Releases: ciscoheat/sveltekit-rate-limiter
Releases · ciscoheat/sveltekit-rate-limiter
v0.6.1
Added
- Plugins can now use an array of rates for the
rate
property, so limits like "1 per secord, 100 per hour" can be set. - New limiters:
CloudflareIPRateLimiter
andCloudflareIPUARateLimiter
that can be imported fromsveltekit-rate-limiter/limiters
.
Changed
- The
RateLimiterStore
interface now usesnumber
as second parameter to theadd
method.
v0.5.2
v0.5.0
Changed
- Plugins returning
null
weren't fully indeterminate: They will now limit the request only if no other limited have passed. As soon as another plugin passes, any subsequentnull
result will pass (for the current request).
Added
- Added "extra data" type parameter for the rate limiter, so plugins can be provided information outside the request event. See README for an example.
v0.4.3
Changed
- The "rates" object options (
IP
,IPUA
,cookie
) should now be set in the top of the configuration forRateLimiter
, no need for a nested object. - Deprecated the
ms
rate unit, it's not reliable due to OS timing issues.
Added
- Added more units for milliseconds and seconds.
v0.4.2
v0.4.1
v0.4.0
Changed
limiter.preflight
is now async and must be awaited!- Cookie limiter options now takes a
serializeOptions
, that can be used for customizing the cookie.
Added
hashFunction
option, for custom hashing. Defaults to Web Crypto API SHA-256, will fallback to NodeJS crypto if not available.
Fixed
- Hash function is now compatible any environment that supports Web Crypto API, including Cloudflare workers.
v0.3.5
Added
- Added a
RetryAfterRateLimiter
, that provides information for setting a Retry-After header. - Added
clear
method to the rate limiters.