import { ExecutionContext } from "@nestjs/common"; import { ThrottlerGuard, ThrottlerRequest } from "@nestjs/throttler"; import { FastifyRequest } from "fastify"; /** * Custom ThrottlerGuard that adds rate limit headers to responses. * * Headers added: * - X-RateLimit-Limit: Maximum number of requests allowed in the time window * - X-RateLimit-Remaining: Number of requests remaining in the current window * - X-RateLimit-Reset: Unix timestamp when the rate limit window resets * * Registered as a global APP_GUARD by the bootstrap app module factory when * `rateLimit.enabled` is true. Apps do not register it themselves. */ export declare class CustomThrottlerGuard extends ThrottlerGuard { protected getTracker(req: FastifyRequest): Promise; /** * Skip throttling for non-HTTP execution contexts. * * This guard is registered globally (APP_GUARD), so NestJS also runs it on * non-HTTP contexts such as necord Discord slash commands (context type * "necord"). Those contexts have no HTTP response object, so calling * `switchToHttp().getResponse().header(...)` in `handleRequest` throws * `TypeError: response.header is not a function` and, inside a Discord event * handler, crashes the worker with an unhandled 'error'. Rate-limit headers * only make sense for HTTP, so we skip everything else. */ protected shouldSkip(context: ExecutionContext): Promise; protected handleRequest(requestProps: ThrottlerRequest): Promise; } //# sourceMappingURL=custom-throttler.guard.d.ts.map