(parsed: CompactRows | SearchResults)
| 210 | } |
| 211 | |
| 212 | function 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:`). |
no outgoing calls
no test coverage detected