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.
Files changed (268) hide show
  1. package/README.md +182 -0
  2. package/dist/compute/runner.d.ts +81 -0
  3. package/dist/compute/runner.d.ts.map +1 -0
  4. package/dist/extensibility.d.ts +9 -0
  5. package/dist/extensibility.d.ts.map +1 -0
  6. package/dist/extensibility.js +25 -0
  7. package/dist/extensibility.js.map +1 -0
  8. package/dist/flowquery.min.js +1 -1
  9. package/dist/index.browser.d.ts +10 -0
  10. package/dist/index.browser.d.ts.map +1 -0
  11. package/dist/index.d.ts +9 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.node.d.ts +14 -0
  14. package/dist/index.node.d.ts.map +1 -0
  15. package/dist/io/command_line.d.ts +28 -0
  16. package/dist/io/command_line.d.ts.map +1 -0
  17. package/dist/parsing/alias.d.ts +10 -0
  18. package/dist/parsing/alias.d.ts.map +1 -0
  19. package/dist/parsing/alias_option.d.ts +6 -0
  20. package/dist/parsing/alias_option.d.ts.map +1 -0
  21. package/dist/parsing/ast_node.d.ts +100 -0
  22. package/dist/parsing/ast_node.d.ts.map +1 -0
  23. package/dist/parsing/base_parser.d.ts +49 -0
  24. package/dist/parsing/base_parser.d.ts.map +1 -0
  25. package/dist/parsing/components/csv.d.ts +6 -0
  26. package/dist/parsing/components/csv.d.ts.map +1 -0
  27. package/dist/parsing/components/from.d.ts +7 -0
  28. package/dist/parsing/components/from.d.ts.map +1 -0
  29. package/dist/parsing/components/headers.d.ts +7 -0
  30. package/dist/parsing/components/headers.d.ts.map +1 -0
  31. package/dist/parsing/components/json.d.ts +6 -0
  32. package/dist/parsing/components/json.d.ts.map +1 -0
  33. package/dist/parsing/components/null.d.ts +6 -0
  34. package/dist/parsing/components/null.d.ts.map +1 -0
  35. package/dist/parsing/components/post.d.ts +6 -0
  36. package/dist/parsing/components/post.d.ts.map +1 -0
  37. package/dist/parsing/components/text.d.ts +6 -0
  38. package/dist/parsing/components/text.d.ts.map +1 -0
  39. package/dist/parsing/context.d.ts +38 -0
  40. package/dist/parsing/context.d.ts.map +1 -0
  41. package/dist/parsing/data_structures/associative_array.d.ts +28 -0
  42. package/dist/parsing/data_structures/associative_array.d.ts.map +1 -0
  43. package/dist/parsing/data_structures/json_array.d.ts +26 -0
  44. package/dist/parsing/data_structures/json_array.d.ts.map +1 -0
  45. package/dist/parsing/data_structures/key_value_pair.d.ts +25 -0
  46. package/dist/parsing/data_structures/key_value_pair.d.ts.map +1 -0
  47. package/dist/parsing/data_structures/lookup.d.ts +25 -0
  48. package/dist/parsing/data_structures/lookup.d.ts.map +1 -0
  49. package/dist/parsing/data_structures/range_lookup.d.ts +14 -0
  50. package/dist/parsing/data_structures/range_lookup.d.ts.map +1 -0
  51. package/dist/parsing/expressions/expression.d.ts +53 -0
  52. package/dist/parsing/expressions/expression.d.ts.map +1 -0
  53. package/dist/parsing/expressions/f_string.d.ts +21 -0
  54. package/dist/parsing/expressions/f_string.d.ts.map +1 -0
  55. package/dist/parsing/expressions/identifier.d.ts +17 -0
  56. package/dist/parsing/expressions/identifier.d.ts.map +1 -0
  57. package/dist/parsing/expressions/number.d.ts +25 -0
  58. package/dist/parsing/expressions/number.d.ts.map +1 -0
  59. package/dist/parsing/expressions/operator.d.ts +79 -0
  60. package/dist/parsing/expressions/operator.d.ts.map +1 -0
  61. package/dist/parsing/expressions/reference.d.ts +29 -0
  62. package/dist/parsing/expressions/reference.d.ts.map +1 -0
  63. package/dist/parsing/expressions/string.d.ts +23 -0
  64. package/dist/parsing/expressions/string.d.ts.map +1 -0
  65. package/dist/parsing/functions/aggregate_function.d.ts +42 -0
  66. package/dist/parsing/functions/aggregate_function.d.ts.map +1 -0
  67. package/dist/parsing/functions/async_function.d.ts +52 -0
  68. package/dist/parsing/functions/async_function.d.ts.map +1 -0
  69. package/dist/parsing/functions/avg.d.ts +15 -0
  70. package/dist/parsing/functions/avg.d.ts.map +1 -0
  71. package/dist/parsing/functions/avg.js +20 -2
  72. package/dist/parsing/functions/avg.js.map +1 -1
  73. package/dist/parsing/functions/collect.d.ts +21 -0
  74. package/dist/parsing/functions/collect.d.ts.map +1 -0
  75. package/dist/parsing/functions/collect.js +20 -2
  76. package/dist/parsing/functions/collect.js.map +1 -1
  77. package/dist/parsing/functions/extensibility/index.d.ts +37 -0
  78. package/dist/parsing/functions/extensibility/index.d.ts.map +1 -0
  79. package/dist/parsing/functions/extensibility/index.js +50 -0
  80. package/dist/parsing/functions/extensibility/index.js.map +1 -0
  81. package/dist/parsing/functions/function.d.ts +36 -0
  82. package/dist/parsing/functions/function.d.ts.map +1 -0
  83. package/dist/parsing/functions/function_factory.d.ts +174 -0
  84. package/dist/parsing/functions/function_factory.d.ts.map +1 -0
  85. package/dist/parsing/functions/function_factory.js +44 -47
  86. package/dist/parsing/functions/function_factory.js.map +1 -1
  87. package/dist/parsing/functions/function_metadata.d.ts +134 -0
  88. package/dist/parsing/functions/function_metadata.d.ts.map +1 -0
  89. package/dist/parsing/functions/function_metadata.js +103 -153
  90. package/dist/parsing/functions/function_metadata.js.map +1 -1
  91. package/dist/parsing/functions/functions.d.ts +21 -0
  92. package/dist/parsing/functions/functions.d.ts.map +1 -0
  93. package/dist/parsing/functions/functions.js +37 -2
  94. package/dist/parsing/functions/functions.js.map +1 -1
  95. package/dist/parsing/functions/join.d.ts +9 -0
  96. package/dist/parsing/functions/join.d.ts.map +1 -0
  97. package/dist/parsing/functions/join.js +21 -2
  98. package/dist/parsing/functions/join.js.map +1 -1
  99. package/dist/parsing/functions/predicate_function.d.ts +19 -0
  100. package/dist/parsing/functions/predicate_function.d.ts.map +1 -0
  101. package/dist/parsing/functions/predicate_function.js +3 -0
  102. package/dist/parsing/functions/predicate_function.js.map +1 -1
  103. package/dist/parsing/functions/predicate_sum.d.ts +7 -0
  104. package/dist/parsing/functions/predicate_sum.d.ts.map +1 -0
  105. package/dist/parsing/functions/predicate_sum.js +23 -2
  106. package/dist/parsing/functions/predicate_sum.js.map +1 -1
  107. package/dist/parsing/functions/rand.d.ts +7 -0
  108. package/dist/parsing/functions/rand.d.ts.map +1 -0
  109. package/dist/parsing/functions/rand.js +18 -2
  110. package/dist/parsing/functions/rand.js.map +1 -1
  111. package/dist/parsing/functions/range.d.ts +7 -0
  112. package/dist/parsing/functions/range.d.ts.map +1 -0
  113. package/dist/parsing/functions/range.js +21 -2
  114. package/dist/parsing/functions/range.js.map +1 -1
  115. package/dist/parsing/functions/reducer_element.d.ts +6 -0
  116. package/dist/parsing/functions/reducer_element.d.ts.map +1 -0
  117. package/dist/parsing/functions/replace.d.ts +7 -0
  118. package/dist/parsing/functions/replace.d.ts.map +1 -0
  119. package/dist/parsing/functions/replace.js +22 -2
  120. package/dist/parsing/functions/replace.js.map +1 -1
  121. package/dist/parsing/functions/round.d.ts +7 -0
  122. package/dist/parsing/functions/round.d.ts.map +1 -0
  123. package/dist/parsing/functions/round.js +20 -2
  124. package/dist/parsing/functions/round.js.map +1 -1
  125. package/dist/parsing/functions/size.d.ts +7 -0
  126. package/dist/parsing/functions/size.d.ts.map +1 -0
  127. package/dist/parsing/functions/size.js +20 -2
  128. package/dist/parsing/functions/size.js.map +1 -1
  129. package/dist/parsing/functions/split.d.ts +9 -0
  130. package/dist/parsing/functions/split.d.ts.map +1 -0
  131. package/dist/parsing/functions/split.js +21 -2
  132. package/dist/parsing/functions/split.js.map +1 -1
  133. package/dist/parsing/functions/stringify.d.ts +9 -0
  134. package/dist/parsing/functions/stringify.d.ts.map +1 -0
  135. package/dist/parsing/functions/stringify.js +20 -2
  136. package/dist/parsing/functions/stringify.js.map +1 -1
  137. package/dist/parsing/functions/sum.d.ts +14 -0
  138. package/dist/parsing/functions/sum.d.ts.map +1 -0
  139. package/dist/parsing/functions/sum.js +20 -2
  140. package/dist/parsing/functions/sum.js.map +1 -1
  141. package/dist/parsing/functions/to_json.d.ts +7 -0
  142. package/dist/parsing/functions/to_json.d.ts.map +1 -0
  143. package/dist/parsing/functions/to_json.js +20 -2
  144. package/dist/parsing/functions/to_json.js.map +1 -1
  145. package/dist/parsing/functions/value_holder.d.ts +8 -0
  146. package/dist/parsing/functions/value_holder.d.ts.map +1 -0
  147. package/dist/parsing/logic/case.d.ts +7 -0
  148. package/dist/parsing/logic/case.d.ts.map +1 -0
  149. package/dist/parsing/logic/else.d.ts +7 -0
  150. package/dist/parsing/logic/else.d.ts.map +1 -0
  151. package/dist/parsing/logic/end.d.ts +6 -0
  152. package/dist/parsing/logic/end.d.ts.map +1 -0
  153. package/dist/parsing/logic/then.d.ts +7 -0
  154. package/dist/parsing/logic/then.d.ts.map +1 -0
  155. package/dist/parsing/logic/when.d.ts +7 -0
  156. package/dist/parsing/logic/when.d.ts.map +1 -0
  157. package/dist/parsing/operations/aggregated_return.d.ts +8 -0
  158. package/dist/parsing/operations/aggregated_return.d.ts.map +1 -0
  159. package/dist/parsing/operations/aggregated_with.d.ts +8 -0
  160. package/dist/parsing/operations/aggregated_with.d.ts.map +1 -0
  161. package/dist/parsing/operations/group_by.d.ts +35 -0
  162. package/dist/parsing/operations/group_by.d.ts.map +1 -0
  163. package/dist/parsing/operations/limit.d.ts +10 -0
  164. package/dist/parsing/operations/limit.d.ts.map +1 -0
  165. package/dist/parsing/operations/load.d.ts +48 -0
  166. package/dist/parsing/operations/load.d.ts.map +1 -0
  167. package/dist/parsing/operations/operation.d.ts +39 -0
  168. package/dist/parsing/operations/operation.d.ts.map +1 -0
  169. package/dist/parsing/operations/projection.d.ts +8 -0
  170. package/dist/parsing/operations/projection.d.ts.map +1 -0
  171. package/dist/parsing/operations/return.d.ts +23 -0
  172. package/dist/parsing/operations/return.d.ts.map +1 -0
  173. package/dist/parsing/operations/unwind.d.ts +12 -0
  174. package/dist/parsing/operations/unwind.d.ts.map +1 -0
  175. package/dist/parsing/operations/where.d.ts +26 -0
  176. package/dist/parsing/operations/where.d.ts.map +1 -0
  177. package/dist/parsing/operations/with.d.ts +17 -0
  178. package/dist/parsing/operations/with.d.ts.map +1 -0
  179. package/dist/parsing/parser.d.ts +66 -0
  180. package/dist/parsing/parser.d.ts.map +1 -0
  181. package/dist/parsing/parser.js +2 -3
  182. package/dist/parsing/parser.js.map +1 -1
  183. package/dist/parsing/token_to_node.d.ts +7 -0
  184. package/dist/parsing/token_to_node.d.ts.map +1 -0
  185. package/dist/tokenization/keyword.d.ts +43 -0
  186. package/dist/tokenization/keyword.d.ts.map +1 -0
  187. package/dist/tokenization/operator.d.ts +22 -0
  188. package/dist/tokenization/operator.d.ts.map +1 -0
  189. package/dist/tokenization/string_walker.d.ts +55 -0
  190. package/dist/tokenization/string_walker.d.ts.map +1 -0
  191. package/dist/tokenization/symbol.d.ts +15 -0
  192. package/dist/tokenization/symbol.d.ts.map +1 -0
  193. package/dist/tokenization/token.d.ts +176 -0
  194. package/dist/tokenization/token.d.ts.map +1 -0
  195. package/dist/tokenization/token_mapper.d.ts +40 -0
  196. package/dist/tokenization/token_mapper.d.ts.map +1 -0
  197. package/dist/tokenization/token_type.d.ts +16 -0
  198. package/dist/tokenization/token_type.d.ts.map +1 -0
  199. package/dist/tokenization/tokenizer.d.ts +45 -0
  200. package/dist/tokenization/tokenizer.d.ts.map +1 -0
  201. package/dist/tokenization/trie.d.ts +41 -0
  202. package/dist/tokenization/trie.d.ts.map +1 -0
  203. package/dist/utils/object_utils.d.ts +15 -0
  204. package/dist/utils/object_utils.d.ts.map +1 -0
  205. package/dist/utils/string_utils.d.ts +51 -0
  206. package/dist/utils/string_utils.d.ts.map +1 -0
  207. package/docs/flowquery.min.js +1 -1
  208. package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
  209. package/misc/apps/RAG/.env.example +14 -0
  210. package/misc/apps/RAG/README.md +0 -7
  211. package/misc/apps/RAG/package.json +16 -7
  212. package/misc/apps/RAG/public/index.html +18 -0
  213. package/misc/apps/RAG/src/App.css +42 -0
  214. package/misc/apps/RAG/src/App.tsx +50 -0
  215. package/misc/apps/RAG/src/components/ApiKeySettings.tsx +245 -0
  216. package/misc/apps/RAG/src/components/ChatContainer.css +67 -0
  217. package/misc/apps/RAG/src/components/ChatContainer.tsx +239 -0
  218. package/misc/apps/RAG/src/components/ChatInput.css +23 -0
  219. package/misc/apps/RAG/src/components/ChatInput.tsx +62 -0
  220. package/misc/apps/RAG/src/components/ChatMessage.css +136 -0
  221. package/misc/apps/RAG/src/components/ChatMessage.tsx +152 -0
  222. package/misc/apps/RAG/src/components/FlowQueryAgent.ts +390 -0
  223. package/misc/apps/RAG/src/components/FlowQueryRunner.css +104 -0
  224. package/misc/apps/RAG/src/components/FlowQueryRunner.tsx +332 -0
  225. package/misc/apps/RAG/src/components/index.ts +15 -0
  226. package/misc/apps/RAG/src/index.tsx +17 -0
  227. package/misc/apps/RAG/src/plugins/PluginRegistry.ts +136 -0
  228. package/misc/apps/RAG/src/plugins/README.md +139 -0
  229. package/misc/apps/RAG/src/plugins/index.ts +72 -0
  230. package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +79 -0
  231. package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +71 -0
  232. package/misc/apps/RAG/src/plugins/loaders/Llm.ts +441 -0
  233. package/misc/apps/RAG/src/plugins/loaders/MockData.ts +161 -0
  234. package/misc/apps/RAG/src/plugins/types.ts +52 -0
  235. package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +385 -0
  236. package/misc/apps/RAG/src/prompts/index.ts +10 -0
  237. package/misc/apps/RAG/src/utils/FlowQueryExecutor.ts +131 -0
  238. package/misc/apps/RAG/src/utils/FlowQueryExtractor.ts +203 -0
  239. package/misc/apps/RAG/src/utils/index.ts +9 -0
  240. package/misc/apps/RAG/tsconfig.json +4 -2
  241. package/misc/apps/RAG/webpack.config.js +23 -12
  242. package/package.json +7 -1
  243. package/src/extensibility.ts +9 -0
  244. package/src/parsing/functions/avg.ts +10 -0
  245. package/src/parsing/functions/collect.ts +10 -0
  246. package/src/parsing/functions/extensibility/index.ts +54 -0
  247. package/src/parsing/functions/function_factory.ts +51 -48
  248. package/src/parsing/functions/function_metadata.ts +132 -156
  249. package/src/parsing/functions/functions.ts +27 -0
  250. package/src/parsing/functions/join.ts +11 -0
  251. package/src/parsing/functions/predicate_function.ts +4 -0
  252. package/src/parsing/functions/predicate_sum.ts +13 -0
  253. package/src/parsing/functions/rand.ts +8 -0
  254. package/src/parsing/functions/range.ts +11 -0
  255. package/src/parsing/functions/replace.ts +12 -0
  256. package/src/parsing/functions/round.ts +10 -0
  257. package/src/parsing/functions/size.ts +10 -0
  258. package/src/parsing/functions/split.ts +11 -0
  259. package/src/parsing/functions/stringify.ts +10 -0
  260. package/src/parsing/functions/sum.ts +10 -0
  261. package/src/parsing/functions/to_json.ts +10 -0
  262. package/src/parsing/parser.ts +2 -3
  263. package/tests/parsing/function_plugins.test.ts +11 -11
  264. package/tsconfig.json +4 -1
  265. package/dist/parsing/functions/predicate_function_factory.js +0 -19
  266. package/dist/parsing/functions/predicate_function_factory.js.map +0 -1
  267. package/misc/apps/RAG/src/index.ts +0 -20
  268. package/src/parsing/functions/predicate_function_factory.ts +0 -15
