flowquery 1.0.14 → 1.0.16
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/.editorconfig +21 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +22 -0
- package/dist/flowquery.min.js +1 -1
- package/dist/parsing/expressions/expression_map.d.ts +9 -0
- package/dist/parsing/expressions/expression_map.d.ts.map +1 -0
- package/dist/parsing/expressions/expression_map.js +24 -0
- package/dist/parsing/expressions/expression_map.js.map +1 -0
- package/dist/parsing/operations/call.d.ts +17 -0
- package/dist/parsing/operations/call.d.ts.map +1 -0
- package/dist/parsing/operations/call.js +105 -0
- package/dist/parsing/operations/call.js.map +1 -0
- package/dist/parsing/operations/load.d.ts +6 -6
- package/dist/parsing/operations/load.d.ts.map +1 -1
- package/dist/parsing/operations/load.js +8 -6
- package/dist/parsing/operations/load.js.map +1 -1
- package/dist/parsing/operations/operation.d.ts +1 -0
- package/dist/parsing/operations/operation.d.ts.map +1 -1
- package/dist/parsing/operations/operation.js +6 -5
- package/dist/parsing/operations/operation.js.map +1 -1
- package/dist/parsing/operations/projection.d.ts +1 -1
- package/dist/parsing/operations/projection.d.ts.map +1 -1
- package/dist/parsing/operations/projection.js.map +1 -1
- package/dist/parsing/parser.d.ts +1 -0
- package/dist/parsing/parser.d.ts.map +1 -1
- package/dist/parsing/parser.js +148 -99
- package/dist/parsing/parser.js.map +1 -1
- package/dist/parsing/token_to_node.d.ts +2 -2
- package/dist/parsing/token_to_node.d.ts.map +1 -1
- package/dist/parsing/token_to_node.js +12 -12
- package/dist/parsing/token_to_node.js.map +1 -1
- package/dist/tokenization/token.d.ts +5 -1
- package/dist/tokenization/token.d.ts.map +1 -1
- package/dist/tokenization/token.js +17 -5
- package/dist/tokenization/token.js.map +1 -1
- package/docs/flowquery.min.js +1 -1
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/misc/apps/RAG/package.json +1 -1
- package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +21 -26
- package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +65 -0
- package/misc/apps/RAG/src/plugins/loaders/Form.ts +163 -147
- package/misc/apps/RAG/src/plugins/loaders/Llm.ts +106 -92
- package/misc/apps/RAG/src/plugins/loaders/MockData.ts +80 -58
- package/misc/apps/RAG/src/plugins/loaders/Table.ts +106 -103
- package/misc/apps/RAG/src/plugins/loaders/Weather.ts +50 -38
- package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +77 -78
- package/package.json +12 -2
- package/src/parsing/expressions/expression_map.ts +22 -0
- package/src/parsing/operations/call.ts +69 -0
- package/src/parsing/operations/load.ts +123 -120
- package/src/parsing/operations/operation.ts +14 -13
- package/src/parsing/operations/projection.ts +3 -3
- package/src/parsing/parser.ts +303 -239
- package/src/parsing/token_to_node.ts +67 -50
- package/src/tokenization/token.ts +29 -14
- package/tests/compute/runner.test.ts +277 -165
- package/tests/parsing/parser.test.ts +352 -303
- package/tests/tokenization/tokenizer.test.ts +17 -17
- package/vscode-settings.json.recommended +16 -0
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import Tokenizer from
|
|
1
|
+
import Tokenizer from "../../src/tokenization/tokenizer";
|
|
2
2
|
|
|
3
|
-
test(
|
|
4
|
-
const tokenizer = new Tokenizer(
|
|
3
|
+
test("Tokenizer.tokenize() should return an array of tokens", () => {
|
|
4
|
+
const tokenizer = new Tokenizer("MATCH (n:Person) RETURN n");
|
|
5
5
|
const tokens = tokenizer.tokenize();
|
|
6
6
|
expect(tokens).toBeDefined();
|
|
7
7
|
expect(tokens.length).toBeGreaterThan(0);
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
test(
|
|
10
|
+
test("Tokenizer.tokenize() should handle escaped quotes", () => {
|
|
11
11
|
const tokenizer = new Tokenizer('return "hello \\"world"');
|
|
12
12
|
const tokens = tokenizer.tokenize();
|
|
13
13
|
expect(tokens).toBeDefined();
|
|
14
14
|
expect(tokens.length).toBeGreaterThan(0);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
test(
|
|
18
|
-
const tokenizer = new Tokenizer(
|
|
17
|
+
test("Test predicate function", () => {
|
|
18
|
+
const tokenizer = new Tokenizer("RETURN sum(n in [1, 2, 3] | n where n > 1)");
|
|
19
19
|
const tokens = tokenizer.tokenize();
|
|
20
20
|
expect(tokens).toBeDefined();
|
|
21
21
|
expect(tokens.length).toBeGreaterThan(0);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
test(
|
|
24
|
+
test("Test f-string", () => {
|
|
25
25
|
const tokenizer = new Tokenizer('RETURN f"hello {world}"');
|
|
26
26
|
const tokens = tokenizer.tokenize();
|
|
27
27
|
expect(tokens).toBeDefined();
|
|
28
28
|
expect(tokens.length).toBeGreaterThan(0);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
test(
|
|
32
|
-
const tokenizer = new Tokenizer(
|
|
31
|
+
test("Test", () => {
|
|
32
|
+
const tokenizer = new Tokenizer("WITH 1 AS n RETURN n");
|
|
33
33
|
const tokens = tokenizer.tokenize();
|
|
34
34
|
expect(tokens).toBeDefined();
|
|
35
35
|
expect(tokens.length).toBeGreaterThan(0);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
test(
|
|
39
|
-
const tokenizer = new Tokenizer(
|
|
38
|
+
test("Test associative array with backtick string", () => {
|
|
39
|
+
const tokenizer = new Tokenizer("RETURN {`key`: `value`}");
|
|
40
40
|
const tokens = tokenizer.tokenize();
|
|
41
41
|
expect(tokens).toBeDefined();
|
|
42
42
|
expect(tokens.length).toBeGreaterThan(0);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
test(
|
|
46
|
-
const tokenizer = new Tokenizer(
|
|
45
|
+
test("Test limit", () => {
|
|
46
|
+
const tokenizer = new Tokenizer("unwind range(1, 10) as n limit 5 return n");
|
|
47
47
|
const tokens = tokenizer.tokenize();
|
|
48
48
|
expect(tokens).toBeDefined();
|
|
49
49
|
expect(tokens.length).toBeGreaterThan(0);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
test(
|
|
53
|
-
const tokenizer = new Tokenizer(
|
|
52
|
+
test("Test return -2", () => {
|
|
53
|
+
const tokenizer = new Tokenizer("return [:-2], -2");
|
|
54
54
|
const tokens = tokenizer.tokenize();
|
|
55
55
|
expect(tokens).toBeDefined();
|
|
56
56
|
expect(tokens.length).toBeGreaterThan(0);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
test(
|
|
59
|
+
test("Test range with function", () => {
|
|
60
60
|
const tokenizer = new Tokenizer(`
|
|
61
61
|
with range(1,10) as data
|
|
62
62
|
return range(0, size(data)-1) as indices
|
|
@@ -64,4 +64,4 @@ test('Test range with function', () => {
|
|
|
64
64
|
const tokens = tokenizer.tokenize();
|
|
65
65
|
expect(tokens).toBeDefined();
|
|
66
66
|
expect(tokens.length).toBeGreaterThan(0);
|
|
67
|
-
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Recommended VS Code settings for FlowQuery development
|
|
3
|
+
// Copy this file to .vscode/settings.json to enable format-on-save
|
|
4
|
+
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
7
|
+
"[typescript]": {
|
|
8
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
9
|
+
},
|
|
10
|
+
"[javascript]": {
|
|
11
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
12
|
+
},
|
|
13
|
+
"[json]": {
|
|
14
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
15
|
+
}
|
|
16
|
+
}
|