@lowgular/code-graph 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/apps/code-graph/src/main.js +50 -0
  2. package/libs/cli/code-graph/src/index.js +39 -0
  3. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +72 -0
  4. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +68 -0
  5. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +147 -0
  6. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +55 -0
  7. package/libs/cli/code-graph/src/lib/class-declarations/index.js +27 -0
  8. package/libs/cli/code-graph/src/lib/code.graph.factory.js +63 -0
  9. package/libs/cli/code-graph/src/lib/code.graph.js +62 -0
  10. package/libs/cli/code-graph/src/lib/core/core.js +58 -0
  11. package/libs/cli/code-graph/src/lib/core.js +85 -0
  12. package/libs/cli/code-graph/src/lib/decorators/index.js +36 -0
  13. package/libs/cli/code-graph/src/lib/docs/index.js +21 -0
  14. package/libs/cli/code-graph/src/lib/docs/specs.js +36 -0
  15. package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +28 -0
  16. package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +53 -0
  17. package/libs/cli/code-graph/src/lib/method-declarations/index.js +23 -0
  18. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +106 -0
  19. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +56 -0
  20. package/libs/cli/code-graph/src/lib/parameters/index.js +42 -0
  21. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +139 -0
  22. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +104 -0
  23. package/libs/cli/code-graph/src/lib/property-declarations/index.js +25 -0
  24. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +74 -0
  25. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +43 -0
  26. package/libs/cli/code-graph/src/lib/tools/index.js +34 -0
  27. package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +64 -0
  28. package/libs/cli/code-graph/src/lib/types/index.js +99 -0
  29. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +345 -0
  30. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +52 -0
  31. package/libs/cli/code-graph/src/lib/v2/extractors/index.js +23 -0
  32. package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +76 -0
  33. package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +21 -0
  34. package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +48 -0
  35. package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +79 -0
  36. package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +45 -0
  37. package/libs/cli/code-graph/src/lib/v2/index.js +37 -0
  38. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +220 -0
  39. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +42 -0
  40. package/libs/cli/cypher/src/index.js +25 -0
  41. package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +277 -0
  42. package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +69 -0
  43. package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +105 -0
  44. package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +70 -0
  45. package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +99 -0
  46. package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +125 -0
  47. package/libs/cli/cypher/src/lib/docs/features/index.js +51 -0
  48. package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +50 -0
  49. package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +106 -0
  50. package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +105 -0
  51. package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +143 -0
  52. package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +152 -0
  53. package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +48 -0
  54. package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +65 -0
  55. package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +82 -0
  56. package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +136 -0
  57. package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +187 -0
  58. package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +302 -0
  59. package/libs/cli/cypher/src/lib/docs/prompts.js +36 -0
  60. package/libs/cli/cypher/src/lib/docs/specs.js +181 -0
  61. package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +158 -0
  62. package/libs/cli/cypher/src/lib/executor/executor.js +83 -0
  63. package/libs/cli/cypher/src/lib/executor/graph.js +15 -0
  64. package/libs/cli/cypher/src/lib/executor/match-engine.js +153 -0
  65. package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +109 -0
  66. package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +64 -0
  67. package/libs/cli/cypher/src/lib/executor/result-formatter.js +143 -0
  68. package/libs/cli/cypher/src/lib/executor/traverse-engine.js +164 -0
  69. package/libs/cli/cypher/src/lib/executor/utils.js +37 -0
  70. package/libs/cli/cypher/src/lib/graph.stub.js +63 -0
  71. package/libs/cli/cypher/src/lib/index.js +74 -0
  72. package/libs/cli/cypher/src/lib/lexer.js +398 -0
  73. package/libs/cli/cypher/src/lib/parser.js +602 -0
  74. package/libs/cli/cypher/src/lib/validator/query-validator.js +95 -0
  75. package/libs/cli/cypher/src/lib/validator/supported-features.config.js +111 -0
  76. package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +150 -0
  77. package/libs/cli/shared/src/index.js +53 -0
  78. package/libs/cli/shared/src/lib/admin-token.js +121 -0
  79. package/libs/cli/shared/src/lib/config.js +49 -0
  80. package/libs/cli/shared/src/lib/consts.js +57 -0
  81. package/libs/cli/shared/src/lib/core.js +46 -0
  82. package/libs/cli/shared/src/lib/infrastructure/cli.js +47 -0
  83. package/libs/cli/shared/src/lib/infrastructure/config.js +47 -0
  84. package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +51 -0
  85. package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +96 -0
  86. package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +41 -0
  87. package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +64 -0
  88. package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +120 -0
  89. package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +15 -0
  90. package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +72 -0
  91. package/libs/cli/shared/src/lib/infrastructure/git.js +147 -0
  92. package/libs/cli/shared/src/lib/infrastructure/http.js +257 -0
  93. package/libs/cli/shared/src/lib/infrastructure/markdown.js +95 -0
  94. package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +88 -0
  95. package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +25 -0
  96. package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +154 -0
  97. package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +210 -0
  98. package/libs/cli/shared/src/lib/infrastructure/workspace.js +297 -0
  99. package/libs/cli/shared/src/lib/infrastructure/yaml.js +237 -0
  100. package/libs/cli/shared/src/lib/lowgular.config.js +120 -0
  101. package/libs/cli/shared/src/lib/token.js +135 -0
  102. package/libs/cli/shared/src/lib/utils/solution.util.js +35 -0
  103. package/libs/cli/shared/src/lib/utils/utils.js +89 -0
  104. package/libs/cli/typescript/src/index.js +21 -0
  105. package/libs/cli/typescript/src/lib/base/index.js +23 -0
  106. package/libs/cli/typescript/src/lib/base/nameable.js +34 -0
  107. package/libs/cli/typescript/src/lib/base/nodeable.js +36 -0
  108. package/libs/cli/typescript/src/lib/class.implementation.js +52 -0
  109. package/libs/cli/typescript/src/lib/core/declaration.registry.js +107 -0
  110. package/libs/cli/typescript/src/lib/core/design-pattern.js +55 -0
  111. package/libs/cli/typescript/src/lib/core/index.js +35 -0
  112. package/libs/cli/typescript/src/lib/core/navigable-declaration.js +69 -0
  113. package/libs/cli/typescript/src/lib/core/program-context.js +71 -0
  114. package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +40 -0
  115. package/libs/cli/typescript/src/lib/core/type.js +374 -0
  116. package/libs/cli/typescript/src/lib/declaration.abstraction.js +90 -0
  117. package/libs/cli/typescript/src/lib/decorator.implementation.js +35 -0
  118. package/libs/cli/typescript/src/lib/enum.implementation.js +35 -0
  119. package/libs/cli/typescript/src/lib/function-declaration.implementation.js +35 -0
  120. package/libs/cli/typescript/src/lib/index.js +57 -0
  121. package/libs/cli/typescript/src/lib/interface.implementation.js +51 -0
  122. package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +90 -0
  123. package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +44 -0
  124. package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +46 -0
  125. package/libs/cli/typescript/src/lib/members/method.util.js +32 -0
  126. package/libs/cli/typescript/src/lib/members/parameter.implementation.js +38 -0
  127. package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +64 -0
  128. package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +34 -0
  129. package/libs/cli/typescript/src/lib/members/property.util.js +61 -0
  130. package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +42 -0
  131. package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +114 -0
  132. package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +188 -0
  133. package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +35 -0
  134. package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +51 -0
  135. package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +49 -0
  136. package/libs/cli/typescript/src/lib/members/statements/utils.js +51 -0
  137. package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +258 -0
  138. package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +15 -0
  139. package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +228 -0
  140. package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +126 -0
  141. package/libs/cli/typescript/src/lib/plugins/stubs.js +66 -0
  142. package/libs/cli/typescript/src/lib/type-alias.implementation.js +72 -0
  143. package/libs/cli/typescript/src/lib/utils.js +39 -0
  144. package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +35 -0
  145. package/libs/core/codegular/src/index.js +21 -0
  146. package/libs/core/codegular/src/lib/index.js +29 -0
  147. package/libs/core/codegular/src/lib/node.js +112 -0
  148. package/libs/core/codegular/src/lib/program.js +92 -0
  149. package/libs/core/codegular/src/lib/string.js +168 -0
  150. package/libs/core/codegular/src/lib/type-checker.js +170 -0
  151. package/libs/core/codegular/src/lib/utils.js +347 -0
  152. package/main.js +43 -0
  153. package/package.json +12 -0
