* 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[])
| 2860 | * are wanted at once ("which files import anything in this one?"). |
| 2861 | */ |
| 2862 | getIncomingEdgesTo(targetIds: readonly string[], kinds?: EdgeKind[]): Edge[] { |
| 2863 | if (targetIds.length === 0) return []; |
| 2864 | const unique = [...new Set(targetIds)]; |
| 2865 | const out: Edge[] = []; |
| 2866 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 2867 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 2868 | const placeholders = chunk.map(() => '?').join(','); |
| 2869 | let sql = `SELECT * FROM edges WHERE target IN (${placeholders})`; |
| 2870 | const params: string[] = [...chunk]; |
| 2871 | if (kinds && kinds.length > 0) { |
| 2872 | sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`; |
| 2873 | params.push(...kinds); |
| 2874 | } |
| 2875 | const rows = this.db.prepare(sql).all(...params) as EdgeRow[]; |
| 2876 | for (const row of rows) out.push(rowToEdge(row)); |
| 2877 | } |
| 2878 | return out; |
| 2879 | } |
| 2880 | |
| 2881 | /** |
| 2882 | * Fan-out (total outgoing edge count) for MANY nodes in one query — the |
no test coverage detected