* Distinct node names present in the given files — the symbol names a sync * pass uses to look up retryable failed refs after those files changed. * `kinds` narrows them to nodes of those kinds.
(filePaths: string[], kinds?: readonly NodeKind[])
| 5822 | * `kinds` narrows them to nodes of those kinds. |
| 5823 | */ |
| 5824 | getNodeNamesByFiles(filePaths: string[], kinds?: readonly NodeKind[]): string[] { |
| 5825 | if (filePaths.length === 0) return []; |
| 5826 | const kindFilter = kinds ? ` AND kind IN (${kinds.map(() => '?').join(',')})` : ''; |
| 5827 | const names = new Set<string>(); |
| 5828 | for (let i = 0; i < filePaths.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 5829 | const chunk = filePaths.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 5830 | const placeholders = chunk.map(() => '?').join(','); |
| 5831 | const rows = this.db |
| 5832 | .prepare(`SELECT DISTINCT name FROM nodes WHERE file_path IN (${placeholders})${kindFilter}`) |
| 5833 | .all(...chunk, ...(kinds ?? [])) as Array<{ name: string }>; |
| 5834 | for (const row of rows) names.add(row.name); |
| 5835 | } |
| 5836 | return [...names]; |
| 5837 | } |
| 5838 | |
| 5839 | /** |
| 5840 | * Distinct `file\0name` pairs defined by the given files — the shape sync's |