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

Method getUnresolvedReferenceNamesFrom

src/db/queries.ts:3054–3076  ·  view source on GitHub ↗

* The names each of `nodeIds` holds an unresolved reference of `kinds` to. * * A reference into code outside the index leaves no edge, only this row: a * decorator imported from a framework (`@HostListener`, `@Cron`) or an * interface named in an `implements` clause. Pending rows count w

(nodeIds: Iterable<string>, kinds: readonly string[])

Source from the content-addressed store, hash-verified

3052 * are absent from the map. Chunked probe over `idx_unresolved_from_node`.
3053 */
3054 getUnresolvedReferenceNamesFrom(nodeIds: Iterable<string>, kinds: readonly string[]): Map<string, string[]> {
3055 const unique = [...new Set(nodeIds)];
3056 const found = new Map<string, string[]>();
3057 if (unique.length === 0 || kinds.length === 0) return found;
3058 const kindPlaceholders = kinds.map(() => '?').join(',');
3059 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
3060 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
3061 const placeholders = chunk.map(() => '?').join(',');
3062 const rows = this.db
3063 .prepare(
3064 `SELECT DISTINCT from_node_id AS id, reference_name AS name FROM unresolved_refs
3065 WHERE from_node_id IN (${placeholders})
3066 AND reference_kind IN (${kindPlaceholders})`
3067 )
3068 .all(...chunk, ...kinds) as Array<{ id: string; name: string }>;
3069 for (const row of rows) {
3070 const names = found.get(row.id);
3071 if (names) names.push(row.name);
3072 else found.set(row.id, [row.name]);
3073 }
3074 }
3075 return found;
3076 }
3077
3078 /**
3079 * Every node holding an unresolved reference of `kinds` to each of `names` —

Callers 3

carriesDecoratorFunction · 0.45
byNameHookCandidatesFunction · 0.45

Calls 7

mapMethod · 0.80
pushMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
getMethod · 0.65
joinMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected