🎯 MapView v2.0 - Global Deployment Ready

 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
This commit is contained in:
2025-07-20 19:52:16 +07:00
parent 3203463a6a
commit c65cc97a33
64624 changed files with 7199453 additions and 6462 deletions

View File

@@ -0,0 +1,60 @@
/// <reference types="node" />
import { RedisClientType } from '../client';
import { RedisClusterOptions } from '.';
import { RedisCommandArgument, RedisFunctions, RedisModules, RedisScripts } from '../commands';
import { ChannelListeners } from '../client/pub-sub';
import { EventEmitter } from 'stream';
interface NodeAddress {
host: string;
port: number;
}
export type NodeAddressMap = {
[address: string]: NodeAddress;
} | ((address: string) => NodeAddress | undefined);
type ValueOrPromise<T> = T | Promise<T>;
type ClientOrPromise<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = ValueOrPromise<RedisClientType<M, F, S>>;
export interface Node<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> {
address: string;
client?: ClientOrPromise<M, F, S>;
}
export interface ShardNode<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> extends Node<M, F, S> {
id: string;
host: string;
port: number;
readonly: boolean;
}
export interface MasterNode<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> extends ShardNode<M, F, S> {
pubSubClient?: ClientOrPromise<M, F, S>;
}
export interface Shard<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> {
master: MasterNode<M, F, S>;
replicas?: Array<ShardNode<M, F, S>>;
nodesIterator?: IterableIterator<ShardNode<M, F, S>>;
}
export type PubSubNode<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = Required<Node<M, F, S>>;
export type OnShardedChannelMovedError = (err: unknown, channel: string, listeners?: ChannelListeners) => void;
export default class RedisClusterSlots<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> {
#private;
slots: Shard<M, F, S>[];
shards: Shard<M, F, S>[];
masters: ShardNode<M, F, S>[];
replicas: ShardNode<M, F, S>[];
readonly nodeByAddress: Map<string, ShardNode<M, F, S> | MasterNode<M, F, S>>;
pubSubNode?: PubSubNode<M, F, S>;
get isOpen(): boolean;
constructor(options: RedisClusterOptions<M, F, S>, emit: EventEmitter['emit']);
connect(): Promise<void>;
nodeClient(node: ShardNode<M, F, S>): ClientOrPromise<M, F, S>;
rediscover(startWith: RedisClientType<M, F, S>): Promise<void>;
quit(): Promise<void>;
disconnect(): Promise<void>;
getClient(firstKey: RedisCommandArgument | undefined, isReadonly: boolean | undefined): ClientOrPromise<M, F, S>;
getRandomNode(): ShardNode<M, F, S>;
getSlotRandomNode(slotNumber: number): ShardNode<M, F, S>;
getMasterByAddress(address: string): ClientOrPromise<M, F, S> | undefined;
getPubSubClient(): ClientOrPromise<M, F, S>;
executeUnsubscribeCommand(unsubscribe: (client: RedisClientType<M, F, S>) => Promise<void>): Promise<void>;
getShardedPubSubClient(channel: string): ClientOrPromise<M, F, S>;
executeShardedUnsubscribeCommand(channel: string, unsubscribe: (client: RedisClientType<M, F, S>) => Promise<void>): Promise<void>;
}
export {};

View File

@@ -0,0 +1,434 @@
"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 _RedisClusterSlots_instances, _a, _RedisClusterSlots_SLOTS, _RedisClusterSlots_options, _RedisClusterSlots_Client, _RedisClusterSlots_emit, _RedisClusterSlots_isOpen, _RedisClusterSlots_discoverWithRootNodes, _RedisClusterSlots_resetSlots, _RedisClusterSlots_discover, _RedisClusterSlots_getShards, _RedisClusterSlots_getNodeAddress, _RedisClusterSlots_clientOptionsDefaults, _RedisClusterSlots_initiateSlotNode, _RedisClusterSlots_createClient, _RedisClusterSlots_createNodeClient, _RedisClusterSlots_runningRediscoverPromise, _RedisClusterSlots_rediscover, _RedisClusterSlots_destroy, _RedisClusterSlots_execOnNodeClient, _RedisClusterSlots_iterateAllNodes, _RedisClusterSlots_randomNodeIterator, _RedisClusterSlots_slotNodesIterator, _RedisClusterSlots_initiatePubSubClient, _RedisClusterSlots_initiateShardedPubSubClient;
Object.defineProperty(exports, "__esModule", { value: true });
const client_1 = require("../client");
const errors_1 = require("../errors");
const util_1 = require("util");
const pub_sub_1 = require("../client/pub-sub");
// We need to use 'require', because it's not possible with Typescript to import
// function that are exported as 'module.exports = function`, without esModuleInterop
// set to true.
const calculateSlot = require('cluster-key-slot');
class RedisClusterSlots {
get isOpen() {
return __classPrivateFieldGet(this, _RedisClusterSlots_isOpen, "f");
}
constructor(options, emit) {
_RedisClusterSlots_instances.add(this);
_RedisClusterSlots_options.set(this, void 0);
_RedisClusterSlots_Client.set(this, void 0);
_RedisClusterSlots_emit.set(this, void 0);
Object.defineProperty(this, "slots", {
enumerable: true,
configurable: true,
writable: true,
value: new Array(__classPrivateFieldGet(_a, _a, "f", _RedisClusterSlots_SLOTS))
});
Object.defineProperty(this, "shards", {
enumerable: true,
configurable: true,
writable: true,
value: new Array()
});
Object.defineProperty(this, "masters", {
enumerable: true,
configurable: true,
writable: true,
value: new Array()
});
Object.defineProperty(this, "replicas", {
enumerable: true,
configurable: true,
writable: true,
value: new Array()
});
Object.defineProperty(this, "nodeByAddress", {
enumerable: true,
configurable: true,
writable: true,
value: new Map()
});
Object.defineProperty(this, "pubSubNode", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
_RedisClusterSlots_isOpen.set(this, false);
_RedisClusterSlots_runningRediscoverPromise.set(this, void 0);
_RedisClusterSlots_randomNodeIterator.set(this, void 0);
__classPrivateFieldSet(this, _RedisClusterSlots_options, options, "f");
__classPrivateFieldSet(this, _RedisClusterSlots_Client, client_1.default.extend(options), "f");
__classPrivateFieldSet(this, _RedisClusterSlots_emit, emit, "f");
}
async connect() {
if (__classPrivateFieldGet(this, _RedisClusterSlots_isOpen, "f")) {
throw new Error('Cluster already open');
}
__classPrivateFieldSet(this, _RedisClusterSlots_isOpen, true, "f");
try {
await __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_discoverWithRootNodes).call(this);
}
catch (err) {
__classPrivateFieldSet(this, _RedisClusterSlots_isOpen, false, "f");
throw err;
}
}
nodeClient(node) {
return node.client ?? __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_createNodeClient).call(this, node);
}
async rediscover(startWith) {
__classPrivateFieldSet(this, _RedisClusterSlots_runningRediscoverPromise, __classPrivateFieldGet(this, _RedisClusterSlots_runningRediscoverPromise, "f") ?? __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_rediscover).call(this, startWith)
.finally(() => __classPrivateFieldSet(this, _RedisClusterSlots_runningRediscoverPromise, undefined, "f")), "f");
return __classPrivateFieldGet(this, _RedisClusterSlots_runningRediscoverPromise, "f");
}
quit() {
return __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_destroy).call(this, client => client.quit());
}
disconnect() {
return __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_destroy).call(this, client => client.disconnect());
}
getClient(firstKey, isReadonly) {
if (!firstKey) {
return this.nodeClient(this.getRandomNode());
}
const slotNumber = calculateSlot(firstKey);
if (!isReadonly) {
return this.nodeClient(this.slots[slotNumber].master);
}
return this.nodeClient(this.getSlotRandomNode(slotNumber));
}
getRandomNode() {
__classPrivateFieldSet(this, _RedisClusterSlots_randomNodeIterator, __classPrivateFieldGet(this, _RedisClusterSlots_randomNodeIterator, "f") ?? __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_iterateAllNodes).call(this), "f");
return __classPrivateFieldGet(this, _RedisClusterSlots_randomNodeIterator, "f").next().value;
}
getSlotRandomNode(slotNumber) {
const slot = this.slots[slotNumber];
if (!slot.replicas?.length) {
return slot.master;
}
slot.nodesIterator ?? (slot.nodesIterator = __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_slotNodesIterator).call(this, slot));
return slot.nodesIterator.next().value;
}
getMasterByAddress(address) {
const master = this.nodeByAddress.get(address);
if (!master)
return;
return this.nodeClient(master);
}
getPubSubClient() {
return this.pubSubNode ?
this.pubSubNode.client :
__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_initiatePubSubClient).call(this);
}
async executeUnsubscribeCommand(unsubscribe) {
const client = await this.getPubSubClient();
await unsubscribe(client);
if (!client.isPubSubActive && client.isOpen) {
await client.disconnect();
this.pubSubNode = undefined;
}
}
getShardedPubSubClient(channel) {
const { master } = this.slots[calculateSlot(channel)];
return master.pubSubClient ?? __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_initiateShardedPubSubClient).call(this, master);
}
async executeShardedUnsubscribeCommand(channel, unsubscribe) {
const { master } = this.slots[calculateSlot(channel)];
if (!master.pubSubClient)
return Promise.resolve();
const client = await master.pubSubClient;
await unsubscribe(client);
if (!client.isPubSubActive && client.isOpen) {
await client.disconnect();
master.pubSubClient = undefined;
}
}
}
_a = RedisClusterSlots, _RedisClusterSlots_options = new WeakMap(), _RedisClusterSlots_Client = new WeakMap(), _RedisClusterSlots_emit = new WeakMap(), _RedisClusterSlots_isOpen = new WeakMap(), _RedisClusterSlots_runningRediscoverPromise = new WeakMap(), _RedisClusterSlots_randomNodeIterator = new WeakMap(), _RedisClusterSlots_instances = new WeakSet(), _RedisClusterSlots_discoverWithRootNodes = async function _RedisClusterSlots_discoverWithRootNodes() {
let start = Math.floor(Math.random() * __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").rootNodes.length);
for (let i = start; i < __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").rootNodes.length; i++) {
if (await __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_discover).call(this, __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").rootNodes[i]))
return;
}
for (let i = 0; i < start; i++) {
if (await __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_discover).call(this, __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").rootNodes[i]))
return;
}
throw new errors_1.RootNodesUnavailableError();
}, _RedisClusterSlots_resetSlots = function _RedisClusterSlots_resetSlots() {
this.slots = new Array(__classPrivateFieldGet(_a, _a, "f", _RedisClusterSlots_SLOTS));
this.shards = [];
this.masters = [];
this.replicas = [];
__classPrivateFieldSet(this, _RedisClusterSlots_randomNodeIterator, undefined, "f");
}, _RedisClusterSlots_discover = async function _RedisClusterSlots_discover(rootNode) {
const addressesInUse = new Set();
try {
const shards = await __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_getShards).call(this, rootNode), promises = [], eagerConnect = __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").minimizeConnections !== true;
__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_resetSlots).call(this);
for (const { from, to, master, replicas } of shards) {
const shard = {
master: __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_initiateSlotNode).call(this, master, false, eagerConnect, addressesInUse, promises)
};
if (__classPrivateFieldGet(this, _RedisClusterSlots_options, "f").useReplicas) {
shard.replicas = replicas.map(replica => __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_initiateSlotNode).call(this, replica, true, eagerConnect, addressesInUse, promises));
}
this.shards.push(shard);
for (let i = from; i <= to; i++) {
this.slots[i] = shard;
}
}
if (this.pubSubNode && !addressesInUse.has(this.pubSubNode.address)) {
if (util_1.types.isPromise(this.pubSubNode.client)) {
promises.push(this.pubSubNode.client.then(client => client.disconnect()));
this.pubSubNode = undefined;
}
else {
promises.push(this.pubSubNode.client.disconnect());
const channelsListeners = this.pubSubNode.client.getPubSubListeners(pub_sub_1.PubSubType.CHANNELS), patternsListeners = this.pubSubNode.client.getPubSubListeners(pub_sub_1.PubSubType.PATTERNS);
if (channelsListeners.size || patternsListeners.size) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_initiatePubSubClient).call(this, {
[pub_sub_1.PubSubType.CHANNELS]: channelsListeners,
[pub_sub_1.PubSubType.PATTERNS]: patternsListeners
}));
}
}
}
for (const [address, node] of this.nodeByAddress.entries()) {
if (addressesInUse.has(address))
continue;
if (node.client) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_execOnNodeClient).call(this, node.client, client => client.disconnect()));
}
const { pubSubClient } = node;
if (pubSubClient) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_execOnNodeClient).call(this, pubSubClient, client => client.disconnect()));
}
this.nodeByAddress.delete(address);
}
await Promise.all(promises);
return true;
}
catch (err) {
__classPrivateFieldGet(this, _RedisClusterSlots_emit, "f").call(this, 'error', err);
return false;
}
}, _RedisClusterSlots_getShards = async function _RedisClusterSlots_getShards(rootNode) {
const client = new (__classPrivateFieldGet(this, _RedisClusterSlots_Client, "f"))(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_clientOptionsDefaults).call(this, rootNode, true));
client.on('error', err => __classPrivateFieldGet(this, _RedisClusterSlots_emit, "f").call(this, 'error', err));
await client.connect();
try {
// using `CLUSTER SLOTS` and not `CLUSTER SHARDS` to support older versions
return await client.clusterSlots();
}
finally {
await client.disconnect();
}
}, _RedisClusterSlots_getNodeAddress = function _RedisClusterSlots_getNodeAddress(address) {
switch (typeof __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").nodeAddressMap) {
case 'object':
return __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").nodeAddressMap[address];
case 'function':
return __classPrivateFieldGet(this, _RedisClusterSlots_options, "f").nodeAddressMap(address);
}
}, _RedisClusterSlots_clientOptionsDefaults = function _RedisClusterSlots_clientOptionsDefaults(options, disableReconnect) {
let result;
if (__classPrivateFieldGet(this, _RedisClusterSlots_options, "f").defaults) {
let socket;
if (__classPrivateFieldGet(this, _RedisClusterSlots_options, "f").defaults.socket) {
socket = {
...__classPrivateFieldGet(this, _RedisClusterSlots_options, "f").defaults.socket,
...options?.socket
};
}
else {
socket = options?.socket;
}
result = {
...__classPrivateFieldGet(this, _RedisClusterSlots_options, "f").defaults,
...options,
socket
};
}
else {
result = options;
}
if (disableReconnect) {
result ?? (result = {});
result.socket ?? (result.socket = {});
result.socket.reconnectStrategy = false;
}
return result;
}, _RedisClusterSlots_initiateSlotNode = function _RedisClusterSlots_initiateSlotNode({ id, ip, port }, readonly, eagerConnent, addressesInUse, promises) {
const address = `${ip}:${port}`;
addressesInUse.add(address);
let node = this.nodeByAddress.get(address);
if (!node) {
node = {
id,
host: ip,
port,
address,
readonly,
client: undefined
};
if (eagerConnent) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_createNodeClient).call(this, node));
}
this.nodeByAddress.set(address, node);
}
(readonly ? this.replicas : this.masters).push(node);
return node;
}, _RedisClusterSlots_createClient = async function _RedisClusterSlots_createClient(node, readonly = node.readonly) {
const client = new (__classPrivateFieldGet(this, _RedisClusterSlots_Client, "f"))(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_clientOptionsDefaults).call(this, {
socket: __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_getNodeAddress).call(this, node.address) ?? {
host: node.host,
port: node.port
},
readonly
}));
client.on('error', err => __classPrivateFieldGet(this, _RedisClusterSlots_emit, "f").call(this, 'error', err));
await client.connect();
return client;
}, _RedisClusterSlots_createNodeClient = function _RedisClusterSlots_createNodeClient(node) {
const promise = __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_createClient).call(this, node)
.then(client => {
node.client = client;
return client;
})
.catch(err => {
node.client = undefined;
throw err;
});
node.client = promise;
return promise;
}, _RedisClusterSlots_rediscover = async function _RedisClusterSlots_rediscover(startWith) {
if (await __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_discover).call(this, startWith.options))
return;
return __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_discoverWithRootNodes).call(this);
}, _RedisClusterSlots_destroy = async function _RedisClusterSlots_destroy(fn) {
__classPrivateFieldSet(this, _RedisClusterSlots_isOpen, false, "f");
const promises = [];
for (const { master, replicas } of this.shards) {
if (master.client) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_execOnNodeClient).call(this, master.client, fn));
}
if (master.pubSubClient) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_execOnNodeClient).call(this, master.pubSubClient, fn));
}
if (replicas) {
for (const { client } of replicas) {
if (client) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_execOnNodeClient).call(this, client, fn));
}
}
}
}
if (this.pubSubNode) {
promises.push(__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_execOnNodeClient).call(this, this.pubSubNode.client, fn));
this.pubSubNode = undefined;
}
__classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_resetSlots).call(this);
this.nodeByAddress.clear();
await Promise.allSettled(promises);
}, _RedisClusterSlots_execOnNodeClient = function _RedisClusterSlots_execOnNodeClient(client, fn) {
return util_1.types.isPromise(client) ?
client.then(fn) :
fn(client);
}, _RedisClusterSlots_iterateAllNodes = function* _RedisClusterSlots_iterateAllNodes() {
let i = Math.floor(Math.random() * (this.masters.length + this.replicas.length));
if (i < this.masters.length) {
do {
yield this.masters[i];
} while (++i < this.masters.length);
for (const replica of this.replicas) {
yield replica;
}
}
else {
i -= this.masters.length;
do {
yield this.replicas[i];
} while (++i < this.replicas.length);
}
while (true) {
for (const master of this.masters) {
yield master;
}
for (const replica of this.replicas) {
yield replica;
}
}
}, _RedisClusterSlots_slotNodesIterator = function* _RedisClusterSlots_slotNodesIterator(slot) {
let i = Math.floor(Math.random() * (1 + slot.replicas.length));
if (i < slot.replicas.length) {
do {
yield slot.replicas[i];
} while (++i < slot.replicas.length);
}
while (true) {
yield slot.master;
for (const replica of slot.replicas) {
yield replica;
}
}
}, _RedisClusterSlots_initiatePubSubClient = async function _RedisClusterSlots_initiatePubSubClient(toResubscribe) {
const index = Math.floor(Math.random() * (this.masters.length + this.replicas.length)), node = index < this.masters.length ?
this.masters[index] :
this.replicas[index - this.masters.length];
this.pubSubNode = {
address: node.address,
client: __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_createClient).call(this, node, false)
.then(async (client) => {
if (toResubscribe) {
await Promise.all([
client.extendPubSubListeners(pub_sub_1.PubSubType.CHANNELS, toResubscribe[pub_sub_1.PubSubType.CHANNELS]),
client.extendPubSubListeners(pub_sub_1.PubSubType.PATTERNS, toResubscribe[pub_sub_1.PubSubType.PATTERNS])
]);
}
this.pubSubNode.client = client;
return client;
})
.catch(err => {
this.pubSubNode = undefined;
throw err;
})
};
return this.pubSubNode.client;
}, _RedisClusterSlots_initiateShardedPubSubClient = function _RedisClusterSlots_initiateShardedPubSubClient(master) {
const promise = __classPrivateFieldGet(this, _RedisClusterSlots_instances, "m", _RedisClusterSlots_createClient).call(this, master, false)
.then(client => {
client.on('server-sunsubscribe', async (channel, listeners) => {
try {
await this.rediscover(client);
const redirectTo = await this.getShardedPubSubClient(channel);
redirectTo.extendPubSubChannelListeners(pub_sub_1.PubSubType.SHARDED, channel, listeners);
}
catch (err) {
__classPrivateFieldGet(this, _RedisClusterSlots_emit, "f").call(this, 'sharded-shannel-moved-error', err, channel, listeners);
}
});
master.pubSubClient = client;
return client;
})
.catch(err => {
master.pubSubClient = undefined;
throw err;
});
master.pubSubClient = promise;
return promise;
};
_RedisClusterSlots_SLOTS = { value: 16384 };
exports.default = RedisClusterSlots;

