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

Function getSourceFromAlias

packages/db/src/query/compiler/lazy-targets.ts:162–182  ·  view source on GitHub ↗
(
  query: QueryIR,
  alias: string,
)

Source from the content-addressed store, hash-verified

160}
161
162function getSourceFromAlias(
163 query: QueryIR,
164 alias: string,
165): CollectionRef | QueryRef | undefined {
166 if (query.join) {
167 for (const join of query.join) {
168 if (join.from.alias === alias) {
169 return join.from
170 }
171 }
172 }
173
174 const from = query.from
175 const sources =
176 from.type === `unionFrom`
177 ? from.sources
178 : from.type === `unionAll`
179 ? []
180 : [from]
181 return sources.find((source) => source.alias === alias)
182}
183
184function dedupeLazyLoadTargets(
185 targets: Array<LazyLoadTarget>,

Callers 1

getTargetsFromPropRefFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected