/// import { ClientCommandOptions } from '../client'; import { CommandOptions } from '../command-options'; import { RedisScriptConfig, SHA1 } from '../lua-script'; export type RedisCommandRawReply = string | number | Buffer | null | undefined | Array; export type RedisCommandArgument = string | Buffer; export type RedisCommandArguments = Array & { preserve?: unknown; }; export interface RedisCommand { FIRST_KEY_INDEX?: number | ((...args: Array) => RedisCommandArgument | undefined); IS_READ_ONLY?: boolean; TRANSFORM_LEGACY_REPLY?: boolean; transformArguments(this: void, ...args: Array): RedisCommandArguments; transformReply?(this: void, reply: any, preserved?: any): any; } export type RedisCommandReply = C['transformReply'] extends (...args: any) => infer T ? T : RedisCommandRawReply; export type ConvertArgumentType = Type extends RedisCommandArgument ? (Type extends (string & ToType) ? Type : ToType) : (Type extends Set ? Set> : (Type extends Map ? Map> : (Type extends Array ? Array> : (Type extends Date ? Type : (Type extends Record ? { [Property in keyof Type]: ConvertArgumentType; } : Type))))); export type RedisCommandSignature = Parameters> = >(...args: Params | [options: Options, ...rest: Params]) => Promise, Options['returnBuffers'] extends true ? Buffer : string>>; export interface RedisCommands { [command: string]: RedisCommand; } export interface RedisModule { [command: string]: RedisCommand; } export interface RedisModules { [module: string]: RedisModule; } export interface RedisFunction extends RedisCommand { NUMBER_OF_KEYS?: number; } export interface RedisFunctionLibrary { [fn: string]: RedisFunction; } export interface RedisFunctions { [library: string]: RedisFunctionLibrary; } export type RedisScript = RedisScriptConfig & SHA1; export interface RedisScripts { [script: string]: RedisScript; } export interface RedisExtensions { modules?: M; functions?: F; scripts?: S; } export type ExcludeMappedString = string extends S ? never : S;