View File

@@ -0,0 +1,669 @@
import * as APPEND from '../commands/APPEND';
import * as BITCOUNT from '../commands/BITCOUNT';
import * as BITFIELD_RO from '../commands/BITFIELD_RO';
import * as BITFIELD from '../commands/BITFIELD';
import * as BITOP from '../commands/BITOP';
import * as BITPOS from '../commands/BITPOS';
import * as BLMOVE from '../commands/BLMOVE';
import * as BLMPOP from '../commands/BLMPOP';
import * as BLPOP from '../commands/BLPOP';
import * as BRPOP from '../commands/BRPOP';
import * as BRPOPLPUSH from '../commands/BRPOPLPUSH';
import * as BZMPOP from '../commands/BZMPOP';
import * as BZPOPMAX from '../commands/BZPOPMAX';
import * as BZPOPMIN from '../commands/BZPOPMIN';
import * as COPY from '../commands/COPY';
import * as DECR from '../commands/DECR';
import * as DECRBY from '../commands/DECRBY';
import * as DEL from '../commands/DEL';
import * as DUMP from '../commands/DUMP';
import * as EVAL_RO from '../commands/EVAL_RO';
import * as EVAL from '../commands/EVAL';
import * as EVALSHA_RO from '../commands/EVALSHA_RO';
import * as EVALSHA from '../commands/EVALSHA';
import * as EXISTS from '../commands/EXISTS';
import * as EXPIRE from '../commands/EXPIRE';
import * as EXPIREAT from '../commands/EXPIREAT';
import * as EXPIRETIME from '../commands/EXPIRETIME';
import * as FCALL_RO from '../commands/FCALL_RO';
import * as FCALL from '../commands/FCALL';
import * as GEOADD from '../commands/GEOADD';
import * as GEODIST from '../commands/GEODIST';
import * as GEOHASH from '../commands/GEOHASH';
import * as GEOPOS from '../commands/GEOPOS';
import * as GEORADIUS_RO_WITH from '../commands/GEORADIUS_RO_WITH';
import * as GEORADIUS_RO from '../commands/GEORADIUS_RO';
import * as GEORADIUS_WITH from '../commands/GEORADIUS_WITH';
import * as GEORADIUS from '../commands/GEORADIUS';
import * as GEORADIUSBYMEMBER_RO_WITH from '../commands/GEORADIUSBYMEMBER_RO_WITH';
import * as GEORADIUSBYMEMBER_RO from '../commands/GEORADIUSBYMEMBER_RO';
import * as GEORADIUSBYMEMBER_WITH from '../commands/GEORADIUSBYMEMBER_WITH';
import * as GEORADIUSBYMEMBER from '../commands/GEORADIUSBYMEMBER';
import * as GEORADIUSBYMEMBERSTORE from '../commands/GEORADIUSBYMEMBERSTORE';
import * as GEORADIUSSTORE from '../commands/GEORADIUSSTORE';
import * as GEOSEARCH_WITH from '../commands/GEOSEARCH_WITH';
import * as GEOSEARCH from '../commands/GEOSEARCH';
import * as GEOSEARCHSTORE from '../commands/GEOSEARCHSTORE';
import * as GET from '../commands/GET';
import * as GETBIT from '../commands/GETBIT';
import * as GETDEL from '../commands/GETDEL';
import * as GETEX from '../commands/GETEX';
import * as GETRANGE from '../commands/GETRANGE';
import * as GETSET from '../commands/GETSET';
import * as HDEL from '../commands/HDEL';
import * as HEXISTS from '../commands/HEXISTS';
import * as HEXPIRE from '../commands/HEXPIRE';
import * as HEXPIREAT from '../commands/HEXPIREAT';
import * as HEXPIRETIME from '../commands/HEXPIRETIME';
import * as HGET from '../commands/HGET';
import * as HGETALL from '../commands/HGETALL';
import * as HINCRBY from '../commands/HINCRBY';
import * as HINCRBYFLOAT from '../commands/HINCRBYFLOAT';
import * as HKEYS from '../commands/HKEYS';
import * as HLEN from '../commands/HLEN';
import * as HMGET from '../commands/HMGET';
import * as HPERSIST from '../commands/HPERSIST';
import * as HPEXPIRE from '../commands/HPEXPIRE';
import * as HPEXPIREAT from '../commands/HPEXPIREAT';
import * as HPEXPIRETIME from '../commands/HPEXPIRETIME';
import * as HPTTL from '../commands/HPTTL';
import * as HRANDFIELD_COUNT_WITHVALUES from '../commands/HRANDFIELD_COUNT_WITHVALUES';
import * as HRANDFIELD_COUNT from '../commands/HRANDFIELD_COUNT';
import * as HRANDFIELD from '../commands/HRANDFIELD';
import * as HSCAN from '../commands/HSCAN';
import * as HSCAN_NOVALUES from '../commands/HSCAN_NOVALUES';
import * as HSET from '../commands/HSET';
import * as HSETNX from '../commands/HSETNX';
import * as HSTRLEN from '../commands/HSTRLEN';
import * as HTTL from '../commands/HTTL';
import * as HVALS from '../commands/HVALS';
import * as INCR from '../commands/INCR';
import * as INCRBY from '../commands/INCRBY';
import * as INCRBYFLOAT from '../commands/INCRBYFLOAT';
import * as LCS_IDX_WITHMATCHLEN from '../commands/LCS_IDX_WITHMATCHLEN';
import * as LCS_IDX from '../commands/LCS_IDX';
import * as LCS_LEN from '../commands/LCS_LEN';
import * as LCS from '../commands/LCS';
import * as LINDEX from '../commands/LINDEX';
import * as LINSERT from '../commands/LINSERT';
import * as LLEN from '../commands/LLEN';
import * as LMOVE from '../commands/LMOVE';
import * as LMPOP from '../commands/LMPOP';
import * as LPOP_COUNT from '../commands/LPOP_COUNT';
import * as LPOP from '../commands/LPOP';
import * as LPOS_COUNT from '../commands/LPOS_COUNT';
import * as LPOS from '../commands/LPOS';
import * as LPUSH from '../commands/LPUSH';
import * as LPUSHX from '../commands/LPUSHX';
import * as LRANGE from '../commands/LRANGE';
import * as LREM from '../commands/LREM';
import * as LSET from '../commands/LSET';
import * as LTRIM from '../commands/LTRIM';
import * as MGET from '../commands/MGET';
import * as MIGRATE from '../commands/MIGRATE';
import * as MSET from '../commands/MSET';
import * as MSETNX from '../commands/MSETNX';
import * as OBJECT_ENCODING from '../commands/OBJECT_ENCODING';
import * as OBJECT_FREQ from '../commands/OBJECT_FREQ';
import * as OBJECT_IDLETIME from '../commands/OBJECT_IDLETIME';
import * as OBJECT_REFCOUNT from '../commands/OBJECT_REFCOUNT';
import * as PERSIST from '../commands/PERSIST';
import * as PEXPIRE from '../commands/PEXPIRE';
import * as PEXPIREAT from '../commands/PEXPIREAT';
import * as PEXPIRETIME from '../commands/PEXPIRETIME';
import * as PFADD from '../commands/PFADD';
import * as PFCOUNT from '../commands/PFCOUNT';
import * as PFMERGE from '../commands/PFMERGE';
import * as PSETEX from '../commands/PSETEX';
import * as PTTL from '../commands/PTTL';
import * as PUBLISH from '../commands/PUBLISH';
import * as RENAME from '../commands/RENAME';
import * as RENAMENX from '../commands/RENAMENX';
import * as RESTORE from '../commands/RESTORE';
import * as RPOP_COUNT from '../commands/RPOP_COUNT';
import * as RPOP from '../commands/RPOP';
import * as RPOPLPUSH from '../commands/RPOPLPUSH';
import * as RPUSH from '../commands/RPUSH';
import * as RPUSHX from '../commands/RPUSHX';
import * as SADD from '../commands/SADD';
import * as SCARD from '../commands/SCARD';
import * as SDIFF from '../commands/SDIFF';
import * as SDIFFSTORE from '../commands/SDIFFSTORE';
import * as SET from '../commands/SET';
import * as SETBIT from '../commands/SETBIT';
import * as SETEX from '../commands/SETEX';
import * as SETNX from '../commands/SETNX';
import * as SETRANGE from '../commands/SETRANGE';
import * as SINTER from '../commands/SINTER';
import * as SINTERCARD from '../commands/SINTERCARD';
import * as SINTERSTORE from '../commands/SINTERSTORE';
import * as SISMEMBER from '../commands/SISMEMBER';
import * as SMEMBERS from '../commands/SMEMBERS';
import * as SMISMEMBER from '../commands/SMISMEMBER';
import * as SMOVE from '../commands/SMOVE';
import * as SORT_RO from '../commands/SORT_RO';
import * as SORT_STORE from '../commands/SORT_STORE';
import * as SORT from '../commands/SORT';
import * as SPOP from '../commands/SPOP';
import * as SPUBLISH from '../commands/SPUBLISH';
import * as SRANDMEMBER_COUNT from '../commands/SRANDMEMBER_COUNT';
import * as SRANDMEMBER from '../commands/SRANDMEMBER';
import * as SREM from '../commands/SREM';
import * as SSCAN from '../commands/SSCAN';
import * as STRLEN from '../commands/STRLEN';
import * as SUNION from '../commands/SUNION';
import * as SUNIONSTORE from '../commands/SUNIONSTORE';
import * as TOUCH from '../commands/TOUCH';
import * as TTL from '../commands/TTL';
import * as TYPE from '../commands/TYPE';
import * as UNLINK from '../commands/UNLINK';
import * as WATCH from '../commands/WATCH';
import * as XACK from '../commands/XACK';
import * as XADD from '../commands/XADD';
import * as XAUTOCLAIM_JUSTID from '../commands/XAUTOCLAIM_JUSTID';
import * as XAUTOCLAIM from '../commands/XAUTOCLAIM';
import * as XCLAIM_JUSTID from '../commands/XCLAIM_JUSTID';
import * as XCLAIM from '../commands/XCLAIM';
import * as XDEL from '../commands/XDEL';
import * as XGROUP_CREATE from '../commands/XGROUP_CREATE';
import * as XGROUP_CREATECONSUMER from '../commands/XGROUP_CREATECONSUMER';
import * as XGROUP_DELCONSUMER from '../commands/XGROUP_DELCONSUMER';
import * as XGROUP_DESTROY from '../commands/XGROUP_DESTROY';
import * as XGROUP_SETID from '../commands/XGROUP_SETID';
import * as XINFO_CONSUMERS from '../commands/XINFO_CONSUMERS';
import * as XINFO_GROUPS from '../commands/XINFO_GROUPS';
import * as XINFO_STREAM from '../commands/XINFO_STREAM';
import * as XLEN from '../commands/XLEN';
import * as XPENDING_RANGE from '../commands/XPENDING_RANGE';
import * as XPENDING from '../commands/XPENDING';
import * as XRANGE from '../commands/XRANGE';
import * as XREAD from '../commands/XREAD';
import * as XREADGROUP from '../commands/XREADGROUP';
import * as XREVRANGE from '../commands/XREVRANGE';
import * as XSETID from '../commands/XSETID';
import * as XTRIM from '../commands/XTRIM';
import * as ZADD from '../commands/ZADD';
import * as ZCARD from '../commands/ZCARD';
import * as ZCOUNT from '../commands/ZCOUNT';
import * as ZDIFF_WITHSCORES from '../commands/ZDIFF_WITHSCORES';
import * as ZDIFF from '../commands/ZDIFF';
import * as ZDIFFSTORE from '../commands/ZDIFFSTORE';
import * as ZINCRBY from '../commands/ZINCRBY';
import * as ZINTER_WITHSCORES from '../commands/ZINTER_WITHSCORES';
import * as ZINTER from '../commands/ZINTER';
import * as ZINTERCARD from '../commands/ZINTERCARD';
import * as ZINTERSTORE from '../commands/ZINTERSTORE';
import * as ZLEXCOUNT from '../commands/ZLEXCOUNT';
import * as ZMPOP from '../commands/ZMPOP';
import * as ZMSCORE from '../commands/ZMSCORE';
import * as ZPOPMAX_COUNT from '../commands/ZPOPMAX_COUNT';
import * as ZPOPMAX from '../commands/ZPOPMAX';
import * as ZPOPMIN_COUNT from '../commands/ZPOPMIN_COUNT';
import * as ZPOPMIN from '../commands/ZPOPMIN';
import * as ZRANDMEMBER_COUNT_WITHSCORES from '../commands/ZRANDMEMBER_COUNT_WITHSCORES';
import * as ZRANDMEMBER_COUNT from '../commands/ZRANDMEMBER_COUNT';
import * as ZRANDMEMBER from '../commands/ZRANDMEMBER';
import * as ZRANGE_WITHSCORES from '../commands/ZRANGE_WITHSCORES';
import * as ZRANGE from '../commands/ZRANGE';
import * as ZRANGEBYLEX from '../commands/ZRANGEBYLEX';
import * as ZRANGEBYSCORE_WITHSCORES from '../commands/ZRANGEBYSCORE_WITHSCORES';
import * as ZRANGEBYSCORE from '../commands/ZRANGEBYSCORE';
import * as ZRANGESTORE from '../commands/ZRANGESTORE';
import * as ZRANK from '../commands/ZRANK';
import * as ZREM from '../commands/ZREM';
import * as ZREMRANGEBYLEX from '../commands/ZREMRANGEBYLEX';
import * as ZREMRANGEBYRANK from '../commands/ZREMRANGEBYRANK';
import * as ZREMRANGEBYSCORE from '../commands/ZREMRANGEBYSCORE';
import * as ZREVRANK from '../commands/ZREVRANK';
import * as ZSCAN from '../commands/ZSCAN';
import * as ZSCORE from '../commands/ZSCORE';
import * as ZUNION_WITHSCORES from '../commands/ZUNION_WITHSCORES';
import * as ZUNION from '../commands/ZUNION';
import * as ZUNIONSTORE from '../commands/ZUNIONSTORE';
declare const _default: {
APPEND: typeof APPEND;
append: typeof APPEND;
BITCOUNT: typeof BITCOUNT;
bitCount: typeof BITCOUNT;
BITFIELD_RO: typeof BITFIELD_RO;
bitFieldRo: typeof BITFIELD_RO;
BITFIELD: typeof BITFIELD;
bitField: typeof BITFIELD;
BITOP: typeof BITOP;
bitOp: typeof BITOP;
BITPOS: typeof BITPOS;
bitPos: typeof BITPOS;
BLMOVE: typeof BLMOVE;
blMove: typeof BLMOVE;
BLMPOP: typeof BLMPOP;
blmPop: typeof BLMPOP;
BLPOP: typeof BLPOP;
blPop: typeof BLPOP;
BRPOP: typeof BRPOP;
brPop: typeof BRPOP;
BRPOPLPUSH: typeof BRPOPLPUSH;
brPopLPush: typeof BRPOPLPUSH;
BZMPOP: typeof BZMPOP;
bzmPop: typeof BZMPOP;
BZPOPMAX: typeof BZPOPMAX;
bzPopMax: typeof BZPOPMAX;
BZPOPMIN: typeof BZPOPMIN;
bzPopMin: typeof BZPOPMIN;
COPY: typeof COPY;
copy: typeof COPY;
DECR: typeof DECR;
decr: typeof DECR;
DECRBY: typeof DECRBY;
decrBy: typeof DECRBY;
DEL: typeof DEL;
del: typeof DEL;
DUMP: typeof DUMP;
dump: typeof DUMP;
EVAL_RO: typeof EVAL_RO;
evalRo: typeof EVAL_RO;
EVAL: typeof EVAL;
eval: typeof EVAL;
EVALSHA: typeof EVALSHA;
evalSha: typeof EVALSHA;
EVALSHA_RO: typeof EVALSHA_RO;
evalShaRo: typeof EVALSHA_RO;
EXISTS: typeof EXISTS;
exists: typeof EXISTS;
EXPIRE: typeof EXPIRE;
expire: typeof EXPIRE;
EXPIREAT: typeof EXPIREAT;
expireAt: typeof EXPIREAT;
EXPIRETIME: typeof EXPIRETIME;
expireTime: typeof EXPIRETIME;
FCALL_RO: typeof FCALL_RO;
fCallRo: typeof FCALL_RO;
FCALL: typeof FCALL;
fCall: typeof FCALL;
GEOADD: typeof GEOADD;
geoAdd: typeof GEOADD;
GEODIST: typeof GEODIST;
geoDist: typeof GEODIST;
GEOHASH: typeof GEOHASH;
geoHash: typeof GEOHASH;
GEOPOS: typeof GEOPOS;
geoPos: typeof GEOPOS;
GEORADIUS_RO_WITH: typeof GEORADIUS_RO_WITH;
geoRadiusRoWith: typeof GEORADIUS_RO_WITH;
GEORADIUS_RO: typeof GEORADIUS_RO;
geoRadiusRo: typeof GEORADIUS_RO;
GEORADIUS_WITH: typeof GEORADIUS_WITH;
geoRadiusWith: typeof GEORADIUS_WITH;
GEORADIUS: typeof GEORADIUS;
geoRadius: typeof GEORADIUS;
GEORADIUSBYMEMBER_RO_WITH: typeof GEORADIUSBYMEMBER_RO_WITH;
geoRadiusByMemberRoWith: typeof GEORADIUSBYMEMBER_RO_WITH;
GEORADIUSBYMEMBER_RO: typeof GEORADIUSBYMEMBER_RO;
geoRadiusByMemberRo: typeof GEORADIUSBYMEMBER_RO;
GEORADIUSBYMEMBER_WITH: typeof GEORADIUSBYMEMBER_WITH;
geoRadiusByMemberWith: typeof GEORADIUSBYMEMBER_WITH;
GEORADIUSBYMEMBER: typeof GEORADIUSBYMEMBER;
geoRadiusByMember: typeof GEORADIUSBYMEMBER;
GEORADIUSBYMEMBERSTORE: typeof GEORADIUSBYMEMBERSTORE;
geoRadiusByMemberStore: typeof GEORADIUSBYMEMBERSTORE;
GEORADIUSSTORE: typeof GEORADIUSSTORE;
geoRadiusStore: typeof GEORADIUSSTORE;
GEOSEARCH_WITH: typeof GEOSEARCH_WITH;
geoSearchWith: typeof GEOSEARCH_WITH;
GEOSEARCH: typeof GEOSEARCH;
geoSearch: typeof GEOSEARCH;
GEOSEARCHSTORE: typeof GEOSEARCHSTORE;
geoSearchStore: typeof GEOSEARCHSTORE;
GET: typeof GET;
get: typeof GET;
GETBIT: typeof GETBIT;
getBit: typeof GETBIT;
GETDEL: typeof GETDEL;
getDel: typeof GETDEL;
GETEX: typeof GETEX;
getEx: typeof GETEX;
GETRANGE: typeof GETRANGE;
getRange: typeof GETRANGE;
GETSET: typeof GETSET;
getSet: typeof GETSET;
HDEL: typeof HDEL;
hDel: typeof HDEL;
HEXISTS: typeof HEXISTS;
hExists: typeof HEXISTS;
HEXPIRE: typeof HEXPIRE;
hExpire: typeof HEXPIRE;
HEXPIREAT: typeof HEXPIREAT;
hExpireAt: typeof HEXPIREAT;
HEXPIRETIME: typeof HEXPIRETIME;
hExpireTime: typeof HEXPIRETIME;
HGET: typeof HGET;
hGet: typeof HGET;
HGETALL: typeof HGETALL;
hGetAll: typeof HGETALL;
HINCRBY: typeof HINCRBY;
hIncrBy: typeof HINCRBY;
HINCRBYFLOAT: typeof HINCRBYFLOAT;
hIncrByFloat: typeof HINCRBYFLOAT;
HKEYS: typeof HKEYS;
hKeys: typeof HKEYS;
HLEN: typeof HLEN;
hLen: typeof HLEN;
HMGET: typeof HMGET;
hmGet: typeof HMGET;
HPERSIST: typeof HPERSIST;
hPersist: typeof HPERSIST;
HPEXPIRE: typeof HPEXPIRE;
hpExpire: typeof HPEXPIRE;
HPEXPIREAT: typeof HPEXPIREAT;
hpExpireAt: typeof HPEXPIREAT;
HPEXPIRETIME: typeof HPEXPIRETIME;
hpExpireTime: typeof HPEXPIRETIME;
HPTTL: typeof HPTTL;
hpTTL: typeof HPTTL;
HRANDFIELD_COUNT_WITHVALUES: typeof HRANDFIELD_COUNT_WITHVALUES;
hRandFieldCountWithValues: typeof HRANDFIELD_COUNT_WITHVALUES;
HRANDFIELD_COUNT: typeof HRANDFIELD_COUNT;
hRandFieldCount: typeof HRANDFIELD_COUNT;
HRANDFIELD: typeof HRANDFIELD;
hRandField: typeof HRANDFIELD;
HSCAN: typeof HSCAN;
hScan: typeof HSCAN;
HSCAN_NOVALUES: typeof HSCAN_NOVALUES;
hScanNoValues: typeof HSCAN_NOVALUES;
HSET: typeof HSET;
hSet: typeof HSET;
HSETNX: typeof HSETNX;
hSetNX: typeof HSETNX;
HSTRLEN: typeof HSTRLEN;
hStrLen: typeof HSTRLEN;
HTTL: typeof HTTL;
hTTL: typeof HTTL;
HVALS: typeof HVALS;
hVals: typeof HVALS;
INCR: typeof INCR;
incr: typeof INCR;
INCRBY: typeof INCRBY;
incrBy: typeof INCRBY;
INCRBYFLOAT: typeof INCRBYFLOAT;
incrByFloat: typeof INCRBYFLOAT;
LCS_IDX_WITHMATCHLEN: typeof LCS_IDX_WITHMATCHLEN;
lcsIdxWithMatchLen: typeof LCS_IDX_WITHMATCHLEN;
LCS_IDX: typeof LCS_IDX;
lcsIdx: typeof LCS_IDX;
LCS_LEN: typeof LCS_LEN;
lcsLen: typeof LCS_LEN;
LCS: typeof LCS;
lcs: typeof LCS;
LINDEX: typeof LINDEX;
lIndex: typeof LINDEX;
LINSERT: typeof LINSERT;
lInsert: typeof LINSERT;
LLEN: typeof LLEN;
lLen: typeof LLEN;
LMOVE: typeof LMOVE;
lMove: typeof LMOVE;
LMPOP: typeof LMPOP;
lmPop: typeof LMPOP;
LPOP_COUNT: typeof LPOP_COUNT;
lPopCount: typeof LPOP_COUNT;
LPOP: typeof LPOP;
lPop: typeof LPOP;
LPOS_COUNT: typeof LPOS_COUNT;
lPosCount: typeof LPOS_COUNT;
LPOS: typeof LPOS;
lPos: typeof LPOS;
LPUSH: typeof LPUSH;
lPush: typeof LPUSH;
LPUSHX: typeof LPUSHX;
lPushX: typeof LPUSHX;
LRANGE: typeof LRANGE;
lRange: typeof LRANGE;
LREM: typeof LREM;
lRem: typeof LREM;
LSET: typeof LSET;
lSet: typeof LSET;
LTRIM: typeof LTRIM;
lTrim: typeof LTRIM;
MGET: typeof MGET;
mGet: typeof MGET;
MIGRATE: typeof MIGRATE;
migrate: typeof MIGRATE;
MSET: typeof MSET;
mSet: typeof MSET;
MSETNX: typeof MSETNX;
mSetNX: typeof MSETNX;
OBJECT_ENCODING: typeof OBJECT_ENCODING;
objectEncoding: typeof OBJECT_ENCODING;
OBJECT_FREQ: typeof OBJECT_FREQ;
objectFreq: typeof OBJECT_FREQ;
OBJECT_IDLETIME: typeof OBJECT_IDLETIME;
objectIdleTime: typeof OBJECT_IDLETIME;
OBJECT_REFCOUNT: typeof OBJECT_REFCOUNT;
objectRefCount: typeof OBJECT_REFCOUNT;
PERSIST: typeof PERSIST;
persist: typeof PERSIST;
PEXPIRE: typeof PEXPIRE;
pExpire: typeof PEXPIRE;
PEXPIREAT: typeof PEXPIREAT;
pExpireAt: typeof PEXPIREAT;
PEXPIRETIME: typeof PEXPIRETIME;
pExpireTime: typeof PEXPIRETIME;
PFADD: typeof PFADD;
pfAdd: typeof PFADD;
PFCOUNT: typeof PFCOUNT;
pfCount: typeof PFCOUNT;
PFMERGE: typeof PFMERGE;
pfMerge: typeof PFMERGE;
PSETEX: typeof PSETEX;
pSetEx: typeof PSETEX;
PTTL: typeof PTTL;
pTTL: typeof PTTL;
PUBLISH: typeof PUBLISH;
publish: typeof PUBLISH;
RENAME: typeof RENAME;
rename: typeof RENAME;
RENAMENX: typeof RENAMENX;
renameNX: typeof RENAMENX;
RESTORE: typeof RESTORE;
restore: typeof RESTORE;
RPOP_COUNT: typeof RPOP_COUNT;
rPopCount: typeof RPOP_COUNT;
RPOP: typeof RPOP;
rPop: typeof RPOP;
RPOPLPUSH: typeof RPOPLPUSH;
rPopLPush: typeof RPOPLPUSH;
RPUSH: typeof RPUSH;
rPush: typeof RPUSH;
RPUSHX: typeof RPUSHX;
rPushX: typeof RPUSHX;
SADD: typeof SADD;
sAdd: typeof SADD;
SCARD: typeof SCARD;
sCard: typeof SCARD;
SDIFF: typeof SDIFF;
sDiff: typeof SDIFF;
SDIFFSTORE: typeof SDIFFSTORE;
sDiffStore: typeof SDIFFSTORE;
SINTER: typeof SINTER;
sInter: typeof SINTER;
SINTERCARD: typeof SINTERCARD;
sInterCard: typeof SINTERCARD;
SINTERSTORE: typeof SINTERSTORE;
sInterStore: typeof SINTERSTORE;
SET: typeof SET;
set: typeof SET;
SETBIT: typeof SETBIT;
setBit: typeof SETBIT;
SETEX: typeof SETEX;
setEx: typeof SETEX;
SETNX: typeof SETNX;
setNX: typeof SETNX;
SETRANGE: typeof SETRANGE;
setRange: typeof SETRANGE;
SISMEMBER: typeof SISMEMBER;
sIsMember: typeof SISMEMBER;
SMEMBERS: typeof SMEMBERS;
sMembers: typeof SMEMBERS;
SMISMEMBER: typeof SMISMEMBER;
smIsMember: typeof SMISMEMBER;
SMOVE: typeof SMOVE;
sMove: typeof SMOVE;
SORT_RO: typeof SORT_RO;
sortRo: typeof SORT_RO;
SORT_STORE: typeof SORT_STORE;
sortStore: typeof SORT_STORE;
SORT: typeof SORT;
sort: typeof SORT;
SPOP: typeof SPOP;
sPop: typeof SPOP;
SPUBLISH: typeof SPUBLISH;
sPublish: typeof SPUBLISH;
SRANDMEMBER_COUNT: typeof SRANDMEMBER_COUNT;
sRandMemberCount: typeof SRANDMEMBER_COUNT;
SRANDMEMBER: typeof SRANDMEMBER;
sRandMember: typeof SRANDMEMBER;
SREM: typeof SREM;
sRem: typeof SREM;
SSCAN: typeof SSCAN;
sScan: typeof SSCAN;
STRLEN: typeof STRLEN;
strLen: typeof STRLEN;
SUNION: typeof SUNION;
sUnion: typeof SUNION;
SUNIONSTORE: typeof SUNIONSTORE;
sUnionStore: typeof SUNIONSTORE;
TOUCH: typeof TOUCH;
touch: typeof TOUCH;
TTL: typeof TTL;
ttl: typeof TTL;
TYPE: typeof TYPE;
type: typeof TYPE;
UNLINK: typeof UNLINK;
unlink: typeof UNLINK;
WATCH: typeof WATCH;
watch: typeof WATCH;
XACK: typeof XACK;
xAck: typeof XACK;
XADD: typeof XADD;
xAdd: typeof XADD;
XAUTOCLAIM_JUSTID: typeof XAUTOCLAIM_JUSTID;
xAutoClaimJustId: typeof XAUTOCLAIM_JUSTID;
XAUTOCLAIM: typeof XAUTOCLAIM;
xAutoClaim: typeof XAUTOCLAIM;
XCLAIM: typeof XCLAIM;
xClaim: typeof XCLAIM;
XCLAIM_JUSTID: typeof XCLAIM_JUSTID;
xClaimJustId: typeof XCLAIM_JUSTID;
XDEL: typeof XDEL;
xDel: typeof XDEL;
XGROUP_CREATE: typeof XGROUP_CREATE;
xGroupCreate: typeof XGROUP_CREATE;
XGROUP_CREATECONSUMER: typeof XGROUP_CREATECONSUMER;
xGroupCreateConsumer: typeof XGROUP_CREATECONSUMER;
XGROUP_DELCONSUMER: typeof XGROUP_DELCONSUMER;
xGroupDelConsumer: typeof XGROUP_DELCONSUMER;
XGROUP_DESTROY: typeof XGROUP_DESTROY;
xGroupDestroy: typeof XGROUP_DESTROY;
XGROUP_SETID: typeof XGROUP_SETID;
xGroupSetId: typeof XGROUP_SETID;
XINFO_CONSUMERS: typeof XINFO_CONSUMERS;
xInfoConsumers: typeof XINFO_CONSUMERS;
XINFO_GROUPS: typeof XINFO_GROUPS;
xInfoGroups: typeof XINFO_GROUPS;
XINFO_STREAM: typeof XINFO_STREAM;
xInfoStream: typeof XINFO_STREAM;
XLEN: typeof XLEN;
xLen: typeof XLEN;
XPENDING_RANGE: typeof XPENDING_RANGE;
xPendingRange: typeof XPENDING_RANGE;
XPENDING: typeof XPENDING;
xPending: typeof XPENDING;
XRANGE: typeof XRANGE;
xRange: typeof XRANGE;
XREAD: typeof XREAD;
xRead: typeof XREAD;
XREADGROUP: typeof XREADGROUP;
xReadGroup: typeof XREADGROUP;
XREVRANGE: typeof XREVRANGE;
xRevRange: typeof XREVRANGE;
XSETID: typeof XSETID;
xSetId: typeof XSETID;
XTRIM: typeof XTRIM;
xTrim: typeof XTRIM;
ZADD: typeof ZADD;
zAdd: typeof ZADD;
ZCARD: typeof ZCARD;
zCard: typeof ZCARD;
ZCOUNT: typeof ZCOUNT;
zCount: typeof ZCOUNT;
ZDIFF_WITHSCORES: typeof ZDIFF_WITHSCORES;
zDiffWithScores: typeof ZDIFF_WITHSCORES;
ZDIFF: typeof ZDIFF;
zDiff: typeof ZDIFF;
ZDIFFSTORE: typeof ZDIFFSTORE;
zDiffStore: typeof ZDIFFSTORE;
ZINCRBY: typeof ZINCRBY;
zIncrBy: typeof ZINCRBY;
ZINTER_WITHSCORES: typeof ZINTER_WITHSCORES;
zInterWithScores: typeof ZINTER_WITHSCORES;
ZINTER: typeof ZINTER;
zInter: typeof ZINTER;
ZINTERCARD: typeof ZINTERCARD;
zInterCard: typeof ZINTERCARD;
ZINTERSTORE: typeof ZINTERSTORE;
zInterStore: typeof ZINTERSTORE;
ZLEXCOUNT: typeof ZLEXCOUNT;
zLexCount: typeof ZLEXCOUNT;
ZMPOP: typeof ZMPOP;
zmPop: typeof ZMPOP;
ZMSCORE: typeof ZMSCORE;
zmScore: typeof ZMSCORE;
ZPOPMAX_COUNT: typeof ZPOPMAX_COUNT;
zPopMaxCount: typeof ZPOPMAX_COUNT;
ZPOPMAX: typeof ZPOPMAX;
zPopMax: typeof ZPOPMAX;
ZPOPMIN_COUNT: typeof ZPOPMIN_COUNT;
zPopMinCount: typeof ZPOPMIN_COUNT;
ZPOPMIN: typeof ZPOPMIN;
zPopMin: typeof ZPOPMIN;
ZRANDMEMBER_COUNT_WITHSCORES: typeof ZRANDMEMBER_COUNT_WITHSCORES;
zRandMemberCountWithScores: typeof ZRANDMEMBER_COUNT_WITHSCORES;
ZRANDMEMBER_COUNT: typeof ZRANDMEMBER_COUNT;
zRandMemberCount: typeof ZRANDMEMBER_COUNT;
ZRANDMEMBER: typeof ZRANDMEMBER;
zRandMember: typeof ZRANDMEMBER;
ZRANGE_WITHSCORES: typeof ZRANGE_WITHSCORES;
zRangeWithScores: typeof ZRANGE_WITHSCORES;
ZRANGE: typeof ZRANGE;
zRange: typeof ZRANGE;
ZRANGEBYLEX: typeof ZRANGEBYLEX;
zRangeByLex: typeof ZRANGEBYLEX;
ZRANGEBYSCORE_WITHSCORES: typeof ZRANGEBYSCORE_WITHSCORES;
zRangeByScoreWithScores: typeof ZRANGEBYSCORE_WITHSCORES;
ZRANGEBYSCORE: typeof ZRANGEBYSCORE;
zRangeByScore: typeof ZRANGEBYSCORE;
ZRANGESTORE: typeof ZRANGESTORE;
zRangeStore: typeof ZRANGESTORE;
ZRANK: typeof ZRANK;
zRank: typeof ZRANK;
ZREM: typeof ZREM;
zRem: typeof ZREM;
ZREMRANGEBYLEX: typeof ZREMRANGEBYLEX;
zRemRangeByLex: typeof ZREMRANGEBYLEX;
ZREMRANGEBYRANK: typeof ZREMRANGEBYRANK;
zRemRangeByRank: typeof ZREMRANGEBYRANK;
ZREMRANGEBYSCORE: typeof ZREMRANGEBYSCORE;
zRemRangeByScore: typeof ZREMRANGEBYSCORE;
ZREVRANK: typeof ZREVRANK;
zRevRank: typeof ZREVRANK;
ZSCAN: typeof ZSCAN;
zScan: typeof ZSCAN;
ZSCORE: typeof ZSCORE;
zScore: typeof ZSCORE;
ZUNION_WITHSCORES: typeof ZUNION_WITHSCORES;
zUnionWithScores: typeof ZUNION_WITHSCORES;
ZUNION: typeof ZUNION;
zUnion: typeof ZUNION;
ZUNIONSTORE: typeof ZUNIONSTORE;
zUnionStore: typeof ZUNIONSTORE;
};
export default _default;

