MCPcopy Create free account
hub / github.com/Effect-TS/effect / register

Function register

packages/effect/src/ui/Query.ts:5369–5399  ·  view source on GitHub ↗
(def: QueryDef)

Source from the content-addressed store, hash-verified

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()) {

Callers 11

watchFunction · 0.70
peekFunction · 0.70
getFunction · 0.70
prefetchFunction · 0.70
registerTargetsFunction · 0.70
applyWritesFunction · 0.70
beginRunFunction · 0.70
seedFunction · 0.70
buildCacheFunction · 0.70
asyncPauseResumeFunction · 0.50
McpServer.tsFile · 0.50

Calls 7

decodeRawFunction · 0.85
reportFunction · 0.70
quoteFunction · 0.70
getMethod · 0.65
setMethod · 0.65
hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected