| 468 | * @since 4.0.0 |
| 469 | */ |
| 470 | export const encodeSchema = < |
| 471 | S extends EventCodec, |
| 472 | IE, |
| 473 | Done |
| 474 | >(schema: S): Channel.Channel< |
| 475 | NonEmptyReadonlyArray<string>, |
| 476 | IE | Schema.SchemaError, |
| 477 | void, |
| 478 | NonEmptyReadonlyArray<S["Type"]>, |
| 479 | IE | Retry, |
| 480 | Done, |
| 481 | S["EncodingServices"] |
| 482 | > => |
| 483 | ChannelSchema.encode(Event.pipe( |
| 484 | Schema.decodeTo(schema, transformEvent) |
| 485 | ))<IE | Retry, Done>().pipe( |
| 486 | Channel.pipeTo(encode()) |
| 487 | ) |
| 488 | |
| 489 | /** |
| 490 | * Encoder capable of rendering an `Event` or `Retry` value as Server-Sent |