@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,64 +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 relationship_navigator_exports = {};
19
- __export(relationship_navigator_exports, {
20
- RelationshipNavigator: () => RelationshipNavigator
21
- });
22
- module.exports = __toCommonJS(relationship_navigator_exports);
23
- class RelationshipNavigator {
24
- constructor(patternMatcher) {
25
- this.patternMatcher = patternMatcher;
26
- }
27
- /**
28
- * Find nodes and edges connected via a relationship from the given node
29
- * Returns both the connected node and the edge that connects them
30
- */
31
- findConnectedNodesAndEdges(graph, node, relationship) {
32
- const connections = [];
33
- const seenNodeIds = /* @__PURE__ */ new Set();
34
- if (relationship.direction === "outgoing" || relationship.direction === "both") {
35
- const outgoingEdges = graph.edgesBySource[node.id] || [];
36
- for (const edge of outgoingEdges) {
37
- if (this.patternMatcher.matchesEdgeType(edge.type, relationship.edgeType)) {
38
- const targetNode = graph.nodesById[edge.target];
39
- if (targetNode && !seenNodeIds.has(targetNode.id)) {
40
- seenNodeIds.add(targetNode.id);
41
- connections.push({ node: targetNode, edge });
42
- }
43
- }
44
- }
45
- }
46
- if (relationship.direction === "incoming" || relationship.direction === "both") {
47
- const incomingEdges = graph.edgesByTarget[node.id] || [];
48
- for (const edge of incomingEdges) {
49
- if (this.patternMatcher.matchesEdgeType(edge.type, relationship.edgeType)) {
50
- const sourceNode = graph.nodesById[edge.source];
51
- if (sourceNode && !seenNodeIds.has(sourceNode.id)) {
52
- seenNodeIds.add(sourceNode.id);
53
- connections.push({ node: sourceNode, edge });
54
- }
55
- }
56
- }
57
- }
58
- return connections;
59
- }
60
- }
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- RelationshipNavigator
64
- });
@@ -1,143 +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 result_formatter_exports = {};
19
- __export(result_formatter_exports, {
20
- ResultFormatter: () => ResultFormatter,
21
- extractGraphNodesFromResult: () => extractGraphNodesFromResult
22
- });
23
- module.exports = __toCommonJS(result_formatter_exports);
24
- var import_utils = require("./utils");
25
- const extractGraphNodesFromResult = (results) => {
26
- return Object.values(results).filter(
27
- (value) => value !== null && typeof value === "object" && "id" in value && "labels" in value
28
- );
29
- };
30
- class ResultFormatter {
31
- constructor() {
32
- this.annonymizer = new import_utils.Annonymizer();
33
- }
34
- /**
35
- * Format a single match value (node or edge) based on extractData flag
36
- */
37
- formatValue(value) {
38
- if (value === null || value === void 0) {
39
- return null;
40
- }
41
- if ("id" in value && "labels" in value) {
42
- const node = value;
43
- return node;
44
- } else {
45
- const edge = value;
46
- return edge;
47
- }
48
- }
49
- /**
50
- * Sort results based on ORDER BY clause
51
- */
52
- sortResults(results, orderBy) {
53
- return [...results].sort((a, b) => {
54
- for (const item of orderBy.items) {
55
- const valA = this.getPropertyValue(a[item.variable], item.property);
56
- const valB = this.getPropertyValue(b[item.variable], item.property);
57
- const comparison = this.compareValues(valA, valB, item.direction);
58
- if (comparison !== 0)
59
- return comparison;
60
- }
61
- return 0;
62
- });
63
- }
64
- /**
65
- * Get property value from an object, handling nested property access
66
- */
67
- getPropertyValue(obj, property) {
68
- if (obj === null || obj === void 0)
69
- return null;
70
- return property ? obj[property] : obj;
71
- }
72
- /**
73
- * Compare two values with Neo4j-style NULL handling
74
- * ASC: NULLs first, then ascending values
75
- * DESC: Values descending, then NULLs last
76
- */
77
- compareValues(a, b, direction) {
78
- const aIsNull = a === null || a === void 0;
79
- const bIsNull = b === null || b === void 0;
80
- if (aIsNull && bIsNull)
81
- return 0;
82
- if (aIsNull)
83
- return direction === "ASC" ? -1 : 1;
84
- if (bIsNull)
85
- return direction === "ASC" ? 1 : -1;
86
- let result;
87
- if (typeof a === "string" && typeof b === "string") {
88
- result = a.localeCompare(b);
89
- } else {
90
- result = a < b ? -1 : a > b ? 1 : 0;
91
- }
92
- return direction === "DESC" ? -result : result;
93
- }
94
- /**
95
- * Format results with RETURN clause
96
- * Only includes variables specified in RETURN clause, with optional aliases
97
- * If returnAll is true (RETURN *), returns all variables
98
- */
99
- formatResults(results, returnClause) {
100
- const limitedResults = returnClause.limit ? results.slice(0, returnClause.limit) : results;
101
- if (returnClause.returnAll) {
102
- return this.formatDefault(limitedResults);
103
- }
104
- return limitedResults.map((match) => {
105
- const result = {};
106
- for (const item of returnClause.items) {
107
- const variable = item.expression;
108
- if (this.annonymizer.isAnonymous(variable)) {
109
- continue;
110
- }
111
- const alias = item.alias || variable;
112
- if (variable in match) {
113
- const value = match[variable];
114
- result[alias] = this.formatValue(value);
115
- } else {
116
- throw new Error(`Variable ${variable} not found in match results`);
117
- }
118
- }
119
- return result;
120
- });
121
- }
122
- /**
123
- * Format results without RETURN clause (default)
124
- * Returns all matched variables keyed by their variable names
125
- */
126
- formatDefault(matches) {
127
- return matches.map((match) => {
128
- const result = {};
129
- for (const [varName, value] of Object.entries(match)) {
130
- if (this.annonymizer.isAnonymous(varName)) {
131
- continue;
132
- }
133
- result[varName] = this.formatValue(value);
134
- }
135
- return result;
136
- });
137
- }
138
- }
139
- // Annotate the CommonJS export names for ESM import in node:
140
- 0 && (module.exports = {
141
- ResultFormatter,
142
- extractGraphNodesFromResult
143
- });
@@ -1,164 +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 traverse_engine_exports = {};
19
- __export(traverse_engine_exports, {
20
- TraverseEngine: () => TraverseEngine
21
- });
22
- module.exports = __toCommonJS(traverse_engine_exports);
23
- var import_utils = require("./utils");
24
- class TraverseEngine {
25
- constructor(patternMatcher, relationshipNavigator) {
26
- this.patternMatcher = patternMatcher;
27
- this.relationshipNavigator = relationshipNavigator;
28
- this.annonymizer = new import_utils.Annonymizer();
29
- }
30
- /**
31
- * Recursively traverse relationships to match subsequent patterns
32
- * Supports returning edges as variables when relationship variable is specified
33
- */
34
- traverseRelationships(graph, currentNode, currentVarName, remainingPatterns, relationships) {
35
- if (remainingPatterns.length === 0) {
36
- return [{ [currentVarName]: currentNode }];
37
- }
38
- const results = [];
39
- const nextPattern = remainingPatterns[0];
40
- const nextRelationship = relationships[0];
41
- const nextVarName = nextPattern.variable || this.annonymizer.generate(currentNode);
42
- const remainingPatterns_ = remainingPatterns.slice(1);
43
- const remainingRelationships = relationships.slice(1);
44
- if (nextRelationship.variableLength) {
45
- return this.traverseVariableLengthPath(
46
- graph,
47
- currentNode,
48
- currentVarName,
49
- nextRelationship,
50
- nextPattern,
51
- nextVarName,
52
- remainingPatterns_,
53
- remainingRelationships
54
- );
55
- }
56
- const connections = this.relationshipNavigator.findConnectedNodesAndEdges(
57
- graph,
58
- currentNode,
59
- nextRelationship
60
- );
61
- for (const { node: connectedNode, edge } of connections) {
62
- if (this.patternMatcher.doesNodeMatchPattern(connectedNode, nextPattern)) {
63
- const subMatches = this.traverseRelationships(
64
- graph,
65
- connectedNode,
66
- nextVarName,
67
- remainingPatterns_,
68
- remainingRelationships
69
- );
70
- for (const subMatch of subMatches) {
71
- const result = {
72
- [currentVarName]: currentNode,
73
- [nextVarName]: connectedNode,
74
- // Always include the connected node
75
- ...subMatch
76
- };
77
- if (nextRelationship.variable && edge) {
78
- result[nextRelationship.variable] = edge;
79
- }
80
- results.push(result);
81
- }
82
- }
83
- }
84
- return results;
85
- }
86
- /**
87
- * Traverse variable-length paths (zero or more edges)
88
- * Handles cycles by tracking visited nodes
89
- */
90
- traverseVariableLengthPath(graph, startNode, startVarName, relationship, targetPattern, targetVarName, remainingPatterns, remainingRelationships) {
91
- const results = [];
92
- const minLength = relationship.minLength ?? 0;
93
- const maxLength = relationship.maxLength ?? Infinity;
94
- const traverse = (currentNode, pathLength, visited, pathEdges) => {
95
- if (pathLength >= minLength && this.patternMatcher.doesNodeMatchPattern(currentNode, targetPattern)) {
96
- const subMatches = this.traverseRelationships(
97
- graph,
98
- currentNode,
99
- targetVarName,
100
- remainingPatterns,
101
- remainingRelationships
102
- );
103
- for (const subMatch of subMatches) {
104
- const result = {
105
- [startVarName]: startNode,
106
- [targetVarName]: currentNode,
107
- ...subMatch
108
- };
109
- if (relationship.variable && pathEdges.length > 0) {
110
- result[relationship.variable] = pathEdges[pathEdges.length - 1];
111
- }
112
- results.push(result);
113
- }
114
- }
115
- if (pathLength < maxLength) {
116
- const connections2 = this.relationshipNavigator.findConnectedNodesAndEdges(
117
- graph,
118
- currentNode,
119
- relationship
120
- );
121
- for (const { node: nextNode, edge } of connections2) {
122
- if (!visited.has(nextNode.id)) {
123
- const newVisited = new Set(visited);
124
- newVisited.add(nextNode.id);
125
- traverse(nextNode, pathLength + 1, newVisited, [
126
- ...pathEdges,
127
- edge
128
- ]);
129
- }
130
- }
131
- }
132
- };
133
- if (minLength === 0 && this.patternMatcher.doesNodeMatchPattern(startNode, targetPattern)) {
134
- const subMatches = this.traverseRelationships(
135
- graph,
136
- startNode,
137
- targetVarName,
138
- remainingPatterns,
139
- remainingRelationships
140
- );
141
- for (const subMatch of subMatches) {
142
- const result = {
143
- [startVarName]: startNode,
144
- [targetVarName]: startNode,
145
- ...subMatch
146
- };
147
- results.push(result);
148
- }
149
- }
150
- const connections = this.relationshipNavigator.findConnectedNodesAndEdges(
151
- graph,
152
- startNode,
153
- relationship
154
- );
155
- for (const { node: nextNode, edge } of connections) {
156
- traverse(nextNode, 1, /* @__PURE__ */ new Set([startNode.id, nextNode.id]), [edge]);
157
- }
158
- return results;
159
- }
160
- }
161
- // Annotate the CommonJS export names for ESM import in node:
162
- 0 && (module.exports = {
163
- TraverseEngine
164
- });
@@ -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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var utils_exports = {};
19
- __export(utils_exports, {
20
- Annonymizer: () => Annonymizer
21
- });
22
- module.exports = __toCommonJS(utils_exports);
23
- class Annonymizer {
24
- constructor() {
25
- this.anonymousVariablePrefix = "annonymous_";
26
- }
27
- generate(node) {
28
- return this.anonymousVariablePrefix + node.id;
29
- }
30
- isAnonymous(variable) {
31
- return variable.startsWith(this.anonymousVariablePrefix);
32
- }
33
- }
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- Annonymizer
37
- });
@@ -1,63 +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 graph_stub_exports = {};
19
- __export(graph_stub_exports, {
20
- GraphBuilder: () => GraphBuilder,
21
- stubEdge: () => stubEdge,
22
- stubNode: () => stubNode
23
- });
24
- module.exports = __toCommonJS(graph_stub_exports);
25
- class GraphBuilder {
26
- constructor() {
27
- this.graph = {
28
- nodesById: {},
29
- edgesBySource: {},
30
- edgesByTarget: {}
31
- };
32
- }
33
- addNode(node) {
34
- this.graph.nodesById[node.id] = node;
35
- return this;
36
- }
37
- addEdge(edge) {
38
- if (!this.graph.edgesBySource[edge.source]) {
39
- this.graph.edgesBySource[edge.source] = [];
40
- }
41
- if (!this.graph.edgesByTarget[edge.target]) {
42
- this.graph.edgesByTarget[edge.target] = [];
43
- }
44
- this.graph.edgesBySource[edge.source].push(edge);
45
- this.graph.edgesByTarget[edge.target].push(edge);
46
- return this;
47
- }
48
- build() {
49
- return this.graph;
50
- }
51
- }
52
- const stubNode = (id, label = "A", extras = {}) => ({ id, labels: Array.isArray(label) ? label : [label], ...extras });
53
- const stubEdge = (source, target, type = "A") => ({
54
- source,
55
- target,
56
- type
57
- });
58
- // Annotate the CommonJS export names for ESM import in node:
59
- 0 && (module.exports = {
60
- GraphBuilder,
61
- stubEdge,
62
- stubNode
63
- });
@@ -1,74 +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 lib_exports = {};
19
- __export(lib_exports, {
20
- FORBIDDEN_AGGREGATIONS: () => import_unsupported_features.FORBIDDEN_AGGREGATIONS,
21
- FORBIDDEN_KEYWORDS: () => import_unsupported_features.FORBIDDEN_KEYWORDS,
22
- FORBIDDEN_MODIFIERS: () => import_unsupported_features.FORBIDDEN_MODIFIERS,
23
- FORBIDDEN_PATTERNS: () => import_unsupported_features.FORBIDDEN_PATTERNS,
24
- ResultRecord: () => import_result_formatter2.ResultRecord,
25
- UnsupportedFeatureError: () => import_query_validator2.UnsupportedFeatureError,
26
- matchAll: () => matchAll,
27
- query: () => query,
28
- validateQuery: () => import_query_validator2.validateQuery,
29
- validateQuerySafe: () => import_query_validator2.validateQuerySafe
30
- });
31
- module.exports = __toCommonJS(lib_exports);
32
- var import_executor = require("./executor/executor");
33
- var import_lexer = require("./lexer");
34
- var import_parser = require("./parser");
35
- var import_query_validator = require("./validator/query-validator");
36
- var import_result_formatter2 = require("./executor/result-formatter");
37
- var import_query_validator2 = require("./validator/query-validator");
38
- var import_unsupported_features = require("./validator/unsupported-features.config");
39
- const buildQueryObject = (query2) => {
40
- const joinedQuery = Array.isArray(query2) ? query2.join(" ") : query2;
41
- (0, import_query_validator.validateQuery)(joinedQuery);
42
- const lexer = new import_lexer.Lexer(joinedQuery);
43
- const tokens = lexer.tokenize();
44
- const parser = new import_parser.Parser(tokens);
45
- return parser.parse();
46
- };
47
- const query = (queryStatements, graph) => {
48
- const queryObject = buildQueryObject(queryStatements);
49
- const executor = new import_executor.CypherExecutor(graph);
50
- return executor.execute(queryObject);
51
- };
52
- const matchAll = (query2, graph) => {
53
- const queryObject = buildQueryObject(query2);
54
- queryObject.statements.push({
55
- type: "ReturnStatement",
56
- returnAll: true,
57
- items: []
58
- });
59
- const executor = new import_executor.CypherExecutor(graph);
60
- return executor.execute(queryObject);
61
- };
62
- // Annotate the CommonJS export names for ESM import in node:
63
- 0 && (module.exports = {
64
- FORBIDDEN_AGGREGATIONS,
65
- FORBIDDEN_KEYWORDS,
66
- FORBIDDEN_MODIFIERS,
67
- FORBIDDEN_PATTERNS,
68
- ResultRecord,
69
- UnsupportedFeatureError,
70
- matchAll,
71
- query,
72
- validateQuery,
73
- validateQuerySafe
74
- });