MCPcopy Index your code
hub / github.com/TanStack/ai / parseChunkSummaries

Function parseChunkSummaries

testing/e2e/tests/structured-output-middleware.spec.ts:63–80  ·  view source on GitHub ↗
(raw: string | null)

Source from the content-addressed store, hash-verified

61}
62
63function parseChunkSummaries(raw: string | null): Array<{ type: string }> {
64 if (!raw) return []
65 let parsed: unknown
66 try {
67 parsed = JSON.parse(raw)
68 } catch {
69 return []
70 }
71 if (!Array.isArray(parsed)) return []
72 const result: Array<{ type: string }> = []
73 for (const entry of parsed) {
74 if (!entry || typeof entry !== 'object') continue
75 const inner: Record<string, unknown> = { ...entry }
76 const t = inner.type
77 if (typeof t === 'string') result.push({ type: t })
78 }
79 return result
80}
81
82test.describe('Structured Output × Middleware Coverage', () => {
83 test('legacy finalization path: middleware observes structuredOutput phase chunks (claude-3-7-sonnet)', async ({

Calls 2

parseMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected