Skip to content

Releases: animir/node-rate-limiter-flexible

Wrappers don't require points and duration options

03 Apr 17:06

Choose a tag to compare

What's Changed

  • #356 fix do not require points and duration options in wrappers by @animir in #357
  • RateLimiterCompatibleAbstract lightweight base class for custom wrappers
    Added a minimal abstract class that defines the core interface (consume, get, set, delete, penalty, reward, block, getKey) without requiring the full RateLimiterAbstract implementation. This makes it easy to build custom wrappers that work seamlessly with RateLimiterUnion, RLWrapperTimeouts, and insurance limiters.
  • Fixed RateLimiterStoreAbstract.set() incorrectly calling _block instead of _set
  • Fixed key parsing when keyPrefix is empty

[BREAKING CHANGES]
RLWrapperBlackAndWhite now extends RateLimiterCompatibleAbstract, and all union/wrapper/insurance classes accept both abstract types via a new isRateLimiterCompatible helper.

⏲️

Full Changelog: v10.0.1...v11.0.0

AI docs fix

15 Mar 09:38

Choose a tag to compare

Full Changelog: v10.0.0...v10.0.1

Require points and duration opts

14 Mar 10:56

Choose a tag to compare

What's Changed

[BREAKING CHANGES]

  • Require points and duration options by @animir in #354

    No default values are set for points and duration options starting from v10. Negative points will not be replaced by default points value 4.
    Validation rules apply.

    Error is thrown during limiter creation if points or duration is invalid:

    1. points must be number.

      Any limiter accepts negative points as valid option starting from v10. If you migrate from older version, be careful: If in your code points option is set to negative value and that works for your project now then you should review the logic in your project. After update to version 10, negative points value will not be replaced by 4 by default as it was prior to version 10.

      When your limiter has negative or zero points consume method call is always rejected since there is always not enough points to consume. You can set points to negative and play with reward and consume calls, that could be useful sometimes.

    2. duration must be non-negative number >= 0. Error is thrown during limiter creation if duration option has invalid value.

    Requiring points and duration seems logical for security package. We don't want our apps working not as we expect even if there is no security threat. This update removes uncertaincy about negative duration and zero points.

[OTHER UPDATES]

  • Faster memory limiter and block mechanism by @animir in #355

    Internal memory storage implementation refactored for Map with timestamps instead of Date objects.

    Memory limiter is faster on 10-15% now on high traffic with diverse keys. Tests show performance improvement from 2569948 ops/sec to 2885688 ops/sec on my laptop.

Full Changelog: v9.1.1...v10.0.0

🐚

Sequelize v7 support

07 Feb 15:59
7134440

Choose a tag to compare

What's Changed

🔔

Non atomic Redis limiter

01 Feb 16:20
4179826

Choose a tag to compare

What's Changed

  • Implement non atomic RateLimiterRedisNonAtomic by @animir in #345

💬

Fixes: Queue and DynamoDB

13 Dec 10:10

Choose a tag to compare

What's Changed

  • RateLimiterQueue: maxQueueSize default param when opts is set to {} by @sevauni in #340
  • RateLimiterDynamo: return null for expired keys in get() method by @anasdevv in #341

New Contributors

Full Changelog: v9.0.0...v9.0.1

📶

Mongoose 9 support

29 Nov 10:14
da73183

Choose a tag to compare

What's Changed

BREAKING CHANGES

  • Dropped support for MongoDB Native Driver version prior 4.0.0
  • Dropped support for Mongoose package version prior to 5.2.0

😋

Timeouts wrapper fixed

23 Nov 10:36

Choose a tag to compare

RLWrapperTimeouts can be imported from defaults:

import { RLWrapperTimeouts } from "rate-limiter-flexible";

Use it with or without insuranceLimiter to handle long requests to a storage.
Read more in docs.

Thank you @florian-schunk

💧

Fix Insurance Strategy

14 Nov 12:46

Choose a tag to compare

This patch reverts v8.2.0 changes. Timeouts Wrapper changed how Insurance Strategy treats rejected promises from working stores.

If you're on the version 8.2.0, please update to v8.2.1.
The impact of 8.2.0 changes is that when main limiter rejected consume or any other method call because there were not enough points on store, insurance limiter consume method was mistakenly called. This logic is incorrect as Insurance Strategy should handle only store errors.

Timeouts wrapper

09 Nov 12:38

Choose a tag to compare

Added a new RLWrapperTimeouts.
It can be used with or without insuranceLimiter to handle long requests to a storage.

Thanks to @florian-schunk .

✌️