| Function | Signature | Description |
|---|
createTenantContext | (options) => TenantContext | Create a tenant context |
getCurrentTenant | (ctx: RequestContext) => TenantContext | null | Get current tenant from request context |
resolveTenant | (event, strategy) => TenantContext | Resolve tenant from request |
| Function | Signature | Description |
|---|
createTenantMiddleware | (options: { strategy: string }) => Middleware | Create tenant resolution middleware |
createQuotaMiddleware | (options?) => Middleware | Create quota enforcement middleware |
checkQuotas | (tenantId: string, quotas: Record<string, QuotaDef>) => Promise<void> | Check quotas programmatically |
Tenant-related types are exported from ./types/index.js, including tenant configuration, resolution strategies, quota definitions, and isolation settings.
Manages tenant context for the current request.
| Class | Status | Description |
|---|
TenantNotFoundError | 404 | Tenant could not be resolved |
TenantSuspendedError | 403 | Tenant is suspended |
TenantInactiveError | 403 | Tenant is inactive |
QuotaExceededError | 429 | Tenant quota exceeded |