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

Function listCheckPage

packages/effect/src/ui/Query.ts:4738–4763  ·  view source on GitHub ↗
(
  env: CacheEnv,
  def: QueryDef,
  logKey: () => string,
  page: unknown
)

Source from the content-addressed store, hash-verified

4736})
4737
4738const listCheckPage = (
4739 env: CacheEnv,
4740 def: QueryDef,
4741 logKey: () => string,
4742 page: unknown
4743): void => {
4744 const list = def.list!
4745 const seen = new Set<string>()
4746 for (const item of list.items(page)) {
4747 const key = list.key(item)
4748 if (!seen.has(key)) {
4749 seen.add(key)
4750 continue
4751 }
4752 const at = logKey()
4753 env.report(
4754 new DuplicateKeyInPage({
4755 query: def.name,
4756 logKey: at,
4757 message: "[Query] a page of " + quote(def.name) + " at " + at +
4758 " holds two items with one key. The first is kept."
4759 })
4760 )
4761 return
4762 }
4763}
4764
4765const listWalk = (
4766 env: CacheEnv,

Callers 1

stepFunction · 0.85

Calls 7

logKeyFunction · 0.85
quoteFunction · 0.70
itemsMethod · 0.65
keyMethod · 0.65
hasMethod · 0.65
addMethod · 0.65
reportMethod · 0.65

Tested by

no test coverage detected