@lowgular/code-graph 0.0.1 → 0.1.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.
Files changed (179) hide show
  1. package/bin/cli.js +10 -0
  2. package/code-graph-v2/code.graph.js +37 -0
  3. package/code-graph-v2/config-from-query.js +131 -0
  4. package/code-graph-v2/extractors/extractor.js +27 -0
  5. package/code-graph-v2/extractors/index.js +1 -0
  6. package/code-graph-v2/graph-builder/code-graph.builder.js +49 -0
  7. package/code-graph-v2/graph-builder/index.js +1 -0
  8. package/code-graph-v2/graph-builder/node.processor.js +22 -0
  9. package/{libs/cli/code-graph/src/lib/v2 → code-graph-v2}/graph-builder/relationship.processor.js +11 -35
  10. package/code-graph-v2/graph-builder/type.processor.js +21 -0
  11. package/code-graph-v2/index.js +4 -0
  12. package/code-graph-v2/tools/build-code-graph.tool.js +19 -0
  13. package/code-graph-v2/utils.js +34 -0
  14. package/codegular/index.js +5 -0
  15. package/codegular/node.js +71 -0
  16. package/codegular/program.js +100 -0
  17. package/{libs/core/codegular/src/lib → codegular}/string.js +6 -53
  18. package/{libs/core/codegular/src/lib → codegular}/type-checker.js +3 -40
  19. package/codegular/type.js +356 -0
  20. package/{libs/core/codegular/src/lib → codegular}/utils.js +50 -62
  21. package/cypher/index.js +1 -0
  22. package/{libs/cli/cypher/src → cypher}/lib/executor/condition-evaluator.js +2 -25
  23. package/cypher/lib/executor/executor.js +60 -0
  24. package/cypher/lib/executor/graph.js +0 -0
  25. package/{libs/cli/cypher/src → cypher}/lib/executor/match-engine.js +4 -27
  26. package/{libs/cli/cypher/src → cypher}/lib/executor/pattern-matcher.js +2 -25
  27. package/{libs/cli/cypher/src → cypher}/lib/executor/relationship-navigator.js +2 -25
  28. package/{libs/cli/cypher/src → cypher}/lib/executor/result-formatter.js +37 -31
  29. package/{libs/cli/cypher/src → cypher}/lib/executor/traverse-engine.js +4 -27
  30. package/cypher/lib/executor/utils.js +14 -0
  31. package/cypher/lib/graph.stub.js +38 -0
  32. package/cypher/lib/index.js +32 -0
  33. package/{libs/cli/cypher/src → cypher}/lib/lexer.js +4 -26
  34. package/{libs/cli/cypher/src → cypher}/lib/parser.js +119 -135
  35. package/{libs/cli/cypher/src → cypher}/lib/validator/query-validator.js +12 -32
  36. package/{libs/cli/cypher/src → cypher}/lib/validator/supported-features.config.js +2 -30
  37. package/{libs/cli/cypher/src → cypher}/lib/validator/unsupported-features.config.js +8 -34
  38. package/cypher-cli.js +41 -0
  39. package/infra/code-graph.js +147 -0
  40. package/main.js +0 -43
  41. package/package.json +25 -7
  42. package/resources-cli.js +75 -0
  43. package/run-cli.js +43 -0
  44. package/apps/code-graph/src/main.js +0 -50
  45. package/libs/cli/code-graph/src/index.js +0 -39
  46. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
  47. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
  48. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
  49. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
  50. package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
  51. package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
  52. package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
  53. package/libs/cli/code-graph/src/lib/core/core.js +0 -58
  54. package/libs/cli/code-graph/src/lib/core.js +0 -85
  55. package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
  56. package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
  57. package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
  58. package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
  59. package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
  60. package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
  61. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
  62. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
  63. package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
  64. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
  65. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
  66. package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
  67. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
  68. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
  69. package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
  70. package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
  71. package/libs/cli/code-graph/src/lib/types/index.js +0 -99
  72. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
  73. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
  74. package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
  75. package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
  76. package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
  77. package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
  78. package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
  79. package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
  80. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
  81. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
  82. package/libs/cli/cypher/src/index.js +0 -25
  83. package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
  84. package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
  85. package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
  86. package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
  87. package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
  88. package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
  89. package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
  90. package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
  91. package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
  92. package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
  93. package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
  94. package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
  95. package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
  96. package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
  97. package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
  98. package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
  99. package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
  100. package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
  101. package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
  102. package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
  103. package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
  104. package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
  105. package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
  106. package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
  107. package/libs/cli/cypher/src/lib/index.js +0 -74
  108. package/libs/cli/shared/src/index.js +0 -53
  109. package/libs/cli/shared/src/lib/admin-token.js +0 -121
  110. package/libs/cli/shared/src/lib/config.js +0 -49
  111. package/libs/cli/shared/src/lib/consts.js +0 -57
  112. package/libs/cli/shared/src/lib/core.js +0 -46
  113. package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
  114. package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
  115. package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
  116. package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
  117. package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
  118. package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
  119. package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
  120. package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
  121. package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
  122. package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
  123. package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
  124. package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
  125. package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
  126. package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
  127. package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
  128. package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
  129. package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
  130. package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
  131. package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
  132. package/libs/cli/shared/src/lib/token.js +0 -135
  133. package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
  134. package/libs/cli/shared/src/lib/utils/utils.js +0 -89
  135. package/libs/cli/typescript/src/index.js +0 -21
  136. package/libs/cli/typescript/src/lib/base/index.js +0 -23
  137. package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
  138. package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
  139. package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
  140. package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
  141. package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
  142. package/libs/cli/typescript/src/lib/core/index.js +0 -35
  143. package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
  144. package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
  145. package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
  146. package/libs/cli/typescript/src/lib/core/type.js +0 -374
  147. package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
  148. package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
  149. package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
  150. package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
  151. package/libs/cli/typescript/src/lib/index.js +0 -57
  152. package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
  153. package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
  154. package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
  155. package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
  156. package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
  157. package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
  158. package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
  159. package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
  160. package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
  161. package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
  162. package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
  163. package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
  164. package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
  165. package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
  166. package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
  167. package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
  168. package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
  169. package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
  170. package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
  171. package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
  172. package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
  173. package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
  174. package/libs/cli/typescript/src/lib/utils.js +0 -39
  175. package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
  176. package/libs/core/codegular/src/index.js +0 -21
  177. package/libs/core/codegular/src/lib/index.js +0 -29
  178. package/libs/core/codegular/src/lib/node.js +0 -112
  179. package/libs/core/codegular/src/lib/program.js +0 -92
