flowquery 1.0.48 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compute/runner.d.ts +12 -1
- package/dist/compute/runner.d.ts.map +1 -1
- package/dist/compute/runner.js +32 -4
- package/dist/compute/runner.js.map +1 -1
- package/dist/flowquery.min.js +1 -1
- package/dist/graph/database.d.ts +5 -0
- package/dist/graph/database.d.ts.map +1 -1
- package/dist/graph/database.js +19 -3
- package/dist/graph/database.js.map +1 -1
- package/dist/graph/physical_node.d.ts +1 -1
- package/dist/graph/physical_node.d.ts.map +1 -1
- package/dist/graph/physical_node.js +2 -2
- package/dist/graph/physical_node.js.map +1 -1
- package/dist/graph/physical_relationship.d.ts +1 -1
- package/dist/graph/physical_relationship.d.ts.map +1 -1
- package/dist/graph/physical_relationship.js +2 -2
- package/dist/graph/physical_relationship.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/parsing/expressions/parameter_reference.d.ts +39 -0
- package/dist/parsing/expressions/parameter_reference.d.ts.map +1 -0
- package/dist/parsing/expressions/parameter_reference.js +56 -0
- package/dist/parsing/expressions/parameter_reference.js.map +1 -0
- package/dist/parsing/operations/match.d.ts +28 -0
- package/dist/parsing/operations/match.d.ts.map +1 -1
- package/dist/parsing/operations/match.js +100 -0
- package/dist/parsing/operations/match.js.map +1 -1
- package/dist/parsing/parser.d.ts.map +1 -1
- package/dist/parsing/parser.js +15 -0
- package/dist/parsing/parser.js.map +1 -1
- package/dist/parsing/parser_state.d.ts +3 -0
- package/dist/parsing/parser_state.d.ts.map +1 -1
- package/dist/parsing/parser_state.js +7 -0
- package/dist/parsing/parser_state.js.map +1 -1
- package/dist/tokenization/string_walker.d.ts +1 -0
- package/dist/tokenization/string_walker.d.ts.map +1 -1
- package/dist/tokenization/string_walker.js +7 -0
- package/dist/tokenization/string_walker.js.map +1 -1
- package/dist/tokenization/tokenizer.d.ts.map +1 -1
- package/dist/tokenization/tokenizer.js +3 -1
- package/dist/tokenization/tokenizer.js.map +1 -1
- package/package.json +1 -1
package/dist/compute/runner.d.ts
CHANGED
|
@@ -15,13 +15,17 @@ import ASTNode from "../parsing/ast_node";
|
|
|
15
15
|
declare class Runner {
|
|
16
16
|
private first;
|
|
17
17
|
private last;
|
|
18
|
+
private _args;
|
|
19
|
+
private _ast;
|
|
18
20
|
/**
|
|
19
21
|
* Creates a new Runner instance and parses the FlowQuery statement.
|
|
20
22
|
*
|
|
21
23
|
* @param statement - The FlowQuery statement to execute
|
|
24
|
+
* @param ast - An optional pre-parsed AST to use instead of parsing the statement
|
|
25
|
+
* @param args - Optional parameters to inject into $-prefixed parameter references
|
|
22
26
|
* @throws {Error} If the statement is null, empty, or contains syntax errors
|
|
23
27
|
*/
|
|
24
|
-
constructor(statement?: string | null, ast?: ASTNode | null);
|
|
28
|
+
constructor(statement?: string | null, ast?: ASTNode | null, args?: Record<string, any> | null);
|
|
25
29
|
/**
|
|
26
30
|
* Executes the parsed FlowQuery statement.
|
|
27
31
|
*
|
|
@@ -29,6 +33,13 @@ declare class Runner {
|
|
|
29
33
|
* @throws {Error} If an error occurs during execution
|
|
30
34
|
*/
|
|
31
35
|
run(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Recursively walks the AST to bind ParameterReference nodes
|
|
38
|
+
* to the args provided to this Runner.
|
|
39
|
+
* - $args resolves to the entire args map (for use with $args.key lookups)
|
|
40
|
+
* - $name resolves to args["name"] (shorthand for individual properties)
|
|
41
|
+
*/
|
|
42
|
+
private bindParameters;
|
|
32
43
|
/**
|
|
33
44
|
* Gets the results from the executed statement.
|
|
34
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAK1C;;;;;;;;;;;;GAYG;AACH,cAAM,MAAM;IACR,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,IAAI,CAAY;IACxB,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,IAAI,CAAU;IAEtB;;;;;;;OAOG;gBAEC,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,GAAG,GAAE,OAAO,GAAG,IAAW,EAC1B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAW;IAW3C;;;;;OAKG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAcjC;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAetB;;;;OAIG;IACH,IAAW,OAAO,IAAI,GAAG,CAExB;CACJ;AAED,eAAe,MAAM,CAAC"}
|
package/dist/compute/runner.js
CHANGED
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const parameter_reference_1 = __importDefault(require("../parsing/expressions/parameter_reference"));
|
|
15
16
|
const parser_1 = __importDefault(require("../parsing/parser"));
|
|
16
17
|
/**
|
|
17
18
|
* Executes a FlowQuery statement and retrieves the results.
|
|
@@ -31,15 +32,19 @@ class Runner {
|
|
|
31
32
|
* Creates a new Runner instance and parses the FlowQuery statement.
|
|
32
33
|
*
|
|
33
34
|
* @param statement - The FlowQuery statement to execute
|
|
35
|
+
* @param ast - An optional pre-parsed AST to use instead of parsing the statement
|
|
36
|
+
* @param args - Optional parameters to inject into $-prefixed parameter references
|
|
34
37
|
* @throws {Error} If the statement is null, empty, or contains syntax errors
|
|
35
38
|
*/
|
|
36
|
-
constructor(statement = null, ast = null) {
|
|
39
|
+
constructor(statement = null, ast = null, args = null) {
|
|
40
|
+
this._args = null;
|
|
37
41
|
if ((statement === null || statement === "") && ast === null) {
|
|
38
42
|
throw new Error("Either statement or AST must be provided");
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
44
|
+
this._ast = ast !== null ? ast : new parser_1.default().parse(statement);
|
|
45
|
+
this._args = args;
|
|
46
|
+
this.first = this._ast.firstChild();
|
|
47
|
+
this.last = this._ast.lastChild();
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Executes the parsed FlowQuery statement.
|
|
@@ -51,6 +56,7 @@ class Runner {
|
|
|
51
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
57
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
53
58
|
try {
|
|
59
|
+
this.bindParameters(this._ast);
|
|
54
60
|
yield this.first.initialize();
|
|
55
61
|
yield this.first.run();
|
|
56
62
|
yield this.first.finish();
|
|
@@ -62,6 +68,28 @@ class Runner {
|
|
|
62
68
|
}));
|
|
63
69
|
});
|
|
64
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Recursively walks the AST to bind ParameterReference nodes
|
|
73
|
+
* to the args provided to this Runner.
|
|
74
|
+
* - $args resolves to the entire args map (for use with $args.key lookups)
|
|
75
|
+
* - $name resolves to args["name"] (shorthand for individual properties)
|
|
76
|
+
*/
|
|
77
|
+
bindParameters(node) {
|
|
78
|
+
var _a;
|
|
79
|
+
if (node instanceof parameter_reference_1.default) {
|
|
80
|
+
const args = (_a = this._args) !== null && _a !== void 0 ? _a : {};
|
|
81
|
+
const key = node.name.startsWith("$") ? node.name.substring(1) : node.name;
|
|
82
|
+
if (key === "args") {
|
|
83
|
+
node.parameterValue = args;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
node.parameterValue = key in args ? args[key] : null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const child of node.getChildren()) {
|
|
90
|
+
this.bindParameters(child);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
65
93
|
/**
|
|
66
94
|
* Gets the results from the executed statement.
|
|
67
95
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,qGAA4E;AAE5E,+DAAuC;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM;IAMR;;;;;;;OAOG;IACH,YACI,YAA2B,IAAI,EAC/B,MAAsB,IAAI,EAC1B,OAAmC,IAAI;QAdnC,UAAK,GAA+B,IAAI,CAAC;QAgB7C,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,EAAE,CAAC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,gBAAM,EAAE,CAAC,KAAK,CAAC,SAAU,CAAC,CAAC;QAChE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAe,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAe,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACU,GAAG;;YACZ,OAAO,IAAI,OAAO,CAAO,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC/C,IAAI,CAAC;oBACD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC/B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;oBAC9B,MAAM,IAAI,CAAC,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