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

Function decodeSchema

packages/effect/src/encoding/Sse.ts:198–223  ·  view source on GitHub ↗
(
  schema: S,
  options?: DecodeOptions,
  parseOptions?: SchemaAST.ParseOptions
)

Source from the content-addressed store, hash-verified

196 * @since 4.0.0
197 */
198export const decodeSchema = <
199 S extends EventCodec,
200 IE,
201 Done
202>(
203 schema: S,
204 options?: DecodeOptions,
205 parseOptions?: SchemaAST.ParseOptions
206): Channel.Channel<
207 NonEmptyReadonlyArray<S["Type"]>,
208 IE | Retry | SseError | Schema.SchemaError,
209 Done,
210 NonEmptyReadonlyArray<string>,
211 IE,
212 Done,
213 S["DecodingServices"]
214> =>
215 Channel.pipeTo(
216 decode<IE, Done>(options),
217 ChannelSchema.decode(
218 Event.pipe(
219 Schema.decodeTo(schema, transformEvent)
220 ),
221 parseOptions
222 )()
223 )
224
225/**
226 * Creates an SSE decoder channel that JSON-decodes each event `data` field with a schema.

Callers

nothing calls this directly

Calls 3

decodeFunction · 0.70
pipeMethod · 0.65
decodeMethod · 0.45

Tested by

no test coverage detected