MCPcopy Index your code
hub / github.com/TanStack/db / extractFromSource

Function extractFromSource

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

Source from the content-addressed store, hash-verified

23
24 // Helper function to recursively extract collections from a query or source
25 function extractFromSource(source: any) {
26 if (source.type === `collectionRef`) {
27 collections[source.collection.id] = source.collection
28 } else if (source.type === `queryRef`) {
29 // Recursively extract from subquery
30 extractFromQuery(source.query)
31 } else if (source.type === `unionFrom`) {
32 for (const childSource of source.sources) {
33 extractFromSource(childSource)
34 }
35 } else if (source.type === `unionAll`) {
36 for (const branch of source.queries) {
37 extractFromQuery(branch)
38 }
39 }
40 }
41
42 // Helper function to recursively extract collections from a query
43 function extractFromQuery(q: any) {

Callers 1

extractFromQueryFunction · 0.85

Calls 1

extractFromQueryFunction · 0.85

Tested by

no test coverage detected