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

Function decodeSchema

packages/effect/src/unstable/encoding/Sse.ts:175–196  ·  view source on GitHub ↗
(
  schema: S,
  options?: DecodeOptions
)

Source from the content-addressed store, hash-verified

173 * @since 4.0.0
174 */
175export const decodeSchema = <
176 S extends EventCodec,
177 IE,
178 Done
179>(
180 schema: S,
181 options?: DecodeOptions
182): Channel.Channel<
183 NonEmptyReadonlyArray<S["Type"]>,
184 IE | Retry | SseError | Schema.SchemaError,
185 Done,
186 NonEmptyReadonlyArray<string>,
187 IE,
188 Done,
189 S["DecodingServices"]
190> =>
191 Channel.pipeTo(
192 decode<IE, Done>(options),
193 ChannelSchema.decode(EventEncoded.pipe(
194 Schema.decodeTo(schema)
195 ))()
196 )
197
198/**
199 * Creates an SSE decoder channel that JSON-decodes each event `data` field with a schema.

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected