@lowgular/code-graph 0.0.1
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/apps/code-graph/src/main.js +50 -0
- package/libs/cli/code-graph/src/index.js +39 -0
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +72 -0
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +68 -0
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +147 -0
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +55 -0
- package/libs/cli/code-graph/src/lib/class-declarations/index.js +27 -0
- package/libs/cli/code-graph/src/lib/code.graph.factory.js +63 -0
- package/libs/cli/code-graph/src/lib/code.graph.js +62 -0
- package/libs/cli/code-graph/src/lib/core/core.js +58 -0
- package/libs/cli/code-graph/src/lib/core.js +85 -0
- package/libs/cli/code-graph/src/lib/decorators/index.js +36 -0
- package/libs/cli/code-graph/src/lib/docs/index.js +21 -0
- package/libs/cli/code-graph/src/lib/docs/specs.js +36 -0
- package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +28 -0
- package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +53 -0
- package/libs/cli/code-graph/src/lib/method-declarations/index.js +23 -0
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +106 -0
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +56 -0
- package/libs/cli/code-graph/src/lib/parameters/index.js +42 -0
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +139 -0
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +104 -0
- package/libs/cli/code-graph/src/lib/property-declarations/index.js +25 -0
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +74 -0
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +43 -0
- package/libs/cli/code-graph/src/lib/tools/index.js +34 -0
- package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +64 -0
- package/libs/cli/code-graph/src/lib/types/index.js +99 -0
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +345 -0
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +52 -0
- package/libs/cli/code-graph/src/lib/v2/extractors/index.js +23 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +76 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +21 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +48 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +79 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +45 -0
- package/libs/cli/code-graph/src/lib/v2/index.js +37 -0
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +220 -0
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +42 -0
- package/libs/cli/cypher/src/index.js +25 -0
- package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +277 -0
- package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +69 -0
- package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +105 -0
- package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +70 -0
- package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +99 -0
- package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +125 -0
- package/libs/cli/cypher/src/lib/docs/features/index.js +51 -0
- package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +50 -0
- package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +106 -0
- package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +105 -0
- package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +143 -0
- package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +152 -0
- package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +48 -0
- package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +65 -0
- package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +82 -0
- package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +136 -0
- package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +187 -0
- package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +302 -0
- package/libs/cli/cypher/src/lib/docs/prompts.js +36 -0
- package/libs/cli/cypher/src/lib/docs/specs.js +181 -0
- package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +158 -0
- package/libs/cli/cypher/src/lib/executor/executor.js +83 -0
- package/libs/cli/cypher/src/lib/executor/graph.js +15 -0
- package/libs/cli/cypher/src/lib/executor/match-engine.js +153 -0
- package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +109 -0
- package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +64 -0
- package/libs/cli/cypher/src/lib/executor/result-formatter.js +143 -0
- package/libs/cli/cypher/src/lib/executor/traverse-engine.js +164 -0
- package/libs/cli/cypher/src/lib/executor/utils.js +37 -0
- package/libs/cli/cypher/src/lib/graph.stub.js +63 -0
- package/libs/cli/cypher/src/lib/index.js +74 -0
- package/libs/cli/cypher/src/lib/lexer.js +398 -0
- package/libs/cli/cypher/src/lib/parser.js +602 -0
- package/libs/cli/cypher/src/lib/validator/query-validator.js +95 -0
- package/libs/cli/cypher/src/lib/validator/supported-features.config.js +111 -0
- package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +150 -0
- package/libs/cli/shared/src/index.js +53 -0
- package/libs/cli/shared/src/lib/admin-token.js +121 -0
- package/libs/cli/shared/src/lib/config.js +49 -0
- package/libs/cli/shared/src/lib/consts.js +57 -0
- package/libs/cli/shared/src/lib/core.js +46 -0
- package/libs/cli/shared/src/lib/infrastructure/cli.js +47 -0
- package/libs/cli/shared/src/lib/infrastructure/config.js +47 -0
- package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +51 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +96 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +41 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +64 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +120 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +15 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +72 -0
- package/libs/cli/shared/src/lib/infrastructure/git.js +147 -0
- package/libs/cli/shared/src/lib/infrastructure/http.js +257 -0
- package/libs/cli/shared/src/lib/infrastructure/markdown.js +95 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +88 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +25 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +154 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +210 -0
- package/libs/cli/shared/src/lib/infrastructure/workspace.js +297 -0
- package/libs/cli/shared/src/lib/infrastructure/yaml.js +237 -0
- package/libs/cli/shared/src/lib/lowgular.config.js +120 -0
- package/libs/cli/shared/src/lib/token.js +135 -0
- package/libs/cli/shared/src/lib/utils/solution.util.js +35 -0
- package/libs/cli/shared/src/lib/utils/utils.js +89 -0
- package/libs/cli/typescript/src/index.js +21 -0
- package/libs/cli/typescript/src/lib/base/index.js +23 -0
- package/libs/cli/typescript/src/lib/base/nameable.js +34 -0
- package/libs/cli/typescript/src/lib/base/nodeable.js +36 -0
- package/libs/cli/typescript/src/lib/class.implementation.js +52 -0
- package/libs/cli/typescript/src/lib/core/declaration.registry.js +107 -0
- package/libs/cli/typescript/src/lib/core/design-pattern.js +55 -0
- package/libs/cli/typescript/src/lib/core/index.js +35 -0
- package/libs/cli/typescript/src/lib/core/navigable-declaration.js +69 -0
- package/libs/cli/typescript/src/lib/core/program-context.js +71 -0
- package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +40 -0
- package/libs/cli/typescript/src/lib/core/type.js +374 -0
- package/libs/cli/typescript/src/lib/declaration.abstraction.js +90 -0
- package/libs/cli/typescript/src/lib/decorator.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/enum.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/function-declaration.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/index.js +57 -0
- package/libs/cli/typescript/src/lib/interface.implementation.js +51 -0
- package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +90 -0
- package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +44 -0
- package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +46 -0
- package/libs/cli/typescript/src/lib/members/method.util.js +32 -0
- package/libs/cli/typescript/src/lib/members/parameter.implementation.js +38 -0
- package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +64 -0
- package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +34 -0
- package/libs/cli/typescript/src/lib/members/property.util.js +61 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +42 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +114 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +188 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +51 -0
- package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +49 -0
- package/libs/cli/typescript/src/lib/members/statements/utils.js +51 -0
- package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +258 -0
- package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +15 -0
- package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +228 -0
- package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +126 -0
- package/libs/cli/typescript/src/lib/plugins/stubs.js +66 -0
- package/libs/cli/typescript/src/lib/type-alias.implementation.js +72 -0
- package/libs/cli/typescript/src/lib/utils.js +39 -0
- package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +35 -0
- package/libs/core/codegular/src/index.js +21 -0
- package/libs/core/codegular/src/lib/index.js +29 -0
- package/libs/core/codegular/src/lib/node.js +112 -0
- package/libs/core/codegular/src/lib/program.js +92 -0
- package/libs/core/codegular/src/lib/string.js +168 -0
- package/libs/core/codegular/src/lib/type-checker.js +170 -0
- package/libs/core/codegular/src/lib/utils.js +347 -0
- package/main.js +43 -0
- package/package.json +12 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var type_processor_exports = {};
|
|
19
|
+
__export(type_processor_exports, {
|
|
20
|
+
processType: () => processType
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(type_processor_exports);
|
|
23
|
+
var import_typescript = require("@cli/typescript");
|
|
24
|
+
var import_extractors = require("../extractors");
|
|
25
|
+
var import_relationship = require("./relationship.processor");
|
|
26
|
+
const ts = require("typescript");
|
|
27
|
+
const processType = (context, nodeExtractors, codeGraph) => {
|
|
28
|
+
const nodeId = context.args.typeChecker.typeToString(
|
|
29
|
+
context.args.current
|
|
30
|
+
);
|
|
31
|
+
const kindName = "Type";
|
|
32
|
+
const nodeConfig = nodeExtractors[kindName];
|
|
33
|
+
const graphNode = {
|
|
34
|
+
...nodeConfig && nodeConfig.properties ? (0, import_extractors.extractNodeProperties)(context, nodeConfig.properties) : {},
|
|
35
|
+
id: nodeId,
|
|
36
|
+
labels: [kindName]
|
|
37
|
+
};
|
|
38
|
+
(0, import_typescript.addNode)(codeGraph, graphNode);
|
|
39
|
+
(0, import_relationship.processRelationships)(nodeId, context, nodeConfig, codeGraph);
|
|
40
|
+
return graphNode;
|
|
41
|
+
};
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
processType
|
|
45
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var v2_exports = {};
|
|
20
|
+
__export(v2_exports, {
|
|
21
|
+
TOOLSV2: () => TOOLSV2
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(v2_exports);
|
|
24
|
+
var import_build_code_graph = require("./tools/build-code-graph.tool");
|
|
25
|
+
__reExport(v2_exports, require("./extractors"), module.exports);
|
|
26
|
+
__reExport(v2_exports, require("./graph-builder"), module.exports);
|
|
27
|
+
__reExport(v2_exports, require("./tools/build-code-graph.doc"), module.exports);
|
|
28
|
+
const TOOLSV2 = {
|
|
29
|
+
buildCodeGraph: import_build_code_graph.buildCodeGraphTool
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
TOOLSV2,
|
|
34
|
+
...require("./extractors"),
|
|
35
|
+
...require("./graph-builder"),
|
|
36
|
+
...require("./tools/build-code-graph.doc")
|
|
37
|
+
});
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var build_code_graph_doc_exports = {};
|
|
19
|
+
__export(build_code_graph_doc_exports, {
|
|
20
|
+
BUILD_CODE_GRAPH_DOC: () => BUILD_CODE_GRAPH_DOC
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(build_code_graph_doc_exports);
|
|
23
|
+
var import_cypher = require("@cli/cypher");
|
|
24
|
+
var import_core = require("../../core/core");
|
|
25
|
+
const BUILD_CODE_GRAPH_DOC = `# Build Code Graph
|
|
26
|
+
|
|
27
|
+
Tool for building a code graph from TypeScript source files using AST-based extraction and relationship configuration.
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
|
|
31
|
+
The \`build_code_graph\` tool allows you to:
|
|
32
|
+
- Extract nodes from TypeScript AST
|
|
33
|
+
- Extract properties from nodes using extractor functions code that you provide
|
|
34
|
+
- Create relationships between nodes using AST traversal functions code that you provide
|
|
35
|
+
- Build a graph structure that will be saved to a file
|
|
36
|
+
|
|
37
|
+
## Graph Structure
|
|
38
|
+
|
|
39
|
+
The tool creates a graph with:
|
|
40
|
+
|
|
41
|
+
### Nodes
|
|
42
|
+
- **id**: Unique identifier (filePath + range)
|
|
43
|
+
- **labels**: Array of SyntaxKind names
|
|
44
|
+
- **properties**: Custom properties defined in configuration
|
|
45
|
+
|
|
46
|
+
### Edges
|
|
47
|
+
- **source**: Source node ID
|
|
48
|
+
- **target**: Target node ID
|
|
49
|
+
- **type**: Relationship type name (from configuration)
|
|
50
|
+
|
|
51
|
+
### Graph File
|
|
52
|
+
- Saved to \`code-graph.json\` (or path specified in \`graphPath\`)
|
|
53
|
+
- Structure: \`{ nodesById, edgesBySource, edgesByTarget }\`
|
|
54
|
+
|
|
55
|
+
The extractor loops through the SourceFiles in the project (does not include node_modules) and extracts the nodes based on the nodeExtractors configuration.
|
|
56
|
+
|
|
57
|
+
## ExtractorGraphConfig
|
|
58
|
+
|
|
59
|
+
${(0, import_cypher.mb)(
|
|
60
|
+
`
|
|
61
|
+
export type ExtractorGraphConfig = {
|
|
62
|
+
nodeExtractors: NodeExtractors;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type NodeExtractors = Record<string, NodeExtractorConfig>;
|
|
66
|
+
|
|
67
|
+
export type NodeExtractorConfig = {
|
|
68
|
+
properties: Record<string, string>; // property name -> Extractor function code that you provide to extract the property
|
|
69
|
+
relationships?: Record<
|
|
70
|
+
string, // name of relationship: HAS_PARAMETER, HAS_CHILD, HAS_DESCENDANT, etc.
|
|
71
|
+
{
|
|
72
|
+
extractorCode: string; // Extractor function code that you provide to extract the relationship
|
|
73
|
+
nodeExtractors: NodeExtractors;
|
|
74
|
+
}
|
|
75
|
+
>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
`,
|
|
79
|
+
"typescript"
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
### Extracting Nodes
|
|
83
|
+
|
|
84
|
+
For each node, the extractor will execute the properties extractor code and create a node with the properties.
|
|
85
|
+
|
|
86
|
+
${(0, import_cypher.mb)(
|
|
87
|
+
`{
|
|
88
|
+
"ClassDeclaration": {
|
|
89
|
+
"properties": {
|
|
90
|
+
"name": "args.current.name.getText();", // this will map ClassDeclaration name text to property 'name'
|
|
91
|
+
"filePath": "args.sourceFile.fileName;" // this will map current SourceFile path to property 'filePath'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`,
|
|
96
|
+
"json"
|
|
97
|
+
)}
|
|
98
|
+
|
|
99
|
+
This will create ClassDeclaration nodes with \`name\` and \`filePath\` properties.
|
|
100
|
+
|
|
101
|
+
### Property Configuration
|
|
102
|
+
|
|
103
|
+
Properties are defined as a map where:
|
|
104
|
+
- **Key**: Property name (can be anything you want)
|
|
105
|
+
- **Value**: Extractor function name (must be a predefined function from the propertyExtractorContents map)
|
|
106
|
+
|
|
107
|
+
${(0, import_cypher.mb)(
|
|
108
|
+
`{
|
|
109
|
+
"properties": {
|
|
110
|
+
"name": "args.current.name?.getText();",
|
|
111
|
+
"filePath": "args.sourceFile.fileName;",
|
|
112
|
+
"hasDecorators": "args.ts.getDecorators(args.current)?.length > 0 || false;"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`,
|
|
116
|
+
"json"
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
**Return Types for Properties:**
|
|
120
|
+
- Primitive types: \`string\`, \`number\`, \`boolean\`
|
|
121
|
+
- Arrays of primitives: \`string[]\`, \`number[]\`, \`boolean[]\`
|
|
122
|
+
- \`null\` and \`undefined\` are allowed but will be ignored (property won't be set)
|
|
123
|
+
|
|
124
|
+
Related resource:
|
|
125
|
+
${(0, import_core.ml)({
|
|
126
|
+
name: "Extractors",
|
|
127
|
+
id: "build-code-graph-extractors"
|
|
128
|
+
})}
|
|
129
|
+
|
|
130
|
+
## Relationships
|
|
131
|
+
|
|
132
|
+
If the extractor config has relationships property, then you must strictly follow the following example:
|
|
133
|
+
|
|
134
|
+
${(0, import_cypher.mb)(
|
|
135
|
+
JSON.stringify(
|
|
136
|
+
{
|
|
137
|
+
ClassDeclaration: {
|
|
138
|
+
properties: {
|
|
139
|
+
name: "args.current.name?.getText();"
|
|
140
|
+
},
|
|
141
|
+
relationships: {
|
|
142
|
+
HAS_METHOD: {
|
|
143
|
+
extractorCode: "helpers.getDescendantsBy(args.current, (node) => node.kind === args.ts.SyntaxKind.MethodDeclaration);",
|
|
144
|
+
nodeExtractors: {
|
|
145
|
+
MethodDeclaration: {
|
|
146
|
+
properties: {
|
|
147
|
+
name: "args.current.name?.getText();"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
null,
|
|
156
|
+
2
|
|
157
|
+
),
|
|
158
|
+
"json"
|
|
159
|
+
)}
|
|
160
|
+
|
|
161
|
+
This example will create:
|
|
162
|
+
- **nodes**: ClassDeclaration and MethodDeclarations
|
|
163
|
+
- **edges**: HAS_METHOD relationship linking ClassDeclaration to MethodDeclaration
|
|
164
|
+
|
|
165
|
+
**Important Notes:**
|
|
166
|
+
- The relationship extractor code must return an array of nodes (\`ts.Node[]\` or \`ts.Type[]\`)
|
|
167
|
+
- Each returned node will be processed according to the nested \`nodeExtractors\` configuration
|
|
168
|
+
- Relationships can be nested to create multi-level graphs
|
|
169
|
+
|
|
170
|
+
### Nested Relationships
|
|
171
|
+
|
|
172
|
+
Relationships can be nested to create chains:
|
|
173
|
+
|
|
174
|
+
${(0, import_cypher.mb)(
|
|
175
|
+
JSON.stringify(
|
|
176
|
+
{
|
|
177
|
+
ClassDeclaration: {
|
|
178
|
+
relationships: {
|
|
179
|
+
HAS_METHOD: {
|
|
180
|
+
extractorCode: "helpers.getDescendantsBy(args.current, (node) => node.kind === args.ts.SyntaxKind.MethodDeclaration);",
|
|
181
|
+
nodeExtractors: {
|
|
182
|
+
MethodDeclaration: {
|
|
183
|
+
relationships: {
|
|
184
|
+
HAS_PARAMETER: {
|
|
185
|
+
extractorCode: "helpers.getDescendantsBy(args.current, (node) => node.kind === args.ts.SyntaxKind.Parameter);",
|
|
186
|
+
nodeExtractors: {
|
|
187
|
+
Parameter: {
|
|
188
|
+
properties: {
|
|
189
|
+
name: "args.current.name?.getText();"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
null,
|
|
202
|
+
2
|
|
203
|
+
),
|
|
204
|
+
"json"
|
|
205
|
+
)}
|
|
206
|
+
|
|
207
|
+
This creates:
|
|
208
|
+
- \`ClassDeclaration -[:HAS_METHOD]-> MethodDeclaration\`
|
|
209
|
+
- \`MethodDeclaration -[:HAS_PARAMETER]-> Parameter\`
|
|
210
|
+
|
|
211
|
+
Related resource:
|
|
212
|
+
${(0, import_core.ml)({
|
|
213
|
+
name: "Extractors",
|
|
214
|
+
id: "build-code-graph-extractors"
|
|
215
|
+
})}
|
|
216
|
+
`;
|
|
217
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
218
|
+
0 && (module.exports = {
|
|
219
|
+
BUILD_CODE_GRAPH_DOC
|
|
220
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var build_code_graph_tool_exports = {};
|
|
19
|
+
__export(build_code_graph_tool_exports, {
|
|
20
|
+
buildCodeGraphTool: () => buildCodeGraphTool
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(build_code_graph_tool_exports);
|
|
23
|
+
var import_codegular = require("@core/codegular");
|
|
24
|
+
var import_fs = require("fs");
|
|
25
|
+
var import_graph_builder = require("../graph-builder");
|
|
26
|
+
async function buildCodeGraphTool(tsConfigPath, config) {
|
|
27
|
+
const program = (0, import_codegular.createProgramFromTsConfig)(tsConfigPath);
|
|
28
|
+
const graph = (0, import_graph_builder.buildCodeGraph)(program, config);
|
|
29
|
+
const nodeCount = Object.keys(graph.nodesById).length;
|
|
30
|
+
const edgeCount = Object.values(graph.edgesBySource).flat().length;
|
|
31
|
+
const graphPath = tsConfigPath.replace("tsconfig.json", "code-graph.json");
|
|
32
|
+
(0, import_fs.writeFileSync)(graphPath, JSON.stringify(graph, null, 2));
|
|
33
|
+
return {
|
|
34
|
+
graphPath,
|
|
35
|
+
nodeCount,
|
|
36
|
+
edgeCount
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
buildCodeGraphTool
|
|
42
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./lib/docs/features"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./lib/docs/specs"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./lib/index"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./lib/docs/features"),
|
|
23
|
+
...require("./lib/docs/specs"),
|
|
24
|
+
...require("./lib/index")
|
|
25
|
+
});
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var advanced_optional_match_feature_exports = {};
|
|
19
|
+
__export(advanced_optional_match_feature_exports, {
|
|
20
|
+
ADVANCED_OPTIONAL_MATCH_FEATURES: () => ADVANCED_OPTIONAL_MATCH_FEATURES
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(advanced_optional_match_feature_exports);
|
|
23
|
+
var import_graph2 = require("../../graph.stub");
|
|
24
|
+
const ADVANCED_OPTIONAL_MATCH_FEATURES = [
|
|
25
|
+
{
|
|
26
|
+
name: "Filter optional matches with WHERE IS NOT NULL",
|
|
27
|
+
description: "Use WHERE IS NOT NULL to filter out results where optional matches failed, keeping only results with successful optional matches.",
|
|
28
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addNode((0, import_graph2.stubNode)("3", "A")).build(),
|
|
29
|
+
queries: [
|
|
30
|
+
[
|
|
31
|
+
"MATCH (a:A)",
|
|
32
|
+
"OPTIONAL MATCH (a)-[:R1]->(b:B)",
|
|
33
|
+
"WHERE b IS NOT NULL",
|
|
34
|
+
"RETURN a, b"
|
|
35
|
+
]
|
|
36
|
+
],
|
|
37
|
+
results: [
|
|
38
|
+
{
|
|
39
|
+
a: {
|
|
40
|
+
id: "1"
|
|
41
|
+
},
|
|
42
|
+
b: {
|
|
43
|
+
id: "2"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "Filter optional matches with WHERE IS NULL",
|
|
50
|
+
description: "Use WHERE IS NULL to find results where optional matches failed, filtering out successful optional matches.",
|
|
51
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addNode((0, import_graph2.stubNode)("3", "A")).build(),
|
|
52
|
+
queries: [
|
|
53
|
+
[
|
|
54
|
+
"MATCH (a:A)",
|
|
55
|
+
"OPTIONAL MATCH (a)-[:R1]->(b:B)",
|
|
56
|
+
"WHERE b IS NULL",
|
|
57
|
+
"RETURN a, b"
|
|
58
|
+
]
|
|
59
|
+
],
|
|
60
|
+
results: [
|
|
61
|
+
{
|
|
62
|
+
a: {
|
|
63
|
+
id: "3"
|
|
64
|
+
},
|
|
65
|
+
b: null
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Multiple optional matches sequentially",
|
|
71
|
+
description: "Multiple OPTIONAL MATCH statements can be chained sequentially, each building on previous results.",
|
|
72
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addNode((0, import_graph2.stubNode)("3", "C")).addEdge((0, import_graph2.stubEdge)("1", "3", "R2")).addNode((0, import_graph2.stubNode)("4", "A")).build(),
|
|
73
|
+
queries: [
|
|
74
|
+
[
|
|
75
|
+
"MATCH (a:A)",
|
|
76
|
+
"OPTIONAL MATCH (a)-[:R1]->(b:B)",
|
|
77
|
+
"OPTIONAL MATCH (a)-[:R2]->(c:C)",
|
|
78
|
+
"RETURN a, b, c"
|
|
79
|
+
]
|
|
80
|
+
],
|
|
81
|
+
results: [
|
|
82
|
+
{
|
|
83
|
+
a: {
|
|
84
|
+
id: "1"
|
|
85
|
+
},
|
|
86
|
+
b: {
|
|
87
|
+
id: "2"
|
|
88
|
+
},
|
|
89
|
+
c: {
|
|
90
|
+
id: "3"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
a: {
|
|
95
|
+
id: "4"
|
|
96
|
+
},
|
|
97
|
+
b: null,
|
|
98
|
+
c: null
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "Optional match with comma-separated patterns",
|
|
104
|
+
description: "OPTIONAL MATCH supports comma-separated patterns in a single statement, creating a Cartesian product of optional matches.",
|
|
105
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addNode((0, import_graph2.stubNode)("3", "C")).build(),
|
|
106
|
+
queries: [
|
|
107
|
+
[
|
|
108
|
+
"MATCH (a:A)",
|
|
109
|
+
"OPTIONAL MATCH (a)-[:R1]->(b:B), (c:C)",
|
|
110
|
+
"RETURN a, b, c"
|
|
111
|
+
]
|
|
112
|
+
],
|
|
113
|
+
results: [
|
|
114
|
+
{
|
|
115
|
+
a: {
|
|
116
|
+
id: "1"
|
|
117
|
+
},
|
|
118
|
+
b: {
|
|
119
|
+
id: "2"
|
|
120
|
+
},
|
|
121
|
+
c: {
|
|
122
|
+
id: "3"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "Bind optional relationship variable when match exists",
|
|
129
|
+
description: "When an optional relationship is bound to a variable and the match succeeds, the relationship object is included in results.",
|
|
130
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addNode((0, import_graph2.stubNode)("3", "A")).build(),
|
|
131
|
+
queries: [
|
|
132
|
+
["MATCH (a:A)", "OPTIONAL MATCH (a)-[rel:R1]->(b:B)", "RETURN a, rel, b"]
|
|
133
|
+
],
|
|
134
|
+
results: [
|
|
135
|
+
{
|
|
136
|
+
a: {
|
|
137
|
+
id: "1"
|
|
138
|
+
},
|
|
139
|
+
rel: {
|
|
140
|
+
source: "1",
|
|
141
|
+
target: "2",
|
|
142
|
+
type: "R1"
|
|
143
|
+
},
|
|
144
|
+
b: {
|
|
145
|
+
id: "2"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
a: {
|
|
150
|
+
id: "3"
|
|
151
|
+
},
|
|
152
|
+
rel: null,
|
|
153
|
+
b: null
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "Set optional relationship variable to null when no match",
|
|
159
|
+
description: "When an optional relationship variable is bound but no match exists, both the relationship and target node variables are set to null.",
|
|
160
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).build(),
|
|
161
|
+
queries: [
|
|
162
|
+
["MATCH (a:A)", "OPTIONAL MATCH (a)-[rel:R1]->(b:B)", "RETURN a, rel, b"]
|
|
163
|
+
],
|
|
164
|
+
results: [
|
|
165
|
+
{
|
|
166
|
+
a: {
|
|
167
|
+
id: "1"
|
|
168
|
+
},
|
|
169
|
+
rel: null,
|
|
170
|
+
b: null
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "Optional incoming relationship",
|
|
176
|
+
description: "OPTIONAL MATCH works with incoming relationships (reverse direction), matching relationships where the optional node is the source.",
|
|
177
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("2", "1", "R1")).addNode((0, import_graph2.stubNode)("3", "A")).build(),
|
|
178
|
+
queries: [
|
|
179
|
+
["MATCH (a:A)", "OPTIONAL MATCH (a)<-[:R1]-(b:B)", "RETURN a, b"]
|
|
180
|
+
],
|
|
181
|
+
results: [
|
|
182
|
+
{
|
|
183
|
+
a: {
|
|
184
|
+
id: "1"
|
|
185
|
+
},
|
|
186
|
+
b: {
|
|
187
|
+
id: "2"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
a: {
|
|
192
|
+
id: "3"
|
|
193
|
+
},
|
|
194
|
+
b: null
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "Optional undirected relationship",
|
|
200
|
+
description: "OPTIONAL MATCH works with undirected relationships, matching relationships in either direction.",
|
|
201
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B")).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addNode((0, import_graph2.stubNode)("3", "A")).build(),
|
|
202
|
+
queries: [["MATCH (a:A)", "OPTIONAL MATCH (a)-[:R1]-(b:B)", "RETURN a, b"]],
|
|
203
|
+
results: [
|
|
204
|
+
{
|
|
205
|
+
a: {
|
|
206
|
+
id: "1"
|
|
207
|
+
},
|
|
208
|
+
b: {
|
|
209
|
+
id: "2"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
a: {
|
|
214
|
+
id: "3"
|
|
215
|
+
},
|
|
216
|
+
b: null
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: "Optional match starting from empty graph",
|
|
222
|
+
description: "When OPTIONAL MATCH is used without a required MATCH and the graph is empty, it returns no results.",
|
|
223
|
+
graphFactory: () => new import_graph2.GraphBuilder().build(),
|
|
224
|
+
queries: [["OPTIONAL MATCH (a:A)", "RETURN a"]],
|
|
225
|
+
results: []
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "Optional match with nodes in graph",
|
|
229
|
+
description: "When OPTIONAL MATCH is used without a required MATCH and nodes exist, it matches all nodes like a regular MATCH.",
|
|
230
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "A")).build(),
|
|
231
|
+
queries: [["OPTIONAL MATCH (a:A)", "RETURN a"]],
|
|
232
|
+
results: [
|
|
233
|
+
{
|
|
234
|
+
a: {
|
|
235
|
+
id: "1"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
a: {
|
|
240
|
+
id: "2"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "Optional match with property filter on optional node",
|
|
247
|
+
description: "Property filters can be applied to optional nodes in the OPTIONAL MATCH pattern, filtering which optional matches succeed.",
|
|
248
|
+
graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A")).addNode((0, import_graph2.stubNode)("2", "B", { id: "2" })).addNode((0, import_graph2.stubNode)("3", "B", { id: "3" })).addEdge((0, import_graph2.stubEdge)("1", "2", "R1")).addEdge((0, import_graph2.stubEdge)("1", "3", "R1")).addNode((0, import_graph2.stubNode)("4", "A")).build(),
|
|
249
|
+
queries: [
|
|
250
|
+
[
|
|
251
|
+
"MATCH (a:A)",
|
|
252
|
+
'OPTIONAL MATCH (a)-[:R1]->(b:B {id: "2"})',
|
|
253
|
+
"RETURN a, b"
|
|
254
|
+
]
|
|
255
|
+
],
|
|
256
|
+
results: [
|
|
257
|
+
{
|
|
258
|
+
a: {
|
|
259
|
+
id: "1"
|
|
260
|
+
},
|
|
261
|
+
b: {
|
|
262
|
+
id: "2"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
a: {
|
|
267
|
+
id: "4"
|
|
268
|
+
},
|
|
269
|
+
b: null
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
];
|
|
274
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
275
|
+
0 && (module.exports = {
|
|
276
|
+
ADVANCED_OPTIONAL_MATCH_FEATURES
|
|
277
|
+
});
|