UNPKG

@iota-big3/sdk-gateway

Version:

Universal API Gateway with protocol translation, intelligent routing, rate limiting, health checking, and caching

55 lines 1.33 kB
/** * @iota-big3/sdk-gateway * Rate Limiter - Request rate limiting with configurable strategies * Phase 2g Implementation */ import { EventEmitter } from 'events'; import { GatewayRequest, RateLimiterConfig, RateLimiterMetrics, RateLimitResult } from '../types/gateway-types'; /** * Rate limiter implementation */ export declare class RateLimiter extends EventEmitter { private config; private store; private enabled; private metrics; private cleanupInterval?; constructor(config: RateLimiterConfig); /** * Check if request is within rate limit */ checkLimitAsync(request: Partial<GatewayRequest>): Promise<RateLimitResult>; /** * Increment key in store */ private incrementKeyAsync; /** * Reset limit for a specific key */ resetAsync(key: string): Promise<void>; /** * Clear all limits */ clearAsync(): Promise<void>; /** * Get current metrics */ getMetrics(): RateLimiterMetrics; /** * Enable rate limiting */ enable(): void; /** * Disable rate limiting */ disable(): void; /** * Check if rate limiting is enabled */ isEnabled(): boolean; /** * Destroy the rate limiter */ destroy(): void; } //# sourceMappingURL=rate-limiter.d.ts.map