import { OnModuleInit } from '@nestjs/common'; import { IRedisDriver } from '@nestjs-redisx/core'; import { IRateLimitResult } from '../../../shared/types'; import { IRateLimitStore } from '../../application/ports/rate-limit-store.port'; /** * Redis-based rate limit store implementation. * Uses Lua scripts for atomic operations. */ export declare class RedisRateLimitStoreAdapter implements IRateLimitStore, OnModuleInit { private readonly driver; private fixedWindowSha; private slidingWindowSha; private tokenBucketSha; constructor(driver: IRedisDriver); /** * Pre-load Lua scripts on module initialization. */ onModuleInit(): Promise; /** * Fixed window rate limiting. */ fixedWindow(key: string, points: number, duration: number): Promise; /** * Sliding window rate limiting. */ slidingWindow(key: string, points: number, duration: number): Promise; /** * Token bucket rate limiting. */ tokenBucket(key: string, capacity: number, refillRate: number, consume?: number): Promise; /** * Peek current state without consuming. * Note: This is a simplified implementation. * For accurate peek, we would need separate Lua scripts. */ peek(key: string, algorithm: string, config: Record): Promise; /** * Reset rate limit key. */ reset(key: string): Promise; /** * Parse fixed window script result. * Returns: {allowed, remaining, reset, current} */ private parseFixedWindowResult; /** * Parse sliding window script result. * Returns: {allowed, remaining, reset, current, retryAfter?} */ private parseSlidingWindowResult; /** * Parse token bucket script result. * Returns: {allowed, remaining, reset, current, retryAfter?} */ private parseTokenBucketResult; /** * Check if error is NOSCRIPT error. */ private isNoScriptError; } //# sourceMappingURL=redis-rate-limit-store.adapter.d.ts.map