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

Function parseMapQuery

src/ui-server/api/map.ts:531–545  ·  view source on GitHub ↗
(query: URLSearchParams)

Source from the content-addressed store, hash-verified

529 * reader who asked for 1, and {@link pickDefaultDepth} would never run.
530 */
531export function parseMapQuery(query: URLSearchParams): {
532 root: string | null;
533 depth: number | null;
534} {
535 const rawDepth = query.get('depth');
536 let depth: number | null = null;
537 if (rawDepth !== null && rawDepth !== '') {
538 depth = Number.parseInt(rawDepth, 10);
539 if (!Number.isFinite(depth) || depth < 1 || depth > MAX_DEPTH) {
540 throw badRequest(`depth must be a whole number from 1 to ${MAX_DEPTH}.`);
541 }
542 }
543 const rawRoot = query.get('root');
544 return { root: rawRoot === null ? null : normalizeRoot(rawRoot), depth };
545}
546
547/**
548 * Rename `x/(root files)` to `x` wherever the bucket is all `x` has.

Callers 1

buildMapFunction · 0.85

Calls 3

badRequestFunction · 0.90
normalizeRootFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected