flowquery 1.0.2 → 1.0.5

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 (186) hide show
  1. package/README.md +54 -1
  2. package/dist/compute/runner.d.ts +81 -0
  3. package/dist/compute/runner.d.ts.map +1 -0
  4. package/dist/index.browser.d.ts +10 -0
  5. package/dist/index.browser.d.ts.map +1 -0
  6. package/dist/index.d.ts +9 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.node.d.ts +14 -0
  9. package/dist/index.node.d.ts.map +1 -0
  10. package/dist/io/command_line.d.ts +28 -0
  11. package/dist/io/command_line.d.ts.map +1 -0
  12. package/dist/parsing/alias.d.ts +10 -0
  13. package/dist/parsing/alias.d.ts.map +1 -0
  14. package/dist/parsing/alias_option.d.ts +6 -0
  15. package/dist/parsing/alias_option.d.ts.map +1 -0
  16. package/dist/parsing/ast_node.d.ts +100 -0
  17. package/dist/parsing/ast_node.d.ts.map +1 -0
  18. package/dist/parsing/base_parser.d.ts +49 -0
  19. package/dist/parsing/base_parser.d.ts.map +1 -0
  20. package/dist/parsing/components/csv.d.ts +6 -0
  21. package/dist/parsing/components/csv.d.ts.map +1 -0
  22. package/dist/parsing/components/from.d.ts +7 -0
  23. package/dist/parsing/components/from.d.ts.map +1 -0
  24. package/dist/parsing/components/headers.d.ts +7 -0
  25. package/dist/parsing/components/headers.d.ts.map +1 -0
  26. package/dist/parsing/components/json.d.ts +6 -0
  27. package/dist/parsing/components/json.d.ts.map +1 -0
  28. package/dist/parsing/components/null.d.ts +6 -0
  29. package/dist/parsing/components/null.d.ts.map +1 -0
  30. package/dist/parsing/components/post.d.ts +6 -0
  31. package/dist/parsing/components/post.d.ts.map +1 -0
  32. package/dist/parsing/components/text.d.ts +6 -0
  33. package/dist/parsing/components/text.d.ts.map +1 -0
  34. package/dist/parsing/context.d.ts +38 -0
  35. package/dist/parsing/context.d.ts.map +1 -0
  36. package/dist/parsing/data_structures/associative_array.d.ts +28 -0
  37. package/dist/parsing/data_structures/associative_array.d.ts.map +1 -0
  38. package/dist/parsing/data_structures/json_array.d.ts +26 -0
  39. package/dist/parsing/data_structures/json_array.d.ts.map +1 -0
  40. package/dist/parsing/data_structures/key_value_pair.d.ts +25 -0
  41. package/dist/parsing/data_structures/key_value_pair.d.ts.map +1 -0
  42. package/dist/parsing/data_structures/lookup.d.ts +25 -0
  43. package/dist/parsing/data_structures/lookup.d.ts.map +1 -0
  44. package/dist/parsing/data_structures/range_lookup.d.ts +14 -0
  45. package/dist/parsing/data_structures/range_lookup.d.ts.map +1 -0
  46. package/dist/parsing/expressions/expression.d.ts +53 -0
  47. package/dist/parsing/expressions/expression.d.ts.map +1 -0
  48. package/dist/parsing/expressions/f_string.d.ts +21 -0
  49. package/dist/parsing/expressions/f_string.d.ts.map +1 -0
  50. package/dist/parsing/expressions/identifier.d.ts +17 -0
  51. package/dist/parsing/expressions/identifier.d.ts.map +1 -0
  52. package/dist/parsing/expressions/number.d.ts +25 -0
  53. package/dist/parsing/expressions/number.d.ts.map +1 -0
  54. package/dist/parsing/expressions/operator.d.ts +79 -0
  55. package/dist/parsing/expressions/operator.d.ts.map +1 -0
  56. package/dist/parsing/expressions/reference.d.ts +29 -0
  57. package/dist/parsing/expressions/reference.d.ts.map +1 -0
  58. package/dist/parsing/expressions/string.d.ts +23 -0
  59. package/dist/parsing/expressions/string.d.ts.map +1 -0
  60. package/dist/parsing/functions/aggregate_function.d.ts +42 -0
  61. package/dist/parsing/functions/aggregate_function.d.ts.map +1 -0
  62. package/dist/parsing/functions/async_function.d.ts +52 -0
  63. package/dist/parsing/functions/async_function.d.ts.map +1 -0
  64. package/dist/parsing/functions/avg.d.ts +15 -0
  65. package/dist/parsing/functions/avg.d.ts.map +1 -0
  66. package/dist/parsing/functions/collect.d.ts +21 -0
  67. package/dist/parsing/functions/collect.d.ts.map +1 -0
  68. package/dist/parsing/functions/function.d.ts +36 -0
  69. package/dist/parsing/functions/function.d.ts.map +1 -0
  70. package/dist/parsing/functions/function_factory.d.ts +151 -0
  71. package/dist/parsing/functions/function_factory.d.ts.map +1 -0
  72. package/dist/parsing/functions/function_metadata.d.ts +83 -0
  73. package/dist/parsing/functions/function_metadata.d.ts.map +1 -0
  74. package/dist/parsing/functions/functions.d.ts +21 -0
  75. package/dist/parsing/functions/functions.d.ts.map +1 -0
  76. package/dist/parsing/functions/join.d.ts +9 -0
  77. package/dist/parsing/functions/join.d.ts.map +1 -0
  78. package/dist/parsing/functions/predicate_function.d.ts +18 -0
  79. package/dist/parsing/functions/predicate_function.d.ts.map +1 -0
  80. package/dist/parsing/functions/predicate_function_factory.d.ts +6 -0
  81. package/dist/parsing/functions/predicate_function_factory.d.ts.map +1 -0
  82. package/dist/parsing/functions/predicate_sum.d.ts +7 -0
  83. package/dist/parsing/functions/predicate_sum.d.ts.map +1 -0
  84. package/dist/parsing/functions/rand.d.ts +7 -0
  85. package/dist/parsing/functions/rand.d.ts.map +1 -0
  86. package/dist/parsing/functions/range.d.ts +7 -0
  87. package/dist/parsing/functions/range.d.ts.map +1 -0
  88. package/dist/parsing/functions/reducer_element.d.ts +6 -0
  89. package/dist/parsing/functions/reducer_element.d.ts.map +1 -0
  90. package/dist/parsing/functions/replace.d.ts +7 -0
  91. package/dist/parsing/functions/replace.d.ts.map +1 -0
  92. package/dist/parsing/functions/round.d.ts +7 -0
  93. package/dist/parsing/functions/round.d.ts.map +1 -0
  94. package/dist/parsing/functions/size.d.ts +7 -0
  95. package/dist/parsing/functions/size.d.ts.map +1 -0
  96. package/dist/parsing/functions/split.d.ts +9 -0
  97. package/dist/parsing/functions/split.d.ts.map +1 -0
  98. package/dist/parsing/functions/stringify.d.ts +9 -0
  99. package/dist/parsing/functions/stringify.d.ts.map +1 -0
  100. package/dist/parsing/functions/sum.d.ts +14 -0
  101. package/dist/parsing/functions/sum.d.ts.map +1 -0
  102. package/dist/parsing/functions/to_json.d.ts +7 -0
  103. package/dist/parsing/functions/to_json.d.ts.map +1 -0
  104. package/dist/parsing/functions/value_holder.d.ts +8 -0
  105. package/dist/parsing/functions/value_holder.d.ts.map +1 -0
  106. package/dist/parsing/logic/case.d.ts +7 -0
  107. package/dist/parsing/logic/case.d.ts.map +1 -0
  108. package/dist/parsing/logic/else.d.ts +7 -0
  109. package/dist/parsing/logic/else.d.ts.map +1 -0
  110. package/dist/parsing/logic/end.d.ts +6 -0
  111. package/dist/parsing/logic/end.d.ts.map +1 -0
  112. package/dist/parsing/logic/then.d.ts +7 -0
  113. package/dist/parsing/logic/then.d.ts.map +1 -0
  114. package/dist/parsing/logic/when.d.ts +7 -0
  115. package/dist/parsing/logic/when.d.ts.map +1 -0
  116. package/dist/parsing/operations/aggregated_return.d.ts +8 -0
  117. package/dist/parsing/operations/aggregated_return.d.ts.map +1 -0
  118. package/dist/parsing/operations/aggregated_with.d.ts +8 -0
  119. package/dist/parsing/operations/aggregated_with.d.ts.map +1 -0
  120. package/dist/parsing/operations/group_by.d.ts +35 -0
  121. package/dist/parsing/operations/group_by.d.ts.map +1 -0
  122. package/dist/parsing/operations/limit.d.ts +10 -0
  123. package/dist/parsing/operations/limit.d.ts.map +1 -0
  124. package/dist/parsing/operations/load.d.ts +48 -0
  125. package/dist/parsing/operations/load.d.ts.map +1 -0
  126. package/dist/parsing/operations/operation.d.ts +39 -0
  127. package/dist/parsing/operations/operation.d.ts.map +1 -0
  128. package/dist/parsing/operations/projection.d.ts +8 -0
  129. package/dist/parsing/operations/projection.d.ts.map +1 -0
  130. package/dist/parsing/operations/return.d.ts +23 -0
  131. package/dist/parsing/operations/return.d.ts.map +1 -0
  132. package/dist/parsing/operations/unwind.d.ts +12 -0
  133. package/dist/parsing/operations/unwind.d.ts.map +1 -0
  134. package/dist/parsing/operations/where.d.ts +26 -0
  135. package/dist/parsing/operations/where.d.ts.map +1 -0
  136. package/dist/parsing/operations/with.d.ts +17 -0
  137. package/dist/parsing/operations/with.d.ts.map +1 -0
  138. package/dist/parsing/parser.d.ts +66 -0
  139. package/dist/parsing/parser.d.ts.map +1 -0
  140. package/dist/parsing/parser.js +1 -1
  141. package/dist/parsing/token_to_node.d.ts +7 -0
  142. package/dist/parsing/token_to_node.d.ts.map +1 -0
  143. package/dist/tokenization/keyword.d.ts +43 -0
  144. package/dist/tokenization/keyword.d.ts.map +1 -0
  145. package/dist/tokenization/operator.d.ts +22 -0
  146. package/dist/tokenization/operator.d.ts.map +1 -0
  147. package/dist/tokenization/string_walker.d.ts +55 -0
  148. package/dist/tokenization/string_walker.d.ts.map +1 -0
  149. package/dist/tokenization/symbol.d.ts +15 -0
  150. package/dist/tokenization/symbol.d.ts.map +1 -0
  151. package/dist/tokenization/token.d.ts +176 -0
  152. package/dist/tokenization/token.d.ts.map +1 -0
  153. package/dist/tokenization/token_mapper.d.ts +40 -0
  154. package/dist/tokenization/token_mapper.d.ts.map +1 -0
  155. package/dist/tokenization/token_mapper.js +2 -2
  156. package/dist/tokenization/token_mapper.js.map +1 -1
  157. package/dist/tokenization/token_type.d.ts +16 -0
  158. package/dist/tokenization/token_type.d.ts.map +1 -0
  159. package/dist/tokenization/tokenizer.d.ts +45 -0
  160. package/dist/tokenization/tokenizer.d.ts.map +1 -0
  161. package/dist/tokenization/trie.d.ts +41 -0
  162. package/dist/tokenization/trie.d.ts.map +1 -0
  163. package/dist/utils/object_utils.d.ts +15 -0
  164. package/dist/utils/object_utils.d.ts.map +1 -0
  165. package/dist/utils/string_utils.d.ts +51 -0
  166. package/dist/utils/string_utils.d.ts.map +1 -0
  167. package/misc/apps/RAG/README.md +48 -0
  168. package/misc/apps/RAG/package.json +31 -0
  169. package/misc/apps/RAG/src/index.ts +20 -0
  170. package/misc/apps/RAG/tsconfig.json +19 -0
  171. package/misc/apps/RAG/webpack.config.js +32 -0
  172. package/misc/apps/README.md +1 -0
  173. package/package.json +1 -1
  174. package/src/parsing/parser.ts +1 -1
  175. package/src/tokenization/token_mapper.ts +2 -2
  176. package/tsconfig.json +3 -1
  177. /package/{queries → misc/queries}/analyze_catfacts.cql +0 -0
  178. /package/{queries → misc/queries}/azure_openai_completions.cql +0 -0
  179. /package/{queries → misc/queries}/azure_openai_models.cql +0 -0
  180. /package/{queries → misc/queries}/mock_pipeline.cql +0 -0
  181. /package/{queries → misc/queries}/openai_completions.cql +0 -0
  182. /package/{queries → misc/queries}/openai_models.cql +0 -0
  183. /package/{queries → misc/queries}/test.cql +0 -0
  184. /package/{queries → misc/queries}/tool_inference.cql +0 -0
  185. /package/{queries → misc/queries}/wisdom.cql +0 -0
  186. /package/{queries → misc/queries}/wisdom_letter_histogram.cql +0 -0
