* A top-level fetch method that compiles a query and executes it.
(query: PreparedQuery, vars: any = {})
| 80 | * A top-level fetch method that compiles a query and executes it. |
| 81 | */ |
| 82 | async fetch(query: PreparedQuery, vars: any = {}): Promise<ViewEntity[]> { |
| 83 | const compiledPlan = compileQuery(structuredClone(query)); |
| 84 | const results = await this.executeSteps(compiledPlan.steps, { |
| 85 | vars, |
| 86 | viewPlans: compiledPlan.views, |
| 87 | }); |
| 88 | if (Array.isArray(results)) { |
| 89 | return results; |
| 90 | } |
| 91 | throw new InvalidResultCardinalityError('many', 'one'); |
| 92 | } |
| 93 | |
| 94 | private async executeSteps( |
| 95 | steps: Step[], |
no test coverage detected