(source: any)
| 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) { |
no test coverage detected