Socket
Socket
Sign inDemoInstall

@redis/client

Package Overview
Dependencies
3
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

2

dist/lib/client/index.d.ts

@@ -87,3 +87,3 @@ /// <reference types="node" />

multi(): RedisClientMultiCommandType<M, F, S>;
multiExecutor(commands: Array<RedisMultiQueuedCommand>, chainId?: symbol): Promise<Array<RedisCommandRawReply>>;
multiExecutor(commands: Array<RedisMultiQueuedCommand>, selectedDB?: number, chainId?: symbol): Promise<Array<RedisCommandRawReply>>;
scanIterator(options?: ScanCommandOptions): AsyncIterable<string>;

@@ -90,0 +90,0 @@ hScanIterator(key: string, options?: ScanOptions): AsyncIterable<ConvertArgumentType<HScanTuple, string>>;

@@ -242,10 +242,12 @@ "use strict";

}
multiExecutor(commands, chainId) {
async multiExecutor(commands, selectedDB, chainId) {
const promise = Promise.all(commands.map(({ args }) => {
return __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(args, RedisClient.commandOptions({
chainId
}));
return __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(args, { chainId });
}));
__classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this);
return promise;
const results = await promise;
if (selectedDB !== undefined) {
__classPrivateFieldSet(this, _RedisClient_selectedDB, selectedDB, "f");
}
return results;
}

