(rpc: Rpc.AnyWithProps)
| 780 | (chunk: ReadonlyArray<unknown>) => Effect.Effect<NonEmptyReadonlyArray<any>, Schema.SchemaError, unknown> |
| 781 | > |
| 782 | readonly encodePayload: (payload: any) => Effect.Effect<any, Schema.SchemaError, unknown> |
| 783 | readonly decodeExit: (encoded: unknown) => Effect.Effect<Exit.Exit<any, any>, Schema.SchemaError, unknown> |
| 784 | } |
| 785 | const rpcSchemasCache = new WeakMap<Rpc.AnyWithProps, RpcSchemas>() |
| 786 | const rpcSchemas = (rpc: Rpc.AnyWithProps) => { |
| 787 | let entry = rpcSchemasCache.get(rpc) |
| 788 | if (entry !== undefined) { |
| 789 | return entry |
| 790 | } |
| 791 | const streamSchemas = RpcSchema.getStreamSchemas(rpc.successSchema) |
| 792 | entry = { |
| 793 | decodeChunk: Option.map( |
| 794 | streamSchemas, |
| 795 | (streamSchemas) => Schema.decodeUnknownEffect(Schema.toCodecJson(Schema.NonEmptyArray(streamSchemas.success))) |
| 796 | ), |
| 797 | encodePayload: Schema.encodeEffect(Schema.toCodecJson(rpc.payloadSchema)), |
| 798 | decodeExit: Schema.decodeUnknownEffect(Schema.toCodecJson(Rpc.exitSchema(rpc as any))) |
| 799 | } |
| 800 | rpcSchemasCache.set(rpc, entry) |
| 801 | return entry |
no test coverage detected
searching dependent graphs…