( handler: (i: I) => Effect.Effect<A, E, R>, successSchema: SuccessSchema, projectionSchema: ProjSchema )
| 82 | |
| 83 | // TODO: optimize - work from encoded shape directly |
| 84 | const 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 | |
| 101 | const projectionSchemaHash = (schema: S.Top) => String(Hash.hash(schema.ast)) |
| 102 |
no test coverage detected
searching dependent graphs…