@epicdm/flowstate-domain-context
v1.0.7
Published
Domain context helpers for multi-tenant FlowState services.
Readme
@epicdm/flowstate-domain-context
Domain context helpers for multi-tenant FlowState services.
Provides lightweight utilities for extracting and validating x-domain-id, x-org-id, and x-workspace-id request headers, plus the domain-related error types that services can throw when required context is missing.
Installation
yarn add @epicdm/flowstate-domain-context
# or
npm install @epicdm/flowstate-domain-contextUsage
import {
requireDomainId,
sanitizeOrgId,
sanitizeWorkspaceId,
extractDomainFromHeaders,
extractOrgFromHeaders,
extractWorkspaceFromHeaders,
} from '@epicdm/flowstate-domain-context'
// Throws MissingDomainIdError if the header is absent
const domainId = extractDomainFromHeaders(request.headers)
// Optional context — returns undefined for 'default' or missing values
const orgId = extractOrgFromHeaders(request.headers)
const workspaceId = extractWorkspaceFromHeaders(request.headers)License
Apache-2.0 © Epic Digital Interactive Media LLC
