From 7983dd4c269997ff288de5a67896170be54997cc Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 2 Sep 2021 11:12:55 -0400 Subject: [PATCH 01/40] update workflows & README --- .github/workflows/benchmark.yml | 3 ++- .github/workflows/documentation.yml | 3 ++- .github/workflows/tests.yml | 3 ++- README.md | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b6e5802a914..2df438eb19c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -3,7 +3,8 @@ name: Benchmark on: push: branches: - - v4 + - master + - v4.0 jobs: benchmark: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 16ca16b5608..9575d4639b9 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,7 +3,8 @@ name: Documentation on: push: branches: - - v4 + - master + - v4.0 jobs: documentation: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 028600f1a17..557d4f452dc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,8 @@ name: Tests on: push: branches: - - v4 + - master + - v4.0 jobs: tests: diff --git a/README.md b/README.md index acc229b69c2..db0fa71cc7f 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@

- - Coverage Status + + Coverage Status Downloads From e421dc4bed75ae50eac927103b5254780e7d8994 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 2 Sep 2021 11:20:57 -0400 Subject: [PATCH 02/40] add .deepsource.toml --- .deepsource.toml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 00000000000..72aefc7b07a --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,9 @@ +version = 1 + +[[analyzers]] +name = "javascript" +enabled = true + + [analyzers.meta] + environment = ["nodejs"] + dialect = "typescript" From b80afc6346ab51a77123a5e3f59bd06524a0e02e Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 2 Sep 2021 14:00:52 -0400 Subject: [PATCH 03/40] fix client.quit, add error events on cluster, fix some "deepsource.io" warnings --- lib/client.ts | 5 +- lib/cluster-slots.ts | 43 ++++------- lib/cluster.ts | 7 +- lib/commander.ts | 4 +- lib/commands-queue.ts | 13 +++- lib/commands/MIGRATE.ts | 2 +- lib/commands/generic-transformers.spec.ts | 1 - package-lock.json | 94 +++++++++++------------ package.json | 2 +- 9 files changed, 86 insertions(+), 85 deletions(-) diff --git a/lib/client.ts b/lib/client.ts index a8da7f5ddd5..ed06317c14c 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -298,9 +298,10 @@ export default class RedisClient { - return this.#socket.quit(async () => { - this.#queue.addEncodedCommand(encodeCommand(['QUIT'])); + return this.#socket.quit(() => { + const promise = this.#queue.addEncodedCommand(encodeCommand(['QUIT'])); this.#tick(); + return promise; }); } diff --git a/lib/cluster-slots.ts b/lib/cluster-slots.ts index 3e255fc2a66..5fae5b92342 100644 --- a/lib/cluster-slots.ts +++ b/lib/cluster-slots.ts @@ -17,54 +17,40 @@ interface SlotNodes { clientIterator: IterableIterator> | undefined; } +type OnError = (err: unknown) => void; + export default class RedisClusterSlots { readonly #options: RedisClusterOptions; + readonly #onError: OnError; readonly #nodeByUrl = new Map>(); readonly #slots: Array> = []; - constructor(options: RedisClusterOptions) { + constructor(options: RedisClusterOptions, onError: OnError) { this.#options = options; + this.#onError = onError; } async connect(): Promise { for (const rootNode of this.#options.rootNodes) { - try { - await this.#discoverNodes(rootNode); - return; - } catch (err) { - console.error(err); - // this.emit('error', err); - } + if (await this.#discoverNodes(rootNode)) return; } throw new Error('None of the root nodes is available'); } async discover(startWith: RedisClientType): Promise { - try { - await this.#discoverNodes(startWith.options?.socket); - return; - } catch (err) { - console.error(err); - // this.emit('error', err); - } + if (await this.#discoverNodes(startWith.options?.socket)) return; for (const { client } of this.#nodeByUrl.values()) { if (client === startWith) continue; - - try { - await this.#discoverNodes(client.options?.socket); - return; - } catch (err) { - console.error(err); - // this.emit('error', err); - } + + if (await this.#discoverNodes(client.options?.socket)) return; } throw new Error('None of the cluster nodes is available'); } - async #discoverNodes(socketOptions?: RedisSocketOptions): Promise { + async #discoverNodes(socketOptions?: RedisSocketOptions): Promise { const client = RedisClient.create({ socket: socketOptions }); @@ -73,8 +59,14 @@ export default class RedisClusterSlots { rootNodes: Array; @@ -17,7 +18,7 @@ export interface RedisClusterOptions { export type RedisClusterType = WithPlugins & RedisCluster; -export default class RedisCluster { +export default class RedisCluster extends EventEmitter { static #extractFirstKey(command: RedisCommand, originalArgs: Array, redisArgs: Array): string | undefined { if (command.FIRST_KEY_INDEX === undefined) { return undefined; @@ -83,8 +84,10 @@ export default class RedisCluster) => RedisMultiCommandType; constructor(options: RedisClusterOptions) { + super(); + this.#options = options; - this.#slots = new RedisClusterSlots(options); + this.#slots = new RedisClusterSlots(options, err => this.emit('error', err)); this.#Multi = RedisMultiCommand.extend(options); } diff --git a/lib/commander.ts b/lib/commander.ts index 51adc417ba9..e8ff91cc7bf 100644 --- a/lib/commander.ts +++ b/lib/commander.ts @@ -97,12 +97,12 @@ export function transformCommandArguments( export function encodeCommand(args: Array): string { const encoded = [ `*${args.length}`, - `$${Buffer.byteLength(args[0])}`, + `$${Buffer.byteLength(args[0]).toString()}`, args[0] ]; for (let i = 1; i < args.length; i++) { - encoded.push(`$${Buffer.byteLength(args[i])}`, args[i]); + encoded.push(`$${Buffer.byteLength(args[i]).toString()}`, args[i]); } return encoded.join('\r\n') + '\r\n'; diff --git a/lib/commands-queue.ts b/lib/commands-queue.ts index 1890e0a00a9..cae3fd6130e 100644 --- a/lib/commands-queue.ts +++ b/lib/commands-queue.ts @@ -12,6 +12,7 @@ export interface QueueCommandOptions { interface CommandWaitingToBeSent extends CommandWaitingForReply { encodedCommand: string; + byteLength: number; chainId?: symbol; abort?: { signal: any; // TODO: `AbortSignal` type is incorrect @@ -130,6 +131,7 @@ export default class RedisCommandsQueue { return new Promise((resolve, reject) => { const node = new LinkedList.Node({ encodedCommand, + byteLength: Buffer.byteLength(encodedCommand), chainId: options?.chainId, resolve, reject @@ -156,7 +158,7 @@ export default class RedisCommandsQueue { this.#waitingToBeSent.pushNode(node); } - this.#waitingToBeSentCommandsLength += encodedCommand.length; + this.#waitingToBeSentCommandsLength += node.value.byteLength; }); } @@ -230,8 +232,12 @@ export default class RedisCommandsQueue { } this.#pubSubState[inProgressKey] += channelsCounter; + + const encodedCommand = encodeCommand(commandArgs), + byteLength = Buffer.byteLength(encodedCommand); this.#waitingToBeSent.push({ - encodedCommand: encodeCommand(commandArgs), + encodedCommand, + byteLength, channelsCounter, resolve: () => { this.#pubSubState[inProgressKey] -= channelsCounter; @@ -243,6 +249,7 @@ export default class RedisCommandsQueue { reject(); } }); + this.#waitingToBeSentCommandsLength += byteLength; }); } @@ -268,7 +275,7 @@ export default class RedisCommandsQueue { lastCommandChainId: symbol | undefined; for (const command of this.#waitingToBeSent) { encoded.push(command.encodedCommand); - size += command.encodedCommand.length; + size += command.byteLength; if (size > recommendedSize) { lastCommandChainId = command.chainId; break; diff --git a/lib/commands/MIGRATE.ts b/lib/commands/MIGRATE.ts index 1d2fc075efe..14dbe741be2 100644 --- a/lib/commands/MIGRATE.ts +++ b/lib/commands/MIGRATE.ts @@ -19,7 +19,7 @@ export function transformArguments( isKeyString = typeof key === 'string'; if (isKeyString) { - args.push(key as string); + args.push(key); } else { args.push('""'); } diff --git a/lib/commands/generic-transformers.spec.ts b/lib/commands/generic-transformers.spec.ts index 5335255f910..9ac72bb1b25 100644 --- a/lib/commands/generic-transformers.spec.ts +++ b/lib/commands/generic-transformers.spec.ts @@ -1,5 +1,4 @@ import { strict as assert } from 'assert'; -import { isObject } from 'util'; import { transformReplyBoolean, transformReplyBooleanArray, diff --git a/package-lock.json b/package-lock.json index 3b7397b61e4..cb1132ddb21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.7.8", + "@types/node": "^16.7.10", "@types/sinon": "^10.0.2", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", @@ -642,9 +642,9 @@ } }, "node_modules/@octokit/graphql": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.7.0.tgz", - "integrity": "sha512-diY0qMPyQjfu4rDu3kDhJ9qIZadIm4IISO3RJSv9ajYUWJUCO0AykbgzLcg1xclxtXgzY583u3gAv66M6zz5SA==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", + "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", "dev": true, "dependencies": { "@octokit/request": "^5.6.0", @@ -653,18 +653,18 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-9.7.0.tgz", - "integrity": "sha512-TUJ16DJU8mekne6+KVcMV5g6g/rJlrnIKn7aALG9QrNpnEipFc1xjoarh0PKaAWf2Hf+HwthRKYt+9mCm5RsRg==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.0.0.tgz", + "integrity": "sha512-k1iO2zKuEjjRS1EJb4FwSLk+iF6EGp+ZV0OMRViQoWhQ1fZTk9hg1xccZII5uyYoiqcbC73MRBmT45y1vp2PPg==", "dev": true }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.15.1.tgz", - "integrity": "sha512-47r52KkhQDkmvUKZqXzA1lKvcyJEfYh3TKAIe5+EzMeyDM3d+/s5v11i2gTk8/n6No6DPi3k5Ind6wtDbo/AEg==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz", + "integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==", "dev": true, "dependencies": { - "@octokit/types": "^6.24.0" + "@octokit/types": "^6.26.0" }, "peerDependencies": { "@octokit/core": ">=2" @@ -730,12 +730,12 @@ } }, "node_modules/@octokit/types": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.25.0.tgz", - "integrity": "sha512-bNvyQKfngvAd/08COlYIN54nRgxskmejgywodizQNyiKoXmWRAjKup2/LYwm+T9V0gsKH6tuld1gM0PzmOiB4Q==", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.26.0.tgz", + "integrity": "sha512-RDxZBAFMtqs1ZPnbUu1e7ohPNfoNhTiep4fErY7tZs995BeHu369Vsh5woMIaFbllRWEZBfvTCS4hvDnMPiHrA==", "dev": true, "dependencies": { - "@octokit/openapi-types": "^9.5.0" + "@octokit/openapi-types": "^10.0.0" } }, "node_modules/@sindresorhus/is": { @@ -855,9 +855,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.7.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.8.tgz", - "integrity": "sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg==", + "version": "16.7.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", + "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==", "dev": true }, "node_modules/@types/parse-json": { @@ -1845,9 +1845,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.822", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.822.tgz", - "integrity": "sha512-k7jG5oYYHxF4jx6PcqwHX3JVME/OjzolqOZiIogi9xtsfsmTjTdie4x88OakYFPEa8euciTgCCzvVNwvmjHb1Q==", + "version": "1.3.827", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", + "integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==", "dev": true }, "node_modules/emoji-regex": { @@ -4773,9 +4773,9 @@ } }, "node_modules/shiki": { - "version": "0.9.8", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.8.tgz", - "integrity": "sha512-499zQUTjcNTVwwiaPrWldUTXIV3T9HZWxDwE82bY+9GE7P2uD6hpHUTXNbTof3iOG6WT+/062+OMbl0lDoG8WQ==", + "version": "0.9.10", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", + "integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", "dev": true, "dependencies": { "json5": "^2.2.0", @@ -6164,9 +6164,9 @@ } }, "@octokit/graphql": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.7.0.tgz", - "integrity": "sha512-diY0qMPyQjfu4rDu3kDhJ9qIZadIm4IISO3RJSv9ajYUWJUCO0AykbgzLcg1xclxtXgzY583u3gAv66M6zz5SA==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", + "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", "dev": true, "requires": { "@octokit/request": "^5.6.0", @@ -6175,18 +6175,18 @@ } }, "@octokit/openapi-types": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-9.7.0.tgz", - "integrity": "sha512-TUJ16DJU8mekne6+KVcMV5g6g/rJlrnIKn7aALG9QrNpnEipFc1xjoarh0PKaAWf2Hf+HwthRKYt+9mCm5RsRg==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.0.0.tgz", + "integrity": "sha512-k1iO2zKuEjjRS1EJb4FwSLk+iF6EGp+ZV0OMRViQoWhQ1fZTk9hg1xccZII5uyYoiqcbC73MRBmT45y1vp2PPg==", "dev": true }, "@octokit/plugin-paginate-rest": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.15.1.tgz", - "integrity": "sha512-47r52KkhQDkmvUKZqXzA1lKvcyJEfYh3TKAIe5+EzMeyDM3d+/s5v11i2gTk8/n6No6DPi3k5Ind6wtDbo/AEg==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz", + "integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==", "dev": true, "requires": { - "@octokit/types": "^6.24.0" + "@octokit/types": "^6.26.0" } }, "@octokit/plugin-request-log": { @@ -6244,12 +6244,12 @@ } }, "@octokit/types": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.25.0.tgz", - "integrity": "sha512-bNvyQKfngvAd/08COlYIN54nRgxskmejgywodizQNyiKoXmWRAjKup2/LYwm+T9V0gsKH6tuld1gM0PzmOiB4Q==", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.26.0.tgz", + "integrity": "sha512-RDxZBAFMtqs1ZPnbUu1e7ohPNfoNhTiep4fErY7tZs995BeHu369Vsh5woMIaFbllRWEZBfvTCS4hvDnMPiHrA==", "dev": true, "requires": { - "@octokit/openapi-types": "^9.5.0" + "@octokit/openapi-types": "^10.0.0" } }, "@sindresorhus/is": { @@ -6360,9 +6360,9 @@ "dev": true }, "@types/node": { - "version": "16.7.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.8.tgz", - "integrity": "sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg==", + "version": "16.7.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", + "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==", "dev": true }, "@types/parse-json": { @@ -7108,9 +7108,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.822", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.822.tgz", - "integrity": "sha512-k7jG5oYYHxF4jx6PcqwHX3JVME/OjzolqOZiIogi9xtsfsmTjTdie4x88OakYFPEa8euciTgCCzvVNwvmjHb1Q==", + "version": "1.3.827", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", + "integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==", "dev": true }, "emoji-regex": { @@ -9284,9 +9284,9 @@ } }, "shiki": { - "version": "0.9.8", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.8.tgz", - "integrity": "sha512-499zQUTjcNTVwwiaPrWldUTXIV3T9HZWxDwE82bY+9GE7P2uD6hpHUTXNbTof3iOG6WT+/062+OMbl0lDoG8WQ==", + "version": "0.9.10", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", + "integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", "dev": true, "requires": { "json5": "^2.2.0", diff --git a/package.json b/package.json index fd309d970f6..32cf674a4d2 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.7.8", + "@types/node": "^16.7.10", "@types/sinon": "^10.0.2", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", From 18ad329ccc2950b5481109367594d72ecaeecf27 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 6 Sep 2021 15:59:52 -0400 Subject: [PATCH 04/40] Release 4.0.0-rc.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index cb1132ddb21..ac623c60e6a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "redis", - "version": "4.0.0-rc.0", + "version": "4.0.0-rc.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redis", - "version": "4.0.0-rc.0", + "version": "4.0.0-rc.1", "license": "MIT", "dependencies": { "cluster-key-slot": "1.1.0", diff --git a/package.json b/package.json index 32cf674a4d2..56a7ed38c65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redis", - "version": "4.0.0-rc.0", + "version": "4.0.0-rc.1", "description": "A high performance Redis client.", "keywords": [ "database", From 1413a69a6b75253b606ffd211f7f119ec5337894 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 9 Sep 2021 16:58:31 -0400 Subject: [PATCH 05/40] add cluster.duplicate, add some tests --- lib/client.ts | 2 +- lib/cluster.ts | 4 +++ lib/commands/GEOPOS.spec.ts | 50 +++++++++++++++++++++++++---- lib/commands/GEOSEARCHSTORE.spec.ts | 9 +++++- lib/commands/PUBSUB_NUMSUB.spec.ts | 2 +- 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/lib/client.ts b/lib/client.ts index ed06317c14c..139ec647fc3 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -184,7 +184,7 @@ export default class RedisClient this.#socket.write(encodedCommands) + encodedCommands => this.#socket.write(encodedCommands) ); } diff --git a/lib/cluster.ts b/lib/cluster.ts index 2c1b23465ee..3eeaed5009f 100644 --- a/lib/cluster.ts +++ b/lib/cluster.ts @@ -91,6 +91,10 @@ export default class RedisCluster { + return new (Object.getPrototypeOf(this).constructor)(this.#options); + } + async connect(): Promise { return this.#slots.connect(); } diff --git a/lib/commands/GEOPOS.spec.ts b/lib/commands/GEOPOS.spec.ts index 98cfa6aa2d3..e15abeff516 100644 --- a/lib/commands/GEOPOS.spec.ts +++ b/lib/commands/GEOPOS.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; -import { transformArguments } from './GEOPOS'; +import { transformArguments, transformReply } from './GEOPOS'; describe('GEOPOS', () => { describe('transformArguments', () => { @@ -19,11 +19,49 @@ describe('GEOPOS', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.geoPos', async client => { - assert.deepEqual( - await client.geoPos('key', 'member'), - [null] - ); + describe('transformReply', () => { + it('null', () => { + assert.deepEqual( + transformReply([null]), + [null] + ); + }); + + it('with member', () => { + assert.deepEqual( + transformReply([['1', '2']]), + [{ + longitude: '1', + latitude: '2' + }] + ); + }); + }); + + describe('client.geoPos', () => { + itWithClient(TestRedisServers.OPEN, 'null', async client => { + assert.deepEqual( + await client.geoPos('key', 'member'), + [null] + ); + }); + + itWithClient(TestRedisServers.OPEN, 'with member', async client => { + const coordinates = { + longitude: '-122.06429868936538696', + latitude: '37.37749628831998194' + }; + + await client.geoAdd('key', { + member: 'member', + ...coordinates + }); + + assert.deepEqual( + await client.geoPos('key', 'member'), + [coordinates] + ); + }); }); itWithCluster(TestRedisClusters.OPEN, 'cluster.geoPos', async cluster => { diff --git a/lib/commands/GEOSEARCHSTORE.spec.ts b/lib/commands/GEOSEARCHSTORE.spec.ts index 1983537077c..ad33c62b78c 100644 --- a/lib/commands/GEOSEARCHSTORE.spec.ts +++ b/lib/commands/GEOSEARCHSTORE.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; -import { transformArguments } from './GEOSEARCHSTORE'; +import { transformArguments, transformReply } from './GEOSEARCHSTORE'; describe('GEOSEARCHSTORE', () => { describeHandleMinimumRedisVersion([6, 2]); @@ -40,6 +40,13 @@ describe('GEOSEARCHSTORE', () => { }); }); + it('transformReply with empty array (https://github.com/redis/redis/issues/9261)', () => { + assert.throws( + () => (transformReply as any)([]), + TypeError + ); + }); + itWithClient(TestRedisServers.OPEN, 'client.geoSearchStore', async client => { await client.geoAdd('source', { longitude: 1, diff --git a/lib/commands/PUBSUB_NUMSUB.spec.ts b/lib/commands/PUBSUB_NUMSUB.spec.ts index 74065dbb48f..403732f8f9d 100644 --- a/lib/commands/PUBSUB_NUMSUB.spec.ts +++ b/lib/commands/PUBSUB_NUMSUB.spec.ts @@ -33,7 +33,7 @@ describe('PUBSUB NUMSUB', () => { ); }); - itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubNumPat', async cluster => { + itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubNumSub', async cluster => { assert.deepEqual( await cluster.pubSubNumSub(), Object.create(null) From 08837c864801558ad8020278ad75a3b14a2ed560 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 13 Sep 2021 19:49:39 -0400 Subject: [PATCH 06/40] fix #1650 - add support for Buffer in some commands, add GET_BUFFER command --- lib/client.spec.ts | 7 ++ lib/client.ts | 94 ++++++++++------------- lib/cluster-slots.ts | 2 +- lib/cluster.ts | 29 +++---- lib/commander.spec.ts | 22 +++++- lib/commander.ts | 20 ++--- lib/commands-queue.ts | 80 +++++-------------- lib/commands/ACL_DELUSER.ts | 3 +- lib/commands/ACL_SETUSER.ts | 3 +- lib/commands/BITOP.ts | 3 +- lib/commands/BLPOP.ts | 3 +- lib/commands/BRPOP.ts | 3 +- lib/commands/BZPOPMAX.ts | 3 +- lib/commands/BZPOPMIN.ts | 3 +- lib/commands/DEL.ts | 3 +- lib/commands/EXISTS.ts | 3 +- lib/commands/GEOHASH.ts | 3 +- lib/commands/GEOPOS.ts | 3 +- lib/commands/GET.ts | 3 +- lib/commands/GET_BUFFER.spec.ts | 22 ++++++ lib/commands/GET_BUFFER.ts | 7 ++ lib/commands/HDEL.ts | 3 +- lib/commands/HMGET.ts | 3 +- lib/commands/LPUSH.ts | 3 +- lib/commands/LPUSHX.ts | 3 +- lib/commands/PFADD.ts | 3 +- lib/commands/PFCOUNT.ts | 3 +- lib/commands/PFMERGE.ts | 3 +- lib/commands/RPUSH.ts | 3 +- lib/commands/RPUSHX.ts | 3 +- lib/commands/SADD.ts | 3 +- lib/commands/SCRIPT_EXISTS.ts | 3 +- lib/commands/SDIFF.ts | 3 +- lib/commands/SDIFFSTORE.ts | 3 +- lib/commands/SET.spec.ts | 2 +- lib/commands/SET.ts | 4 +- lib/commands/SETEX.ts | 3 +- lib/commands/SINTER.ts | 3 +- lib/commands/SINTERSTORE.ts | 3 +- lib/commands/SREM.ts | 3 +- lib/commands/SUNION.ts | 3 +- lib/commands/SUNIONSTORE.ts | 3 +- lib/commands/TOUCH.ts | 3 +- lib/commands/UNLINK.ts | 3 +- lib/commands/WATCH.ts | 3 +- lib/commands/XACK.ts | 3 +- lib/commands/XDEL.ts | 3 +- lib/commands/ZDIFF.ts | 3 +- lib/commands/ZDIFFSTORE.ts | 3 +- lib/commands/ZDIFF_WITHSCORES.ts | 3 +- lib/commands/ZINTER.ts | 3 +- lib/commands/ZINTERSTORE.ts | 3 +- lib/commands/ZINTER_WITHSCORES.ts | 3 +- lib/commands/ZMSCORE.ts | 3 +- lib/commands/ZREM.ts | 3 +- lib/commands/ZUNION.ts | 3 +- lib/commands/ZUNIONSTORE.ts | 3 +- lib/commands/ZUNION_WITHSCORES.ts | 3 +- lib/commands/generic-transformers.ts | 12 ++- lib/commands/index.ts | 10 ++- lib/multi-command.spec.ts | 23 +++--- lib/multi-command.ts | 20 +++-- lib/socket.ts | 28 +++++-- lib/ts-declarations/cluster-key-slot.d.ts | 2 +- lib/ts-declarations/redis-parser.d.ts | 2 + 65 files changed, 300 insertions(+), 227 deletions(-) create mode 100644 lib/commands/GET_BUFFER.spec.ts create mode 100644 lib/commands/GET_BUFFER.ts diff --git a/lib/client.spec.ts b/lib/client.spec.ts index f73049d2286..9f18e184c88 100644 --- a/lib/client.spec.ts +++ b/lib/client.spec.ts @@ -195,6 +195,13 @@ describe('Client', () => { assert.equal(await client.sendCommand(['PING']), 'PONG'); }); + itWithClient(TestRedisServers.OPEN, 'bufferMode', async client => { + assert.deepEqual( + await client.sendCommand(['PING'], undefined, true), + Buffer.from('PONG') + ); + }); + describe('AbortController', () => { before(function () { if (!global.AbortController) { diff --git a/lib/client.ts b/lib/client.ts index 139ec647fc3..aaa982da1cc 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -1,6 +1,6 @@ import RedisSocket, { RedisSocketOptions } from './socket'; import RedisCommandsQueue, { PubSubListener, PubSubSubscribeCommands, PubSubUnsubscribeCommands, QueueCommandOptions } from './commands-queue'; -import COMMANDS from './commands'; +import COMMANDS, { TransformArgumentsReply } from './commands'; import { RedisCommand, RedisModules, RedisReply } from './commands'; import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; import EventEmitter from 'events'; @@ -62,12 +62,10 @@ export default class RedisClient> { const { args: redisArgs, options } = transformCommandArguments(command, args); - const reply = command.transformReply( - await this.#sendCommand(redisArgs, options), - redisArgs.preserve + return command.transformReply( + await this.#sendCommand(redisArgs, options, command.BUFFER_MODE), + redisArgs.preserve, ); - - return reply; } static async #scriptsExecutor( @@ -77,12 +75,10 @@ export default class RedisClient { const { args: redisArgs, options } = transformCommandArguments(script, args); - const reply = script.transformReply( - await this.executeScript(script, redisArgs, options), + return script.transformReply( + await this.executeScript(script, redisArgs, options, script.BUFFER_MODE), redisArgs.preserve ); - - return reply; } static create(options?: RedisClientOptions): RedisClientType { @@ -182,10 +178,7 @@ export default class RedisClient this.#socket.write(encodedCommands) - ); + return new RedisCommandsQueue(this.#options?.commandsQueueMaxLength); } #legacyMode(): void { @@ -299,7 +292,7 @@ export default class RedisClient { return this.#socket.quit(() => { - const promise = this.#queue.addEncodedCommand(encodeCommand(['QUIT'])); + const promise = this.#queue.addCommand(['QUIT']); this.#tick(); return promise; }); @@ -307,46 +300,64 @@ export default class RedisClient(args: Array, options?: ClientCommandOptions): Promise { - return this.#sendCommand(args, options); + sendCommand(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { + return this.#sendCommand(args, options, bufferMode); } // using `#sendCommand` cause `sendCommand` is overwritten in legacy mode - #sendCommand(args: Array, options?: ClientCommandOptions): Promise { - return this.sendEncodedCommand(encodeCommand(args), options); - } - - async sendEncodedCommand(encodedCommand: string, options?: ClientCommandOptions): Promise { + async #sendCommand(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { if (!this.#socket.isOpen) { throw new ClientClosedError(); } if (options?.isolated) { return this.executeIsolated(isolatedClient => - isolatedClient.sendEncodedCommand(encodedCommand, { + isolatedClient.sendCommand(args, { ...options, isolated: false }) ); } - const promise = this.#queue.addEncodedCommand(encodedCommand, options); + const promise = this.#queue.addCommand(args, options, bufferMode); this.#tick(); return await promise; } + #tick(): void { + if (!this.#socket.isSocketExists) { + return; + } + + this.#socket.cork(); + + while (true) { + const args = this.#queue.getCommandToSend(); + if (args === undefined) break; + + let writeResult; + for (const toWrite of encodeCommand(args)) { + writeResult = this.#socket.write(toWrite); + } + + if (!writeResult) { + break; + } + } + } + executeIsolated(fn: (client: RedisClientType) => T | Promise): Promise { return this.#isolationPool.use(fn); } - async executeScript(script: RedisLuaScript, args: Array, options?: ClientCommandOptions): Promise> { + async executeScript(script: RedisLuaScript, args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise> { try { return await this.#sendCommand([ 'EVALSHA', script.SHA1, script.NUMBER_OF_KEYS.toString(), ...args - ], options); + ], options, bufferMode); } catch (err: any) { if (!err?.message?.startsWith?.('NOSCRIPT')) { throw err; @@ -357,14 +368,14 @@ export default class RedisClient, chainId?: symbol): Promise> { const promise = Promise.all( - commands.map(({encodedCommand}) => { - return this.#queue.addEncodedCommand(encodedCommand, RedisClient.commandOptions({ + commands.map(({ args }) => { + return this.#queue.addCommand(args, RedisClient.commandOptions({ chainId })); }) @@ -438,31 +449,6 @@ export default class RedisClient this.#tick()); - this.#isTickQueued = true; - return; - } - - const isBuffering = this.#queue.executeChunk(chunkRecommendedSize); - if (isBuffering === true) { - this.#socket.once('drain', () => this.#tick()); - } else if (isBuffering === false) { - this.#tick(); - return; - } - - this.#isTickQueued = false; - } } extendWithDefaultCommands(RedisClient, RedisClient.commandsExecutor); diff --git a/lib/cluster-slots.ts b/lib/cluster-slots.ts index 5fae5b92342..a5155cc53db 100644 --- a/lib/cluster-slots.ts +++ b/lib/cluster-slots.ts @@ -172,7 +172,7 @@ export default class RedisClusterSlots { + getClient(firstKey?: string | Buffer, isReadonly?: boolean): RedisClientType { if (!firstKey) { return this.#getRandomClient(); } diff --git a/lib/cluster.ts b/lib/cluster.ts index 3eeaed5009f..4f1b27cb05f 100644 --- a/lib/cluster.ts +++ b/lib/cluster.ts @@ -1,4 +1,4 @@ -import { RedisCommand, RedisModules } from './commands'; +import { RedisCommand, RedisModules, TransformArgumentsReply } from './commands'; import RedisClient, { ClientCommandOptions, RedisClientType, WithPlugins } from './client'; import { RedisSocketOptions } from './socket'; import RedisClusterSlots, { ClusterNode } from './cluster-slots'; @@ -6,6 +6,7 @@ import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { extendWithModulesAndScripts, extendWithDefaultCommands, transformCommandArguments } from './commander'; import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; import { EventEmitter } from 'events'; +import cluster from 'cluster'; export interface RedisClusterOptions { rootNodes: Array; @@ -19,7 +20,7 @@ export type RedisClusterType WithPlugins & RedisCluster; export default class RedisCluster extends EventEmitter { - static #extractFirstKey(command: RedisCommand, originalArgs: Array, redisArgs: Array): string | undefined { + static #extractFirstKey(command: RedisCommand, originalArgs: Array, redisArgs: TransformArgumentsReply): string | Buffer | undefined { if (command.FIRST_KEY_INDEX === undefined) { return undefined; } else if (typeof command.FIRST_KEY_INDEX === 'number') { @@ -41,7 +42,8 @@ export default class RedisCluster( - firstKey: string | undefined, + firstKey: string | Buffer | undefined, isReadonly: boolean | undefined, - args: Array, + args: TransformArgumentsReply, options?: ClientCommandOptions, + bufferMode?: boolean, redirections = 0 ): Promise> { const client = this.#slots.getClient(firstKey, isReadonly); try { - return await client.sendCommand(args, options); + return await client.sendCommand(args, options, bufferMode); } catch (err: any) { const shouldRetry = await this.#handleCommandError(err, client, redirections); if (shouldRetry === true) { - return this.sendCommand(firstKey, isReadonly, args, options, redirections + 1); + return this.sendCommand(firstKey, isReadonly, args, options, bufferMode, redirections + 1); } else if (shouldRetry) { - return shouldRetry.sendCommand(args, options); + return shouldRetry.sendCommand(args, options, bufferMode); } throw err; @@ -125,7 +128,7 @@ export default class RedisCluster, - redisArgs: Array, + redisArgs: TransformArgumentsReply, options?: ClientCommandOptions, redirections = 0 ): Promise> { @@ -135,13 +138,13 @@ export default class RedisCluster { - return client.sendEncodedCommand(encodedCommand, RedisClient.commandOptions({ + commands.map(({ args }) => { + return client.sendCommand(args, RedisClient.commandOptions({ chainId })); }) diff --git a/lib/commander.spec.ts b/lib/commander.spec.ts index a38330abada..b6ec1004613 100644 --- a/lib/commander.spec.ts +++ b/lib/commander.spec.ts @@ -2,27 +2,43 @@ import { strict as assert } from 'assert'; import { describe } from 'mocha'; import { encodeCommand } from './commander'; +function encodeCommandToString(...args: Parameters): string { + const arr = []; + for (const item of encodeCommand(...args)) { + arr.push(item.toString()); + } + + return arr.join(''); +} + describe('Commander', () => { describe('encodeCommand (see #1628)', () => { it('1 byte', () => { assert.equal( - encodeCommand(['a', 'z']), + encodeCommandToString(['a', 'z']), '*2\r\n$1\r\na\r\n$1\r\nz\r\n' ); }); it('2 bytes', () => { assert.equal( - encodeCommand(['א', 'ת']), + encodeCommandToString(['א', 'ת']), '*2\r\n$2\r\nא\r\n$2\r\nת\r\n' ); }); it('4 bytes', () => { assert.equal( - encodeCommand(['🐣', '🐤']), + encodeCommandToString(['🐣', '🐤']), '*2\r\n$4\r\n🐣\r\n$4\r\n🐤\r\n' ); }); + + it('with a buffer', () => { + assert.equal( + encodeCommandToString([Buffer.from('string')]), + '*1\r\n$6\r\nstring\r\n' + ); + }); }); }); diff --git a/lib/commander.ts b/lib/commander.ts index e8ff91cc7bf..c2b1918709a 100644 --- a/lib/commander.ts +++ b/lib/commander.ts @@ -2,6 +2,7 @@ import COMMANDS, { RedisCommand, RedisModules, TransformArgumentsReply } from './commands'; import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { CommandOptions, isCommandOptions } from './command-options'; +import { off } from 'process'; type Instantiable = new(...args: Array) => T; @@ -94,16 +95,15 @@ export function transformCommandArguments( }; } -export function encodeCommand(args: Array): string { - const encoded = [ - `*${args.length}`, - `$${Buffer.byteLength(args[0]).toString()}`, - args[0] - ]; +const DELIMITER = '\r\n'; - for (let i = 1; i < args.length; i++) { - encoded.push(`$${Buffer.byteLength(args[i]).toString()}`, args[i]); - } +export function* encodeCommand(args: TransformArgumentsReply): IterableIterator { + yield `*${args.length}${DELIMITER}`; - return encoded.join('\r\n') + '\r\n'; + for (const arg of args) { + const byteLength = typeof arg === 'string' ? Buffer.byteLength(arg): arg.length; + yield `$${byteLength.toString()}${DELIMITER}`; + yield arg; + yield DELIMITER; + } } diff --git a/lib/commands-queue.ts b/lib/commands-queue.ts index cae3fd6130e..27c83965529 100644 --- a/lib/commands-queue.ts +++ b/lib/commands-queue.ts @@ -2,17 +2,15 @@ import LinkedList from 'yallist'; import RedisParser from 'redis-parser'; import { AbortError } from './errors'; import { RedisReply } from './commands'; -import { encodeCommand } from './commander'; export interface QueueCommandOptions { asap?: boolean; - signal?: any; // TODO: `AbortSignal` type is incorrect chainId?: symbol; + signal?: any; // TODO: `AbortSignal` type is incorrect } interface CommandWaitingToBeSent extends CommandWaitingForReply { - encodedCommand: string; - byteLength: number; + args: Array; chainId?: symbol; abort?: { signal: any; // TODO: `AbortSignal` type is incorrect @@ -24,10 +22,9 @@ interface CommandWaitingForReply { resolve(reply?: any): void; reject(err: Error): void; channelsCounter?: number; + bufferMode?: boolean; } -export type CommandsQueueExecutor = (encodedCommands: string) => boolean | undefined; - export enum PubSubSubscribeCommands { SUBSCRIBE = 'SUBSCRIBE', PSUBSCRIBE = 'PSUBSCRIBE' @@ -57,16 +54,8 @@ export default class RedisCommandsQueue { readonly #maxLength: number | null | undefined; - readonly #executor: CommandsQueueExecutor; - readonly #waitingToBeSent = new LinkedList(); - #waitingToBeSentCommandsLength = 0; - - get waitingToBeSentCommandsLength() { - return this.#waitingToBeSentCommandsLength; - } - readonly #waitingForReply = new LinkedList(); readonly #pubSubState = { @@ -114,12 +103,11 @@ export default class RedisCommandsQueue { #chainInExecution: symbol | undefined; - constructor(maxLength: number | null | undefined, executor: CommandsQueueExecutor) { + constructor(maxLength: number | null | undefined) { this.#maxLength = maxLength; - this.#executor = executor; } - addEncodedCommand(encodedCommand: string, options?: QueueCommandOptions): Promise { + addCommand(args: Array, options?: QueueCommandOptions, bufferMode?: boolean): Promise { if (this.#pubSubState.subscribing || this.#pubSubState.subscribed) { return Promise.reject(new Error('Cannot send commands in PubSub mode')); } else if (this.#maxLength && this.#waitingToBeSent.length + this.#waitingForReply.length >= this.#maxLength) { @@ -130,11 +118,11 @@ export default class RedisCommandsQueue { return new Promise((resolve, reject) => { const node = new LinkedList.Node({ - encodedCommand, - byteLength: Buffer.byteLength(encodedCommand), + args, chainId: options?.chainId, + bufferMode, resolve, - reject + reject, }); if (options?.signal) { @@ -157,8 +145,6 @@ export default class RedisCommandsQueue { } else { this.#waitingToBeSent.pushNode(node); } - - this.#waitingToBeSentCommandsLength += node.value.byteLength; }); } @@ -233,11 +219,8 @@ export default class RedisCommandsQueue { this.#pubSubState[inProgressKey] += channelsCounter; - const encodedCommand = encodeCommand(commandArgs), - byteLength = Buffer.byteLength(encodedCommand); this.#waitingToBeSent.push({ - encodedCommand, - byteLength, + args: commandArgs, channelsCounter, resolve: () => { this.#pubSubState[inProgressKey] -= channelsCounter; @@ -249,7 +232,6 @@ export default class RedisCommandsQueue { reject(); } }); - this.#waitingToBeSentCommandsLength += byteLength; }); } @@ -267,47 +249,25 @@ export default class RedisCommandsQueue { ]); } - executeChunk(recommendedSize: number): boolean | undefined { - if (!this.#waitingToBeSent.length) return; - - const encoded: Array = []; - let size = 0, - lastCommandChainId: symbol | undefined; - for (const command of this.#waitingToBeSent) { - encoded.push(command.encodedCommand); - size += command.byteLength; - if (size > recommendedSize) { - lastCommandChainId = command.chainId; - break; - } - } - - if (!lastCommandChainId && encoded.length === this.#waitingToBeSent.length) { - lastCommandChainId = this.#waitingToBeSent.tail!.value.chainId; - } - - lastCommandChainId ??= this.#waitingToBeSent.tail?.value.chainId; - - this.#executor(encoded.join('')); - - for (let i = 0; i < encoded.length; i++) { - const waitingToBeSent = this.#waitingToBeSent.shift()!; - if (waitingToBeSent.abort) { - waitingToBeSent.abort.signal.removeEventListener('abort', waitingToBeSent.abort.listener); - } + getCommandToSend(): Array | undefined { + const toSend = this.#waitingToBeSent.shift(); + if (toSend) { this.#waitingForReply.push({ - resolve: waitingToBeSent.resolve, - reject: waitingToBeSent.reject, - channelsCounter: waitingToBeSent.channelsCounter + resolve: toSend.resolve, + reject: toSend.reject, + channelsCounter: toSend.channelsCounter, + bufferMode: toSend.bufferMode }); } - this.#chainInExecution = lastCommandChainId; - this.#waitingToBeSentCommandsLength -= size; + this.#chainInExecution = toSend?.chainId; + + return toSend?.args; } parseResponse(data: Buffer): void { + this.#parser.setReturnBuffers(!!this.#waitingForReply.head?.value.bufferMode); this.#parser.execute(data); } diff --git a/lib/commands/ACL_DELUSER.ts b/lib/commands/ACL_DELUSER.ts index 7fb4904be41..85a916c4379 100644 --- a/lib/commands/ACL_DELUSER.ts +++ b/lib/commands/ACL_DELUSER.ts @@ -1,6 +1,7 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; -export function transformArguments(username: string | Array): Array { +export function transformArguments(username: string | Array): TransformArgumentsReply { return pushVerdictArguments(['ACL', 'DELUSER'], username); } diff --git a/lib/commands/ACL_SETUSER.ts b/lib/commands/ACL_SETUSER.ts index b2829ca964f..e55a8942e02 100644 --- a/lib/commands/ACL_SETUSER.ts +++ b/lib/commands/ACL_SETUSER.ts @@ -1,6 +1,7 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyString } from './generic-transformers'; -export function transformArguments(username: string, rule: string | Array): Array { +export function transformArguments(username: string, rule: string | Array): TransformArgumentsReply { return pushVerdictArguments(['ACL', 'SETUSER', username], rule); } diff --git a/lib/commands/BITOP.ts b/lib/commands/BITOP.ts index fe7d339f5d1..bb965da6dfa 100644 --- a/lib/commands/BITOP.ts +++ b/lib/commands/BITOP.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; type BitOperations = 'AND' | 'OR' | 'XOR' | 'NOT'; -export function transformArguments(operation: BitOperations, destKey: string, key: string | Array): Array { +export function transformArguments(operation: BitOperations, destKey: string, key: string | Array): TransformArgumentsReply { return pushVerdictArguments(['BITOP', operation, destKey], key); } diff --git a/lib/commands/BLPOP.ts b/lib/commands/BLPOP.ts index 7c352951fb3..1061f5e113a 100644 --- a/lib/commands/BLPOP.ts +++ b/lib/commands/BLPOP.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(keys: string | Array, timeout: number): Array { +export function transformArguments(keys: string | Buffer | Array, timeout: number): TransformArgumentsReply { const args = pushVerdictArguments(['BLPOP'], keys); args.push(timeout.toString()); diff --git a/lib/commands/BRPOP.ts b/lib/commands/BRPOP.ts index a03c278309a..93ded4dbf1a 100644 --- a/lib/commands/BRPOP.ts +++ b/lib/commands/BRPOP.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array, timeout: number): Array { +export function transformArguments(key: string | Array, timeout: number): TransformArgumentsReply { const args = pushVerdictArguments(['BRPOP'], key); args.push(timeout.toString()); diff --git a/lib/commands/BZPOPMAX.ts b/lib/commands/BZPOPMAX.ts index ccd84272a50..3db9ca42cbb 100644 --- a/lib/commands/BZPOPMAX.ts +++ b/lib/commands/BZPOPMAX.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array, timeout: number): Array { +export function transformArguments(key: string | Array, timeout: number): TransformArgumentsReply { const args = pushVerdictArguments(['BZPOPMAX'], key); args.push(timeout.toString()); diff --git a/lib/commands/BZPOPMIN.ts b/lib/commands/BZPOPMIN.ts index 0c299cdb9df..9106ae770da 100644 --- a/lib/commands/BZPOPMIN.ts +++ b/lib/commands/BZPOPMIN.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array, timeout: number): Array { +export function transformArguments(key: string | Array, timeout: number): TransformArgumentsReply { const args = pushVerdictArguments(['BZPOPMIN'], key); args.push(timeout.toString()); diff --git a/lib/commands/DEL.ts b/lib/commands/DEL.ts index 3d9a78212f8..f96b6988f1c 100644 --- a/lib/commands/DEL.ts +++ b/lib/commands/DEL.ts @@ -1,6 +1,7 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; -export function transformArguments(keys: string | Array): Array { +export function transformArguments(keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['DEL'], keys); } diff --git a/lib/commands/EXISTS.ts b/lib/commands/EXISTS.ts index 5a76ca833fb..00d10b9eebc 100644 --- a/lib/commands/EXISTS.ts +++ b/lib/commands/EXISTS.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyBoolean } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(keys: string | Array): Array { +export function transformArguments(keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['EXISTS'], keys); } diff --git a/lib/commands/GEOHASH.ts b/lib/commands/GEOHASH.ts index a46738955d3..a95ae443408 100644 --- a/lib/commands/GEOHASH.ts +++ b/lib/commands/GEOHASH.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, member: string | Array): Array { +export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { return pushVerdictArguments(['GEOHASH', key], member); } diff --git a/lib/commands/GEOPOS.ts b/lib/commands/GEOPOS.ts index 46b0a153ba9..893048cf6da 100644 --- a/lib/commands/GEOPOS.ts +++ b/lib/commands/GEOPOS.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, member: string | Array): Array { +export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { return pushVerdictArguments(['GEOPOS', key], member); } diff --git a/lib/commands/GET.ts b/lib/commands/GET.ts index 714ad953d8e..6c6475a9d24 100644 --- a/lib/commands/GET.ts +++ b/lib/commands/GET.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { transformReplyString } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string): Array { +export function transformArguments(key: string | Buffer): TransformArgumentsReply { return ['GET', key]; } diff --git a/lib/commands/GET_BUFFER.spec.ts b/lib/commands/GET_BUFFER.spec.ts new file mode 100644 index 00000000000..533eb808c49 --- /dev/null +++ b/lib/commands/GET_BUFFER.spec.ts @@ -0,0 +1,22 @@ +import { strict as assert } from 'assert'; +import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; + +describe('GET_BUFFER', () => { + itWithClient(TestRedisServers.OPEN, 'client.getBuffer', async client => { + const buffer = Buffer.from('string'); + await client.set('key', buffer); + assert.deepEqual( + buffer, + await client.getBuffer('key') + ); + }); + + itWithCluster(TestRedisClusters.OPEN, 'cluster.getBuffer', async cluster => { + const buffer = Buffer.from('string'); + await cluster.set('key', buffer); + assert.deepEqual( + buffer, + await cluster.getBuffer('key') + ); + }); +}); diff --git a/lib/commands/GET_BUFFER.ts b/lib/commands/GET_BUFFER.ts new file mode 100644 index 00000000000..3d6f454898b --- /dev/null +++ b/lib/commands/GET_BUFFER.ts @@ -0,0 +1,7 @@ +import { transformReplyBuffer } from './generic-transformers'; + +export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './GET'; + +export const BUFFER_MODE = true; + +export const transformReply = transformReplyBuffer; diff --git a/lib/commands/HDEL.ts b/lib/commands/HDEL.ts index ee961931449..4785b0e67f9 100644 --- a/lib/commands/HDEL.ts +++ b/lib/commands/HDEL.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, field: string | Array): Array { +export function transformArguments(key: string, field: string | Array): TransformArgumentsReply { return pushVerdictArguments(['HDEL', key], field); } diff --git a/lib/commands/HMGET.ts b/lib/commands/HMGET.ts index fc0f91d8224..9f26eeba640 100644 --- a/lib/commands/HMGET.ts +++ b/lib/commands/HMGET.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, fields: string | Array): Array { +export function transformArguments(key: string, fields: string | Array): TransformArgumentsReply { return pushVerdictArguments(['HMGET', key], fields); } diff --git a/lib/commands/LPUSH.ts b/lib/commands/LPUSH.ts index 434ad619cb7..7416d4946ea 100644 --- a/lib/commands/LPUSH.ts +++ b/lib/commands/LPUSH.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, elements: string | Array): Array { +export function transformArguments(key: string, elements: string | Array): TransformArgumentsReply { return pushVerdictArguments(['LPUSH', key], elements);} export const transformReply = transformReplyNumber; diff --git a/lib/commands/LPUSHX.ts b/lib/commands/LPUSHX.ts index f1a989d9625..f89623ace3a 100644 --- a/lib/commands/LPUSHX.ts +++ b/lib/commands/LPUSHX.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): Array { +export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { return pushVerdictArguments(['LPUSHX', key], element); } diff --git a/lib/commands/PFADD.ts b/lib/commands/PFADD.ts index 3348a98852a..cc99bed7f65 100644 --- a/lib/commands/PFADD.ts +++ b/lib/commands/PFADD.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyBoolean } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): Array { +export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { return pushVerdictArguments(['PFADD', key], element); } diff --git a/lib/commands/PFCOUNT.ts b/lib/commands/PFCOUNT.ts index eac710a3543..52963697adf 100644 --- a/lib/commands/PFCOUNT.ts +++ b/lib/commands/PFCOUNT.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array): Array { +export function transformArguments(key: string | Array): TransformArgumentsReply { return pushVerdictArguments(['PFCOUNT'], key); } diff --git a/lib/commands/PFMERGE.ts b/lib/commands/PFMERGE.ts index 73a4a2edb9a..c4ba11877f7 100644 --- a/lib/commands/PFMERGE.ts +++ b/lib/commands/PFMERGE.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyString } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, source: string | Array): Array { +export function transformArguments(destination: string, source: string | Array): TransformArgumentsReply { return pushVerdictArguments(['PFMERGE', destination], source); } diff --git a/lib/commands/RPUSH.ts b/lib/commands/RPUSH.ts index 191d2704e09..665094f47a5 100644 --- a/lib/commands/RPUSH.ts +++ b/lib/commands/RPUSH.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): Array { +export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { return pushVerdictArguments(['RPUSH', key], element); } diff --git a/lib/commands/RPUSHX.ts b/lib/commands/RPUSHX.ts index a07615a58e0..fe1f969f3f6 100644 --- a/lib/commands/RPUSHX.ts +++ b/lib/commands/RPUSHX.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): Array { +export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { return pushVerdictArguments(['RPUSHX', key], element); } diff --git a/lib/commands/SADD.ts b/lib/commands/SADD.ts index a14ba1686c0..a432ccfef59 100644 --- a/lib/commands/SADD.ts +++ b/lib/commands/SADD.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, members: string | Array): Array { +export function transformArguments(key: string, members: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SADD', key], members); } diff --git a/lib/commands/SCRIPT_EXISTS.ts b/lib/commands/SCRIPT_EXISTS.ts index b127a0b261b..47a7f456e9b 100644 --- a/lib/commands/SCRIPT_EXISTS.ts +++ b/lib/commands/SCRIPT_EXISTS.ts @@ -1,6 +1,7 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyBooleanArray } from './generic-transformers'; -export function transformArguments(sha1: string | Array): Array { +export function transformArguments(sha1: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SCRIPT', 'EXISTS'], sha1); } diff --git a/lib/commands/SDIFF.ts b/lib/commands/SDIFF.ts index 496ed593370..4d5aaea1a06 100644 --- a/lib/commands/SDIFF.ts +++ b/lib/commands/SDIFF.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(keys: string | Array): Array { +export function transformArguments(keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SDIFF'], keys); } diff --git a/lib/commands/SDIFFSTORE.ts b/lib/commands/SDIFFSTORE.ts index 295433602fb..69883d4124c 100644 --- a/lib/commands/SDIFFSTORE.ts +++ b/lib/commands/SDIFFSTORE.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: string | Array): Array { +export function transformArguments(destination: string, keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SDIFFSTORE', destination], keys); } diff --git a/lib/commands/SET.spec.ts b/lib/commands/SET.spec.ts index a587f6c3120..32d138f2920 100644 --- a/lib/commands/SET.spec.ts +++ b/lib/commands/SET.spec.ts @@ -106,7 +106,7 @@ describe('SET', () => { 'OK' ); }); - + itWithClient(TestRedisServers.OPEN, 'with GET on empty key', async client => { assert.equal( await client.set('key', 'value', { diff --git a/lib/commands/SET.ts b/lib/commands/SET.ts index 4d5919cde21..03853b3f7d6 100644 --- a/lib/commands/SET.ts +++ b/lib/commands/SET.ts @@ -1,3 +1,5 @@ +import { TransformArgumentsReply } from '.'; + export const FIRST_KEY_INDEX = 1; interface EX { @@ -38,7 +40,7 @@ interface SetCommonOptions { type SetOptions = SetTTL & SetGuards & (SetCommonOptions | {}); -export function transformArguments(key: string, value: string, options?: SetOptions): Array { +export function transformArguments(key: string | Buffer, value: string | Buffer, options?: SetOptions): TransformArgumentsReply { const args = ['SET', key, value]; if (!options) { diff --git a/lib/commands/SETEX.ts b/lib/commands/SETEX.ts index 57c32db6ffe..320278c9264 100644 --- a/lib/commands/SETEX.ts +++ b/lib/commands/SETEX.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { transformReplyString } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, seconds: number, value: string): Array { +export function transformArguments(key: string | Buffer, seconds: number, value: string): TransformArgumentsReply { return [ 'SETEX', key, diff --git a/lib/commands/SINTER.ts b/lib/commands/SINTER.ts index 104e81b9214..43869652370 100644 --- a/lib/commands/SINTER.ts +++ b/lib/commands/SINTER.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(keys: string | Array): Array { +export function transformArguments(keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SINTER'], keys); } diff --git a/lib/commands/SINTERSTORE.ts b/lib/commands/SINTERSTORE.ts index a7a4d4fd106..5ad1b11cbac 100644 --- a/lib/commands/SINTERSTORE.ts +++ b/lib/commands/SINTERSTORE.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: string | Array): Array { +export function transformArguments(destination: string, keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SINTERSTORE', destination], keys); } diff --git a/lib/commands/SREM.ts b/lib/commands/SREM.ts index d1021bb3a19..4ae33245d29 100644 --- a/lib/commands/SREM.ts +++ b/lib/commands/SREM.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, members: string | Array): Array { +export function transformArguments(key: string, members: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SREM', key], members); } diff --git a/lib/commands/SUNION.ts b/lib/commands/SUNION.ts index 3f06138b1b6..705bff29927 100644 --- a/lib/commands/SUNION.ts +++ b/lib/commands/SUNION.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(keys: string | Array): Array { +export function transformArguments(keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SUNION'], keys); } diff --git a/lib/commands/SUNIONSTORE.ts b/lib/commands/SUNIONSTORE.ts index 7a1aab80117..af717f627df 100644 --- a/lib/commands/SUNIONSTORE.ts +++ b/lib/commands/SUNIONSTORE.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: string | Array): Array { +export function transformArguments(destination: string, keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['SUNIONSTORE', destination], keys); } diff --git a/lib/commands/TOUCH.ts b/lib/commands/TOUCH.ts index f2fb0548970..abff4160392 100644 --- a/lib/commands/TOUCH.ts +++ b/lib/commands/TOUCH.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array): Array { +export function transformArguments(key: string | Array): TransformArgumentsReply { return pushVerdictArguments(['TOUCH'], key); } diff --git a/lib/commands/UNLINK.ts b/lib/commands/UNLINK.ts index 9dfe0ca48ea..4647a976e42 100644 --- a/lib/commands/UNLINK.ts +++ b/lib/commands/UNLINK.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array): Array { +export function transformArguments(key: string | Array): TransformArgumentsReply { return pushVerdictArguments(['UNLINK'], key); } diff --git a/lib/commands/WATCH.ts b/lib/commands/WATCH.ts index 5e24ca37952..e644ab0f462 100644 --- a/lib/commands/WATCH.ts +++ b/lib/commands/WATCH.ts @@ -1,6 +1,7 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyString } from './generic-transformers'; -export function transformArguments(key: string | Array): Array { +export function transformArguments(key: string | Array): TransformArgumentsReply { return pushVerdictArguments(['WATCH'], key); } diff --git a/lib/commands/XACK.ts b/lib/commands/XACK.ts index 969f9b6a8b9..a6de28151eb 100644 --- a/lib/commands/XACK.ts +++ b/lib/commands/XACK.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, group: string, id: string | Array): Array { +export function transformArguments(key: string, group: string, id: string | Array): TransformArgumentsReply { return pushVerdictArguments(['XACK', key, group], id); } diff --git a/lib/commands/XDEL.ts b/lib/commands/XDEL.ts index 9d173271c28..083ea77ef0f 100644 --- a/lib/commands/XDEL.ts +++ b/lib/commands/XDEL.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, id: string | Array): Array { +export function transformArguments(key: string, id: string | Array): TransformArgumentsReply { return pushVerdictArguments(['XDEL', key], id); } diff --git a/lib/commands/ZDIFF.ts b/lib/commands/ZDIFF.ts index f557b597ec4..7154947fea7 100644 --- a/lib/commands/ZDIFF.ts +++ b/lib/commands/ZDIFF.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArgument, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; export const IS_READ_ONLY = true; -export function transformArguments(keys: Array | string): Array { +export function transformArguments(keys: Array | string): TransformArgumentsReply { return pushVerdictArgument(['ZDIFF'], keys); } diff --git a/lib/commands/ZDIFFSTORE.ts b/lib/commands/ZDIFFSTORE.ts index de409c0939a..f91d4c869ba 100644 --- a/lib/commands/ZDIFFSTORE.ts +++ b/lib/commands/ZDIFFSTORE.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArgument, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: Array | string): Array { +export function transformArguments(destination: string, keys: Array | string): TransformArgumentsReply { return pushVerdictArgument(['ZDIFFSTORE', destination], keys); } diff --git a/lib/commands/ZDIFF_WITHSCORES.ts b/lib/commands/ZDIFF_WITHSCORES.ts index 26effab7189..84126853361 100644 --- a/lib/commands/ZDIFF_WITHSCORES.ts +++ b/lib/commands/ZDIFF_WITHSCORES.ts @@ -1,9 +1,10 @@ +import { TransformArgumentsReply } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { transformArguments as transformZDiffArguments } from './ZDIFF'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZDIFF'; -export function transformArguments(...args: Parameters): Array { +export function transformArguments(...args: Parameters): TransformArgumentsReply { return [ ...transformZDiffArguments(...args), 'WITHSCORES' diff --git a/lib/commands/ZINTER.ts b/lib/commands/ZINTER.ts index 90a42eda0d3..91d7982a8e7 100644 --- a/lib/commands/ZINTER.ts +++ b/lib/commands/ZINTER.ts @@ -1,3 +1,4 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArgument, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -9,7 +10,7 @@ interface ZInterOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(keys: Array | string, options?: ZInterOptions): Array { +export function transformArguments(keys: Array | string, options?: ZInterOptions): TransformArgumentsReply { const args = pushVerdictArgument(['ZINTER'], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZINTERSTORE.ts b/lib/commands/ZINTERSTORE.ts index a026916ce1f..6e79e423cb0 100644 --- a/lib/commands/ZINTERSTORE.ts +++ b/lib/commands/ZINTERSTORE.ts @@ -1,3 +1,4 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArgument, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,7 +8,7 @@ interface ZInterStoreOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(destination: string, keys: Array | string, options?: ZInterStoreOptions): Array { +export function transformArguments(destination: string, keys: Array | string, options?: ZInterStoreOptions): TransformArgumentsReply { const args = pushVerdictArgument(['ZINTERSTORE', destination], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZINTER_WITHSCORES.ts b/lib/commands/ZINTER_WITHSCORES.ts index 0a82228fce9..f4287d1a684 100644 --- a/lib/commands/ZINTER_WITHSCORES.ts +++ b/lib/commands/ZINTER_WITHSCORES.ts @@ -1,9 +1,10 @@ +import { TransformArgumentsReply } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { transformArguments as transformZInterArguments } from './ZINTER'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZINTER'; -export function transformArguments(...args: Parameters): Array { +export function transformArguments(...args: Parameters): TransformArgumentsReply { return [ ...transformZInterArguments(...args), 'WITHSCORES' diff --git a/lib/commands/ZMSCORE.ts b/lib/commands/ZMSCORE.ts index 8a6f73c7836..373adac3cf0 100644 --- a/lib/commands/ZMSCORE.ts +++ b/lib/commands/ZMSCORE.ts @@ -1,10 +1,11 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumberInfinityNullArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, member: string | Array): Array { +export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { return pushVerdictArguments(['ZMSCORE', key], member); } diff --git a/lib/commands/ZREM.ts b/lib/commands/ZREM.ts index 089b6136afd..8419291f2fd 100644 --- a/lib/commands/ZREM.ts +++ b/lib/commands/ZREM.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, member: string | Array): Array { +export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { return pushVerdictArguments(['ZREM', key], member); } diff --git a/lib/commands/ZUNION.ts b/lib/commands/ZUNION.ts index efdfccb1ff4..87158b8425a 100644 --- a/lib/commands/ZUNION.ts +++ b/lib/commands/ZUNION.ts @@ -1,3 +1,4 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArgument, transformReplyStringArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -9,7 +10,7 @@ interface ZUnionOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(keys: Array | string, options?: ZUnionOptions): Array { +export function transformArguments(keys: Array | string, options?: ZUnionOptions): TransformArgumentsReply { const args = pushVerdictArgument(['ZUNION'], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZUNIONSTORE.ts b/lib/commands/ZUNIONSTORE.ts index c03f1203706..4ebbdbd8591 100644 --- a/lib/commands/ZUNIONSTORE.ts +++ b/lib/commands/ZUNIONSTORE.ts @@ -1,3 +1,4 @@ +import { TransformArgumentsReply } from '.'; import { pushVerdictArgument, transformReplyNumber } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,7 +8,7 @@ interface ZUnionOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(destination: string, keys: Array | string, options?: ZUnionOptions): Array { +export function transformArguments(destination: string, keys: Array | string, options?: ZUnionOptions): TransformArgumentsReply { const args = pushVerdictArgument(['ZUNIONSTORE', destination], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZUNION_WITHSCORES.ts b/lib/commands/ZUNION_WITHSCORES.ts index d0cef45cfb1..2215dad9749 100644 --- a/lib/commands/ZUNION_WITHSCORES.ts +++ b/lib/commands/ZUNION_WITHSCORES.ts @@ -1,9 +1,10 @@ +import { TransformArgumentsReply } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { transformArguments as transformZUnionArguments } from './ZUNION'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZUNION'; -export function transformArguments(...args: Parameters): Array { +export function transformArguments(...args: Parameters): TransformArgumentsReply { return [ ...transformZUnionArguments(...args), 'WITHSCORES' diff --git a/lib/commands/generic-transformers.ts b/lib/commands/generic-transformers.ts index 8105bfe903f..496745cb1f1 100644 --- a/lib/commands/generic-transformers.ts +++ b/lib/commands/generic-transformers.ts @@ -20,6 +20,10 @@ export function transformReplyString(reply: string): string { return reply; } +export function transformReplyBuffer(reply: Buffer): Buffer { + return reply; +} + export function transformReplyStringNull(reply: string | null): string | null { return reply; } @@ -352,11 +356,11 @@ export function pushStringTuplesArguments(args: Array, tuples: StringTup return args; } -export function pushVerdictArguments(args: TransformArgumentsReply, value: string | Array): TransformArgumentsReply { - if (typeof value === 'string') { - args.push(value); - } else { +export function pushVerdictArguments(args: TransformArgumentsReply, value: string | Buffer | Array): TransformArgumentsReply { + if (Array.isArray(value)) { args.push(...value); + } else { + args.push(value); } return args; diff --git a/lib/commands/index.ts b/lib/commands/index.ts index cffb47c668a..dce28ac0937 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -61,6 +61,7 @@ import * as GEOPOS from './GEOPOS'; import * as GEOSEARCH_WITH from './GEOSEARCH_WITH'; import * as GEOSEARCH from './GEOSEARCH'; import * as GEOSEARCHSTORE from './GEOSEARCHSTORE'; +import * as GET_BUFFER from './GET_BUFFER'; import * as GET from './GET'; import * as GETBIT from './GETBIT'; import * as GETDEL from './GETDEL'; @@ -370,6 +371,8 @@ export default { geoSearch: GEOSEARCH, GEOSEARCHSTORE, geoSearchStore: GEOSEARCHSTORE, + GET_BUFFER, + getBuffer: GET_BUFFER, GET, get: GET, GETBIT, @@ -733,15 +736,16 @@ export default { zUnionStore: ZUNIONSTORE }; -export type RedisReply = string | number | Array | null | undefined; +export type RedisReply = string | number | Buffer | Array | null | undefined; -export type TransformArgumentsReply = Array & { preserve?: unknown }; +export type TransformArgumentsReply = Array & { preserve?: unknown }; export interface RedisCommand { FIRST_KEY_INDEX?: number | ((...args: Array) => string); IS_READ_ONLY?: boolean; transformArguments(...args: Array): TransformArgumentsReply; - transformReply(reply: RedisReply, preserved: unknown): any; + BUFFER_MODE?: boolean; + transformReply(reply: RedisReply, preserved?: unknown): any; } export interface RedisCommands { diff --git a/lib/multi-command.spec.ts b/lib/multi-command.spec.ts index a78cc8b2e08..52ecfb94b1c 100644 --- a/lib/multi-command.spec.ts +++ b/lib/multi-command.spec.ts @@ -1,6 +1,5 @@ import { strict as assert } from 'assert'; import RedisMultiCommand from './multi-command'; -import { encodeCommand } from './commander'; import { WatchError } from './errors'; import { spy } from 'sinon'; import { SQUARE_SCRIPT } from './client.spec'; @@ -10,11 +9,11 @@ describe('Multi Command', () => { it('simple', async () => { const multi = RedisMultiCommand.create((queue, symbol) => { assert.deepEqual( - queue.map(({encodedCommand}) => encodedCommand), + queue.map(({ args }) => args), [ - encodeCommand(['MULTI']), - encodeCommand(['PING']), - encodeCommand(['EXEC']), + ['MULTI'], + ['PING'], + ['EXEC'], ] ); @@ -55,8 +54,8 @@ describe('Multi Command', () => { it('execAsPipeline', async () => { const multi = RedisMultiCommand.create(queue => { assert.deepEqual( - queue.map(({encodedCommand}) => encodedCommand), - [encodeCommand(['PING'])] + queue.map(({ args }) => args), + [['PING']] ); return Promise.resolve(['PONG']); @@ -75,8 +74,8 @@ describe('Multi Command', () => { it('simple', async () => { const multi = RedisMultiCommand.create(queue => { assert.deepEqual( - queue.map(({encodedCommand}) => encodedCommand), - [encodeCommand(['PING'])] + queue.map(({ args }) => args), + [['PING']] ); return Promise.resolve(['PONG']); @@ -111,10 +110,10 @@ describe('Multi Command', () => { assert.deepEqual( await new MultiWithScript(queue => { assert.deepEqual( - queue.map(({encodedCommand}) => encodedCommand), + queue.map(({ args }) => args), [ - encodeCommand(['EVAL', SQUARE_SCRIPT.SCRIPT, '0', '2']), - encodeCommand(['EVALSHA', SQUARE_SCRIPT.SHA1, '0', '3']), + ['EVAL', SQUARE_SCRIPT.SCRIPT, '0', '2'], + ['EVALSHA', SQUARE_SCRIPT.SHA1, '0', '3'], ] ); diff --git a/lib/multi-command.ts b/lib/multi-command.ts index c8a50765967..53f439d8f36 100644 --- a/lib/multi-command.ts +++ b/lib/multi-command.ts @@ -2,7 +2,7 @@ import COMMANDS, { TransformArgumentsReply } from './commands'; import { RedisCommand, RedisModules, RedisReply } from './commands'; import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { RedisClientOptions } from './client'; -import { extendWithModulesAndScripts, extendWithDefaultCommands, encodeCommand } from './commander'; +import { extendWithModulesAndScripts, extendWithDefaultCommands } from './commander'; import { WatchError } from './errors'; type RedisMultiCommandSignature = (...args: Parameters) => RedisMultiCommandType; @@ -24,7 +24,7 @@ type WithScripts = { export type RedisMultiCommandType = RedisMultiCommand & WithCommands & WithModules & WithScripts; export interface MultiQueuedCommand { - encodedCommand: string; + args: TransformArgumentsReply; preservedArguments?: unknown; transformReply?: RedisCommand['transformReply']; } @@ -62,7 +62,9 @@ export default class RedisMultiCommand): this => { this.#queue.push({ - encodedCommand: encodeCommand(args.flat() as Array) + args: args.flat() as Array }); return this; } @@ -153,7 +155,7 @@ export default class RedisMultiCommand); diff --git a/lib/socket.ts b/lib/socket.ts index 66cd28d91d5..23daee14c37 100644 --- a/lib/socket.ts +++ b/lib/socket.ts @@ -91,10 +91,8 @@ export default class RedisSocket extends EventEmitter { return this.#isOpen; } - get chunkRecommendedSize(): number { - if (!this.#socket) return 0; - - return this.#socket.writableHighWaterMark - this.#socket.writableLength; + get isSocketExists(): boolean { + return !!this.#socket; } constructor(initiator?: RedisSocketInitiator, options?: RedisSocketOptions) { @@ -214,12 +212,12 @@ export default class RedisSocket extends EventEmitter { .catch(err => this.emit('error', err)); } - write(encodedCommands: string): boolean { + write(toWrite: string | Buffer): boolean { if (!this.#socket) { throw new ClientClosedError(); } - return this.#socket.write(encodedCommands); + return this.#socket.write(toWrite); } async disconnect(ignoreIsOpen = false): Promise { @@ -251,4 +249,22 @@ export default class RedisSocket extends EventEmitter { throw err; } } + + #isCorked = false; + + cork(): void { + if (!this.#socket) { + return; + } + + if (!this.#isCorked) { + this.#socket.cork(); + this.#isCorked = true; + + queueMicrotask(() => { + this.#socket?.uncork(); + this.#isCorked = false; + }); + } + } } diff --git a/lib/ts-declarations/cluster-key-slot.d.ts b/lib/ts-declarations/cluster-key-slot.d.ts index 5774c50fbd4..60421de296b 100644 --- a/lib/ts-declarations/cluster-key-slot.d.ts +++ b/lib/ts-declarations/cluster-key-slot.d.ts @@ -1,3 +1,3 @@ declare module 'cluster-key-slot' { - export default function calculateSlot(key: string): number; + export default function calculateSlot(key: string | Buffer): number; } diff --git a/lib/ts-declarations/redis-parser.d.ts b/lib/ts-declarations/redis-parser.d.ts index 68659616b93..7ec129ed8cd 100644 --- a/lib/ts-declarations/redis-parser.d.ts +++ b/lib/ts-declarations/redis-parser.d.ts @@ -8,6 +8,8 @@ declare module 'redis-parser' { export default class RedisParser { constructor(callbacks: RedisParserCallbacks); + setReturnBuffers(returnBuffers?: boolean): void; + execute(buffer: Buffer): void; } } From 9fc08d449ce357a8fd2f00187e993670be310cff Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 13 Sep 2021 19:55:37 -0400 Subject: [PATCH 07/40] fix GET and GET_BUFFER return type --- lib/commands/GET.ts | 4 ++-- lib/commands/GET_BUFFER.ts | 4 ++-- lib/commands/generic-transformers.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/commands/GET.ts b/lib/commands/GET.ts index 6c6475a9d24..541790e54e4 100644 --- a/lib/commands/GET.ts +++ b/lib/commands/GET.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { transformReplyString } from './generic-transformers'; +import { transformReplyStringNull } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -9,4 +9,4 @@ export function transformArguments(key: string | Buffer): TransformArgumentsRepl return ['GET', key]; } -export const transformReply = transformReplyString; +export const transformReply = transformReplyStringNull; diff --git a/lib/commands/GET_BUFFER.ts b/lib/commands/GET_BUFFER.ts index 3d6f454898b..9d281961130 100644 --- a/lib/commands/GET_BUFFER.ts +++ b/lib/commands/GET_BUFFER.ts @@ -1,7 +1,7 @@ -import { transformReplyBuffer } from './generic-transformers'; +import { transformReplyBufferNull } from './generic-transformers'; export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './GET'; export const BUFFER_MODE = true; -export const transformReply = transformReplyBuffer; +export const transformReply = transformReplyBufferNull; diff --git a/lib/commands/generic-transformers.ts b/lib/commands/generic-transformers.ts index 496745cb1f1..bbc12ee113e 100644 --- a/lib/commands/generic-transformers.ts +++ b/lib/commands/generic-transformers.ts @@ -20,10 +20,6 @@ export function transformReplyString(reply: string): string { return reply; } -export function transformReplyBuffer(reply: Buffer): Buffer { - return reply; -} - export function transformReplyStringNull(reply: string | null): string | null { return reply; } @@ -54,6 +50,10 @@ export function transformReplyBit(reply: BitValue): BitValue { return reply; } +export function transformReplyBufferNull(reply: Buffer | null): Buffer | null { + return reply; +} + export function transformReplyVoid(): void {} export interface ScanOptions { From b91897acdbc3c38c63013aaca0a6cc8bc240c162 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 13 Sep 2021 20:05:29 -0400 Subject: [PATCH 08/40] update FAQ --- docs/FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/FAQ.md b/docs/FAQ.md index b5074e73025..cfdb2ecaf42 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -8,6 +8,6 @@ When a socket closed unexpectedly, all the commands that were already sent will ## How are commands batched? -Commands are pipelined using [`queueMicrotask`](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback). Commands from the same "tick" will be sent in batches and respect the [`writableHighWaterMark`](https://nodejs.org/api/stream.html#stream_new_stream_writable_options). +Commands are pipelined using [`queueMicrotask`](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback). If `socket.write()` returns `false`—meaning that ["all or part of the data was queued in user memory"](https://nodejs.org/api/net.html#net_socket_write_data_encoding_callback:~:text=all%20or%20part%20of%20the%20data%20was%20queued%20in%20user%20memory)—the commands will stack in memory until the [`drain`](https://nodejs.org/api/net.html#net_event_drain) event is fired. From 64f456767e489d2817ab58a5b86b6604d4eb339d Mon Sep 17 00:00:00 2001 From: Richard Samuelsson Date: Tue, 14 Sep 2021 04:08:11 +0200 Subject: [PATCH 09/40] Update invalid code example in README.md (#1654) * Update invalid code example in README.md * Update README.md Co-authored-by: Leibale Eidelman --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index db0fa71cc7f..bbcb7edc976 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,7 @@ await client.set('another-key', 'another-value'); const [ setKeyReply, otherKeyValue ] = await client.multi() .set('key', 'value') .get('another-key') - .exec() -]); // ['OK', 'another-value'] + .exec(); // ['OK', 'another-value'] ``` You can also [watch](https://redis.io/topics/transactions#optimistic-locking-using-check-and-set) keys by calling `.watch()`. Your transaction will abort if any of the watched keys change. From 0f5a2784974589e8ef54603b6dacaf72d2cc6335 Mon Sep 17 00:00:00 2001 From: leibale Date: Tue, 14 Sep 2021 11:09:31 -0400 Subject: [PATCH 10/40] fix #1652 --- lib/client.spec.ts | 3 +++ lib/commands-queue.ts | 17 +++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/client.spec.ts b/lib/client.spec.ts index 9f18e184c88..7f1a534352c 100644 --- a/lib/client.spec.ts +++ b/lib/client.spec.ts @@ -516,6 +516,9 @@ describe('Client', () => { assert.ok(channelListener1.calledOnce); assert.ok(channelListener2.calledTwice); assert.ok(patternListener.calledThrice); + + // should be able to send commands when unsubsribed from all channels (see #1652) + await assert.doesNotReject(subscriber.ping()); } finally { await subscriber.disconnect(); } diff --git a/lib/commands-queue.ts b/lib/commands-queue.ts index 27c83965529..ef87184193f 100644 --- a/lib/commands-queue.ts +++ b/lib/commands-queue.ts @@ -171,8 +171,9 @@ export default class RedisCommandsQueue { unsubscribe(command: PubSubUnsubscribeCommands, channels?: string | Array, listener?: PubSubListener): Promise { const listeners = command === PubSubUnsubscribeCommands.UNSUBSCRIBE ? this.#pubSubListeners.channels : this.#pubSubListeners.patterns; if (!channels) { + const size = listeners.size; listeners.clear(); - return this.#pushPubSubCommand(command); + return this.#pushPubSubCommand(command, size); } const channelsToUnsubscribe = []; @@ -199,22 +200,18 @@ export default class RedisCommandsQueue { return this.#pushPubSubCommand(command, channelsToUnsubscribe); } - #pushPubSubCommand(command: PubSubSubscribeCommands | PubSubUnsubscribeCommands, channels?: Array): Promise { + #pushPubSubCommand(command: PubSubSubscribeCommands | PubSubUnsubscribeCommands, channels: number | Array): Promise { return new Promise((resolve, reject) => { const isSubscribe = command === PubSubSubscribeCommands.SUBSCRIBE || command === PubSubSubscribeCommands.PSUBSCRIBE, inProgressKey = isSubscribe ? 'subscribing' : 'unsubscribing', commandArgs: Array = [command]; + let channelsCounter: number; - if (channels?.length) { + if (typeof channels === 'number') { // unsubscribe only + channelsCounter = channels; + } else { commandArgs.push(...channels); channelsCounter = channels.length; - } else { - // unsubscribe only - channelsCounter = ( - command[0] === 'P' ? - this.#pubSubListeners.patterns : - this.#pubSubListeners.channels - ).size; } this.#pubSubState[inProgressKey] += channelsCounter; From 0ab224504961212fe44cf3972c7a2902346e1627 Mon Sep 17 00:00:00 2001 From: leibale Date: Sat, 18 Sep 2021 05:52:54 -0400 Subject: [PATCH 11/40] ref #1653 - better types --- lib/client.ts | 164 ++++++++++++++-------------- lib/cluster.ts | 89 +++++++-------- lib/commands/GEOSEARCHSTORE.spec.ts | 2 +- lib/commands/GETEX.ts | 3 +- lib/commands/index.ts | 7 +- lib/lua-script.ts | 4 +- lib/multi-command.ts | 89 ++++++++------- lib/test-utils.ts | 8 +- 8 files changed, 176 insertions(+), 190 deletions(-) diff --git a/lib/client.ts b/lib/client.ts index aaa982da1cc..c9e9cecf924 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -13,7 +13,7 @@ import { encodeCommand, extendWithDefaultCommands, extendWithModulesAndScripts, import { Pool, Options as PoolOptions, createPool } from 'generic-pool'; import { ClientClosedError } from './errors'; -export interface RedisClientOptions { +export interface RedisClientOptions { socket?: RedisSocketOptions; modules?: M; scripts?: S; @@ -43,51 +43,25 @@ type WithScripts = { export type WithPlugins = WithCommands & WithModules & WithScripts; -export type RedisClientType = +export type RedisClientType = WithPlugins & RedisClient; export interface ClientCommandOptions extends QueueCommandOptions { isolated?: boolean; } -export default class RedisClient extends EventEmitter { +export default class RedisClient extends EventEmitter { static commandOptions(options: ClientCommandOptions): CommandOptions { return commandOptions(options); } - static async commandsExecutor( - this: RedisClient, - command: RedisCommand, - args: Array - ): Promise> { - const { args: redisArgs, options } = transformCommandArguments(command, args); - - return command.transformReply( - await this.#sendCommand(redisArgs, options, command.BUFFER_MODE), - redisArgs.preserve, - ); - } - - static async #scriptsExecutor( - this: RedisClient, - script: RedisLuaScript, - args: Array - ): Promise { - const { args: redisArgs, options } = transformCommandArguments(script, args); - - return script.transformReply( - await this.executeScript(script, redisArgs, options, script.BUFFER_MODE), - redisArgs.preserve - ); - } - - static create(options?: RedisClientOptions): RedisClientType { + static create(options?: RedisClientOptions): RedisClientType { const Client = (extendWithModulesAndScripts({ BaseClass: RedisClient, modules: options?.modules, - modulesCommandsExecutor: RedisClient.commandsExecutor, + modulesCommandsExecutor: RedisClient.prototype.commandsExecutor, scripts: options?.scripts, - scriptsExecutor: RedisClient.#scriptsExecutor + scriptsExecutor: RedisClient.prototype.scriptsExecutor })); if (Client !== RedisClient) { @@ -104,7 +78,7 @@ export default class RedisClient = {}; #selectedDB = 0; - get options(): RedisClientOptions | null | undefined { + get options(): RedisClientOptions | undefined { return this.#options; } @@ -240,6 +214,72 @@ export default class RedisClient): Promise> { + const { args: redisArgs, options } = transformCommandArguments(command, args); + + return command.transformReply( + await this.#sendCommand(redisArgs, options, command.BUFFER_MODE), + redisArgs.preserve, + ); + } + + sendCommand(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { + return this.#sendCommand(args, options, bufferMode); + } + + // using `#sendCommand` cause `sendCommand` is overwritten in legacy mode + async #sendCommand(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { + if (!this.#socket.isOpen) { + throw new ClientClosedError(); + } + + if (options?.isolated) { + return this.executeIsolated(isolatedClient => + isolatedClient.sendCommand(args, { + ...options, + isolated: false + }) + ); + } + + const promise = this.#queue.addCommand(args, options, bufferMode); + this.#tick(); + return await promise; + } + + async scriptsExecutor(script: RedisLuaScript, args: Array): Promise> { + const { args: redisArgs, options } = transformCommandArguments(script, args); + + return script.transformReply( + await this.executeScript(script, redisArgs, options, script.BUFFER_MODE), + redisArgs.preserve + ); + } + + async executeScript(script: RedisLuaScript, args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise> { + try { + return await this.#sendCommand([ + 'EVALSHA', + script.SHA1, + script.NUMBER_OF_KEYS.toString(), + ...args + ], options, bufferMode); + } catch (err: any) { + if (!err?.message?.startsWith?.('NOSCRIPT')) { + throw err; + } + + return await this.#sendCommand([ + 'EVAL', + script.SCRIPT, + script.NUMBER_OF_KEYS.toString(), + ...args + ], options, bufferMode); + } + } + + + async SELECT(db: number): Promise; async SELECT(options: CommandOptions, db: number): Promise; async SELECT(options?: any, db?: any): Promise { @@ -300,30 +340,6 @@ export default class RedisClient(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { - return this.#sendCommand(args, options, bufferMode); - } - - // using `#sendCommand` cause `sendCommand` is overwritten in legacy mode - async #sendCommand(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { - if (!this.#socket.isOpen) { - throw new ClientClosedError(); - } - - if (options?.isolated) { - return this.executeIsolated(isolatedClient => - isolatedClient.sendCommand(args, { - ...options, - isolated: false - }) - ); - } - - const promise = this.#queue.addCommand(args, options, bufferMode); - this.#tick(); - return await promise; - } - #tick(): void { if (!this.#socket.isSocketExists) { return; @@ -350,26 +366,11 @@ export default class RedisClient> { - try { - return await this.#sendCommand([ - 'EVALSHA', - script.SHA1, - script.NUMBER_OF_KEYS.toString(), - ...args - ], options, bufferMode); - } catch (err: any) { - if (!err?.message?.startsWith?.('NOSCRIPT')) { - throw err; - } - - return await this.#sendCommand([ - 'EVAL', - script.SCRIPT, - script.NUMBER_OF_KEYS.toString(), - ...args - ], options, bufferMode); - } + multi(): RedisMultiCommandType { + return new (this as any).Multi( + this.#multiExecutor.bind(this), + this.#options + ); } #multiExecutor(commands: Array, chainId?: symbol): Promise> { @@ -386,13 +387,6 @@ export default class RedisClient { - return new (this as any).Multi( - this.#multiExecutor.bind(this), - this.#options - ); - } - async* scanIterator(options?: ScanCommandOptions): AsyncIterable { let cursor = 0; do { @@ -451,5 +445,5 @@ export default class RedisClient { maxCommandRedirections?: number; } -export type RedisClusterType = - WithPlugins & RedisCluster; +export type RedisClusterType = + WithPlugins & RedisCluster; -export default class RedisCluster extends EventEmitter { +export default class RedisCluster extends EventEmitter { static #extractFirstKey(command: RedisCommand, originalArgs: Array, redisArgs: TransformArgumentsReply): string | Buffer | undefined { if (command.FIRST_KEY_INDEX === undefined) { return undefined; @@ -30,54 +30,13 @@ export default class RedisCluster - ): Promise> { - const { args: redisArgs, options } = transformCommandArguments(command, args); - - const reply = command.transformReply( - await this.sendCommand( - RedisCluster.#extractFirstKey(command, args, redisArgs), - command.IS_READ_ONLY, - redisArgs, - options, - command.BUFFER_MODE - ), - redisArgs.preserve - ); - - return reply; - } - - static async #scriptsExecutor( - this: RedisCluster, - script: RedisLuaScript, - args: Array - ): Promise { - const { args: redisArgs, options } = transformCommandArguments(script, args); - - const reply = script.transformReply( - await this.executeScript( - script, - args, - redisArgs, - options - ), - redisArgs.preserve - ); - - return reply; - } - - static create(options?: RedisClusterOptions): RedisClusterType { + static create(options?: RedisClusterOptions): RedisClusterType { return new (extendWithModulesAndScripts({ BaseClass: RedisCluster, modules: options?.modules, - modulesCommandsExecutor: RedisCluster.commandsExecutor, + modulesCommandsExecutor: RedisCluster.prototype.commandsExecutor, scripts: options?.scripts, - scriptsExecutor: RedisCluster.#scriptsExecutor + scriptsExecutor: RedisCluster.prototype.scriptsExecutor }))(options); } @@ -101,6 +60,23 @@ export default class RedisCluster): Promise> { + const { args: redisArgs, options } = transformCommandArguments(command, args); + + const reply = command.transformReply( + await this.sendCommand( + RedisCluster.#extractFirstKey(command, args, redisArgs), + command.IS_READ_ONLY, + redisArgs, + options, + command.BUFFER_MODE + ), + redisArgs.preserve + ); + + return reply; + } + async sendCommand( firstKey: string | Buffer | undefined, isReadonly: boolean | undefined, @@ -125,6 +101,22 @@ export default class RedisCluster): Promise> { + const { args: redisArgs, options } = transformCommandArguments(script, args); + + const reply = script.transformReply( + await this.executeScript( + script, + args, + redisArgs, + options + ), + redisArgs.preserve + ); + + return reply; + } + async executeScript( script: RedisLuaScript, originalArgs: Array, @@ -208,5 +200,4 @@ export default class RedisCluster { describe('transformArguments', () => { it('simple', () => { assert.deepEqual( - transformArguments('destination', 'source', 'member', { + transformArguments('destination', '/home/leibale/Workspace/node-redis/lib/commands/GEOSEARCHSTORE.spec.tssource', 'member', { radius: 1, unit: 'm' }, { diff --git a/lib/commands/GETEX.ts b/lib/commands/GETEX.ts index ca1465b7ee5..214dae5c7ab 100644 --- a/lib/commands/GETEX.ts +++ b/lib/commands/GETEX.ts @@ -1,3 +1,4 @@ +import { TransformArgumentsReply } from '.'; import { transformEXAT, transformPXAT, transformReplyStringNull } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -14,7 +15,7 @@ type GetExModes = { PERSIST: true; }; -export function transformArguments(key: string, mode: GetExModes) { +export function transformArguments(key: string, mode: GetExModes): TransformArgumentsReply { const args = ['GETEX', key]; if ('EX' in mode) { diff --git a/lib/commands/index.ts b/lib/commands/index.ts index dce28ac0937..6e5310b811a 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -753,7 +753,10 @@ export interface RedisCommands { } export interface RedisModule { - [key: string]: RedisCommand; + [command: string]: RedisCommand; } -export type RedisModules = Record; +export interface RedisModules { + [module: string]: RedisModule; +} +// export type RedisModules = Record; diff --git a/lib/lua-script.ts b/lib/lua-script.ts index 183c42f219c..be16f9b9133 100644 --- a/lib/lua-script.ts +++ b/lib/lua-script.ts @@ -13,10 +13,10 @@ export interface SHA1 { export type RedisLuaScript = RedisLuaScriptConfig & SHA1; export interface RedisLuaScripts { - [key: string]: RedisLuaScript; + [script: string]: RedisLuaScript; } -export function defineScript(script: S): S & SHA1 { +export function defineScript(script: RedisLuaScriptConfig): typeof script & SHA1 { return { ...script, SHA1: scriptSha1(script.SCRIPT) diff --git a/lib/multi-command.ts b/lib/multi-command.ts index 53f439d8f36..a329a5dbf19 100644 --- a/lib/multi-command.ts +++ b/lib/multi-command.ts @@ -21,7 +21,8 @@ type WithScripts = { [P in keyof S]: RedisMultiCommandSignature }; -export type RedisMultiCommandType = RedisMultiCommand & WithCommands & WithModules & WithScripts; +export type RedisMultiCommandType = + RedisMultiCommand & WithCommands & WithModules & WithScripts; export interface MultiQueuedCommand { args: TransformArgumentsReply; @@ -31,60 +32,20 @@ export interface MultiQueuedCommand { export type RedisMultiExecutor = (queue: Array, chainId?: symbol) => Promise>; -export default class RedisMultiCommand { - static commandsExecutor(this: RedisMultiCommand, command: RedisCommand, args: Array): RedisMultiCommand { - return this.addCommand( - command.transformArguments(...args), - command.transformReply - ); - } - - static #scriptsExecutor( - this: RedisMultiCommand, - script: RedisLuaScript, - args: Array - ): RedisMultiCommand { - const transformedArguments: TransformArgumentsReply = []; - if (this.#scriptsInUse.has(script.SHA1)) { - transformedArguments.push( - 'EVALSHA', - script.SHA1 - ); - } else { - this.#scriptsInUse.add(script.SHA1); - transformedArguments.push( - 'EVAL', - script.SCRIPT - ); - } - - transformedArguments.push(script.NUMBER_OF_KEYS.toString()); - - const scriptArguments = script.transformArguments(...args); - transformedArguments.push(...scriptArguments); - if (scriptArguments.preserve) { - transformedArguments.preserve = scriptArguments.preserve; - } - - return this.addCommand( - transformedArguments, - script.transformReply - ); - } - +export default class RedisMultiCommand { static extend( clientOptions?: RedisClientOptions ): new (...args: ConstructorParameters) => RedisMultiCommandType { return extendWithModulesAndScripts({ BaseClass: RedisMultiCommand, modules: clientOptions?.modules, - modulesCommandsExecutor: RedisMultiCommand.commandsExecutor, + modulesCommandsExecutor: RedisMultiCommand.prototype.commandsExecutor, scripts: clientOptions?.scripts, - scriptsExecutor: RedisMultiCommand.#scriptsExecutor + scriptsExecutor: RedisMultiCommand.prototype.scriptsExecutor }); } - static create( + static create( executor: RedisMultiExecutor, clientOptions?: RedisClientOptions ): RedisMultiCommandType { @@ -153,6 +114,42 @@ export default class RedisMultiCommand): void => (this as any).addCommand(name, args); } + commandsExecutor(command: RedisCommand, args: Array): this { + return this.addCommand( + command.transformArguments(...args), + command.transformReply + ); + } + + scriptsExecutor(script: RedisLuaScript, args: Array): this { + const transformedArguments: TransformArgumentsReply = []; + if (this.#scriptsInUse.has(script.SHA1)) { + transformedArguments.push( + 'EVALSHA', + script.SHA1 + ); + } else { + this.#scriptsInUse.add(script.SHA1); + transformedArguments.push( + 'EVAL', + script.SCRIPT + ); + } + + transformedArguments.push(script.NUMBER_OF_KEYS.toString()); + + const scriptArguments = script.transformArguments(...args); + transformedArguments.push(...scriptArguments); + if (scriptArguments.preserve) { + transformedArguments.preserve = scriptArguments.preserve; + } + + return this.addCommand( + transformedArguments, + script.transformReply + ); + } + addCommand(args: TransformArgumentsReply, transformReply?: RedisCommand['transformReply']): this { this.#queue.push({ args, @@ -205,4 +202,4 @@ export default class RedisMultiCommand): Promise { const SLOTS = 16384; interface SpawnRedisClusterNodeResult extends SpawnRedisServerResult { - client: RedisClientType + client: RedisClientType } async function spawnRedisClusterNode( @@ -281,7 +281,7 @@ export function describeHandleMinimumRedisVersion(minimumVersion: PartialRedisVe export function itWithClient( type: TestRedisServers, title: string, - fn: (client: RedisClientType) => Promise, + fn: (client: RedisClientType) => Promise, options?: RedisTestOptions ): void { it(title, async function () { @@ -306,7 +306,7 @@ export function itWithClient( export function itWithCluster( type: TestRedisClusters, title: string, - fn: (cluster: RedisClusterType) => Promise, + fn: (cluster: RedisClusterType) => Promise, options?: RedisTestOptions ): void { it(title, async function () { @@ -328,7 +328,7 @@ export function itWithCluster( }); } -export function itWithDedicatedCluster(title: string, fn: (cluster: RedisClusterType) => Promise): void { +export function itWithDedicatedCluster(title: string, fn: (cluster: RedisClusterType) => Promise): void { it(title, async function () { this.timeout(10000); From 54124793ad1b633d39d372bdff487c9888c017a7 Mon Sep 17 00:00:00 2001 From: leibale Date: Sat, 18 Sep 2021 05:58:08 -0400 Subject: [PATCH 12/40] better types --- lib/commands/SETBIT.ts | 3 ++- lib/commands/index.ts | 4 ++-- lib/test-utils.ts | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/commands/SETBIT.ts b/lib/commands/SETBIT.ts index 0cd41d1b975..33b2ff1a838 100644 --- a/lib/commands/SETBIT.ts +++ b/lib/commands/SETBIT.ts @@ -1,8 +1,9 @@ +import { TransformArgumentsReply } from '.'; import { BitValue, transformReplyBit } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, offset: number, value: BitValue) { +export function transformArguments(key: string, offset: number, value: BitValue): TransformArgumentsReply { return ['SETBIT', key, offset.toString(), value.toString()]; } diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 6e5310b811a..2c1a02d224f 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -743,9 +743,9 @@ export type TransformArgumentsReply = Array & { preserve?: unkn export interface RedisCommand { FIRST_KEY_INDEX?: number | ((...args: Array) => string); IS_READ_ONLY?: boolean; - transformArguments(...args: Array): TransformArgumentsReply; + transformArguments(this: void, zpte...args: Array): TransformArgumentsReply; BUFFER_MODE?: boolean; - transformReply(reply: RedisReply, preserved?: unknown): any; + transformReply(this: void, reply: RedisReply, preserved?: unknown): any; } export interface RedisCommands { diff --git a/lib/test-utils.ts b/lib/test-utils.ts index f68857d61e6..84685923693 100644 --- a/lib/test-utils.ts +++ b/lib/test-utils.ts @@ -1,7 +1,5 @@ import { strict as assert } from 'assert'; import RedisClient, { RedisClientType } from './client'; -import { RedisModules } from './commands'; -import { RedisLuaScripts } from './lua-script'; import { execSync, spawn } from 'child_process'; import { once } from 'events'; import { RedisSocketOptions } from './socket'; @@ -370,4 +368,4 @@ export async function waitTillBeenCalled(spy: SinonSpy): Promise { await promiseTimeout(1); } while (spy.callCount === calls) -} \ No newline at end of file +} From 10b9c59e0ffe2f2bfdd926080bf4c92a516cedd4 Mon Sep 17 00:00:00 2001 From: leibale Date: Sat, 18 Sep 2021 06:06:17 -0400 Subject: [PATCH 13/40] fix 54124793ad1b633d39d372bdff487c9888c017a7 --- lib/commands/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 2c1a02d224f..93220630980 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -743,7 +743,7 @@ export type TransformArgumentsReply = Array & { preserve?: unkn export interface RedisCommand { FIRST_KEY_INDEX?: number | ((...args: Array) => string); IS_READ_ONLY?: boolean; - transformArguments(this: void, zpte...args: Array): TransformArgumentsReply; + transformArguments(this: void, ...args: Array): TransformArgumentsReply; BUFFER_MODE?: boolean; transformReply(this: void, reply: RedisReply, preserved?: unknown): any; } From 3cd31e37c2e9f6c763324b66ac71b3d55702e29e Mon Sep 17 00:00:00 2001 From: Leibale Eidelman Date: Sat, 18 Sep 2021 13:55:45 -0400 Subject: [PATCH 14/40] Update GEOSEARCHSTORE.spec.ts --- lib/commands/GEOSEARCHSTORE.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commands/GEOSEARCHSTORE.spec.ts b/lib/commands/GEOSEARCHSTORE.spec.ts index b39e94fc40c..ad33c62b78c 100644 --- a/lib/commands/GEOSEARCHSTORE.spec.ts +++ b/lib/commands/GEOSEARCHSTORE.spec.ts @@ -8,7 +8,7 @@ describe('GEOSEARCHSTORE', () => { describe('transformArguments', () => { it('simple', () => { assert.deepEqual( - transformArguments('destination', '/home/leibale/Workspace/node-redis/lib/commands/GEOSEARCHSTORE.spec.tssource', 'member', { + transformArguments('destination', 'source', 'member', { radius: 1, unit: 'm' }, { From 3a169d5e35b73b4c35f4df37781737d405699030 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 20 Sep 2021 18:59:42 -0400 Subject: [PATCH 15/40] fix #1660 - add support for client.HSET('key', 'field', 'value') --- lib/commands/HSET.spec.ts | 9 ++++++++- lib/commands/HSET.ts | 13 +++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/commands/HSET.spec.ts b/lib/commands/HSET.spec.ts index af7bcb6eb20..601e7f967e1 100644 --- a/lib/commands/HSET.spec.ts +++ b/lib/commands/HSET.spec.ts @@ -4,6 +4,13 @@ import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from describe('HSET', () => { describe('transformArguments', () => { + it('field, value', () => { + assert.deepEqual( + transformArguments('key', 'field', 'value'), + ['HSET', 'key', 'field', 'value'] + ); + }); + it('Map', () => { assert.deepEqual( transformArguments('key', new Map([['field', 'value']])), @@ -30,7 +37,7 @@ describe('HSET', () => { itWithClient(TestRedisServers.OPEN, 'client.hSet', async client => { assert.equal( - await client.hSet('key', { field: 'value' }), + await client.hSet('key', 'field', 'value'), 1 ); }); diff --git a/lib/commands/HSET.ts b/lib/commands/HSET.ts index 3edaa64b4e8..cbd46061ad8 100644 --- a/lib/commands/HSET.ts +++ b/lib/commands/HSET.ts @@ -1,3 +1,4 @@ +import { TransformArgumentsReply } from '.'; import { transformReplyString } from './generic-transformers'; type HSETObject = Record; @@ -8,10 +9,18 @@ type HSETTuples = Array<[string, string]> | Array; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, value: HSETObject | HSETMap | HSETTuples): Array { +type GenericArguments = [key: string]; + +type SingleFieldArguments = [...generic: GenericArguments, field: string, value: string]; + +type MultipleFieldsArguments = [...generic: GenericArguments, value: HSETObject | HSETMap | HSETTuples]; + +export function transformArguments(...[ key, value, fieldValue ]: SingleFieldArguments | MultipleFieldsArguments): TransformArgumentsReply { const args = ['HSET', key]; - if (value instanceof Map) { + if (typeof value === 'string') { + args.push(value, fieldValue!); + } else if (value instanceof Map) { pushMap(args, value); } else if (Array.isArray(value)) { pushTuples(args, value); From d79bc55df6666c94cc44812aa861a6b208d56336 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 20 Sep 2021 19:35:13 -0400 Subject: [PATCH 16/40] upgrade dependencies, update README --- README.md | 186 +++++----- package-lock.json | 856 ++++++++++++++++++++++++---------------------- package.json | 10 +- 3 files changed, 541 insertions(+), 511 deletions(-) diff --git a/README.md b/README.md index bbcb7edc976..2c465ae69fa 100644 --- a/README.md +++ b/README.md @@ -35,17 +35,17 @@ npm install redis@next ### Basic Example ```typescript -import { createClient } from 'redis'; +import { createClient } from "redis"; (async () => { - const client = createClient(); + const client = createClient(); - client.on('error', (err) => console.log('Redis Client Error', err)); + client.on("error", (err) => console.log("Redis Client Error", err)); - await client.connect(); + await client.connect(); - await client.set('key', 'value'); - const value = await client.get('key'); + await client.set("key", "value"); + const value = await client.get("key"); })(); ``` @@ -53,9 +53,9 @@ The above code connects to localhost on port 6379. To connect to a different hos ```typescript createClient({ - socket: { - url: 'redis://alice:foobared@awesome.redis.server:6380' - } + socket: { + url: "redis://alice:foobared@awesome.redis.server:6380", + }, }); ``` @@ -67,28 +67,28 @@ There is built-in support for all of the [out-of-the-box Redis commands](https:/ ```typescript // raw Redis commands -await client.HSET('key', 'field', 'value'); -await client.HGETALL('key'); +await client.HSET("key", "field", "value"); +await client.HGETALL("key"); // friendly JavaScript commands -await client.hSet('key', 'field', 'value'); -await client.hGetAll('key'); +await client.hSet("key", "field", "value"); +await client.hGetAll("key"); ``` Modifiers to commands are specified using a JavaScript object: ```typescript -await client.set('key', 'value', { - EX: 10, - NX: true +await client.set("key", "value", { + EX: 10, + NX: true, }); ``` Replies will be transformed into useful data structures: ```typescript -await client.hGetAll('key'); // { field1: 'value1', field2: 'value2' } -await client.hVals('key'); // ['value1', 'value2'] +await client.hGetAll("key"); // { field1: 'value1', field2: 'value2' } +await client.hVals("key"); // ['value1', 'value2'] ``` ### Unsupported Redis Commands @@ -96,9 +96,9 @@ await client.hVals('key'); // ['value1', 'value2'] If you want to run commands and/or use arguments that Node Redis doesn't know about (yet!) use `.sendCommand()`: ```typescript -await client.sendCommand(['SET', 'key', 'value', 'NX']); // 'OK' +await client.sendCommand(["SET", "key", "value", "NX"]); // 'OK' -await client.sendCommand(['HGETALL', 'key']); // ['key1', 'field1', 'key2', 'field2'] +await client.sendCommand(["HGETALL", "key"]); // ['key1', 'field1', 'key2', 'field2'] ``` ### Transactions (Multi/Exec) @@ -106,12 +106,13 @@ await client.sendCommand(['HGETALL', 'key']); // ['key1', 'field1', 'key2', 'fie Start a [transaction](https://redis.io/topics/transactions) by calling `.multi()`, then chaining your commands. When you're done, call `.exec()` and you'll get an array back with your results: ```typescript -await client.set('another-key', 'another-value'); +await client.set("another-key", "another-value"); -const [ setKeyReply, otherKeyValue ] = await client.multi() - .set('key', 'value') - .get('another-key') - .exec(); // ['OK', 'another-value'] +const [setKeyReply, otherKeyValue] = await client + .multi() + .set("key", "value") + .get("another-key") + .exec(); // ['OK', 'another-value'] ``` You can also [watch](https://redis.io/topics/transactions#optimistic-locking-using-check-and-set) keys by calling `.watch()`. Your transaction will abort if any of the watched keys change. @@ -125,14 +126,11 @@ Any command can be run on a new connection by specifying the `isolated` option. This pattern works especially well for blocking commands—such as `BLPOP` and `BLMOVE`: ```typescript -import { commandOptions } from 'redis'; +import { commandOptions } from "redis"; -const blPopPromise = client.blPop( - commandOptions({ isolated: true }), - 'key' -); +const blPopPromise = client.blPop(commandOptions({ isolated: true }), "key"); -await client.lPush('key', ['1', '2']); +await client.lPush("key", ["1", "2"]); await blPopPromise; // '2' ``` @@ -152,23 +150,23 @@ await subscriber.connect(); Once you have one, simply subscribe and unsubscribe as needed: ```typescript -await subscriber.subscribe('channel', message => { - console.log(message); // 'message' +await subscriber.subscribe("channel", (message) => { + console.log(message); // 'message' }); -await subscriber.pSubscribe('channe*', (message, channel) => { - console.log(message, channel); // 'message', 'channel' +await subscriber.pSubscribe("channe*", (message, channel) => { + console.log(message, channel); // 'message', 'channel' }); -await subscriber.unsubscribe('channel'); +await subscriber.unsubscribe("channel"); -await subscriber.pUnsubscribe('channe*'); +await subscriber.pUnsubscribe("channe*"); ``` Publish a message on a channel: ```typescript -await publisher.publish('channel', 'message'); +await publisher.publish("channel", "message"); ``` ### Scan Iterator @@ -177,26 +175,29 @@ await publisher.publish('channel', 'message'); ```typescript for await (const key of client.scanIterator()) { - // use the key! - await client.get(key); + // use the key! + await client.get(key); } ``` This works with `HSCAN`, `SSCAN`, and `ZSCAN` too: ```typescript -for await (const member of client.hScanIterator('hash')) {} -for await (const { field, value } of client.sScanIterator('set')) {} -for await (const { member, score } of client.zScanIterator('sorted-set')) {} +for await (const member of client.hScanIterator("hash")) { +} +for await (const { field, value } of client.sScanIterator("set")) { +} +for await (const { member, score } of client.zScanIterator("sorted-set")) { +} ``` You can override the default options by providing a configuration object: ```typescript client.scanIterator({ - TYPE: 'string', // `SCAN` only - MATCH: 'patter*', - COUNT: 100 + TYPE: "string", // `SCAN` only + MATCH: "patter*", + COUNT: 100, }); ``` @@ -205,30 +206,29 @@ client.scanIterator({ Define new functions using [Lua scripts](https://redis.io/commands/eval) which execute on the Redis server: ```typescript -import { createClient, defineScript } from 'redis'; +import { createClient, defineScript } from "redis"; (async () => { - const client = createClient({ - scripts: { - add: defineScript({ - NUMBER_OF_KEYS: 1, - SCRIPT: - 'local val = redis.pcall("GET", KEYS[1]);' + - 'return val + ARGV[1];', - transformArguments(key: string, toAdd: number): Array { - return [key, number.toString()]; - }, - transformReply(reply: number): number { - return reply; - } - }) - } - }); - - await client.connect(); - - await client.set('key', '1'); - await client.add('key', 2); // 3 + const client = createClient({ + scripts: { + add: defineScript({ + NUMBER_OF_KEYS: 1, + SCRIPT: + 'local val = redis.pcall("GET", KEYS[1]);' + "return val + ARGV[1];", + transformArguments(key: string, toAdd: number): Array { + return [key, number.toString()]; + }, + transformReply(reply: number): number { + return reply; + }, + }), + }, + }); + + await client.connect(); + + await client.set("key", "1"); + await client.add("key", 2); // 3 })(); ``` @@ -237,25 +237,28 @@ import { createClient, defineScript } from 'redis'; Connecting to a cluster is a bit different. Create the client by specifying some (or all) of the nodes in your cluster and then use it like a non-clustered client: ```typescript -import { createCluster } from 'redis'; +import { createCluster } from "redis"; (async () => { - const cluster = createCluster({ - rootNodes: [{ - host: '10.0.0.1', - port: 30001 - }, { - host: '10.0.0.2', - port: 30002 - }] - }); - - cluster.on('error', (err) => console.log('Redis Cluster Error', err)); - - await cluster.connect(); - - await cluster.set('key', 'value'); - const value = await cluster.get('key'); + const cluster = createCluster({ + rootNodes: [ + { + host: "10.0.0.1", + port: 30001, + }, + { + host: "10.0.0.2", + port: 30002, + }, + ], + }); + + cluster.on("error", (err) => console.log("Redis Cluster Error", err)); + + await cluster.connect(); + + await cluster.set("key", "value"); + const value = await cluster.get("key"); })(); ``` @@ -264,16 +267,16 @@ import { createCluster } from 'redis'; Node Redis will automatically pipeline requests that are made during the same "tick". ```typescript -client.set('Tm9kZSBSZWRpcw==', 'users:1'); -client.sAdd('users:1:tokens', 'Tm9kZSBSZWRpcw=='); +client.set("Tm9kZSBSZWRpcw==", "users:1"); +client.sAdd("users:1:tokens", "Tm9kZSBSZWRpcw=="); ``` Of course, if you don't do something with your Promises you're certain to get [unhandled Promise exceptions](https://nodejs.org/api/process.html#process_event_unhandledrejection). To take advantage of auto-pipelining and handle your Promises, use `Promise.all()`. ```typescript await Promise.all([ - client.set('Tm9kZSBSZWRpcw==', 'users:1'), - client.sAdd('users:1:tokens', 'Tm9kZSBSZWRpcw==') + client.set("Tm9kZSBSZWRpcw==", "users:1"), + client.sAdd("users:1:tokens", "Tm9kZSBSZWRpcw=="), ]); ``` @@ -283,8 +286,9 @@ If you'd like to contribute, check out the [contributing guide](CONTRIBUTING.md) Thank you to all the people who already contributed to Node Redis! - - + + + ## License This repository is licensed under the "MIT" license. See [LICENSE](LICENSE). diff --git a/package-lock.json b/package-lock.json index ac623c60e6a..9986a955bf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.7.10", + "@types/node": "^16.9.4", "@types/sinon": "^10.0.2", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", @@ -25,12 +25,12 @@ "nyc": "^15.1.0", "release-it": "^14.11.5", "sinon": "^11.1.2", - "source-map-support": "^0.5.19", + "source-map-support": "^0.5.20", "ts-node": "^10.2.1", - "typedoc": "^0.21.9", + "typedoc": "^0.22.4", "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "^3.10.4", - "typescript": "^4.4.2", + "typedoc-plugin-markdown": "^3.11.0", + "typescript": "^4.4.3", "which": "^2.0.2" }, "engines": { @@ -59,20 +59,20 @@ } }, "node_modules/@babel/core": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.0.tgz", - "integrity": "sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==", + "version": "7.15.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.5.tgz", + "integrity": "sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.0", - "@babel/helper-compilation-targets": "^7.15.0", - "@babel/helper-module-transforms": "^7.15.0", - "@babel/helpers": "^7.14.8", - "@babel/parser": "^7.15.0", - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0", + "@babel/generator": "^7.15.4", + "@babel/helper-compilation-targets": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.4", + "@babel/helpers": "^7.15.4", + "@babel/parser": "^7.15.5", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -89,12 +89,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.0.tgz", - "integrity": "sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", + "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", "dev": true, "dependencies": { - "@babel/types": "^7.15.0", + "@babel/types": "^7.15.4", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, @@ -103,9 +103,9 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz", - "integrity": "sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", + "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", "dev": true, "dependencies": { "@babel/compat-data": "^7.15.0", @@ -121,141 +121,141 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz", - "integrity": "sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", + "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", "dev": true, "dependencies": { - "@babel/helper-get-function-arity": "^7.14.5", - "@babel/template": "^7.14.5", - "@babel/types": "^7.14.5" + "@babel/helper-get-function-arity": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-get-function-arity": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz", - "integrity": "sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", + "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", "dev": true, "dependencies": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz", - "integrity": "sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", + "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", "dev": true, "dependencies": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.0.tgz", - "integrity": "sha512-Jq8H8U2kYiafuj2xMTPQwkTBnEEdGKpT35lJEQsRRjnG0LW3neucsaMWLgKcwu3OHKNeYugfw+Z20BXBSEs2Lg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", + "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", "dev": true, "dependencies": { - "@babel/types": "^7.15.0" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", - "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", + "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", "dev": true, "dependencies": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz", - "integrity": "sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.7.tgz", + "integrity": "sha512-ZNqjjQG/AuFfekFTY+7nY4RgBSklgTu970c7Rj3m/JOhIu5KPBUuTA9AY6zaKcUvk4g6EbDXdBnhi35FAssdSw==", "dev": true, "dependencies": { - "@babel/helper-module-imports": "^7.14.5", - "@babel/helper-replace-supers": "^7.15.0", - "@babel/helper-simple-access": "^7.14.8", - "@babel/helper-split-export-declaration": "^7.14.5", - "@babel/helper-validator-identifier": "^7.14.9", - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/helper-module-imports": "^7.15.4", + "@babel/helper-replace-supers": "^7.15.4", + "@babel/helper-simple-access": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/helper-validator-identifier": "^7.15.7", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.14.5.tgz", - "integrity": "sha512-IqiLIrODUOdnPU9/F8ib1Fx2ohlgDhxnIDU7OEVi+kAbEZcyiF7BLU8W6PfvPi9LzztjS7kcbzbmL7oG8kD6VA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", + "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", "dev": true, "dependencies": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.0.tgz", - "integrity": "sha512-6O+eWrhx+HEra/uJnifCwhwMd6Bp5+ZfZeJwbqUTuqkhIT6YcRhiZCOOFChRypOIe0cV46kFrRBlm+t5vHCEaA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", + "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", "dev": true, "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.15.0", - "@babel/helper-optimise-call-expression": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/helper-member-expression-to-functions": "^7.15.4", + "@babel/helper-optimise-call-expression": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.14.8", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz", - "integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", + "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", "dev": true, "dependencies": { - "@babel/types": "^7.14.8" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz", - "integrity": "sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", + "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", "dev": true, "dependencies": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.14.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz", - "integrity": "sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -271,14 +271,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.3.tgz", - "integrity": "sha512-HwJiz52XaS96lX+28Tnbu31VeFSQJGOeKHJeaEPQlTl7PnlhFElWPj8tUXtqFIzeN86XxXoBr+WFAyK2PPVz6g==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", + "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", "dev": true, "dependencies": { - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" @@ -370,9 +370,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.3.tgz", - "integrity": "sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", + "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -382,32 +382,32 @@ } }, "node_modules/@babel/template": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.14.5.tgz", - "integrity": "sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", + "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", "dev": true, "dependencies": { "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.14.5", - "@babel/types": "^7.14.5" + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.0.tgz", - "integrity": "sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", + "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.0", - "@babel/helper-function-name": "^7.14.5", - "@babel/helper-hoist-variables": "^7.14.5", - "@babel/helper-split-export-declaration": "^7.14.5", - "@babel/parser": "^7.15.0", - "@babel/types": "^7.15.0", + "@babel/generator": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -416,9 +416,9 @@ } }, "node_modules/@babel/types": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", - "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", + "version": "7.15.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", + "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.14.9", @@ -607,9 +607,9 @@ } }, "node_modules/@octokit/auth-token": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", - "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", + "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", "dev": true, "dependencies": { "@octokit/types": "^6.0.3" @@ -653,18 +653,18 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.0.0.tgz", - "integrity": "sha512-k1iO2zKuEjjRS1EJb4FwSLk+iF6EGp+ZV0OMRViQoWhQ1fZTk9hg1xccZII5uyYoiqcbC73MRBmT45y1vp2PPg==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.2.2.tgz", + "integrity": "sha512-EVcXQ+ZrC04cg17AMg1ofocWMxHDn17cB66ZHgYc0eUwjFtxS0oBzkyw2VqIrHBwVgtfoYrq1WMQfQmMjUwthw==", "dev": true }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz", - "integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==", + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.3.tgz", + "integrity": "sha512-kdc65UEsqze/9fCISq6BxLzeB9qf0vKvKojIfzgwf4tEF+Wy6c9dXnPFE6vgpoDFB1Z5Jek5WFVU6vL1w22+Iw==", "dev": true, "dependencies": { - "@octokit/types": "^6.26.0" + "@octokit/types": "^6.28.1" }, "peerDependencies": { "@octokit/core": ">=2" @@ -730,18 +730,18 @@ } }, "node_modules/@octokit/types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.26.0.tgz", - "integrity": "sha512-RDxZBAFMtqs1ZPnbUu1e7ohPNfoNhTiep4fErY7tZs995BeHu369Vsh5woMIaFbllRWEZBfvTCS4hvDnMPiHrA==", + "version": "6.28.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.28.1.tgz", + "integrity": "sha512-XlxDoQLFO5JnFZgKVQTYTvXRsQFfr/GwDUU108NJ9R5yFPkA2qXhTJjYuul3vE4eLXP40FA2nysOu2zd6boE+w==", "dev": true, "dependencies": { - "@octokit/openapi-types": "^10.0.0" + "@octokit/openapi-types": "^10.2.2" } }, "node_modules/@sindresorhus/is": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz", - "integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.0.tgz", + "integrity": "sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw==", "dev": true, "engines": { "node": ">=10" @@ -840,9 +840,9 @@ "dev": true }, "node_modules/@types/keyv": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.2.tgz", - "integrity": "sha512-/FvAK2p4jQOaJ6CGDHJTqZcUtbZe820qIeTg7o0Shg7drB4JHeL+V/dhSaly7NXx6u8eSee+r7coT+yuJEvDLg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.3.tgz", + "integrity": "sha512-FXCJgyyN3ivVgRoml4h94G/p3kY+u/B86La+QptcqJaWtBWtmc6TtkNfS40n9bIvyLteHh7zXOtgbobORKPbDg==", "dev": true, "dependencies": { "@types/node": "*" @@ -855,9 +855,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.7.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", - "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==", + "version": "16.9.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz", + "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA==", "dev": true }, "node_modules/@types/parse-json": { @@ -903,9 +903,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz", - "integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", + "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -915,9 +915,9 @@ } }, "node_modules/acorn-walk": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.1.1.tgz", - "integrity": "sha512-FbJdceMlPHEAWJOILDk1fXD8lnTlEIWFkqtfk+MvmL5q/qlHfN7GEHcsFZWt/Tea9jRNPWUZG4G976nqAAmU9w==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, "engines": { "node": ">=0.4.0" @@ -1032,9 +1032,9 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "engines": { "node": ">=8" @@ -1175,16 +1175,16 @@ } }, "node_modules/boxen": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.0.1.tgz", - "integrity": "sha512-49VBlw+PrWEF51aCmy7QIteYPIFZxSpvqBdP/2itCPPlJ49kj9zg/XPRFrdkne2W+CfwXUls8exMvu1RysZpKA==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", "dev": true, "dependencies": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", - "string-width": "^4.2.0", + "string-width": "^4.2.2", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" @@ -1249,14 +1249,14 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.16.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", - "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.0.tgz", + "integrity": "sha512-g2BJ2a0nEYvEFQC208q8mVAhfNwpZ5Mu8BwgtCdZKO3qx98HChmeg448fPdUzld8aFmfLgVh7yymqV+q1lJZ5g==", "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001251", + "caniuse-lite": "^1.0.30001254", "colorette": "^1.3.0", - "electron-to-chromium": "^1.3.811", + "electron-to-chromium": "^1.3.830", "escalade": "^3.1.1", "node-releases": "^1.1.75" }, @@ -1390,9 +1390,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001252", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001252.tgz", - "integrity": "sha512-I56jhWDGMtdILQORdusxBOH+Nl/KgQSdDmpJezYddnAkVOmnoU8zwjTV9xAjMIYxr0iPreEAVylCGcmHCjfaOw==", + "version": "1.0.30001258", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz", + "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==", "dev": true, "funding": { "type": "opencollective", @@ -1570,9 +1570,9 @@ "dev": true }, "node_modules/colorette": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", - "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", "dev": true }, "node_modules/combined-stream": { @@ -1845,9 +1845,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.827", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", - "integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==", + "version": "1.3.844", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.844.tgz", + "integrity": "sha512-7ES6GQVsbgsUA49/apqub51I9ij8E3QwGqq/IRvO6OPCly3how/YUSg1GPslRWq+BteT2h94iAIQdJbuVVH4Pg==", "dev": true }, "node_modules/emoji-regex": { @@ -1977,9 +1977,9 @@ } }, "node_modules/fastq": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz", - "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3068,6 +3068,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -3214,9 +3220,9 @@ "dev": true }, "node_modules/marked": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.2.tgz", - "integrity": "sha512-TMJQQ79Z0e3rJYazY0tIoMsFzteUGw9fB3FD+gzuIT3zLuG9L9ckIvUfF51apdJkcqc208jJN2KbtPbOvXtbjA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.4.tgz", + "integrity": "sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==", "dev": true, "bin": { "marked": "bin/marked" @@ -3419,10 +3425,13 @@ } }, "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.3.tgz", + "integrity": "sha512-BXSmNTLLDHT0UjQDg5E23x+0n/hPDjySqc0ELE4NpCa2wE5qmmaEWFRP/+v8pfuocchR9l5vFLbSB7CPE2ahvQ==", "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { "node": "4.x || >=6.0.0" } @@ -3440,9 +3449,9 @@ } }, "node_modules/node-releases": { - "version": "1.1.75", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", - "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", + "version": "1.1.76", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", + "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==", "dev": true }, "node_modules/normalize-path": { @@ -4201,15 +4210,6 @@ "node": ">=8" } }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -4773,12 +4773,12 @@ } }, "node_modules/shiki": { - "version": "0.9.10", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", - "integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.11.tgz", + "integrity": "sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==", "dev": true, "dependencies": { - "json5": "^2.2.0", + "jsonc-parser": "^3.0.0", "onigasm": "^2.2.5", "vscode-textmate": "5.2.0" } @@ -4798,9 +4798,9 @@ } }, "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.4.tgz", + "integrity": "sha512-rqYhcAnZ6d/vTPGghdrw7iumdcbXpsk1b8IG/rz+VWV51DM0p7XCtMoJ3qhPLIbp3tvyt3pKRbaaEMZYpHto8Q==", "dev": true }, "node_modules/sinon": { @@ -4852,9 +4852,9 @@ } }, "node_modules/source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", + "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", "dev": true, "dependencies": { "buffer-from": "^1.0.0", @@ -5073,6 +5073,12 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, "node_modules/ts-node": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz", @@ -5160,19 +5166,16 @@ } }, "node_modules/typedoc": { - "version": "0.21.9", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.9.tgz", - "integrity": "sha512-VRo7aII4bnYaBBM1lhw4bQFmUcDQV8m8tqgjtc7oXl87jc1Slbhfw2X5MccfcR2YnEClHDWgsiQGgNB8KJXocA==", + "version": "0.22.4", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.4.tgz", + "integrity": "sha512-M/a8NnPxq3/iZNNVjzFCK5gu4m//HTJIPbSS0JQVbkHJPP9wyepR12agylWTSqeVZe0xsbidVtO26+PP7iD/jw==", "dev": true, "dependencies": { "glob": "^7.1.7", - "handlebars": "^4.7.7", "lunr": "^2.3.9", - "marked": "^3.0.2", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shiki": "^0.9.8", - "typedoc-default-themes": "^0.12.10" + "marked": "^3.0.4", + "minimatch": "^3.0.4", + "shiki": "^0.9.11" }, "bin": { "typedoc": "bin/typedoc" @@ -5184,15 +5187,6 @@ "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x" } }, - "node_modules/typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/typedoc-github-wiki-theme": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.5.1.tgz", @@ -5204,21 +5198,21 @@ } }, "node_modules/typedoc-plugin-markdown": { - "version": "3.10.4", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.4.tgz", - "integrity": "sha512-if9w7S9fXLg73AYi/EoRSEhTOZlg3I8mIP8YEmvzSE33VrNXC9/hA0nVcLEwFVJeQY7ay6z67I6kW0KIv7LjeA==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.0.tgz", + "integrity": "sha512-zewcbzOlMV9nbhLsJhKBpoRW4J32LgbfdqwYfEfzzeE+wGOaOfsM6g7QH+ZKj8n+knH4sLCtk6XMN1TI/a1UuQ==", "dev": true, "dependencies": { "handlebars": "^4.7.7" }, "peerDependencies": { - "typedoc": ">=0.21.2" + "typedoc": ">=0.22.0" } }, "node_modules/typescript": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz", - "integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz", + "integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5229,9 +5223,9 @@ } }, "node_modules/uglify-js": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.1.tgz", - "integrity": "sha512-JhS3hmcVaXlp/xSo3PKY5R0JqKs5M3IV+exdLHW99qKvKivPO4Z8qbej6mte17SOPqAOVMjt/XGgWacnFSzM3g==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.2.tgz", + "integrity": "sha512-rtPMlmcO4agTUfz10CbgJ1k6UAoXM2gWb3GoMPPZB/+/Ackf8lNWk11K4rYi2D0apgoFRLtQOZhb+/iGNJq26A==", "dev": true, "optional": true, "bin": { @@ -5381,6 +5375,22 @@ "defaults": "^1.0.3" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -5712,20 +5722,20 @@ "dev": true }, "@babel/core": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.0.tgz", - "integrity": "sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==", + "version": "7.15.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.5.tgz", + "integrity": "sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==", "dev": true, "requires": { "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.0", - "@babel/helper-compilation-targets": "^7.15.0", - "@babel/helper-module-transforms": "^7.15.0", - "@babel/helpers": "^7.14.8", - "@babel/parser": "^7.15.0", - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0", + "@babel/generator": "^7.15.4", + "@babel/helper-compilation-targets": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.4", + "@babel/helpers": "^7.15.4", + "@babel/parser": "^7.15.5", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -5735,20 +5745,20 @@ } }, "@babel/generator": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.0.tgz", - "integrity": "sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", + "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", "dev": true, "requires": { - "@babel/types": "^7.15.0", + "@babel/types": "^7.15.4", "jsesc": "^2.5.1", "source-map": "^0.5.0" } }, "@babel/helper-compilation-targets": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz", - "integrity": "sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz", + "integrity": "sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ==", "dev": true, "requires": { "@babel/compat-data": "^7.15.0", @@ -5758,111 +5768,111 @@ } }, "@babel/helper-function-name": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz", - "integrity": "sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz", + "integrity": "sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.14.5", - "@babel/template": "^7.14.5", - "@babel/types": "^7.14.5" + "@babel/helper-get-function-arity": "^7.15.4", + "@babel/template": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/helper-get-function-arity": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz", - "integrity": "sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz", + "integrity": "sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-hoist-variables": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz", - "integrity": "sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz", + "integrity": "sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-member-expression-to-functions": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.0.tgz", - "integrity": "sha512-Jq8H8U2kYiafuj2xMTPQwkTBnEEdGKpT35lJEQsRRjnG0LW3neucsaMWLgKcwu3OHKNeYugfw+Z20BXBSEs2Lg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz", + "integrity": "sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA==", "dev": true, "requires": { - "@babel/types": "^7.15.0" + "@babel/types": "^7.15.4" } }, "@babel/helper-module-imports": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", - "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz", + "integrity": "sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-module-transforms": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz", - "integrity": "sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.7.tgz", + "integrity": "sha512-ZNqjjQG/AuFfekFTY+7nY4RgBSklgTu970c7Rj3m/JOhIu5KPBUuTA9AY6zaKcUvk4g6EbDXdBnhi35FAssdSw==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.14.5", - "@babel/helper-replace-supers": "^7.15.0", - "@babel/helper-simple-access": "^7.14.8", - "@babel/helper-split-export-declaration": "^7.14.5", - "@babel/helper-validator-identifier": "^7.14.9", - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/helper-module-imports": "^7.15.4", + "@babel/helper-replace-supers": "^7.15.4", + "@babel/helper-simple-access": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/helper-validator-identifier": "^7.15.7", + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.6" } }, "@babel/helper-optimise-call-expression": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.14.5.tgz", - "integrity": "sha512-IqiLIrODUOdnPU9/F8ib1Fx2ohlgDhxnIDU7OEVi+kAbEZcyiF7BLU8W6PfvPi9LzztjS7kcbzbmL7oG8kD6VA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz", + "integrity": "sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-replace-supers": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.0.tgz", - "integrity": "sha512-6O+eWrhx+HEra/uJnifCwhwMd6Bp5+ZfZeJwbqUTuqkhIT6YcRhiZCOOFChRypOIe0cV46kFrRBlm+t5vHCEaA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz", + "integrity": "sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw==", "dev": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.15.0", - "@babel/helper-optimise-call-expression": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/helper-member-expression-to-functions": "^7.15.4", + "@babel/helper-optimise-call-expression": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/helper-simple-access": { - "version": "7.14.8", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz", - "integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz", + "integrity": "sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg==", "dev": true, "requires": { - "@babel/types": "^7.14.8" + "@babel/types": "^7.15.4" } }, "@babel/helper-split-export-declaration": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz", - "integrity": "sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz", + "integrity": "sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw==", "dev": true, "requires": { - "@babel/types": "^7.14.5" + "@babel/types": "^7.15.4" } }, "@babel/helper-validator-identifier": { - "version": "7.14.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz", - "integrity": "sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", "dev": true }, "@babel/helper-validator-option": { @@ -5872,14 +5882,14 @@ "dev": true }, "@babel/helpers": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.3.tgz", - "integrity": "sha512-HwJiz52XaS96lX+28Tnbu31VeFSQJGOeKHJeaEPQlTl7PnlhFElWPj8tUXtqFIzeN86XxXoBr+WFAyK2PPVz6g==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.4.tgz", + "integrity": "sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ==", "dev": true, "requires": { - "@babel/template": "^7.14.5", - "@babel/traverse": "^7.15.0", - "@babel/types": "^7.15.0" + "@babel/template": "^7.15.4", + "@babel/traverse": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/highlight": { @@ -5952,43 +5962,43 @@ } }, "@babel/parser": { - "version": "7.15.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.3.tgz", - "integrity": "sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA==", + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", + "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", "dev": true }, "@babel/template": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.14.5.tgz", - "integrity": "sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.15.4.tgz", + "integrity": "sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg==", "dev": true, "requires": { "@babel/code-frame": "^7.14.5", - "@babel/parser": "^7.14.5", - "@babel/types": "^7.14.5" + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4" } }, "@babel/traverse": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.0.tgz", - "integrity": "sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw==", + "version": "7.15.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.4.tgz", + "integrity": "sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==", "dev": true, "requires": { "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.0", - "@babel/helper-function-name": "^7.14.5", - "@babel/helper-hoist-variables": "^7.14.5", - "@babel/helper-split-export-declaration": "^7.14.5", - "@babel/parser": "^7.15.0", - "@babel/types": "^7.15.0", + "@babel/generator": "^7.15.4", + "@babel/helper-function-name": "^7.15.4", + "@babel/helper-hoist-variables": "^7.15.4", + "@babel/helper-split-export-declaration": "^7.15.4", + "@babel/parser": "^7.15.4", + "@babel/types": "^7.15.4", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.15.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", - "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", + "version": "7.15.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.6.tgz", + "integrity": "sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.14.9", @@ -6129,9 +6139,9 @@ } }, "@octokit/auth-token": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", - "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", + "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", "dev": true, "requires": { "@octokit/types": "^6.0.3" @@ -6175,18 +6185,18 @@ } }, "@octokit/openapi-types": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.0.0.tgz", - "integrity": "sha512-k1iO2zKuEjjRS1EJb4FwSLk+iF6EGp+ZV0OMRViQoWhQ1fZTk9hg1xccZII5uyYoiqcbC73MRBmT45y1vp2PPg==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.2.2.tgz", + "integrity": "sha512-EVcXQ+ZrC04cg17AMg1ofocWMxHDn17cB66ZHgYc0eUwjFtxS0oBzkyw2VqIrHBwVgtfoYrq1WMQfQmMjUwthw==", "dev": true }, "@octokit/plugin-paginate-rest": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz", - "integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==", + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.3.tgz", + "integrity": "sha512-kdc65UEsqze/9fCISq6BxLzeB9qf0vKvKojIfzgwf4tEF+Wy6c9dXnPFE6vgpoDFB1Z5Jek5WFVU6vL1w22+Iw==", "dev": true, "requires": { - "@octokit/types": "^6.26.0" + "@octokit/types": "^6.28.1" } }, "@octokit/plugin-request-log": { @@ -6244,18 +6254,18 @@ } }, "@octokit/types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.26.0.tgz", - "integrity": "sha512-RDxZBAFMtqs1ZPnbUu1e7ohPNfoNhTiep4fErY7tZs995BeHu369Vsh5woMIaFbllRWEZBfvTCS4hvDnMPiHrA==", + "version": "6.28.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.28.1.tgz", + "integrity": "sha512-XlxDoQLFO5JnFZgKVQTYTvXRsQFfr/GwDUU108NJ9R5yFPkA2qXhTJjYuul3vE4eLXP40FA2nysOu2zd6boE+w==", "dev": true, "requires": { - "@octokit/openapi-types": "^10.0.0" + "@octokit/openapi-types": "^10.2.2" } }, "@sindresorhus/is": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz", - "integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.0.tgz", + "integrity": "sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw==", "dev": true }, "@sinonjs/commons": { @@ -6345,9 +6355,9 @@ "dev": true }, "@types/keyv": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.2.tgz", - "integrity": "sha512-/FvAK2p4jQOaJ6CGDHJTqZcUtbZe820qIeTg7o0Shg7drB4JHeL+V/dhSaly7NXx6u8eSee+r7coT+yuJEvDLg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.3.tgz", + "integrity": "sha512-FXCJgyyN3ivVgRoml4h94G/p3kY+u/B86La+QptcqJaWtBWtmc6TtkNfS40n9bIvyLteHh7zXOtgbobORKPbDg==", "dev": true, "requires": { "@types/node": "*" @@ -6360,9 +6370,9 @@ "dev": true }, "@types/node": { - "version": "16.7.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", - "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==", + "version": "16.9.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz", + "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA==", "dev": true }, "@types/parse-json": { @@ -6408,15 +6418,15 @@ "dev": true }, "acorn": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz", - "integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", + "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", "dev": true }, "acorn-walk": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.1.1.tgz", - "integrity": "sha512-FbJdceMlPHEAWJOILDk1fXD8lnTlEIWFkqtfk+MvmL5q/qlHfN7GEHcsFZWt/Tea9jRNPWUZG4G976nqAAmU9w==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, "aggregate-error": { @@ -6502,9 +6512,9 @@ } }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "ansi-styles": { @@ -6610,16 +6620,16 @@ } }, "boxen": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.0.1.tgz", - "integrity": "sha512-49VBlw+PrWEF51aCmy7QIteYPIFZxSpvqBdP/2itCPPlJ49kj9zg/XPRFrdkne2W+CfwXUls8exMvu1RysZpKA==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", "dev": true, "requires": { "ansi-align": "^3.0.0", "camelcase": "^6.2.0", "chalk": "^4.1.0", "cli-boxes": "^2.2.1", - "string-width": "^4.2.0", + "string-width": "^4.2.2", "type-fest": "^0.20.2", "widest-line": "^3.1.0", "wrap-ansi": "^7.0.0" @@ -6665,14 +6675,14 @@ "dev": true }, "browserslist": { - "version": "4.16.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", - "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.0.tgz", + "integrity": "sha512-g2BJ2a0nEYvEFQC208q8mVAhfNwpZ5Mu8BwgtCdZKO3qx98HChmeg448fPdUzld8aFmfLgVh7yymqV+q1lJZ5g==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001251", + "caniuse-lite": "^1.0.30001254", "colorette": "^1.3.0", - "electron-to-chromium": "^1.3.811", + "electron-to-chromium": "^1.3.830", "escalade": "^3.1.1", "node-releases": "^1.1.75" } @@ -6760,9 +6770,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001252", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001252.tgz", - "integrity": "sha512-I56jhWDGMtdILQORdusxBOH+Nl/KgQSdDmpJezYddnAkVOmnoU8zwjTV9xAjMIYxr0iPreEAVylCGcmHCjfaOw==", + "version": "1.0.30001258", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz", + "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==", "dev": true }, "chalk": { @@ -6894,9 +6904,9 @@ "dev": true }, "colorette": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", - "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", "dev": true }, "combined-stream": { @@ -7108,9 +7118,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.827", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", - "integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==", + "version": "1.3.844", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.844.tgz", + "integrity": "sha512-7ES6GQVsbgsUA49/apqub51I9ij8E3QwGqq/IRvO6OPCly3how/YUSg1GPslRWq+BteT2h94iAIQdJbuVVH4Pg==", "dev": true }, "emoji-regex": { @@ -7209,9 +7219,9 @@ } }, "fastq": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz", - "integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -7988,6 +7998,12 @@ "minimist": "^1.2.5" } }, + "jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, "just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -8106,9 +8122,9 @@ "dev": true }, "marked": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.2.tgz", - "integrity": "sha512-TMJQQ79Z0e3rJYazY0tIoMsFzteUGw9fB3FD+gzuIT3zLuG9L9ckIvUfF51apdJkcqc208jJN2KbtPbOvXtbjA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.4.tgz", + "integrity": "sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==", "dev": true }, "merge-stream": { @@ -8263,10 +8279,13 @@ } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "dev": true + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.3.tgz", + "integrity": "sha512-BXSmNTLLDHT0UjQDg5E23x+0n/hPDjySqc0ELE4NpCa2wE5qmmaEWFRP/+v8pfuocchR9l5vFLbSB7CPE2ahvQ==", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } }, "node-preload": { "version": "0.2.1", @@ -8278,9 +8297,9 @@ } }, "node-releases": { - "version": "1.1.75", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", - "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", + "version": "1.1.76", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", + "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==", "dev": true }, "normalize-path": { @@ -8865,12 +8884,6 @@ "fromentries": "^1.2.0" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, "protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -9284,12 +9297,12 @@ } }, "shiki": { - "version": "0.9.10", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", - "integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.11.tgz", + "integrity": "sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==", "dev": true, "requires": { - "json5": "^2.2.0", + "jsonc-parser": "^3.0.0", "onigasm": "^2.2.5", "vscode-textmate": "5.2.0" } @@ -9306,9 +9319,9 @@ } }, "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.4.tgz", + "integrity": "sha512-rqYhcAnZ6d/vTPGghdrw7iumdcbXpsk1b8IG/rz+VWV51DM0p7XCtMoJ3qhPLIbp3tvyt3pKRbaaEMZYpHto8Q==", "dev": true }, "sinon": { @@ -9349,9 +9362,9 @@ "dev": true }, "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "version": "0.5.20", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz", + "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -9509,6 +9522,12 @@ "is-number": "^7.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, "ts-node": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz", @@ -9565,27 +9584,18 @@ } }, "typedoc": { - "version": "0.21.9", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.9.tgz", - "integrity": "sha512-VRo7aII4bnYaBBM1lhw4bQFmUcDQV8m8tqgjtc7oXl87jc1Slbhfw2X5MccfcR2YnEClHDWgsiQGgNB8KJXocA==", + "version": "0.22.4", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.4.tgz", + "integrity": "sha512-M/a8NnPxq3/iZNNVjzFCK5gu4m//HTJIPbSS0JQVbkHJPP9wyepR12agylWTSqeVZe0xsbidVtO26+PP7iD/jw==", "dev": true, "requires": { "glob": "^7.1.7", - "handlebars": "^4.7.7", "lunr": "^2.3.9", - "marked": "^3.0.2", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shiki": "^0.9.8", - "typedoc-default-themes": "^0.12.10" + "marked": "^3.0.4", + "minimatch": "^3.0.4", + "shiki": "^0.9.11" } }, - "typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "dev": true - }, "typedoc-github-wiki-theme": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.5.1.tgz", @@ -9594,24 +9604,24 @@ "requires": {} }, "typedoc-plugin-markdown": { - "version": "3.10.4", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.4.tgz", - "integrity": "sha512-if9w7S9fXLg73AYi/EoRSEhTOZlg3I8mIP8YEmvzSE33VrNXC9/hA0nVcLEwFVJeQY7ay6z67I6kW0KIv7LjeA==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.0.tgz", + "integrity": "sha512-zewcbzOlMV9nbhLsJhKBpoRW4J32LgbfdqwYfEfzzeE+wGOaOfsM6g7QH+ZKj8n+knH4sLCtk6XMN1TI/a1UuQ==", "dev": true, "requires": { "handlebars": "^4.7.7" } }, "typescript": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz", - "integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz", + "integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==", "dev": true }, "uglify-js": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.1.tgz", - "integrity": "sha512-JhS3hmcVaXlp/xSo3PKY5R0JqKs5M3IV+exdLHW99qKvKivPO4Z8qbej6mte17SOPqAOVMjt/XGgWacnFSzM3g==", + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.2.tgz", + "integrity": "sha512-rtPMlmcO4agTUfz10CbgJ1k6UAoXM2gWb3GoMPPZB/+/Ackf8lNWk11K4rYi2D0apgoFRLtQOZhb+/iGNJq26A==", "dev": true, "optional": true }, @@ -9729,6 +9739,22 @@ "defaults": "^1.0.3" } }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 56a7ed38c65..fc107833fc6 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.7.10", + "@types/node": "^16.9.4", "@types/sinon": "^10.0.2", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", @@ -43,12 +43,12 @@ "nyc": "^15.1.0", "release-it": "^14.11.5", "sinon": "^11.1.2", - "source-map-support": "^0.5.19", + "source-map-support": "^0.5.20", "ts-node": "^10.2.1", - "typedoc": "^0.21.9", + "typedoc": "^0.22.4", "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "^3.10.4", - "typescript": "^4.4.2", + "typedoc-plugin-markdown": "^3.11.0", + "typescript": "^4.4.3", "which": "^2.0.2" }, "engines": { From 1819b9c1c4a6ae48fd0597e6fa451c242b707e05 Mon Sep 17 00:00:00 2001 From: leibale Date: Tue, 21 Sep 2021 15:30:25 -0400 Subject: [PATCH 17/40] fix #1659 - add support for db-number in client options url --- docs/client-configuration.md | 39 ++++++++++---------- lib/client.spec.ts | 63 ++++++++++++++++++++++++++------ lib/client.ts | 69 +++++++++++++++++++++++++++++++++--- lib/socket.ts | 20 +---------- lib/test-utils.ts | 18 ++++++---- 5 files changed, 149 insertions(+), 60 deletions(-) diff --git a/docs/client-configuration.md b/docs/client-configuration.md index 4b93340ad8f..0c4c0c1ca8f 100644 --- a/docs/client-configuration.md +++ b/docs/client-configuration.md @@ -1,24 +1,25 @@ # `createClient` configuration -| Property | Default | Description | -|--------------------------|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------| -| socket | | Object defining socket connection properties | -| socket.url | | `[redis[s]:]//[[username][:password]@][host][:port]` | -| socket.host | `'localhost'` | Hostname to connect to | -| socket.port | `6379` | Port to connect to | -| socket.username | | ACL username ([see ACL guide](https://redis.io/topics/acl)) | -| socket.password | | ACL password or the old "--requirepass" password | -| socket.connectTimeout | `5000` | The timeout for connecting to the Redis Server (in milliseconds) | -| socket.noDelay | `true` | Enable/disable the use of [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay) | -| socket.keepAlive | `5000` | Enable/disable the [`keep-alive`](https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay) functionality | -| socket.tls | | Set to `true` to enable [TLS Configuration](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) | -| socket.reconnectStrategy | `retries => Math.min(retries * 50, 500)` | A function containing the [Reconnect Strategy](#reconnect-strategy) logic | -| modules | | Object defining which [Redis Modules](https://redis.io/modules) to include (TODO - document) | -| scripts | | Object defining Lua scripts to use with this client. See [Lua Scripts](../README.md#lua-scripts) | -| commandsQueueMaxLength | | Maximum length of the client's internal command queue | -| readonly | `false` | Connect in [`READONLY`](https://redis.io/commands/readonly) mode | -| legacyMode | `false` | Maintain some backwards compatibility (see the [Migration Guide](v3-to-v4.md)) | -| isolationPoolOptions | | See the [Isolated Execution Guide](./isolated-execution.md) | +| Property | Default | Description | +|--------------------------|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| url | | `redis[s]://[[username][:password]@][host][:port][/db-number]` (see [`redis`](https://www.iana.org/assignments/uri-schemes/prov/redis) and [`rediss`](https://www.iana.org/assignments/uri-schemes/prov/rediss) IANA registration for more details) | +| socket | | Object defining socket connection properties | +| socket.host | `'localhost'` | Hostname to connect to | +| socket.port | `6379` | Port to connect to | +| socket.connectTimeout | `5000` | The timeout for connecting to the Redis Server (in milliseconds) | +| socket.noDelay | `true` | Enable/disable the use of [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay) | +| socket.keepAlive | `5000` | Enable/disable the [`keep-alive`](https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay) functionality | +| socket.tls | | Set to `true` to enable [TLS Configuration](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) | +| socket.reconnectStrategy | `retries => Math.min(retries * 50, 500)` | A function containing the [Reconnect Strategy](#reconnect-strategy) logic | +| username | | ACL username ([see ACL guide](https://redis.io/topics/acl)) | +| password | | ACL password or the old "--requirepass" password | +| database | | Database number to connect to (see [`SELECT`](https://redis.io/commands/select) command) | +| modules | | Object defining which [Redis Modules](https://redis.io/modules) to include (TODO - document) | +| scripts | | Object defining Lua Scripts to use with this client (see [Lua Scripts](../README.md#lua-scripts)) | +| commandsQueueMaxLength | | Maximum length of the client's internal command queue | +| readonly | `false` | Connect in [`READONLY`](https://redis.io/commands/readonly) mode | +| legacyMode | `false` | Maintain some backwards compatibility (see the [Migration Guide](v3-to-v4.md)) | +| isolationPoolOptions | | See the [Isolated Execution Guide](./isolated-execution.md) | ## Reconnect Strategy diff --git a/lib/client.spec.ts b/lib/client.spec.ts index 7f1a534352c..06f8d2bb102 100644 --- a/lib/client.spec.ts +++ b/lib/client.spec.ts @@ -18,6 +18,53 @@ export const SQUARE_SCRIPT = defineScript({ }); describe('Client', () => { + describe('parseURL', () => { + it('redis://user:secret@localhost:6379/0', () => { + assert.deepEqual( + RedisClient.parseURL('redis://user:secret@localhost:6379/0'), + { + socket: { + host: 'localhost', + port: 6379 + }, + username: 'user', + password: 'secret', + database: 0 + } + ); + }); + + it('rediss://user:secret@localhost:6379/0', () => { + assert.deepEqual( + RedisClient.parseURL('rediss://user:secret@localhost:6379/0'), + { + socket: { + host: 'localhost', + port: 6379, + tls: true + }, + username: 'user', + password: 'secret', + database: 0 + } + ); + }); + + it('Invalid protocol', () => { + assert.throws( + () => RedisClient.parseURL('redi://user:secret@localhost:6379/0'), + TypeError + ); + }); + + it('Invalid pathname', () => { + assert.throws( + () => RedisClient.parseURL('redis://user:secret@localhost:6379/NaN'), + TypeError + ); + }); + }); + describe('authentication', () => { itWithClient(TestRedisServers.PASSWORD, 'Client should be authenticated', async client => { assert.equal( @@ -28,10 +75,8 @@ describe('Client', () => { it('should not retry connecting if failed due to wrong auth', async () => { const client = RedisClient.create({ - socket: { - ...TEST_REDIS_SERVERS[TestRedisServers.PASSWORD], - password: 'wrongpassword' - } + ...TEST_REDIS_SERVERS[TestRedisServers.PASSWORD], + password: 'wrongpassword' }); await assert.rejects( @@ -49,7 +94,7 @@ describe('Client', () => { describe('legacyMode', () => { const client = RedisClient.create({ - socket: TEST_REDIS_SERVERS[TestRedisServers.OPEN], + ...TEST_REDIS_SERVERS[TestRedisServers.OPEN], scripts: { square: SQUARE_SCRIPT }, @@ -173,9 +218,7 @@ describe('Client', () => { describe('events', () => { it('connect, ready, end', async () => { - const client = RedisClient.create({ - socket: TEST_REDIS_SERVERS[TestRedisServers.OPEN] - }); + const client = RedisClient.create(TEST_REDIS_SERVERS[TestRedisServers.OPEN]); await Promise.all([ client.connect(), @@ -550,9 +593,7 @@ describe('Client', () => { }); it('client.quit', async () => { - const client = RedisClient.create({ - socket: TEST_REDIS_SERVERS[TestRedisServers.OPEN] - }); + const client = RedisClient.create(TEST_REDIS_SERVERS[TestRedisServers.OPEN]); await client.connect(); diff --git a/lib/client.ts b/lib/client.ts index c9e9cecf924..93afee1ff1a 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -1,4 +1,4 @@ -import RedisSocket, { RedisSocketOptions } from './socket'; +import RedisSocket, { RedisSocketOptions, RedisNetSocketOptions, RedisTlsSocketOptions } from './socket'; import RedisCommandsQueue, { PubSubListener, PubSubSubscribeCommands, PubSubUnsubscribeCommands, QueueCommandOptions } from './commands-queue'; import COMMANDS, { TransformArgumentsReply } from './commands'; import { RedisCommand, RedisModules, RedisReply } from './commands'; @@ -12,9 +12,14 @@ import { HScanTuple } from './commands/HSCAN'; import { encodeCommand, extendWithDefaultCommands, extendWithModulesAndScripts, transformCommandArguments } from './commander'; import { Pool, Options as PoolOptions, createPool } from 'generic-pool'; import { ClientClosedError } from './errors'; +import { URL } from 'url'; export interface RedisClientOptions { + url?: string; socket?: RedisSocketOptions; + username?: string; + password?: string; + database?: number; modules?: M; scripts?: S; commandsQueueMaxLength?: number; @@ -71,6 +76,45 @@ export default class RedisClient { + // https://www.iana.org/assignments/uri-schemes/prov/redis + const { hostname, port, protocol, username, password, pathname } = new URL(url), + parsed: RedisClientOptions<{}, {}> = { + socket: { + host: hostname + } + }; + + if (protocol === 'rediss:') { + (parsed.socket as RedisTlsSocketOptions).tls = true; + } else if (protocol !== 'redis:') { + throw new TypeError('Invalid protocol'); + } + + if (port) { + (parsed.socket as RedisNetSocketOptions).port = Number(port); + } + + if (username) { + parsed.username = username; + } + + if (password) { + parsed.password = password; + } + + if (pathname.length > 1) { + const database = Number(pathname.substring(1)); + if (isNaN(database)) { + throw new TypeError('Invalid pathname'); + } + + parsed.database = database; + } + + return parsed; + } + readonly #options?: RedisClientOptions; readonly #socket: RedisSocket; readonly #queue: RedisCommandsQueue; @@ -96,7 +140,7 @@ export default class RedisClient) { super(); - this.#options = options; + this.#options = this.#initiateOptions(options); this.#socket = this.#initiateSocket(); this.#queue = this.#initiateQueue(); this.#isolationPool = createPool({ @@ -110,6 +154,23 @@ export default class RedisClient): RedisClientOptions | undefined { + if (options?.url) { + const parsed = RedisClient.parseURL(options.url); + if (options.socket) { + parsed.socket = Object.assign(options.socket, parsed.socket); + } + + Object.assign(options, parsed); + } + + if (options?.database) { + this.#selectedDB = options.database; + } + + return options; + } + #initiateSocket(): RedisSocket { const socketInitiator = async (): Promise => { const v4Commands = this.#options?.legacyMode ? this.#v4 : this, @@ -123,8 +184,8 @@ export default class RedisClient { connectEvent: string; @@ -44,14 +38,6 @@ export default class RedisSocket extends EventEmitter { static #initiateOptions(options?: RedisSocketOptions): RedisSocketOptions { options ??= {}; if (!RedisSocket.#isUnixSocket(options)) { - if (RedisSocket.#isUrlSocket(options)) { - const url = new URL(options.url); - (options as RedisNetSocketOptions).port = Number(url.port); - (options as RedisNetSocketOptions).host = url.hostname; - options.username = url.username; - options.password = url.password; - } - (options as RedisNetSocketOptions).port ??= 6379; (options as RedisNetSocketOptions).host ??= '127.0.0.1'; } @@ -67,10 +53,6 @@ export default class RedisSocket extends EventEmitter { return Math.min(retries * 50, 500); } - static #isUrlSocket(options: RedisSocketOptions): options is RedisUrlSocketOptions { - return Object.prototype.hasOwnProperty.call(options, 'url'); - } - static #isUnixSocket(options: RedisSocketOptions): options is RedisUnixSocketOptions { return Object.prototype.hasOwnProperty.call(options, 'path'); } diff --git a/lib/test-utils.ts b/lib/test-utils.ts index 84685923693..713a1a3434a 100644 --- a/lib/test-utils.ts +++ b/lib/test-utils.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import RedisClient, { RedisClientType } from './client'; +import RedisClient, { RedisClientOptions, RedisClientType } from './client'; import { execSync, spawn } from 'child_process'; import { once } from 'events'; import { RedisSocketOptions } from './socket'; @@ -9,6 +9,8 @@ import RedisCluster, { RedisClusterType } from './cluster'; import { promises as fs } from 'fs'; import { Context as MochaContext } from 'mocha'; import { promiseTimeout } from './utils'; +import { RedisModules } from './commands'; +import { RedisLuaScripts } from './lua-script'; type RedisVersion = [major: number, minor: number, patch: number]; @@ -52,7 +54,7 @@ export enum TestRedisServers { PASSWORD } -export const TEST_REDIS_SERVERS: Record = {}; +export const TEST_REDIS_SERVERS: Record> = {}; export enum TestRedisClusters { OPEN @@ -226,13 +228,17 @@ export async function spawnGlobalRedisCluster(type: TestRedisClusters | null, nu async function spawnOpenServer(): Promise { TEST_REDIS_SERVERS[TestRedisServers.OPEN] = { - port: await spawnGlobalRedisServer() + socket: { + port: await spawnGlobalRedisServer() + } }; } async function spawnPasswordServer(): Promise { TEST_REDIS_SERVERS[TestRedisServers.PASSWORD] = { - port: await spawnGlobalRedisServer(['--requirepass', 'password']), + socket: { + port: await spawnGlobalRedisServer(['--requirepass', 'password']), + }, password: 'password' }; @@ -285,9 +291,7 @@ export function itWithClient( it(title, async function () { if (handleMinimumRedisVersion(this, options?.minimumRedisVersion)) return; - const client = RedisClient.create({ - socket: TEST_REDIS_SERVERS[type] - }); + const client = RedisClient.create(TEST_REDIS_SERVERS[type]); await client.connect(); From ad151cd10d2fb839888583fd8c12c45d2ac3b2f2 Mon Sep 17 00:00:00 2001 From: leibale Date: Tue, 21 Sep 2021 18:45:17 -0400 Subject: [PATCH 18/40] fix README, remove unused import, downgrade typedoc & typedoc-plugin-markdown --- README.md | 92 ++++++++------- lib/socket.ts | 1 - package-lock.json | 288 ++++++++++++++++++++++++++-------------------- package.json | 10 +- 4 files changed, 212 insertions(+), 179 deletions(-) diff --git a/README.md b/README.md index 2c465ae69fa..0ac104a2c21 100644 --- a/README.md +++ b/README.md @@ -35,27 +35,25 @@ npm install redis@next ### Basic Example ```typescript -import { createClient } from "redis"; +import { createClient } from 'redis'; (async () => { const client = createClient(); - client.on("error", (err) => console.log("Redis Client Error", err)); + client.on('error', (err) => console.log('Redis Client Error', err)); await client.connect(); - await client.set("key", "value"); - const value = await client.get("key"); + await client.set('key', 'value'); + const value = await client.get('key'); })(); ``` -The above code connects to localhost on port 6379. To connect to a different host or port, use a connection string in the format `[redis[s]:]//[[username][:password]@][host][:port]`: +The above code connects to localhost on port 6379. To connect to a different host or port, use a connection string in the format `redis[s]://[[username][:password]@][host][:port][/db-number]`: ```typescript createClient({ - socket: { - url: "redis://alice:foobared@awesome.redis.server:6380", - }, + url: 'redis://alice:foobared@awesome.redis.server:6380', }); ``` @@ -67,18 +65,18 @@ There is built-in support for all of the [out-of-the-box Redis commands](https:/ ```typescript // raw Redis commands -await client.HSET("key", "field", "value"); -await client.HGETALL("key"); +await client.HSET('key', 'field', 'value'); +await client.HGETALL('key'); // friendly JavaScript commands -await client.hSet("key", "field", "value"); -await client.hGetAll("key"); +await client.hSet('key', 'field', 'value'); +await client.hGetAll('key'); ``` Modifiers to commands are specified using a JavaScript object: ```typescript -await client.set("key", "value", { +await client.set('key', 'value', { EX: 10, NX: true, }); @@ -87,8 +85,8 @@ await client.set("key", "value", { Replies will be transformed into useful data structures: ```typescript -await client.hGetAll("key"); // { field1: 'value1', field2: 'value2' } -await client.hVals("key"); // ['value1', 'value2'] +await client.hGetAll('key'); // { field1: 'value1', field2: 'value2' } +await client.hVals('key'); // ['value1', 'value2'] ``` ### Unsupported Redis Commands @@ -96,9 +94,9 @@ await client.hVals("key"); // ['value1', 'value2'] If you want to run commands and/or use arguments that Node Redis doesn't know about (yet!) use `.sendCommand()`: ```typescript -await client.sendCommand(["SET", "key", "value", "NX"]); // 'OK' +await client.sendCommand(['SET', 'key', 'value', 'NX']); // 'OK' -await client.sendCommand(["HGETALL", "key"]); // ['key1', 'field1', 'key2', 'field2'] +await client.sendCommand(['HGETALL', 'key']); // ['key1', 'field1', 'key2', 'field2'] ``` ### Transactions (Multi/Exec) @@ -106,12 +104,12 @@ await client.sendCommand(["HGETALL", "key"]); // ['key1', 'field1', 'key2', 'fie Start a [transaction](https://redis.io/topics/transactions) by calling `.multi()`, then chaining your commands. When you're done, call `.exec()` and you'll get an array back with your results: ```typescript -await client.set("another-key", "another-value"); +await client.set('another-key', 'another-value'); const [setKeyReply, otherKeyValue] = await client .multi() - .set("key", "value") - .get("another-key") + .set('key', 'value') + .get('another-key') .exec(); // ['OK', 'another-value'] ``` @@ -126,11 +124,11 @@ Any command can be run on a new connection by specifying the `isolated` option. This pattern works especially well for blocking commands—such as `BLPOP` and `BLMOVE`: ```typescript -import { commandOptions } from "redis"; +import { commandOptions } from 'redis'; -const blPopPromise = client.blPop(commandOptions({ isolated: true }), "key"); +const blPopPromise = client.blPop(commandOptions({ isolated: true }), 'key'); -await client.lPush("key", ["1", "2"]); +await client.lPush('key', ['1', '2']); await blPopPromise; // '2' ``` @@ -150,23 +148,23 @@ await subscriber.connect(); Once you have one, simply subscribe and unsubscribe as needed: ```typescript -await subscriber.subscribe("channel", (message) => { +await subscriber.subscribe('channel', (message) => { console.log(message); // 'message' }); -await subscriber.pSubscribe("channe*", (message, channel) => { +await subscriber.pSubscribe('channe*', (message, channel) => { console.log(message, channel); // 'message', 'channel' }); -await subscriber.unsubscribe("channel"); +await subscriber.unsubscribe('channel'); -await subscriber.pUnsubscribe("channe*"); +await subscriber.pUnsubscribe('channe*'); ``` Publish a message on a channel: ```typescript -await publisher.publish("channel", "message"); +await publisher.publish('channel', 'message'); ``` ### Scan Iterator @@ -183,11 +181,11 @@ for await (const key of client.scanIterator()) { This works with `HSCAN`, `SSCAN`, and `ZSCAN` too: ```typescript -for await (const member of client.hScanIterator("hash")) { +for await (const member of client.hScanIterator('hash')) { } -for await (const { field, value } of client.sScanIterator("set")) { +for await (const { field, value } of client.sScanIterator('set')) { } -for await (const { member, score } of client.zScanIterator("sorted-set")) { +for await (const { member, score } of client.zScanIterator('sorted-set')) { } ``` @@ -195,8 +193,8 @@ You can override the default options by providing a configuration object: ```typescript client.scanIterator({ - TYPE: "string", // `SCAN` only - MATCH: "patter*", + TYPE: 'string', // `SCAN` only + MATCH: 'patter*', COUNT: 100, }); ``` @@ -206,7 +204,7 @@ client.scanIterator({ Define new functions using [Lua scripts](https://redis.io/commands/eval) which execute on the Redis server: ```typescript -import { createClient, defineScript } from "redis"; +import { createClient, defineScript } from 'redis'; (async () => { const client = createClient({ @@ -214,7 +212,7 @@ import { createClient, defineScript } from "redis"; add: defineScript({ NUMBER_OF_KEYS: 1, SCRIPT: - 'local val = redis.pcall("GET", KEYS[1]);' + "return val + ARGV[1];", + "local val = redis.pcall('GET', KEYS[1]);' + 'return val + ARGV[1];", transformArguments(key: string, toAdd: number): Array { return [key, number.toString()]; }, @@ -227,8 +225,8 @@ import { createClient, defineScript } from "redis"; await client.connect(); - await client.set("key", "1"); - await client.add("key", 2); // 3 + await client.set('key', '1'); + await client.add('key', 2); // 3 })(); ``` @@ -237,28 +235,28 @@ import { createClient, defineScript } from "redis"; Connecting to a cluster is a bit different. Create the client by specifying some (or all) of the nodes in your cluster and then use it like a non-clustered client: ```typescript -import { createCluster } from "redis"; +import { createCluster } from 'redis'; (async () => { const cluster = createCluster({ rootNodes: [ { - host: "10.0.0.1", + host: '10.0.0.1', port: 30001, }, { - host: "10.0.0.2", + host: '10.0.0.2', port: 30002, }, ], }); - cluster.on("error", (err) => console.log("Redis Cluster Error", err)); + cluster.on('error', (err) => console.log('Redis Cluster Error', err)); await cluster.connect(); - await cluster.set("key", "value"); - const value = await cluster.get("key"); + await cluster.set('key', 'value'); + const value = await cluster.get('key'); })(); ``` @@ -267,16 +265,16 @@ import { createCluster } from "redis"; Node Redis will automatically pipeline requests that are made during the same "tick". ```typescript -client.set("Tm9kZSBSZWRpcw==", "users:1"); -client.sAdd("users:1:tokens", "Tm9kZSBSZWRpcw=="); +client.set('Tm9kZSBSZWRpcw==', 'users:1'); +client.sAdd('users:1:tokens', 'Tm9kZSBSZWRpcw=='); ``` Of course, if you don't do something with your Promises you're certain to get [unhandled Promise exceptions](https://nodejs.org/api/process.html#process_event_unhandledrejection). To take advantage of auto-pipelining and handle your Promises, use `Promise.all()`. ```typescript await Promise.all([ - client.set("Tm9kZSBSZWRpcw==", "users:1"), - client.sAdd("users:1:tokens", "Tm9kZSBSZWRpcw=="), + client.set('Tm9kZSBSZWRpcw==', 'users:1'), + client.sAdd('users:1:tokens', 'Tm9kZSBSZWRpcw=='), ]); ``` diff --git a/lib/socket.ts b/lib/socket.ts index 35673501876..8bc94c5ba07 100644 --- a/lib/socket.ts +++ b/lib/socket.ts @@ -1,7 +1,6 @@ import EventEmitter from 'events'; import net from 'net'; import tls from 'tls'; -import { URL } from 'url'; import { ConnectionTimeoutError, ClientClosedError } from './errors'; import { promiseTimeout } from './utils'; diff --git a/package-lock.json b/package-lock.json index 9986a955bf6..8d37f49d73b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,19 +17,19 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.9.4", - "@types/sinon": "^10.0.2", + "@types/node": "^16.9.6", + "@types/sinon": "^10.0.3", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", "mocha": "^9.1.1", "nyc": "^15.1.0", - "release-it": "^14.11.5", + "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", "ts-node": "^10.2.1", - "typedoc": "^0.22.4", + "typedoc": "0.21.9", "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "^3.11.0", + "typedoc-plugin-markdown": "3.10.4", "typescript": "^4.4.3", "which": "^2.0.2" }, @@ -680,12 +680,12 @@ } }, "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.7.0.tgz", - "integrity": "sha512-G7sgccWRYQMwcHJXkDY/sDxbXeKiZkFQqUtzBCwmrzCNj2GQf3VygQ4T/BFL2crLVpIbenkE/c0ErhYOte2MPw==", + "version": "5.10.4", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.10.4.tgz", + "integrity": "sha512-Dh+EAMCYR9RUHwQChH94Skl0lM8Fh99auT8ggck/xTzjJrwVzvsd0YH68oRPqp/HxICzmUjLfaQ9sy1o1sfIiA==", "dev": true, "dependencies": { - "@octokit/types": "^6.24.0", + "@octokit/types": "^6.28.1", "deprecation": "^2.3.1" }, "peerDependencies": { @@ -718,15 +718,15 @@ } }, "node_modules/@octokit/rest": { - "version": "18.9.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.9.0.tgz", - "integrity": "sha512-VrmrE8gjpuOoDAGjrQq2j9ZhOE6LxaqxaQg0yMrrEnnQZy2ZcAnr5qbVfKsMF0up/48PRV/VFS/2GSMhA7nTdA==", + "version": "18.10.0", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.10.0.tgz", + "integrity": "sha512-esHR5OKy38bccL/sajHqZudZCvmv4yjovMJzyXlphaUo7xykmtOdILGJ3aAm0mFHmMLmPFmDMJXf39cAjNJsrw==", "dev": true, "dependencies": { - "@octokit/core": "^3.5.0", - "@octokit/plugin-paginate-rest": "^2.6.2", - "@octokit/plugin-request-log": "^1.0.2", - "@octokit/plugin-rest-endpoint-methods": "5.7.0" + "@octokit/core": "^3.5.1", + "@octokit/plugin-paginate-rest": "^2.16.0", + "@octokit/plugin-request-log": "^1.0.4", + "@octokit/plugin-rest-endpoint-methods": "^5.9.0" } }, "node_modules/@octokit/types": { @@ -855,9 +855,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.9.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz", - "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA==", + "version": "16.9.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz", + "integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ==", "dev": true }, "node_modules/@types/parse-json": { @@ -876,9 +876,9 @@ } }, "node_modules/@types/sinon": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.2.tgz", - "integrity": "sha512-BHn8Bpkapj8Wdfxvh2jWIUoaYB/9/XhsL0oOvBfRagJtKlSl9NWPcFOz2lRukI9szwGxFtYZCTejJSqsGDbdmw==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.3.tgz", + "integrity": "sha512-XUaFuUOQ3A/r6gS1qCU/USMleascaqGeQpGR1AZ5JdRtBPlzijRzKsik1TuGzvdtPA0mdq42JqaJmJ+Afg1LJg==", "dev": true, "dependencies": { "@sinonjs/fake-timers": "^7.1.0" @@ -1108,12 +1108,12 @@ } }, "node_modules/async-retry": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.1.tgz", - "integrity": "sha512-aiieFW/7h3hY0Bq5d+ktDBejxuwR78vRu9hDUdR8rNhSaQ29VzPL4AoIRG7D/c7tdenwOcKvgPM6tIxB3cB6HA==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", "dev": true, "dependencies": { - "retry": "0.12.0" + "retry": "0.13.1" } }, "node_modules/asynckit": { @@ -1390,9 +1390,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001258", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz", - "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==", + "version": "1.0.30001259", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz", + "integrity": "sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg==", "dev": true, "funding": { "type": "opencollective", @@ -1626,9 +1626,9 @@ } }, "node_modules/cosmiconfig": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", - "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", "dev": true, "dependencies": { "@types/parse-json": "^4.0.0", @@ -1845,9 +1845,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.844", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.844.tgz", - "integrity": "sha512-7ES6GQVsbgsUA49/apqub51I9ij8E3QwGqq/IRvO6OPCly3how/YUSg1GPslRWq+BteT2h94iAIQdJbuVVH4Pg==", + "version": "1.3.846", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.846.tgz", + "integrity": "sha512-2jtSwgyiRzybHRxrc2nKI+39wH3AwQgn+sogQ+q814gv8hIFwrcZbV07Ea9f8AmK0ufPVZUvvAG1uZJ+obV4Jw==", "dev": true }, "node_modules/emoji-regex": { @@ -2217,9 +2217,9 @@ } }, "node_modules/git-url-parse": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.5.0.tgz", - "integrity": "sha512-TZYSMDeM37r71Lqg1mbnMlOqlHd7BSij9qN7XwTkRqSAYFMihGLGhfHwgqQob3GUhEneKnV4nskN9rbQw2KGxA==", + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.6.0.tgz", + "integrity": "sha512-WWUxvJs5HsyHL6L08wOusa/IXYtMuCAhrMmnTjQPpBU0TTHyDhnOATNH3xNQz7YOQUsqIIPTGr4xiVti1Hsk5g==", "dev": true, "dependencies": { "git-up": "^4.0.0" @@ -2615,9 +2615,9 @@ } }, "node_modules/inquirer": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.1.2.tgz", - "integrity": "sha512-DHLKJwLPNgkfwNmsuEUKSejJFbkv0FMO9SMiQbjI3n5NQuCrSIBqP66ggqyz2a6t2qEolKrMjhQ3+W/xXgUQ+Q==", + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.1.5.tgz", + "integrity": "sha512-G6/9xUqmt/r+UvufSyrPpt84NYwhKZ9jLsgMbQzlx804XErNupor8WQdBnBRrXmBfTPpuwf1sV+ss2ovjgdXIg==", "dev": true, "dependencies": { "ansi-escapes": "^4.2.1", @@ -2628,7 +2628,7 @@ "figures": "^3.0.0", "lodash": "^4.17.21", "mute-stream": "0.0.8", - "ora": "^5.3.0", + "ora": "^5.4.1", "run-async": "^2.4.0", "rxjs": "^7.2.0", "string-width": "^4.1.0", @@ -3425,9 +3425,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.3.tgz", - "integrity": "sha512-BXSmNTLLDHT0UjQDg5E23x+0n/hPDjySqc0ELE4NpCa2wE5qmmaEWFRP/+v8pfuocchR9l5vFLbSB7CPE2ahvQ==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.4.tgz", + "integrity": "sha512-aD1fO+xtLiSCc9vuD+sYMxpIuQyhHscGSkBEo2o5LTV/3bTEAYvdUii29n8LlO5uLCmWdGP7uVUVXFo5SRdkLA==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -4210,6 +4210,15 @@ "node": ">=8" } }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -4424,25 +4433,25 @@ } }, "node_modules/release-it": { - "version": "14.11.5", - "resolved": "https://registry.npmjs.org/release-it/-/release-it-14.11.5.tgz", - "integrity": "sha512-9BaPdq7ZKOwtzz3p1mRhg/tOH/cT/y2tUnPYzUwQiVdj42JaGI1Vo2l3WbgK8ICsbFyrhc0tri1+iqI8OvkI1A==", + "version": "14.11.6", + "resolved": "https://registry.npmjs.org/release-it/-/release-it-14.11.6.tgz", + "integrity": "sha512-6BNcuzFZHThBUBJ/xYw/bxZ+58CAwrwf1zgmjq2Ibl3nlDZbjphHG6iqxkJu7mZ8TIWs6NjloEAhqpjeXoN//Q==", "dev": true, "dependencies": { "@iarna/toml": "2.2.5", - "@octokit/rest": "18.9.0", - "async-retry": "1.3.1", + "@octokit/rest": "18.10.0", + "async-retry": "1.3.3", "chalk": "4.1.2", - "cosmiconfig": "7.0.0", + "cosmiconfig": "7.0.1", "debug": "4.3.2", "deprecated-obj": "2.0.0", "execa": "5.1.1", "form-data": "4.0.0", - "git-url-parse": "11.5.0", + "git-url-parse": "11.6.0", "globby": "11.0.4", "got": "11.8.2", "import-cwd": "3.0.0", - "inquirer": "8.1.2", + "inquirer": "8.1.5", "is-ci": "3.0.0", "lodash": "4.17.21", "mime-types": "2.1.32", @@ -4612,9 +4621,9 @@ } }, "node_modules/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", "dev": true, "engines": { "node": ">= 4" @@ -5166,16 +5175,19 @@ } }, "node_modules/typedoc": { - "version": "0.22.4", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.4.tgz", - "integrity": "sha512-M/a8NnPxq3/iZNNVjzFCK5gu4m//HTJIPbSS0JQVbkHJPP9wyepR12agylWTSqeVZe0xsbidVtO26+PP7iD/jw==", + "version": "0.21.9", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.9.tgz", + "integrity": "sha512-VRo7aII4bnYaBBM1lhw4bQFmUcDQV8m8tqgjtc7oXl87jc1Slbhfw2X5MccfcR2YnEClHDWgsiQGgNB8KJXocA==", "dev": true, "dependencies": { "glob": "^7.1.7", + "handlebars": "^4.7.7", "lunr": "^2.3.9", - "marked": "^3.0.4", - "minimatch": "^3.0.4", - "shiki": "^0.9.11" + "marked": "^3.0.2", + "minimatch": "^3.0.0", + "progress": "^2.0.3", + "shiki": "^0.9.8", + "typedoc-default-themes": "^0.12.10" }, "bin": { "typedoc": "bin/typedoc" @@ -5187,6 +5199,15 @@ "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x" } }, + "node_modules/typedoc-default-themes": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/typedoc-github-wiki-theme": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.5.1.tgz", @@ -5198,15 +5219,15 @@ } }, "node_modules/typedoc-plugin-markdown": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.0.tgz", - "integrity": "sha512-zewcbzOlMV9nbhLsJhKBpoRW4J32LgbfdqwYfEfzzeE+wGOaOfsM6g7QH+ZKj8n+knH4sLCtk6XMN1TI/a1UuQ==", + "version": "3.10.4", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.4.tgz", + "integrity": "sha512-if9w7S9fXLg73AYi/EoRSEhTOZlg3I8mIP8YEmvzSE33VrNXC9/hA0nVcLEwFVJeQY7ay6z67I6kW0KIv7LjeA==", "dev": true, "dependencies": { "handlebars": "^4.7.7" }, "peerDependencies": { - "typedoc": ">=0.22.0" + "typedoc": ">=0.21.2" } }, "node_modules/typescript": { @@ -6207,12 +6228,12 @@ "requires": {} }, "@octokit/plugin-rest-endpoint-methods": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.7.0.tgz", - "integrity": "sha512-G7sgccWRYQMwcHJXkDY/sDxbXeKiZkFQqUtzBCwmrzCNj2GQf3VygQ4T/BFL2crLVpIbenkE/c0ErhYOte2MPw==", + "version": "5.10.4", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.10.4.tgz", + "integrity": "sha512-Dh+EAMCYR9RUHwQChH94Skl0lM8Fh99auT8ggck/xTzjJrwVzvsd0YH68oRPqp/HxICzmUjLfaQ9sy1o1sfIiA==", "dev": true, "requires": { - "@octokit/types": "^6.24.0", + "@octokit/types": "^6.28.1", "deprecation": "^2.3.1" } }, @@ -6242,15 +6263,15 @@ } }, "@octokit/rest": { - "version": "18.9.0", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.9.0.tgz", - "integrity": "sha512-VrmrE8gjpuOoDAGjrQq2j9ZhOE6LxaqxaQg0yMrrEnnQZy2ZcAnr5qbVfKsMF0up/48PRV/VFS/2GSMhA7nTdA==", + "version": "18.10.0", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.10.0.tgz", + "integrity": "sha512-esHR5OKy38bccL/sajHqZudZCvmv4yjovMJzyXlphaUo7xykmtOdILGJ3aAm0mFHmMLmPFmDMJXf39cAjNJsrw==", "dev": true, "requires": { - "@octokit/core": "^3.5.0", - "@octokit/plugin-paginate-rest": "^2.6.2", - "@octokit/plugin-request-log": "^1.0.2", - "@octokit/plugin-rest-endpoint-methods": "5.7.0" + "@octokit/core": "^3.5.1", + "@octokit/plugin-paginate-rest": "^2.16.0", + "@octokit/plugin-request-log": "^1.0.4", + "@octokit/plugin-rest-endpoint-methods": "^5.9.0" } }, "@octokit/types": { @@ -6370,9 +6391,9 @@ "dev": true }, "@types/node": { - "version": "16.9.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.4.tgz", - "integrity": "sha512-KDazLNYAGIuJugdbULwFZULF9qQ13yNWEBFnfVpqlpgAAo6H/qnM9RjBgh0A0kmHf3XxAKLdN5mTIng9iUvVLA==", + "version": "16.9.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz", + "integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ==", "dev": true }, "@types/parse-json": { @@ -6391,9 +6412,9 @@ } }, "@types/sinon": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.2.tgz", - "integrity": "sha512-BHn8Bpkapj8Wdfxvh2jWIUoaYB/9/XhsL0oOvBfRagJtKlSl9NWPcFOz2lRukI9szwGxFtYZCTejJSqsGDbdmw==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.3.tgz", + "integrity": "sha512-XUaFuUOQ3A/r6gS1qCU/USMleascaqGeQpGR1AZ5JdRtBPlzijRzKsik1TuGzvdtPA0mdq42JqaJmJ+Afg1LJg==", "dev": true, "requires": { "@sinonjs/fake-timers": "^7.1.0" @@ -6570,12 +6591,12 @@ "dev": true }, "async-retry": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.1.tgz", - "integrity": "sha512-aiieFW/7h3hY0Bq5d+ktDBejxuwR78vRu9hDUdR8rNhSaQ29VzPL4AoIRG7D/c7tdenwOcKvgPM6tIxB3cB6HA==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", "dev": true, "requires": { - "retry": "0.12.0" + "retry": "0.13.1" } }, "asynckit": { @@ -6770,9 +6791,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001258", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz", - "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==", + "version": "1.0.30001259", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz", + "integrity": "sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg==", "dev": true }, "chalk": { @@ -6954,9 +6975,9 @@ } }, "cosmiconfig": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", - "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", "dev": true, "requires": { "@types/parse-json": "^4.0.0", @@ -7118,9 +7139,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.844", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.844.tgz", - "integrity": "sha512-7ES6GQVsbgsUA49/apqub51I9ij8E3QwGqq/IRvO6OPCly3how/YUSg1GPslRWq+BteT2h94iAIQdJbuVVH4Pg==", + "version": "1.3.846", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.846.tgz", + "integrity": "sha512-2jtSwgyiRzybHRxrc2nKI+39wH3AwQgn+sogQ+q814gv8hIFwrcZbV07Ea9f8AmK0ufPVZUvvAG1uZJ+obV4Jw==", "dev": true }, "emoji-regex": { @@ -7383,9 +7404,9 @@ } }, "git-url-parse": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.5.0.tgz", - "integrity": "sha512-TZYSMDeM37r71Lqg1mbnMlOqlHd7BSij9qN7XwTkRqSAYFMihGLGhfHwgqQob3GUhEneKnV4nskN9rbQw2KGxA==", + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.6.0.tgz", + "integrity": "sha512-WWUxvJs5HsyHL6L08wOusa/IXYtMuCAhrMmnTjQPpBU0TTHyDhnOATNH3xNQz7YOQUsqIIPTGr4xiVti1Hsk5g==", "dev": true, "requires": { "git-up": "^4.0.0" @@ -7664,9 +7685,9 @@ "dev": true }, "inquirer": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.1.2.tgz", - "integrity": "sha512-DHLKJwLPNgkfwNmsuEUKSejJFbkv0FMO9SMiQbjI3n5NQuCrSIBqP66ggqyz2a6t2qEolKrMjhQ3+W/xXgUQ+Q==", + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.1.5.tgz", + "integrity": "sha512-G6/9xUqmt/r+UvufSyrPpt84NYwhKZ9jLsgMbQzlx804XErNupor8WQdBnBRrXmBfTPpuwf1sV+ss2ovjgdXIg==", "dev": true, "requires": { "ansi-escapes": "^4.2.1", @@ -7677,7 +7698,7 @@ "figures": "^3.0.0", "lodash": "^4.17.21", "mute-stream": "0.0.8", - "ora": "^5.3.0", + "ora": "^5.4.1", "run-async": "^2.4.0", "rxjs": "^7.2.0", "string-width": "^4.1.0", @@ -8279,9 +8300,9 @@ } }, "node-fetch": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.3.tgz", - "integrity": "sha512-BXSmNTLLDHT0UjQDg5E23x+0n/hPDjySqc0ELE4NpCa2wE5qmmaEWFRP/+v8pfuocchR9l5vFLbSB7CPE2ahvQ==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.4.tgz", + "integrity": "sha512-aD1fO+xtLiSCc9vuD+sYMxpIuQyhHscGSkBEo2o5LTV/3bTEAYvdUii29n8LlO5uLCmWdGP7uVUVXFo5SRdkLA==", "dev": true, "requires": { "whatwg-url": "^5.0.0" @@ -8884,6 +8905,12 @@ "fromentries": "^1.2.0" } }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -9038,25 +9065,25 @@ } }, "release-it": { - "version": "14.11.5", - "resolved": "https://registry.npmjs.org/release-it/-/release-it-14.11.5.tgz", - "integrity": "sha512-9BaPdq7ZKOwtzz3p1mRhg/tOH/cT/y2tUnPYzUwQiVdj42JaGI1Vo2l3WbgK8ICsbFyrhc0tri1+iqI8OvkI1A==", + "version": "14.11.6", + "resolved": "https://registry.npmjs.org/release-it/-/release-it-14.11.6.tgz", + "integrity": "sha512-6BNcuzFZHThBUBJ/xYw/bxZ+58CAwrwf1zgmjq2Ibl3nlDZbjphHG6iqxkJu7mZ8TIWs6NjloEAhqpjeXoN//Q==", "dev": true, "requires": { "@iarna/toml": "2.2.5", - "@octokit/rest": "18.9.0", - "async-retry": "1.3.1", + "@octokit/rest": "18.10.0", + "async-retry": "1.3.3", "chalk": "4.1.2", - "cosmiconfig": "7.0.0", + "cosmiconfig": "7.0.1", "debug": "4.3.2", "deprecated-obj": "2.0.0", "execa": "5.1.1", "form-data": "4.0.0", - "git-url-parse": "11.5.0", + "git-url-parse": "11.6.0", "globby": "11.0.4", "got": "11.8.2", "import-cwd": "3.0.0", - "inquirer": "8.1.2", + "inquirer": "8.1.5", "is-ci": "3.0.0", "lodash": "4.17.21", "mime-types": "2.1.32", @@ -9184,9 +9211,9 @@ } }, "retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", "dev": true }, "reusify": { @@ -9584,18 +9611,27 @@ } }, "typedoc": { - "version": "0.22.4", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.4.tgz", - "integrity": "sha512-M/a8NnPxq3/iZNNVjzFCK5gu4m//HTJIPbSS0JQVbkHJPP9wyepR12agylWTSqeVZe0xsbidVtO26+PP7iD/jw==", + "version": "0.21.9", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.9.tgz", + "integrity": "sha512-VRo7aII4bnYaBBM1lhw4bQFmUcDQV8m8tqgjtc7oXl87jc1Slbhfw2X5MccfcR2YnEClHDWgsiQGgNB8KJXocA==", "dev": true, "requires": { "glob": "^7.1.7", + "handlebars": "^4.7.7", "lunr": "^2.3.9", - "marked": "^3.0.4", - "minimatch": "^3.0.4", - "shiki": "^0.9.11" + "marked": "^3.0.2", + "minimatch": "^3.0.0", + "progress": "^2.0.3", + "shiki": "^0.9.8", + "typedoc-default-themes": "^0.12.10" } }, + "typedoc-default-themes": { + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", + "dev": true + }, "typedoc-github-wiki-theme": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.5.1.tgz", @@ -9604,9 +9640,9 @@ "requires": {} }, "typedoc-plugin-markdown": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.0.tgz", - "integrity": "sha512-zewcbzOlMV9nbhLsJhKBpoRW4J32LgbfdqwYfEfzzeE+wGOaOfsM6g7QH+ZKj8n+knH4sLCtk6XMN1TI/a1UuQ==", + "version": "3.10.4", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.4.tgz", + "integrity": "sha512-if9w7S9fXLg73AYi/EoRSEhTOZlg3I8mIP8YEmvzSE33VrNXC9/hA0nVcLEwFVJeQY7ay6z67I6kW0KIv7LjeA==", "dev": true, "requires": { "handlebars": "^4.7.7" diff --git a/package.json b/package.json index fc107833fc6..ec77a93bb55 100644 --- a/package.json +++ b/package.json @@ -35,19 +35,19 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.9.4", - "@types/sinon": "^10.0.2", + "@types/node": "^16.9.6", + "@types/sinon": "^10.0.3", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", "mocha": "^9.1.1", "nyc": "^15.1.0", - "release-it": "^14.11.5", + "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", "ts-node": "^10.2.1", - "typedoc": "^0.22.4", + "typedoc": "0.21.9", "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "^3.11.0", + "typedoc-plugin-markdown": "3.10.4", "typescript": "^4.4.3", "which": "^2.0.2" }, From 1c13a6575f1f68e6779c32bcbacf91db40058ec8 Mon Sep 17 00:00:00 2001 From: leibale Date: Tue, 21 Sep 2021 18:49:21 -0400 Subject: [PATCH 19/40] update client-configurations.md --- docs/client-configuration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/client-configuration.md b/docs/client-configuration.md index 0c4c0c1ca8f..11fdb0a6819 100644 --- a/docs/client-configuration.md +++ b/docs/client-configuration.md @@ -6,6 +6,7 @@ | socket | | Object defining socket connection properties | | socket.host | `'localhost'` | Hostname to connect to | | socket.port | `6379` | Port to connect to | +| socket.path | | UNIX Socket to connect to | | socket.connectTimeout | `5000` | The timeout for connecting to the Redis Server (in milliseconds) | | socket.noDelay | `true` | Enable/disable the use of [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay) | | socket.keepAlive | `5000` | Enable/disable the [`keep-alive`](https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay) functionality | From 9237a4e68aef4aae5af291cbb966a46d6715682f Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 23 Sep 2021 11:06:30 -0400 Subject: [PATCH 20/40] fix README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0ac104a2c21..c5f0ea1a1c9 100644 --- a/README.md +++ b/README.md @@ -287,6 +287,7 @@ Thank you to all the people who already contributed to Node Redis! + ## License This repository is licensed under the "MIT" license. See [LICENSE](LICENSE). From 42dcf802b14ff5b1aeda3c87eba9dd3426107b31 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 23 Sep 2021 16:17:00 -0400 Subject: [PATCH 21/40] add CLUSTER_SLOTS, add some tests --- lib/client.spec.ts | 29 ++++++++++++ lib/commands/CLUSTER_SLOTS.spec.ts | 76 ++++++++++++++++++++++++++++++ lib/commands/CLUSTER_SLOTS.ts | 41 ++++++++++++++++ lib/commands/index.ts | 3 ++ 4 files changed, 149 insertions(+) create mode 100644 lib/commands/CLUSTER_SLOTS.spec.ts create mode 100644 lib/commands/CLUSTER_SLOTS.ts diff --git a/lib/client.spec.ts b/lib/client.spec.ts index 06f8d2bb102..9f600c79185 100644 --- a/lib/client.spec.ts +++ b/lib/client.spec.ts @@ -5,6 +5,7 @@ import RedisClient from './client'; import { AbortError, ClientClosedError, ConnectionTimeoutError, WatchError } from './errors'; import { defineScript } from './lua-script'; import { spy } from 'sinon'; +import { RedisNetSocketOptions } from './socket'; export const SQUARE_SCRIPT = defineScript({ NUMBER_OF_KEYS: 0, @@ -63,6 +64,34 @@ describe('Client', () => { TypeError ); }); + + it('redis://localhost', () => { + assert.deepEqual( + RedisClient.parseURL('redis://localhost'), + { + socket: { + host: 'localhost', + } + } + ); + }); + + it('createClient with url', async () => { + const client = RedisClient.create({ + url: `redis://localhost:${(TEST_REDIS_SERVERS[TestRedisServers.OPEN].socket as RedisNetSocketOptions)!.port!.toString()}/1` + }); + + await client.connect(); + + try { + assert.equal( + (await client.clientInfo()).db, + 1 + ); + } finally { + await client.disconnect(); + } + }); }); describe('authentication', () => { diff --git a/lib/commands/CLUSTER_SLOTS.spec.ts b/lib/commands/CLUSTER_SLOTS.spec.ts new file mode 100644 index 00000000000..ec6773bcdd4 --- /dev/null +++ b/lib/commands/CLUSTER_SLOTS.spec.ts @@ -0,0 +1,76 @@ +import { strict as assert } from 'assert'; +import { transformArguments, transformReply } from './CLUSTER_SLOTS'; + +describe('CLUSTER SLOTS', () => { + it('transformArguments', () => { + assert.deepEqual( + transformArguments(), + ['CLUSTER', 'SLOTS'] + ); + }); + + it('transformReply', () => { + assert.deepEqual( + transformReply([ + [ + 0, + 5460, + ['127.0.0.1', 30001, '09dbe9720cda62f7865eabc5fd8857c5d2678366'], + ['127.0.0.1', 30004, '821d8ca00d7ccf931ed3ffc7e3db0599d2271abf'] + ], + [ + 5461, + 10922, + ['127.0.0.1', 30002, 'c9d93d9f2c0c524ff34cc11838c2003d8c29e013'], + ['127.0.0.1', 30005, 'faadb3eb99009de4ab72ad6b6ed87634c7ee410f'] + ], + [ + 10923, + 16383, + ['127.0.0.1', 30003, '044ec91f325b7595e76dbcb18cc688b6a5b434a1'], + ['127.0.0.1', 30006, '58e6e48d41228013e5d9c1c37c5060693925e97e'] + ] + ]), + [{ + from: 0, + to: 5460, + master: { + ip: '127.0.0.1', + port: 30001, + id: '09dbe9720cda62f7865eabc5fd8857c5d2678366' + }, + replicas: [{ + ip: '127.0.0.1', + port: 30004, + id: '821d8ca00d7ccf931ed3ffc7e3db0599d2271abf' + }] + }, { + from: 5461, + to: 10922, + master: { + ip: '127.0.0.1', + port: 30002, + id: 'c9d93d9f2c0c524ff34cc11838c2003d8c29e013' + }, + replicas: [{ + ip: '127.0.0.1', + port: 30005, + id: 'faadb3eb99009de4ab72ad6b6ed87634c7ee410f' + }] + }, { + from: 10923, + to: 16383, + master: { + ip: '127.0.0.1', + port: 30003, + id: '044ec91f325b7595e76dbcb18cc688b6a5b434a1' + }, + replicas: [{ + ip: '127.0.0.1', + port: 30006, + id: '58e6e48d41228013e5d9c1c37c5060693925e97e' + }] + }] + ) + }); +}); diff --git a/lib/commands/CLUSTER_SLOTS.ts b/lib/commands/CLUSTER_SLOTS.ts new file mode 100644 index 00000000000..b4672e731ac --- /dev/null +++ b/lib/commands/CLUSTER_SLOTS.ts @@ -0,0 +1,41 @@ +import { TransformArgumentsReply } from '.'; + +export function transformArguments(): TransformArgumentsReply { + return ['CLUSTER', 'SLOTS']; +} + +type ClusterSlotsRawNode = [ip: string, port: number, id: string]; + +type ClusterSlotsRawReply = Array<[from: number, to: number, master: ClusterSlotsRawNode, ...replicas: Array]>; + +type ClusterSlotsNode = { + ip: string; + port: number; + id: string; +}; + +export type ClusterSlotsReply = Array<{ + from: number; + to: number; + master: ClusterSlotsNode; + replicas: Array; +}>; + +export function transformReply(reply: ClusterSlotsRawReply): ClusterSlotsReply { + return reply.map(([from, to, master, ...replicas]) => { + return { + from, + to, + master: transformNode(master), + replicas: replicas.map(transformNode) + }; + }); +} + +function transformNode([ip, port, id]: ClusterSlotsRawNode): ClusterSlotsNode { + return { + ip, + port, + id + }; +} diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 93220630980..89581090e58 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -34,6 +34,7 @@ import * as CLUSTER_NODES from './CLUSTER_NODES'; import * as CLUSTER_MEET from './CLUSTER_MEET'; import * as CLUSTER_RESET from './CLUSTER_RESET'; import * as CLUSTER_SETSLOT from './CLUSTER_SETSLOT'; +import * as CLUSTER_SLOTS from './CLUSTER_SLOTS'; import * as CONFIG_GET from './CONFIG_GET'; import * as CONFIG_RESETASTAT from './CONFIG_RESETSTAT'; import * as CONFIG_REWRITE from './CONFIG_REWRITE'; @@ -317,6 +318,8 @@ export default { clusterReset: CLUSTER_RESET, CLUSTER_SETSLOT, clusterSetSlot: CLUSTER_SETSLOT, + CLUSTER_SLOTS, + clusterSlots: CLUSTER_SLOTS, CONFIG_GET, configGet: CONFIG_GET, CONFIG_RESETASTAT, From 7d286e7ebe38c9a2f1f3161581f09410494bb041 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 23 Sep 2021 16:33:47 -0400 Subject: [PATCH 22/40] fix "createClient with url" test with redis 5 --- lib/client.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client.spec.ts b/lib/client.spec.ts index 9f600c79185..2cf6ea4964e 100644 --- a/lib/client.spec.ts +++ b/lib/client.spec.ts @@ -85,13 +85,13 @@ describe('Client', () => { try { assert.equal( - (await client.clientInfo()).db, - 1 + await client.ping(), + 'PONG' ); } finally { await client.disconnect(); } - }); + }) }); describe('authentication', () => { From 06ee6af14a010e5ff9172c87fa694505d100a63b Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 23 Sep 2021 16:35:55 -0400 Subject: [PATCH 23/40] remove unused imports --- lib/cluster.ts | 1 - lib/commander.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/cluster.ts b/lib/cluster.ts index 97e87d3d88e..4be0e268207 100644 --- a/lib/cluster.ts +++ b/lib/cluster.ts @@ -6,7 +6,6 @@ import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { extendWithModulesAndScripts, extendWithDefaultCommands, transformCommandArguments } from './commander'; import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; import { EventEmitter } from 'events'; -import cluster from 'cluster'; export interface RedisClusterOptions { rootNodes: Array; diff --git a/lib/commander.ts b/lib/commander.ts index c2b1918709a..78823516448 100644 --- a/lib/commander.ts +++ b/lib/commander.ts @@ -2,7 +2,6 @@ import COMMANDS, { RedisCommand, RedisModules, TransformArgumentsReply } from './commands'; import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { CommandOptions, isCommandOptions } from './command-options'; -import { off } from 'process'; type Instantiable = new(...args: Array) => T; From 01df65157a095c81afc02a54a5f98dbfab057737 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 23 Sep 2021 16:36:27 -0400 Subject: [PATCH 24/40] Release 4.0.0-rc.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 36d4818943c..9fcd62b5996 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "redis", - "version": "4.0.0-rc.1", + "version": "4.0.0-rc.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redis", - "version": "4.0.0-rc.1", + "version": "4.0.0-rc.2", "license": "MIT", "dependencies": { "cluster-key-slot": "1.1.0", diff --git a/package.json b/package.json index ec77a93bb55..b2ceadbdd16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redis", - "version": "4.0.0-rc.1", + "version": "4.0.0-rc.2", "description": "A high performance Redis client.", "keywords": [ "database", From 9a1beedda7ef2d07599e061d6f542fa9a2e1e965 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 23 Sep 2021 16:52:34 -0400 Subject: [PATCH 25/40] add missing semicolon --- lib/commands/BITFIELD.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commands/BITFIELD.ts b/lib/commands/BITFIELD.ts index 445c26e28a3..90adb969814 100644 --- a/lib/commands/BITFIELD.ts +++ b/lib/commands/BITFIELD.ts @@ -66,7 +66,7 @@ export function transformArguments(key: string, operations: BitFieldOperations): options.type, options.offset.toString(), options.increment.toString() - ) + ); break; case 'OVERFLOW': From c19d200b91c3c32fde7bf75c859daf9b416a5540 Mon Sep 17 00:00:00 2001 From: leibale Date: Wed, 29 Sep 2021 17:58:16 -0400 Subject: [PATCH 26/40] replace empty "transformReply" functions with typescript "declare" --- benchmark/package-lock.json | 215 ++++------ lib/client.ts | 20 +- lib/cluster.ts | 22 +- lib/commander.ts | 10 +- lib/commands/ACL_CAT.ts | 4 +- lib/commands/ACL_DELUSER.ts | 4 +- lib/commands/ACL_GENPASS.ts | 4 +- lib/commands/ACL_LIST.ts | 4 +- lib/commands/ACL_LOAD.ts | 4 +- lib/commands/ACL_LOG_RESET.ts | 4 +- lib/commands/ACL_SAVE.ts | 4 +- lib/commands/ACL_SETUSER.ts | 4 +- lib/commands/ACL_USERS.ts | 4 +- lib/commands/ACL_WHOAMI.ts | 4 +- lib/commands/APPEND.ts | 4 +- lib/commands/ASKING.ts | 4 +- lib/commands/AUTH.ts | 4 +- lib/commands/BGREWRITEAOF.ts | 4 +- lib/commands/BGSAVE.ts | 4 +- lib/commands/BITCOUNT.ts | 4 +- lib/commands/BITFIELD.ts | 4 +- lib/commands/BITOP.ts | 4 +- lib/commands/BITPOS.ts | 4 +- lib/commands/BLMOVE.ts | 3 +- lib/commands/BRPOPLPUSH.ts | 4 +- lib/commands/CLIENT_ID.ts | 4 +- lib/commands/CLUSTER_ADDSLOTS.ts | 4 +- lib/commands/CLUSTER_FLUSHSLOTS.ts | 4 +- lib/commands/CLUSTER_GETKEYSINSLOT.ts | 4 +- lib/commands/CLUSTER_MEET.ts | 4 +- lib/commands/CLUSTER_RESET.ts | 4 +- lib/commands/CLUSTER_SETSLOT.ts | 4 +- lib/commands/CONFIG_RESETSTAT.ts | 4 +- lib/commands/CONFIG_REWRITE.ts | 4 +- lib/commands/CONFIG_SET.ts | 4 +- lib/commands/DBSIZE.ts | 4 +- lib/commands/DECR.ts | 4 +- lib/commands/DECRBY.ts | 4 +- lib/commands/DEL.ts | 4 +- lib/commands/DISCARD.ts | 4 +- lib/commands/DUMP.ts | 4 +- lib/commands/ECHO.ts | 4 +- lib/commands/FAILOVER.ts | 4 +- lib/commands/FLUSHALL.ts | 4 +- lib/commands/FLUSHDB.ts | 3 +- lib/commands/GEOADD.ts | 4 +- lib/commands/GEOHASH.ts | 4 +- lib/commands/GEOSEARCH.ts | 4 +- lib/commands/GET.ts | 3 +- lib/commands/GETBIT.ts | 4 +- lib/commands/GETDEL.ts | 4 +- lib/commands/GETEX.ts | 4 +- lib/commands/GETRANGE.ts | 4 +- lib/commands/GETSET.ts | 4 +- lib/commands/GET_BUFFER.ts | 4 +- lib/commands/HDEL.ts | 4 +- lib/commands/HINCRBY.ts | 4 +- lib/commands/HINCRBYFLOAT.ts | 4 +- lib/commands/HKEYS.ts | 4 +- lib/commands/HLEN.ts | 4 +- lib/commands/HMGET.ts | 4 +- lib/commands/HRANDFIELD.ts | 4 +- lib/commands/HRANDFIELD_COUNT.ts | 3 +- lib/commands/HSET.ts | 3 +- lib/commands/HSTRLEN.ts | 4 +- lib/commands/HVALS.ts | 4 +- lib/commands/INCR.ts | 4 +- lib/commands/INCRBY.ts | 4 +- lib/commands/INCRBYFLOAT.ts | 4 +- lib/commands/INFO.ts | 4 +- lib/commands/LINDEX.ts | 4 +- lib/commands/LINSERT.ts | 4 +- lib/commands/LLEN.ts | 4 +- lib/commands/LMOVE.ts | 4 +- lib/commands/LOLWUT.ts | 4 +- lib/commands/LPOP.ts | 4 +- lib/commands/LPOP_COUNT.ts | 4 +- lib/commands/LPOS.ts | 4 +- lib/commands/LPOS_COUNT.ts | 3 +- lib/commands/LPUSH.ts | 4 +- lib/commands/LPUSHX.ts | 4 +- lib/commands/LRANGE.ts | 4 +- lib/commands/LREM.ts | 4 +- lib/commands/LSET.ts | 4 +- lib/commands/LTRIM.ts | 4 +- lib/commands/MEMORY_DOCTOR.ts | 4 +- lib/commands/MEMORY_MALLOC-STATS.ts | 4 +- lib/commands/MEMORY_PURGE.ts | 4 +- lib/commands/MEMORY_USAGE.ts | 4 +- lib/commands/MGET.ts | 4 +- lib/commands/MIGRATE.ts | 3 +- lib/commands/MODULE_LIST.ts | 4 +- lib/commands/MODULE_LOAD.ts | 4 +- lib/commands/MODULE_UNLOAD.ts | 4 +- lib/commands/MSET.ts | 4 +- lib/commands/PFCOUNT.ts | 4 +- lib/commands/PFMERGE.ts | 4 +- lib/commands/PING.ts | 4 +- lib/commands/PSETEX.ts | 4 +- lib/commands/PTTL.ts | 4 +- lib/commands/PUBLISH.ts | 4 +- lib/commands/PUBSUB_CHANNELS.ts | 4 +- lib/commands/PUBSUB_NUMPAT.ts | 4 +- lib/commands/READONLY.ts | 4 +- lib/commands/READWRITE.ts | 4 +- lib/commands/RENAME.ts | 4 +- lib/commands/REPLICAOF.ts | 4 +- lib/commands/RESTORE-ASKING.ts | 4 +- lib/commands/RPOP.ts | 4 +- lib/commands/RPOPLPUSH.ts | 4 +- lib/commands/RPOP_COUNT.ts | 4 +- lib/commands/RPUSH.ts | 4 +- lib/commands/RPUSHX.ts | 4 +- lib/commands/SADD.ts | 4 +- lib/commands/SAVE.ts | 4 +- lib/commands/SCARD.ts | 4 +- lib/commands/SCRIPT_DEBUG.ts | 4 +- lib/commands/SCRIPT_FLUSH.ts | 4 +- lib/commands/SCRIPT_KILL.ts | 4 +- lib/commands/SCRIPT_LOAD.ts | 4 +- lib/commands/SDIFF.ts | 4 +- lib/commands/SDIFFSTORE.ts | 4 +- lib/commands/SETBIT.ts | 4 +- lib/commands/SETEX.ts | 3 +- lib/commands/SETRANGE.ts | 4 +- lib/commands/SHUTDOWN.ts | 4 +- lib/commands/SINTER.ts | 4 +- lib/commands/SINTERSTORE.ts | 4 +- lib/commands/SMEMBERS.ts | 4 +- lib/commands/SPOP.ts | 4 +- lib/commands/SRANDMEMBER.ts | 4 +- lib/commands/SRANDMEMBER_COUNT.ts | 3 +- lib/commands/SREM.ts | 4 +- lib/commands/STRLEN.ts | 4 +- lib/commands/SUNION.ts | 4 +- lib/commands/SUNIONSTORE.ts | 4 +- lib/commands/SWAPDB.ts | 4 +- lib/commands/TOUCH.ts | 4 +- lib/commands/TTL.ts | 4 +- lib/commands/TYPE.ts | 4 +- lib/commands/UNLINK.ts | 4 +- lib/commands/UNWATCH.ts | 4 +- lib/commands/WAIT.ts | 4 +- lib/commands/WATCH.ts | 4 +- lib/commands/XACK.ts | 4 +- lib/commands/XADD.ts | 5 +- lib/commands/XCLAIM_JUSTID.ts | 3 +- lib/commands/XDEL.ts | 4 +- lib/commands/XGROUP_CREATE.ts | 4 +- lib/commands/XGROUP_DELCONSUMER.ts | 4 +- lib/commands/XGROUP_SETID.ts | 4 +- lib/commands/XLEN.ts | 4 +- lib/commands/XTRIM.ts | 4 +- lib/commands/ZCARD.ts | 4 +- lib/commands/ZCOUNT.ts | 4 +- lib/commands/ZDIFF.ts | 4 +- lib/commands/ZDIFFSTORE.ts | 4 +- lib/commands/ZINTER.ts | 4 +- lib/commands/ZINTERSTORE.ts | 4 +- lib/commands/ZLEXCOUNT.ts | 4 +- lib/commands/ZRANDMEMBER.ts | 4 +- lib/commands/ZRANDMEMBER_COUNT.ts | 3 +- lib/commands/ZRANGE.ts | 4 +- lib/commands/ZRANK.ts | 4 +- lib/commands/ZREM.ts | 4 +- lib/commands/ZREMRANGEBYLEX.ts | 4 +- lib/commands/ZREMRANGEBYRANK.ts | 4 +- lib/commands/ZREMRANGEBYSCORE.ts | 4 +- lib/commands/ZREVRANK.ts | 4 +- lib/commands/ZUNION.ts | 4 +- lib/commands/ZUNIONSTORE.ts | 4 +- lib/commands/generic-transformers.ts | 46 --- lib/commands/index.ts | 4 +- package-lock.json | 548 ++++++++------------------ 174 files changed, 472 insertions(+), 1051 deletions(-) diff --git a/benchmark/package-lock.json b/benchmark/package-lock.json index a16a420f8cb..767d6870184 100644 --- a/benchmark/package-lock.json +++ b/benchmark/package-lock.json @@ -4,9 +4,9 @@ "requires": true, "packages": { "": { + "name": "benchmark", "license": "ISC", "dependencies": { - "@probe.gl/bench": "^3.4.0", "benny": "^3.6.15", "v3": "npm:redis@3.1.2", "v4": "file:../" @@ -14,30 +14,31 @@ }, "..": { "name": "redis", - "version": "4.0.0-next.5", + "version": "4.0.0-rc.2", "license": "MIT", "dependencies": { "cluster-key-slot": "1.1.0", + "generic-pool": "3.8.2", "redis-parser": "3.0.0", "yallist": "4.0.0" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.4.5", - "@types/sinon": "^10.0.2", + "@types/node": "^16.9.6", + "@types/sinon": "^10.0.3", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", - "mocha": "^9.0.3", + "mocha": "^9.1.1", "nyc": "^15.1.0", - "release-it": "^14.10.1", + "release-it": "^14.11.6", "sinon": "^11.1.2", - "source-map-support": "^0.5.19", - "ts-node": "^10.1.0", - "typedoc": "^0.21.4", + "source-map-support": "^0.5.20", + "ts-node": "^10.2.1", + "typedoc": "0.21.9", "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "^3.10.4", - "typescript": "^4.3.5", + "typedoc-plugin-markdown": "3.10.4", + "typescript": "^4.4.3", "which": "^2.0.2" }, "engines": { @@ -81,34 +82,6 @@ "fast-deep-equal": "^3.1.1" } }, - "node_modules/@babel/runtime": { - "version": "7.14.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.8.tgz", - "integrity": "sha512-twj3L8Og5SaCRCErB4x4ajbvBIVV77CGeFglHpeg5WC5FF8TZzBWXtTJ4MqaD9QszLYTtr+IsaAL2rEUevb+eg==", - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@probe.gl/bench": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@probe.gl/bench/-/bench-3.4.0.tgz", - "integrity": "sha512-S7iNPz5G3zEfEP0S4SAMvtj+dwP7EWfVBaA8Cy5CVIgM1lnpUbXvqoAJxlVEedNC32Icxwq65XQheufy1Zzmug==", - "dependencies": { - "@babel/runtime": "^7.0.0", - "probe.gl": "3.4.0" - } - }, - "node_modules/@probe.gl/stats": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@probe.gl/stats/-/stats-3.4.0.tgz", - "integrity": "sha512-Gl37r9qGuiKadIvTZdSZvzCNOttJYw6RcY1oT0oDuB8r2uhuZAdSMQRQTy9FTinp6MY6O9wngGnV6EpQ8wSBAw==", - "dependencies": { - "@babel/runtime": "^7.0.0" - } - }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -124,9 +97,9 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "engines": { "node": ">=8" } @@ -223,9 +196,9 @@ } }, "node_modules/denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz", + "integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==", "engines": { "node": ">=0.10" } @@ -255,9 +228,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", @@ -366,9 +339,9 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, "node_modules/prettier": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", - "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", "bin": { "prettier": "bin-prettier.js" }, @@ -376,15 +349,6 @@ "node": ">=10.13.0" } }, - "node_modules/probe.gl": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/probe.gl/-/probe.gl-3.4.0.tgz", - "integrity": "sha512-9CLByZATuhuG/Viq3ckfWU+dAhb7dMmjzsyCy4s7ds9ueTejcVRENxL197/XacOK/AN61YrEERB0QnouB0Qc0Q==", - "dependencies": { - "@babel/runtime": "^7.0.0", - "@probe.gl/stats": "3.4.0" - } - }, "node_modules/redis-commands": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", @@ -409,11 +373,6 @@ "node": ">=4" } }, - "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -427,9 +386,9 @@ } }, "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", + "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==" }, "node_modules/slice-ansi": { "version": "4.0.0", @@ -453,24 +412,24 @@ "integrity": "sha512-IYsheLg6dasD3zT/w9+8Iq9tcIQqqu91ZIpJOnIEM25C3X/g4Tl8mhXwW2ZQpbrsJISr9+wizEYgsibN5/b32Q==" }, "node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" @@ -570,31 +529,6 @@ "fast-deep-equal": "^3.1.1" } }, - "@babel/runtime": { - "version": "7.14.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.8.tgz", - "integrity": "sha512-twj3L8Og5SaCRCErB4x4ajbvBIVV77CGeFglHpeg5WC5FF8TZzBWXtTJ4MqaD9QszLYTtr+IsaAL2rEUevb+eg==", - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@probe.gl/bench": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@probe.gl/bench/-/bench-3.4.0.tgz", - "integrity": "sha512-S7iNPz5G3zEfEP0S4SAMvtj+dwP7EWfVBaA8Cy5CVIgM1lnpUbXvqoAJxlVEedNC32Icxwq65XQheufy1Zzmug==", - "requires": { - "@babel/runtime": "^7.0.0", - "probe.gl": "3.4.0" - } - }, - "@probe.gl/stats": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@probe.gl/stats/-/stats-3.4.0.tgz", - "integrity": "sha512-Gl37r9qGuiKadIvTZdSZvzCNOttJYw6RcY1oT0oDuB8r2uhuZAdSMQRQTy9FTinp6MY6O9wngGnV6EpQ8wSBAw==", - "requires": { - "@babel/runtime": "^7.0.0" - } - }, "ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -604,9 +538,9 @@ } }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { "version": "4.3.0", @@ -679,9 +613,9 @@ "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==" }, "denque": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz", - "integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz", + "integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==" }, "emoji-regex": { "version": "8.0.0", @@ -705,9 +639,9 @@ } }, "graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -783,18 +717,9 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, "prettier": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", - "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==" - }, - "probe.gl": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/probe.gl/-/probe.gl-3.4.0.tgz", - "integrity": "sha512-9CLByZATuhuG/Viq3ckfWU+dAhb7dMmjzsyCy4s7ds9ueTejcVRENxL197/XacOK/AN61YrEERB0QnouB0Qc0Q==", - "requires": { - "@babel/runtime": "^7.0.0", - "@probe.gl/stats": "3.4.0" - } + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==" }, "redis-commands": { "version": "1.7.0", @@ -814,11 +739,6 @@ "redis-errors": "^1.0.0" } }, - "regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, "restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -829,9 +749,9 @@ } }, "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", + "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==" }, "slice-ansi": { "version": "4.0.0", @@ -849,21 +769,21 @@ "integrity": "sha512-IYsheLg6dasD3zT/w9+8Iq9tcIQqqu91ZIpJOnIEM25C3X/g4Tl8mhXwW2ZQpbrsJISr9+wizEYgsibN5/b32Q==" }, "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "type-fest": { @@ -892,22 +812,23 @@ "requires": { "@istanbuljs/nyc-config-typescript": "^1.0.1", "@types/mocha": "^9.0.0", - "@types/node": "^16.4.5", - "@types/sinon": "^10.0.2", + "@types/node": "^16.9.6", + "@types/sinon": "^10.0.3", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", "cluster-key-slot": "1.1.0", - "mocha": "^9.0.3", + "generic-pool": "3.8.2", + "mocha": "^9.1.1", "nyc": "^15.1.0", "redis-parser": "3.0.0", - "release-it": "^14.10.1", + "release-it": "^14.11.6", "sinon": "^11.1.2", - "source-map-support": "^0.5.19", - "ts-node": "^10.1.0", - "typedoc": "^0.21.4", + "source-map-support": "^0.5.20", + "ts-node": "^10.2.1", + "typedoc": "0.21.9", "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "^3.10.4", - "typescript": "^4.3.5", + "typedoc-plugin-markdown": "3.10.4", + "typescript": "^4.4.3", "which": "^2.0.2", "yallist": "4.0.0" } diff --git a/lib/client.ts b/lib/client.ts index 93afee1ff1a..98169bc302e 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -1,6 +1,6 @@ import RedisSocket, { RedisSocketOptions, RedisNetSocketOptions, RedisTlsSocketOptions } from './socket'; import RedisCommandsQueue, { PubSubListener, PubSubSubscribeCommands, PubSubUnsubscribeCommands, QueueCommandOptions } from './commands-queue'; -import COMMANDS, { TransformArgumentsReply } from './commands'; +import COMMANDS, { RedisCommandReply, TransformArgumentsReply } from './commands'; import { RedisCommand, RedisModules, RedisReply } from './commands'; import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; import EventEmitter from 'events'; @@ -9,7 +9,7 @@ import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { ScanOptions, ZMember } from './commands/generic-transformers'; import { ScanCommandOptions } from './commands/SCAN'; import { HScanTuple } from './commands/HSCAN'; -import { encodeCommand, extendWithDefaultCommands, extendWithModulesAndScripts, transformCommandArguments } from './commander'; +import { encodeCommand, extendWithDefaultCommands, extendWithModulesAndScripts, transformCommandArguments, transformCommandReply } from './commander'; import { Pool, Options as PoolOptions, createPool } from 'generic-pool'; import { ClientClosedError } from './errors'; import { URL } from 'url'; @@ -29,7 +29,7 @@ export interface RedisClientOptions { } export type RedisCommandSignature = - (...args: Parameters | [options: CommandOptions, ...rest: Parameters]) => Promise>; + (...args: Parameters | [options: CommandOptions, ...rest: Parameters]) => Promise>; type WithCommands = { [P in keyof typeof COMMANDS]: RedisCommandSignature<(typeof COMMANDS)[P]>; @@ -275,12 +275,13 @@ export default class RedisClient): Promise> { + async commandsExecutor(command: RedisCommand, args: Array): Promise> { const { args: redisArgs, options } = transformCommandArguments(command, args); - return command.transformReply( + return transformCommandReply( + command, await this.#sendCommand(redisArgs, options, command.BUFFER_MODE), - redisArgs.preserve, + redisArgs.preserve ); } @@ -308,16 +309,17 @@ export default class RedisClient): Promise> { + async scriptsExecutor(script: RedisLuaScript, args: Array): Promise> { const { args: redisArgs, options } = transformCommandArguments(script, args); - return script.transformReply( + return transformCommandReply( + script, await this.executeScript(script, redisArgs, options, script.BUFFER_MODE), redisArgs.preserve ); } - async executeScript(script: RedisLuaScript, args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise> { + async executeScript(script: RedisLuaScript, args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise> { try { return await this.#sendCommand([ 'EVALSHA', diff --git a/lib/cluster.ts b/lib/cluster.ts index 4be0e268207..87dcec17b71 100644 --- a/lib/cluster.ts +++ b/lib/cluster.ts @@ -1,9 +1,9 @@ -import { RedisCommand, RedisModules, TransformArgumentsReply } from './commands'; +import { RedisCommand, RedisCommandReply, RedisModules, TransformArgumentsReply } from './commands'; import RedisClient, { ClientCommandOptions, RedisClientType, WithPlugins } from './client'; import { RedisSocketOptions } from './socket'; import RedisClusterSlots, { ClusterNode } from './cluster-slots'; import { RedisLuaScript, RedisLuaScripts } from './lua-script'; -import { extendWithModulesAndScripts, extendWithDefaultCommands, transformCommandArguments } from './commander'; +import { extendWithModulesAndScripts, extendWithDefaultCommands, transformCommandArguments, transformCommandReply } from './commander'; import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; import { EventEmitter } from 'events'; @@ -59,10 +59,11 @@ export default class RedisCluster): Promise> { + async commandsExecutor(command: RedisCommand, args: Array): Promise> { const { args: redisArgs, options } = transformCommandArguments(command, args); - const reply = command.transformReply( + return transformCommandReply( + command, await this.sendCommand( RedisCluster.#extractFirstKey(command, args, redisArgs), command.IS_READ_ONLY, @@ -72,8 +73,6 @@ export default class RedisCluster( @@ -83,7 +82,7 @@ export default class RedisCluster> { + ): Promise> { const client = this.#slots.getClient(firstKey, isReadonly); try { @@ -100,10 +99,11 @@ export default class RedisCluster): Promise> { + async scriptsExecutor(script: RedisLuaScript, args: Array): Promise> { const { args: redisArgs, options } = transformCommandArguments(script, args); - const reply = script.transformReply( + return transformCommandReply( + script, await this.executeScript( script, args, @@ -112,8 +112,6 @@ export default class RedisCluster> { + ): Promise> { const client = this.#slots.getClient( RedisCluster.#extractFirstKey(script, originalArgs, redisArgs), script.IS_READ_ONLY diff --git a/lib/commander.ts b/lib/commander.ts index 78823516448..4e542bde74a 100644 --- a/lib/commander.ts +++ b/lib/commander.ts @@ -1,5 +1,5 @@ -import COMMANDS, { RedisCommand, RedisModules, TransformArgumentsReply } from './commands'; +import COMMANDS, { RedisCommand, RedisCommandReply, RedisModules, RedisReply, TransformArgumentsReply } from './commands'; import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { CommandOptions, isCommandOptions } from './command-options'; @@ -106,3 +106,11 @@ export function* encodeCommand(args: TransformArgumentsReply): IterableIterator< yield DELIMITER; } } + +export function transformCommandReply(command: RedisCommand, rawReply: RedisReply, preserved: unknown): RedisCommandReply { + if (!command.transformReply) { + return rawReply; + } + + return command.transformReply(rawReply, preserved); +} diff --git a/lib/commands/ACL_CAT.ts b/lib/commands/ACL_CAT.ts index d1620ef1584..f11be873961 100644 --- a/lib/commands/ACL_CAT.ts +++ b/lib/commands/ACL_CAT.ts @@ -1,5 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; - export function transformArguments(categoryName?: string): Array { const args = ['ACL', 'CAT']; @@ -10,4 +8,4 @@ export function transformArguments(categoryName?: string): Array { return args; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ACL_DELUSER.ts b/lib/commands/ACL_DELUSER.ts index 85a916c4379..e83e4d7d0ab 100644 --- a/lib/commands/ACL_DELUSER.ts +++ b/lib/commands/ACL_DELUSER.ts @@ -1,8 +1,8 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export function transformArguments(username: string | Array): TransformArgumentsReply { return pushVerdictArguments(['ACL', 'DELUSER'], username); } -export const transformReply = transformReplyNumber; +export declare const transformReply: (reply: number) => number; diff --git a/lib/commands/ACL_GENPASS.ts b/lib/commands/ACL_GENPASS.ts index ec55aebdb07..6a36c396619 100644 --- a/lib/commands/ACL_GENPASS.ts +++ b/lib/commands/ACL_GENPASS.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(bits?: number): Array { const args = ['ACL', 'GENPASS']; @@ -10,4 +8,4 @@ export function transformArguments(bits?: number): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ACL_LIST.ts b/lib/commands/ACL_LIST.ts index 3f2845b907a..a2caae82c46 100644 --- a/lib/commands/ACL_LIST.ts +++ b/lib/commands/ACL_LIST.ts @@ -1,7 +1,5 @@ -import { transformReplyStringArray } from './generic-transformers'; - export function transformArguments(): Array { return ['ACL', 'LIST']; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ACL_LOAD.ts b/lib/commands/ACL_LOAD.ts index 59418614ed3..0a5ea85101d 100644 --- a/lib/commands/ACL_LOAD.ts +++ b/lib/commands/ACL_LOAD.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['ACL', 'LOAD']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ACL_LOG_RESET.ts b/lib/commands/ACL_LOG_RESET.ts index 30b8ccb20c7..5bfd7ae9392 100644 --- a/lib/commands/ACL_LOG_RESET.ts +++ b/lib/commands/ACL_LOG_RESET.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['ACL', 'LOG', 'RESET']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ACL_SAVE.ts b/lib/commands/ACL_SAVE.ts index 5b9c7b84cc3..af9abeb1d5c 100644 --- a/lib/commands/ACL_SAVE.ts +++ b/lib/commands/ACL_SAVE.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['ACL', 'SAVE']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ACL_SETUSER.ts b/lib/commands/ACL_SETUSER.ts index e55a8942e02..a590376ab84 100644 --- a/lib/commands/ACL_SETUSER.ts +++ b/lib/commands/ACL_SETUSER.ts @@ -1,8 +1,8 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyString } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export function transformArguments(username: string, rule: string | Array): TransformArgumentsReply { return pushVerdictArguments(['ACL', 'SETUSER', username], rule); } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ACL_USERS.ts b/lib/commands/ACL_USERS.ts index f9e837a4347..91f391a5b73 100644 --- a/lib/commands/ACL_USERS.ts +++ b/lib/commands/ACL_USERS.ts @@ -1,7 +1,5 @@ -import { transformReplyStringArray } from './generic-transformers'; - export function transformArguments(): Array { return ['ACL', 'USERS']; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ACL_WHOAMI.ts b/lib/commands/ACL_WHOAMI.ts index 3fc70649f87..c855eeb1aa7 100644 --- a/lib/commands/ACL_WHOAMI.ts +++ b/lib/commands/ACL_WHOAMI.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['ACL', 'WHOAMI']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/APPEND.ts b/lib/commands/APPEND.ts index f64e835113c..a162dc1381c 100644 --- a/lib/commands/APPEND.ts +++ b/lib/commands/APPEND.ts @@ -1,9 +1,7 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, value: string): Array { return ['APPEND', key, value]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ASKING.ts b/lib/commands/ASKING.ts index 3f836131ac1..8071ec20180 100644 --- a/lib/commands/ASKING.ts +++ b/lib/commands/ASKING.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['ASKING']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/AUTH.ts b/lib/commands/AUTH.ts index 750f0f54354..eb2449208a8 100644 --- a/lib/commands/AUTH.ts +++ b/lib/commands/AUTH.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export interface AuthOptions { username?: string; password: string; @@ -13,4 +11,4 @@ export function transformArguments({username, password}: AuthOptions): Array { return ['BGREWRITEAOF']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/BGSAVE.ts b/lib/commands/BGSAVE.ts index f09f906ade7..fba9e37ed76 100644 --- a/lib/commands/BGSAVE.ts +++ b/lib/commands/BGSAVE.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - interface BgSaveOptions { SCHEDULE?: true; } @@ -14,4 +12,4 @@ export function transformArguments(options?: BgSaveOptions): Array { return args; } -export const transformReply = transformReplyString; \ No newline at end of file +export declare function transformReply(): string; diff --git a/lib/commands/BITCOUNT.ts b/lib/commands/BITCOUNT.ts index 1aececc377e..320d8f3acb7 100644 --- a/lib/commands/BITCOUNT.ts +++ b/lib/commands/BITCOUNT.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -22,4 +20,4 @@ export function transformArguments(key: string, range?: BitCountRange): Array; diff --git a/lib/commands/BITOP.ts b/lib/commands/BITOP.ts index bb965da6dfa..1a750f811ca 100644 --- a/lib/commands/BITOP.ts +++ b/lib/commands/BITOP.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -9,4 +9,4 @@ export function transformArguments(operation: BitOperations, destKey: string, ke return pushVerdictArguments(['BITOP', operation, destKey], key); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/BITPOS.ts b/lib/commands/BITPOS.ts index bebc45b03c3..86f539f2dda 100644 --- a/lib/commands/BITPOS.ts +++ b/lib/commands/BITPOS.ts @@ -1,4 +1,4 @@ -import { BitValue, transformReplyNumber } from './generic-transformers'; +import { BitValue } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -18,4 +18,4 @@ export function transformArguments(key: string, bit: BitValue, start?: number, e return args; } -export const transformReply = transformReplyNumber; \ No newline at end of file +export declare function transformReply(): number; diff --git a/lib/commands/BLMOVE.ts b/lib/commands/BLMOVE.ts index 74a2eed4aa5..461a146e7a3 100644 --- a/lib/commands/BLMOVE.ts +++ b/lib/commands/BLMOVE.ts @@ -1,4 +1,3 @@ -import { transformReplyStringNull } from './generic-transformers'; import { LMoveSide } from './LMOVE'; export const FIRST_KEY_INDEX = 1; @@ -20,4 +19,4 @@ export function transformArguments( ]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/BRPOPLPUSH.ts b/lib/commands/BRPOPLPUSH.ts index f6a3bc1b8a6..3f6aed35be1 100644 --- a/lib/commands/BRPOPLPUSH.ts +++ b/lib/commands/BRPOPLPUSH.ts @@ -1,9 +1,7 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(source: string, destination: string, timeout: number): Array { return ['BRPOPLPUSH', source, destination, timeout.toString()]; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/CLIENT_ID.ts b/lib/commands/CLIENT_ID.ts index baeab148eba..a57e392ade6 100644 --- a/lib/commands/CLIENT_ID.ts +++ b/lib/commands/CLIENT_ID.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(): Array { return ['CLIENT', 'ID']; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/CLUSTER_ADDSLOTS.ts b/lib/commands/CLUSTER_ADDSLOTS.ts index 594eae77c75..e458b8aab91 100644 --- a/lib/commands/CLUSTER_ADDSLOTS.ts +++ b/lib/commands/CLUSTER_ADDSLOTS.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(slots: number | Array): Array { const args = ['CLUSTER', 'ADDSLOTS']; @@ -12,4 +10,4 @@ export function transformArguments(slots: number | Array): Array return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CLUSTER_FLUSHSLOTS.ts b/lib/commands/CLUSTER_FLUSHSLOTS.ts index 28fbcc1fab1..285c9fd26fe 100644 --- a/lib/commands/CLUSTER_FLUSHSLOTS.ts +++ b/lib/commands/CLUSTER_FLUSHSLOTS.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['CLUSTER', 'FLUSHSLOTS']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CLUSTER_GETKEYSINSLOT.ts b/lib/commands/CLUSTER_GETKEYSINSLOT.ts index c5719848cf5..67c5cbafb77 100644 --- a/lib/commands/CLUSTER_GETKEYSINSLOT.ts +++ b/lib/commands/CLUSTER_GETKEYSINSLOT.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(slot: number, count: number): Array { return ['CLUSTER', 'GETKEYSINSLOT', slot.toString(), count.toString()]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CLUSTER_MEET.ts b/lib/commands/CLUSTER_MEET.ts index 19da150356c..54a0bf708a8 100644 --- a/lib/commands/CLUSTER_MEET.ts +++ b/lib/commands/CLUSTER_MEET.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(ip: string, port: number): Array { return ['CLUSTER', 'MEET', ip, port.toString()]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CLUSTER_RESET.ts b/lib/commands/CLUSTER_RESET.ts index ec27b45eeb7..3e7c5bb52fb 100644 --- a/lib/commands/CLUSTER_RESET.ts +++ b/lib/commands/CLUSTER_RESET.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export type ClusterResetModes = 'HARD' | 'SOFT'; export function transformArguments(mode?: ClusterResetModes): Array { @@ -12,4 +10,4 @@ export function transformArguments(mode?: ClusterResetModes): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CLUSTER_SETSLOT.ts b/lib/commands/CLUSTER_SETSLOT.ts index c665b349622..591b5fb9632 100644 --- a/lib/commands/CLUSTER_SETSLOT.ts +++ b/lib/commands/CLUSTER_SETSLOT.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export enum ClusterSlotStates { IMPORTING = 'IMPORTING', MIGRATING = 'MIGRATING', @@ -17,4 +15,4 @@ export function transformArguments(slot: number, state: ClusterSlotStates, nodeI return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CONFIG_RESETSTAT.ts b/lib/commands/CONFIG_RESETSTAT.ts index 3c87b08d88b..aba54bc3c7b 100644 --- a/lib/commands/CONFIG_RESETSTAT.ts +++ b/lib/commands/CONFIG_RESETSTAT.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['CONFIG', 'RESETSTAT']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CONFIG_REWRITE.ts b/lib/commands/CONFIG_REWRITE.ts index 06247517128..67984adf300 100644 --- a/lib/commands/CONFIG_REWRITE.ts +++ b/lib/commands/CONFIG_REWRITE.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['CONFIG', 'REWRITE']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/CONFIG_SET.ts b/lib/commands/CONFIG_SET.ts index 894a95cb1cc..ec09e4469fa 100644 --- a/lib/commands/CONFIG_SET.ts +++ b/lib/commands/CONFIG_SET.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(parameter: string, value: string): Array { return ['CONFIG', 'SET', parameter, value]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/DBSIZE.ts b/lib/commands/DBSIZE.ts index 72933930f70..6b442ec33a2 100644 --- a/lib/commands/DBSIZE.ts +++ b/lib/commands/DBSIZE.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(): Array { return ['DBSIZE']; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/DECR.ts b/lib/commands/DECR.ts index cac6e07f053..e30d2aaf29c 100644 --- a/lib/commands/DECR.ts +++ b/lib/commands/DECR.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['DECR', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/DECRBY.ts b/lib/commands/DECRBY.ts index cc163cbe824..561eb9491c4 100644 --- a/lib/commands/DECRBY.ts +++ b/lib/commands/DECRBY.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, decrement: number): Array { return ['DECRBY', key, decrement.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/DEL.ts b/lib/commands/DEL.ts index f96b6988f1c..b815258df1b 100644 --- a/lib/commands/DEL.ts +++ b/lib/commands/DEL.ts @@ -1,8 +1,8 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export function transformArguments(keys: string | Array): TransformArgumentsReply { return pushVerdictArguments(['DEL'], keys); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/DISCARD.ts b/lib/commands/DISCARD.ts index b5aaf45cc8d..444f800db80 100644 --- a/lib/commands/DISCARD.ts +++ b/lib/commands/DISCARD.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['DISCARD']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/DUMP.ts b/lib/commands/DUMP.ts index 1c72110f21f..de85b889bb9 100644 --- a/lib/commands/DUMP.ts +++ b/lib/commands/DUMP.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(key: string): Array { return ['DUMP', key]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/ECHO.ts b/lib/commands/ECHO.ts index 007b8f27646..75a91d4ac91 100644 --- a/lib/commands/ECHO.ts +++ b/lib/commands/ECHO.ts @@ -1,9 +1,7 @@ -import { transformReplyString } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(message: string): Array { return ['ECHO', message]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/FAILOVER.ts b/lib/commands/FAILOVER.ts index 11ccb32a5cf..c31dbc063de 100644 --- a/lib/commands/FAILOVER.ts +++ b/lib/commands/FAILOVER.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - interface FailoverOptions { TO?: { host: string; @@ -32,4 +30,4 @@ export function transformArguments(options?: FailoverOptions): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/FLUSHALL.ts b/lib/commands/FLUSHALL.ts index 4be3474f7e2..967096bb9bd 100644 --- a/lib/commands/FLUSHALL.ts +++ b/lib/commands/FLUSHALL.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export enum RedisFlushModes { ASYNC = 'ASYNC', SYNC = 'SYNC' @@ -15,4 +13,4 @@ export function transformArguments(mode?: RedisFlushModes): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/FLUSHDB.ts b/lib/commands/FLUSHDB.ts index a85c0933c4c..5b8060df9eb 100644 --- a/lib/commands/FLUSHDB.ts +++ b/lib/commands/FLUSHDB.ts @@ -1,5 +1,4 @@ import { RedisFlushModes } from './FLUSHALL'; -import { transformReplyString } from './generic-transformers'; export function transformArguments(mode?: RedisFlushModes): Array { const args = ['FLUSHDB']; @@ -11,4 +10,4 @@ export function transformArguments(mode?: RedisFlushModes): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/GEOADD.ts b/lib/commands/GEOADD.ts index 1236563d541..7f5ac5533e3 100644 --- a/lib/commands/GEOADD.ts +++ b/lib/commands/GEOADD.ts @@ -1,4 +1,4 @@ -import { GeoCoordinates, transformReplyNumber } from './generic-transformers'; +import { GeoCoordinates } from './generic-transformers'; interface GeoMember extends GeoCoordinates { member: string; @@ -46,4 +46,4 @@ export function transformArguments(key: string, toAdd: GeoMember | Array): return pushVerdictArguments(['GEOHASH', key], member); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/GEOSEARCH.ts b/lib/commands/GEOSEARCH.ts index 3872f11c6cb..5453a2ae1b1 100644 --- a/lib/commands/GEOSEARCH.ts +++ b/lib/commands/GEOSEARCH.ts @@ -1,4 +1,4 @@ -import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments, transformReplyStringArray } from './generic-transformers'; +import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -13,4 +13,4 @@ export function transformArguments( return pushGeoSearchArguments(['GEOSEARCH'], key, from, by, options); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/GET.ts b/lib/commands/GET.ts index 541790e54e4..dbd303d1c65 100644 --- a/lib/commands/GET.ts +++ b/lib/commands/GET.ts @@ -1,5 +1,4 @@ import { TransformArgumentsReply } from '.'; -import { transformReplyStringNull } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -9,4 +8,4 @@ export function transformArguments(key: string | Buffer): TransformArgumentsRepl return ['GET', key]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/GETBIT.ts b/lib/commands/GETBIT.ts index c7e878f75a8..1e5fd884251 100644 --- a/lib/commands/GETBIT.ts +++ b/lib/commands/GETBIT.ts @@ -1,4 +1,4 @@ -import { transformReplyBit } from './generic-transformers'; +import { BitValue } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -8,4 +8,4 @@ export function transformArguments(key: string, offset: number): Array { return ['GETBIT', key, offset.toString()]; } -export const transformReply = transformReplyBit; +export declare function transformReply(): BitValue; diff --git a/lib/commands/GETDEL.ts b/lib/commands/GETDEL.ts index 218e057637d..de99cc6357b 100644 --- a/lib/commands/GETDEL.ts +++ b/lib/commands/GETDEL.ts @@ -1,9 +1,7 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['GETDEL', key]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/GETEX.ts b/lib/commands/GETEX.ts index 214dae5c7ab..2c6a4f243f6 100644 --- a/lib/commands/GETEX.ts +++ b/lib/commands/GETEX.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { transformEXAT, transformPXAT, transformReplyStringNull } from './generic-transformers'; +import { transformEXAT, transformPXAT } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -33,4 +33,4 @@ export function transformArguments(key: string, mode: GetExModes): TransformArgu return args; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/GETRANGE.ts b/lib/commands/GETRANGE.ts index 9488dd53d5e..babb0a6a7c2 100644 --- a/lib/commands/GETRANGE.ts +++ b/lib/commands/GETRANGE.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string, start: number, end: number): Arr return ['GETRANGE', key, start.toString(), end.toString()]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/GETSET.ts b/lib/commands/GETSET.ts index 1b9b9d6bc75..4d3516866fb 100644 --- a/lib/commands/GETSET.ts +++ b/lib/commands/GETSET.ts @@ -1,9 +1,7 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, value: string): Array { return ['GETSET', key, value]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/GET_BUFFER.ts b/lib/commands/GET_BUFFER.ts index 9d281961130..2f08ecb708a 100644 --- a/lib/commands/GET_BUFFER.ts +++ b/lib/commands/GET_BUFFER.ts @@ -1,7 +1,5 @@ -import { transformReplyBufferNull } from './generic-transformers'; - export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './GET'; export const BUFFER_MODE = true; -export const transformReply = transformReplyBufferNull; +export declare function transformReply(): Buffer | null; diff --git a/lib/commands/HDEL.ts b/lib/commands/HDEL.ts index 4785b0e67f9..75130c87239 100644 --- a/lib/commands/HDEL.ts +++ b/lib/commands/HDEL.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, field: string | Array): return pushVerdictArguments(['HDEL', key], field); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/HINCRBY.ts b/lib/commands/HINCRBY.ts index 192dac456e1..8f0e99d41f4 100644 --- a/lib/commands/HINCRBY.ts +++ b/lib/commands/HINCRBY.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, field: string, increment: number): Array { return ['HINCRBY', key, field, increment.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/HINCRBYFLOAT.ts b/lib/commands/HINCRBYFLOAT.ts index 10c949b8d93..262a7d5d6b0 100644 --- a/lib/commands/HINCRBYFLOAT.ts +++ b/lib/commands/HINCRBYFLOAT.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, field: string, increment: number): Array { return ['HINCRBYFLOAT', key, field, increment.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/HKEYS.ts b/lib/commands/HKEYS.ts index d79d2c1d134..358f08fc762 100644 --- a/lib/commands/HKEYS.ts +++ b/lib/commands/HKEYS.ts @@ -1,9 +1,7 @@ -import { transformReplyStringArray } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['HKEYS', key]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/HLEN.ts b/lib/commands/HLEN.ts index ba7ccc3aed9..5c717ad7c54 100644 --- a/lib/commands/HLEN.ts +++ b/lib/commands/HLEN.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['HLEN', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/HMGET.ts b/lib/commands/HMGET.ts index 9f26eeba640..420102d2b27 100644 --- a/lib/commands/HMGET.ts +++ b/lib/commands/HMGET.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -9,4 +9,4 @@ export function transformArguments(key: string, fields: string | Array): return pushVerdictArguments(['HMGET', key], fields); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/HRANDFIELD.ts b/lib/commands/HRANDFIELD.ts index e0c6ee392d5..24ca9b83d56 100644 --- a/lib/commands/HRANDFIELD.ts +++ b/lib/commands/HRANDFIELD.ts @@ -1,9 +1,7 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['HRANDFIELD', key]; } -export const transformReply = transformReplyStringNull; \ No newline at end of file +export declare function transformReply(): string | null; diff --git a/lib/commands/HRANDFIELD_COUNT.ts b/lib/commands/HRANDFIELD_COUNT.ts index d615b86ee8b..c0a8b1d449f 100644 --- a/lib/commands/HRANDFIELD_COUNT.ts +++ b/lib/commands/HRANDFIELD_COUNT.ts @@ -1,4 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; import { transformArguments as transformHRandFieldArguments } from './HRANDFIELD'; export { FIRST_KEY_INDEX } from './HRANDFIELD'; @@ -10,4 +9,4 @@ export function transformArguments(key: string, count: number): Array { ]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/HSET.ts b/lib/commands/HSET.ts index cbd46061ad8..1aecd50c0d0 100644 --- a/lib/commands/HSET.ts +++ b/lib/commands/HSET.ts @@ -1,5 +1,4 @@ import { TransformArgumentsReply } from '.'; -import { transformReplyString } from './generic-transformers'; type HSETObject = Record; @@ -47,4 +46,4 @@ function pushObject(args: Array, object: HSETObject): void { } } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/HSTRLEN.ts b/lib/commands/HSTRLEN.ts index 4181cde8517..d0138eb3ec9 100644 --- a/lib/commands/HSTRLEN.ts +++ b/lib/commands/HSTRLEN.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, field: string): Array { return ['HSTRLEN', key, field]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/HVALS.ts b/lib/commands/HVALS.ts index 7f924623cf3..cb17fdb29be 100644 --- a/lib/commands/HVALS.ts +++ b/lib/commands/HVALS.ts @@ -1,9 +1,7 @@ -import { transformReplyStringArray } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['HVALS', key]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/INCR.ts b/lib/commands/INCR.ts index 00747f0f7e2..f7b81013258 100644 --- a/lib/commands/INCR.ts +++ b/lib/commands/INCR.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['INCR', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/INCRBY.ts b/lib/commands/INCRBY.ts index 8fd31d03380..8f2a4406bf9 100644 --- a/lib/commands/INCRBY.ts +++ b/lib/commands/INCRBY.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, increment: number): Array { return ['INCRBY', key, increment.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/INCRBYFLOAT.ts b/lib/commands/INCRBYFLOAT.ts index 38912cbdc94..a5f99820cb3 100644 --- a/lib/commands/INCRBYFLOAT.ts +++ b/lib/commands/INCRBYFLOAT.ts @@ -1,9 +1,7 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, increment: number): Array { return ['INCRBYFLOAT', key, increment.toString()]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/INFO.ts b/lib/commands/INFO.ts index 437b5e5b83b..8ab24221b26 100644 --- a/lib/commands/INFO.ts +++ b/lib/commands/INFO.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(section?: string): Array { @@ -12,4 +10,4 @@ export function transformArguments(section?: string): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/LINDEX.ts b/lib/commands/LINDEX.ts index 0237a4705b1..9a89b41da55 100644 --- a/lib/commands/LINDEX.ts +++ b/lib/commands/LINDEX.ts @@ -1,5 +1,3 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string, element: string): Array return ['LINDEX', key, element]; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/LINSERT.ts b/lib/commands/LINSERT.ts index 40bd4e3d4df..b1d377f92aa 100644 --- a/lib/commands/LINSERT.ts +++ b/lib/commands/LINSERT.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; type LInsertPosition = 'BEFORE' | 'AFTER'; @@ -19,4 +17,4 @@ export function transformArguments( ]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/LLEN.ts b/lib/commands/LLEN.ts index 61aae604c97..49ac1d1916c 100644 --- a/lib/commands/LLEN.ts +++ b/lib/commands/LLEN.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['LLEN', key]; } -export const transformReply = transformReplyNumber; \ No newline at end of file +export declare function transformReply(): number; diff --git a/lib/commands/LMOVE.ts b/lib/commands/LMOVE.ts index 1e99297d812..111e758a0a4 100644 --- a/lib/commands/LMOVE.ts +++ b/lib/commands/LMOVE.ts @@ -1,5 +1,3 @@ -import { transformReplyStringNull } from './generic-transformers'; - export type LMoveSide = 'LEFT' | 'RIGHT'; export const FIRST_KEY_INDEX = 1; @@ -19,4 +17,4 @@ export function transformArguments( ]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/LOLWUT.ts b/lib/commands/LOLWUT.ts index f0cd20d4471..cfe01adbcf2 100644 --- a/lib/commands/LOLWUT.ts +++ b/lib/commands/LOLWUT.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(version?: number, ...optionalArguments: Array): Array { @@ -16,4 +14,4 @@ export function transformArguments(version?: number, ...optionalArguments: Array return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/LPOP.ts b/lib/commands/LPOP.ts index 30595a5491a..9bf340e07c9 100644 --- a/lib/commands/LPOP.ts +++ b/lib/commands/LPOP.ts @@ -1,9 +1,7 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['LPOP', key]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/LPOP_COUNT.ts b/lib/commands/LPOP_COUNT.ts index 432d2c47c09..828b0251ff6 100644 --- a/lib/commands/LPOP_COUNT.ts +++ b/lib/commands/LPOP_COUNT.ts @@ -1,9 +1,7 @@ -import { transformReplyStringArrayNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, count: number): Array { return ['LPOP', key, count.toString()]; } -export const transformReply = transformReplyStringArrayNull; +export declare function transformReply(): Array | null; diff --git a/lib/commands/LPOS.ts b/lib/commands/LPOS.ts index fc160dbcbb8..3371f01d67e 100644 --- a/lib/commands/LPOS.ts +++ b/lib/commands/LPOS.ts @@ -1,5 +1,3 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -23,4 +21,4 @@ export function transformArguments(key: string, element: string, options?: LPosO return args; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/LPOS_COUNT.ts b/lib/commands/LPOS_COUNT.ts index 2a1d3068583..b5a60317eae 100644 --- a/lib/commands/LPOS_COUNT.ts +++ b/lib/commands/LPOS_COUNT.ts @@ -1,4 +1,3 @@ -import { transformReplyNumberArray } from './generic-transformers'; import { LPosOptions } from './LPOS'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './LPOS'; @@ -19,4 +18,4 @@ export function transformArguments(key: string, element: string, count: number, return args; } -export const transformReply = transformReplyNumberArray; +export declare function transformReply(): Array; diff --git a/lib/commands/LPUSH.ts b/lib/commands/LPUSH.ts index 7416d4946ea..349affb5e09 100644 --- a/lib/commands/LPUSH.ts +++ b/lib/commands/LPUSH.ts @@ -1,9 +1,9 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, elements: string | Array): TransformArgumentsReply { return pushVerdictArguments(['LPUSH', key], elements);} -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/LPUSHX.ts b/lib/commands/LPUSHX.ts index f89623ace3a..23b8bd9b91b 100644 --- a/lib/commands/LPUSHX.ts +++ b/lib/commands/LPUSHX.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, element: string | Array) return pushVerdictArguments(['LPUSHX', key], element); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/LRANGE.ts b/lib/commands/LRANGE.ts index cbed9a75ded..7ea97ec4f43 100644 --- a/lib/commands/LRANGE.ts +++ b/lib/commands/LRANGE.ts @@ -1,5 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -13,4 +11,4 @@ export function transformArguments(key: string, start: number, stop: number): Ar ]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/LREM.ts b/lib/commands/LREM.ts index 5eabbc9194e..b43f8a28427 100644 --- a/lib/commands/LREM.ts +++ b/lib/commands/LREM.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, count: number, element: string): Array { @@ -11,4 +9,4 @@ export function transformArguments(key: string, count: number, element: string): ]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/LSET.ts b/lib/commands/LSET.ts index 0e910dd6a1c..1511fb9751e 100644 --- a/lib/commands/LSET.ts +++ b/lib/commands/LSET.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, index: number, element: string): Array { @@ -11,4 +9,4 @@ export function transformArguments(key: string, index: number, element: string): ]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/LTRIM.ts b/lib/commands/LTRIM.ts index 3ccfa751af6..018afd90a15 100644 --- a/lib/commands/LTRIM.ts +++ b/lib/commands/LTRIM.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, start: number, stop: number): Array { @@ -11,4 +9,4 @@ export function transformArguments(key: string, start: number, stop: number): Ar ] } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MEMORY_DOCTOR.ts b/lib/commands/MEMORY_DOCTOR.ts index 0d02bf93360..95a37246ffa 100644 --- a/lib/commands/MEMORY_DOCTOR.ts +++ b/lib/commands/MEMORY_DOCTOR.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['MEMORY', 'DOCTOR']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MEMORY_MALLOC-STATS.ts b/lib/commands/MEMORY_MALLOC-STATS.ts index 7dd997c48b1..3977e3a1de4 100644 --- a/lib/commands/MEMORY_MALLOC-STATS.ts +++ b/lib/commands/MEMORY_MALLOC-STATS.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['MEMORY', 'MALLOC-STATS']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MEMORY_PURGE.ts b/lib/commands/MEMORY_PURGE.ts index 7aaeee7e6aa..cfa38179273 100644 --- a/lib/commands/MEMORY_PURGE.ts +++ b/lib/commands/MEMORY_PURGE.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['MEMORY', 'PURGE']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MEMORY_USAGE.ts b/lib/commands/MEMORY_USAGE.ts index 0868b162268..959cdb0a0c4 100644 --- a/lib/commands/MEMORY_USAGE.ts +++ b/lib/commands/MEMORY_USAGE.ts @@ -1,5 +1,3 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -18,4 +16,4 @@ export function transformArguments(key: string, options?: MemoryUsageOptions): A return args; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/MGET.ts b/lib/commands/MGET.ts index fdf5b3dde85..6d5b9073d49 100644 --- a/lib/commands/MGET.ts +++ b/lib/commands/MGET.ts @@ -1,5 +1,3 @@ -import { transformReplyStringNullArray } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(keys: Array): Array { return ['MGET', ...keys]; } -export const transformReply = transformReplyStringNullArray; +export declare function transformReply(): Array; diff --git a/lib/commands/MIGRATE.ts b/lib/commands/MIGRATE.ts index 14dbe741be2..4d2795123a8 100644 --- a/lib/commands/MIGRATE.ts +++ b/lib/commands/MIGRATE.ts @@ -1,5 +1,4 @@ import { AuthOptions } from './AUTH'; -import { transformReplyString } from './generic-transformers'; interface MigrateOptions { COPY?: true; @@ -62,4 +61,4 @@ export function transformArguments( return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MODULE_LIST.ts b/lib/commands/MODULE_LIST.ts index 53ad14b68eb..d75b2428308 100644 --- a/lib/commands/MODULE_LIST.ts +++ b/lib/commands/MODULE_LIST.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['MODULE', 'LIST']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MODULE_LOAD.ts b/lib/commands/MODULE_LOAD.ts index cd2347af24c..b44b4b57ce6 100644 --- a/lib/commands/MODULE_LOAD.ts +++ b/lib/commands/MODULE_LOAD.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(path: string, moduleArgs?: Array): Array { const args = ['MODULE', 'LOAD', path]; @@ -10,4 +8,4 @@ export function transformArguments(path: string, moduleArgs?: Array): Ar return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MODULE_UNLOAD.ts b/lib/commands/MODULE_UNLOAD.ts index 3737784f000..d5927778fe6 100644 --- a/lib/commands/MODULE_UNLOAD.ts +++ b/lib/commands/MODULE_UNLOAD.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(name: string): Array { return ['MODULE', 'UNLOAD', name]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/MSET.ts b/lib/commands/MSET.ts index d51790caeed..d3e290df70f 100644 --- a/lib/commands/MSET.ts +++ b/lib/commands/MSET.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(toSet: Array<[string, string]> | Array | Record): Array { @@ -16,4 +14,4 @@ export function transformArguments(toSet: Array<[string, string]> | Array): TransformArgume return pushVerdictArguments(['PFCOUNT'], key); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/PFMERGE.ts b/lib/commands/PFMERGE.ts index c4ba11877f7..86bef6c4d7f 100644 --- a/lib/commands/PFMERGE.ts +++ b/lib/commands/PFMERGE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyString } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(destination: string, source: string | Array { return ['PING']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/PSETEX.ts b/lib/commands/PSETEX.ts index 101030d2e63..a0bd4f5c229 100644 --- a/lib/commands/PSETEX.ts +++ b/lib/commands/PSETEX.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, milliseconds: number, value: string): Array { @@ -11,4 +9,4 @@ export function transformArguments(key: string, milliseconds: number, value: str ]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/PTTL.ts b/lib/commands/PTTL.ts index 8356c75bbd9..c1bc18323d5 100644 --- a/lib/commands/PTTL.ts +++ b/lib/commands/PTTL.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['PTTL', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/PUBLISH.ts b/lib/commands/PUBLISH.ts index 51387a6803f..eda5234df20 100644 --- a/lib/commands/PUBLISH.ts +++ b/lib/commands/PUBLISH.ts @@ -1,7 +1,5 @@ -import { transformReplyNumber } from './generic-transformers'; - export function transformArguments(channel: string, message: string): Array { return ['PUBLISH', channel, message]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/PUBSUB_CHANNELS.ts b/lib/commands/PUBSUB_CHANNELS.ts index aa7a0749fc6..86a144ede8e 100644 --- a/lib/commands/PUBSUB_CHANNELS.ts +++ b/lib/commands/PUBSUB_CHANNELS.ts @@ -1,5 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(pattern?: string): Array { @@ -12,4 +10,4 @@ export function transformArguments(pattern?: string): Array { return args; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/PUBSUB_NUMPAT.ts b/lib/commands/PUBSUB_NUMPAT.ts index 966a8d237c7..15be6aa1b18 100644 --- a/lib/commands/PUBSUB_NUMPAT.ts +++ b/lib/commands/PUBSUB_NUMPAT.ts @@ -1,9 +1,7 @@ -import { transformReplyString } from './generic-transformers'; - export const IS_READ_ONLY = true; export function transformArguments(): Array { return ['PUBSUB', 'NUMPAT']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/READONLY.ts b/lib/commands/READONLY.ts index 00fbe4e4351..db7db881628 100644 --- a/lib/commands/READONLY.ts +++ b/lib/commands/READONLY.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['READONLY']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/READWRITE.ts b/lib/commands/READWRITE.ts index 16f95604407..60dc865e89e 100644 --- a/lib/commands/READWRITE.ts +++ b/lib/commands/READWRITE.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['READWRITE']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/RENAME.ts b/lib/commands/RENAME.ts index 0f9582677f1..f2affada60b 100644 --- a/lib/commands/RENAME.ts +++ b/lib/commands/RENAME.ts @@ -1,9 +1,7 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, newKey: string): Array { return ['RENAME', key, newKey]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/REPLICAOF.ts b/lib/commands/REPLICAOF.ts index 0b56bd74dc6..bd452e0f371 100644 --- a/lib/commands/REPLICAOF.ts +++ b/lib/commands/REPLICAOF.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(host: string, port: number): Array { return ['REPLICAOF', host, port.toString()]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/RESTORE-ASKING.ts b/lib/commands/RESTORE-ASKING.ts index 4d178cb1f0b..d53d8541cd7 100644 --- a/lib/commands/RESTORE-ASKING.ts +++ b/lib/commands/RESTORE-ASKING.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['RESTORE-ASKING']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/RPOP.ts b/lib/commands/RPOP.ts index daccbf5d42d..96735dea8b9 100644 --- a/lib/commands/RPOP.ts +++ b/lib/commands/RPOP.ts @@ -1,9 +1,7 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['RPOP', key]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/RPOPLPUSH.ts b/lib/commands/RPOPLPUSH.ts index db388906d3e..23f1ff08766 100644 --- a/lib/commands/RPOPLPUSH.ts +++ b/lib/commands/RPOPLPUSH.ts @@ -1,9 +1,7 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(source: string, destination: string): Array { return ['RPOPLPUSH', source, destination]; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/RPOP_COUNT.ts b/lib/commands/RPOP_COUNT.ts index 205704274f7..f7f3463a3ee 100644 --- a/lib/commands/RPOP_COUNT.ts +++ b/lib/commands/RPOP_COUNT.ts @@ -1,9 +1,7 @@ -import { transformReplyStringArrayNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, count: number): Array { return ['RPOP', key, count.toString()]; } -export const transformReply = transformReplyStringArrayNull; +export declare function transformReply(): Array | null; diff --git a/lib/commands/RPUSH.ts b/lib/commands/RPUSH.ts index 665094f47a5..92df52f03ff 100644 --- a/lib/commands/RPUSH.ts +++ b/lib/commands/RPUSH.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, element: string | Array) return pushVerdictArguments(['RPUSH', key], element); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/RPUSHX.ts b/lib/commands/RPUSHX.ts index fe1f969f3f6..14ad9dc9d50 100644 --- a/lib/commands/RPUSHX.ts +++ b/lib/commands/RPUSHX.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, element: string | Array) return pushVerdictArguments(['RPUSHX', key], element); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/SADD.ts b/lib/commands/SADD.ts index a432ccfef59..31623c435ce 100644 --- a/lib/commands/SADD.ts +++ b/lib/commands/SADD.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, members: string | Array) return pushVerdictArguments(['SADD', key], members); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/SAVE.ts b/lib/commands/SAVE.ts index 38a397892f8..e88575f0a5c 100644 --- a/lib/commands/SAVE.ts +++ b/lib/commands/SAVE.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['SAVE']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/SCARD.ts b/lib/commands/SCARD.ts index 8a90bd3b029..0d3ce49b6b2 100644 --- a/lib/commands/SCARD.ts +++ b/lib/commands/SCARD.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['SCARD', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/SCRIPT_DEBUG.ts b/lib/commands/SCRIPT_DEBUG.ts index e93443a5860..e9e1e909d59 100644 --- a/lib/commands/SCRIPT_DEBUG.ts +++ b/lib/commands/SCRIPT_DEBUG.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(mode: 'YES' | 'SYNC' | 'NO'): Array { return ['SCRIPT', 'DEBUG', mode]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/SCRIPT_FLUSH.ts b/lib/commands/SCRIPT_FLUSH.ts index 83bc9e2b5d8..2c220e9e3d1 100644 --- a/lib/commands/SCRIPT_FLUSH.ts +++ b/lib/commands/SCRIPT_FLUSH.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(mode?: 'ASYNC' | 'SYNC'): Array { const args = ['SCRIPT', 'FLUSH']; @@ -10,4 +8,4 @@ export function transformArguments(mode?: 'ASYNC' | 'SYNC'): Array { return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/SCRIPT_KILL.ts b/lib/commands/SCRIPT_KILL.ts index 5c175b74d6c..c0a53da8681 100644 --- a/lib/commands/SCRIPT_KILL.ts +++ b/lib/commands/SCRIPT_KILL.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['SCRIPT', 'KILL']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/SCRIPT_LOAD.ts b/lib/commands/SCRIPT_LOAD.ts index 378fbf1e76a..7cb28c1ec7f 100644 --- a/lib/commands/SCRIPT_LOAD.ts +++ b/lib/commands/SCRIPT_LOAD.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(script: string): Array { return ['SCRIPT', 'LOAD', script]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/SDIFF.ts b/lib/commands/SDIFF.ts index 4d5aaea1a06..134bd66ef85 100644 --- a/lib/commands/SDIFF.ts +++ b/lib/commands/SDIFF.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(keys: string | Array): TransformArgum return pushVerdictArguments(['SDIFF'], keys); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/SDIFFSTORE.ts b/lib/commands/SDIFFSTORE.ts index 69883d4124c..1c437087c5e 100644 --- a/lib/commands/SDIFFSTORE.ts +++ b/lib/commands/SDIFFSTORE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(destination: string, keys: string | Array { return ['SETRANGE', key, offset.toString(), value]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/SHUTDOWN.ts b/lib/commands/SHUTDOWN.ts index 0dd2cf3a5b3..1990d05a2ed 100644 --- a/lib/commands/SHUTDOWN.ts +++ b/lib/commands/SHUTDOWN.ts @@ -1,5 +1,3 @@ -import { transformReplyVoid } from './generic-transformers'; - export function transformArguments(mode?: 'NOSAVE' | 'SAVE'): Array { const args = ['SHUTDOWN']; @@ -10,4 +8,4 @@ export function transformArguments(mode?: 'NOSAVE' | 'SAVE'): Array { return args; } -export const transformReply = transformReplyVoid; +export declare function transformReply(): void; diff --git a/lib/commands/SINTER.ts b/lib/commands/SINTER.ts index 43869652370..6348bbc7ab9 100644 --- a/lib/commands/SINTER.ts +++ b/lib/commands/SINTER.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(keys: string | Array): TransformArgum return pushVerdictArguments(['SINTER'], keys); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/SINTERSTORE.ts b/lib/commands/SINTERSTORE.ts index 5ad1b11cbac..0d31c409da8 100644 --- a/lib/commands/SINTERSTORE.ts +++ b/lib/commands/SINTERSTORE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(destination: string, keys: string | Array; diff --git a/lib/commands/SMEMBERS.ts b/lib/commands/SMEMBERS.ts index d7e75daaa3e..71b479f9d8e 100644 --- a/lib/commands/SMEMBERS.ts +++ b/lib/commands/SMEMBERS.ts @@ -1,9 +1,7 @@ -import { transformReplyStringArray } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['SMEMBERS', key]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/SPOP.ts b/lib/commands/SPOP.ts index a389fed5cc5..84845230d41 100644 --- a/lib/commands/SPOP.ts +++ b/lib/commands/SPOP.ts @@ -1,5 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, count?: number): Array { @@ -12,4 +10,4 @@ export function transformArguments(key: string, count?: number): Array { return args; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/SRANDMEMBER.ts b/lib/commands/SRANDMEMBER.ts index 2e8cd539273..c477a5691d7 100644 --- a/lib/commands/SRANDMEMBER.ts +++ b/lib/commands/SRANDMEMBER.ts @@ -1,9 +1,7 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string): Array { return ['SRANDMEMBER', key]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/SRANDMEMBER_COUNT.ts b/lib/commands/SRANDMEMBER_COUNT.ts index b7fa8ebeb3a..89d9b8c4aef 100644 --- a/lib/commands/SRANDMEMBER_COUNT.ts +++ b/lib/commands/SRANDMEMBER_COUNT.ts @@ -1,4 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; import { transformArguments as transformSRandMemberArguments } from './SRANDMEMBER'; export { FIRST_KEY_INDEX } from './SRANDMEMBER'; @@ -10,4 +9,4 @@ export function transformArguments(key: string, count: number): Array { ]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/SREM.ts b/lib/commands/SREM.ts index 4ae33245d29..534de170540 100644 --- a/lib/commands/SREM.ts +++ b/lib/commands/SREM.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, members: string | Array) return pushVerdictArguments(['SREM', key], members); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/STRLEN.ts b/lib/commands/STRLEN.ts index d8112ce7d1f..208d9d73fb8 100644 --- a/lib/commands/STRLEN.ts +++ b/lib/commands/STRLEN.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['STRLEN', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/SUNION.ts b/lib/commands/SUNION.ts index 705bff29927..07a46e38efa 100644 --- a/lib/commands/SUNION.ts +++ b/lib/commands/SUNION.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -9,4 +9,4 @@ export function transformArguments(keys: string | Array): TransformArgum return pushVerdictArguments(['SUNION'], keys); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/SUNIONSTORE.ts b/lib/commands/SUNIONSTORE.ts index af717f627df..8745c516433 100644 --- a/lib/commands/SUNIONSTORE.ts +++ b/lib/commands/SUNIONSTORE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(destination: string, keys: string | Array { return ['SWAPDB', index1.toString(), index2.toString()]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/TOUCH.ts b/lib/commands/TOUCH.ts index abff4160392..8632d848dbf 100644 --- a/lib/commands/TOUCH.ts +++ b/lib/commands/TOUCH.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string | Array): TransformArgume return pushVerdictArguments(['TOUCH'], key); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/TTL.ts b/lib/commands/TTL.ts index aa8462dfea3..4ae31245aa0 100644 --- a/lib/commands/TTL.ts +++ b/lib/commands/TTL.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['TTL', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/TYPE.ts b/lib/commands/TYPE.ts index 4f27b29d2b6..283701b6e9f 100644 --- a/lib/commands/TYPE.ts +++ b/lib/commands/TYPE.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['TYPE', key]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/UNLINK.ts b/lib/commands/UNLINK.ts index 4647a976e42..2ff87974cfb 100644 --- a/lib/commands/UNLINK.ts +++ b/lib/commands/UNLINK.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string | Array): TransformArgume return pushVerdictArguments(['UNLINK'], key); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/UNWATCH.ts b/lib/commands/UNWATCH.ts index d0ede556f3a..ce42e7697bf 100644 --- a/lib/commands/UNWATCH.ts +++ b/lib/commands/UNWATCH.ts @@ -1,7 +1,5 @@ -import { transformReplyString } from './generic-transformers'; - export function transformArguments(): Array { return ['UNWATCH']; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/WAIT.ts b/lib/commands/WAIT.ts index 214fb356688..dff51ed9680 100644 --- a/lib/commands/WAIT.ts +++ b/lib/commands/WAIT.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(numberOfReplicas: number, timeout: number): Array { return ['WAIT', numberOfReplicas.toString(), timeout.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/WATCH.ts b/lib/commands/WATCH.ts index e644ab0f462..5ca42c0eb95 100644 --- a/lib/commands/WATCH.ts +++ b/lib/commands/WATCH.ts @@ -1,8 +1,8 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyString } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export function transformArguments(key: string | Array): TransformArgumentsReply { return pushVerdictArguments(['WATCH'], key); } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/XACK.ts b/lib/commands/XACK.ts index a6de28151eb..4573b7f3d25 100644 --- a/lib/commands/XACK.ts +++ b/lib/commands/XACK.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, group: string, id: string | Arra return pushVerdictArguments(['XACK', key, group], id); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/XADD.ts b/lib/commands/XADD.ts index 0500a2fde65..7bc263b2400 100644 --- a/lib/commands/XADD.ts +++ b/lib/commands/XADD.ts @@ -1,8 +1,7 @@ -import { TuplesObject, transformReplyString } from './generic-transformers'; +import { TuplesObject } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; - interface XAddOptions { NOMKSTREAM?: true; TRIM?: { @@ -45,4 +44,4 @@ export function transformArguments(key: string, id: string, message: TuplesObjec return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/XCLAIM_JUSTID.ts b/lib/commands/XCLAIM_JUSTID.ts index dcf274ed821..ab74c89420c 100644 --- a/lib/commands/XCLAIM_JUSTID.ts +++ b/lib/commands/XCLAIM_JUSTID.ts @@ -1,4 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; import { transformArguments as transformArgumentsXClaim } from './XCLAIM'; export { FIRST_KEY_INDEX } from './XCLAIM'; @@ -10,4 +9,4 @@ export function transformArguments(...args: Parameters; diff --git a/lib/commands/XDEL.ts b/lib/commands/XDEL.ts index 083ea77ef0f..187e5b4e73a 100644 --- a/lib/commands/XDEL.ts +++ b/lib/commands/XDEL.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, id: string | Array): Tra return pushVerdictArguments(['XDEL', key], id); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/XGROUP_CREATE.ts b/lib/commands/XGROUP_CREATE.ts index 167197b263c..c2d7f157615 100644 --- a/lib/commands/XGROUP_CREATE.ts +++ b/lib/commands/XGROUP_CREATE.ts @@ -1,5 +1,3 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 2; interface XGroupCreateOptions { @@ -16,4 +14,4 @@ export function transformArguments(key: string, group: string, id: string, optio return args; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/XGROUP_DELCONSUMER.ts b/lib/commands/XGROUP_DELCONSUMER.ts index 91a36f91a30..dc9de7bb577 100644 --- a/lib/commands/XGROUP_DELCONSUMER.ts +++ b/lib/commands/XGROUP_DELCONSUMER.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 2; export function transformArguments(key: string, group: string, consumer: string): Array { return ['XGROUP', 'DELCONSUMER', key, group, consumer]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/XGROUP_SETID.ts b/lib/commands/XGROUP_SETID.ts index ce4a13086d3..2d4e30d9c94 100644 --- a/lib/commands/XGROUP_SETID.ts +++ b/lib/commands/XGROUP_SETID.ts @@ -1,9 +1,7 @@ -import { transformReplyString } from './generic-transformers'; - export const FIRST_KEY_INDEX = 2; export function transformArguments(key: string, group: string, id: string): Array { return ['XGROUP', 'SETID', key, group, id]; } -export const transformReply = transformReplyString; +export declare function transformReply(): string; diff --git a/lib/commands/XLEN.ts b/lib/commands/XLEN.ts index d7ba033e612..1cadd61952b 100644 --- a/lib/commands/XLEN.ts +++ b/lib/commands/XLEN.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['XLEN', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/XTRIM.ts b/lib/commands/XTRIM.ts index 8175ba70df3..520c38847b8 100644 --- a/lib/commands/XTRIM.ts +++ b/lib/commands/XTRIM.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; interface XTrimOptions { @@ -23,4 +21,4 @@ export function transformArguments(key: string, strategy: 'MAXLEN' | 'MINID', th return args; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZCARD.ts b/lib/commands/ZCARD.ts index f6e4ea5f6cd..9c76c485bf9 100644 --- a/lib/commands/ZCARD.ts +++ b/lib/commands/ZCARD.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['ZCARD', key]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZCOUNT.ts b/lib/commands/ZCOUNT.ts index fd73c384489..a18ba0fd790 100644 --- a/lib/commands/ZCOUNT.ts +++ b/lib/commands/ZCOUNT.ts @@ -1,4 +1,4 @@ -import { transformArgumentNumberInfinity, transformReplyNumber } from './generic-transformers'; +import { transformArgumentNumberInfinity } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -13,4 +13,4 @@ export function transformArguments(key: string, min: number, max: number): Array ]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZDIFF.ts b/lib/commands/ZDIFF.ts index 7154947fea7..4c5b722131e 100644 --- a/lib/commands/ZDIFF.ts +++ b/lib/commands/ZDIFF.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArgument, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -9,4 +9,4 @@ export function transformArguments(keys: Array | string): TransformArgum return pushVerdictArgument(['ZDIFF'], keys); } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ZDIFFSTORE.ts b/lib/commands/ZDIFFSTORE.ts index f91d4c869ba..95c58c66b9e 100644 --- a/lib/commands/ZDIFFSTORE.ts +++ b/lib/commands/ZDIFFSTORE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArgument, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(destination: string, keys: Array | st return pushVerdictArgument(['ZDIFFSTORE', destination], keys); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZINTER.ts b/lib/commands/ZINTER.ts index 91d7982a8e7..ae1b27a6c8d 100644 --- a/lib/commands/ZINTER.ts +++ b/lib/commands/ZINTER.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArgument, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -27,4 +27,4 @@ export function transformArguments(keys: Array | string, options?: ZInte return args; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ZINTERSTORE.ts b/lib/commands/ZINTERSTORE.ts index 6e79e423cb0..496729a774e 100644 --- a/lib/commands/ZINTERSTORE.ts +++ b/lib/commands/ZINTERSTORE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArgument, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -25,4 +25,4 @@ export function transformArguments(destination: string, keys: Array | st return args; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZLEXCOUNT.ts b/lib/commands/ZLEXCOUNT.ts index 2ba50dda73e..2e70fdee91d 100644 --- a/lib/commands/ZLEXCOUNT.ts +++ b/lib/commands/ZLEXCOUNT.ts @@ -1,5 +1,3 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -13,4 +11,4 @@ export function transformArguments(key: string, min: string, max: string): Array ]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZRANDMEMBER.ts b/lib/commands/ZRANDMEMBER.ts index 27bb7cefa50..13bb05598b7 100644 --- a/lib/commands/ZRANDMEMBER.ts +++ b/lib/commands/ZRANDMEMBER.ts @@ -1,5 +1,3 @@ -import { transformReplyStringNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string): Array { return ['ZRANDMEMBER', key]; } -export const transformReply = transformReplyStringNull; +export declare function transformReply(): string | null; diff --git a/lib/commands/ZRANDMEMBER_COUNT.ts b/lib/commands/ZRANDMEMBER_COUNT.ts index f7eef456d05..1b7b8fea994 100644 --- a/lib/commands/ZRANDMEMBER_COUNT.ts +++ b/lib/commands/ZRANDMEMBER_COUNT.ts @@ -1,4 +1,3 @@ -import { transformReplyStringArray } from './generic-transformers'; import { transformArguments as transformZRandMemberArguments } from './ZRANDMEMBER'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZRANDMEMBER'; @@ -10,4 +9,4 @@ export function transformArguments(key: string, count: number): Array { ]; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ZRANGE.ts b/lib/commands/ZRANGE.ts index 9037210d69f..391c5ca893e 100644 --- a/lib/commands/ZRANGE.ts +++ b/lib/commands/ZRANGE.ts @@ -1,4 +1,4 @@ -import { transformArgumentNumberInfinity, transformReplyStringArray } from './generic-transformers'; +import { transformArgumentNumberInfinity } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -42,4 +42,4 @@ export function transformArguments(key: string, min: string | number, max: strin return args; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ZRANK.ts b/lib/commands/ZRANK.ts index 84f9c7d4a9e..e060ccf6f8c 100644 --- a/lib/commands/ZRANK.ts +++ b/lib/commands/ZRANK.ts @@ -1,5 +1,3 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string, member: string): Array { return ['ZRANK', key, member]; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/ZREM.ts b/lib/commands/ZREM.ts index 8419291f2fd..550a41e8b5c 100644 --- a/lib/commands/ZREM.ts +++ b/lib/commands/ZREM.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArguments, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -7,4 +7,4 @@ export function transformArguments(key: string, member: string | Array): return pushVerdictArguments(['ZREM', key], member); } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZREMRANGEBYLEX.ts b/lib/commands/ZREMRANGEBYLEX.ts index aaf92992f98..1f17d6b986e 100644 --- a/lib/commands/ZREMRANGEBYLEX.ts +++ b/lib/commands/ZREMRANGEBYLEX.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, min: string, max: string): Array { return ['ZREMRANGEBYLEX', key, min, max]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZREMRANGEBYRANK.ts b/lib/commands/ZREMRANGEBYRANK.ts index 89bf63d8e34..550a56e8a85 100644 --- a/lib/commands/ZREMRANGEBYRANK.ts +++ b/lib/commands/ZREMRANGEBYRANK.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, start: number, stop: number): Array { return ['ZREMRANGEBYRANK', key, start.toString(), stop.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZREMRANGEBYSCORE.ts b/lib/commands/ZREMRANGEBYSCORE.ts index 64d14a4eb41..e0186fcb64e 100644 --- a/lib/commands/ZREMRANGEBYSCORE.ts +++ b/lib/commands/ZREMRANGEBYSCORE.ts @@ -1,9 +1,7 @@ -import { transformReplyNumber } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export function transformArguments(key: string, min: number, max: number): Array { return ['ZREMRANGEBYSCORE', key, min.toString(), max.toString()]; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/ZREVRANK.ts b/lib/commands/ZREVRANK.ts index 7d4c4ce2ab5..808d9e45dc3 100644 --- a/lib/commands/ZREVRANK.ts +++ b/lib/commands/ZREVRANK.ts @@ -1,5 +1,3 @@ -import { transformReplyNumberNull } from './generic-transformers'; - export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; @@ -8,4 +6,4 @@ export function transformArguments(key: string, member: string): Array { return ['ZREVRANK', key, member]; } -export const transformReply = transformReplyNumberNull; +export declare function transformReply(): number | null; diff --git a/lib/commands/ZUNION.ts b/lib/commands/ZUNION.ts index 87158b8425a..1f0723eb021 100644 --- a/lib/commands/ZUNION.ts +++ b/lib/commands/ZUNION.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArgument, transformReplyStringArray } from './generic-transformers'; +import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -24,4 +24,4 @@ export function transformArguments(keys: Array | string, options?: ZUnio return args; } -export const transformReply = transformReplyStringArray; +export declare function transformReply(): Array; diff --git a/lib/commands/ZUNIONSTORE.ts b/lib/commands/ZUNIONSTORE.ts index 4ebbdbd8591..d0a92b20a60 100644 --- a/lib/commands/ZUNIONSTORE.ts +++ b/lib/commands/ZUNIONSTORE.ts @@ -1,5 +1,5 @@ import { TransformArgumentsReply } from '.'; -import { pushVerdictArgument, transformReplyNumber } from './generic-transformers'; +import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -22,4 +22,4 @@ export function transformArguments(destination: string, keys: Array | st return args; } -export const transformReply = transformReplyNumber; +export declare function transformReply(): number; diff --git a/lib/commands/generic-transformers.ts b/lib/commands/generic-transformers.ts index bbc12ee113e..87325e61d72 100644 --- a/lib/commands/generic-transformers.ts +++ b/lib/commands/generic-transformers.ts @@ -1,41 +1,5 @@ import { TransformArgumentsReply } from '.'; -export function transformReplyNumber(reply: number): number { - return reply; -} - -export function transformReplyNumberNull(reply: number | null): number | null { - return reply; -} - -export function transformReplyNumberArray(reply: Array): Array { - return reply; -} - -export function transformReplyNumberNullArray(reply: Array): Array { - return reply; -} - -export function transformReplyString(reply: string): string { - return reply; -} - -export function transformReplyStringNull(reply: string | null): string | null { - return reply; -} - -export function transformReplyStringArray(reply: Array): Array { - return reply; -} - -export function transformReplyStringArrayNull(reply: Array | null): Array | null { - return reply; -} - -export function transformReplyStringNullArray(reply: Array): Array { - return reply; -} - export function transformReplyBoolean(reply: number): boolean { return reply === 1; } @@ -46,16 +10,6 @@ export function transformReplyBooleanArray(reply: Array): Array export type BitValue = 0 | 1; -export function transformReplyBit(reply: BitValue): BitValue { - return reply; -} - -export function transformReplyBufferNull(reply: Buffer | null): Buffer | null { - return reply; -} - -export function transformReplyVoid(): void {} - export interface ScanOptions { MATCH?: string; COUNT?: number; diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 89581090e58..192968cb2ae 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -748,9 +748,11 @@ export interface RedisCommand { IS_READ_ONLY?: boolean; transformArguments(this: void, ...args: Array): TransformArgumentsReply; BUFFER_MODE?: boolean; - transformReply(this: void, reply: RedisReply, preserved?: unknown): any; + transformReply?(this: void, reply: RedisReply, preserved?: unknown): any; } +export type RedisCommandReply = C['transformReply'] extends (...args: any) => infer T ? T : RedisReply; + export interface RedisCommands { [command: string]: RedisCommand; } diff --git a/package-lock.json b/package-lock.json index 9fcd62b5996..e4625a07401 100644 --- a/package-lock.json +++ b/package-lock.json @@ -653,18 +653,18 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.0.0.tgz", - "integrity": "sha512-k1iO2zKuEjjRS1EJb4FwSLk+iF6EGp+ZV0OMRViQoWhQ1fZTk9hg1xccZII5uyYoiqcbC73MRBmT45y1vp2PPg==", + "version": "10.6.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.6.1.tgz", + "integrity": "sha512-53YKy8w8+sHQhUONhTiYt6MqNqPolejYr6rK/3VOevpORAIYGQEX2pmXnnhgdSsjHy176e5ZBgVt0ppOGziS7g==", "dev": true }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz", - "integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==", + "version": "2.16.5", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.5.tgz", + "integrity": "sha512-2PfRGymdBypqRes4Xelu0BAZZRCV/Qg0xgo8UB10UKoghCM+zg640+T5WkRsRD0edwfLBPP3VsJgDyDTG4EIYg==", "dev": true, "dependencies": { - "@octokit/types": "^6.26.0" + "@octokit/types": "^6.31.0" }, "peerDependencies": { "@octokit/core": ">=2" @@ -680,12 +680,12 @@ } }, "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "5.10.4", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.10.4.tgz", - "integrity": "sha512-Dh+EAMCYR9RUHwQChH94Skl0lM8Fh99auT8ggck/xTzjJrwVzvsd0YH68oRPqp/HxICzmUjLfaQ9sy1o1sfIiA==", + "version": "5.11.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.11.3.tgz", + "integrity": "sha512-E19gqHqfP3uJa2/hx6Abhx2NrVP5tsNbst2/AeqGxlGM+eL4N8fRbzhd+NEIsGAB4y3R7e9kVE0y8OOghlXUXw==", "dev": true, "dependencies": { - "@octokit/types": "^6.28.1", + "@octokit/types": "^6.31.1", "deprecation": "^2.3.1" }, "peerDependencies": { @@ -730,12 +730,12 @@ } }, "node_modules/@octokit/types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.26.0.tgz", - "integrity": "sha512-RDxZBAFMtqs1ZPnbUu1e7ohPNfoNhTiep4fErY7tZs995BeHu369Vsh5woMIaFbllRWEZBfvTCS4hvDnMPiHrA==", + "version": "6.31.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.31.1.tgz", + "integrity": "sha512-xkF46eaYcpT8ieO78mZWhMq3bt37zIsP5BUkN+zWgX+mTYDB7jOtUP1MOxcSF8hhJhsjjlB1YDgQAhX0z0oqPw==", "dev": true, "dependencies": { - "@octokit/openapi-types": "^10.0.0" + "@octokit/openapi-types": "^10.6.1" } }, "node_modules/@sindresorhus/is": { @@ -855,9 +855,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.7.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", - "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==", + "version": "16.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz", + "integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==", "dev": true }, "node_modules/@types/parse-json": { @@ -876,9 +876,9 @@ } }, "node_modules/@types/sinon": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.3.tgz", - "integrity": "sha512-XUaFuUOQ3A/r6gS1qCU/USMleascaqGeQpGR1AZ5JdRtBPlzijRzKsik1TuGzvdtPA0mdq42JqaJmJ+Afg1LJg==", + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.4.tgz", + "integrity": "sha512-fOYjrxQv8zJsqOY6V6ecP4eZhQBxtY80X0er1VVnUIAIZo74jHm8e1vguG5Yt4Iv8W2Wr7TgibB8MfRe32k9pA==", "dev": true, "dependencies": { "@sinonjs/fake-timers": "^7.1.0" @@ -937,62 +937,12 @@ } }, "node_modules/ansi-align": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", - "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", - "dev": true, - "dependencies": { - "string-width": "^3.0.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "node_modules/ansi-align/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", "dev": true, "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" + "string-width": "^4.1.0" } }, "node_modules/ansi-colors": { @@ -1249,16 +1199,16 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.0.tgz", - "integrity": "sha512-g2BJ2a0nEYvEFQC208q8mVAhfNwpZ5Mu8BwgtCdZKO3qx98HChmeg448fPdUzld8aFmfLgVh7yymqV+q1lJZ5g==", + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.1.tgz", + "integrity": "sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ==", "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001254", - "colorette": "^1.3.0", - "electron-to-chromium": "^1.3.830", + "caniuse-lite": "^1.0.30001259", + "electron-to-chromium": "^1.3.846", "escalade": "^3.1.1", - "node-releases": "^1.1.75" + "nanocolors": "^0.1.5", + "node-releases": "^1.1.76" }, "bin": { "browserslist": "cli.js" @@ -1390,9 +1340,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001259", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz", - "integrity": "sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg==", + "version": "1.0.30001261", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001261.tgz", + "integrity": "sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA==", "dev": true, "funding": { "type": "opencollective", @@ -1569,12 +1519,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", - "dev": true - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1671,9 +1615,9 @@ } }, "node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1845,9 +1789,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.827", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", - "integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==", + "version": "1.3.853", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.853.tgz", + "integrity": "sha512-W4U8n+U8I5/SUaFcqZgbKRmYZwcyEIQVBDf+j5QQK6xChjXnQD+wj248eGR9X4u+dDmDR//8vIfbu4PrdBBIoQ==", "dev": true }, "node_modules/emoji-regex": { @@ -2679,9 +2623,9 @@ } }, "node_modules/is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", - "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.7.0.tgz", + "integrity": "sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -2724,9 +2668,9 @@ } }, "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "dependencies": { "is-extglob": "^2.1.1" @@ -2896,9 +2840,9 @@ "dev": true }, "node_modules/istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.1.tgz", + "integrity": "sha512-GvCYYTxaCPqwMjobtVcVKvSHtAGe48MNhGjpK8LtVF8K0ISX7hCKl85LgtuaSneWVyQmaGcW3iXVV3GaZSLpmQ==", "dev": true, "engines": { "node": ">=8" @@ -3317,16 +3261,16 @@ "dev": true }, "node_modules/mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-0wE74YMgOkCgBUj8VyIDwmLUjTsS13WV1Pg7l0SHea2qzZzlq7MDnfbPsHKcELBRk3+izEVkRofjmClpycudCA==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.2.tgz", + "integrity": "sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w==", "dev": true, "dependencies": { "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", "chokidar": "3.5.2", - "debug": "4.3.1", + "debug": "4.3.2", "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", @@ -3337,12 +3281,11 @@ "log-symbols": "4.1.0", "minimatch": "3.0.4", "ms": "2.1.3", - "nanoid": "3.1.23", + "nanoid": "3.1.25", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", "which": "2.0.2", - "wide-align": "1.1.3", "workerpool": "6.1.5", "yargs": "16.2.0", "yargs-parser": "20.2.4", @@ -3372,10 +3315,16 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node_modules/nanocolors": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.1.12.tgz", + "integrity": "sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==", + "dev": true + }, "node_modules/nanoid": { - "version": "3.1.23", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", - "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" @@ -3425,9 +3374,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.4.tgz", - "integrity": "sha512-aD1fO+xtLiSCc9vuD+sYMxpIuQyhHscGSkBEo2o5LTV/3bTEAYvdUii29n8LlO5uLCmWdGP7uVUVXFo5SRdkLA==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -4475,23 +4424,6 @@ "node": ">=10" } }, - "node_modules/release-it/node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, "node_modules/release-it/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4504,12 +4436,6 @@ "node": ">=10" } }, - "node_modules/release-it/node_modules/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 - }, "node_modules/release-it/node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -4782,9 +4708,9 @@ } }, "node_modules/shiki": { - "version": "0.9.10", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", - "integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.11.tgz", + "integrity": "sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==", "dev": true, "dependencies": { "jsonc-parser": "^3.0.0", @@ -4807,9 +4733,9 @@ } }, "node_modules/signal-exit": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.4.tgz", - "integrity": "sha512-rqYhcAnZ6d/vTPGghdrw7iumdcbXpsk1b8IG/rz+VWV51DM0p7XCtMoJ3qhPLIbp3tvyt3pKRbaaEMZYpHto8Q==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", + "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", "dev": true }, "node_modules/sinon": { @@ -4950,26 +4876,26 @@ ] }, "node_modules/string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, "node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "dependencies": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" @@ -5433,58 +5359,6 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "node_modules/wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/wide-align/node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/wide-align/node_modules/strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -6206,18 +6080,18 @@ } }, "@octokit/openapi-types": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.0.0.tgz", - "integrity": "sha512-k1iO2zKuEjjRS1EJb4FwSLk+iF6EGp+ZV0OMRViQoWhQ1fZTk9hg1xccZII5uyYoiqcbC73MRBmT45y1vp2PPg==", + "version": "10.6.1", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.6.1.tgz", + "integrity": "sha512-53YKy8w8+sHQhUONhTiYt6MqNqPolejYr6rK/3VOevpORAIYGQEX2pmXnnhgdSsjHy176e5ZBgVt0ppOGziS7g==", "dev": true }, "@octokit/plugin-paginate-rest": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.0.tgz", - "integrity": "sha512-8YYzALPMvEZ35kgy5pdYvQ22Roz+BIuEaedO575GwE2vb/ACDqQn0xQrTJR4tnZCJn7pi8+AWPVjrFDaERIyXQ==", + "version": "2.16.5", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.5.tgz", + "integrity": "sha512-2PfRGymdBypqRes4Xelu0BAZZRCV/Qg0xgo8UB10UKoghCM+zg640+T5WkRsRD0edwfLBPP3VsJgDyDTG4EIYg==", "dev": true, "requires": { - "@octokit/types": "^6.26.0" + "@octokit/types": "^6.31.0" } }, "@octokit/plugin-request-log": { @@ -6228,12 +6102,12 @@ "requires": {} }, "@octokit/plugin-rest-endpoint-methods": { - "version": "5.10.4", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.10.4.tgz", - "integrity": "sha512-Dh+EAMCYR9RUHwQChH94Skl0lM8Fh99auT8ggck/xTzjJrwVzvsd0YH68oRPqp/HxICzmUjLfaQ9sy1o1sfIiA==", + "version": "5.11.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.11.3.tgz", + "integrity": "sha512-E19gqHqfP3uJa2/hx6Abhx2NrVP5tsNbst2/AeqGxlGM+eL4N8fRbzhd+NEIsGAB4y3R7e9kVE0y8OOghlXUXw==", "dev": true, "requires": { - "@octokit/types": "^6.28.1", + "@octokit/types": "^6.31.1", "deprecation": "^2.3.1" } }, @@ -6275,12 +6149,12 @@ } }, "@octokit/types": { - "version": "6.28.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.28.1.tgz", - "integrity": "sha512-XlxDoQLFO5JnFZgKVQTYTvXRsQFfr/GwDUU108NJ9R5yFPkA2qXhTJjYuul3vE4eLXP40FA2nysOu2zd6boE+w==", + "version": "6.31.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.31.1.tgz", + "integrity": "sha512-xkF46eaYcpT8ieO78mZWhMq3bt37zIsP5BUkN+zWgX+mTYDB7jOtUP1MOxcSF8hhJhsjjlB1YDgQAhX0z0oqPw==", "dev": true, "requires": { - "@octokit/openapi-types": "^10.2.2" + "@octokit/openapi-types": "^10.6.1" } }, "@sindresorhus/is": { @@ -6391,9 +6265,9 @@ "dev": true }, "@types/node": { - "version": "16.9.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.6.tgz", - "integrity": "sha512-YHUZhBOMTM3mjFkXVcK+WwAcYmyhe1wL4lfqNtzI0b3qAy7yuSetnM7QJazgE5PFmgVTNGiLOgRFfJMqW7XpSQ==", + "version": "16.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz", + "integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==", "dev": true }, "@types/parse-json": { @@ -6412,9 +6286,9 @@ } }, "@types/sinon": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.3.tgz", - "integrity": "sha512-XUaFuUOQ3A/r6gS1qCU/USMleascaqGeQpGR1AZ5JdRtBPlzijRzKsik1TuGzvdtPA0mdq42JqaJmJ+Afg1LJg==", + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.4.tgz", + "integrity": "sha512-fOYjrxQv8zJsqOY6V6ecP4eZhQBxtY80X0er1VVnUIAIZo74jHm8e1vguG5Yt4Iv8W2Wr7TgibB8MfRe32k9pA==", "dev": true, "requires": { "@sinonjs/fake-timers": "^7.1.0" @@ -6461,52 +6335,12 @@ } }, "ansi-align": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", - "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", "dev": true, "requires": { - "string-width": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "string-width": "^4.1.0" } }, "ansi-colors": { @@ -6696,16 +6530,16 @@ "dev": true }, "browserslist": { - "version": "4.17.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.0.tgz", - "integrity": "sha512-g2BJ2a0nEYvEFQC208q8mVAhfNwpZ5Mu8BwgtCdZKO3qx98HChmeg448fPdUzld8aFmfLgVh7yymqV+q1lJZ5g==", + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.1.tgz", + "integrity": "sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001254", - "colorette": "^1.3.0", - "electron-to-chromium": "^1.3.830", + "caniuse-lite": "^1.0.30001259", + "electron-to-chromium": "^1.3.846", "escalade": "^3.1.1", - "node-releases": "^1.1.75" + "nanocolors": "^0.1.5", + "node-releases": "^1.1.76" } }, "buffer": { @@ -6791,9 +6625,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001259", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz", - "integrity": "sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg==", + "version": "1.0.30001261", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001261.tgz", + "integrity": "sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA==", "dev": true }, "chalk": { @@ -6924,12 +6758,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "colorette": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", - "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", - "dev": true - }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -7011,9 +6839,9 @@ "dev": true }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -7139,9 +6967,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.827", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.827.tgz", - "integrity": "sha512-ye+4uQOY/jbjRutMcE/EmOcNwUeo1qo9aKL2tPyb09cU3lmxNeyDF4RWiemmkknW+p29h7dyDqy02higTxc9/A==", + "version": "1.3.853", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.853.tgz", + "integrity": "sha512-W4U8n+U8I5/SUaFcqZgbKRmYZwcyEIQVBDf+j5QQK6xChjXnQD+wj248eGR9X4u+dDmDR//8vIfbu4PrdBBIoQ==", "dev": true }, "emoji-regex": { @@ -7737,9 +7565,9 @@ } }, "is-core-module": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.6.0.tgz", - "integrity": "sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.7.0.tgz", + "integrity": "sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==", "dev": true, "requires": { "has": "^1.0.3" @@ -7764,9 +7592,9 @@ "dev": true }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { "is-extglob": "^2.1.1" @@ -7885,9 +7713,9 @@ "dev": true }, "istanbul-lib-coverage": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", - "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.1.tgz", + "integrity": "sha512-GvCYYTxaCPqwMjobtVcVKvSHtAGe48MNhGjpK8LtVF8K0ISX7hCKl85LgtuaSneWVyQmaGcW3iXVV3GaZSLpmQ==", "dev": true }, "istanbul-lib-hook": { @@ -8213,16 +8041,16 @@ "dev": true }, "mocha": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.1.tgz", - "integrity": "sha512-0wE74YMgOkCgBUj8VyIDwmLUjTsS13WV1Pg7l0SHea2qzZzlq7MDnfbPsHKcELBRk3+izEVkRofjmClpycudCA==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.2.tgz", + "integrity": "sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w==", "dev": true, "requires": { "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", "chokidar": "3.5.2", - "debug": "4.3.1", + "debug": "4.3.2", "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", @@ -8233,12 +8061,11 @@ "log-symbols": "4.1.0", "minimatch": "3.0.4", "ms": "2.1.3", - "nanoid": "3.1.23", + "nanoid": "3.1.25", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", "which": "2.0.2", - "wide-align": "1.1.3", "workerpool": "6.1.5", "yargs": "16.2.0", "yargs-parser": "20.2.4", @@ -8257,10 +8084,16 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "nanocolors": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.1.12.tgz", + "integrity": "sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==", + "dev": true + }, "nanoid": { - "version": "3.1.23", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", - "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", "dev": true }, "neo-async": { @@ -8300,9 +8133,9 @@ } }, "node-fetch": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.4.tgz", - "integrity": "sha512-aD1fO+xtLiSCc9vuD+sYMxpIuQyhHscGSkBEo2o5LTV/3bTEAYvdUii29n8LlO5uLCmWdGP7uVUVXFo5SRdkLA==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "dev": true, "requires": { "whatwg-url": "^5.0.0" @@ -9101,15 +8934,6 @@ "yargs-parser": "20.2.9" }, "dependencies": { - "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -9119,12 +8943,6 @@ "yallist": "^4.0.0" } }, - "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 - }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -9324,9 +9142,9 @@ } }, "shiki": { - "version": "0.9.10", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.10.tgz", - "integrity": "sha512-xeM7Oc6hY+6iW5O/T5hor8ul7mEprzyl5y4r5zthEHToQNw7MIhREMgU3r2gKDB0NaMLNrkcEQagudCdzE13Lg==", + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.11.tgz", + "integrity": "sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==", "dev": true, "requires": { "jsonc-parser": "^3.0.0", @@ -9346,9 +9164,9 @@ } }, "signal-exit": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.4.tgz", - "integrity": "sha512-rqYhcAnZ6d/vTPGghdrw7iumdcbXpsk1b8IG/rz+VWV51DM0p7XCtMoJ3qhPLIbp3tvyt3pKRbaaEMZYpHto8Q==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", + "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", "dev": true }, "sinon": { @@ -9456,23 +9274,23 @@ } }, "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "strip-ansi": "^6.0.1" } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "strip-bom": { @@ -9806,48 +9624,6 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", From 068f7f49bf4db822c603697e99b5f906c78ab850 Mon Sep 17 00:00:00 2001 From: leibale Date: Wed, 29 Sep 2021 18:20:50 -0400 Subject: [PATCH 27/40] fix EVAL & EVALSHA, add some tests, npm update --- lib/commands/EVAL.ts | 4 ---- lib/commands/EVALSHA.ts | 4 ---- lib/commands/ZRANGESTORE.spec.ts | 11 ++++++++++- lib/commands/generic-transformers.spec.ts | 7 +++++++ lib/commands/generic-transformers.ts | 6 ++---- package-lock.json | 12 ++++++------ 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/lib/commands/EVAL.ts b/lib/commands/EVAL.ts index 89645df9f3e..f269815b7ec 100644 --- a/lib/commands/EVAL.ts +++ b/lib/commands/EVAL.ts @@ -3,7 +3,3 @@ import { EvalOptions, pushEvalArguments } from './generic-transformers'; export function transformArguments(script: string, options?: EvalOptions): Array { return pushEvalArguments(['EVAL', script], options); } - -export function transformReply(reply: unknown): unknown { - return reply; -} diff --git a/lib/commands/EVALSHA.ts b/lib/commands/EVALSHA.ts index a81595bc4c0..105784cf5f8 100644 --- a/lib/commands/EVALSHA.ts +++ b/lib/commands/EVALSHA.ts @@ -3,7 +3,3 @@ import { EvalOptions, pushEvalArguments } from './generic-transformers'; export function transformArguments(sha1: string, options?: EvalOptions): Array { return pushEvalArguments(['EVALSHA', sha1], options); } - -export function transformReply(reply: unknown): unknown { - return reply; -} diff --git a/lib/commands/ZRANGESTORE.spec.ts b/lib/commands/ZRANGESTORE.spec.ts index 30dee7c0b5b..54055656409 100644 --- a/lib/commands/ZRANGESTORE.spec.ts +++ b/lib/commands/ZRANGESTORE.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; import { TestRedisServers, itWithClient, describeHandleMinimumRedisVersion } from '../test-utils'; -import { transformArguments } from './ZRANGESTORE'; +import { transformArguments, transformReply } from './ZRANGESTORE'; describe('ZRANGESTORE', () => { describeHandleMinimumRedisVersion([6, 2]); @@ -68,6 +68,15 @@ describe('ZRANGESTORE', () => { }); }); + describe('transformReply', () => { + it('should throw TypeError when reply is not a number', () => { + assert.throws( + () => (transformReply as any)([]), + TypeError + ); + }); + }); + itWithClient(TestRedisServers.OPEN, 'client.zRangeStore', async client => { await client.zAdd('src', { score: 0.5, diff --git a/lib/commands/generic-transformers.spec.ts b/lib/commands/generic-transformers.spec.ts index 9ac72bb1b25..9bde6ebb3af 100644 --- a/lib/commands/generic-transformers.spec.ts +++ b/lib/commands/generic-transformers.spec.ts @@ -300,6 +300,13 @@ describe('Generic Transformers', () => { ); }); + it('with COUNT', () => { + assert.deepEqual( + pushGeoCountArgument([], 1), + ['COUNT', '1'] + ); + }); + it('with ANY', () => { assert.deepEqual( pushGeoCountArgument([], { diff --git a/lib/commands/generic-transformers.ts b/lib/commands/generic-transformers.ts index 87325e61d72..84a6c97b81e 100644 --- a/lib/commands/generic-transformers.ts +++ b/lib/commands/generic-transformers.ts @@ -204,12 +204,10 @@ export function pushGeoSearchArguments( args.push('BYBOX', by.width.toString(), by.height.toString()); } - if (by.unit) { - args.push(by.unit); - } + args.push(by.unit); if (options?.SORT) { - args.push(options?.SORT); + args.push(options.SORT); } pushGeoCountArgument(args, options?.COUNT); diff --git a/package-lock.json b/package-lock.json index e4625a07401..bb840cc6dde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1789,9 +1789,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.853", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.853.tgz", - "integrity": "sha512-W4U8n+U8I5/SUaFcqZgbKRmYZwcyEIQVBDf+j5QQK6xChjXnQD+wj248eGR9X4u+dDmDR//8vIfbu4PrdBBIoQ==", + "version": "1.3.854", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.854.tgz", + "integrity": "sha512-00/IIC1mFPkq32MhUJyLdcTp7+wsKK2G3Sb65GSas9FKJQGYkDcZ4GwJkkxf5YyM3ETvl6n+toV8OmtXl4IA/g==", "dev": true }, "node_modules/emoji-regex": { @@ -6967,9 +6967,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.853", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.853.tgz", - "integrity": "sha512-W4U8n+U8I5/SUaFcqZgbKRmYZwcyEIQVBDf+j5QQK6xChjXnQD+wj248eGR9X4u+dDmDR//8vIfbu4PrdBBIoQ==", + "version": "1.3.854", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.854.tgz", + "integrity": "sha512-00/IIC1mFPkq32MhUJyLdcTp7+wsKK2G3Sb65GSas9FKJQGYkDcZ4GwJkkxf5YyM3ETvl6n+toV8OmtXl4IA/g==", "dev": true }, "emoji-regex": { From 43e546df987b58655383030edb570a7034694ee1 Mon Sep 17 00:00:00 2001 From: leibale Date: Fri, 1 Oct 2021 15:31:00 -0400 Subject: [PATCH 28/40] fix #1665 - add ZRANGEBYLEX, ZRANGEBYSCORE, ZRANGEBYSCORE_WITHSCORES --- lib/commands/ZRANGEBYLEX.spec.ts | 33 +++++++++++++++++ lib/commands/ZRANGEBYLEX.ts | 35 +++++++++++++++++++ lib/commands/ZRANGEBYSCORE.spec.ts | 33 +++++++++++++++++ lib/commands/ZRANGEBYSCORE.ts | 35 +++++++++++++++++++ lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts | 33 +++++++++++++++++ lib/commands/ZRANGEBYSCORE_WITHSCORES.ts | 19 ++++++++++ lib/commands/index.ts | 9 +++++ 7 files changed, 197 insertions(+) create mode 100644 lib/commands/ZRANGEBYLEX.spec.ts create mode 100644 lib/commands/ZRANGEBYLEX.ts create mode 100644 lib/commands/ZRANGEBYSCORE.spec.ts create mode 100644 lib/commands/ZRANGEBYSCORE.ts create mode 100644 lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts create mode 100644 lib/commands/ZRANGEBYSCORE_WITHSCORES.ts diff --git a/lib/commands/ZRANGEBYLEX.spec.ts b/lib/commands/ZRANGEBYLEX.spec.ts new file mode 100644 index 00000000000..7f687509548 --- /dev/null +++ b/lib/commands/ZRANGEBYLEX.spec.ts @@ -0,0 +1,33 @@ +import { strict as assert } from 'assert'; +import { TestRedisServers, itWithClient } from '../test-utils'; +import { transformArguments } from './ZRANGEBYLEX'; + +describe('ZRANGEBYLEX', () => { + describe('transformArguments', () => { + it('simple', () => { + assert.deepEqual( + transformArguments('src', '-', '+'), + ['ZRANGEBYLEX', 'src', '-', '+'] + ); + }); + + it('with LIMIT', () => { + assert.deepEqual( + transformArguments('src', '-', '+', { + LIMIT: { + offset: 0, + count: 1 + } + }), + ['ZRANGEBYLEX', 'src', '-', '+', 'LIMIT', '0', '1'] + ); + }); + }); + + itWithClient(TestRedisServers.OPEN, 'client.zRangeByLex', async client => { + assert.deepEqual( + await client.zRangeByLex('src', '-', '+'), + [] + ); + }); +}); diff --git a/lib/commands/ZRANGEBYLEX.ts b/lib/commands/ZRANGEBYLEX.ts new file mode 100644 index 00000000000..5e4475800c2 --- /dev/null +++ b/lib/commands/ZRANGEBYLEX.ts @@ -0,0 +1,35 @@ +import { TransformArgumentsReply } from '.'; +import { transformArgumentNumberInfinity } from './generic-transformers'; + +export const FIRST_KEY_INDEX = 1; + +export const IS_READ_ONLY = true; + +export interface ZRangeByLexOptions { + LIMIT?: { + offset: number; + count: number; + }; +} + +export function transformArguments( + key: string, + min: number | string, + max: number | string, + options?: ZRangeByLexOptions +): TransformArgumentsReply { + const args = [ + 'ZRANGEBYLEX', + key, + typeof min === 'string' ? min : transformArgumentNumberInfinity(min), + typeof max === 'string' ? max : transformArgumentNumberInfinity(max) + ]; + + if (options?.LIMIT) { + args.push('LIMIT', options.LIMIT.offset.toString(), options.LIMIT.count.toString()); + } + + return args; +} + +export declare function transformReply(): Array; diff --git a/lib/commands/ZRANGEBYSCORE.spec.ts b/lib/commands/ZRANGEBYSCORE.spec.ts new file mode 100644 index 00000000000..0419b232563 --- /dev/null +++ b/lib/commands/ZRANGEBYSCORE.spec.ts @@ -0,0 +1,33 @@ +import { strict as assert } from 'assert'; +import { TestRedisServers, itWithClient } from '../test-utils'; +import { transformArguments } from './ZRANGEBYSCORE'; + +describe('ZRANGEBYSCORE', () => { + describe('transformArguments', () => { + it('simple', () => { + assert.deepEqual( + transformArguments('src', 0, 1), + ['ZRANGEBYSCORE', 'src', '0', '1'] + ); + }); + + it('with LIMIT', () => { + assert.deepEqual( + transformArguments('src', 0, 1, { + LIMIT: { + offset: 0, + count: 1 + } + }), + ['ZRANGEBYSCORE', 'src', '0', '1', 'LIMIT', '0', '1'] + ); + }); + }); + + itWithClient(TestRedisServers.OPEN, 'client.zRangeByScore', async client => { + assert.deepEqual( + await client.zRangeByScore('src', 0, 1), + [] + ); + }); +}); diff --git a/lib/commands/ZRANGEBYSCORE.ts b/lib/commands/ZRANGEBYSCORE.ts new file mode 100644 index 00000000000..1932683f955 --- /dev/null +++ b/lib/commands/ZRANGEBYSCORE.ts @@ -0,0 +1,35 @@ +import { TransformArgumentsReply } from '.'; +import { transformArgumentNumberInfinity } from './generic-transformers'; + +export const FIRST_KEY_INDEX = 1; + +export const IS_READ_ONLY = true; + +export interface ZRangeByScoreOptions { + LIMIT?: { + offset: number; + count: number; + }; +} + +export function transformArguments( + key: string, + min: number | string, + max: number | string, + options?: ZRangeByScoreOptions +): TransformArgumentsReply { + const args = [ + 'ZRANGEBYSCORE', + key, + typeof min === 'string' ? min : transformArgumentNumberInfinity(min), + typeof max === 'string' ? max : transformArgumentNumberInfinity(max) + ]; + + if (options?.LIMIT) { + args.push('LIMIT', options.LIMIT.offset.toString(), options.LIMIT.count.toString()); + } + + return args; +} + +export declare function transformReply(): Array; diff --git a/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts b/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts new file mode 100644 index 00000000000..84d1aeb0aad --- /dev/null +++ b/lib/commands/ZRANGEBYSCORE_WITHSCORES.spec.ts @@ -0,0 +1,33 @@ +import { strict as assert } from 'assert'; +import { TestRedisServers, itWithClient } from '../test-utils'; +import { transformArguments } from './ZRANGEBYSCORE_WITHSCORES'; + +describe('ZRANGEBYSCORE WITHSCORES', () => { + describe('transformArguments', () => { + it('simple', () => { + assert.deepEqual( + transformArguments('src', 0, 1), + ['ZRANGEBYSCORE', 'src', '0', '1', 'WITHSCORES'] + ); + }); + + it('with LIMIT', () => { + assert.deepEqual( + transformArguments('src', 0, 1, { + LIMIT: { + offset: 0, + count: 1 + } + }), + ['ZRANGEBYSCORE', 'src', '0', '1', 'LIMIT', '0', '1', 'WITHSCORES'] + ); + }); + }); + + itWithClient(TestRedisServers.OPEN, 'client.zRangeByScoreWithScores', async client => { + assert.deepEqual( + await client.zRangeByScoreWithScores('src', 0, 1), + [] + ); + }); +}); diff --git a/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts b/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts new file mode 100644 index 00000000000..050ebf58936 --- /dev/null +++ b/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts @@ -0,0 +1,19 @@ +import { TransformArgumentsReply } from '.'; +import { transformReplySortedSetWithScores } from './generic-transformers'; +import { ZRangeByScoreOptions, transformArguments as transformZRangeByScoreArguments } from './ZRANGEBYSCORE'; + +export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZRANGEBYSCORE'; + +export function transformArguments( + key: string, + min: number | string, + max: number | string, + options?: ZRangeByScoreOptions +): TransformArgumentsReply { + return [ + ...transformZRangeByScoreArguments(key, min, max, options), + 'WITHSCORES' + ]; +} + +export const transformReply = transformReplySortedSetWithScores; diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 192968cb2ae..03a44ad7947 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -232,6 +232,9 @@ import * as ZRANDMEMBER_COUNT from './ZRANDMEMBER_COUNT'; import * as ZRANDMEMBER from './ZRANDMEMBER'; import * as ZRANGE_WITHSCORES from './ZRANGE_WITHSCORES'; import * as ZRANGE from './ZRANGE'; +import * as ZRANGEBYLEX from './ZRANGEBYLEX'; +import * as ZRANGEBYSCORE_WITHSCORES from './ZRANGEBYSCORE_WITHSCORES'; +import * as ZRANGEBYSCORE from './ZRANGEBYSCORE'; import * as ZRANGESTORE from './ZRANGESTORE'; import * as ZRANK from './ZRANK'; import * as ZREM from './ZREM'; @@ -713,6 +716,12 @@ export default { zRangeWithScores: ZRANGE_WITHSCORES, ZRANGE, zRange: ZRANGE, + ZRANGEBYLEX, + zRangeByLex: ZRANGEBYLEX, + ZRANGEBYSCORE_WITHSCORES, + zRangeByScoreWithScores: ZRANGEBYSCORE_WITHSCORES, + ZRANGEBYSCORE, + zRangeByScore: ZRANGEBYSCORE, ZRANGESTORE, zRangeStore: ZRANGESTORE, ZRANK, From 5eb06bcaa344ae531088677eef55496a8c3b3b94 Mon Sep 17 00:00:00 2001 From: leibale Date: Fri, 1 Oct 2021 15:51:45 -0400 Subject: [PATCH 29/40] new issue templates --- .github/ISSUE_TEMPLATE.md | 21 --------------------- .github/ISSUE_TEMPLATE/bug-report.md | 15 +++++++++++++++ .github/ISSUE_TEMPLATE/feature-request.md | 7 +++++++ 3 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 9b181d43149..00000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: ⚠️ Bug report -labels: needs-triage ---- - -### Issue - -> Describe your issue here - ---- - -### Environment - - - - **Node.js Version**: `VERSION_HERE` - - - - **Redis Server Version**: `VERSION_HERE` - - - - **Platform**: `PLATFORM_HERE` diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 00000000000..a7fae8eeb11 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,15 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: Bug +assignees: '' +--- + + + +**Environment:** + - **Node.js Version**: + - **Redis Server Version**: + - **Node Redis Version**: + - **Platform**: diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 00000000000..0645d6e1a83 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,7 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: Bug +assignees: '' +--- From 6e7844eca0c0dcb164bb29406d2612fa441b408b Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 4 Oct 2021 17:30:18 -0400 Subject: [PATCH 30/40] add all COMMAND commands --- lib/commands/COMMAND.spec.ts | 28 +++++++++ lib/commands/COMMAND.ts | 12 ++++ lib/commands/COMMAND_COUNT.spec.ts | 26 ++++++++ lib/commands/COMMAND_COUNT.ts | 9 +++ lib/commands/COMMAND_GETKEYS.spec.ts | 26 ++++++++ lib/commands/COMMAND_GETKEYS.ts | 9 +++ lib/commands/COMMAND_INFO.spec.ts | 28 +++++++++ lib/commands/COMMAND_INFO.ts | 12 ++++ lib/commands/generic-transformers.spec.ts | 28 ++++++++- lib/commands/generic-transformers.ts | 76 +++++++++++++++++++++++ lib/commands/index.ts | 12 ++++ 11 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 lib/commands/COMMAND.spec.ts create mode 100644 lib/commands/COMMAND.ts create mode 100644 lib/commands/COMMAND_COUNT.spec.ts create mode 100644 lib/commands/COMMAND_COUNT.ts create mode 100644 lib/commands/COMMAND_GETKEYS.spec.ts create mode 100644 lib/commands/COMMAND_GETKEYS.ts create mode 100644 lib/commands/COMMAND_INFO.spec.ts create mode 100644 lib/commands/COMMAND_INFO.ts diff --git a/lib/commands/COMMAND.spec.ts b/lib/commands/COMMAND.spec.ts new file mode 100644 index 00000000000..e2c563862fb --- /dev/null +++ b/lib/commands/COMMAND.spec.ts @@ -0,0 +1,28 @@ +import { strict as assert } from 'assert'; +import { itWithClient, TestRedisServers } from '../test-utils'; +import { transformArguments } from './COMMAND'; +import { CommandCategories, CommandFlags } from './generic-transformers'; + +describe('COMMAND', () => { + it('transformArguments', () => { + assert.deepEqual( + transformArguments(), + ['COMMAND'] + ); + }); + + itWithClient(TestRedisServers.OPEN, 'client.command', async client => { + assert.deepEqual( + (await client.command()).find(command => command.name === 'ping'), + { + name: 'ping', + arity: -1, + flags: new Set([CommandFlags.STALE, CommandFlags.FAST]), + firstKeyIndex: 0, + lastKeyIndex: 0, + step: 0, + categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) + } + ); + }); +}); diff --git a/lib/commands/COMMAND.ts b/lib/commands/COMMAND.ts new file mode 100644 index 00000000000..f72cc3f37dd --- /dev/null +++ b/lib/commands/COMMAND.ts @@ -0,0 +1,12 @@ +import { TransformArgumentsReply } from '.'; +import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers'; + +export const IS_READ_ONLY = true; + +export function transformArguments(): TransformArgumentsReply { + return ['COMMAND']; +} + +export function transformReply(reply: Array): Array { + return reply.map(transformCommandReply); +} diff --git a/lib/commands/COMMAND_COUNT.spec.ts b/lib/commands/COMMAND_COUNT.spec.ts new file mode 100644 index 00000000000..61ba1bf2540 --- /dev/null +++ b/lib/commands/COMMAND_COUNT.spec.ts @@ -0,0 +1,26 @@ +import { strict as assert } from 'assert'; +import { itWithClient, itWithCluster, TestRedisClusters, TestRedisServers } from '../test-utils'; +import { transformArguments } from './COMMAND_COUNT'; + +describe('COMMAND COUNT', () => { + it('transformArguments', () => { + assert.deepEqual( + transformArguments(), + ['COMMAND', 'COUNT'] + ); + }); + + itWithClient(TestRedisServers.OPEN, 'client.commandCount', async client => { + assert.equal( + typeof await client.commandCount(), + 'number' + ); + }); + + itWithCluster(TestRedisClusters.OPEN, 'cluster.commandCount', async cluster => { + assert.equal( + typeof await cluster.commandCount(), + 'number' + ); + }); +}); diff --git a/lib/commands/COMMAND_COUNT.ts b/lib/commands/COMMAND_COUNT.ts new file mode 100644 index 00000000000..4cdec7bebf1 --- /dev/null +++ b/lib/commands/COMMAND_COUNT.ts @@ -0,0 +1,9 @@ +import { TransformArgumentsReply } from '.'; + +export const IS_READ_ONLY = true; + +export function transformArguments(): TransformArgumentsReply { + return ['COMMAND', 'COUNT']; +} + +declare function transformReply(): number; diff --git a/lib/commands/COMMAND_GETKEYS.spec.ts b/lib/commands/COMMAND_GETKEYS.spec.ts new file mode 100644 index 00000000000..37e91781589 --- /dev/null +++ b/lib/commands/COMMAND_GETKEYS.spec.ts @@ -0,0 +1,26 @@ +import { strict as assert } from 'assert'; +import { itWithClient, itWithCluster, TestRedisClusters, TestRedisServers } from '../test-utils'; +import { transformArguments } from './COMMAND_GETKEYS'; + +describe('COMMAND GETKEYS', () => { + it('transformArguments', () => { + assert.deepEqual( + transformArguments(['GET', 'key']), + ['COMMAND', 'GETKEYS', 'GET', 'key'] + ); + }); + + itWithClient(TestRedisServers.OPEN, 'client.commandGetKeys', async client => { + assert.deepEqual( + await client.commandGetKeys(['GET', 'key']), + ['key'] + ); + }); + + itWithCluster(TestRedisClusters.OPEN, 'cluster.commandGetKeys', async cluster => { + assert.deepEqual( + await cluster.commandGetKeys(['GET', 'key']), + ['key'] + ); + }); +}); diff --git a/lib/commands/COMMAND_GETKEYS.ts b/lib/commands/COMMAND_GETKEYS.ts new file mode 100644 index 00000000000..0b8f38e3d08 --- /dev/null +++ b/lib/commands/COMMAND_GETKEYS.ts @@ -0,0 +1,9 @@ +import { TransformArgumentsReply } from '.'; + +export const IS_READ_ONLY = true; + +export function transformArguments(args: Array): TransformArgumentsReply { + return ['COMMAND', 'GETKEYS', ...args]; +} + +declare function transformReply(): Array; diff --git a/lib/commands/COMMAND_INFO.spec.ts b/lib/commands/COMMAND_INFO.spec.ts new file mode 100644 index 00000000000..c4deec0d220 --- /dev/null +++ b/lib/commands/COMMAND_INFO.spec.ts @@ -0,0 +1,28 @@ +import { strict as assert } from 'assert'; +import { itWithClient, TestRedisServers } from '../test-utils'; +import { transformArguments } from './COMMAND_INFO'; +import { CommandCategories, CommandFlags } from './generic-transformers'; + +describe('COMMAND INFO', () => { + it('transformArguments', () => { + assert.deepEqual( + transformArguments(['PING']), + ['COMMAND', 'INFO', 'PING'] + ); + }); + + itWithClient(TestRedisServers.OPEN, 'client.commandInfo', async client => { + assert.deepEqual( + await client.commandInfo(['PING']), + [{ + name: 'ping', + arity: -1, + flags: new Set([CommandFlags.STALE, CommandFlags.FAST]), + firstKeyIndex: 0, + lastKeyIndex: 0, + step: 0, + categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) + }] + ); + }); +}); diff --git a/lib/commands/COMMAND_INFO.ts b/lib/commands/COMMAND_INFO.ts new file mode 100644 index 00000000000..274c57d6aef --- /dev/null +++ b/lib/commands/COMMAND_INFO.ts @@ -0,0 +1,12 @@ +import { TransformArgumentsReply } from '.'; +import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers'; + +export const IS_READ_ONLY = true; + +export function transformArguments(commands: Array): TransformArgumentsReply { + return ['COMMAND', 'INFO', ...commands]; +} + +export function transformReply(reply: Array): Array { + return reply.map(command => command ? transformCommandReply(command) : null); +} diff --git a/lib/commands/generic-transformers.spec.ts b/lib/commands/generic-transformers.spec.ts index 9bde6ebb3af..bdc3ee938cd 100644 --- a/lib/commands/generic-transformers.spec.ts +++ b/lib/commands/generic-transformers.spec.ts @@ -21,7 +21,10 @@ import { pushStringTuplesArguments, pushVerdictArguments, pushVerdictArgument, - pushOptionalVerdictArgument + pushOptionalVerdictArgument, + transformCommandReply, + CommandFlags, + CommandCategories } from './generic-transformers'; describe('Generic Transformers', () => { @@ -626,4 +629,27 @@ describe('Generic Transformers', () => { ); }); }); + + it('transformCommandReply', () => { + assert.deepEqual( + transformCommandReply([ + 'ping', + -1, + [CommandFlags.STALE, CommandFlags.FAST], + 0, + 0, + 0, + [CommandCategories.FAST, CommandCategories.CONNECTION] + ]), + { + name: 'ping', + arity: -1, + flags: new Set([CommandFlags.STALE, CommandFlags.FAST]), + firstKeyIndex: 0, + lastKeyIndex: 0, + step: 0, + categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) + } + ); + }); }); diff --git a/lib/commands/generic-transformers.ts b/lib/commands/generic-transformers.ts index 84a6c97b81e..98e6750f765 100644 --- a/lib/commands/generic-transformers.ts +++ b/lib/commands/generic-transformers.ts @@ -335,3 +335,79 @@ export function pushOptionalVerdictArgument(args: TransformArgumentsReply, name: return pushVerdictArgument(args, value); } + +export enum CommandFlags { + WRITE = 'write', // command may result in modifications + READONLY = 'readonly', // command will never modify keys + DENYOOM = 'denyoom', // reject command if currently out of memory + ADMIN = 'admin', // server admin command + PUBSUB = 'pubsub', // pubsub-related command + NOSCRIPT = 'noscript', // deny this command from scripts + RANDOM = 'random', // command has random results, dangerous for scripts + SORT_FOR_SCRIPT = 'sort_for_script', // if called from script, sort output + LOADING = 'loading', // allow command while database is loading + STALE = 'stale', // allow command while replica has stale data + SKIP_MONITOR = 'skip_monitor', // do not show this command in MONITOR + ASKING = 'asking', // cluster related - accept even if importing + FAST = 'fast', // command operates in constant or log(N) time. Used for latency monitoring. + MOVABLEKEYS = 'movablekeys' // keys have no pre-determined position. You must discover keys yourself. +} + +export enum CommandCategories { + KEYSPACE = '@keyspace', + READ = '@read', + WRITE = '@write', + SET = '@set', + SORTEDSET = '@sortedset', + LIST = '@list', + HASH = '@hash', + STRING = '@string', + BITMAP = '@bitmap', + HYPERLOGLOG = '@hyperloglog', + GEO = '@geo', + STREAM = '@stream', + PUBSUB = '@pubsub', + ADMIN = '@admin', + FAST = '@fast', + SLOW = '@slow', + BLOCKING = '@blocking', + DANGEROUS = '@dangerous', + CONNECTION = '@connection', + TRANSACTION = '@transaction', + SCRIPTING = '@scripting' +} + +export type CommandRawReply = [ + name: string, + arity: number, + flags: Array, + firstKeyIndex: number, + lastKeyIndex: number, + step: number, + categories: Array +]; + +export type CommandReply = { + name: string, + arity: number, + flags: Set, + firstKeyIndex: number, + lastKeyIndex: number, + step: number, + categories: Set +}; + +export function transformCommandReply( + this: void, + [name, arity, flags, firstKeyIndex, lastKeyIndex, step, categories]: CommandRawReply +): CommandReply { + return { + name, + arity, + flags: new Set(flags), + firstKeyIndex, + lastKeyIndex, + step, + categories: new Set(categories) + }; +} diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 03a44ad7947..014aff9e3a6 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -35,6 +35,10 @@ import * as CLUSTER_MEET from './CLUSTER_MEET'; import * as CLUSTER_RESET from './CLUSTER_RESET'; import * as CLUSTER_SETSLOT from './CLUSTER_SETSLOT'; import * as CLUSTER_SLOTS from './CLUSTER_SLOTS'; +import * as COMMAND_COUNT from './COMMAND_COUNT'; +import * as COMMAND_GETKEYS from './COMMAND_GETKEYS'; +import * as COMMAND_INFO from './COMMAND_INFO'; +import * as COMMAND from './COMMAND'; import * as CONFIG_GET from './CONFIG_GET'; import * as CONFIG_RESETASTAT from './CONFIG_RESETSTAT'; import * as CONFIG_REWRITE from './CONFIG_REWRITE'; @@ -323,6 +327,14 @@ export default { clusterSetSlot: CLUSTER_SETSLOT, CLUSTER_SLOTS, clusterSlots: CLUSTER_SLOTS, + COMMAND_COUNT, + commandCount: COMMAND_COUNT, + COMMAND_GETKEYS, + commandGetKeys: COMMAND_GETKEYS, + COMMAND_INFO, + commandInfo: COMMAND_INFO, + COMMAND, + command: COMMAND, CONFIG_GET, configGet: CONFIG_GET, CONFIG_RESETASTAT, From 833416c4e90a4f301ce257c30ce4309f300ab31e Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 4 Oct 2021 18:27:32 -0400 Subject: [PATCH 31/40] run COMMAND & COMMAND INFO tests only on redis >6 --- lib/commands/COMMAND.spec.ts | 2 ++ lib/commands/COMMAND_INFO.spec.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/commands/COMMAND.spec.ts b/lib/commands/COMMAND.spec.ts index e2c563862fb..1f036dadc17 100644 --- a/lib/commands/COMMAND.spec.ts +++ b/lib/commands/COMMAND.spec.ts @@ -24,5 +24,7 @@ describe('COMMAND', () => { categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) } ); + }, { + minimumRedisVersion: [6] }); }); diff --git a/lib/commands/COMMAND_INFO.spec.ts b/lib/commands/COMMAND_INFO.spec.ts index c4deec0d220..59a61f6680a 100644 --- a/lib/commands/COMMAND_INFO.spec.ts +++ b/lib/commands/COMMAND_INFO.spec.ts @@ -24,5 +24,7 @@ describe('COMMAND INFO', () => { categories: new Set([CommandCategories.FAST, CommandCategories.CONNECTION]) }] ); + }, { + minimumRedisVersion: [6] }); }); From ef93bb192d04372d130aca5510c347a866990685 Mon Sep 17 00:00:00 2001 From: Leibale Eidelman Date: Tue, 5 Oct 2021 16:53:32 -0400 Subject: [PATCH 32/40] Create SECURITY.md --- SECURITY.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000000..0839a123c96 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,16 @@ +# Security Policy + +## Supported Versions + +Node Redis is generally backwards compatible with very few exceptions, so we recommend users to always use the latest version to experience stability, performance and security. + +| Version | Supported | +| ------- | ------------------ | +| 4.0.x | :white_check_mark: | +| 3.1.x | :white_check_mark: | +| < 3.1 | :x: | + +## Reporting a Vulnerability + +If you believe you’ve discovered a serious vulnerability, please contact the Node Redis core team at redis@redis.io. We will evaluate your report and if necessary issue a fix and an advisory. If the issue was previously undisclosed, +we’ll also mention your name in the credits. From cc83cee22ce5cc835d54ea2281c5debb2e6cd3ff Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 7 Oct 2021 10:20:21 -0400 Subject: [PATCH 33/40] fix #1671 - add support for all client configurations in cluster --- README.md | 34 +++++++++++++++------------------- index.ts | 2 -- lib/cluster-slots.ts | 12 +++++------- lib/cluster.spec.ts | 4 ++-- lib/cluster.ts | 10 ++++++---- lib/commands/BZPOPMAX.spec.ts | 1 - lib/test-utils.ts | 22 +++++++++++++--------- 7 files changed, 41 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index c5f0ea1a1c9..c768b691d71 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ The above code connects to localhost on port 6379. To connect to a different hos ```typescript createClient({ - url: 'redis://alice:foobared@awesome.redis.server:6380', + url: 'redis://alice:foobared@awesome.redis.server:6380' }); ``` @@ -78,7 +78,7 @@ Modifiers to commands are specified using a JavaScript object: ```typescript await client.set('key', 'value', { EX: 10, - NX: true, + NX: true }); ``` @@ -181,12 +181,9 @@ for await (const key of client.scanIterator()) { This works with `HSCAN`, `SSCAN`, and `ZSCAN` too: ```typescript -for await (const member of client.hScanIterator('hash')) { -} -for await (const { field, value } of client.sScanIterator('set')) { -} -for await (const { member, score } of client.zScanIterator('sorted-set')) { -} +for await (const member of client.hScanIterator('hash')) {} +for await (const { field, value } of client.sScanIterator('set')) {} +for await (const { member, score } of client.zScanIterator('sorted-set')) {} ``` You can override the default options by providing a configuration object: @@ -204,7 +201,8 @@ client.scanIterator({ Define new functions using [Lua scripts](https://redis.io/commands/eval) which execute on the Redis server: ```typescript -import { createClient, defineScript } from 'redis'; +import { createClient } from 'redis'; +import { defineScript } from 'redis/lua-script'; (async () => { const client = createClient({ @@ -218,9 +216,9 @@ import { createClient, defineScript } from 'redis'; }, transformReply(reply: number): number { return reply; - }, - }), - }, + } + }) + } }); await client.connect(); @@ -241,14 +239,12 @@ import { createCluster } from 'redis'; const cluster = createCluster({ rootNodes: [ { - host: '10.0.0.1', - port: 30001, + url: 'redis://10.0.0.1:30001' }, { - host: '10.0.0.2', - port: 30002, - }, - ], + url: 'redis://10.0.0.2:30002' + } + ] }); cluster.on('error', (err) => console.log('Redis Cluster Error', err)); @@ -274,7 +270,7 @@ Of course, if you don't do something with your Promises you're certain to get [u ```typescript await Promise.all([ client.set('Tm9kZSBSZWRpcw==', 'users:1'), - client.sAdd('users:1:tokens', 'Tm9kZSBSZWRpcw=='), + client.sAdd('users:1:tokens', 'Tm9kZSBSZWRpcw==') ]); ``` diff --git a/index.ts b/index.ts index 408cbe3b996..fb448f989c7 100644 --- a/index.ts +++ b/index.ts @@ -6,5 +6,3 @@ export const createClient = RedisClient.create; export const commandOptions = RedisClient.commandOptions; export const createCluster = RedisCluster.create; - -export { defineScript } from './lib/lua-script'; diff --git a/lib/cluster-slots.ts b/lib/cluster-slots.ts index a5155cc53db..4c33f2e0f79 100644 --- a/lib/cluster-slots.ts +++ b/lib/cluster-slots.ts @@ -2,7 +2,7 @@ import calculateSlot from 'cluster-key-slot'; import RedisClient, { RedisClientType } from './client'; import { RedisSocketOptions } from './socket'; import { RedisClusterMasterNode, RedisClusterReplicaNode } from './commands/CLUSTER_NODES'; -import { RedisClusterOptions } from './cluster'; +import { RedisClusterClientOptions, RedisClusterOptions } from './cluster'; import { RedisModules } from './commands'; import { RedisLuaScripts } from './lua-script'; @@ -39,21 +39,19 @@ export default class RedisClusterSlots): Promise { - if (await this.#discoverNodes(startWith.options?.socket)) return; + if (await this.#discoverNodes(startWith.options)) return; for (const { client } of this.#nodeByUrl.values()) { if (client === startWith) continue; - if (await this.#discoverNodes(client.options?.socket)) return; + if (await this.#discoverNodes(client.options)) return; } throw new Error('None of the cluster nodes is available'); } - async #discoverNodes(socketOptions?: RedisSocketOptions): Promise { - const client = RedisClient.create({ - socket: socketOptions - }); + async #discoverNodes(clientOptions?: RedisClusterClientOptions): Promise { + const client = RedisClient.create(clientOptions); await client.connect(); diff --git a/lib/cluster.spec.ts b/lib/cluster.spec.ts index b7dbe50c908..22ae204f9aa 100644 --- a/lib/cluster.spec.ts +++ b/lib/cluster.spec.ts @@ -8,7 +8,7 @@ import { ClusterSlotStates } from './commands/CLUSTER_SETSLOT'; describe('Cluster', () => { it('sendCommand', async () => { const cluster = RedisCluster.create({ - rootNodes: TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN], + ...TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN], useReplicas: true }); @@ -42,7 +42,7 @@ describe('Cluster', () => { it('scripts', async () => { const cluster = RedisCluster.create({ - rootNodes: TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN], + ...TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN], scripts: { add: defineScript({ NUMBER_OF_KEYS: 0, diff --git a/lib/cluster.ts b/lib/cluster.ts index 87dcec17b71..565bb859b84 100644 --- a/lib/cluster.ts +++ b/lib/cluster.ts @@ -1,14 +1,16 @@ import { RedisCommand, RedisCommandReply, RedisModules, TransformArgumentsReply } from './commands'; -import RedisClient, { ClientCommandOptions, RedisClientType, WithPlugins } from './client'; -import { RedisSocketOptions } from './socket'; +import RedisClient, { ClientCommandOptions, RedisClientOptions, RedisClientType, WithPlugins } from './client'; import RedisClusterSlots, { ClusterNode } from './cluster-slots'; import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { extendWithModulesAndScripts, extendWithDefaultCommands, transformCommandArguments, transformCommandReply } from './commander'; import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; import { EventEmitter } from 'events'; -export interface RedisClusterOptions { - rootNodes: Array; +export type RedisClusterClientOptions = Omit, 'modules' | 'scripts'>; + +export interface RedisClusterOptions { + rootNodes: Array; + defaults?: RedisClusterClientOptions; modules?: M; scripts?: S; useReplicas?: boolean; diff --git a/lib/commands/BZPOPMAX.spec.ts b/lib/commands/BZPOPMAX.spec.ts index c4bcc321b29..090dfba096d 100644 --- a/lib/commands/BZPOPMAX.spec.ts +++ b/lib/commands/BZPOPMAX.spec.ts @@ -2,7 +2,6 @@ import { strict as assert } from 'assert'; import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments, transformReply } from './BZPOPMAX'; import { commandOptions } from '../../index'; -import { describe } from 'mocha'; describe('BZPOPMAX', () => { describe('transformArguments', () => { diff --git a/lib/test-utils.ts b/lib/test-utils.ts index 713a1a3434a..bc3c0514606 100644 --- a/lib/test-utils.ts +++ b/lib/test-utils.ts @@ -5,7 +5,7 @@ import { once } from 'events'; import { RedisSocketOptions } from './socket'; import which from 'which'; import { SinonSpy } from 'sinon'; -import RedisCluster, { RedisClusterType } from './cluster'; +import RedisCluster, { RedisClusterOptions, RedisClusterType } from './cluster'; import { promises as fs } from 'fs'; import { Context as MochaContext } from 'mocha'; import { promiseTimeout } from './utils'; @@ -60,7 +60,7 @@ export enum TestRedisClusters { OPEN } -export const TEST_REDIS_CLUSTERES: Record> = {}; +export const TEST_REDIS_CLUSTERES: Record> = {}; let port = 6379; @@ -248,9 +248,13 @@ async function spawnPasswordServer(): Promise { } async function spawnOpenCluster(): Promise { - TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN] = (await spawnGlobalRedisCluster(TestRedisClusters.OPEN, 3)).map(port => ({ - port - })); + TEST_REDIS_CLUSTERES[TestRedisClusters.OPEN] = { + rootNodes: (await spawnGlobalRedisCluster(TestRedisClusters.OPEN, 3)).map(port => ({ + socket: { + port + } + })) + }; } before(function () { @@ -314,9 +318,7 @@ export function itWithCluster( it(title, async function () { if (handleMinimumRedisVersion(this, options?.minimumRedisVersion)) return; - const cluster = RedisCluster.create({ - rootNodes: TEST_REDIS_CLUSTERES[type] - }); + const cluster = RedisCluster.create(TEST_REDIS_CLUSTERES[type]); await cluster.connect(); @@ -337,7 +339,9 @@ export function itWithDedicatedCluster(title: string, fn: (cluster: RedisCluster const spawnResults = await spawnRedisCluster(null, 3), cluster = RedisCluster.create({ rootNodes: [{ - port: spawnResults[0].port + socket: { + port: spawnResults[0].port + } }] }); From d7026f619e66eadb186c15589cb9bc5cc7d03de4 Mon Sep 17 00:00:00 2001 From: leibale Date: Thu, 7 Oct 2021 11:44:45 -0400 Subject: [PATCH 34/40] ref #1671 - add support for defaults --- lib/cluster-slots.ts | 31 ++++++++++++++++++++++--------- lib/cluster.ts | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/cluster-slots.ts b/lib/cluster-slots.ts index 4c33f2e0f79..29730bf753d 100644 --- a/lib/cluster-slots.ts +++ b/lib/cluster-slots.ts @@ -1,6 +1,5 @@ import calculateSlot from 'cluster-key-slot'; import RedisClient, { RedisClientType } from './client'; -import { RedisSocketOptions } from './socket'; import { RedisClusterMasterNode, RedisClusterReplicaNode } from './commands/CLUSTER_NODES'; import { RedisClusterClientOptions, RedisClusterOptions } from './cluster'; import { RedisModules } from './commands'; @@ -32,7 +31,7 @@ export default class RedisClusterSlots { for (const rootNode of this.#options.rootNodes) { - if (await this.#discoverNodes(rootNode)) return; + if (await this.#discoverNodes(this.#clientOptionsDefaults(rootNode))) return; } throw new Error('None of the root nodes is available'); @@ -99,6 +98,18 @@ export default class RedisClusterSlots, promises: Array>): ClusterNode { const url = `${nodeData.host}:${nodeData.port}`; clientsInUse.add(url); @@ -107,13 +118,15 @@ export default class RedisClusterSlots, 'module export interface RedisClusterOptions { rootNodes: Array; - defaults?: RedisClusterClientOptions; + defaults?: Partial; modules?: M; scripts?: S; useReplicas?: boolean; From 13d44147db4e4f718c27c7c34f7ab4eb3b009e4c Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 11 Oct 2021 17:18:41 -0400 Subject: [PATCH 35/40] remove some commands from cluster, npm update, clean code, --- benchmark/package-lock.json | 122 +-- benchmark/package.json | 2 +- lib/{ => client}/commands-queue.ts | 6 +- lib/client/commands.ts | 233 ++++++ lib/{client.spec.ts => client/index.spec.ts} | 19 +- lib/{client.ts => client/index.ts} | 90 +- lib/client/multi-command.ts | 132 +++ lib/{ => client}/socket.spec.ts | 0 lib/{ => client}/socket.ts | 4 +- lib/{ => cluster}/cluster-slots.ts | 25 +- lib/cluster/commands.ts | 535 ++++++++++++ .../index.spec.ts} | 13 +- lib/{cluster.ts => cluster/index.ts} | 80 +- lib/cluster/multi-command.ts | 112 +++ lib/commander.ts | 45 +- lib/commands/ACL_DELUSER.ts | 4 +- lib/commands/ACL_SETUSER.ts | 4 +- lib/commands/BITOP.ts | 4 +- lib/commands/BLPOP.ts | 4 +- lib/commands/BRPOP.ts | 4 +- lib/commands/BZPOPMAX.ts | 4 +- lib/commands/BZPOPMIN.ts | 4 +- lib/commands/CLUSTER_INFO.spec.ts | 18 - lib/commands/CLUSTER_NODES.spec.ts | 21 - lib/commands/CLUSTER_SLOTS.ts | 4 +- lib/commands/COMMAND.ts | 4 +- lib/commands/COMMAND_COUNT.spec.ts | 9 +- lib/commands/COMMAND_COUNT.ts | 4 +- lib/commands/COMMAND_GETKEYS.spec.ts | 9 +- lib/commands/COMMAND_GETKEYS.ts | 4 +- lib/commands/COMMAND_INFO.ts | 4 +- lib/commands/DBSIZE.spec.ts | 9 +- lib/commands/DEL.ts | 4 +- lib/commands/ECHO.spec.ts | 9 +- lib/commands/EXISTS.ts | 4 +- lib/commands/GEOHASH.ts | 4 +- lib/commands/GEOPOS.ts | 4 +- lib/commands/GEOSEARCH_WITH.spec.ts | 4 +- lib/commands/GEOSEARCH_WITH.ts | 6 +- lib/commands/GET.ts | 4 +- lib/commands/GETEX.ts | 4 +- lib/commands/HDEL.ts | 4 +- lib/commands/HMGET.ts | 4 +- lib/commands/HSET.ts | 4 +- lib/commands/LASTSAVE.spec.ts | 6 +- lib/commands/LOLWUT.spec.ts | 11 +- lib/commands/LPUSH.ts | 4 +- lib/commands/LPUSHX.ts | 4 +- lib/commands/MEMORY_DOCTOR.spec.ts | 9 +- lib/commands/MEMORY_MALLOC-STATS.spec.ts | 9 +- lib/commands/MEMORY_PURGE.spec.ts | 9 +- lib/commands/MEMORY_USAGE.spec.ts | 9 +- lib/commands/PFADD.ts | 4 +- lib/commands/PFCOUNT.ts | 4 +- lib/commands/PFMERGE.ts | 4 +- lib/commands/PING.spec.ts | 9 +- lib/commands/PUBSUB_CHANNELS.spec.ts | 9 +- lib/commands/PUBSUB_NUMPAT.spec.ts | 9 +- lib/commands/PUBSUB_NUMSUB.spec.ts | 9 +- lib/commands/RPUSH.ts | 4 +- lib/commands/RPUSHX.ts | 4 +- lib/commands/SADD.ts | 4 +- lib/commands/SCRIPT_DEBUG.spec.ts | 9 +- lib/commands/SCRIPT_EXISTS.spec.ts | 9 +- lib/commands/SCRIPT_EXISTS.ts | 4 +- lib/commands/SCRIPT_FLUSH.spec.ts | 9 +- lib/commands/SCRIPT_LOAD.spec.ts | 9 +- lib/commands/SDIFF.ts | 4 +- lib/commands/SDIFFSTORE.ts | 4 +- lib/commands/SET.ts | 4 +- lib/commands/SETBIT.ts | 4 +- lib/commands/SETEX.ts | 4 +- lib/commands/SINTER.ts | 4 +- lib/commands/SINTERSTORE.ts | 4 +- lib/commands/SREM.ts | 4 +- lib/commands/SUNION.ts | 4 +- lib/commands/SUNIONSTORE.ts | 4 +- lib/commands/TOUCH.ts | 4 +- lib/commands/UNLINK.ts | 4 +- lib/commands/UNWATCH.spec.ts | 9 +- lib/commands/WATCH.ts | 4 +- lib/commands/XACK.ts | 4 +- lib/commands/XDEL.ts | 4 +- lib/commands/ZDIFF.ts | 4 +- lib/commands/ZDIFFSTORE.ts | 4 +- lib/commands/ZDIFF_WITHSCORES.ts | 4 +- lib/commands/ZINTER.ts | 4 +- lib/commands/ZINTERSTORE.ts | 4 +- lib/commands/ZINTER_WITHSCORES.ts | 4 +- lib/commands/ZMSCORE.ts | 4 +- lib/commands/ZRANGEBYLEX.ts | 4 +- lib/commands/ZRANGEBYSCORE.ts | 4 +- lib/commands/ZRANGEBYSCORE_WITHSCORES.ts | 4 +- lib/commands/ZREM.ts | 4 +- lib/commands/ZUNION.ts | 4 +- lib/commands/ZUNIONSTORE.ts | 4 +- lib/commands/ZUNION_WITHSCORES.ts | 4 +- lib/commands/generic-transformers.ts | 8 +- lib/commands/index.ts | 784 +----------------- lib/lua-script.ts | 10 +- lib/multi-command.spec.ts | 163 ++-- lib/multi-command.ts | 190 +---- lib/test-utils.ts | 8 +- package-lock.json | 492 ++++++----- package.json | 15 +- tsconfig.json | 8 +- 106 files changed, 1729 insertions(+), 1822 deletions(-) rename lib/{ => client}/commands-queue.ts (97%) create mode 100644 lib/client/commands.ts rename lib/{client.spec.ts => client/index.spec.ts} (97%) rename lib/{client.ts => client/index.ts} (82%) create mode 100644 lib/client/multi-command.ts rename lib/{ => client}/socket.spec.ts (100%) rename lib/{ => client}/socket.ts (98%) rename lib/{ => cluster}/cluster-slots.ts (91%) create mode 100644 lib/cluster/commands.ts rename lib/{cluster.spec.ts => cluster/index.spec.ts} (91%) rename lib/{cluster.ts => cluster/index.ts} (68%) create mode 100644 lib/cluster/multi-command.ts diff --git a/benchmark/package-lock.json b/benchmark/package-lock.json index 767d6870184..49d77a57787 100644 --- a/benchmark/package-lock.json +++ b/benchmark/package-lock.json @@ -7,7 +7,7 @@ "name": "benchmark", "license": "ISC", "dependencies": { - "benny": "^3.6.15", + "benny": "^3.7.0", "v3": "npm:redis@3.1.2", "v4": "file:../" } @@ -24,20 +24,21 @@ }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@tsconfig/node12": "^1.0.9", "@types/mocha": "^9.0.0", - "@types/node": "^16.9.6", - "@types/sinon": "^10.0.3", + "@types/node": "^16.10.3", + "@types/sinon": "^10.0.4", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", - "mocha": "^9.1.1", + "mocha": "^9.1.2", "nyc": "^15.1.0", "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", - "ts-node": "^10.2.1", - "typedoc": "0.21.9", - "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "3.10.4", + "ts-node": "^10.3.0", + "typedoc": "^0.22.5", + "typedoc-github-wiki-theme": "^0.6.0", + "typedoc-plugin-markdown": "^3.11.3", "typescript": "^4.4.3", "which": "^2.0.2" }, @@ -126,14 +127,6 @@ "node": ">=8" } }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/benchmark": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", @@ -144,20 +137,21 @@ } }, "node_modules/benny": { - "version": "3.6.15", - "resolved": "https://registry.npmjs.org/benny/-/benny-3.6.15.tgz", - "integrity": "sha512-kq6XVGGYVou3Y8KNPs3SEF881vi5fJ8sIf9w69D2rreiNfRicWVWK6u6/mObMw6BiexoHHumtipn5gcu0Tngng==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/benny/-/benny-3.7.0.tgz", + "integrity": "sha512-tfQ8s4qwjfyMvFqe7wSGGel2Pzgl5ytwztS72Xh/ynPKJeXFLQ0sSVL95X9wHpqpXqW13pTHsEMCggrNKgeAoA==", "dependencies": { "@arrows/composition": "^1.0.0", "@arrows/dispatch": "^1.0.2", "@arrows/multimethod": "^1.1.6", "benchmark": "^2.1.4", - "fs-extra": "^9.0.1", - "json2csv": "^5.0.4", - "kleur": "^4.1.3", - "log-update": "^4.0.0", - "prettier": "^2.1.2", - "stats-median": "^1.0.1" + "fs-extra": "^10.0.0", + "json2csv": "^5.0.6", + "kleur": "^4.1.4", + "log-update": "^4.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/cli-cursor": { @@ -214,17 +208,16 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", "dependencies": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/graceful-fs": { @@ -338,17 +331,6 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, - "node_modules/prettier": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", - "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/redis-commands": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", @@ -406,11 +388,6 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/stats-median": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stats-median/-/stats-median-1.0.1.tgz", - "integrity": "sha512-IYsheLg6dasD3zT/w9+8Iq9tcIQqqu91ZIpJOnIEM25C3X/g4Tl8mhXwW2ZQpbrsJISr9+wizEYgsibN5/b32Q==" - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -555,11 +532,6 @@ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==" }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" - }, "benchmark": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", @@ -570,20 +542,18 @@ } }, "benny": { - "version": "3.6.15", - "resolved": "https://registry.npmjs.org/benny/-/benny-3.6.15.tgz", - "integrity": "sha512-kq6XVGGYVou3Y8KNPs3SEF881vi5fJ8sIf9w69D2rreiNfRicWVWK6u6/mObMw6BiexoHHumtipn5gcu0Tngng==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/benny/-/benny-3.7.0.tgz", + "integrity": "sha512-tfQ8s4qwjfyMvFqe7wSGGel2Pzgl5ytwztS72Xh/ynPKJeXFLQ0sSVL95X9wHpqpXqW13pTHsEMCggrNKgeAoA==", "requires": { "@arrows/composition": "^1.0.0", "@arrows/dispatch": "^1.0.2", "@arrows/multimethod": "^1.1.6", "benchmark": "^2.1.4", - "fs-extra": "^9.0.1", - "json2csv": "^5.0.4", - "kleur": "^4.1.3", - "log-update": "^4.0.0", - "prettier": "^2.1.2", - "stats-median": "^1.0.1" + "fs-extra": "^10.0.0", + "json2csv": "^5.0.6", + "kleur": "^4.1.4", + "log-update": "^4.0.0" } }, "cli-cursor": { @@ -628,11 +598,10 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", "requires": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" @@ -716,11 +685,6 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, - "prettier": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", - "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==" - }, "redis-commands": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", @@ -763,11 +727,6 @@ "is-fullwidth-code-point": "^3.0.0" } }, - "stats-median": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stats-median/-/stats-median-1.0.1.tgz", - "integrity": "sha512-IYsheLg6dasD3zT/w9+8Iq9tcIQqqu91ZIpJOnIEM25C3X/g4Tl8mhXwW2ZQpbrsJISr9+wizEYgsibN5/b32Q==" - }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -811,23 +770,24 @@ "version": "file:..", "requires": { "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@tsconfig/node12": "^1.0.9", "@types/mocha": "^9.0.0", - "@types/node": "^16.9.6", - "@types/sinon": "^10.0.3", + "@types/node": "^16.10.3", + "@types/sinon": "^10.0.4", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", "cluster-key-slot": "1.1.0", "generic-pool": "3.8.2", - "mocha": "^9.1.1", + "mocha": "^9.1.2", "nyc": "^15.1.0", "redis-parser": "3.0.0", "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", - "ts-node": "^10.2.1", - "typedoc": "0.21.9", - "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "3.10.4", + "ts-node": "^10.3.0", + "typedoc": "^0.22.5", + "typedoc-github-wiki-theme": "^0.6.0", + "typedoc-plugin-markdown": "^3.11.3", "typescript": "^4.4.3", "which": "^2.0.2", "yallist": "4.0.0" diff --git a/benchmark/package.json b/benchmark/package.json index 5226a5b0c89..f56ad2f23ce 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -10,7 +10,7 @@ "author": "", "license": "ISC", "dependencies": { - "benny": "^3.6.15", + "benny": "^3.7.0", "v3": "npm:redis@3.1.2", "v4": "file:../" } diff --git a/lib/commands-queue.ts b/lib/client/commands-queue.ts similarity index 97% rename from lib/commands-queue.ts rename to lib/client/commands-queue.ts index ef87184193f..791c7638bad 100644 --- a/lib/commands-queue.ts +++ b/lib/client/commands-queue.ts @@ -1,7 +1,7 @@ import LinkedList from 'yallist'; import RedisParser from 'redis-parser'; -import { AbortError } from './errors'; -import { RedisReply } from './commands'; +import { AbortError } from '../errors'; +import { RedisCommandRawReply } from '../commands'; export interface QueueCommandOptions { asap?: boolean; @@ -107,7 +107,7 @@ export default class RedisCommandsQueue { this.#maxLength = maxLength; } - addCommand(args: Array, options?: QueueCommandOptions, bufferMode?: boolean): Promise { + addCommand(args: Array, options?: QueueCommandOptions, bufferMode?: boolean): Promise { if (this.#pubSubState.subscribing || this.#pubSubState.subscribed) { return Promise.reject(new Error('Cannot send commands in PubSub mode')); } else if (this.#maxLength && this.#waitingToBeSent.length + this.#waitingForReply.length >= this.#maxLength) { diff --git a/lib/client/commands.ts b/lib/client/commands.ts new file mode 100644 index 00000000000..c34f34be4fa --- /dev/null +++ b/lib/client/commands.ts @@ -0,0 +1,233 @@ +import CLUSTER_COMMANDS from '../cluster/commands'; +import * as ACL_CAT from '../commands/ACL_CAT'; +import * as ACL_DELUSER from '../commands/ACL_DELUSER'; +import * as ACL_GENPASS from '../commands/ACL_GENPASS'; +import * as ACL_GETUSER from '../commands/ACL_GETUSER'; +import * as ACL_LIST from '../commands/ACL_LIST'; +import * as ACL_LOAD from '../commands/ACL_LOAD'; +import * as ACL_LOG_RESET from '../commands/ACL_LOG_RESET'; +import * as ACL_LOG from '../commands/ACL_LOG'; +import * as ACL_SAVE from '../commands/ACL_SAVE'; +import * as ACL_SETUSER from '../commands/ACL_SETUSER'; +import * as ACL_USERS from '../commands/ACL_USERS'; +import * as ACL_WHOAMI from '../commands/ACL_WHOAMI'; +import * as ASKING from '../commands/ASKING'; +import * as AUTH from '../commands/AUTH'; +import * as BGREWRITEAOF from '../commands/BGREWRITEAOF'; +import * as BGSAVE from '../commands/BGSAVE'; +import * as CLIENT_ID from '../commands/CLIENT_ID'; +import * as CLIENT_INFO from '../commands/CLIENT_INFO'; +import * as CLUSTER_ADDSLOTS from '../commands/CLUSTER_ADDSLOTS'; +import * as CLUSTER_FLUSHSLOTS from '../commands/CLUSTER_FLUSHSLOTS'; +import * as CLUSTER_INFO from '../commands/CLUSTER_INFO'; +import * as CLUSTER_NODES from '../commands/CLUSTER_NODES'; +import * as CLUSTER_MEET from '../commands/CLUSTER_MEET'; +import * as CLUSTER_RESET from '../commands/CLUSTER_RESET'; +import * as CLUSTER_SETSLOT from '../commands/CLUSTER_SETSLOT'; +import * as CLUSTER_SLOTS from '../commands/CLUSTER_SLOTS'; +import * as COMMAND_COUNT from '../commands/COMMAND_COUNT'; +import * as COMMAND_GETKEYS from '../commands/COMMAND_GETKEYS'; +import * as COMMAND_INFO from '../commands/COMMAND_INFO'; +import * as COMMAND from '../commands/COMMAND'; +import * as CONFIG_GET from '../commands/CONFIG_GET'; +import * as CONFIG_RESETASTAT from '../commands/CONFIG_RESETSTAT'; +import * as CONFIG_REWRITE from '../commands/CONFIG_REWRITE'; +import * as CONFIG_SET from '../commands/CONFIG_SET'; +import * as DBSIZE from '../commands/DBSIZE'; +import * as DISCARD from '../commands/DISCARD'; +import * as ECHO from '../commands/ECHO'; +import * as FAILOVER from '../commands/FAILOVER'; +import * as FLUSHALL from '../commands/FLUSHALL'; +import * as FLUSHDB from '../commands/FLUSHDB'; +import * as HELLO from '../commands/HELLO'; +import * as INFO from '../commands/INFO'; +import * as KEYS from '../commands/KEYS'; +import * as LASTSAVE from '../commands/LASTSAVE'; +import * as LOLWUT from '../commands/LOLWUT'; +import * as MEMOERY_DOCTOR from '../commands/MEMORY_DOCTOR'; +import * as MEMORY_MALLOC_STATS from '../commands/MEMORY_MALLOC-STATS'; +import * as MEMORY_PURGE from '../commands/MEMORY_PURGE'; +import * as MEMORY_STATS from '../commands/MEMORY_STATS'; +import * as MEMORY_USAGE from '../commands/MEMORY_USAGE'; +import * as MODULE_LIST from '../commands/MODULE_LIST'; +import * as MODULE_LOAD from '../commands/MODULE_LOAD'; +import * as MODULE_UNLOAD from '../commands/MODULE_UNLOAD'; +import * as MOVE from '../commands/MOVE'; +import * as PING from '../commands/PING'; +import * as PUBSUB_CHANNELS from '../commands/PUBSUB_CHANNELS'; +import * as PUBSUB_NUMPAT from '../commands/PUBSUB_NUMPAT'; +import * as PUBSUB_NUMSUB from '../commands/PUBSUB_NUMSUB'; +import * as RANDOMKEY from '../commands/RANDOMKEY'; +import * as READONLY from '../commands/READONLY'; +import * as READWRITE from '../commands/READWRITE'; +import * as REPLICAOF from '../commands/REPLICAOF'; +import * as RESTORE_ASKING from '../commands/RESTORE-ASKING'; +import * as ROLE from '../commands/ROLE'; +import * as SAVE from '../commands/SAVE'; +import * as SCAN from '../commands/SCAN'; +import * as SCRIPT_DEBUG from '../commands/SCRIPT_DEBUG'; +import * as SCRIPT_EXISTS from '../commands/SCRIPT_EXISTS'; +import * as SCRIPT_FLUSH from '../commands/SCRIPT_FLUSH'; +import * as SCRIPT_KILL from '../commands/SCRIPT_KILL'; +import * as SCRIPT_LOAD from '../commands/SCRIPT_LOAD'; +import * as SHUTDOWN from '../commands/SHUTDOWN'; +import * as SWAPDB from '../commands/SWAPDB'; +import * as TIME from '../commands/TIME'; +import * as UNWATCH from '../commands/UNWATCH'; +import * as WAIT from '../commands/WAIT'; + +export default { + ...CLUSTER_COMMANDS, + ACL_CAT, + aclCat: ACL_CAT, + ACL_DELUSER, + aclDelUser: ACL_DELUSER, + ACL_GENPASS, + aclGenPass: ACL_GENPASS, + ACL_GETUSER, + aclGetUser: ACL_GETUSER, + ACL_LIST, + aclList: ACL_LIST, + ACL_LOAD, + aclLoad: ACL_LOAD, + ACL_LOG_RESET, + aclLogReset: ACL_LOG_RESET, + ACL_LOG, + aclLog: ACL_LOG, + ACL_SAVE, + aclSave: ACL_SAVE, + ACL_SETUSER, + aclSetUser: ACL_SETUSER, + ACL_USERS, + aclUsers: ACL_USERS, + ACL_WHOAMI, + aclWhoAmI: ACL_WHOAMI, + ASKING, + asking: ASKING, + AUTH, + auth: AUTH, + BGREWRITEAOF, + bgRewriteAof: BGREWRITEAOF, + BGSAVE, + bgSave: BGSAVE, + CLIENT_ID, + clientId: CLIENT_ID, + CLIENT_INFO, + clientInfo: CLIENT_INFO, + CLUSTER_ADDSLOTS, + clusterAddSlots: CLUSTER_ADDSLOTS, + CLUSTER_FLUSHSLOTS, + clusterFlushSlots: CLUSTER_FLUSHSLOTS, + CLUSTER_INFO, + clusterInfo: CLUSTER_INFO, + CLUSTER_NODES, + clusterNodes: CLUSTER_NODES, + CLUSTER_MEET, + clusterMeet: CLUSTER_MEET, + CLUSTER_RESET, + clusterReset: CLUSTER_RESET, + CLUSTER_SETSLOT, + clusterSetSlot: CLUSTER_SETSLOT, + CLUSTER_SLOTS, + clusterSlots: CLUSTER_SLOTS, + COMMAND_COUNT, + commandCount: COMMAND_COUNT, + COMMAND_GETKEYS, + commandGetKeys: COMMAND_GETKEYS, + COMMAND_INFO, + commandInfo: COMMAND_INFO, + COMMAND, + command: COMMAND, + CONFIG_GET, + configGet: CONFIG_GET, + CONFIG_RESETASTAT, + configResetStat: CONFIG_RESETASTAT, + CONFIG_REWRITE, + configRewrite: CONFIG_REWRITE, + CONFIG_SET, + configSet: CONFIG_SET, + DBSIZE, + dbSize: DBSIZE, + DISCARD, + discard: DISCARD, + ECHO, + echo: ECHO, + FAILOVER, + failover: FAILOVER, + FLUSHALL, + flushAll: FLUSHALL, + FLUSHDB, + flushDb: FLUSHDB, + HELLO, + hello: HELLO, + INFO, + info: INFO, + KEYS, + keys: KEYS, + LASTSAVE, + lastSave: LASTSAVE, + LOLWUT, + lolwut: LOLWUT, + MEMOERY_DOCTOR, + memoryDoctor: MEMOERY_DOCTOR, + 'MEMORY_MALLOC-STATS': MEMORY_MALLOC_STATS, + memoryMallocStats: MEMORY_MALLOC_STATS, + MEMORY_PURGE, + memoryPurge: MEMORY_PURGE, + MEMORY_STATS, + memoryStats: MEMORY_STATS, + MEMORY_USAGE, + memoryUsage: MEMORY_USAGE, + MODULE_LIST, + moduleList: MODULE_LIST, + MODULE_LOAD, + moduleLoad: MODULE_LOAD, + MODULE_UNLOAD, + moduleUnload: MODULE_UNLOAD, + MOVE, + move: MOVE, + PING, + ping: PING, + PUBSUB_CHANNELS, + pubSubChannels: PUBSUB_CHANNELS, + PUBSUB_NUMPAT, + pubSubNumPat: PUBSUB_NUMPAT, + PUBSUB_NUMSUB, + pubSubNumSub: PUBSUB_NUMSUB, + RANDOMKEY, + randomKey: RANDOMKEY, + READONLY, + readonly: READONLY, + READWRITE, + readwrite: READWRITE, + REPLICAOF, + replicaOf: REPLICAOF, + 'RESTORE-ASKING': RESTORE_ASKING, + restoreAsking: RESTORE_ASKING, + ROLE, + role: ROLE, + SAVE, + save: SAVE, + SCAN, + scan: SCAN, + SCRIPT_DEBUG, + scriptDebug: SCRIPT_DEBUG, + SCRIPT_EXISTS, + scriptExists: SCRIPT_EXISTS, + SCRIPT_FLUSH, + scriptFlush: SCRIPT_FLUSH, + SCRIPT_KILL, + scriptKill: SCRIPT_KILL, + SCRIPT_LOAD, + scriptLoad: SCRIPT_LOAD, + SHUTDOWN, + shutdown: SHUTDOWN, + SWAPDB, + swapDb: SWAPDB, + TIME, + time: TIME, + UNWATCH, + unwatch: UNWATCH, + WAIT, + wait: WAIT, +}; diff --git a/lib/client.spec.ts b/lib/client/index.spec.ts similarity index 97% rename from lib/client.spec.ts rename to lib/client/index.spec.ts index 2cf6ea4964e..e98814d0582 100644 --- a/lib/client.spec.ts +++ b/lib/client/index.spec.ts @@ -1,11 +1,11 @@ import { strict as assert, AssertionError } from 'assert'; import { once } from 'events'; -import { itWithClient, TEST_REDIS_SERVERS, TestRedisServers, waitTillBeenCalled, isRedisVersionGreaterThan } from './test-utils'; -import RedisClient from './client'; -import { AbortError, ClientClosedError, ConnectionTimeoutError, WatchError } from './errors'; -import { defineScript } from './lua-script'; +import { itWithClient, TEST_REDIS_SERVERS, TestRedisServers, waitTillBeenCalled, isRedisVersionGreaterThan } from '../test-utils'; +import RedisClient from '.'; +import { AbortError, ClientClosedError, ConnectionTimeoutError, WatchError } from '../errors'; +import { defineScript } from '../lua-script'; import { spy } from 'sinon'; -import { RedisNetSocketOptions } from './socket'; +import { RedisNetSocketOptions } from '../client/socket'; export const SQUARE_SCRIPT = defineScript({ NUMBER_OF_KEYS: 0, @@ -366,6 +366,15 @@ describe('Client', () => { WatchError ); }); + + itWithClient(TestRedisServers.OPEN, 'execAsPipeline', async client => { + assert.deepEqual( + await client.multi() + .ping() + .exec(true), + ['PONG'] + ); + }); }); it('scripts', async () => { diff --git a/lib/client.ts b/lib/client/index.ts similarity index 82% rename from lib/client.ts rename to lib/client/index.ts index 98169bc302e..5aeffd365da 100644 --- a/lib/client.ts +++ b/lib/client/index.ts @@ -1,79 +1,81 @@ +import COMMANDS from './commands'; +import { RedisCommand, RedisCommandArguments, RedisCommandRawReply, RedisCommandReply, RedisModules, RedisPlugins, RedisScript, RedisScripts } from '../commands'; import RedisSocket, { RedisSocketOptions, RedisNetSocketOptions, RedisTlsSocketOptions } from './socket'; import RedisCommandsQueue, { PubSubListener, PubSubSubscribeCommands, PubSubUnsubscribeCommands, QueueCommandOptions } from './commands-queue'; -import COMMANDS, { RedisCommandReply, TransformArgumentsReply } from './commands'; -import { RedisCommand, RedisModules, RedisReply } from './commands'; -import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; +import RedisClientMultiCommand, { RedisClientMultiCommandType } from './multi-command'; +import { RedisMultiQueuedCommand } from '../multi-command'; import EventEmitter from 'events'; -import { CommandOptions, commandOptions, isCommandOptions } from './command-options'; -import { RedisLuaScript, RedisLuaScripts } from './lua-script'; -import { ScanOptions, ZMember } from './commands/generic-transformers'; -import { ScanCommandOptions } from './commands/SCAN'; -import { HScanTuple } from './commands/HSCAN'; -import { encodeCommand, extendWithDefaultCommands, extendWithModulesAndScripts, transformCommandArguments, transformCommandReply } from './commander'; +import { CommandOptions, commandOptions, isCommandOptions } from '../command-options'; +import { ScanOptions, ZMember } from '../commands/generic-transformers'; +import { ScanCommandOptions } from '../commands/SCAN'; +import { HScanTuple } from '../commands/HSCAN'; +import { encodeCommand, extendWithCommands, extendWithModulesAndScripts, transformCommandArguments, transformCommandReply } from '../commander'; import { Pool, Options as PoolOptions, createPool } from 'generic-pool'; -import { ClientClosedError } from './errors'; +import { ClientClosedError } from '../errors'; import { URL } from 'url'; -export interface RedisClientOptions { +export interface RedisClientOptions extends RedisPlugins { url?: string; socket?: RedisSocketOptions; username?: string; password?: string; database?: number; - modules?: M; - scripts?: S; commandsQueueMaxLength?: number; readonly?: boolean; legacyMode?: boolean; isolationPoolOptions?: PoolOptions; } -export type RedisCommandSignature = +export type RedisClientCommandSignature = (...args: Parameters | [options: CommandOptions, ...rest: Parameters]) => Promise>; type WithCommands = { - [P in keyof typeof COMMANDS]: RedisCommandSignature<(typeof COMMANDS)[P]>; + [P in keyof typeof COMMANDS]: RedisClientCommandSignature<(typeof COMMANDS)[P]>; }; -type WithModules = { +export type WithModules = { [P in keyof M]: { - [C in keyof M[P]]: RedisCommandSignature; + [C in keyof M[P]]: RedisClientCommandSignature; }; }; -type WithScripts = { - [P in keyof S]: RedisCommandSignature; +export type WithScripts = { + [P in keyof S]: RedisClientCommandSignature; }; -export type WithPlugins = - WithCommands & WithModules & WithScripts; +export type RedisClientType = + RedisClient & WithCommands & WithModules & WithScripts; -export type RedisClientType = - WithPlugins & RedisClient; +export type InstantiableRedisClient = + new (...args: ConstructorParameters) => RedisClientType; export interface ClientCommandOptions extends QueueCommandOptions { isolated?: boolean; } -export default class RedisClient extends EventEmitter { +export default class RedisClient extends EventEmitter { static commandOptions(options: ClientCommandOptions): CommandOptions { return commandOptions(options); } - static create(options?: RedisClientOptions): RedisClientType { - const Client = (extendWithModulesAndScripts({ + static extend(plugins?: RedisPlugins): InstantiableRedisClient { + const Client = extendWithModulesAndScripts({ BaseClass: RedisClient, - modules: options?.modules, + modules: plugins?.modules, modulesCommandsExecutor: RedisClient.prototype.commandsExecutor, - scripts: options?.scripts, + scripts: plugins?.scripts, scriptsExecutor: RedisClient.prototype.scriptsExecutor - })); + }); if (Client !== RedisClient) { - Client.prototype.Multi = RedisMultiCommand.extend(options); + Client.prototype.Multi = RedisClientMultiCommand.extend(plugins); } - return new Client(options); + return Client; + } + + static create(options?: RedisClientOptions): RedisClientType { + return new (RedisClient.extend(options))(options); } static parseURL(url: string): RedisClientOptions<{}, {}> { @@ -285,12 +287,12 @@ export default class RedisClient(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { + sendCommand(args: RedisCommandArguments, options?: ClientCommandOptions, bufferMode?: boolean): Promise { return this.#sendCommand(args, options, bufferMode); } // using `#sendCommand` cause `sendCommand` is overwritten in legacy mode - async #sendCommand(args: TransformArgumentsReply, options?: ClientCommandOptions, bufferMode?: boolean): Promise { + async #sendCommand(args: RedisCommandArguments, options?: ClientCommandOptions, bufferMode?: boolean): Promise { if (!this.#socket.isOpen) { throw new ClientClosedError(); } @@ -309,7 +311,7 @@ export default class RedisClient): Promise> { + async scriptsExecutor(script: RedisScript, args: Array): Promise> { const { args: redisArgs, options } = transformCommandArguments(script, args); return transformCommandReply( @@ -319,7 +321,7 @@ export default class RedisClient> { + async executeScript(script: RedisScript, args: RedisCommandArguments, options?: ClientCommandOptions, bufferMode?: boolean): Promise> { try { return await this.#sendCommand([ 'EVALSHA', @@ -341,8 +343,6 @@ export default class RedisClient; async SELECT(options: CommandOptions, db: number): Promise; async SELECT(options?: any, db?: any): Promise { @@ -429,14 +429,14 @@ export default class RedisClient { + multi(): RedisClientMultiCommandType { return new (this as any).Multi( - this.#multiExecutor.bind(this), - this.#options + this.multiExecutor.bind(this), + this.#options?.legacyMode ); } - #multiExecutor(commands: Array, chainId?: symbol): Promise> { + multiExecutor(commands: Array, chainId?: symbol): Promise> { const promise = Promise.all( commands.map(({ args }) => { return this.#queue.addCommand(args, RedisClient.commandOptions({ @@ -508,5 +508,9 @@ export default class RedisClient = + (...args: Parameters) => RedisClientMultiCommandType; + +type WithCommands = { + [P in keyof typeof COMMANDS]: RedisClientMultiCommandSignature<(typeof COMMANDS)[P], M, S> +}; + +type WithModules = { + [P in keyof M]: { + [C in keyof M[P]]: RedisClientMultiCommandSignature; + }; +}; + +type WithScripts = { + [P in keyof S]: RedisClientMultiCommandSignature +}; + +export type RedisClientMultiCommandType = + RedisClientMultiCommand & WithCommands & WithModules & WithScripts; + +export type RedisClientMultiExecutor = (queue: Array, chainId?: symbol) => Promise>; + +export default class RedisClientMultiCommand { + readonly #multi = new RedisMultiCommand(); + readonly #executor: RedisClientMultiExecutor; + + static extend( + plugins?: RedisPlugins + ): new (...args: ConstructorParameters) => RedisClientMultiCommandType { + return extendWithModulesAndScripts({ + BaseClass: RedisClientMultiCommand, + modules: plugins?.modules, + modulesCommandsExecutor: RedisClientMultiCommand.prototype.commandsExecutor, + scripts: plugins?.scripts, + scriptsExecutor: RedisClientMultiCommand.prototype.scriptsExecutor + }); + } + + readonly v4: Record = {}; + + constructor(executor: RedisClientMultiExecutor, legacyMode = false) { + this.#executor = executor; + if (legacyMode) { + this.#legacyMode(); + } + } + + #legacyMode(): void { + this.v4.addCommand = this.addCommand.bind(this); + (this as any).addCommand = (...args: Array>): this => { + this.#multi.addCommand(args.flat()); + return this; + }; + this.v4.exec = this.exec.bind(this); + (this as any).exec = (callback?: (err: Error | null, replies?: Array) => unknown): void => { + this.v4.exec() + .then((reply: Array) => { + if (!callback) return; + + callback(null, reply); + }) + .catch((err: Error) => { + if (!callback) { + // this.emit('error', err); + return; + } + + callback(err); + }); + }; + + for (const name of Object.keys(COMMANDS)) { + this.#defineLegacyCommand(name); + } + } + + #defineLegacyCommand(name: string): void { + (this as any).v4[name] = (this as any)[name].bind(this.v4); + (this as any)[name] = (...args: Array): void => (this as any).addCommand(name, args); + } + + commandsExecutor(command: RedisCommand, args: Array): this { + return this.addCommand( + command.transformArguments(...args), + command.transformReply + ); + } + + addCommand(args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): this { + this.#multi.addCommand(args, transformReply); + return this; + } + + scriptsExecutor(script: RedisScript, args: Array): this { + this.#multi.addScript(script, args); + return this; + } + + async exec(execAsPipeline = false): Promise> { + if (execAsPipeline) { + return this.execAsPipeline(); + } + + const commands = this.#multi.exec(); + if (!commands) return []; + + return this.#multi.handleExecReplies( + await this.#executor(commands, RedisMultiCommand.generateChainId()) + ); + } + + EXEC = this.exec; + + async execAsPipeline(): Promise> { + if (!this.#multi.queue.length) return []; + + return this.#multi.transformReplies( + await this.#executor(this.#multi.queue) + ); + } +} + +extendWithCommands({ + BaseClass: RedisClientMultiCommand, + commands: COMMANDS, + executor: RedisClientMultiCommand.prototype.commandsExecutor +}); diff --git a/lib/socket.spec.ts b/lib/client/socket.spec.ts similarity index 100% rename from lib/socket.spec.ts rename to lib/client/socket.spec.ts diff --git a/lib/socket.ts b/lib/client/socket.ts similarity index 98% rename from lib/socket.ts rename to lib/client/socket.ts index 8bc94c5ba07..ca48ad4d542 100644 --- a/lib/socket.ts +++ b/lib/client/socket.ts @@ -1,8 +1,8 @@ import EventEmitter from 'events'; import net from 'net'; import tls from 'tls'; -import { ConnectionTimeoutError, ClientClosedError } from './errors'; -import { promiseTimeout } from './utils'; +import { ConnectionTimeoutError, ClientClosedError } from '../errors'; +import { promiseTimeout } from '../utils'; export interface RedisSocketCommonOptions { connectTimeout?: number; diff --git a/lib/cluster-slots.ts b/lib/cluster/cluster-slots.ts similarity index 91% rename from lib/cluster-slots.ts rename to lib/cluster/cluster-slots.ts index 29730bf753d..63834d4b4ca 100644 --- a/lib/cluster-slots.ts +++ b/lib/cluster/cluster-slots.ts @@ -1,16 +1,15 @@ import calculateSlot from 'cluster-key-slot'; -import RedisClient, { RedisClientType } from './client'; -import { RedisClusterMasterNode, RedisClusterReplicaNode } from './commands/CLUSTER_NODES'; -import { RedisClusterClientOptions, RedisClusterOptions } from './cluster'; -import { RedisModules } from './commands'; -import { RedisLuaScripts } from './lua-script'; +import RedisClient, { InstantiableRedisClient, RedisClientType } from '../client'; +import { RedisClusterMasterNode, RedisClusterReplicaNode } from '../commands/CLUSTER_NODES'; +import { RedisClusterClientOptions, RedisClusterOptions } from '.'; +import { RedisModules, RedisScripts } from '../commands'; -export interface ClusterNode { +export interface ClusterNode { id: string; client: RedisClientType; } -interface SlotNodes { +interface SlotNodes { master: ClusterNode; replicas: Array>; clientIterator: IterableIterator> | undefined; @@ -18,14 +17,16 @@ interface SlotNodes { type OnError = (err: unknown) => void; -export default class RedisClusterSlots { - readonly #options: RedisClusterOptions; +export default class RedisClusterSlots { + readonly #options: RedisClusterOptions; + readonly #Client: InstantiableRedisClient; readonly #onError: OnError; readonly #nodeByUrl = new Map>(); readonly #slots: Array> = []; - constructor(options: RedisClusterOptions, onError: OnError) { + constructor(options: RedisClusterOptions, onError: OnError) { this.#options = options; + this.#Client = RedisClient.extend(options); this.#onError = onError; } @@ -50,7 +51,7 @@ export default class RedisClusterSlots { - const client = RedisClient.create(clientOptions); + const client = new this.#Client(clientOptions); await client.connect(); @@ -118,7 +119,7 @@ export default class RedisClusterSlots { it('sendCommand', async () => { @@ -15,7 +15,7 @@ describe('Cluster', () => { await cluster.connect(); try { - await cluster.ping(); + await cluster.publish('channel', 'message'); await cluster.set('a', 'b'); await cluster.set('a{a}', 'bb'); await cluster.set('aa', 'bb'); @@ -32,11 +32,10 @@ describe('Cluster', () => { const key = 'key'; assert.deepEqual( await cluster.multi(key) - .ping() .set(key, 'value') .get(key) .exec(), - ['PONG', 'OK', 'value'] + ['OK', 'value'] ); }); diff --git a/lib/cluster.ts b/lib/cluster/index.ts similarity index 68% rename from lib/cluster.ts rename to lib/cluster/index.ts index 295e193cbc9..4b55a93d4ab 100644 --- a/lib/cluster.ts +++ b/lib/cluster/index.ts @@ -1,27 +1,35 @@ -import { RedisCommand, RedisCommandReply, RedisModules, TransformArgumentsReply } from './commands'; -import RedisClient, { ClientCommandOptions, RedisClientOptions, RedisClientType, WithPlugins } from './client'; +import COMMANDS from './commands'; +import { RedisCommand, RedisCommandArguments, RedisCommandReply, RedisModules, RedisScript, RedisScripts } from '../commands'; +import { ClientCommandOptions, RedisClientCommandSignature, RedisClientOptions, RedisClientType, WithModules, WithScripts } from '../client'; import RedisClusterSlots, { ClusterNode } from './cluster-slots'; -import { RedisLuaScript, RedisLuaScripts } from './lua-script'; -import { extendWithModulesAndScripts, extendWithDefaultCommands, transformCommandArguments, transformCommandReply } from './commander'; -import RedisMultiCommand, { MultiQueuedCommand, RedisMultiCommandType } from './multi-command'; +import { extendWithModulesAndScripts, transformCommandArguments, transformCommandReply, extendWithCommands } from '../commander'; import { EventEmitter } from 'events'; +import RedisClusterMultiCommand, { RedisClusterMultiCommandType } from './multi-command'; +import { RedisMultiQueuedCommand } from '../multi-command'; export type RedisClusterClientOptions = Omit, 'modules' | 'scripts'>; -export interface RedisClusterOptions { - rootNodes: Array; - defaults?: Partial; +export interface RedisClusterPlugins { modules?: M; scripts?: S; +} + +export interface RedisClusterOptions extends RedisClusterPlugins { + rootNodes: Array; + defaults?: Partial; useReplicas?: boolean; maxCommandRedirections?: number; } -export type RedisClusterType = - WithPlugins & RedisCluster; +type WithCommands = { + [P in keyof typeof COMMANDS]: RedisClientCommandSignature<(typeof COMMANDS)[P]>; +}; + +export type RedisClusterType = + RedisCluster & WithCommands & WithModules & WithScripts; -export default class RedisCluster extends EventEmitter { - static #extractFirstKey(command: RedisCommand, originalArgs: Array, redisArgs: TransformArgumentsReply): string | Buffer | undefined { +export default class RedisCluster extends EventEmitter { + static extractFirstKey(command: RedisCommand, originalArgs: Array, redisArgs: RedisCommandArguments): string | Buffer | undefined { if (command.FIRST_KEY_INDEX === undefined) { return undefined; } else if (typeof command.FIRST_KEY_INDEX === 'number') { @@ -31,7 +39,7 @@ export default class RedisCluster(options?: RedisClusterOptions): RedisClusterType { + static create(options?: RedisClusterOptions): RedisClusterType { return new (extendWithModulesAndScripts({ BaseClass: RedisCluster, modules: options?.modules, @@ -41,20 +49,20 @@ export default class RedisCluster; readonly #slots: RedisClusterSlots; - readonly #Multi: new (...args: ConstructorParameters) => RedisMultiCommandType; + readonly #Multi: new (...args: ConstructorParameters) => RedisClusterMultiCommandType; constructor(options: RedisClusterOptions) { super(); this.#options = options; this.#slots = new RedisClusterSlots(options, err => this.emit('error', err)); - this.#Multi = RedisMultiCommand.extend(options); + this.#Multi = RedisClusterMultiCommand.extend(options); } - duplicate(): RedisClusterOptions { - return new (Object.getPrototypeOf(this).constructor)(this.#options); + duplicate(): RedisClusterType { + return new (Object.getPrototypeOf(this).constructor)(); } async connect(): Promise { @@ -67,7 +75,7 @@ export default class RedisCluster( firstKey: string | Buffer | undefined, isReadonly: boolean | undefined, - args: TransformArgumentsReply, + args: RedisCommandArguments, options?: ClientCommandOptions, bufferMode?: boolean, redirections = 0 @@ -101,7 +109,7 @@ export default class RedisCluster): Promise> { + async scriptsExecutor(script: RedisScript, args: Array): Promise> { const { args: redisArgs, options } = transformCommandArguments(script, args); return transformCommandReply( @@ -117,14 +125,14 @@ export default class RedisCluster, - redisArgs: TransformArgumentsReply, + redisArgs: RedisCommandArguments, options?: ClientCommandOptions, redirections = 0 ): Promise> { const client = this.#slots.getClient( - RedisCluster.#extractFirstKey(script, originalArgs, redisArgs), + RedisCluster.extractFirstKey(script, originalArgs, redisArgs), script.IS_READ_ONLY ); @@ -169,20 +177,14 @@ export default class RedisCluster { + multi(routing?: string | Buffer): RedisClusterMultiCommandType { return new this.#Multi( - async (commands: Array, chainId?: symbol) => { - const client = this.#slots.getClient(routing); - - return Promise.all( - commands.map(({ args }) => { - return client.sendCommand(args, RedisClient.commandOptions({ - chainId - })); - }) - ); + async (commands: Array, firstKey?: string | Buffer, chainId?: symbol) => { + return this.#slots + .getClient(firstKey) + .multiExecutor(commands, chainId); }, - this.#options + routing ); } @@ -199,4 +201,8 @@ export default class RedisCluster = + (...args: Parameters) => RedisClusterMultiCommandType; + +type WithCommands = { + [P in keyof typeof COMMANDS]: RedisClusterMultiCommandSignature<(typeof COMMANDS)[P], M, S> +}; + +type WithModules = { + [P in keyof M]: { + [C in keyof M[P]]: RedisClusterMultiCommandSignature; + }; +}; + +type WithScripts = { + [P in keyof S]: RedisClusterMultiCommandSignature +}; + +export type RedisClusterMultiCommandType = + RedisClusterMultiCommand & WithCommands & WithModules & WithScripts; + +export type RedisClusterMultiExecutor = (queue: Array, firstKey?: string | Buffer, chainId?: symbol) => Promise>; + +export default class RedisClusterMultiCommand { + readonly #multi = new RedisMultiCommand(); + readonly #executor: RedisClusterMultiExecutor; + #firstKey: string | Buffer | undefined; + + static extend( + plugins?: RedisPlugins + ): new (...args: ConstructorParameters) => RedisClusterMultiCommandType { + return extendWithModulesAndScripts({ + BaseClass: RedisClusterMultiCommand, + modules: plugins?.modules, + modulesCommandsExecutor: RedisClusterMultiCommand.prototype.commandsExecutor, + scripts: plugins?.scripts, + scriptsExecutor: RedisClusterMultiCommand.prototype.scriptsExecutor + }); + } + + constructor(executor: RedisClusterMultiExecutor, firstKey?: string | Buffer) { + this.#executor = executor; + this.#firstKey = firstKey; + } + + commandsExecutor(command: RedisCommand, args: Array): this { + const transformedArguments = command.transformArguments(...args); + if (!this.#firstKey) { + this.#firstKey = RedisCluster.extractFirstKey(command, args, transformedArguments); + } + + return this.addCommand( + undefined, + transformedArguments, + command.transformReply + ); + } + + addCommand( + firstKey: string | Buffer | undefined, + args: RedisCommandArguments, + transformReply?: RedisCommand['transformReply'] + ): this { + if (!this.#firstKey) { + this.#firstKey = firstKey; + } + + this.#multi.addCommand(args, transformReply); + return this; + } + + scriptsExecutor(script: RedisScript, args: Array): this { + const transformedArguments = this.#multi.addScript(script, args); + if (!this.#firstKey) { + this.#firstKey = RedisCluster.extractFirstKey(script, args, transformedArguments); + } + + return this.addCommand(undefined, transformedArguments); + } + + async exec(execAsPipeline = false): Promise> { + if (execAsPipeline) { + return this.execAsPipeline(); + } + + const commands = this.#multi.exec(); + if (!commands) return []; + + return this.#multi.handleExecReplies( + await this.#executor(commands, this.#firstKey, RedisMultiCommand.generateChainId()) + ); + } + + EXEC = this.exec; + + async execAsPipeline(): Promise> { + return this.#multi.transformReplies( + await this.#executor(this.#multi.queue, this.#firstKey) + ); + } +} + +extendWithCommands({ + BaseClass: RedisClusterMultiCommand, + commands: COMMANDS, + executor: RedisClusterMultiCommand.prototype.commandsExecutor +}); diff --git a/lib/commander.ts b/lib/commander.ts index 4e542bde74a..5871c2f235b 100644 --- a/lib/commander.ts +++ b/lib/commander.ts @@ -1,37 +1,32 @@ -import COMMANDS, { RedisCommand, RedisCommandReply, RedisModules, RedisReply, TransformArgumentsReply } from './commands'; -import { RedisLuaScript, RedisLuaScripts } from './lua-script'; import { CommandOptions, isCommandOptions } from './command-options'; +import { RedisCommand, RedisCommandArguments, RedisCommandRawReply, RedisCommandReply, RedisCommands, RedisModules, RedisScript, RedisScripts } from './commands'; type Instantiable = new(...args: Array) => T; -type CommandExecutor = (this: InstanceType, command: RedisCommand, args: Array) => unknown; +interface ExtendWithCommandsConfig { + BaseClass: T; + commands: RedisCommands; + executor(command: RedisCommand, args: Array): unknown; +} -export function extendWithDefaultCommands(BaseClass: T, executor: CommandExecutor): void { - for (const [name, command] of Object.entries(COMMANDS)) { +export function extendWithCommands({ BaseClass, commands, executor }: ExtendWithCommandsConfig): void { + for (const [name, command] of Object.entries(commands)) { BaseClass.prototype[name] = function (...args: Array): unknown { return executor.call(this, command, args); }; } } -interface ExtendWithModulesAndScriptsConfig< - T extends Instantiable, - M extends RedisModules, - S extends RedisLuaScripts -> { +interface ExtendWithModulesAndScriptsConfig { BaseClass: T; - modules: M | undefined; - modulesCommandsExecutor: CommandExecutor; - scripts: S | undefined; - scriptsExecutor(this: InstanceType, script: RedisLuaScript, args: Array): unknown; + modules?: RedisModules; + modulesCommandsExecutor(this: InstanceType, command: RedisCommand, args: Array): unknown; + scripts?: RedisScripts; + scriptsExecutor(this: InstanceType, script: RedisScript, args: Array): unknown; } -export function extendWithModulesAndScripts< - T extends Instantiable, - M extends RedisModules, - S extends RedisLuaScripts, ->(config: ExtendWithModulesAndScriptsConfig): T { +export function extendWithModulesAndScripts(config: ExtendWithModulesAndScriptsConfig): T { let Commander: T | undefined; if (config.modules) { @@ -39,7 +34,7 @@ export function extendWithModulesAndScripts< constructor(...args: Array) { super(...args); - for (const module of Object.keys(config.modules as RedisModules)) { + for (const module of Object.keys(config.modules!)) { this[module] = new this[module](this); } } @@ -79,7 +74,7 @@ export function transformCommandArguments( command: RedisCommand, args: Array ): { - args: TransformArgumentsReply; + args: RedisCommandArguments; options: CommandOptions | undefined; } { let options; @@ -96,7 +91,7 @@ export function transformCommandArguments( const DELIMITER = '\r\n'; -export function* encodeCommand(args: TransformArgumentsReply): IterableIterator { +export function* encodeCommand(args: RedisCommandArguments): IterableIterator { yield `*${args.length}${DELIMITER}`; for (const arg of args) { @@ -107,7 +102,11 @@ export function* encodeCommand(args: TransformArgumentsReply): IterableIterator< } } -export function transformCommandReply(command: RedisCommand, rawReply: RedisReply, preserved: unknown): RedisCommandReply { +export function transformCommandReply( + command: RedisCommand, + rawReply: RedisCommandRawReply, + preserved: unknown +): RedisCommandReply { if (!command.transformReply) { return rawReply; } diff --git a/lib/commands/ACL_DELUSER.ts b/lib/commands/ACL_DELUSER.ts index e83e4d7d0ab..97f50d48945 100644 --- a/lib/commands/ACL_DELUSER.ts +++ b/lib/commands/ACL_DELUSER.ts @@ -1,7 +1,7 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; -export function transformArguments(username: string | Array): TransformArgumentsReply { +export function transformArguments(username: string | Array): RedisCommandArguments { return pushVerdictArguments(['ACL', 'DELUSER'], username); } diff --git a/lib/commands/ACL_SETUSER.ts b/lib/commands/ACL_SETUSER.ts index a590376ab84..d8734f0a1ca 100644 --- a/lib/commands/ACL_SETUSER.ts +++ b/lib/commands/ACL_SETUSER.ts @@ -1,7 +1,7 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; -export function transformArguments(username: string, rule: string | Array): TransformArgumentsReply { +export function transformArguments(username: string, rule: string | Array): RedisCommandArguments { return pushVerdictArguments(['ACL', 'SETUSER', username], rule); } diff --git a/lib/commands/BITOP.ts b/lib/commands/BITOP.ts index 1a750f811ca..af31f42f1dc 100644 --- a/lib/commands/BITOP.ts +++ b/lib/commands/BITOP.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; type BitOperations = 'AND' | 'OR' | 'XOR' | 'NOT'; -export function transformArguments(operation: BitOperations, destKey: string, key: string | Array): TransformArgumentsReply { +export function transformArguments(operation: BitOperations, destKey: string, key: string | Array): RedisCommandArguments { return pushVerdictArguments(['BITOP', operation, destKey], key); } diff --git a/lib/commands/BLPOP.ts b/lib/commands/BLPOP.ts index 1061f5e113a..15c52722941 100644 --- a/lib/commands/BLPOP.ts +++ b/lib/commands/BLPOP.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(keys: string | Buffer | Array, timeout: number): TransformArgumentsReply { +export function transformArguments(keys: string | Buffer | Array, timeout: number): RedisCommandArguments { const args = pushVerdictArguments(['BLPOP'], keys); args.push(timeout.toString()); diff --git a/lib/commands/BRPOP.ts b/lib/commands/BRPOP.ts index 93ded4dbf1a..602ce9c7913 100644 --- a/lib/commands/BRPOP.ts +++ b/lib/commands/BRPOP.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array, timeout: number): TransformArgumentsReply { +export function transformArguments(key: string | Array, timeout: number): RedisCommandArguments { const args = pushVerdictArguments(['BRPOP'], key); args.push(timeout.toString()); diff --git a/lib/commands/BZPOPMAX.ts b/lib/commands/BZPOPMAX.ts index 3db9ca42cbb..eb6647ce9e3 100644 --- a/lib/commands/BZPOPMAX.ts +++ b/lib/commands/BZPOPMAX.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array, timeout: number): TransformArgumentsReply { +export function transformArguments(key: string | Array, timeout: number): RedisCommandArguments { const args = pushVerdictArguments(['BZPOPMAX'], key); args.push(timeout.toString()); diff --git a/lib/commands/BZPOPMIN.ts b/lib/commands/BZPOPMIN.ts index 9106ae770da..75b092e543b 100644 --- a/lib/commands/BZPOPMIN.ts +++ b/lib/commands/BZPOPMIN.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array, timeout: number): TransformArgumentsReply { +export function transformArguments(key: string | Array, timeout: number): RedisCommandArguments { const args = pushVerdictArguments(['BZPOPMIN'], key); args.push(timeout.toString()); diff --git a/lib/commands/CLUSTER_INFO.spec.ts b/lib/commands/CLUSTER_INFO.spec.ts index ce41151b67f..a4def45cb79 100644 --- a/lib/commands/CLUSTER_INFO.spec.ts +++ b/lib/commands/CLUSTER_INFO.spec.ts @@ -1,5 +1,4 @@ import { strict as assert } from 'assert'; -import { itWithCluster, TestRedisClusters } from '../test-utils'; import { transformArguments, transformReply } from './CLUSTER_INFO'; describe('CLUSTER INFO', () => { @@ -44,21 +43,4 @@ describe('CLUSTER INFO', () => { } ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.clusterInfo', async cluster => { - const info = await cluster.clusterInfo(); - assert.equal(info.state, 'ok'); - assert.deepEqual(info.slots, { - assigned: 16384, - ok: 16384, - pfail: 0, - fail: 0 - }); - assert.equal(info.knownNodes, 3); - assert.equal(info.size, 3); - assert.equal(typeof info.currentEpoch, 'number'); - assert.equal(typeof info.myEpoch, 'number'); - assert.equal(typeof info.stats.messagesReceived, 'number'); - assert.equal(typeof info.stats.messagesSent, 'number'); - }); }); diff --git a/lib/commands/CLUSTER_NODES.spec.ts b/lib/commands/CLUSTER_NODES.spec.ts index 1f0e9dd425a..2b3881d8cd0 100644 --- a/lib/commands/CLUSTER_NODES.spec.ts +++ b/lib/commands/CLUSTER_NODES.spec.ts @@ -1,5 +1,4 @@ import { strict as assert } from 'assert'; -import { itWithCluster, TestRedisClusters } from '../test-utils'; import { RedisClusterNodeLinkStates, transformArguments, transformReply } from './CLUSTER_NODES'; describe('CLUSTER NODES', () => { @@ -93,24 +92,4 @@ describe('CLUSTER NODES', () => { ); }); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.clusterNodes', async cluster => { - for (const node of (await cluster.clusterNodes())) { - assert.equal(typeof node.id, 'string'); - assert.equal(typeof node.url, 'string'); - assert.equal(typeof node.host, 'string'); - assert.equal(typeof node.port, 'number'); - assert.equal(typeof node.cport, 'number'); - assert.ok(Array.isArray(node.flags)); - assert.equal(typeof node.pingSent, 'number'); - assert.equal(typeof node.pongRecv, 'number'); - assert.equal(typeof node.configEpoch, 'number'); - assert.equal(typeof node.linkState, 'string'); - - for (const slot of node.slots) { - assert.equal(typeof slot.from, 'number'); - assert.equal(typeof slot.to, 'number'); - } - } - }); }); diff --git a/lib/commands/CLUSTER_SLOTS.ts b/lib/commands/CLUSTER_SLOTS.ts index b4672e731ac..afe1ebc83dd 100644 --- a/lib/commands/CLUSTER_SLOTS.ts +++ b/lib/commands/CLUSTER_SLOTS.ts @@ -1,6 +1,6 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; -export function transformArguments(): TransformArgumentsReply { +export function transformArguments(): RedisCommandArguments { return ['CLUSTER', 'SLOTS']; } diff --git a/lib/commands/COMMAND.ts b/lib/commands/COMMAND.ts index f72cc3f37dd..b6ee50b2f4c 100644 --- a/lib/commands/COMMAND.ts +++ b/lib/commands/COMMAND.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers'; export const IS_READ_ONLY = true; -export function transformArguments(): TransformArgumentsReply { +export function transformArguments(): RedisCommandArguments { return ['COMMAND']; } diff --git a/lib/commands/COMMAND_COUNT.spec.ts b/lib/commands/COMMAND_COUNT.spec.ts index 61ba1bf2540..23e83c71cec 100644 --- a/lib/commands/COMMAND_COUNT.spec.ts +++ b/lib/commands/COMMAND_COUNT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { itWithClient, itWithCluster, TestRedisClusters, TestRedisServers } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './COMMAND_COUNT'; describe('COMMAND COUNT', () => { @@ -16,11 +16,4 @@ describe('COMMAND COUNT', () => { 'number' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.commandCount', async cluster => { - assert.equal( - typeof await cluster.commandCount(), - 'number' - ); - }); }); diff --git a/lib/commands/COMMAND_COUNT.ts b/lib/commands/COMMAND_COUNT.ts index 4cdec7bebf1..5b8283bcc66 100644 --- a/lib/commands/COMMAND_COUNT.ts +++ b/lib/commands/COMMAND_COUNT.ts @@ -1,8 +1,8 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; export const IS_READ_ONLY = true; -export function transformArguments(): TransformArgumentsReply { +export function transformArguments(): RedisCommandArguments { return ['COMMAND', 'COUNT']; } diff --git a/lib/commands/COMMAND_GETKEYS.spec.ts b/lib/commands/COMMAND_GETKEYS.spec.ts index 37e91781589..f2630db9afa 100644 --- a/lib/commands/COMMAND_GETKEYS.spec.ts +++ b/lib/commands/COMMAND_GETKEYS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { itWithClient, itWithCluster, TestRedisClusters, TestRedisServers } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './COMMAND_GETKEYS'; describe('COMMAND GETKEYS', () => { @@ -16,11 +16,4 @@ describe('COMMAND GETKEYS', () => { ['key'] ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.commandGetKeys', async cluster => { - assert.deepEqual( - await cluster.commandGetKeys(['GET', 'key']), - ['key'] - ); - }); }); diff --git a/lib/commands/COMMAND_GETKEYS.ts b/lib/commands/COMMAND_GETKEYS.ts index 0b8f38e3d08..caf342088fb 100644 --- a/lib/commands/COMMAND_GETKEYS.ts +++ b/lib/commands/COMMAND_GETKEYS.ts @@ -1,8 +1,8 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; export const IS_READ_ONLY = true; -export function transformArguments(args: Array): TransformArgumentsReply { +export function transformArguments(args: Array): RedisCommandArguments { return ['COMMAND', 'GETKEYS', ...args]; } diff --git a/lib/commands/COMMAND_INFO.ts b/lib/commands/COMMAND_INFO.ts index 274c57d6aef..6f84d0edaf9 100644 --- a/lib/commands/COMMAND_INFO.ts +++ b/lib/commands/COMMAND_INFO.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers'; export const IS_READ_ONLY = true; -export function transformArguments(commands: Array): TransformArgumentsReply { +export function transformArguments(commands: Array): RedisCommandArguments { return ['COMMAND', 'INFO', ...commands]; } diff --git a/lib/commands/DBSIZE.spec.ts b/lib/commands/DBSIZE.spec.ts index 87e3c154534..36f591dbd29 100644 --- a/lib/commands/DBSIZE.spec.ts +++ b/lib/commands/DBSIZE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './DBSIZE'; describe('DBSIZE', () => { @@ -16,11 +16,4 @@ describe('DBSIZE', () => { 0 ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.dbSize', async cluster => { - assert.equal( - await cluster.dbSize(), - 0 - ); - }); }); diff --git a/lib/commands/DEL.ts b/lib/commands/DEL.ts index b815258df1b..02ef553f647 100644 --- a/lib/commands/DEL.ts +++ b/lib/commands/DEL.ts @@ -1,7 +1,7 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; -export function transformArguments(keys: string | Array): TransformArgumentsReply { +export function transformArguments(keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['DEL'], keys); } diff --git a/lib/commands/ECHO.spec.ts b/lib/commands/ECHO.spec.ts index 4a1bf8fe378..d91b7373950 100644 --- a/lib/commands/ECHO.spec.ts +++ b/lib/commands/ECHO.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './ECHO'; describe('ECHO', () => { @@ -16,11 +16,4 @@ describe('ECHO', () => { 'message' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.echo', async cluster => { - assert.equal( - await cluster.echo('message'), - 'message' - ); - }); }); diff --git a/lib/commands/EXISTS.ts b/lib/commands/EXISTS.ts index 00d10b9eebc..aac164fc953 100644 --- a/lib/commands/EXISTS.ts +++ b/lib/commands/EXISTS.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments, transformReplyBoolean } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(keys: string | Array): TransformArgumentsReply { +export function transformArguments(keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['EXISTS'], keys); } diff --git a/lib/commands/GEOHASH.ts b/lib/commands/GEOHASH.ts index 2ee2c6a6689..8613f37fa43 100644 --- a/lib/commands/GEOHASH.ts +++ b/lib/commands/GEOHASH.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, member: string | Array): RedisCommandArguments { return pushVerdictArguments(['GEOHASH', key], member); } diff --git a/lib/commands/GEOPOS.ts b/lib/commands/GEOPOS.ts index 893048cf6da..95f33d9e3a8 100644 --- a/lib/commands/GEOPOS.ts +++ b/lib/commands/GEOPOS.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, member: string | Array): RedisCommandArguments { return pushVerdictArguments(['GEOPOS', key], member); } diff --git a/lib/commands/GEOSEARCH_WITH.spec.ts b/lib/commands/GEOSEARCH_WITH.spec.ts index a400fb965c6..922c00d7194 100644 --- a/lib/commands/GEOSEARCH_WITH.spec.ts +++ b/lib/commands/GEOSEARCH_WITH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster, describeHandleMinimumRedisVersion } from '../test-utils'; import { GeoReplyWith } from './generic-transformers'; import { transformArguments } from './GEOSEARCH_WITH'; @@ -8,7 +8,7 @@ describe('GEOSEARCH WITH', () => { describeHandleMinimumRedisVersion([6, 2]); it('transformArguments', () => { - const expectedReply: TransformArgumentsReply = ['GEOSEARCH', 'key', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'WITHDIST'] + const expectedReply: RedisCommandArguments = ['GEOSEARCH', 'key', 'FROMMEMBER', 'member', 'BYRADIUS', '1', 'm', 'WITHDIST'] expectedReply.preserve = ['WITHDIST']; assert.deepEqual( diff --git a/lib/commands/GEOSEARCH_WITH.ts b/lib/commands/GEOSEARCH_WITH.ts index ef19ca5dfc9..cd461c9677f 100644 --- a/lib/commands/GEOSEARCH_WITH.ts +++ b/lib/commands/GEOSEARCH_WITH.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { GeoSearchFrom, GeoSearchBy, GeoReplyWith, GeoSearchOptions, transformGeoMembersWithReply } from './generic-transformers'; import { transformArguments as geoSearchTransformArguments } from './GEOSEARCH'; @@ -10,8 +10,8 @@ export function transformArguments( by: GeoSearchBy, replyWith: Array, options?: GeoSearchOptions -): TransformArgumentsReply { - const args: TransformArgumentsReply = geoSearchTransformArguments(key, from, by, options); +): RedisCommandArguments { + const args: RedisCommandArguments = geoSearchTransformArguments(key, from, by, options); args.push(...replyWith); diff --git a/lib/commands/GET.ts b/lib/commands/GET.ts index dbd303d1c65..0e89a4e6a74 100644 --- a/lib/commands/GET.ts +++ b/lib/commands/GET.ts @@ -1,10 +1,10 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string | Buffer): TransformArgumentsReply { +export function transformArguments(key: string | Buffer): RedisCommandArguments { return ['GET', key]; } diff --git a/lib/commands/GETEX.ts b/lib/commands/GETEX.ts index 2c6a4f243f6..cd4f283eee3 100644 --- a/lib/commands/GETEX.ts +++ b/lib/commands/GETEX.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformEXAT, transformPXAT } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -15,7 +15,7 @@ type GetExModes = { PERSIST: true; }; -export function transformArguments(key: string, mode: GetExModes): TransformArgumentsReply { +export function transformArguments(key: string, mode: GetExModes): RedisCommandArguments { const args = ['GETEX', key]; if ('EX' in mode) { diff --git a/lib/commands/HDEL.ts b/lib/commands/HDEL.ts index 75130c87239..58d057ebf10 100644 --- a/lib/commands/HDEL.ts +++ b/lib/commands/HDEL.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, field: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, field: string | Array): RedisCommandArguments { return pushVerdictArguments(['HDEL', key], field); } diff --git a/lib/commands/HMGET.ts b/lib/commands/HMGET.ts index 420102d2b27..7ca3a55b69c 100644 --- a/lib/commands/HMGET.ts +++ b/lib/commands/HMGET.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, fields: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, fields: string | Array): RedisCommandArguments { return pushVerdictArguments(['HMGET', key], fields); } diff --git a/lib/commands/HSET.ts b/lib/commands/HSET.ts index 1aecd50c0d0..1d4acd6c018 100644 --- a/lib/commands/HSET.ts +++ b/lib/commands/HSET.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; type HSETObject = Record; @@ -14,7 +14,7 @@ type SingleFieldArguments = [...generic: GenericArguments, field: string, value: type MultipleFieldsArguments = [...generic: GenericArguments, value: HSETObject | HSETMap | HSETTuples]; -export function transformArguments(...[ key, value, fieldValue ]: SingleFieldArguments | MultipleFieldsArguments): TransformArgumentsReply { +export function transformArguments(...[ key, value, fieldValue ]: SingleFieldArguments | MultipleFieldsArguments): RedisCommandArguments { const args = ['HSET', key]; if (typeof value === 'string') { diff --git a/lib/commands/LASTSAVE.spec.ts b/lib/commands/LASTSAVE.spec.ts index 1b13bed5d20..b8d801f70b5 100644 --- a/lib/commands/LASTSAVE.spec.ts +++ b/lib/commands/LASTSAVE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './LASTSAVE'; describe('LASTSAVE', () => { @@ -13,8 +13,4 @@ describe('LASTSAVE', () => { itWithClient(TestRedisServers.OPEN, 'client.lastSave', async client => { assert.ok((await client.lastSave()) instanceof Date); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.lastSave', async cluster => { - assert.ok((await cluster.lastSave()) instanceof Date); - }); }); diff --git a/lib/commands/LOLWUT.spec.ts b/lib/commands/LOLWUT.spec.ts index 8e77b85b599..8f4478aecc7 100644 --- a/lib/commands/LOLWUT.spec.ts +++ b/lib/commands/LOLWUT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './LOLWUT'; describe('LOLWUT', () => { @@ -25,7 +25,7 @@ describe('LOLWUT', () => { ); }); }); - + itWithClient(TestRedisServers.OPEN, 'client.LOLWUT', async client => { assert.equal( @@ -33,11 +33,4 @@ describe('LOLWUT', () => { 'string' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.LOLWUT', async cluster => { - assert.equal( - typeof (await cluster.LOLWUT()), - 'string' - ); - }); }); diff --git a/lib/commands/LPUSH.ts b/lib/commands/LPUSH.ts index 349affb5e09..b9644344772 100644 --- a/lib/commands/LPUSH.ts +++ b/lib/commands/LPUSH.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, elements: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, elements: string | Array): RedisCommandArguments { return pushVerdictArguments(['LPUSH', key], elements);} export declare function transformReply(): number; diff --git a/lib/commands/LPUSHX.ts b/lib/commands/LPUSHX.ts index 23b8bd9b91b..5f92d84d3b0 100644 --- a/lib/commands/LPUSHX.ts +++ b/lib/commands/LPUSHX.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, element: string | Array): RedisCommandArguments { return pushVerdictArguments(['LPUSHX', key], element); } diff --git a/lib/commands/MEMORY_DOCTOR.spec.ts b/lib/commands/MEMORY_DOCTOR.spec.ts index da883deeb77..1b4d16fa0db 100644 --- a/lib/commands/MEMORY_DOCTOR.spec.ts +++ b/lib/commands/MEMORY_DOCTOR.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './MEMORY_DOCTOR'; describe('MEMORY DOCTOR', () => { @@ -16,11 +16,4 @@ describe('MEMORY DOCTOR', () => { 'string' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.memoryDoctor', async cluster => { - assert.equal( - typeof (await cluster.memoryDoctor()), - 'string' - ); - }); }); diff --git a/lib/commands/MEMORY_MALLOC-STATS.spec.ts b/lib/commands/MEMORY_MALLOC-STATS.spec.ts index 2750ebdf7a0..034b94f7c66 100644 --- a/lib/commands/MEMORY_MALLOC-STATS.spec.ts +++ b/lib/commands/MEMORY_MALLOC-STATS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './MEMORY_MALLOC-STATS'; describe('MEMORY MALLOC-STATS', () => { @@ -16,11 +16,4 @@ describe('MEMORY MALLOC-STATS', () => { 'string' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.memoryDoctor', async cluster => { - assert.equal( - typeof (await cluster.memoryDoctor()), - 'string' - ); - }); }); diff --git a/lib/commands/MEMORY_PURGE.spec.ts b/lib/commands/MEMORY_PURGE.spec.ts index ac9198ccfc8..97ca6feebf6 100644 --- a/lib/commands/MEMORY_PURGE.spec.ts +++ b/lib/commands/MEMORY_PURGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './MEMORY_PURGE'; describe('MEMORY PURGE', () => { @@ -16,11 +16,4 @@ describe('MEMORY PURGE', () => { 'OK' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.memoryPurge', async cluster => { - assert.equal( - await cluster.memoryPurge(), - 'OK' - ); - }); }); diff --git a/lib/commands/MEMORY_USAGE.spec.ts b/lib/commands/MEMORY_USAGE.spec.ts index 7487e7e4ffc..90dff62c674 100644 --- a/lib/commands/MEMORY_USAGE.spec.ts +++ b/lib/commands/MEMORY_USAGE.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './MEMORY_USAGE'; describe('MEMORY USAGE', () => { @@ -27,11 +27,4 @@ describe('MEMORY USAGE', () => { null ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.memoryUsage', async cluster => { - assert.equal( - await cluster.memoryUsage('key'), - null - ); - }); }); diff --git a/lib/commands/PFADD.ts b/lib/commands/PFADD.ts index cc99bed7f65..4328a18dfe5 100644 --- a/lib/commands/PFADD.ts +++ b/lib/commands/PFADD.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments, transformReplyBoolean } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, element: string | Array): RedisCommandArguments { return pushVerdictArguments(['PFADD', key], element); } diff --git a/lib/commands/PFCOUNT.ts b/lib/commands/PFCOUNT.ts index 1fe3b1ee5d2..ec6c0906041 100644 --- a/lib/commands/PFCOUNT.ts +++ b/lib/commands/PFCOUNT.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array): TransformArgumentsReply { +export function transformArguments(key: string | Array): RedisCommandArguments { return pushVerdictArguments(['PFCOUNT'], key); } diff --git a/lib/commands/PFMERGE.ts b/lib/commands/PFMERGE.ts index 86bef6c4d7f..e934062b3fe 100644 --- a/lib/commands/PFMERGE.ts +++ b/lib/commands/PFMERGE.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, source: string | Array): TransformArgumentsReply { +export function transformArguments(destination: string, source: string | Array): RedisCommandArguments { return pushVerdictArguments(['PFMERGE', destination], source); } diff --git a/lib/commands/PING.spec.ts b/lib/commands/PING.spec.ts index 87d9359a36d..43b683f192d 100644 --- a/lib/commands/PING.spec.ts +++ b/lib/commands/PING.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; describe('PING', () => { itWithClient(TestRedisServers.OPEN, 'client.ping', async client => { @@ -8,11 +8,4 @@ describe('PING', () => { 'PONG' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.ping', async cluster => { - assert.equal( - await cluster.ping(), - 'PONG' - ); - }); }); diff --git a/lib/commands/PUBSUB_CHANNELS.spec.ts b/lib/commands/PUBSUB_CHANNELS.spec.ts index 5ff9db60df8..9e148bc7fda 100644 --- a/lib/commands/PUBSUB_CHANNELS.spec.ts +++ b/lib/commands/PUBSUB_CHANNELS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './PUBSUB_CHANNELS'; describe('PUBSUB CHANNELS', () => { @@ -25,11 +25,4 @@ describe('PUBSUB CHANNELS', () => { [] ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubChannels', async cluster => { - assert.deepEqual( - await cluster.pubSubChannels(), - [] - ); - }); }); diff --git a/lib/commands/PUBSUB_NUMPAT.spec.ts b/lib/commands/PUBSUB_NUMPAT.spec.ts index 49a39eedae0..55eef6a97de 100644 --- a/lib/commands/PUBSUB_NUMPAT.spec.ts +++ b/lib/commands/PUBSUB_NUMPAT.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './PUBSUB_NUMPAT'; describe('PUBSUB NUMPAT', () => { @@ -16,11 +16,4 @@ describe('PUBSUB NUMPAT', () => { 0 ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubNumPat', async cluster => { - assert.equal( - await cluster.pubSubNumPat(), - 0 - ); - }); }); diff --git a/lib/commands/PUBSUB_NUMSUB.spec.ts b/lib/commands/PUBSUB_NUMSUB.spec.ts index 403732f8f9d..ef44faf2c0b 100644 --- a/lib/commands/PUBSUB_NUMSUB.spec.ts +++ b/lib/commands/PUBSUB_NUMSUB.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './PUBSUB_NUMSUB'; describe('PUBSUB NUMSUB', () => { @@ -32,11 +32,4 @@ describe('PUBSUB NUMSUB', () => { Object.create(null) ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.pubSubNumSub', async cluster => { - assert.deepEqual( - await cluster.pubSubNumSub(), - Object.create(null) - ); - }); }); diff --git a/lib/commands/RPUSH.ts b/lib/commands/RPUSH.ts index 92df52f03ff..575177755cc 100644 --- a/lib/commands/RPUSH.ts +++ b/lib/commands/RPUSH.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, element: string | Array): RedisCommandArguments { return pushVerdictArguments(['RPUSH', key], element); } diff --git a/lib/commands/RPUSHX.ts b/lib/commands/RPUSHX.ts index 14ad9dc9d50..bacc60d404b 100644 --- a/lib/commands/RPUSHX.ts +++ b/lib/commands/RPUSHX.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, element: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, element: string | Array): RedisCommandArguments { return pushVerdictArguments(['RPUSHX', key], element); } diff --git a/lib/commands/SADD.ts b/lib/commands/SADD.ts index 31623c435ce..05e5a6858f7 100644 --- a/lib/commands/SADD.ts +++ b/lib/commands/SADD.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, members: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, members: string | Array): RedisCommandArguments { return pushVerdictArguments(['SADD', key], members); } diff --git a/lib/commands/SCRIPT_DEBUG.spec.ts b/lib/commands/SCRIPT_DEBUG.spec.ts index 9096605143a..9d2ad1af266 100644 --- a/lib/commands/SCRIPT_DEBUG.spec.ts +++ b/lib/commands/SCRIPT_DEBUG.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './SCRIPT_DEBUG'; describe('SCRIPT DEBUG', () => { @@ -16,11 +16,4 @@ describe('SCRIPT DEBUG', () => { 'OK' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.scriptDebug', async cluster => { - assert.equal( - await cluster.scriptDebug('NO'), - 'OK' - ); - }); }); diff --git a/lib/commands/SCRIPT_EXISTS.spec.ts b/lib/commands/SCRIPT_EXISTS.spec.ts index d03521a5c60..b23380c7579 100644 --- a/lib/commands/SCRIPT_EXISTS.spec.ts +++ b/lib/commands/SCRIPT_EXISTS.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './SCRIPT_EXISTS'; describe('SCRIPT EXISTS', () => { @@ -25,11 +25,4 @@ describe('SCRIPT EXISTS', () => { [false] ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.scriptExists', async cluster => { - assert.deepEqual( - await cluster.scriptExists('sha1'), - [false] - ); - }); }); diff --git a/lib/commands/SCRIPT_EXISTS.ts b/lib/commands/SCRIPT_EXISTS.ts index 47a7f456e9b..ee89f955e50 100644 --- a/lib/commands/SCRIPT_EXISTS.ts +++ b/lib/commands/SCRIPT_EXISTS.ts @@ -1,7 +1,7 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments, transformReplyBooleanArray } from './generic-transformers'; -export function transformArguments(sha1: string | Array): TransformArgumentsReply { +export function transformArguments(sha1: string | Array): RedisCommandArguments { return pushVerdictArguments(['SCRIPT', 'EXISTS'], sha1); } diff --git a/lib/commands/SCRIPT_FLUSH.spec.ts b/lib/commands/SCRIPT_FLUSH.spec.ts index c1321676ebe..c77accb50a9 100644 --- a/lib/commands/SCRIPT_FLUSH.spec.ts +++ b/lib/commands/SCRIPT_FLUSH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './SCRIPT_FLUSH'; describe('SCRIPT FLUSH', () => { @@ -25,11 +25,4 @@ describe('SCRIPT FLUSH', () => { 'OK' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.scriptFlush', async cluster => { - assert.equal( - await cluster.scriptFlush(), - 'OK' - ); - }); }); diff --git a/lib/commands/SCRIPT_LOAD.spec.ts b/lib/commands/SCRIPT_LOAD.spec.ts index 46490f35c8a..1d7da3e9c2d 100644 --- a/lib/commands/SCRIPT_LOAD.spec.ts +++ b/lib/commands/SCRIPT_LOAD.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; import { scriptSha1 } from '../lua-script'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './SCRIPT_LOAD'; describe('SCRIPT LOAD', () => { @@ -20,11 +20,4 @@ describe('SCRIPT LOAD', () => { SCRIPT_SHA1 ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.scriptLoad', async cluster => { - assert.equal( - await cluster.scriptLoad(SCRIPT), - SCRIPT_SHA1 - ); - }); }); diff --git a/lib/commands/SDIFF.ts b/lib/commands/SDIFF.ts index 134bd66ef85..7c1e4fc34a9 100644 --- a/lib/commands/SDIFF.ts +++ b/lib/commands/SDIFF.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(keys: string | Array): TransformArgumentsReply { +export function transformArguments(keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['SDIFF'], keys); } diff --git a/lib/commands/SDIFFSTORE.ts b/lib/commands/SDIFFSTORE.ts index 1c437087c5e..9cca24beb61 100644 --- a/lib/commands/SDIFFSTORE.ts +++ b/lib/commands/SDIFFSTORE.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: string | Array): TransformArgumentsReply { +export function transformArguments(destination: string, keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['SDIFFSTORE', destination], keys); } diff --git a/lib/commands/SET.ts b/lib/commands/SET.ts index 03853b3f7d6..b19a1b2c5c2 100644 --- a/lib/commands/SET.ts +++ b/lib/commands/SET.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; export const FIRST_KEY_INDEX = 1; @@ -40,7 +40,7 @@ interface SetCommonOptions { type SetOptions = SetTTL & SetGuards & (SetCommonOptions | {}); -export function transformArguments(key: string | Buffer, value: string | Buffer, options?: SetOptions): TransformArgumentsReply { +export function transformArguments(key: string | Buffer, value: string | Buffer, options?: SetOptions): RedisCommandArguments { const args = ['SET', key, value]; if (!options) { diff --git a/lib/commands/SETBIT.ts b/lib/commands/SETBIT.ts index 7b96907dfeb..7b0812a55ba 100644 --- a/lib/commands/SETBIT.ts +++ b/lib/commands/SETBIT.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { BitValue } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, offset: number, value: BitValue): TransformArgumentsReply { +export function transformArguments(key: string, offset: number, value: BitValue): RedisCommandArguments { return ['SETBIT', key, offset.toString(), value.toString()]; } diff --git a/lib/commands/SETEX.ts b/lib/commands/SETEX.ts index 0d21479bdc4..89c6e06a3f2 100644 --- a/lib/commands/SETEX.ts +++ b/lib/commands/SETEX.ts @@ -1,8 +1,8 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Buffer, seconds: number, value: string): TransformArgumentsReply { +export function transformArguments(key: string | Buffer, seconds: number, value: string): RedisCommandArguments { return [ 'SETEX', key, diff --git a/lib/commands/SINTER.ts b/lib/commands/SINTER.ts index 6348bbc7ab9..5d74e761f0e 100644 --- a/lib/commands/SINTER.ts +++ b/lib/commands/SINTER.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(keys: string | Array): TransformArgumentsReply { +export function transformArguments(keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['SINTER'], keys); } diff --git a/lib/commands/SINTERSTORE.ts b/lib/commands/SINTERSTORE.ts index 0d31c409da8..40f31a8b7a3 100644 --- a/lib/commands/SINTERSTORE.ts +++ b/lib/commands/SINTERSTORE.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: string | Array): TransformArgumentsReply { +export function transformArguments(destination: string, keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['SINTERSTORE', destination], keys); } diff --git a/lib/commands/SREM.ts b/lib/commands/SREM.ts index 534de170540..9a37ac9bf99 100644 --- a/lib/commands/SREM.ts +++ b/lib/commands/SREM.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, members: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, members: string | Array): RedisCommandArguments { return pushVerdictArguments(['SREM', key], members); } diff --git a/lib/commands/SUNION.ts b/lib/commands/SUNION.ts index 07a46e38efa..ae8b02b481d 100644 --- a/lib/commands/SUNION.ts +++ b/lib/commands/SUNION.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(keys: string | Array): TransformArgumentsReply { +export function transformArguments(keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['SUNION'], keys); } diff --git a/lib/commands/SUNIONSTORE.ts b/lib/commands/SUNIONSTORE.ts index 8745c516433..f259769f49a 100644 --- a/lib/commands/SUNIONSTORE.ts +++ b/lib/commands/SUNIONSTORE.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: string | Array): TransformArgumentsReply { +export function transformArguments(destination: string, keys: string | Array): RedisCommandArguments { return pushVerdictArguments(['SUNIONSTORE', destination], keys); } diff --git a/lib/commands/TOUCH.ts b/lib/commands/TOUCH.ts index 8632d848dbf..a3dc31e8568 100644 --- a/lib/commands/TOUCH.ts +++ b/lib/commands/TOUCH.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array): TransformArgumentsReply { +export function transformArguments(key: string | Array): RedisCommandArguments { return pushVerdictArguments(['TOUCH'], key); } diff --git a/lib/commands/UNLINK.ts b/lib/commands/UNLINK.ts index 2ff87974cfb..467b4172e0f 100644 --- a/lib/commands/UNLINK.ts +++ b/lib/commands/UNLINK.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string | Array): TransformArgumentsReply { +export function transformArguments(key: string | Array): RedisCommandArguments { return pushVerdictArguments(['UNLINK'], key); } diff --git a/lib/commands/UNWATCH.spec.ts b/lib/commands/UNWATCH.spec.ts index 238ffdc59b3..07059310cbc 100644 --- a/lib/commands/UNWATCH.spec.ts +++ b/lib/commands/UNWATCH.spec.ts @@ -1,5 +1,5 @@ import { strict as assert } from 'assert'; -import { TestRedisServers, itWithClient, TestRedisClusters, itWithCluster } from '../test-utils'; +import { TestRedisServers, itWithClient } from '../test-utils'; import { transformArguments } from './UNWATCH'; describe('UNWATCH', () => { @@ -16,11 +16,4 @@ describe('UNWATCH', () => { 'OK' ); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.unwatch', async cluster => { - assert.equal( - await cluster.unwatch(), - 'OK' - ); - }); }); diff --git a/lib/commands/WATCH.ts b/lib/commands/WATCH.ts index 5ca42c0eb95..f66429b507e 100644 --- a/lib/commands/WATCH.ts +++ b/lib/commands/WATCH.ts @@ -1,7 +1,7 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; -export function transformArguments(key: string | Array): TransformArgumentsReply { +export function transformArguments(key: string | Array): RedisCommandArguments { return pushVerdictArguments(['WATCH'], key); } diff --git a/lib/commands/XACK.ts b/lib/commands/XACK.ts index 4573b7f3d25..0d21a0ec085 100644 --- a/lib/commands/XACK.ts +++ b/lib/commands/XACK.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, group: string, id: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, group: string, id: string | Array): RedisCommandArguments { return pushVerdictArguments(['XACK', key, group], id); } diff --git a/lib/commands/XDEL.ts b/lib/commands/XDEL.ts index 187e5b4e73a..892b9a0de5b 100644 --- a/lib/commands/XDEL.ts +++ b/lib/commands/XDEL.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, id: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, id: string | Array): RedisCommandArguments { return pushVerdictArguments(['XDEL', key], id); } diff --git a/lib/commands/ZDIFF.ts b/lib/commands/ZDIFF.ts index 4c5b722131e..a45bf01a526 100644 --- a/lib/commands/ZDIFF.ts +++ b/lib/commands/ZDIFF.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; export const IS_READ_ONLY = true; -export function transformArguments(keys: Array | string): TransformArgumentsReply { +export function transformArguments(keys: Array | string): RedisCommandArguments { return pushVerdictArgument(['ZDIFF'], keys); } diff --git a/lib/commands/ZDIFFSTORE.ts b/lib/commands/ZDIFFSTORE.ts index 95c58c66b9e..9c782b8a5ab 100644 --- a/lib/commands/ZDIFFSTORE.ts +++ b/lib/commands/ZDIFFSTORE.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(destination: string, keys: Array | string): TransformArgumentsReply { +export function transformArguments(destination: string, keys: Array | string): RedisCommandArguments { return pushVerdictArgument(['ZDIFFSTORE', destination], keys); } diff --git a/lib/commands/ZDIFF_WITHSCORES.ts b/lib/commands/ZDIFF_WITHSCORES.ts index 84126853361..49707563546 100644 --- a/lib/commands/ZDIFF_WITHSCORES.ts +++ b/lib/commands/ZDIFF_WITHSCORES.ts @@ -1,10 +1,10 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { transformArguments as transformZDiffArguments } from './ZDIFF'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZDIFF'; -export function transformArguments(...args: Parameters): TransformArgumentsReply { +export function transformArguments(...args: Parameters): RedisCommandArguments { return [ ...transformZDiffArguments(...args), 'WITHSCORES' diff --git a/lib/commands/ZINTER.ts b/lib/commands/ZINTER.ts index ae1b27a6c8d..eee49837386 100644 --- a/lib/commands/ZINTER.ts +++ b/lib/commands/ZINTER.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -10,7 +10,7 @@ interface ZInterOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(keys: Array | string, options?: ZInterOptions): TransformArgumentsReply { +export function transformArguments(keys: Array | string, options?: ZInterOptions): RedisCommandArguments { const args = pushVerdictArgument(['ZINTER'], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZINTERSTORE.ts b/lib/commands/ZINTERSTORE.ts index 496729a774e..59a27e11c51 100644 --- a/lib/commands/ZINTERSTORE.ts +++ b/lib/commands/ZINTERSTORE.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -8,7 +8,7 @@ interface ZInterStoreOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(destination: string, keys: Array | string, options?: ZInterStoreOptions): TransformArgumentsReply { +export function transformArguments(destination: string, keys: Array | string, options?: ZInterStoreOptions): RedisCommandArguments { const args = pushVerdictArgument(['ZINTERSTORE', destination], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZINTER_WITHSCORES.ts b/lib/commands/ZINTER_WITHSCORES.ts index f4287d1a684..f75a506de73 100644 --- a/lib/commands/ZINTER_WITHSCORES.ts +++ b/lib/commands/ZINTER_WITHSCORES.ts @@ -1,10 +1,10 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { transformArguments as transformZInterArguments } from './ZINTER'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZINTER'; -export function transformArguments(...args: Parameters): TransformArgumentsReply { +export function transformArguments(...args: Parameters): RedisCommandArguments { return [ ...transformZInterArguments(...args), 'WITHSCORES' diff --git a/lib/commands/ZMSCORE.ts b/lib/commands/ZMSCORE.ts index 373adac3cf0..2790f712316 100644 --- a/lib/commands/ZMSCORE.ts +++ b/lib/commands/ZMSCORE.ts @@ -1,11 +1,11 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments, transformReplyNumberInfinityNullArray } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; -export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, member: string | Array): RedisCommandArguments { return pushVerdictArguments(['ZMSCORE', key], member); } diff --git a/lib/commands/ZRANGEBYLEX.ts b/lib/commands/ZRANGEBYLEX.ts index 5e4475800c2..7e2e7613b00 100644 --- a/lib/commands/ZRANGEBYLEX.ts +++ b/lib/commands/ZRANGEBYLEX.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformArgumentNumberInfinity } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -17,7 +17,7 @@ export function transformArguments( min: number | string, max: number | string, options?: ZRangeByLexOptions -): TransformArgumentsReply { +): RedisCommandArguments { const args = [ 'ZRANGEBYLEX', key, diff --git a/lib/commands/ZRANGEBYSCORE.ts b/lib/commands/ZRANGEBYSCORE.ts index 1932683f955..48dd8a415c6 100644 --- a/lib/commands/ZRANGEBYSCORE.ts +++ b/lib/commands/ZRANGEBYSCORE.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformArgumentNumberInfinity } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -17,7 +17,7 @@ export function transformArguments( min: number | string, max: number | string, options?: ZRangeByScoreOptions -): TransformArgumentsReply { +): RedisCommandArguments { const args = [ 'ZRANGEBYSCORE', key, diff --git a/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts b/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts index 050ebf58936..f6f7f993cbc 100644 --- a/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts +++ b/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { ZRangeByScoreOptions, transformArguments as transformZRangeByScoreArguments } from './ZRANGEBYSCORE'; @@ -9,7 +9,7 @@ export function transformArguments( min: number | string, max: number | string, options?: ZRangeByScoreOptions -): TransformArgumentsReply { +): RedisCommandArguments { return [ ...transformZRangeByScoreArguments(key, min, max, options), 'WITHSCORES' diff --git a/lib/commands/ZREM.ts b/lib/commands/ZREM.ts index 550a41e8b5c..332289b3fdb 100644 --- a/lib/commands/ZREM.ts +++ b/lib/commands/ZREM.ts @@ -1,9 +1,9 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; -export function transformArguments(key: string, member: string | Array): TransformArgumentsReply { +export function transformArguments(key: string, member: string | Array): RedisCommandArguments { return pushVerdictArguments(['ZREM', key], member); } diff --git a/lib/commands/ZUNION.ts b/lib/commands/ZUNION.ts index 1f0723eb021..2163978470c 100644 --- a/lib/commands/ZUNION.ts +++ b/lib/commands/ZUNION.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 2; @@ -10,7 +10,7 @@ interface ZUnionOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(keys: Array | string, options?: ZUnionOptions): TransformArgumentsReply { +export function transformArguments(keys: Array | string, options?: ZUnionOptions): RedisCommandArguments { const args = pushVerdictArgument(['ZUNION'], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZUNIONSTORE.ts b/lib/commands/ZUNIONSTORE.ts index d0a92b20a60..406f0430c52 100644 --- a/lib/commands/ZUNIONSTORE.ts +++ b/lib/commands/ZUNIONSTORE.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { pushVerdictArgument } from './generic-transformers'; export const FIRST_KEY_INDEX = 1; @@ -8,7 +8,7 @@ interface ZUnionOptions { AGGREGATE?: 'SUM' | 'MIN' | 'MAX'; } -export function transformArguments(destination: string, keys: Array | string, options?: ZUnionOptions): TransformArgumentsReply { +export function transformArguments(destination: string, keys: Array | string, options?: ZUnionOptions): RedisCommandArguments { const args = pushVerdictArgument(['ZUNIONSTORE', destination], keys); if (options?.WEIGHTS) { diff --git a/lib/commands/ZUNION_WITHSCORES.ts b/lib/commands/ZUNION_WITHSCORES.ts index 2215dad9749..d361fd432b0 100644 --- a/lib/commands/ZUNION_WITHSCORES.ts +++ b/lib/commands/ZUNION_WITHSCORES.ts @@ -1,10 +1,10 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; import { transformReplySortedSetWithScores } from './generic-transformers'; import { transformArguments as transformZUnionArguments } from './ZUNION'; export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZUNION'; -export function transformArguments(...args: Parameters): TransformArgumentsReply { +export function transformArguments(...args: Parameters): RedisCommandArguments { return [ ...transformZUnionArguments(...args), 'WITHSCORES' diff --git a/lib/commands/generic-transformers.ts b/lib/commands/generic-transformers.ts index 98e6750f765..a531e86b432 100644 --- a/lib/commands/generic-transformers.ts +++ b/lib/commands/generic-transformers.ts @@ -1,4 +1,4 @@ -import { TransformArgumentsReply } from '.'; +import { RedisCommandArguments } from '.'; export function transformReplyBoolean(reply: number): boolean { return reply === 1; @@ -308,7 +308,7 @@ export function pushStringTuplesArguments(args: Array, tuples: StringTup return args; } -export function pushVerdictArguments(args: TransformArgumentsReply, value: string | Buffer | Array): TransformArgumentsReply { +export function pushVerdictArguments(args: RedisCommandArguments, value: string | Buffer | Array): RedisCommandArguments { if (Array.isArray(value)) { args.push(...value); } else { @@ -318,7 +318,7 @@ export function pushVerdictArguments(args: TransformArgumentsReply, value: strin return args; } -export function pushVerdictArgument(args: TransformArgumentsReply, value: string | Array): TransformArgumentsReply { +export function pushVerdictArgument(args: RedisCommandArguments, value: string | Array): RedisCommandArguments { if (typeof value === 'string') { args.push('1', value); } else { @@ -328,7 +328,7 @@ export function pushVerdictArgument(args: TransformArgumentsReply, value: string return args; } -export function pushOptionalVerdictArgument(args: TransformArgumentsReply, name: string, value: undefined | string | Array): TransformArgumentsReply { +export function pushOptionalVerdictArgument(args: RedisCommandArguments, name: string, value: undefined | string | Array): RedisCommandArguments { if (value === undefined) return args; args.push(name); diff --git a/lib/commands/index.ts b/lib/commands/index.ts index 014aff9e3a6..f88d777c892 100644 --- a/lib/commands/index.ts +++ b/lib/commands/index.ts @@ -1,778 +1,18 @@ -import * as ACL_CAT from './ACL_CAT'; -import * as ACL_DELUSER from './ACL_DELUSER'; -import * as ACL_GENPASS from './ACL_GENPASS'; -import * as ACL_GETUSER from './ACL_GETUSER'; -import * as ACL_LIST from './ACL_LIST'; -import * as ACL_LOAD from './ACL_LOAD'; -import * as ACL_LOG_RESET from './ACL_LOG_RESET'; -import * as ACL_LOG from './ACL_LOG'; -import * as ACL_SAVE from './ACL_SAVE'; -import * as ACL_SETUSER from './ACL_SETUSER'; -import * as ACL_USERS from './ACL_USERS'; -import * as ACL_WHOAMI from './ACL_WHOAMI'; -import * as APPEND from './APPEND'; -import * as ASKING from './ASKING'; -import * as AUTH from './AUTH'; -import * as BGREWRITEAOF from './BGREWRITEAOF'; -import * as BGSAVE from './BGSAVE'; -import * as BITCOUNT from './BITCOUNT'; -import * as BITFIELD from './BITFIELD'; -import * as BITOP from './BITOP'; -import * as BITPOS from './BITPOS'; -import * as BLMOVE from './BLMOVE'; -import * as BLPOP from './BLPOP'; -import * as BRPOP from './BRPOP'; -import * as BRPOPLPUSH from './BRPOPLPUSH'; -import * as BZPOPMAX from './BZPOPMAX'; -import * as BZPOPMIN from './BZPOPMIN'; -import * as CLIENT_ID from './CLIENT_ID'; -import * as CLIENT_INFO from './CLIENT_INFO'; -import * as CLUSTER_ADDSLOTS from './CLUSTER_ADDSLOTS'; -import * as CLUSTER_FLUSHSLOTS from './CLUSTER_FLUSHSLOTS'; -import * as CLUSTER_INFO from './CLUSTER_INFO'; -import * as CLUSTER_NODES from './CLUSTER_NODES'; -import * as CLUSTER_MEET from './CLUSTER_MEET'; -import * as CLUSTER_RESET from './CLUSTER_RESET'; -import * as CLUSTER_SETSLOT from './CLUSTER_SETSLOT'; -import * as CLUSTER_SLOTS from './CLUSTER_SLOTS'; -import * as COMMAND_COUNT from './COMMAND_COUNT'; -import * as COMMAND_GETKEYS from './COMMAND_GETKEYS'; -import * as COMMAND_INFO from './COMMAND_INFO'; -import * as COMMAND from './COMMAND'; -import * as CONFIG_GET from './CONFIG_GET'; -import * as CONFIG_RESETASTAT from './CONFIG_RESETSTAT'; -import * as CONFIG_REWRITE from './CONFIG_REWRITE'; -import * as CONFIG_SET from './CONFIG_SET'; -import * as COPY from './COPY'; -import * as DBSIZE from './DBSIZE'; -import * as DECR from './DECR'; -import * as DECRBY from './DECRBY'; -import * as DEL from './DEL'; -import * as DISCARD from './DISCARD'; -import * as DUMP from './DUMP'; -import * as ECHO from './ECHO'; -import * as EVAL from './EVAL'; -import * as EVALSHA from './EVALSHA'; -import * as EXISTS from './EXISTS'; -import * as EXPIRE from './EXPIRE'; -import * as EXPIREAT from './EXPIREAT'; -import * as FAILOVER from './FAILOVER'; -import * as FLUSHALL from './FLUSHALL'; -import * as FLUSHDB from './FLUSHDB'; -import * as GEOADD from './GEOADD'; -import * as GEODIST from './GEODIST'; -import * as GEOHASH from './GEOHASH'; -import * as GEOPOS from './GEOPOS'; -import * as GEOSEARCH_WITH from './GEOSEARCH_WITH'; -import * as GEOSEARCH from './GEOSEARCH'; -import * as GEOSEARCHSTORE from './GEOSEARCHSTORE'; -import * as GET_BUFFER from './GET_BUFFER'; -import * as GET from './GET'; -import * as GETBIT from './GETBIT'; -import * as GETDEL from './GETDEL'; -import * as GETEX from './GETEX'; -import * as GETRANGE from './GETRANGE'; -import * as GETSET from './GETSET'; -import * as HDEL from './HDEL'; -import * as HELLO from './HELLO'; -import * as HEXISTS from './HEXISTS'; -import * as HGET from './HGET'; -import * as HGETALL from './HGETALL'; -import * as HINCRBY from './HINCRBY'; -import * as HINCRBYFLOAT from './HINCRBYFLOAT'; -import * as HKEYS from './HKEYS'; -import * as HLEN from './HLEN'; -import * as HMGET from './HMGET'; -import * as HRANDFIELD_COUNT_WITHVALUES from './HRANDFIELD_COUNT_WITHVALUES'; -import * as HRANDFIELD_COUNT from './HRANDFIELD_COUNT'; -import * as HRANDFIELD from './HRANDFIELD'; -import * as HSCAN from './HSCAN'; -import * as HSET from './HSET'; -import * as HSETNX from './HSETNX'; -import * as HSTRLEN from './HSTRLEN'; -import * as HVALS from './HVALS'; -import * as INCR from './INCR'; -import * as INCRBY from './INCRBY'; -import * as INCRBYFLOAT from './INCRBYFLOAT'; -import * as INFO from './INFO'; -import * as KEYS from './KEYS'; -import * as LASTSAVE from './LASTSAVE'; -import * as LINDEX from './LINDEX'; -import * as LINSERT from './LINSERT'; -import * as LLEN from './LLEN'; -import * as LMOVE from './LMOVE'; -import * as LOLWUT from './LOLWUT'; -import * as LPOP_COUNT from './LPOP_COUNT'; -import * as LPOP from './LPOP'; -import * as LPOS_COUNT from './LPOS_COUNT'; -import * as LPOS from './LPOS'; -import * as LPUSH from './LPUSH'; -import * as LPUSHX from './LPUSHX'; -import * as LRANGE from './LRANGE'; -import * as LREM from './LREM'; -import * as LSET from './LSET'; -import * as LTRIM from './LTRIM'; -import * as MEMOERY_DOCTOR from './MEMORY_DOCTOR'; -import * as MEMORY_MALLOC_STATS from './MEMORY_MALLOC-STATS'; -import * as MEMORY_PURGE from './MEMORY_PURGE'; -import * as MEMORY_STATS from './MEMORY_STATS'; -import * as MEMORY_USAGE from './MEMORY_USAGE'; -import * as MGET from './MGET'; -import * as MIGRATE from './MIGRATE'; -import * as MODULE_LIST from './MODULE_LIST'; -import * as MODULE_LOAD from './MODULE_LOAD'; -import * as MODULE_UNLOAD from './MODULE_UNLOAD'; -import * as MOVE from './MOVE'; -import * as MSET from './MSET'; -import * as MSETNX from './MSETNX'; -import * as PERSIST from './PERSIST'; -import * as PEXPIRE from './PEXPIRE'; -import * as PEXPIREAT from './PEXPIREAT'; -import * as PFADD from './PFADD'; -import * as PFCOUNT from './PFCOUNT'; -import * as PFMERGE from './PFMERGE'; -import * as PING from './PING'; -import * as PSETEX from './PSETEX'; -import * as PTTL from './PTTL'; -import * as PUBLISH from './PUBLISH'; -import * as PUBSUB_CHANNELS from './PUBSUB_CHANNELS'; -import * as PUBSUB_NUMPAT from './PUBSUB_NUMPAT'; -import * as PUBSUB_NUMSUB from './PUBSUB_NUMSUB'; -import * as RANDOMKEY from './RANDOMKEY'; -import * as READONLY from './READONLY'; -import * as READWRITE from './READWRITE'; -import * as RENAME from './RENAME'; -import * as RENAMENX from './RENAMENX'; -import * as REPLICAOF from './REPLICAOF'; -import * as RESTORE_ASKING from './RESTORE-ASKING'; -import * as ROLE from './ROLE'; -import * as RPOP_COUNT from './RPOP_COUNT'; -import * as RPOP from './RPOP'; -import * as RPOPLPUSH from './RPOPLPUSH'; -import * as RPUSH from './RPUSH'; -import * as RPUSHX from './RPUSHX'; -import * as SADD from './SADD'; -import * as SAVE from './SAVE'; -import * as SCAN from './SCAN'; -import * as SCARD from './SCARD'; -import * as SCRIPT_DEBUG from './SCRIPT_DEBUG'; -import * as SCRIPT_EXISTS from './SCRIPT_EXISTS'; -import * as SCRIPT_FLUSH from './SCRIPT_FLUSH'; -import * as SCRIPT_KILL from './SCRIPT_KILL'; -import * as SCRIPT_LOAD from './SCRIPT_LOAD'; -import * as SDIFF from './SDIFF'; -import * as SDIFFSTORE from './SDIFFSTORE'; -import * as SET from './SET'; -import * as SETBIT from './SETBIT'; -import * as SETEX from './SETEX'; -import * as SETNX from './SETNX'; -import * as SETRANGE from './SETRANGE'; -import * as SHUTDOWN from './SHUTDOWN'; -import * as SINTER from './SINTER'; -import * as SINTERSTORE from './SINTERSTORE'; -import * as SISMEMBER from './SISMEMBER'; -import * as SMEMBERS from './SMEMBERS'; -import * as SMISMEMBER from './SMISMEMBER'; -import * as SMOVE from './SMOVE'; -import * as SORT from './SORT'; -import * as SPOP from './SPOP'; -import * as SRANDMEMBER_COUNT from './SRANDMEMBER_COUNT'; -import * as SRANDMEMBER from './SRANDMEMBER'; -import * as SREM from './SREM'; -import * as SSCAN from './SSCAN'; -import * as STRLEN from './STRLEN'; -import * as SUNION from './SUNION'; -import * as SUNIONSTORE from './SUNIONSTORE'; -import * as SWAPDB from './SWAPDB'; -import * as TIME from './TIME'; -import * as TOUCH from './TOUCH'; -import * as TTL from './TTL'; -import * as TYPE from './TYPE'; -import * as UNLINK from './UNLINK'; -import * as UNWATCH from './UNWATCH'; -import * as WAIT from './WAIT'; -import * as WATCH from './WATCH'; -import * as XACK from './XACK'; -import * as XADD from './XADD'; -import * as XAUTOCLAIM_JUSTID from './XAUTOCLAIM_JUSTID'; -import * as XAUTOCLAIM from './XAUTOCLAIM'; -import * as XCLAIM from './XCLAIM'; -import * as XCLAIM_JUSTID from './XCLAIM_JUSTID'; -import * as XDEL from './XDEL'; -import * as XGROUP_CREATE from './XGROUP_CREATE'; -import * as XGROUP_CREATECONSUMER from './XGROUP_CREATECONSUMER'; -import * as XGROUP_DELCONSUMER from './XGROUP_DELCONSUMER'; -import * as XGROUP_DESTROY from './XGROUP_DESTROY'; -import * as XGROUP_SETID from './XGROUP_SETID'; -import * as XINFO_CONSUMERS from './XINFO_CONSUMERS'; -import * as XINFO_GROUPS from './XINFO_GROUPS'; -import * as XINFO_STREAM from './XINFO_STREAM'; -import * as XLEN from './XLEN'; -import * as XPENDING_RANGE from './XPENDING_RANGE'; -import * as XPENDING from './XPENDING'; -import * as XRANGE from './XRANGE'; -import * as XREAD from './XREAD'; -import * as XREADGROUP from './XREADGROUP'; -import * as XREVRANGE from './XREVRANGE'; -import * as XTRIM from './XTRIM'; -import * as ZADD from './ZADD'; -import * as ZCARD from './ZCARD'; -import * as ZCOUNT from './ZCOUNT'; -import * as ZDIFF_WITHSCORES from './ZDIFF_WITHSCORES'; -import * as ZDIFF from './ZDIFF'; -import * as ZDIFFSTORE from './ZDIFFSTORE'; -import * as ZINCRBY from './ZINCRBY'; -import * as ZINTER_WITHSCORES from './ZINTER_WITHSCORES'; -import * as ZINTER from './ZINTER'; -import * as ZINTERSTORE from './ZINTERSTORE'; -import * as ZLEXCOUNT from './ZLEXCOUNT'; -import * as ZMSCORE from './ZMSCORE'; -import * as ZPOPMAX_COUNT from './ZPOPMAX_COUNT'; -import * as ZPOPMAX from './ZPOPMAX'; -import * as ZPOPMIN_COUNT from './ZPOPMIN_COUNT'; -import * as ZPOPMIN from './ZPOPMIN'; -import * as ZRANDMEMBER_COUNT_WITHSCORES from './ZRANDMEMBER_COUNT_WITHSCORES'; -import * as ZRANDMEMBER_COUNT from './ZRANDMEMBER_COUNT'; -import * as ZRANDMEMBER from './ZRANDMEMBER'; -import * as ZRANGE_WITHSCORES from './ZRANGE_WITHSCORES'; -import * as ZRANGE from './ZRANGE'; -import * as ZRANGEBYLEX from './ZRANGEBYLEX'; -import * as ZRANGEBYSCORE_WITHSCORES from './ZRANGEBYSCORE_WITHSCORES'; -import * as ZRANGEBYSCORE from './ZRANGEBYSCORE'; -import * as ZRANGESTORE from './ZRANGESTORE'; -import * as ZRANK from './ZRANK'; -import * as ZREM from './ZREM'; -import * as ZREMRANGEBYLEX from './ZREMRANGEBYLEX'; -import * as ZREMRANGEBYRANK from './ZREMRANGEBYRANK'; -import * as ZREMRANGEBYSCORE from './ZREMRANGEBYSCORE'; -import * as ZREVRANK from './ZREVRANK'; -import * as ZSCAN from './ZSCAN'; -import * as ZSCORE from './ZSCORE'; -import * as ZUNION_WITHSCORES from './ZUNION_WITHSCORES'; -import * as ZUNION from './ZUNION'; -import * as ZUNIONSTORE from './ZUNIONSTORE'; +import { RedisScriptConfig, SHA1 } from '../lua-script'; -export default { - ACL_CAT, - aclCat: ACL_CAT, - ACL_DELUSER, - aclDelUser: ACL_DELUSER, - ACL_GENPASS, - aclGenPass: ACL_GENPASS, - ACL_GETUSER, - aclGetUser: ACL_GETUSER, - ACL_LIST, - aclList: ACL_LIST, - ACL_LOAD, - aclLoad: ACL_LOAD, - ACL_LOG_RESET, - aclLogReset: ACL_LOG_RESET, - ACL_LOG, - aclLog: ACL_LOG, - ACL_SAVE, - aclSave: ACL_SAVE, - ACL_SETUSER, - aclSetUser: ACL_SETUSER, - ACL_USERS, - aclUsers: ACL_USERS, - ACL_WHOAMI, - aclWhoAmI: ACL_WHOAMI, - APPEND, - append: APPEND, - ASKING, - asking: ASKING, - AUTH, - auth: AUTH, - BGREWRITEAOF, - bgRewriteAof: BGREWRITEAOF, - BGSAVE, - bgSave: BGSAVE, - BITCOUNT, - bitCount: BITCOUNT, - BITFIELD, - bitField: BITFIELD, - BITOP, - bitOp: BITOP, - BITPOS, - bitPos: BITPOS, - BLMOVE, - blMove: BLMOVE, - BLPOP, - blPop: BLPOP, - BRPOP, - brPop: BRPOP, - BRPOPLPUSH, - brPopLPush: BRPOPLPUSH, - BZPOPMAX, - bzPopMax: BZPOPMAX, - BZPOPMIN, - bzPopMin: BZPOPMIN, - CLIENT_ID, - clientId: CLIENT_ID, - CLIENT_INFO, - clientInfo: CLIENT_INFO, - CLUSTER_ADDSLOTS, - clusterAddSlots: CLUSTER_ADDSLOTS, - CLUSTER_FLUSHSLOTS, - clusterFlushSlots: CLUSTER_FLUSHSLOTS, - CLUSTER_INFO, - clusterInfo: CLUSTER_INFO, - CLUSTER_NODES, - clusterNodes: CLUSTER_NODES, - CLUSTER_MEET, - clusterMeet: CLUSTER_MEET, - CLUSTER_RESET, - clusterReset: CLUSTER_RESET, - CLUSTER_SETSLOT, - clusterSetSlot: CLUSTER_SETSLOT, - CLUSTER_SLOTS, - clusterSlots: CLUSTER_SLOTS, - COMMAND_COUNT, - commandCount: COMMAND_COUNT, - COMMAND_GETKEYS, - commandGetKeys: COMMAND_GETKEYS, - COMMAND_INFO, - commandInfo: COMMAND_INFO, - COMMAND, - command: COMMAND, - CONFIG_GET, - configGet: CONFIG_GET, - CONFIG_RESETASTAT, - configResetStat: CONFIG_RESETASTAT, - CONFIG_REWRITE, - configRewrite: CONFIG_REWRITE, - CONFIG_SET, - configSet: CONFIG_SET, - COPY, - copy: COPY, - DBSIZE, - dbSize: DBSIZE, - DECR, - decr: DECR, - DECRBY, - decrBy: DECRBY, - DEL, - del: DEL, - DISCARD, - discard: DISCARD, - DUMP, - dump: DUMP, - ECHO, - echo: ECHO, - EVAL, - eval: EVAL, - EVALSHA, - evalSha: EVALSHA, - EXISTS, - exists: EXISTS, - EXPIRE, - expire: EXPIRE, - EXPIREAT, - expireAt: EXPIREAT, - FAILOVER, - failover: FAILOVER, - FLUSHALL, - flushAll: FLUSHALL, - FLUSHDB, - flushDb: FLUSHDB, - GEOADD, - geoAdd: GEOADD, - GEODIST, - geoDist: GEODIST, - GEOHASH, - geoHash: GEOHASH, - GEOPOS, - geoPos: GEOPOS, - GEOSEARCH_WITH, - geoSearchWith: GEOSEARCH_WITH, - GEOSEARCH, - geoSearch: GEOSEARCH, - GEOSEARCHSTORE, - geoSearchStore: GEOSEARCHSTORE, - GET_BUFFER, - getBuffer: GET_BUFFER, - GET, - get: GET, - GETBIT, - getBit: GETBIT, - GETDEL, - getDel: GETDEL, - GETEX, - getEx: GETEX, - GETRANGE, - getRange: GETRANGE, - GETSET, - getSet: GETSET, - HDEL, - hDel: HDEL, - HELLO, - hello: HELLO, - HEXISTS, - hExists: HEXISTS, - HGET, - hGet: HGET, - HGETALL, - hGetAll: HGETALL, - HINCRBY, - hIncrBy: HINCRBY, - HINCRBYFLOAT, - hIncrByFloat: HINCRBYFLOAT, - HKEYS, - hKeys: HKEYS, - HLEN, - hLen: HLEN, - HMGET, - hmGet: HMGET, - HRANDFIELD_COUNT_WITHVALUES, - hRandFieldCountWithValues: HRANDFIELD_COUNT_WITHVALUES, - HRANDFIELD_COUNT, - hRandFieldCount: HRANDFIELD_COUNT, - HRANDFIELD, - hRandField: HRANDFIELD, - HSCAN, - hScan: HSCAN, - HSET, - hSet: HSET, - HSETNX, - hSetNX: HSETNX, - HSTRLEN, - hStrLen: HSTRLEN, - HVALS, - hVals: HVALS, - INCR, - incr: INCR, - INCRBY, - incrBy: INCRBY, - INCRBYFLOAT, - incrByFloat: INCRBYFLOAT, - INFO, - info: INFO, - KEYS, - keys: KEYS, - LASTSAVE, - lastSave: LASTSAVE, - LINDEX, - lIndex: LINDEX, - LINSERT, - lInsert: LINSERT, - LLEN, - lLen: LLEN, - LMOVE, - lMove: LMOVE, - LOLWUT, - LPOP_COUNT, - lPopCount: LPOP_COUNT, - LPOP, - lPop: LPOP, - LPOS_COUNT, - lPosCount: LPOS_COUNT, - LPOS, - lPos: LPOS, - LPUSH, - lPush: LPUSH, - LPUSHX, - lPushX: LPUSHX, - LRANGE, - lRange: LRANGE, - LREM, - lRem: LREM, - LSET, - lSet: LSET, - LTRIM, - lTrim: LTRIM, - MEMOERY_DOCTOR, - memoryDoctor: MEMOERY_DOCTOR, - 'MEMORY_MALLOC-STATS': MEMORY_MALLOC_STATS, - memoryMallocStats: MEMORY_MALLOC_STATS, - MEMORY_PURGE, - memoryPurge: MEMORY_PURGE, - MEMORY_STATS, - memoryStats: MEMORY_STATS, - MEMORY_USAGE, - memoryUsage: MEMORY_USAGE, - MGET, - mGet: MGET, - MIGRATE, - migrate: MIGRATE, - MODULE_LIST, - moduleList: MODULE_LIST, - MODULE_LOAD, - moduleLoad: MODULE_LOAD, - MODULE_UNLOAD, - moduleUnload: MODULE_UNLOAD, - MOVE, - move: MOVE, - MSET, - mSet: MSET, - MSETNX, - mSetNX: MSETNX, - PERSIST, - persist: PERSIST, - PEXPIRE, - pExpire: PEXPIRE, - PEXPIREAT, - pExpireAt: PEXPIREAT, - PFADD, - pfAdd: PFADD, - PFCOUNT, - pfCount: PFCOUNT, - PFMERGE, - pfMerge: PFMERGE, - PING, - ping: PING, - PSETEX, - pSetEx: PSETEX, - PTTL, - pTTL: PTTL, - PUBLISH, - publish: PUBLISH, - PUBSUB_CHANNELS, - pubSubChannels: PUBSUB_CHANNELS, - PUBSUB_NUMPAT, - pubSubNumPat: PUBSUB_NUMPAT, - PUBSUB_NUMSUB, - pubSubNumSub: PUBSUB_NUMSUB, - RANDOMKEY, - randomKey: RANDOMKEY, - READONLY, - readonly: READONLY, - READWRITE, - readwrite: READWRITE, - RENAME, - rename: RENAME, - RENAMENX, - renameNX: RENAMENX, - REPLICAOF, - replicaOf: REPLICAOF, - 'RESTORE-ASKING': RESTORE_ASKING, - restoreAsking: RESTORE_ASKING, - ROLE, - role: ROLE, - RPOP_COUNT, - rPopCount: RPOP_COUNT, - RPOP, - rPop: RPOP, - RPOPLPUSH, - rPopLPush: RPOPLPUSH, - RPUSH, - rPush: RPUSH, - RPUSHX, - rPushX: RPUSHX, - SADD, - sAdd: SADD, - SAVE, - save: SAVE, - SCAN, - scan: SCAN, - SCARD, - sCard: SCARD, - SCRIPT_DEBUG, - scriptDebug: SCRIPT_DEBUG, - SCRIPT_EXISTS, - scriptExists: SCRIPT_EXISTS, - SCRIPT_FLUSH, - scriptFlush: SCRIPT_FLUSH, - SCRIPT_KILL, - scriptKill: SCRIPT_KILL, - SCRIPT_LOAD, - scriptLoad: SCRIPT_LOAD, - SDIFF, - sDiff: SDIFF, - SDIFFSTORE, - sDiffStore: SDIFFSTORE, - SINTER, - sInter: SINTER, - SINTERSTORE, - sInterStore: SINTERSTORE, - SET, - set: SET, - SETBIT, - setBit: SETBIT, - SETEX, - setEx: SETEX, - SETNX, - setNX: SETNX, - SETRANGE, - setRange: SETRANGE, - SHUTDOWN, - shutdown: SHUTDOWN, - SISMEMBER, - sIsMember: SISMEMBER, - SMEMBERS, - sMembers: SMEMBERS, - SMISMEMBER, - smIsMember: SMISMEMBER, - SMOVE, - sMove: SMOVE, - SORT, - sort: SORT, - SPOP, - sPop: SPOP, - SRANDMEMBER_COUNT, - sRandMemberCount: SRANDMEMBER_COUNT, - SRANDMEMBER, - sRandMember: SRANDMEMBER, - SREM, - sRem: SREM, - SSCAN, - sScan: SSCAN, - STRLEN, - strLen: STRLEN, - SUNION, - sUnion: SUNION, - SUNIONSTORE, - sUnionStore: SUNIONSTORE, - SWAPDB, - swapDb: SWAPDB, - TIME, - time: TIME, - TOUCH, - touch: TOUCH, - TTL, - ttl: TTL, - TYPE, - type: TYPE, - UNLINK, - unlink: UNLINK, - UNWATCH, - unwatch: UNWATCH, - WAIT, - wait: WAIT, - WATCH, - watch: WATCH, - XACK, - xAck: XACK, - XADD, - xAdd: XADD, - XAUTOCLAIM_JUSTID, - xAutoClaimJustId: XAUTOCLAIM_JUSTID, - XAUTOCLAIM, - xAutoClaim: XAUTOCLAIM, - XCLAIM, - xClaim: XCLAIM, - XCLAIM_JUSTID, - xClaimJustId: XCLAIM_JUSTID, - XDEL, - xDel: XDEL, - XGROUP_CREATE, - xGroupCreate: XGROUP_CREATE, - XGROUP_CREATECONSUMER, - xGroupCreateConsumer: XGROUP_CREATECONSUMER, - XGROUP_DELCONSUMER, - xGroupDelConsumer: XGROUP_DELCONSUMER, - XGROUP_DESTROY, - xGroupDestroy: XGROUP_DESTROY, - XGROUP_SETID, - xGroupSetId: XGROUP_SETID, - XINFO_CONSUMERS, - xInfoConsumers: XINFO_CONSUMERS, - XINFO_GROUPS, - xInfoGroups: XINFO_GROUPS, - XINFO_STREAM, - xInfoStream: XINFO_STREAM, - XLEN, - xLen: XLEN, - XPENDING_RANGE, - xPendingRange: XPENDING_RANGE, - XPENDING, - xPending: XPENDING, - XRANGE, - xRange: XRANGE, - XREAD, - xRead: XREAD, - XREADGROUP, - xReadGroup: XREADGROUP, - XREVRANGE, - xRevRange: XREVRANGE, - XTRIM, - xTrim: XTRIM, - ZADD, - zAdd: ZADD, - ZCARD, - zCard: ZCARD, - ZCOUNT, - zCount: ZCOUNT, - ZDIFF_WITHSCORES, - zDiffWithScores: ZDIFF_WITHSCORES, - ZDIFF, - zDiff: ZDIFF, - ZDIFFSTORE, - zDiffStore: ZDIFFSTORE, - ZINCRBY, - zIncrBy: ZINCRBY, - ZINTER_WITHSCORES, - zInterWithScores: ZINTER_WITHSCORES, - ZINTER, - zInter: ZINTER, - ZINTERSTORE, - zInterStore: ZINTERSTORE, - ZLEXCOUNT, - zLexCount: ZLEXCOUNT, - ZMSCORE, - zmScore: ZMSCORE, - ZPOPMAX_COUNT, - zPopMaxCount: ZPOPMAX_COUNT, - ZPOPMAX, - zPopMax: ZPOPMAX, - ZPOPMIN_COUNT, - zPopMinCount: ZPOPMIN_COUNT, - ZPOPMIN, - zPopMin: ZPOPMIN, - ZRANDMEMBER_COUNT_WITHSCORES, - zRandMemberCountWithScores: ZRANDMEMBER_COUNT_WITHSCORES, - ZRANDMEMBER_COUNT, - zRandMemberCount: ZRANDMEMBER_COUNT, - ZRANDMEMBER, - zRandMember: ZRANDMEMBER, - ZRANGE_WITHSCORES, - zRangeWithScores: ZRANGE_WITHSCORES, - ZRANGE, - zRange: ZRANGE, - ZRANGEBYLEX, - zRangeByLex: ZRANGEBYLEX, - ZRANGEBYSCORE_WITHSCORES, - zRangeByScoreWithScores: ZRANGEBYSCORE_WITHSCORES, - ZRANGEBYSCORE, - zRangeByScore: ZRANGEBYSCORE, - ZRANGESTORE, - zRangeStore: ZRANGESTORE, - ZRANK, - zRank: ZRANK, - ZREM, - zRem: ZREM, - ZREMRANGEBYLEX, - zRemRangeByLex: ZREMRANGEBYLEX, - ZREMRANGEBYRANK, - zRemRangeByRank: ZREMRANGEBYRANK, - ZREMRANGEBYSCORE, - zRemRangeByScore: ZREMRANGEBYSCORE, - ZREVRANK, - zRevRank: ZREVRANK, - ZSCAN, - zScan: ZSCAN, - ZSCORE, - zScore: ZSCORE, - ZUNION_WITHSCORES, - zUnionWithScores: ZUNION_WITHSCORES, - ZUNION, - zUnion: ZUNION, - ZUNIONSTORE, - zUnionStore: ZUNIONSTORE -}; +export type RedisCommandRawReply = string | number | Buffer | Array | null | undefined; -export type RedisReply = string | number | Buffer | Array | null | undefined; - -export type TransformArgumentsReply = Array & { preserve?: unknown }; +export type RedisCommandArguments = Array & { preserve?: unknown }; export interface RedisCommand { FIRST_KEY_INDEX?: number | ((...args: Array) => string); IS_READ_ONLY?: boolean; - transformArguments(this: void, ...args: Array): TransformArgumentsReply; + transformArguments(this: void, ...args: Array): RedisCommandArguments; BUFFER_MODE?: boolean; - transformReply?(this: void, reply: RedisReply, preserved?: unknown): any; + transformReply?(this: void, reply: RedisCommandRawReply, preserved?: unknown): any; } -export type RedisCommandReply = C['transformReply'] extends (...args: any) => infer T ? T : RedisReply; +export type RedisCommandReply = C['transformReply'] extends (...args: any) => infer T ? T : RedisCommandRawReply; export interface RedisCommands { [command: string]: RedisCommand; @@ -785,4 +25,14 @@ export interface RedisModule { export interface RedisModules { [module: string]: RedisModule; } -// export type RedisModules = Record; + +export type RedisScript = RedisScriptConfig & SHA1; + +export interface RedisScripts { + [script: string]: RedisScript; +} + +export interface RedisPlugins { + modules?: M; + scripts?: S; +} diff --git a/lib/lua-script.ts b/lib/lua-script.ts index be16f9b9133..3089d468d65 100644 --- a/lib/lua-script.ts +++ b/lib/lua-script.ts @@ -1,7 +1,7 @@ import { createHash } from 'crypto'; import { RedisCommand } from './commands'; -export interface RedisLuaScriptConfig extends RedisCommand { +export interface RedisScriptConfig extends RedisCommand { SCRIPT: string; NUMBER_OF_KEYS: number; } @@ -10,13 +10,7 @@ export interface SHA1 { SHA1: string; } -export type RedisLuaScript = RedisLuaScriptConfig & SHA1; - -export interface RedisLuaScripts { - [script: string]: RedisLuaScript; -} - -export function defineScript(script: RedisLuaScriptConfig): typeof script & SHA1 { +export function defineScript(script: RedisScriptConfig): typeof script & SHA1 { return { ...script, SHA1: scriptSha1(script.SCRIPT) diff --git a/lib/multi-command.spec.ts b/lib/multi-command.spec.ts index 52ecfb94b1c..7e9667cd518 100644 --- a/lib/multi-command.spec.ts +++ b/lib/multi-command.spec.ts @@ -1,126 +1,97 @@ import { strict as assert } from 'assert'; import RedisMultiCommand from './multi-command'; import { WatchError } from './errors'; -import { spy } from 'sinon'; -import { SQUARE_SCRIPT } from './client.spec'; +import { SQUARE_SCRIPT } from './client/index.spec'; describe('Multi Command', () => { - describe('exec', () => { - it('simple', async () => { - const multi = RedisMultiCommand.create((queue, symbol) => { - assert.deepEqual( - queue.map(({ args }) => args), - [ - ['MULTI'], - ['PING'], - ['EXEC'], - ] - ); + it('generateChainId', () => { + assert.equal( + typeof RedisMultiCommand.generateChainId(), + 'symbol' + ); + }); - assert.equal( - typeof symbol, - 'symbol' - ); + it('addCommand', () => { + const multi = new RedisMultiCommand(); + multi.addCommand(['PING']); - return Promise.resolve(['QUEUED', 'QUEUED', ['PONG']]); - }); + assert.deepEqual( + multi.queue[0].args, + ['PING'] + ); + }); - multi.ping(); + it('addScript', () => { + const multi = new RedisMultiCommand(); + + multi.addScript(SQUARE_SCRIPT, ['1']); + assert.equal( + multi.scriptsInUse.has(SQUARE_SCRIPT.SHA1), + true + ); + assert.deepEqual( + multi.queue[0].args, + ['EVAL', SQUARE_SCRIPT.SCRIPT, '0', '1'] + ); + + multi.addScript(SQUARE_SCRIPT, ['2']); + assert.equal( + multi.scriptsInUse.has(SQUARE_SCRIPT.SHA1), + true + ); + assert.deepEqual( + multi.queue[1].args, + ['EVALSHA', SQUARE_SCRIPT.SHA1, '0', '2'] + ); + }); - assert.deepEqual( - await multi.exec(), - ['PONG'] + describe('exec', () => { + it('undefined', () => { + assert.equal( + new RedisMultiCommand().exec(), + undefined ); }); - it('executing an empty queue should resolve without executing on the server', async () => { - const executor = spy(); + it('Array', () => { + const multi = new RedisMultiCommand(); + multi.addCommand(['PING']); assert.deepEqual( - await RedisMultiCommand.create(executor).exec(), - [] + multi.exec(), + [ + { args: ['MULTI'] }, + { args: ['PING'], transformReply: undefined }, + { args: ['EXEC'] } + ] ); - - assert.ok(executor.notCalled); }); + }); + describe('handleExecReplies', () => { it('WatchError', () => { - return assert.rejects( - RedisMultiCommand.create(() => Promise.resolve([null])).ping().exec(), + assert.throws( + () => new RedisMultiCommand().handleExecReplies([null]), WatchError ); }); - it('execAsPipeline', async () => { - const multi = RedisMultiCommand.create(queue => { - assert.deepEqual( - queue.map(({ args }) => args), - [['PING']] - ); - - return Promise.resolve(['PONG']); - }); - - multi.ping(); - + it('with replies', () => { + const multi = new RedisMultiCommand(); + multi.addCommand(['PING']); assert.deepEqual( - await multi.exec(true), + multi.handleExecReplies(['OK', 'QUEUED', ['PONG']]), ['PONG'] ); }); }); - describe('execAsPipeline', () => { - it('simple', async () => { - const multi = RedisMultiCommand.create(queue => { - assert.deepEqual( - queue.map(({ args }) => args), - [['PING']] - ); - - return Promise.resolve(['PONG']); - }); - - multi.ping(); - - assert.deepEqual( - await multi.execAsPipeline(), - ['PONG'] - ); - }); - - it('executing an empty queue should resolve without executing on the server', async () => { - const executor = spy(); - - assert.deepEqual( - await RedisMultiCommand.create(executor).execAsPipeline(), - [] - ); - - assert.ok(executor.notCalled); - }); - - it('with scripts', async () => { - const MultiWithScript = RedisMultiCommand.extend({ - scripts: { - square: SQUARE_SCRIPT - } - }); - - assert.deepEqual( - await new MultiWithScript(queue => { - assert.deepEqual( - queue.map(({ args }) => args), - [ - ['EVAL', SQUARE_SCRIPT.SCRIPT, '0', '2'], - ['EVALSHA', SQUARE_SCRIPT.SHA1, '0', '3'], - ] - ); - - return Promise.resolve([4, 9]); - }).square(2).square(3).execAsPipeline(), - [4, 9] - ); - }); + it('transformReplies', () => { + const multi = new RedisMultiCommand(); + multi.addCommand(['PING'], (reply: string) => reply.substring(0, 2)); + assert.deepEqual( + multi.transformReplies(['PONG']), + ['PO'] + ); }); }); diff --git a/lib/multi-command.ts b/lib/multi-command.ts index a329a5dbf19..d66974a5a21 100644 --- a/lib/multi-command.ts +++ b/lib/multi-command.ts @@ -1,135 +1,36 @@ -import COMMANDS, { TransformArgumentsReply } from './commands'; -import { RedisCommand, RedisModules, RedisReply } from './commands'; -import { RedisLuaScript, RedisLuaScripts } from './lua-script'; -import { RedisClientOptions } from './client'; -import { extendWithModulesAndScripts, extendWithDefaultCommands } from './commander'; +import { RedisCommand, RedisCommandArguments, RedisCommandRawReply, RedisScript } from './commands'; import { WatchError } from './errors'; -type RedisMultiCommandSignature = (...args: Parameters) => RedisMultiCommandType; - -type WithCommands = { - [P in keyof typeof COMMANDS]: RedisMultiCommandSignature<(typeof COMMANDS)[P], M, S> -}; - -type WithModules = { - [P in keyof M]: { - [C in keyof M[P]]: RedisMultiCommandSignature; - }; -}; - -type WithScripts = { - [P in keyof S]: RedisMultiCommandSignature -}; - -export type RedisMultiCommandType = - RedisMultiCommand & WithCommands & WithModules & WithScripts; - -export interface MultiQueuedCommand { - args: TransformArgumentsReply; - preservedArguments?: unknown; +export interface RedisMultiQueuedCommand { + args: RedisCommandArguments; transformReply?: RedisCommand['transformReply']; } -export type RedisMultiExecutor = (queue: Array, chainId?: symbol) => Promise>; - -export default class RedisMultiCommand { - static extend( - clientOptions?: RedisClientOptions - ): new (...args: ConstructorParameters) => RedisMultiCommandType { - return extendWithModulesAndScripts({ - BaseClass: RedisMultiCommand, - modules: clientOptions?.modules, - modulesCommandsExecutor: RedisMultiCommand.prototype.commandsExecutor, - scripts: clientOptions?.scripts, - scriptsExecutor: RedisMultiCommand.prototype.scriptsExecutor - }); - } - - static create( - executor: RedisMultiExecutor, - clientOptions?: RedisClientOptions - ): RedisMultiCommandType { - return new this(executor, clientOptions); - } - - readonly #executor: RedisMultiExecutor; - - readonly #clientOptions: RedisClientOptions | undefined; - - readonly #queue: Array = []; - - readonly #scriptsInUse = new Set(); - - readonly #v4: Record = {}; - - get v4(): Record { - if (!this.#clientOptions?.legacyMode) { - throw new Error('client is not in "legacy mode"'); - } - - return this.#v4; - } - - constructor(executor: RedisMultiExecutor, clientOptions?: RedisClientOptions) { - this.#executor = executor; - this.#clientOptions = clientOptions; - this.#legacyMode(); +export default class RedisMultiCommand { + static generateChainId(): symbol { + return Symbol('RedisMultiCommand Chain Id'); } - #legacyMode(): void { - if (!this.#clientOptions?.legacyMode) return; - - this.#v4.addCommand = this.addCommand.bind(this); - (this as any).addCommand = (...args: Array): this => { - this.#queue.push({ - args: args.flat() as Array - }); - return this; - } - this.#v4.exec = this.exec.bind(this); - (this as any).exec = (callback?: (err: Error | null, replies?: Array) => unknown): void => { - this.#v4.exec() - .then((reply: Array) => { - if (!callback) return; - - callback(null, reply); - }) - .catch((err: Error) => { - if (!callback) { - // this.emit('error', err); - return; - } - - callback(err); - }); - }; - - for (const name of Object.keys(COMMANDS)) { - this.#defineLegacyCommand(name); - } - } + readonly queue: Array = []; - #defineLegacyCommand(name: string): void { - (this as any).#v4[name] = (this as any)[name].bind(this.#v4); - (this as any)[name] = (...args: Array): void => (this as any).addCommand(name, args); - } + readonly scriptsInUse = new Set(); - commandsExecutor(command: RedisCommand, args: Array): this { - return this.addCommand( - command.transformArguments(...args), - command.transformReply - ); + addCommand(args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): void { + this.queue.push({ + args, + transformReply + }); } - scriptsExecutor(script: RedisLuaScript, args: Array): this { - const transformedArguments: TransformArgumentsReply = []; - if (this.#scriptsInUse.has(script.SHA1)) { + addScript(script: RedisScript, args: Array): RedisCommandArguments { + const transformedArguments: RedisCommandArguments = []; + if (this.scriptsInUse.has(script.SHA1)) { transformedArguments.push( 'EVALSHA', script.SHA1 ); } else { - this.#scriptsInUse.add(script.SHA1); + this.scriptsInUse.add(script.SHA1); transformedArguments.push( 'EVAL', script.SCRIPT @@ -144,62 +45,39 @@ export default class RedisMultiCommand> { - if (execAsPipeline) { - return this.execAsPipeline(); - } else if (!this.#queue.length) { - return []; + exec(): undefined | Array { + if (!this.queue.length) { + return; } - const queue = this.#queue.splice(0), - rawReplies = await this.#executor([ - { args: ['MULTI'] }, - ...queue, - { args: ['EXEC'] } - ], Symbol('[RedisMultiCommand] Chain ID')), - execReply = rawReplies[rawReplies.length - 1] as (null | Array); + return [ + { args: ['MULTI'] }, + ...this.queue, + { args: ['EXEC'] } + ]; + } + handleExecReplies(rawReplies: Array): Array { + const execReply = rawReplies[rawReplies.length - 1] as (null | Array); if (execReply === null) { throw new WatchError(); } - return this.#transformReplies(execReply, queue); + return this.transformReplies(execReply); } - async execAsPipeline(): Promise> { - if (!this.#queue.length) { - return []; - } - - const queue = this.#queue.splice(0); - return this.#transformReplies( - await this.#executor(queue), - queue - ); - } - - #transformReplies(rawReplies: Array, queue: Array): Array { + transformReplies(rawReplies: Array): Array { return rawReplies.map((reply, i) => { - const { transformReply, preservedArguments } = queue[i]; - return transformReply ? transformReply(reply, preservedArguments) : reply; + const { transformReply, args } = this.queue[i]; + return transformReply ? transformReply(reply, args.preserve) : reply; }); } } - -extendWithDefaultCommands(RedisMultiCommand, RedisMultiCommand.prototype.commandsExecutor); diff --git a/lib/test-utils.ts b/lib/test-utils.ts index bc3c0514606..978940ff93d 100644 --- a/lib/test-utils.ts +++ b/lib/test-utils.ts @@ -2,15 +2,13 @@ import { strict as assert } from 'assert'; import RedisClient, { RedisClientOptions, RedisClientType } from './client'; import { execSync, spawn } from 'child_process'; import { once } from 'events'; -import { RedisSocketOptions } from './socket'; import which from 'which'; import { SinonSpy } from 'sinon'; import RedisCluster, { RedisClusterOptions, RedisClusterType } from './cluster'; import { promises as fs } from 'fs'; import { Context as MochaContext } from 'mocha'; import { promiseTimeout } from './utils'; -import { RedisModules } from './commands'; -import { RedisLuaScripts } from './lua-script'; +import { RedisModules, RedisScripts } from './commands'; type RedisVersion = [major: number, minor: number, patch: number]; @@ -54,13 +52,13 @@ export enum TestRedisServers { PASSWORD } -export const TEST_REDIS_SERVERS: Record> = {}; +export const TEST_REDIS_SERVERS: Record> = {}; export enum TestRedisClusters { OPEN } -export const TEST_REDIS_CLUSTERES: Record> = {}; +export const TEST_REDIS_CLUSTERES: Record> = {}; let port = 6379; diff --git a/package-lock.json b/package-lock.json index bb840cc6dde..6a7fa380af7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,20 +16,21 @@ }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@tsconfig/node12": "^1.0.9", "@types/mocha": "^9.0.0", - "@types/node": "^16.9.6", - "@types/sinon": "^10.0.3", + "@types/node": "^16.10.3", + "@types/sinon": "^10.0.4", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", - "mocha": "^9.1.1", + "mocha": "^9.1.2", "nyc": "^15.1.0", "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", - "ts-node": "^10.2.1", - "typedoc": "0.21.9", - "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "3.10.4", + "ts-node": "^10.3.0", + "typedoc": "^0.22.5", + "typedoc-github-wiki-theme": "^0.6.0", + "typedoc-plugin-markdown": "^3.11.3", "typescript": "^4.4.3", "which": "^2.0.2" }, @@ -38,9 +39,9 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", + "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", "dev": true, "dependencies": { "@babel/highlight": "^7.14.5" @@ -59,20 +60,20 @@ } }, "node_modules/@babel/core": { - "version": "7.15.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.5.tgz", - "integrity": "sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.8.tgz", + "integrity": "sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", + "@babel/code-frame": "^7.15.8", + "@babel/generator": "^7.15.8", "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.8", "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.5", + "@babel/parser": "^7.15.8", "@babel/template": "^7.15.4", "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4", + "@babel/types": "^7.15.6", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -89,12 +90,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", - "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.8.tgz", + "integrity": "sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g==", "dev": true, "dependencies": { - "@babel/types": "^7.15.4", + "@babel/types": "^7.15.6", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, @@ -183,9 +184,9 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.7.tgz", - "integrity": "sha512-ZNqjjQG/AuFfekFTY+7nY4RgBSklgTu970c7Rj3m/JOhIu5KPBUuTA9AY6zaKcUvk4g6EbDXdBnhi35FAssdSw==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz", + "integrity": "sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.15.4", @@ -370,9 +371,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", - "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.8.tgz", + "integrity": "sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -438,9 +439,9 @@ } }, "node_modules/@cspotcode/source-map-support": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz", - "integrity": "sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", "dev": true, "dependencies": { "@cspotcode/source-map-consumer": "0.8.0" @@ -653,18 +654,18 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "10.6.1", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.6.1.tgz", - "integrity": "sha512-53YKy8w8+sHQhUONhTiYt6MqNqPolejYr6rK/3VOevpORAIYGQEX2pmXnnhgdSsjHy176e5ZBgVt0ppOGziS7g==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz", + "integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==", "dev": true }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "2.16.5", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.5.tgz", - "integrity": "sha512-2PfRGymdBypqRes4Xelu0BAZZRCV/Qg0xgo8UB10UKoghCM+zg640+T5WkRsRD0edwfLBPP3VsJgDyDTG4EIYg==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz", + "integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==", "dev": true, "dependencies": { - "@octokit/types": "^6.31.0" + "@octokit/types": "^6.34.0" }, "peerDependencies": { "@octokit/core": ">=2" @@ -680,12 +681,12 @@ } }, "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "5.11.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.11.3.tgz", - "integrity": "sha512-E19gqHqfP3uJa2/hx6Abhx2NrVP5tsNbst2/AeqGxlGM+eL4N8fRbzhd+NEIsGAB4y3R7e9kVE0y8OOghlXUXw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", + "integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", "dev": true, "dependencies": { - "@octokit/types": "^6.31.1", + "@octokit/types": "^6.34.0", "deprecation": "^2.3.1" }, "peerDependencies": { @@ -693,9 +694,9 @@ } }, "node_modules/@octokit/request": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.1.tgz", - "integrity": "sha512-Ls2cfs1OfXaOKzkcxnqw5MR6drMA/zWX/LIS/p8Yjdz7QKTPQLMsB3R+OvoxE6XnXeXEE2X7xe4G4l4X0gRiKQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.2.tgz", + "integrity": "sha512-je66CvSEVf0jCpRISxkUcCa0UkxmFs6eGDRSbfJtAVwbLH5ceqF+YEyC8lj8ystKyZTy8adWr0qmkY52EfOeLA==", "dev": true, "dependencies": { "@octokit/endpoint": "^6.0.1", @@ -730,12 +731,12 @@ } }, "node_modules/@octokit/types": { - "version": "6.31.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.31.1.tgz", - "integrity": "sha512-xkF46eaYcpT8ieO78mZWhMq3bt37zIsP5BUkN+zWgX+mTYDB7jOtUP1MOxcSF8hhJhsjjlB1YDgQAhX0z0oqPw==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", + "integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", "dev": true, "dependencies": { - "@octokit/openapi-types": "^10.6.1" + "@octokit/openapi-types": "^11.2.0" } }, "node_modules/@sindresorhus/is": { @@ -855,9 +856,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.10.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz", - "integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==", + "version": "16.10.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", + "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==", "dev": true }, "node_modules/@types/parse-json": { @@ -1199,16 +1200,16 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.1.tgz", - "integrity": "sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ==", + "version": "4.17.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.3.tgz", + "integrity": "sha512-59IqHJV5VGdcJZ+GZ2hU5n4Kv3YiASzW6Xk5g9tf5a/MAzGeFwgGWU39fVzNIOVcgB3+Gp+kiQu0HEfTVU/3VQ==", "dev": true, "dependencies": { - "caniuse-lite": "^1.0.30001259", - "electron-to-chromium": "^1.3.846", + "caniuse-lite": "^1.0.30001264", + "electron-to-chromium": "^1.3.857", "escalade": "^3.1.1", - "nanocolors": "^0.1.5", - "node-releases": "^1.1.76" + "node-releases": "^1.1.77", + "picocolors": "^0.2.1" }, "bin": { "browserslist": "cli.js" @@ -1340,9 +1341,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001261", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001261.tgz", - "integrity": "sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA==", + "version": "1.0.30001265", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz", + "integrity": "sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==", "dev": true, "funding": { "type": "opencollective", @@ -1444,9 +1445,9 @@ } }, "node_modules/cli-spinners": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", - "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", "dev": true, "engines": { "node": ">=6" @@ -1789,9 +1790,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.3.854", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.854.tgz", - "integrity": "sha512-00/IIC1mFPkq32MhUJyLdcTp7+wsKK2G3Sb65GSas9FKJQGYkDcZ4GwJkkxf5YyM3ETvl6n+toV8OmtXl4IA/g==", + "version": "1.3.864", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.864.tgz", + "integrity": "sha512-v4rbad8GO6/yVI92WOeU9Wgxc4NA0n4f6P1FvZTY+jyY7JHEhw3bduYu60v3Q1h81Cg6eo4ApZrFPuycwd5hGw==", "dev": true }, "node_modules/emoji-regex": { @@ -2840,9 +2841,9 @@ "dev": true }, "node_modules/istanbul-lib-coverage": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.1.tgz", - "integrity": "sha512-GvCYYTxaCPqwMjobtVcVKvSHtAGe48MNhGjpK8LtVF8K0ISX7hCKl85LgtuaSneWVyQmaGcW3iXVV3GaZSLpmQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true, "engines": { "node": ">=8" @@ -2943,9 +2944,9 @@ } }, "node_modules/istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.3.tgz", + "integrity": "sha512-0i77ZFLsb9U3DHi22WzmIngVzfoyxxbQcZRqlF3KoKmCJGq9nhFHoGi8FqBztN2rE8w6hURnZghetn0xpkVb6A==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -3164,9 +3165,9 @@ "dev": true }, "node_modules/marked": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.4.tgz", - "integrity": "sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.7.tgz", + "integrity": "sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q==", "dev": true, "bin": { "marked": "bin/marked" @@ -3315,12 +3316,6 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "node_modules/nanocolors": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.1.12.tgz", - "integrity": "sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==", - "dev": true - }, "node_modules/nanoid": { "version": "3.1.25", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", @@ -3398,9 +3393,9 @@ } }, "node_modules/node-releases": { - "version": "1.1.76", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", - "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==", + "version": "1.1.77", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz", + "integrity": "sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ==", "dev": true }, "node_modules/normalize-path": { @@ -4062,6 +4057,12 @@ "node": ">=8" } }, + "node_modules/picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true + }, "node_modules/picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", @@ -4159,15 +4160,6 @@ "node": ">=8" } }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -4613,9 +4605,9 @@ } }, "node_modules/rxjs": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.3.0.tgz", - "integrity": "sha512-p2yuGIg9S1epc3vrjKf6iVb3RCaAYjYskkO+jHIaV0IjOPlJop4UnodOoFb2xeNwlguqLYvGw1b1McillYb5Gw==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", "dev": true, "dependencies": { "tslib": "~2.1.0" @@ -5015,12 +5007,12 @@ "dev": true }, "node_modules/ts-node": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz", - "integrity": "sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.3.0.tgz", + "integrity": "sha512-RYIy3i8IgpFH45AX4fQHExrT8BxDeKTdC83QFJkNzkvt8uFB6QJ8XMyhynYiKMLxt9a7yuXaDBZNOYS3XjDcYw==", "dev": true, "dependencies": { - "@cspotcode/source-map-support": "0.6.1", + "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -5040,9 +5032,6 @@ "ts-node-transpile-only": "dist/bin-transpile.js", "ts-script": "dist/bin-script-deprecated.js" }, - "engines": { - "node": ">=12.0.0" - }, "peerDependencies": { "@swc/core": ">=1.2.50", "@swc/wasm": ">=1.2.50", @@ -5101,19 +5090,16 @@ } }, "node_modules/typedoc": { - "version": "0.21.9", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.9.tgz", - "integrity": "sha512-VRo7aII4bnYaBBM1lhw4bQFmUcDQV8m8tqgjtc7oXl87jc1Slbhfw2X5MccfcR2YnEClHDWgsiQGgNB8KJXocA==", + "version": "0.22.5", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.5.tgz", + "integrity": "sha512-KFrWGU1iKiTGw0RcyjLNYDmhd7uICU14HgBNPmFKY/sT4Pm/fraaLyWyisst9vGTUAKxqibqoDITR7+ZcAkhHg==", "dev": true, "dependencies": { - "glob": "^7.1.7", - "handlebars": "^4.7.7", + "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^3.0.2", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shiki": "^0.9.8", - "typedoc-default-themes": "^0.12.10" + "marked": "^3.0.4", + "minimatch": "^3.0.4", + "shiki": "^0.9.11" }, "bin": { "typedoc": "bin/typedoc" @@ -5125,35 +5111,46 @@ "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x" } }, - "node_modules/typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/typedoc-github-wiki-theme": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.5.1.tgz", - "integrity": "sha512-ED2Uc3WUjbv6xIdCkpMz3yBtcEciJnAhDQdRWLYgw4K+FKY0T3PzbI+ssNsBVgwDnYQP/XuaqfZkeQ3EQsOm9g==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.6.0.tgz", + "integrity": "sha512-uHhR7PwAZ4JgO0KzlLocWSvMqKsSZ/wxUQYGKskIepzsotPAQcAWnSSnGi6gdkSw8UAfIIppdD7H1AmI39962w==", "dev": true, "peerDependencies": { - "typedoc": ">=0.20.0", - "typedoc-plugin-markdown": ">=3.4.0" + "typedoc": ">=0.22.0", + "typedoc-plugin-markdown": ">=3.11.0" } }, "node_modules/typedoc-plugin-markdown": { - "version": "3.10.4", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.4.tgz", - "integrity": "sha512-if9w7S9fXLg73AYi/EoRSEhTOZlg3I8mIP8YEmvzSE33VrNXC9/hA0nVcLEwFVJeQY7ay6z67I6kW0KIv7LjeA==", + "version": "3.11.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.3.tgz", + "integrity": "sha512-rWiHbEIe0oZetDIsBR24XJVxGOJ91kDcHoj2KhFKxCLoJGX659EKBQkHne9QJ4W2stGhu1fRgFyQaouSBnxukA==", "dev": true, "dependencies": { "handlebars": "^4.7.7" }, "peerDependencies": { - "typedoc": ">=0.21.2" + "typedoc": ">=0.22.0" + } + }, + "node_modules/typedoc/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/typescript": { @@ -5602,9 +5599,9 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", - "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.15.8.tgz", + "integrity": "sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg==", "dev": true, "requires": { "@babel/highlight": "^7.14.5" @@ -5617,20 +5614,20 @@ "dev": true }, "@babel/core": { - "version": "7.15.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.5.tgz", - "integrity": "sha512-pYgXxiwAgQpgM1bNkZsDEq85f0ggXMA5L7c+o3tskGMh2BunCI9QUwB9Z4jpvXUOuMdyGKiGKQiRe11VS6Jzvg==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.8.tgz", + "integrity": "sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og==", "dev": true, "requires": { - "@babel/code-frame": "^7.14.5", - "@babel/generator": "^7.15.4", + "@babel/code-frame": "^7.15.8", + "@babel/generator": "^7.15.8", "@babel/helper-compilation-targets": "^7.15.4", - "@babel/helper-module-transforms": "^7.15.4", + "@babel/helper-module-transforms": "^7.15.8", "@babel/helpers": "^7.15.4", - "@babel/parser": "^7.15.5", + "@babel/parser": "^7.15.8", "@babel/template": "^7.15.4", "@babel/traverse": "^7.15.4", - "@babel/types": "^7.15.4", + "@babel/types": "^7.15.6", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -5640,12 +5637,12 @@ } }, "@babel/generator": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.4.tgz", - "integrity": "sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.8.tgz", + "integrity": "sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g==", "dev": true, "requires": { - "@babel/types": "^7.15.4", + "@babel/types": "^7.15.6", "jsesc": "^2.5.1", "source-map": "^0.5.0" } @@ -5710,9 +5707,9 @@ } }, "@babel/helper-module-transforms": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.7.tgz", - "integrity": "sha512-ZNqjjQG/AuFfekFTY+7nY4RgBSklgTu970c7Rj3m/JOhIu5KPBUuTA9AY6zaKcUvk4g6EbDXdBnhi35FAssdSw==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz", + "integrity": "sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.15.4", @@ -5857,9 +5854,9 @@ } }, "@babel/parser": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.7.tgz", - "integrity": "sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==", + "version": "7.15.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.8.tgz", + "integrity": "sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA==", "dev": true }, "@babel/template": { @@ -5907,9 +5904,9 @@ "dev": true }, "@cspotcode/source-map-support": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz", - "integrity": "sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", "dev": true, "requires": { "@cspotcode/source-map-consumer": "0.8.0" @@ -6080,18 +6077,18 @@ } }, "@octokit/openapi-types": { - "version": "10.6.1", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-10.6.1.tgz", - "integrity": "sha512-53YKy8w8+sHQhUONhTiYt6MqNqPolejYr6rK/3VOevpORAIYGQEX2pmXnnhgdSsjHy176e5ZBgVt0ppOGziS7g==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz", + "integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==", "dev": true }, "@octokit/plugin-paginate-rest": { - "version": "2.16.5", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.16.5.tgz", - "integrity": "sha512-2PfRGymdBypqRes4Xelu0BAZZRCV/Qg0xgo8UB10UKoghCM+zg640+T5WkRsRD0edwfLBPP3VsJgDyDTG4EIYg==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz", + "integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==", "dev": true, "requires": { - "@octokit/types": "^6.31.0" + "@octokit/types": "^6.34.0" } }, "@octokit/plugin-request-log": { @@ -6102,19 +6099,19 @@ "requires": {} }, "@octokit/plugin-rest-endpoint-methods": { - "version": "5.11.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.11.3.tgz", - "integrity": "sha512-E19gqHqfP3uJa2/hx6Abhx2NrVP5tsNbst2/AeqGxlGM+eL4N8fRbzhd+NEIsGAB4y3R7e9kVE0y8OOghlXUXw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", + "integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", "dev": true, "requires": { - "@octokit/types": "^6.31.1", + "@octokit/types": "^6.34.0", "deprecation": "^2.3.1" } }, "@octokit/request": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.1.tgz", - "integrity": "sha512-Ls2cfs1OfXaOKzkcxnqw5MR6drMA/zWX/LIS/p8Yjdz7QKTPQLMsB3R+OvoxE6XnXeXEE2X7xe4G4l4X0gRiKQ==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.2.tgz", + "integrity": "sha512-je66CvSEVf0jCpRISxkUcCa0UkxmFs6eGDRSbfJtAVwbLH5ceqF+YEyC8lj8ystKyZTy8adWr0qmkY52EfOeLA==", "dev": true, "requires": { "@octokit/endpoint": "^6.0.1", @@ -6149,12 +6146,12 @@ } }, "@octokit/types": { - "version": "6.31.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.31.1.tgz", - "integrity": "sha512-xkF46eaYcpT8ieO78mZWhMq3bt37zIsP5BUkN+zWgX+mTYDB7jOtUP1MOxcSF8hhJhsjjlB1YDgQAhX0z0oqPw==", + "version": "6.34.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", + "integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", "dev": true, "requires": { - "@octokit/openapi-types": "^10.6.1" + "@octokit/openapi-types": "^11.2.0" } }, "@sindresorhus/is": { @@ -6265,9 +6262,9 @@ "dev": true }, "@types/node": { - "version": "16.10.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz", - "integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==", + "version": "16.10.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.3.tgz", + "integrity": "sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==", "dev": true }, "@types/parse-json": { @@ -6530,16 +6527,16 @@ "dev": true }, "browserslist": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.1.tgz", - "integrity": "sha512-aLD0ZMDSnF4lUt4ZDNgqi5BUn9BZ7YdQdI/cYlILrhdSSZJLU9aNZoD5/NBmM4SK34APB2e83MOsRt1EnkuyaQ==", + "version": "4.17.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.3.tgz", + "integrity": "sha512-59IqHJV5VGdcJZ+GZ2hU5n4Kv3YiASzW6Xk5g9tf5a/MAzGeFwgGWU39fVzNIOVcgB3+Gp+kiQu0HEfTVU/3VQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001259", - "electron-to-chromium": "^1.3.846", + "caniuse-lite": "^1.0.30001264", + "electron-to-chromium": "^1.3.857", "escalade": "^3.1.1", - "nanocolors": "^0.1.5", - "node-releases": "^1.1.76" + "node-releases": "^1.1.77", + "picocolors": "^0.2.1" } }, "buffer": { @@ -6625,9 +6622,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001261", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001261.tgz", - "integrity": "sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA==", + "version": "1.0.30001265", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz", + "integrity": "sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==", "dev": true }, "chalk": { @@ -6701,9 +6698,9 @@ } }, "cli-spinners": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz", - "integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", "dev": true }, "cli-width": { @@ -6967,9 +6964,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.854", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.854.tgz", - "integrity": "sha512-00/IIC1mFPkq32MhUJyLdcTp7+wsKK2G3Sb65GSas9FKJQGYkDcZ4GwJkkxf5YyM3ETvl6n+toV8OmtXl4IA/g==", + "version": "1.3.864", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.864.tgz", + "integrity": "sha512-v4rbad8GO6/yVI92WOeU9Wgxc4NA0n4f6P1FvZTY+jyY7JHEhw3bduYu60v3Q1h81Cg6eo4ApZrFPuycwd5hGw==", "dev": true }, "emoji-regex": { @@ -7713,9 +7710,9 @@ "dev": true }, "istanbul-lib-coverage": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.1.tgz", - "integrity": "sha512-GvCYYTxaCPqwMjobtVcVKvSHtAGe48MNhGjpK8LtVF8K0ISX7hCKl85LgtuaSneWVyQmaGcW3iXVV3GaZSLpmQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", "dev": true }, "istanbul-lib-hook": { @@ -7796,9 +7793,9 @@ } }, "istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.3.tgz", + "integrity": "sha512-0i77ZFLsb9U3DHi22WzmIngVzfoyxxbQcZRqlF3KoKmCJGq9nhFHoGi8FqBztN2rE8w6hURnZghetn0xpkVb6A==", "dev": true, "requires": { "html-escaper": "^2.0.0", @@ -7971,9 +7968,9 @@ "dev": true }, "marked": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.4.tgz", - "integrity": "sha512-jBo8AOayNaEcvBhNobg6/BLhdsK3NvnKWJg33MAAPbvTWiG4QBn9gpW1+7RssrKu4K1dKlN+0goVQwV41xEfOA==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.7.tgz", + "integrity": "sha512-ctKqbnLuNbsHbI26cfMyOlKgXGfl1orOv1AvWWDX7AkgfMOwCWvmuYc+mVLeWhQ9W6hdWVBynOs96VkcscKo0Q==", "dev": true }, "merge-stream": { @@ -8084,12 +8081,6 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "nanocolors": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.1.12.tgz", - "integrity": "sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==", - "dev": true - }, "nanoid": { "version": "3.1.25", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", @@ -8151,9 +8142,9 @@ } }, "node-releases": { - "version": "1.1.76", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.76.tgz", - "integrity": "sha512-9/IECtNr8dXNmPWmFXepT0/7o5eolGesHUa3mtr0KlgnCvnZxwh2qensKL42JJY2vQKC3nIBXetFAqR+PW1CmA==", + "version": "1.1.77", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz", + "integrity": "sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ==", "dev": true }, "normalize-path": { @@ -8669,6 +8660,12 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true + }, "picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", @@ -8738,12 +8735,6 @@ "fromentries": "^1.2.0" } }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, "protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -9065,9 +9056,9 @@ } }, "rxjs": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.3.0.tgz", - "integrity": "sha512-p2yuGIg9S1epc3vrjKf6iVb3RCaAYjYskkO+jHIaV0IjOPlJop4UnodOoFb2xeNwlguqLYvGw1b1McillYb5Gw==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.4.0.tgz", + "integrity": "sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==", "dev": true, "requires": { "tslib": "~2.1.0" @@ -9374,12 +9365,12 @@ "dev": true }, "ts-node": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz", - "integrity": "sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.3.0.tgz", + "integrity": "sha512-RYIy3i8IgpFH45AX4fQHExrT8BxDeKTdC83QFJkNzkvt8uFB6QJ8XMyhynYiKMLxt9a7yuXaDBZNOYS3XjDcYw==", "dev": true, "requires": { - "@cspotcode/source-map-support": "0.6.1", + "@cspotcode/source-map-support": "0.7.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -9429,38 +9420,45 @@ } }, "typedoc": { - "version": "0.21.9", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.9.tgz", - "integrity": "sha512-VRo7aII4bnYaBBM1lhw4bQFmUcDQV8m8tqgjtc7oXl87jc1Slbhfw2X5MccfcR2YnEClHDWgsiQGgNB8KJXocA==", + "version": "0.22.5", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.5.tgz", + "integrity": "sha512-KFrWGU1iKiTGw0RcyjLNYDmhd7uICU14HgBNPmFKY/sT4Pm/fraaLyWyisst9vGTUAKxqibqoDITR7+ZcAkhHg==", "dev": true, "requires": { - "glob": "^7.1.7", - "handlebars": "^4.7.7", + "glob": "^7.2.0", "lunr": "^2.3.9", - "marked": "^3.0.2", - "minimatch": "^3.0.0", - "progress": "^2.0.3", - "shiki": "^0.9.8", - "typedoc-default-themes": "^0.12.10" + "marked": "^3.0.4", + "minimatch": "^3.0.4", + "shiki": "^0.9.11" + }, + "dependencies": { + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } } }, - "typedoc-default-themes": { - "version": "0.12.10", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", - "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", - "dev": true - }, "typedoc-github-wiki-theme": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.5.1.tgz", - "integrity": "sha512-ED2Uc3WUjbv6xIdCkpMz3yBtcEciJnAhDQdRWLYgw4K+FKY0T3PzbI+ssNsBVgwDnYQP/XuaqfZkeQ3EQsOm9g==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/typedoc-github-wiki-theme/-/typedoc-github-wiki-theme-0.6.0.tgz", + "integrity": "sha512-uHhR7PwAZ4JgO0KzlLocWSvMqKsSZ/wxUQYGKskIepzsotPAQcAWnSSnGi6gdkSw8UAfIIppdD7H1AmI39962w==", "dev": true, "requires": {} }, "typedoc-plugin-markdown": { - "version": "3.10.4", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.10.4.tgz", - "integrity": "sha512-if9w7S9fXLg73AYi/EoRSEhTOZlg3I8mIP8YEmvzSE33VrNXC9/hA0nVcLEwFVJeQY7ay6z67I6kW0KIv7LjeA==", + "version": "3.11.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.3.tgz", + "integrity": "sha512-rWiHbEIe0oZetDIsBR24XJVxGOJ91kDcHoj2KhFKxCLoJGX659EKBQkHne9QJ4W2stGhu1fRgFyQaouSBnxukA==", "dev": true, "requires": { "handlebars": "^4.7.7" diff --git a/package.json b/package.json index b2ceadbdd16..48c5018c13f 100644 --- a/package.json +++ b/package.json @@ -34,20 +34,21 @@ }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", + "@tsconfig/node12": "^1.0.9", "@types/mocha": "^9.0.0", - "@types/node": "^16.9.6", - "@types/sinon": "^10.0.3", + "@types/node": "^16.10.3", + "@types/sinon": "^10.0.4", "@types/which": "^2.0.1", "@types/yallist": "^4.0.1", - "mocha": "^9.1.1", + "mocha": "^9.1.2", "nyc": "^15.1.0", "release-it": "^14.11.6", "sinon": "^11.1.2", "source-map-support": "^0.5.20", - "ts-node": "^10.2.1", - "typedoc": "0.21.9", - "typedoc-github-wiki-theme": "^0.5.1", - "typedoc-plugin-markdown": "3.10.4", + "ts-node": "^10.3.0", + "typedoc": "^0.22.5", + "typedoc-github-wiki-theme": "^0.6.0", + "typedoc-plugin-markdown": "^3.11.3", "typescript": "^4.4.3", "which": "^2.0.2" }, diff --git a/tsconfig.json b/tsconfig.json index deebc9f1252..1f76310034d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,6 @@ { + "extends": "@tsconfig/node12/tsconfig.json", "compilerOptions": { - "strict": true, - "target": "ES2019", - "lib": ["ES2019", "ES2020.BigInt", "ES2020.String", "ES2020.Symbol.WellKnown"], - "module": "CommonJS", - "moduleResolution": "Node", - "esModuleInterop": true, "outDir": "./dist", "declaration": true, "useDefineForClassFields": true, @@ -27,6 +22,7 @@ "./index.ts", "./lib" ], + "entryPointStrategy": "expand", "exclude": [ "./lib/ts-declarations", "./lib/test-utils.ts" From c650d864d1fc2e48c243ed0cdec50b24b583eb55 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 11 Oct 2021 17:32:15 -0400 Subject: [PATCH 36/40] lock benny version --- benchmark/package-lock.json | 92 +++++++++++++++++++++++++++---------- benchmark/package.json | 2 +- 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/benchmark/package-lock.json b/benchmark/package-lock.json index 49d77a57787..4afaf8c305c 100644 --- a/benchmark/package-lock.json +++ b/benchmark/package-lock.json @@ -7,7 +7,7 @@ "name": "benchmark", "license": "ISC", "dependencies": { - "benny": "^3.7.0", + "benny": "3.6.15", "v3": "npm:redis@3.1.2", "v4": "file:../" } @@ -127,6 +127,14 @@ "node": ">=8" } }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/benchmark": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", @@ -137,21 +145,20 @@ } }, "node_modules/benny": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/benny/-/benny-3.7.0.tgz", - "integrity": "sha512-tfQ8s4qwjfyMvFqe7wSGGel2Pzgl5ytwztS72Xh/ynPKJeXFLQ0sSVL95X9wHpqpXqW13pTHsEMCggrNKgeAoA==", + "version": "3.6.15", + "resolved": "https://registry.npmjs.org/benny/-/benny-3.6.15.tgz", + "integrity": "sha512-kq6XVGGYVou3Y8KNPs3SEF881vi5fJ8sIf9w69D2rreiNfRicWVWK6u6/mObMw6BiexoHHumtipn5gcu0Tngng==", "dependencies": { "@arrows/composition": "^1.0.0", "@arrows/dispatch": "^1.0.2", "@arrows/multimethod": "^1.1.6", "benchmark": "^2.1.4", - "fs-extra": "^10.0.0", - "json2csv": "^5.0.6", - "kleur": "^4.1.4", - "log-update": "^4.0.0" - }, - "engines": { - "node": ">=12" + "fs-extra": "^9.0.1", + "json2csv": "^5.0.4", + "kleur": "^4.1.3", + "log-update": "^4.0.0", + "prettier": "^2.1.2", + "stats-median": "^1.0.1" } }, "node_modules/cli-cursor": { @@ -208,16 +215,17 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dependencies": { + "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=12" + "node": ">=10" } }, "node_modules/graceful-fs": { @@ -331,6 +339,17 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "node_modules/prettier": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/redis-commands": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", @@ -388,6 +407,11 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, + "node_modules/stats-median": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stats-median/-/stats-median-1.0.1.tgz", + "integrity": "sha512-IYsheLg6dasD3zT/w9+8Iq9tcIQqqu91ZIpJOnIEM25C3X/g4Tl8mhXwW2ZQpbrsJISr9+wizEYgsibN5/b32Q==" + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -532,6 +556,11 @@ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==" }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, "benchmark": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", @@ -542,18 +571,20 @@ } }, "benny": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/benny/-/benny-3.7.0.tgz", - "integrity": "sha512-tfQ8s4qwjfyMvFqe7wSGGel2Pzgl5ytwztS72Xh/ynPKJeXFLQ0sSVL95X9wHpqpXqW13pTHsEMCggrNKgeAoA==", + "version": "3.6.15", + "resolved": "https://registry.npmjs.org/benny/-/benny-3.6.15.tgz", + "integrity": "sha512-kq6XVGGYVou3Y8KNPs3SEF881vi5fJ8sIf9w69D2rreiNfRicWVWK6u6/mObMw6BiexoHHumtipn5gcu0Tngng==", "requires": { "@arrows/composition": "^1.0.0", "@arrows/dispatch": "^1.0.2", "@arrows/multimethod": "^1.1.6", "benchmark": "^2.1.4", - "fs-extra": "^10.0.0", - "json2csv": "^5.0.6", - "kleur": "^4.1.4", - "log-update": "^4.0.0" + "fs-extra": "^9.0.1", + "json2csv": "^5.0.4", + "kleur": "^4.1.3", + "log-update": "^4.0.0", + "prettier": "^2.1.2", + "stats-median": "^1.0.1" } }, "cli-cursor": { @@ -598,10 +629,11 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "requires": { + "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" @@ -685,6 +717,11 @@ "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, + "prettier": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==" + }, "redis-commands": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz", @@ -727,6 +764,11 @@ "is-fullwidth-code-point": "^3.0.0" } }, + "stats-median": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stats-median/-/stats-median-1.0.1.tgz", + "integrity": "sha512-IYsheLg6dasD3zT/w9+8Iq9tcIQqqu91ZIpJOnIEM25C3X/g4Tl8mhXwW2ZQpbrsJISr9+wizEYgsibN5/b32Q==" + }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", diff --git a/benchmark/package.json b/benchmark/package.json index f56ad2f23ce..ab874090c4b 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -10,7 +10,7 @@ "author": "", "license": "ISC", "dependencies": { - "benny": "^3.7.0", + "benny": "3.6.15", "v3": "npm:redis@3.1.2", "v4": "file:../" } From 40972582f02acb9b5ebf8ac5c897e2eefa9e9474 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 11 Oct 2021 17:32:49 -0400 Subject: [PATCH 37/40] fix #1674 - remove `isolationPoolOptions` when creating isolated connection --- lib/client/index.ts | 11 ++++++++--- lib/cluster/index.ts | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/client/index.ts b/lib/client/index.ts index 5aeffd365da..1a5384f509f 100644 --- a/lib/client/index.ts +++ b/lib/client/index.ts @@ -147,7 +147,9 @@ export default class RedisClient this.#queue = this.#initiateQueue(); this.#isolationPool = createPool({ create: async () => { - const duplicate = this.duplicate(); + const duplicate = this.duplicate({ + isolationPoolOptions: undefined + }); await duplicate.connect(); return duplicate; }, @@ -269,8 +271,11 @@ export default class RedisClient }; } - duplicate(): RedisClientType { - return new (Object.getPrototypeOf(this).constructor)(this.#options); + duplicate(overrides?: Partial>): RedisClientType { + return new (Object.getPrototypeOf(this).constructor)({ + ...this.#options, + ...overrides + }); } async connect(): Promise { diff --git a/lib/cluster/index.ts b/lib/cluster/index.ts index 4b55a93d4ab..aeaabecae35 100644 --- a/lib/cluster/index.ts +++ b/lib/cluster/index.ts @@ -61,8 +61,11 @@ export default class RedisCluster(): RedisClusterType { - return new (Object.getPrototypeOf(this).constructor)(); + duplicate(overrides?: Partial>): RedisClusterType { + return new (Object.getPrototypeOf(this).constructor)({ + ...this.#options, + ...overrides + }); } async connect(): Promise { From 61cec9d06cc6806fd097bbc94d6d096b000e269a Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 11 Oct 2021 19:15:02 -0400 Subject: [PATCH 38/40] increase test coverage --- lib/cluster/index.spec.ts | 2 +- lib/commands/GEODIST.spec.ts | 32 ++++++++++++++++--- lib/commands/HELLO.ts | 2 +- lib/commands/HSET.spec.ts | 10 +++--- lib/commands/XREAD.spec.ts | 22 +++++++++++-- lib/commands/XREADGROUP.spec.ts | 56 +++++++++++++++++++++------------ lib/commands/ZINTER.ts | 2 +- lib/commands/ZINTERSTORE.ts | 2 +- lib/commands/ZRANGE.spec.ts | 7 +++++ 9 files changed, 97 insertions(+), 38 deletions(-) diff --git a/lib/cluster/index.spec.ts b/lib/cluster/index.spec.ts index f3bf4d8bacb..f2227395385 100644 --- a/lib/cluster/index.spec.ts +++ b/lib/cluster/index.spec.ts @@ -31,7 +31,7 @@ describe('Cluster', () => { itWithCluster(TestRedisClusters.OPEN, 'multi', async cluster => { const key = 'key'; assert.deepEqual( - await cluster.multi(key) + await cluster.multi() .set(key, 'value') .get(key) .exec(), diff --git a/lib/commands/GEODIST.spec.ts b/lib/commands/GEODIST.spec.ts index c1168259312..2cff8ecbd82 100644 --- a/lib/commands/GEODIST.spec.ts +++ b/lib/commands/GEODIST.spec.ts @@ -19,11 +19,33 @@ describe('GEODIST', () => { }); }); - itWithClient(TestRedisServers.OPEN, 'client.geoDist', async client => { - assert.equal( - await client.geoDist('key', '1', '2'), - null - ); + describe('client.geoDist', () => { + itWithClient(TestRedisServers.OPEN, 'null', async client => { + assert.equal( + await client.geoDist('key', '1', '2'), + null + ); + }); + + itWithClient(TestRedisServers.OPEN, 'with value', async client => { + const [, dist] = await Promise.all([ + client.geoAdd('key', [{ + member: '1', + longitude: 1, + latitude: 1 + }, { + member: '2', + longitude: 2, + latitude: 2 + }]), + client.geoDist('key', '1', '2') + ]); + + assert.equal( + dist, + 157270.0561 + ); + }); }); itWithCluster(TestRedisClusters.OPEN, 'cluster.geoDist', async cluster => { diff --git a/lib/commands/HELLO.ts b/lib/commands/HELLO.ts index efb96890fcd..86dae2a1d71 100644 --- a/lib/commands/HELLO.ts +++ b/lib/commands/HELLO.ts @@ -12,7 +12,7 @@ export function transformArguments(options?: HelloOptions): Array { if (options) { args.push(options.protover.toString()); - if (options?.auth) { + if (options.auth) { args.push('AUTH', options.auth.username, options.auth.password); } diff --git a/lib/commands/HSET.spec.ts b/lib/commands/HSET.spec.ts index 601e7f967e1..e8dfe7865d3 100644 --- a/lib/commands/HSET.spec.ts +++ b/lib/commands/HSET.spec.ts @@ -26,12 +26,10 @@ describe('HSET', () => { }); it('Object', () => { - it('Array', () => { - assert.deepEqual( - transformArguments('key', { field: 'value' }), - ['HSET', 'key', 'field', 'value'] - ); - }); + assert.deepEqual( + transformArguments('key', { field: 'value' }), + ['HSET', 'key', 'field', 'value'] + ); }); }); diff --git a/lib/commands/XREAD.spec.ts b/lib/commands/XREAD.spec.ts index e7bf127a90a..501571bfbeb 100644 --- a/lib/commands/XREAD.spec.ts +++ b/lib/commands/XREAD.spec.ts @@ -1,8 +1,24 @@ import { strict as assert } from 'assert'; import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; -import { transformArguments } from './XREAD'; +import { FIRST_KEY_INDEX, transformArguments } from './XREAD'; describe('XREAD', () => { + describe('FIRST_KEY_INDEX', () => { + it('single stream', () => { + assert.equal( + FIRST_KEY_INDEX({ key: 'key', id: '' }), + 'key' + ); + }); + + it('multiple streams', () => { + assert.equal( + FIRST_KEY_INDEX([{ key: '1', id: '' }, { key: '2', id: '' }]), + '1' + ); + }); + }); + describe('transformArguments', () => { it('single stream', () => { assert.deepEqual( @@ -13,13 +29,13 @@ describe('XREAD', () => { ['XREAD', 'STREAMS', 'key', '0'] ); }); - + it('multiple streams', () => { assert.deepEqual( transformArguments([{ key: '1', id: '0' - }, { + }, { key: '2', id: '0' }]), diff --git a/lib/commands/XREADGROUP.spec.ts b/lib/commands/XREADGROUP.spec.ts index 8f7693c333b..8cb3147bfe7 100644 --- a/lib/commands/XREADGROUP.spec.ts +++ b/lib/commands/XREADGROUP.spec.ts @@ -1,8 +1,24 @@ import { strict as assert } from 'assert'; import { TestRedisServers, itWithClient, itWithCluster, TestRedisClusters } from '../test-utils'; -import { transformArguments } from './XREADGROUP'; +import { FIRST_KEY_INDEX, transformArguments } from './XREADGROUP'; describe('XREADGROUP', () => { + describe('FIRST_KEY_INDEX', () => { + it('single stream', () => { + assert.equal( + FIRST_KEY_INDEX('', '', { key: 'key', id: '' }), + 'key' + ); + }); + + it('multiple streams', () => { + assert.equal( + FIRST_KEY_INDEX('', '', [{ key: '1', id: '' }, { key: '2', id: '' }]), + '1' + ); + }); + }); + describe('transformArguments', () => { it('single stream', () => { assert.deepEqual( @@ -78,13 +94,27 @@ describe('XREADGROUP', () => { }); }); - describe('client.xReadGroup', () => { - itWithClient(TestRedisServers.OPEN, 'null', async client => { + itWithClient(TestRedisServers.OPEN, 'null', async client => { + const [, readGroupReply] = await Promise.all([ + client.xGroupCreate('key', 'group', '$', { + MKSTREAM: true + }), + client.xReadGroup('group', 'consumer', { + key: 'key', + id: '>' + }) + ]); + + assert.equal(readGroupReply, null); + }); + + describe('cluster.xReadGroup', () => { + itWithCluster(TestRedisClusters.OPEN, 'null', async cluster => { const [, readGroupReply] = await Promise.all([ - client.xGroupCreate('key', 'group', '$', { + cluster.xGroupCreate('key', 'group', '$', { MKSTREAM: true }), - client.xReadGroup('group', 'consumer', { + cluster.xReadGroup('group', 'consumer', { key: 'key', id: '>' }) @@ -93,7 +123,7 @@ describe('XREADGROUP', () => { assert.equal(readGroupReply, null); }); - itWithClient(TestRedisServers.OPEN, 'with a message', async client => { + itWithCluster(TestRedisClusters.OPEN, 'with a message', async client => { const [, id, readGroupReply] = await Promise.all([ client.xGroupCreate('key', 'group', '$', { MKSTREAM: true @@ -120,18 +150,4 @@ describe('XREADGROUP', () => { }]); }); }); - - itWithCluster(TestRedisClusters.OPEN, 'cluster.xReadGroup', async cluster => { - const [, readGroupReply] = await Promise.all([ - cluster.xGroupCreate('key', 'group', '$', { - MKSTREAM: true - }), - cluster.xReadGroup('group', 'consumer', { - key: 'key', - id: '>' - }) - ]); - - assert.equal(readGroupReply, null); - }); }); diff --git a/lib/commands/ZINTER.ts b/lib/commands/ZINTER.ts index eee49837386..629515b57f9 100644 --- a/lib/commands/ZINTER.ts +++ b/lib/commands/ZINTER.ts @@ -21,7 +21,7 @@ export function transformArguments(keys: Array | string, options?: ZInte } if (options?.AGGREGATE) { - args.push('AGGREGATE', options?.AGGREGATE); + args.push('AGGREGATE', options.AGGREGATE); } return args; diff --git a/lib/commands/ZINTERSTORE.ts b/lib/commands/ZINTERSTORE.ts index 59a27e11c51..e0916e5b14a 100644 --- a/lib/commands/ZINTERSTORE.ts +++ b/lib/commands/ZINTERSTORE.ts @@ -19,7 +19,7 @@ export function transformArguments(destination: string, keys: Array | st } if (options?.AGGREGATE) { - args.push('AGGREGATE', options?.AGGREGATE); + args.push('AGGREGATE', options.AGGREGATE); } return args; diff --git a/lib/commands/ZRANGE.spec.ts b/lib/commands/ZRANGE.spec.ts index 72d83931ff4..7347ed0ad09 100644 --- a/lib/commands/ZRANGE.spec.ts +++ b/lib/commands/ZRANGE.spec.ts @@ -11,6 +11,13 @@ describe('ZRANGE', () => { ); }); + it('using strings', () => { + assert.deepEqual( + transformArguments('src', '0', '1'), + ['ZRANGE', 'src', '0', '1'] + ); + }); + it('with BYSCORE', () => { assert.deepEqual( transformArguments('src', 0, 1, { From b0f657c74762a2f5c87bbe27ed3d160b0dd8fbd9 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 11 Oct 2021 19:34:23 -0400 Subject: [PATCH 39/40] update .npmignore --- .npmignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index fa2d8841124..e3fc1a7731d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,12 +1,13 @@ .vscode/ .idea/ node_modules/ -.nyc_output +.nyc_output/ coverage/ dump.rdb documentation/ CONTRIBUTING.md tsconfig.json +.deepsource.toml .nycrc.json benchmark/ .github/ From 235db19f795d18ca620def083e2230a36b889858 Mon Sep 17 00:00:00 2001 From: leibale Date: Mon, 11 Oct 2021 19:36:46 -0400 Subject: [PATCH 40/40] Release 4.0.0-rc.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a7fa380af7..f47208d6c9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "redis", - "version": "4.0.0-rc.2", + "version": "4.0.0-rc.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "redis", - "version": "4.0.0-rc.2", + "version": "4.0.0-rc.3", "license": "MIT", "dependencies": { "cluster-key-slot": "1.1.0", diff --git a/package.json b/package.json index 48c5018c13f..7f8720f47bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redis", - "version": "4.0.0-rc.2", + "version": "4.0.0-rc.3", "description": "A high performance Redis client.", "keywords": [ "database",