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

Function selectHandler

src/resolution/goframe-synthesizer.ts:67–75  ·  view source on GitHub ↗

* Pick the one handler for a route from same-request-type candidates. Usually a * single candidate. When several share the request type (a cloned addon module), * keep controller-dir methods, then the one in the route's own module (core route * → core handler, addon route → that addon's handler).

(candidates: Node[], routeFile: string)

Source from the content-addressed store, hash-verified

65 * edge (silent beats wrong).
66 */
67function selectHandler(candidates: Node[], routeFile: string): Node | null {
68 if (candidates.length === 1) return candidates[0]!;
69 let cands = candidates.filter((h) => /\/controller(s)?\//.test(h.filePath));
70 if (cands.length === 0) cands = candidates;
71 if (cands.length === 1) return cands[0]!;
72 const ar = addonRoot(routeFile);
73 const sameModule = cands.filter((h) => addonRoot(h.filePath) === ar);
74 return sameModule.length === 1 ? sameModule[0]! : null;
75}
76
77export async function goframeRouteEdges(ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]> {
78 let scanned255 = 0;

Callers 1

goframeRouteEdgesFunction · 0.85

Calls 1

addonRootFunction · 0.85

Tested by

no test coverage detected