MCPcopy Index your code
hub / github.com/aspen-cloud/triplit / fetch

Method fetch

packages/db/src/query-engine.ts:82–92  ·  view source on GitHub ↗

* A top-level fetch method that compiles a query and executes it.

(query: PreparedQuery, vars: any = {})

Source from the content-addressed store, hash-verified

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[],

Callers 4

connectQueryMethod · 0.95
fetchMethod · 0.95
rawFetchMethod · 0.95
fetchMethod · 0.95

Calls 2

executeStepsMethod · 0.95
compileQueryFunction · 0.85

Tested by

no test coverage detected