View File

@@ -0,0 +1,670 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const APPEND = require("../commands/APPEND");
const BITCOUNT = require("../commands/BITCOUNT");
const BITFIELD_RO = require("../commands/BITFIELD_RO");
const BITFIELD = require("../commands/BITFIELD");
const BITOP = require("../commands/BITOP");
const BITPOS = require("../commands/BITPOS");
const BLMOVE = require("../commands/BLMOVE");
const BLMPOP = require("../commands/BLMPOP");
const BLPOP = require("../commands/BLPOP");
const BRPOP = require("../commands/BRPOP");
const BRPOPLPUSH = require("../commands/BRPOPLPUSH");
const BZMPOP = require("../commands/BZMPOP");
const BZPOPMAX = require("../commands/BZPOPMAX");
const BZPOPMIN = require("../commands/BZPOPMIN");
const COPY = require("../commands/COPY");
const DECR = require("../commands/DECR");
const DECRBY = require("../commands/DECRBY");
const DEL = require("../commands/DEL");
const DUMP = require("../commands/DUMP");
const EVAL_RO = require("../commands/EVAL_RO");
const EVAL = require("../commands/EVAL");
const EVALSHA_RO = require("../commands/EVALSHA_RO");
const EVALSHA = require("../commands/EVALSHA");
const EXISTS = require("../commands/EXISTS");
const EXPIRE = require("../commands/EXPIRE");
const EXPIREAT = require("../commands/EXPIREAT");
const EXPIRETIME = require("../commands/EXPIRETIME");
const FCALL_RO = require("../commands/FCALL_RO");
const FCALL = require("../commands/FCALL");
const GEOADD = require("../commands/GEOADD");
const GEODIST = require("../commands/GEODIST");
const GEOHASH = require("../commands/GEOHASH");
const GEOPOS = require("../commands/GEOPOS");
const GEORADIUS_RO_WITH = require("../commands/GEORADIUS_RO_WITH");
const GEORADIUS_RO = require("../commands/GEORADIUS_RO");
const GEORADIUS_WITH = require("../commands/GEORADIUS_WITH");
const GEORADIUS = require("../commands/GEORADIUS");
const GEORADIUSBYMEMBER_RO_WITH = require("../commands/GEORADIUSBYMEMBER_RO_WITH");
const GEORADIUSBYMEMBER_RO = require("../commands/GEORADIUSBYMEMBER_RO");
const GEORADIUSBYMEMBER_WITH = require("../commands/GEORADIUSBYMEMBER_WITH");
const GEORADIUSBYMEMBER = require("../commands/GEORADIUSBYMEMBER");
const GEORADIUSBYMEMBERSTORE = require("../commands/GEORADIUSBYMEMBERSTORE");
const GEORADIUSSTORE = require("../commands/GEORADIUSSTORE");
const GEOSEARCH_WITH = require("../commands/GEOSEARCH_WITH");
const GEOSEARCH = require("../commands/GEOSEARCH");
const GEOSEARCHSTORE = require("../commands/GEOSEARCHSTORE");
const GET = require("../commands/GET");
const GETBIT = require("../commands/GETBIT");
const GETDEL = require("../commands/GETDEL");
const GETEX = require("../commands/GETEX");
const GETRANGE = require("../commands/GETRANGE");
const GETSET = require("../commands/GETSET");
const HDEL = require("../commands/HDEL");
const HEXISTS = require("../commands/HEXISTS");
const HEXPIRE = require("../commands/HEXPIRE");
const HEXPIREAT = require("../commands/HEXPIREAT");
const HEXPIRETIME = require("../commands/HEXPIRETIME");
const HGET = require("../commands/HGET");
const HGETALL = require("../commands/HGETALL");
const HINCRBY = require("../commands/HINCRBY");
const HINCRBYFLOAT = require("../commands/HINCRBYFLOAT");
const HKEYS = require("../commands/HKEYS");
const HLEN = require("../commands/HLEN");
const HMGET = require("../commands/HMGET");
const HPERSIST = require("../commands/HPERSIST");
const HPEXPIRE = require("../commands/HPEXPIRE");
const HPEXPIREAT = require("../commands/HPEXPIREAT");
const HPEXPIRETIME = require("../commands/HPEXPIRETIME");
const HPTTL = require("../commands/HPTTL");
const HRANDFIELD_COUNT_WITHVALUES = require("../commands/HRANDFIELD_COUNT_WITHVALUES");
const HRANDFIELD_COUNT = require("../commands/HRANDFIELD_COUNT");
const HRANDFIELD = require("../commands/HRANDFIELD");
const HSCAN = require("../commands/HSCAN");
const HSCAN_NOVALUES = require("../commands/HSCAN_NOVALUES");
const HSET = require("../commands/HSET");
const HSETNX = require("../commands/HSETNX");
const HSTRLEN = require("../commands/HSTRLEN");
const HTTL = require("../commands/HTTL");
const HVALS = require("../commands/HVALS");
const INCR = require("../commands/INCR");
const INCRBY = require("../commands/INCRBY");
const INCRBYFLOAT = require("../commands/INCRBYFLOAT");
const LCS_IDX_WITHMATCHLEN = require("../commands/LCS_IDX_WITHMATCHLEN");
const LCS_IDX = require("../commands/LCS_IDX");
const LCS_LEN = require("../commands/LCS_LEN");
const LCS = require("../commands/LCS");
const LINDEX = require("../commands/LINDEX");
const LINSERT = require("../commands/LINSERT");
const LLEN = require("../commands/LLEN");
const LMOVE = require("../commands/LMOVE");
const LMPOP = require("../commands/LMPOP");
const LPOP_COUNT = require("../commands/LPOP_COUNT");
const LPOP = require("../commands/LPOP");
const LPOS_COUNT = require("../commands/LPOS_COUNT");
const LPOS = require("../commands/LPOS");
const LPUSH = require("../commands/LPUSH");
const LPUSHX = require("../commands/LPUSHX");
const LRANGE = require("../commands/LRANGE");
const LREM = require("../commands/LREM");
const LSET = require("../commands/LSET");
const LTRIM = require("../commands/LTRIM");
const MGET = require("../commands/MGET");
const MIGRATE = require("../commands/MIGRATE");
const MSET = require("../commands/MSET");
const MSETNX = require("../commands/MSETNX");
const OBJECT_ENCODING = require("../commands/OBJECT_ENCODING");
const OBJECT_FREQ = require("../commands/OBJECT_FREQ");
const OBJECT_IDLETIME = require("../commands/OBJECT_IDLETIME");
const OBJECT_REFCOUNT = require("../commands/OBJECT_REFCOUNT");
const PERSIST = require("../commands/PERSIST");
const PEXPIRE = require("../commands/PEXPIRE");
const PEXPIREAT = require("../commands/PEXPIREAT");
const PEXPIRETIME = require("../commands/PEXPIRETIME");
const PFADD = require("../commands/PFADD");
const PFCOUNT = require("../commands/PFCOUNT");
const PFMERGE = require("../commands/PFMERGE");
const PSETEX = require("../commands/PSETEX");
const PTTL = require("../commands/PTTL");
const PUBLISH = require("../commands/PUBLISH");
const RENAME = require("../commands/RENAME");
const RENAMENX = require("../commands/RENAMENX");
const RESTORE = require("../commands/RESTORE");
const RPOP_COUNT = require("../commands/RPOP_COUNT");
const RPOP = require("../commands/RPOP");
const RPOPLPUSH = require("../commands/RPOPLPUSH");
const RPUSH = require("../commands/RPUSH");
const RPUSHX = require("../commands/RPUSHX");
const SADD = require("../commands/SADD");
const SCARD = require("../commands/SCARD");
const SDIFF = require("../commands/SDIFF");
const SDIFFSTORE = require("../commands/SDIFFSTORE");
const SET = require("../commands/SET");
const SETBIT = require("../commands/SETBIT");
const SETEX = require("../commands/SETEX");
const SETNX = require("../commands/SETNX");
const SETRANGE = require("../commands/SETRANGE");
const SINTER = require("../commands/SINTER");
const SINTERCARD = require("../commands/SINTERCARD");
const SINTERSTORE = require("../commands/SINTERSTORE");
const SISMEMBER = require("../commands/SISMEMBER");
const SMEMBERS = require("../commands/SMEMBERS");
const SMISMEMBER = require("../commands/SMISMEMBER");
const SMOVE = require("../commands/SMOVE");
const SORT_RO = require("../commands/SORT_RO");
const SORT_STORE = require("../commands/SORT_STORE");
const SORT = require("../commands/SORT");
const SPOP = require("../commands/SPOP");
const SPUBLISH = require("../commands/SPUBLISH");
const SRANDMEMBER_COUNT = require("../commands/SRANDMEMBER_COUNT");
const SRANDMEMBER = require("../commands/SRANDMEMBER");
const SREM = require("../commands/SREM");
const SSCAN = require("../commands/SSCAN");
const STRLEN = require("../commands/STRLEN");
const SUNION = require("../commands/SUNION");
const SUNIONSTORE = require("../commands/SUNIONSTORE");
const TOUCH = require("../commands/TOUCH");
const TTL = require("../commands/TTL");
const TYPE = require("../commands/TYPE");
const UNLINK = require("../commands/UNLINK");
const WATCH = require("../commands/WATCH");
const XACK = require("../commands/XACK");
const XADD = require("../commands/XADD");
const XAUTOCLAIM_JUSTID = require("../commands/XAUTOCLAIM_JUSTID");
const XAUTOCLAIM = require("../commands/XAUTOCLAIM");
const XCLAIM_JUSTID = require("../commands/XCLAIM_JUSTID");
const XCLAIM = require("../commands/XCLAIM");
const XDEL = require("../commands/XDEL");
const XGROUP_CREATE = require("../commands/XGROUP_CREATE");
const XGROUP_CREATECONSUMER = require("../commands/XGROUP_CREATECONSUMER");
const XGROUP_DELCONSUMER = require("../commands/XGROUP_DELCONSUMER");
const XGROUP_DESTROY = require("../commands/XGROUP_DESTROY");
const XGROUP_SETID = require("../commands/XGROUP_SETID");
const XINFO_CONSUMERS = require("../commands/XINFO_CONSUMERS");
const XINFO_GROUPS = require("../commands/XINFO_GROUPS");
const XINFO_STREAM = require("../commands/XINFO_STREAM");
const XLEN = require("../commands/XLEN");
const XPENDING_RANGE = require("../commands/XPENDING_RANGE");
const XPENDING = require("../commands/XPENDING");
const XRANGE = require("../commands/XRANGE");
const XREAD = require("../commands/XREAD");
const XREADGROUP = require("../commands/XREADGROUP");
const XREVRANGE = require("../commands/XREVRANGE");
const XSETID = require("../commands/XSETID");
const XTRIM = require("../commands/XTRIM");
const ZADD = require("../commands/ZADD");
const ZCARD = require("../commands/ZCARD");
const ZCOUNT = require("../commands/ZCOUNT");
const ZDIFF_WITHSCORES = require("../commands/ZDIFF_WITHSCORES");
const ZDIFF = require("../commands/ZDIFF");
const ZDIFFSTORE = require("../commands/ZDIFFSTORE");
const ZINCRBY = require("../commands/ZINCRBY");
const ZINTER_WITHSCORES = require("../commands/ZINTER_WITHSCORES");
const ZINTER = require("../commands/ZINTER");
const ZINTERCARD = require("../commands/ZINTERCARD");
const ZINTERSTORE = require("../commands/ZINTERSTORE");
const ZLEXCOUNT = require("../commands/ZLEXCOUNT");
const ZMPOP = require("../commands/ZMPOP");
const ZMSCORE = require("../commands/ZMSCORE");
const ZPOPMAX_COUNT = require("../commands/ZPOPMAX_COUNT");
const ZPOPMAX = require("../commands/ZPOPMAX");
const ZPOPMIN_COUNT = require("../commands/ZPOPMIN_COUNT");
const ZPOPMIN = require("../commands/ZPOPMIN");
const ZRANDMEMBER_COUNT_WITHSCORES = require("../commands/ZRANDMEMBER_COUNT_WITHSCORES");
const ZRANDMEMBER_COUNT = require("../commands/ZRANDMEMBER_COUNT");
const ZRANDMEMBER = require("../commands/ZRANDMEMBER");
const ZRANGE_WITHSCORES = require("../commands/ZRANGE_WITHSCORES");
const ZRANGE = require("../commands/ZRANGE");
const ZRANGEBYLEX = require("../commands/ZRANGEBYLEX");
const ZRANGEBYSCORE_WITHSCORES = require("../commands/ZRANGEBYSCORE_WITHSCORES");
const ZRANGEBYSCORE = require("../commands/ZRANGEBYSCORE");
const ZRANGESTORE = require("../commands/ZRANGESTORE");
const ZRANK = require("../commands/ZRANK");
const ZREM = require("../commands/ZREM");
const ZREMRANGEBYLEX = require("../commands/ZREMRANGEBYLEX");
const ZREMRANGEBYRANK = require("../commands/ZREMRANGEBYRANK");
const ZREMRANGEBYSCORE = require("../commands/ZREMRANGEBYSCORE");
const ZREVRANK = require("../commands/ZREVRANK");
const ZSCAN = require("../commands/ZSCAN");
const ZSCORE = require("../commands/ZSCORE");
const ZUNION_WITHSCORES = require("../commands/ZUNION_WITHSCORES");
const ZUNION = require("../commands/ZUNION");
const ZUNIONSTORE = require("../commands/ZUNIONSTORE");
exports.default = {
APPEND,
append: APPEND,
BITCOUNT,
bitCount: BITCOUNT,
BITFIELD_RO,
bitFieldRo: BITFIELD_RO,
BITFIELD,
bitField: BITFIELD,
BITOP,
bitOp: BITOP,
BITPOS,
bitPos: BITPOS,
BLMOVE,
blMove: BLMOVE,
BLMPOP,
blmPop: BLMPOP,
BLPOP,
blPop: BLPOP,
BRPOP,
brPop: BRPOP,
BRPOPLPUSH,
brPopLPush: BRPOPLPUSH,
BZMPOP,
bzmPop: BZMPOP,
BZPOPMAX,
bzPopMax: BZPOPMAX,
BZPOPMIN,
bzPopMin: BZPOPMIN,
COPY,
copy: COPY,
DECR,
decr: DECR,
DECRBY,
decrBy: DECRBY,
DEL,
del: DEL,
DUMP,
dump: DUMP,
EVAL_RO,
evalRo: EVAL_RO,
EVAL,
eval: EVAL,
EVALSHA,
evalSha: EVALSHA,
EVALSHA_RO,
evalShaRo: EVALSHA_RO,
EXISTS,
exists: EXISTS,
EXPIRE,
expire: EXPIRE,
EXPIREAT,
expireAt: EXPIREAT,
EXPIRETIME,
expireTime: EXPIRETIME,
FCALL_RO,
fCallRo: FCALL_RO,
FCALL,
fCall: FCALL,
GEOADD,
geoAdd: GEOADD,
GEODIST,
geoDist: GEODIST,
GEOHASH,
geoHash: GEOHASH,
GEOPOS,
geoPos: GEOPOS,
GEORADIUS_RO_WITH,
geoRadiusRoWith: GEORADIUS_RO_WITH,
GEORADIUS_RO,
geoRadiusRo: GEORADIUS_RO,
GEORADIUS_WITH,
geoRadiusWith: GEORADIUS_WITH,
GEORADIUS,
geoRadius: GEORADIUS,
GEORADIUSBYMEMBER_RO_WITH,
geoRadiusByMemberRoWith: GEORADIUSBYMEMBER_RO_WITH,
GEORADIUSBYMEMBER_RO,
geoRadiusByMemberRo: GEORADIUSBYMEMBER_RO,
GEORADIUSBYMEMBER_WITH,
geoRadiusByMemberWith: GEORADIUSBYMEMBER_WITH,
GEORADIUSBYMEMBER,
geoRadiusByMember: GEORADIUSBYMEMBER,
GEORADIUSBYMEMBERSTORE,
geoRadiusByMemberStore: GEORADIUSBYMEMBERSTORE,
GEORADIUSSTORE,
geoRadiusStore: GEORADIUSSTORE,
GEOSEARCH_WITH,
geoSearchWith: GEOSEARCH_WITH,
GEOSEARCH,
geoSearch: GEOSEARCH,
GEOSEARCHSTORE,
geoSearchStore: GEOSEARCHSTORE,
GET,
get: GET,
GETBIT,
getBit: GETBIT,
GETDEL,
getDel: GETDEL,
GETEX,
getEx: GETEX,
GETRANGE,
getRange: GETRANGE,
GETSET,
getSet: GETSET,
HDEL,
hDel: HDEL,
HEXISTS,
hExists: HEXISTS,
HEXPIRE,
hExpire: HEXPIRE,
HEXPIREAT,
hExpireAt: HEXPIREAT,
HEXPIRETIME,
hExpireTime: HEXPIRETIME,
HGET,
hGet: HGET,
HGETALL,
hGetAll: HGETALL,
HINCRBY,
hIncrBy: HINCRBY,
HINCRBYFLOAT,
hIncrByFloat: HINCRBYFLOAT,
HKEYS,
hKeys: HKEYS,
HLEN,
hLen: HLEN,
HMGET,
hmGet: HMGET,
HPERSIST,
hPersist: HPERSIST,
HPEXPIRE,
hpExpire: HPEXPIRE,
HPEXPIREAT,
hpExpireAt: HPEXPIREAT,
HPEXPIRETIME,
hpExpireTime: HPEXPIRETIME,
HPTTL,
hpTTL: HPTTL,
HRANDFIELD_COUNT_WITHVALUES,
hRandFieldCountWithValues: HRANDFIELD_COUNT_WITHVALUES,
HRANDFIELD_COUNT,
hRandFieldCount: HRANDFIELD_COUNT,
HRANDFIELD,
hRandField: HRANDFIELD,
HSCAN,
hScan: HSCAN,
HSCAN_NOVALUES,
hScanNoValues: HSCAN_NOVALUES,
HSET,
hSet: HSET,
HSETNX,
hSetNX: HSETNX,
HSTRLEN,
hStrLen: HSTRLEN,
HTTL,
hTTL: HTTL,
HVALS,
hVals: HVALS,
INCR,
incr: INCR,
INCRBY,
incrBy: INCRBY,
INCRBYFLOAT,
incrByFloat: INCRBYFLOAT,
LCS_IDX_WITHMATCHLEN,
lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN,
LCS_IDX,
lcsIdx: LCS_IDX,
LCS_LEN,
lcsLen: LCS_LEN,
LCS,
lcs: LCS,
LINDEX,
lIndex: LINDEX,
LINSERT,
lInsert: LINSERT,
LLEN,
lLen: LLEN,
LMOVE,
lMove: LMOVE,
LMPOP,
lmPop: LMPOP,
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,
MGET,
mGet: MGET,
MIGRATE,
migrate: MIGRATE,
MSET,
mSet: MSET,
MSETNX,
mSetNX: MSETNX,
OBJECT_ENCODING,
objectEncoding: OBJECT_ENCODING,
OBJECT_FREQ,
objectFreq: OBJECT_FREQ,
OBJECT_IDLETIME,
objectIdleTime: OBJECT_IDLETIME,
OBJECT_REFCOUNT,
objectRefCount: OBJECT_REFCOUNT,
PERSIST,
persist: PERSIST,
PEXPIRE,
pExpire: PEXPIRE,
PEXPIREAT,
pExpireAt: PEXPIREAT,
PEXPIRETIME,
pExpireTime: PEXPIRETIME,
PFADD,
pfAdd: PFADD,
PFCOUNT,
pfCount: PFCOUNT,
PFMERGE,
pfMerge: PFMERGE,
PSETEX,
pSetEx: PSETEX,
PTTL,
pTTL: PTTL,
PUBLISH,
publish: PUBLISH,
RENAME,
rename: RENAME,
RENAMENX,
renameNX: RENAMENX,
RESTORE,
restore: RESTORE,
RPOP_COUNT,
rPopCount: RPOP_COUNT,
RPOP,
rPop: RPOP,
RPOPLPUSH,
rPopLPush: RPOPLPUSH,
RPUSH,
rPush: RPUSH,
RPUSHX,
rPushX: RPUSHX,
SADD,
sAdd: SADD,
SCARD,
sCard: SCARD,
SDIFF,
sDiff: SDIFF,
SDIFFSTORE,
sDiffStore: SDIFFSTORE,
SINTER,
sInter: SINTER,
SINTERCARD,
sInterCard: SINTERCARD,
SINTERSTORE,
sInterStore: SINTERSTORE,
SET,
set: SET,
SETBIT,
setBit: SETBIT,
SETEX,
setEx: SETEX,
SETNX,
setNX: SETNX,
SETRANGE,
setRange: SETRANGE,
SISMEMBER,
sIsMember: SISMEMBER,
SMEMBERS,
sMembers: SMEMBERS,
SMISMEMBER,
smIsMember: SMISMEMBER,
SMOVE,
sMove: SMOVE,
SORT_RO,
sortRo: SORT_RO,
SORT_STORE,
sortStore: SORT_STORE,
SORT,
sort: SORT,
SPOP,
sPop: SPOP,
SPUBLISH,
sPublish: SPUBLISH,
SRANDMEMBER_COUNT,
sRandMemberCount: SRANDMEMBER_COUNT,
SRANDMEMBER,
sRandMember: SRANDMEMBER,
SREM,
sRem: SREM,
SSCAN,
sScan: SSCAN,
STRLEN,
strLen: STRLEN,
SUNION,
sUnion: SUNION,
SUNIONSTORE,
sUnionStore: SUNIONSTORE,
TOUCH,
touch: TOUCH,
TTL,
ttl: TTL,
TYPE,
type: TYPE,
UNLINK,
unlink: UNLINK,
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,
XSETID,
xSetId: XSETID,
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,
ZINTERCARD,
zInterCard: ZINTERCARD,
ZINTERSTORE,
zInterStore: ZINTERSTORE,
ZLEXCOUNT,
zLexCount: ZLEXCOUNT,
ZMPOP,
zmPop: ZMPOP,
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
};

