type CommandArgs any> = ConstructorParameters[0]; type Telemetry = { /** * Upstash-Telemetry-Sdk * @example @upstash/redis@v1.1.1 */ sdk?: string; /** * Upstash-Telemetry-Platform * @example cloudflare */ platform?: string; /** * Upstash-Telemetry-Runtime * @example node@v18 */ runtime?: string; }; type RedisOptions = { /** * Automatically try to deserialize the returned data from upstash using `JSON.deserialize` * * @default true */ automaticDeserialization?: boolean; latencyLogging?: boolean; enableTelemetry?: boolean; enableAutoPipelining?: boolean; readYourWrites?: boolean; }; type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; type UpstashRequest = { path?: string[]; /** * Request body will be serialized to json */ body?: unknown; /** * Additional headers for the request */ headers?: Record; upstashSyncToken?: string; /** * Callback for handling streaming messages */ onMessage?: (data: string) => void; /** * Whether this request expects a streaming response */ isStreaming?: boolean; /** * Abort signal for the request */ signal?: AbortSignal; }; type UpstashResponse = { result?: TResult; error?: string; }; interface Requester { /** * When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client. */ readYourWrites?: boolean; /** * This token is used to ensure that the client is in sync with the server. On each request, we send this token in the header, and the server will return a new token. */ upstashSyncToken?: string; request: (req: UpstashRequest) => Promise>; } type RetryConfig = false | { /** * The number of retries to attempt before giving up. * * @default 5 */ retries?: number; /** * A backoff function receives the current retry count and returns a number in milliseconds to wait before retrying. * * @default * ```ts * Math.exp(retryCount) * 50 * ``` */ backoff?: (retryCount: number) => number; }; type Options$1 = { backend?: string; }; type RequesterConfig = { /** * Configure the retry behaviour in case of network errors */ retry?: RetryConfig; /** * Due to the nature of dynamic and custom data, it is possible to write data to redis that is not * valid json and will therefore cause errors when deserializing. This used to happen very * frequently with non-utf8 data, such as emojis. * * By default we will therefore encode the data as base64 on the server, before sending it to the * client. The client will then decode the base64 data and parse it as utf8. * * For very large entries, this can add a few milliseconds, so if you are sure that your data is * valid utf8, you can disable this behaviour by setting this option to false. * * Here's what the response body looks like: * * ```json * { * result?: "base64-encoded", * error?: string * } * ``` * * @default "base64" */ responseEncoding?: false | "base64"; /** * Configure the cache behaviour * @default "no-store" */ cache?: CacheSetting; }; type HttpClientConfig = { headers?: Record; baseUrl: string; options?: Options$1; retry?: RetryConfig; agent?: any; signal?: AbortSignal | (() => AbortSignal); keepAlive?: boolean; /** * When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client. */ readYourWrites?: boolean; } & RequesterConfig; type Serialize = (data: unknown) => string | number | boolean; type Deserialize = (result: TResult) => TData; type CommandOptions = { /** * Custom deserializer */ deserialize?: (result: TResult) => TData; /** * Automatically try to deserialize the returned data from upstash using `JSON.deserialize` * * @default true */ automaticDeserialization?: boolean; latencyLogging?: boolean; /** * Additional headers to be sent with the request */ headers?: Record; /** * Path to append to the URL */ path?: string[]; /** * Options for streaming requests, mainly used for subscribe, monitor commands **/ streamOptions?: { /** * Callback to be called when a message is received */ onMessage?: (data: string) => void; /** * Whether the request is streaming */ isStreaming?: boolean; /** * Signal to abort the request */ signal?: AbortSignal; }; }; /** * Command offers default (de)serialization and the exec method to all commands. * * TData represents what the user will enter or receive, * TResult is the raw data returned from upstash, which may need to be transformed or parsed. */ declare class Command { readonly command: (string | number | boolean)[]; readonly serialize: Serialize; readonly deserialize: Deserialize; protected readonly headers?: Record; protected readonly path?: string[]; protected readonly onMessage?: (data: string) => void; protected readonly isStreaming: boolean; protected readonly signal?: AbortSignal; /** * Create a new command instance. * * You can define a custom `deserialize` function. By default we try to deserialize as json. */ constructor(command: (string | boolean | number | unknown)[], opts?: CommandOptions); /** * Execute the command using a client. */ exec(client: Requester): Promise; } type Type = "string" | "list" | "set" | "zset" | "hash" | "none"; /** * @see https://redis.io/commands/type */ declare class TypeCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } declare const FIELD_TYPES: readonly ["TEXT", "U64", "I64", "F64", "BOOL", "DATE", "KEYWORD", "FACET"]; type FieldType = (typeof FIELD_TYPES)[number]; type TextField = { type: "TEXT"; noTokenize?: boolean; noStem?: boolean; from?: string; }; type NumericField = { type: "U64" | "I64" | "F64"; fast: true; from?: string; }; type BoolField = { type: "BOOL"; fast?: boolean; from?: string; }; type DateField = { type: "DATE"; fast?: boolean; from?: string; }; type KeywordField = { type: "KEYWORD"; }; type FacetField = { type: "FACET"; }; type DetailedField = TextField | NumericField | BoolField | DateField | KeywordField | FacetField; type NestedIndexSchema = { [key: string]: FieldType | DetailedField | NestedIndexSchema; }; type FlatIndexSchema = { [key: string]: FieldType | DetailedField; }; type SchemaPaths = { [K in keyof T]: K extends string ? T[K] extends FieldType | DetailedField ? Prefix extends "" ? K : `${Prefix}${K}` : T[K] extends object ? SchemaPaths : never : never; }[keyof T]; type ExtractFieldType = T extends FieldType ? T : T extends { type: infer U; } ? U extends FieldType ? U : never : never; type GetFieldAtPath = Path extends `${infer First}.${infer Rest}` ? First extends keyof TSchema ? GetFieldAtPath : never : Path extends keyof TSchema ? TSchema[Path] : never; type FieldValueType = T extends "TEXT" ? string : T extends "U64" | "I64" | "F64" ? number : T extends "BOOL" ? boolean : T extends "DATE" ? string : T extends "KEYWORD" ? string : T extends "FACET" ? string : never; type GetFieldValueType = GetFieldAtPath extends infer Field ? Field extends FieldType | DetailedField ? FieldValueType> : never : never; type HasFrom = T extends { from: string; } ? true : false; type InferSchemaDataField = T extends FieldType ? FieldValueType : T extends DetailedField ? FieldValueType> : T extends NestedIndexSchema ? InferSchemaData : unknown; type IsDefaultSchema = [T] extends [NestedIndexSchema | FlatIndexSchema] ? [NestedIndexSchema | FlatIndexSchema] extends [T] ? true : false : false; type AsAnyIfUnknown = unknown extends T ? any : T; type InferSchemaData = IsDefaultSchema extends true ? any : { [K in keyof TSchema as TSchema[K] extends DetailedField ? HasFrom extends true ? never : K : K]: AsAnyIfUnknown>; }; type QueryOptions = IsDefaultSchema extends true ? { filter?: Record; limit?: number; offset?: number; select?: Record; highlight?: { fields: string[]; preTag?: string; postTag?: string; }; orderBy?: Record; scoreFunc?: ScoreBy; } : { filter?: RootQueryFilter; /** Maximum number of results to return */ limit?: number; /** Number of results to skip */ offset?: number; select?: Partial<{ [K in SchemaPaths]: true; }>; highlight?: { fields: SchemaPaths[]; preTag?: string; postTag?: string; }; } & QueryOrderOption; type CombineMode = "multiply" | "sum"; type ScoreMode = "multiply" | "sum" | "replace"; type ScoreModifier = "none" | "log" | "log1p" | "log2p" | "ln" | "ln1p" | "ln2p" | "square" | "sqrt" | "reciprocal"; type ScoreBy = ScoreByField | { fields: ScoreByField[]; combineMode?: CombineMode; scoreMode?: ScoreMode; }; type ScoreByField = { field: TSchemaPaths; modifier?: ScoreModifier; factor?: number; missing?: number; scoreMode?: TMultiple extends true ? never : ScoreMode; } | TSchemaPaths; type QueryOrderOption = { orderBy?: { [K in SchemaPaths]: { [P in K]: "ASC" | "DESC"; }; }[SchemaPaths]; } | { scoreFunc?: ScoreBy>; }; /** * Converts dot notation paths to nested object structure type * e.g. "content.title" | "content.author" becomes { content: { title: ..., author: ... } } */ type PathToNestedObject = Path extends `${infer First}.${infer Rest}` ? { [K in First]: PathToNestedObject; } : { [K in Path]: Value; }; /** * Merges intersection of objects into a single object type with proper nesting */ type DeepMerge = T extends object ? { [K in keyof T]: T[K] extends object ? DeepMerge : T[K]; } : T; /** * Build nested result type from selected paths */ type BuildNestedResult = IsDefaultSchema extends true ? DeepMerge; }[keyof TFields & string]>> : DeepMerge]: PathToNestedObject>>; }[keyof TFields & SchemaPaths]>>; type UnionToIntersection = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never; type QueryResult | undefined = undefined> = TOptions extends { select: infer TFields; } ? {} extends TFields ? { key: string; score: number; } : { key: string; score: number; data: BuildNestedResult; } : { key: string; score: number; data: InferSchemaData; }; type PublicQueryResult[] | undefined = undefined> = QueryResult[] ? { select: { [K in TSelectFields[number]]: true; }; } : undefined>; type StringOperationMap = { $eq: T; $in: T[]; $fuzzy: T | { value: T; distance?: number; transpositionCostOne?: boolean; prefix?: boolean; }; $phrase: T | { value: T; } | { value: T; slop: number; prefix?: never; } | { value: T; prefix: boolean; slop?: never; }; $regex: T; $smart: T; }; type NumberOperationMap = { $eq: T; $in: T[]; $gt: T; $gte: T; $lt: T; $lte: T; }; type KeywordOperationMap = { $eq: T; $in: T[]; $gt: T; $gte: T; $lt: T; $lte: T; }; type BooleanOperationMap = { $eq: T; $in: T[]; }; type DateOperationMap = { $eq: T; $in: T[]; $gt: T; $gte: T; $lte: T; $lt: T; }; type FacetOperationMap = { $eq: T; $in: T[]; }; type StringOperations = { [K in keyof StringOperationMap]: { [P in K]: StringOperationMap[K]; } & { $boost?: number; }; }[keyof StringOperationMap]; type NumberOperations = { [K in keyof NumberOperationMap]: { [P in K]: NumberOperationMap[K]; } & { $boost?: number; }; }[keyof NumberOperationMap]; type BooleanOperations = { [K in keyof BooleanOperationMap]: { [P in K]: BooleanOperationMap[K]; } & { $boost?: number; }; }[keyof BooleanOperationMap]; type DateOperations = { [K in keyof DateOperationMap]: { [P in K]: DateOperationMap[K]; } & { $boost?: number; }; }[keyof DateOperationMap]; type KeywordOperations = { [K in keyof KeywordOperationMap]: { [P in K]: KeywordOperationMap[K]; } & { $boost?: number; }; }[keyof KeywordOperationMap]; type FacetOperations = { [K in keyof FacetOperationMap]: { [P in K]: FacetOperationMap[K]; } & { $boost?: number; }; }[keyof FacetOperationMap]; type OperationsForFieldType = T extends "TEXT" ? StringOperations : T extends "U64" | "I64" | "F64" ? NumberOperations : T extends "BOOL" ? BooleanOperations : T extends "DATE" ? DateOperations : T extends "KEYWORD" ? KeywordOperations : T extends "FACET" ? FacetOperations : never; type PathOperations = GetFieldAtPath extends infer Field ? Field extends FieldType | DetailedField ? OperationsForFieldType> | FieldValueType> : never : never; type QueryLeaf = { [K in SchemaPaths]?: PathOperations; } & { $and?: never; $or?: never; $must?: never; $should?: never; $mustNot?: never; $boost?: number; }; type BoolBase = { [P in SchemaPaths]?: PathOperations; }; type AndNode = BoolBase & { $and: QueryFilter | QueryFilter[]; $boost?: number; $or?: never; $must?: never; $should?: never; $mustNot?: never; }; type OrNode = BoolBase & { $or: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $must?: never; $should?: never; $mustNot?: never; }; type MustNode = BoolBase & { $must: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $or?: never; $should?: never; $mustNot?: never; }; type ShouldNode = BoolBase & { $should: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $or?: never; $must?: never; $mustNot?: never; }; type MustShouldNode = BoolBase & { $must: QueryFilter | QueryFilter[]; $should: QueryFilter | QueryFilter[]; $and?: never; $or?: never; }; type NotNode = BoolBase & { $mustNot: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $or?: never; $must?: never; $should?: never; }; type AndNotNode = BoolBase & { $and: QueryFilter | QueryFilter[]; $mustNot: QueryFilter | QueryFilter[]; $boost?: number; $or?: never; $must?: never; $should?: never; }; type OrNotNode = BoolBase & { $or: QueryFilter | QueryFilter[]; $mustNot: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $must?: never; $should?: never; }; type ShouldNotNode = BoolBase & { $should: QueryFilter | QueryFilter[]; $mustNot: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $or?: never; $must?: never; }; type MustNotNode = BoolBase & { $must: QueryFilter | QueryFilter[]; $mustNot: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $or?: never; $should?: never; }; type BoolNode = BoolBase & { $must: QueryFilter | QueryFilter[]; $should: QueryFilter | QueryFilter[]; $mustNot: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $or?: never; }; type QueryFilter = IsDefaultSchema extends true ? Record : QueryLeaf | AndNode | OrNode | MustNode | ShouldNode | MustShouldNode | NotNode | AndNotNode | OrNotNode | ShouldNotNode | MustNotNode | BoolNode; type RootQueryFilter = IsDefaultSchema extends true ? Record : QueryLeaf | AndNode | RootOrNode | MustNode | ShouldNode | MustShouldNode | AndNotNode | ShouldNotNode | BoolNode; type RootOrNode = { [P in SchemaPaths]?: never; } & { $or: QueryFilter | QueryFilter[]; $boost?: number; $and?: never; $must?: never; $should?: never; $mustNot?: QueryFilter | QueryFilter[]; }; type DescribeFieldInfo = { type: FieldType; noTokenize?: boolean; noStem?: boolean; fast?: boolean; from?: string; }; type IndexDescription = { name: string; dataType: "hash" | "string" | "json"; prefixes: string[]; language?: Language; schema: IsDefaultSchema extends true ? Record : Record, DescribeFieldInfo>; }; type Language = "english" | "arabic" | "danish" | "dutch" | "finnish" | "french" | "german" | "greek" | "hungarian" | "italian" | "norwegian" | "portuguese" | "romanian" | "russian" | "spanish" | "swedish" | "tamil" | "turkish"; type FacetPaths = { [K in keyof T]: K extends string ? T[K] extends "FACET" | { type: "FACET"; } ? Prefix extends "" ? K : `${Prefix}${K}` : T[K] extends FieldType | DetailedField ? never : T[K] extends object ? FacetPaths : never : never; }[keyof T]; type AggregateOptions = IsDefaultSchema extends true ? { filter?: Record; aggregations: { [key: string]: Record; }; } : { filter?: RootQueryFilter; aggregations: { [key: string]: Aggregation; }; }; type Aggregation = IsDefaultSchema extends true ? Record : TermsAggregation | RangeAggregation | HistogramAggregation | StatsAggregation | AvgAggregation | SumAggregation | MinAggregation | MaxAggregation | CountAggregation | ExtendedStatsAggregation | PercentilesAggregation | CardinalityAggregation | FacetAggregation; type BaseAggregation = { $aggs?: { [key: string]: Aggregation; }; }; type TermsAggregation = BaseAggregation & { $terms: { field: SchemaPaths; size?: number; }; }; type RangeAggregation = BaseAggregation & { $range: { field: SchemaPaths; ranges: { from?: number; to?: number; }[]; }; }; type HistogramAggregation = BaseAggregation & { $histogram: { field: SchemaPaths; interval: number; }; }; type StatsAggregation = BaseAggregation & { $stats: { field: SchemaPaths; missing?: number; }; }; type AvgAggregation = BaseAggregation & { $avg: { field: SchemaPaths; missing?: number; }; }; type SumAggregation = BaseAggregation & { $sum: { field: SchemaPaths; missing?: number; }; }; type MinAggregation = BaseAggregation & { $min: { field: SchemaPaths; missing?: number; }; }; type MaxAggregation = BaseAggregation & { $max: { field: SchemaPaths; missing?: number; }; }; type CountAggregation = BaseAggregation & { $count: { field: SchemaPaths; }; }; type ExtendedStatsAggregation = BaseAggregation & { $extendedStats: { field: SchemaPaths; sigma?: number; missing?: number; }; }; type PercentilesAggregation = BaseAggregation & { $percentiles: { field: SchemaPaths; percents?: number[]; keyed?: boolean; missing?: number; }; }; type CardinalityAggregation = BaseAggregation & { $cardinality: { field: SchemaPaths; }; }; type FacetAggregation = BaseAggregation & { $facet: { field: FacetPaths; path: string; depth?: number; size?: number; minDocCount?: number; order?: { count: "desc" | "asc"; }; }; }; type AggregateResult> = IsDefaultSchema extends true ? Record : BuildAggregateResult; }>>; type BuildAggregateResult; }> = { [K in keyof TAggs]: TAggs[K] extends TermsAggregation ? TermsResult : TAggs[K] extends RangeAggregation ? RangeResult : TAggs[K] extends HistogramAggregation ? HistogramResult : TAggs[K] extends StatsAggregation ? StatsResult : TAggs[K] extends AvgAggregation ? MetricValueResult : TAggs[K] extends SumAggregation ? MetricValueResult : TAggs[K] extends MinAggregation ? MetricValueResult : TAggs[K] extends MaxAggregation ? MetricValueResult : TAggs[K] extends CountAggregation ? MetricValueResult : TAggs[K] extends CardinalityAggregation ? MetricValueResult : TAggs[K] extends ExtendedStatsAggregation ? ExtendedStatsResult : TAggs[K] extends PercentilesAggregation ? PercentilesResult : TAggs[K] extends FacetAggregation ? FacetResult : never; }; type Bucket = { key: T; docCount: number; from?: number; to?: number; }; type TermsResult> = TAgg["$aggs"] extends { [key: string]: Aggregation; } ? { buckets: (Bucket> & BuildAggregateResult)[]; sumOtherDocCount: number; docCountErrorUpperBound: number; } : { buckets: Bucket>[]; sumOtherDocCount: number; docCountErrorUpperBound: number; }; type RangeResult> = TAgg["$aggs"] extends { [key: string]: Aggregation; } ? { buckets: (Bucket & BuildAggregateResult)[]; } : { buckets: Bucket[]; }; type HistogramResult> = TAgg["$aggs"] extends { [key: string]: Aggregation; } ? { buckets: (Bucket & BuildAggregateResult)[]; } : { buckets: Bucket[]; }; type MetricValueResult = { value: number; }; type StatsResult = { count: number; min: number; max: number; sum: number; avg: number; }; type ExtendedStatsResult<_TAgg> = { count: number; min: number; max: number; avg: number; sum: number; sumOfSquares: number; variance: number; variancePopulation: number; varianceSampling: number; stdDeviation: number; stdDeviationPopulation: number; stdDeviationSampling: number; stdDeviationBounds: { upper: number; lower: number; upperSampling: number; lowerSampling: number; upperPopulation: number; lowerPopulation: number; }; }; type PercentilesResult = TAgg extends { $percentiles: { keyed: false; }; } ? { values: Array<{ key: number; value: number; }>; } : { values: { [key: string]: number; }; }; type FacetChildNode = { path: string; docCount: number; sumOtherDocCount: number; children?: FacetChildNode[]; }; type FacetResult = { path: string; sumOtherDocCount: number; children: FacetChildNode[]; }; type CreateIndexParameters = { name: string; prefix: string | string[]; language?: Language; skipInitialScan?: boolean; existsOk?: boolean; } & ({ dataType: "string"; schema: TSchema extends NestedIndexSchema ? TSchema : never; } | { dataType: "json"; schema: TSchema extends NestedIndexSchema ? TSchema : never; } | { dataType: "hash"; schema: TSchema extends FlatIndexSchema ? TSchema : never; }); type InitIndexParameters = { name: string; schema?: TSchema; }; type SearchIndexParameters = { name: string; client: Requester; schema?: TSchema; }; declare class SearchIndex { readonly name: SearchIndexParameters["name"]; readonly schema?: TSchema; private client; constructor({ name, schema, client }: SearchIndexParameters); waitIndexing(): Promise<0 | 1>; describe(): Promise | null>; query>(options?: TOpts): Promise[]>; aggregate>(options: TOpts): Promise>; count({ filter }: { filter: RootQueryFilter; }): Promise<{ count: number; }>; drop(): Promise<1 | 0>; addAlias({ alias }: { alias: string; }): Promise<1>; } type InferFilterFromSchema = NonNullable["query"]>[0]>["filter"]>; type FunctionListArgs = { /** * Pattern for matching library names. Supports glob patterns. * * Example: "my_library_*" */ libraryName?: string; /** * Includes the library source code in the response. * * @default false */ withCode?: boolean; }; type FunctionLoadArgs = { /** * The Lua code to load. * * Example: * ```lua * #!lua name=mylib * redis.register_function('myfunc', function() return 'ok' end) * ``` */ code: string; /** * If true, the library will replace the existing library with the same name. * * @default false */ replace?: boolean; }; /** * @see https://redis.io/commands/append */ declare class AppendCommand extends Command { constructor(cmd: [key: string, value: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/bitcount */ declare class BitCountCommand extends Command { constructor(cmd: [key: string, start?: never, end?: never], opts?: CommandOptions); constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions); } type SubCommandArgs = [ encoding: string, offset: number | string, ...rest: TRest ]; /** * @see https://redis.io/commands/bitfield */ declare class BitFieldCommand> { private client; private opts?; private execOperation; private command; constructor(args: [key: string], client: Requester, opts?: CommandOptions | undefined, execOperation?: (command: Command) => T); private chain; get(...args: SubCommandArgs): this; set(...args: SubCommandArgs<[value: number]>): this; incrby(...args: SubCommandArgs<[increment: number]>): this; overflow(overflow: "WRAP" | "SAT" | "FAIL"): this; exec(): T; } /** * @see https://redis.io/commands/bitop */ declare class BitOpCommand extends Command { constructor(cmd: [op: "and" | "or" | "xor", destinationKey: string, ...sourceKeys: string[]], opts?: CommandOptions); constructor(cmd: [op: "not", destinationKey: string, sourceKey: string], opts?: CommandOptions); constructor(cmd: [op: "diff" | "diff1" | "andor", destinationKey: string, x: string, ...y: string[]], opts?: CommandOptions); constructor(cmd: [op: "one", destinationKey: string, ...sourceKeys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/bitpos */ declare class BitPosCommand extends Command { constructor(cmd: [key: string, bit: 0 | 1, start?: number, end?: number], opts?: CommandOptions); } type ClientSetInfoAttribute = "LIB-NAME" | "lib-name" | "LIB-VER" | "lib-ver"; /** * @see https://redis.io/commands/client-setinfo */ declare class ClientSetInfoCommand extends Command { constructor([attribute, value]: [attribute: ClientSetInfoAttribute, value: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/copy */ declare class CopyCommand extends Command { constructor([key, destinationKey, opts]: [key: string, destinationKey: string, opts?: { replace: boolean; }], commandOptions?: CommandOptions); } /** * @see https://redis.io/commands/dbsize */ declare class DBSizeCommand extends Command { constructor(opts?: CommandOptions); } /** * @see https://redis.io/commands/decr */ declare class DecrCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/decrby */ declare class DecrByCommand extends Command { constructor(cmd: [key: string, decrement: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/del */ declare class DelCommand extends Command { constructor(cmd: [...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/echo */ declare class EchoCommand extends Command { constructor(cmd: [message: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/eval_ro */ declare class EvalROCommand extends Command { constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions); } /** * @see https://redis.io/commands/eval */ declare class EvalCommand extends Command { constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions); } /** * @see https://redis.io/commands/evalsha_ro */ declare class EvalshaROCommand extends Command { constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions); } /** * @see https://redis.io/commands/evalsha */ declare class EvalshaCommand extends Command { constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions); } /** * @see https://redis.io/commands/exists */ declare class ExistsCommand extends Command { constructor(cmd: [...keys: string[]], opts?: CommandOptions); } type ExpireOption = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt"; declare class ExpireCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/expireat */ declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/flushall */ declare class FlushAllCommand extends Command<"OK", "OK"> { constructor(args?: [{ async?: boolean; }], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/flushdb */ declare class FlushDBCommand extends Command<"OK", "OK"> { constructor([opts]: [opts?: { async?: boolean; }], cmdOpts?: CommandOptions<"OK", "OK">); } type GeoAddCommandOptions = { nx?: boolean; xx?: never; } | ({ nx?: never; xx?: boolean; } & { ch?: boolean; }); type GeoMember = { latitude: number; longitude: number; member: TMemberType; }; /** * @see https://redis.io/commands/geoadd */ declare class GeoAddCommand extends Command { constructor([key, arg1, ...arg2]: [ string, GeoMember | GeoAddCommandOptions, ...GeoMember[] ], opts?: CommandOptions); } /** * @see https://redis.io/commands/geodist */ declare class GeoDistCommand extends Command { constructor([key, member1, member2, unit]: [ key: string, member1: TMemberType, member2: TMemberType, unit?: "M" | "KM" | "FT" | "MI" ], opts?: CommandOptions); } /** * @see https://redis.io/commands/geohash */ declare class GeoHashCommand extends Command<(string | null)[], (string | null)[]> { constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>); } type Coordinates = { lng: number; lat: number; }; /** * @see https://redis.io/commands/geopos */ declare class GeoPosCommand extends Command<(string | null)[][], Coordinates[]> { constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[][], Coordinates[]>); } type RadiusOptions$1 = "M" | "KM" | "FT" | "MI"; type CenterPoint$1 = { type: "FROMMEMBER" | "frommember"; member: TMemberType; } | { type: "FROMLONLAT" | "fromlonlat"; coordinate: { lon: number; lat: number; }; }; type Shape$1 = { type: "BYRADIUS" | "byradius"; radius: number; radiusType: RadiusOptions$1; } | { type: "BYBOX" | "bybox"; rect: { width: number; height: number; }; rectType: RadiusOptions$1; }; type GeoSearchCommandOptions$1 = { count?: { limit: number; any?: boolean; }; withCoord?: boolean; withDist?: boolean; withHash?: boolean; }; type OptionMappings = { withHash: "hash"; withCoord: "coord"; withDist: "dist"; }; type GeoSearchOptions = { [K in keyof TOptions as K extends keyof OptionMappings ? OptionMappings[K] : never]: K extends "withHash" ? string : K extends "withCoord" ? { long: number; lat: number; } : K extends "withDist" ? number : never; }; type GeoSearchResponse = ({ member: TMemberType; } & GeoSearchOptions)[]; /** * @see https://redis.io/commands/geosearch */ declare class GeoSearchCommand extends Command> { constructor([key, centerPoint, shape, order, opts]: [ key: string, centerPoint: CenterPoint$1, shape: Shape$1, order: "ASC" | "DESC" | "asc" | "desc", opts?: TOptions ], commandOptions?: CommandOptions>); } type RadiusOptions = "M" | "KM" | "FT" | "MI"; type CenterPoint = { type: "FROMMEMBER" | "frommember"; member: TMemberType; } | { type: "FROMLONLAT" | "fromlonlat"; coordinate: { lon: number; lat: number; }; }; type Shape = { type: "BYRADIUS" | "byradius"; radius: number; radiusType: RadiusOptions; } | { type: "BYBOX" | "bybox"; rect: { width: number; height: number; }; rectType: RadiusOptions; }; type GeoSearchCommandOptions = { count?: { limit: number; any?: boolean; }; storeDist?: boolean; }; /** * @see https://redis.io/commands/geosearchstore */ declare class GeoSearchStoreCommand extends Command { constructor([destination, key, centerPoint, shape, order, opts]: [ destination: string, key: string, centerPoint: CenterPoint, shape: Shape, order: "ASC" | "DESC" | "asc" | "desc", opts?: TOptions ], commandOptions?: CommandOptions); } /** * @see https://redis.io/commands/get */ declare class GetCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/getbit */ declare class GetBitCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, offset: number], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/getdel */ declare class GetDelCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } type GetExCommandOptions = { ex: number; px?: never; exat?: never; pxat?: never; persist?: never; } | { ex?: never; px: number; exat?: never; pxat?: never; persist?: never; } | { ex?: never; px?: never; exat: number; pxat?: never; persist?: never; } | { ex?: never; px?: never; exat?: never; pxat: number; persist?: never; } | { ex?: never; px?: never; exat?: never; pxat?: never; persist: true; } | { ex?: never; px?: never; exat?: never; pxat?: never; persist?: never; }; /** * @see https://redis.io/commands/getex */ declare class GetExCommand extends Command { constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions); } /** * @see https://redis.io/commands/getrange */ declare class GetRangeCommand extends Command { constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/getset */ declare class GetSetCommand extends Command { constructor(cmd: [key: string, value: TData], opts?: CommandOptions); } /** * @see https://redis.io/commands/hdel */ declare class HDelCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, ...fields: string[]], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/hexists */ declare class HExistsCommand extends Command { constructor(cmd: [key: string, field: string], opts?: CommandOptions); } declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> { constructor(cmd: [ key: string, fields: (string | number) | (string | number)[], seconds: number, option?: ExpireOption ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>); } declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> { constructor(cmd: [ key: string, fields: (string | number) | (string | number)[], timestamp: number, option?: ExpireOption ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>); } declare class HExpireTimeCommand extends Command { constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions); } declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> { constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>); } declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> { constructor(cmd: [ key: string, fields: (string | number) | (string | number)[], milliseconds: number, option?: ExpireOption ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>); } declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> { constructor(cmd: [ key: string, fields: (string | number) | (string | number)[], timestamp: number, option?: ExpireOption ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>); } declare class HPExpireTimeCommand extends Command { constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions); } declare class HPTtlCommand extends Command { constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/hget */ declare class HGetCommand extends Command { constructor(cmd: [key: string, field: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/hgetall */ declare class HGetAllCommand> extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * HGETDEL returns the values of the specified fields and then atomically deletes them from the hash * The field values are returned as an object like this: * ```ts * {[fieldName: string]: T | null} * ``` * * In case all fields are non-existent or the hash doesn't exist, `null` is returned * * @see https://redis.io/commands/hgetdel */ declare class HGetDelCommand> extends Command<(string | null)[], TData | null> { constructor([key, ...fields]: [key: string, ...fields: (string | number)[]], opts?: CommandOptions<(string | null)[], TData | null>); } type HGetExCommandOptions = { ex: number; px?: never; exat?: never; pxat?: never; persist?: never; } | { ex?: never; px: number; exat?: never; pxat?: never; persist?: never; } | { ex?: never; px?: never; exat: number; pxat?: never; persist?: never; } | { ex?: never; px?: never; exat?: never; pxat: number; persist?: never; } | { ex?: never; px?: never; exat?: never; pxat?: never; persist: true; }; /** * HGETEX returns the values of the specified fields and optionally sets their expiration time or TTL * The field values are returned as an object like this: * ```ts * {[fieldName: string]: T | null} * ``` * * In case all fields are non-existent or the hash doesn't exist, `null` is returned * * @see https://redis.io/commands/hgetex */ declare class HGetExCommand> extends Command<(string | null)[], TData | null> { constructor([key, opts, ...fields]: [ key: string, opts: HGetExCommandOptions, ...fields: (string | number)[] ], cmdOpts?: CommandOptions<(string | null)[], TData | null>); } /** * @see https://redis.io/commands/hincrby */ declare class HIncrByCommand extends Command { constructor(cmd: [key: string, field: string, increment: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/hincrbyfloat */ declare class HIncrByFloatCommand extends Command { constructor(cmd: [key: string, field: string, increment: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/hkeys */ declare class HKeysCommand extends Command { constructor([key]: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/hlen */ declare class HLenCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * hmget returns an object of all requested fields from a hash * The field values are returned as an object like this: * ```ts * {[fieldName: string]: T | null} * ``` * * In case the hash does not exist or all fields are empty `null` is returned * * @see https://redis.io/commands/hmget */ declare class HMGetCommand> extends Command<(string | null)[], TData | null> { constructor([key, ...fields]: [key: string, ...fields: string[]], opts?: CommandOptions<(string | null)[], TData | null>); } /** * @see https://redis.io/commands/hmset */ declare class HMSetCommand extends Command<"OK", "OK"> { constructor([key, kv]: [key: string, kv: Record], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/hrandfield */ declare class HRandFieldCommand> extends Command { constructor(cmd: [key: string], opts?: CommandOptions); constructor(cmd: [key: string, count: number], opts?: CommandOptions); constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions>); } type ScanCommandOptionsStandard = { match?: string; count?: number; type?: string; withType?: false; }; type ScanCommandOptionsWithType = { match?: string; count?: number; /** * Includes types of each key in the result * * @example * ```typescript * await redis.scan("0", { withType: true }) * // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]] * ``` */ withType: true; }; type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType; type ScanResultStandard = [string, string[]]; type ScanResultWithType = [string, { key: string; type: string; }[]]; /** * @see https://redis.io/commands/scan */ declare class ScanCommand extends Command<[string, string[]], TData> { constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>); } /** * @see https://redis.io/commands/hscan */ declare class HScanCommand extends Command<[ string, (string | number)[] ], [ string, (string | number)[] ]> { constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>); } /** * @see https://redis.io/commands/hset */ declare class HSetCommand extends Command { constructor([key, kv]: [key: string, kv: Record], opts?: CommandOptions); } type HSetExConditionalOptions = "FNX" | "fnx" | "FXX" | "fxx"; type HSetExExpirationOptions = { ex: number; px?: never; exat?: never; pxat?: never; keepttl?: never; } | { ex?: never; px: number; exat?: never; pxat?: never; keepttl?: never; } | { ex?: never; px?: never; exat: number; pxat?: never; keepttl?: never; } | { ex?: never; px?: never; exat?: never; pxat: number; keepttl?: never; } | { ex?: never; px?: never; exat?: never; pxat?: never; keepttl: true; } | { ex?: never; px?: never; exat?: never; pxat?: never; keepttl?: never; }; type HSetExCommandOptions = { conditional?: HSetExConditionalOptions; expiration?: HSetExExpirationOptions; }; /** * HSETEX sets the specified fields with their values and optionally sets their expiration time or TTL * Returns 1 on success and 0 otherwise. * * @see https://redis.io/commands/hsetex */ declare class HSetExCommand extends Command { constructor([key, opts, kv]: [key: string, opts: HSetExCommandOptions, kv: Record], cmdOpts?: CommandOptions); } /** * @see https://redis.io/commands/hsetnx */ declare class HSetNXCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, field: string, value: TData], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/hstrlen */ declare class HStrLenCommand extends Command { constructor(cmd: [key: string, field: string], opts?: CommandOptions); } declare class HTtlCommand extends Command { constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/hvals */ declare class HValsCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/incr */ declare class IncrCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/incrby */ declare class IncrByCommand extends Command { constructor(cmd: [key: string, value: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/incrbyfloat */ declare class IncrByFloatCommand extends Command { constructor(cmd: [key: string, value: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.arrappend */ declare class JsonArrAppendCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path: string, ...values: TData], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.arrindex */ declare class JsonArrIndexCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path: string, value: TValue, start?: number, stop?: number], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.arrinsert */ declare class JsonArrInsertCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path: string, index: number, ...values: TData], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.arrlen */ declare class JsonArrLenCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.arrpop */ declare class JsonArrPopCommand extends Command<(null | string)[], (TData | null)[]> { constructor(cmd: [key: string, path?: string, index?: number], opts?: CommandOptions<(null | string)[], (TData | null)[]>); } /** * @see https://redis.io/commands/json.arrtrim */ declare class JsonArrTrimCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path?: string, start?: number, stop?: number], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.clear */ declare class JsonClearCommand extends Command { constructor(cmd: [key: string, path?: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.del */ declare class JsonDelCommand extends Command { constructor(cmd: [key: string, path?: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.forget */ declare class JsonForgetCommand extends Command { constructor(cmd: [key: string, path?: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.get */ declare class JsonGetCommand) | (unknown | Record)[]> extends Command { constructor(cmd: [ key: string, opts?: { indent?: string; newline?: string; space?: string; }, ...path: string[] ] | [key: string, ...path: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.merge */ declare class JsonMergeCommand | Array> extends Command<"OK" | null, "OK" | null> { constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>); } /** * @see https://redis.io/commands/json.mget */ declare class JsonMGetCommand extends Command { constructor(cmd: [keys: string[], path: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.mset */ declare class JsonMSetCommand | (number | string | boolean | Record)[]> extends Command<"OK" | null, "OK" | null> { constructor(cmd: { key: string; path: string; value: TData; }[], opts?: CommandOptions<"OK" | null, "OK" | null>); } /** * @see https://redis.io/commands/json.numincrby */ declare class JsonNumIncrByCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path: string, value: number], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.nummultby */ declare class JsonNumMultByCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path: string, value: number], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.objkeys */ declare class JsonObjKeysCommand extends Command<(string[] | null)[], (string[] | null)[]> { constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(string[] | null)[], (string[] | null)[]>); } /** * @see https://redis.io/commands/json.objlen */ declare class JsonObjLenCommand extends Command<(number | null)[], (number | null)[]> { constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(number | null)[], (number | null)[]>); } /** * @see https://redis.io/commands/json.resp */ declare class JsonRespCommand extends Command { constructor(cmd: [key: string, path?: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.set */ declare class JsonSetCommand | (number | string | boolean | Record)[]> extends Command<"OK" | null, "OK" | null> { constructor(cmd: [ key: string, path: string, value: TData, opts?: { nx: true; xx?: never; } | { nx?: never; xx: true; } ], opts?: CommandOptions<"OK" | null, "OK" | null>); } /** * @see https://redis.io/commands/json.strappend */ declare class JsonStrAppendCommand extends Command<(null | string)[], (null | number)[]> { constructor(cmd: [key: string, path: string, value: string], opts?: CommandOptions<(null | string)[], (null | number)[]>); } /** * @see https://redis.io/commands/json.strlen */ declare class JsonStrLenCommand extends Command<(number | null)[], (number | null)[]> { constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(number | null)[], (number | null)[]>); } /** * @see https://redis.io/commands/json.toggle */ declare class JsonToggleCommand extends Command { constructor(cmd: [key: string, path: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/json.type */ declare class JsonTypeCommand extends Command { constructor(cmd: [key: string, path?: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/keys */ declare class KeysCommand extends Command { constructor(cmd: [pattern: string], opts?: CommandOptions); } declare class LIndexCommand extends Command { constructor(cmd: [key: string, index: number], opts?: CommandOptions); } declare class LInsertCommand extends Command { constructor(cmd: [key: string, direction: "before" | "after", pivot: TData, value: TData], opts?: CommandOptions); } /** * @see https://redis.io/commands/llen */ declare class LLenCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/lmove */ declare class LMoveCommand extends Command { constructor(cmd: [ source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right" ], opts?: CommandOptions); } /** * @see https://redis.io/commands/lmpop */ declare class LmPopCommand extends Command<[ string, TValues[] ] | null, [ string, TValues[] ] | null> { constructor(cmd: [numkeys: number, keys: string[], "LEFT" | "RIGHT", count?: number], opts?: CommandOptions<[string, TValues[]] | null, [string, TValues[]] | null>); } /** * @see https://redis.io/commands/lpop */ declare class LPopCommand extends Command { constructor(cmd: [key: string, count?: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/lpos */ declare class LPosCommand extends Command { constructor(cmd: [key: string, element: unknown, opts?: { rank?: number; count?: number; maxLen?: number; }], opts?: CommandOptions); } /** * @see https://redis.io/commands/lpush */ declare class LPushCommand extends Command { constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/lpushx */ declare class LPushXCommand extends Command { constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions); } declare class LRangeCommand extends Command { constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions); } declare class LRemCommand extends Command { constructor(cmd: [key: string, count: number, value: TData], opts?: CommandOptions); } declare class LSetCommand extends Command<"OK", "OK"> { constructor(cmd: [key: string, index: number, data: TData], opts?: CommandOptions<"OK", "OK">); } declare class LTrimCommand extends Command<"OK", "OK"> { constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/mget */ declare class MGetCommand extends Command<(string | null)[], TData> { constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>); } /** * @see https://redis.io/commands/mset */ declare class MSetCommand extends Command<"OK", "OK"> { constructor([kv]: [kv: Record], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/msetnx */ declare class MSetNXCommand extends Command { constructor([kv]: [kv: Record], opts?: CommandOptions); } /** * @see https://redis.io/commands/persist */ declare class PersistCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/pexpire */ declare class PExpireCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/pexpireat */ declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/pfadd */ declare class PfAddCommand extends Command { constructor(cmd: [string, ...TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/pfcount */ declare class PfCountCommand extends Command { constructor(cmd: [string, ...string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/pfmerge */ declare class PfMergeCommand extends Command<"OK", "OK"> { constructor(cmd: [destination_key: string, ...string[]], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/ping */ declare class PingCommand extends Command { constructor(cmd?: [message?: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/psetex */ declare class PSetEXCommand extends Command { constructor(cmd: [key: string, ttl: number, value: TData], opts?: CommandOptions); } /** * @see https://redis.io/commands/pttl */ declare class PTtlCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/publish */ declare class PublishCommand extends Command { constructor(cmd: [channel: string, message: TMessage], opts?: CommandOptions); } /** * @see https://redis.io/commands/randomkey */ declare class RandomKeyCommand extends Command { constructor(opts?: CommandOptions); } /** * @see https://redis.io/commands/rename */ declare class RenameCommand extends Command<"OK", "OK"> { constructor(cmd: [source: string, destination: string], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/renamenx */ declare class RenameNXCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [source: string, destination: string], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/rpop */ declare class RPopCommand extends Command { constructor(cmd: [key: string, count?: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/rpush */ declare class RPushCommand extends Command { constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/rpushx */ declare class RPushXCommand extends Command { constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/sadd */ declare class SAddCommand extends Command { constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/scard */ declare class SCardCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/script-exists */ declare class ScriptExistsCommand extends Command { constructor(hashes: T, opts?: CommandOptions); } type ScriptFlushCommandOptions = { sync: true; async?: never; } | { sync?: never; async: true; }; /** * @see https://redis.io/commands/script-flush */ declare class ScriptFlushCommand extends Command<"OK", "OK"> { constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/script-load */ declare class ScriptLoadCommand extends Command { constructor(args: [script: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/sdiff */ declare class SDiffCommand extends Command { constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/sdiffstore */ declare class SDiffStoreCommand extends Command { constructor(cmd: [destination: string, ...keys: string[]], opts?: CommandOptions); } type SetCommandOptions = { get?: boolean; } & ({ ex: number; px?: never; exat?: never; pxat?: never; keepTtl?: never; } | { ex?: never; px: number; exat?: never; pxat?: never; keepTtl?: never; } | { ex?: never; px?: never; exat: number; pxat?: never; keepTtl?: never; } | { ex?: never; px?: never; exat?: never; pxat: number; keepTtl?: never; } | { ex?: never; px?: never; exat?: never; pxat?: never; keepTtl: true; } | { ex?: never; px?: never; exat?: never; pxat?: never; keepTtl?: never; }) & ({ nx: true; xx?: never; } | { xx: true; nx?: never; } | { xx?: never; nx?: never; }); /** * @see https://redis.io/commands/set */ declare class SetCommand extends Command { constructor([key, value, opts]: [key: string, value: TData, opts?: SetCommandOptions], cmdOpts?: CommandOptions); } /** * @see https://redis.io/commands/setbit */ declare class SetBitCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, offset: number, value: 0 | 1], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/setex */ declare class SetExCommand extends Command<"OK", "OK"> { constructor(cmd: [key: string, ttl: number, value: TData], opts?: CommandOptions<"OK", "OK">); } /** * @see https://redis.io/commands/setnx */ declare class SetNxCommand extends Command { constructor(cmd: [key: string, value: TData], opts?: CommandOptions); } /** * @see https://redis.io/commands/setrange */ declare class SetRangeCommand extends Command { constructor(cmd: [key: string, offset: number, value: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/sinter */ declare class SInterCommand extends Command { constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/sintercard */ declare class SInterCardCommand extends Command { constructor(cmd: [keys: string[], opts?: { limit?: number; }], cmdOpts?: CommandOptions); } /** * @see https://redis.io/commands/sinterstore */ declare class SInterStoreCommand extends Command { constructor(cmd: [destination: string, key: string, ...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/sismember */ declare class SIsMemberCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [key: string, member: TData], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/smembers */ declare class SMembersCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/smismember */ declare class SMIsMemberCommand extends Command<("0" | "1")[], (0 | 1)[]> { constructor(cmd: [key: string, members: TMembers], opts?: CommandOptions<("0" | "1")[], (0 | 1)[]>); } /** * @see https://redis.io/commands/smove */ declare class SMoveCommand extends Command<"0" | "1", 0 | 1> { constructor(cmd: [source: string, destination: string, member: TData], opts?: CommandOptions<"0" | "1", 0 | 1>); } /** * @see https://redis.io/commands/spop */ declare class SPopCommand extends Command { constructor([key, count]: [key: string, count?: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/srandmember */ declare class SRandMemberCommand extends Command { constructor([key, count]: [key: string, count?: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/srem */ declare class SRemCommand extends Command { constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/sscan */ declare class SScanCommand extends Command<[ string, (string | number)[] ], [ string, (string | number)[] ]> { constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>); } /** * @see https://redis.io/commands/strlen */ declare class StrLenCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/sunion */ declare class SUnionCommand extends Command { constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/sunionstore */ declare class SUnionStoreCommand extends Command { constructor(cmd: [destination: string, key: string, ...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/time */ declare class TimeCommand extends Command<[number, number], [number, number]> { constructor(opts?: CommandOptions<[number, number], [number, number]>); } /** * @see https://redis.io/commands/touch */ declare class TouchCommand extends Command { constructor(cmd: [...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/ttl */ declare class TtlCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/unlink */ declare class UnlinkCommand extends Command { constructor(cmd: [...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/xack */ declare class XAckCommand extends Command { constructor([key, group, id]: [key: string, group: string, id: string | string[]], opts?: CommandOptions); } type XAckDelOption = "KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked"; /** * @see https://redis.io/commands/xackdel */ declare class XAckDelCommand extends Command { constructor([key, group, opts, ...ids]: [key: string, group: string, opts: XAckDelOption, ...ids: string[]], cmdOpts?: CommandOptions); } type XAddCommandOptions = { nomkStream?: boolean; trim?: ({ type: "MAXLEN" | "maxlen"; threshold: number; } | { type: "MINID" | "minid"; threshold: string; }) & ({ comparison: "~"; limit?: number; } | { comparison: "="; limit?: never; }); }; /** * @see https://redis.io/commands/xadd * * Stream ID formats: * - "*" - Fully automatic ID generation * - "-" - Explicit ID (e.g., "1526919030474-55") * - "-*" - Auto-generate sequence number for the given millisecond timestamp (Redis 8+) */ declare class XAddCommand extends Command { constructor([key, id, entries, opts]: [ key: string, id: "*" | `${number}-*` | string, entries: Record, opts?: XAddCommandOptions ], commandOptions?: CommandOptions); } /** * @see https://redis.io/commands/xautoclaim */ declare class XAutoClaim extends Command { constructor([key, group, consumer, minIdleTime, start, options]: [ key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: { count?: number; justId?: boolean; } ], opts?: CommandOptions); } /** * @see https://redis.io/commands/xclaim */ declare class XClaimCommand extends Command { constructor([key, group, consumer, minIdleTime, id, options]: [ key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: { idleMS?: number; timeMS?: number; retryCount?: number; force?: boolean; justId?: boolean; lastId?: number; } ], opts?: CommandOptions); } /** * @see https://redis.io/commands/xdel */ declare class XDelCommand extends Command { constructor([key, ids]: [key: string, ids: string[] | string], opts?: CommandOptions); } type XDelExOption = "KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked"; /** * @see https://redis.io/commands/xdelex */ declare class XDelExCommand extends Command { constructor([key, opts, ...ids]: [key: string, opts?: XDelExOption, ...ids: string[]], cmdOpts?: CommandOptions); } type XGroupCommandType = { type: "CREATE"; group: string; id: `$` | string; options?: { MKSTREAM?: boolean; ENTRIESREAD?: number; }; } | { type: "CREATECONSUMER"; group: string; consumer: string; } | { type: "DELCONSUMER"; group: string; consumer: string; } | { type: "DESTROY"; group: string; } | { type: "SETID"; group: string; id: `$` | string; options?: { ENTRIESREAD?: number; }; }; type XGroupReturnType = T["type"] extends "CREATE" ? string : T["type"] extends "CREATECONSUMER" ? 0 | 1 : T["type"] extends "DELCONSUMER" ? number : T["type"] extends "DESTROY" ? 0 | 1 : T["type"] extends "SETID" ? string : never; /** * @see https://redis.io/commands/xgroup */ declare class XGroupCommand extends Command> { constructor([key, opts]: [key: string, opts: TOptions], commandOptions?: CommandOptions); } type XInfoCommands = { type: "CONSUMERS"; group: string; } | { type: "GROUPS"; }; /** * @see https://redis.io/commands/xinfo */ declare class XInfoCommand extends Command { constructor([key, options]: [key: string, options: XInfoCommands], opts?: CommandOptions); } /** * @see https://redis.io/commands/xlen */ declare class XLenCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/xpending */ declare class XPendingCommand extends Command { constructor([key, group, start, end, count, options]: [ key: string, group: string, start: string, end: string, count: number, options?: { idleTime?: number; consumer?: string | string[]; } ], opts?: CommandOptions); } declare class XRangeCommand>> extends Command { constructor([key, start, end, count]: [key: string, start: string, end: string, count?: number], opts?: CommandOptions); } type XReadCommandOptions = [ key: string | string[], id: string | string[], options?: { count?: number; /** * @deprecated block is not yet supported in Upstash Redis */ blockMS?: number; } ]; type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [ key: string, id: string, options?: { count?: number; /** * @deprecated block is not yet supported in Upstash Redis */ blockMS?: number; } ] : never : K extends string[] ? I extends string[] ? [ key: string[], id: string[], options?: { count?: number; /** * @deprecated block is not yet supported in Upstash Redis */ blockMS?: number; } ] : never : never : never; /** * @see https://redis.io/commands/xread */ declare class XReadCommand extends Command { constructor([key, id, options]: XReadOptions, opts?: CommandOptions); } type Options = { count?: number; /** * @deprecated block is not yet supported in Upstash Redis */ blockMS?: number; NOACK?: boolean; }; type XReadGroupCommandOptions = [ group: string, consumer: string, key: string | string[], id: string | string[], options?: Options ]; type XReadGroupOptions = XReadGroupCommandOptions extends [ string, string, infer TKey, infer TId, ...any[] ] ? TKey extends string ? TId extends string ? [group: string, consumer: string, key: string, id: string, options?: Options] : never : TKey extends string[] ? TId extends string[] ? [group: string, consumer: string, key: string[], id: string[], options?: Options] : never : never : never; /** * @see https://redis.io/commands/xreadgroup */ declare class XReadGroupCommand extends Command { constructor([group, consumer, key, id, options]: XReadGroupOptions, opts?: CommandOptions); } declare class XRevRangeCommand>> extends Command { constructor([key, end, start, count]: [key: string, end: string, start: string, count?: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/xtrim */ type XTrimOptions = { strategy: "MAXLEN" | "MINID"; exactness?: "~" | "="; threshold: number | string; limit?: number; }; declare class XTrimCommand extends Command { constructor([key, options]: [key: string, options: XTrimOptions], opts?: CommandOptions); } type NXAndXXOptions = { nx: true; xx?: never; } | { nx?: never; xx: true; } | { nx?: never; xx?: never; }; type LTAndGTOptions = { lt: true; gt?: never; } | { lt?: never; gt: true; } | { lt?: never; gt?: never; }; type ZAddCommandOptions = NXAndXXOptions & LTAndGTOptions & { ch?: true; } & { incr?: true; }; type Arg2 = ScoreMember | ZAddCommandOptions; type ScoreMember = { score: number; member: TData; }; /** * @see https://redis.io/commands/zadd */ declare class ZAddCommand extends Command { constructor([key, arg1, ...arg2]: [string, Arg2, ...ScoreMember[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/zcard */ declare class ZCardCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/zcount */ declare class ZCountCommand extends Command { constructor(cmd: [key: string, min: number | string, max: number | string], opts?: CommandOptions); } /** * @see https://redis.io/commands/zincrby */ declare class ZIncrByCommand extends Command { constructor(cmd: [key: string, increment: number, member: TData], opts?: CommandOptions); } type ZInterStoreCommandOptions = { aggregate?: "sum" | "min" | "max"; } & ({ weight: number; weights?: never; } | { weight?: never; weights: number[]; } | { weight?: never; weights?: never; }); /** * @see https://redis.io/commands/zInterstore */ declare class ZInterStoreCommand extends Command { constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZInterStoreCommandOptions], cmdOpts?: CommandOptions); constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions], cmdOpts?: CommandOptions); } /** * @see https://redis.io/commands/zlexcount */ declare class ZLexCountCommand extends Command { constructor(cmd: [key: string, min: string, max: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/zpopmax */ declare class ZPopMaxCommand extends Command { constructor([key, count]: [key: string, count?: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/zpopmin */ declare class ZPopMinCommand extends Command { constructor([key, count]: [key: string, count?: number], opts?: CommandOptions); } type ZRangeCommandOptions = { withScores?: boolean; rev?: boolean; } & ({ byScore: true; byLex?: never; } | { byScore?: never; byLex: true; } | { byScore?: never; byLex?: never; }) & ({ offset: number; count: number; } | { offset?: never; count?: never; }); /** * @see https://redis.io/commands/zrange */ declare class ZRangeCommand extends Command { constructor(cmd: [key: string, min: number, max: number, opts?: ZRangeCommandOptions], cmdOpts?: CommandOptions); constructor(cmd: [ key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: { byLex: true; } & ZRangeCommandOptions ], cmdOpts?: CommandOptions); constructor(cmd: [ key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: { byScore: true; } & ZRangeCommandOptions ], cmdOpts?: CommandOptions); } /** * @see https://redis.io/commands/zrank */ declare class ZRankCommand extends Command { constructor(cmd: [key: string, member: TData], opts?: CommandOptions); } /** * @see https://redis.io/commands/zrem */ declare class ZRemCommand extends Command { constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/zremrangebylex */ declare class ZRemRangeByLexCommand extends Command { constructor(cmd: [key: string, min: string, max: string], opts?: CommandOptions); } /** * @see https://redis.io/commands/zremrangebyrank */ declare class ZRemRangeByRankCommand extends Command { constructor(cmd: [key: string, start: number, stop: number], opts?: CommandOptions); } /** * @see https://redis.io/commands/zremrangebyscore */ declare class ZRemRangeByScoreCommand extends Command { constructor(cmd: [ key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf" ], opts?: CommandOptions); } /** * @see https://redis.io/commands/zrevrank */ declare class ZRevRankCommand extends Command { constructor(cmd: [key: string, member: TData], opts?: CommandOptions); } /** * @see https://redis.io/commands/zscan */ declare class ZScanCommand extends Command<[ string, (string | number)[] ], [ string, (string | number)[] ]> { constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>); } /** * @see https://redis.io/commands/zscore */ declare class ZScoreCommand extends Command { constructor(cmd: [key: string, member: TData], opts?: CommandOptions); } type ZUnionCommandOptions = { withScores?: boolean; aggregate?: "sum" | "min" | "max"; } & ({ weight: number; weights?: never; } | { weight?: never; weights: number[]; } | { weight?: never; weights?: never; }); /** * @see https://redis.io/commands/zunion */ declare class ZUnionCommand extends Command { constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions); constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions); } type ZUnionStoreCommandOptions = { aggregate?: "sum" | "min" | "max"; } & ({ weight: number; weights?: never; } | { weight?: never; weights: number[]; } | { weight?: never; weights?: never; }); /** * @see https://redis.io/commands/zunionstore */ declare class ZUnionStoreCommand extends Command { constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions); constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions); } type BaseMessageData = { channel: string; message: TMessage; }; type PatternMessageData = BaseMessageData & { pattern: string; }; type SubscriptionCountEvent = number; type MessageEventMap = { message: BaseMessageData; subscribe: SubscriptionCountEvent; unsubscribe: SubscriptionCountEvent; pmessage: PatternMessageData; psubscribe: SubscriptionCountEvent; punsubscribe: SubscriptionCountEvent; error: Error; [key: `message:${string}`]: BaseMessageData; [key: `pmessage:${string}`]: PatternMessageData; }; type EventType = keyof MessageEventMap; type Listener = (event: MessageEventMap[T]) => void; declare class Subscriber extends EventTarget { private subscriptions; private client; private listeners; private opts?; constructor(client: Requester, channels: string[], isPattern?: boolean, opts?: Pick); private subscribeToChannel; private subscribeToPattern; private handleMessage; private dispatchToListeners; on>(type: T, listener: Listener): void; removeAllListeners(): void; unsubscribe(channels?: string[]): Promise; getSubscribedChannels(): string[]; } /** * @see https://redis.io/commands/zdiffstore */ declare class ZDiffStoreCommand extends Command { constructor(cmd: [destination: string, numkeys: number, ...keys: string[]], opts?: CommandOptions); } /** * @see https://redis.io/commands/zmscore */ declare class ZMScoreCommand extends Command { constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions); } type InferResponseData = { [K in keyof T]: T[K] extends Command ? TData : unknown; }; interface ExecMethod[]> { /** * Send the pipeline request to upstash. * * Returns an array with the results of all pipelined commands. * * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though: * ```ts * const p = redis.pipeline() * p.get("key") * const result = p.exec<[{ greeting: string }]>() * ``` * * If one of the commands get an error, the whole pipeline fails. Alternatively, you can set the keepErrors option to true in order to get the errors individually. * * If keepErrors is set to true, a list of objects is returned where each object corresponds to a command and is of type: `{ result: unknown, error?: string }`. * * ```ts * const p = redis.pipeline() * p.get("key") * * const result = await p.exec({ keepErrors: true }); * const getResult = result[0].result * const getError = result[0].error * ``` */ >(): Promise; >(options: { keepErrors: true; }): Promise<{ [K in keyof TCommandResults]: UpstashResponse; }>; } /** * Upstash REST API supports command pipelining to send multiple commands in * batch, instead of sending each command one by one and waiting for a response. * When using pipelines, several commands are sent using a single HTTP request, * and a single JSON array response is returned. Each item in the response array * corresponds to the command in the same order within the pipeline. * * **NOTE:** * * Execution of the pipeline is not atomic. Even though each command in * the pipeline will be executed in order, commands sent by other clients can * interleave with the pipeline. * * **Examples:** * * ```ts * const p = redis.pipeline() // or redis.multi() * p.set("key","value") * p.get("key") * const res = await p.exec() * ``` * * You can also chain commands together * ```ts * const p = redis.pipeline() * const res = await p.set("key","value").get("key").exec() * ``` * * Return types are inferred if all commands are chained, but you can still * override the response type manually: * ```ts * redis.pipeline() * .set("key", { greeting: "hello"}) * .get("key") * .exec<["OK", { greeting: string } ]>() * * ``` */ declare class Pipeline[] = []> { private client; private commands; private commandOptions?; private multiExec; constructor(opts: { client: Requester; commandOptions?: CommandOptions; multiExec?: boolean; }); exec: ExecMethod; /** * Returns the length of pipeline before the execution */ length(): number; /** * Pushes a command into the pipeline and returns a chainable instance of the * pipeline */ private chain; /** * @see https://redis.io/commands/append */ append: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/bitcount */ bitcount: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * Returns an instance that can be used to execute `BITFIELD` commands on one key. * * @example * ```typescript * redis.set("mykey", 0); * const result = await redis.pipeline() * .bitfield("mykey") * .set("u4", 0, 16) * .incr("u4", "#1", 1) * .exec(); * console.log(result); // [[0, 1]] * ``` * * @see https://redis.io/commands/bitfield */ bitfield: (...args: CommandArgs) => BitFieldCommand]>>; /** * @see https://redis.io/commands/bitop */ bitop: { (op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>; (op: "not", destinationKey: string, sourceKey: string): Pipeline<[...TCommands, BitOpCommand]>; (op: "diff" | "diff1" | "andor", destinationKey: string, x: string, ...y: string[]): Pipeline<[...TCommands, BitOpCommand]>; (op: "one", destinationKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>; }; /** * @see https://redis.io/commands/bitpos */ bitpos: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/client-setinfo */ clientSetinfo: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/copy */ copy: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zdiffstore */ zdiffstore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/dbsize */ dbsize: () => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/decr */ decr: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/decrby */ decrby: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/del */ del: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/echo */ echo: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/eval_ro */ evalRo: (...args: [script: string, keys: string[], args: TArgs]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/eval */ eval: (...args: [script: string, keys: string[], args: TArgs]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/evalsha_ro */ evalshaRo: (...args: [sha1: string, keys: string[], args: TArgs]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/evalsha */ evalsha: (...args: [sha1: string, keys: string[], args: TArgs]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/exists */ exists: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/expire */ expire: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/expireat */ expireat: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/flushall */ flushall: (args?: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/flushdb */ flushdb: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/geoadd */ geoadd: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/geodist */ geodist: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/geopos */ geopos: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/geohash */ geohash: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/geosearch */ geosearch: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/geosearchstore */ geosearchstore: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/get */ get: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/getbit */ getbit: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/getdel */ getdel: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/getex */ getex: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/getrange */ getrange: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/getset */ getset: (key: string, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hdel */ hdel: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hexists */ hexists: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hexpire */ hexpire: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hexpireat */ hexpireat: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hexpiretime */ hexpiretime: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/httl */ httl: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hpexpire */ hpexpire: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hpexpireat */ hpexpireat: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hpexpiretime */ hpexpiretime: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hpttl */ hpttl: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hpersist */ hpersist: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hget */ hget: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hgetall */ hgetall: >(...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hgetdel */ hgetdel: >(...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hgetex */ hgetex: >(...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hincrby */ hincrby: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hincrbyfloat */ hincrbyfloat: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hkeys */ hkeys: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hlen */ hlen: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hmget */ hmget: >(...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hmset */ hmset: (key: string, kv: Record) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hrandfield */ hrandfield: >(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hscan */ hscan: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hset */ hset: (key: string, kv: Record) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hsetex */ hsetex: (...args: CommandArgs>) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hsetnx */ hsetnx: (key: string, field: string, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hstrlen */ hstrlen: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/hvals */ hvals: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/incr */ incr: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/incrby */ incrby: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/incrbyfloat */ incrbyfloat: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/keys */ keys: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lindex */ lindex: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/linsert */ linsert: (key: string, direction: "before" | "after", pivot: TData, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/llen */ llen: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lmove */ lmove: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lpop */ lpop: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lmpop */ lmpop: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lpos */ lpos: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lpush */ lpush: (key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lpushx */ lpushx: (key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lrange */ lrange: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lrem */ lrem: (key: string, count: number, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/lset */ lset: (key: string, index: number, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/ltrim */ ltrim: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/mget */ mget: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/mset */ mset: (kv: Record) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/msetnx */ msetnx: (kv: Record) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/persist */ persist: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/pexpire */ pexpire: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/pexpireat */ pexpireat: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/pfadd */ pfadd: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/pfcount */ pfcount: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/pfmerge */ pfmerge: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/ping */ ping: (args?: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/psetex */ psetex: (key: string, ttl: number, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/pttl */ pttl: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/publish */ publish: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/randomkey */ randomkey: () => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/rename */ rename: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/renamenx */ renamenx: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/rpop */ rpop: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/rpush */ rpush: (key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/rpushx */ rpushx: (key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sadd */ sadd: (key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/scan */ scan: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/scard */ scard: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/script-exists */ scriptExists: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/script-flush */ scriptFlush: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/script-load */ scriptLoad: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; sdiff: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sdiffstore */ sdiffstore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/set */ set: (key: string, value: TData, opts?: SetCommandOptions) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/setbit */ setbit: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/setex */ setex: (key: string, ttl: number, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/setnx */ setnx: (key: string, value: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/setrange */ setrange: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sinter */ sinter: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sintercard */ sintercard: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sinterstore */ sinterstore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sismember */ sismember: (key: string, member: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/smembers */ smembers: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/smismember */ smismember: (key: string, members: TMembers) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/smove */ smove: (source: string, destination: string, member: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/spop */ spop: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/srandmember */ srandmember: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/srem */ srem: (key: string, ...members: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sscan */ sscan: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/strlen */ strlen: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sunion */ sunion: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/sunionstore */ sunionstore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/time */ time: () => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/touch */ touch: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/ttl */ ttl: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/type */ type: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/unlink */ unlink: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zadd */ zadd: (...args: [key: string, scoreMember: ScoreMember, ...scoreMemberPairs: ScoreMember[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember, ...ScoreMember[]]]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xadd */ xadd: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xack */ xack: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xackdel */ xackdel: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xdel */ xdel: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xdelex */ xdelex: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xgroup */ xgroup: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xread */ xread: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xreadgroup */ xreadgroup: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xinfo */ xinfo: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xlen */ xlen: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xpending */ xpending: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xclaim */ xclaim: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xautoclaim */ xautoclaim: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xtrim */ xtrim: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/xrange */ xrange: >(...args: CommandArgs) => Pipeline<[...TCommands, Command>]>; /** * @see https://redis.io/commands/xrevrange */ xrevrange: >(...args: CommandArgs) => Pipeline<[...TCommands, Command>]>; /** * @see https://redis.io/commands/zcard */ zcard: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zcount */ zcount: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zincrby */ zincrby: (key: string, increment: number, member: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zinterstore */ zinterstore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zlexcount */ zlexcount: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zmscore */ zmscore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zpopmax */ zpopmax: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zpopmin */ zpopmin: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zrange */ zrange: (...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: { byLex: true; } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: { byScore: true; } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zrank */ zrank: (key: string, member: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zrem */ zrem: (key: string, ...members: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zremrangebylex */ zremrangebylex: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zremrangebyrank */ zremrangebyrank: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zremrangebyscore */ zremrangebyscore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zrevrank */ zrevrank: (key: string, member: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zscan */ zscan: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zscore */ zscore: (key: string, member: TData) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zunionstore */ zunionstore: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/zunion */ zunion: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/?group=json */ get json(): { /** * @see https://redis.io/commands/json.arrappend */ arrappend: (key: string, path: string, ...values: unknown[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.arrindex */ arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.arrinsert */ arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.arrlen */ arrlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.arrpop */ arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.arrtrim */ arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.clear */ clear: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.del */ del: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.forget */ forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.get */ get: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.merge */ merge: (key: string, path: string, value: string | number | unknown[] | Record) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.mget */ mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.mset */ mset: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.numincrby */ numincrby: (key: string, path: string, value: number) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.nummultby */ nummultby: (key: string, path: string, value: number) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.objkeys */ objkeys: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.objlen */ objlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.resp */ resp: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.set */ set: (key: string, path: string, value: string | number | boolean | Record | (string | number | boolean | Record)[], opts?: { nx: true; xx?: never; } | { nx?: never; xx: true; } | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.strappend */ strappend: (key: string, path: string, value: string) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.strlen */ strlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.toggle */ toggle: (key: string, path: string) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/commands/json.type */ type: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command]>; }; get functions(): { /** * @see https://redis.io/docs/latest/commands/function-load/ */ load: (args: FunctionLoadArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/docs/latest/commands/function-list/ */ list: (args?: FunctionListArgs | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/docs/latest/commands/function-delete/ */ delete: (libraryName: string) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/docs/latest/commands/function-flush/ */ flush: () => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/docs/latest/commands/function-stats/ */ stats: () => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/docs/latest/commands/fcall/ */ call: (functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command]>; /** * @see https://redis.io/docs/latest/commands/fcall_ro/ */ callRo: (functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command]>; }; } /** * Creates a new script. * * Scripts offer the ability to optimistically try to execute a script without having to send the * entire script to the server. If the script is loaded on the server, it tries again by sending * the entire script. Afterwards, the script is cached on the server. * * @example * ```ts * const redis = new Redis({...}) * * const script = redis.createScript("return ARGV[1];") * const arg1 = await script.eval([], ["Hello World"]) * expect(arg1, "Hello World") * ``` */ declare class Script { readonly script: string; /** * @deprecated This property is initialized to an empty string and will be set in the init method * asynchronously. Do not use this property immidiately after the constructor. * * This property is only exposed for backwards compatibility and will be removed in the * future major release. */ sha1: string; private initPromise; private readonly redis; constructor(redis: Redis, script: string); /** * Initialize the script by computing its SHA-1 hash. */ private init; /** * Send an `EVAL` command to redis. */ eval(keys: string[], args: string[]): Promise; /** * Calculates the sha1 hash of the script and then calls `EVALSHA`. */ evalsha(keys: string[], args: string[]): Promise; /** * Optimistically try to run `EVALSHA` first. * If the script is not loaded in redis, it will fall back and try again with `EVAL`. * * Following calls will be able to use the cached script */ exec(keys: string[], args: string[]): Promise; /** * Compute the sha1 hash of the script and return its hex representation. */ private digest; } /** * Creates a new script. * * Scripts offer the ability to optimistically try to execute a script without having to send the * entire script to the server. If the script is loaded on the server, it tries again by sending * the entire script. Afterwards, the script is cached on the server. * * @example * ```ts * const redis = new Redis({...}) * * const script = redis.createScript("return ARGV[1];", { readOnly: true }) * const arg1 = await script.evalRo([], ["Hello World"]) * expect(arg1, "Hello World") * ``` */ declare class ScriptRO { readonly script: string; /** * @deprecated This property is initialized to an empty string and will be set in the init method * asynchronously. Do not use this property immidiately after the constructor. * * This property is only exposed for backwards compatibility and will be removed in the * future major release. */ sha1: string; private initPromise; private readonly redis; constructor(redis: Redis, script: string); private init; /** * Send an `EVAL_RO` command to redis. */ evalRo(keys: string[], args: string[]): Promise; /** * Calculates the sha1 hash of the script and then calls `EVALSHA_RO`. */ evalshaRo(keys: string[], args: string[]): Promise; /** * Optimistically try to run `EVALSHA_RO` first. * If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`. * * Following calls will be able to use the cached script */ exec(keys: string[], args: string[]): Promise; /** * Compute the sha1 hash of the script and return its hex representation. */ private digest; } /** * Serverless redis client for upstash. */ declare class Redis { protected client: Requester; protected opts?: CommandOptions; protected enableTelemetry: boolean; protected enableAutoPipelining: boolean; /** * Create a new redis client * * @example * ```typescript * const redis = new Redis({ * url: "", * token: "", * }); * ``` */ constructor(client: Requester, opts?: RedisOptions); get readYourWritesSyncToken(): string | undefined; set readYourWritesSyncToken(session: string | undefined); get json(): { /** * @see https://redis.io/commands/json.arrappend */ arrappend: (key: string, path: string, ...values: unknown[]) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.arrindex */ arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.arrinsert */ arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.arrlen */ arrlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.arrpop */ arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Promise; /** * @see https://redis.io/commands/json.arrtrim */ arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.clear */ clear: (key: string, path?: string | undefined) => Promise; /** * @see https://redis.io/commands/json.del */ del: (key: string, path?: string | undefined) => Promise; /** * @see https://redis.io/commands/json.forget */ forget: (key: string, path?: string | undefined) => Promise; /** * @see https://redis.io/commands/json.get */ get: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/json.merge */ merge: (key: string, path: string, value: string | number | unknown[] | Record) => Promise<"OK" | null>; /** * @see https://redis.io/commands/json.mget */ mget: (keys: string[], path: string) => Promise; /** * @see https://redis.io/commands/json.mset */ mset: (...args: CommandArgs) => Promise<"OK" | null>; /** * @see https://redis.io/commands/json.numincrby */ numincrby: (key: string, path: string, value: number) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.nummultby */ nummultby: (key: string, path: string, value: number) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.objkeys */ objkeys: (key: string, path?: string | undefined) => Promise<(string[] | null)[]>; /** * @see https://redis.io/commands/json.objlen */ objlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.resp */ resp: (key: string, path?: string | undefined) => Promise; /** * @see https://redis.io/commands/json.set */ set: (key: string, path: string, value: string | number | boolean | Record | (string | number | boolean | Record)[], opts?: { nx: true; xx?: never; } | { nx?: never; xx: true; } | undefined) => Promise<"OK" | null>; /** * @see https://redis.io/commands/json.strappend */ strappend: (key: string, path: string, value: string) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.strlen */ strlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>; /** * @see https://redis.io/commands/json.toggle */ toggle: (key: string, path: string) => Promise; /** * @see https://redis.io/commands/json.type */ type: (key: string, path?: string | undefined) => Promise; }; get functions(): { /** * @see https://redis.io/docs/latest/commands/function-load/ */ load: (args: FunctionLoadArgs) => Promise; /** * @see https://redis.io/docs/latest/commands/function-list/ */ list: (args?: FunctionListArgs | undefined) => Promise<{ libraryName: string; engine: string; functions: { name: string; description?: string; flags: string[]; }[]; libraryCode?: string; }[]>; /** * @see https://redis.io/docs/latest/commands/function-delete/ */ delete: (libraryName: string) => Promise<"OK">; /** * @see https://redis.io/docs/latest/commands/function-flush/ */ flush: () => Promise<"OK">; /** * @see https://redis.io/docs/latest/commands/function-stats/ * * Note: `running_script` field is not supported and therefore not included in the type. */ stats: () => Promise<{ engines: { [k: string]: { librariesCount: any; functionsCount: any; }; }; }>; /** * @see https://redis.io/docs/latest/commands/fcall/ */ call: (functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise; /** * @see https://redis.io/docs/latest/commands/fcall_ro/ */ callRo: (functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise; }; /** * Wrap a new middleware around the HTTP client. */ use: (middleware: (r: UpstashRequest, next: (req: UpstashRequest) => Promise>) => Promise>) => void; /** * Technically this is not private, we can hide it from intellisense by doing this */ protected addTelemetry: (telemetry: Telemetry) => void; /** * Creates a new script. * * Scripts offer the ability to optimistically try to execute a script without having to send the * entire script to the server. If the script is loaded on the server, it tries again by sending * the entire script. Afterwards, the script is cached on the server. * * @param script - The script to create * @param opts - Optional options to pass to the script `{ readonly?: boolean }` * @returns A new script * * @example * ```ts * const redis = new Redis({...}) * * const script = redis.createScript("return ARGV[1];") * const arg1 = await script.eval([], ["Hello World"]) * expect(arg1, "Hello World") * ``` * @example * ```ts * const redis = new Redis({...}) * * const script = redis.createScript("return ARGV[1];", { readonly: true }) * const arg1 = await script.evalRo([], ["Hello World"]) * expect(arg1, "Hello World") * ``` */ createScript(script: string, opts?: { readonly?: TReadonly; }): TReadonly extends true ? ScriptRO : Script; get search(): { createIndex: (params: CreateIndexParameters) => Promise>; index: (params: InitIndexParameters) => SearchIndex; alias: { list: () => Promise>; add: ({ indexName, alias }: { indexName: string; alias: string; }) => Promise<1 | 2>; delete: ({ alias }: { alias: string; }) => Promise<0 | 1>; }; }; /** * Create a new pipeline that allows you to send requests in bulk. * * @see {@link Pipeline} */ pipeline: () => Pipeline<[]>; protected autoPipeline: () => Redis; /** * Create a new transaction to allow executing multiple steps atomically. * * All the commands in a transaction are serialized and executed sequentially. A request sent by * another client will never be served in the middle of the execution of a Redis Transaction. This * guarantees that the commands are executed as a single isolated operation. * * @see {@link Pipeline} */ multi: () => Pipeline<[]>; /** * Returns an instance that can be used to execute `BITFIELD` commands on one key. * * @example * ```typescript * redis.set("mykey", 0); * const result = await redis.bitfield("mykey") * .set("u4", 0, 16) * .incr("u4", "#1", 1) * .exec(); * console.log(result); // [0, 1] * ``` * * @see https://redis.io/commands/bitfield */ bitfield: (...args: CommandArgs) => BitFieldCommand>; /** * @see https://redis.io/commands/append */ append: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/bitcount */ bitcount: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/bitop */ bitop: { (op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Promise; (op: "not", destinationKey: string, sourceKey: string): Promise; (op: "diff" | "diff1" | "andor", destinationKey: string, x: string, ...y: string[]): Promise; (op: "one", destinationKey: string, ...sourceKeys: string[]): Promise; }; /** * @see https://redis.io/commands/bitpos */ bitpos: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/client-setinfo */ clientSetinfo: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/copy */ copy: (...args: CommandArgs) => Promise<"COPIED" | "NOT_COPIED">; /** * @see https://redis.io/commands/dbsize */ dbsize: () => Promise; /** * @see https://redis.io/commands/decr */ decr: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/decrby */ decrby: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/del */ del: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/echo */ echo: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/eval_ro */ evalRo: (...args: [script: string, keys: string[], args: TArgs]) => Promise; /** * @see https://redis.io/commands/eval */ eval: (...args: [script: string, keys: string[], args: TArgs]) => Promise; /** * @see https://redis.io/commands/evalsha_ro */ evalshaRo: (...args: [sha1: string, keys: string[], args: TArgs]) => Promise; /** * @see https://redis.io/commands/evalsha */ evalsha: (...args: [sha1: string, keys: string[], args: TArgs]) => Promise; /** * Generic method to execute any Redis command. */ exec: (args: [command: string, ...args: (string | number | boolean)[]]) => Promise; /** * @see https://redis.io/commands/exists */ exists: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/expire */ expire: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/expireat */ expireat: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/flushall */ flushall: (args?: CommandArgs) => Promise<"OK">; /** * @see https://redis.io/commands/flushdb */ flushdb: (...args: CommandArgs) => Promise<"OK">; /** * @see https://redis.io/commands/geoadd */ geoadd: (...args: CommandArgs>) => Promise; /** * @see https://redis.io/commands/geopos */ geopos: (...args: CommandArgs>) => Promise<{ lng: number; lat: number; }[]>; /** * @see https://redis.io/commands/geodist */ geodist: (...args: CommandArgs>) => Promise; /** * @see https://redis.io/commands/geohash */ geohash: (...args: CommandArgs>) => Promise<(string | null)[]>; /** * @see https://redis.io/commands/geosearch */ geosearch: (...args: CommandArgs>) => Promise<({ member: TData; } & { coord?: { long: number; lat: number; } | undefined; dist?: number | undefined; hash?: string | undefined; })[]>; /** * @see https://redis.io/commands/geosearchstore */ geosearchstore: (...args: CommandArgs>) => Promise; /** * @see https://redis.io/commands/get */ get: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/getbit */ getbit: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/getdel */ getdel: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/getex */ getex: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/getrange */ getrange: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/getset */ getset: (key: string, value: TData) => Promise; /** * @see https://redis.io/commands/hdel */ hdel: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/hexists */ hexists: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hexpire */ hexpire: (...args: CommandArgs) => Promise<(0 | 1 | 2 | -2)[]>; /** * @see https://redis.io/commands/hexpireat */ hexpireat: (...args: CommandArgs) => Promise<(0 | 1 | 2 | -2)[]>; /** * @see https://redis.io/commands/hexpiretime */ hexpiretime: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/httl */ httl: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hpexpire */ hpexpire: (...args: CommandArgs) => Promise<(0 | 1 | 2 | -2)[]>; /** * @see https://redis.io/commands/hpexpireat */ hpexpireat: (...args: CommandArgs) => Promise<(0 | 1 | 2 | -2)[]>; /** * @see https://redis.io/commands/hpexpiretime */ hpexpiretime: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hpttl */ hpttl: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hpersist */ hpersist: (...args: CommandArgs) => Promise<(1 | -2 | -1)[]>; /** * @see https://redis.io/commands/hget */ hget: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hgetall */ hgetall: >(...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hgetdel */ hgetdel: >(...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hgetex */ hgetex: >(...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hincrby */ hincrby: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hincrbyfloat */ hincrbyfloat: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hkeys */ hkeys: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hlen */ hlen: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hmget */ hmget: >(...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hmset */ hmset: (key: string, kv: Record) => Promise<"OK">; /** * @see https://redis.io/commands/hrandfield */ hrandfield: { (key: string): Promise; (key: string, count: number): Promise; >(key: string, count: number, withValues: boolean): Promise>; }; /** * @see https://redis.io/commands/hscan */ hscan: (...args: CommandArgs) => Promise<[string, (string | number)[]]>; /** * @see https://redis.io/commands/hset */ hset: (key: string, kv: Record) => Promise; /** * @see https://redis.io/commands/hsetex */ hsetex: (...args: CommandArgs>) => Promise; /** * @see https://redis.io/commands/hsetnx */ hsetnx: (key: string, field: string, value: TData) => Promise<0 | 1>; /** * @see https://redis.io/commands/hstrlen */ hstrlen: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/hvals */ hvals: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/incr */ incr: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/incrby */ incrby: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/incrbyfloat */ incrbyfloat: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/keys */ keys: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/lindex */ lindex: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/linsert */ linsert: (key: string, direction: "before" | "after", pivot: TData, value: TData) => Promise; /** * @see https://redis.io/commands/llen */ llen: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/lmove */ lmove: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/lpop */ lpop: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/lmpop */ lmpop: (...args: CommandArgs) => Promise<[string, TData[]] | null>; /** * @see https://redis.io/commands/lpos */ lpos: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/lpush */ lpush: (key: string, ...elements: TData[]) => Promise; /** * @see https://redis.io/commands/lpushx */ lpushx: (key: string, ...elements: TData[]) => Promise; /** * @see https://redis.io/commands/lrange */ lrange: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/lrem */ lrem: (key: string, count: number, value: TData) => Promise; /** * @see https://redis.io/commands/lset */ lset: (key: string, index: number, value: TData) => Promise<"OK">; /** * @see https://redis.io/commands/ltrim */ ltrim: (...args: CommandArgs) => Promise<"OK">; /** * @see https://redis.io/commands/mget */ mget: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/mset */ mset: (kv: Record) => Promise<"OK">; /** * @see https://redis.io/commands/msetnx */ msetnx: (kv: Record) => Promise; /** * @see https://redis.io/commands/persist */ persist: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/pexpire */ pexpire: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/pexpireat */ pexpireat: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/pfadd */ pfadd: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/pfcount */ pfcount: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/pfmerge */ pfmerge: (...args: CommandArgs) => Promise<"OK">; /** * @see https://redis.io/commands/ping */ ping: (args?: CommandArgs) => Promise; /** * @see https://redis.io/commands/psetex */ psetex: (key: string, ttl: number, value: TData) => Promise; /** * @see https://redis.io/commands/psubscribe */ psubscribe: (patterns: string | string[]) => Subscriber; /** * @see https://redis.io/commands/pttl */ pttl: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/publish */ publish: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/randomkey */ randomkey: () => Promise; /** * @see https://redis.io/commands/rename */ rename: (...args: CommandArgs) => Promise<"OK">; /** * @see https://redis.io/commands/renamenx */ renamenx: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/rpop */ rpop: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/rpush */ rpush: (key: string, ...elements: TData[]) => Promise; /** * @see https://redis.io/commands/rpushx */ rpushx: (key: string, ...elements: TData[]) => Promise; /** * @see https://redis.io/commands/sadd */ sadd: (key: string, member: TData, ...members: TData[]) => Promise; /** * @see https://redis.io/commands/scan */ scan(cursor: string | number): Promise; scan(cursor: string | number, opts: TOptions): Promise; /** * @see https://redis.io/commands/scard */ scard: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/script-exists */ scriptExists: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/script-flush */ scriptFlush: (...args: CommandArgs) => Promise<"OK">; /** * @see https://redis.io/commands/script-load */ scriptLoad: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sdiff */ sdiff: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sdiffstore */ sdiffstore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/set */ set: (key: string, value: TData, opts?: SetCommandOptions) => Promise<"OK" | TData | null>; /** * @see https://redis.io/commands/setbit */ setbit: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://redis.io/commands/setex */ setex: (key: string, ttl: number, value: TData) => Promise<"OK">; /** * @see https://redis.io/commands/setnx */ setnx: (key: string, value: TData) => Promise; /** * @see https://redis.io/commands/setrange */ setrange: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sinter */ sinter: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sintercard */ sintercard: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sinterstore */ sinterstore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sismember */ sismember: (key: string, member: TData) => Promise<0 | 1>; /** * @see https://redis.io/commands/smismember */ smismember: (key: string, members: TMembers) => Promise<(0 | 1)[]>; /** * @see https://redis.io/commands/smembers */ smembers: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/smove */ smove: (source: string, destination: string, member: TData) => Promise<0 | 1>; /** * @see https://redis.io/commands/spop */ spop: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/srandmember */ srandmember: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/srem */ srem: (key: string, ...members: TData[]) => Promise; /** * @see https://redis.io/commands/sscan */ sscan: (...args: CommandArgs) => Promise<[string, (string | number)[]]>; /** * @see https://redis.io/commands/strlen */ strlen: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/subscribe */ subscribe: (channels: string | string[]) => Subscriber; /** * @see https://redis.io/commands/sunion */ sunion: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/sunionstore */ sunionstore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/time */ time: () => Promise<[number, number]>; /** * @see https://redis.io/commands/touch */ touch: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/ttl */ ttl: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/type */ type: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/unlink */ unlink: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xadd */ xadd: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xack */ xack: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xackdel */ xackdel: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xdel */ xdel: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xdelex */ xdelex: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xgroup */ xgroup: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xread */ xread: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xreadgroup */ xreadgroup: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xinfo */ xinfo: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xlen */ xlen: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xpending */ xpending: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xclaim */ xclaim: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xautoclaim */ xautoclaim: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xtrim */ xtrim: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/xrange */ xrange: >(...args: CommandArgs) => Promise>; /** * @see https://redis.io/commands/xrevrange */ xrevrange: >(...args: CommandArgs) => Promise>; /** * @see https://redis.io/commands/zadd */ zadd: (...args: [key: string, scoreMember: ScoreMember, ...scoreMemberPairs: ScoreMember[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember, ...ScoreMember[]]]) => Promise; /** * @see https://redis.io/commands/zcard */ zcard: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zcount */ zcount: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zdiffstore */ zdiffstore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zincrby */ zincrby: (key: string, increment: number, member: TData) => Promise; /** * @see https://redis.io/commands/zinterstore */ zinterstore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zlexcount */ zlexcount: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zmscore */ zmscore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zpopmax */ zpopmax: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zpopmin */ zpopmin: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zrange */ zrange: (...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: { byLex: true; } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: { byScore: true; } & ZRangeCommandOptions]) => Promise; /** * @see https://redis.io/commands/zrank */ zrank: (key: string, member: TData) => Promise; /** * @see https://redis.io/commands/zrem */ zrem: (key: string, ...members: TData[]) => Promise; /** * @see https://redis.io/commands/zremrangebylex */ zremrangebylex: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zremrangebyrank */ zremrangebyrank: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zremrangebyscore */ zremrangebyscore: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zrevrank */ zrevrank: (key: string, member: TData) => Promise; /** * @see https://redis.io/commands/zscan */ zscan: (...args: CommandArgs) => Promise<[string, (string | number)[]]>; /** * @see https://redis.io/commands/zscore */ zscore: (key: string, member: TData) => Promise; /** * @see https://redis.io/commands/zunion */ zunion: (...args: CommandArgs) => Promise; /** * @see https://redis.io/commands/zunionstore */ zunionstore: (...args: CommandArgs) => Promise; } type UpstashErrorOptions = Pick[1]>, "cause">; /** * Result of a bad request to upstash */ declare class UpstashError extends Error { constructor(message: string, options?: ErrorOptions); } declare class UrlError extends Error { constructor(url: string); } declare class UpstashJSONParseError extends UpstashError { constructor(body: string, options?: UpstashErrorOptions); } type error_UpstashError = UpstashError; declare const error_UpstashError: typeof UpstashError; type error_UpstashJSONParseError = UpstashJSONParseError; declare const error_UpstashJSONParseError: typeof UpstashJSONParseError; type error_UrlError = UrlError; declare const error_UrlError: typeof UrlError; declare namespace error { export { error_UpstashError as UpstashError, error_UpstashJSONParseError as UpstashJSONParseError, error_UrlError as UrlError }; } export { HMGetCommand as $, AppendCommand as A, BitCountCommand as B, type ClientSetInfoAttribute as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, type HttpClientConfig as H, GetCommand as I, GetDelCommand as J, GetExCommand as K, GetRangeCommand as L, GetSetCommand as M, HDelCommand as N, HExistsCommand as O, HExpireAtCommand as P, HExpireCommand as Q, Redis as R, HExpireTimeCommand as S, HGetAllCommand as T, HGetCommand as U, HGetDelCommand as V, HGetExCommand as W, HIncrByCommand as X, HIncrByFloatCommand as Y, HKeysCommand as Z, HLenCommand as _, type RedisOptions as a, RPushCommand as a$, HMSetCommand as a0, HPExpireAtCommand as a1, HPExpireCommand as a2, HPExpireTimeCommand as a3, HPTtlCommand as a4, HPersistCommand as a5, HRandFieldCommand as a6, HScanCommand as a7, HSetCommand as a8, HSetExCommand as a9, JsonStrLenCommand as aA, JsonToggleCommand as aB, JsonTypeCommand as aC, KeysCommand as aD, LIndexCommand as aE, LInsertCommand as aF, LLenCommand as aG, LMoveCommand as aH, LPopCommand as aI, LPushCommand as aJ, LPushXCommand as aK, LRangeCommand as aL, LRemCommand as aM, LSetCommand as aN, LTrimCommand as aO, MGetCommand as aP, MSetCommand as aQ, MSetNXCommand as aR, PExpireAtCommand as aS, PExpireCommand as aT, PSetEXCommand as aU, PTtlCommand as aV, PersistCommand as aW, PingCommand as aX, Pipeline as aY, PublishCommand as aZ, RPopCommand as a_, HSetNXCommand as aa, HStrLenCommand as ab, HTtlCommand as ac, HValsCommand as ad, IncrByCommand as ae, IncrByFloatCommand as af, IncrCommand as ag, JsonArrAppendCommand as ah, JsonArrIndexCommand as ai, JsonArrInsertCommand as aj, JsonArrLenCommand as ak, JsonArrPopCommand as al, JsonArrTrimCommand as am, JsonClearCommand as an, JsonDelCommand as ao, JsonForgetCommand as ap, JsonGetCommand as aq, JsonMGetCommand as ar, JsonMergeCommand as as, JsonNumIncrByCommand as at, JsonNumMultByCommand as au, JsonObjKeysCommand as av, JsonObjLenCommand as aw, JsonRespCommand as ax, JsonSetCommand as ay, JsonStrAppendCommand as az, type RequesterConfig as b, ZRemRangeByLexCommand as b$, RPushXCommand as b0, RandomKeyCommand as b1, RenameCommand as b2, RenameNXCommand as b3, type Requester as b4, SAddCommand as b5, SCardCommand as b6, SDiffCommand as b7, SDiffStoreCommand as b8, SInterCardCommand as b9, TouchCommand as bA, TtlCommand as bB, type Type as bC, TypeCommand as bD, UnlinkCommand as bE, type UpstashRequest as bF, type UpstashResponse as bG, XAckDelCommand as bH, XAddCommand as bI, XDelExCommand as bJ, XRangeCommand as bK, ZAddCommand as bL, type ZAddCommandOptions as bM, ZCardCommand as bN, ZCountCommand as bO, ZDiffStoreCommand as bP, ZIncrByCommand as bQ, ZInterStoreCommand as bR, type ZInterStoreCommandOptions as bS, ZLexCountCommand as bT, ZMScoreCommand as bU, ZPopMaxCommand as bV, ZPopMinCommand as bW, ZRangeCommand as bX, type ZRangeCommandOptions as bY, ZRankCommand as bZ, ZRemCommand as b_, SInterCommand as ba, SInterStoreCommand as bb, SIsMemberCommand as bc, SMIsMemberCommand as bd, SMembersCommand as be, SMoveCommand as bf, SPopCommand as bg, SRandMemberCommand as bh, SRemCommand as bi, SScanCommand as bj, SUnionCommand as bk, SUnionStoreCommand as bl, ScanCommand as bm, type ScanCommandOptions as bn, type ScoreMember as bo, ScriptExistsCommand as bp, ScriptFlushCommand as bq, ScriptLoadCommand as br, SetBitCommand as bs, SetCommand as bt, type SetCommandOptions as bu, SetExCommand as bv, SetNxCommand as bw, SetRangeCommand as bx, StrLenCommand as by, TimeCommand as bz, BitOpCommand as c, ZRemRangeByRankCommand as c0, ZRemRangeByScoreCommand as c1, ZRevRankCommand as c2, ZScanCommand as c3, ZScoreCommand as c4, ZUnionCommand as c5, type ZUnionCommandOptions as c6, ZUnionStoreCommand as c7, type ZUnionStoreCommandOptions as c8, error as c9, type NumericField as ca, type NestedIndexSchema as cb, type CreateIndexParameters as cc, type FlatIndexSchema as cd, type InferFilterFromSchema as ce, type PublicQueryResult as cf, SearchIndex as cg, type SearchIndexParameters as ch, BitPosCommand as d, ClientSetInfoCommand as e, CopyCommand as f, DecrByCommand as g, DecrCommand as h, DelCommand as i, EvalCommand as j, EvalROCommand as k, EvalshaCommand as l, EvalshaROCommand as m, ExistsCommand as n, ExpireAtCommand as o, ExpireCommand as p, type ExpireOption as q, FlushDBCommand as r, type GeoAddCommandOptions as s, GeoDistCommand as t, GeoHashCommand as u, type GeoMember as v, GeoPosCommand as w, GeoSearchCommand as x, GeoSearchStoreCommand as y, GetBitCommand as z };