/// import COMMANDS from "./commands"; import { ValkeyCommand, ValkeyCommandArguments, ValkeyCommandRawReply, ValkeyCommandReply, ValkeyFunctions, ValkeyModules, ValkeyExtensions, ValkeyScript, ValkeyScripts, ValkeyCommandSignature, ConvertArgumentType, ValkeyFunction, ExcludeMappedString } from "../commands"; import { ValkeySocketOptions } from "./socket"; import { QueueCommandOptions } from "./commands-queue"; import { ValkeyClientMultiCommandType } from "./multi-command"; import { ValkeyMultiQueuedCommand } from "../multi-command"; import { EventEmitter } from "events"; import { CommandOptions } from "../command-options"; import { ScanOptions, ZMember } from "../commands/generic-transformers"; import { ScanCommandOptions } from "../commands/SCAN"; import { HScanTuple } from "../commands/HSCAN"; import { Options as PoolOptions } from "generic-pool"; import { PubSubType, PubSubListener, PubSubTypeListeners, ChannelListeners } from "./pub-sub"; export interface ValkeyClientOptions extends ValkeyExtensions { /** * `redis[s]://[[username][:password]@][host][:port][/db-number]` * See [`redis`](https://www.iana.org/assignments/uri-schemes/prov/redis) and [`rediss`](https://www.iana.org/assignments/uri-schemes/prov/rediss) IANA registration for more details */ url?: string; /** * Socket connection properties */ socket?: ValkeySocketOptions; /** * ACL username ([see ACL guide](https://redis.io/topics/acl)) */ username?: string; /** * ACL password or the old "--requirepass" password */ password?: string; /** * Client name ([see `CLIENT SETNAME`](https://redis.io/commands/client-setname)) */ name?: string; /** * Valkey database number (see [`SELECT`](https://redis.io/commands/select) command) */ database?: number; /** * Maximum length of the client's internal command queue */ commandsQueueMaxLength?: number; /** * When `true`, commands are rejected when the client is reconnecting. * When `false`, commands are queued for execution after reconnection. */ disableOfflineQueue?: boolean; /** * Connect in [`READONLY`](https://redis.io/commands/readonly) mode */ readonly?: boolean; legacyMode?: boolean; isolationPoolOptions?: PoolOptions; /** * Send `PING` command at interval (in ms). * Useful with Valkey deployments that do not use TCP Keep-Alive. */ pingInterval?: number; /** * If set to true, disables sending client identifier (user-agent like message) to the redis server */ disableClientInfo?: boolean; /** * Tag to append to library name that is sent to the Valkey server */ clientInfoTag?: string; } type WithCommands = { [P in keyof typeof COMMANDS]: ValkeyCommandSignature<(typeof COMMANDS)[P]>; }; export type WithModules = { [P in keyof M as ExcludeMappedString

]: { [C in keyof M[P] as ExcludeMappedString]: ValkeyCommandSignature; }; }; export type WithFunctions = { [P in keyof F as ExcludeMappedString

]: { [FF in keyof F[P] as ExcludeMappedString]: ValkeyCommandSignature; }; }; export type WithScripts = { [P in keyof S as ExcludeMappedString

]: ValkeyCommandSignature; }; export type ValkeyClientType, F extends ValkeyFunctions = Record, S extends ValkeyScripts = Record> = ValkeyClient & WithCommands & WithModules & WithFunctions & WithScripts; export type InstantiableValkeyClient = new (options?: ValkeyClientOptions) => ValkeyClientType; export interface ClientCommandOptions extends QueueCommandOptions { isolated?: boolean; } export default class ValkeyClient extends EventEmitter { #private; static commandOptions(options: T): CommandOptions; commandOptions: typeof ValkeyClient.commandOptions; static extend(extensions?: ValkeyExtensions): InstantiableValkeyClient; static create(options?: ValkeyClientOptions): ValkeyClientType; static parseURL(url: string): ValkeyClientOptions; get options(): ValkeyClientOptions | undefined; get isOpen(): boolean; get isReady(): boolean; get isPubSubActive(): boolean; get v4(): Record; constructor(options?: ValkeyClientOptions); duplicate(overrides?: Partial>): ValkeyClientType; connect(): Promise>; commandsExecutor(command: C, args: Array): Promise>; sendCommand(args: ValkeyCommandArguments, options?: ClientCommandOptions): Promise; functionsExecuter(fn: F, args: Array, name: string): Promise>; executeFunction(name: string, fn: ValkeyFunction, args: ValkeyCommandArguments, options?: ClientCommandOptions): Promise; scriptsExecuter(script: S, args: Array): Promise>; executeScript(script: ValkeyScript, args: ValkeyCommandArguments, 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) => Promise; UNSUBSCRIBE(channels?: string | Array, listener?: PubSubListener, bufferMode?: T): Promise; unsubscribe: (channels?: string | Array, listener?: PubSubListener, bufferMode?: T) => Promise; PSUBSCRIBE(patterns: string | Array, listener: PubSubListener, bufferMode?: T): Promise; pSubscribe: (patterns: string | Array, listener: PubSubListener, bufferMode?: T) => Promise; PUNSUBSCRIBE(patterns?: string | Array, listener?: PubSubListener, bufferMode?: T): Promise; pUnsubscribe: (patterns?: string | Array, listener?: PubSubListener, bufferMode?: T) => Promise; SSUBSCRIBE(channels: string | Array, listener: PubSubListener, bufferMode?: T): Promise; sSubscribe: (channels: string | Array, listener: PubSubListener, bufferMode?: T) => Promise; SUNSUBSCRIBE(channels?: string | Array, listener?: PubSubListener, bufferMode?: T): Promise; sUnsubscribe: (channels?: string | Array, listener?: PubSubListener, bufferMode?: T) => 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: ValkeyClientType) => T | Promise): Promise; MULTI(): ValkeyClientMultiCommandType; multi: () => ValkeyClientMultiCommandType; multiExecutor(commands: Array, selectedDB?: number, chainId?: symbol): Promise>; scanIterator(options?: ScanCommandOptions): AsyncIterable; hScanIterator(key: string, options?: ScanOptions): AsyncIterable>; sScanIterator(key: string, options?: ScanOptions): AsyncIterable; zScanIterator(key: string, options?: ScanOptions): AsyncIterable>; disconnect(): Promise; ref(): void; unref(): void; } export {};