| 34 | * @since 4.0.0 |
| 35 | */ |
| 36 | export const encode = <S extends Schema.Constraint>( |
| 37 | schema: S |
| 38 | ) => |
| 39 | <IE = never, Done = unknown>(): Channel.Channel< |
| 40 | Arr.NonEmptyReadonlyArray<S["Encoded"]>, |
| 41 | IE | Schema.SchemaError, |
| 42 | Done, |
| 43 | Arr.NonEmptyReadonlyArray<S["Type"]>, |
| 44 | IE, |
| 45 | Done, |
| 46 | S["EncodingServices"] |
| 47 | > => { |
| 48 | const encode = Schema.encodeEffect(Schema.NonEmptyArray(schema)) |
| 49 | return Channel.fromTransform((upstream, _scope) => Effect.succeed(Effect.flatMap(upstream, (chunk) => encode(chunk)))) |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Creates an `encode` channel variant whose encoded output chunks are typed as |