MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / getResolutionEdgesThrough

Method getResolutionEdgesThrough

src/db/queries.ts:3832–3859  ·  view source on GitHub ↗

* Resolution edges out of the nodes of `filePath` whose reference was * written through one of `names` (see THROUGH_NAMES), with the source * file and language a resurrection needs and the file of each target. * Synthesized (`provenance='heuristic'`) and `contains` edges are left ou

(
    filePath: string,
    names: readonly string[]
  )

Source from the content-addressed store, hash-verified

3830 * Synthesized (`provenance='heuristic'`) and `contains` edges are left out.
3831 */
3832 getResolutionEdgesThrough(
3833 filePath: string,
3834 names: readonly string[]
3835 ): Array<Edge & { edgeId: number; sourceFilePath: string; sourceLanguage: Language; targetFilePath: string }> {
3836 const rows = this.db
3837 .prepare(
3838 `SELECT * FROM (
3839 SELECT e.*, src.file_path AS source_file_path, src.language AS source_language, tgt.file_path AS target_file_path,
3840 CASE WHEN json_valid(e.metadata) THEN json_extract(e.metadata, '$.refName') END AS ref_name
3841 FROM nodes src
3842 JOIN edges e ON e.source = src.id
3843 JOIN nodes tgt ON tgt.id = e.target
3844 WHERE src.file_path = ?
3845 AND e.kind != 'contains'
3846 AND (e.provenance IS NULL OR e.provenance != 'heuristic')
3847 ) WHERE ${THROUGH_NAMES('ref_name')}`
3848 )
3849 .all(filePath, JSON.stringify(names), JSON.stringify(names)) as Array<
3850 EdgeRow & { source_file_path: string; source_language: Language; target_file_path: string }
3851 >;
3852 return rows.map((row) => ({
3853 ...rowToEdge(row),
3854 edgeId: row.id,
3855 sourceFilePath: row.source_file_path,
3856 sourceLanguage: row.source_language,
3857 targetFilePath: row.target_file_path,
3858 }));
3859 }
3860
3861 /**
3862 * The import bindings of `filePaths` that resolved some other way than

Calls 5

THROUGH_NAMESFunction · 0.85
rowToEdgeFunction · 0.85
mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected