MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeSseDecoder

Function makeSseDecoder

packages/effect/src/unstable/httpapi/HttpApiClient.ts:892–903  ·  view source on GitHub ↗
(
  declaration: HttpApiSchema.StreamSse<Sse.EventCodec, Schema.Constraint, unknown>
)

Source from the content-addressed store, hash-verified

890}
891
892function makeSseDecoder(
893 declaration: HttpApiSchema.StreamSse<Sse.EventCodec, Schema.Constraint, unknown>
894) {
895 const Event = Schema.Union([
896 Schema.Struct({
897 event: Schema.Literal(reservedStreamFailureEvent),
898 data: Schema.fromJsonString(Schema.toCodecJson(Schema.Cause(declaration.error, Schema.Defect())))
899 }),
900 declaration.events
901 ])
902 return Sse.decodeSchema(Event)
903}
904
905function decodeSseStream(
906 stream: Stream.Stream<Uint8Array, HttpClientError.HttpClientError>,

Callers 1

streamToResponseFunction · 0.85

Calls 1

toCodecJsonMethod · 0.45

Tested by

no test coverage detected