View File

@@ -0,0 +1,93 @@
/// <reference types="node" />
import COMMANDS from './commands';
import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandRawReply, RedisCommandReply, RedisFunctions, RedisModules, RedisExtensions, RedisScript, RedisScripts, RedisCommandSignature, RedisFunction } from '../commands';
import { ClientCommandOptions, RedisClientOptions, RedisClientType, WithFunctions, WithModules, WithScripts } from '../client';
import { NodeAddressMap, ShardNode } from './cluster-slots';
import { EventEmitter } from 'events';
import { RedisClusterMultiCommandType } from './multi-command';
import { PubSubListener } from '../client/pub-sub';
export type RedisClusterClientOptions = Omit<RedisClientOptions, 'modules' | 'functions' | 'scripts' | 'database'>;
export interface RedisClusterOptions<M extends RedisModules = Record<string, never>, F extends RedisFunctions = Record<string, never>, S extends RedisScripts = Record<string, never>> extends RedisExtensions<M, F, S> {
/**
* Should contain details for some of the cluster nodes that the client will use to discover
* the "cluster topology". We recommend including details for at least 3 nodes here.
*/
rootNodes: Array<RedisClusterClientOptions>;
/**
* Default values used for every client in the cluster. Use this to specify global values,
* for example: ACL credentials, timeouts, TLS configuration etc.
*/
defaults?: Partial<RedisClusterClientOptions>;
/**
* When `true`, `.connect()` will only discover the cluster topology, without actually connecting to all the nodes.
* Useful for short-term or PubSub-only connections.
*/
minimizeConnections?: boolean;
/**
* When `true`, distribute load by executing readonly commands (such as `GET`, `GEOSEARCH`, etc.) across all cluster nodes. When `false`, only use master nodes.
*/
useReplicas?: boolean;
/**
* The maximum number of times a command will be redirected due to `MOVED` or `ASK` errors.
*/
maxCommandRedirections?: number;
/**
* Mapping between the addresses in the cluster (see `CLUSTER SHARDS`) and the addresses the client should connect to
* Useful when the cluster is running on another network
*
*/
nodeAddressMap?: NodeAddressMap;
}
type WithCommands = {
[P in keyof typeof COMMANDS]: RedisCommandSignature<(typeof COMMANDS)[P]>;
};
export type RedisClusterType<M extends RedisModules = Record<string, never>, F extends RedisFunctions = Record<string, never>, S extends RedisScripts = Record<string, never>> = RedisCluster<M, F, S> & WithCommands & WithModules<M> & WithFunctions<F> & WithScripts<S>;
export default class RedisCluster<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> extends EventEmitter {
#private;
static extractFirstKey(command: RedisCommand, originalArgs: Array<unknown>, redisArgs: RedisCommandArguments): RedisCommandArgument | undefined;
static create<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts>(options?: RedisClusterOptions<M, F, S>): RedisClusterType<M, F, S>;
get slots(): import("./cluster-slots").Shard<M, F, S>[];
get shards(): import("./cluster-slots").Shard<M, F, S>[];
get masters(): ShardNode<M, F, S>[];
get replicas(): ShardNode<M, F, S>[];
get nodeByAddress(): Map<string, ShardNode<M, F, S> | import("./cluster-slots").MasterNode<M, F, S>>;
get pubSubNode(): Required<import("./cluster-slots").Node<M, F, S>> | undefined;
get isOpen(): boolean;
constructor(options: RedisClusterOptions<M, F, S>);
duplicate(overrides?: Partial<RedisClusterOptions<M, F, S>>): RedisClusterType<M, F, S>;
connect(): Promise<void>;
commandsExecutor<C extends RedisCommand>(command: C, args: Array<unknown>): Promise<RedisCommandReply<C>>;
sendCommand<T = RedisCommandRawReply>(firstKey: RedisCommandArgument | undefined, isReadonly: boolean | undefined, args: RedisCommandArguments, options?: ClientCommandOptions): Promise<T>;
functionsExecutor<F extends RedisFunction>(fn: F, args: Array<unknown>, name: string): Promise<RedisCommandReply<F>>;
executeFunction(name: string, fn: RedisFunction, originalArgs: Array<unknown>, redisArgs: RedisCommandArguments, options?: ClientCommandOptions): Promise<RedisCommandRawReply>;
scriptsExecutor<S extends RedisScript>(script: S, args: Array<unknown>): Promise<RedisCommandReply<S>>;
executeScript(script: RedisScript, originalArgs: Array<unknown>, redisArgs: RedisCommandArguments, options?: ClientCommandOptions): Promise<RedisCommandRawReply>;
MULTI(routing?: RedisCommandArgument): RedisClusterMultiCommandType<M, F, S>;
multi: (routing?: RedisCommandArgument) => RedisClusterMultiCommandType<M, F, S>;
SUBSCRIBE<T extends boolean = false>(channels: string | Array<string>, listener: PubSubListener<T>, bufferMode?: T): Promise<void>;
subscribe: <T extends boolean = false>(channels: string | Array<string>, listener: PubSubListener<T>, bufferMode?: T | undefined) => Promise<void>;
UNSUBSCRIBE<T extends boolean = false>(channels?: string | Array<string>, listener?: PubSubListener<boolean>, bufferMode?: T): Promise<void>;
unsubscribe: <T extends boolean = false>(channels?: string | Array<string>, listener?: PubSubListener<boolean>, bufferMode?: T | undefined) => Promise<void>;
PSUBSCRIBE<T extends boolean = false>(patterns: string | Array<string>, listener: PubSubListener<T>, bufferMode?: T): Promise<void>;
pSubscribe: <T extends boolean = false>(patterns: string | Array<string>, listener: PubSubListener<T>, bufferMode?: T | undefined) => Promise<void>;
PUNSUBSCRIBE<T extends boolean = false>(patterns?: string | Array<string>, listener?: PubSubListener<T>, bufferMode?: T): Promise<void>;
pUnsubscribe: <T extends boolean = false>(patterns?: string | Array<string>, listener?: PubSubListener<T> | undefined, bufferMode?: T | undefined) => Promise<void>;
SSUBSCRIBE<T extends boolean = false>(channels: string | Array<string>, listener: PubSubListener<T>, bufferMode?: T): Promise<void>;
sSubscribe: <T extends boolean = false>(channels: string | Array<string>, listener: PubSubListener<T>, bufferMode?: T | undefined) => Promise<void>;
SUNSUBSCRIBE<T extends boolean = false>(channels: string | Array<string>, listener?: PubSubListener<T>, bufferMode?: T): Promise<void>;
sUnsubscribe: <T extends boolean = false>(channels: string | Array<string>, listener?: PubSubListener<T> | undefined, bufferMode?: T | undefined) => Promise<void>;
quit(): Promise<void>;
disconnect(): Promise<void>;
nodeClient(node: ShardNode<M, F, S>): RedisClientType<M, F, S> | Promise<RedisClientType<M, F, S>>;
getRandomNode(): ShardNode<M, F, S>;
getSlotRandomNode(slot: number): ShardNode<M, F, S>;
/**
* @deprecated use `.masters` instead
*/
getMasters(): ShardNode<M, F, S>[];
/**
* @deprecated use `.slots[<SLOT>]` instead
*/
getSlotMaster(slot: number): import("./cluster-slots").MasterNode<M, F, S>;
}
export {};

