* The import bindings of `filePaths` that resolved some other way than * through their import — `imports` edges out of each file's node named for * the binding, whose `resolvedBy` is a name match or a framework's — with * the source file and language a resurrection needs and the file of eac
(
filePaths: readonly string[]
)
| 3756 | * an indexed range (idx_edges_source_kind); few of them resolve by name. |
| 3757 | */ |
| 3758 | getImportBindingsResolvedElsewhere( |
| 3759 | filePaths: readonly string[] |
| 3760 | ): Array<Edge & { edgeId: number; sourceFilePath: string; sourceLanguage: Language; targetFilePath: string }> { |
| 3761 | const out: Array<Edge & { edgeId: number; sourceFilePath: string; sourceLanguage: Language; targetFilePath: string }> = []; |
| 3762 | const unique = [...new Set(filePaths)].map((filePath) => `file:${filePath}`); |
| 3763 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 3764 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 3765 | const placeholders = chunk.map(() => '?').join(','); |
| 3766 | const rows = this.db |
| 3767 | .prepare( |
| 3768 | `SELECT e.*, src.file_path AS source_file_path, src.language AS source_language, tgt.file_path AS target_file_path |
| 3769 | FROM edges e |
| 3770 | JOIN nodes src ON src.id = e.source |
| 3771 | JOIN nodes tgt ON tgt.id = e.target |
| 3772 | WHERE e.source IN (${placeholders}) |
| 3773 | AND e.kind = 'imports' |
| 3774 | AND (e.provenance IS NULL OR e.provenance != 'heuristic') |
| 3775 | AND json_valid(e.metadata) |
| 3776 | AND json_extract(e.metadata, '$.resolvedBy') != 'import'` |
| 3777 | ) |
| 3778 | .all(...chunk) as Array<EdgeRow & { source_file_path: string; source_language: Language; target_file_path: string }>; |
| 3779 | for (const row of rows) { |
| 3780 | out.push({ |
| 3781 | ...rowToEdge(row), |
| 3782 | edgeId: row.id, |
| 3783 | sourceFilePath: row.source_file_path, |
| 3784 | sourceLanguage: row.source_language, |
| 3785 | targetFilePath: row.target_file_path, |
| 3786 | }); |
| 3787 | } |
| 3788 | } |
| 3789 | return out; |
| 3790 | } |
| 3791 | |
| 3792 | /** |
| 3793 | * The resolution edges into `targetIds` — every edge into one of them but |