MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / links

Function links

__tests__/tauri-ipc.test.ts:42–51  ·  view source on GitHub ↗

Everything the pass drew, in edge order.

(graph: CodeGraph, by = 'tauri-command')

Source from the content-addressed store, hash-verified

40
41/** Everything the pass drew, in edge order. */
42function links(graph: CodeGraph, by = 'tauri-command'): Array<{ from: Node; to: Node; edge: Edge }> {
43 const db = (graph as unknown as { db: { db: { prepare(sql: string): { all(...args: unknown[]): unknown[] } } } }).db.db;
44 const rows = db.prepare(
45 `SELECT source, target, kind, line, col AS "column", provenance, metadata FROM edges WHERE json_extract(metadata, '$.synthesizedBy') = ?`
46 ).all(by) as Array<Omit<Edge, 'metadata'> & { metadata: string }>;
47 return rows.map((row) => {
48 const edge = { ...row, metadata: JSON.parse(row.metadata) as Record<string, unknown> };
49 return { from: graph.getNode(row.source)!, to: graph.getNode(row.target)!, edge };
50 });
51}
52
53const names = (rows: ReadonlyArray<{ from: Node; to: Node }>): string[] => rows.map((r) => `${r.from.name} > ${r.to.name}`).sort();
54

Callers 1

tauri-ipc.test.tsFile · 0.70

Calls 5

mapMethod · 0.80
parseMethod · 0.80
getNodeMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected