flowquery 1.0.3 → 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.
- package/dist/compute/runner.d.ts +81 -0
- package/dist/compute/runner.d.ts.map +1 -0
- package/dist/index.browser.d.ts +10 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.node.d.ts +14 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/io/command_line.d.ts +28 -0
- package/dist/io/command_line.d.ts.map +1 -0
- package/dist/parsing/alias.d.ts +10 -0
- package/dist/parsing/alias.d.ts.map +1 -0
- package/dist/parsing/alias_option.d.ts +6 -0
- package/dist/parsing/alias_option.d.ts.map +1 -0
- package/dist/parsing/ast_node.d.ts +100 -0
- package/dist/parsing/ast_node.d.ts.map +1 -0
- package/dist/parsing/base_parser.d.ts +49 -0
- package/dist/parsing/base_parser.d.ts.map +1 -0
- package/dist/parsing/components/csv.d.ts +6 -0
- package/dist/parsing/components/csv.d.ts.map +1 -0
- package/dist/parsing/components/from.d.ts +7 -0
- package/dist/parsing/components/from.d.ts.map +1 -0
- package/dist/parsing/components/headers.d.ts +7 -0
- package/dist/parsing/components/headers.d.ts.map +1 -0
- package/dist/parsing/components/json.d.ts +6 -0
- package/dist/parsing/components/json.d.ts.map +1 -0
- package/dist/parsing/components/null.d.ts +6 -0
- package/dist/parsing/components/null.d.ts.map +1 -0
- package/dist/parsing/components/post.d.ts +6 -0
- package/dist/parsing/components/post.d.ts.map +1 -0
- package/dist/parsing/components/text.d.ts +6 -0
- package/dist/parsing/components/text.d.ts.map +1 -0
- package/dist/parsing/context.d.ts +38 -0
- package/dist/parsing/context.d.ts.map +1 -0
- package/dist/parsing/data_structures/associative_array.d.ts +28 -0
- package/dist/parsing/data_structures/associative_array.d.ts.map +1 -0
- package/dist/parsing/data_structures/json_array.d.ts +26 -0
- package/dist/parsing/data_structures/json_array.d.ts.map +1 -0
- package/dist/parsing/data_structures/key_value_pair.d.ts +25 -0
- package/dist/parsing/data_structures/key_value_pair.d.ts.map +1 -0
- package/dist/parsing/data_structures/lookup.d.ts +25 -0
- package/dist/parsing/data_structures/lookup.d.ts.map +1 -0
- package/dist/parsing/data_structures/range_lookup.d.ts +14 -0
- package/dist/parsing/data_structures/range_lookup.d.ts.map +1 -0
- package/dist/parsing/expressions/expression.d.ts +53 -0
- package/dist/parsing/expressions/expression.d.ts.map +1 -0
- package/dist/parsing/expressions/f_string.d.ts +21 -0
- package/dist/parsing/expressions/f_string.d.ts.map +1 -0
- package/dist/parsing/expressions/identifier.d.ts +17 -0
- package/dist/parsing/expressions/identifier.d.ts.map +1 -0
- package/dist/parsing/expressions/number.d.ts +25 -0
- package/dist/parsing/expressions/number.d.ts.map +1 -0
- package/dist/parsing/expressions/operator.d.ts +79 -0
- package/dist/parsing/expressions/operator.d.ts.map +1 -0
- package/dist/parsing/expressions/reference.d.ts +29 -0
- package/dist/parsing/expressions/reference.d.ts.map +1 -0
- package/dist/parsing/expressions/string.d.ts +23 -0
- package/dist/parsing/expressions/string.d.ts.map +1 -0
- package/dist/parsing/functions/aggregate_function.d.ts +42 -0
- package/dist/parsing/functions/aggregate_function.d.ts.map +1 -0
- package/dist/parsing/functions/async_function.d.ts +52 -0
- package/dist/parsing/functions/async_function.d.ts.map +1 -0
- package/dist/parsing/functions/avg.d.ts +15 -0
- package/dist/parsing/functions/avg.d.ts.map +1 -0
- package/dist/parsing/functions/collect.d.ts +21 -0
- package/dist/parsing/functions/collect.d.ts.map +1 -0
- package/dist/parsing/functions/function.d.ts +36 -0
- package/dist/parsing/functions/function.d.ts.map +1 -0
- package/dist/parsing/functions/function_factory.d.ts +151 -0
- package/dist/parsing/functions/function_factory.d.ts.map +1 -0
- package/dist/parsing/functions/function_metadata.d.ts +83 -0
- package/dist/parsing/functions/function_metadata.d.ts.map +1 -0
- package/dist/parsing/functions/functions.d.ts +21 -0
- package/dist/parsing/functions/functions.d.ts.map +1 -0
- package/dist/parsing/functions/join.d.ts +9 -0
- package/dist/parsing/functions/join.d.ts.map +1 -0
- package/dist/parsing/functions/predicate_function.d.ts +18 -0
- package/dist/parsing/functions/predicate_function.d.ts.map +1 -0
- package/dist/parsing/functions/predicate_function_factory.d.ts +6 -0
- package/dist/parsing/functions/predicate_function_factory.d.ts.map +1 -0
- package/dist/parsing/functions/predicate_sum.d.ts +7 -0
- package/dist/parsing/functions/predicate_sum.d.ts.map +1 -0
- package/dist/parsing/functions/rand.d.ts +7 -0
- package/dist/parsing/functions/rand.d.ts.map +1 -0
- package/dist/parsing/functions/range.d.ts +7 -0
- package/dist/parsing/functions/range.d.ts.map +1 -0
- package/dist/parsing/functions/reducer_element.d.ts +6 -0
- package/dist/parsing/functions/reducer_element.d.ts.map +1 -0
- package/dist/parsing/functions/replace.d.ts +7 -0
- package/dist/parsing/functions/replace.d.ts.map +1 -0
- package/dist/parsing/functions/round.d.ts +7 -0
- package/dist/parsing/functions/round.d.ts.map +1 -0
- package/dist/parsing/functions/size.d.ts +7 -0
- package/dist/parsing/functions/size.d.ts.map +1 -0
- package/dist/parsing/functions/split.d.ts +9 -0
- package/dist/parsing/functions/split.d.ts.map +1 -0
- package/dist/parsing/functions/stringify.d.ts +9 -0
- package/dist/parsing/functions/stringify.d.ts.map +1 -0
- package/dist/parsing/functions/sum.d.ts +14 -0
- package/dist/parsing/functions/sum.d.ts.map +1 -0
- package/dist/parsing/functions/to_json.d.ts +7 -0
- package/dist/parsing/functions/to_json.d.ts.map +1 -0
- package/dist/parsing/functions/value_holder.d.ts +8 -0
- package/dist/parsing/functions/value_holder.d.ts.map +1 -0
- package/dist/parsing/logic/case.d.ts +7 -0
- package/dist/parsing/logic/case.d.ts.map +1 -0
- package/dist/parsing/logic/else.d.ts +7 -0
- package/dist/parsing/logic/else.d.ts.map +1 -0
- package/dist/parsing/logic/end.d.ts +6 -0
- package/dist/parsing/logic/end.d.ts.map +1 -0
- package/dist/parsing/logic/then.d.ts +7 -0
- package/dist/parsing/logic/then.d.ts.map +1 -0
- package/dist/parsing/logic/when.d.ts +7 -0
- package/dist/parsing/logic/when.d.ts.map +1 -0
- package/dist/parsing/operations/aggregated_return.d.ts +8 -0
- package/dist/parsing/operations/aggregated_return.d.ts.map +1 -0
- package/dist/parsing/operations/aggregated_with.d.ts +8 -0
- package/dist/parsing/operations/aggregated_with.d.ts.map +1 -0
- package/dist/parsing/operations/group_by.d.ts +35 -0
- package/dist/parsing/operations/group_by.d.ts.map +1 -0
- package/dist/parsing/operations/limit.d.ts +10 -0
- package/dist/parsing/operations/limit.d.ts.map +1 -0
- package/dist/parsing/operations/load.d.ts +48 -0
- package/dist/parsing/operations/load.d.ts.map +1 -0
- package/dist/parsing/operations/operation.d.ts +39 -0
- package/dist/parsing/operations/operation.d.ts.map +1 -0
- package/dist/parsing/operations/projection.d.ts +8 -0
- package/dist/parsing/operations/projection.d.ts.map +1 -0
- package/dist/parsing/operations/return.d.ts +23 -0
- package/dist/parsing/operations/return.d.ts.map +1 -0
- package/dist/parsing/operations/unwind.d.ts +12 -0
- package/dist/parsing/operations/unwind.d.ts.map +1 -0
- package/dist/parsing/operations/where.d.ts +26 -0
- package/dist/parsing/operations/where.d.ts.map +1 -0
- package/dist/parsing/operations/with.d.ts +17 -0
- package/dist/parsing/operations/with.d.ts.map +1 -0
- package/dist/parsing/parser.d.ts +66 -0
- package/dist/parsing/parser.d.ts.map +1 -0
- package/dist/parsing/parser.js +1 -1
- package/dist/parsing/token_to_node.d.ts +7 -0
- package/dist/parsing/token_to_node.d.ts.map +1 -0
- package/dist/tokenization/keyword.d.ts +43 -0
- package/dist/tokenization/keyword.d.ts.map +1 -0
- package/dist/tokenization/operator.d.ts +22 -0
- package/dist/tokenization/operator.d.ts.map +1 -0
- package/dist/tokenization/string_walker.d.ts +55 -0
- package/dist/tokenization/string_walker.d.ts.map +1 -0
- package/dist/tokenization/symbol.d.ts +15 -0
- package/dist/tokenization/symbol.d.ts.map +1 -0
- package/dist/tokenization/token.d.ts +176 -0
- package/dist/tokenization/token.d.ts.map +1 -0
- package/dist/tokenization/token_mapper.d.ts +40 -0
- package/dist/tokenization/token_mapper.d.ts.map +1 -0
- package/dist/tokenization/token_type.d.ts +16 -0
- package/dist/tokenization/token_type.d.ts.map +1 -0
- package/dist/tokenization/tokenizer.d.ts +45 -0
- package/dist/tokenization/tokenizer.d.ts.map +1 -0
- package/dist/tokenization/trie.d.ts +41 -0
- package/dist/tokenization/trie.d.ts.map +1 -0
- package/dist/utils/object_utils.d.ts +15 -0
- package/dist/utils/object_utils.d.ts.map +1 -0
- package/dist/utils/string_utils.d.ts +51 -0
- package/dist/utils/string_utils.d.ts.map +1 -0
- package/misc/apps/RAG/package.json +1 -1
- package/misc/apps/RAG/src/index.ts +4 -4
- package/package.json +1 -1
- package/src/parsing/parser.ts +1 -1
- package/tsconfig.json +3 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for object-related operations.
|
|
3
|
+
*/
|
|
4
|
+
declare class ObjectUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Checks if an object is an instance of any of the provided classes.
|
|
7
|
+
*
|
|
8
|
+
* @param obj - The object to check
|
|
9
|
+
* @param classes - Array of class constructors to test against
|
|
10
|
+
* @returns True if the object is an instance of any class, false otherwise
|
|
11
|
+
*/
|
|
12
|
+
static isInstanceOfAny(obj: any, classes: any[]): boolean;
|
|
13
|
+
}
|
|
14
|
+
export default ObjectUtils;
|
|
15
|
+
//# sourceMappingURL=object_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object_utils.d.ts","sourceRoot":"","sources":["../../src/utils/object_utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAM,WAAW;IACb;;;;;;OAMG;IACH,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO;CAG5D;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for string manipulation and validation.
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for handling quoted strings, comments, escape sequences,
|
|
5
|
+
* and identifier validation.
|
|
6
|
+
*/
|
|
7
|
+
declare class StringUtils {
|
|
8
|
+
static readonly quotes: string[];
|
|
9
|
+
static readonly letters = "abcdefghijklmnopqrstuvwxyz";
|
|
10
|
+
static readonly digits = "0123456789";
|
|
11
|
+
static readonly whitespace = " \t\n\r";
|
|
12
|
+
static readonly word_valid_chars: string;
|
|
13
|
+
/**
|
|
14
|
+
* Removes surrounding quotes from a string.
|
|
15
|
+
*
|
|
16
|
+
* @param str - The string to unquote
|
|
17
|
+
* @returns The unquoted string
|
|
18
|
+
*/
|
|
19
|
+
static unquote(str: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Removes comment markers from a string.
|
|
22
|
+
*
|
|
23
|
+
* @param str - The comment string
|
|
24
|
+
* @returns The string without comment markers
|
|
25
|
+
*/
|
|
26
|
+
static uncomment(str: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Removes escape sequences before quotes in a string.
|
|
29
|
+
*
|
|
30
|
+
* @param str - The string to process
|
|
31
|
+
* @param quoteChar - The quote character that was escaped
|
|
32
|
+
* @returns The string with escape sequences removed
|
|
33
|
+
*/
|
|
34
|
+
static removeEscapedQuotes(str: string, quoteChar: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Removes escaped braces ({{ and }}) from f-strings.
|
|
37
|
+
*
|
|
38
|
+
* @param str - The string to process
|
|
39
|
+
* @returns The string with escaped braces resolved
|
|
40
|
+
*/
|
|
41
|
+
static removeEscapedBraces(str: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Checks if a string is a valid identifier.
|
|
44
|
+
*
|
|
45
|
+
* @param str - The string to validate
|
|
46
|
+
* @returns True if the string can be used as an identifier, false otherwise
|
|
47
|
+
*/
|
|
48
|
+
static can_be_identifier(str: string): boolean;
|
|
49
|
+
}
|
|
50
|
+
export default StringUtils;
|
|
51
|
+
//# sourceMappingURL=string_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string_utils.d.ts","sourceRoot":"","sources":["../../src/utils/string_utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAM,WAAW;IACb,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAmB;IACnD,MAAM,CAAC,QAAQ,CAAC,OAAO,gCAAgC;IACvD,MAAM,CAAC,QAAQ,CAAC,MAAM,gBAAgB;IACtC,MAAM,CAAC,QAAQ,CAAC,UAAU,aAAa;IACvC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,SAAkD;IAElF;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAqBnC;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAarC;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAWlE;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAW/C;;;;;OAKG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAWjD;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FlowQuery } from 'flowquery';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* RAG (Retrieval Augmented Generation) loop using FlowQuery.
|
|
@@ -7,11 +7,11 @@ import { run } from 'flowquery';
|
|
|
7
7
|
*/
|
|
8
8
|
async function main() {
|
|
9
9
|
// Example: Run a simple FlowQuery query
|
|
10
|
-
const query =
|
|
10
|
+
const query = new FlowQuery('WITH 1 AS x RETURN x + 1');
|
|
11
11
|
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
console.log('Result:',
|
|
13
|
+
await query.run();
|
|
14
|
+
console.log('Result:', query.results); // [ { expr0: 2 } ]
|
|
15
15
|
} catch (error) {
|
|
16
16
|
console.error('Error running query:', error);
|
|
17
17
|
}
|
package/package.json
CHANGED
package/src/parsing/parser.ts
CHANGED
|
@@ -50,7 +50,7 @@ import Null from "./components/null";
|
|
|
50
50
|
* @example
|
|
51
51
|
* ```typescript
|
|
52
52
|
* const parser = new Parser();
|
|
53
|
-
* const ast = parser.parse("unwind [1, 2, 3, 4
|
|
53
|
+
* const ast = parser.parse("unwind [1, 2, 3, 4] as num return num");
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
class Parser extends BaseParser {
|
package/tsconfig.json
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
10
10
|
"strict": true,
|
|
11
11
|
"types": ["node", "jest"],
|
|
12
|
-
"sourceMap": true
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"declaration": true, /* Generate .d.ts declaration files. */
|
|
14
|
+
"declarationMap": true /* Generate sourcemaps for .d.ts files. */
|
|
13
15
|
},
|
|
14
16
|
"include": ["src"]
|
|
15
17
|
}
|