View File

@@ -0,0 +1,254 @@
"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 _RedisCluster_instances, _RedisCluster_options, _RedisCluster_slots, _RedisCluster_Multi, _RedisCluster_execute;
Object.defineProperty(exports, "__esModule", { value: true });
const commands_1 = require("./commands");
const cluster_slots_1 = require("./cluster-slots");
const commander_1 = require("../commander");
const events_1 = require("events");
const multi_command_1 = require("./multi-command");
const errors_1 = require("../errors");
class RedisCluster extends events_1.EventEmitter {
static extractFirstKey(command, originalArgs, redisArgs) {
if (command.FIRST_KEY_INDEX === undefined) {
return undefined;
}
else if (typeof command.FIRST_KEY_INDEX === 'number') {
return redisArgs[command.FIRST_KEY_INDEX];
}
return command.FIRST_KEY_INDEX(...originalArgs);
}
static create(options) {
return new ((0, commander_1.attachExtensions)({
BaseClass: RedisCluster,
modulesExecutor: RedisCluster.prototype.commandsExecutor,
modules: options?.modules,
functionsExecutor: RedisCluster.prototype.functionsExecutor,
functions: options?.functions,
scriptsExecutor: RedisCluster.prototype.scriptsExecutor,
scripts: options?.scripts
}))(options);
}
get slots() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").slots;
}
get shards() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").shards;
}
get masters() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").masters;
}
get replicas() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").replicas;
}
get nodeByAddress() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").nodeByAddress;
}
get pubSubNode() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").pubSubNode;
}
get isOpen() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").isOpen;
}
constructor(options) {
super();
_RedisCluster_instances.add(this);
_RedisCluster_options.set(this, void 0);
_RedisCluster_slots.set(this, void 0);
_RedisCluster_Multi.set(this, void 0);
Object.defineProperty(this, "multi", {
enumerable: true,
configurable: true,
writable: true,
value: this.MULTI
});
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
});
__classPrivateFieldSet(this, _RedisCluster_options, options, "f");
__classPrivateFieldSet(this, _RedisCluster_slots, new cluster_slots_1.default(options, this.emit.bind(this)), "f");
__classPrivateFieldSet(this, _RedisCluster_Multi, multi_command_1.default.extend(options), "f");
}
duplicate(overrides) {
return new (Object.getPrototypeOf(this).constructor)({
...__classPrivateFieldGet(this, _RedisCluster_options, "f"),
...overrides
});
}
connect() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").connect();
}
async commandsExecutor(command, args) {
const { jsArgs, args: redisArgs, options } = (0, commander_1.transformCommandArguments)(command, args);
return (0, commander_1.transformCommandReply)(command, await this.sendCommand(RedisCluster.extractFirstKey(command, jsArgs, redisArgs), command.IS_READ_ONLY, redisArgs, options), redisArgs.preserve);
}
async sendCommand(firstKey, isReadonly, args, options) {
return __classPrivateFieldGet(this, _RedisCluster_instances, "m", _RedisCluster_execute).call(this, firstKey, isReadonly, client => client.sendCommand(args, options));
}
async functionsExecutor(fn, args, name) {
const { args: redisArgs, options } = (0, commander_1.transformCommandArguments)(fn, args);
return (0, commander_1.transformCommandReply)(fn, await this.executeFunction(name, fn, args, redisArgs, options), redisArgs.preserve);
}
async executeFunction(name, fn, originalArgs, redisArgs, options) {
return __classPrivateFieldGet(this, _RedisCluster_instances, "m", _RedisCluster_execute).call(this, RedisCluster.extractFirstKey(fn, originalArgs, redisArgs), fn.IS_READ_ONLY, client => client.executeFunction(name, fn, redisArgs, options));
}
async scriptsExecutor(script, args) {
const { args: redisArgs, options } = (0, commander_1.transformCommandArguments)(script, args);
return (0, commander_1.transformCommandReply)(script, await this.executeScript(script, args, redisArgs, options), redisArgs.preserve);
}
async executeScript(script, originalArgs, redisArgs, options) {
return __classPrivateFieldGet(this, _RedisCluster_instances, "m", _RedisCluster_execute).call(this, RedisCluster.extractFirstKey(script, originalArgs, redisArgs), script.IS_READ_ONLY, client => client.executeScript(script, redisArgs, options));
}
MULTI(routing) {
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, undefined, chainId));
}, routing);
}
async SUBSCRIBE(channels, listener, bufferMode) {
return (await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getPubSubClient())
.SUBSCRIBE(channels, listener, bufferMode);
}
async UNSUBSCRIBE(channels, listener, bufferMode) {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").executeUnsubscribeCommand(client => client.UNSUBSCRIBE(channels, listener, bufferMode));
}
async PSUBSCRIBE(patterns, listener, bufferMode) {
return (await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getPubSubClient())
.PSUBSCRIBE(patterns, listener, bufferMode);
}
async PUNSUBSCRIBE(patterns, listener, bufferMode) {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").executeUnsubscribeCommand(client => client.PUNSUBSCRIBE(patterns, listener, bufferMode));
}
async SSUBSCRIBE(channels, listener, bufferMode) {
const maxCommandRedirections = __classPrivateFieldGet(this, _RedisCluster_options, "f").maxCommandRedirections ?? 16, firstChannel = Array.isArray(channels) ? channels[0] : channels;
let client = await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getShardedPubSubClient(firstChannel);
for (let i = 0;; i++) {
try {
return await client.SSUBSCRIBE(channels, listener, bufferMode);
}
catch (err) {
if (++i > maxCommandRedirections || !(err instanceof errors_1.ErrorReply)) {
throw err;
}
if (err.message.startsWith('MOVED')) {
await __classPrivateFieldGet(this, _RedisCluster_slots, "f").rediscover(client);
client = await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getShardedPubSubClient(firstChannel);
continue;
}
throw err;
}
}
}
SUNSUBSCRIBE(channels, listener, bufferMode) {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").executeShardedUnsubscribeCommand(Array.isArray(channels) ? channels[0] : channels, client => client.SUNSUBSCRIBE(channels, listener, bufferMode));
}
quit() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").quit();
}
disconnect() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").disconnect();
}
nodeClient(node) {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").nodeClient(node);
}
getRandomNode() {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").getRandomNode();
}
getSlotRandomNode(slot) {
return __classPrivateFieldGet(this, _RedisCluster_slots, "f").getSlotRandomNode(slot);
}
/**
* @deprecated use `.masters` instead
*/
getMasters() {
return this.masters;
}
/**
* @deprecated use `.slots[<SLOT>]` instead
*/
getSlotMaster(slot) {
return this.slots[slot].master;
}
}
_RedisCluster_options = new WeakMap(), _RedisCluster_slots = new WeakMap(), _RedisCluster_Multi = new WeakMap(), _RedisCluster_instances = new WeakSet(), _RedisCluster_execute = async function _RedisCluster_execute(firstKey, isReadonly, executor) {
const maxCommandRedirections = __classPrivateFieldGet(this, _RedisCluster_options, "f").maxCommandRedirections ?? 16;
let client = await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getClient(firstKey, isReadonly);
for (let i = 0;; i++) {
try {
return await executor(client);
}
catch (err) {
if (++i > maxCommandRedirections || !(err instanceof errors_1.ErrorReply)) {
throw err;
}
if (err.message.startsWith('ASK')) {
const address = err.message.substring(err.message.lastIndexOf(' ') + 1);
let redirectTo = await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getMasterByAddress(address);
if (!redirectTo) {
await __classPrivateFieldGet(this, _RedisCluster_slots, "f").rediscover(client);
redirectTo = await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getMasterByAddress(address);
}
if (!redirectTo) {
throw new Error(`Cannot find node ${address}`);
}
await redirectTo.asking();
client = redirectTo;
continue;
}
else if (err.message.startsWith('MOVED')) {
await __classPrivateFieldGet(this, _RedisCluster_slots, "f").rediscover(client);
client = await __classPrivateFieldGet(this, _RedisCluster_slots, "f").getClient(firstKey, isReadonly);
continue;
}
throw err;
}
}
};
exports.default = RedisCluster;
(0, commander_1.attachCommands)({
BaseClass: RedisCluster,
commands: commands_1.default,
executor: RedisCluster.prototype.commandsExecutor
});

