MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / validateCounts

Function validateCounts

graph-ui/src/provider/compact-rows.ts:212–222  ·  view source on GitHub ↗
(parsed: CompactRows | SearchResults)

Source from the content-addressed store, hash-verified

210}
211
212function validateCounts(parsed: CompactRows | SearchResults): void {
213 for (const value of [parsed.total, parsed.returned, 'offset' in parsed ? parsed.offset : undefined,
214 'nextOffset' in parsed ? parsed.nextOffset : undefined]) {
215 if (value !== undefined && (!Number.isSafeInteger(value) || value < 0))
216 throw new Error('Invalid compact response count');
217 }
218 if (parsed.total < parsed.rows.length || (parsed.returned !== undefined && parsed.returned !== parsed.rows.length))
219 throw new Error('Compact response counts contradict returned rows');
220 if (parsed.totalRelation !== undefined && parsed.totalRelation !== 'eq' && parsed.totalRelation !== 'gte')
221 throw new Error('Unknown total_relation');
222}
223
224/**
225 * Parst die Zeilenform (`rows:` / Datenzeilen / `total:` / optional `hint:`).

Callers 2

parseCompactRowsFunction · 0.85
parseSearchResultsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected