From f8a1be216f1c8903374a13ce935f8d04d6c22ecb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Jan 2023 16:45:24 +0000 Subject: [PATCH] chore: version packages --- .changeset/violet-islands-compare.md | 30 --------------------------- CHANGELOG.md | 31 ++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 .changeset/violet-islands-compare.md diff --git a/.changeset/violet-islands-compare.md b/.changeset/violet-islands-compare.md deleted file mode 100644 index 6cf2b9e9..00000000 --- a/.changeset/violet-islands-compare.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -'@nestjs/throttler': major ---- - -Rewrite the storage service to better handle large numbers of operations - -## Why - -The initial behavior was that `getRecord()` returned an list of sorted TTL -timestamps, then if it didn't reach the limit, it will call `addRecord()`. -This change was made based on the use of the Redis storage community package -where it was found how to prevent this issue. It was found out that -[express-rate-limit](https://github.com/express-rate-limit/express-rate-limit) -is incrementing a single number and returning the information in a single -roundtrip, which is significantly faster than how NestJS throttler works by -called `getRecord()`, then `addRecord`. - -## Breaking Changes - -- removed `getRecord` -- `addRecord(key: string, ttl: number): Promise;` changes to `increment(key: string, ttl: number): Promise;` - -## How to Migrate - -If you are just _using_ the throttler library, you're already covered. No -changes necessary to your code, version 4.0.0 will work as is. - -If you are providing a custom storage, you will need to remove your current -service's `getRecord` method and rename `addRecord` to `incremenet` while -adhering to the new interface and returning an `ThrottlerStorageRecord` object diff --git a/CHANGELOG.md b/CHANGELOG.md index e409fc9f..e4a92e00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,36 @@ # [2.0.0](https://github.com/nestjs/throttler/compare/v1.2.1...v2.0.0) (2021-07-09) +## 4.0.0 + +### Major Changes + +- 4803dda: Rewrite the storage service to better handle large numbers of operations + + ## Why + + The initial behavior was that `getRecord()` returned an list of sorted TTL + timestamps, then if it didn't reach the limit, it will call `addRecord()`. + This change was made based on the use of the Redis storage community package + where it was found how to prevent this issue. It was found out that + [express-rate-limit](https://github.com/express-rate-limit/express-rate-limit) + is incrementing a single number and returning the information in a single + roundtrip, which is significantly faster than how NestJS throttler works by + called `getRecord()`, then `addRecord`. + + ## Breaking Changes + + - removed `getRecord` + - `addRecord(key: string, ttl: number): Promise;` changes to `increment(key: string, ttl: number): Promise;` + + ## How to Migrate + + If you are just _using_ the throttler library, you're already covered. No + changes necessary to your code, version 4.0.0 will work as is. + + If you are providing a custom storage, you will need to remove your current + service's `getRecord` method and rename `addRecord` to `incremenet` while + adhering to the new interface and returning an `ThrottlerStorageRecord` object + ## 3.1.0 ### Minor Changes diff --git a/package.json b/package.json index 368ce6ff..d22667ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nestjs/throttler", - "version": "3.1.0", + "version": "4.0.0", "description": "A Rate-Limiting module for NestJS to work on Express, Fastify, Websockets, Socket.IO, and GraphQL, all rolled up into a simple package.", "author": "Jay McDoniel ", "contributors": [],