ts-knowledge-graph 0.1.1 → 0.1.4
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/README.md +104 -43
- package/contribs/web_visualisation/README.md +83 -0
- package/contribs/web_visualisation/web/css/style.css +219 -0
- package/contribs/web_visualisation/web/data/.gitignore +3 -0
- package/contribs/web_visualisation/web/data/kind_descriptions.js +38 -0
- package/contribs/web_visualisation/web/index.html +74 -0
- package/contribs/web_visualisation/web/js/app.js +910 -0
- package/contribs/web_visualisation/web/tsconfig.json +18 -0
- package/contribs/web_visualisation/web/types/app_globals.d.ts +146 -0
- package/dist/benchmark/benchmark_stats.d.ts +41 -0
- package/dist/benchmark/benchmark_stats.d.ts.map +1 -0
- package/dist/benchmark/benchmark_stats.js +61 -0
- package/dist/benchmark/benchmark_stats.js.map +1 -0
- package/dist/benchmark/node_benchmark.d.ts +78 -0
- package/dist/benchmark/node_benchmark.d.ts.map +1 -0
- package/dist/benchmark/node_benchmark.js +112 -0
- package/dist/benchmark/node_benchmark.js.map +1 -0
- package/dist/cli.d.ts +0 -9
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +32 -208
- package/dist/cli.js.map +1 -1
- package/dist/commands/benchmark_command.d.ts +11 -0
- package/dist/commands/benchmark_command.d.ts.map +1 -0
- package/dist/commands/benchmark_command.js +91 -0
- package/dist/commands/benchmark_command.js.map +1 -0
- package/dist/commands/blast_radius_command.d.ts +5 -0
- package/dist/commands/blast_radius_command.d.ts.map +1 -0
- package/dist/commands/blast_radius_command.js +18 -0
- package/dist/commands/blast_radius_command.js.map +1 -0
- package/dist/commands/calls_command.d.ts +5 -0
- package/dist/commands/calls_command.d.ts.map +1 -0
- package/dist/commands/calls_command.js +7 -0
- package/dist/commands/calls_command.js.map +1 -0
- package/dist/commands/command_helpers.d.ts +15 -0
- package/dist/commands/command_helpers.d.ts.map +1 -0
- package/dist/commands/command_helpers.js +61 -0
- package/dist/commands/command_helpers.js.map +1 -0
- package/dist/commands/cost_command.d.ts +13 -0
- package/dist/commands/cost_command.d.ts.map +1 -0
- package/dist/commands/cost_command.js +122 -0
- package/dist/commands/cost_command.js.map +1 -0
- package/dist/commands/dead_exports_command.d.ts +5 -0
- package/dist/commands/dead_exports_command.d.ts.map +1 -0
- package/dist/commands/dead_exports_command.js +7 -0
- package/dist/commands/dead_exports_command.js.map +1 -0
- package/dist/commands/enrich_command.d.ts +7 -0
- package/dist/commands/enrich_command.d.ts.map +1 -0
- package/dist/commands/enrich_command.js +62 -0
- package/dist/commands/enrich_command.js.map +1 -0
- package/dist/commands/extract_command.d.ts +8 -0
- package/dist/commands/extract_command.d.ts.map +1 -0
- package/dist/commands/extract_command.js +49 -0
- package/dist/commands/extract_command.js.map +1 -0
- package/dist/commands/find_command.d.ts +5 -0
- package/dist/commands/find_command.d.ts.map +1 -0
- package/dist/commands/find_command.js +7 -0
- package/dist/commands/find_command.js.map +1 -0
- package/dist/commands/hotspots_command.d.ts +7 -0
- package/dist/commands/hotspots_command.d.ts.map +1 -0
- package/dist/commands/hotspots_command.js +67 -0
- package/dist/commands/hotspots_command.js.map +1 -0
- package/dist/commands/install_command.d.ts +15 -0
- package/dist/commands/install_command.d.ts.map +1 -0
- package/dist/commands/install_command.js +41 -0
- package/dist/commands/install_command.js.map +1 -0
- package/dist/commands/load_command.d.ts +6 -0
- package/dist/commands/load_command.d.ts.map +1 -0
- package/dist/commands/load_command.js +30 -0
- package/dist/commands/load_command.js.map +1 -0
- package/dist/commands/neighbors_command.d.ts +5 -0
- package/dist/commands/neighbors_command.d.ts.map +1 -0
- package/dist/commands/neighbors_command.js +17 -0
- package/dist/commands/neighbors_command.js.map +1 -0
- package/dist/commands/references_command.d.ts +5 -0
- package/dist/commands/references_command.d.ts.map +1 -0
- package/dist/commands/references_command.js +17 -0
- package/dist/commands/references_command.js.map +1 -0
- package/dist/commands/verify_command.d.ts +8 -0
- package/dist/commands/verify_command.d.ts.map +1 -0
- package/dist/commands/verify_command.js +57 -0
- package/dist/commands/verify_command.js.map +1 -0
- package/dist/commands/web_command.d.ts +46 -0
- package/dist/commands/web_command.d.ts.map +1 -0
- package/dist/commands/web_command.js +226 -0
- package/dist/commands/web_command.js.map +1 -0
- package/dist/commands/who_calls_command.d.ts +5 -0
- package/dist/commands/who_calls_command.d.ts.map +1 -0
- package/dist/commands/who_calls_command.js +7 -0
- package/dist/commands/who_calls_command.js.map +1 -0
- package/dist/enrich/cpu_profile.d.ts +127 -0
- package/dist/enrich/cpu_profile.d.ts.map +1 -0
- package/dist/enrich/cpu_profile.js +97 -0
- package/dist/enrich/cpu_profile.js.map +1 -0
- package/dist/enrich/runtime_enricher.d.ts +56 -0
- package/dist/enrich/runtime_enricher.d.ts.map +1 -0
- package/dist/enrich/runtime_enricher.js +80 -0
- package/dist/enrich/runtime_enricher.js.map +1 -0
- package/dist/enrich/runtime_join.d.ts +100 -0
- package/dist/enrich/runtime_join.d.ts.map +1 -0
- package/dist/enrich/runtime_join.js +227 -0
- package/dist/enrich/runtime_join.js.map +1 -0
- package/dist/extract/api_extractor.d.ts +24 -0
- package/dist/extract/api_extractor.d.ts.map +1 -0
- package/dist/extract/api_extractor.js +71 -0
- package/dist/extract/api_extractor.js.map +1 -0
- package/dist/extract/config_extractor.d.ts +22 -0
- package/dist/extract/config_extractor.d.ts.map +1 -0
- package/dist/extract/config_extractor.js +61 -0
- package/dist/extract/config_extractor.js.map +1 -0
- package/dist/extract/endpoint_extractor.d.ts +36 -0
- package/dist/extract/endpoint_extractor.d.ts.map +1 -0
- package/dist/extract/endpoint_extractor.js +117 -0
- package/dist/extract/endpoint_extractor.js.map +1 -0
- package/dist/extract/{graph-builder.d.ts → graph_builder.d.ts} +9 -1
- package/dist/extract/graph_builder.d.ts.map +1 -0
- package/dist/extract/graph_builder.js +61 -0
- package/dist/extract/graph_builder.js.map +1 -0
- package/dist/extract/node_id.d.ts +24 -0
- package/dist/extract/node_id.d.ts.map +1 -0
- package/dist/extract/node_id.js +44 -0
- package/dist/extract/node_id.js.map +1 -0
- package/dist/extract/{project-loader.d.ts → project_loader.d.ts} +1 -1
- package/dist/extract/project_loader.d.ts.map +1 -0
- package/dist/extract/{project-loader.js → project_loader.js} +1 -1
- package/dist/extract/{project-loader.js.map → project_loader.js.map} +1 -1
- package/dist/extract/scope_resolver.d.ts +22 -0
- package/dist/extract/scope_resolver.d.ts.map +1 -0
- package/dist/extract/scope_resolver.js +53 -0
- package/dist/extract/scope_resolver.js.map +1 -0
- package/dist/extract/semantic_extractor.d.ts +47 -0
- package/dist/extract/semantic_extractor.d.ts.map +1 -0
- package/dist/extract/{semantic-extractor.js → semantic_extractor.js} +98 -4
- package/dist/extract/semantic_extractor.js.map +1 -0
- package/dist/extract/{structural-extractor.d.ts → structural_extractor.d.ts} +7 -1
- package/dist/extract/{structural-extractor.d.ts.map → structural_extractor.d.ts.map} +1 -1
- package/dist/extract/{structural-extractor.js → structural_extractor.js} +24 -14
- package/dist/extract/structural_extractor.js.map +1 -0
- package/dist/project_root.d.ts +7 -0
- package/dist/project_root.d.ts.map +1 -0
- package/dist/project_root.js +9 -0
- package/dist/project_root.js.map +1 -0
- package/dist/query/graph_query.d.ts +262 -0
- package/dist/query/graph_query.d.ts.map +1 -0
- package/dist/query/graph_query.js +604 -0
- package/dist/query/graph_query.js.map +1 -0
- package/dist/schema/edge.d.ts +40 -5
- package/dist/schema/edge.d.ts.map +1 -1
- package/dist/schema/edge.js +70 -0
- package/dist/schema/edge.js.map +1 -1
- package/dist/schema/node.d.ts +20 -5
- package/dist/schema/node.d.ts.map +1 -1
- package/dist/schema/node.js +36 -0
- package/dist/schema/node.js.map +1 -1
- package/dist/schema/runtime_manifest.d.ts +36 -0
- package/dist/schema/runtime_manifest.d.ts.map +1 -0
- package/dist/schema/runtime_manifest.js +23 -0
- package/dist/schema/runtime_manifest.js.map +1 -0
- package/dist/store/{jsonl-reader.d.ts → jsonl_reader.d.ts} +1 -1
- package/dist/store/{jsonl-reader.d.ts.map → jsonl_reader.d.ts.map} +1 -1
- package/dist/store/{jsonl-reader.js → jsonl_reader.js} +1 -1
- package/dist/store/{jsonl-reader.js.map → jsonl_reader.js.map} +1 -1
- package/dist/store/{jsonl-store.d.ts → jsonl_store.d.ts} +1 -1
- package/dist/store/{jsonl-store.d.ts.map → jsonl_store.d.ts.map} +1 -1
- package/dist/store/{jsonl-store.js → jsonl_store.js} +1 -1
- package/dist/store/{jsonl-store.js.map → jsonl_store.js.map} +1 -1
- package/dist/store/kuzu_store.d.ts +66 -0
- package/dist/store/kuzu_store.d.ts.map +1 -0
- package/dist/store/kuzu_store.js +156 -0
- package/dist/store/kuzu_store.js.map +1 -0
- package/dist/verify/project_verifier.d.ts +85 -0
- package/dist/verify/project_verifier.d.ts.map +1 -0
- package/dist/verify/project_verifier.js +138 -0
- package/dist/verify/project_verifier.js.map +1 -0
- package/dotclaude_folder/skills/code-graph-query/SKILL.md +91 -0
- package/package.json +88 -5
- package/.env-sample +0 -34
- package/dist/agent/agent-tools.d.ts +0 -13
- package/dist/agent/agent-tools.d.ts.map +0 -1
- package/dist/agent/agent-tools.js +0 -153
- package/dist/agent/agent-tools.js.map +0 -1
- package/dist/agent/code-editor.d.ts +0 -18
- package/dist/agent/code-editor.d.ts.map +0 -1
- package/dist/agent/code-editor.js +0 -43
- package/dist/agent/code-editor.js.map +0 -1
- package/dist/agent/optimizer-agent.d.ts +0 -30
- package/dist/agent/optimizer-agent.d.ts.map +0 -1
- package/dist/agent/optimizer-agent.js +0 -97
- package/dist/agent/optimizer-agent.js.map +0 -1
- package/dist/agent/verifier.d.ts +0 -9
- package/dist/agent/verifier.d.ts.map +0 -1
- package/dist/agent/verifier.js +0 -19
- package/dist/agent/verifier.js.map +0 -1
- package/dist/extract/graph-builder.d.ts.map +0 -1
- package/dist/extract/graph-builder.js +0 -39
- package/dist/extract/graph-builder.js.map +0 -1
- package/dist/extract/node-id.d.ts +0 -8
- package/dist/extract/node-id.d.ts.map +0 -1
- package/dist/extract/node-id.js +0 -22
- package/dist/extract/node-id.js.map +0 -1
- package/dist/extract/project-loader.d.ts.map +0 -1
- package/dist/extract/semantic-extractor.d.ts +0 -22
- package/dist/extract/semantic-extractor.d.ts.map +0 -1
- package/dist/extract/semantic-extractor.js.map +0 -1
- package/dist/extract/structural-extractor.js.map +0 -1
- package/dist/query/graph-query.d.ts +0 -28
- package/dist/query/graph-query.d.ts.map +0 -1
- package/dist/query/graph-query.js +0 -93
- package/dist/query/graph-query.js.map +0 -1
- package/dist/store/kuzu-store.d.ts +0 -14
- package/dist/store/kuzu-store.d.ts.map +0 -1
- package/dist/store/kuzu-store.js +0 -52
- package/dist/store/kuzu-store.js.map +0 -1
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
import { REFERENCE_EDGE_KINDS } from '../schema/edge.js';
|
|
2
|
+
import { RUNTIME_MANIFEST_KEY, RuntimeManifestSchema } from '../schema/runtime_manifest.js';
|
|
3
|
+
/**
|
|
4
|
+
* The {@link REFERENCE_EDGE_KINDS} set rendered as a Cypher list literal — e.g.
|
|
5
|
+
* `['CALLS', 'EXTENDS', …]` — for interpolation into `kind IN …` predicates. The
|
|
6
|
+
* schema array is the single source of truth; this is its query-side projection.
|
|
7
|
+
*/
|
|
8
|
+
const REFERENCE_EDGE_KINDS_CYPHER = `[${REFERENCE_EDGE_KINDS.map((kind) => `'${kind}'`).join(', ')}]`;
|
|
9
|
+
const RETURN_REF = (variable) => `${variable}.id AS id, ${variable}.kind AS kind, ${variable}.name AS name, ${variable}.filePath AS filePath, ${variable}.startLine AS startLine, ${variable}.metadata AS metadata`;
|
|
10
|
+
/**
|
|
11
|
+
* Kùzu's hard ceiling on the upper bound of a variable-length relationship: a
|
|
12
|
+
* pattern like `-[e:Edge*1..N]-` with `N > 30` is rejected by the binder at query
|
|
13
|
+
* time. {@link GraphQuery.clampDepth} caps `--depth` here so the bound it
|
|
14
|
+
* interpolates into {@link GraphQuery.blastRadius} is always one Kùzu accepts.
|
|
15
|
+
*/
|
|
16
|
+
const KUZU_MAX_REL_BOUND = 30;
|
|
17
|
+
export class GraphQuery {
|
|
18
|
+
constructor(store) {
|
|
19
|
+
this.store = store;
|
|
20
|
+
}
|
|
21
|
+
async whoCalls(id) {
|
|
22
|
+
const rows = await this.store.run(`MATCH (caller:GraphNode)-[e:Edge]->(callee:GraphNode {id: $id})
|
|
23
|
+
WHERE e.kind = 'CALLS'
|
|
24
|
+
RETURN ${RETURN_REF('caller')}
|
|
25
|
+
ORDER BY filePath, startLine`, { id });
|
|
26
|
+
return GraphQuery.toRefs(rows);
|
|
27
|
+
}
|
|
28
|
+
async calls(id) {
|
|
29
|
+
const rows = await this.store.run(`MATCH (caller:GraphNode {id: $id})-[e:Edge]->(callee:GraphNode)
|
|
30
|
+
WHERE e.kind = 'CALLS'
|
|
31
|
+
RETURN ${RETURN_REF('callee')}
|
|
32
|
+
ORDER BY filePath, startLine`, { id });
|
|
33
|
+
return GraphQuery.toRefs(rows);
|
|
34
|
+
}
|
|
35
|
+
async blastRadius(id, depth) {
|
|
36
|
+
const bound = GraphQuery.clampDepth(depth);
|
|
37
|
+
const rows = await this.store.run(`MATCH (target:GraphNode {id: $id})<-[e:Edge*1..${bound} (r, n | WHERE r.kind = 'CALLS')]-(impacted:GraphNode)
|
|
38
|
+
RETURN DISTINCT ${RETURN_REF('impacted')}
|
|
39
|
+
ORDER BY filePath, startLine`, { id });
|
|
40
|
+
return GraphQuery.toRefs(rows);
|
|
41
|
+
}
|
|
42
|
+
async deadExports() {
|
|
43
|
+
const rows = await this.store.run(`MATCH (n:GraphNode)
|
|
44
|
+
WHERE n.exported = true
|
|
45
|
+
OPTIONAL MATCH (n)<-[selfRef:Edge]-(:GraphNode)
|
|
46
|
+
WHERE selfRef.kind IN ${REFERENCE_EDGE_KINDS_CYPHER}
|
|
47
|
+
WITH n, count(selfRef) AS selfRefs
|
|
48
|
+
OPTIONAL MATCH (n)-[c:Edge]->(member:GraphNode)<-[memberRef:Edge]-(:GraphNode)
|
|
49
|
+
WHERE c.kind = 'CONTAINS' AND memberRef.kind IN ${REFERENCE_EDGE_KINDS_CYPHER}
|
|
50
|
+
WITH n, selfRefs, count(memberRef) AS memberRefs
|
|
51
|
+
WHERE selfRefs = 0 AND memberRefs = 0
|
|
52
|
+
RETURN ${RETURN_REF('n')}
|
|
53
|
+
ORDER BY filePath, startLine`);
|
|
54
|
+
return GraphQuery.toRefs(rows);
|
|
55
|
+
}
|
|
56
|
+
async references(id) {
|
|
57
|
+
const rows = await this.store.run(`MATCH (n:GraphNode {id: $id})<-[e:Edge]-(other:GraphNode)
|
|
58
|
+
WHERE e.kind IN ${REFERENCE_EDGE_KINDS_CYPHER}
|
|
59
|
+
RETURN ${RETURN_REF('other')}, e.kind AS edgeKind, e.metadata AS edgeMetadata
|
|
60
|
+
ORDER BY edgeKind, filePath, startLine`, { id });
|
|
61
|
+
return rows.map((row) => GraphQuery.toNeighbor(row, 'in'));
|
|
62
|
+
}
|
|
63
|
+
async neighborhood(id) {
|
|
64
|
+
const outgoing = await this.store.run(`MATCH (center:GraphNode {id: $id})-[e:Edge]->(other:GraphNode)
|
|
65
|
+
RETURN ${RETURN_REF('other')}, e.kind AS edgeKind, e.metadata AS edgeMetadata`, { id });
|
|
66
|
+
const incoming = await this.store.run(`MATCH (center:GraphNode {id: $id})<-[e:Edge]-(other:GraphNode)
|
|
67
|
+
RETURN ${RETURN_REF('other')}, e.kind AS edgeKind, e.metadata AS edgeMetadata`, { id });
|
|
68
|
+
return [
|
|
69
|
+
...outgoing.map((row) => GraphQuery.toNeighbor(row, 'out')),
|
|
70
|
+
...incoming.map((row) => GraphQuery.toNeighbor(row, 'in')),
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Resolves a search pattern to nodes, matching either a substring of the node
|
|
75
|
+
* name or an exact (case-insensitive) node kind. The kind match makes the
|
|
76
|
+
* system-level kinds discoverable as a set — `find Endpoint`, `find ConfigFlag`,
|
|
77
|
+
* `find ExternalAPI` — since their names are values (a route path, a host) rather
|
|
78
|
+
* than the kind itself. `Module` nodes are always excluded.
|
|
79
|
+
*/
|
|
80
|
+
async find(pattern) {
|
|
81
|
+
const rows = await this.store.run(`MATCH (n:GraphNode)
|
|
82
|
+
WHERE n.kind <> 'Module' AND (lower(n.name) CONTAINS lower($pattern) OR lower(n.kind) = lower($pattern))
|
|
83
|
+
RETURN ${RETURN_REF('n')}
|
|
84
|
+
ORDER BY filePath, startLine
|
|
85
|
+
LIMIT 50`, { pattern });
|
|
86
|
+
return GraphQuery.toRefs(rows);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Ranks nodes by optimization leverage, returning the top-N for a chosen
|
|
90
|
+
* metric alongside the context needed to read the result.
|
|
91
|
+
*
|
|
92
|
+
* Runtime metrics (`self-time`, `samples`) read `metadata.runtime`; static
|
|
93
|
+
* metrics (`callers`, `call-count`, `blast-radius`) are derived from the
|
|
94
|
+
* inbound `CALLS` graph. The whole graph is read once (nodes, and the call
|
|
95
|
+
* edges when a static metric is used) and ranked in memory rather than per
|
|
96
|
+
* node, so `blast-radius` does not fan out into one traversal per node.
|
|
97
|
+
*
|
|
98
|
+
* The default metric is `self-time` on an enriched graph and `callers`
|
|
99
|
+
* otherwise. Asking for a runtime metric on an un-enriched graph does not
|
|
100
|
+
* return empty: it falls back to `callers` and flags `fellBack` so the caller
|
|
101
|
+
* can say so. Nodes that score zero on the chosen metric are omitted — a
|
|
102
|
+
* symbol nothing calls is not a fan-in hotspot.
|
|
103
|
+
*/
|
|
104
|
+
async hotspots(options = {}) {
|
|
105
|
+
const nodes = await this.store.readNodes();
|
|
106
|
+
const enriched = nodes.some((node) => GraphQuery.hasRuntime(node.metadata));
|
|
107
|
+
const requested = options.by ?? (enriched === true ? 'self-time' : 'callers');
|
|
108
|
+
const fellBack = GraphQuery.isRuntimeMetric(requested) === true && enriched === false;
|
|
109
|
+
const metric = fellBack === true ? 'callers' : requested;
|
|
110
|
+
const measuredOnly = options.measuredOnly === true;
|
|
111
|
+
const limit = GraphQuery.clampLimit(options.limit);
|
|
112
|
+
const scores = await this.scoreNodes(nodes, metric);
|
|
113
|
+
const candidates = measuredOnly === true
|
|
114
|
+
? nodes.filter((node) => GraphQuery.hasRuntime(node.metadata))
|
|
115
|
+
: nodes;
|
|
116
|
+
const hotspots = candidates
|
|
117
|
+
.map((node) => ({ node, score: scores.get(node.id) ?? 0 }))
|
|
118
|
+
.filter((entry) => entry.score > 0)
|
|
119
|
+
.sort((a, b) => b.score - a.score
|
|
120
|
+
|| a.node.filePath.localeCompare(b.node.filePath)
|
|
121
|
+
|| a.node.startLine - b.node.startLine)
|
|
122
|
+
.slice(0, limit)
|
|
123
|
+
.map((entry) => GraphQuery.toHotspot(entry.node, entry.score, metric));
|
|
124
|
+
return { metric, requested, enriched, fellBack, measuredOnly, hotspots };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Ranks nodes by **inclusive cost** — self cost plus the cost attributed from
|
|
128
|
+
* everything a node transitively calls — and reports each node's share of the
|
|
129
|
+
* graph's total self cost. This is the causal counterpart to {@link hotspots}'
|
|
130
|
+
* `self-time` ranking: where hotspots asks "where is time spent?", this asks
|
|
131
|
+
* "who is *responsible* for the time spent?".
|
|
132
|
+
*
|
|
133
|
+
* Cost propagates along `CALLS` edges, each callee's inclusive cost partitioned
|
|
134
|
+
* among its callers in proportion to call-site `count`, so cost is conserved (a
|
|
135
|
+
* diamond is not double-counted) and `shareOfTotal` is a true fraction. Call
|
|
136
|
+
* cycles are collapsed and their members share the cycle's total. The whole
|
|
137
|
+
* graph is read once and propagated in memory.
|
|
138
|
+
*
|
|
139
|
+
* Cost is inherently a runtime quantity: on an un-enriched graph there is no
|
|
140
|
+
* self cost to propagate, so `nodes` is empty and `enriched` is false — there is
|
|
141
|
+
* no static fallback (unlike {@link hotspots}).
|
|
142
|
+
*/
|
|
143
|
+
async costRanking(options = {}) {
|
|
144
|
+
const nodes = await this.store.readNodes();
|
|
145
|
+
const enriched = nodes.some((node) => GraphQuery.hasRuntime(node.metadata));
|
|
146
|
+
const metric = options.by ?? 'self-time';
|
|
147
|
+
const limit = GraphQuery.clampLimit(options.limit);
|
|
148
|
+
const edges = await this.readCallEdges();
|
|
149
|
+
const manifest = await this.readRuntimeManifest();
|
|
150
|
+
const model = GraphQuery.computeCostModel(nodes, edges, metric);
|
|
151
|
+
const ranked = nodes
|
|
152
|
+
.map((node) => GraphQuery.toCostRef(node, model))
|
|
153
|
+
.filter((ref) => ref.inclusiveCost > 0)
|
|
154
|
+
.sort((a, b) => b.inclusiveCost - a.inclusiveCost
|
|
155
|
+
|| a.filePath.localeCompare(b.filePath)
|
|
156
|
+
|| a.startLine - b.startLine)
|
|
157
|
+
.slice(0, limit);
|
|
158
|
+
return {
|
|
159
|
+
metric,
|
|
160
|
+
enriched,
|
|
161
|
+
totalSelf: model.totalSelf,
|
|
162
|
+
measuredNodes: model.measuredNodes,
|
|
163
|
+
coverage: GraphQuery.coverageFor(manifest, metric),
|
|
164
|
+
nodes: ranked,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Breaks one node's cost down causally: where its inclusive cost goes
|
|
169
|
+
* (`callees`, each carrying the cost its subtree contributes) and who is
|
|
170
|
+
* responsible for it (`callers`, how the node's cost is attributed upward by
|
|
171
|
+
* call-count share). Both are derived from the same propagation
|
|
172
|
+
* {@link costRanking} uses. Returns `node: null` when the id resolves to no node.
|
|
173
|
+
*/
|
|
174
|
+
async costAttribution(id, options = {}) {
|
|
175
|
+
const nodes = await this.store.readNodes();
|
|
176
|
+
const enriched = nodes.some((node) => GraphQuery.hasRuntime(node.metadata));
|
|
177
|
+
const metric = options.by ?? 'self-time';
|
|
178
|
+
const edges = await this.readCallEdges();
|
|
179
|
+
const manifest = await this.readRuntimeManifest();
|
|
180
|
+
const model = GraphQuery.computeCostModel(nodes, edges, metric);
|
|
181
|
+
const nodeById = new Map(nodes.map((node) => [node.id, node]));
|
|
182
|
+
const coverage = GraphQuery.coverageFor(manifest, metric);
|
|
183
|
+
const focal = nodeById.get(id);
|
|
184
|
+
if (focal === undefined) {
|
|
185
|
+
return { metric, enriched, totalSelf: model.totalSelf, coverage, node: null, callees: [], callers: [] };
|
|
186
|
+
}
|
|
187
|
+
const focalRef = GraphQuery.toCostRef(focal, model);
|
|
188
|
+
const focalComponent = model.componentOf.get(id);
|
|
189
|
+
const focalInclusive = focalRef.inclusiveCost;
|
|
190
|
+
const focalInbound = model.externalInbound.get(id) ?? 0;
|
|
191
|
+
const callees = [];
|
|
192
|
+
for (const edge of model.outEdges.get(id) ?? []) {
|
|
193
|
+
if (model.componentOf.get(edge.toId) === focalComponent) {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const callee = nodeById.get(edge.toId);
|
|
197
|
+
if (callee === undefined) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const inbound = model.externalInbound.get(edge.toId) ?? 0;
|
|
201
|
+
const calleeInclusive = model.inclusiveCost.get(edge.toId) ?? 0;
|
|
202
|
+
const amount = inbound > 0 ? calleeInclusive * edge.count / inbound : 0;
|
|
203
|
+
const share = focalInclusive > 0 ? amount / focalInclusive : 0;
|
|
204
|
+
callees.push({ ...GraphQuery.symbolOf(callee), amount, share, callCount: edge.count });
|
|
205
|
+
}
|
|
206
|
+
const callers = [];
|
|
207
|
+
for (const edge of model.inEdges.get(id) ?? []) {
|
|
208
|
+
if (model.componentOf.get(edge.fromId) === focalComponent) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const caller = nodeById.get(edge.fromId);
|
|
212
|
+
if (caller === undefined) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const amount = focalInbound > 0 ? focalInclusive * edge.count / focalInbound : 0;
|
|
216
|
+
const share = focalInbound > 0 ? edge.count / focalInbound : 0;
|
|
217
|
+
callers.push({ ...GraphQuery.symbolOf(caller), amount, share, callCount: edge.count });
|
|
218
|
+
}
|
|
219
|
+
callees.sort((a, b) => b.amount - a.amount || a.filePath.localeCompare(b.filePath) || a.startLine - b.startLine);
|
|
220
|
+
callers.sort((a, b) => b.amount - a.amount || a.filePath.localeCompare(b.filePath) || a.startLine - b.startLine);
|
|
221
|
+
return { metric, enriched, totalSelf: model.totalSelf, coverage, node: focalRef, callees, callers };
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Reads the runtime ingest manifest `enrich` records at the graph level, or
|
|
225
|
+
* null when the graph carries none (never enriched, or enriched before manifests
|
|
226
|
+
* were recorded). A stored value that fails validation is treated as absent.
|
|
227
|
+
*/
|
|
228
|
+
async readRuntimeManifest() {
|
|
229
|
+
const raw = await this.store.readGraphMeta(RUNTIME_MANIFEST_KEY);
|
|
230
|
+
if (raw === null) {
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
const parsed = RuntimeManifestSchema.safeParse(raw);
|
|
234
|
+
return parsed.success === true ? parsed.data : null;
|
|
235
|
+
}
|
|
236
|
+
/** Builds a node-id → score map for the chosen metric, reading call edges only when a static metric needs them. */
|
|
237
|
+
async scoreNodes(nodes, metric) {
|
|
238
|
+
if (metric === 'self-time' || metric === 'samples') {
|
|
239
|
+
const key = metric === 'self-time' ? 'selfMs' : 'samples';
|
|
240
|
+
return new Map(nodes.map((node) => [node.id, GraphQuery.runtimeValue(node.metadata, key)]));
|
|
241
|
+
}
|
|
242
|
+
const edges = await this.readCallEdges();
|
|
243
|
+
if (metric === 'call-count') {
|
|
244
|
+
return GraphQuery.sumInbound(edges, (edge) => edge.count);
|
|
245
|
+
}
|
|
246
|
+
if (metric === 'blast-radius') {
|
|
247
|
+
return GraphQuery.blastRadiusSizes(nodes, edges);
|
|
248
|
+
}
|
|
249
|
+
return GraphQuery.sumInbound(edges, () => 1);
|
|
250
|
+
}
|
|
251
|
+
/** Reads every `CALLS` edge with its call-site `count` decoded from edge metadata. */
|
|
252
|
+
async readCallEdges() {
|
|
253
|
+
const rows = await this.store.run(`MATCH (caller:GraphNode)-[e:Edge]->(callee:GraphNode)
|
|
254
|
+
WHERE e.kind = 'CALLS'
|
|
255
|
+
RETURN caller.id AS fromId, callee.id AS toId, e.metadata AS metadata`);
|
|
256
|
+
return rows.map((row) => ({
|
|
257
|
+
fromId: String(row.fromId),
|
|
258
|
+
toId: String(row.toId),
|
|
259
|
+
count: GraphQuery.callCount(row.metadata),
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
/** Sums a per-edge weight onto each edge's target, yielding inbound fan-in (`weight = 1`) or call-count (`weight = count`). */
|
|
263
|
+
static sumInbound(edges, weight) {
|
|
264
|
+
const totals = new Map();
|
|
265
|
+
for (const edge of edges) {
|
|
266
|
+
totals.set(edge.toId, (totals.get(edge.toId) ?? 0) + weight(edge));
|
|
267
|
+
}
|
|
268
|
+
return totals;
|
|
269
|
+
}
|
|
270
|
+
/** Computes, for every node, the number of distinct nodes that transitively reach it through inbound `CALLS`. */
|
|
271
|
+
static blastRadiusSizes(nodes, edges) {
|
|
272
|
+
const callers = new Map();
|
|
273
|
+
for (const edge of edges) {
|
|
274
|
+
const bucket = callers.get(edge.toId);
|
|
275
|
+
if (bucket === undefined) {
|
|
276
|
+
callers.set(edge.toId, [edge.fromId]);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
bucket.push(edge.fromId);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const sizes = new Map();
|
|
283
|
+
for (const node of nodes) {
|
|
284
|
+
sizes.set(node.id, GraphQuery.reachableCount(node.id, callers));
|
|
285
|
+
}
|
|
286
|
+
return sizes;
|
|
287
|
+
}
|
|
288
|
+
/** Counts the distinct ancestors of `start` over the reverse-call adjacency, cycle-safe and excluding `start` itself. */
|
|
289
|
+
static reachableCount(start, callers) {
|
|
290
|
+
const visited = new Set();
|
|
291
|
+
const stack = [...(callers.get(start) ?? [])];
|
|
292
|
+
while (stack.length > 0) {
|
|
293
|
+
const id = stack.pop();
|
|
294
|
+
if (id === undefined || visited.has(id) === true) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
visited.add(id);
|
|
298
|
+
for (const next of callers.get(id) ?? []) {
|
|
299
|
+
if (visited.has(next) === false) {
|
|
300
|
+
stack.push(next);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
visited.delete(start);
|
|
305
|
+
return visited.size;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Propagates self cost into inclusive cost over the whole graph in one pass.
|
|
309
|
+
*
|
|
310
|
+
* Self-edges and edges touching unknown nodes are dropped. Strongly-connected
|
|
311
|
+
* components (call cycles) are collapsed with Tarjan's algorithm, which numbers
|
|
312
|
+
* them in reverse-topological order (a callee's component before its caller's);
|
|
313
|
+
* processing components in that order lets each caller read its callees'
|
|
314
|
+
* already-computed inclusive cost. A callee's inclusive cost is partitioned
|
|
315
|
+
* among its callers by call-site `count` over the inbound weight from *outside*
|
|
316
|
+
* its component, so cost is conserved on the acyclic part and a cycle's members
|
|
317
|
+
* share the cycle's total.
|
|
318
|
+
*/
|
|
319
|
+
static computeCostModel(nodes, edges, metric) {
|
|
320
|
+
const key = metric === 'self-time' ? 'selfMs' : 'samples';
|
|
321
|
+
const count = nodes.length;
|
|
322
|
+
const indexOf = new Map();
|
|
323
|
+
nodes.forEach((node, i) => indexOf.set(node.id, i));
|
|
324
|
+
const self = nodes.map((node) => GraphQuery.runtimeValue(node.metadata, key));
|
|
325
|
+
const successors = nodes.map(() => []);
|
|
326
|
+
const outEdges = nodes.map(() => []);
|
|
327
|
+
const inEdges = nodes.map(() => []);
|
|
328
|
+
for (const edge of edges) {
|
|
329
|
+
const from = indexOf.get(edge.fromId);
|
|
330
|
+
const to = indexOf.get(edge.toId);
|
|
331
|
+
if (from === undefined || to === undefined || from === to) {
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
successors[from].push(to);
|
|
335
|
+
outEdges[from].push({ to, count: edge.count });
|
|
336
|
+
inEdges[to].push({ from, count: edge.count });
|
|
337
|
+
}
|
|
338
|
+
const { componentOf, componentCount } = GraphQuery.stronglyConnectedComponents(successors);
|
|
339
|
+
const componentSize = new Array(componentCount).fill(0);
|
|
340
|
+
const selfByComponent = new Array(componentCount).fill(0);
|
|
341
|
+
const members = Array.from({ length: componentCount }, () => []);
|
|
342
|
+
for (let i = 0; i < count; i += 1) {
|
|
343
|
+
const comp = componentOf[i];
|
|
344
|
+
componentSize[comp] += 1;
|
|
345
|
+
selfByComponent[comp] += self[i];
|
|
346
|
+
members[comp].push(i);
|
|
347
|
+
}
|
|
348
|
+
const externalInbound = new Array(count).fill(0);
|
|
349
|
+
for (let to = 0; to < count; to += 1) {
|
|
350
|
+
for (const edge of inEdges[to]) {
|
|
351
|
+
if (componentOf[edge.from] !== componentOf[to]) {
|
|
352
|
+
externalInbound[to] += edge.count;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
const inclusiveByComponent = new Array(componentCount).fill(0);
|
|
357
|
+
for (let comp = 0; comp < componentCount; comp += 1) {
|
|
358
|
+
let inclusive = selfByComponent[comp];
|
|
359
|
+
for (const member of members[comp]) {
|
|
360
|
+
for (const edge of outEdges[member]) {
|
|
361
|
+
const target = componentOf[edge.to];
|
|
362
|
+
if (target === comp) {
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
const inbound = externalInbound[edge.to];
|
|
366
|
+
if (inbound > 0) {
|
|
367
|
+
inclusive += inclusiveByComponent[target] * edge.count / inbound;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
inclusiveByComponent[comp] = inclusive;
|
|
372
|
+
}
|
|
373
|
+
const model = {
|
|
374
|
+
totalSelf: 0,
|
|
375
|
+
measuredNodes: 0,
|
|
376
|
+
selfCost: new Map(),
|
|
377
|
+
inclusiveCost: new Map(),
|
|
378
|
+
componentOf: new Map(),
|
|
379
|
+
cycleSize: new Map(),
|
|
380
|
+
externalInbound: new Map(),
|
|
381
|
+
outEdges: new Map(),
|
|
382
|
+
inEdges: new Map(),
|
|
383
|
+
};
|
|
384
|
+
for (let i = 0; i < count; i += 1) {
|
|
385
|
+
const node = nodes[i];
|
|
386
|
+
const comp = componentOf[i];
|
|
387
|
+
model.totalSelf += self[i];
|
|
388
|
+
if (GraphQuery.hasRuntime(node.metadata) === true) {
|
|
389
|
+
model.measuredNodes += 1;
|
|
390
|
+
}
|
|
391
|
+
model.selfCost.set(node.id, self[i]);
|
|
392
|
+
model.inclusiveCost.set(node.id, inclusiveByComponent[comp]);
|
|
393
|
+
model.componentOf.set(node.id, comp);
|
|
394
|
+
model.cycleSize.set(node.id, componentSize[comp]);
|
|
395
|
+
model.externalInbound.set(node.id, externalInbound[i]);
|
|
396
|
+
model.outEdges.set(node.id, outEdges[i].map((edge) => ({ fromId: node.id, toId: nodes[edge.to].id, count: edge.count })));
|
|
397
|
+
model.inEdges.set(node.id, inEdges[i].map((edge) => ({ fromId: nodes[edge.from].id, toId: node.id, count: edge.count })));
|
|
398
|
+
}
|
|
399
|
+
return model;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Tarjan's strongly-connected components over the index-based successor lists,
|
|
403
|
+
* iterative so a deep call chain cannot overflow the stack. Components are
|
|
404
|
+
* numbered in the order they are finalized, which is reverse-topological: every
|
|
405
|
+
* cross-component edge runs from a higher-numbered component to a lower one.
|
|
406
|
+
*/
|
|
407
|
+
static stronglyConnectedComponents(successors) {
|
|
408
|
+
const count = successors.length;
|
|
409
|
+
const index = new Array(count).fill(-1);
|
|
410
|
+
const lowlink = new Array(count).fill(0);
|
|
411
|
+
const onStack = new Array(count).fill(false);
|
|
412
|
+
const componentOf = new Array(count).fill(-1);
|
|
413
|
+
const sccStack = [];
|
|
414
|
+
const workNode = [];
|
|
415
|
+
const workNext = [];
|
|
416
|
+
let counter = 0;
|
|
417
|
+
let componentCount = 0;
|
|
418
|
+
for (let start = 0; start < count; start += 1) {
|
|
419
|
+
if (index[start] !== -1) {
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
workNode.push(start);
|
|
423
|
+
workNext.push(0);
|
|
424
|
+
index[start] = counter;
|
|
425
|
+
lowlink[start] = counter;
|
|
426
|
+
counter += 1;
|
|
427
|
+
sccStack.push(start);
|
|
428
|
+
onStack[start] = true;
|
|
429
|
+
while (workNode.length > 0) {
|
|
430
|
+
const node = workNode[workNode.length - 1];
|
|
431
|
+
const position = workNext[workNext.length - 1];
|
|
432
|
+
const succ = successors[node];
|
|
433
|
+
if (position < succ.length) {
|
|
434
|
+
workNext[workNext.length - 1] = position + 1;
|
|
435
|
+
const next = succ[position];
|
|
436
|
+
if (index[next] === -1) {
|
|
437
|
+
index[next] = counter;
|
|
438
|
+
lowlink[next] = counter;
|
|
439
|
+
counter += 1;
|
|
440
|
+
sccStack.push(next);
|
|
441
|
+
onStack[next] = true;
|
|
442
|
+
workNode.push(next);
|
|
443
|
+
workNext.push(0);
|
|
444
|
+
}
|
|
445
|
+
else if (onStack[next] === true && index[next] < lowlink[node]) {
|
|
446
|
+
lowlink[node] = index[next];
|
|
447
|
+
}
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
if (lowlink[node] === index[node]) {
|
|
451
|
+
let member = -1;
|
|
452
|
+
do {
|
|
453
|
+
const popped = sccStack.pop();
|
|
454
|
+
member = popped === undefined ? node : popped;
|
|
455
|
+
onStack[member] = false;
|
|
456
|
+
componentOf[member] = componentCount;
|
|
457
|
+
} while (member !== node);
|
|
458
|
+
componentCount += 1;
|
|
459
|
+
}
|
|
460
|
+
workNode.pop();
|
|
461
|
+
workNext.pop();
|
|
462
|
+
if (workNode.length > 0) {
|
|
463
|
+
const parent = workNode[workNode.length - 1];
|
|
464
|
+
if (lowlink[node] < lowlink[parent]) {
|
|
465
|
+
lowlink[parent] = lowlink[node];
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return { componentOf, componentCount };
|
|
471
|
+
}
|
|
472
|
+
static toCostRef(node, model) {
|
|
473
|
+
const selfCost = model.selfCost.get(node.id) ?? 0;
|
|
474
|
+
const inclusiveCost = model.inclusiveCost.get(node.id) ?? 0;
|
|
475
|
+
const cycleSize = model.cycleSize.get(node.id) ?? 1;
|
|
476
|
+
return {
|
|
477
|
+
...GraphQuery.symbolOf(node),
|
|
478
|
+
selfCost,
|
|
479
|
+
inclusiveCost,
|
|
480
|
+
shareOfTotal: model.totalSelf > 0 ? inclusiveCost / model.totalSelf : 0,
|
|
481
|
+
cyclic: cycleSize > 1,
|
|
482
|
+
cycleSize,
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
static symbolOf(node) {
|
|
486
|
+
return {
|
|
487
|
+
id: node.id,
|
|
488
|
+
kind: node.kind,
|
|
489
|
+
name: node.name,
|
|
490
|
+
filePath: node.filePath,
|
|
491
|
+
startLine: node.startLine,
|
|
492
|
+
metadata: node.metadata,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* The fraction of profiled cost (in `metric`) the join attributed to graph
|
|
497
|
+
* nodes, from the manifest: matched ÷ total. Null when there is no manifest or
|
|
498
|
+
* the profile measured nothing in that metric.
|
|
499
|
+
*/
|
|
500
|
+
static coverageFor(manifest, metric) {
|
|
501
|
+
if (manifest === null) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
if (metric === 'samples') {
|
|
505
|
+
return manifest.totalSamples > 0 ? manifest.matchedSamples / manifest.totalSamples : null;
|
|
506
|
+
}
|
|
507
|
+
return manifest.totalSelfMicros > 0 ? manifest.matchedSelfMicros / manifest.totalSelfMicros : null;
|
|
508
|
+
}
|
|
509
|
+
static toHotspot(node, score, metric) {
|
|
510
|
+
return {
|
|
511
|
+
id: node.id,
|
|
512
|
+
kind: node.kind,
|
|
513
|
+
name: node.name,
|
|
514
|
+
filePath: node.filePath,
|
|
515
|
+
startLine: node.startLine,
|
|
516
|
+
metadata: node.metadata,
|
|
517
|
+
score,
|
|
518
|
+
metric,
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
static isRuntimeMetric(metric) {
|
|
522
|
+
return metric === 'self-time' || metric === 'samples';
|
|
523
|
+
}
|
|
524
|
+
/** Reads a numeric metric out of `metadata.runtime`, defaulting to 0 when absent or non-numeric. */
|
|
525
|
+
static runtimeValue(metadata, key) {
|
|
526
|
+
const runtime = metadata.runtime;
|
|
527
|
+
if (typeof runtime !== 'object' || runtime === null) {
|
|
528
|
+
return 0;
|
|
529
|
+
}
|
|
530
|
+
const value = runtime[key];
|
|
531
|
+
return typeof value === 'number' ? value : 0;
|
|
532
|
+
}
|
|
533
|
+
static hasRuntime(metadata) {
|
|
534
|
+
const runtime = metadata.runtime;
|
|
535
|
+
return typeof runtime === 'object' && runtime !== null;
|
|
536
|
+
}
|
|
537
|
+
/** Decodes an edge's call-site `count`, defaulting to 1 (the minimum the builder records). */
|
|
538
|
+
static callCount(value) {
|
|
539
|
+
const metadata = GraphQuery.parseMetadata(value);
|
|
540
|
+
const count = metadata.count;
|
|
541
|
+
return typeof count === 'number' && count > 0 ? count : 1;
|
|
542
|
+
}
|
|
543
|
+
static clampLimit(limit) {
|
|
544
|
+
if (limit === undefined || Number.isFinite(limit) === false) {
|
|
545
|
+
return 20;
|
|
546
|
+
}
|
|
547
|
+
const floored = Math.floor(limit);
|
|
548
|
+
if (floored < 1) {
|
|
549
|
+
return 20;
|
|
550
|
+
}
|
|
551
|
+
return floored > 1000 ? 1000 : floored;
|
|
552
|
+
}
|
|
553
|
+
static toRefs(rows) {
|
|
554
|
+
return rows.map((row) => GraphQuery.toRef(row));
|
|
555
|
+
}
|
|
556
|
+
static toRef(row) {
|
|
557
|
+
return {
|
|
558
|
+
id: String(row.id),
|
|
559
|
+
kind: String(row.kind),
|
|
560
|
+
name: String(row.name),
|
|
561
|
+
filePath: String(row.filePath),
|
|
562
|
+
startLine: Number(row.startLine),
|
|
563
|
+
metadata: GraphQuery.parseMetadata(row.metadata),
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
static toNeighbor(row, direction) {
|
|
567
|
+
return {
|
|
568
|
+
...GraphQuery.toRef(row),
|
|
569
|
+
edgeKind: String(row.edgeKind),
|
|
570
|
+
edgeMetadata: GraphQuery.parseMetadata(row.edgeMetadata),
|
|
571
|
+
direction,
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Decodes the JSON `metadata` column back into a record. A missing, empty, or
|
|
576
|
+
* malformed value decodes to an empty object so callers always receive a record.
|
|
577
|
+
*/
|
|
578
|
+
static parseMetadata(value) {
|
|
579
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
580
|
+
return {};
|
|
581
|
+
}
|
|
582
|
+
try {
|
|
583
|
+
const parsed = JSON.parse(value);
|
|
584
|
+
if (typeof parsed === 'object' && parsed !== null) {
|
|
585
|
+
return parsed;
|
|
586
|
+
}
|
|
587
|
+
return {};
|
|
588
|
+
}
|
|
589
|
+
catch {
|
|
590
|
+
return {};
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
static clampDepth(depth) {
|
|
594
|
+
if (Number.isFinite(depth) === false) {
|
|
595
|
+
return 5;
|
|
596
|
+
}
|
|
597
|
+
const floored = Math.floor(depth);
|
|
598
|
+
if (floored < 1) {
|
|
599
|
+
return 1;
|
|
600
|
+
}
|
|
601
|
+
return floored > KUZU_MAX_REL_BOUND ? KUZU_MAX_REL_BOUND : floored;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
//# sourceMappingURL=graph_query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph_query.js","sourceRoot":"","sources":["../../src/query/graph_query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAmB,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAiL7G;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,IA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