Socket
Socket
Sign inDemoInstall

rate-limiter-flexible

Package Overview
Dependencies
0
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.4 to 2.3.0

15

lib/component/BlockedKeys/BlockedKeys.js

@@ -60,2 +60,17 @@ module.exports = class BlockedKeys {

}
/**
* If key is not given, delete all data in memory
*
* @param {string|undefined} key
*/
delete(key) {
if (key) {
delete this._keys[key];
} else {
Object.keys(this._keys).forEach((key) => {
delete this._keys[key];
});
}
}
};

@@ -287,2 +287,3 @@ const RateLimiterAbstract = require('./RateLimiterAbstract');

.then((res) => {
this._inmemoryBlockedKeys.delete(rlKey);
resolve(res);

@@ -297,2 +298,9 @@ })

/**
* Cleanup keys no-matter expired or not.
*/
deleteInMemoryBlockedAll() {
this._inmemoryBlockedKeys.delete();
}
/**
* Get RateLimiterRes object filled depending on storeResult, which specific for exact store

@@ -361,2 +369,19 @@ *

}
/**
* Have to be implemented
* Resolve with object used for {@link _getRateLimiterRes} to generate {@link RateLimiterRes}
*
* @param {string} rlKey
* @param {number} points
* @param {number} msDuration
* @param {boolean} forceExpire
* @param {Object} options
* @abstract
*
* @return Promise<Object>
*/
_upsert() {
throw new Error("You have to implement the method '_upsert'!");
}
};

2

package.json
{
"name": "rate-limiter-flexible",
"version": "2.2.4",
"version": "2.3.0",
"description": "Node.js rate limiter by key and protection from DDoS and Brute-Force attacks in process Memory, Redis, MongoDb, Memcached, MySQL, PostgreSQL, Cluster or PM",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -187,2 +187,3 @@ [![Build Status](https://travis-ci.org/animir/node-rate-limiter-flexible.png)](https://travis-ci.org/animir/node-rate-limiter-flexible)

* [delete(key)](https://github.com/animir/node-rate-limiter-flexible/wiki/API-methods#ratelimiterdeletekey) Reset consumed points.
* [deleteInMemoryBlockedAll](https://github.com/animir/node-rate-limiter-flexible/wiki/API-methods#ratelimiterdeleteinmemoryblockedall)
* [penalty(key, points = 1)](https://github.com/animir/node-rate-limiter-flexible/wiki/API-methods#ratelimiterpenaltykey-points--1) Increase number of consumed points in current duration.

@@ -189,0 +190,0 @@ * [reward(key, points = 1)](https://github.com/animir/node-rate-limiter-flexible/wiki/API-methods#ratelimiterrewardkey-points--1) Decrease number of consumed points in current duration.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc