From debafb453707a327070311e556aaca43a78a9284 Mon Sep 17 00:00:00 2001 From: LaukikOnVictus <22937426+LRagji@users.noreply.github.com> Date: Mon, 30 Aug 2021 12:46:49 +0530 Subject: [PATCH] Fixed #5, replaced packages and npm audit is green ;) --- index.js | 6 ++--- package-lock.json | 56 +++++++++++++++++------------------------------ package.json | 4 ++-- readme.md | 4 ++-- 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/index.js b/index.js index 1012837..9a65ba1 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ -const shortid = require("shortid"); -const Scripto = require("redis-scripto"); +const _nonSecureId = require("nanoid/non-secure").nanoid; +const Scripto = require("redis-scripto2"); const path = require("path"); class StreamChannelBroker { @@ -43,7 +43,7 @@ class StreamChannelBroker { } } - async _subscribe(groupName, consumerName, handler, pollSpan = 1000, payloadsToFetch = 2, subscriptionHandle = shortid.generate(), readPending = false) { + async _subscribe(groupName, consumerName, handler, pollSpan = 1000, payloadsToFetch = 2, subscriptionHandle = _nonSecureId(), readPending = false) { const intervalHandle = setTimeout(async () => { try { const messages = await this._redisClient.xreadgroup("GROUP", groupName, consumerName, "BLOCK", pollSpan, "COUNT", payloadsToFetch, "STREAMS", this._channelName, (readPending === false ? ">" : "0")); diff --git a/package-lock.json b/package-lock.json index 3f2ee59..fd46998 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "redis-streams-broker", - "version": "0.0.10", + "version": "0.0.12", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -228,8 +228,7 @@ "denque": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==", - "dev": true + "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" }, "diff": { "version": "3.5.0", @@ -698,13 +697,12 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==" }, "node-environment-flags": { "version": "1.0.6", @@ -827,7 +825,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz", "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==", - "dev": true, "requires": { "denque": "^1.5.0", "redis-commands": "^1.7.0", @@ -838,42 +835,37 @@ "redis-commands": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", - "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==", - "dev": true + "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==" }, "redis-errors": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", - "integrity": "sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=", - "dev": true + "integrity": "sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=" }, "redis-parser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", "integrity": "sha1-tm2CjNyv5rS4pCin3vTGvKwxyLQ=", - "dev": true, "requires": { "redis-errors": "^1.0.0" } }, - "redis-scripto": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/redis-scripto/-/redis-scripto-0.1.3.tgz", - "integrity": "sha1-TRIcPA7X8HIGYSRyVbeRmIRd8ck=", + "redis-scripto2": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/redis-scripto2/-/redis-scripto2-0.2.2.tgz", + "integrity": "sha512-CACkbH6qdDdGG9tQHILc3wBgjp+zQTpYapO5vJY0iUnw7tGGsHEsxleYVtA+FF/1PmHEiNKUbDMSCquvJSGtbQ==", "requires": { - "debug": "0.7.x", - "redis": "0.8.x" + "debug": "^4.3.2", + "redis": "^3.1.2" }, "dependencies": { "debug": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=" - }, - "redis": { - "version": "0.8.6", - "resolved": "https://registry.npmjs.org/redis/-/redis-0.8.6.tgz", - "integrity": "sha1-p66PDW+tJL3q/+KBWNbNHxydMLg=" + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "requires": { + "ms": "2.1.2" + } } } }, @@ -901,14 +893,6 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, - "shortid": { - "version": "2.2.16", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", - "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", - "requires": { - "nanoid": "^2.1.0" - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", diff --git a/package.json b/package.json index 99d6108..0cf9373 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ }, "homepage": "https://github.com/LRagji/redis-streams-broker#readme", "dependencies": { - "redis-scripto": "^0.1.3", - "shortid": "^2.2.15" + "nanoid": "^3.1.25", + "redis-scripto2": "^0.2.2" }, "devDependencies": { "ioredis": "^4.26.0", diff --git a/readme.md b/readme.md index 3e4b349..0ca3742 100644 --- a/readme.md +++ b/readme.md @@ -69,8 +69,8 @@ const consumedMem = await broker.memoryFootprint(); ## Built with 1. Authors :heart for Open Source. -2. [shortid](https://www.npmjs.com/package/shortid) for auto generating subscribtion handles. -3. [redis-scripto](https://www.npmjs.com/package/redis-scripto) for handling lua scripts. +2. [nanoid](https://www.npmjs.com/package/nanoid#js) for auto generating subscribtion handles. +3. [redis-scripto2](https://www.npmjs.com/package/redis-scripto2) for handling lua scripts. ## Contributions