import { CanActivate, ExecutionContext } from '@nestjs/common'; import { HttpAdapterHost, Reflector } from '@nestjs/core'; import { IRateLimitPluginOptions } from '../../../shared/types'; import { IRateLimitService } from '../../application/ports/rate-limit-service.port'; interface IMetricsService { incrementCounter(name: string, labels?: Record, value?: number): void; } interface ISpan { setAttribute(key: string, value: unknown): this; addEvent(name: string, attributes?: Record): this; setStatus(status: 'OK' | 'ERROR'): this; recordException(error: Error): this; end(): void; } interface ITracingService { startSpan(name: string, options?: { kind?: string; attributes?: Record; }): ISpan; } /** * Rate limit guard. * Enforces rate limiting based on @RateLimit() decorator configuration. */ export declare class RateLimitGuard implements CanActivate { private readonly rateLimitService; private readonly config; private readonly reflector; private readonly adapterHost; private readonly metrics?; private readonly tracing?; constructor(rateLimitService: IRateLimitService, config: IRateLimitPluginOptions, reflector: Reflector, adapterHost: HttpAdapterHost, metrics?: IMetricsService | undefined, tracing?: ITracingService | undefined); /** * Guard activation logic. * Checks rate limit and sets response headers. */ canActivate(context: ExecutionContext): Promise; /** * Get rate limit options from decorator metadata. * Merges class-level and method-level options. */ private getOptions; /** * Extract rate limit key from context. */ private extractKey; /** * Get client IP address. */ private getClientIp; /** * Get user ID from request. */ private getUserId; /** * Get API key from request. */ private getApiKey; /** * Set response headers. */ private setHeaders; /** * Create error when rate limit exceeded. */ private createError; /** * Check if rate limiting should be skipped. */ private shouldSkip; } export {}; //# sourceMappingURL=rate-limit.guard.d.ts.map