@@ -0,0 +1,29 @@
1
+ import ASTNode from "../ast_node";
2
+ import Identifier from "./identifier";
3
+ /**
4
+ * Represents a reference to a previously defined variable or expression.
5
+ *
6
+ * References point to values defined earlier in the query (e.g., in WITH or LOAD statements).
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const ref = new Reference("myVar", previousNode);
11
+ * console.log(ref.value()); // Gets value from referred node
12
+ * ```
13
+ */
14
+ declare class Reference extends Identifier {
15
+ private _referred;
16
+ /**
17
+ * Creates a new Reference to a variable.
18
+ *
19
+ * @param value - The identifier name
20
+ * @param referred - The node this reference points to (optional)
21
+ */
22
+ constructor(value: string, referred?: ASTNode | undefined);
23
+ set referred(node: ASTNode);
24
+ toString(): string;
25
+ value(): any;
26
+ get identifier(): string;
27
+ }
28
+ export default Reference;
29
+ //# sourceMappingURL=reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/parsing/expressions/reference.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,cAAM,SAAU,SAAQ,UAAU;IAC9B,OAAO,CAAC,SAAS,CAAkC;IAEnD;;;;;OAKG;gBACS,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,GAAG,SAAqB;IAIpE,IAAW,QAAQ,CAAC,IAAI,EAAE,OAAO,EAEhC;IACM,QAAQ,IAAI,MAAM;IAGlB,KAAK,IAAI,GAAG;IAGnB,IAAW,UAAU,IAAI,MAAM,CAE9B;CACJ;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,23 @@
1
+ import ASTNode from "../ast_node";
2
+ /**
3
+ * Represents a string literal in the AST.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const str = new String("hello");
8
+ * console.log(str.value()); // "hello"
9
+ * ```
10
+ */
11
+ declare class String extends ASTNode {
12
+ protected _value: string;
13
+ /**
14
+ * Creates a new String node with the given value.
15
+ *
16
+ * @param value - The string value
17
+ */
18
+ constructor(value: string);
19
+ value(): string;
20
+ toString(): string;
21
+ }
22
+ export default String;
23
+ //# sourceMappingURL=string.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/parsing/expressions/string.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;;;;GAQG;AACH,cAAM,MAAO,SAAQ,OAAO;IACxB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;gBACS,KAAK,EAAE,MAAM;IAKlB,KAAK,IAAI,MAAM;IAIf,QAAQ,IAAI,MAAM;CAG5B;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,42 @@
1
+ import Function from "./function";
2
+ import ReducerElement from "./reducer_element";
3
+ /**
4
+ * Base class for aggregate functions that reduce multiple values to a single value.
5
+ *
6
+ * Aggregate functions like SUM, AVG, and COLLECT process multiple input values
7
+ * and produce a single output. They cannot be nested within other aggregate functions.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const sumFunc = new Sum();
12
+ * // Used in: RETURN SUM(values)
13
+ * ```
14
+ */
15
+ declare class AggregateFunction extends Function {
16
+ private _overridden;
17
+ /**
18
+ * Creates a new AggregateFunction with the given name.
19
+ *
20
+ * @param name - The function name
21
+ */
22
+ constructor(name: string);
23
+ /**
24
+ * Processes a value during the aggregation phase.
25
+ *
26
+ * @param value - The element to aggregate
27
+ * @throws {Error} If not implemented by subclass
28
+ */
29
+ reduce(value: ReducerElement): void;
30
+ /**
31
+ * Creates a reducer element for this aggregate function.
32
+ *
33
+ * @returns A ReducerElement instance
34
+ * @throws {Error} If not implemented by subclass
35
+ */
36
+ element(): ReducerElement;
37
+ get overridden(): any | null;
38
+ set overridden(value: any | null);
39
+ value(): any;
40
+ }
41
+ export default AggregateFunction;
42
+ //# sourceMappingURL=aggregate_function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate_function.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/aggregate_function.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,cAAM,iBAAkB,SAAQ,QAAQ;IACpC,OAAO,CAAC,WAAW,CAAoB;IAEvC;;;;OAIG;gBACS,IAAI,EAAE,MAAM;IAIxB;;;;;OAKG;IACI,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAI1C;;;;;OAKG;IACI,OAAO,IAAI,cAAc;IAGhC,IAAW,UAAU,IAAI,GAAG,GAAG,IAAI,CAElC;IACD,IAAW,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,EAEtC;IACM,KAAK,IAAI,GAAG;CAGtB;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import ASTNode from "../ast_node";
2
+ /**
3
+ * Represents an async data provider function call for use in LOAD operations.
4
+ *
5
+ * This class holds the function name and arguments, and provides async iteration
6
+ * over the results from a registered async data provider.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Used in: LOAD JSON FROM myDataSource('arg1', 'arg2') AS data
11
+ * const asyncFunc = new AsyncFunction("myDataSource");
12
+ * asyncFunc.parameters = [arg1Node, arg2Node];
13
+ * for await (const item of asyncFunc.execute()) {
14
+ * console.log(item);
15
+ * }
16
+ * ```
17
+ */
18
+ declare class AsyncFunction extends ASTNode {
19
+ private _name;
20
+ /**
21
+ * Creates a new AsyncFunction with the given name.
22
+ *
23
+ * @param name - The function name (must be registered as an async provider)
24
+ */
25
+ constructor(name: string);
26
+ /**
27
+ * Gets the function name.
28
+ */
29
+ get name(): string;
30
+ /**
31
+ * Sets the function parameters.
32
+ *
33
+ * @param nodes - Array of AST nodes representing the function arguments
34
+ */
35
+ set parameters(nodes: ASTNode[]);
36
+ /**
37
+ * Evaluates all parameters and returns their values.
38
+ *
39
+ * @returns Array of parameter values
40
+ */
41
+ private getArguments;
42
+ /**
43
+ * Executes the async data provider function and yields results.
44
+ *
45
+ * @yields Data items from the async provider
46
+ * @throws {Error} If the function is not registered as an async provider
47
+ */
48
+ execute(): AsyncGenerator<any, void, unknown>;
49
+ toString(): string;
50
+ }
51
+ export default AsyncFunction;
52
+ //# sourceMappingURL=async_function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async_function.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/async_function.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC;;;;;;;;;;;;;;;GAeG;AACH,cAAM,aAAc,SAAQ,OAAO;IAC/B,OAAO,CAAC,KAAK,CAAS;IAEtB;;;;OAIG;gBACS,IAAI,EAAE,MAAM;IAKxB;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACH,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,EAErC;IAED;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;OAKG;IACW,OAAO,IAAI,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC;IA0BpD,QAAQ,IAAI,MAAM;CAG5B;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ import AggregateFunction from "./aggregate_function";
2
+ import ReducerElement from "./reducer_element";
3
+ declare class AvgReducerElement extends ReducerElement {
4
+ private _count;
5
+ private _sum;
6
+ get value(): number | null;
7
+ set value(value: number);
8
+ }
9
+ declare class Avg extends AggregateFunction {
10
+ constructor();
11
+ reduce(element: AvgReducerElement): void;
12
+ element(): AvgReducerElement;
13
+ }
14
+ export default Avg;
15
+ //# sourceMappingURL=avg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avg.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/avg.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AAErD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,cAAM,iBAAkB,SAAQ,cAAc;IAC1C,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,IAAI,CAAuB;IACnC,IAAW,KAAK,IAAI,MAAM,GAAG,IAAI,CAKhC;IACD,IAAW,KAAK,CAAC,KAAK,EAAE,MAAM,EAO7B;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 AvgReducerElement extends reducer_element_1.default {
9
16
  constructor() {
10
17
  super(...arguments);
@@ -27,7 +34,7 @@ class AvgReducerElement extends reducer_element_1.default {
27
34
  }
28
35
  }
