/** * Tenant Middleware * * Middleware for resolving and setting tenant context. */ import type { IsolationConfig, Tenant } from '../types/index.js'; import { TenantRequest } from '../context/resolver.js'; /** * Tenant lookup function type */ export type TenantLookup = (tenantId: string) => Promise; /** * Tenant middleware options */ export interface TenantMiddlewareOptions { /** Isolation config */ config: IsolationConfig; /** Function to lookup tenant by ID */ lookupTenant: TenantLookup; /** Called when tenant not found */ onTenantNotFound?: (tenantId: string) => void; /** Called when tenant is suspended */ onTenantSuspended?: (tenant: Tenant) => void; } /** * Create tenant middleware */ export declare function createTenantMiddleware(options: TenantMiddlewareOptions): (request: TenantRequest, next: () => Promise) => Promise; /** * Tenant not found error */ export declare class TenantNotFoundError extends Error { tenantId: string; constructor(tenantId: string); } /** * Tenant suspended error */ export declare class TenantSuspendedError extends Error { tenantId: string; constructor(tenantId: string); } /** * Tenant inactive error */ export declare class TenantInactiveError extends Error { tenantId: string; status: string; constructor(tenantId: string, status: string); } //# sourceMappingURL=tenant-middleware.d.ts.map