@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
23 lines • 1.04 kB
TypeScript
import type { FastifyRequest, FastifyReply, FastifyInstance } from "fastify";
export interface RateLimitOptions {
windowMs?: number;
max?: number;
message?: string;
statusCode?: number;
headers?: boolean;
skipSuccessfulRequests?: boolean;
skipFailedRequests?: boolean;
keyGenerator?: (req: FastifyRequest) => string;
}
export declare class RateLimiter {
private options;
private requests;
constructor(options: Required<RateLimitOptions>);
private getKey;
private isRateLimited;
middleware(): (request: FastifyRequest, reply: FastifyReply) => Promise<undefined>;
}
export declare function createRateLimitMiddleware(options?: RateLimitOptions): (request: FastifyRequest, reply: FastifyReply) => Promise<undefined>;
export declare function registerRateLimitPlugin(fastify: FastifyInstance, options?: RateLimitOptions): void;
export declare const rateLimitMiddleware: (request: FastifyRequest, reply: FastifyReply) => Promise<undefined>;
//# sourceMappingURL=rate.interceptor.d.ts.map