View File

@@ -0,0 +1,36 @@
import COMMANDS from './commands';
import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandRawReply, RedisFunctions, RedisModules, RedisExtensions, RedisScript, RedisScripts, ExcludeMappedString, RedisFunction } from '../commands';
import { RedisMultiQueuedCommand } from '../multi-command';
type RedisClusterMultiCommandSignature<C extends RedisCommand, M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = (...args: Parameters<C['transformArguments']>) => RedisClusterMultiCommandType<M, F, S>;
type WithCommands<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = {
[P in keyof typeof COMMANDS]: RedisClusterMultiCommandSignature<(typeof COMMANDS)[P], M, F, S>;
};
type WithModules<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = {
[P in keyof M as ExcludeMappedString<P>]: {
[C in keyof M[P] as ExcludeMappedString<C>]: RedisClusterMultiCommandSignature<M[P][C], M, F, S>;
};
};
type WithFunctions<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = {
[P in keyof F as ExcludeMappedString<P>]: {
[FF in keyof F[P] as ExcludeMappedString<FF>]: RedisClusterMultiCommandSignature<F[P][FF], M, F, S>;
};
};
type WithScripts<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = {
[P in keyof S as ExcludeMappedString<P>]: RedisClusterMultiCommandSignature<S[P], M, F, S>;
};
export type RedisClusterMultiCommandType<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = RedisClusterMultiCommand & WithCommands<M, F, S> & WithModules<M, F, S> & WithFunctions<M, F, S> & WithScripts<M, F, S>;
export type InstantiableRedisClusterMultiCommandType<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts> = new (...args: ConstructorParameters<typeof RedisClusterMultiCommand>) => RedisClusterMultiCommandType<M, F, S>;
export type RedisClusterMultiExecutor = (queue: Array<RedisMultiQueuedCommand>, firstKey?: RedisCommandArgument, chainId?: symbol) => Promise<Array<RedisCommandRawReply>>;
export default class RedisClusterMultiCommand {
#private;
static extend<M extends RedisModules, F extends RedisFunctions, S extends RedisScripts>(extensions?: RedisExtensions<M, F, S>): InstantiableRedisClusterMultiCommandType<M, F, S>;
constructor(executor: RedisClusterMultiExecutor, firstKey?: RedisCommandArgument);
commandsExecutor(command: RedisCommand, args: Array<unknown>): this;
addCommand(firstKey: RedisCommandArgument | undefined, args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): this;
functionsExecutor(fn: RedisFunction, args: Array<unknown>, name: string): this;
scriptsExecutor(script: RedisScript, args: Array<unknown>): this;
exec(execAsPipeline?: boolean): Promise<Array<RedisCommandRawReply>>;
EXEC: (execAsPipeline?: boolean) => Promise<Array<RedisCommandRawReply>>;
execAsPipeline(): Promise<Array<RedisCommandRawReply>>;
}
export {};

