MCPcopy Create free account
hub / github.com/TanStack/db / recordAlias

Function recordAlias

packages/db/src/query/live/utils.ts:157–179  ·  view source on GitHub ↗
(source: any)

Source from the content-addressed store, hash-verified

155 const aliasesById = new Map<string, Set<string>>()
156
157 function recordAlias(source: any) {
158 if (!source) return
159
160 if (source.type === `collectionRef`) {
161 const { id } = source.collection
162 const existing = aliasesById.get(id)
163 if (existing) {
164 existing.add(source.alias)
165 } else {
166 aliasesById.set(id, new Set([source.alias]))
167 }
168 } else if (source.type === `queryRef`) {
169 traverse(source.query)
170 } else if (source.type === `unionFrom`) {
171 for (const childSource of source.sources) {
172 recordAlias(childSource)
173 }
174 } else if (source.type === `unionAll`) {
175 for (const branch of source.queries) {
176 traverse(branch)
177 }
178 }
179 }
180
181 function traverseSelect(select: any) {
182 for (const [key, value] of Object.entries(select)) {

Callers 1

traverseFunction · 0.85

Calls 4

traverseFunction · 0.85
getMethod · 0.45
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected