import { type CacheStore } from '@nl-framework/core'; import type { CanActivate, GuardDecision, GuardFunction, HttpExecutionContext } from '../guards/types'; import { type ThrottleConfig } from './metadata'; export interface ThrottleGuardOptions { /** Backing store for request counts. Defaults to an in-memory store. */ store?: CacheStore; /** * Derive the client identity from the request context. Defaults to the first * hop of `x-forwarded-for`, then `x-real-ip`, then `'global'`. */ keyResolver?: (context: HttpExecutionContext) => string; /** Clock injection seam for testing window resets. Defaults to `Date.now`. */ now?: () => number; /** Fallback config applied to routes without an explicit `@Throttle`. Off by default. */ default?: ThrottleConfig; } /** * Fixed-window rate-limiting guard. Reads `@Throttle` config off the matched * route, counts requests per `throttle:{route}:{clientKey}:{window}` key in a * `CacheStore`, and returns a 429 with `Retry-After` once the limit is reached. */ export declare class ThrottleGuard implements CanActivate { private readonly store; private readonly keyResolver; private readonly now; private readonly fallback?; constructor(options?: ThrottleGuardOptions); canActivate(context: HttpExecutionContext): Promise; } /** * Build a configured throttle guard as a `GuardFunction`, ready to hand to * `registerHttpGuard` (global) or `@UseGuards`. A single guard instance (and its * store) is shared across all requests. * * ```ts * registerHttpGuard(createThrottleGuard({ default: { limit: 100, windowMs: 60_000 } })); * ``` */ export declare const createThrottleGuard: (options?: ThrottleGuardOptions) => GuardFunction; //# sourceMappingURL=throttle.guard.d.ts.map