(def: QueryDef)
| 5367 | // -- registry and index ----------------------------------------------------- |
| 5368 | /** First wins: the first definition under a name pins everything about the query. */ |
| 5369 | const register = (def: QueryDef): QueryDef => { |
| 5370 | const existing = queries.get(def.name) |
| 5371 | if (existing === undefined) { |
| 5372 | queries.set(def.name, def) |
| 5373 | if ( |
| 5374 | !settleOnce && reactivity === undefined && |
| 5375 | def.reactivityKeys !== undefined |
| 5376 | ) { |
| 5377 | report( |
| 5378 | new ReactivityMissing({ |
| 5379 | query: def.name, |
| 5380 | message: "[Query] " + quote(def.name) + |
| 5381 | " declares reactivityKeys, but no Reactivity service is in the cache's context." |
| 5382 | }) |
| 5383 | ) |
| 5384 | } |
| 5385 | decodeRaw(def) |
| 5386 | return def |
| 5387 | } |
| 5388 | if (existing !== def && !duplicates.has(def)) { |
| 5389 | duplicates.add(def) |
| 5390 | report( |
| 5391 | new DuplicateName({ |
| 5392 | query: def.name, |
| 5393 | message: "[Query] a second query named " + quote(def.name) + |
| 5394 | " was registered in one cache. The first definition wins." |
| 5395 | }) |
| 5396 | ) |
| 5397 | } |
| 5398 | return existing |
| 5399 | } |
| 5400 | const allEntries = (): Array<Entry> => { |
| 5401 | const out: Array<Entry> = [] |
| 5402 | for (const byKey of index.values()) { |
no test coverage detected