Publish curated ITWorx_MCP_Hub source from 6c7434368ce2a594005983c5a6601a31a639e7f1
This commit is contained in:
1 parent
77946d62c4
commit
6d40ab975c
86 files changed
+6784
-1478
No files matched your search
@@ -13,4 +13,11 @@ export function usePath() {
|
||||
return [path, navigate] as const;
|
||||
}
|
||||
export function basePath(path: string) { return (path.split("?")[0] ?? "").replace(/\/$/, "") || "/"; }
|
||||
export function resourceKind(path: string): ResourceKind | null { const base = basePath(path); if (base.startsWith("/projects/") && base !== "/projects") return "projects"; return resourceRoutes[base] ?? null; }
|
||||
export function projectDetailId(path: string): string | null { return decodeDetailId(path, "projects"); }
|
||||
export function connectorDetailId(path: string): string | null { return decodeDetailId(path, "connectors"); }
|
||||
function decodeDetailId(path: string, collection: "projects" | "connectors"): string | null {
|
||||
const match = new RegExp(`^/${collection}/([^/]+)$`).exec(basePath(path));
|
||||
if (!match?.[1]) return null;
|
||||
try { return decodeURIComponent(match[1]); } catch { return null; }
|
||||
}
|
||||
export function resourceKind(path: string): ResourceKind | null { const base = basePath(path); if (projectDetailId(base)) return "projects"; if (connectorDetailId(base)) return null; return resourceRoutes[base] ?? null; }
|
||||
Reference in new issue
Block a user