* Determines if a source alias refers to a collection reference (not a subquery). * This is used to identify WHERE clauses that can be pushed down to collection subscriptions. * * @param query - The query to analyze * @param sourceAlias - The source alias to check * @returns True if the alias r
(query: QueryIR, sourceAlias: string)
| 294 | * @returns True if the alias refers to a collection reference |
| 295 | */ |
| 296 | function isCollectionReference(query: QueryIR, sourceAlias: string): boolean { |
| 297 | // Check the FROM clause |
| 298 | for (const source of getFromSources(query.from)) { |
| 299 | if (source.alias === sourceAlias) { |
| 300 | return source.type === `collectionRef` |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | // Check JOIN clauses |
| 305 | if (query.join) { |
| 306 | for (const joinClause of query.join) { |
| 307 | if (joinClause.from.alias === sourceAlias) { |
| 308 | return joinClause.from.type === `collectionRef` |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | return false |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Returns the set of source aliases that are on the nullable side of outer joins. |
no test coverage detected