rate-limiter-flexible 6.2.0 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,8 +217,7 @@ class RateLimiterSQLite extends RateLimiterStoreAbstract {
217
217
  return res;
218
218
  }
219
219
 
220
- async _upsertTransactionSQLite3(upsertQuery, upsertParams) {
221
- const conn = await this._getConnection();
220
+ async _upsertTransactionSQLite3(conn, upsertQuery, upsertParams) {
222
221
  return await new Promise((resolve, reject) => {
223
222
  conn.serialize(() => {
224
223
  conn.run("SAVEPOINT rate_limiter_trx;", (err) => {
@@ -237,9 +236,7 @@ class RateLimiterSQLite extends RateLimiterStoreAbstract {
237
236
  });
238
237
  }
239
238
 
240
- async _upsertTransactionBetterSQLite3(upsertQuery, upsertParams) {
241
- const conn = await this._getConnection();
242
-
239
+ async _upsertTransactionBetterSQLite3(conn, upsertQuery, upsertParams) {
243
240
  return conn.transaction(() =>
244
241
  conn.prepare(upsertQuery).get(...upsertParams)
245
242
  )();
@@ -263,9 +260,14 @@ class RateLimiterSQLite extends RateLimiterStoreAbstract {
263
260
  try {
264
261
  switch (this._internalStoreType) {
265
262
  case "sqlite3":
266
- return this._upsertTransactionSQLite3(upsertQuery, upsertParams);
263
+ return this._upsertTransactionSQLite3(
264
+ conn,
265
+ upsertQuery,
266
+ upsertParams
267
+ );
267
268
  case "better-sqlite3":
268
269
  return this._upsertTransactionBetterSQLite3(
270
+ conn,
269
271
  upsertQuery,
270
272
  upsertParams
271
273
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rate-limiter-flexible",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "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
5
  "main": "index.js",
6
6
  "scripts": {
@@ -56,6 +56,7 @@
56
56
  "ioredis": "^5.3.2",
57
57
  "iovalkey": "^0.3.1",
58
58
  "istanbul": "^1.1.0-alpha.1",
59
+ "knex": "^3.1.0",
59
60
  "memcached-mock": "^0.1.0",
60
61
  "mocha": "^10.2.0",
61
62
  "nyc": "^15.1.0",