MCPcopy Create free account
hub / github.com/effect-app/libs / buildEffect

Function buildEffect

packages/effect-app/src/client/apiClientFactory.ts:300–318  ·  view source on GitHub ↗
(input: any)

Source from the content-addressed store, hash-verified

298 const isStream = h.stream
299
300 const buildEffect = (input: any) =>
301 mr.contextEffect.pipe(
302 Effect.flatMap((svcs) => {
303 const rpcEffect = TheClient
304 .use((client) => (client as any)[requestAttr]!(Request.make(input)) as Effect.Effect<any, any>)
305 .pipe(
306 // local: true → isolate to this RPC call. `layers` is pure today
307 // (RequestName + caller-supplied requestLevelLayers), but the
308 // flag prevents a stateful caller-supplied layer from leaking
309 // across RPC calls via the ambient fiber MemoMap.
310 Effect.provide(layers, { local: true }),
311 Effect.provide(svcs)
312 )
313 return isCommand ? unwrapCommand(rpcEffect) : isStream ? rpcEffect : unwrapQuery(rpcEffect)
314 }),
315 // Forwarding the server's dependency metadata needs a recorder in scope. A parent
316 // query/command (vue) provides one; a top-level call gets a fresh per-request one.
317 DataDependencies.ensureDataDependencyRecorder
318 )
319
320 const buildStream = (input: any) => {
321 const stream = Stream.unwrap(

Callers 1

Calls 6

unwrapCommandFunction · 0.85
unwrapQueryFunction · 0.85
pipeMethod · 0.65
useMethod · 0.65
makeMethod · 0.65
provideMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…