MCPcopy Index your code
hub / github.com/Effect-TS/effect / Stream

Function Stream

packages/rpc/src/RpcSchema.ts:63–93  ·  view source on GitHub ↗
(
  { failure, success }: {
    readonly failure: E
    readonly success: A
  }
)

Source from the content-addressed store, hash-verified

61 * @category Stream
62 */
63export const Stream = <A extends Schema.Schema.Any, E extends Schema.Schema.All>(
64 { failure, success }: {
65 readonly failure: E
66 readonly success: A
67 }
68): Stream<A, E> =>
69 Object.assign(
70 Schema.declare(
71 [success, failure],
72 {
73 decode: (success, failure) =>
74 parseStream(
75 ParseResult.decodeUnknown(Schema.ChunkFromSelf(success)),
76 ParseResult.decodeUnknown(failure)
77 ),
78 encode: (success, failure) =>
79 parseStream(
80 ParseResult.encodeUnknown(Schema.ChunkFromSelf(success)),
81 ParseResult.encodeUnknown(failure)
82 )
83 },
84 {
85 schemaId: StreamSchemaId,
86 [StreamSchemaId]: { success, failure }
87 }
88 ),
89 {
90 success,
91 failure
92 }
93 )
94
95const isStream = (u: unknown): u is Stream_.Stream<unknown, unknown> => hasProperty(u, Stream_.StreamTypeId)
96

Callers

nothing calls this directly

Calls 1

parseStreamFunction · 0.85

Tested by

no test coverage detected