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

Function projectHandler

packages/vue/src/makeClient.ts:84–99  ·  view source on GitHub ↗
(
  handler: (i: I) => Effect.Effect<A, E, R>,
  successSchema: SuccessSchema,
  projectionSchema: ProjSchema
)

Source from the content-addressed store, hash-verified

82
83// TODO: optimize - work from encoded shape directly
84const projectHandler = <
85 I,
86 A,
87 E,
88 R,
89 SuccessSchema extends S.Top & { readonly "EncodingServices": R },
90 ProjSchema extends S.Top & { readonly "DecodingServices": R }
91>(
92 handler: (i: I) => Effect.Effect<A, E, R>,
93 successSchema: SuccessSchema,
94 projectionSchema: ProjSchema
95) => {
96 const encode = S.encodeUnknownEffect(successSchema)
97 const decode = S.decodeUnknownEffect(projectionSchema)
98 return (i: I) => handler(i).pipe(Effect.flatMap(encode), Effect.flatMap(decode))
99}
100
101const projectionSchemaHash = (schema: S.Top) => String(Hash.hash(schema.ast))
102

Callers 2

projectQueryForFunction · 0.85
makeProjectedMutationFunction · 0.85

Calls 2

pipeMethod · 0.65
handlerFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…