View File

@@ -0,0 +1,80 @@
"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 _RedisClusterMultiCommand_multi, _RedisClusterMultiCommand_executor, _RedisClusterMultiCommand_firstKey;
Object.defineProperty(exports, "__esModule", { value: true });
const commands_1 = require("./commands");
const multi_command_1 = require("../multi-command");
const commander_1 = require("../commander");
const _1 = require(".");
class RedisClusterMultiCommand {
static extend(extensions) {
return (0, commander_1.attachExtensions)({
BaseClass: RedisClusterMultiCommand,
modulesExecutor: RedisClusterMultiCommand.prototype.commandsExecutor,
modules: extensions?.modules,
functionsExecutor: RedisClusterMultiCommand.prototype.functionsExecutor,
functions: extensions?.functions,
scriptsExecutor: RedisClusterMultiCommand.prototype.scriptsExecutor,
scripts: extensions?.scripts
});
}
constructor(executor, firstKey) {
_RedisClusterMultiCommand_multi.set(this, new multi_command_1.default());
_RedisClusterMultiCommand_executor.set(this, void 0);
_RedisClusterMultiCommand_firstKey.set(this, void 0);
Object.defineProperty(this, "EXEC", {
enumerable: true,
configurable: true,
writable: true,
value: this.exec
});
__classPrivateFieldSet(this, _RedisClusterMultiCommand_executor, executor, "f");
__classPrivateFieldSet(this, _RedisClusterMultiCommand_firstKey, firstKey, "f");
}
commandsExecutor(command, args) {
const transformedArguments = command.transformArguments(...args);
__classPrivateFieldSet(this, _RedisClusterMultiCommand_firstKey, __classPrivateFieldGet(this, _RedisClusterMultiCommand_firstKey, "f") ?? _1.default.extractFirstKey(command, args, transformedArguments), "f");
return this.addCommand(undefined, transformedArguments, command.transformReply);
}
addCommand(firstKey, args, transformReply) {
__classPrivateFieldSet(this, _RedisClusterMultiCommand_firstKey, __classPrivateFieldGet(this, _RedisClusterMultiCommand_firstKey, "f") ?? firstKey, "f");
__classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").addCommand(args, transformReply);
return this;
}
functionsExecutor(fn, args, name) {
const transformedArguments = __classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").addFunction(name, fn, args);
__classPrivateFieldSet(this, _RedisClusterMultiCommand_firstKey, __classPrivateFieldGet(this, _RedisClusterMultiCommand_firstKey, "f") ?? _1.default.extractFirstKey(fn, args, transformedArguments), "f");
return this;
}
scriptsExecutor(script, args) {
const transformedArguments = __classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").addScript(script, args);
__classPrivateFieldSet(this, _RedisClusterMultiCommand_firstKey, __classPrivateFieldGet(this, _RedisClusterMultiCommand_firstKey, "f") ?? _1.default.extractFirstKey(script, args, transformedArguments), "f");
return this;
}
async exec(execAsPipeline = false) {
if (execAsPipeline) {
return this.execAsPipeline();
}
return __classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").handleExecReplies(await __classPrivateFieldGet(this, _RedisClusterMultiCommand_executor, "f").call(this, __classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").queue, __classPrivateFieldGet(this, _RedisClusterMultiCommand_firstKey, "f"), multi_command_1.default.generateChainId()));
}
async execAsPipeline() {
return __classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").transformReplies(await __classPrivateFieldGet(this, _RedisClusterMultiCommand_executor, "f").call(this, __classPrivateFieldGet(this, _RedisClusterMultiCommand_multi, "f").queue, __classPrivateFieldGet(this, _RedisClusterMultiCommand_firstKey, "f")));
}
}
_RedisClusterMultiCommand_multi = new WeakMap(), _RedisClusterMultiCommand_executor = new WeakMap(), _RedisClusterMultiCommand_firstKey = new WeakMap();
exports.default = RedisClusterMultiCommand;
(0, commander_1.attachCommands)({
BaseClass: RedisClusterMultiCommand,
commands: commands_1.default,
executor: RedisClusterMultiCommand.prototype.commandsExecutor
});