@lowgular/code-graph 0.0.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/bin/cli.js +2463 -0
  2. package/lib.js +2430 -0
  3. package/package.json +26 -7
  4. package/apps/code-graph/src/main.js +0 -50
  5. package/libs/cli/code-graph/src/index.js +0 -39
  6. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
  7. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
  8. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
  9. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
  10. package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
  11. package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
  12. package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
  13. package/libs/cli/code-graph/src/lib/core/core.js +0 -58
  14. package/libs/cli/code-graph/src/lib/core.js +0 -85
  15. package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
  16. package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
  17. package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
  18. package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
  19. package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
  20. package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
  21. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
  22. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
  23. package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
  24. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
  25. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
  26. package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
  27. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
  28. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
  29. package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
  30. package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
  31. package/libs/cli/code-graph/src/lib/types/index.js +0 -99
  32. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
  33. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
  34. package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
  35. package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
  36. package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
  37. package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
  38. package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +0 -79
  39. package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
  40. package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
  41. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
  42. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
  43. package/libs/cli/cypher/src/index.js +0 -25
  44. package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
  45. package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
  46. package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
  47. package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
  48. package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
  49. package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
  50. package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
  51. package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
  52. package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
  53. package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
  54. package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
  55. package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
  56. package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
  57. package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
  58. package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
  59. package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
  60. package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
  61. package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
  62. package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
  63. package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
  64. package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +0 -158
  65. package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
  66. package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
  67. package/libs/cli/cypher/src/lib/executor/match-engine.js +0 -153
  68. package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +0 -109
  69. package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +0 -64
  70. package/libs/cli/cypher/src/lib/executor/result-formatter.js +0 -143
  71. package/libs/cli/cypher/src/lib/executor/traverse-engine.js +0 -164
  72. package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
  73. package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
  74. package/libs/cli/cypher/src/lib/index.js +0 -74
  75. package/libs/cli/cypher/src/lib/lexer.js +0 -398
  76. package/libs/cli/cypher/src/lib/parser.js +0 -602
  77. package/libs/cli/cypher/src/lib/validator/query-validator.js +0 -95
  78. package/libs/cli/cypher/src/lib/validator/supported-features.config.js +0 -111
  79. package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +0 -150
  80. package/libs/cli/shared/src/index.js +0 -53
  81. package/libs/cli/shared/src/lib/admin-token.js +0 -121
  82. package/libs/cli/shared/src/lib/config.js +0 -49
  83. package/libs/cli/shared/src/lib/consts.js +0 -57
  84. package/libs/cli/shared/src/lib/core.js +0 -46
  85. package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
  86. package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
  87. package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
  88. package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
  89. package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
  90. package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
  91. package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
  92. package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
  93. package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
  94. package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
  95. package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
  96. package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
  97. package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
  98. package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
  99. package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
  100. package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
  101. package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
  102. package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
  103. package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
  104. package/libs/cli/shared/src/lib/token.js +0 -135
  105. package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
  106. package/libs/cli/shared/src/lib/utils/utils.js +0 -89
  107. package/libs/cli/typescript/src/index.js +0 -21
  108. package/libs/cli/typescript/src/lib/base/index.js +0 -23
  109. package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
  110. package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
  111. package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
  112. package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
  113. package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
  114. package/libs/cli/typescript/src/lib/core/index.js +0 -35
  115. package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
  116. package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
  117. package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
  118. package/libs/cli/typescript/src/lib/core/type.js +0 -374
  119. package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
  120. package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
  121. package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
  122. package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
  123. package/libs/cli/typescript/src/lib/index.js +0 -57
  124. package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
  125. package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
  126. package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
  127. package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
  128. package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
  129. package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
  130. package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
  131. package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
  132. package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
  133. package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
  134. package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
  135. package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
  136. package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
  137. package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
  138. package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
  139. package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
  140. package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
  141. package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
  142. package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
  143. package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
  144. package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
  145. package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
  146. package/libs/cli/typescript/src/lib/utils.js +0 -39
  147. package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
  148. package/libs/core/codegular/src/index.js +0 -21
  149. package/libs/core/codegular/src/lib/index.js +0 -29
  150. package/libs/core/codegular/src/lib/node.js +0 -112
  151. package/libs/core/codegular/src/lib/program.js +0 -92
  152. package/libs/core/codegular/src/lib/string.js +0 -168
  153. package/libs/core/codegular/src/lib/type-checker.js +0 -170
  154. package/libs/core/codegular/src/lib/utils.js +0 -347
  155. package/main.js +0 -43
@@ -1,45 +0,0 @@
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
- });
@@ -1,37 +0,0 @@
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
- });
@@ -1,220 +0,0 @@
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
- });
@@ -1,42 +0,0 @@
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
- });
@@ -1,25 +0,0 @@
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
- });
@@ -1,277 +0,0 @@
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
- });