(id: string)
| 90 | }; |
| 91 | |
| 92 | function makeStream(id: string): ReadableStream<ExecEvent> { |
| 93 | return new ReadableStream<ExecEvent>({ |
| 94 | start(c) { |
| 95 | for (const e of events) c.enqueue({ ...e, id }); |
| 96 | if (options.streamError !== undefined) { |
| 97 | c.error(options.streamError); |
| 98 | return; |
| 99 | } |
| 100 | c.close(); |
| 101 | }, |
| 102 | }); |
| 103 | } |
| 104 | |
| 105 | const sync: SyncRPC = { |
| 106 | async push() { |