= {
- [P in keyof M as ExcludeMappedString]: {
- [C in keyof M[P] as ExcludeMappedString]: RedisCommandSignature;
- };
-};
-export type WithFunctions = {
- [P in keyof F as ExcludeMappedString]: {
- [FF in keyof F[P] as ExcludeMappedString]: RedisCommandSignature;
- };
-};
-export type WithScripts = {
- [P in keyof S as ExcludeMappedString]: RedisCommandSignature;
-};
-export type RedisClientType, F extends RedisFunctions = Record, S extends RedisScripts = Record> = RedisClient & WithCommands & WithModules & WithFunctions & WithScripts;
-export type InstantiableRedisClient = new (options?: RedisClientOptions) => RedisClientType;
-export interface ClientCommandOptions extends QueueCommandOptions {
- isolated?: boolean;
-}
-export default class RedisClient extends EventEmitter {
- #private;
- static commandOptions(options: T): CommandOptions;
- commandOptions: typeof RedisClient.commandOptions;
- static extend(extensions?: RedisExtensions): InstantiableRedisClient;
- static create(options?: RedisClientOptions): RedisClientType;
- static parseURL(url: string): RedisClientOptions;
- get options(): RedisClientOptions | undefined;
- get isOpen(): boolean;
- get isReady(): boolean;
- get isPubSubActive(): boolean;
- get v4(): Record;
- constructor(options?: RedisClientOptions);
- duplicate(overrides?: Partial>): RedisClientType;
- connect(): Promise>;
- commandsExecutor(command: C, args: Array): Promise>;
- sendCommand(args: RedisCommandArguments, options?: ClientCommandOptions): Promise;
- functionsExecuter(fn: F, args: Array, name: string): Promise>;
- executeFunction(name: string, fn: RedisFunction, args: RedisCommandArguments, options?: ClientCommandOptions): Promise;
- scriptsExecuter(script: S, args: Array): Promise>;
- executeScript(script: RedisScript, args: RedisCommandArguments, options?: ClientCommandOptions): Promise;
- SELECT(db: number): Promise;
- SELECT(options: CommandOptions, db: number): Promise;
- select: {
- (db: number): Promise;
- (options: CommandOptions, db: number): Promise;
- };
- SUBSCRIBE(channels: string | Array, listener: PubSubListener, bufferMode?: T): Promise;
- subscribe: (channels: string | Array, listener: PubSubListener, bufferMode?: T | undefined) => Promise;
- UNSUBSCRIBE(channels?: string | Array, listener?: PubSubListener, bufferMode?: T): Promise;
- unsubscribe: (channels?: string | Array, listener?: PubSubListener | undefined, bufferMode?: T | undefined) => Promise;
- PSUBSCRIBE(patterns: string | Array, listener: PubSubListener, bufferMode?: T): Promise;
- pSubscribe: (patterns: string | Array, listener: PubSubListener, bufferMode?: T | undefined) => Promise;
- PUNSUBSCRIBE(patterns?: string | Array, listener?: PubSubListener, bufferMode?: T): Promise;
- pUnsubscribe: (patterns?: string | Array, listener?: PubSubListener | undefined, bufferMode?: T | undefined) => Promise;
- SSUBSCRIBE(channels: string | Array, listener: PubSubListener, bufferMode?: T): Promise;
- sSubscribe: (channels: string | Array, listener: PubSubListener, bufferMode?: T | undefined) => Promise;
- SUNSUBSCRIBE(channels?: string | Array, listener?: PubSubListener, bufferMode?: T): Promise;
- sUnsubscribe: (channels?: string | Array, listener?: PubSubListener | undefined, bufferMode?: T | undefined) => Promise;
- getPubSubListeners(type: PubSubType): PubSubTypeListeners;
- extendPubSubChannelListeners(type: PubSubType, channel: string, listeners: ChannelListeners): Promise;
- extendPubSubListeners(type: PubSubType, listeners: PubSubTypeListeners): Promise;
- QUIT(): Promise;
- quit: () => Promise;
- executeIsolated(fn: (client: RedisClientType) => T | Promise): Promise;
- MULTI(): RedisClientMultiCommandType;
- multi: () => RedisClientMultiCommandType;
- multiExecutor(commands: Array, selectedDB?: number, chainId?: symbol): Promise>;
- scanIterator(options?: ScanCommandOptions): AsyncIterable;
- hScanIterator(key: string, options?: ScanOptions): AsyncIterable>;
- hScanNoValuesIterator(key: string, options?: ScanOptions): AsyncIterable>;
- sScanIterator(key: string, options?: ScanOptions): AsyncIterable;
- zScanIterator(key: string, options?: ScanOptions): AsyncIterable>;
- disconnect(): Promise;
- ref(): void;
- unref(): void;
-}
-export {};
diff --git a/node_modules/@redis/client/dist/lib/client/index.js b/node_modules/@redis/client/dist/lib/client/index.js
deleted file mode 100644
index 5b7d58e..0000000
--- a/node_modules/@redis/client/dist/lib/client/index.js
+++ /dev/null
@@ -1,563 +0,0 @@
-"use strict";
-var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
-};
-var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
- if (kind === "m") throw new TypeError("Private method is not writable");
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
-};
-var _RedisClient_instances, _a, _RedisClient_options, _RedisClient_socket, _RedisClient_queue, _RedisClient_isolationPool, _RedisClient_v4, _RedisClient_selectedDB, _RedisClient_initiateOptions, _RedisClient_initiateQueue, _RedisClient_initiateSocket, _RedisClient_initiateIsolationPool, _RedisClient_legacyMode, _RedisClient_legacySendCommand, _RedisClient_defineLegacyCommand, _RedisClient_pingTimer, _RedisClient_setPingTimer, _RedisClient_sendCommand, _RedisClient_pubSubCommand, _RedisClient_tick, _RedisClient_addMultiCommands, _RedisClient_destroyIsolationPool;
-Object.defineProperty(exports, "__esModule", { value: true });
-const commands_1 = require("./commands");
-const socket_1 = require("./socket");
-const commands_queue_1 = require("./commands-queue");
-const multi_command_1 = require("./multi-command");
-const events_1 = require("events");
-const command_options_1 = require("../command-options");
-const commander_1 = require("../commander");
-const generic_pool_1 = require("generic-pool");
-const errors_1 = require("../errors");
-const url_1 = require("url");
-const pub_sub_1 = require("./pub-sub");
-const package_json_1 = require("../../package.json");
-class RedisClient extends events_1.EventEmitter {
- static commandOptions(options) {
- return (0, command_options_1.commandOptions)(options);
- }
- static extend(extensions) {
- const Client = (0, commander_1.attachExtensions)({
- BaseClass: _a,
- modulesExecutor: _a.prototype.commandsExecutor,
- modules: extensions?.modules,
- functionsExecutor: _a.prototype.functionsExecuter,
- functions: extensions?.functions,
- scriptsExecutor: _a.prototype.scriptsExecuter,
- scripts: extensions?.scripts
- });
- if (Client !== _a) {
- Client.prototype.Multi = multi_command_1.default.extend(extensions);
- }
- return Client;
- }
- static create(options) {
- return new (_a.extend(options))(options);
- }
- static parseURL(url) {
- // https://www.iana.org/assignments/uri-schemes/prov/redis
- const { hostname, port, protocol, username, password, pathname } = new url_1.URL(url), parsed = {
- socket: {
- host: hostname
- }
- };
- if (protocol === 'rediss:') {
- parsed.socket.tls = true;
- }
- else if (protocol !== 'redis:') {
- throw new TypeError('Invalid protocol');
- }
- if (port) {
- parsed.socket.port = Number(port);
- }
- if (username) {
- parsed.username = decodeURIComponent(username);
- }
- if (password) {
- parsed.password = decodeURIComponent(password);
- }
- if (pathname.length > 1) {
- const database = Number(pathname.substring(1));
- if (isNaN(database)) {
- throw new TypeError('Invalid pathname');
- }
- parsed.database = database;
- }
- return parsed;
- }
- get options() {
- return __classPrivateFieldGet(this, _RedisClient_options, "f");
- }
- get isOpen() {
- return __classPrivateFieldGet(this, _RedisClient_socket, "f").isOpen;
- }
- get isReady() {
- return __classPrivateFieldGet(this, _RedisClient_socket, "f").isReady;
- }
- get isPubSubActive() {
- return __classPrivateFieldGet(this, _RedisClient_queue, "f").isPubSubActive;
- }
- get v4() {
- if (!__classPrivateFieldGet(this, _RedisClient_options, "f")?.legacyMode) {
- throw new Error('the client is not in "legacy mode"');
- }
- return __classPrivateFieldGet(this, _RedisClient_v4, "f");
- }
- constructor(options) {
- super();
- _RedisClient_instances.add(this);
- Object.defineProperty(this, "commandOptions", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: _a.commandOptions
- });
- _RedisClient_options.set(this, void 0);
- _RedisClient_socket.set(this, void 0);
- _RedisClient_queue.set(this, void 0);
- _RedisClient_isolationPool.set(this, void 0);
- _RedisClient_v4.set(this, {});
- _RedisClient_selectedDB.set(this, 0);
- _RedisClient_pingTimer.set(this, void 0);
- Object.defineProperty(this, "select", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.SELECT
- });
- Object.defineProperty(this, "subscribe", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.SUBSCRIBE
- });
- Object.defineProperty(this, "unsubscribe", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.UNSUBSCRIBE
- });
- Object.defineProperty(this, "pSubscribe", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.PSUBSCRIBE
- });
- Object.defineProperty(this, "pUnsubscribe", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.PUNSUBSCRIBE
- });
- Object.defineProperty(this, "sSubscribe", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.SSUBSCRIBE
- });
- Object.defineProperty(this, "sUnsubscribe", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.SUNSUBSCRIBE
- });
- Object.defineProperty(this, "quit", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.QUIT
- });
- Object.defineProperty(this, "multi", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.MULTI
- });
- __classPrivateFieldSet(this, _RedisClient_options, __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_initiateOptions).call(this, options), "f");
- __classPrivateFieldSet(this, _RedisClient_queue, __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_initiateQueue).call(this), "f");
- __classPrivateFieldSet(this, _RedisClient_socket, __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_initiateSocket).call(this), "f");
- // should be initiated in connect, not here
- // TODO: consider breaking in v5
- __classPrivateFieldSet(this, _RedisClient_isolationPool, __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_initiateIsolationPool).call(this), "f");
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_legacyMode).call(this);
- }
- duplicate(overrides) {
- return new (Object.getPrototypeOf(this).constructor)({
- ...__classPrivateFieldGet(this, _RedisClient_options, "f"),
- ...overrides
- });
- }
- async connect() {
- // see comment in constructor
- __classPrivateFieldSet(this, _RedisClient_isolationPool, __classPrivateFieldGet(this, _RedisClient_isolationPool, "f") ?? __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_initiateIsolationPool).call(this), "f");
- await __classPrivateFieldGet(this, _RedisClient_socket, "f").connect();
- return this;
- }
- async commandsExecutor(command, args) {
- const { args: redisArgs, options } = (0, commander_1.transformCommandArguments)(command, args);
- return (0, commander_1.transformCommandReply)(command, await __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, redisArgs, options), redisArgs.preserve);
- }
- sendCommand(args, options) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, args, options);
- }
- async functionsExecuter(fn, args, name) {
- const { args: redisArgs, options } = (0, commander_1.transformCommandArguments)(fn, args);
- return (0, commander_1.transformCommandReply)(fn, await this.executeFunction(name, fn, redisArgs, options), redisArgs.preserve);
- }
- executeFunction(name, fn, args, options) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, (0, commander_1.fCallArguments)(name, fn, args), options);
- }
- async scriptsExecuter(script, args) {
- const { args: redisArgs, options } = (0, commander_1.transformCommandArguments)(script, args);
- return (0, commander_1.transformCommandReply)(script, await this.executeScript(script, redisArgs, options), redisArgs.preserve);
- }
- async executeScript(script, args, options) {
- const redisArgs = ['EVALSHA', script.SHA1];
- if (script.NUMBER_OF_KEYS !== undefined) {
- redisArgs.push(script.NUMBER_OF_KEYS.toString());
- }
- redisArgs.push(...args);
- try {
- return await __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, redisArgs, options);
- }
- catch (err) {
- if (!err?.message?.startsWith?.('NOSCRIPT')) {
- throw err;
- }
- redisArgs[0] = 'EVAL';
- redisArgs[1] = script.SCRIPT;
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, redisArgs, options);
- }
- }
- async SELECT(options, db) {
- if (!(0, command_options_1.isCommandOptions)(options)) {
- db = options;
- options = null;
- }
- await __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, ['SELECT', db.toString()], options);
- __classPrivateFieldSet(this, _RedisClient_selectedDB, db, "f");
- }
- SUBSCRIBE(channels, listener, bufferMode) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").subscribe(pub_sub_1.PubSubType.CHANNELS, channels, listener, bufferMode));
- }
- UNSUBSCRIBE(channels, listener, bufferMode) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").unsubscribe(pub_sub_1.PubSubType.CHANNELS, channels, listener, bufferMode));
- }
- PSUBSCRIBE(patterns, listener, bufferMode) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").subscribe(pub_sub_1.PubSubType.PATTERNS, patterns, listener, bufferMode));
- }
- PUNSUBSCRIBE(patterns, listener, bufferMode) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").unsubscribe(pub_sub_1.PubSubType.PATTERNS, patterns, listener, bufferMode));
- }
- SSUBSCRIBE(channels, listener, bufferMode) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").subscribe(pub_sub_1.PubSubType.SHARDED, channels, listener, bufferMode));
- }
- SUNSUBSCRIBE(channels, listener, bufferMode) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").unsubscribe(pub_sub_1.PubSubType.SHARDED, channels, listener, bufferMode));
- }
- getPubSubListeners(type) {
- return __classPrivateFieldGet(this, _RedisClient_queue, "f").getPubSubListeners(type);
- }
- extendPubSubChannelListeners(type, channel, listeners) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").extendPubSubChannelListeners(type, channel, listeners));
- }
- extendPubSubListeners(type, listeners) {
- return __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_pubSubCommand).call(this, __classPrivateFieldGet(this, _RedisClient_queue, "f").extendPubSubListeners(type, listeners));
- }
- QUIT() {
- return __classPrivateFieldGet(this, _RedisClient_socket, "f").quit(async () => {
- if (__classPrivateFieldGet(this, _RedisClient_pingTimer, "f"))
- clearTimeout(__classPrivateFieldGet(this, _RedisClient_pingTimer, "f"));
- const quitPromise = __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(['QUIT']);
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this);
- const [reply] = await Promise.all([
- quitPromise,
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_destroyIsolationPool).call(this)
- ]);
- return reply;
- });
- }
- executeIsolated(fn) {
- if (!__classPrivateFieldGet(this, _RedisClient_isolationPool, "f"))
- return Promise.reject(new errors_1.ClientClosedError());
- return __classPrivateFieldGet(this, _RedisClient_isolationPool, "f").use(fn);
- }
- MULTI() {
- return new this.Multi(this.multiExecutor.bind(this), __classPrivateFieldGet(this, _RedisClient_options, "f")?.legacyMode);
- }
- async multiExecutor(commands, selectedDB, chainId) {
- if (!__classPrivateFieldGet(this, _RedisClient_socket, "f").isOpen) {
- return Promise.reject(new errors_1.ClientClosedError());
- }
- const promise = chainId ?
- // if `chainId` has a value, it's a `MULTI` (and not "pipeline") - need to add the `MULTI` and `EXEC` commands
- Promise.all([
- __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(['MULTI'], { chainId }),
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_addMultiCommands).call(this, commands, chainId),
- __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(['EXEC'], { chainId })
- ]) :
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_addMultiCommands).call(this, commands);
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this);
- const results = await promise;
- if (selectedDB !== undefined) {
- __classPrivateFieldSet(this, _RedisClient_selectedDB, selectedDB, "f");
- }
- return results;
- }
- async *scanIterator(options) {
- let cursor = 0;
- do {
- const reply = await this.scan(cursor, options);
- cursor = reply.cursor;
- for (const key of reply.keys) {
- yield key;
- }
- } while (cursor !== 0);
- }
- async *hScanIterator(key, options) {
- let cursor = 0;
- do {
- const reply = await this.hScan(key, cursor, options);
- cursor = reply.cursor;
- for (const tuple of reply.tuples) {
- yield tuple;
- }
- } while (cursor !== 0);
- }
- async *hScanNoValuesIterator(key, options) {
- let cursor = 0;
- do {
- const reply = await this.hScanNoValues(key, cursor, options);
- cursor = reply.cursor;
- for (const k of reply.keys) {
- yield k;
- }
- } while (cursor !== 0);
- }
- async *sScanIterator(key, options) {
- let cursor = 0;
- do {
- const reply = await this.sScan(key, cursor, options);
- cursor = reply.cursor;
- for (const member of reply.members) {
- yield member;
- }
- } while (cursor !== 0);
- }
- async *zScanIterator(key, options) {
- let cursor = 0;
- do {
- const reply = await this.zScan(key, cursor, options);
- cursor = reply.cursor;
- for (const member of reply.members) {
- yield member;
- }
- } while (cursor !== 0);
- }
- async disconnect() {
- if (__classPrivateFieldGet(this, _RedisClient_pingTimer, "f"))
- clearTimeout(__classPrivateFieldGet(this, _RedisClient_pingTimer, "f"));
- __classPrivateFieldGet(this, _RedisClient_queue, "f").flushAll(new errors_1.DisconnectsClientError());
- __classPrivateFieldGet(this, _RedisClient_socket, "f").disconnect();
- await __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_destroyIsolationPool).call(this);
- }
- ref() {
- __classPrivateFieldGet(this, _RedisClient_socket, "f").ref();
- }
- unref() {
- __classPrivateFieldGet(this, _RedisClient_socket, "f").unref();
- }
-}
-_a = RedisClient, _RedisClient_options = new WeakMap(), _RedisClient_socket = new WeakMap(), _RedisClient_queue = new WeakMap(), _RedisClient_isolationPool = new WeakMap(), _RedisClient_v4 = new WeakMap(), _RedisClient_selectedDB = new WeakMap(), _RedisClient_pingTimer = new WeakMap(), _RedisClient_instances = new WeakSet(), _RedisClient_initiateOptions = function _RedisClient_initiateOptions(options) {
- if (options?.url) {
- const parsed = _a.parseURL(options.url);
- if (options.socket) {
- parsed.socket = Object.assign(options.socket, parsed.socket);
- }
- Object.assign(options, parsed);
- }
- if (options?.database) {
- __classPrivateFieldSet(this, _RedisClient_selectedDB, options.database, "f");
- }
- return options;
-}, _RedisClient_initiateQueue = function _RedisClient_initiateQueue() {
- return new commands_queue_1.default(__classPrivateFieldGet(this, _RedisClient_options, "f")?.commandsQueueMaxLength, (channel, listeners) => this.emit('sharded-channel-moved', channel, listeners));
-}, _RedisClient_initiateSocket = function _RedisClient_initiateSocket() {
- const socketInitiator = async () => {
- const promises = [];
- if (__classPrivateFieldGet(this, _RedisClient_selectedDB, "f") !== 0) {
- promises.push(__classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(['SELECT', __classPrivateFieldGet(this, _RedisClient_selectedDB, "f").toString()], { asap: true }));
- }
- if (__classPrivateFieldGet(this, _RedisClient_options, "f")?.readonly) {
- promises.push(__classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(commands_1.default.READONLY.transformArguments(), { asap: true }));
- }
- if (!__classPrivateFieldGet(this, _RedisClient_options, "f")?.disableClientInfo) {
- promises.push(__classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(['CLIENT', 'SETINFO', 'LIB-VER', package_json_1.version], { asap: true }).catch(err => {
- if (!(err instanceof errors_1.ErrorReply)) {
- throw err;
- }
- }));
- promises.push(__classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand([
- 'CLIENT', 'SETINFO', 'LIB-NAME',
- __classPrivateFieldGet(this, _RedisClient_options, "f")?.clientInfoTag ? `node-redis(${__classPrivateFieldGet(this, _RedisClient_options, "f").clientInfoTag})` : 'node-redis'
- ], { asap: true }).catch(err => {
- if (!(err instanceof errors_1.ErrorReply)) {
- throw err;
- }
- }));
- }
- if (__classPrivateFieldGet(this, _RedisClient_options, "f")?.name) {
- promises.push(__classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(commands_1.default.CLIENT_SETNAME.transformArguments(__classPrivateFieldGet(this, _RedisClient_options, "f").name), { asap: true }));
- }
- if (__classPrivateFieldGet(this, _RedisClient_options, "f")?.username || __classPrivateFieldGet(this, _RedisClient_options, "f")?.password) {
- promises.push(__classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(commands_1.default.AUTH.transformArguments({
- username: __classPrivateFieldGet(this, _RedisClient_options, "f").username,
- password: __classPrivateFieldGet(this, _RedisClient_options, "f").password ?? ''
- }), { asap: true }));
- }
- const resubscribePromise = __classPrivateFieldGet(this, _RedisClient_queue, "f").resubscribe();
- if (resubscribePromise) {
- promises.push(resubscribePromise);
- }
- if (promises.length) {
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this, true);
- await Promise.all(promises);
- }
- };
- return new socket_1.default(socketInitiator, __classPrivateFieldGet(this, _RedisClient_options, "f")?.socket)
- .on('data', chunk => __classPrivateFieldGet(this, _RedisClient_queue, "f").onReplyChunk(chunk))
- .on('error', err => {
- this.emit('error', err);
- if (__classPrivateFieldGet(this, _RedisClient_socket, "f").isOpen && !__classPrivateFieldGet(this, _RedisClient_options, "f")?.disableOfflineQueue) {
- __classPrivateFieldGet(this, _RedisClient_queue, "f").flushWaitingForReply(err);
- }
- else {
- __classPrivateFieldGet(this, _RedisClient_queue, "f").flushAll(err);
- }
- })
- .on('connect', () => {
- this.emit('connect');
- })
- .on('ready', () => {
- this.emit('ready');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_setPingTimer).call(this);
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this);
- })
- .on('reconnecting', () => this.emit('reconnecting'))
- .on('drain', () => __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this))
- .on('end', () => this.emit('end'));
-}, _RedisClient_initiateIsolationPool = function _RedisClient_initiateIsolationPool() {
- return (0, generic_pool_1.createPool)({
- create: async () => {
- const duplicate = this.duplicate({
- isolationPoolOptions: undefined
- }).on('error', err => this.emit('error', err));
- await duplicate.connect();
- return duplicate;
- },
- destroy: client => client.disconnect()
- }, __classPrivateFieldGet(this, _RedisClient_options, "f")?.isolationPoolOptions);
-}, _RedisClient_legacyMode = function _RedisClient_legacyMode() {
- var _b, _c;
- if (!__classPrivateFieldGet(this, _RedisClient_options, "f")?.legacyMode)
- return;
- __classPrivateFieldGet(this, _RedisClient_v4, "f").sendCommand = __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).bind(this);
- this.sendCommand = (...args) => {
- const result = __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_legacySendCommand).call(this, ...args);
- if (result) {
- result.promise
- .then(reply => result.callback(null, reply))
- .catch(err => result.callback(err));
- }
- };
- for (const [name, command] of Object.entries(commands_1.default)) {
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, name, command);
- (_b = this)[_c = name.toLowerCase()] ?? (_b[_c] = this[name]);
- }
- // hard coded commands
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'SELECT');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'select');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'SUBSCRIBE');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'subscribe');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'PSUBSCRIBE');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'pSubscribe');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'UNSUBSCRIBE');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'unsubscribe');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'PUNSUBSCRIBE');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'pUnsubscribe');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'QUIT');
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_defineLegacyCommand).call(this, 'quit');
-}, _RedisClient_legacySendCommand = function _RedisClient_legacySendCommand(...args) {
- const callback = typeof args[args.length - 1] === 'function' ?
- args.pop() :
- undefined;
- const promise = __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, (0, commander_1.transformLegacyCommandArguments)(args));
- if (callback)
- return {
- promise,
- callback
- };
- promise.catch(err => this.emit('error', err));
-}, _RedisClient_defineLegacyCommand = function _RedisClient_defineLegacyCommand(name, command) {
- __classPrivateFieldGet(this, _RedisClient_v4, "f")[name] = this[name].bind(this);
- this[name] = command && command.TRANSFORM_LEGACY_REPLY && command.transformReply ?
- (...args) => {
- const result = __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_legacySendCommand).call(this, name, ...args);
- if (result) {
- result.promise
- .then(reply => result.callback(null, command.transformReply(reply)))
- .catch(err => result.callback(err));
- }
- } :
- (...args) => this.sendCommand(name, ...args);
-}, _RedisClient_setPingTimer = function _RedisClient_setPingTimer() {
- if (!__classPrivateFieldGet(this, _RedisClient_options, "f")?.pingInterval || !__classPrivateFieldGet(this, _RedisClient_socket, "f").isReady)
- return;
- clearTimeout(__classPrivateFieldGet(this, _RedisClient_pingTimer, "f"));
- __classPrivateFieldSet(this, _RedisClient_pingTimer, setTimeout(() => {
- if (!__classPrivateFieldGet(this, _RedisClient_socket, "f").isReady)
- return;
- // using #sendCommand to support legacy mode
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_sendCommand).call(this, ['PING'])
- .then(reply => this.emit('ping-interval', reply))
- .catch(err => this.emit('error', err))
- .finally(() => __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_setPingTimer).call(this));
- }, __classPrivateFieldGet(this, _RedisClient_options, "f").pingInterval), "f");
-}, _RedisClient_sendCommand = function _RedisClient_sendCommand(args, options) {
- if (!__classPrivateFieldGet(this, _RedisClient_socket, "f").isOpen) {
- return Promise.reject(new errors_1.ClientClosedError());
- }
- else if (options?.isolated) {
- return this.executeIsolated(isolatedClient => isolatedClient.sendCommand(args, {
- ...options,
- isolated: false
- }));
- }
- else if (!__classPrivateFieldGet(this, _RedisClient_socket, "f").isReady && __classPrivateFieldGet(this, _RedisClient_options, "f")?.disableOfflineQueue) {
- return Promise.reject(new errors_1.ClientOfflineError());
- }
- const promise = __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(args, options);
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this);
- return promise;
-}, _RedisClient_pubSubCommand = function _RedisClient_pubSubCommand(promise) {
- if (promise === undefined)
- return Promise.resolve();
- __classPrivateFieldGet(this, _RedisClient_instances, "m", _RedisClient_tick).call(this);
- return promise;
-}, _RedisClient_tick = function _RedisClient_tick(force = false) {
- if (__classPrivateFieldGet(this, _RedisClient_socket, "f").writableNeedDrain || (!force && !__classPrivateFieldGet(this, _RedisClient_socket, "f").isReady)) {
- return;
- }
- __classPrivateFieldGet(this, _RedisClient_socket, "f").cork();
- while (!__classPrivateFieldGet(this, _RedisClient_socket, "f").writableNeedDrain) {
- const args = __classPrivateFieldGet(this, _RedisClient_queue, "f").getCommandToSend();
- if (args === undefined)
- break;
- __classPrivateFieldGet(this, _RedisClient_socket, "f").writeCommand(args);
- }
-}, _RedisClient_addMultiCommands = function _RedisClient_addMultiCommands(commands, chainId) {
- return Promise.all(commands.map(({ args }) => __classPrivateFieldGet(this, _RedisClient_queue, "f").addCommand(args, { chainId })));
-}, _RedisClient_destroyIsolationPool = async function _RedisClient_destroyIsolationPool() {
- await __classPrivateFieldGet(this, _RedisClient_isolationPool, "f").drain();
- await __classPrivateFieldGet(this, _RedisClient_isolationPool, "f").clear();
- __classPrivateFieldSet(this, _RedisClient_isolationPool, undefined, "f");
-};
-exports.default = RedisClient;
-(0, commander_1.attachCommands)({
- BaseClass: RedisClient,
- commands: commands_1.default,
- executor: RedisClient.prototype.commandsExecutor
-});
-RedisClient.prototype.Multi = multi_command_1.default;
diff --git a/node_modules/@redis/client/dist/lib/client/multi-command.d.ts b/node_modules/@redis/client/dist/lib/client/multi-command.d.ts
deleted file mode 100644
index 0893589..0000000
--- a/node_modules/@redis/client/dist/lib/client/multi-command.d.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import COMMANDS from './commands';
-import { RedisCommand, RedisCommandArguments, RedisCommandRawReply, RedisFunctions, RedisModules, RedisExtensions, RedisScript, RedisScripts, ExcludeMappedString, RedisFunction } from '../commands';
-import { RedisMultiQueuedCommand } from '../multi-command';
-type CommandSignature = (...args: Parameters) => RedisClientMultiCommandType;
-type WithCommands = {
- [P in keyof typeof COMMANDS]: CommandSignature<(typeof COMMANDS)[P], M, F, S>;
-};
-type WithModules = {
- [P in keyof M as ExcludeMappedString]: {
- [C in keyof M[P] as ExcludeMappedString]: CommandSignature;
- };
-};
-type WithFunctions = {
- [P in keyof F as ExcludeMappedString]: {
- [FF in keyof F[P] as ExcludeMappedString]: CommandSignature;
- };
-};
-type WithScripts = {
- [P in keyof S as ExcludeMappedString]: CommandSignature;
-};
-export type RedisClientMultiCommandType = RedisClientMultiCommand & WithCommands & WithModules & WithFunctions & WithScripts;
-type InstantiableRedisMultiCommand = new (...args: ConstructorParameters) => RedisClientMultiCommandType;
-export type RedisClientMultiExecutor = (queue: Array, selectedDB?: number, chainId?: symbol) => Promise>;
-export default class RedisClientMultiCommand {
- #private;
- static extend(extensions?: RedisExtensions): InstantiableRedisMultiCommand;
- readonly v4: Record;
- constructor(executor: RedisClientMultiExecutor, legacyMode?: boolean);
- commandsExecutor(command: RedisCommand, args: Array): this;
- SELECT(db: number, transformReply?: RedisCommand['transformReply']): this;
- select: (db: number, transformReply?: RedisCommand['transformReply']) => this;
- addCommand(args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): this;
- functionsExecutor(fn: RedisFunction, args: Array, name: string): this;
- scriptsExecutor(script: RedisScript, args: Array): this;
- exec(execAsPipeline?: boolean): Promise>;
- EXEC: (execAsPipeline?: boolean) => Promise>;
- execAsPipeline(): Promise>;
-}
-export {};
diff --git a/node_modules/@redis/client/dist/lib/client/multi-command.js b/node_modules/@redis/client/dist/lib/client/multi-command.js
deleted file mode 100644
index 4d43c8f..0000000
--- a/node_modules/@redis/client/dist/lib/client/multi-command.js
+++ /dev/null
@@ -1,130 +0,0 @@
-"use strict";
-var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
- if (kind === "m") throw new TypeError("Private method is not writable");
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
-};
-var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
-};
-var _RedisClientMultiCommand_instances, _RedisClientMultiCommand_multi, _RedisClientMultiCommand_executor, _RedisClientMultiCommand_selectedDB, _RedisClientMultiCommand_legacyMode, _RedisClientMultiCommand_defineLegacyCommand;
-Object.defineProperty(exports, "__esModule", { value: true });
-const commands_1 = require("./commands");
-const multi_command_1 = require("../multi-command");
-const commander_1 = require("../commander");
-class RedisClientMultiCommand {
- static extend(extensions) {
- return (0, commander_1.attachExtensions)({
- BaseClass: RedisClientMultiCommand,
- modulesExecutor: RedisClientMultiCommand.prototype.commandsExecutor,
- modules: extensions?.modules,
- functionsExecutor: RedisClientMultiCommand.prototype.functionsExecutor,
- functions: extensions?.functions,
- scriptsExecutor: RedisClientMultiCommand.prototype.scriptsExecutor,
- scripts: extensions?.scripts
- });
- }
- constructor(executor, legacyMode = false) {
- _RedisClientMultiCommand_instances.add(this);
- _RedisClientMultiCommand_multi.set(this, new multi_command_1.default());
- _RedisClientMultiCommand_executor.set(this, void 0);
- Object.defineProperty(this, "v4", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: {}
- });
- _RedisClientMultiCommand_selectedDB.set(this, void 0);
- Object.defineProperty(this, "select", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.SELECT
- });
- Object.defineProperty(this, "EXEC", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.exec
- });
- __classPrivateFieldSet(this, _RedisClientMultiCommand_executor, executor, "f");
- if (legacyMode) {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_instances, "m", _RedisClientMultiCommand_legacyMode).call(this);
- }
- }
- commandsExecutor(command, args) {
- return this.addCommand(command.transformArguments(...args), command.transformReply);
- }
- SELECT(db, transformReply) {
- __classPrivateFieldSet(this, _RedisClientMultiCommand_selectedDB, db, "f");
- return this.addCommand(['SELECT', db.toString()], transformReply);
- }
- addCommand(args, transformReply) {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").addCommand(args, transformReply);
- return this;
- }
- functionsExecutor(fn, args, name) {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").addFunction(name, fn, args);
- return this;
- }
- scriptsExecutor(script, args) {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").addScript(script, args);
- return this;
- }
- async exec(execAsPipeline = false) {
- if (execAsPipeline) {
- return this.execAsPipeline();
- }
- return __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").handleExecReplies(await __classPrivateFieldGet(this, _RedisClientMultiCommand_executor, "f").call(this, __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").queue, __classPrivateFieldGet(this, _RedisClientMultiCommand_selectedDB, "f"), multi_command_1.default.generateChainId()));
- }
- async execAsPipeline() {
- if (__classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").queue.length === 0)
- return [];
- 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")));
- }
-}
-_RedisClientMultiCommand_multi = new WeakMap(), _RedisClientMultiCommand_executor = new WeakMap(), _RedisClientMultiCommand_selectedDB = new WeakMap(), _RedisClientMultiCommand_instances = new WeakSet(), _RedisClientMultiCommand_legacyMode = function _RedisClientMultiCommand_legacyMode() {
- var _a, _b;
- this.v4.addCommand = this.addCommand.bind(this);
- this.addCommand = (...args) => {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").addCommand((0, commander_1.transformLegacyCommandArguments)(args));
- return this;
- };
- this.v4.exec = this.exec.bind(this);
- this.exec = (callback) => {
- this.v4.exec()
- .then((reply) => {
- if (!callback)
- return;
- callback(null, reply);
- })
- .catch((err) => {
- if (!callback) {
- // this.emit('error', err);
- return;
- }
- callback(err);
- });
- };
- for (const [name, command] of Object.entries(commands_1.default)) {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_instances, "m", _RedisClientMultiCommand_defineLegacyCommand).call(this, name, command);
- (_a = this)[_b = name.toLowerCase()] ?? (_a[_b] = this[name]);
- }
-}, _RedisClientMultiCommand_defineLegacyCommand = function _RedisClientMultiCommand_defineLegacyCommand(name, command) {
- this.v4[name] = this[name].bind(this.v4);
- this[name] = command && command.TRANSFORM_LEGACY_REPLY && command.transformReply ?
- (...args) => {
- __classPrivateFieldGet(this, _RedisClientMultiCommand_multi, "f").addCommand([name, ...(0, commander_1.transformLegacyCommandArguments)(args)], command.transformReply);
- return this;
- } :
- (...args) => this.addCommand(name, ...args);
-};
-exports.default = RedisClientMultiCommand;
-(0, commander_1.attachCommands)({
- BaseClass: RedisClientMultiCommand,
- commands: commands_1.default,
- executor: RedisClientMultiCommand.prototype.commandsExecutor
-});
diff --git a/node_modules/@redis/client/dist/lib/client/pub-sub.d.ts b/node_modules/@redis/client/dist/lib/client/pub-sub.d.ts
deleted file mode 100644
index ffd2783..0000000
--- a/node_modules/@redis/client/dist/lib/client/pub-sub.d.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-///
-import { RedisCommandArgument } from "../commands";
-export declare enum PubSubType {
- CHANNELS = "CHANNELS",
- PATTERNS = "PATTERNS",
- SHARDED = "SHARDED"
-}
-export type PubSubListener = (message: T, channel: T) => unknown;
-export interface ChannelListeners {
- unsubscribing: boolean;
- buffers: Set>;
- strings: Set>;
-}
-export type PubSubTypeListeners = Map;
-export type PubSubCommand = ReturnType;
-export declare class PubSub {
- #private;
- static isStatusReply(reply: Array): boolean;
- static isShardedUnsubscribe(reply: Array): boolean;
- get isActive(): boolean;
- subscribe(type: PubSubType, channels: string | Array, listener: PubSubListener, returnBuffers?: T): {
- args: RedisCommandArgument[];
- channelsCounter: number;
- resolve: () => void;
- reject: () => void;
- } | undefined;
- extendChannelListeners(type: PubSubType, channel: string, listeners: ChannelListeners): {
- args: (string | Buffer)[];
- channelsCounter: number;
- resolve: () => number;
- reject: () => void;
- } | undefined;
- extendTypeListeners(type: PubSubType, listeners: PubSubTypeListeners): {
- args: RedisCommandArgument[];
- channelsCounter: number;
- resolve: () => number;
- reject: () => void;
- } | undefined;
- unsubscribe(type: PubSubType, channels?: string | Array, listener?: PubSubListener