| 96 | * @since 4.0.0 |
| 97 | */ |
| 98 | export const decode = <S extends Schema.Constraint>( |
| 99 | schema: S |
| 100 | ) => |
| 101 | <IE = never, Done = unknown>(): Channel.Channel< |
| 102 | Arr.NonEmptyReadonlyArray<S["Type"]>, |
| 103 | IE | Schema.SchemaError, |
| 104 | Done, |
| 105 | Arr.NonEmptyReadonlyArray<S["Encoded"]>, |
| 106 | IE, |
| 107 | Done, |
| 108 | S["DecodingServices"] |
| 109 | > => { |
| 110 | const decode = Schema.decodeEffect(Schema.NonEmptyArray(schema)) |
| 111 | return Channel.fromTransform((upstream, _scope) => Effect.succeed(Effect.flatMap(upstream, (chunk) => decode(chunk)))) |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Creates a `decode` channel variant for schema-decoding channel boundaries. |