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

Method getResolutionEdgesThrough

src/db/queries.ts:3721–3748  ·  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

3719 * Synthesized (`provenance='heuristic'`) and `contains` edges are left out.
3720 */
3721 getResolutionEdgesThrough(
3722 filePath: string,
3723 names: readonly string[]
3724 ): Array<Edge & { edgeId: number; sourceFilePath: string; sourceLanguage: Language; targetFilePath: string }> {
3725 const rows = this.db
3726 .prepare(
3727 `SELECT * FROM (
3728 SELECT e.*, src.file_path AS source_file_path, src.language AS source_language, tgt.file_path AS target_file_path,
3729 CASE WHEN json_valid(e.metadata) THEN json_extract(e.metadata, '$.refName') END AS ref_name
3730 FROM nodes src
3731 JOIN edges e ON e.source = src.id
3732 JOIN nodes tgt ON tgt.id = e.target
3733 WHERE src.file_path = ?
3734 AND e.kind != 'contains'
3735 AND (e.provenance IS NULL OR e.provenance != 'heuristic')
3736 ) WHERE ${THROUGH_NAMES('ref_name')}`
3737 )
3738 .all(filePath, JSON.stringify(names), JSON.stringify(names)) as Array<
3739 EdgeRow & { source_file_path: string; source_language: Language; target_file_path: string }
3740 >;
3741 return rows.map((row) => ({
3742 ...rowToEdge(row),
3743 edgeId: row.id,
3744 sourceFilePath: row.source_file_path,
3745 sourceLanguage: row.source_language,
3746 targetFilePath: row.target_file_path,
3747 }));
3748 }
3749
3750 /**
3751 * The import bindings of `filePaths` that resolved some other way than

Callers 3

reopenEdgesFunction · 0.80
changedDefaultExportsMethod · 0.80

Calls 5

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

Tested by

no test coverage detected