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

Method getUnresolvedReferenceNamesFrom

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

3018 * are absent from the map. Chunked probe over `idx_unresolved_from_node`.
3019 */
3020 getUnresolvedReferenceNamesFrom(nodeIds: Iterable<string>, kinds: readonly string[]): Map<string, string[]> {
3021 const unique = [...new Set(nodeIds)];
3022 const found = new Map<string, string[]>();
3023 if (unique.length === 0 || kinds.length === 0) return found;
3024 const kindPlaceholders = kinds.map(() => '?').join(',');
3025 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
3026 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
3027 const placeholders = chunk.map(() => '?').join(',');
3028 const rows = this.db
3029 .prepare(
3030 `SELECT DISTINCT from_node_id AS id, reference_name AS name FROM unresolved_refs
3031 WHERE from_node_id IN (${placeholders})
3032 AND reference_kind IN (${kindPlaceholders})`
3033 )
3034 .all(...chunk, ...kinds) as Array<{ id: string; name: string }>;
3035 for (const row of rows) {
3036 const names = found.get(row.id);
3037 if (names) names.push(row.name);
3038 else found.set(row.id, [row.name]);
3039 }
3040 }
3041 return found;
3042 }
3043
3044 /**
3045 * 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