(id: string, value: any)
| 67 | } |
| 68 | |
| 69 | export function serializeToJSStream(id: string, value: any) { |
| 70 | return new ReadableStream({ |
| 71 | start(controller) { |
| 72 | crossSerializeStream(value, { |
| 73 | scopeId: id, |
| 74 | plugins: DEFAULT_PLUGINS, |
| 75 | onSerialize(data: string, initial: boolean) { |
| 76 | controller.enqueue( |
| 77 | createChunk(initial ? `(${getCrossReferenceHeader(id)},${data})` : data), |
| 78 | ); |
| 79 | }, |
| 80 | onDone() { |
| 81 | controller.close(); |
| 82 | }, |
| 83 | onError(error: any) { |
| 84 | controller.error(error); |
| 85 | }, |
| 86 | }); |
| 87 | }, |
| 88 | }); |
| 89 | } |
| 90 | |
| 91 | export function serializeToJSONStream(value: any) { |
| 92 | return new ReadableStream({ |
no outgoing calls
no test coverage detected
searching dependent graphs…