@@ -1,302 +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 where_operators_feature_exports = {};
19
- __export(where_operators_feature_exports, {
20
- WHERE_OPERATORS_FEATURES: () => WHERE_OPERATORS_FEATURES
21
- });
22
- module.exports = __toCommonJS(where_operators_feature_exports);
23
- var import_graph2 = require("../../graph.stub");
24
- const WHERE_OPERATORS_FEATURES = [
25
- {
26
- name: "Filter with != operator",
27
- description: "Use != operator to filter nodes where property is not equal to a value.",
28
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).build(),
29
- queries: [["MATCH (a:A)", "WHERE a.count != 5", "RETURN a"]],
30
- results: [
31
- {
32
- a: {
33
- id: "1"
34
- }
35
- },
36
- {
37
- a: {
38
- id: "3"
39
- }
40
- }
41
- ]
42
- },
43
- {
44
- name: "Filter with > operator",
45
- description: "Use > operator to filter nodes where property is greater than a value.",
46
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).addNode((0, import_graph2.stubNode)("4", "A", { count: 10 })).build(),
47
- queries: [["MATCH (a:A)", "WHERE a.count > 5", "RETURN a"]],
48
- results: [
49
- {
50
- a: {
51
- id: "3"
52
- }
53
- },
54
- {
55
- a: {
56
- id: "4"
57
- }
58
- }
59
- ]
60
- },
61
- {
62
- name: "Filter with < operator",
63
- description: "Use < operator to filter nodes where property is less than a value.",
64
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).build(),
65
- queries: [["MATCH (a:A)", "WHERE a.count < 5", "RETURN a"]],
66
- results: [
67
- {
68
- a: {
69
- id: "1"
70
- }
71
- }
72
- ]
73
- },
74
- {
75
- name: "Filter with >= operator",
76
- description: "Use >= operator to filter nodes where property is greater than or equal to a value.",
77
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).build(),
78
- queries: [["MATCH (a:A)", "WHERE a.count >= 5", "RETURN a"]],
79
- results: [
80
- {
81
- a: {
82
- id: "2"
83
- }
84
- },
85
- {
86
- a: {
87
- id: "3"
88
- }
89
- }
90
- ]
91
- },
92
- {
93
- name: "Filter with <= operator",
94
- description: "Use <= operator to filter nodes where property is less than or equal to a value.",
95
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).build(),
96
- queries: [["MATCH (a:A)", "WHERE a.count <= 5", "RETURN a"]],
97
- results: [
98
- {
99
- a: {
100
- id: "1"
101
- }
102
- },
103
- {
104
- a: {
105
- id: "2"
106
- }
107
- }
108
- ]
109
- },
110
- {
111
- name: "Filter with IN operator (strings)",
112
- description: "Use IN operator to filter nodes where property value is in a list of strings.",
113
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { type: "X" })).addNode((0, import_graph2.stubNode)("2", "A", { type: "Y" })).addNode((0, import_graph2.stubNode)("3", "A", { type: "Z" })).build(),
114
- queries: [["MATCH (a:A)", 'WHERE a.type IN ["X", "Y"]', "RETURN a"]],
115
- results: [
116
- {
117
- a: {
118
- id: "1"
119
- }
120
- },
121
- {
122
- a: {
123
- id: "2"
124
- }
125
- }
126
- ]
127
- },
128
- {
129
- name: "Filter with IN operator (numbers)",
130
- description: "Use IN operator to filter nodes where property value is in a list of numbers.",
131
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).addNode((0, import_graph2.stubNode)("4", "A", { count: 9 })).build(),
132
- queries: [["MATCH (a:A)", "WHERE a.count IN [5, 7, 10]", "RETURN a"]],
133
- results: [
134
- {
135
- a: {
136
- id: "2"
137
- }
138
- },
139
- {
140
- a: {
141
- id: "3"
142
- }
143
- }
144
- ]
145
- },
146
- {
147
- name: "Filter with NOT IN operator (strings)",
148
- description: "Use NOT IN operator to filter nodes where property value is not in a list of strings.",
149
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { type: "X" })).addNode((0, import_graph2.stubNode)("2", "A", { type: "Y" })).addNode((0, import_graph2.stubNode)("3", "A", { type: "Z" })).build(),
150
- queries: [["MATCH (a:A)", 'WHERE a.type NOT IN ["X", "Y"]', "RETURN a"]],
151
- results: [
152
- {
153
- a: {
154
- id: "3"
155
- }
156
- }
157
- ]
158
- },
159
- {
160
- name: "Filter with NOT IN operator (numbers)",
161
- description: "Use NOT IN operator to filter nodes where property value is not in a list of numbers.",
162
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { count: 3 })).addNode((0, import_graph2.stubNode)("2", "A", { count: 5 })).addNode((0, import_graph2.stubNode)("3", "A", { count: 7 })).addNode((0, import_graph2.stubNode)("4", "A", { count: 10 })).build(),
163
- queries: [["MATCH (a:A)", "WHERE a.count NOT IN [5, 7]", "RETURN a"]],
164
- results: [
165
- {
166
- a: {
167
- id: "1"
168
- }
169
- },
170
- {
171
- a: {
172
- id: "4"
173
- }
174
- }
175
- ]
176
- },
177
- {
178
- name: "Filter with IS NULL operator",
179
- description: "Use IS NULL to filter nodes where a property is null or does not exist.",
180
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { value: null })).addNode((0, import_graph2.stubNode)("2", "A", { value: "test" })).addNode((0, import_graph2.stubNode)("3", "A", {})).build(),
181
- queries: [["MATCH (a:A)", "WHERE a.value IS NULL", "RETURN a"]],
182
- results: [
183
- {
184
- a: {
185
- id: "1"
186
- }
187
- },
188
- {
189
- a: {
190
- id: "3"
191
- }
192
- }
193
- ]
194
- },
195
- {
196
- name: "Filter with IS NOT NULL operator",
197
- description: "Use IS NOT NULL to filter nodes where a property exists and is not null.",
198
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { value: null })).addNode((0, import_graph2.stubNode)("2", "A", { value: "test" })).addNode((0, import_graph2.stubNode)("3", "A", {})).build(),
199
- queries: [["MATCH (a:A)", "WHERE a.value IS NOT NULL", "RETURN a"]],
200
- results: [
201
- {
202
- a: {
203
- id: "2"
204
- }
205
- }
206
- ]
207
- },
208
- {
209
- name: "Filter with STARTS WITH operator",
210
- description: "Use STARTS WITH operator to filter nodes where a string property starts with a specific value.",
211
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { name: "apple" })).addNode((0, import_graph2.stubNode)("2", "A", { name: "application" })).addNode((0, import_graph2.stubNode)("3", "A", { name: "banana" })).addNode((0, import_graph2.stubNode)("4", "A", { name: "cherry" })).build(),
212
- queries: [["MATCH (a:A)", "WHERE a.name STARTS WITH 'app'", "RETURN a"]],
213
- results: [
214
- {
215
- a: {
216
- id: "1"
217
- }
218
- },
219
- {
220
- a: {
221
- id: "2"
222
- }
223
- }
224
- ]
225
- },
226
- {
227
- name: "Filter with ENDS WITH operator",
228
- description: "Use ENDS WITH operator to filter nodes where a string property ends with a specific value.",
229
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { name: "apple" })).addNode((0, import_graph2.stubNode)("2", "A", { name: "pineapple" })).addNode((0, import_graph2.stubNode)("3", "A", { name: "banana" })).addNode((0, import_graph2.stubNode)("4", "A", { name: "cherry" })).build(),
230
- queries: [["MATCH (a:A)", "WHERE a.name ENDS WITH 'le'", "RETURN a"]],
231
- results: [
232
- {
233
- a: {
234
- id: "1"
235
- }
236
- },
237
- {
238
- a: {
239
- id: "2"
240
- }
241
- }
242
- ]
243
- },
244
- {
245
- name: "Filter with CONTAINS operator",
246
- description: "Use CONTAINS operator to filter nodes where a string property contains a specific value.",
247
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { name: "apple" })).addNode((0, import_graph2.stubNode)("2", "A", { name: "pineapple" })).addNode((0, import_graph2.stubNode)("3", "A", { name: "banana" })).addNode((0, import_graph2.stubNode)("4", "A", { name: "cherry" })).build(),
248
- queries: [["MATCH (a:A)", "WHERE a.name CONTAINS 'pp'", "RETURN a"]],
249
- results: [
250
- {
251
- a: {
252
- id: "1"
253
- }
254
- },
255
- {
256
- a: {
257
- id: "2"
258
- }
259
- }
260
- ]
261
- },
262
- {
263
- name: "Filter with =~ regex operator (letters only)",
264
- description: "Use =~ operator to filter nodes where a string property matches a regex pattern. This example matches strings containing only lowercase letters.",
265
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { name: "apple" })).addNode((0, import_graph2.stubNode)("2", "A", { name: "application" })).addNode((0, import_graph2.stubNode)("3", "A", { name: "banana" })).addNode((0, import_graph2.stubNode)("4", "A", { name: "cherry123" })).build(),
266
- queries: [["MATCH (a:A)", "WHERE a.name =~ '^[a-z]+$'", "RETURN a"]],
267
- results: [
268
- {
269
- a: {
270
- id: "1"
271
- }
272
- },
273
- {
274
- a: {
275
- id: "2"
276
- }
277
- },
278
- {
279
- a: {
280
- id: "3"
281
- }
282
- }
283
- ]
284
- },
285
- {
286
- name: "Filter with =~ regex operator (ends with pattern)",
287
- description: 'Use =~ operator to filter nodes where a string property matches a regex pattern. This example matches strings ending with "123".',
288
- graphFactory: () => new import_graph2.GraphBuilder().addNode((0, import_graph2.stubNode)("1", "A", { name: "apple" })).addNode((0, import_graph2.stubNode)("2", "A", { name: "application" })).addNode((0, import_graph2.stubNode)("3", "A", { name: "banana" })).addNode((0, import_graph2.stubNode)("4", "A", { name: "cherry123" })).build(),
289
- queries: [["MATCH (a:A)", "WHERE a.name =~ '.*123$'", "RETURN a"]],
290
- results: [
291
- {
292
- a: {
293
- id: "4"
294
- }
295
- }
296
- ]
297
- }
298
- ];
299
- // Annotate the CommonJS export names for ESM import in node:
300
- 0 && (module.exports = {
301
- WHERE_OPERATORS_FEATURES
302
- });
@@ -1,36 +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 prompts_exports = {};
19
- __export(prompts_exports, {
20
- FUNCTIONALITY_RESEARCH: () => FUNCTIONALITY_RESEARCH
21
- });
22
- module.exports = __toCommonJS(prompts_exports);
23
- const FUNCTIONALITY_RESEARCH = `you are a cypher expert that needs to implement the cypher query language from neo4j.
24
-
25
- There is a project that has a lot of it already done and is located in libs/cli/cypher.
26
- Follow this step by step:
27
-
28
- - read the docs in libs/cli/cypher/src/lib/docs: that will explain you current supported and unsupported features as well as contrains and limitations
29
- - read the .spec.ts test files to understand how it works in real life
30
- - read the source files: index.ts, lexer.ts, parser.ts, validator.ts, executor.ts - this is the core of the project and you will need to understand how it works
31
-
32
- `;
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- FUNCTIONALITY_RESEARCH
36
- });
@@ -1,181 +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 specs_exports = {};
19
- __export(specs_exports, {
20
- CYPHER_CONSTRAINTS: () => CYPHER_CONSTRAINTS,
21
- CYPHER_FORBIDDEN_FEATURES: () => CYPHER_FORBIDDEN_FEATURES,
22
- MATCH_BASICS: () => MATCH_BASICS,
23
- RELATIONSHIP_ADVANCED: () => RELATIONSHIP_ADVANCED,
24
- RELATIONSHIP_BASICS: () => RELATIONSHIP_BASICS,
25
- WHERE_BASICS: () => WHERE_BASICS,
26
- mb: () => mb
27
- });
28
- module.exports = __toCommonJS(specs_exports);
29
- var import_supported_features = require("../validator/supported-features.config");
30
- var import_unsupported_features = require("../validator/unsupported-features.config");
31
- var import_features = require("./features");
32
- var import_basic_optional_match = require("./features/basic-optional-match.feature");
33
- var import_return_statement = require("./features/return-statement.feature");
34
- const mb = (content, type) => `\`\`\`${type}
35
- ${content}
36
- \`\`\``;
37
- function generateFeatureList(depth, features) {
38
- return features.map((feature) => {
39
- const lines = [];
40
- lines.push(`${mh(depth)} ${feature.name}`);
41
- lines.push(feature.description);
42
- if (feature.queries) {
43
- lines.push(`Allowed queries:`);
44
- feature.queries.forEach((query) => {
45
- lines.push(mb(query.join("\n"), "cypher"));
46
- });
47
- }
48
- return lines.join("\n\n");
49
- }).join("\n");
50
- }
51
- function generateConstraintList(constraints) {
52
- return constraints.map((constraint) => `- ${constraint.description}`).join("\n");
53
- }
54
- function generateForbiddenFeaturesList(data) {
55
- return data.map((feature) => {
56
- let line = `- **${feature.name}** - ${feature.errorMessage}`;
57
- if (feature.alternative) {
58
- line += ` ${feature.alternative}`;
59
- }
60
- return line;
61
- }).join("\n");
62
- }
63
- const mh = (depth) => `${"#".repeat(depth)}`;
64
- const MATCH_BASICS = (depth) => `
65
- ${mh(depth)} MATCH Nodes
66
-
67
- ${generateFeatureList(depth + 1, import_features.MATCH_NODES_FEATURES)}
68
-
69
- ${mh(depth)} MATCH Nodes by Properties
70
-
71
- ${generateFeatureList(depth + 1, import_features.PROPERTY_MATCHING_FEATURES)}
72
-
73
- ${mh(depth)} Optional Match
74
-
75
- ${generateFeatureList(depth + 1, import_basic_optional_match.BASIC_OPTIONAL_MATCH_FEATURES)}
76
-
77
- ${mh(depth)} Return Statement
78
-
79
- ${generateFeatureList(depth + 1, import_return_statement.RETURN_STATEMENT_FEATURES)}
80
-
81
- ${mh(depth)} LIMIT Clause
82
-
83
- ${generateFeatureList(depth + 1, import_features.LIMIT_FEATURES)}
84
-
85
- ${mh(depth)} ORDER BY Clause
86
-
87
- Without ORDER BY, results are returned in graph insertion order:
88
- - Files: Order from TypeScript's program.getSourceFiles() (typically alphabetical by file path based on tsconfig include patterns)
89
- - Within files: Top-to-bottom AST traversal order (position in SourceFile)
90
-
91
- ${generateFeatureList(depth + 1, import_features.ORDER_BY_FEATURES)}
92
- `;
93
- const WHERE_BASICS = (depth) => `
94
- ${mh(depth)} Filtering Nodes
95
-
96
- ${generateFeatureList(depth + 1, import_features.BASIC_FILTERING_FEATURES)}
97
-
98
- ${mh(depth)} WHERE Clause Operators
99
-
100
- ${generateFeatureList(depth + 1, import_features.WHERE_OPERATORS_FEATURES)}
101
-
102
- ${mh(depth)} WHERE Conditional Logic
103
-
104
- ${generateFeatureList(depth + 1, import_features.WHERE_CONDITIONAL_LOGIC_FEATURES)}
105
-
106
- ${mh(depth)} Advanced Optional Match
107
-
108
- ${generateFeatureList(depth + 1, import_features.ADVANCED_OPTIONAL_MATCH_FEATURES)}
109
- `;
110
- const RELATIONSHIP_BASICS = (depth) => `
111
- ${mh(depth)} Basic Relationships
112
-
113
- ${generateFeatureList(depth + 1, import_features.BASIC_RELATIONSHIP_FEATURES)}
114
-
115
- ${mh(depth)} Undirected Relationships
116
-
117
- ${generateFeatureList(depth + 1, import_features.UNDIRECTED_RELATIONSHIP_FEATURES)}
118
-
119
- ${mh(depth)} Multiple Relationship Types
120
-
121
- ${generateFeatureList(depth + 1, import_features.MULTIPLE_RELATIONSHIP_TYPES_FEATURES)}
122
-
123
- ${mh(depth)} Anonymous Relationships
124
-
125
- ${generateFeatureList(depth + 1, import_features.ANONYMOUS_RELATIONSHIP_FEATURES)}
126
-
127
- ${mh(depth)} Relationship Without Variable
128
-
129
- ${generateFeatureList(depth + 1, import_features.RELATIONSHIP_WITHOUT_VARIABLE_FEATURES)}
130
- `;
131
- const RELATIONSHIP_ADVANCED = (depth) => `
132
- ${mh(depth)} Variable-Length Paths
133
-
134
- ${generateFeatureList(depth + 1, import_features.VARIABLE_LENGTH_PATH_FEATURES)}
135
-
136
- ${mh(depth)} Anonymous Variable-Length Paths
137
-
138
- ${generateFeatureList(depth + 1, import_features.ANONYMOUS_VARIABLE_LENGTH_FEATURES)}
139
- `;
140
- const CYPHER_CONSTRAINTS = (depth) => `${mh(depth)} Node Constraints
141
-
142
- ${generateConstraintList(import_supported_features.NODE_CONSTRAINTS)}
143
-
144
- ${mh(depth)} Relationship Constraints
145
-
146
- ${generateConstraintList(import_supported_features.RELATIONSHIP_CONSTRAINTS)}
147
-
148
- ${mh(depth)} Query Constraints
149
-
150
- ${generateConstraintList(import_supported_features.QUERY_CONSTRAINTS)}
151
-
152
- ${mh(depth)} Pattern Constraints
153
-
154
- ${generateConstraintList(import_supported_features.PATTERN_CONSTRAINTS)}`;
155
- const CYPHER_FORBIDDEN_FEATURES = (depth) => `${mh(depth)} Forbidden Keywords
156
-
157
- ${generateForbiddenFeaturesList(import_unsupported_features.FORBIDDEN_KEYWORDS)}
158
-
159
- ${mh(depth)} Forbidden Aggregations
160
-
161
- ${generateForbiddenFeaturesList(import_unsupported_features.FORBIDDEN_AGGREGATIONS)}
162
-
163
- ${mh(depth)} Forbidden Modifiers
164
-
165
- ${generateForbiddenFeaturesList(import_unsupported_features.FORBIDDEN_MODIFIERS)}
166
-
167
- ${mh(depth)} Forbidden Patterns
168
-
169
- ${generateForbiddenFeaturesList(import_unsupported_features.FORBIDDEN_PATTERNS)}
170
-
171
- `;
172
- // Annotate the CommonJS export names for ESM import in node:
173
- 0 && (module.exports = {
174
- CYPHER_CONSTRAINTS,
175
- CYPHER_FORBIDDEN_FEATURES,
176
- MATCH_BASICS,
177
- RELATIONSHIP_ADVANCED,
178
- RELATIONSHIP_BASICS,
179
- WHERE_BASICS,
180
- mb
181
- });
@@ -1,83 +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 executor_exports = {};
19
- __export(executor_exports, {
20
- CypherExecutor: () => CypherExecutor
21
- });
22
- module.exports = __toCommonJS(executor_exports);
23
- var import_condition_evaluator = require("./condition-evaluator");
24
- var import_match_engine = require("./match-engine");
25
- var import_pattern_matcher = require("./pattern-matcher");
26
- var import_relationship_navigator = require("./relationship-navigator");
27
- var import_result_formatter = require("./result-formatter");
28
- var import_traverse_engine = require("./traverse-engine");
29
- class CypherExecutor {
30
- constructor(graph) {
31
- this.graph = graph;
32
- this.conditionEvaluator = new import_condition_evaluator.ConditionEvaluator();
33
- const patternMatcher = new import_pattern_matcher.PatternMatcher();
34
- const relationshipNavigator = new import_relationship_navigator.RelationshipNavigator(patternMatcher);
35
- const traverseEngine = new import_traverse_engine.TraverseEngine(
36
- patternMatcher,
37
- relationshipNavigator
38
- );
39
- this.matchEngine = new import_match_engine.MatchEngine(patternMatcher, traverseEngine);
40
- this.resultFormatter = new import_result_formatter.ResultFormatter();
41
- }
42
- /**
43
- * Execute a parsed Cypher query
44
- * @param extractData - If true (default), returns node.data. If false, returns full GraphNode objects.
45
- * For edges, always returns the full GraphEdge object (edges have no data property).
46
- * Returns results where keys are variable names and values are either node data or edge objects
47
- */
48
- execute(query) {
49
- if (query.statements.length === 0) {
50
- throw new Error("Query must have at least one statement");
51
- }
52
- if (query.statements[query.statements.length - 1].type !== "ReturnStatement") {
53
- throw new Error("MATCH Query must have a RETURN statement");
54
- }
55
- let results = [];
56
- for (const statement of query.statements) {
57
- if (statement.type === "MatchStatement") {
58
- results = this.matchEngine.processMatchStatement(
59
- this.graph,
60
- statement,
61
- results
62
- );
63
- } else if (statement.type === "WhereStatement") {
64
- results = this.conditionEvaluator.applyWhereClauseIfNeeded(
65
- results,
66
- statement
67
- );
68
- } else if (statement.type === "OrderByStatement") {
69
- results = this.resultFormatter.sortResults(results, statement);
70
- }
71
- }
72
- const returnStatement = query.statements[query.statements.length - 1];
73
- let formattedResults = this.resultFormatter.formatResults(
74
- results,
75
- returnStatement
76
- );
77
- return formattedResults;
78
- }
79
- }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- CypherExecutor
83
- });
@@ -1,15 +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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var graph_exports = {};
15
- module.exports = __toCommonJS(graph_exports);
@@ -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
- });