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

Function middlewareDecoding

packages/effect/src/Schema.ts:5305–5316  ·  view source on GitHub ↗
(
  decode: (
    effect: Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, S["DecodingServices"]>,
    options: SchemaAST.ParseOptions
  ) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, RD>
)

Source from the content-addressed store, hash-verified

5303 * @since 4.0.0
5304 */
5305export function middlewareDecoding<S extends Constraint, RD>(
5306 decode: (
5307 effect: Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, S["DecodingServices"]>,
5308 options: SchemaAST.ParseOptions
5309 ) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, RD>
5310) {
5311 return (schema: S): middlewareDecoding<S, RD> =>
5312 make(
5313 SchemaAST.middlewareDecoding(schema.ast, new SchemaTransformation.Middleware(decode, identity)),
5314 { schema }
5315 )
5316}
5317
5318/**
5319 * Type-level representation returned by {@link middlewareEncoding}.

Callers 1

catchDecodingWithContextFunction · 0.70

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected