import { IRateLimitPluginOptions, IRateLimitConfig, IRateLimitResetOptions, IRateLimitResult, IRateLimitState } from '../../../shared/types'; import { IRateLimitService } from '../ports/rate-limit-service.port'; import { IRateLimitStore } from '../ports/rate-limit-store.port'; /** * Rate limit service implementation. * Provides rate limiting operations with multiple algorithms over two * interchangeable stores: distributed (redis) and per-instance (memory). */ export declare class RateLimitService implements IRateLimitService { private readonly config; private readonly store; private readonly memoryStore?; constructor(config: IRateLimitPluginOptions, store: IRateLimitStore, memoryStore?: IRateLimitStore | undefined); /** * Check and consume rate limit. */ check(key: string, config?: IRateLimitConfig): Promise; /** * Check without consuming. */ peek(key: string, config?: IRateLimitConfig): Promise; /** * Reset rate limit for key. * Resets all algorithm variants (fixed-window, sliding-window, token-bucket). * With no store targeting, BOTH stores are swept: the service cannot know * which store a key was counted in. Memory-store resets are per-instance. */ reset(key: string, options?: IRateLimitResetOptions): Promise; /** * Get current state. */ getState(key: string, config?: IRateLimitConfig): Promise; /** * Resolve the store for a call: per-call override -> plugin default -> redis. * Configuration errors here are fail-fast (never subject to errorPolicy). */ private resolveStore; /** * Check fixed window rate limit. */ private checkFixedWindow; /** * Check sliding window rate limit. */ private checkSlidingWindow; /** * Check token bucket rate limit. */ private checkTokenBucket; /** * Build store configuration. */ private buildStoreConfig; /** * Handle error based on error policy. */ private handleError; /** * Build full key with prefix and algorithm. * Including algorithm prevents WRONGTYPE errors when different algorithms * use different Redis data types for the same logical key. */ private buildKey; } //# sourceMappingURL=rate-limit.service.d.ts.map