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

Function applyAppConfig

src/resolution/frameworks/nestjs.ts:471–487  ·  view source on GitHub ↗

* A route's name with everything the app adds to it, in NestJS's order: * `/{globalPrefix}/{v}{version}/{RouterModule prefix}/{controller}/{method}`. * Recomputed from the in-file `method:path` in the qualified name, so the pass * is idempotent.

(route: Node, modulePrefix: string, config: NestAppConfig | null, version: string | null | undefined)

Source from the content-addressed store, hash-verified

469 * is idempotent.
470 */
471function applyAppConfig(route: Node, modulePrefix: string, config: NestAppConfig | null, version: string | null | undefined): Node | null {
472 const sep = route.qualifiedName.indexOf('::');
473 if (sep < 0) return null;
474 const tail = route.qualifiedName.slice(sep + 2);
475 const colon = tail.indexOf(':');
476 if (colon < 0) return null;
477 const method = tail.slice(0, colon);
478 const inner = joinHttpPath(modulePrefix, tail.slice(colon + 1));
479 let path = inner;
480 if (config) {
481 const v = version === undefined ? config.defaultVersion : version;
482 const versionSeg = config.uri && v !== null && v !== NEUTRAL ? `${config.versionPrefix}${v}` : '';
483 const prefix = config.prefix && !isExcluded(inner, config.excludes) ? config.prefix : '';
484 path = joinHttpPath(joinHttpPath(prefix, versionSeg), inner);
485 }
486 return { ...route, name: `${method} ${path}`, updatedAt: Date.now() };
487}
488
489// ---------------------------------------------------------------------------
490// Provider resolution conventions

Callers 1

postExtractFunction · 0.85

Calls 2

joinHttpPathFunction · 0.85
isExcludedFunction · 0.85

Tested by

no test coverage detected