mirror of
https://github.com/morluto/rea.git
synced 2026-10-28 02:15:44 +00:00
refactor(javascript): reuse parsed semantic query contracts
This commit is contained in:
1 parent
db2a3174f6
commit
0b17cb621d
5 files changed
+112
-34
No files matched your search
@@ -38,8 +38,17 @@ interface QueryResult {
|
||||
export const queryJavaScriptSemanticGraph = (
|
||||
graph: JavaScriptSemanticGraph,
|
||||
rawInput: unknown,
|
||||
): JavaScriptSemanticQueryResult =>
|
||||
queryJavaScriptSemanticGraphValidated(
|
||||
graph,
|
||||
javaScriptSemanticQueryInputSchema.parse(rawInput),
|
||||
);
|
||||
|
||||
/** Run a query already parsed by its owning request boundary. */
|
||||
export const queryJavaScriptSemanticGraphValidated = (
|
||||
graph: JavaScriptSemanticGraph,
|
||||
input: JavaScriptSemanticQueryInput,
|
||||
): JavaScriptSemanticQueryResult => {
|
||||
const input = javaScriptSemanticQueryInputSchema.parse(rawInput);
|
||||
const queryId = queryIdentifier(graph, input);
|
||||
const seeds = resolveSeeds(graph, input);
|
||||
const nodes = new Map(graph.nodes.map((node) => [node.node_id, node]));
|
||||
|
||||
Reference in new issue
Block a user