flowquery 1.0.15 → 1.0.17

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 (333) hide show
  1. package/.github/workflows/python-publish.yml +97 -0
  2. package/dist/compute/runner.d.ts +3 -2
  3. package/dist/compute/runner.d.ts.map +1 -1
  4. package/dist/compute/runner.js +7 -7
  5. package/dist/compute/runner.js.map +1 -1
  6. package/dist/flowquery.min.js +1 -1
  7. package/dist/graph/data.d.ts +31 -0
  8. package/dist/graph/data.d.ts.map +1 -0
  9. package/dist/graph/data.js +110 -0
  10. package/dist/graph/data.js.map +1 -0
  11. package/dist/graph/database.d.ts +20 -0
  12. package/dist/graph/database.d.ts.map +1 -0
  13. package/dist/graph/database.js +77 -0
  14. package/dist/graph/database.js.map +1 -0
  15. package/dist/graph/hops.d.ts +11 -0
  16. package/dist/graph/hops.d.ts.map +1 -0
  17. package/dist/graph/hops.js +25 -0
  18. package/dist/graph/hops.js.map +1 -0
  19. package/dist/graph/node.d.ts +35 -0
  20. package/dist/graph/node.d.ts.map +1 -0
  21. package/dist/graph/node.js +113 -0
  22. package/dist/graph/node.js.map +1 -0
  23. package/dist/graph/node_data.d.ts +11 -0
  24. package/dist/graph/node_data.d.ts.map +1 -0
  25. package/dist/graph/node_data.js +20 -0
  26. package/dist/graph/node_data.js.map +1 -0
  27. package/dist/graph/node_reference.d.ts +10 -0
  28. package/dist/graph/node_reference.d.ts.map +1 -0
  29. package/dist/graph/node_reference.js +52 -0
  30. package/dist/graph/node_reference.js.map +1 -0
  31. package/dist/graph/pattern.d.ts +18 -0
  32. package/dist/graph/pattern.d.ts.map +1 -0
  33. package/dist/graph/pattern.js +114 -0
  34. package/dist/graph/pattern.js.map +1 -0
  35. package/dist/graph/pattern_expression.d.ts +14 -0
  36. package/dist/graph/pattern_expression.d.ts.map +1 -0
  37. package/dist/graph/pattern_expression.js +58 -0
  38. package/dist/graph/pattern_expression.js.map +1 -0
  39. package/dist/graph/patterns.d.ts +11 -0
  40. package/dist/graph/patterns.d.ts.map +1 -0
  41. package/dist/graph/patterns.js +49 -0
  42. package/dist/graph/patterns.js.map +1 -0
  43. package/dist/graph/physical_node.d.ts +10 -0
  44. package/dist/graph/physical_node.d.ts.map +1 -0
  45. package/dist/graph/physical_node.js +40 -0
  46. package/dist/graph/physical_node.js.map +1 -0
  47. package/dist/graph/physical_relationship.d.ts +10 -0
  48. package/dist/graph/physical_relationship.d.ts.map +1 -0
  49. package/dist/graph/physical_relationship.js +40 -0
  50. package/dist/graph/physical_relationship.js.map +1 -0
  51. package/dist/graph/relationship.d.ts +40 -0
  52. package/dist/graph/relationship.d.ts.map +1 -0
  53. package/dist/graph/relationship.js +124 -0
  54. package/dist/graph/relationship.js.map +1 -0
  55. package/dist/graph/relationship_data.d.ts +12 -0
  56. package/dist/graph/relationship_data.d.ts.map +1 -0
  57. package/dist/graph/relationship_data.js +40 -0
  58. package/dist/graph/relationship_data.js.map +1 -0
  59. package/dist/graph/relationship_match_collector.d.ts +19 -0
  60. package/dist/graph/relationship_match_collector.d.ts.map +1 -0
  61. package/dist/graph/relationship_match_collector.js +55 -0
  62. package/dist/graph/relationship_match_collector.js.map +1 -0
  63. package/dist/graph/relationship_reference.d.ts +8 -0
  64. package/dist/graph/relationship_reference.d.ts.map +1 -0
  65. package/dist/graph/relationship_reference.js +37 -0
  66. package/dist/graph/relationship_reference.js.map +1 -0
  67. package/dist/parsing/base_parser.d.ts +1 -0
  68. package/dist/parsing/base_parser.d.ts.map +1 -1
  69. package/dist/parsing/base_parser.js +4 -1
  70. package/dist/parsing/base_parser.js.map +1 -1
  71. package/dist/parsing/context.d.ts +2 -2
  72. package/dist/parsing/context.js +5 -5
  73. package/dist/parsing/expressions/boolean.d.ts +8 -0
  74. package/dist/parsing/expressions/boolean.d.ts.map +1 -0
  75. package/dist/parsing/expressions/boolean.js +26 -0
  76. package/dist/parsing/expressions/boolean.js.map +1 -0
  77. package/dist/parsing/expressions/expression.d.ts +4 -1
  78. package/dist/parsing/expressions/expression.d.ts.map +1 -1
  79. package/dist/parsing/expressions/expression.js +15 -8
  80. package/dist/parsing/expressions/expression.js.map +1 -1
  81. package/dist/parsing/expressions/expression_map.d.ts +1 -0
  82. package/dist/parsing/expressions/expression_map.d.ts.map +1 -1
  83. package/dist/parsing/expressions/expression_map.js +3 -0
  84. package/dist/parsing/expressions/expression_map.js.map +1 -1
  85. package/dist/parsing/expressions/operator.d.ts +1 -1
  86. package/dist/parsing/expressions/operator.d.ts.map +1 -1
  87. package/dist/parsing/expressions/operator.js.map +1 -1
  88. package/dist/parsing/functions/function_factory.d.ts +13 -13
  89. package/dist/parsing/functions/function_factory.d.ts.map +1 -1
  90. package/dist/parsing/functions/function_factory.js +20 -18
  91. package/dist/parsing/functions/function_factory.js.map +1 -1
  92. package/dist/parsing/operations/call.d.ts.map +1 -1
  93. package/dist/parsing/operations/call.js +3 -1
  94. package/dist/parsing/operations/call.js.map +1 -1
  95. package/dist/parsing/operations/create_node.d.ts +14 -0
  96. package/dist/parsing/operations/create_node.d.ts.map +1 -0
  97. package/dist/parsing/operations/create_node.js +51 -0
  98. package/dist/parsing/operations/create_node.js.map +1 -0
  99. package/dist/parsing/operations/create_relationship.d.ts +14 -0
  100. package/dist/parsing/operations/create_relationship.d.ts.map +1 -0
  101. package/dist/parsing/operations/create_relationship.js +51 -0
  102. package/dist/parsing/operations/create_relationship.js.map +1 -0
  103. package/dist/parsing/operations/match.d.ts +15 -0
  104. package/dist/parsing/operations/match.d.ts.map +1 -0
  105. package/dist/parsing/operations/match.js +45 -0
  106. package/dist/parsing/operations/match.js.map +1 -0
  107. package/dist/parsing/operations/operation.d.ts +1 -0
  108. package/dist/parsing/operations/operation.d.ts.map +1 -1
  109. package/dist/parsing/operations/operation.js +6 -0
  110. package/dist/parsing/operations/operation.js.map +1 -1
  111. package/dist/parsing/operations/return.d.ts +1 -0
  112. package/dist/parsing/operations/return.d.ts.map +1 -1
  113. package/dist/parsing/operations/return.js +7 -1
  114. package/dist/parsing/operations/return.js.map +1 -1
  115. package/dist/parsing/operations/where.d.ts +1 -1
  116. package/dist/parsing/operations/where.d.ts.map +1 -1
  117. package/dist/parsing/operations/where.js +4 -0
  118. package/dist/parsing/operations/where.js.map +1 -1
  119. package/dist/parsing/parser.d.ts +10 -0
  120. package/dist/parsing/parser.d.ts.map +1 -1
  121. package/dist/parsing/parser.js +344 -5
  122. package/dist/parsing/parser.js.map +1 -1
  123. package/dist/parsing/token_to_node.d.ts.map +1 -1
  124. package/dist/parsing/token_to_node.js +7 -0
  125. package/dist/parsing/token_to_node.js.map +1 -1
  126. package/dist/tokenization/keyword.d.ts +1 -0
  127. package/dist/tokenization/keyword.d.ts.map +1 -1
  128. package/dist/tokenization/keyword.js +1 -0
  129. package/dist/tokenization/keyword.js.map +1 -1
  130. package/dist/tokenization/token.d.ts +4 -0
  131. package/dist/tokenization/token.d.ts.map +1 -1
  132. package/dist/tokenization/token.js +14 -1
  133. package/dist/tokenization/token.js.map +1 -1
  134. package/dist/tokenization/token_type.d.ts +1 -0
  135. package/dist/tokenization/token_type.d.ts.map +1 -1
  136. package/dist/tokenization/token_type.js +1 -0
  137. package/dist/tokenization/token_type.js.map +1 -1
  138. package/dist/tokenization/tokenizer.d.ts +2 -1
  139. package/dist/tokenization/tokenizer.d.ts.map +1 -1
  140. package/dist/tokenization/tokenizer.js +25 -12
  141. package/dist/tokenization/tokenizer.js.map +1 -1
  142. package/docs/flowquery.min.js +1 -1
  143. package/flowquery-py/README.md +166 -0
  144. package/flowquery-py/pyproject.toml +75 -0
  145. package/flowquery-py/setup_env.ps1 +92 -0
  146. package/flowquery-py/setup_env.sh +87 -0
  147. package/flowquery-py/src/__init__.py +34 -0
  148. package/flowquery-py/src/__main__.py +10 -0
  149. package/flowquery-py/src/compute/__init__.py +5 -0
  150. package/flowquery-py/src/compute/runner.py +60 -0
  151. package/flowquery-py/src/extensibility.py +52 -0
  152. package/flowquery-py/src/graph/__init__.py +31 -0
  153. package/flowquery-py/src/graph/data.py +118 -0
  154. package/flowquery-py/src/graph/database.py +82 -0
  155. package/flowquery-py/src/graph/hops.py +43 -0
  156. package/flowquery-py/src/graph/node.py +112 -0
  157. package/flowquery-py/src/graph/node_data.py +26 -0
  158. package/flowquery-py/src/graph/node_reference.py +49 -0
  159. package/flowquery-py/src/graph/pattern.py +125 -0
  160. package/flowquery-py/src/graph/pattern_expression.py +62 -0
  161. package/flowquery-py/src/graph/patterns.py +42 -0
  162. package/flowquery-py/src/graph/physical_node.py +40 -0
  163. package/flowquery-py/src/graph/physical_relationship.py +36 -0
  164. package/flowquery-py/src/graph/relationship.py +135 -0
  165. package/flowquery-py/src/graph/relationship_data.py +33 -0
  166. package/flowquery-py/src/graph/relationship_match_collector.py +77 -0
  167. package/flowquery-py/src/graph/relationship_reference.py +21 -0
  168. package/flowquery-py/src/io/__init__.py +5 -0
  169. package/flowquery-py/src/io/command_line.py +67 -0
  170. package/flowquery-py/src/parsing/__init__.py +17 -0
  171. package/flowquery-py/src/parsing/alias.py +20 -0
  172. package/flowquery-py/src/parsing/alias_option.py +11 -0
  173. package/flowquery-py/src/parsing/ast_node.py +146 -0
  174. package/flowquery-py/src/parsing/base_parser.py +84 -0
  175. package/flowquery-py/src/parsing/components/__init__.py +19 -0
  176. package/flowquery-py/src/parsing/components/csv.py +8 -0
  177. package/flowquery-py/src/parsing/components/from_.py +10 -0
  178. package/flowquery-py/src/parsing/components/headers.py +12 -0
  179. package/flowquery-py/src/parsing/components/json.py +8 -0
  180. package/flowquery-py/src/parsing/components/null.py +10 -0
  181. package/flowquery-py/src/parsing/components/post.py +8 -0
  182. package/flowquery-py/src/parsing/components/text.py +8 -0
  183. package/flowquery-py/src/parsing/context.py +50 -0
  184. package/flowquery-py/src/parsing/data_structures/__init__.py +15 -0
  185. package/flowquery-py/src/parsing/data_structures/associative_array.py +41 -0
  186. package/flowquery-py/src/parsing/data_structures/json_array.py +30 -0
  187. package/flowquery-py/src/parsing/data_structures/key_value_pair.py +38 -0
  188. package/flowquery-py/src/parsing/data_structures/lookup.py +49 -0
  189. package/flowquery-py/src/parsing/data_structures/range_lookup.py +42 -0
  190. package/flowquery-py/src/parsing/expressions/__init__.py +57 -0
  191. package/flowquery-py/src/parsing/expressions/boolean.py +20 -0
  192. package/flowquery-py/src/parsing/expressions/expression.py +138 -0
  193. package/flowquery-py/src/parsing/expressions/expression_map.py +26 -0
  194. package/flowquery-py/src/parsing/expressions/f_string.py +27 -0
  195. package/flowquery-py/src/parsing/expressions/identifier.py +20 -0
  196. package/flowquery-py/src/parsing/expressions/number.py +32 -0
  197. package/flowquery-py/src/parsing/expressions/operator.py +169 -0
  198. package/flowquery-py/src/parsing/expressions/reference.py +47 -0
  199. package/flowquery-py/src/parsing/expressions/string.py +27 -0
  200. package/flowquery-py/src/parsing/functions/__init__.py +75 -0
  201. package/flowquery-py/src/parsing/functions/aggregate_function.py +60 -0
  202. package/flowquery-py/src/parsing/functions/async_function.py +62 -0
  203. package/flowquery-py/src/parsing/functions/avg.py +55 -0
  204. package/flowquery-py/src/parsing/functions/collect.py +75 -0
  205. package/flowquery-py/src/parsing/functions/function.py +68 -0
  206. package/flowquery-py/src/parsing/functions/function_factory.py +173 -0
  207. package/flowquery-py/src/parsing/functions/function_metadata.py +149 -0
  208. package/flowquery-py/src/parsing/functions/functions.py +59 -0
  209. package/flowquery-py/src/parsing/functions/join.py +47 -0
  210. package/flowquery-py/src/parsing/functions/keys.py +34 -0
  211. package/flowquery-py/src/parsing/functions/predicate_function.py +46 -0
  212. package/flowquery-py/src/parsing/functions/predicate_sum.py +47 -0
  213. package/flowquery-py/src/parsing/functions/rand.py +28 -0
  214. package/flowquery-py/src/parsing/functions/range_.py +34 -0
  215. package/flowquery-py/src/parsing/functions/reducer_element.py +15 -0
  216. package/flowquery-py/src/parsing/functions/replace.py +37 -0
  217. package/flowquery-py/src/parsing/functions/round_.py +32 -0
  218. package/flowquery-py/src/parsing/functions/size.py +32 -0
  219. package/flowquery-py/src/parsing/functions/split.py +47 -0
  220. package/flowquery-py/src/parsing/functions/stringify.py +47 -0
  221. package/flowquery-py/src/parsing/functions/sum.py +51 -0
  222. package/flowquery-py/src/parsing/functions/to_json.py +33 -0
  223. package/flowquery-py/src/parsing/functions/type_.py +47 -0
  224. package/flowquery-py/src/parsing/functions/value_holder.py +24 -0
  225. package/flowquery-py/src/parsing/logic/__init__.py +15 -0
  226. package/flowquery-py/src/parsing/logic/case.py +29 -0
  227. package/flowquery-py/src/parsing/logic/else_.py +12 -0
  228. package/flowquery-py/src/parsing/logic/end.py +8 -0
  229. package/flowquery-py/src/parsing/logic/then.py +12 -0
  230. package/flowquery-py/src/parsing/logic/when.py +10 -0
  231. package/flowquery-py/src/parsing/operations/__init__.py +35 -0
  232. package/flowquery-py/src/parsing/operations/aggregated_return.py +24 -0
  233. package/flowquery-py/src/parsing/operations/aggregated_with.py +22 -0
  234. package/flowquery-py/src/parsing/operations/call.py +74 -0
  235. package/flowquery-py/src/parsing/operations/create_node.py +34 -0
  236. package/flowquery-py/src/parsing/operations/create_relationship.py +34 -0
  237. package/flowquery-py/src/parsing/operations/group_by.py +130 -0
  238. package/flowquery-py/src/parsing/operations/limit.py +22 -0
  239. package/flowquery-py/src/parsing/operations/load.py +140 -0
  240. package/flowquery-py/src/parsing/operations/match.py +29 -0
  241. package/flowquery-py/src/parsing/operations/operation.py +69 -0
  242. package/flowquery-py/src/parsing/operations/projection.py +21 -0
  243. package/flowquery-py/src/parsing/operations/return_op.py +50 -0
  244. package/flowquery-py/src/parsing/operations/unwind.py +37 -0
  245. package/flowquery-py/src/parsing/operations/where.py +41 -0
  246. package/flowquery-py/src/parsing/operations/with_op.py +18 -0
  247. package/flowquery-py/src/parsing/parser.py +1011 -0
  248. package/flowquery-py/src/parsing/token_to_node.py +109 -0
  249. package/flowquery-py/src/tokenization/__init__.py +23 -0
  250. package/flowquery-py/src/tokenization/keyword.py +48 -0
  251. package/flowquery-py/src/tokenization/operator.py +29 -0
  252. package/flowquery-py/src/tokenization/string_walker.py +158 -0
  253. package/flowquery-py/src/tokenization/symbol.py +19 -0
  254. package/flowquery-py/src/tokenization/token.py +659 -0
  255. package/flowquery-py/src/tokenization/token_mapper.py +52 -0
  256. package/flowquery-py/src/tokenization/token_type.py +21 -0
  257. package/flowquery-py/src/tokenization/tokenizer.py +214 -0
  258. package/flowquery-py/src/tokenization/trie.py +124 -0
  259. package/flowquery-py/src/utils/__init__.py +6 -0
  260. package/flowquery-py/src/utils/object_utils.py +20 -0
  261. package/flowquery-py/src/utils/string_utils.py +113 -0
  262. package/flowquery-py/tests/__init__.py +1 -0
  263. package/flowquery-py/tests/compute/__init__.py +1 -0
  264. package/flowquery-py/tests/compute/test_runner.py +1335 -0
  265. package/flowquery-py/tests/graph/__init__.py +1 -0
  266. package/flowquery-py/tests/graph/test_create.py +56 -0
  267. package/flowquery-py/tests/graph/test_data.py +73 -0
  268. package/flowquery-py/tests/graph/test_match.py +40 -0
  269. package/flowquery-py/tests/parsing/__init__.py +1 -0
  270. package/flowquery-py/tests/parsing/test_context.py +34 -0
  271. package/flowquery-py/tests/parsing/test_expression.py +49 -0
  272. package/flowquery-py/tests/parsing/test_parser.py +674 -0
  273. package/flowquery-py/tests/test_extensibility.py +611 -0
  274. package/flowquery-py/tests/tokenization/__init__.py +1 -0
  275. package/flowquery-py/tests/tokenization/test_token_mapper.py +60 -0
  276. package/flowquery-py/tests/tokenization/test_tokenizer.py +164 -0
  277. package/flowquery-py/tests/tokenization/test_trie.py +30 -0
  278. package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
  279. package/misc/apps/RAG/package.json +1 -1
  280. package/misc/apps/RAG/src/components/AdaptiveCardRenderer.tsx +76 -8
  281. package/misc/apps/RAG/src/components/index.ts +19 -10
  282. package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +21 -26
  283. package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +24 -25
  284. package/misc/apps/RAG/src/plugins/loaders/Form.ts +163 -147
  285. package/misc/apps/RAG/src/plugins/loaders/Llm.ts +103 -90
  286. package/misc/apps/RAG/src/plugins/loaders/MockData.ts +80 -130
  287. package/misc/apps/RAG/src/plugins/loaders/Table.ts +104 -101
  288. package/misc/apps/RAG/src/plugins/loaders/Weather.ts +47 -36
  289. package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +89 -78
  290. package/package.json +1 -1
  291. package/src/compute/runner.ts +24 -19
  292. package/src/graph/data.ts +112 -0
  293. package/src/graph/database.ts +63 -0
  294. package/src/graph/hops.ts +22 -0
  295. package/src/graph/node.ts +99 -0
  296. package/src/graph/node_data.ts +18 -0
  297. package/src/graph/node_reference.ts +33 -0
  298. package/src/graph/pattern.ts +101 -0
  299. package/src/graph/pattern_expression.ts +37 -0
  300. package/src/graph/patterns.ts +36 -0
  301. package/src/graph/physical_node.ts +23 -0
  302. package/src/graph/physical_relationship.ts +23 -0
  303. package/src/graph/relationship.ts +116 -0
  304. package/src/graph/relationship_data.ts +27 -0
  305. package/src/graph/relationship_match_collector.ts +58 -0
  306. package/src/graph/relationship_reference.ts +24 -0
  307. package/src/parsing/base_parser.ts +20 -14
  308. package/src/parsing/context.ts +14 -14
  309. package/src/parsing/expressions/boolean.ts +21 -0
  310. package/src/parsing/expressions/expression.ts +34 -26
  311. package/src/parsing/expressions/expression_map.ts +3 -0
  312. package/src/parsing/expressions/operator.ts +19 -1
  313. package/src/parsing/functions/function_factory.ts +45 -45
  314. package/src/parsing/operations/call.ts +3 -1
  315. package/src/parsing/operations/create_node.ts +39 -0
  316. package/src/parsing/operations/create_relationship.ts +38 -0
  317. package/src/parsing/operations/match.ts +31 -0
  318. package/src/parsing/operations/operation.ts +3 -0
  319. package/src/parsing/operations/return.ts +11 -7
  320. package/src/parsing/operations/where.ts +10 -6
  321. package/src/parsing/parser.ts +346 -8
  322. package/src/parsing/token_to_node.ts +6 -0
  323. package/src/tokenization/keyword.ts +41 -40
  324. package/src/tokenization/token.ts +21 -1
  325. package/src/tokenization/token_type.ts +2 -1
  326. package/src/tokenization/tokenizer.ts +52 -31
  327. package/tests/compute/runner.test.ts +660 -6
  328. package/tests/extensibility.test.ts +97 -93
  329. package/tests/graph/create.test.ts +36 -0
  330. package/tests/graph/data.test.ts +58 -0
  331. package/tests/graph/match.test.ts +29 -0
  332. package/tests/parsing/parser.test.ts +276 -8
  333. package/tests/tokenization/tokenizer.test.ts +107 -17
