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

Function routesRunning

__tests__/nextjs-proxy.test.ts:220–223  ·  view source on GitHub ↗
(cg: CodeGraph, target: Node)

Source from the content-addressed store, hash-verified

218 const proxyEdges = (cg: CodeGraph): Edge[] =>
219 cg.getNodesByKind('route').flatMap((r) => cg.getOutgoingEdges(r.id).filter((e) => meta(e).synthesizedBy === 'next-proxy'));
220 const routesRunning = (cg: CodeGraph, target: Node): Record<string, unknown> =>
221 Object.fromEntries(
222 proxyEdges(cg).filter((e) => e.target === target.id).map((e) => [cg.getNode(e.source)!.name, meta(e).matcher ?? null])
223 );
224 const fn = (cg: CodeGraph, name: string, filePath: string): Node => {
225 const node = cg.getNodesByName(name).find((n) => n.filePath === filePath && n.kind === 'function');
226 if (!node) throw new Error(`no function ${name} in ${filePath}`);

Callers 1

Calls 4

proxyEdgesFunction · 0.85
mapMethod · 0.80
getNodeMethod · 0.80
metaFunction · 0.70

Tested by

no test coverage detected