( query: QueryIR, outerAlias: string, expr: unknown, )
| 78 | } |
| 79 | |
| 80 | function getTargetsFromQueryRef( |
| 81 | query: QueryIR, |
| 82 | outerAlias: string, |
| 83 | expr: unknown, |
| 84 | ): Array<LazyLoadTarget> { |
| 85 | if (!expr || typeof expr !== `object` || !(`type` in expr)) { |
| 86 | return [] |
| 87 | } |
| 88 | |
| 89 | const expression = expr as BasicExpression |
| 90 | if (expression.type === `func` && expression.name === `coalesce`) { |
| 91 | return dedupeLazyLoadTargets( |
| 92 | expression.args.flatMap((arg) => |
| 93 | getTargetsFromQueryRef(query, outerAlias, arg), |
| 94 | ), |
| 95 | ) |
| 96 | } |
| 97 | |
| 98 | const ref = toPropRef(expression) |
| 99 | if (!ref || ref.path[0] !== outerAlias) { |
| 100 | return [] |
| 101 | } |
| 102 | |
| 103 | return getTargetsFromPropRef(query, new PropRef(ref.path.slice(1))) |
| 104 | } |
| 105 | |
| 106 | function getTargetsFromExpression( |
| 107 | query: QueryIR, |
no test coverage detected