/** * Quota Middleware * * Middleware for enforcing tenant quotas. */ import type { TenantQuotas } from '../types/index.js'; /** * Quota check function type */ export type QuotaCheck = (tenantId: string, quotaKey: string) => Promise<{ current: number; limit: number; }>; /** * Quota middleware options */ export interface QuotaMiddlewareOptions { /** Function to check current usage */ checkUsage: QuotaCheck; /** Quota key to check */ quotaKey: keyof TenantQuotas; /** Called when quota exceeded */ onQuotaExceeded?: (tenantId: string, current: number, limit: number) => void; } /** * Create quota enforcement middleware */ export declare function createQuotaMiddleware(options: QuotaMiddlewareOptions): (next: () => Promise) => Promise; /** * Quota exceeded error */ export declare class QuotaExceededError extends Error { tenantId: string; quotaKey: string; current: number; limit: number; constructor(tenantId: string, quotaKey: string, current: number, limit: number); } /** * Check multiple quotas at once */ export declare function checkQuotas(tenantId: string, quotas: TenantQuotas, checkUsage: QuotaCheck): Promise<{ key: string; current: number; limit: number; exceeded: boolean; }[]>; //# sourceMappingURL=quota-middleware.d.ts.map