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