* Incoming edges for MANY target nodes in one query — the mirror of * getOutgoingEdgesFrom. Needed wherever a whole file's inbound edges * are wanted at once ("which files import anything in this one?").
(targetIds: readonly string[], kinds?: EdgeKind[])
| 2894 | * are wanted at once ("which files import anything in this one?"). |
| 2895 | */ |
| 2896 | getIncomingEdgesTo(targetIds: readonly string[], kinds?: EdgeKind[]): Edge[] { |
| 2897 | if (targetIds.length === 0) return []; |
| 2898 | const unique = [...new Set(targetIds)]; |
| 2899 | const out: Edge[] = []; |
| 2900 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 2901 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 2902 | const placeholders = chunk.map(() => '?').join(','); |
| 2903 | let sql = `SELECT * FROM edges WHERE target IN (${placeholders})`; |
| 2904 | const params: string[] = [...chunk]; |
| 2905 | if (kinds && kinds.length > 0) { |
| 2906 | sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`; |
| 2907 | params.push(...kinds); |
| 2908 | } |
| 2909 | const rows = this.db.prepare(sql).all(...params) as EdgeRow[]; |
| 2910 | for (const row of rows) out.push(rowToEdge(row)); |
| 2911 | } |
| 2912 | return out; |
| 2913 | } |
| 2914 | |
| 2915 | /** |
| 2916 | * Fan-out (total outgoing edge count) for MANY nodes in one query — the |
no test coverage detected