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

Method getOutgoingEdges

src/db/queries.ts:3084–3113  ·  view source on GitHub ↗

* Get outgoing edges from a node. Preserve the source/kind index order * (calls before imports/references), then break ties deterministically.

(sourceId: string, kinds?: EdgeKind[], provenance?: string, limit?: number)

Source from the content-addressed store, hash-verified

3082 * (calls before imports/references), then break ties deterministically.
3083 */
3084 getOutgoingEdges(sourceId: string, kinds?: EdgeKind[], provenance?: string, limit?: number): Edge[] {
3085 if ((kinds && kinds.length > 0) || provenance || limit !== undefined) {
3086 let sql = 'SELECT * FROM edges WHERE source = ?';
3087 const params: (string | number)[] = [sourceId];
3088
3089 if (kinds && kinds.length > 0) {
3090 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
3091 params.push(...kinds);
3092 }
3093
3094 if (provenance) {
3095 sql += ' AND provenance = ?';
3096 params.push(provenance);
3097 }
3098
3099 sql += ' ORDER BY kind, target, line, col';
3100 if (limit !== undefined) {
3101 sql += ' LIMIT ?';
3102 params.push(Math.max(0, Math.floor(limit)));
3103 }
3104 const rows = this.edgeKindStmt(sql).all(...params) as EdgeRow[];
3105 return rows.map(rowToEdge);
3106 }
3107
3108 if (!this.stmts.getEdgesBySource) {
3109 this.stmts.getEdgesBySource = this.db.prepare('SELECT * FROM edges WHERE source = ? ORDER BY kind, target, line, col');
3110 }
3111 const rows = this.stmts.getEdgesBySource.all(sourceId) as EdgeRow[];
3112 return rows.map(rowToEdge);
3113 }
3114
3115 /**
3116 * Incoming edges to a node except `contains`: the edges that make their

Callers 15

createContextMethod · 0.45
supertypesOfMethod · 0.45
callableMembersOfMethod · 0.45
fnRefsOfFunction · 0.45
ancestorsOfFunction · 0.45
classReferencedAtFunction · 0.45
fieldChannelEdgesFunction · 0.45
reactRenderEdgesFunction · 0.45
flutterBuildEdgesFunction · 0.45
arkuiStateBuildEdgesFunction · 0.45
methodsOfFunction · 0.45

Calls 6

edgeKindStmtMethod · 0.95
mapMethod · 0.80
pushMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected