( query: R3QueryMetadata, constantPool: ConstantPool, )
| 65 | } |
| 66 | |
| 67 | export function getQueryPredicate( |
| 68 | query: R3QueryMetadata, |
| 69 | constantPool: ConstantPool, |
| 70 | ): o.Expression { |
| 71 | if (Array.isArray(query.predicate)) { |
| 72 | let predicate: o.Expression[] = []; |
| 73 | query.predicate.forEach((selector: string): void => { |
| 74 | // Each item in predicates array may contain strings with comma-separated refs |
| 75 | // (for ex. 'ref, ref1, ..., refN'), thus we extract individual refs and store them |
| 76 | // as separate array entities |
| 77 | const selectors = selector.split(',').map((token) => o.literal(token.trim())); |
| 78 | predicate.push(...selectors); |
| 79 | }); |
| 80 | return constantPool.getConstLiteral(o.literalArr(predicate), true); |
| 81 | } else { |
| 82 | // The original predicate may have been wrapped in a `forwardRef()` call. |
| 83 | switch (query.predicate.forwardRef) { |
| 84 | case ForwardRefHandling.None: |
| 85 | case ForwardRefHandling.Unwrapped: |
| 86 | return query.predicate.expression; |
| 87 | case ForwardRefHandling.Wrapped: |
| 88 | return o.importExpr(R3.resolveForwardRef).callFn([query.predicate.expression]); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | function getQueryCreateParameters( |
| 94 | query: R3QueryMetadata, |
no test coverage detected