Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960const ROUTE_ALIASES = { "verify-password": "verify-builds-password", "pack-telemetry": "bundle-telemetry", "pack-telemetry-query": "bundle-telemetry-query", "track-tape": "track-media", "logo.png": "logo",};
const NESTED_ROUTES = { "chat/messages": "chat-messages", "chat/heart": "chat-heart", "auth/cli-callback": "auth-cli-callback", "news/toll": "news-toll",};
const NEWS_API_ROUTES = new Set([ "posts", "updates", "submit", "comment", "vote", "delete", "unfurl",]);
function normalizeRest(rest) { if (Array.isArray(rest)) return rest.join("/"); if (typeof rest === "string") return rest; return "";}
function resolveFunctionName(fn, rest, functions = {}) { const normalizedRest = normalizeRest(rest);
if (normalizedRest) { const nested = `${fn}/${normalizedRest}`; for (const [pattern, target] of Object.entries(NESTED_ROUTES)) { if (nested === pattern || nested.startsWith(`${pattern}/`)) { return target; } } }
if (ROUTE_ALIASES[fn]) return ROUTE_ALIASES[fn];
if (fn === "news" && normalizedRest) { const firstSegment = normalizedRest.split("/")[0]; return NEWS_API_ROUTES.has(firstSegment) ? "news-api" : "news"; }
if (fn === "ff1" && normalizedRest) { const subFn = `ff1-${normalizedRest.split("/")[0]}`; if (functions[subFn]) return subFn; }
return fn;}
export { resolveFunctionName };