@@ -1,19 +1,19 @@
1
1
  import {
2
- Function,
3
2
  AggregateFunction,
4
3
  AsyncFunction,
5
- PredicateFunction,
6
- ReducerElement,
4
+ Function,
5
+ FunctionCategory,
7
6
  FunctionDef,
8
- FunctionMetadata,
9
7
  FunctionDefOptions,
10
- ParameterSchema,
8
+ FunctionMetadata,
11
9
  OutputSchema,
12
- FunctionCategory
10
+ ParameterSchema,
11
+ PredicateFunction,
12
+ ReducerElement,
13
13
  } from "../src/extensibility";
14
14
  import {
15
15
  getFunctionMetadata,
16
- getRegisteredFunctionFactory
16
+ getRegisteredFunctionFactory,
17
17
  } from "../src/parsing/functions/function_metadata";
18
18
 
19
19
  describe("Extensibility API Exports", () => {
@@ -23,12 +23,12 @@ describe("Extensibility API Exports", () => {
23
23
  super("customFunc");
24
24
  this._expectedParameterCount = 1;
25
25
  }
26
-
26
+
27
27
  public value(): string {
28
28
  return "custom value";
29
29
  }
30
30
  }
31
-
31
+
32
32
  const func = new CustomFunction();
33
33
  expect(func.name).toBe("customFunc");
34
34
  expect(func.toString()).toBe("Function (customFunc)");
@@ -42,9 +42,9 @@ describe("Extensibility API Exports", () => {
42
42
  this._expectedParameterCount = 2;
43
43
  }
44
44
  }
45
-
45
+
46
46
  const func = new TwoParamFunction();
47
-
47
+
48
48
  // Should throw when wrong number of parameters
49
49
  expect(() => {
50
50
  func.parameters = [];
@@ -58,7 +58,7 @@ describe("Extensibility API Exports", () => {
58
58
  // _expectedParameterCount is null by default
59
59
  }
60
60
  }
61
-
61
+
62
62
  const func = new FlexibleFunction();
63
63
  // Should not throw
64
64
  func.parameters = [];
@@ -75,37 +75,37 @@ describe("Extensibility API Exports", () => {
75
75
  this._value = v;
76
76
  }
77
77
  }
78
-
78
+
79
79
  class CustomSum extends AggregateFunction {
80
80
  private _total: number = 0;
81
-
81
+
82
82
  constructor() {
83
83
  super("customSum");
84
84
  }
85
-
85
+
86
86
  public reduce(element: ReducerElement): void {
87
87
  this._total += element.value;
88
88
  }
89
-
89
+
90
90
  public element(): ReducerElement {
91
91
  const el = new SumElement();
92
92
  el.value = this._total;
93
93
  return el;
94
94
  }
95
-
95
+
96
96
  public value(): number {
97
97
  return this._total;
98
98
  }
99
99
  }
100
-
100
+
101
101
  const agg = new CustomSum();
102
102
  expect(agg.name).toBe("customSum");
103
-
103
+
104
104
  const elem = new SumElement();
105
105
  elem.value = 5;
106
106
  agg.reduce(elem);
107
107
  expect(agg.value()).toBe(5);
108
-
108
+
109
109
  const elem2 = new SumElement();
110
110
  elem2.value = 3;
111
111
  agg.reduce(elem2);
@@ -117,12 +117,12 @@ describe("Extensibility API Exports", () => {
117
117
  constructor() {
118
118
  super("customPredicate");
119
119
  }
120
-
120
+
121
121
  public value(): boolean {
122
122
  return true;
123
123
  }
124
124
  }
125
-
125
+
126
126
  const pred = new CustomPredicate();
127
127
  expect(pred.name).toBe("customPredicate");
128
128
  expect(pred.toString()).toBe("PredicateFunction (customPredicate)");
@@ -137,16 +137,16 @@ describe("Extensibility API Exports", () => {
137
137
  test("ReducerElement class is exported and can be extended", () => {
138
138
  class NumberElement extends ReducerElement {
139
139
  private _num: number = 0;
140
-
140
+
141
141
  public get value(): number {
142
142
  return this._num;
143
143
  }
144
-
144
+
145
145
  public set value(v: number) {
146
146
  this._num = v;
147
147
  }
148
148
  }
149
-
149
+
150
150
  const elem = new NumberElement();
151
151
  elem.value = 42;
152
152
  expect(elem.value).toBe(42);
@@ -158,23 +158,21 @@ describe("FunctionDef Decorator", () => {
158
158
  @FunctionDef({
159
159
  description: "Test function for extensibility",
160
160
  category: "scalar",
161
- parameters: [
162
- { name: "input", description: "Input value", type: "string" }
163
- ],
161
+ parameters: [{ name: "input", description: "Input value", type: "string" }],
164
162
  output: { description: "Output value", type: "string" },
165
- examples: ["RETURN testExtFunc('hello')"]
163
+ examples: ["RETURN testExtFunc('hello')"],
166
164
  })
167
165
  class TestExtFunc extends Function {
168
166
  constructor() {
169
167
  super("testExtFunc");
170
168
  this._expectedParameterCount = 1;
171
169
  }
172
-
170
+
173
171
  public value(): string {
174
172
  return "test result";
175
173
  }
176
174
  }
177
-
175
+
178
176
  // Verify the decorated class still works correctly
179
177
  const instance = new TestExtFunc();
180
178
  expect(instance.name).toBe("testExtFunc");
@@ -185,23 +183,21 @@ describe("FunctionDef Decorator", () => {
185
183
  @FunctionDef({
186
184
  description: "Test aggregate function",
187
185
  category: "aggregate",
188
- parameters: [
189
- { name: "value", description: "Numeric value", type: "number" }
190
- ],
191
- output: { description: "Aggregated result", type: "number" }
186
+ parameters: [{ name: "value", description: "Numeric value", type: "number" }],
187
+ output: { description: "Aggregated result", type: "number" },
192
188
  })
193
189
  class TestAggExt extends AggregateFunction {
194
190
  private _sum: number = 0;
195
-
191
+
196
192
  constructor() {
197
193
  super("testAggExt");
198
194
  }
199
-
195
+
200
196
  public value(): number {
201
197
  return this._sum;
202
198
  }
203
199
  }
204
-
200
+
205
201
  const instance = new TestAggExt();
206
202
  expect(instance.name).toBe("testAggExt");
207
203
  expect(instance.value()).toBe(0);
@@ -212,9 +208,15 @@ describe("FunctionDef Decorator", () => {
212
208
  description: "Test async provider for extensibility",
213
209
  category: "async",
214
210
  parameters: [
215
- { name: "count", description: "Number of items", type: "number", required: false, default: 1 }
211
+ {
212
+ name: "count",
213
+ description: "Number of items",
214
+ type: "number",
215
+ required: false,
216
+ default: 1,
217
+ },
216
218
  ],
217
- output: { description: "Data object", type: "object" }
219
+ output: { description: "Data object", type: "object" },
218
220
  })
219
221
  class Simple extends AsyncFunction {
220
222
  public async *generate(count: number = 1): AsyncGenerator<any> {
@@ -223,7 +225,7 @@ describe("FunctionDef Decorator", () => {
223
225
  }
224
226
  }
225
227
  }
226
-
228
+
227
229
  // Verify the decorated class still works correctly
228
230
  const loader = new Simple("simple");
229
231
  const results: any[] = [];
@@ -233,12 +235,12 @@ describe("FunctionDef Decorator", () => {
233
235
  expect(results.length).toBe(2);
234
236
  expect(results[0]).toEqual({ id: 0, data: "item0" });
235
237
  expect(results[1]).toEqual({ id: 1, data: "item1" });
236
-
238
+
237
239
  // Verify the async provider was registered
238
240
  const provider = getRegisteredFunctionFactory("simple", "async");
239
241
  expect(provider).toBeDefined();
240
242
  expect(typeof provider).toBe("function");
241
-
243
+
242
244
  // Verify the metadata was registered
243
245
  const metadata = getFunctionMetadata("simple", "async");
244
246
  expect(metadata).toBeDefined();
@@ -251,21 +253,19 @@ describe("FunctionDef Decorator", () => {
251
253
  @FunctionDef({
252
254
  description: "Test predicate function",
253
255
  category: "predicate",
254
- parameters: [
255
- { name: "list", description: "List to check", type: "array" }
256
- ],
257
- output: { description: "Boolean result", type: "boolean" }
256
+ parameters: [{ name: "list", description: "List to check", type: "array" }],
257
+ output: { description: "Boolean result", type: "boolean" },
258
258
  })
259
259
  class TestPredExt extends PredicateFunction {
260
260
  constructor() {
261
261
  super("testPredExt");
262
262
  }
263
-
263
+
264
264
  public value(): boolean {
265
265
  return true;
266
266
  }
267
267
  }
268
-
268
+
269
269
  const instance = new TestPredExt();
270
270
  expect(instance.name).toBe("testPredExt");
271
271
  expect(instance.value()).toBe(true);
@@ -279,9 +279,9 @@ describe("Type Exports", () => {
279
279
  description: "Testing type exports",
280
280
  category: "scalar",
281
281
  parameters: [],
282
- output: { description: "Output", type: "string" }
282
+ output: { description: "Output", type: "string" },
283
283
  };
284
-
284
+
285
285
  expect(meta.name).toBe("typeTest");
286
286
  expect(meta.description).toBe("Testing type exports");
287
287
  });
@@ -293,9 +293,9 @@ describe("Type Exports", () => {
293
293
  type: "string",
294
294
  required: true,
295
295
  default: "default value",
296
- example: "example value"
296
+ example: "example value",
297
297
  };
298
-
298
+
299
299
  expect(param.name).toBe("testParam");
300
300
  expect(param.required).toBe(true);
301
301
  });
@@ -307,20 +307,20 @@ describe("Type Exports", () => {
307
307
  type: "array",
308
308
  items: {
309
309
  description: "Item in array",
310
- type: "string"
311
- }
310
+ type: "string",
311
+ },
312
312
  };
313
-
313
+
314
314
  const objectParam: ParameterSchema = {
315
315
  name: "config",
316
316
  description: "Configuration object",
317
317
  type: "object",
318
318
  properties: {
319
319
  enabled: { description: "Is enabled", type: "boolean" },
320
- value: { description: "Value", type: "number" }
321
- }
320
+ value: { description: "Value", type: "number" },
321
+ },
322
322
  };
323
-
323
+
324
324
  expect(arrayParam.items?.type).toBe("string");
325
325
  expect(objectParam.properties?.enabled.type).toBe("boolean");
326
326
  });
@@ -331,11 +331,11 @@ describe("Type Exports", () => {
331
331
  type: "object",
332
332
  properties: {
333
333
  success: { description: "Success flag", type: "boolean" },
334
- data: { description: "Result data", type: "array" }
334
+ data: { description: "Result data", type: "array" },
335
335
  },
336
- example: { success: true, data: [] }
336
+ example: { success: true, data: [] },
337
337
  };
338
-
338
+
339
339
  expect(output.type).toBe("object");
340
340
  expect(output.properties?.success.type).toBe("boolean");
341
341
  });
@@ -346,7 +346,7 @@ describe("Type Exports", () => {
346
346
  const predicate: FunctionCategory = "predicate";
347
347
  const async: FunctionCategory = "async";
348
348
  const custom: FunctionCategory = "myCustomCategory";
349
-
349
+
350
350
  expect(scalar).toBe("scalar");
351
351
  expect(aggregate).toBe("aggregate");
352
352
  expect(predicate).toBe("predicate");
@@ -360,9 +360,9 @@ describe("Type Exports", () => {
360
360
  category: "scalar",
361
361
  parameters: [],
362
362
  output: { description: "Output", type: "string" },
363
- notes: "Some additional notes"
363
+ notes: "Some additional notes",
364
364
  };
365
-
365
+
366
366
  expect(options.description).toBe("Function options test");
367
367
  expect(options.notes).toBe("Some additional notes");
368
368
  });
@@ -378,14 +378,14 @@ describe("Plugin Functions Integration with FlowQuery", () => {
378
378
  description: "Doubles a number",
379
379
  category: "scalar",
380
380
  parameters: [{ name: "value", description: "Number to double", type: "number" }],
381
- output: { description: "Doubled value", type: "number" }
381
+ output: { description: "Doubled value", type: "number" },
382
382
  })
383
383
  class Double extends Function {
384
384
  constructor() {
385
385
  super("double");
386
386
  this._expectedParameterCount = 1;
387
387
  }
388
-
388
+
389
389
  public value(): number {
390
390
  return this.getChildren()[0].value() * 2;
391
391
  }
@@ -394,7 +394,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
394
394
  // Execute a FlowQuery statement that uses the custom function
395
395
  const runner = new Runner("WITH 5 AS num RETURN double(num) AS result");
396
396
  await runner.run();
397
-
397
+
398
398
  expect(runner.results.length).toBe(1);
399
399
  expect(runner.results[0]).toEqual({ result: 10 });
400
400
  });
@@ -404,25 +404,25 @@ describe("Plugin Functions Integration with FlowQuery", () => {
404
404
  description: "Reverses a string",
405
405
  category: "scalar",
406
406
  parameters: [{ name: "text", description: "String to reverse", type: "string" }],
407
- output: { description: "Reversed string", type: "string" }
407
+ output: { description: "Reversed string", type: "string" },
408
408
  })
409
409
  class StrReverse extends Function {
410
410
  constructor() {
411
411
  super("strreverse");
412
412
  this._expectedParameterCount = 1;
413
413
  }
414
-
414
+
415
415
  public value(): string {
416
416
  const input = String(this.getChildren()[0].value());
417
- return input.split('').reverse().join('');
417
+ return input.split("").reverse().join("");
418
418
  }
419
419
  }
420
420
 
421
421
  const runner = new Runner("WITH 'hello' AS s RETURN strreverse(s) AS reversed");
422
422
  await runner.run();
423
-
423
+
424
424
  expect(runner.results.length).toBe(1);
425
- expect(runner.results[0]).toEqual({ reversed: 'olleh' });
425
+ expect(runner.results[0]).toEqual({ reversed: "olleh" });
426
426
  });
427
427
 
428
428
  test("Custom aggregate function can be used in a FlowQuery statement", async () => {
@@ -441,18 +441,18 @@ describe("Plugin Functions Integration with FlowQuery", () => {
441
441
  description: "Calculates the product of values",
442
442
  category: "aggregate",
443
443
  parameters: [{ name: "value", description: "Number to multiply", type: "number" }],
444
- output: { description: "Product of all values", type: "number" }
444
+ output: { description: "Product of all values", type: "number" },
445
445
  })
446
446
  class Product extends AggregateFunction {
447
447
  constructor() {
448
448
  super("product");
449
449
  this._expectedParameterCount = 1;
450
450
  }
451
-
451
+
452
452
  public reduce(element: ReducerElement): void {
453
453
  element.value = this.firstChild().value();
454
454
  }
455
-
455
+
456
456
  public element(): ReducerElement {
457
457
  return new ProductElement();
458
458
  }
@@ -460,7 +460,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
460
460
 
461
461
  const runner = new Runner("UNWIND [2, 3, 4] AS num RETURN product(num) AS result");
462
462
  await runner.run();
463
-
463
+
464
464
  expect(runner.results.length).toBe(1);
465
465
  expect(runner.results[0]).toEqual({ result: 24 });
466
466
  });
@@ -470,14 +470,14 @@ describe("Plugin Functions Integration with FlowQuery", () => {
470
470
  description: "Adds 100 to a number",
471
471
  category: "scalar",
472
472
  parameters: [{ name: "value", description: "Number", type: "number" }],
473
- output: { description: "Number plus 100", type: "number" }
473
+ output: { description: "Number plus 100", type: "number" },
474
474
  })
475
475
  class AddHundred extends Function {
476
476
  constructor() {
477
477
  super("addhundred");
478
478
  this._expectedParameterCount = 1;
479
479
  }
480
-
480
+
481
481
  public value(): number {
482
482
  return this.getChildren()[0].value() + 100;
483
483
  }
@@ -486,7 +486,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
486
486
  // Use the custom function with expressions
487
487
  const runner = new Runner("WITH 5 * 3 AS num RETURN addhundred(num) + 1 AS result");
488
488
  await runner.run();
489
-
489
+
490
490
  expect(runner.results.length).toBe(1);
491
491
  expect(runner.results[0]).toEqual({ result: 116 }); // (5*3) + 100 + 1 = 116
492
492
  });
@@ -496,14 +496,14 @@ describe("Plugin Functions Integration with FlowQuery", () => {
496
496
  description: "Triples a number",
497
497
  category: "scalar",
498
498
  parameters: [{ name: "value", description: "Number to triple", type: "number" }],
499
- output: { description: "Tripled value", type: "number" }
499
+ output: { description: "Tripled value", type: "number" },
500
500
  })
501
501
  class Triple extends Function {
502
502
  constructor() {
503
503
  super("triple");
504
504
  this._expectedParameterCount = 1;
505
505
  }
506
-
506
+
507
507
  public value(): number {
508
508
  return this.getChildren()[0].value() * 3;
509
509
  }
@@ -513,14 +513,14 @@ describe("Plugin Functions Integration with FlowQuery", () => {
513
513
  description: "Squares a number",
514
514
  category: "scalar",
515
515
  parameters: [{ name: "value", description: "Number to square", type: "number" }],
516
- output: { description: "Squared value", type: "number" }
516
+ output: { description: "Squared value", type: "number" },
517
517
  })
518
518
  class Square extends Function {
519
519
  constructor() {
520
520
  super("square");
521
521
  this._expectedParameterCount = 1;
522
522
  }
523
-
523
+
524
524
  public value(): number {
525
525
  const v = this.getChildren()[0].value();
526
526
  return v * v;
@@ -528,9 +528,11 @@ describe("Plugin Functions Integration with FlowQuery", () => {
528
528
  }
529
529
 
530
530
  // Use both custom functions in a query
531
- const runner = new Runner("WITH 2 AS num RETURN triple(num) AS tripled, square(num) AS squared");
531
+ const runner = new Runner(
532
+ "WITH 2 AS num RETURN triple(num) AS tripled, square(num) AS squared"
533
+ );
532
534
  await runner.run();
533
-
535
+
534
536
  expect(runner.results.length).toBe(1);
535
537
  expect(runner.results[0]).toEqual({ tripled: 6, squared: 4 });
536
538
  });
@@ -540,7 +542,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
540
542
  description: "Provides example data for testing",
541
543
  category: "async",
542
544
  parameters: [],
543
- output: { description: "Example data o.bject", type: "object" }
545
+ output: { description: "Example data o.bject", type: "object" },
544
546
  })
545
547
  class GetExampleData extends AsyncFunction {
546
548
  public async *generate(): AsyncGenerator<any> {
@@ -553,9 +555,11 @@ describe("Plugin Functions Integration with FlowQuery", () => {
553
555
  expect(getRegisteredFunctionFactory("getExampleData", "async")).toBeDefined();
554
556
 
555
557
  // Use the async provider in a FlowQuery statement
556
- const runner = new Runner("LOAD JSON FROM getExampleData() AS data RETURN data.id AS id, data.name AS name");
558
+ const runner = new Runner(
559
+ "LOAD JSON FROM getExampleData() AS data RETURN data.id AS id, data.name AS name"
560
+ );
557
561
  await runner.run();
558
-
562
+
559
563
  expect(runner.results.length).toBe(2);
560
564
  expect(runner.results[0]).toEqual({ id: 1, name: "Alice" });
561
565
  expect(runner.results[1]).toEqual({ id: 2, name: "Bob" });
@@ -566,7 +570,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
566
570
  description: "Test function for case insensitivity",
567
571
  category: "async",
568
572
  parameters: [],
569
- output: { description: "Test data", type: "object" }
573
+ output: { description: "Test data", type: "object" },
570
574
  })
571
575
  class MixedCaseFunc extends AsyncFunction {
572
576
  public async *generate(): AsyncGenerator<any> {
@@ -604,14 +608,14 @@ describe("Plugin Functions Integration with FlowQuery", () => {
604
608
  description: "A unique test function for introspection",
605
609
  category: "scalar",
606
610
  parameters: [{ name: "x", description: "Input value", type: "number" }],
607
- output: { description: "Output value", type: "number" }
611
+ output: { description: "Output value", type: "number" },
608
612
  })
609
613
  class IntrospectTestFunc extends Function {
610
614
  constructor() {
611
615
  super("introspectTestFunc");
612
616
  this._expectedParameterCount = 1;
613
617
  }
614
-
618
+
615
619
  public value(): number {
616
620
  return this.getChildren()[0].value() + 42;
617
621
  }
@@ -630,7 +634,7 @@ describe("Plugin Functions Integration with FlowQuery", () => {
630
634
  RETURN f.name AS name, f.description AS description, f.category AS category
631
635
  `);
632
636
  await runner.run();
633
-
637
+
634
638
  expect(runner.results.length).toBe(1);
635
639
  expect(runner.results[0].name).toBe("introspecttestfunc");
636
640
  expect(runner.results[0].description).toBe("A unique test function for introspection");
@@ -0,0 +1,36 @@
1
+ import Database from "../../src/graph/database";
2
+ import PhysicalNode from "../../src/graph/physical_node";
3
+ import PhysicalRelationship from "../../src/graph/physical_relationship";
4
+ import CreateNode from "../../src/parsing/operations/create_node";
5
+ import CreateRelationship from "../../src/parsing/operations/create_relationship";
6
+ import Parser from "../../src/parsing/parser";
7
+
8
+ test("Test CreateNode operation", async () => {
9
+ const node = new PhysicalNode(null, "Person");
10
+ expect(node.label).toBe("Person");
11
+ expect(node.statement).toBeNull();
12
+ const parser = new Parser();
13
+ const statement = parser.parse("WITH 1 as x RETURN x");
14
+ const op = new CreateNode(node, statement);
15
+ await op.run();
16
+ const db = Database.getInstance();
17
+ const found = db.getNode(node);
18
+ expect(found!.label).toBe(node.label);
19
+ const data = await found!.data();
20
+ expect(data).toEqual([{ x: 1 }]);
21
+ });
22
+
23
+ test("Test CreateRelationship operation", async () => {
24
+ const relationship = new PhysicalRelationship();
25
+ relationship.type = "KNOWS";
26
+ expect(relationship.type).toBe("KNOWS");
27
+ expect(relationship.statement).toBeNull();
28
+ const parser = new Parser();
29
+ const statement = parser.parse("WITH 1 as x RETURN x");
30
+ const op = new CreateRelationship(relationship, statement);
31
+ await op.run();
32
+ const db = Database.getInstance();
33
+ const found = db.getRelationship(relationship);
34
+ const data = await found!.data();
35
+ expect(data).toEqual([{ x: 1 }]);
36
+ });
@@ -0,0 +1,58 @@
1
+ import Data from "../../src/graph/data";
2
+ import NodeData from "../../src/graph/node_data";
3
+ import RelationshipData from "../../src/graph/relationship_data";
4
+
5
+ test("Data iteration", () => {
6
+ const records = [
7
+ { id: "1", name: "Alice" },
8
+ { id: "2", name: "Bob" },
9
+ { id: "3", name: "Charlie" },
10
+ ];
11
+ const data = new Data(records);
12
+ expect(data.next()).toBe(true);
13
+ expect(data.next()).toBe(true);
14
+ expect(data.next()).toBe(true);
15
+ expect(data.next()).toBe(false);
16
+ });
17
+
18
+ test("Data find", () => {
19
+ const records = [
20
+ { id: "1", name: "Alice" },
21
+ { id: "2", name: "Bob" },
22
+ { id: "3", name: "Charlie" },
23
+ { id: "2", name: "Bob Duplicate" },
24
+ ];
25
+ const data: NodeData = new NodeData(records);
26
+ data.find("2");
27
+ expect(data.current()).toEqual({ id: "2", name: "Bob" });
28
+ expect(data.find("2")).toBe(true);
29
+ expect(data.current()).toEqual({ id: "2", name: "Bob Duplicate" });
30
+ expect(data.find("2")).toBe(false);
31
+ });
32
+
33
+ test("Data find non-existing", () => {
34
+ const records = [
35
+ { id: "1", name: "Alice" },
36
+ { id: "2", name: "Bob" },
37
+ ];
38
+ const data: NodeData = new NodeData(records);
39
+ expect(data.find("3")).toBe(false);
40
+ });
41
+
42
+ test("RelationshipData find", () => {
43
+ const records = [
44
+ { left_id: "1", right_id: "2", type: "FRIEND", id: "r1" },
45
+ { left_id: "2", right_id: "3", type: "COLLEAGUE", id: "r2" },
46
+ { left_id: "1", right_id: "3", type: "FRIEND", id: "r3" },
47
+ ];
48
+ const data: RelationshipData = new RelationshipData(records);
49
+ data.find("1");
50
+ expect(data.current()).toEqual({ left_id: "1", right_id: "2", type: "FRIEND", id: "r1" });
51
+ expect(data.find("1")).toBe(true);
52
+ expect(data.current()).toEqual({ left_id: "1", right_id: "3", type: "FRIEND", id: "r3" });
53
+ expect(data.find("1")).toBe(false);
54
+ expect(data.find("2")).toBe(true);
55
+ expect(data.current()).toEqual({ left_id: "2", right_id: "3", type: "COLLEAGUE", id: "r2" });
56
+ expect(data.find("2")).toBe(false);
57
+ expect(data.find("4")).toBe(false);
58
+ });