@@ -252,0 +254,0 @@ async *scanIterator(options) {

@@ -23,3 +23,3 @@ import COMMANDS from './commands';

declare type InstantiableRedisMultiCommand<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = new (...args: ConstructorParameters<typeof RedisClientMultiCommand>) => RedisClientMultiCommandType<M, F, S>;
export declare type RedisClientMultiExecutor = (queue: Array<RedisMultiQueuedCommand>, chainId?: symbol) => Promise<Array<RedisCommandRawReply>>;
export declare type RedisClientMultiExecutor = (queue: Array<RedisMultiQueuedCommand>, selectedDB?: number, chainId?: symbol) => Promise<Array<RedisCommandRawReply>>;
export default class RedisClientMultiCommand {

@@ -31,2 +31,4 @@ #private;

commandsExecutor(command: RedisCommand, args: Array<unknown>): this;
SELECT(db: number, transformReply?: RedisCommand['transformReply']): this;
select: (db: number, transformReply?: RedisCommand['transformReply']) => this;
addCommand(args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): this;

@@ -33,0 +35,0 @@ functionsExecutor(fn: RedisFunction, args: Array<unknown>, name: string): this;

@@ -13,3 +13,3 @@ "use strict";

};
var _RedisClientMultiCommand_instances, _RedisClientMultiCommand_multi, _RedisClientMultiCommand_executor, _RedisClientMultiCommand_legacyMode, _RedisClientMultiCommand_defineLegacyCommand;
var _RedisClientMultiCommand_instances, _RedisClientMultiCommand_multi, _RedisClientMultiCommand_executor, _RedisClientMultiCommand_selectedDB, _RedisClientMultiCommand_legacyMode, _RedisClientMultiCommand_defineLegacyCommand;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -30,2 +30,9 @@ const commands_1 = require("./commands");

});
_RedisClientMultiCommand_selectedDB.set(this, void 0);
Object.defineProperty(this, "select", {
enumerable: true,
configurable: true,
writable: true,
value: this.SELECT
});
Object.defineProperty(this, "EXEC", {

@@ -56,2 +63,6 @@ enumerable: true,

}
SELECT(db, transformReply) {
__classPrivateFieldSet(this, _RedisClientMultiCommand_selectedDB, db, "f");
return this.addCommand(['SELECT', db.toString()], transformReply);
}
addCommand(args, transformReply) {

@@ -76,10 +87,10 @@ __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").addCommand(args, transformReply);

return [];
return __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").handleExecReplies(await __classPrivateFieldGet(this, _RedisClientMultiCommand_executor, "f").call(this, commands, multi_command_1.default.generateChainId()));
return __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").handleExecReplies(await __classPrivateFieldGet(this, _RedisClientMultiCommand_executor, "f").call(this, commands, __classPrivateFieldGet(this, _RedisClientMultiCommand_selectedDB, "f"), multi_command_1.default.generateChainId()));
}
async execAsPipeline() {
return __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").transformReplies(await __classPrivateFieldGet(this, _RedisClientMultiCommand_executor, "f").call(this, __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").queue));
return __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").transformReplies(await __classPrivateFieldGet(this, _RedisClientMultiCommand_executor, "f").call(this, __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").queue, __classPrivateFieldGet(this, _RedisClientMultiCommand_selectedDB, "f")));
}
}
exports.default = RedisClientMultiCommand;
_RedisClientMultiCommand_multi = new WeakMap(), _RedisClientMultiCommand_executor = new WeakMap(), _RedisClientMultiCommand_instances = new WeakSet(), _RedisClientMultiCommand_legacyMode = function _RedisClientMultiCommand_legacyMode() {
_RedisClientMultiCommand_multi = new WeakMap(), _RedisClientMultiCommand_executor = new WeakMap(), _RedisClientMultiCommand_selectedDB = new WeakMap(), _RedisClientMultiCommand_instances = new WeakSet(), _RedisClientMultiCommand_legacyMode = function _RedisClientMultiCommand_legacyMode() {
this.v4.addCommand = this.addCommand.bind(this);

@@ -86,0 +97,0 @@ this.addCommand = (...args) => {

@@ -83,3 +83,3 @@ "use strict";

return new (__classPrivateFieldGet(this, _RedisCluster_Multi, "f"))((commands, firstKey, chainId) => {
return __classPrivateFieldGet(this, _RedisCluster_instances, "m", _RedisCluster_execute).call(this, firstKey, false, client => client.multiExecutor(commands, chainId));
return __classPrivateFieldGet(this, _RedisCluster_instances, "m", _RedisCluster_execute).call(this, firstKey, false, client => client.multiExecutor(commands, undefined, chainId));
}, routing);

@@ -86,0 +86,0 @@ }

@@ -8,4 +8,3 @@ "use strict";

if (typeof value === 'string' || typeof value === 'number' || Buffer.isBuffer(value)) {
pushValue(args, value);
pushValue(args, fieldValue);
args.push(convertValue(value), convertValue(fieldValue));
}

@@ -26,4 +25,3 @@ else if (value instanceof Map) {

for (const [key, value] of map.entries()) {
pushValue(args, key);
pushValue(args, value);
args.push(convertValue(key), convertValue(value));
}

@@ -37,3 +35,3 @@ }

}
pushValue(args, tuple);
args.push(convertValue(tuple));
}

@@ -43,9 +41,9 @@ }

for (const key of Object.keys(object)) {
args.push(key.toString(), object[key].toString());
args.push(convertValue(key), convertValue(object[key]));
}
}
function pushValue(args, value) {
args.push(typeof value === 'number' ?
function convertValue(value) {
return typeof value === 'number' ?
value.toString() :
value);
value;
}
{
"name": "@redis/client",
"version": "1.1.1",
"version": "1.2.0",
"license": "MIT",

@@ -24,15 +24,15 @@ "main": "./dist/index.js",

"@redis/test-utils": "*",
"@types/node": "^17.0.31",
"@types/sinon": "^10.0.11",
"@types/node": "^18.0.1",
"@types/sinon": "^10.0.12",
"@types/yallist": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"eslint": "^8.14.0",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"eslint": "^8.19.0",
"nyc": "^15.1.0",
"release-it": "^15.0.0",
"sinon": "^13.0.2",
"release-it": "^15.1.1",
"sinon": "^14.0.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.7.0",
"typedoc": "^0.22.15",
"typescript": "^4.6.4"
"ts-node": "^10.8.2",
"typedoc": "^0.23.5",
"typescript": "^4.7.4"
},

@@ -39,0 +39,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc