@lowgular/code-graph 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/code-graph/src/main.js +50 -0
- package/libs/cli/code-graph/src/index.js +39 -0
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +72 -0
- package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +68 -0
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +147 -0
- package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +55 -0
- package/libs/cli/code-graph/src/lib/class-declarations/index.js +27 -0
- package/libs/cli/code-graph/src/lib/code.graph.factory.js +63 -0
- package/libs/cli/code-graph/src/lib/code.graph.js +62 -0
- package/libs/cli/code-graph/src/lib/core/core.js +58 -0
- package/libs/cli/code-graph/src/lib/core.js +85 -0
- package/libs/cli/code-graph/src/lib/decorators/index.js +36 -0
- package/libs/cli/code-graph/src/lib/docs/index.js +21 -0
- package/libs/cli/code-graph/src/lib/docs/specs.js +36 -0
- package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +28 -0
- package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +53 -0
- package/libs/cli/code-graph/src/lib/method-declarations/index.js +23 -0
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +106 -0
- package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +56 -0
- package/libs/cli/code-graph/src/lib/parameters/index.js +42 -0
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +139 -0
- package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +104 -0
- package/libs/cli/code-graph/src/lib/property-declarations/index.js +25 -0
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +74 -0
- package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +43 -0
- package/libs/cli/code-graph/src/lib/tools/index.js +34 -0
- package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +64 -0
- package/libs/cli/code-graph/src/lib/types/index.js +99 -0
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +345 -0
- package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +52 -0
- package/libs/cli/code-graph/src/lib/v2/extractors/index.js +23 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +76 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +21 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +48 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +79 -0
- package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +45 -0
- package/libs/cli/code-graph/src/lib/v2/index.js +37 -0
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +220 -0
- package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +42 -0
- package/libs/cli/cypher/src/index.js +25 -0
- package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +277 -0
- package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +69 -0
- package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +105 -0
- package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +70 -0
- package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +99 -0
- package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +125 -0
- package/libs/cli/cypher/src/lib/docs/features/index.js +51 -0
- package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +50 -0
- package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +106 -0
- package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +105 -0
- package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +143 -0
- package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +152 -0
- package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +48 -0
- package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +65 -0
- package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +82 -0
- package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +136 -0
- package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +187 -0
- package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +302 -0
- package/libs/cli/cypher/src/lib/docs/prompts.js +36 -0
- package/libs/cli/cypher/src/lib/docs/specs.js +181 -0
- package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +158 -0
- package/libs/cli/cypher/src/lib/executor/executor.js +83 -0
- package/libs/cli/cypher/src/lib/executor/graph.js +15 -0
- package/libs/cli/cypher/src/lib/executor/match-engine.js +153 -0
- package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +109 -0
- package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +64 -0
- package/libs/cli/cypher/src/lib/executor/result-formatter.js +143 -0
- package/libs/cli/cypher/src/lib/executor/traverse-engine.js +164 -0
- package/libs/cli/cypher/src/lib/executor/utils.js +37 -0
- package/libs/cli/cypher/src/lib/graph.stub.js +63 -0
- package/libs/cli/cypher/src/lib/index.js +74 -0
- package/libs/cli/cypher/src/lib/lexer.js +398 -0
- package/libs/cli/cypher/src/lib/parser.js +602 -0
- package/libs/cli/cypher/src/lib/validator/query-validator.js +95 -0
- package/libs/cli/cypher/src/lib/validator/supported-features.config.js +111 -0
- package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +150 -0
- package/libs/cli/shared/src/index.js +53 -0
- package/libs/cli/shared/src/lib/admin-token.js +121 -0
- package/libs/cli/shared/src/lib/config.js +49 -0
- package/libs/cli/shared/src/lib/consts.js +57 -0
- package/libs/cli/shared/src/lib/core.js +46 -0
- package/libs/cli/shared/src/lib/infrastructure/cli.js +47 -0
- package/libs/cli/shared/src/lib/infrastructure/config.js +47 -0
- package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +51 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +96 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +41 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +64 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +120 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +15 -0
- package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +72 -0
- package/libs/cli/shared/src/lib/infrastructure/git.js +147 -0
- package/libs/cli/shared/src/lib/infrastructure/http.js +257 -0
- package/libs/cli/shared/src/lib/infrastructure/markdown.js +95 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +88 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +25 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +154 -0
- package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +210 -0
- package/libs/cli/shared/src/lib/infrastructure/workspace.js +297 -0
- package/libs/cli/shared/src/lib/infrastructure/yaml.js +237 -0
- package/libs/cli/shared/src/lib/lowgular.config.js +120 -0
- package/libs/cli/shared/src/lib/token.js +135 -0
- package/libs/cli/shared/src/lib/utils/solution.util.js +35 -0
- package/libs/cli/shared/src/lib/utils/utils.js +89 -0
- package/libs/cli/typescript/src/index.js +21 -0
- package/libs/cli/typescript/src/lib/base/index.js +23 -0
- package/libs/cli/typescript/src/lib/base/nameable.js +34 -0
- package/libs/cli/typescript/src/lib/base/nodeable.js +36 -0
- package/libs/cli/typescript/src/lib/class.implementation.js +52 -0
- package/libs/cli/typescript/src/lib/core/declaration.registry.js +107 -0
- package/libs/cli/typescript/src/lib/core/design-pattern.js +55 -0
- package/libs/cli/typescript/src/lib/core/index.js +35 -0
- package/libs/cli/typescript/src/lib/core/navigable-declaration.js +69 -0
- package/libs/cli/typescript/src/lib/core/program-context.js +71 -0
- package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +40 -0
- package/libs/cli/typescript/src/lib/core/type.js +374 -0
- package/libs/cli/typescript/src/lib/declaration.abstraction.js +90 -0
- package/libs/cli/typescript/src/lib/decorator.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/enum.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/function-declaration.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/index.js +57 -0
- package/libs/cli/typescript/src/lib/interface.implementation.js +51 -0
- package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +90 -0
- package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +44 -0
- package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +46 -0
- package/libs/cli/typescript/src/lib/members/method.util.js +32 -0
- package/libs/cli/typescript/src/lib/members/parameter.implementation.js +38 -0
- package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +64 -0
- package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +34 -0
- package/libs/cli/typescript/src/lib/members/property.util.js +61 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +42 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +114 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +188 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +35 -0
- package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +51 -0
- package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +49 -0
- package/libs/cli/typescript/src/lib/members/statements/utils.js +51 -0
- package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +258 -0
- package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +15 -0
- package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +228 -0
- package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +126 -0
- package/libs/cli/typescript/src/lib/plugins/stubs.js +66 -0
- package/libs/cli/typescript/src/lib/type-alias.implementation.js +72 -0
- package/libs/cli/typescript/src/lib/utils.js +39 -0
- package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +35 -0
- package/libs/core/codegular/src/index.js +21 -0
- package/libs/core/codegular/src/lib/index.js +29 -0
- package/libs/core/codegular/src/lib/node.js +112 -0
- package/libs/core/codegular/src/lib/program.js +92 -0
- package/libs/core/codegular/src/lib/string.js +168 -0
- package/libs/core/codegular/src/lib/type-checker.js +170 -0
- package/libs/core/codegular/src/lib/utils.js +347 -0
- package/main.js +43 -0
- package/package.json +12 -0
|
@@ -0,0 +1,50 @@
|
|
|
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 main_exports = {};
|
|
19
|
+
__export(main_exports, {
|
|
20
|
+
NODE_PRESETS: () => NODE_PRESETS,
|
|
21
|
+
matchFromFileSystem: () => matchFromFileSystem,
|
|
22
|
+
matchFromTsConfig: () => matchFromTsConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(main_exports);
|
|
25
|
+
var import_code_graph = require("@cli/code-graph");
|
|
26
|
+
var import_codegular = require("@core/codegular");
|
|
27
|
+
const matchFromTsConfig = async (cypherQuery, tsConfigPath = "./tsconfig.json") => {
|
|
28
|
+
const program = (0, import_codegular.createProgramFromTsConfig)(tsConfigPath);
|
|
29
|
+
return [];
|
|
30
|
+
};
|
|
31
|
+
const matchFromFileSystem = async (cypherQuery, config, fileSystem) => {
|
|
32
|
+
const program = (0, import_codegular.createProgramFromFileSystem)(fileSystem);
|
|
33
|
+
const codeGraph = (0, import_code_graph.buildCodeGraph)(program, config);
|
|
34
|
+
const results = await import_code_graph.TOOLS.queryFromGraph(cypherQuery, codeGraph);
|
|
35
|
+
return results;
|
|
36
|
+
};
|
|
37
|
+
const NODE_PRESETS = {
|
|
38
|
+
NAMEABLE: {
|
|
39
|
+
properties: {
|
|
40
|
+
name: `helpers.getDescendantsBy(args.current, (node) => node.kind === args.ts.SyntaxKind.Identifier)[0]?.getText();`,
|
|
41
|
+
filePath: "args.sourceFile.fileName;"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
NODE_PRESETS,
|
|
48
|
+
matchFromFileSystem,
|
|
49
|
+
matchFromTsConfig
|
|
50
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./lib/class-declarations"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./lib/code.graph.factory"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./lib/core/core"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./lib/decorators"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./lib/docs"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./lib/method-declarations"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./lib/parameters"), module.exports);
|
|
24
|
+
__reExport(src_exports, require("./lib/property-declarations"), module.exports);
|
|
25
|
+
__reExport(src_exports, require("./lib/tools"), module.exports);
|
|
26
|
+
__reExport(src_exports, require("./lib/v2"), module.exports);
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
...require("./lib/class-declarations"),
|
|
30
|
+
...require("./lib/code.graph.factory"),
|
|
31
|
+
...require("./lib/core/core"),
|
|
32
|
+
...require("./lib/decorators"),
|
|
33
|
+
...require("./lib/docs"),
|
|
34
|
+
...require("./lib/method-declarations"),
|
|
35
|
+
...require("./lib/parameters"),
|
|
36
|
+
...require("./lib/property-declarations"),
|
|
37
|
+
...require("./lib/tools"),
|
|
38
|
+
...require("./lib/v2")
|
|
39
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
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 service_exports = {};
|
|
19
|
+
__export(service_exports, {
|
|
20
|
+
SERVICE_CLASS_ABSTRACTION: () => SERVICE_CLASS_ABSTRACTION,
|
|
21
|
+
SERVICE_CLASS_EXAMPLES: () => SERVICE_CLASS_EXAMPLES,
|
|
22
|
+
SERVICE_CLASS_MATCH_QUERY: () => SERVICE_CLASS_MATCH_QUERY,
|
|
23
|
+
SERVICE_STUB: () => SERVICE_STUB
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(service_exports);
|
|
26
|
+
const SERVICE_STUB = `
|
|
27
|
+
export class DecoratorlessService { }
|
|
28
|
+
|
|
29
|
+
@Injectable({ providedIn: 'root' })
|
|
30
|
+
export class InjectableService { }
|
|
31
|
+
|
|
32
|
+
`;
|
|
33
|
+
const SERVICE_CLASS_MATCH_QUERY = `OPTIONAL MATCH (c)-[:HAS_DECORATOR]->(d:Decorator)
|
|
34
|
+
WHERE d IS NULL OR d.name = 'Injectable'`;
|
|
35
|
+
const SERVICE_CLASS_EXAMPLES = [
|
|
36
|
+
{
|
|
37
|
+
userPrompt: "Find all service classes",
|
|
38
|
+
given: SERVICE_STUB,
|
|
39
|
+
when: `MATCH (c:ClassDeclaration)
|
|
40
|
+
${SERVICE_CLASS_MATCH_QUERY}
|
|
41
|
+
RETURN c`,
|
|
42
|
+
then: [
|
|
43
|
+
[
|
|
44
|
+
{
|
|
45
|
+
labels: ["ClassDeclaration"],
|
|
46
|
+
name: "DecoratorlessService"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
labels: ["ClassDeclaration"],
|
|
52
|
+
name: "InjectableService"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
const SERVICE_CLASS_ABSTRACTION = {
|
|
59
|
+
id: "service-class",
|
|
60
|
+
name: "ServiceClass",
|
|
61
|
+
schema: {},
|
|
62
|
+
relationships: {},
|
|
63
|
+
description: `Abstraction on top of the TypeScript ClassDeclaration that provides reusable functionality and business logic. It encapsulates operations that can be shared across multiple components or other services.`,
|
|
64
|
+
examples: SERVICE_CLASS_EXAMPLES
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
SERVICE_CLASS_ABSTRACTION,
|
|
69
|
+
SERVICE_CLASS_EXAMPLES,
|
|
70
|
+
SERVICE_CLASS_MATCH_QUERY,
|
|
71
|
+
SERVICE_STUB
|
|
72
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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 service_stateful_exports = {};
|
|
19
|
+
__export(service_stateful_exports, {
|
|
20
|
+
CLASS_SERVICE_STATEFUL_ABSTRACTION: () => CLASS_SERVICE_STATEFUL_ABSTRACTION,
|
|
21
|
+
STATEFULL_SERVICE_STUB: () => STATEFULL_SERVICE_STUB,
|
|
22
|
+
STATEFUL_SERVICE_CLASS_EXAMPLES: () => STATEFUL_SERVICE_CLASS_EXAMPLES
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(service_stateful_exports);
|
|
25
|
+
var import_core = require("../../core/core");
|
|
26
|
+
var import_property_declarations = require("../../property-declarations");
|
|
27
|
+
var import_service = require("./service");
|
|
28
|
+
const STATEFULL_SERVICE_STUB = `
|
|
29
|
+
import { Subject } from 'rxjs';
|
|
30
|
+
|
|
31
|
+
${import_service.SERVICE_STUB}
|
|
32
|
+
|
|
33
|
+
@Injectable({ providedIn: 'root' })
|
|
34
|
+
export class StatefullService {
|
|
35
|
+
private readonly state = new Subject<number>();
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const STATEFUL_SERVICE_CLASS_EXAMPLES = [
|
|
39
|
+
{
|
|
40
|
+
userPrompt: "Find all stateful service classes",
|
|
41
|
+
given: STATEFULL_SERVICE_STUB,
|
|
42
|
+
when: `MATCH (c:ClassDeclaration)-[:HAS_PROPERTY]->${import_property_declarations.REACTIVE_STATE_PROPERTY_MATCH_QUERY}
|
|
43
|
+
${import_service.SERVICE_CLASS_MATCH_QUERY}
|
|
44
|
+
RETURN c`,
|
|
45
|
+
then: [
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
labels: ["ClassDeclaration"],
|
|
49
|
+
name: "StatefullService"
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
const CLASS_SERVICE_STATEFUL_ABSTRACTION = {
|
|
56
|
+
id: "service-class-stateful",
|
|
57
|
+
name: "Stateful Service Class",
|
|
58
|
+
description: `Abstraction that extends ${(0, import_core.ml)(import_service.SERVICE_CLASS_ABSTRACTION)} with internal state using ${(0, import_core.ml)(import_property_declarations.REACTIVE_STATE_PROPERTY_ABSTRACTION)}`,
|
|
59
|
+
schema: {},
|
|
60
|
+
relationships: {},
|
|
61
|
+
examples: STATEFUL_SERVICE_CLASS_EXAMPLES
|
|
62
|
+
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
CLASS_SERVICE_STATEFUL_ABSTRACTION,
|
|
66
|
+
STATEFULL_SERVICE_STUB,
|
|
67
|
+
STATEFUL_SERVICE_CLASS_EXAMPLES
|
|
68
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
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 class_declarations_doc_exports = {};
|
|
19
|
+
__export(class_declarations_doc_exports, {
|
|
20
|
+
CLASS_DECLARATION_DOC: () => CLASS_DECLARATION_DOC,
|
|
21
|
+
CLASS_DECLARATION_EDGE_TYPES: () => CLASS_DECLARATION_EDGE_TYPES,
|
|
22
|
+
CLASS_DECLARATION_EXAMPLES: () => CLASS_DECLARATION_EXAMPLES,
|
|
23
|
+
SNIPPETS: () => SNIPPETS
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(class_declarations_doc_exports);
|
|
26
|
+
var import_core = require("../core/core");
|
|
27
|
+
var import_method_declarations = require("../method-declarations/method-declarations.doc");
|
|
28
|
+
const SNIPPETS = {
|
|
29
|
+
singleClassMultipleMemebers: `class Test {
|
|
30
|
+
num = 1;
|
|
31
|
+
str = 'test';
|
|
32
|
+
bool = true;
|
|
33
|
+
|
|
34
|
+
queryMethod() {
|
|
35
|
+
return this.num;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
commandMethod(param1: number) {
|
|
39
|
+
this.num = this.num + param1;
|
|
40
|
+
}
|
|
41
|
+
}`,
|
|
42
|
+
injectableClass: `@Injectable({ providedIn: 'root' })
|
|
43
|
+
export class TestService { }`
|
|
44
|
+
};
|
|
45
|
+
var CLASS_DECLARATION_EDGE_TYPES = /* @__PURE__ */ ((CLASS_DECLARATION_EDGE_TYPES2) => {
|
|
46
|
+
CLASS_DECLARATION_EDGE_TYPES2["HAS_DECORATOR"] = "HAS_DECORATOR";
|
|
47
|
+
CLASS_DECLARATION_EDGE_TYPES2["HAS_PROPERTY"] = "HAS_PROPERTY";
|
|
48
|
+
CLASS_DECLARATION_EDGE_TYPES2["HAS_METHOD"] = "HAS_METHOD";
|
|
49
|
+
return CLASS_DECLARATION_EDGE_TYPES2;
|
|
50
|
+
})(CLASS_DECLARATION_EDGE_TYPES || {});
|
|
51
|
+
const CLASS_DECLARATION_EXAMPLES = [
|
|
52
|
+
{
|
|
53
|
+
userPrompt: "Find all classes",
|
|
54
|
+
given: SNIPPETS.singleClassMultipleMemebers,
|
|
55
|
+
when: `MATCH (classDecl:ClassDeclaration) RETURN classDecl`,
|
|
56
|
+
then: [
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
labels: ["ClassDeclaration"],
|
|
60
|
+
name: "Test"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
userPrompt: "Find all properties of all classes",
|
|
67
|
+
given: SNIPPETS.singleClassMultipleMemebers,
|
|
68
|
+
when: `MATCH (classDecl:ClassDeclaration)-[:${"HAS_PROPERTY" /* HAS_PROPERTY */}]->(propDecl:PropertyDeclaration) RETURN classDecl, propDecl`,
|
|
69
|
+
then: [
|
|
70
|
+
[
|
|
71
|
+
{
|
|
72
|
+
labels: ["ClassDeclaration"],
|
|
73
|
+
name: "Test"
|
|
74
|
+
},
|
|
75
|
+
{ labels: ["PropertyDeclaration"], name: "num" }
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
{
|
|
79
|
+
labels: ["ClassDeclaration"],
|
|
80
|
+
name: "Test"
|
|
81
|
+
},
|
|
82
|
+
{ labels: ["PropertyDeclaration"], name: "str" }
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
{
|
|
86
|
+
labels: ["ClassDeclaration"],
|
|
87
|
+
name: "Test"
|
|
88
|
+
},
|
|
89
|
+
{ labels: ["PropertyDeclaration"], name: "bool" }
|
|
90
|
+
]
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
userPrompt: "Find all parameters of all methods and all classes",
|
|
95
|
+
given: SNIPPETS.singleClassMultipleMemebers,
|
|
96
|
+
when: `MATCH (n:ClassDeclaration)-[rel1:${"HAS_METHOD" /* HAS_METHOD */}]->(m:MethodDeclaration)-[rel2:${import_method_declarations.METHOD_DECLARATION_EDGE_TYPES.HAS_PARAMETER}]->(p:Parameter) RETURN n, m, p`,
|
|
97
|
+
then: [
|
|
98
|
+
[
|
|
99
|
+
{
|
|
100
|
+
labels: ["ClassDeclaration"],
|
|
101
|
+
name: "Test"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
labels: ["MethodDeclaration"],
|
|
105
|
+
name: "commandMethod"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
labels: ["Parameter"],
|
|
109
|
+
name: "param1"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
const CLASS_DECLARATION_DOC = {
|
|
116
|
+
id: "class-declaration",
|
|
117
|
+
name: "ClassDeclaration",
|
|
118
|
+
schema: {
|
|
119
|
+
...import_core.NameableSchema
|
|
120
|
+
},
|
|
121
|
+
relationships: {
|
|
122
|
+
["HAS_DECORATOR" /* HAS_DECORATOR */]: {
|
|
123
|
+
examples: [
|
|
124
|
+
`(c:ClassDeclaration)-[:${"HAS_DECORATOR" /* HAS_DECORATOR */}]->(d:Decorator)`
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
["HAS_PROPERTY" /* HAS_PROPERTY */]: {
|
|
128
|
+
examples: [
|
|
129
|
+
`(c:ClassDeclaration)-[:${"HAS_PROPERTY" /* HAS_PROPERTY */}]->(p:PropertyDeclaration)`
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
["HAS_METHOD" /* HAS_METHOD */]: {
|
|
133
|
+
examples: [
|
|
134
|
+
`(c:ClassDeclaration)-[:${"HAS_METHOD" /* HAS_METHOD */}]->(m:MethodDeclaration)`
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
description: `The node represents TypeScript AST kind: ClassDeclaration.`,
|
|
139
|
+
examples: CLASS_DECLARATION_EXAMPLES
|
|
140
|
+
};
|
|
141
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
142
|
+
0 && (module.exports = {
|
|
143
|
+
CLASS_DECLARATION_DOC,
|
|
144
|
+
CLASS_DECLARATION_EDGE_TYPES,
|
|
145
|
+
CLASS_DECLARATION_EXAMPLES,
|
|
146
|
+
SNIPPETS
|
|
147
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
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 class_declarations_graph_exports = {};
|
|
19
|
+
__export(class_declarations_graph_exports, {
|
|
20
|
+
appendClassGraph: () => appendClassGraph
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(class_declarations_graph_exports);
|
|
23
|
+
var import_typescript = require("@cli/typescript");
|
|
24
|
+
var import_code = require("../code.graph");
|
|
25
|
+
var import_core = require("../core/core");
|
|
26
|
+
var import_method_declarations = require("../method-declarations/method-declarations.graph");
|
|
27
|
+
var import_property_declarations = require("../property-declarations/property-declarations.graph");
|
|
28
|
+
var import_class_declarations = require("./class-declarations.doc");
|
|
29
|
+
const ts = require("typescript");
|
|
30
|
+
const appendClassGraph = (codeGraph, classDeclaration, context) => {
|
|
31
|
+
const classImplementation = new import_typescript.ClassImplementation(
|
|
32
|
+
classDeclaration,
|
|
33
|
+
context
|
|
34
|
+
);
|
|
35
|
+
const classNode = (0, import_core.extendNameable)(classImplementation);
|
|
36
|
+
(0, import_code.addNode)(codeGraph, classNode);
|
|
37
|
+
appendClassDecoratorsGraph(codeGraph, classNode.id, classImplementation);
|
|
38
|
+
(0, import_property_declarations.appendClassPropertiesGraph)(codeGraph, classNode.id, classImplementation);
|
|
39
|
+
(0, import_method_declarations.appendClassMethodsGraph)(codeGraph, classNode.id, classImplementation);
|
|
40
|
+
};
|
|
41
|
+
const appendClassDecoratorsGraph = (codeGraph, classId, classImplementation) => {
|
|
42
|
+
classImplementation.decorators.forEach((d) => {
|
|
43
|
+
const decoratorNode = (0, import_core.extendNameable)(d);
|
|
44
|
+
(0, import_code.addNode)(codeGraph, decoratorNode);
|
|
45
|
+
(0, import_code.addEdge)(codeGraph, {
|
|
46
|
+
source: classId,
|
|
47
|
+
target: decoratorNode.id,
|
|
48
|
+
type: import_class_declarations.CLASS_DECLARATION_EDGE_TYPES.HAS_DECORATOR
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
appendClassGraph
|
|
55
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
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 class_declarations_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(class_declarations_exports);
|
|
17
|
+
__reExport(class_declarations_exports, require("./abstractions/service"), module.exports);
|
|
18
|
+
__reExport(class_declarations_exports, require("./abstractions/service.stateful"), module.exports);
|
|
19
|
+
__reExport(class_declarations_exports, require("./class-declarations.doc"), module.exports);
|
|
20
|
+
__reExport(class_declarations_exports, require("./class-declarations.graph"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./abstractions/service"),
|
|
24
|
+
...require("./abstractions/service.stateful"),
|
|
25
|
+
...require("./class-declarations.doc"),
|
|
26
|
+
...require("./class-declarations.graph")
|
|
27
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
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 code_graph_factory_exports = {};
|
|
19
|
+
__export(code_graph_factory_exports, {
|
|
20
|
+
makeCodeGraphFromSourceFiles: () => makeCodeGraphFromSourceFiles
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(code_graph_factory_exports);
|
|
23
|
+
var import_typescript = require("@cli/typescript");
|
|
24
|
+
var import_codegular = require("@core/codegular");
|
|
25
|
+
var import_class_declarations = require("./class-declarations/class-declarations.graph");
|
|
26
|
+
const ts = require("typescript");
|
|
27
|
+
const makeCodeGraphFromSourceFiles = (program) => {
|
|
28
|
+
const codeGraph = {
|
|
29
|
+
nodesById: {},
|
|
30
|
+
edgesBySource: {},
|
|
31
|
+
edgesByTarget: {}
|
|
32
|
+
};
|
|
33
|
+
const sourceFiles = (0, import_codegular.getSolutionSourceFiles)(program);
|
|
34
|
+
const context = {
|
|
35
|
+
typeChecker: program.getTypeChecker(),
|
|
36
|
+
typeResolutionTracker: new import_typescript.TypeResolutionTracker(),
|
|
37
|
+
declarationRegistry: new import_typescript.DeclarationRegistry()
|
|
38
|
+
};
|
|
39
|
+
const counter = {
|
|
40
|
+
files: 0,
|
|
41
|
+
classes: 0
|
|
42
|
+
};
|
|
43
|
+
sourceFiles.forEach((sourceFile) => {
|
|
44
|
+
const classDeclarations = (0, import_codegular.findChildrenByKind)(
|
|
45
|
+
sourceFile,
|
|
46
|
+
ts.SyntaxKind.ClassDeclaration
|
|
47
|
+
);
|
|
48
|
+
counter.files++;
|
|
49
|
+
classDeclarations.forEach((classDeclaration) => {
|
|
50
|
+
(0, import_class_declarations.appendClassGraph)(
|
|
51
|
+
codeGraph,
|
|
52
|
+
classDeclaration,
|
|
53
|
+
context
|
|
54
|
+
);
|
|
55
|
+
counter.classes++;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return codeGraph;
|
|
59
|
+
};
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
makeCodeGraphFromSourceFiles
|
|
63
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
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 code_graph_exports = {};
|
|
19
|
+
__export(code_graph_exports, {
|
|
20
|
+
addEdge: () => addEdge,
|
|
21
|
+
addNode: () => addNode
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(code_graph_exports);
|
|
24
|
+
const ts = require("typescript");
|
|
25
|
+
const addNode = (graph, node) => {
|
|
26
|
+
graph.nodesById[node.id] = node;
|
|
27
|
+
return graph;
|
|
28
|
+
};
|
|
29
|
+
const getEdgeKey = (edge) => {
|
|
30
|
+
return `${edge.source}|${edge.target}|${edge.type}`;
|
|
31
|
+
};
|
|
32
|
+
const addEdge = (graph, edge) => {
|
|
33
|
+
const edgeKey = getEdgeKey(edge);
|
|
34
|
+
const sourceEdges = graph.edgesBySource[edge.source];
|
|
35
|
+
if (sourceEdges) {
|
|
36
|
+
const sourceEdgeKeys = new Set(sourceEdges.map(getEdgeKey));
|
|
37
|
+
if (sourceEdgeKeys.has(edgeKey)) {
|
|
38
|
+
return graph;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const targetEdges = graph.edgesByTarget[edge.target];
|
|
42
|
+
if (targetEdges) {
|
|
43
|
+
const targetEdgeKeys = new Set(targetEdges.map(getEdgeKey));
|
|
44
|
+
if (targetEdgeKeys.has(edgeKey)) {
|
|
45
|
+
return graph;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!graph.edgesBySource[edge.source]) {
|
|
49
|
+
graph.edgesBySource[edge.source] = [];
|
|
50
|
+
}
|
|
51
|
+
graph.edgesBySource[edge.source].push(edge);
|
|
52
|
+
if (!graph.edgesByTarget[edge.target]) {
|
|
53
|
+
graph.edgesByTarget[edge.target] = [];
|
|
54
|
+
}
|
|
55
|
+
graph.edgesByTarget[edge.target].push(edge);
|
|
56
|
+
return graph;
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
addEdge,
|
|
61
|
+
addNode
|
|
62
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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 core_exports = {};
|
|
19
|
+
__export(core_exports, {
|
|
20
|
+
NameableSchema: () => NameableSchema,
|
|
21
|
+
extendNameable: () => extendNameable,
|
|
22
|
+
generateNodeId: () => generateNodeId,
|
|
23
|
+
ml: () => ml
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(core_exports);
|
|
26
|
+
const generateNodeId = (node) => `${node.filePath}.${node.range.start.line}.${node.range.start.character}.${node.range.end.line}.${node.range.end.character}`;
|
|
27
|
+
const extendNameable = (node, extraProps = {}) => {
|
|
28
|
+
return {
|
|
29
|
+
...extraProps,
|
|
30
|
+
id: generateNodeId(node),
|
|
31
|
+
name: node.name,
|
|
32
|
+
range: node.range,
|
|
33
|
+
filePath: node.filePath,
|
|
34
|
+
labels: [node.kind]
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const NameableSchema = {
|
|
38
|
+
name: "string",
|
|
39
|
+
filePath: "string",
|
|
40
|
+
range: {
|
|
41
|
+
start: {
|
|
42
|
+
line: "number",
|
|
43
|
+
column: "number"
|
|
44
|
+
},
|
|
45
|
+
end: {
|
|
46
|
+
line: "number",
|
|
47
|
+
column: "number"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const ml = (nodeDoc) => `[${nodeDoc.name}](${`codegraph://docs/${nodeDoc.id}`})`;
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
NameableSchema,
|
|
55
|
+
extendNameable,
|
|
56
|
+
generateNodeId,
|
|
57
|
+
ml
|
|
58
|
+
});
|