Releases: ciscoheat/sveltekit-rate-limiter
Releases · ciscoheat/sveltekit-rate-limiter
v0.7.0
Added
- The
checkmethod now exists on both limiters, and will return areasonproperty. RateLimiterOptionsis now exported.- Package updates for Svelte 5 and general QOL improvements #18, thanks to screenfluent!
Fixed
- Fixed so invalid cookie data does not cause an infinite loop when
preflightisfalse.
v0.6.1
Added
- Plugins can now use an array of rates for the
rateproperty, so limits like "1 per secord, 100 per hour" can be set. - New limiters:
CloudflareIPRateLimiterandCloudflareIPUARateLimiterthat can be imported fromsveltekit-rate-limiter/limiters.
Changed
- The
RateLimiterStoreinterface now usesnumberas second parameter to theaddmethod.
v0.5.2
v0.5.0
Changed
- Plugins returning
nullweren't fully indeterminate: They will now limit the request only if no other limited have passed. As soon as another plugin passes, any subsequentnullresult 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
msrate 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.preflightis now async and must be awaited!- Cookie limiter options now takes a
serializeOptions, that can be used for customizing the cookie.
Added
hashFunctionoption, 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
clearmethod to the rate limiters.