import type { Request, Response, NextFunction } from 'express'; import type { IRateLimiterOptions } from 'rate-limiter-flexible'; import { RateLimiterCluster, RateLimiterMemory, RateLimiterRes } from 'rate-limiter-flexible'; import type { RequestExcludingInput } from '../validation/index.js'; export declare const createRateLimiter: (keyScope: string, opts: IRateLimiterOptions) => RateLimiterMemory | RateLimiterCluster | { consume: (key: string | number, pointsToConsume?: number | undefined, options?: { [key: string]: any; } | undefined) => Promise; penalty: (key: string | number, points?: number | undefined, options?: { [key: string]: any; } | undefined) => Promise; delete: (key: string | number, options?: { [key: string]: any; } | undefined) => Promise; }; export declare const getUserIDFromCreds: (req: Pick) => string; export type RateLimitKeyFn = (req: RequestExcludingInput, res: Response) => Resolvable; export type RateLimitKey = string | RateLimitKeyFn; export type RateLimitMiddleware = (req: RequestExcludingInput, res: Response, next: NextFunction) => Resolvable; export type PartialRateLimitMiddleware = (field?: RateLimitKey) => RateLimitMiddleware; export declare const createRateLimitMiddleware: (rateLimiter: ReturnType, keyOpts?: Parameters[1]) => PartialRateLimitMiddleware; /** * If 'field' is set, the middleware will apply the rate limit to requests * that originate from the same IP *and* have the same 'field'. * * If 'field' is not set, the rate limit will be applied to *all* requests * originating from a particular IP. */ declare const $createRateLimitMiddleware: (rateLimiter: ReturnType, { ignoreIP, allowReset, }?: { ignoreIP?: boolean; allowReset?: boolean; }, field?: RateLimitKey) => RateLimitMiddleware; export {};