| 766 | // Decodes framed values in order. On a failure, values decoded before it |
| 767 | // are emitted first and the error fails the next pull. |
| 768 | const decodeAll = ( |
| 769 | raw: ReadonlyArray<unknown> |
| 770 | ): Pull.Pull<Arr.NonEmptyReadonlyArray<S["Type"]>, Schema.SchemaError | IE, Done> => { |
| 771 | const out: Array<S["Type"]> = [] |
| 772 | const loop: Effect.Effect<Arr.NonEmptyReadonlyArray<S["Type"]>, Schema.SchemaError> = Effect.suspend(() => |
| 773 | out.length === raw.length |
| 774 | ? Effect.succeed(out as unknown as Arr.NonEmptyReadonlyArray<S["Type"]>) |
| 775 | : Effect.flatMap(decodeEncoded!(raw[out.length]), (value) => { |
| 776 | out.push(value as S["Type"]) |
| 777 | return loop |
| 778 | }) |
| 779 | ) |
| 780 | return Effect.catch(loop, (error) => { |
| 781 | if (out.length === 0) { |
| 782 | stashed = undefined |
| 783 | return Effect.fail(error) |
| 784 | } |
| 785 | stashed = error |
| 786 | return Effect.succeed(out as unknown as Arr.NonEmptyReadonlyArray<S["Type"]>) |
| 787 | }) |
| 788 | } |
| 789 | |
| 790 | const feed = ( |
| 791 | chunk: Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>> |