@@ -0,0 +1,104 @@
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 reactive_state_exports = {};
19
+ __export(reactive_state_exports, {
20
+ PROPERTY_STUB: () => PROPERTY_STUB,
21
+ REACTIVE_STATE_PROPERTY_ABSTRACTION: () => REACTIVE_STATE_PROPERTY_ABSTRACTION,
22
+ REACTIVE_STATE_PROPERTY_EXAMPLES: () => REACTIVE_STATE_PROPERTY_EXAMPLES,
23
+ REACTIVE_STATE_PROPERTY_MATCH_QUERY: () => REACTIVE_STATE_PROPERTY_MATCH_QUERY
24
+ });
25
+ module.exports = __toCommonJS(reactive_state_exports);
26
+ const PROPERTY_STUB = `
27
+ import { Subject, BehaviorSubject, ReplaySubject, AsyncSubject } from 'rxjs';
28
+ import { signal, computed, writableSignal, toSignal } from '@angular/core';
29
+
30
+ export class RxJSClass {
31
+ private readonly subject = new Subject<number>();
32
+ private readonly behaviorSubject = new BehaviorSubject<number>(0);
33
+ private readonly replaySubject = new ReplaySubject<number>(10);
34
+ private readonly asyncSubject = new AsyncSubject<number>();
35
+ private readonly observable = new Observable<number>();
36
+ private readonly asObservable = this.subject.asObservable();
37
+ }
38
+
39
+ export class SignalClass {
40
+ private readonly signal = signal<number>(0);
41
+ private readonly computed = computed(() => this.counter.value * 2);
42
+ }
43
+ `;
44
+ const REACTIVE_STATE_PROPERTY_MATCH_QUERY = `(p:PropertyDeclaration)-[:HAS_TYPE]->(t:Type)
45
+ WHERE t.name STARTS WITH 'Subject'
46
+ OR t.name STARTS WITH 'BehaviorSubject'
47
+ OR t.name STARTS WITH 'ReplaySubject'
48
+ OR t.name STARTS WITH 'AsyncSubject'
49
+ OR t.name STARTS WITH 'WritableSignal'`;
50
+ const REACTIVE_STATE_PROPERTY_EXAMPLES = [
51
+ {
52
+ userPrompt: "Find all reactive properties",
53
+ given: PROPERTY_STUB,
54
+ when: `MATCH ${REACTIVE_STATE_PROPERTY_MATCH_QUERY}
55
+ RETURN p, t`,
56
+ then: [
57
+ [
58
+ {
59
+ labels: ["PropertyDeclaration"],
60
+ name: "subject"
61
+ }
62
+ ],
63
+ [
64
+ {
65
+ labels: ["PropertyDeclaration"],
66
+ name: "behaviorSubject"
67
+ }
68
+ ],
69
+ [
70
+ {
71
+ labels: ["PropertyDeclaration"],
72
+ name: "replaySubject"
73
+ }
74
+ ],
75
+ [
76
+ {
77
+ labels: ["PropertyDeclaration"],
78
+ name: "asyncSubject"
79
+ }
80
+ ],
81
+ [
82
+ {
83
+ labels: ["PropertyDeclaration"],
84
+ name: "signal"
85
+ }
86
+ ]
87
+ ]
88
+ }
89
+ ];
90
+ const REACTIVE_STATE_PROPERTY_ABSTRACTION = {
91
+ id: "reactive-state-property",
92
+ name: "Reactive State Property",
93
+ schema: {},
94
+ relationships: {},
95
+ description: "Abstraction on top of the TypeScript PropertyDeclaration that holds reactive state (primitives, data structures, or custom types). Instantiated and can be set/read reactively",
96
+ examples: REACTIVE_STATE_PROPERTY_EXAMPLES
97
+ };
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ PROPERTY_STUB,
101
+ REACTIVE_STATE_PROPERTY_ABSTRACTION,
102
+ REACTIVE_STATE_PROPERTY_EXAMPLES,
103
+ REACTIVE_STATE_PROPERTY_MATCH_QUERY
104
+ });
@@ -0,0 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var property_declarations_exports = {};
16
+ module.exports = __toCommonJS(property_declarations_exports);
17
+ __reExport(property_declarations_exports, require("./abstractions/reactive-state"), module.exports);
18
+ __reExport(property_declarations_exports, require("./property-declarations.doc"), module.exports);
19
+ __reExport(property_declarations_exports, require("./property-declarations.graph"), module.exports);
20
+ // Annotate the CommonJS export names for ESM import in node:
21
+ 0 && (module.exports = {
22
+ ...require("./abstractions/reactive-state"),
23
+ ...require("./property-declarations.doc"),
24
+ ...require("./property-declarations.graph")
25
+ });
@@ -0,0 +1,74 @@
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 property_declarations_doc_exports = {};
19
+ __export(property_declarations_doc_exports, {
20
+ PROPERTY_DECLARATION_DOC: () => PROPERTY_DECLARATION_DOC,
21
+ PROPERTY_EXAMPLES: () => PROPERTY_EXAMPLES
22
+ });
23
+ module.exports = __toCommonJS(property_declarations_doc_exports);
24
+ var import_core = require("../core/core");
25
+ const STUB = `class Test {
26
+ num = 1;
27
+ str = 'test';
28
+ bool = true;
29
+ }`;
30
+ const PROPERTY_EXAMPLES = [
31
+ {
32
+ userPrompt: "Find all property declarations",
33
+ given: STUB,
34
+ when: `MATCH (propDecl:PropertyDeclaration) RETURN propDecl`,
35
+ then: [
36
+ [
37
+ {
38
+ labels: ["PropertyDeclaration"],
39
+ name: "num"
40
+ }
41
+ ],
42
+ [
43
+ {
44
+ labels: ["PropertyDeclaration"],
45
+ name: "str"
46
+ }
47
+ ],
48
+ [
49
+ {
50
+ labels: ["PropertyDeclaration"],
51
+ name: "bool"
52
+ }
53
+ ]
54
+ ]
55
+ }
56
+ ];
57
+ const PROPERTY_DECLARATION_DOC = {
58
+ id: "property-declaration",
59
+ name: "PropertyDeclaration",
60
+ schema: {
61
+ ...import_core.NameableSchema,
62
+ modifiers: "string[]",
63
+ name: "string",
64
+ initializerText: "string"
65
+ },
66
+ relationships: {},
67
+ description: `The node represents TypeScript AST kind: PropertyDeclaration.`,
68
+ examples: PROPERTY_EXAMPLES
69
+ };
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ PROPERTY_DECLARATION_DOC,
73
+ PROPERTY_EXAMPLES
74
+ });
@@ -0,0 +1,43 @@
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 property_declarations_graph_exports = {};
19
+ __export(property_declarations_graph_exports, {
20
+ appendClassPropertiesGraph: () => appendClassPropertiesGraph
21
+ });
22
+ module.exports = __toCommonJS(property_declarations_graph_exports);
23
+ var import_class_declarations = require("../class-declarations/class-declarations.doc");
24
+ var import_code = require("../code.graph");
25
+ var import_core = require("../core/core");
26
+ const appendClassPropertiesGraph = (classCodeGraph, classId, classImplementation) => {
27
+ classImplementation.properties.forEach((p) => {
28
+ const propertyNode = (0, import_core.extendNameable)(p, {
29
+ modifiers: p.modifiers,
30
+ initializerText: p.initializerText
31
+ });
32
+ (0, import_code.addNode)(classCodeGraph, propertyNode);
33
+ (0, import_code.addEdge)(classCodeGraph, {
34
+ source: classId,
35
+ target: propertyNode.id,
36
+ type: import_class_declarations.CLASS_DECLARATION_EDGE_TYPES.HAS_PROPERTY
37
+ });
38
+ });
39
+ };
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ appendClassPropertiesGraph
43
+ });
@@ -0,0 +1,34 @@
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 tools_exports = {};
19
+ __export(tools_exports, {
20
+ TOOLS: () => TOOLS
21
+ });
22
+ module.exports = __toCommonJS(tools_exports);
23
+ var import_match_code_graph = require("./match-code-graph.tool");
24
+ const TOOLS = {
25
+ matchCodeGraph: import_match_code_graph.matchCodeGraphTool,
26
+ matchAll: import_match_code_graph.matchAllTool,
27
+ query: import_match_code_graph.queryTool,
28
+ queryFromProgram: import_match_code_graph.queryToolFromProgram,
29
+ queryFromGraph: import_match_code_graph.queryToolFromGraph
30
+ };
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ TOOLS
34
+ });
@@ -0,0 +1,64 @@
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 match_code_graph_tool_exports = {};
19
+ __export(match_code_graph_tool_exports, {
20
+ matchAllTool: () => matchAllTool,
21
+ matchCodeGraphTool: () => matchCodeGraphTool,
22
+ queryTool: () => queryTool,
23
+ queryToolFromGraph: () => queryToolFromGraph,
24
+ queryToolFromProgram: () => queryToolFromProgram
25
+ });
26
+ module.exports = __toCommonJS(match_code_graph_tool_exports);
27
+ var import_cypher = require("@cli/cypher");
28
+ var import_codegular = require("@core/codegular");
29
+ var import_fs = require("fs");
30
+ var import_code_graph = require("../code.graph.factory");
31
+ const matchCodeGraphTool = async (tsConfigPath, query2) => {
32
+ const program = (0, import_codegular.createProgramFromTsConfig)(tsConfigPath);
33
+ const codeGraph = (0, import_code_graph.makeCodeGraphFromSourceFiles)(program);
34
+ const result = (0, import_cypher.matchAll)(query2, codeGraph);
35
+ return result;
36
+ };
37
+ const queryTool = async (graphPath, queryStatements) => {
38
+ const codeGraph = JSON.parse((0, import_fs.readFileSync)(graphPath, "utf8"));
39
+ const result = (0, import_cypher.query)(queryStatements, codeGraph);
40
+ return result;
41
+ };
42
+ const queryToolFromGraph = async (queryStatements, graph) => {
43
+ const result = (0, import_cypher.query)(queryStatements, graph);
44
+ return result;
45
+ };
46
+ const queryToolFromProgram = async (program, queryStatements) => {
47
+ const codeGraph = (0, import_code_graph.makeCodeGraphFromSourceFiles)(program);
48
+ const result = (0, import_cypher.query)(queryStatements, codeGraph);
49
+ return result;
50
+ };
51
+ const matchAllTool = async (query2, tsConfigPath = "./tsconfig.json") => {
52
+ const program = (0, import_codegular.createProgramFromTsConfig)(tsConfigPath);
53
+ const codeGraph = (0, import_code_graph.makeCodeGraphFromSourceFiles)(program);
54
+ const result = (0, import_cypher.matchAll)(query2, codeGraph);
55
+ return result;
56
+ };
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ matchAllTool,
60
+ matchCodeGraphTool,
61
+ queryTool,
62
+ queryToolFromGraph,
63
+ queryToolFromProgram
64
+ });
@@ -0,0 +1,99 @@
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 types_exports = {};
19
+ __export(types_exports, {
20
+ TYPE_DOC: () => TYPE_DOC,
21
+ TYPE_INFO_EDGE_TYPES: () => TYPE_INFO_EDGE_TYPES,
22
+ appendTypeInfoGraph: () => appendTypeInfoGraph
23
+ });
24
+ module.exports = __toCommonJS(types_exports);
25
+ var import_typescript = require("@cli/typescript");
26
+ var import_core = require("../core/core");
27
+ var TYPE_INFO_EDGE_TYPES = /* @__PURE__ */ ((TYPE_INFO_EDGE_TYPES2) => {
28
+ TYPE_INFO_EDGE_TYPES2["HAS_TYPE"] = "HAS_TYPE";
29
+ TYPE_INFO_EDGE_TYPES2["HAS_BASE_TYPE"] = "HAS_BASE_TYPE";
30
+ TYPE_INFO_EDGE_TYPES2["HAS_DECLARATION"] = "HAS_DECLARATION";
31
+ TYPE_INFO_EDGE_TYPES2["HAS_TYPE_ARGUMENT"] = "HAS_TYPE_ARGUMENT";
32
+ return TYPE_INFO_EDGE_TYPES2;
33
+ })(TYPE_INFO_EDGE_TYPES || {});
34
+ const appendTypeInfoGraph = (classCodeGraph, sourceId, typeInfo) => {
35
+ if (typeInfo) {
36
+ const typeInfoId = typeInfo.name;
37
+ (0, import_typescript.addNode)(classCodeGraph, {
38
+ id: typeInfoId,
39
+ labels: [typeInfo.kind],
40
+ name: typeInfo.name
41
+ });
42
+ (0, import_typescript.addEdge)(classCodeGraph, {
43
+ source: sourceId,
44
+ target: typeInfoId,
45
+ type: "HAS_TYPE" /* HAS_TYPE */
46
+ });
47
+ if (typeInfo.baseTypes.length > 0) {
48
+ typeInfo.baseTypes.forEach((baseType) => {
49
+ appendTypeInfoGraph(classCodeGraph, typeInfoId, baseType);
50
+ });
51
+ }
52
+ if (typeInfo.declaration) {
53
+ const declarationNode = (0, import_core.extendNameable)(
54
+ typeInfo.declaration
55
+ );
56
+ (0, import_typescript.addNode)(classCodeGraph, declarationNode);
57
+ (0, import_typescript.addEdge)(classCodeGraph, {
58
+ source: typeInfoId,
59
+ target: declarationNode.id,
60
+ type: "HAS_DECLARATION" /* HAS_DECLARATION */
61
+ });
62
+ }
63
+ if (typeInfo.typeArguments) {
64
+ typeInfo.typeArguments.forEach((typeArgument) => {
65
+ appendTypeInfoGraph(classCodeGraph, typeInfoId, typeArgument);
66
+ });
67
+ }
68
+ }
69
+ };
70
+ const TYPE_DOC = {
71
+ id: "type",
72
+ name: "Type",
73
+ schema: {
74
+ name: "string"
75
+ },
76
+ description: `The node represents TypeScript AST kind: Type.`,
77
+ relationships: {
78
+ ["HAS_DECLARATION" /* HAS_DECLARATION */]: {
79
+ examples: [
80
+ `(t:Type)-[:${"HAS_DECLARATION" /* HAS_DECLARATION */}]->(c:ClassDeclaration)`
81
+ ]
82
+ },
83
+ ["HAS_TYPE_ARGUMENT" /* HAS_TYPE_ARGUMENT */]: {
84
+ examples: [
85
+ `(t:Type)-[:${"HAS_TYPE_ARGUMENT" /* HAS_TYPE_ARGUMENT */}]->(t:Type)`
86
+ ]
87
+ },
88
+ ["HAS_BASE_TYPE" /* HAS_BASE_TYPE */]: {
89
+ examples: [`(t:Type)-[:${"HAS_BASE_TYPE" /* HAS_BASE_TYPE */}]->(t:Type)`]
90
+ }
91
+ },
92
+ examples: []
93
+ };
94
+ // Annotate the CommonJS export names for ESM import in node:
95
+ 0 && (module.exports = {
96
+ TYPE_DOC,
97
+ TYPE_INFO_EDGE_TYPES,
98
+ appendTypeInfoGraph
99
+ });