MCPcopy Index your code
hub / github.com/solidjs/solid-start / deserializeJSONStream

Function deserializeJSONStream

packages/start/src/fns/serialization.ts:203–227  ·  view source on GitHub ↗
(response: Response | Request)

Source from the content-addressed store, hash-verified

201}
202
203export async function deserializeJSONStream(response: Response | Request) {
204 if (!response.body) {
205 throw new Error("missing body");
206 }
207 const reader = new SerovalChunkReader(response.body);
208 const result = await reader.next();
209 if (!result.done) {
210 const refs = new Map();
211
212 function interpretChunk(chunk: string): unknown {
213 const value = fromCrossJSON(JSON.parse(chunk) as SerovalNode, {
214 refs,
215 disabledFeatures: DISABLED_FEATURES,
216 depthLimit: MAX_SERIALIZATION_DEPTH_LIMIT,
217 plugins: DEFAULT_PLUGINS,
218 });
219 return value;
220 }
221
222 void reader.drain(interpretChunk);
223
224 return interpretChunk(result.value);
225 }
226 return undefined;
227}
228
229export async function deserializeJSStream(id: string, response: Request | Response) {
230 if (!response.body) {

Callers 2

extractBodyFunction · 0.90

Calls 3

nextMethod · 0.95
drainMethod · 0.95
interpretChunkFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…