flowquery 1.0.3 → 1.0.6
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 +182 -0
- package/dist/compute/runner.d.ts +81 -0
- package/dist/compute/runner.d.ts.map +1 -0
- package/dist/extensibility.d.ts +9 -0
- package/dist/extensibility.d.ts.map +1 -0
- package/dist/extensibility.js +25 -0
- package/dist/extensibility.js.map +1 -0
- package/dist/flowquery.min.js +1 -1
- package/dist/index.browser.d.ts +10 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.node.d.ts +14 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/io/command_line.d.ts +28 -0
- package/dist/io/command_line.d.ts.map +1 -0
- package/dist/parsing/alias.d.ts +10 -0
- package/dist/parsing/alias.d.ts.map +1 -0
- package/dist/parsing/alias_option.d.ts +6 -0
- package/dist/parsing/alias_option.d.ts.map +1 -0
- package/dist/parsing/ast_node.d.ts +100 -0
- package/dist/parsing/ast_node.d.ts.map +1 -0
- package/dist/parsing/base_parser.d.ts +49 -0
- package/dist/parsing/base_parser.d.ts.map +1 -0
- package/dist/parsing/components/csv.d.ts +6 -0
- package/dist/parsing/components/csv.d.ts.map +1 -0
- package/dist/parsing/components/from.d.ts +7 -0
- package/dist/parsing/components/from.d.ts.map +1 -0
- package/dist/parsing/components/headers.d.ts +7 -0
- package/dist/parsing/components/headers.d.ts.map +1 -0
- package/dist/parsing/components/json.d.ts +6 -0
- package/dist/parsing/components/json.d.ts.map +1 -0
- package/dist/parsing/components/null.d.ts +6 -0
- package/dist/parsing/components/null.d.ts.map +1 -0
- package/dist/parsing/components/post.d.ts +6 -0
- package/dist/parsing/components/post.d.ts.map +1 -0
- package/dist/parsing/components/text.d.ts +6 -0
- package/dist/parsing/components/text.d.ts.map +1 -0
- package/dist/parsing/context.d.ts +38 -0
- package/dist/parsing/context.d.ts.map +1 -0
- package/dist/parsing/data_structures/associative_array.d.ts +28 -0
- package/dist/parsing/data_structures/associative_array.d.ts.map +1 -0
- package/dist/parsing/data_structures/json_array.d.ts +26 -0
- package/dist/parsing/data_structures/json_array.d.ts.map +1 -0
- package/dist/parsing/data_structures/key_value_pair.d.ts +25 -0
- package/dist/parsing/data_structures/key_value_pair.d.ts.map +1 -0
- package/dist/parsing/data_structures/lookup.d.ts +25 -0
- package/dist/parsing/data_structures/lookup.d.ts.map +1 -0
- package/dist/parsing/data_structures/range_lookup.d.ts +14 -0
- package/dist/parsing/data_structures/range_lookup.d.ts.map +1 -0
- package/dist/parsing/expressions/expression.d.ts +53 -0
- package/dist/parsing/expressions/expression.d.ts.map +1 -0
- package/dist/parsing/expressions/f_string.d.ts +21 -0
- package/dist/parsing/expressions/f_string.d.ts.map +1 -0
- package/dist/parsing/expressions/identifier.d.ts +17 -0
- package/dist/parsing/expressions/identifier.d.ts.map +1 -0
- package/dist/parsing/expressions/number.d.ts +25 -0
- package/dist/parsing/expressions/number.d.ts.map +1 -0
- package/dist/parsing/expressions/operator.d.ts +79 -0
- package/dist/parsing/expressions/operator.d.ts.map +1 -0
- package/dist/parsing/expressions/reference.d.ts +29 -0
- package/dist/parsing/expressions/reference.d.ts.map +1 -0
- package/dist/parsing/expressions/string.d.ts +23 -0
- package/dist/parsing/expressions/string.d.ts.map +1 -0
- package/dist/parsing/functions/aggregate_function.d.ts +42 -0
- package/dist/parsing/functions/aggregate_function.d.ts.map +1 -0
- package/dist/parsing/functions/async_function.d.ts +52 -0
- package/dist/parsing/functions/async_function.d.ts.map +1 -0
- package/dist/parsing/functions/avg.d.ts +15 -0
- package/dist/parsing/functions/avg.d.ts.map +1 -0
- package/dist/parsing/functions/avg.js +20 -2
- package/dist/parsing/functions/avg.js.map +1 -1
- package/dist/parsing/functions/collect.d.ts +21 -0
- package/dist/parsing/functions/collect.d.ts.map +1 -0
- package/dist/parsing/functions/collect.js +20 -2
- package/dist/parsing/functions/collect.js.map +1 -1
- package/dist/parsing/functions/extensibility/index.d.ts +37 -0
- package/dist/parsing/functions/extensibility/index.d.ts.map +1 -0
- package/dist/parsing/functions/extensibility/index.js +50 -0
- package/dist/parsing/functions/extensibility/index.js.map +1 -0
- package/dist/parsing/functions/function.d.ts +36 -0
- package/dist/parsing/functions/function.d.ts.map +1 -0
- package/dist/parsing/functions/function_factory.d.ts +174 -0
- package/dist/parsing/functions/function_factory.d.ts.map +1 -0
- package/dist/parsing/functions/function_factory.js +44 -47
- package/dist/parsing/functions/function_factory.js.map +1 -1
- package/dist/parsing/functions/function_metadata.d.ts +134 -0
- package/dist/parsing/functions/function_metadata.d.ts.map +1 -0
- package/dist/parsing/functions/function_metadata.js +103 -153
- package/dist/parsing/functions/function_metadata.js.map +1 -1
- package/dist/parsing/functions/functions.d.ts +21 -0
- package/dist/parsing/functions/functions.d.ts.map +1 -0
- package/dist/parsing/functions/functions.js +37 -2
- package/dist/parsing/functions/functions.js.map +1 -1
- package/dist/parsing/functions/join.d.ts +9 -0
- package/dist/parsing/functions/join.d.ts.map +1 -0
- package/dist/parsing/functions/join.js +21 -2
- package/dist/parsing/functions/join.js.map +1 -1
- package/dist/parsing/functions/predicate_function.d.ts +19 -0
- package/dist/parsing/functions/predicate_function.d.ts.map +1 -0
- package/dist/parsing/functions/predicate_function.js +3 -0
- package/dist/parsing/functions/predicate_function.js.map +1 -1
- package/dist/parsing/functions/predicate_sum.d.ts +7 -0
- package/dist/parsing/functions/predicate_sum.d.ts.map +1 -0
- package/dist/parsing/functions/predicate_sum.js +23 -2
- package/dist/parsing/functions/predicate_sum.js.map +1 -1
- package/dist/parsing/functions/rand.d.ts +7 -0
- package/dist/parsing/functions/rand.d.ts.map +1 -0
- package/dist/parsing/functions/rand.js +18 -2
- package/dist/parsing/functions/rand.js.map +1 -1
- package/dist/parsing/functions/range.d.ts +7 -0
- package/dist/parsing/functions/range.d.ts.map +1 -0
- package/dist/parsing/functions/range.js +21 -2
- package/dist/parsing/functions/range.js.map +1 -1
- package/dist/parsing/functions/reducer_element.d.ts +6 -0
- package/dist/parsing/functions/reducer_element.d.ts.map +1 -0
- package/dist/parsing/functions/replace.d.ts +7 -0
- package/dist/parsing/functions/replace.d.ts.map +1 -0
- package/dist/parsing/functions/replace.js +22 -2
- package/dist/parsing/functions/replace.js.map +1 -1
- package/dist/parsing/functions/round.d.ts +7 -0
- package/dist/parsing/functions/round.d.ts.map +1 -0
- package/dist/parsing/functions/round.js +20 -2
- package/dist/parsing/functions/round.js.map +1 -1
- package/dist/parsing/functions/size.d.ts +7 -0
- package/dist/parsing/functions/size.d.ts.map +1 -0
- package/dist/parsing/functions/size.js +20 -2
- package/dist/parsing/functions/size.js.map +1 -1
- package/dist/parsing/functions/split.d.ts +9 -0
- package/dist/parsing/functions/split.d.ts.map +1 -0
- package/dist/parsing/functions/split.js +21 -2
- package/dist/parsing/functions/split.js.map +1 -1
- package/dist/parsing/functions/stringify.d.ts +9 -0
- package/dist/parsing/functions/stringify.d.ts.map +1 -0
- package/dist/parsing/functions/stringify.js +20 -2
- package/dist/parsing/functions/stringify.js.map +1 -1
- package/dist/parsing/functions/sum.d.ts +14 -0
- package/dist/parsing/functions/sum.d.ts.map +1 -0
- package/dist/parsing/functions/sum.js +20 -2
- package/dist/parsing/functions/sum.js.map +1 -1
- package/dist/parsing/functions/to_json.d.ts +7 -0
- package/dist/parsing/functions/to_json.d.ts.map +1 -0
- package/dist/parsing/functions/to_json.js +20 -2
- package/dist/parsing/functions/to_json.js.map +1 -1
- package/dist/parsing/functions/value_holder.d.ts +8 -0
- package/dist/parsing/functions/value_holder.d.ts.map +1 -0
- package/dist/parsing/logic/case.d.ts +7 -0
- package/dist/parsing/logic/case.d.ts.map +1 -0
- package/dist/parsing/logic/else.d.ts +7 -0
- package/dist/parsing/logic/else.d.ts.map +1 -0
- package/dist/parsing/logic/end.d.ts +6 -0
- package/dist/parsing/logic/end.d.ts.map +1 -0
- package/dist/parsing/logic/then.d.ts +7 -0
- package/dist/parsing/logic/then.d.ts.map +1 -0
- package/dist/parsing/logic/when.d.ts +7 -0
- package/dist/parsing/logic/when.d.ts.map +1 -0
- package/dist/parsing/operations/aggregated_return.d.ts +8 -0
- package/dist/parsing/operations/aggregated_return.d.ts.map +1 -0
- package/dist/parsing/operations/aggregated_with.d.ts +8 -0
- package/dist/parsing/operations/aggregated_with.d.ts.map +1 -0
- package/dist/parsing/operations/group_by.d.ts +35 -0
- package/dist/parsing/operations/group_by.d.ts.map +1 -0
- package/dist/parsing/operations/limit.d.ts +10 -0
- package/dist/parsing/operations/limit.d.ts.map +1 -0
- package/dist/parsing/operations/load.d.ts +48 -0
- package/dist/parsing/operations/load.d.ts.map +1 -0
- package/dist/parsing/operations/operation.d.ts +39 -0
- package/dist/parsing/operations/operation.d.ts.map +1 -0
- package/dist/parsing/operations/projection.d.ts +8 -0
- package/dist/parsing/operations/projection.d.ts.map +1 -0
- package/dist/parsing/operations/return.d.ts +23 -0
- package/dist/parsing/operations/return.d.ts.map +1 -0
- package/dist/parsing/operations/unwind.d.ts +12 -0
- package/dist/parsing/operations/unwind.d.ts.map +1 -0
- package/dist/parsing/operations/where.d.ts +26 -0
- package/dist/parsing/operations/where.d.ts.map +1 -0
- package/dist/parsing/operations/with.d.ts +17 -0
- package/dist/parsing/operations/with.d.ts.map +1 -0
- package/dist/parsing/parser.d.ts +66 -0
- package/dist/parsing/parser.d.ts.map +1 -0
- package/dist/parsing/parser.js +2 -3
- package/dist/parsing/parser.js.map +1 -1
- package/dist/parsing/token_to_node.d.ts +7 -0
- package/dist/parsing/token_to_node.d.ts.map +1 -0
- package/dist/tokenization/keyword.d.ts +43 -0
- package/dist/tokenization/keyword.d.ts.map +1 -0
- package/dist/tokenization/operator.d.ts +22 -0
- package/dist/tokenization/operator.d.ts.map +1 -0
- package/dist/tokenization/string_walker.d.ts +55 -0
- package/dist/tokenization/string_walker.d.ts.map +1 -0
- package/dist/tokenization/symbol.d.ts +15 -0
- package/dist/tokenization/symbol.d.ts.map +1 -0
- package/dist/tokenization/token.d.ts +176 -0
- package/dist/tokenization/token.d.ts.map +1 -0
- package/dist/tokenization/token_mapper.d.ts +40 -0
- package/dist/tokenization/token_mapper.d.ts.map +1 -0
- package/dist/tokenization/token_type.d.ts +16 -0
- package/dist/tokenization/token_type.d.ts.map +1 -0
- package/dist/tokenization/tokenizer.d.ts +45 -0
- package/dist/tokenization/tokenizer.d.ts.map +1 -0
- package/dist/tokenization/trie.d.ts +41 -0
- package/dist/tokenization/trie.d.ts.map +1 -0
- package/dist/utils/object_utils.d.ts +15 -0
- package/dist/utils/object_utils.d.ts.map +1 -0
- package/dist/utils/string_utils.d.ts +51 -0
- package/dist/utils/string_utils.d.ts.map +1 -0
- package/docs/flowquery.min.js +1 -1
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/misc/apps/RAG/.env.example +14 -0
- package/misc/apps/RAG/README.md +0 -7
- package/misc/apps/RAG/package.json +16 -7
- package/misc/apps/RAG/public/index.html +18 -0
- package/misc/apps/RAG/src/App.css +42 -0
- package/misc/apps/RAG/src/App.tsx +50 -0
- package/misc/apps/RAG/src/components/ApiKeySettings.tsx +245 -0
- package/misc/apps/RAG/src/components/ChatContainer.css +67 -0
- package/misc/apps/RAG/src/components/ChatContainer.tsx +239 -0
- package/misc/apps/RAG/src/components/ChatInput.css +23 -0
- package/misc/apps/RAG/src/components/ChatInput.tsx +62 -0
- package/misc/apps/RAG/src/components/ChatMessage.css +136 -0
- package/misc/apps/RAG/src/components/ChatMessage.tsx +152 -0
- package/misc/apps/RAG/src/components/FlowQueryAgent.ts +390 -0
- package/misc/apps/RAG/src/components/FlowQueryRunner.css +104 -0
- package/misc/apps/RAG/src/components/FlowQueryRunner.tsx +332 -0
- package/misc/apps/RAG/src/components/index.ts +15 -0
- package/misc/apps/RAG/src/index.tsx +17 -0
- package/misc/apps/RAG/src/plugins/PluginRegistry.ts +136 -0
- package/misc/apps/RAG/src/plugins/README.md +139 -0
- package/misc/apps/RAG/src/plugins/index.ts +72 -0
- package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +79 -0
- package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +71 -0
- package/misc/apps/RAG/src/plugins/loaders/Llm.ts +441 -0
- package/misc/apps/RAG/src/plugins/loaders/MockData.ts +161 -0
- package/misc/apps/RAG/src/plugins/types.ts +52 -0
- package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +385 -0
- package/misc/apps/RAG/src/prompts/index.ts +10 -0
- package/misc/apps/RAG/src/utils/FlowQueryExecutor.ts +131 -0
- package/misc/apps/RAG/src/utils/FlowQueryExtractor.ts +203 -0
- package/misc/apps/RAG/src/utils/index.ts +9 -0
- package/misc/apps/RAG/tsconfig.json +4 -2
- package/misc/apps/RAG/webpack.config.js +23 -12
- package/package.json +7 -1
- package/src/extensibility.ts +9 -0
- package/src/parsing/functions/avg.ts +10 -0
- package/src/parsing/functions/collect.ts +10 -0
- package/src/parsing/functions/extensibility/index.ts +54 -0
- package/src/parsing/functions/function_factory.ts +51 -48
- package/src/parsing/functions/function_metadata.ts +132 -156
- package/src/parsing/functions/functions.ts +27 -0
- package/src/parsing/functions/join.ts +11 -0
- package/src/parsing/functions/predicate_function.ts +4 -0
- package/src/parsing/functions/predicate_sum.ts +13 -0
- package/src/parsing/functions/rand.ts +8 -0
- package/src/parsing/functions/range.ts +11 -0
- package/src/parsing/functions/replace.ts +12 -0
- package/src/parsing/functions/round.ts +10 -0
- package/src/parsing/functions/size.ts +10 -0
- package/src/parsing/functions/split.ts +11 -0
- package/src/parsing/functions/stringify.ts +10 -0
- package/src/parsing/functions/sum.ts +10 -0
- package/src/parsing/functions/to_json.ts +10 -0
- package/src/parsing/parser.ts +2 -3
- package/tests/parsing/function_plugins.test.ts +11 -11
- package/tsconfig.json +4 -1
- package/dist/parsing/functions/predicate_function_factory.js +0 -19
- package/dist/parsing/functions/predicate_function_factory.js.map +0 -1
- package/misc/apps/RAG/src/index.ts +0 -20
- package/src/parsing/functions/predicate_function_factory.ts +0 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/stringify.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC,cASM,SAAU,SAAQ,QAAQ;;IAK5B,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,EAKrC;IACM,KAAK,IAAI,GAAG;CAQtB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
const function_1 = __importDefault(require("./function"));
|
|
7
13
|
const number_1 = __importDefault(require("../expressions/number"));
|
|
8
|
-
|
|
14
|
+
const function_metadata_1 = require("./function_metadata");
|
|
15
|
+
let Stringify = class Stringify extends function_1.default {
|
|
9
16
|
constructor() {
|
|
10
17
|
super("stringify");
|
|
11
18
|
this._expectedParameterCount = 2;
|
|
@@ -24,6 +31,17 @@ class Stringify extends function_1.default {
|
|
|
24
31
|
}
|
|
25
32
|
return JSON.stringify(value, null, indent);
|
|
26
33
|
}
|
|
27
|
-
}
|
|
34
|
+
};
|
|
35
|
+
Stringify = __decorate([
|
|
36
|
+
(0, function_metadata_1.FunctionDef)({
|
|
37
|
+
description: "Converts a value to its JSON string representation",
|
|
38
|
+
category: "scalar",
|
|
39
|
+
parameters: [
|
|
40
|
+
{ name: "value", description: "Value to stringify", type: "any" }
|
|
41
|
+
],
|
|
42
|
+
output: { description: "JSON string", type: "string", example: "{\"a\":1}" },
|
|
43
|
+
examples: ["WITH {a: 1} AS obj RETURN stringify(obj)"]
|
|
44
|
+
})
|
|
45
|
+
], Stringify);
|
|
28
46
|
exports.default = Stringify;
|
|
29
47
|
//# sourceMappingURL=stringify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../../src/parsing/functions/stringify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stringify.js","sourceRoot":"","sources":["../../../src/parsing/functions/stringify.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,0DAAkC;AAClC,mEAA2C;AAC3C,2DAAkD;AAWlD,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,kBAAQ;IAC5B;QACI,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,IAAW,UAAU,CAAC,KAAgB;QAClC,IAAG,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,IAAI,CAAC,IAAI,gBAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,iDAAiD;QAClF,CAAC;QACD,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC;IAC7B,CAAC;IACM,KAAK;QACR,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAA;AAnBK,SAAS;IATd,IAAA,+BAAW,EAAC;QACT,WAAW,EAAE,oDAAoD;QACjE,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,KAAK,EAAE;SACpE;QACD,MAAM,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE;QAC5E,QAAQ,EAAE,CAAC,0CAA0C,CAAC;KACzD,CAAC;GACI,SAAS,CAmBd;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import AggregateFunction from "./aggregate_function";
|
|
2
|
+
import ReducerElement from "./reducer_element";
|
|
3
|
+
declare class SumReducerElement extends ReducerElement {
|
|
4
|
+
private _value;
|
|
5
|
+
get value(): any;
|
|
6
|
+
set value(value: any);
|
|
7
|
+
}
|
|
8
|
+
declare class Sum extends AggregateFunction {
|
|
9
|
+
constructor();
|
|
10
|
+
reduce(element: SumReducerElement): void;
|
|
11
|
+
element(): SumReducerElement;
|
|
12
|
+
}
|
|
13
|
+
export default Sum;
|
|
14
|
+
//# sourceMappingURL=sum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sum.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/sum.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,cAAM,iBAAkB,SAAQ,cAAc;IAC1C,OAAO,CAAC,MAAM,CAAa;IAC3B,IAAW,KAAK,IAAI,GAAG,CAEtB;IACD,IAAW,KAAK,CAAC,KAAK,EAAE,GAAG,EAM1B;CACJ;AAED,cASM,GAAI,SAAQ,iBAAiB;;IAKxB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAGxC,OAAO,IAAI,iBAAiB;CAGtC;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
const aggregate_function_1 = __importDefault(require("./aggregate_function"));
|
|
7
13
|
const reducer_element_1 = __importDefault(require("./reducer_element"));
|
|
14
|
+
const function_metadata_1 = require("./function_metadata");
|
|
8
15
|
class SumReducerElement extends reducer_element_1.default {
|
|
9
16
|
constructor() {
|
|
10
17
|
super(...arguments);
|
|
@@ -22,7 +29,7 @@ class SumReducerElement extends reducer_element_1.default {
|
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
}
|
|
25
|
-
class Sum extends aggregate_function_1.default {
|
|
32
|
+
let Sum = class Sum extends aggregate_function_1.default {
|
|
26
33
|
constructor() {
|
|
27
34
|
super("sum");
|
|
28
35
|
this._expectedParameterCount = 1;
|
|
@@ -33,6 +40,17 @@ class Sum extends aggregate_function_1.default {
|
|
|
33
40
|
element() {
|
|
34
41
|
return new SumReducerElement();
|
|
35
42
|
}
|
|
36
|
-
}
|
|
43
|
+
};
|
|
44
|
+
Sum = __decorate([
|
|
45
|
+
(0, function_metadata_1.FunctionDef)({
|
|
46
|
+
description: "Calculates the sum of numeric values across grouped rows",
|
|
47
|
+
category: "aggregate",
|
|
48
|
+
parameters: [
|
|
49
|
+
{ name: "value", description: "Numeric value to sum", type: "number" }
|
|
50
|
+
],
|
|
51
|
+
output: { description: "Sum of all values", type: "number", example: 150 },
|
|
52
|
+
examples: ["WITH [1, 2, 3] AS nums UNWIND nums AS n RETURN sum(n)"]
|
|
53
|
+
})
|
|
54
|
+
], Sum);
|
|
37
55
|
exports.default = Sum;
|
|
38
56
|
//# sourceMappingURL=sum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sum.js","sourceRoot":"","sources":["../../../src/parsing/functions/sum.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sum.js","sourceRoot":"","sources":["../../../src/parsing/functions/sum.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,8EAAqD;AACrD,wEAA+C;AAC/C,2DAAkD;AAElD,MAAM,iBAAkB,SAAQ,yBAAc;IAA9C;;QACY,WAAM,GAAQ,IAAI,CAAC;IAW/B,CAAC;IAVG,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAW,KAAK,CAAC,KAAU;QACvB,IAAG,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACxB,CAAC;IACL,CAAC;CACJ;AAWD,IAAM,GAAG,GAAT,MAAM,GAAI,SAAQ,4BAAiB;IAC/B;QACI,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IACrC,CAAC;IACM,MAAM,CAAC,OAA0B;QACpC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IACM,OAAO;QACV,OAAO,IAAI,iBAAiB,EAAE,CAAC;IACnC,CAAC;CACJ,CAAA;AAXK,GAAG;IATR,IAAA,+BAAW,EAAC;QACT,WAAW,EAAE,0DAA0D;QACvE,QAAQ,EAAE,WAAW;QACrB,UAAU,EAAE;YACR,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzE;QACD,MAAM,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;QAC1E,QAAQ,EAAE,CAAC,uDAAuD,CAAC;KACtE,CAAC;GACI,GAAG,CAWR;AAED,kBAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to_json.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/to_json.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,cASM,MAAO,SAAQ,QAAQ;;IAKlB,KAAK,IAAI,GAAG;CAOtB;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
const function_1 = __importDefault(require("./function"));
|
|
7
|
-
|
|
13
|
+
const function_metadata_1 = require("./function_metadata");
|
|
14
|
+
let ToJson = class ToJson extends function_1.default {
|
|
8
15
|
constructor() {
|
|
9
16
|
super("tojson");
|
|
10
17
|
this._expectedParameterCount = 1;
|
|
@@ -16,6 +23,17 @@ class ToJson extends function_1.default {
|
|
|
16
23
|
}
|
|
17
24
|
return JSON.parse(str);
|
|
18
25
|
}
|
|
19
|
-
}
|
|
26
|
+
};
|
|
27
|
+
ToJson = __decorate([
|
|
28
|
+
(0, function_metadata_1.FunctionDef)({
|
|
29
|
+
description: "Parses a JSON string into an object",
|
|
30
|
+
category: "scalar",
|
|
31
|
+
parameters: [
|
|
32
|
+
{ name: "text", description: "JSON string to parse", type: "string" }
|
|
33
|
+
],
|
|
34
|
+
output: { description: "Parsed object or array", type: "object", example: { a: 1 } },
|
|
35
|
+
examples: ["WITH '{\"a\": 1}' AS s RETURN tojson(s)"]
|
|
36
|
+
})
|
|
37
|
+
], ToJson);
|
|
20
38
|
exports.default = ToJson;
|
|
21
39
|
//# sourceMappingURL=to_json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to_json.js","sourceRoot":"","sources":["../../../src/parsing/functions/to_json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"to_json.js","sourceRoot":"","sources":["../../../src/parsing/functions/to_json.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,0DAAkC;AAClC,2DAAkD;AAWlD,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,kBAAQ;IACzB;QACI,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IACrC,CAAC;IACM,KAAK;QACR,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACJ,CAAA;AAZK,MAAM;IATX,IAAA,+BAAW,EAAC;QACT,WAAW,EAAE,qCAAqC;QAClD,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE;YACR,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,IAAI,EAAE,QAAQ,EAAE;SACxE;QACD,MAAM,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;QACpF,QAAQ,EAAE,CAAC,yCAAyC,CAAC;KACxD,CAAC;GACI,MAAM,CAYX;AAED,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value_holder.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/value_holder.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,WAAY,SAAQ,OAAO;IAC7B,OAAO,CAAC,OAAO,CAAM;IACrB,IAAW,MAAM,CAAC,KAAK,EAAE,GAAG,EAE3B;IACM,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/parsing/logic/case.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAKlC,cAAM,IAAK,SAAQ,OAAO;;IAKf,KAAK,IAAI,GAAG;CAatB;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"else.d.ts","sourceRoot":"","sources":["../../../src/parsing/logic/else.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;IAIf,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"end.d.ts","sourceRoot":"","sources":["../../../src/parsing/logic/end.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,GAAI,SAAQ,OAAO;;CAIxB;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"then.d.ts","sourceRoot":"","sources":["../../../src/parsing/logic/then.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;IAIf,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"when.d.ts","sourceRoot":"","sources":["../../../src/parsing/logic/when.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;IAIf,KAAK,IAAI,OAAO;CAG1B;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregated_return.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_return.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAI9B,cAAM,gBAAiB,SAAQ,MAAM;IACjC,OAAO,CAAC,SAAS,CAAuD;IAC3D,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAK1C;CACJ;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregated_with.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_with.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,UAAU,CAAC;AAI5B,cAAM,cAAe,SAAQ,IAAI;IAC7B,OAAO,CAAC,SAAS,CAAuD;IAC3D,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAGpB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAMvC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import AggregationElement from "../functions/reducer_element";
|
|
2
|
+
import Projection from "./projection";
|
|
3
|
+
import Where from "./where";
|
|
4
|
+
declare class Node {
|
|
5
|
+
private _value;
|
|
6
|
+
private _children;
|
|
7
|
+
private _elements;
|
|
8
|
+
constructor(value?: any);
|
|
9
|
+
get value(): any;
|
|
10
|
+
get children(): Map<string, Node>;
|
|
11
|
+
get elements(): AggregationElement[] | null;
|
|
12
|
+
set elements(elements: AggregationElement[]);
|
|
13
|
+
}
|
|
14
|
+
declare class GroupBy extends Projection {
|
|
15
|
+
private _root;
|
|
16
|
+
private _current;
|
|
17
|
+
private _mappers;
|
|
18
|
+
private _reducers;
|
|
19
|
+
protected _where: Where | null;
|
|
20
|
+
run(): Promise<void>;
|
|
21
|
+
private get root();
|
|
22
|
+
private get current();
|
|
23
|
+
private set current(value);
|
|
24
|
+
private resetTree;
|
|
25
|
+
private map;
|
|
26
|
+
private reduce;
|
|
27
|
+
private get mappers();
|
|
28
|
+
private _generate_mappers;
|
|
29
|
+
private get reducers();
|
|
30
|
+
generate_results(mapperIndex?: number, node?: Node): Generator<Record<string, any>>;
|
|
31
|
+
set where(where: Where);
|
|
32
|
+
get where(): boolean;
|
|
33
|
+
}
|
|
34
|
+
export default GroupBy;
|
|
35
|
+
//# sourceMappingURL=group_by.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group_by.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/group_by.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,8BAA8B,CAAC;AAC9D,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,cAAM,IAAI;IACN,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAqC;gBAC1C,KAAK,GAAE,GAAU;IAG7B,IAAW,KAAK,IAAI,GAAG,CAEtB;IACD,IAAW,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAEvC;IACD,IAAW,QAAQ,IAAI,kBAAkB,EAAE,GAAG,IAAI,CAEjD;IACD,IAAW,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,EAAE,EAEjD;CACJ;AAED,cAAM,OAAQ,SAAQ,UAAU;IAC5B,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,SAAS,CAAoC;IACrD,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAQ;IACzB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,OAAO,KAAK,IAAI,GAEf;IACD,OAAO,KAAK,OAAO,GAElB;IACD,OAAO,KAAK,OAAO,QAElB;IACD,OAAO,CAAC,SAAS;IAGjB,OAAO,CAAC,GAAG;IAaX,OAAO,CAAC,MAAM;IASd,OAAO,KAAK,OAAO,GAKlB;IACD,OAAO,CAAE,iBAAiB;IAO1B,OAAO,KAAK,QAAQ,GAOnB;IACO,gBAAgB,CAAC,WAAW,GAAE,MAAU,EAAE,IAAI,GAAE,IAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAmBzG,IAAW,KAAK,CAAC,KAAK,EAAE,KAAK,EAE5B;IACD,IAAW,KAAK,IAAI,OAAO,CAK1B;CACJ;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/limit.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,cAAM,KAAM,SAAQ,SAAS;IACzB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAAa;gBACd,KAAK,EAAE,MAAM;IAIZ,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,KAAK,IAAI,IAAI;CAGvB;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Operation from "./operation";
|
|
2
|
+
import CSV from "../components/csv";
|
|
3
|
+
import { default as _JSON } from "../components/json";
|
|
4
|
+
import Text from "../components/text";
|
|
5
|
+
import Function from "../functions/function";
|
|
6
|
+
import AsyncFunction from "../functions/async_function";
|
|
7
|
+
import AssociativeArray from "../data_structures/associative_array";
|
|
8
|
+
import Reference from "../expressions/reference";
|
|
9
|
+
import Expression from "../expressions/expression";
|
|
10
|
+
import Lookup from "../data_structures/lookup";
|
|
11
|
+
import From from "../components/from";
|
|
12
|
+
declare class Load extends Operation {
|
|
13
|
+
private _value;
|
|
14
|
+
constructor();
|
|
15
|
+
get type(): _JSON | CSV | Text;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the From component which contains either a URL expression or an AsyncFunction.
|
|
18
|
+
*/
|
|
19
|
+
get fromComponent(): From;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the data source is an async function.
|
|
22
|
+
*/
|
|
23
|
+
get isAsyncFunction(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the async function if the source is a function, otherwise null.
|
|
26
|
+
*/
|
|
27
|
+
get asyncFunction(): AsyncFunction | null;
|
|
28
|
+
get from(): string;
|
|
29
|
+
get headers(): {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
};
|
|
32
|
+
get payload(): Function | Reference | Expression | AssociativeArray | Lookup | null;
|
|
33
|
+
private method;
|
|
34
|
+
private options;
|
|
35
|
+
/**
|
|
36
|
+
* Loads data from an async function source.
|
|
37
|
+
*/
|
|
38
|
+
private loadFromFunction;
|
|
39
|
+
/**
|
|
40
|
+
* Loads data from a URL source (original behavior).
|
|
41
|
+
*/
|
|
42
|
+
private loadFromUrl;
|
|
43
|
+
load(): Promise<any>;
|
|
44
|
+
run(): Promise<void>;
|
|
45
|
+
value(): any;
|
|
46
|
+
}
|
|
47
|
+
export default Load;
|
|
48
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/load.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,EAAC,OAAO,IAAI,KAAK,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAGnD,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AAEtC,cAAM,IAAK,SAAQ,SAAS;IAC1B,OAAO,CAAC,MAAM,CAAa;;IAI3B,IAAW,IAAI,IAAI,KAAK,GAAG,GAAG,GAAG,IAAI,CAEpC;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,IAAI,CAE/B;IAED;;OAEG;IACH,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED;;OAEG;IACH,IAAW,aAAa,IAAI,aAAa,GAAG,IAAI,CAG/C;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IACD,IAAW,OAAO,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAK9C;IACD,IAAW,OAAO,IAAI,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAQzF;IACD,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,OAAO;IAcf;;OAEG;YACW,gBAAgB;IAQ9B;;OAEG;YACW,WAAW;IAsBZ,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC;IAOpB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ1B,KAAK,IAAI,GAAG;CAGpB;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import ASTNode from "../ast_node";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all FlowQuery operations.
|
|
4
|
+
*
|
|
5
|
+
* Operations represent the main statements in FlowQuery (WITH, UNWIND, RETURN, LOAD, WHERE).
|
|
6
|
+
* They form a linked list structure and can be executed sequentially.
|
|
7
|
+
*
|
|
8
|
+
* @abstract
|
|
9
|
+
*/
|
|
10
|
+
declare abstract class Operation extends ASTNode {
|
|
11
|
+
private _previous;
|
|
12
|
+
private _next;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new Operation instance.
|
|
15
|
+
*/
|
|
16
|
+
constructor();
|
|
17
|
+
get previous(): Operation | null;
|
|
18
|
+
set previous(value: Operation | null);
|
|
19
|
+
get next(): Operation | null;
|
|
20
|
+
set next(value: Operation | null);
|
|
21
|
+
addSibling(operation: Operation): void;
|
|
22
|
+
/**
|
|
23
|
+
* Executes this operation. Must be implemented by subclasses.
|
|
24
|
+
*
|
|
25
|
+
* @returns A promise that resolves when the operation completes
|
|
26
|
+
* @throws {Error} If not implemented by subclass
|
|
27
|
+
*/
|
|
28
|
+
run(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Finishes execution by calling finish on the next operation in the chain.
|
|
31
|
+
*
|
|
32
|
+
* @returns A promise that resolves when all operations finish
|
|
33
|
+
*/
|
|
34
|
+
finish(): Promise<void>;
|
|
35
|
+
reset(): void;
|
|
36
|
+
get results(): Record<string, any>[];
|
|
37
|
+
}
|
|
38
|
+
export default Operation;
|
|
39
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/operation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;;;GAOG;AACH,uBAAe,SAAU,SAAQ,OAAO;IACpC,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,KAAK,CAA0B;IAEvC;;OAEG;;IAIH,IAAW,QAAQ,IAAI,SAAS,GAAG,IAAI,CAEtC;IACD,IAAW,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,EAE1C;IACD,IAAW,IAAI,IAAI,SAAS,GAAG,IAAI,CAElC;IACD,IAAW,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,EAEtC;IACM,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAM7C;;;;;OAKG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;;;OAIG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAG7B,KAAK,IAAI,IAAI;IAGpB,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAE1C;CACJ;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Operation from "./operation";
|
|
2
|
+
import Expression from "../expressions/expression";
|
|
3
|
+
declare class Projection extends Operation {
|
|
4
|
+
constructor(expressions: Expression[]);
|
|
5
|
+
protected expressions(): Generator<[Expression, string]>;
|
|
6
|
+
}
|
|
7
|
+
export default Projection;
|
|
8
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/projection.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,cAAM,UAAW,SAAQ,SAAS;gBAClB,WAAW,EAAE,UAAU,EAAE;IAIrC,SAAS,CAAE,WAAW,IAAI,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;CAO5D;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Projection from "./projection";
|
|
2
|
+
import Where from "./where";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a RETURN operation that produces the final query results.
|
|
5
|
+
*
|
|
6
|
+
* The RETURN operation evaluates expressions and collects them into result records.
|
|
7
|
+
* It can optionally have a WHERE clause to filter results.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // RETURN x, y WHERE x > 0
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare class Return extends Projection {
|
|
15
|
+
protected _where: Where | null;
|
|
16
|
+
protected _results: Record<string, any>[];
|
|
17
|
+
set where(where: Where);
|
|
18
|
+
get where(): boolean;
|
|
19
|
+
run(): Promise<void>;
|
|
20
|
+
get results(): Record<string, any>[];
|
|
21
|
+
}
|
|
22
|
+
export default Return;
|
|
23
|
+
//# sourceMappingURL=return.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"return.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/return.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;;;;;;;;;;GAUG;AACH,cAAM,MAAO,SAAQ,UAAU;IAC3B,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAQ;IACtC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAM;IAC/C,IAAW,KAAK,CAAC,KAAK,EAAE,KAAK,EAE5B;IACD,IAAW,KAAK,IAAI,OAAO,CAK1B;IACY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAWjC,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAE1C;CACJ;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Operation from "./operation";
|
|
2
|
+
import Expression from "../expressions/expression";
|
|
3
|
+
declare class Unwind extends Operation {
|
|
4
|
+
private _value;
|
|
5
|
+
constructor(expression: Expression);
|
|
6
|
+
get expression(): Expression;
|
|
7
|
+
get as(): string;
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
value(): any;
|
|
10
|
+
}
|
|
11
|
+
export default Unwind;
|
|
12
|
+
//# sourceMappingURL=unwind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unwind.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/unwind.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,cAAM,MAAO,SAAQ,SAAS;IAC1B,OAAO,CAAC,MAAM,CAAM;gBACR,UAAU,EAAE,UAAU;IAIlC,IAAW,UAAU,IAAI,UAAU,CAElC;IACD,IAAW,EAAE,IAAI,MAAM,CAEtB;IACY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAW1B,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Operation from "./operation";
|
|
2
|
+
import Expression from "../expressions/expression";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a WHERE operation that filters data based on a condition.
|
|
5
|
+
*
|
|
6
|
+
* The WHERE operation evaluates a boolean expression and only continues
|
|
7
|
+
* execution to the next operation if the condition is true.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // RETURN x WHERE x > 0
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare class Where extends Operation {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new WHERE operation with the given condition.
|
|
17
|
+
*
|
|
18
|
+
* @param expression - The boolean expression to evaluate
|
|
19
|
+
*/
|
|
20
|
+
constructor(expression: Expression);
|
|
21
|
+
get expression(): Expression;
|
|
22
|
+
run(): Promise<void>;
|
|
23
|
+
value(): any;
|
|
24
|
+
}
|
|
25
|
+
export default Where;
|
|
26
|
+
//# sourceMappingURL=where.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/where.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,cAAM,KAAM,SAAQ,SAAS;IACzB;;;;OAIG;gBACS,UAAU,EAAE,UAAU;IAIlC,IAAW,UAAU,IAAI,UAAU,CAElC;IACY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAK1B,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Projection from "./projection";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a WITH operation that defines variables or intermediate results.
|
|
4
|
+
*
|
|
5
|
+
* The WITH operation creates named expressions that can be referenced later in the query.
|
|
6
|
+
* It passes control to the next operation in the chain.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // WITH x = 1, y = 2 RETURN x + y
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare class With extends Projection {
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export default With;
|
|
17
|
+
//# sourceMappingURL=with.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/with.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,cAAM,IAAK,SAAQ,UAAU;IACZ,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import ASTNode from "./ast_node";
|
|
2
|
+
import BaseParser from "./base_parser";
|
|
3
|
+
/**
|
|
4
|
+
* Main parser for FlowQuery statements.
|
|
5
|
+
*
|
|
6
|
+
* Parses FlowQuery declarative query language statements into an Abstract Syntax Tree (AST).
|
|
7
|
+
* Supports operations like WITH, UNWIND, RETURN, LOAD, WHERE, and LIMIT, along with
|
|
8
|
+
* expressions, functions, data structures, and logical constructs.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const parser = new Parser();
|
|
13
|
+
* const ast = parser.parse("unwind [1, 2, 3, 4] as num return num");
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare class Parser extends BaseParser {
|
|
17
|
+
private variables;
|
|
18
|
+
private context;
|
|
19
|
+
private _returns;
|
|
20
|
+
/**
|
|
21
|
+
* Parses a FlowQuery statement into an Abstract Syntax Tree.
|
|
22
|
+
*
|
|
23
|
+
* @param statement - The FlowQuery statement to parse
|
|
24
|
+
* @returns The root AST node containing the parsed structure
|
|
25
|
+
* @throws {Error} If the statement is malformed or contains syntax errors
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const ast = parser.parse("LOAD JSON FROM 'https://api.adviceslip.com/advice' AS data RETURN data");
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
parse(statement: string): ASTNode;
|
|
33
|
+
private parseOperation;
|
|
34
|
+
private parseWith;
|
|
35
|
+
private parseUnwind;
|
|
36
|
+
private parseReturn;
|
|
37
|
+
private parseWhere;
|
|
38
|
+
private parseLoad;
|
|
39
|
+
private parseLimit;
|
|
40
|
+
private parseExpressions;
|
|
41
|
+
private parseExpression;
|
|
42
|
+
private parseLookup;
|
|
43
|
+
private parseCase;
|
|
44
|
+
private parseWhen;
|
|
45
|
+
private parseThen;
|
|
46
|
+
private parseElse;
|
|
47
|
+
private parseAlias;
|
|
48
|
+
private parseFunction;
|
|
49
|
+
/**
|
|
50
|
+
* Parses an async function call for use in LOAD operations.
|
|
51
|
+
* Only matches if the identifier is registered as an async data provider.
|
|
52
|
+
*
|
|
53
|
+
* @returns An AsyncFunction node if a registered async function is found, otherwise null
|
|
54
|
+
*/
|
|
55
|
+
private parseAsyncFunction;
|
|
56
|
+
private parsePredicateFunction;
|
|
57
|
+
private parseFString;
|
|
58
|
+
private parseJSON;
|
|
59
|
+
private parseAssociativeArray;
|
|
60
|
+
private parseJSONArray;
|
|
61
|
+
private expectAndSkipWhitespaceAndComments;
|
|
62
|
+
private skipWhitespaceAndComments;
|
|
63
|
+
private expectPreviousTokenToBeWhitespaceOrComment;
|
|
64
|
+
}
|
|
65
|
+
export default Parser;
|
|
66
|
+
//# sourceMappingURL=parser.d.ts.map
|