apps/gateway/src/utils/workspace.ts
Metadata
- Purpose: Source artifact in the anchor-msp system.
- Domain:
applications - Language:
ts - Bytes: 514
- Lines: 16
- Content hash (short):
76ee535c - Source (start): apps/gateway/src/utils/workspace.ts:1
- Source (end): apps/gateway/src/utils/workspace.ts:16
Indexed Symbols
getWorkspaceIdFromHeaders(line 4, function) - Implements get workspace id from headers for module behavior.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { env } from "../config/env.js";
import { isUuid } from "./uuid.js";
export function getWorkspaceIdFromHeaders(headers: Record<string, unknown>): string {
const value = headers[env.workspaceHeader] ?? headers[env.workspaceHeader.toLowerCase()];
if (!value || typeof value !== "string") {
throw new Error(`Missing required workspace header: ${env.workspaceHeader}`);
}
if (!isUuid(value)) {
throw new Error(`Workspace header must be a UUID: ${env.workspaceHeader}`);
}
return value;
}