29
36
  }
30
- class Avg extends aggregate_function_1.default {
37
+ let Avg = class Avg extends aggregate_function_1.default {
31
38
  constructor() {
32
39
  super("avg");
33
40
  this._expectedParameterCount = 1;
@@ -38,6 +45,17 @@ class Avg extends aggregate_function_1.default {
38
45
  element() {
39
46
  return new AvgReducerElement();
40
47
  }
41
- }
48
+ };
49
+ Avg = __decorate([
50
+ (0, function_metadata_1.FunctionDef)({
51
+ description: "Calculates the average of numeric values across grouped rows",
52
+ category: "aggregate",
53
+ parameters: [
54
+ { name: "value", description: "Numeric value to average", type: "number" }
55
+ ],
56
+ output: { description: "Average of all values", type: "number", example: 50 },
57
+ examples: ["WITH [10, 20, 30] AS nums UNWIND nums AS n RETURN avg(n)"]
58
+ })
59
+ ], Avg);
42
60
  exports.default = Avg;
43
61
  //# sourceMappingURL=avg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"avg.js","sourceRoot":"","sources":["../../../src/parsing/functions/avg.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AAErD,wEAA+C;AAE/C,MAAM,iBAAkB,SAAQ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AO,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,CAAC;IACD,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;QACjB,IAAG,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC;QACvB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACtB,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,8DAA8D;QAC3E,QAAQ,EAAE,WAAW;QACrB,UAAU,EAAE;YACR,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC7E;QACD,MAAM,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC7E,QAAQ,EAAE,CAAC,0DAA0D,CAAC;KACzE,CAAC;GACI,GAAG,CAWR;AAED,kBAAe,GAAG,CAAC"}
@@ -0,0 +1,21 @@
1
+ import AggregateFunction from "./aggregate_function";
2
+ import ReducerElement from "./reducer_element";
3
+ declare class CollectReducerElement extends ReducerElement {
4
+ private _value;
5
+ get value(): any;
6
+ set value(value: any);
7
+ }
8
+ declare class DistinctCollectReducerElement extends ReducerElement {
9
+ private _value;
10
+ get value(): any;
11
+ set value(value: any);
12
+ }
13
+ declare class Collect extends AggregateFunction {
14
+ private _distinct;
15
+ constructor();
16
+ reduce(element: CollectReducerElement): void;
17
+ element(): CollectReducerElement | DistinctCollectReducerElement;
18
+ set distinct(distinct: boolean);
19
+ }
20
+ export default Collect;
21
+ //# sourceMappingURL=collect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/collect.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,cAAM,qBAAsB,SAAQ,cAAc;IAC9C,OAAO,CAAC,MAAM,CAAa;IAC3B,IAAW,KAAK,IAAI,GAAG,CAEtB;IACD,IAAW,KAAK,CAAC,KAAK,EAAE,GAAG,EAE1B;CACJ;AAED,cAAM,6BAA8B,SAAQ,cAAc;IACtD,OAAO,CAAC,MAAM,CAA4B;IAC1C,IAAW,KAAK,IAAI,GAAG,CAEtB;IACD,IAAW,KAAK,CAAC,KAAK,EAAE,GAAG,EAK1B;CACJ;AAED,cASM,OAAQ,SAAQ,iBAAiB;IACnC,OAAO,CAAC,SAAS,CAAkB;;IAK5B,MAAM,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAG5C,OAAO,IAAI,qBAAqB,GAAG,6BAA6B;IAGvE,IAAW,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAEpC;CACJ;AAED,eAAe,OAAO,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 CollectReducerElement extends reducer_element_1.default {
9
16
  constructor() {
10
17
  super(...arguments);
@@ -32,7 +39,7 @@ class DistinctCollectReducerElement extends reducer_element_1.default {
32
39
  }
33
40
  }
34
41
  }
35
- class Collect extends aggregate_function_1.default {
42
+ let Collect = class Collect extends aggregate_function_1.default {
36
43
  constructor() {
37
44
  super("collect");
38
45
  this._distinct = false;
@@ -47,6 +54,17 @@ class Collect extends aggregate_function_1.default {
47
54
  set distinct(distinct) {
48
55
  this._distinct = distinct;
49
56
  }
50
- }
57
+ };
58
+ Collect = __decorate([
59
+ (0, function_metadata_1.FunctionDef)({
60
+ description: "Collects values into an array across grouped rows",
61
+ category: "aggregate",
62
+ parameters: [
63
+ { name: "value", description: "Value to collect", type: "any" }
64
+ ],
65
+ output: { description: "Array of collected values", type: "array", example: [1, 2, 3] },
66
+ examples: ["WITH [1, 2, 3] AS nums UNWIND nums AS n RETURN collect(n)"]
67
+ })
68
+ ], Collect);
51
69
  exports.default = Collect;
52
70
  //# sourceMappingURL=collect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collect.js","sourceRoot":"","sources":["../../../src/parsing/functions/collect.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AACrD,wEAA+C;AAE/C,MAAM,qBAAsB,SAAQ,yBAAc;IAAlD;;QACY,WAAM,GAAU,EAAE,CAAC;IAO/B,CAAC;IANG,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IAC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AAQ,CAAC,QAAiB;QACjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;CACJ,CAAA;AAfK,OAAO;IATZ,IAAA,+BAAW,EAAC;QACT,WAAW,EAAE,mDAAmD;QAChE,QAAQ,EAAE,WAAW;QACrB,UAAU,EAAE;YACR,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE;SAClE;QACD,MAAM,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;QACvF,QAAQ,EAAE,CAAC,2DAA2D,CAAC;KAC1E,CAAC;GACI,OAAO,CAeZ;AAED,kBAAe,OAAO,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * FlowQuery Extensibility API
3
+ *
4
+ * This module provides all the exports needed to create custom FlowQuery functions.
5
+ *
6
+ * @packageDocumentation
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { Function, FunctionDef } from '../parsing/functions/extensibility';
11
+ *
12
+ * @FunctionDef({
13
+ * description: "Converts a string to uppercase",
14
+ * category: "string",
15
+ * parameters: [{ name: "text", description: "String to convert", type: "string" }],
16
+ * output: { description: "Uppercase string", type: "string" }
17
+ * })
18
+ * class UpperCase extends Function {
19
+ * constructor() {
20
+ * super("uppercase");
21
+ * this._expectedParameterCount = 1;
22
+ * }
23
+ * public value(): string {
24
+ * return String(this.getChildren()[0].value()).toUpperCase();
25
+ * }
26
+ * }
27
+ * ```
28
+ */
29
+ export { default as Function } from "../function";
30
+ export { default as AggregateFunction } from "../aggregate_function";
31
+ export { default as PredicateFunction } from "../predicate_function";
32
+ export { default as ReducerElement } from "../reducer_element";
33
+ export { FunctionDef, FunctionMetadata, FunctionDefOptions, ParameterSchema, OutputSchema, FunctionCategory } from "../function_metadata";
34
+ export { default as FunctionFactory } from "../function_factory";
35
+ export type { FunctionCreator, AsyncDataProvider } from "../function_factory";
36
+ export type { RegisterFunctionOptions, RegisterAsyncProviderOptions } from "../function_metadata";
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/parsing/functions/extensibility/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,YAAY,EACR,uBAAuB,EACvB,4BAA4B,EAC/B,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /**
3
+ * FlowQuery Extensibility API
4
+ *
5
+ * This module provides all the exports needed to create custom FlowQuery functions.
6
+ *
7
+ * @packageDocumentation
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { Function, FunctionDef } from '../parsing/functions/extensibility';
12
+ *
13
+ * @FunctionDef({
14
+ * description: "Converts a string to uppercase",
15
+ * category: "string",
16
+ * parameters: [{ name: "text", description: "String to convert", type: "string" }],
17
+ * output: { description: "Uppercase string", type: "string" }
18
+ * })
19
+ * class UpperCase extends Function {
20
+ * constructor() {
21
+ * super("uppercase");
22
+ * this._expectedParameterCount = 1;
23
+ * }
24
+ * public value(): string {
25
+ * return String(this.getChildren()[0].value()).toUpperCase();
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.FunctionFactory = exports.FunctionDef = exports.ReducerElement = exports.PredicateFunction = exports.AggregateFunction = exports.Function = void 0;
35
+ // Base function classes for creating custom functions
36
+ var function_1 = require("../function");
37
+ Object.defineProperty(exports, "Function", { enumerable: true, get: function () { return __importDefault(function_1).default; } });
38
+ var aggregate_function_1 = require("../aggregate_function");
39
+ Object.defineProperty(exports, "AggregateFunction", { enumerable: true, get: function () { return __importDefault(aggregate_function_1).default; } });
40
+ var predicate_function_1 = require("../predicate_function");
41
+ Object.defineProperty(exports, "PredicateFunction", { enumerable: true, get: function () { return __importDefault(predicate_function_1).default; } });
42
+ var reducer_element_1 = require("../reducer_element");
43
+ Object.defineProperty(exports, "ReducerElement", { enumerable: true, get: function () { return __importDefault(reducer_element_1).default; } });
44
+ // Decorator and metadata types for function registration
45
+ var function_metadata_1 = require("../function_metadata");
46
+ Object.defineProperty(exports, "FunctionDef", { enumerable: true, get: function () { return function_metadata_1.FunctionDef; } });
47
+ // Factory for advanced usage
48
+ var function_factory_1 = require("../function_factory");
49
+ Object.defineProperty(exports, "FunctionFactory", { enumerable: true, get: function () { return __importDefault(function_factory_1).default; } });
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/parsing/functions/extensibility/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;AAEH,sDAAsD;AACtD,wCAAkD;AAAzC,qHAAA,OAAO,OAAY;AAC5B,4DAAqE;AAA5D,wIAAA,OAAO,OAAqB;AACrC,4DAAqE;AAA5D,wIAAA,OAAO,OAAqB;AACrC,sDAA+D;AAAtD,kIAAA,OAAO,OAAkB;AAElC,yDAAyD;AACzD,0DAO8B;AAN1B,gHAAA,WAAW,OAAA;AAQf,6BAA6B;AAC7B,wDAAiE;AAAxD,oIAAA,OAAO,OAAmB"}
@@ -0,0 +1,36 @@
1
+ import ASTNode from "../ast_node";
2
+ /**
3
+ * Base class for all functions in FlowQuery.
4
+ *
5
+ * Functions can have parameters and may support the DISTINCT modifier.
6
+ * Subclasses implement specific function logic.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const func = FunctionFactory.create("sum");
11
+ * func.parameters = [expression1, expression2];
12
+ * ```
13
+ */
14
+ declare class Function extends ASTNode {
15
+ protected _name: string;
16
+ protected _expectedParameterCount: number | null;
17
+ protected _supports_distinct: boolean;
18
+ /**
19
+ * Creates a new Function with the given name.
20
+ *
21
+ * @param name - The function name
22
+ */
23
+ constructor(name: string);
24
+ /**
25
+ * Sets the function parameters.
26
+ *
27
+ * @param nodes - Array of AST nodes representing the function arguments
28
+ * @throws {Error} If the number of parameters doesn't match expected count
29
+ */
30
+ set parameters(nodes: ASTNode[]);
31
+ get name(): string;
32
+ toString(): string;
33
+ set distinct(distinct: boolean);
34
+ }
35
+ export default Function;
36
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/function.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;;;;;;;GAWG;AACH,cAAM,QAAS,SAAQ,OAAO;IAC1B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAQ;IACxD,SAAS,CAAC,kBAAkB,EAAE,OAAO,CAAS;IAE9C;;;;OAIG;gBACS,IAAI,EAAE,MAAM;IAKxB;;;;;OAKG;IACH,IAAW,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,EAKrC;IAED,IAAW,IAAI,IAAI,MAAM,CAExB;IAEM,QAAQ,IAAI,MAAM;IAIzB,IAAW,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAMpC;CACJ;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,174 @@
1
+ import Function from "./function";
2
+ import PredicateFunction from "./predicate_function";
3
+ import "./sum";
4
+ import "./collect";
5
+ import "./avg";
6
+ import "./range";
7
+ import "./rand";
8
+ import "./round";
9
+ import "./split";
10
+ import "./join";
11
+ import "./to_json";
12
+ import "./replace";
13
+ import "./stringify";
14
+ import "./size";
15
+ import "./functions";
16
+ import "./predicate_sum";
17
+ import { FunctionMetadata, RegisterFunctionOptions, RegisterAsyncProviderOptions } from "./function_metadata";
18
+ /**
19
+ * Type for synchronous function factories.
20
+ */
21
+ export type FunctionCreator = () => Function;
22
+ /**
23
+ * Type for async data provider functions used in LOAD operations.
24
+ * These functions can yield data asynchronously.
25
+ */
26
+ export type AsyncDataProvider = (...args: any[]) => AsyncGenerator<any, void, unknown> | Promise<any>;
27
+ /**
28
+ * Factory for creating function instances by name.
29
+ *
30
+ * Maps function names (case-insensitive) to their corresponding implementation classes.
31
+ * Supports built-in functions like sum, avg, collect, range, split, join, etc.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const sumFunc = FunctionFactory.create("sum");
36
+ * const avgFunc = FunctionFactory.create("AVG");
37
+ * ```
38
+ */
39
+ declare class FunctionFactory {
40
+ /**
41
+ * Registry for plugin functions (synchronous).
42
+ */
43
+ private static plugins;
44
+ /**
45
+ * Registry for async data provider functions used in LOAD operations.
46
+ */
47
+ private static asyncProviders;
48
+ /**
49
+ * Registry for function metadata (both sync and async).
50
+ */
51
+ private static metadata;
52
+ /**
53
+ * Registers a synchronous plugin function.
54
+ *
55
+ * @param name - The function name (will be lowercased)
56
+ * @param factoryOrOptions - Factory function or options object with metadata
57
+ */
58
+ static register(name: string, factoryOrOptions: FunctionCreator | RegisterFunctionOptions): void;
59
+ /**
60
+ * Unregisters a synchronous plugin function.
61
+ *
62
+ * @param name - The function name to unregister
63
+ */
64
+ static unregister(name: string): void;
65
+ /**
66
+ * Registers an async data provider function for use in LOAD operations.
67
+ *
68
+ * @param name - The function name (will be lowercased)
69
+ * @param providerOrOptions - Async provider or options object with metadata
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * // Register with metadata for LLM consumption
74
+ * FunctionFactory.registerAsyncProvider("fetchUsers", {
75
+ * provider: async function* (endpoint: string) {
76
+ * const response = await fetch(endpoint);
77
+ * const data = await response.json();
78
+ * for (const item of data) {
79
+ * yield item;
80
+ * }
81
+ * },
82
+ * metadata: {
83
+ * name: "fetchUsers",
84
+ * description: "Fetches user data from an API endpoint",
85
+ * parameters: [
86
+ * { name: "endpoint", description: "API endpoint URL", type: "string" }
87
+ * ],
88
+ * output: {
89
+ * description: "User objects",
90
+ * type: "object",
91
+ * properties: {
92
+ * id: { description: "User ID", type: "number" },
93
+ * name: { description: "User name", type: "string" }
94
+ * }
95
+ * },
96
+ * examples: ["LOAD JSON FROM fetchUsers('https://api.example.com/users') AS user"]
97
+ * }
98
+ * });
99
+ * ```
100
+ */
101
+ static registerAsyncProvider(name: string, providerOrOptions: AsyncDataProvider | RegisterAsyncProviderOptions): void;
102
+ /**
103
+ * Unregisters an async data provider function.
104
+ *
105
+ * @param name - The function name to unregister
106
+ */
107
+ static unregisterAsyncProvider(name: string): void;
108
+ /**
109
+ * Gets an async data provider by name.
110
+ *
111
+ * @param name - The function name (case-insensitive)
112
+ * @returns The async data provider, or undefined if not found
113
+ */
114
+ static getAsyncProvider(name: string): AsyncDataProvider | undefined;
115
+ /**
116
+ * Checks if a function name is registered as an async data provider.
117
+ *
118
+ * @param name - The function name (case-insensitive)
119
+ * @returns True if the function is an async data provider
120
+ */
121
+ static isAsyncProvider(name: string): boolean;
122
+ /**
123
+ * Gets metadata for a specific function.
124
+ *
125
+ * @param name - The function name (case-insensitive)
126
+ * @returns The function metadata, or undefined if not found
127
+ */
128
+ static getMetadata(name: string): FunctionMetadata | undefined;
129
+ /**
130
+ * Lists all registered functions with their metadata.
131
+ * Includes both built-in and plugin functions.
132
+ *
133
+ * @param options - Optional filter options
134
+ * @returns Array of function metadata
135
+ */
136
+ static listFunctions(options?: {
137
+ category?: string;
138
+ includeBuiltins?: boolean;
139
+ asyncOnly?: boolean;
140
+ syncOnly?: boolean;
141
+ }): FunctionMetadata[];
142
+ /**
143
+ * Lists all registered function names.
144
+ *
145
+ * @returns Array of function names
146
+ */
147
+ static listFunctionNames(): string[];
148
+ /**
149
+ * Gets all function metadata as a JSON-serializable object for LLM consumption.
150
+ *
151
+ * @returns Object with functions grouped by category
152
+ */
153
+ static toJSON(): {
154
+ functions: FunctionMetadata[];
155
+ categories: string[];
156
+ };
157
+ /**
158
+ * Creates a function instance by name.
159
+ *
160
+ * @param name - The function name (case-insensitive)
161
+ * @returns A Function instance of the appropriate type
162
+ */
163
+ static create(name: string): Function;
164
+ /**
165
+ * Creates a predicate function instance by name.
166
+ * Predicate functions are used in WHERE clauses with quantifiers (e.g., ANY, ALL).
167
+ *
168
+ * @param name - The function name (case-insensitive)
169
+ * @returns A PredicateFunction instance of the appropriate type
170
+ */
171
+ static createPredicate(name: string): PredicateFunction;
172
+ }
173
+ export default FunctionFactory;
174
+ //# sourceMappingURL=function_factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function_factory.d.ts","sourceRoot":"","sources":["../../../src/parsing/functions/function_factory.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AAErD,OAAO,OAAO,CAAC;AACf,OAAO,WAAW,CAAC;AACnB,OAAO,OAAO,CAAC;AACf,OAAO,SAAS,CAAC;AACjB,OAAO,QAAQ,CAAC;AAChB,OAAO,SAAS,CAAC;AACjB,OAAO,SAAS,CAAC;AACjB,OAAO,QAAQ,CAAC;AAChB,OAAO,WAAW,CAAC;AACnB,OAAO,WA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