package/README.md CHANGED
@@ -18,8 +18,61 @@ FlowQuery is written in TypeScript (https://www.typescriptlang.org/) and built/c
18
18
  - This will run all unit tests.
19
19
  - Build: ```npm run build``` (builds for both Node and web)
20
20
 
21
+ ## Installation & Usage
22
+
23
+ ### Node.js
24
+
25
+ Install FlowQuery from npm:
26
+
27
+ ```bash
28
+ npm install flowquery
29
+ ```
30
+
31
+ Then use it in your code:
32
+
33
+ ```javascript
34
+ const FlowQuery = require('flowquery').default;
35
+ // Or with ES modules:
36
+ // import FlowQuery from 'flowquery';
37
+
38
+ async function main() {
39
+ const query = new FlowQuery('WITH 1 AS x RETURN x + 1');
40
+ await query.run();
41
+ console.log(query.results); // [ { expr0: 2 } ]
42
+ }
43
+
44
+ main();
45
+ ```
46
+
47
+ ### Browser
48
+
49
+ Include the minified bundle in your HTML:
50
+
51
+ ```html
52
+ <script src="https://microsoft.github.io/FlowQuery/flowquery.min.js"></script>
53
+ <script>
54
+ async function main() {
55
+ const query = new FlowQuery('WITH 1 AS x RETURN x + 1');
56
+ await query.run();
57
+ console.log(query.results); // [ { expr0: 2 } ]
58
+ }
59
+
60
+ main();
61
+ </script>
62
+ ```
63
+
64
+ Or import from the browser-specific entry point:
65
+
66
+ ```javascript
67
+ import FlowQuery from 'flowquery/browser';
68
+
69
+ const query = new FlowQuery('WITH "Hello" AS greeting RETURN greeting');
70
+ await query.run();
71
+ console.log(query.results);
72
+ ```
73
+
21
74
  ## Examples
22
- See also .\queries and .\tests\compute\runner.test.ts for more examples.
75
+ See also ./misc/queries and ./tests/compute/runner.test.ts for more examples.
23
76
  ```cypher
24
77
  /*
25
78
  Collect 10 random pieces of wisdom and create a letter histogram.
@@ -0,0 +1,81 @@
1
+ import { FunctionCreator, AsyncDataProvider } from "../parsing/functions/function_factory";
2
+ import { FunctionMetadata, RegisterFunctionOptions, RegisterAsyncProviderOptions } from "../parsing/functions/function_metadata";
3
+ import Function from "../parsing/functions/function";
4
+ /**
5
+ * Executes a FlowQuery statement and retrieves the results.
6
+ *
7
+ * The Runner class parses a FlowQuery statement into an AST and executes it,
8
+ * managing the execution flow from the first operation to the final return statement.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const runner = new Runner("WITH 1 as x RETURN x");
13
+ * await runner.run();
14
+ * console.log(runner.results); // [{ x: 1 }]
15
+ * ```
16
+ */
17
+ declare class Runner {
18
+ private first;
19
+ private last;
20
+ /**
21
+ * Register a synchronous plugin function.
22
+ * Added dynamically in index.browser.ts / index.node.ts
23
+ */
24
+ static registerFunction: (name: string, factoryOrOptions: FunctionCreator | RegisterFunctionOptions) => void;
25
+ /**
26
+ * Unregister a synchronous plugin function.
27
+ * Added dynamically in index.browser.ts / index.node.ts
28
+ */
29
+ static unregisterFunction: (name: string) => void;
30
+ /**
31
+ * Register an async data provider function for use in LOAD operations.
32
+ * Added dynamically in index.browser.ts / index.node.ts
33
+ */
34
+ static registerAsyncProvider: (name: string, providerOrOptions: AsyncDataProvider | RegisterAsyncProviderOptions) => void;
35
+ /**
36
+ * Unregister an async data provider function.
37
+ * Added dynamically in index.browser.ts / index.node.ts
38
+ */
39
+ static unregisterAsyncProvider: (name: string) => void;
40
+ /**
41
+ * List all registered functions with their metadata.
42
+ * Added dynamically in index.browser.ts / index.node.ts
43
+ */
44
+ static listFunctions: (options?: {
45
+ category?: string;
46
+ asyncOnly?: boolean;
47
+ syncOnly?: boolean;
48
+ }) => FunctionMetadata[];
49
+ /**
50
+ * Get metadata for a specific function.
51
+ * Added dynamically in index.browser.ts / index.node.ts
52
+ */
53
+ static getFunctionMetadata: (name: string) => FunctionMetadata | undefined;
54
+ /**
55
+ * Base Function class for creating custom plugin functions.
56
+ * Added dynamically in index.browser.ts / index.node.ts
57
+ */
58
+ static Function: typeof Function;
59
+ /**
60
+ * Creates a new Runner instance and parses the FlowQuery statement.
61
+ *
62
+ * @param statement - The FlowQuery statement to execute
63
+ * @throws {Error} If the statement is null, empty, or contains syntax errors
64
+ */
65
+ constructor(statement?: string | null);
66
+ /**
67
+ * Executes the parsed FlowQuery statement.
68
+ *
69
+ * @returns A promise that resolves when execution completes
70
+ * @throws {Error} If an error occurs during execution
71
+ */
72
+ run(): Promise<void>;
73
+ /**
74
+ * Gets the results from the executed statement.
75
+ *
76
+ * @returns The results from the last operation (typically a RETURN statement)
77
+ */
78
+ get results(): any;
79
+ }
80
+ export default Runner;
81
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/compute/runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACjI,OAAO,QAAQ,MAAM,+BAA+B,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,cAAM,MAAM;IACR,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,IAAI,CAAY;IAExB;;;OAGG;IACH,MAAM,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,GAAG,uBAAuB,KAAK,IAAI,CAAC;IAE7G;;;OAGG;IACH,MAAM,CAAC,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAElD;;;OAGG;IACH,MAAM,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,4BAA4B,KAAK,IAAI,CAAC;IAE1H;;;OAGG;IACH,MAAM,CAAC,uBAAuB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,MAAM,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,gBAAgB,EAAE,CAAC;IAEvH;;;OAGG;IACH,MAAM,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,GAAG,SAAS,CAAC;IAE3E;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAEjC;;;;;OAKG;gBACS,SAAS,GAAE,MAAM,GAAG,IAAW;IAU3C;;;;;OAKG;IACU,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAYjC;;;;OAIG;IACH,IAAW,OAAO,IAAI,GAAG,CAExB;CACJ;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * FlowQuery - A declarative query language for data processing pipelines.
3
+ *
4
+ * This is the main entry point for the FlowQuery in-browser usage.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import { default as FlowQuery } from "./compute/runner";
9
+ export default FlowQuery;
10
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAwHtD,eAAe,SAAS,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * FlowQuery - A declarative query language for data processing pipelines.
3
+ *
4
+ * This is the main entry point for the FlowQuery command-line interface.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * FlowQuery - A declarative query language for data processing pipelines.
3
+ *
4
+ * This is the main entry point for the FlowQuery Node.js library usage.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import { default as FlowQuery } from "./compute/runner";
9
+ import FunctionFactory, { FunctionCreator, AsyncDataProvider } from "./parsing/functions/function_factory";
10
+ import { FunctionMetadata, ParameterSchema, OutputSchema, RegisterFunctionOptions, RegisterAsyncProviderOptions } from "./parsing/functions/function_metadata";
11
+ import Function from "./parsing/functions/function";
12
+ export default FlowQuery;
13
+ export { FlowQuery, Function, FunctionFactory, FunctionCreator, AsyncDataProvider, FunctionMetadata, ParameterSchema, OutputSchema, RegisterFunctionOptions, RegisterAsyncProviderOptions };
14
+ //# sourceMappingURL=index.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,kBAAkB,CAAC;AACtD,OAAO,eAAe,EAAE,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC3G,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC/B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,QAAQ,MAAM,8BAA8B,CAAC;AA+GpD,eAAe,SAAS,CAAC;AACzB,OAAO,EACH,SAAS,EACT,QAAQ,EACR,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,4BAA4B,EAC/B,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Interactive command-line interface for FlowQuery.
3
+ *
4
+ * Provides a REPL (Read-Eval-Print Loop) for executing FlowQuery statements
5
+ * and displaying results.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const cli = new CommandLine();
10
+ * cli.loop(); // Starts interactive mode
11
+ * ```
12
+ */
13
+ declare class CommandLine {
14
+ private rl;
15
+ /**
16
+ * Creates a new CommandLine interface.
17
+ */
18
+ constructor();
19
+ /**
20
+ * Starts the interactive command loop.
21
+ *
22
+ * Prompts the user for FlowQuery statements, executes them, and displays results.
23
+ * Type "exit" to quit the loop.
24
+ */
25
+ loop(): void;
26
+ }
27
+ export default CommandLine;
28
+ //# sourceMappingURL=command_line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command_line.d.ts","sourceRoot":"","sources":["../../src/io/command_line.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,cAAM,WAAW;IACb,OAAO,CAAC,EAAE,CAAqB;IAE/B;;OAEG;;IAQH;;;;;OAKG;IACI,IAAI;CAqCd;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,10 @@
1
+ import ASTNode from "./ast_node";
2
+ declare class Alias extends ASTNode {
3
+ private alias;
4
+ constructor(alias: string);
5
+ toString(): string;
6
+ getAlias(): string;
7
+ value(): string;
8
+ }
9
+ export default Alias;
10
+ //# sourceMappingURL=alias.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../../src/parsing/alias.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,cAAM,KAAM,SAAQ,OAAO;IACvB,OAAO,CAAC,KAAK,CAAS;gBACV,KAAK,EAAE,MAAM;IAKlB,QAAQ,IAAI,MAAM;IAIlB,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,MAAM;CAGzB;AAED,eAAe,KAAK,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum AliasOption {
2
+ NOT_ALLOWED = 0,
3
+ OPTIONAL = 1,
4
+ REQUIRED = 2
5
+ }
6
+ //# sourceMappingURL=alias_option.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias_option.d.ts","sourceRoot":"","sources":["../../src/parsing/alias_option.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,WAAW,IAAI;IACf,QAAQ,IAAI;IACZ,QAAQ,IAAI;CACf"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Represents a node in the Abstract Syntax Tree (AST).
3
+ *
4
+ * The AST is a tree representation of the parsed FlowQuery statement structure.
5
+ * Each node can have children and maintains a reference to its parent.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const root = new ASTNode();
10
+ * const child = new ASTNode();
11
+ * root.addChild(child);
12
+ * ```
13
+ */
14
+ declare class ASTNode {
15
+ protected _parent: ASTNode | null;
16
+ protected children: ASTNode[];
17
+ /**
18
+ * Adds a child node to this node and sets the child's parent reference.
19
+ *
20
+ * @param child - The child node to add
21
+ */
22
+ addChild(child: ASTNode): void;
23
+ /**
24
+ * Returns the first child node.
25
+ *
26
+ * @returns The first child node
27
+ * @throws {Error} If the node has no children
28
+ */
29
+ firstChild(): ASTNode;
30
+ /**
31
+ * Returns the last child node.
32
+ *
33
+ * @returns The last child node
34
+ * @throws {Error} If the node has no children
35
+ */
36
+ lastChild(): ASTNode;
37
+ /**
38
+ * Returns all child nodes.
39
+ *
40
+ * @returns Array of child nodes
41
+ */
42
+ getChildren(): ASTNode[];
43
+ /**
44
+ * Returns the number of child nodes.
45
+ *
46
+ * @returns The count of children
47
+ */
48
+ childCount(): number;
49
+ /**
50
+ * Returns the value of this node. Override in subclasses to provide specific values.
51
+ *
52
+ * @returns The node's value, or null if not applicable
53
+ */
54
+ value(): any;
55
+ /**
56
+ * Checks if this node represents an operator.
57
+ *
58
+ * @returns True if this is an operator node, false otherwise
59
+ */
60
+ isOperator(): boolean;
61
+ /**
62
+ * Checks if this node represents an operand (the opposite of an operator).
63
+ *
64
+ * @returns True if this is an operand node, false otherwise
65
+ */
66
+ isOperand(): boolean;
67
+ /**
68
+ * Gets the operator precedence for this node. Higher values indicate higher precedence.
69
+ *
70
+ * @returns The precedence value (0 for non-operators)
71
+ */
72
+ get precedence(): number;
73
+ /**
74
+ * Indicates whether this operator is left-associative.
75
+ *
76
+ * @returns True if left-associative, false otherwise
77
+ */
78
+ get leftAssociative(): boolean;
79
+ /**
80
+ * Prints a string representation of the AST tree starting from this node.
81
+ *
82
+ * @returns A formatted string showing the tree structure
83
+ */
84
+ print(): string;
85
+ /**
86
+ * Generator function for recursively printing the tree structure.
87
+ *
88
+ * @param indent - The current indentation level
89
+ * @yields Lines representing each node in the tree
90
+ */
91
+ private _print;
92
+ /**
93
+ * Returns a string representation of this node. Override in subclasses for custom formatting.
94
+ *
95
+ * @returns The string representation
96
+ */
97
+ protected toString(): string;
98
+ }
99
+ export default ASTNode;
100
+ //# sourceMappingURL=ast_node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast_node.d.ts","sourceRoot":"","sources":["../../src/parsing/ast_node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAM,OAAO;IACT,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;IACzC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAM;IAEnC;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKrC;;;;;OAKG;IACI,UAAU,IAAI,OAAO;IAO5B;;;;;OAKG;IACI,SAAS,IAAI,OAAO;IAO3B;;;;OAIG;IACI,WAAW,IAAI,OAAO,EAAE;IAI/B;;;;OAIG;IACI,UAAU,IAAI,MAAM;IAI3B;;;;OAIG;IACI,KAAK,IAAI,GAAG;IAInB;;;;OAIG;IACI,UAAU,IAAI,OAAO;IAI5B;;;;OAIG;IACI,SAAS,IAAI,OAAO;IAI3B;;;;OAIG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED;;;;OAIG;IACH,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED;;;;OAIG;IACI,KAAK,IAAI,MAAM;IAItB;;;;;OAKG;IACH,OAAO,CAAE,MAAM;IAWf;;;;OAIG;IACH,SAAS,CAAC,QAAQ,IAAI,MAAM;CAG/B;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,49 @@
1
+ import Token from "../tokenization/token";
2
+ /**
3
+ * Base class for parsers providing common token manipulation functionality.
4
+ *
5
+ * This class handles tokenization and provides utility methods for navigating
6
+ * through tokens, peeking ahead, and checking token sequences.
7
+ */
8
+ declare class BaseParser {
9
+ private tokens;
10
+ private tokenIndex;
11
+ /**
12
+ * Tokenizes a statement and initializes the token array.
13
+ *
14
+ * @param statement - The input statement to tokenize
15
+ */
16
+ protected tokenize(statement: string): void;
17
+ /**
18
+ * Advances to the next token in the sequence.
19
+ */
20
+ protected setNextToken(): void;
21
+ /**
22
+ * Peeks at the next token without advancing the current position.
23
+ *
24
+ * @returns The next token, or null if at the end of the token stream
25
+ */
26
+ protected peek(): Token | null;
27
+ /**
28
+ * Checks if a sequence of tokens appears ahead in the token stream.
29
+ *
30
+ * @param tokens - The sequence of tokens to look for
31
+ * @param skipWhitespaceAndComments - Whether to skip whitespace and comments when matching
32
+ * @returns True if the token sequence is found ahead, false otherwise
33
+ */
34
+ protected ahead(tokens: Token[], skipWhitespaceAndComments?: boolean): boolean;
35
+ /**
36
+ * Gets the current token.
37
+ *
38
+ * @returns The current token, or EOF if at the end
39
+ */
40
+ protected get token(): Token;
41
+ /**
42
+ * Gets the previous token.
43
+ *
44
+ * @returns The previous token, or EOF if at the beginning
45
+ */
46
+ protected get previousToken(): Token;
47
+ }
48
+ export default BaseParser;
49
+ //# sourceMappingURL=base_parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base_parser.d.ts","sourceRoot":"","sources":["../../src/parsing/base_parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAG1C;;;;;GAKG;AACH,cAAM,UAAU;IACZ,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,UAAU,CAAa;IAE/B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK3C;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAI9B;;;;OAIG;IACH,SAAS,CAAC,IAAI,IAAI,KAAK,GAAG,IAAI;IAO9B;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,yBAAyB,GAAE,OAAc,GAAG,OAAO;IAiBpF;;;;OAIG;IACH,SAAS,KAAK,KAAK,IAAI,KAAK,CAK3B;IAED;;;;OAIG;IACH,SAAS,KAAK,aAAa,IAAI,KAAK,CAKnC;CACJ;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class CSV extends ASTNode {
3
+ constructor();
4
+ }
5
+ export default CSV;
6
+ //# sourceMappingURL=csv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/csv.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,GAAI,SAAQ,OAAO;;CAIxB;AAED,eAAe,GAAG,CAAC"}
@@ -0,0 +1,7 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class From extends ASTNode {
3
+ constructor();
4
+ value(): string;
5
+ }
6
+ export default From;
7
+ //# sourceMappingURL=from.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/from.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;IAIjB,KAAK,IAAI,MAAM;CAGvB;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,7 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class Headers extends ASTNode {
3
+ constructor();
4
+ value(): object;
5
+ }
6
+ export default Headers;
7
+ //# sourceMappingURL=headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/headers.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,OAAQ,SAAQ,OAAO;;IAIpB,KAAK,IAAI,MAAM;CAGvB;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,6 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class JSON extends ASTNode {
3
+ constructor();
4
+ }
5
+ export default JSON;
6
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/json.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;CAIzB;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,6 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class Null extends ASTNode {
3
+ constructor();
4
+ }
5
+ export default Null;
6
+ //# sourceMappingURL=null.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/null.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;CAIzB;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,6 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class Post extends ASTNode {
3
+ constructor();
4
+ }
5
+ export default Post;
6
+ //# sourceMappingURL=post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/post.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;CAIzB;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,6 @@
1
+ import ASTNode from "../ast_node";
2
+ declare class Text extends ASTNode {
3
+ constructor();
4
+ }
5
+ export default Text;
6
+ //# sourceMappingURL=text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/parsing/components/text.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,cAAM,IAAK,SAAQ,OAAO;;CAIzB;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,38 @@
1
+ import ASTNode from "./ast_node";
2
+ /**
3
+ * Maintains a stack of AST nodes to track parsing context.
4
+ *
5
+ * Used during parsing to maintain the current context and check for specific node types
6
+ * in the parsing hierarchy, which helps with context-sensitive parsing decisions.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const context = new Context();
11
+ * context.push(node);
12
+ * const hasReturn = context.containsType(Return);
13
+ * ```
14
+ */
15
+ declare class Context {
16
+ private stack;
17
+ /**
18
+ * Pushes a node onto the context stack.
19
+ *
20
+ * @param node - The AST node to push
21
+ */
22
+ push(node: ASTNode): void;
23
+ /**
24
+ * Pops the top node from the context stack.
25
+ *
26
+ * @returns The popped node, or undefined if the stack is empty
27
+ */
28
+ pop(): ASTNode | undefined;
29
+ /**
30
+ * Checks if the stack contains a node of the specified type.
31
+ *
32
+ * @param type - The constructor of the node type to search for
33
+ * @returns True if a node of the specified type is found in the stack, false otherwise
34
+ */
35
+ containsType(type: new (...args: any[]) => ASTNode): boolean;
36
+ }
37
+ export default Context;
38
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/parsing/context.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC;;;;;;;;;;;;GAYG;AACH,cAAM,OAAO;IACT,OAAO,CAAC,KAAK,CAAiB;IAE9B;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIhC;;;;OAIG;IACI,GAAG,IAAI,OAAO,GAAG,SAAS;IAIjC;;;;;OAKG;IACI,YAAY,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,GAAG,OAAO;CAGtE;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,28 @@
1
+ import ASTNode from "../ast_node";
2
+ import KeyValuePair from "./key_value_pair";
3
+ /**
4
+ * Represents an associative array (object/dictionary) in the AST.
5
+ *
6
+ * Associative arrays map string keys to values, similar to JSON objects.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // For { name: "Alice", age: 30 }
11
+ * const obj = new AssociativeArray();
12
+ * obj.addKeyValue(new KeyValuePair("name", nameExpr));
13
+ * obj.addKeyValue(new KeyValuePair("age", ageExpr));
14
+ * ```
15
+ */
16
+ declare class AssociativeArray extends ASTNode {
17
+ /**
18
+ * Adds a key-value pair to the associative array.
19
+ *
20
+ * @param keyValuePair - The key-value pair to add
21
+ */
22
+ addKeyValue(keyValuePair: KeyValuePair): void;
23
+ toString(): string;
24
+ private _value;
25
+ value(): Record<string, any>;
26
+ }
27
+ export default AssociativeArray;
28
+ //# sourceMappingURL=associative_array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"associative_array.d.ts","sourceRoot":"","sources":["../../../src/parsing/data_structures/associative_array.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,cAAM,gBAAiB,SAAQ,OAAO;IAClC;;;;OAIG;IACI,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAI7C,QAAQ,IAAI,MAAM;IAGzB,OAAO,CAAE,MAAM;IAQR,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGtC;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import ASTNode from "../ast_node";
2
+ /**
3
+ * Represents a JSON array in the AST.
4
+ *
5
+ * JSON arrays are ordered collections of values.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // For [1, 2, 3]
10
+ * const arr = new JSONArray();
11
+ * arr.addValue(new Number("1"));
12
+ * arr.addValue(new Number("2"));
13
+ * arr.addValue(new Number("3"));
14
+ * ```
15
+ */
16
+ declare class JSONArray extends ASTNode {
17
+ /**
18
+ * Adds a value to the array.
19
+ *
20
+ * @param value - The AST node representing the value to add
21
+ */
22
+ addValue(value: ASTNode): void;
23
+ value(): any[];
24
+ }
25
+ export default JSONArray;
26
+ //# sourceMappingURL=json_array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json_array.d.ts","sourceRoot":"","sources":["../../../src/parsing/data_structures/json_array.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC;;;;;;;;;;;;;GAaG;AACH,cAAM,SAAU,SAAQ,OAAO;IAC3B;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAG9B,KAAK,IAAI,GAAG,EAAE;CAGxB;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,25 @@
1
+ import ASTNode from "../ast_node";
2
+ /**
3
+ * Represents a key-value pair in an associative array.
4
+ *
5
+ * Used to build object literals in FlowQuery.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const kvp = new KeyValuePair("name", new String("Alice"));
10
+ * ```
11
+ */
12
+ declare class KeyValuePair extends ASTNode {
13
+ /**
14
+ * Creates a new key-value pair.
15
+ *
16
+ * @param key - The key string
17
+ * @param value - The AST node representing the value
18
+ */
19
+ constructor(key: string, value: ASTNode);
20
+ get key(): string;
21
+ get _value(): any;
22
+ toString(): string;
23
+ }
24
+ export default KeyValuePair;
25
+ //# sourceMappingURL=key_value_pair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key_value_pair.d.ts","sourceRoot":"","sources":["../../../src/parsing/data_structures/key_value_pair.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAC;AAGlC;;;;;;;;;GASG;AACH,cAAM,YAAa,SAAQ,OAAO;IAC9B;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAKvC,IAAW,GAAG,IAAI,MAAM,CAEvB;IACD,IAAW,MAAM,IAAI,GAAG,CAEvB;IACM,QAAQ,IAAI,MAAM;CAG5B;AAED,eAAe,YAAY,CAAC"}