UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

31 lines 1.29 kB
import { LucidHonoContext, LucidHonoGeneric } from "../../../types/hono.mjs"; //#region src/libs/http/middleware/rate-limiter.d.ts type RateLimitMode = "ip" | "user" | "client"; type RateLimitOptions = { /** * What to use as the rate limit key * - "ip": Client IP address (default) * - "user": Authenticated user ID * - "client": Client integration ID */ mode: RateLimitMode; /** Time window in milliseconds */ windowMs: number; /** Maximum number of requests allowed within the window */ limit: number; /** * Scope for the rate limit. Creates separate rate limit groups per scope value. Useful for per-route or per-action limits. */ scope?: string | ((c: LucidHonoContext) => string | Promise<string>); /** * Custom key generator function. Takes precedence over mode and scope. */ keyGenerator?: (c: LucidHonoContext) => string | Promise<string>; /** * Function to skip rate limiting for certain requests. * Return true to bypass rate limiting. */ skip?: (c: LucidHonoContext) => boolean | Promise<boolean>; }; declare const rateLimiter: (options: RateLimitOptions) => import("hono").MiddlewareHandler<LucidHonoGeneric, any, {}, Response>; //#endregion export { rateLimiter as default }; //# sourceMappingURL=rate-limiter.d.mts.map