import { OnModuleDestroy } from '@nestjs/common'; /** * Token bucket rate limiter for email logs * Prevents email spam during error storms * * Similar pattern to CacheModule's LRUCacheProvider */ export declare class EmailLogRateLimiterService implements OnModuleDestroy { private readonly maxEmails; private readonly windowMs; private readonly burstSize; private readonly logger; private tokenBucket; private refillTimer; constructor(maxEmails: number, windowMs: number, burstSize: number); /** * Check if email should be sent based on rate limit * @param key - Rate limit key (e.g., 'error:global' or 'error:appname') * @returns true if allowed, false if rate limited */ canSend(key: string): boolean; /** * Get current state for monitoring/debugging */ getState(key: string): { tokens: number; lastRefill: number; } | undefined; /** * Reset rate limit for a key (admin function) */ reset(key: string): void; /** * Start periodic token refill * Refills all buckets every second to prevent token starvation */ private startRefillTimer; /** * Cleanup on module destroy */ onModuleDestroy(): void; }