flowquery 1.0.68 → 1.0.70
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/README.md +244 -1
- package/dist/compute/runner.d.ts +6 -0
- package/dist/compute/runner.d.ts.map +1 -1
- package/dist/compute/runner.js +26 -0
- package/dist/compute/runner.js.map +1 -1
- package/dist/flowquery.min.js +1 -1
- package/dist/graph/bindings.d.ts +78 -0
- package/dist/graph/bindings.d.ts.map +1 -0
- package/dist/graph/bindings.js +210 -0
- package/dist/graph/bindings.js.map +1 -0
- package/dist/graph/database.d.ts +4 -2
- package/dist/graph/database.d.ts.map +1 -1
- package/dist/graph/database.js +45 -9
- package/dist/graph/database.js.map +1 -1
- package/dist/graph/physical_node.d.ts +9 -0
- package/dist/graph/physical_node.d.ts.map +1 -1
- package/dist/graph/physical_node.js +70 -3
- package/dist/graph/physical_node.js.map +1 -1
- package/dist/graph/physical_relationship.d.ts +9 -0
- package/dist/graph/physical_relationship.d.ts.map +1 -1
- package/dist/graph/physical_relationship.js +70 -3
- package/dist/graph/physical_relationship.js.map +1 -1
- package/dist/parsing/ast_node.d.ts +9 -0
- package/dist/parsing/ast_node.d.ts.map +1 -1
- package/dist/parsing/ast_node.js +21 -4
- package/dist/parsing/ast_node.js.map +1 -1
- package/dist/parsing/expressions/binding_reference.d.ts +16 -0
- package/dist/parsing/expressions/binding_reference.d.ts.map +1 -0
- package/dist/parsing/expressions/binding_reference.js +34 -0
- package/dist/parsing/expressions/binding_reference.js.map +1 -0
- package/dist/parsing/operations/create_node.d.ts +5 -1
- package/dist/parsing/operations/create_node.d.ts.map +1 -1
- package/dist/parsing/operations/create_node.js +12 -2
- package/dist/parsing/operations/create_node.js.map +1 -1
- package/dist/parsing/operations/create_relationship.d.ts +5 -1
- package/dist/parsing/operations/create_relationship.d.ts.map +1 -1
- package/dist/parsing/operations/create_relationship.js +12 -2
- package/dist/parsing/operations/create_relationship.js.map +1 -1
- package/dist/parsing/operations/drop_binding.d.ts +15 -0
- package/dist/parsing/operations/drop_binding.d.ts.map +1 -0
- package/dist/parsing/operations/drop_binding.js +42 -0
- package/dist/parsing/operations/drop_binding.js.map +1 -0
- package/dist/parsing/operations/let.d.ts +36 -0
- package/dist/parsing/operations/let.d.ts.map +1 -0
- package/dist/parsing/operations/let.js +101 -0
- package/dist/parsing/operations/let.js.map +1 -0
- package/dist/parsing/operations/load.d.ts +11 -0
- package/dist/parsing/operations/load.d.ts.map +1 -1
- package/dist/parsing/operations/load.js +31 -2
- package/dist/parsing/operations/load.js.map +1 -1
- package/dist/parsing/operations/merge.d.ts +158 -0
- package/dist/parsing/operations/merge.d.ts.map +1 -0
- package/dist/parsing/operations/merge.js +338 -0
- package/dist/parsing/operations/merge.js.map +1 -0
- package/dist/parsing/operations/refresh_binding.d.ts +15 -0
- package/dist/parsing/operations/refresh_binding.d.ts.map +1 -0
- package/dist/parsing/operations/refresh_binding.js +42 -0
- package/dist/parsing/operations/refresh_binding.js.map +1 -0
- package/dist/parsing/operations/refresh_node.d.ts +11 -0
- package/dist/parsing/operations/refresh_node.d.ts.map +1 -0
- package/dist/parsing/operations/refresh_node.js +46 -0
- package/dist/parsing/operations/refresh_node.js.map +1 -0
- package/dist/parsing/operations/refresh_relationship.d.ts +11 -0
- package/dist/parsing/operations/refresh_relationship.d.ts.map +1 -0
- package/dist/parsing/operations/refresh_relationship.js +46 -0
- package/dist/parsing/operations/refresh_relationship.js.map +1 -0
- package/dist/parsing/operations/return.d.ts.map +1 -1
- package/dist/parsing/operations/return.js +7 -1
- package/dist/parsing/operations/return.js.map +1 -1
- package/dist/parsing/operations/update.d.ts +27 -0
- package/dist/parsing/operations/update.d.ts.map +1 -0
- package/dist/parsing/operations/update.js +88 -0
- package/dist/parsing/operations/update.js.map +1 -0
- package/dist/parsing/operations/update_delete.d.ts +43 -0
- package/dist/parsing/operations/update_delete.d.ts.map +1 -0
- package/dist/parsing/operations/update_delete.js +105 -0
- package/dist/parsing/operations/update_delete.js.map +1 -0
- package/dist/parsing/parser.d.ts +70 -1
- package/dist/parsing/parser.d.ts.map +1 -1
- package/dist/parsing/parser.js +704 -10
- package/dist/parsing/parser.js.map +1 -1
- package/dist/parsing/statement_info_crawler.d.ts +26 -0
- package/dist/parsing/statement_info_crawler.d.ts.map +1 -1
- package/dist/parsing/statement_info_crawler.js +86 -4
- package/dist/parsing/statement_info_crawler.js.map +1 -1
- package/dist/tokenization/keyword.d.ts +21 -1
- package/dist/tokenization/keyword.d.ts.map +1 -1
- package/dist/tokenization/keyword.js +20 -0
- package/dist/tokenization/keyword.js.map +1 -1
- package/dist/tokenization/token.d.ts +24 -0
- package/dist/tokenization/token.d.ts.map +1 -1
- package/dist/tokenization/token.js +73 -0
- package/dist/tokenization/token.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -17,25 +50,59 @@ class PhysicalRelationship extends relationship_1.default {
|
|
|
17
50
|
constructor() {
|
|
18
51
|
super(...arguments);
|
|
19
52
|
this._statement = null;
|
|
53
|
+
this._isStatic = false;
|
|
54
|
+
this._refreshEveryMs = null;
|
|
55
|
+
this._cache = null;
|
|
56
|
+
this._cachedAt = 0;
|
|
20
57
|
}
|
|
21
58
|
set statement(statement) {
|
|
22
59
|
this._statement = statement;
|
|
60
|
+
this.invalidateCache();
|
|
23
61
|
}
|
|
24
62
|
get statement() {
|
|
25
63
|
return this._statement;
|
|
26
64
|
}
|
|
65
|
+
get isStatic() {
|
|
66
|
+
return this._isStatic;
|
|
67
|
+
}
|
|
68
|
+
set isStatic(value) {
|
|
69
|
+
this._isStatic = value;
|
|
70
|
+
}
|
|
71
|
+
get refreshEveryMs() {
|
|
72
|
+
return this._refreshEveryMs;
|
|
73
|
+
}
|
|
74
|
+
set refreshEveryMs(value) {
|
|
75
|
+
this._refreshEveryMs = value;
|
|
76
|
+
}
|
|
77
|
+
invalidateCache() {
|
|
78
|
+
this._cache = null;
|
|
79
|
+
this._cachedAt = 0;
|
|
80
|
+
}
|
|
27
81
|
data() {
|
|
28
82
|
return __awaiter(this, arguments, void 0, function* (args = null) {
|
|
29
83
|
if (this._statement === null) {
|
|
30
84
|
throw new Error("Statement is null");
|
|
31
85
|
}
|
|
32
|
-
//
|
|
86
|
+
// Filter pass-down queries (with args) bypass the persistent cache
|
|
87
|
+
// because results depend on runtime parameter values.
|
|
88
|
+
if (args === null && this._isStatic && this._cache !== null) {
|
|
89
|
+
const isFresh = this._refreshEveryMs === null || Date.now() - this._cachedAt < this._refreshEveryMs;
|
|
90
|
+
if (isFresh) {
|
|
91
|
+
return this._cache;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Lazy dynamic import to avoid a load-time cycle:
|
|
33
95
|
// physical_relationship -> runner -> parsing -> graph (back to here).
|
|
34
96
|
// Python uses the same idiom (function-local import).
|
|
35
|
-
const RunnerCtor = require("../compute/runner").default;
|
|
97
|
+
const RunnerCtor = (yield Promise.resolve().then(() => __importStar(require("../compute/runner")))).default;
|
|
36
98
|
const runner = new RunnerCtor(null, this._statement, args);
|
|
37
99
|
yield runner.run();
|
|
38
|
-
|
|
100
|
+
const result = runner.results;
|
|
101
|
+
if (args === null && this._isStatic) {
|
|
102
|
+
this._cache = result;
|
|
103
|
+
this._cachedAt = Date.now();
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
39
106
|
});
|
|
40
107
|
}
|
|
41
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physical_relationship.js","sourceRoot":"","sources":["../../src/graph/physical_relationship.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"physical_relationship.js","sourceRoot":"","sources":["../../src/graph/physical_relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kEAA0C;AAE1C,MAAM,oBAAqB,SAAQ,sBAAY;IAA/C;;QACY,eAAU,GAAmB,IAAI,CAAC;QAClC,cAAS,GAAY,KA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C;YACD,kDAAkD;YAClD,sEAAsE;YACtE,sDAAsD;YACtD,MAAM,UAAU,GAAkB,CAAC,wDAAa,mBAAmB,GAAC,CAAC,CAAC,OAAO,CAAC;YAC9E,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC3D,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;YAC9B,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAChC,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AAED,kBAAe,oBAAoB,CAAC"}
|
|
@@ -20,6 +20,15 @@ declare class ASTNode {
|
|
|
20
20
|
* @param child - The child node to add
|
|
21
21
|
*/
|
|
22
22
|
addChild(child: ASTNode): void;
|
|
23
|
+
/**
|
|
24
|
+
* Replaces an existing child node with a new node in-place. The
|
|
25
|
+
* new node takes the old node's position and parent reference.
|
|
26
|
+
*
|
|
27
|
+
* @param oldChild - The existing child to replace
|
|
28
|
+
* @param newChild - The replacement node
|
|
29
|
+
* @returns True if the replacement was performed, false otherwise
|
|
30
|
+
*/
|
|
31
|
+
replaceChild(oldChild: ASTNode, newChild: ASTNode): boolean;
|
|
23
32
|
/**
|
|
24
33
|
* Returns the first child node.
|
|
25
34
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast_node.d.ts","sourceRoot":"","sources":["../../src/parsing/ast_node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAM,OAAO;IACT,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;IACzC,SAAS,CAAC,QAAQ,EAAE,OAA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;;;OAIG;IACI,UAAU,IAAI,OAAO;IAI5B;;;;OAIG;IACI,SAAS,IAAI,OAAO;IAI3B;;;;OAIG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED;;;;OAIG;IACH,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED;;;;OAIG;IACI,KAAK,IAAI,MAAM;IAItB;;;;;OAKG;IACH,OAAO,CAAE,MAAM;IAWf;;;;OAIG;IACH,SAAS,CAAC,QAAQ,IAAI,MAAM;CAG/B;AAED,eAAe,OAAO,CAAC"}
|
package/dist/parsing/ast_node.js
CHANGED
|
@@ -27,6 +27,23 @@ class ASTNode {
|
|
|
27
27
|
child._parent = this;
|
|
28
28
|
this.children.push(child);
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Replaces an existing child node with a new node in-place. The
|
|
32
|
+
* new node takes the old node's position and parent reference.
|
|
33
|
+
*
|
|
34
|
+
* @param oldChild - The existing child to replace
|
|
35
|
+
* @param newChild - The replacement node
|
|
36
|
+
* @returns True if the replacement was performed, false otherwise
|
|
37
|
+
*/
|
|
38
|
+
replaceChild(oldChild, newChild) {
|
|
39
|
+
const idx = this.children.indexOf(oldChild);
|
|
40
|
+
if (idx === -1) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
newChild._parent = this;
|
|
44
|
+
this.children[idx] = newChild;
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
30
47
|
/**
|
|
31
48
|
* Returns the first child node.
|
|
32
49
|
*
|
|
@@ -35,7 +52,7 @@ class ASTNode {
|
|
|
35
52
|
*/
|
|
36
53
|
firstChild() {
|
|
37
54
|
if (this.children.length === 0) {
|
|
38
|
-
throw new Error(
|
|
55
|
+
throw new Error("Expected child");
|
|
39
56
|
}
|
|
40
57
|
return this.children[0];
|
|
41
58
|
}
|
|
@@ -47,7 +64,7 @@ class ASTNode {
|
|
|
47
64
|
*/
|
|
48
65
|
lastChild() {
|
|
49
66
|
if (this.children.length === 0) {
|
|
50
|
-
throw new Error(
|
|
67
|
+
throw new Error("Expected child");
|
|
51
68
|
}
|
|
52
69
|
return this.children[this.children.length - 1];
|
|
53
70
|
}
|
|
@@ -113,7 +130,7 @@ class ASTNode {
|
|
|
113
130
|
* @returns A formatted string showing the tree structure
|
|
114
131
|
*/
|
|
115
132
|
print() {
|
|
116
|
-
return Array.from(this._print(0)).join(
|
|
133
|
+
return Array.from(this._print(0)).join("\n");
|
|
117
134
|
}
|
|
118
135
|
/**
|
|
119
136
|
* Generator function for recursively printing the tree structure.
|
|
@@ -126,7 +143,7 @@ class ASTNode {
|
|
|
126
143
|
yield this.constructor.name;
|
|
127
144
|
}
|
|
128
145
|
else if (indent > 0) {
|
|
129
|
-
yield
|
|
146
|
+
yield "-".repeat(indent) + ` ${this.toString()}`;
|
|
130
147
|
}
|
|
131
148
|
for (const child of this.children) {
|
|
132
149
|
yield* child._print(indent + 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast_node.js","sourceRoot":"","sources":["../../src/parsing/ast_node.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO;IAAb;QACc,YAAO,GAAmB,IAAI,CAAC;QAC/B,aAAQ,GAAc,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ast_node.js","sourceRoot":"","sources":["../../src/parsing/ast_node.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO;IAAb;QACc,YAAO,GAAmB,IAAI,CAAC;QAC/B,aAAQ,GAAc,EAAE,CAAC;IAyJvC,CAAC;IAvJG;;;;OAIG;IACI,QAAQ,CAAC,KAAc;QAC1B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACI,YAAY,CAAC,QAAiB,EAAE,QAAiB;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC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KAAK,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,KAAK;QACR,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACK,CAAC,MAAM,CAAC,MAAc;QAC1B,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;YACf,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAChC,CAAC;aAAM,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;QACrD,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACO,QAAQ;QACd,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACjC,CAAC;CACJ;AAED,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Identifier from "./identifier";
|
|
2
|
+
/**
|
|
3
|
+
* Reference to a `LET`-bound binding by name.
|
|
4
|
+
*
|
|
5
|
+
* Distinct from {@link Reference} (which points to a scope-local
|
|
6
|
+
* variable in the parser state) — a `BindingReference` is resolved
|
|
7
|
+
* against the global {@link Bindings} singleton at execution time.
|
|
8
|
+
*/
|
|
9
|
+
declare class BindingReference extends Identifier {
|
|
10
|
+
constructor(value: string);
|
|
11
|
+
get name(): string;
|
|
12
|
+
toString(): string;
|
|
13
|
+
value(): any;
|
|
14
|
+
}
|
|
15
|
+
export default BindingReference;
|
|
16
|
+
//# sourceMappingURL=binding_reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding_reference.d.ts","sourceRoot":"","sources":["../../../src/parsing/expressions/binding_reference.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC;;;;;;GAMG;AACH,cAAM,gBAAiB,SAAQ,UAAU;gBACzB,KAAK,EAAE,MAAM;IAIzB,IAAW,IAAI,IAAI,MAAM,CAExB;IAEM,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,GAAG;CAOtB;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const bindings_1 = __importDefault(require("../../graph/bindings"));
|
|
7
|
+
const identifier_1 = __importDefault(require("./identifier"));
|
|
8
|
+
/**
|
|
9
|
+
* Reference to a `LET`-bound binding by name.
|
|
10
|
+
*
|
|
11
|
+
* Distinct from {@link Reference} (which points to a scope-local
|
|
12
|
+
* variable in the parser state) — a `BindingReference` is resolved
|
|
13
|
+
* against the global {@link Bindings} singleton at execution time.
|
|
14
|
+
*/
|
|
15
|
+
class BindingReference extends identifier_1.default {
|
|
16
|
+
constructor(value) {
|
|
17
|
+
super(value);
|
|
18
|
+
}
|
|
19
|
+
get name() {
|
|
20
|
+
return this._value;
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
return `BindingReference (${this._value})`;
|
|
24
|
+
}
|
|
25
|
+
value() {
|
|
26
|
+
const bindings = bindings_1.default.getInstance();
|
|
27
|
+
if (!bindings.has(this._value)) {
|
|
28
|
+
throw new Error(`Binding '${this._value}' is not defined`);
|
|
29
|
+
}
|
|
30
|
+
return bindings.get(this._value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = BindingReference;
|
|
34
|
+
//# sourceMappingURL=binding_reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding_reference.js","sourceRoot":"","sources":["../../../src/parsing/expressions/binding_reference.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAC5C,8DAAsC;AAEtC;;;;;;GAMG;AACH,MAAM,gBAAiB,SAAQ,oBAAU;IACrC,YAAY,KAAa;QACrB,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEM,QAAQ;QACX,OAAO,qBAAqB,IAAI,CAAC,MAAM,GAAG,CAAC;IAC/C,CAAC;IAEM,KAAK;QACR,MAAM,QAAQ,GAAG,kBAAQ,CAAC,WAAW,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,MAAM,kBAAkB,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -4,9 +4,13 @@ import Operation from "./operation";
|
|
|
4
4
|
declare class CreateNode extends Operation {
|
|
5
5
|
private _node;
|
|
6
6
|
private _statement;
|
|
7
|
-
|
|
7
|
+
private _isStatic;
|
|
8
|
+
private _refreshEveryMs;
|
|
9
|
+
constructor(node: Node, statement: ASTNode, isStatic?: boolean, refreshEveryMs?: number | null);
|
|
8
10
|
get node(): Node | null;
|
|
9
11
|
get statement(): ASTNode | null;
|
|
12
|
+
get isStatic(): boolean;
|
|
13
|
+
get refreshEveryMs(): number | null;
|
|
10
14
|
run(): Promise<void>;
|
|
11
15
|
get results(): Record<string, any>[];
|
|
12
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_node.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/create_node.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,cAAM,UAAW,SAAQ,SAAS;IAC9B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,UAAU,CAAwB;
|
|
1
|
+
{"version":3,"file":"create_node.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/create_node.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,cAAM,UAAW,SAAQ,SAAS;IAC9B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAAuB;gBAE1C,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,EACzB,cAAc,GAAE,MAAM,GAAG,IAAW;IAQxC,IAAW,IAAI,IAAI,IAAI,GAAG,IAAI,CAE7B;IACD,IAAW,SAAS,IAAI,OAAO,GAAG,IAAI,CAErC;IACD,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACD,IAAW,cAAc,IAAI,MAAM,GAAG,IAAI,CAEzC;IACM,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAE1C;CACJ;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -15,12 +15,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const database_1 = __importDefault(require("../../graph/database"));
|
|
16
16
|
const operation_1 = __importDefault(require("./operation"));
|
|
17
17
|
class CreateNode extends operation_1.default {
|
|
18
|
-
constructor(node, statement) {
|
|
18
|
+
constructor(node, statement, isStatic = false, refreshEveryMs = null) {
|
|
19
19
|
super();
|
|
20
20
|
this._node = null;
|
|
21
21
|
this._statement = null;
|
|
22
|
+
this._isStatic = false;
|
|
23
|
+
this._refreshEveryMs = null;
|
|
22
24
|
this._node = node;
|
|
23
25
|
this._statement = statement;
|
|
26
|
+
this._isStatic = isStatic;
|
|
27
|
+
this._refreshEveryMs = refreshEveryMs;
|
|
24
28
|
}
|
|
25
29
|
get node() {
|
|
26
30
|
return this._node;
|
|
@@ -28,6 +32,12 @@ class CreateNode extends operation_1.default {
|
|
|
28
32
|
get statement() {
|
|
29
33
|
return this._statement;
|
|
30
34
|
}
|
|
35
|
+
get isStatic() {
|
|
36
|
+
return this._isStatic;
|
|
37
|
+
}
|
|
38
|
+
get refreshEveryMs() {
|
|
39
|
+
return this._refreshEveryMs;
|
|
40
|
+
}
|
|
31
41
|
run() {
|
|
32
42
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
33
43
|
try {
|
|
@@ -35,7 +45,7 @@ class CreateNode extends operation_1.default {
|
|
|
35
45
|
throw new Error("Node is null");
|
|
36
46
|
}
|
|
37
47
|
const db = database_1.default.getInstance();
|
|
38
|
-
db.addNode(this._node, this._statement);
|
|
48
|
+
db.addNode(this._node, this._statement, this._isStatic, this._refreshEveryMs);
|
|
39
49
|
resolve();
|
|
40
50
|
}
|
|
41
51
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_node.js","sourceRoot":"","sources":["../../../src/parsing/operations/create_node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA4C;AAG5C,4DAAoC;AAEpC,MAAM,UAAW,SAAQ,mBAAS;
|
|
1
|
+
{"version":3,"file":"create_node.js","sourceRoot":"","sources":["../../../src/parsing/operations/create_node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA4C;AAG5C,4DAAoC;AAEpC,MA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AAC,CAAC;IACP,CAAC;IACD,IAAW,OAAO;QACd,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAED,kBAAe,UAAU,CAAC"}
|
|
@@ -4,9 +4,13 @@ import Operation from "./operation";
|
|
|
4
4
|
declare class CreateRelationship extends Operation {
|
|
5
5
|
private _relationship;
|
|
6
6
|
private _statement;
|
|
7
|
-
|
|
7
|
+
private _isStatic;
|
|
8
|
+
private _refreshEveryMs;
|
|
9
|
+
constructor(relationship: Relationship, statement: ASTNode, isStatic?: boolean, refreshEveryMs?: number | null);
|
|
8
10
|
get relationship(): Relationship | null;
|
|
9
11
|
get statement(): ASTNode | null;
|
|
12
|
+
get isStatic(): boolean;
|
|
13
|
+
get refreshEveryMs(): number | null;
|
|
10
14
|
run(): Promise<void>;
|
|
11
15
|
get results(): Record<string, any>[];
|
|
12
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_relationship.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/create_relationship.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,cAAM,kBAAmB,SAAQ,SAAS;IACtC,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,UAAU,CAAwB;
|
|
1
|
+
{"version":3,"file":"create_relationship.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/create_relationship.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,cAAM,kBAAmB,SAAQ,SAAS;IACtC,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAAuB;gBAE1C,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,OAAO,EAClB,QAAQ,GAAE,OAAe,EACzB,cAAc,GAAE,MAAM,GAAG,IAAW;IAQxC,IAAW,YAAY,IAAI,YAAY,GAAG,IAAI,CAE7C;IACD,IAAW,SAAS,IAAI,OAAO,GAAG,IAAI,CAErC;IACD,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACD,IAAW,cAAc,IAAI,MAAM,GAAG,IAAI,CAEzC;IACM,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3B,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAE1C;CACJ;AACD,eAAe,kBAAkB,CAAC"}
|
|
@@ -15,12 +15,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const database_1 = __importDefault(require("../../graph/database"));
|
|
16
16
|
const operation_1 = __importDefault(require("./operation"));
|
|
17
17
|
class CreateRelationship extends operation_1.default {
|
|
18
|
-
constructor(relationship, statement) {
|
|
18
|
+
constructor(relationship, statement, isStatic = false, refreshEveryMs = null) {
|
|
19
19
|
super();
|
|
20
20
|
this._relationship = null;
|
|
21
21
|
this._statement = null;
|
|
22
|
+
this._isStatic = false;
|
|
23
|
+
this._refreshEveryMs = null;
|
|
22
24
|
this._relationship = relationship;
|
|
23
25
|
this._statement = statement;
|
|
26
|
+
this._isStatic = isStatic;
|
|
27
|
+
this._refreshEveryMs = refreshEveryMs;
|
|
24
28
|
}
|
|
25
29
|
get relationship() {
|
|
26
30
|
return this._relationship;
|
|
@@ -28,6 +32,12 @@ class CreateRelationship extends operation_1.default {
|
|
|
28
32
|
get statement() {
|
|
29
33
|
return this._statement;
|
|
30
34
|
}
|
|
35
|
+
get isStatic() {
|
|
36
|
+
return this._isStatic;
|
|
37
|
+
}
|
|
38
|
+
get refreshEveryMs() {
|
|
39
|
+
return this._refreshEveryMs;
|
|
40
|
+
}
|
|
31
41
|
run() {
|
|
32
42
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
33
43
|
try {
|
|
@@ -35,7 +45,7 @@ class CreateRelationship extends operation_1.default {
|
|
|
35
45
|
throw new Error("Relationship is null");
|
|
36
46
|
}
|
|
37
47
|
const db = database_1.default.getInstance();
|
|
38
|
-
db.addRelationship(this._relationship, this._statement);
|
|
48
|
+
db.addRelationship(this._relationship, this._statement, this._isStatic, this._refreshEveryMs);
|
|
39
49
|
resolve();
|
|
40
50
|
}
|
|
41
51
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_relationship.js","sourceRoot":"","sources":["../../../src/parsing/operations/create_relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA4C;AAG5C,4DAAoC;AAEpC,MAAM,kBAAmB,SAAQ,mBAAS;
|
|
1
|
+
{"version":3,"file":"create_relationship.js","sourceRoot":"","sources":["../../../src/parsing/operations/create_relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA4C;AAG5C,4DAAoC;AAEpC,MAAM,kBAAmB,SAAQ,mBAAS;IAKtC,YACI,YAA0B,EAC1B,SAAkB,EAClB,WAAoB,KAAK,EACzB,iBAAgC,IAAI;QAEpC,KAAK,EAAE,CAAC;QAVJ,kBAAa,GAAwB,IAAI,CAAC;QAC1C,eAAU,GAAmB,IAAI,CAAC;QAClC,cAAS,GAAY,KAAK,CAAC;QAC3B,oBAAe,GAAkB,IAAI,CAAC;QAQ1C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IAC1C,CAAC;IACD,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IACM,GAAG;QACN,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAE,EAAE;YACzC,IAAI,CAAC;gBACD,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;oBAC9B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBAC5C,CAAC;gBACD,MAAM,EAAE,GAAG,kBAAQ,CAAC,WAAW,EAAE,CAAC;gBAClC,EAAE,CAAC,eAAe,CACd,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,UAAW,EAChB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,eAAe,CACvB,CAAC;gBACF,OAAO,EAAE,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,MAAM,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;IACD,IAAW,OAAO;QACd,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AACD,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Operation from "./operation";
|
|
2
|
+
/**
|
|
3
|
+
* `DROP BINDING name`: remove a `LET`-bound entry (plain or
|
|
4
|
+
* refreshable) from the {@link Bindings} singleton. No-op if the
|
|
5
|
+
* binding does not exist.
|
|
6
|
+
*/
|
|
7
|
+
declare class DropBinding extends Operation {
|
|
8
|
+
private _name;
|
|
9
|
+
constructor(name: string);
|
|
10
|
+
get name(): string;
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
get results(): Record<string, any>[];
|
|
13
|
+
}
|
|
14
|
+
export default DropBinding;
|
|
15
|
+
//# sourceMappingURL=drop_binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop_binding.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/drop_binding.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC;;;;GAIG;AACH,cAAM,WAAY,SAAQ,SAAS;IAC/B,OAAO,CAAC,KAAK,CAAS;gBAEV,IAAI,EAAE,MAAM;IAKxB,IAAW,IAAI,IAAI,MAAM,CAExB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAE1C;CACJ;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const bindings_1 = __importDefault(require("../../graph/bindings"));
|
|
16
|
+
const operation_1 = __importDefault(require("./operation"));
|
|
17
|
+
/**
|
|
18
|
+
* `DROP BINDING name`: remove a `LET`-bound entry (plain or
|
|
19
|
+
* refreshable) from the {@link Bindings} singleton. No-op if the
|
|
20
|
+
* binding does not exist.
|
|
21
|
+
*/
|
|
22
|
+
class DropBinding extends operation_1.default {
|
|
23
|
+
constructor(name) {
|
|
24
|
+
super();
|
|
25
|
+
this._name = name;
|
|
26
|
+
}
|
|
27
|
+
get name() {
|
|
28
|
+
return this._name;
|
|
29
|
+
}
|
|
30
|
+
run() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
var _a;
|
|
33
|
+
bindings_1.default.getInstance().delete(this._name);
|
|
34
|
+
yield ((_a = this.next) === null || _a === void 0 ? void 0 : _a.run());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
get results() {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.default = DropBinding;
|
|
42
|
+
//# sourceMappingURL=drop_binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop_binding.js","sourceRoot":"","sources":["../../../src/parsing/operations/drop_binding.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA4C;AAC5C,4DAAoC;AAEpC;;;;GAIG;AACH,MAAM,WAAY,SAAQ,mBAAS;IAG/B,YAAY,IAAY;QACpB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAEY,GAAG;;;YACZ,kBAAQ,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1C,MAAM,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,GAAG,EAAE,CAAA,CAAC;QAC3B,CAAC;KAAA;IAED,IAAW,OAAO;QACd,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import ASTNode from "../ast_node";
|
|
2
|
+
import Expression from "../expressions/expression";
|
|
3
|
+
import Operation from "./operation";
|
|
4
|
+
/**
|
|
5
|
+
* `LET name = <expression-or-query>`: binds a value to a name in the
|
|
6
|
+
* global {@link Bindings} store.
|
|
7
|
+
*
|
|
8
|
+
* The right-hand side is either a parsed expression (literal, function
|
|
9
|
+
* call, identifier, ...) or a sub-query AST that is executed at
|
|
10
|
+
* run-time; a query RHS materialises to the list of result rows. In
|
|
11
|
+
* either case the value is stored eagerly when the `LET` operation
|
|
12
|
+
* runs and remains available to subsequent statements until
|
|
13
|
+
* overwritten or `DROP BINDING name` is executed.
|
|
14
|
+
*
|
|
15
|
+
* `LET name = { ... } REFRESH EVERY n unit` registers a refreshable
|
|
16
|
+
* binding: the sub-query is evaluated once at `LET` time, the result
|
|
17
|
+
* is cached, and the next read after the TTL has elapsed re-executes
|
|
18
|
+
* the sub-query. Refreshable bindings cannot be silently replaced;
|
|
19
|
+
* `DROP BINDING name` first.
|
|
20
|
+
*/
|
|
21
|
+
declare class Let extends Operation {
|
|
22
|
+
private _name;
|
|
23
|
+
private _expression;
|
|
24
|
+
private _subQuery;
|
|
25
|
+
private _value;
|
|
26
|
+
private _refreshEveryMs;
|
|
27
|
+
constructor(name: string, expression: Expression | null, subQuery: ASTNode | null, refreshEveryMs?: number | null);
|
|
28
|
+
get name(): string;
|
|
29
|
+
get expression(): Expression | null;
|
|
30
|
+
get subQuery(): ASTNode | null;
|
|
31
|
+
get refreshEveryMs(): number | null;
|
|
32
|
+
run(): Promise<void>;
|
|
33
|
+
get results(): Record<string, any>[];
|
|
34
|
+
}
|
|
35
|
+
export default Let;
|
|
36
|
+
//# sourceMappingURL=let.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"let.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/let.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,cAAM,GAAI,SAAQ,SAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,eAAe,CAAgB;gBAGnC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,GAAG,IAAI,EAC7B,QAAQ,EAAE,OAAO,GAAG,IAAI,EACxB,cAAc,GAAE,MAAM,GAAG,IAAW;IAexC,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,UAAU,IAAI,UAAU,GAAG,IAAI,CAEzC;IAED,IAAW,QAAQ,IAAI,OAAO,GAAG,IAAI,CAEpC;IAED,IAAW,cAAc,IAAI,MAAM,GAAG,IAAI,CAEzC;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BjC,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAK1C;CACJ;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const bindings_1 = __importDefault(require("../../graph/bindings"));
|
|
16
|
+
const operation_1 = __importDefault(require("./operation"));
|
|
17
|
+
/**
|
|
18
|
+
* `LET name = <expression-or-query>`: binds a value to a name in the
|
|
19
|
+
* global {@link Bindings} store.
|
|
20
|
+
*
|
|
21
|
+
* The right-hand side is either a parsed expression (literal, function
|
|
22
|
+
* call, identifier, ...) or a sub-query AST that is executed at
|
|
23
|
+
* run-time; a query RHS materialises to the list of result rows. In
|
|
24
|
+
* either case the value is stored eagerly when the `LET` operation
|
|
25
|
+
* runs and remains available to subsequent statements until
|
|
26
|
+
* overwritten or `DROP BINDING name` is executed.
|
|
27
|
+
*
|
|
28
|
+
* `LET name = { ... } REFRESH EVERY n unit` registers a refreshable
|
|
29
|
+
* binding: the sub-query is evaluated once at `LET` time, the result
|
|
30
|
+
* is cached, and the next read after the TTL has elapsed re-executes
|
|
31
|
+
* the sub-query. Refreshable bindings cannot be silently replaced;
|
|
32
|
+
* `DROP BINDING name` first.
|
|
33
|
+
*/
|
|
34
|
+
class Let extends operation_1.default {
|
|
35
|
+
constructor(name, expression, subQuery, refreshEveryMs = null) {
|
|
36
|
+
super();
|
|
37
|
+
this._value = undefined;
|
|
38
|
+
this._name = name;
|
|
39
|
+
this._expression = expression;
|
|
40
|
+
this._subQuery = subQuery;
|
|
41
|
+
this._refreshEveryMs = refreshEveryMs;
|
|
42
|
+
if (expression !== null) {
|
|
43
|
+
this.addChild(expression);
|
|
44
|
+
}
|
|
45
|
+
if (subQuery !== null) {
|
|
46
|
+
this.addChild(subQuery);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
get name() {
|
|
50
|
+
return this._name;
|
|
51
|
+
}
|
|
52
|
+
get expression() {
|
|
53
|
+
return this._expression;
|
|
54
|
+
}
|
|
55
|
+
get subQuery() {
|
|
56
|
+
return this._subQuery;
|
|
57
|
+
}
|
|
58
|
+
get refreshEveryMs() {
|
|
59
|
+
return this._refreshEveryMs;
|
|
60
|
+
}
|
|
61
|
+
run() {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
var _a;
|
|
64
|
+
const bindings = bindings_1.default.getInstance();
|
|
65
|
+
let value;
|
|
66
|
+
if (this._subQuery !== null) {
|
|
67
|
+
const first = this._subQuery.firstChild();
|
|
68
|
+
const last = this._subQuery.lastChild();
|
|
69
|
+
yield first.initialize();
|
|
70
|
+
yield first.run();
|
|
71
|
+
yield first.finish();
|
|
72
|
+
value = last.results;
|
|
73
|
+
}
|
|
74
|
+
else if (this._expression !== null) {
|
|
75
|
+
value = this._expression.value();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
value = null;
|
|
79
|
+
}
|
|
80
|
+
this._value = value;
|
|
81
|
+
if (this._refreshEveryMs !== null) {
|
|
82
|
+
if (this._subQuery === null) {
|
|
83
|
+
throw new Error("LET REFRESH EVERY requires a sub-query right-hand side");
|
|
84
|
+
}
|
|
85
|
+
bindings.registerRefreshable(this._name, value, this._subQuery, this._refreshEveryMs);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
bindings.set(this._name, value);
|
|
89
|
+
}
|
|
90
|
+
yield ((_a = this.next) === null || _a === void 0 ? void 0 : _a.run());
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
get results() {
|
|
94
|
+
if (Array.isArray(this._value)) {
|
|
95
|
+
return this._value;
|
|
96
|
+
}
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.default = Let;
|
|
101
|
+
//# sourceMappingURL=let.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"let.js","sourceRoot":"","sources":["../../../src/parsing/operations/let.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oEAA4C;AAG5C,4DAAoC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,GAAI,SAAQ,mBAAS;IAOvB,YACI,IAAY,EACZ,UAA6B,EAC7B,QAAwB,EAC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KAAK,IAAI,EAAE,CAAC;gBACnC,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACJ,KAAK,GAAG,IAAI,CAAC;YACjB,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;gBAChC,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;oBAC1B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;gBAC9E,CAAC;gBACD,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YAC1F,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACpC,CAAC;YACD,MAAM,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,GAAG,EAAE,CAAA,CAAC;QAC3B,CAAC;KAAA;IAED,IAAW,OAAO;QACd,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,MAA+B,CAAC;QAChD,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAED,kBAAe,GAAG,CAAC"}
|
|
@@ -50,6 +50,17 @@ declare class Load extends Operation {
|
|
|
50
50
|
* Loads data from a URL source (original behavior).
|
|
51
51
|
*/
|
|
52
52
|
private loadFromUrl;
|
|
53
|
+
/**
|
|
54
|
+
* Emits an already-resolved JSON value (e.g. coming from a LET-binding
|
|
55
|
+
* referenced by `LOAD JSON FROM <name>`). Arrays expand into one
|
|
56
|
+
* iteration per element; non-array values are emitted once.
|
|
57
|
+
*/
|
|
58
|
+
private loadFromValue;
|
|
59
|
+
/**
|
|
60
|
+
* Drives the downstream pipeline for the given data. Shared by
|
|
61
|
+
* URL / file / value loading paths.
|
|
62
|
+
*/
|
|
63
|
+
private emit;
|
|
53
64
|
load(): Promise<any>;
|
|
54
65
|
run(): Promise<void>;
|
|
55
66
|
value(): any;
|