* Get incoming edges to a node. Kind must precede opaque source IDs: * file IDs sort before function IDs, so source-first ordering lets imports * displace actual calls in capped caller lists. Keep deterministic ties * without changing the target/kind index's established kind precedence.
(targetId: string, kinds?: EdgeKind[])
| 2140 | * without changing the target/kind index's established kind precedence. |
| 2141 | */ |
| 2142 | getIncomingEdges(targetId: string, kinds?: EdgeKind[]): Edge[] { |
| 2143 | if (kinds && kinds.length > 0) { |
| 2144 | const sql = `SELECT * FROM edges WHERE target = ? AND kind IN (${kinds.map(() => '?').join(',')}) ORDER BY kind, source, line, col`; |
| 2145 | const rows = this.edgeKindStmt(sql).all(targetId, ...kinds) as EdgeRow[]; |
| 2146 | return rows.map(rowToEdge); |
| 2147 | } |
| 2148 | |
| 2149 | if (!this.stmts.getEdgesByTarget) { |
| 2150 | this.stmts.getEdgesByTarget = this.db.prepare('SELECT * FROM edges WHERE target = ? ORDER BY kind, source, line, col'); |
| 2151 | } |
| 2152 | const rows = this.stmts.getEdgesByTarget.all(targetId) as EdgeRow[]; |
| 2153 | return rows.map(rowToEdge); |
| 2154 | } |
| 2155 | |
| 2156 | /** |
| 2157 | * Outgoing edges for MANY source nodes in one query. |
no test coverage detected