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); } type ArInfoOptions = { /** * Also report per-slice statistics. This walks the whole array. */ full?: boolean; }; type ArInfoResult = { /** Highest occupied index plus one, as reported by `arlen`. A string, like every index. */ len: string; /** Number of occupied slots, as reported by `arcount`. */ count: number; /** Number of indexes covered by one slice. */ sliceSize: number; /** Number of slices currently allocated. */ slices: number; /** Number of entries in the slice directory. */ directorySize: number; /** Number of entries in the top-level directory. */ superDirEntries: number; /** Index the next `arinsert` would write to. A string, like every index. */ nextInsertIndex: string; /** Slices stored in dense form. Only with `full`. */ denseSlices?: number; /** Slices stored in sparse form. Only with `full`. */ sparseSlices?: number; /** Average number of values in a dense slice. Only with `full`. */ avgDenseSize?: number; /** Average fill ratio of a dense slice. Only with `full`. */ avgDenseFill?: number; /** Average number of values in a sparse slice. Only with `full`. */ avgSparseSize?: number; }; type RawArInfo = unknown[] | Record; /** * Describes how an array is laid out in memory. Throws if the key does not exist. * * @see https://upstash.com/docs/redis/commands/array/arinfo */ declare class ArInfoCommand extends Command { constructor([key, opts]: [key: string, opts?: ArInfoOptions], cmdOpts?: CommandOptions); } /** * A single `ARGREP` predicate: * - `exact`: the whole value equals the pattern * - `match`: the value contains the pattern as a substring * - `glob`: the value matches a glob pattern (`*` and `?`) * - `re`: the value matches a regular expression */ type ArGrepPredicate = { exact: string; } | { match: string; } | { glob: string; } | { re: string; }; type ArGrepOptions = { /** * One or more predicates (at most 250). */ predicates: ArGrepPredicate[]; /** * How to combine several predicates. `OR` (the default) matches a slot when any predicate * matches, `AND` requires all of them. */ combine?: "AND" | "OR" | "and" | "or"; /** * Compare case-insensitively. */ noCase?: boolean; /** * Return `[index, value]` pairs instead of bare indexes. */ withValues?: boolean; /** * Maximum number of matches to return. */ limit?: number; }; /** * Matching indexes, or `[index, value]` pairs when `withValues` is `true`. Indexes are returned as * strings; see `arlen`. */ type ArGrepResult = TOpts extends { withValues: true; } ? [string, TData][] : TOpts extends { withValues: false; } ? string[] : "withValues" extends keyof TOpts ? string[] | [string, TData][] : string[]; /** * Returns the indexes in `[start, end]` whose value matches the given predicates, or * `[index, value]` pairs with `withValues`. `start` and `end` accept `"-"` and `"+"` for the lowest * and highest possible index. * * @see https://upstash.com/docs/redis/commands/array/argrep */ declare class ArGrepCommand extends Command> { constructor([key, start, end, opts]: [ key: string, start: number | string, end: number | string, opts: TOpts ], cmdOpts?: CommandOptions>); } /** * Distance metric used by a vector index. */ type VectorMetric = "COSINE" | "EUCLIDEAN" | "DOT"; /** * Speed / recall trade-off for `VECTOR.QUERY`. * * @default "BALANCED" */ type VectorQueryProfile = "FAST" | "BALANCED" | "PRECISE"; /** * A vector to add or query with. Accepts: * - `number[]`: sent as `VALUES ... ` * - `Float32Array`: encoded as little-endian FP32 and sent as `BASE64-FP32 ` * - `{ base64: string }`: a base64-encoded little-endian FP32 blob, sent as-is with `BASE64-FP32` * (e.g. the `encoding_format: "base64"` output of embedding providers) */ type VectorInput = number[] | Float32Array | { base64: string; }; type VectorCreateOptions = { /** * Number of dimensions of the vectors stored in the index. Must be between 1 and 32768. */ dimension: number; /** * Distance metric used to compare vectors. */ metric: VectorMetric; /** * When `true`, creating an index that already exists with the same dimension and metric * succeeds (returns `0`) instead of throwing. */ existsOk?: boolean; }; type VectorQueryOptions = { /** * The query vector. */ vector: VectorInput; /** * Number of nearest neighbours to return. Must be between 1 and 1000. */ topK: number; /** * Speed / recall trade-off. * * @default "BALANCED" */ profile?: VectorQueryProfile; }; type VectorQueryResult = { id: string; score: number; }; type VectorIndexInfo = { dimension: number; metric: VectorMetric; }; type CreateVectorIndexParameters = VectorCreateOptions & { /** * Name (key) of the index. */ name: string; }; type VectorIndexParameters = { name: string; client: Requester; commandOptions?: CommandOptions; }; /** * A handle to a vector index. Obtain one with `redis.vector.createIndex(...)` or * `redis.vector.index(name)`. * * @example * ```typescript * const index = await redis.vector.createIndex({ name: "docs", dimension: 3, metric: "COSINE" }); * await index.add("doc-1", [0.1, 0.2, 0.3]); * const hits = await index.query({ vector: [0.1, 0.2, 0.3], topK: 5 }); * ``` */ declare class VectorIndex { readonly name: string; private client; private commandOptions?; constructor({ name, client, commandOptions }: VectorIndexParameters); /** * Adds a vector to the index, or overwrites the vector stored under `id`. * * @returns `1` if a new vector was inserted, `0` if an existing one was overwritten. */ add(id: string, vector: VectorInput): Promise<0 | 1>; /** * Returns the vector stored under `id`, or `null` if it does not exist. */ get(id: string): Promise; /** * Returns the `topK` nearest neighbours of the query vector. */ query(options: VectorQueryOptions): Promise; /** * Deletes the vector stored under `id`. * * @returns `1` if the vector existed and was removed, `0` otherwise. */ delete(id: string): Promise<0 | 1>; /** * Returns the number of vectors in the index. */ count(): Promise; /** * Returns the dimension and metric of the index, or `null` if it does not exist. */ info(): Promise; /** * Drops the index and all vectors in it. * * @returns `1` if the index existed and was dropped, `0` otherwise. */ drop(): Promise<0 | 1>; } 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" | "stream"; /** * Key prefixes tracked by the index. For a stream index, this holds the single stream key. */ 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; language?: Language; skipInitialScan?: boolean; existsOk?: boolean; } & ({ dataType: "string"; prefix: string | string[]; schema: TSchema extends NestedIndexSchema ? TSchema : never; } | { dataType: "json"; prefix: string | string[]; schema: TSchema extends NestedIndexSchema ? TSchema : never; } | { dataType: "hash"; prefix: string | string[]; schema: TSchema extends FlatIndexSchema ? TSchema : never; } | { /** * Index the entries of a single Redis stream. Each entry becomes a document whose key is * the entry ID and whose fields are the entry's fields. * * @see https://upstash.com/docs/redis/search/streams */ dataType: "stream"; /** * Exact key of the stream to index. The stream does not need to exist yet. */ stream: string; prefix?: never; 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); } /** * Returns the number of occupied slots in an array. A missing key counts as `0`. * * @see https://upstash.com/docs/redis/commands/array/arcount */ declare class ArCountCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * Empties one or more array slots. Later values are not shifted. * * Returns the number of slots that held a value. * * @see https://upstash.com/docs/redis/commands/array/ardel */ declare class ArDelCommand extends Command { constructor(cmd: [key: string, ...indexes: (number | string)[]], opts?: CommandOptions); } /** * Empties every occupied slot inside one or more inclusive `[start, end]` ranges. * * Returns the total number of values removed across all ranges. * * @see https://upstash.com/docs/redis/commands/array/ardelrange */ declare class ArDelRangeCommand extends Command { constructor([key, ...ranges]: [key: string, ...ranges: [start: number | string, end: number | string][]], opts?: CommandOptions); } /** * Returns the value stored at `index`, or `null` if the slot is empty or the key does not exist. * * @see https://upstash.com/docs/redis/commands/array/arget */ declare class ArGetCommand extends Command { constructor(cmd: [key: string, index: number | string], opts?: CommandOptions); } /** * Returns every slot in the inclusive range `[start, end]`, with `null` for empty slots. * * When `start` is greater than `end`, the values are returned from the higher index down. * Ranges wider than 1,000,000 indexes are rejected by the server. * * @see https://upstash.com/docs/redis/commands/array/argetrange */ declare class ArGetRangeCommand extends Command { constructor(cmd: [key: string, start: number | string, end: number | string], opts?: CommandOptions); } /** * Appends one or more values after the array's append cursor. * * Returns the index the last value was written to (not the number of values written). * * Indexes are returned as strings; see `arlen`. * * @see https://upstash.com/docs/redis/commands/array/arinsert */ declare class ArInsertCommand extends Command { constructor(cmd: [key: string, ...values: TData[]], opts?: CommandOptions); } type ArLastItemsOptions = { /** * Return the newest value first instead of last. */ rev?: boolean; }; /** * Returns up to `count` of the most recently appended values, walking backwards from the append * cursor. Values come back oldest-first unless `rev` is set. * * @see https://upstash.com/docs/redis/commands/array/arlastitems */ declare class ArLastItemsCommand extends Command { constructor([key, count, opts]: [key: string, count: number, opts?: ArLastItemsOptions], cmdOpts?: CommandOptions); } /** * Returns the length of an array: the highest occupied index plus one. A missing key has length `0`. * * Because arrays are sparse this can be larger than the number of stored values, see `arcount`. * * Indexes are returned as strings: they run up to 2^64-2, past what a JavaScript number can hold * exactly. This matches how the SDK keeps the `scan` cursor a string, and the value can be passed * straight back into any command that takes an index. * * @see https://upstash.com/docs/redis/commands/array/arlen */ declare class ArLenCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } /** * Returns the values at several indexes, in the order the indexes were given, with `null` for * empty slots. * * @see https://upstash.com/docs/redis/commands/array/armget */ declare class ArMGetCommand extends Command { constructor(cmd: [key: string, ...indexes: (number | string)[]], opts?: CommandOptions); } /** * Index-value pairs for `ARMSET`, either as an object (`{ 0: "a", 10: "b" }`) or as a list of * `[index, value]` tuples. */ type ArMSetValues = Record | [number | string, TData][]; /** * Writes several index-value pairs into an array in one atomic call. * * Returns the number of slots that were newly occupied. Overwriting an existing value contributes `0`. * * @see https://upstash.com/docs/redis/commands/array/armset */ declare class ArMSetCommand extends Command { constructor([key, values]: [key: string, values: ArMSetValues], opts?: CommandOptions); } /** * Returns the index the next `arinsert` would write to, without moving the cursor. * * Returns `"0"` for a missing key or one that was never appended to, and `null` when the cursor is * already at the highest supported index. Indexes are returned as strings; see `arlen`. * * @see https://upstash.com/docs/redis/commands/array/arnext */ declare class ArNextCommand extends Command { constructor(cmd: [key: string], opts?: CommandOptions); } type ArOpKeyword = "SUM" | "MIN" | "MAX" | "AND" | "OR" | "XOR" | "USED"; /** * Reduction applied by `AROP`: * - `SUM`, `MIN`, `MAX`: numeric aggregates * - `AND`, `OR`, `XOR`: bitwise folds over the values as 64-bit integers * - `USED`: number of occupied slots * - `{ match: value }`: number of slots whose value equals `value` */ type ArOpOperation = ArOpKeyword | Lowercase | { match: TData; }; /** * Reduces the values in the inclusive range `[start, end]` to a single number on the server. * * `SUM`, `MIN`, `MAX`, `AND`, `OR` and `XOR` skip non-numeric values and return `null` when the * range contains nothing they could use. `USED` and `match` always return a number. * * Results are returned as JavaScript numbers, so bitwise results beyond `Number.MAX_SAFE_INTEGER` * lose precision. * * @see https://upstash.com/docs/redis/commands/array/arop */ declare class ArOpCommand extends Command { constructor([key, start, end, operation]: [ key: string, start: number | string, end: number | string, operation: ArOpOperation ], opts?: CommandOptions); } /** * Appends values to a fixed-size ring of `size` slots, wrapping back to index `0` and overwriting * the oldest values once the ring is full. Calling it with a different `size` reshapes the ring. * * Returns the index the last value was written to, as a string; see `arlen`. * * @see https://upstash.com/docs/redis/commands/array/arring */ declare class ArRingCommand extends Command { constructor(cmd: [key: string, size: number, ...values: TData[]], opts?: CommandOptions); } type ArScanOptions = { /** * Maximum number of slots to return. */ limit?: number; }; /** * Returns the occupied slots in the inclusive range `[start, end]` as `[index, value]` pairs, in * ascending index order. Empty slots are skipped. * * Indexes are returned as strings; see `arlen`. * * @see https://upstash.com/docs/redis/commands/array/arscan */ declare class ArScanCommand extends Command { constructor([key, start, end, opts]: [ key: string, start: number | string, end: number | string, opts?: ArScanOptions ], cmdOpts?: CommandOptions); } /** * Moves the append cursor so that the next `arinsert` writes to `index`. Stored values are not * touched. * * Returns `1` if the cursor was moved, `0` if the key does not exist. * * @see https://upstash.com/docs/redis/commands/array/arseek */ declare class ArSeekCommand extends Command<0 | 1, 0 | 1> { constructor(cmd: [key: string, index: number | string], opts?: CommandOptions<0 | 1, 0 | 1>); } /** * Writes one or more values into an array, starting at `index`: the first value goes to `index`, * the next to `index + 1`, and so on. * * Returns the number of slots that were newly occupied. Overwriting an existing value contributes `0`. * * @see https://upstash.com/docs/redis/commands/array/arset */ declare class ArSetCommand extends Command { constructor(cmd: [key: string, index: number | string, ...values: TData[]], 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); } /** * Adds a vector to an index, or overwrites the vector stored under `id`. * * Returns `1` if a new vector was inserted, `0` if an existing one was overwritten. */ declare class VectorAddCommand extends Command<0 | 1, 0 | 1> { constructor([index, id, vector]: [index: string, id: string, vector: VectorInput], cmdOpts?: CommandOptions<0 | 1, 0 | 1>); } /** * Returns the number of vectors in the index. A missing index counts as `0`. */ declare class VectorCountCommand extends Command { constructor([index]: [index: string], cmdOpts?: CommandOptions); } /** * Creates a vector index. * * Returns `1` if the index was created, `0` if it already existed (only possible with `existsOk`). */ declare class VectorCreateCommand extends Command<0 | 1, 0 | 1> { constructor([index, opts]: [index: string, opts: VectorCreateOptions], cmdOpts?: CommandOptions<0 | 1, 0 | 1>); } /** * Deletes the vector stored under `id`. * * Returns `1` if the vector existed and was removed, `0` otherwise. */ declare class VectorDelCommand extends Command<0 | 1, 0 | 1> { constructor([index, id]: [index: string, id: string], cmdOpts?: CommandOptions<0 | 1, 0 | 1>); } /** * Drops the index and all vectors in it. * * Returns `1` if the index existed and was dropped, `0` otherwise. */ declare class VectorDropCommand extends Command<0 | 1, 0 | 1> { constructor([index]: [index: string], cmdOpts?: CommandOptions<0 | 1, 0 | 1>); } /** * Returns the vector stored under `id`, or `null` if it does not exist. */ declare class VectorGetCommand extends Command<(string | number)[] | null, number[] | null> { constructor([index, id]: [index: string, id: string], cmdOpts?: CommandOptions<(string | number)[] | null, number[] | null>); } /** * Returns the dimension and metric of the index, or `null` if it does not exist. */ declare class VectorInfoCommand extends Command<(string | number)[] | Record | null, VectorIndexInfo | null> { constructor([index]: [index: string], cmdOpts?: CommandOptions<(string | number)[] | Record | null, VectorIndexInfo | null>); } /** * Returns the `topK` nearest neighbours of the query vector as `{ id, score }` pairs. */ declare class VectorQueryCommand extends Command<[string, string | number][], VectorQueryResult[]> { constructor([index, opts]: [index: string, opts: VectorQueryOptions], cmdOpts?: CommandOptions<[string, string | number][], VectorQueryResult[]>); } /** * @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://upstash.com/docs/redis/commands/array/arcount */ arcount: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/ardel */ ardel: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/ardelrange */ ardelrange: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arget */ arget: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/argetrange */ argetrange: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/argrep */ argrep: (key: string, start: number | string, end: number | string, opts: TOpts) => Pipeline<[...TCommands, Command>]>; /** * @see https://upstash.com/docs/redis/commands/array/arinfo */ arinfo: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arinsert */ arinsert: (key: string, ...values: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arlastitems */ arlastitems: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arlen */ arlen: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/armget */ armget: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/armset */ armset: (key: string, values: ArMSetValues) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arnext */ arnext: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arop */ arop: (key: string, start: number | string, end: number | string, operation: ArOpOperation) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arring */ arring: (key: string, size: number, ...values: TData[]) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arscan */ arscan: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arseek */ arseek: (...args: CommandArgs) => Pipeline<[...TCommands, Command]>; /** * @see https://upstash.com/docs/redis/commands/array/arset */ arset: (key: string, index: number | string, ...values: TData[]) => 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>; }; }; /** * Vector index commands. * * @example * ```typescript * const index = await redis.vector.createIndex({ name: "docs", dimension: 3, metric: "COSINE" }); * await index.add("doc-1", [0.1, 0.2, 0.3]); * const hits = await index.query({ vector: [0.1, 0.2, 0.3], topK: 5 }); * ``` */ get vector(): { /** * Creates a vector index and returns a handle to it. */ createIndex: (params: CreateVectorIndexParameters) => Promise; /** * Returns a handle to an existing vector index without sending any command. */ index: (name: string) => VectorIndex; }; /** * 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://upstash.com/docs/redis/commands/array/arcount */ arcount: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/ardel */ ardel: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/ardelrange */ ardelrange: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arget */ arget: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/argetrange */ argetrange: (...args: CommandArgs) => Promise<(TData | null)[]>; /** * @see https://upstash.com/docs/redis/commands/array/argrep */ argrep: (key: string, start: number | string, end: number | string, opts: TOpts) => Promise>; /** * @see https://upstash.com/docs/redis/commands/array/arinfo */ arinfo: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arinsert */ arinsert: (key: string, ...values: TData[]) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arlastitems */ arlastitems: (...args: CommandArgs) => Promise<(TData | null)[]>; /** * @see https://upstash.com/docs/redis/commands/array/arlen */ arlen: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/armget */ armget: (...args: CommandArgs) => Promise<(TData | null)[]>; /** * @see https://upstash.com/docs/redis/commands/array/armset */ armset: (key: string, values: ArMSetValues) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arnext */ arnext: (...args: CommandArgs) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arop */ arop: (key: string, start: number | string, end: number | string, operation: ArOpOperation) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arring */ arring: (key: string, size: number, ...values: TData[]) => Promise; /** * @see https://upstash.com/docs/redis/commands/array/arscan */ arscan: (...args: CommandArgs) => Promise<[string, TData][]>; /** * @see https://upstash.com/docs/redis/commands/array/arseek */ arseek: (...args: CommandArgs) => Promise<0 | 1>; /** * @see https://upstash.com/docs/redis/commands/array/arset */ arset: (key: string, index: number | string, ...values: TData[]) => 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 { GeoAddCommand as $, AppendCommand as A, type ArScanOptions as B, ArSeekCommand as C, ArSetCommand as D, BitCountCommand as E, BitOpCommand as F, BitPosCommand as G, type HttpClientConfig as H, type ClientSetInfoAttribute as I, ClientSetInfoCommand as J, CopyCommand as K, DBSizeCommand as L, DecrByCommand as M, DecrCommand as N, DelCommand as O, EchoCommand as P, EvalCommand as Q, Redis as R, EvalROCommand as S, EvalshaCommand as T, EvalshaROCommand as U, ExistsCommand as V, ExpireAtCommand as W, ExpireCommand as X, type ExpireOption as Y, FlushAllCommand as Z, FlushDBCommand as _, type RedisOptions as a, JsonStrLenCommand as a$, type GeoAddCommandOptions as a0, GeoDistCommand as a1, GeoHashCommand as a2, type GeoMember as a3, GeoPosCommand as a4, GeoSearchCommand as a5, GeoSearchStoreCommand as a6, GetBitCommand as a7, GetCommand as a8, GetDelCommand as a9, HSetExCommand as aA, HSetNXCommand as aB, HStrLenCommand as aC, HTtlCommand as aD, HValsCommand as aE, IncrByCommand as aF, IncrByFloatCommand as aG, IncrCommand as aH, JsonArrAppendCommand as aI, JsonArrIndexCommand as aJ, JsonArrInsertCommand as aK, JsonArrLenCommand as aL, JsonArrPopCommand as aM, JsonArrTrimCommand as aN, JsonClearCommand as aO, JsonDelCommand as aP, JsonForgetCommand as aQ, JsonGetCommand as aR, JsonMGetCommand as aS, JsonMergeCommand as aT, JsonNumIncrByCommand as aU, JsonNumMultByCommand as aV, JsonObjKeysCommand as aW, JsonObjLenCommand as aX, JsonRespCommand as aY, JsonSetCommand as aZ, JsonStrAppendCommand as a_, GetExCommand as aa, GetRangeCommand as ab, GetSetCommand as ac, HDelCommand as ad, HExistsCommand as ae, HExpireAtCommand as af, HExpireCommand as ag, HExpireTimeCommand as ah, HGetAllCommand as ai, HGetCommand as aj, HGetDelCommand as ak, HGetExCommand as al, HIncrByCommand as am, HIncrByFloatCommand as an, HKeysCommand as ao, HLenCommand as ap, HMGetCommand as aq, HMSetCommand as ar, HPExpireAtCommand as as, HPExpireCommand as at, HPExpireTimeCommand as au, HPTtlCommand as av, HPersistCommand as aw, HRandFieldCommand as ax, HScanCommand as ay, HSetCommand as az, type RequesterConfig as b, TouchCommand as b$, JsonToggleCommand as b0, JsonTypeCommand as b1, KeysCommand as b2, LIndexCommand as b3, LInsertCommand as b4, LLenCommand as b5, LMoveCommand as b6, LPopCommand as b7, LPushCommand as b8, LPushXCommand as b9, SInterCardCommand as bA, SInterCommand as bB, SInterStoreCommand as bC, SIsMemberCommand as bD, SMIsMemberCommand as bE, SMembersCommand as bF, SMoveCommand as bG, SPopCommand as bH, SRandMemberCommand as bI, SRemCommand as bJ, SScanCommand as bK, SUnionCommand as bL, SUnionStoreCommand as bM, ScanCommand as bN, type ScanCommandOptions as bO, type ScoreMember as bP, ScriptExistsCommand as bQ, ScriptFlushCommand as bR, ScriptLoadCommand as bS, SetBitCommand as bT, SetCommand as bU, type SetCommandOptions as bV, SetExCommand as bW, SetNxCommand as bX, SetRangeCommand as bY, StrLenCommand as bZ, TimeCommand as b_, LRangeCommand as ba, LRemCommand as bb, LSetCommand as bc, LTrimCommand as bd, MGetCommand as be, MSetCommand as bf, MSetNXCommand as bg, PExpireAtCommand as bh, PExpireCommand as bi, PSetEXCommand as bj, PTtlCommand as bk, PersistCommand as bl, PingCommand as bm, Pipeline as bn, PublishCommand as bo, RPopCommand as bp, RPushCommand as bq, RPushXCommand as br, RandomKeyCommand as bs, RenameCommand as bt, RenameNXCommand as bu, type Requester as bv, SAddCommand as bw, SCardCommand as bx, SDiffCommand as by, SDiffStoreCommand as bz, ArCountCommand as c, TtlCommand as c0, type Type as c1, TypeCommand as c2, UnlinkCommand as c3, type UpstashRequest as c4, type UpstashResponse as c5, VectorAddCommand as c6, VectorCountCommand as c7, VectorCreateCommand as c8, VectorDelCommand as c9, ZRemRangeByScoreCommand as cA, ZRevRankCommand as cB, ZScanCommand as cC, ZScoreCommand as cD, ZUnionCommand as cE, type ZUnionCommandOptions as cF, ZUnionStoreCommand as cG, type ZUnionStoreCommandOptions as cH, error as cI, type NumericField as cJ, type NestedIndexSchema as cK, type CreateIndexParameters as cL, type CreateVectorIndexParameters as cM, type FlatIndexSchema as cN, type InferFilterFromSchema as cO, type PublicQueryResult as cP, SearchIndex as cQ, type SearchIndexParameters as cR, type VectorCreateOptions as cS, VectorIndex as cT, type VectorIndexInfo as cU, type VectorIndexParameters as cV, type VectorInput as cW, type VectorMetric as cX, type VectorQueryOptions as cY, type VectorQueryProfile as cZ, type VectorQueryResult as c_, VectorDropCommand as ca, VectorGetCommand as cb, VectorInfoCommand as cc, VectorQueryCommand as cd, XAckDelCommand as ce, XAddCommand as cf, XDelExCommand as cg, XRangeCommand as ch, ZAddCommand as ci, type ZAddCommandOptions as cj, ZCardCommand as ck, ZCountCommand as cl, ZDiffStoreCommand as cm, ZIncrByCommand as cn, ZInterStoreCommand as co, type ZInterStoreCommandOptions as cp, ZLexCountCommand as cq, ZMScoreCommand as cr, ZPopMaxCommand as cs, ZPopMinCommand as ct, ZRangeCommand as cu, type ZRangeCommandOptions as cv, ZRankCommand as cw, ZRemCommand as cx, ZRemRangeByLexCommand as cy, ZRemRangeByRankCommand as cz, ArDelCommand as d, ArDelRangeCommand as e, ArGetCommand as f, ArGetRangeCommand as g, ArGrepCommand as h, type ArGrepOptions as i, type ArGrepPredicate as j, type ArGrepResult as k, ArInfoCommand as l, type ArInfoOptions as m, type ArInfoResult as n, ArInsertCommand as o, ArLastItemsCommand as p, type ArLastItemsOptions as q, ArLenCommand as r, ArMGetCommand as s, ArMSetCommand as t, type ArMSetValues as u, ArNextCommand as v, ArOpCommand as w, type ArOpOperation as x, ArRingCommand as y, ArScanCommand as z };