/** * Wrap any limiter with a violation-count ban policy. When a caller * triggers `threshold` denials within `trackingWindow`, we bump them to * a hard ban for `banDuration` — subsequent `.check()` calls short-circuit * to denied without touching the base limiter. * * Sits nicely on top of a stricter-than-you-need limiter: the base * limiter catches ordinary abuse, `withBan` catches persistent abuse * cheaply (a single `store.get` per request while in the ban window, * no HMAC / no algorithm work). * * const limiter = rateLimit.withBan( * rateLimit.sliding({ requests: 20, window: '1m', store }), * { store, threshold: 5, banDuration: '1h' }, * ) * * State is written with the prefixes `bs:v:` (violation counter, * TTL = trackingWindow) and `bs:b:` (ban marker, TTL = banDuration). * You can share the base limiter's store or provide a dedicated one. * * @param {import('./index.js').Limiter} limiter * @param {{ * store: import('./index.js').RateLimitStore, * threshold: number, * banDuration: string | number, * trackingWindow?: string | number, * }} options * @returns {import('./index.js').Limiter} */ export function withBan(limiter: import("./index.js").Limiter, options: { store: import("./index.js").RateLimitStore; threshold: number; banDuration: string | number; trackingWindow?: string | number; }): import("./index.js").Limiter;