MCPcopy Create free account
hub / github.com/codemix/graph / parseQueryToSteps

Function parseQueryToSteps

packages/graph/src/index.ts:145–160  ·  view source on GitHub ↗
(
  queryString: string,
  options?: ParseQueryToStepsOptions,
)

Source from the content-addressed store, hash-verified

143 * @param options.readonly When true, throws ReadonlyGraphError if the query contains mutation steps.
144 */
145export function parseQueryToSteps(
146 queryString: string,
147 options?: ParseQueryToStepsOptions,
148): {
149 steps: readonly Step<any>[];
150 postprocess: (row: readonly unknown[]) => Record<string, unknown>;
151} {
152 const ast = parse(queryString) as Query | UnionQuery | MultiStatement;
153 const steps = anyAstToSteps(ast);
154
155 if (options?.readonly) {
156 validateNoMutations(steps);
157 }
158
159 return { steps, postprocess: createPostprocessor(ast) };
160}
161
162/**
163 * Creates a function which takes the array of values returned by the graph traversal

Callers 4

index.test.tsFile · 0.85

Calls 3

anyAstToStepsFunction · 0.85
validateNoMutationsFunction · 0.85
createPostprocessorFunction · 0.85

Tested by

no test coverage detected