flowquery 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/python-publish.yml +97 -0
- package/dist/compute/runner.d.ts +3 -2
- package/dist/compute/runner.d.ts.map +1 -1
- package/dist/compute/runner.js +7 -7
- package/dist/compute/runner.js.map +1 -1
- package/dist/flowquery.min.js +1 -1
- package/dist/graph/data.d.ts +31 -0
- package/dist/graph/data.d.ts.map +1 -0
- package/dist/graph/data.js +110 -0
- package/dist/graph/data.js.map +1 -0
- package/dist/graph/database.d.ts +20 -0
- package/dist/graph/database.d.ts.map +1 -0
- package/dist/graph/database.js +77 -0
- package/dist/graph/database.js.map +1 -0
- package/dist/graph/hops.d.ts +11 -0
- package/dist/graph/hops.d.ts.map +1 -0
- package/dist/graph/hops.js +25 -0
- package/dist/graph/hops.js.map +1 -0
- package/dist/graph/node.d.ts +35 -0
- package/dist/graph/node.d.ts.map +1 -0
- package/dist/graph/node.js +113 -0
- package/dist/graph/node.js.map +1 -0
- package/dist/graph/node_data.d.ts +11 -0
- package/dist/graph/node_data.d.ts.map +1 -0
- package/dist/graph/node_data.js +20 -0
- package/dist/graph/node_data.js.map +1 -0
- package/dist/graph/node_reference.d.ts +10 -0
- package/dist/graph/node_reference.d.ts.map +1 -0
- package/dist/graph/node_reference.js +52 -0
- package/dist/graph/node_reference.js.map +1 -0
- package/dist/graph/pattern.d.ts +18 -0
- package/dist/graph/pattern.d.ts.map +1 -0
- package/dist/graph/pattern.js +114 -0
- package/dist/graph/pattern.js.map +1 -0
- package/dist/graph/pattern_expression.d.ts +14 -0
- package/dist/graph/pattern_expression.d.ts.map +1 -0
- package/dist/graph/pattern_expression.js +58 -0
- package/dist/graph/pattern_expression.js.map +1 -0
- package/dist/graph/patterns.d.ts +11 -0
- package/dist/graph/patterns.d.ts.map +1 -0
- package/dist/graph/patterns.js +49 -0
- package/dist/graph/patterns.js.map +1 -0
- package/dist/graph/physical_node.d.ts +10 -0
- package/dist/graph/physical_node.d.ts.map +1 -0
- package/dist/graph/physical_node.js +40 -0
- package/dist/graph/physical_node.js.map +1 -0
- package/dist/graph/physical_relationship.d.ts +10 -0
- package/dist/graph/physical_relationship.d.ts.map +1 -0
- package/dist/graph/physical_relationship.js +40 -0
- package/dist/graph/physical_relationship.js.map +1 -0
- package/dist/graph/relationship.d.ts +40 -0
- package/dist/graph/relationship.d.ts.map +1 -0
- package/dist/graph/relationship.js +124 -0
- package/dist/graph/relationship.js.map +1 -0
- package/dist/graph/relationship_data.d.ts +12 -0
- package/dist/graph/relationship_data.d.ts.map +1 -0
- package/dist/graph/relationship_data.js +40 -0
- package/dist/graph/relationship_data.js.map +1 -0
- package/dist/graph/relationship_match_collector.d.ts +19 -0
- package/dist/graph/relationship_match_collector.d.ts.map +1 -0
- package/dist/graph/relationship_match_collector.js +55 -0
- package/dist/graph/relationship_match_collector.js.map +1 -0
- package/dist/graph/relationship_reference.d.ts +8 -0
- package/dist/graph/relationship_reference.d.ts.map +1 -0
- package/dist/graph/relationship_reference.js +37 -0
- package/dist/graph/relationship_reference.js.map +1 -0
- package/dist/parsing/base_parser.d.ts +1 -0
- package/dist/parsing/base_parser.d.ts.map +1 -1
- package/dist/parsing/base_parser.js +4 -1
- package/dist/parsing/base_parser.js.map +1 -1
- package/dist/parsing/context.d.ts +2 -2
- package/dist/parsing/context.js +5 -5
- package/dist/parsing/expressions/boolean.d.ts +8 -0
- package/dist/parsing/expressions/boolean.d.ts.map +1 -0
- package/dist/parsing/expressions/boolean.js +26 -0
- package/dist/parsing/expressions/boolean.js.map +1 -0
- package/dist/parsing/expressions/expression.d.ts +4 -1
- package/dist/parsing/expressions/expression.d.ts.map +1 -1
- package/dist/parsing/expressions/expression.js +15 -8
- package/dist/parsing/expressions/expression.js.map +1 -1
- package/dist/parsing/expressions/expression_map.d.ts +1 -0
- package/dist/parsing/expressions/expression_map.d.ts.map +1 -1
- package/dist/parsing/expressions/expression_map.js +3 -0
- package/dist/parsing/expressions/expression_map.js.map +1 -1
- package/dist/parsing/expressions/operator.d.ts +1 -1
- package/dist/parsing/expressions/operator.d.ts.map +1 -1
- package/dist/parsing/expressions/operator.js.map +1 -1
- package/dist/parsing/functions/function_factory.d.ts +13 -13
- package/dist/parsing/functions/function_factory.d.ts.map +1 -1
- package/dist/parsing/functions/function_factory.js +20 -18
- package/dist/parsing/functions/function_factory.js.map +1 -1
- package/dist/parsing/operations/call.d.ts.map +1 -1
- package/dist/parsing/operations/call.js +3 -1
- package/dist/parsing/operations/call.js.map +1 -1
- package/dist/parsing/operations/create_node.d.ts +14 -0
- package/dist/parsing/operations/create_node.d.ts.map +1 -0
- package/dist/parsing/operations/create_node.js +51 -0
- package/dist/parsing/operations/create_node.js.map +1 -0
- package/dist/parsing/operations/create_relationship.d.ts +14 -0
- package/dist/parsing/operations/create_relationship.d.ts.map +1 -0
- package/dist/parsing/operations/create_relationship.js +51 -0
- package/dist/parsing/operations/create_relationship.js.map +1 -0
- package/dist/parsing/operations/match.d.ts +15 -0
- package/dist/parsing/operations/match.d.ts.map +1 -0
- package/dist/parsing/operations/match.js +45 -0
- package/dist/parsing/operations/match.js.map +1 -0
- package/dist/parsing/operations/operation.d.ts +1 -0
- package/dist/parsing/operations/operation.d.ts.map +1 -1
- package/dist/parsing/operations/operation.js +6 -0
- package/dist/parsing/operations/operation.js.map +1 -1
- package/dist/parsing/operations/return.d.ts +1 -0
- package/dist/parsing/operations/return.d.ts.map +1 -1
- package/dist/parsing/operations/return.js +7 -1
- package/dist/parsing/operations/return.js.map +1 -1
- package/dist/parsing/operations/where.d.ts +1 -1
- package/dist/parsing/operations/where.d.ts.map +1 -1
- package/dist/parsing/operations/where.js +4 -0
- package/dist/parsing/operations/where.js.map +1 -1
- package/dist/parsing/parser.d.ts +10 -0
- package/dist/parsing/parser.d.ts.map +1 -1
- package/dist/parsing/parser.js +344 -5
- package/dist/parsing/parser.js.map +1 -1
- package/dist/parsing/token_to_node.d.ts.map +1 -1
- package/dist/parsing/token_to_node.js +7 -0
- package/dist/parsing/token_to_node.js.map +1 -1
- package/dist/tokenization/keyword.d.ts +1 -0
- package/dist/tokenization/keyword.d.ts.map +1 -1
- package/dist/tokenization/keyword.js +1 -0
- package/dist/tokenization/keyword.js.map +1 -1
- package/dist/tokenization/token.d.ts +4 -0
- package/dist/tokenization/token.d.ts.map +1 -1
- package/dist/tokenization/token.js +14 -1
- package/dist/tokenization/token.js.map +1 -1
- package/dist/tokenization/token_type.d.ts +1 -0
- package/dist/tokenization/token_type.d.ts.map +1 -1
- package/dist/tokenization/token_type.js +1 -0
- package/dist/tokenization/token_type.js.map +1 -1
- package/dist/tokenization/tokenizer.d.ts +2 -1
- package/dist/tokenization/tokenizer.d.ts.map +1 -1
- package/dist/tokenization/tokenizer.js +25 -12
- package/dist/tokenization/tokenizer.js.map +1 -1
- package/docs/flowquery.min.js +1 -1
- package/flowquery-py/README.md +166 -0
- package/flowquery-py/pyproject.toml +75 -0
- package/flowquery-py/setup_env.ps1 +92 -0
- package/flowquery-py/setup_env.sh +87 -0
- package/flowquery-py/src/__init__.py +34 -0
- package/flowquery-py/src/__main__.py +10 -0
- package/flowquery-py/src/compute/__init__.py +5 -0
- package/flowquery-py/src/compute/runner.py +60 -0
- package/flowquery-py/src/extensibility.py +52 -0
- package/flowquery-py/src/graph/__init__.py +31 -0
- package/flowquery-py/src/graph/data.py +118 -0
- package/flowquery-py/src/graph/database.py +82 -0
- package/flowquery-py/src/graph/hops.py +43 -0
- package/flowquery-py/src/graph/node.py +112 -0
- package/flowquery-py/src/graph/node_data.py +26 -0
- package/flowquery-py/src/graph/node_reference.py +49 -0
- package/flowquery-py/src/graph/pattern.py +125 -0
- package/flowquery-py/src/graph/pattern_expression.py +62 -0
- package/flowquery-py/src/graph/patterns.py +42 -0
- package/flowquery-py/src/graph/physical_node.py +40 -0
- package/flowquery-py/src/graph/physical_relationship.py +36 -0
- package/flowquery-py/src/graph/relationship.py +135 -0
- package/flowquery-py/src/graph/relationship_data.py +33 -0
- package/flowquery-py/src/graph/relationship_match_collector.py +77 -0
- package/flowquery-py/src/graph/relationship_reference.py +21 -0
- package/flowquery-py/src/io/__init__.py +5 -0
- package/flowquery-py/src/io/command_line.py +67 -0
- package/flowquery-py/src/parsing/__init__.py +17 -0
- package/flowquery-py/src/parsing/alias.py +20 -0
- package/flowquery-py/src/parsing/alias_option.py +11 -0
- package/flowquery-py/src/parsing/ast_node.py +146 -0
- package/flowquery-py/src/parsing/base_parser.py +84 -0
- package/flowquery-py/src/parsing/components/__init__.py +19 -0
- package/flowquery-py/src/parsing/components/csv.py +8 -0
- package/flowquery-py/src/parsing/components/from_.py +10 -0
- package/flowquery-py/src/parsing/components/headers.py +12 -0
- package/flowquery-py/src/parsing/components/json.py +8 -0
- package/flowquery-py/src/parsing/components/null.py +10 -0
- package/flowquery-py/src/parsing/components/post.py +8 -0
- package/flowquery-py/src/parsing/components/text.py +8 -0
- package/flowquery-py/src/parsing/context.py +50 -0
- package/flowquery-py/src/parsing/data_structures/__init__.py +15 -0
- package/flowquery-py/src/parsing/data_structures/associative_array.py +41 -0
- package/flowquery-py/src/parsing/data_structures/json_array.py +30 -0
- package/flowquery-py/src/parsing/data_structures/key_value_pair.py +38 -0
- package/flowquery-py/src/parsing/data_structures/lookup.py +49 -0
- package/flowquery-py/src/parsing/data_structures/range_lookup.py +42 -0
- package/flowquery-py/src/parsing/expressions/__init__.py +57 -0
- package/flowquery-py/src/parsing/expressions/boolean.py +20 -0
- package/flowquery-py/src/parsing/expressions/expression.py +138 -0
- package/flowquery-py/src/parsing/expressions/expression_map.py +26 -0
- package/flowquery-py/src/parsing/expressions/f_string.py +27 -0
- package/flowquery-py/src/parsing/expressions/identifier.py +20 -0
- package/flowquery-py/src/parsing/expressions/number.py +32 -0
- package/flowquery-py/src/parsing/expressions/operator.py +169 -0
- package/flowquery-py/src/parsing/expressions/reference.py +47 -0
- package/flowquery-py/src/parsing/expressions/string.py +27 -0
- package/flowquery-py/src/parsing/functions/__init__.py +75 -0
- package/flowquery-py/src/parsing/functions/aggregate_function.py +60 -0
- package/flowquery-py/src/parsing/functions/async_function.py +62 -0
- package/flowquery-py/src/parsing/functions/avg.py +55 -0
- package/flowquery-py/src/parsing/functions/collect.py +75 -0
- package/flowquery-py/src/parsing/functions/function.py +68 -0
- package/flowquery-py/src/parsing/functions/function_factory.py +173 -0
- package/flowquery-py/src/parsing/functions/function_metadata.py +149 -0
- package/flowquery-py/src/parsing/functions/functions.py +59 -0
- package/flowquery-py/src/parsing/functions/join.py +47 -0
- package/flowquery-py/src/parsing/functions/keys.py +34 -0
- package/flowquery-py/src/parsing/functions/predicate_function.py +46 -0
- package/flowquery-py/src/parsing/functions/predicate_sum.py +47 -0
- package/flowquery-py/src/parsing/functions/rand.py +28 -0
- package/flowquery-py/src/parsing/functions/range_.py +34 -0
- package/flowquery-py/src/parsing/functions/reducer_element.py +15 -0
- package/flowquery-py/src/parsing/functions/replace.py +37 -0
- package/flowquery-py/src/parsing/functions/round_.py +32 -0
- package/flowquery-py/src/parsing/functions/size.py +32 -0
- package/flowquery-py/src/parsing/functions/split.py +47 -0
- package/flowquery-py/src/parsing/functions/stringify.py +47 -0
- package/flowquery-py/src/parsing/functions/sum.py +51 -0
- package/flowquery-py/src/parsing/functions/to_json.py +33 -0
- package/flowquery-py/src/parsing/functions/type_.py +47 -0
- package/flowquery-py/src/parsing/functions/value_holder.py +24 -0
- package/flowquery-py/src/parsing/logic/__init__.py +15 -0
- package/flowquery-py/src/parsing/logic/case.py +29 -0
- package/flowquery-py/src/parsing/logic/else_.py +12 -0
- package/flowquery-py/src/parsing/logic/end.py +8 -0
- package/flowquery-py/src/parsing/logic/then.py +12 -0
- package/flowquery-py/src/parsing/logic/when.py +10 -0
- package/flowquery-py/src/parsing/operations/__init__.py +35 -0
- package/flowquery-py/src/parsing/operations/aggregated_return.py +24 -0
- package/flowquery-py/src/parsing/operations/aggregated_with.py +22 -0
- package/flowquery-py/src/parsing/operations/call.py +74 -0
- package/flowquery-py/src/parsing/operations/create_node.py +34 -0
- package/flowquery-py/src/parsing/operations/create_relationship.py +34 -0
- package/flowquery-py/src/parsing/operations/group_by.py +130 -0
- package/flowquery-py/src/parsing/operations/limit.py +22 -0
- package/flowquery-py/src/parsing/operations/load.py +140 -0
- package/flowquery-py/src/parsing/operations/match.py +29 -0
- package/flowquery-py/src/parsing/operations/operation.py +69 -0
- package/flowquery-py/src/parsing/operations/projection.py +21 -0
- package/flowquery-py/src/parsing/operations/return_op.py +50 -0
- package/flowquery-py/src/parsing/operations/unwind.py +37 -0
- package/flowquery-py/src/parsing/operations/where.py +41 -0
- package/flowquery-py/src/parsing/operations/with_op.py +18 -0
- package/flowquery-py/src/parsing/parser.py +1011 -0
- package/flowquery-py/src/parsing/token_to_node.py +109 -0
- package/flowquery-py/src/tokenization/__init__.py +23 -0
- package/flowquery-py/src/tokenization/keyword.py +48 -0
- package/flowquery-py/src/tokenization/operator.py +29 -0
- package/flowquery-py/src/tokenization/string_walker.py +158 -0
- package/flowquery-py/src/tokenization/symbol.py +19 -0
- package/flowquery-py/src/tokenization/token.py +659 -0
- package/flowquery-py/src/tokenization/token_mapper.py +52 -0
- package/flowquery-py/src/tokenization/token_type.py +21 -0
- package/flowquery-py/src/tokenization/tokenizer.py +214 -0
- package/flowquery-py/src/tokenization/trie.py +124 -0
- package/flowquery-py/src/utils/__init__.py +6 -0
- package/flowquery-py/src/utils/object_utils.py +20 -0
- package/flowquery-py/src/utils/string_utils.py +113 -0
- package/flowquery-py/tests/__init__.py +1 -0
- package/flowquery-py/tests/compute/__init__.py +1 -0
- package/flowquery-py/tests/compute/test_runner.py +1335 -0
- package/flowquery-py/tests/graph/__init__.py +1 -0
- package/flowquery-py/tests/graph/test_create.py +56 -0
- package/flowquery-py/tests/graph/test_data.py +73 -0
- package/flowquery-py/tests/graph/test_match.py +40 -0
- package/flowquery-py/tests/parsing/__init__.py +1 -0
- package/flowquery-py/tests/parsing/test_context.py +34 -0
- package/flowquery-py/tests/parsing/test_expression.py +49 -0
- package/flowquery-py/tests/parsing/test_parser.py +674 -0
- package/flowquery-py/tests/test_extensibility.py +611 -0
- package/flowquery-py/tests/tokenization/__init__.py +1 -0
- package/flowquery-py/tests/tokenization/test_token_mapper.py +60 -0
- package/flowquery-py/tests/tokenization/test_tokenizer.py +164 -0
- package/flowquery-py/tests/tokenization/test_trie.py +30 -0
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/misc/apps/RAG/package.json +1 -1
- package/misc/apps/RAG/src/components/AdaptiveCardRenderer.tsx +76 -8
- package/misc/apps/RAG/src/components/index.ts +19 -10
- package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +21 -26
- package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +24 -25
- package/misc/apps/RAG/src/plugins/loaders/Form.ts +163 -147
- package/misc/apps/RAG/src/plugins/loaders/Llm.ts +103 -90
- package/misc/apps/RAG/src/plugins/loaders/MockData.ts +80 -130
- package/misc/apps/RAG/src/plugins/loaders/Table.ts +104 -101
- package/misc/apps/RAG/src/plugins/loaders/Weather.ts +47 -36
- package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +89 -78
- package/package.json +1 -1
- package/src/compute/runner.ts +24 -19
- package/src/graph/data.ts +112 -0
- package/src/graph/database.ts +63 -0
- package/src/graph/hops.ts +22 -0
- package/src/graph/node.ts +99 -0
- package/src/graph/node_data.ts +18 -0
- package/src/graph/node_reference.ts +33 -0
- package/src/graph/pattern.ts +101 -0
- package/src/graph/pattern_expression.ts +37 -0
- package/src/graph/patterns.ts +36 -0
- package/src/graph/physical_node.ts +23 -0
- package/src/graph/physical_relationship.ts +23 -0
- package/src/graph/relationship.ts +116 -0
- package/src/graph/relationship_data.ts +27 -0
- package/src/graph/relationship_match_collector.ts +58 -0
- package/src/graph/relationship_reference.ts +24 -0
- package/src/parsing/base_parser.ts +20 -14
- package/src/parsing/context.ts +14 -14
- package/src/parsing/expressions/boolean.ts +21 -0
- package/src/parsing/expressions/expression.ts +34 -26
- package/src/parsing/expressions/expression_map.ts +3 -0
- package/src/parsing/expressions/operator.ts +19 -1
- package/src/parsing/functions/function_factory.ts +45 -45
- package/src/parsing/operations/call.ts +3 -1
- package/src/parsing/operations/create_node.ts +39 -0
- package/src/parsing/operations/create_relationship.ts +38 -0
- package/src/parsing/operations/match.ts +31 -0
- package/src/parsing/operations/operation.ts +3 -0
- package/src/parsing/operations/return.ts +11 -7
- package/src/parsing/operations/where.ts +10 -6
- package/src/parsing/parser.ts +346 -8
- package/src/parsing/token_to_node.ts +6 -0
- package/src/tokenization/keyword.ts +41 -40
- package/src/tokenization/token.ts +21 -1
- package/src/tokenization/token_type.ts +2 -1
- package/src/tokenization/tokenizer.ts +52 -31
- package/tests/compute/runner.test.ts +660 -6
- package/tests/extensibility.test.ts +97 -93
- package/tests/graph/create.test.ts +36 -0
- package/tests/graph/data.test.ts +58 -0
- package/tests/graph/match.test.ts +29 -0
- package/tests/parsing/parser.test.ts +276 -8
- package/tests/tokenization/tokenizer.test.ts +107 -17
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const ast_node_1 = __importDefault(require("../parsing/ast_node"));
|
|
16
|
+
const database_1 = __importDefault(require("./database"));
|
|
17
|
+
const node_1 = __importDefault(require("./node"));
|
|
18
|
+
const node_reference_1 = __importDefault(require("./node_reference"));
|
|
19
|
+
const relationship_1 = __importDefault(require("./relationship"));
|
|
20
|
+
const relationship_reference_1 = __importDefault(require("./relationship_reference"));
|
|
21
|
+
class Pattern extends ast_node_1.default {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this._identifier = null;
|
|
25
|
+
this._chain = [];
|
|
26
|
+
}
|
|
27
|
+
set identifier(id) {
|
|
28
|
+
this._identifier = id;
|
|
29
|
+
}
|
|
30
|
+
get identifier() {
|
|
31
|
+
return this._identifier;
|
|
32
|
+
}
|
|
33
|
+
addElement(element) {
|
|
34
|
+
if (this._chain.length > 0 &&
|
|
35
|
+
this._chain[this._chain.length - 1].constructor === element.constructor) {
|
|
36
|
+
throw new Error("Cannot add two consecutive elements of the same type to the graph pattern");
|
|
37
|
+
}
|
|
38
|
+
if (this._chain.length > 0) {
|
|
39
|
+
const last = this._chain[this._chain.length - 1];
|
|
40
|
+
if (last instanceof node_1.default && element instanceof relationship_1.default) {
|
|
41
|
+
last.outgoing = element;
|
|
42
|
+
element.source = last;
|
|
43
|
+
}
|
|
44
|
+
if (last instanceof relationship_1.default && element instanceof node_1.default) {
|
|
45
|
+
last.target = element;
|
|
46
|
+
element.incoming = last;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
this._chain.push(element);
|
|
50
|
+
}
|
|
51
|
+
get chain() {
|
|
52
|
+
return this._chain;
|
|
53
|
+
}
|
|
54
|
+
get startNode() {
|
|
55
|
+
if (this._chain.length === 0) {
|
|
56
|
+
throw new Error("Pattern is empty");
|
|
57
|
+
}
|
|
58
|
+
const first = this._chain[0];
|
|
59
|
+
if (first instanceof node_1.default) {
|
|
60
|
+
return first;
|
|
61
|
+
}
|
|
62
|
+
throw new Error("Pattern does not start with a node");
|
|
63
|
+
}
|
|
64
|
+
get endNode() {
|
|
65
|
+
if (this._chain.length === 0) {
|
|
66
|
+
throw new Error("Pattern is empty");
|
|
67
|
+
}
|
|
68
|
+
const last = this._chain[this._chain.length - 1];
|
|
69
|
+
if (last instanceof node_1.default) {
|
|
70
|
+
return last;
|
|
71
|
+
}
|
|
72
|
+
throw new Error("Pattern does not end with a node");
|
|
73
|
+
}
|
|
74
|
+
value() {
|
|
75
|
+
return Array.from(this.values());
|
|
76
|
+
}
|
|
77
|
+
*values() {
|
|
78
|
+
for (const element of this._chain) {
|
|
79
|
+
if (element instanceof node_1.default) {
|
|
80
|
+
yield element.value();
|
|
81
|
+
}
|
|
82
|
+
else if (element instanceof relationship_1.default) {
|
|
83
|
+
let i = 0;
|
|
84
|
+
for (const match of element.matches) {
|
|
85
|
+
yield match;
|
|
86
|
+
if (i < element.matches.length - 1) {
|
|
87
|
+
yield match.endNode;
|
|
88
|
+
}
|
|
89
|
+
i++;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
fetchData() {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const db = database_1.default.getInstance();
|
|
97
|
+
for (const element of this._chain) {
|
|
98
|
+
if (element.constructor === node_reference_1.default ||
|
|
99
|
+
element.constructor === relationship_reference_1.default) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const data = yield db.getData(element);
|
|
103
|
+
if (element.constructor === node_1.default) {
|
|
104
|
+
element.setData(data);
|
|
105
|
+
}
|
|
106
|
+
else if (element.constructor === relationship_1.default) {
|
|
107
|
+
element.setData(data);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.default = Pattern;
|
|
114
|
+
//# sourceMappingURL=pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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BACV,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;oBAClC,MAAM,KAAK,CAAC;oBACZ,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACjC,MAAM,KAAK,CAAC,OAAO,CAAC;oBACxB,CAAC;oBACD,CAAC,EAAE,CAAC;gBACR,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IACY,SAAS;;YAClB,MAAM,EAAE,GAAa,kBAAQ,CAAC,WAAW,EAAE,CAAC;YAC5C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChC,IACI,OAAO,CAAC,WAAW,KAAK,wBAAa;oBACrC,OAAO,CAAC,WAAW,KAAK,gCAAqB,EAC/C,CAAC;oBACC,SAAS;gBACb,CAAC;gBACD,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,OAAO,CAAC,WAAW,KAAK,cAAI,EAAE,CAAC;oBAC/B,OAAO,CAAC,OAAO,CAAC,IAAgB,CAAC,CAAC;gBACtC,CAAC;qBAAM,IAAI,OAAO,CAAC,WAAW,KAAK,sBAAY,EAAE,CAAC;oBAC9C,OAAO,CAAC,OAAO,CAAC,IAAwB,CAAC,CAAC;gBAC9C,CAAC;YACL,CAAC;QACL,CAAC;KAAA;CACJ;AACD,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Node from "./node";
|
|
2
|
+
import Pattern from "./pattern";
|
|
3
|
+
import Relationship from "./relationship";
|
|
4
|
+
declare class PatternExpression extends Pattern {
|
|
5
|
+
private _fetched;
|
|
6
|
+
private _evaluation;
|
|
7
|
+
set identifier(id: string | null);
|
|
8
|
+
addElement(element: Relationship | Node): void;
|
|
9
|
+
evaluate(): Promise<void>;
|
|
10
|
+
value(): boolean;
|
|
11
|
+
fetchData(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default PatternExpression;
|
|
14
|
+
//# sourceMappingURL=pattern_expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern_expression.d.ts","sourceRoot":"","sources":["../../src/graph/pattern_expression.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAM,iBAAkB,SAAQ,OAAO;IACnC,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,WAAW,CAAkB;IACrC,IAAW,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAEtC;IACM,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI;IAMxC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B,KAAK,IAAI,OAAO;IAGV,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAO1C;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const node_reference_1 = __importDefault(require("./node_reference"));
|
|
16
|
+
const pattern_1 = __importDefault(require("./pattern"));
|
|
17
|
+
class PatternExpression extends pattern_1.default {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this._fetched = false;
|
|
21
|
+
this._evaluation = false;
|
|
22
|
+
}
|
|
23
|
+
set identifier(id) {
|
|
24
|
+
throw new Error("Cannot set identifier on PatternExpression");
|
|
25
|
+
}
|
|
26
|
+
addElement(element) {
|
|
27
|
+
if (this._chain.length == 0 && !(element instanceof node_reference_1.default)) {
|
|
28
|
+
throw new Error("PatternExpression must start with a NodeReference");
|
|
29
|
+
}
|
|
30
|
+
super.addElement(element);
|
|
31
|
+
}
|
|
32
|
+
evaluate() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
this._evaluation = false;
|
|
35
|
+
this.endNode.todoNext = () => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
this._evaluation = true;
|
|
37
|
+
});
|
|
38
|
+
yield this.startNode.next();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
value() {
|
|
42
|
+
return this._evaluation;
|
|
43
|
+
}
|
|
44
|
+
fetchData() {
|
|
45
|
+
const _super = Object.create(null, {
|
|
46
|
+
fetchData: { get: () => super.fetchData }
|
|
47
|
+
});
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
if (this._fetched) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
yield _super.fetchData.call(this);
|
|
53
|
+
this._fetched = true;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = PatternExpression;
|
|
58
|
+
//# sourceMappingURL=pattern_expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern_expression.js","sourceRoot":"","sources":["../../src/graph/pattern_expression.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,sEAA6C;AAC7C,wDAAgC;AAGhC,MAAM,iBAAkB,SAAQ,iBAAO;IAAvC;;QACY,aAAQ,GAAY,KAAK,CAAC;QAC1B,gBAAW,GAAY,KAAK,CAAC;IA2BzC,CAAC;IA1BG,IAAW,UAAU,CAAC,EAAiB;QACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAClE,CAAC;IACM,UAAU,CAAC,OAA4B;QAC1C,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,YAAY,wBAAa,CAAC,EAAE,CAAC;YACjE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzE,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IACY,QAAQ;;YACjB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAS,EAAE;gBAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAA,CAAC;YACF,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAChC,CAAC;KAAA;IACM,KAAK;QACR,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACY,SAAS;;;;;YAClB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChB,OAAO;YACX,CAAC;YACD,MAAM,OAAM,SAAS,WAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC;KAAA;CACJ;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Pattern from "./pattern";
|
|
2
|
+
declare class Patterns {
|
|
3
|
+
private _patterns;
|
|
4
|
+
constructor(patterns?: Pattern[]);
|
|
5
|
+
get patterns(): Pattern[];
|
|
6
|
+
initialize(): Promise<void>;
|
|
7
|
+
set toDoNext(func: () => Promise<void>);
|
|
8
|
+
traverse(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export default Patterns;
|
|
11
|
+
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/graph/patterns.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,cAAM,QAAQ;IACV,OAAO,CAAC,SAAS,CAAiB;gBACtB,QAAQ,GAAE,OAAO,EAAO;IAGpC,IAAW,QAAQ,IAAI,OAAO,EAAE,CAE/B;IACY,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxC,IAAW,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAI5C;IACY,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAKzC;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
class Patterns {
|
|
13
|
+
constructor(patterns = []) {
|
|
14
|
+
this._patterns = [];
|
|
15
|
+
this._patterns = patterns;
|
|
16
|
+
}
|
|
17
|
+
get patterns() {
|
|
18
|
+
return this._patterns;
|
|
19
|
+
}
|
|
20
|
+
initialize() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
let previous = null;
|
|
23
|
+
for (const pattern of this._patterns) {
|
|
24
|
+
yield pattern.fetchData(); // Ensure data is loaded
|
|
25
|
+
if (previous !== null) {
|
|
26
|
+
// Chain the patterns together
|
|
27
|
+
previous.endNode.todoNext = () => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield pattern.startNode.next();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
previous = pattern;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
set toDoNext(func) {
|
|
36
|
+
if (this._patterns.length > 0) {
|
|
37
|
+
this._patterns[this._patterns.length - 1].endNode.todoNext = func;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
traverse() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (this._patterns.length > 0) {
|
|
43
|
+
yield this._patterns[0].startNode.next();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = Patterns;
|
|
49
|
+
//# sourceMappingURL=patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/graph/patterns.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAM,QAAQ;IAEV,YAAY,WAAsB,EAAE;QAD5B,cAAS,GAAc,EAAE,CAAC;QAE9B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACY,UAAU;;YACnB,IAAI,QAAQ,GAAmB,IAAI,CAAC;YACpC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,wBAAwB;gBACnD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;oBACpB,8BAA8B;oBAC9B,QAAQ,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAS,EAAE;wBACnC,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;oBACnC,CAAC,CAAA,CAAC;gBACN,CAAC;gBACD,QAAQ,GAAG,OAAO,CAAC;YACvB,CAAC;QACL,CAAC;KAAA;IACD,IAAW,QAAQ,CAAC,IAAyB;QACzC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;QACtE,CAAC;IACL,CAAC;IACY,QAAQ;;YACjB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YAC7C,CAAC;QACL,CAAC;KAAA;CACJ;AAED,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
import Node from "./node";
|
|
3
|
+
declare class PhysicalNode extends Node {
|
|
4
|
+
private _statement;
|
|
5
|
+
set statement(statement: ASTNode | null);
|
|
6
|
+
get statement(): ASTNode | null;
|
|
7
|
+
data(): Promise<Record<string, any>[]>;
|
|
8
|
+
}
|
|
9
|
+
export default PhysicalNode;
|
|
10
|
+
//# sourceMappingURL=physical_node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physical_node.d.ts","sourceRoot":"","sources":["../../src/graph/physical_node.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,cAAM,YAAa,SAAQ,IAAI;IAC3B,OAAO,CAAC,UAAU,CAAwB;IAC1C,IAAW,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,EAE7C;IACD,IAAW,SAAS,IAAI,OAAO,GAAG,IAAI,CAErC;IACY,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CAQtD;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const runner_1 = __importDefault(require("../compute/runner"));
|
|
16
|
+
const node_1 = __importDefault(require("./node"));
|
|
17
|
+
class PhysicalNode extends node_1.default {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this._statement = null;
|
|
21
|
+
}
|
|
22
|
+
set statement(statement) {
|
|
23
|
+
this._statement = statement;
|
|
24
|
+
}
|
|
25
|
+
get statement() {
|
|
26
|
+
return this._statement;
|
|
27
|
+
}
|
|
28
|
+
data() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (this._statement === null) {
|
|
31
|
+
throw new Error("Statement is null");
|
|
32
|
+
}
|
|
33
|
+
const runner = new runner_1.default(null, this._statement);
|
|
34
|
+
yield runner.run();
|
|
35
|
+
return runner.results;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = PhysicalNode;
|
|
40
|
+
//# sourceMappingURL=physical_node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physical_node.js","sourceRoot":"","sources":["../../src/graph/physical_node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuC;AAEvC,kDAA0B;AAE1B,MAAM,YAAa,SAAQ,cAAI;IAA/B;;QACY,eAAU,GAAmB,IAAI,CAAC;IAe9C,CAAC;IAdG,IAAW,SAAS,CAAC,SAAyB;QAC1C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACY,IAAI;;YACb,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YACjD,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC,OAAO,CAAC;QAC1B,CAAC;KAAA;CACJ;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
import Relationship from "./relationship";
|
|
3
|
+
declare class PhysicalRelationship extends Relationship {
|
|
4
|
+
private _statement;
|
|
5
|
+
set statement(statement: ASTNode | null);
|
|
6
|
+
get statement(): ASTNode | null;
|
|
7
|
+
data(): Promise<Record<string, any>[]>;
|
|
8
|
+
}
|
|
9
|
+
export default PhysicalRelationship;
|
|
10
|
+
//# sourceMappingURL=physical_relationship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physical_relationship.d.ts","sourceRoot":"","sources":["../../src/graph/physical_relationship.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAM,oBAAqB,SAAQ,YAAY;IAC3C,OAAO,CAAC,UAAU,CAAwB;IAC1C,IAAW,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,EAE7C;IACD,IAAW,SAAS,IAAI,OAAO,GAAG,IAAI,CAErC;IACY,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CAQtD;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const runner_1 = __importDefault(require("../compute/runner"));
|
|
16
|
+
const relationship_1 = __importDefault(require("./relationship"));
|
|
17
|
+
class PhysicalRelationship extends relationship_1.default {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this._statement = null;
|
|
21
|
+
}
|
|
22
|
+
set statement(statement) {
|
|
23
|
+
this._statement = statement;
|
|
24
|
+
}
|
|
25
|
+
get statement() {
|
|
26
|
+
return this._statement;
|
|
27
|
+
}
|
|
28
|
+
data() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (this._statement === null) {
|
|
31
|
+
throw new Error("Statement is null");
|
|
32
|
+
}
|
|
33
|
+
const runner = new runner_1.default(null, this._statement);
|
|
34
|
+
yield runner.run();
|
|
35
|
+
return runner.results;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = PhysicalRelationship;
|
|
40
|
+
//# sourceMappingURL=physical_relationship.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physical_relationship.js","sourceRoot":"","sources":["../../src/graph/physical_relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuC;AAEvC,kEAA0C;AAE1C,MAAM,oBAAqB,SAAQ,sBAAY;IAA/C;;QACY,eAAU,GAAmB,IAAI,CAAC;IAe9C,CAAC;IAdG,IAAW,SAAS,CAAC,SAAyB;QAC1C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACY,IAAI;;YACb,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YACjD,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC,OAAO,CAAC;QAC1B,CAAC;KAAA;CACJ;AAED,kBAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
import Expression from "../parsing/expressions/expression";
|
|
3
|
+
import Hops from "./hops";
|
|
4
|
+
import Node from "./node";
|
|
5
|
+
import RelationshipData from "./relationship_data";
|
|
6
|
+
import RelationshipMatchCollector, { RelationshipMatchRecord } from "./relationship_match_collector";
|
|
7
|
+
declare class Relationship extends ASTNode {
|
|
8
|
+
protected _identifier: string | null;
|
|
9
|
+
protected _type: string | null;
|
|
10
|
+
protected _properties: Map<string, Expression>;
|
|
11
|
+
protected _hops: Hops;
|
|
12
|
+
protected _value: RelationshipMatchRecord | RelationshipMatchRecord[] | null;
|
|
13
|
+
protected _matches: RelationshipMatchCollector;
|
|
14
|
+
protected _source: Node | null;
|
|
15
|
+
protected _target: Node | null;
|
|
16
|
+
private _data;
|
|
17
|
+
constructor(identifier?: string | null, type?: string | null);
|
|
18
|
+
set identifier(identifier: string);
|
|
19
|
+
get identifier(): string | null;
|
|
20
|
+
set type(type: string);
|
|
21
|
+
get type(): string | null;
|
|
22
|
+
get properties(): Record<string, any>;
|
|
23
|
+
setProperty(key: string, value: Expression): void;
|
|
24
|
+
getProperty(key: string): Expression | null;
|
|
25
|
+
set hops(hops: Hops);
|
|
26
|
+
get hops(): Hops | null;
|
|
27
|
+
setValue(relationship: Relationship): void;
|
|
28
|
+
set source(node: Node | null);
|
|
29
|
+
get source(): Node | null;
|
|
30
|
+
set target(node: Node | null);
|
|
31
|
+
get target(): Node | null;
|
|
32
|
+
value(): RelationshipMatchRecord | RelationshipMatchRecord[] | null;
|
|
33
|
+
get matches(): RelationshipMatchRecord[];
|
|
34
|
+
setData(data: RelationshipData | null): void;
|
|
35
|
+
getData(): RelationshipData | null;
|
|
36
|
+
setEndNode(node: Node): void;
|
|
37
|
+
find(left_id: string, hop?: number): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export default Relationship;
|
|
40
|
+
//# sourceMappingURL=relationship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../src/graph/relationship.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,gBAAwC,MAAM,qBAAqB,CAAC;AAC3E,OAAO,0BAA0B,EAAE,EAC/B,uBAAuB,EAC1B,MAAM,gCAAgC,CAAC;AAExC,cAAM,YAAa,SAAQ,OAAO;IAC9B,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5C,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IACtC,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAC3D,SAAS,CAAC,KAAK,EAAE,IAAI,CAAc;IAEnC,SAAS,CAAC,MAAM,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,GAAG,IAAI,CAAQ;IACpF,SAAS,CAAC,QAAQ,EAAE,0BAA0B,CAAoC;IAElF,SAAS,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,CAAQ;IACtC,SAAS,CAAC,OAAO,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEtC,OAAO,CAAC,KAAK,CAAiC;gBAElC,UAAU,GAAE,MAAM,GAAG,IAAW,EAAE,IAAI,GAAE,MAAM,GAAG,IAAW;IAKxE,IAAW,UAAU,CAAC,UAAU,EAAE,MAAM,EAEvC;IACD,IAAW,UAAU,IAAI,MAAM,GAAG,IAAI,CAErC;IACD,IAAW,IAAI,CAAC,IAAI,EAAE,MAAM,EAE3B;IACD,IAAW,IAAI,IAAI,MAAM,GAAG,IAAI,CAE/B;IACD,IAAW,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAE3C;IACM,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAGjD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAGlD,IAAW,IAAI,CAAC,IAAI,EAAE,IAAI,EAEzB;IACD,IAAW,IAAI,IAAI,IAAI,GAAG,IAAI,CAE7B;IACM,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAIjD,IAAW,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAElC;IACD,IAAW,MAAM,IAAI,IAAI,GAAG,IAAI,CAE/B;IACD,IAAW,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAElC;IACD,IAAW,MAAM,IAAI,IAAI,GAAG,IAAI,CAE/B;IACM,KAAK,IAAI,uBAAuB,GAAG,uBAAuB,EAAE,GAAG,IAAI;IAG1E,IAAW,OAAO,IAAI,uBAAuB,EAAE,CAE9C;IACM,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI;IAG5C,OAAO,IAAI,gBAAgB,GAAG,IAAI;IAGlC,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAGtB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BrE;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const ast_node_1 = __importDefault(require("../parsing/ast_node"));
|
|
16
|
+
const hops_1 = __importDefault(require("./hops"));
|
|
17
|
+
const relationship_match_collector_1 = __importDefault(require("./relationship_match_collector"));
|
|
18
|
+
class Relationship extends ast_node_1.default {
|
|
19
|
+
constructor(identifier = null, type = null) {
|
|
20
|
+
super();
|
|
21
|
+
this._identifier = null;
|
|
22
|
+
this._type = null;
|
|
23
|
+
this._properties = new Map();
|
|
24
|
+
this._hops = new hops_1.default();
|
|
25
|
+
this._value = null;
|
|
26
|
+
this._matches = new relationship_match_collector_1.default();
|
|
27
|
+
this._source = null;
|
|
28
|
+
this._target = null;
|
|
29
|
+
this._data = null;
|
|
30
|
+
this._identifier = identifier;
|
|
31
|
+
this._type = type;
|
|
32
|
+
}
|
|
33
|
+
set identifier(identifier) {
|
|
34
|
+
this._identifier = identifier;
|
|
35
|
+
}
|
|
36
|
+
get identifier() {
|
|
37
|
+
return this._identifier;
|
|
38
|
+
}
|
|
39
|
+
set type(type) {
|
|
40
|
+
this._type = type;
|
|
41
|
+
}
|
|
42
|
+
get type() {
|
|
43
|
+
return this._type;
|
|
44
|
+
}
|
|
45
|
+
get properties() {
|
|
46
|
+
var _a;
|
|
47
|
+
return ((_a = this._data) === null || _a === void 0 ? void 0 : _a.properties()) || {};
|
|
48
|
+
}
|
|
49
|
+
setProperty(key, value) {
|
|
50
|
+
this._properties.set(key, value);
|
|
51
|
+
}
|
|
52
|
+
getProperty(key) {
|
|
53
|
+
return this._properties.get(key) || null;
|
|
54
|
+
}
|
|
55
|
+
set hops(hops) {
|
|
56
|
+
this._hops = hops;
|
|
57
|
+
}
|
|
58
|
+
get hops() {
|
|
59
|
+
return this._hops;
|
|
60
|
+
}
|
|
61
|
+
setValue(relationship) {
|
|
62
|
+
const match = this._matches.push(relationship);
|
|
63
|
+
this._value = this._matches.value();
|
|
64
|
+
}
|
|
65
|
+
set source(node) {
|
|
66
|
+
this._source = node;
|
|
67
|
+
}
|
|
68
|
+
get source() {
|
|
69
|
+
return this._source;
|
|
70
|
+
}
|
|
71
|
+
set target(node) {
|
|
72
|
+
this._target = node;
|
|
73
|
+
}
|
|
74
|
+
get target() {
|
|
75
|
+
return this._target;
|
|
76
|
+
}
|
|
77
|
+
value() {
|
|
78
|
+
return this._value;
|
|
79
|
+
}
|
|
80
|
+
get matches() {
|
|
81
|
+
return this._matches.matches;
|
|
82
|
+
}
|
|
83
|
+
setData(data) {
|
|
84
|
+
this._data = data;
|
|
85
|
+
}
|
|
86
|
+
getData() {
|
|
87
|
+
return this._data;
|
|
88
|
+
}
|
|
89
|
+
setEndNode(node) {
|
|
90
|
+
this._matches.endNode = node;
|
|
91
|
+
}
|
|
92
|
+
find(left_id_1) {
|
|
93
|
+
return __awaiter(this, arguments, void 0, function* (left_id, hop = 0) {
|
|
94
|
+
var _a, _b, _c, _d;
|
|
95
|
+
// Save original source node
|
|
96
|
+
const original = this._source;
|
|
97
|
+
if (hop > 0) {
|
|
98
|
+
// For hops greater than 0, the source becomes the target of the previous hop
|
|
99
|
+
this._source = this._target;
|
|
100
|
+
}
|
|
101
|
+
if (hop === 0) {
|
|
102
|
+
(_a = this._data) === null || _a === void 0 ? void 0 : _a.reset();
|
|
103
|
+
}
|
|
104
|
+
while ((_b = this._data) === null || _b === void 0 ? void 0 : _b.find(left_id, hop)) {
|
|
105
|
+
const data = (_c = this._data) === null || _c === void 0 ? void 0 : _c.current(hop);
|
|
106
|
+
if (hop >= this.hops.min) {
|
|
107
|
+
this.setValue(this);
|
|
108
|
+
yield ((_d = this._target) === null || _d === void 0 ? void 0 : _d.find(data.right_id, hop));
|
|
109
|
+
if (this._matches.isCircular()) {
|
|
110
|
+
throw new Error("Circular relationship detected");
|
|
111
|
+
}
|
|
112
|
+
if (hop + 1 < this.hops.max) {
|
|
113
|
+
yield this.find(data.right_id, hop + 1);
|
|
114
|
+
}
|
|
115
|
+
this._matches.pop();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Restore original source node
|
|
119
|
+
this._source = original;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.default = Relationship;
|
|
124
|
+
//# sourceMappingURL=relationship.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship.js","sourceRoot":"","sources":["../../src/graph/relationship.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mEAA0C;AAE1C,kDAA0B;AAG1B,kGAEwC;AAExC,MAAM,YAAa,SAAQ,kBAAO;IAc9B,YAAY,aAA4B,IAAI,EAAE,OAAsB,IAAI;QACpE,KAAK,EAAE,CAAC;QAdF,gBAAW,GAAkB,IAAI,CAAC;QAClC,UAAK,GAAkB,IAAI,CAAC;QAC5B,gBAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;QACjD,UAAK,GAAS,IAAI,cAAI,EAAE,CAAC;QAEzB,WAAM,GAA+D,IAAI,CAAC;QAC1E,aAAQ,GAA+B,IAAI,sCAA0B,EAAE,CAAC;QAExE,YAAO,GAAgB,IAAI,CAAC;QAC5B,YAAO,GAAgB,IAAI,CAAC;QAE9B,UAAK,GAA4B,IAAI,CAAC;QAI1C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IACD,IAAW,UAAU,CAAC,UAAkB;QACpC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IACD,IAAW,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AG,IAAI,CAAC,IAAK,CAAC,GAAG,EAAE,CAAC;wBAC3B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;oBAC5C,CAAC;oBACD,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;gBACxB,CAAC;YACL,CAAC;YACD,+BAA+B;YAC/B,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QAC5B,CAAC;KAAA;CACJ;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Data from "./data";
|
|
2
|
+
export type RelationshipRecord = {
|
|
3
|
+
left_id: string;
|
|
4
|
+
right_id: string;
|
|
5
|
+
} & Record<string, any>;
|
|
6
|
+
declare class RelationshipData extends Data {
|
|
7
|
+
constructor(records?: RelationshipRecord[]);
|
|
8
|
+
find(left_id: string, hop?: number): boolean;
|
|
9
|
+
properties(): Record<string, any> | null;
|
|
10
|
+
}
|
|
11
|
+
export default RelationshipData;
|
|
12
|
+
//# sourceMappingURL=relationship_data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship_data.d.ts","sourceRoot":"","sources":["../../src/graph/relationship_data.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE7F,cAAM,gBAAiB,SAAQ,IAAI;gBACnB,OAAO,GAAE,kBAAkB,EAAO;IAIvC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU,GAAG,OAAO;IAO/C,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;CAQlD;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const data_1 = __importDefault(require("./data"));
|
|
18
|
+
class RelationshipData extends data_1.default {
|
|
19
|
+
constructor(records = []) {
|
|
20
|
+
super(records);
|
|
21
|
+
super._buildIndex("left_id");
|
|
22
|
+
}
|
|
23
|
+
find(left_id, hop = 0) {
|
|
24
|
+
return super._find(left_id, hop);
|
|
25
|
+
}
|
|
26
|
+
/*
|
|
27
|
+
** Get the properties of the current relationship record
|
|
28
|
+
'' excluding the left_id and right_id fields
|
|
29
|
+
*/
|
|
30
|
+
properties() {
|
|
31
|
+
const current = this.current();
|
|
32
|
+
if (current) {
|
|
33
|
+
const { left_id, right_id } = current, props = __rest(current, ["left_id", "right_id"]);
|
|
34
|
+
return props;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = RelationshipData;
|
|
40
|
+
//# sourceMappingURL=relationship_data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship_data.js","sourceRoot":"","sources":["../../src/graph/relationship_data.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA0B;AAI1B,MAAM,gBAAiB,SAAQ,cAAI;IAC/B,YAAY,UAAgC,EAAE;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IACM,IAAI,CAAC,OAAe,EAAE,MAAc,CAAC;QACxC,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;IACD;;;MAGE;IACK,UAAU;QACb,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,OAAO,EAAE,QAAQ,KAAe,OAAO,EAAjB,KAAK,UAAK,OAAO,EAAzC,uBAA+B,CAAU,CAAC;YAChD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,kBAAe,gBAAgB,CAAC"}
|