/** * Rate Limiter Implementation * * Implements a sliding window rate limiter to control request rates */ export interface RateLimiterOptions { /** Maximum number of requests allowed in the time window */ maxRequests: number; /** Time window in milliseconds */ windowMs: number; /** Optional key generator function for identifying clients */ keyGenerator?: (identifier: string) => string; } export declare class RateLimiter { private records; private options; private cleanupInterval; constructor(options: RateLimiterOptions); /** * Check if a request should be allowed * @param identifier - Client identifier (e.g., IP address, session ID) * @returns Object with allowed status and retry information */ check(identifier: string): { allowed: boolean; remaining: number; resetTime: number; retryAfter?: number; }; /** * Reset rate limit for a specific identifier */ reset(identifier: string): void; /** * Clear all rate limit records */ clear(): void; destroy(): void; /** * Clean up expired records */ private cleanup; }