@upstash/redis 0.0.0-ci.9bd1ff41998c5dc9570b51feb81235cbc9682015-20240215122050 → 0.0.0-ci.9c093ea2a3b2688d34fb8d3b201f52dfeb4e9d0a-20251013124022

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,10 @@ type RedisOptions = {
23
23
  * @default true
24
24
  */
25
25
  automaticDeserialization?: boolean;
26
+ latencyLogging?: boolean;
26
27
  enableTelemetry?: boolean;
28
+ enableAutoPipelining?: boolean;
29
+ readYourWrites?: boolean;
27
30
  };
28
31
 
29
32
  type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
@@ -33,12 +36,37 @@ type UpstashRequest = {
33
36
  * Request body will be serialized to json
34
37
  */
35
38
  body?: unknown;
39
+ /**
40
+ * Additional headers for the request
41
+ */
42
+ headers?: Record<string, string>;
43
+ upstashSyncToken?: string;
44
+ /**
45
+ * Callback for handling streaming messages
46
+ */
47
+ onMessage?: (data: string) => void;
48
+ /**
49
+ * Whether this request expects a streaming response
50
+ */
51
+ isStreaming?: boolean;
52
+ /**
53
+ * Abort signal for the request
54
+ */
55
+ signal?: AbortSignal;
36
56
  };
37
57
  type UpstashResponse<TResult> = {
38
58
  result?: TResult;
39
59
  error?: string;
40
60
  };
41
61
  interface Requester {
62
+ /**
63
+ * 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.
64
+ */
65
+ readYourWrites?: boolean;
66
+ /**
67
+ * 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.
68
+ */
69
+ upstashSyncToken?: string;
42
70
  request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
43
71
  }
44
72
  type RetryConfig = false | {
@@ -49,7 +77,7 @@ type RetryConfig = false | {
49
77
  */
50
78
  retries?: number;
51
79
  /**
52
- * A backoff function receives the current retry cound and returns a number in milliseconds to wait before retrying.
80
+ * A backoff function receives the current retry count and returns a number in milliseconds to wait before retrying.
53
81
  *
54
82
  * @default
55
83
  * ```ts
@@ -58,6 +86,9 @@ type RetryConfig = false | {
58
86
  */
59
87
  backoff?: (retryCount: number) => number;
60
88
  };
89
+ type Options$1 = {
90
+ backend?: string;
91
+ };
61
92
  type RequesterConfig = {
62
93
  /**
63
94
  * Configure the retry behaviour in case of network errors
@@ -92,6 +123,19 @@ type RequesterConfig = {
92
123
  */
93
124
  cache?: CacheSetting;
94
125
  };
126
+ type HttpClientConfig = {
127
+ headers?: Record<string, string>;
128
+ baseUrl: string;
129
+ options?: Options$1;
130
+ retry?: RetryConfig;
131
+ agent?: any;
132
+ signal?: AbortSignal | (() => AbortSignal);
133
+ keepAlive?: boolean;
134
+ /**
135
+ * 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.
136
+ */
137
+ readYourWrites?: boolean;
138
+ } & RequesterConfig;
95
139
 
96
140
  type Serialize = (data: unknown) => string | number | boolean;
97
141
  type Deserialize<TResult, TData> = (result: TResult) => TData;
@@ -106,6 +150,32 @@ type CommandOptions<TResult, TData> = {
106
150
  * @default true
107
151
  */
108
152
  automaticDeserialization?: boolean;
153
+ latencyLogging?: boolean;
154
+ /**
155
+ * Additional headers to be sent with the request
156
+ */
157
+ headers?: Record<string, string>;
158
+ /**
159
+ * Path to append to the URL
160
+ */
161
+ path?: string[];
162
+ /**
163
+ * Options for streaming requests, mainly used for subscribe, monitor commands
164
+ **/
165
+ streamOptions?: {
166
+ /**
167
+ * Callback to be called when a message is received
168
+ */
169
+ onMessage?: (data: string) => void;
170
+ /**
171
+ * Whether the request is streaming
172
+ */
173
+ isStreaming?: boolean;
174
+ /**
175
+ * Signal to abort the request
176
+ */
177
+ signal?: AbortSignal;
178
+ };
109
179
  };
110
180
  /**
111
181
  * Command offers default (de)serialization and the exec method to all commands.
@@ -117,6 +187,11 @@ declare class Command<TResult, TData> {
117
187
  readonly command: (string | number | boolean)[];
118
188
  readonly serialize: Serialize;
119
189
  readonly deserialize: Deserialize<TResult, TData>;
190
+ protected readonly headers?: Record<string, string>;
191
+ protected readonly path?: string[];
192
+ protected readonly onMessage?: (data: string) => void;
193
+ protected readonly isStreaming: boolean;
194
+ protected readonly signal?: AbortSignal;
120
195
  /**
121
196
  * Create a new command instance.
122
197
  *
@@ -212,18 +287,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
212
287
  constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
213
288
  }
214
289
 
215
- type ScanCommandOptions = {
216
- match?: string;
217
- count?: number;
218
- type?: string;
219
- };
220
- /**
221
- * @see https://redis.io/commands/scan
222
- */
223
- declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
224
- constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, string[]], [number, string[]]>);
225
- }
226
-
227
290
  type GeoAddCommandOptions = {
228
291
  nx?: boolean;
229
292
  xx?: never;
@@ -233,11 +296,11 @@ type GeoAddCommandOptions = {
233
296
  } & {
234
297
  ch?: boolean;
235
298
  });
236
- interface GeoMember<TMemberType> {
299
+ type GeoMember<TMemberType> = {
237
300
  latitude: number;
238
301
  longitude: number;
239
302
  member: TMemberType;
240
- }
303
+ };
241
304
  /**
242
305
  * @see https://redis.io/commands/geoadd
243
306
  */
@@ -249,6 +312,11 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
249
312
  ], opts?: CommandOptions<number | null, number | null>);
250
313
  }
251
314
 
315
+ type ExpireOption = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
316
+ declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
317
+ constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
318
+ }
319
+
252
320
  /**
253
321
  * @see https://redis.io/commands/append
254
322
  */
@@ -264,6 +332,28 @@ declare class BitCountCommand extends Command<number, number> {
264
332
  constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
265
333
  }
266
334
 
335
+ type SubCommandArgs<TRest extends unknown[] = []> = [
336
+ encoding: string,
337
+ offset: number | string,
338
+ ...rest: TRest
339
+ ];
340
+ /**
341
+ * @see https://redis.io/commands/bitfield
342
+ */
343
+ declare class BitFieldCommand<T = Promise<number[]>> {
344
+ private client;
345
+ private opts?;
346
+ private execOperation;
347
+ private command;
348
+ constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
349
+ private chain;
350
+ get(...args: SubCommandArgs): this;
351
+ set(...args: SubCommandArgs<[value: number]>): this;
352
+ incrby(...args: SubCommandArgs<[increment: number]>): this;
353
+ overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
354
+ exec(): T;
355
+ }
356
+
267
357
  /**
268
358
  * @see https://redis.io/commands/bitop
269
359
  */
@@ -323,6 +413,13 @@ declare class EchoCommand extends Command<string, string> {
323
413
  constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
324
414
  }
325
415
 
416
+ /**
417
+ * @see https://redis.io/commands/eval_ro
418
+ */
419
+ declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
420
+ constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
421
+ }
422
+
326
423
  /**
327
424
  * @see https://redis.io/commands/eval
328
425
  */
@@ -330,6 +427,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
330
427
  constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
331
428
  }
332
429
 
430
+ /**
431
+ * @see https://redis.io/commands/evalsha_ro
432
+ */
433
+ declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
434
+ constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
435
+ }
436
+
333
437
  /**
334
438
  * @see https://redis.io/commands/evalsha
335
439
  */
@@ -344,16 +448,11 @@ declare class ExistsCommand extends Command<number, number> {
344
448
  constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
345
449
  }
346
450
 
347
- type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
348
- declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
349
- constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
350
- }
351
-
352
451
  /**
353
452
  * @see https://redis.io/commands/expireat
354
453
  */
355
454
  declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
356
- constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
455
+ constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
357
456
  }
358
457
 
359
458
  /**
@@ -390,7 +489,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
390
489
  * @see https://redis.io/commands/geohash
391
490
  */
392
491
  declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
393
- constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
492
+ constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
394
493
  }
395
494
 
396
495
  type Coordinates = {
@@ -528,6 +627,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
528
627
  constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
529
628
  }
530
629
 
630
+ type GetExCommandOptions = {
631
+ ex: number;
632
+ px?: never;
633
+ exat?: never;
634
+ pxat?: never;
635
+ persist?: never;
636
+ } | {
637
+ ex?: never;
638
+ px: number;
639
+ exat?: never;
640
+ pxat?: never;
641
+ persist?: never;
642
+ } | {
643
+ ex?: never;
644
+ px?: never;
645
+ exat: number;
646
+ pxat?: never;
647
+ persist?: never;
648
+ } | {
649
+ ex?: never;
650
+ px?: never;
651
+ exat?: never;
652
+ pxat: number;
653
+ persist?: never;
654
+ } | {
655
+ ex?: never;
656
+ px?: never;
657
+ exat?: never;
658
+ pxat?: never;
659
+ persist: true;
660
+ } | {
661
+ ex?: never;
662
+ px?: never;
663
+ exat?: never;
664
+ pxat?: never;
665
+ persist?: never;
666
+ };
667
+ /**
668
+ * @see https://redis.io/commands/getex
669
+ */
670
+ declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
671
+ constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
672
+ }
673
+
531
674
  /**
532
675
  * @see https://redis.io/commands/getrange
533
676
  */
@@ -556,6 +699,58 @@ declare class HExistsCommand extends Command<number, number> {
556
699
  constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
557
700
  }
558
701
 
702
+ declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
703
+ constructor(cmd: [
704
+ key: string,
705
+ fields: (string | number) | (string | number)[],
706
+ seconds: number,
707
+ option?: ExpireOption
708
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
709
+ }
710
+
711
+ declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
712
+ constructor(cmd: [
713
+ key: string,
714
+ fields: (string | number) | (string | number)[],
715
+ timestamp: number,
716
+ option?: ExpireOption
717
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
718
+ }
719
+
720
+ declare class HExpireTimeCommand extends Command<number[], number[]> {
721
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
722
+ }
723
+
724
+ declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
725
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
726
+ }
727
+
728
+ declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
729
+ constructor(cmd: [
730
+ key: string,
731
+ fields: (string | number) | (string | number)[],
732
+ milliseconds: number,
733
+ option?: ExpireOption
734
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
735
+ }
736
+
737
+ declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
738
+ constructor(cmd: [
739
+ key: string,
740
+ fields: (string | number) | (string | number)[],
741
+ timestamp: number,
742
+ option?: ExpireOption
743
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
744
+ }
745
+
746
+ declare class HPExpireTimeCommand extends Command<number[], number[]> {
747
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
748
+ }
749
+
750
+ declare class HPTtlCommand extends Command<number[], number[]> {
751
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
752
+ }
753
+
559
754
  /**
560
755
  * @see https://redis.io/commands/hget
561
756
  */
@@ -617,9 +812,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
617
812
  * @see https://redis.io/commands/hmset
618
813
  */
619
814
  declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
620
- constructor([key, kv]: [key: string, kv: {
621
- [field: string]: TData;
622
- }], opts?: CommandOptions<"OK", "OK">);
815
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
623
816
  }
624
817
 
625
818
  /**
@@ -631,26 +824,57 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
631
824
  constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
632
825
  }
633
826
 
827
+ type ScanCommandOptionsStandard = {
828
+ match?: string;
829
+ count?: number;
830
+ type?: string;
831
+ withType?: false;
832
+ };
833
+ type ScanCommandOptionsWithType = {
834
+ match?: string;
835
+ count?: number;
836
+ /**
837
+ * Includes types of each key in the result
838
+ *
839
+ * @example
840
+ * ```typescript
841
+ * await redis.scan("0", { withType: true })
842
+ * // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]]
843
+ * ```
844
+ */
845
+ withType: true;
846
+ };
847
+ type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType;
848
+ type ScanResultStandard = [string, string[]];
849
+ type ScanResultWithType = [string, {
850
+ key: string;
851
+ type: string;
852
+ }[]];
853
+ /**
854
+ * @see https://redis.io/commands/scan
855
+ */
856
+ declare class ScanCommand<TData = ScanResultStandard> extends Command<[string, string[]], TData> {
857
+ constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>);
858
+ }
859
+
634
860
  /**
635
861
  * @see https://redis.io/commands/hscan
636
862
  */
637
863
  declare class HScanCommand extends Command<[
638
- number,
864
+ string,
639
865
  (string | number)[]
640
866
  ], [
641
- number,
867
+ string,
642
868
  (string | number)[]
643
869
  ]> {
644
- constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
870
+ constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
645
871
  }
646
872
 
647
873
  /**
648
874
  * @see https://redis.io/commands/hset
649
875
  */
650
876
  declare class HSetCommand<TData> extends Command<number, number> {
651
- constructor([key, kv]: [key: string, kv: {
652
- [field: string]: TData;
653
- }], opts?: CommandOptions<number, number>);
877
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
654
878
  }
655
879
 
656
880
  /**
@@ -667,6 +891,10 @@ declare class HStrLenCommand extends Command<number, number> {
667
891
  constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
668
892
  }
669
893
 
894
+ declare class HTtlCommand extends Command<number[], number[]> {
895
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
896
+ }
897
+
670
898
  /**
671
899
  * @see https://redis.io/commands/hvals
672
900
  */
@@ -773,6 +1001,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
773
1001
  ] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
774
1002
  }
775
1003
 
1004
+ /**
1005
+ * @see https://redis.io/commands/json.merge
1006
+ */
1007
+ declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
1008
+ constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
1009
+ }
1010
+
776
1011
  /**
777
1012
  * @see https://redis.io/commands/json.mget
778
1013
  */
@@ -780,6 +1015,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
780
1015
  constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
781
1016
  }
782
1017
 
1018
+ /**
1019
+ * @see https://redis.io/commands/json.mset
1020
+ */
1021
+ declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
1022
+ constructor(cmd: {
1023
+ key: string;
1024
+ path: string;
1025
+ value: TData;
1026
+ }[], opts?: CommandOptions<"OK" | null, "OK" | null>);
1027
+ }
1028
+
783
1029
  /**
784
1030
  * @see https://redis.io/commands/json.numincrby
785
1031
  */
@@ -936,25 +1182,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
936
1182
  * @see https://redis.io/commands/mget
937
1183
  */
938
1184
  declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
939
- constructor(cmd: [string[]] | [...(string[] | string[])], opts?: CommandOptions<(string | null)[], TData>);
1185
+ constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
940
1186
  }
941
1187
 
942
1188
  /**
943
1189
  * @see https://redis.io/commands/mset
944
1190
  */
945
1191
  declare class MSetCommand<TData> extends Command<"OK", "OK"> {
946
- constructor([kv]: [kv: {
947
- [key: string]: TData;
948
- }], opts?: CommandOptions<"OK", "OK">);
1192
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
949
1193
  }
950
1194
 
951
1195
  /**
952
1196
  * @see https://redis.io/commands/msetnx
953
1197
  */
954
1198
  declare class MSetNXCommand<TData = string> extends Command<number, number> {
955
- constructor([kv]: [kv: {
956
- [key: string]: TData;
957
- }], opts?: CommandOptions<number, number>);
1199
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
958
1200
  }
959
1201
 
960
1202
  /**
@@ -968,14 +1210,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
968
1210
  * @see https://redis.io/commands/pexpire
969
1211
  */
970
1212
  declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
971
- constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
1213
+ constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
972
1214
  }
973
1215
 
974
1216
  /**
975
1217
  * @see https://redis.io/commands/pexpireat
976
1218
  */
977
1219
  declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
978
- constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
1220
+ constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
979
1221
  }
980
1222
 
981
1223
  /**
@@ -1052,7 +1294,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
1052
1294
  * @see https://redis.io/commands/sadd
1053
1295
  */
1054
1296
  declare class SAddCommand<TData = string> extends Command<number, number> {
1055
- constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1297
+ constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
1056
1298
  }
1057
1299
 
1058
1300
  /**
@@ -1240,13 +1482,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
1240
1482
  * @see https://redis.io/commands/sscan
1241
1483
  */
1242
1484
  declare class SScanCommand extends Command<[
1243
- number,
1485
+ string,
1244
1486
  (string | number)[]
1245
1487
  ], [
1246
- number,
1488
+ string,
1247
1489
  (string | number)[]
1248
1490
  ]> {
1249
- constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
1491
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1250
1492
  }
1251
1493
 
1252
1494
  /**
@@ -1321,9 +1563,7 @@ declare class XAddCommand extends Command<string, string> {
1321
1563
  constructor([key, id, entries, opts]: [
1322
1564
  key: string,
1323
1565
  id: "*" | string,
1324
- entries: {
1325
- [field: string]: unknown;
1326
- },
1566
+ entries: Record<string, unknown>,
1327
1567
  opts?: XAddCommandOptions
1328
1568
  ], commandOptions?: CommandOptions<string, string>);
1329
1569
  }
@@ -1337,16 +1577,33 @@ type XReadCommandOptions = [
1337
1577
  id: string | string[],
1338
1578
  options?: {
1339
1579
  count?: number;
1580
+ /**
1581
+ * @deprecated block is not yet supported in Upstash Redis
1582
+ */
1340
1583
  blockMS?: number;
1341
1584
  }
1342
1585
  ];
1343
- type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [key: string, id: string, options?: {
1344
- count?: number;
1345
- blockMS?: number;
1346
- }] : never : K extends string[] ? I extends string[] ? [key: string[], id: string[], options?: {
1347
- count?: number;
1348
- blockMS?: number;
1349
- }] : never : never : never;
1586
+ type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
1587
+ key: string,
1588
+ id: string,
1589
+ options?: {
1590
+ count?: number;
1591
+ /**
1592
+ * @deprecated block is not yet supported in Upstash Redis
1593
+ */
1594
+ blockMS?: number;
1595
+ }
1596
+ ] : never : K extends string[] ? I extends string[] ? [
1597
+ key: string[],
1598
+ id: string[],
1599
+ options?: {
1600
+ count?: number;
1601
+ /**
1602
+ * @deprecated block is not yet supported in Upstash Redis
1603
+ */
1604
+ blockMS?: number;
1605
+ }
1606
+ ] : never : never : never;
1350
1607
  /**
1351
1608
  * @see https://redis.io/commands/xread
1352
1609
  */
@@ -1356,6 +1613,9 @@ declare class XReadCommand extends Command<number, unknown[]> {
1356
1613
 
1357
1614
  type Options = {
1358
1615
  count?: number;
1616
+ /**
1617
+ * @deprecated block is not yet supported in Upstash Redis
1618
+ */
1359
1619
  blockMS?: number;
1360
1620
  NOACK?: boolean;
1361
1621
  };
@@ -1547,13 +1807,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
1547
1807
  * @see https://redis.io/commands/zscan
1548
1808
  */
1549
1809
  declare class ZScanCommand extends Command<[
1550
- number,
1810
+ string,
1551
1811
  (string | number)[]
1552
1812
  ], [
1553
- number,
1813
+ string,
1554
1814
  (string | number)[]
1555
1815
  ]> {
1556
- constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
1816
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1557
1817
  }
1558
1818
 
1559
1819
  /**
@@ -1563,9 +1823,79 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
1563
1823
  constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
1564
1824
  }
1565
1825
 
1826
+ type BaseMessageData<TMessage> = {
1827
+ channel: string;
1828
+ message: TMessage;
1829
+ };
1830
+ type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
1831
+ pattern: string;
1832
+ };
1833
+ type SubscriptionCountEvent = number;
1834
+ type MessageEventMap<TMessage> = {
1835
+ message: BaseMessageData<TMessage>;
1836
+ subscribe: SubscriptionCountEvent;
1837
+ unsubscribe: SubscriptionCountEvent;
1838
+ pmessage: PatternMessageData<TMessage>;
1839
+ psubscribe: SubscriptionCountEvent;
1840
+ punsubscribe: SubscriptionCountEvent;
1841
+ error: Error;
1842
+ [key: `message:${string}`]: BaseMessageData<TMessage>;
1843
+ [key: `pmessage:${string}`]: PatternMessageData<TMessage>;
1844
+ };
1845
+ type EventType = keyof MessageEventMap<any>;
1846
+ type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
1847
+ declare class Subscriber<TMessage = any> extends EventTarget {
1848
+ private subscriptions;
1849
+ private client;
1850
+ private listeners;
1851
+ private opts?;
1852
+ constructor(client: Requester, channels: string[], isPattern?: boolean, opts?: Pick<RedisOptions, "automaticDeserialization">);
1853
+ private subscribeToChannel;
1854
+ private subscribeToPattern;
1855
+ private handleMessage;
1856
+ private dispatchToListeners;
1857
+ on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
1858
+ removeAllListeners(): void;
1859
+ unsubscribe(channels?: string[]): Promise<void>;
1860
+ getSubscribedChannels(): string[];
1861
+ }
1862
+
1566
1863
  type InferResponseData<T extends unknown[]> = {
1567
1864
  [K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
1568
1865
  };
1866
+ interface ExecMethod<TCommands extends Command<any, any>[]> {
1867
+ /**
1868
+ * Send the pipeline request to upstash.
1869
+ *
1870
+ * Returns an array with the results of all pipelined commands.
1871
+ *
1872
+ * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1873
+ * ```ts
1874
+ * const p = redis.pipeline()
1875
+ * p.get("key")
1876
+ * const result = p.exec<[{ greeting: string }]>()
1877
+ * ```
1878
+ *
1879
+ * 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.
1880
+ *
1881
+ * 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 }`.
1882
+ *
1883
+ * ```ts
1884
+ * const p = redis.pipeline()
1885
+ * p.get("key")
1886
+ *
1887
+ * const result = await p.exec({ keepErrors: true });
1888
+ * const getResult = result[0].result
1889
+ * const getError = result[0].error
1890
+ * ```
1891
+ */
1892
+ <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
1893
+ <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
1894
+ keepErrors: true;
1895
+ }): Promise<{
1896
+ [K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
1897
+ }>;
1898
+ }
1569
1899
  /**
1570
1900
  * Upstash REST API supports command pipelining to send multiple commands in
1571
1901
  * batch, instead of sending each command one by one and waiting for a response.
@@ -1614,19 +1944,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1614
1944
  commandOptions?: CommandOptions<any, any>;
1615
1945
  multiExec?: boolean;
1616
1946
  });
1617
- /**
1618
- * Send the pipeline request to upstash.
1619
- *
1620
- * Returns an array with the results of all pipelined commands.
1621
- *
1622
- * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1623
- * ```ts
1624
- * const p = redis.pipeline()
1625
- * p.get("key")
1626
- * const result = p.exec<[{ greeting: string }]>()
1627
- * ```
1628
- */
1629
- exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
1947
+ exec: ExecMethod<TCommands>;
1630
1948
  /**
1631
1949
  * Returns the length of pipeline before the execution
1632
1950
  */
@@ -1644,6 +1962,23 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1644
1962
  * @see https://redis.io/commands/bitcount
1645
1963
  */
1646
1964
  bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
1965
+ /**
1966
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
1967
+ *
1968
+ * @example
1969
+ * ```typescript
1970
+ * redis.set("mykey", 0);
1971
+ * const result = await redis.pipeline()
1972
+ * .bitfield("mykey")
1973
+ * .set("u4", 0, 16)
1974
+ * .incr("u4", "#1", 1)
1975
+ * .exec();
1976
+ * console.log(result); // [[0, 1]]
1977
+ * ```
1978
+ *
1979
+ * @see https://redis.io/commands/bitfield
1980
+ */
1981
+ bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
1647
1982
  /**
1648
1983
  * @see https://redis.io/commands/bitop
1649
1984
  */
@@ -1685,10 +2020,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1685
2020
  * @see https://redis.io/commands/echo
1686
2021
  */
1687
2022
  echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
2023
+ /**
2024
+ * @see https://redis.io/commands/eval_ro
2025
+ */
2026
+ evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1688
2027
  /**
1689
2028
  * @see https://redis.io/commands/eval
1690
2029
  */
1691
2030
  eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
2031
+ /**
2032
+ * @see https://redis.io/commands/evalsha_ro
2033
+ */
2034
+ evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1692
2035
  /**
1693
2036
  * @see https://redis.io/commands/evalsha
1694
2037
  */
@@ -1700,11 +2043,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1700
2043
  /**
1701
2044
  * @see https://redis.io/commands/expire
1702
2045
  */
1703
- expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2046
+ expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1704
2047
  /**
1705
2048
  * @see https://redis.io/commands/expireat
1706
2049
  */
1707
- expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2050
+ expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1708
2051
  /**
1709
2052
  * @see https://redis.io/commands/flushall
1710
2053
  */
@@ -1713,31 +2056,31 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1713
2056
  * @see https://redis.io/commands/flushdb
1714
2057
  */
1715
2058
  flushdb: (opts?: {
1716
- async?: boolean | undefined;
2059
+ async?: boolean;
1717
2060
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1718
2061
  /**
1719
2062
  * @see https://redis.io/commands/geoadd
1720
2063
  */
1721
- geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2064
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
1722
2065
  /**
1723
2066
  * @see https://redis.io/commands/geodist
1724
2067
  */
1725
- geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
2068
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
1726
2069
  /**
1727
2070
  * @see https://redis.io/commands/geopos
1728
2071
  */
1729
- geopos: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, {
2072
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
1730
2073
  lng: number;
1731
2074
  lat: number;
1732
2075
  }[]>]>;
1733
2076
  /**
1734
2077
  * @see https://redis.io/commands/geohash
1735
2078
  */
1736
- geohash: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
2079
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
1737
2080
  /**
1738
2081
  * @see https://redis.io/commands/geosearch
1739
2082
  */
1740
- geosearch: (key: string, centerPoint: {
2083
+ geosearch: <TData>(key: string, centerPoint: {
1741
2084
  type: "FROMLONLAT" | "fromlonlat";
1742
2085
  coordinate: {
1743
2086
  lon: number;
@@ -1745,7 +2088,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1745
2088
  };
1746
2089
  } | {
1747
2090
  type: "FROMMEMBER" | "frommember";
1748
- member: unknown;
2091
+ member: TData;
1749
2092
  }, shape: {
1750
2093
  type: "BYRADIUS" | "byradius";
1751
2094
  radius: number;
@@ -1760,13 +2103,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1760
2103
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1761
2104
  count?: {
1762
2105
  limit: number;
1763
- any?: boolean | undefined;
1764
- } | undefined;
1765
- withCoord?: boolean | undefined;
1766
- withDist?: boolean | undefined;
1767
- withHash?: boolean | undefined;
2106
+ any?: boolean;
2107
+ };
2108
+ withCoord?: boolean;
2109
+ withDist?: boolean;
2110
+ withHash?: boolean;
1768
2111
  } | undefined) => Pipeline<[...TCommands, Command<any, ({
1769
- member: unknown;
2112
+ member: TData;
1770
2113
  } & {
1771
2114
  coord?: {
1772
2115
  long: number;
@@ -1778,7 +2121,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1778
2121
  /**
1779
2122
  * @see https://redis.io/commands/geosearchstore
1780
2123
  */
1781
- geosearchstore: (destination: string, key: string, centerPoint: {
2124
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
1782
2125
  type: "FROMLONLAT" | "fromlonlat";
1783
2126
  coordinate: {
1784
2127
  lon: number;
@@ -1786,7 +2129,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1786
2129
  };
1787
2130
  } | {
1788
2131
  type: "FROMMEMBER" | "frommember";
1789
- member: unknown;
2132
+ member: TData;
1790
2133
  }, shape: {
1791
2134
  type: "BYRADIUS" | "byradius";
1792
2135
  radius: number;
@@ -1801,9 +2144,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1801
2144
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1802
2145
  count?: {
1803
2146
  limit: number;
1804
- any?: boolean | undefined;
1805
- } | undefined;
1806
- storeDist?: boolean | undefined;
2147
+ any?: boolean;
2148
+ };
2149
+ storeDist?: boolean;
1807
2150
  } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1808
2151
  /**
1809
2152
  * @see https://redis.io/commands/get
@@ -1817,6 +2160,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1817
2160
  * @see https://redis.io/commands/getdel
1818
2161
  */
1819
2162
  getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2163
+ /**
2164
+ * @see https://redis.io/commands/getex
2165
+ */
2166
+ getex: <TData>(key: string, opts?: ({
2167
+ ex: number;
2168
+ px?: never;
2169
+ exat?: never;
2170
+ pxat?: never;
2171
+ persist?: never;
2172
+ } | {
2173
+ ex?: never;
2174
+ px: number;
2175
+ exat?: never;
2176
+ pxat?: never;
2177
+ persist?: never;
2178
+ } | {
2179
+ ex?: never;
2180
+ px?: never;
2181
+ exat: number;
2182
+ pxat?: never;
2183
+ persist?: never;
2184
+ } | {
2185
+ ex?: never;
2186
+ px?: never;
2187
+ exat?: never;
2188
+ pxat: number;
2189
+ persist?: never;
2190
+ } | {
2191
+ ex?: never;
2192
+ px?: never;
2193
+ exat?: never;
2194
+ pxat?: never;
2195
+ persist: true;
2196
+ } | {
2197
+ ex?: never;
2198
+ px?: never;
2199
+ exat?: never;
2200
+ pxat?: never;
2201
+ persist?: never;
2202
+ }) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1820
2203
  /**
1821
2204
  * @see https://redis.io/commands/getrange
1822
2205
  */
@@ -1833,6 +2216,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1833
2216
  * @see https://redis.io/commands/hexists
1834
2217
  */
1835
2218
  hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
2219
+ /**
2220
+ * @see https://redis.io/commands/hexpire
2221
+ */
2222
+ hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2223
+ /**
2224
+ * @see https://redis.io/commands/hexpireat
2225
+ */
2226
+ hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2227
+ /**
2228
+ * @see https://redis.io/commands/hexpiretime
2229
+ */
2230
+ hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2231
+ /**
2232
+ * @see https://redis.io/commands/httl
2233
+ */
2234
+ httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2235
+ /**
2236
+ * @see https://redis.io/commands/hpexpire
2237
+ */
2238
+ hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2239
+ /**
2240
+ * @see https://redis.io/commands/hpexpireat
2241
+ */
2242
+ hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2243
+ /**
2244
+ * @see https://redis.io/commands/hpexpiretime
2245
+ */
2246
+ hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2247
+ /**
2248
+ * @see https://redis.io/commands/hpttl
2249
+ */
2250
+ hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2251
+ /**
2252
+ * @see https://redis.io/commands/hpersist
2253
+ */
2254
+ hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
1836
2255
  /**
1837
2256
  * @see https://redis.io/commands/hget
1838
2257
  */
@@ -1864,9 +2283,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1864
2283
  /**
1865
2284
  * @see https://redis.io/commands/hmset
1866
2285
  */
1867
- hmset: <TData>(key: string, kv: {
1868
- [field: string]: TData;
1869
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2286
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1870
2287
  /**
1871
2288
  * @see https://redis.io/commands/hrandfield
1872
2289
  */
@@ -1874,13 +2291,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1874
2291
  /**
1875
2292
  * @see https://redis.io/commands/hscan
1876
2293
  */
1877
- hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2294
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
1878
2295
  /**
1879
2296
  * @see https://redis.io/commands/hset
1880
2297
  */
1881
- hset: <TData>(key: string, kv: {
1882
- [field: string]: TData;
1883
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2298
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1884
2299
  /**
1885
2300
  * @see https://redis.io/commands/hsetnx
1886
2301
  */
@@ -1929,13 +2344,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1929
2344
  * @see https://redis.io/commands/lpop
1930
2345
  */
1931
2346
  lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2347
+ /**
2348
+ * @see https://redis.io/commands/lmpop
2349
+ */
2350
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
1932
2351
  /**
1933
2352
  * @see https://redis.io/commands/lpos
1934
2353
  */
1935
2354
  lpos: <TData>(key: string, element: unknown, opts?: {
1936
- rank?: number | undefined;
1937
- count?: number | undefined;
1938
- maxLen?: number | undefined;
2355
+ rank?: number;
2356
+ count?: number;
2357
+ maxLen?: number;
1939
2358
  } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
1940
2359
  /**
1941
2360
  * @see https://redis.io/commands/lpush
@@ -1968,15 +2387,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1968
2387
  /**
1969
2388
  * @see https://redis.io/commands/mset
1970
2389
  */
1971
- mset: <TData>(kv: {
1972
- [key: string]: TData;
1973
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2390
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1974
2391
  /**
1975
2392
  * @see https://redis.io/commands/msetnx
1976
2393
  */
1977
- msetnx: <TData>(kv: {
1978
- [key: string]: TData;
1979
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2394
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1980
2395
  /**
1981
2396
  * @see https://redis.io/commands/persist
1982
2397
  */
@@ -1984,11 +2399,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1984
2399
  /**
1985
2400
  * @see https://redis.io/commands/pexpire
1986
2401
  */
1987
- pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2402
+ pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1988
2403
  /**
1989
2404
  * @see https://redis.io/commands/pexpireat
1990
2405
  */
1991
- pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2406
+ pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1992
2407
  /**
1993
2408
  * @see https://redis.io/commands/pfadd
1994
2409
  */
@@ -2044,11 +2459,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2044
2459
  /**
2045
2460
  * @see https://redis.io/commands/sadd
2046
2461
  */
2047
- sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2462
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2048
2463
  /**
2049
2464
  * @see https://redis.io/commands/scan
2050
2465
  */
2051
- scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, string[]]>]>;
2466
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
2052
2467
  /**
2053
2468
  * @see https://redis.io/commands/scard
2054
2469
  */
@@ -2129,7 +2544,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2129
2544
  /**
2130
2545
  * @see https://redis.io/commands/sscan
2131
2546
  */
2132
- sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2547
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2133
2548
  /**
2134
2549
  * @see https://redis.io/commands/strlen
2135
2550
  */
@@ -2165,15 +2580,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2165
2580
  /**
2166
2581
  * @see https://redis.io/commands/zadd
2167
2582
  */
2168
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2583
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2169
2584
  /**
2170
2585
  * @see https://redis.io/commands/xadd
2171
2586
  */
2172
- xadd: (key: string, id: string, entries: {
2173
- [field: string]: unknown;
2174
- }, opts?: {
2175
- nomkStream?: boolean | undefined;
2176
- trim?: (({
2587
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2588
+ nomkStream?: boolean;
2589
+ trim?: ({
2177
2590
  type: "MAXLEN" | "maxlen";
2178
2591
  threshold: number;
2179
2592
  } | {
@@ -2181,11 +2594,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2181
2594
  threshold: string;
2182
2595
  }) & ({
2183
2596
  comparison: "~";
2184
- limit?: number | undefined;
2597
+ limit?: number;
2185
2598
  } | {
2186
2599
  comparison: "=";
2187
- limit?: undefined;
2188
- })) | undefined;
2600
+ limit?: never;
2601
+ });
2189
2602
  } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2190
2603
  /**
2191
2604
  * @see https://redis.io/commands/xack
@@ -2201,11 +2614,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2201
2614
  xgroup: (key: string, opts: {
2202
2615
  type: "CREATE";
2203
2616
  group: string;
2204
- id: string;
2617
+ id: `$` | string;
2205
2618
  options?: {
2206
- MKSTREAM?: boolean | undefined;
2207
- ENTRIESREAD?: number | undefined;
2208
- } | undefined;
2619
+ MKSTREAM?: boolean;
2620
+ ENTRIESREAD?: number;
2621
+ };
2209
2622
  } | {
2210
2623
  type: "CREATECONSUMER";
2211
2624
  group: string;
@@ -2220,10 +2633,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2220
2633
  } | {
2221
2634
  type: "SETID";
2222
2635
  group: string;
2223
- id: string;
2636
+ id: `$` | string;
2224
2637
  options?: {
2225
- ENTRIESREAD?: number | undefined;
2226
- } | undefined;
2638
+ ENTRIESREAD?: number;
2639
+ };
2227
2640
  }) => Pipeline<[...TCommands, Command<any, never>]>;
2228
2641
  /**
2229
2642
  * @see https://redis.io/commands/xread
@@ -2250,35 +2663,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2250
2663
  * @see https://redis.io/commands/xpending
2251
2664
  */
2252
2665
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2253
- idleTime?: number | undefined;
2254
- consumer?: string | string[] | undefined;
2666
+ idleTime?: number;
2667
+ consumer?: string | string[];
2255
2668
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2256
2669
  /**
2257
2670
  * @see https://redis.io/commands/xclaim
2258
2671
  */
2259
2672
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2260
- idleMS?: number | undefined;
2261
- timeMS?: number | undefined;
2262
- retryCount?: number | undefined;
2263
- force?: boolean | undefined;
2264
- justId?: boolean | undefined;
2265
- lastId?: number | undefined;
2673
+ idleMS?: number;
2674
+ timeMS?: number;
2675
+ retryCount?: number;
2676
+ force?: boolean;
2677
+ justId?: boolean;
2678
+ lastId?: number;
2266
2679
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2267
2680
  /**
2268
2681
  * @see https://redis.io/commands/xautoclaim
2269
2682
  */
2270
2683
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2271
- count?: number | undefined;
2272
- justId?: boolean | undefined;
2684
+ count?: number;
2685
+ justId?: boolean;
2273
2686
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2274
2687
  /**
2275
2688
  * @see https://redis.io/commands/xtrim
2276
2689
  */
2277
2690
  xtrim: (key: string, options: {
2278
2691
  strategy: "MAXLEN" | "MINID";
2279
- exactness?: "~" | "=" | undefined;
2280
- threshold: string | number;
2281
- limit?: number | undefined;
2692
+ exactness?: "~" | "=";
2693
+ threshold: number | string;
2694
+ limit?: number;
2282
2695
  }) => Pipeline<[...TCommands, Command<any, number>]>;
2283
2696
  /**
2284
2697
  * @see https://redis.io/commands/xrange
@@ -2323,21 +2736,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2323
2736
  /**
2324
2737
  * @see https://redis.io/commands/zrange
2325
2738
  */
2326
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
2327
- key: string,
2328
- min: `(${string}` | `[${string}` | "-" | "+",
2329
- max: `(${string}` | `[${string}` | "-" | "+",
2330
- opts: {
2331
- byLex: true;
2332
- } & ZRangeCommandOptions
2333
- ] | [
2334
- key: string,
2335
- min: number | `(${number}` | "-inf" | "+inf",
2336
- max: number | `(${number}` | "-inf" | "+inf",
2337
- opts: {
2338
- byScore: true;
2339
- } & ZRangeCommandOptions
2340
- ]) => Pipeline<[...TCommands, Command<any, TData>]>;
2739
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
2740
+ byLex: true;
2741
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
2742
+ byScore: true;
2743
+ } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
2341
2744
  /**
2342
2745
  * @see https://redis.io/commands/zrank
2343
2746
  */
@@ -2365,7 +2768,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2365
2768
  /**
2366
2769
  * @see https://redis.io/commands/zscan
2367
2770
  */
2368
- zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2771
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2369
2772
  /**
2370
2773
  * @see https://redis.io/commands/zscore
2371
2774
  */
@@ -2422,10 +2825,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2422
2825
  * @see https://redis.io/commands/json.get
2423
2826
  */
2424
2827
  get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
2828
+ /**
2829
+ * @see https://redis.io/commands/json.merge
2830
+ */
2831
+ merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2425
2832
  /**
2426
2833
  * @see https://redis.io/commands/json.mget
2427
2834
  */
2428
2835
  mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
2836
+ /**
2837
+ * @see https://redis.io/commands/json.mset
2838
+ */
2839
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2429
2840
  /**
2430
2841
  * @see https://redis.io/commands/json.numincrby
2431
2842
  */
@@ -2451,9 +2862,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2451
2862
  */
2452
2863
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2453
2864
  nx: true;
2454
- xx?: undefined;
2865
+ xx?: never;
2455
2866
  } | {
2456
- nx?: undefined;
2867
+ nx?: never;
2457
2868
  xx: true;
2458
2869
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2459
2870
  /**
@@ -2493,9 +2904,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2493
2904
  */
2494
2905
  declare class Script<TResult = unknown> {
2495
2906
  readonly script: string;
2496
- readonly sha1: string;
2907
+ /**
2908
+ * @deprecated This property is initialized to an empty string and will be set in the init method
2909
+ * asynchronously. Do not use this property immidiately after the constructor.
2910
+ *
2911
+ * This property is only exposed for backwards compatibility and will be removed in the
2912
+ * future major release.
2913
+ */
2914
+ sha1: string;
2497
2915
  private readonly redis;
2498
2916
  constructor(redis: Redis, script: string);
2917
+ /**
2918
+ * Initialize the script by computing its SHA-1 hash.
2919
+ */
2920
+ private init;
2499
2921
  /**
2500
2922
  * Send an `EVAL` command to redis.
2501
2923
  */
@@ -2517,6 +2939,56 @@ declare class Script<TResult = unknown> {
2517
2939
  private digest;
2518
2940
  }
2519
2941
 
2942
+ /**
2943
+ * Creates a new script.
2944
+ *
2945
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
2946
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
2947
+ * the entire script. Afterwards, the script is cached on the server.
2948
+ *
2949
+ * @example
2950
+ * ```ts
2951
+ * const redis = new Redis({...})
2952
+ *
2953
+ * const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
2954
+ * const arg1 = await script.evalRo([], ["Hello World"])
2955
+ * expect(arg1, "Hello World")
2956
+ * ```
2957
+ */
2958
+ declare class ScriptRO<TResult = unknown> {
2959
+ readonly script: string;
2960
+ /**
2961
+ * @deprecated This property is initialized to an empty string and will be set in the init method
2962
+ * asynchronously. Do not use this property immidiately after the constructor.
2963
+ *
2964
+ * This property is only exposed for backwards compatibility and will be removed in the
2965
+ * future major release.
2966
+ */
2967
+ sha1: string;
2968
+ private readonly redis;
2969
+ constructor(redis: Redis, script: string);
2970
+ private init;
2971
+ /**
2972
+ * Send an `EVAL_RO` command to redis.
2973
+ */
2974
+ evalRo(keys: string[], args: string[]): Promise<TResult>;
2975
+ /**
2976
+ * Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
2977
+ */
2978
+ evalshaRo(keys: string[], args: string[]): Promise<TResult>;
2979
+ /**
2980
+ * Optimistically try to run `EVALSHA_RO` first.
2981
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
2982
+ *
2983
+ * Following calls will be able to use the cached script
2984
+ */
2985
+ exec(keys: string[], args: string[]): Promise<TResult>;
2986
+ /**
2987
+ * Compute the sha1 hash of the script and return its hex representation.
2988
+ */
2989
+ private digest;
2990
+ }
2991
+
2520
2992
  /**
2521
2993
  * Serverless redis client for upstash.
2522
2994
  */
@@ -2524,6 +2996,7 @@ declare class Redis {
2524
2996
  protected client: Requester;
2525
2997
  protected opts?: CommandOptions<any, any>;
2526
2998
  protected enableTelemetry: boolean;
2999
+ protected enableAutoPipelining: boolean;
2527
3000
  /**
2528
3001
  * Create a new redis client
2529
3002
  *
@@ -2536,6 +3009,8 @@ declare class Redis {
2536
3009
  * ```
2537
3010
  */
2538
3011
  constructor(client: Requester, opts?: RedisOptions);
3012
+ get readYourWritesSyncToken(): string | undefined;
3013
+ set readYourWritesSyncToken(session: string | undefined);
2539
3014
  get json(): {
2540
3015
  /**
2541
3016
  * @see https://redis.io/commands/json.arrappend
@@ -2577,10 +3052,18 @@ declare class Redis {
2577
3052
  * @see https://redis.io/commands/json.get
2578
3053
  */
2579
3054
  get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
3055
+ /**
3056
+ * @see https://redis.io/commands/json.merge
3057
+ */
3058
+ merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
2580
3059
  /**
2581
3060
  * @see https://redis.io/commands/json.mget
2582
3061
  */
2583
- mget: <TData_1>(keys: string[], path: string) => Promise<TData_1>;
3062
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
3063
+ /**
3064
+ * @see https://redis.io/commands/json.mset
3065
+ */
3066
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2584
3067
  /**
2585
3068
  * @see https://redis.io/commands/json.numincrby
2586
3069
  */
@@ -2606,9 +3089,9 @@ declare class Redis {
2606
3089
  */
2607
3090
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2608
3091
  nx: true;
2609
- xx?: undefined;
3092
+ xx?: never;
2610
3093
  } | {
2611
- nx?: undefined;
3094
+ nx?: never;
2612
3095
  xx: true;
2613
3096
  } | undefined) => Promise<"OK" | null>;
2614
3097
  /**
@@ -2636,13 +3119,44 @@ declare class Redis {
2636
3119
  * Technically this is not private, we can hide it from intellisense by doing this
2637
3120
  */
2638
3121
  protected addTelemetry: (telemetry: Telemetry) => void;
2639
- createScript(script: string): Script;
3122
+ /**
3123
+ * Creates a new script.
3124
+ *
3125
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
3126
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
3127
+ * the entire script. Afterwards, the script is cached on the server.
3128
+ *
3129
+ * @param script - The script to create
3130
+ * @param opts - Optional options to pass to the script `{ readonly?: boolean }`
3131
+ * @returns A new script
3132
+ *
3133
+ * @example
3134
+ * ```ts
3135
+ * const redis = new Redis({...})
3136
+ *
3137
+ * const script = redis.createScript<string>("return ARGV[1];")
3138
+ * const arg1 = await script.eval([], ["Hello World"])
3139
+ * expect(arg1, "Hello World")
3140
+ * ```
3141
+ * @example
3142
+ * ```ts
3143
+ * const redis = new Redis({...})
3144
+ *
3145
+ * const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
3146
+ * const arg1 = await script.evalRo([], ["Hello World"])
3147
+ * expect(arg1, "Hello World")
3148
+ * ```
3149
+ */
3150
+ createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
3151
+ readonly?: TReadonly;
3152
+ }): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
2640
3153
  /**
2641
3154
  * Create a new pipeline that allows you to send requests in bulk.
2642
3155
  *
2643
3156
  * @see {@link Pipeline}
2644
3157
  */
2645
3158
  pipeline: () => Pipeline<[]>;
3159
+ protected autoPipeline: () => Redis;
2646
3160
  /**
2647
3161
  * Create a new transaction to allow executing multiple steps atomically.
2648
3162
  *
@@ -2653,6 +3167,22 @@ declare class Redis {
2653
3167
  * @see {@link Pipeline}
2654
3168
  */
2655
3169
  multi: () => Pipeline<[]>;
3170
+ /**
3171
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
3172
+ *
3173
+ * @example
3174
+ * ```typescript
3175
+ * redis.set("mykey", 0);
3176
+ * const result = await redis.bitfield("mykey")
3177
+ * .set("u4", 0, 16)
3178
+ * .incr("u4", "#1", 1)
3179
+ * .exec();
3180
+ * console.log(result); // [0, 1]
3181
+ * ```
3182
+ *
3183
+ * @see https://redis.io/commands/bitfield
3184
+ */
3185
+ bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
2656
3186
  /**
2657
3187
  * @see https://redis.io/commands/append
2658
3188
  */
@@ -2698,14 +3228,26 @@ declare class Redis {
2698
3228
  * @see https://redis.io/commands/echo
2699
3229
  */
2700
3230
  echo: (message: string) => Promise<string>;
3231
+ /**
3232
+ * @see https://redis.io/commands/eval_ro
3233
+ */
3234
+ evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
2701
3235
  /**
2702
3236
  * @see https://redis.io/commands/eval
2703
3237
  */
2704
3238
  eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
3239
+ /**
3240
+ * @see https://redis.io/commands/evalsha_ro
3241
+ */
3242
+ evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
2705
3243
  /**
2706
3244
  * @see https://redis.io/commands/evalsha
2707
3245
  */
2708
3246
  evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
3247
+ /**
3248
+ * Generic method to execute any Redis command.
3249
+ */
3250
+ exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
2709
3251
  /**
2710
3252
  * @see https://redis.io/commands/exists
2711
3253
  */
@@ -2713,11 +3255,11 @@ declare class Redis {
2713
3255
  /**
2714
3256
  * @see https://redis.io/commands/expire
2715
3257
  */
2716
- expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Promise<0 | 1>;
3258
+ expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
2717
3259
  /**
2718
3260
  * @see https://redis.io/commands/expireat
2719
3261
  */
2720
- expireat: (key: string, unix: number) => Promise<0 | 1>;
3262
+ expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
2721
3263
  /**
2722
3264
  * @see https://redis.io/commands/flushall
2723
3265
  */
@@ -2726,31 +3268,31 @@ declare class Redis {
2726
3268
  * @see https://redis.io/commands/flushdb
2727
3269
  */
2728
3270
  flushdb: (opts?: {
2729
- async?: boolean | undefined;
3271
+ async?: boolean;
2730
3272
  } | undefined) => Promise<"OK">;
2731
3273
  /**
2732
3274
  * @see https://redis.io/commands/geoadd
2733
3275
  */
2734
- geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Promise<number | null>;
3276
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
2735
3277
  /**
2736
3278
  * @see https://redis.io/commands/geopos
2737
3279
  */
2738
- geopos: (args_0: string, ...args_1: unknown[]) => Promise<{
3280
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
2739
3281
  lng: number;
2740
3282
  lat: number;
2741
3283
  }[]>;
2742
3284
  /**
2743
3285
  * @see https://redis.io/commands/geodist
2744
3286
  */
2745
- geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
3287
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2746
3288
  /**
2747
3289
  * @see https://redis.io/commands/geohash
2748
3290
  */
2749
- geohash: (args_0: string, ...args_1: unknown[]) => Promise<(string | null)[]>;
3291
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
2750
3292
  /**
2751
3293
  * @see https://redis.io/commands/geosearch
2752
3294
  */
2753
- geosearch: (key: string, centerPoint: {
3295
+ geosearch: <TData>(key: string, centerPoint: {
2754
3296
  type: "FROMLONLAT" | "fromlonlat";
2755
3297
  coordinate: {
2756
3298
  lon: number;
@@ -2758,7 +3300,7 @@ declare class Redis {
2758
3300
  };
2759
3301
  } | {
2760
3302
  type: "FROMMEMBER" | "frommember";
2761
- member: unknown;
3303
+ member: TData;
2762
3304
  }, shape: {
2763
3305
  type: "BYRADIUS" | "byradius";
2764
3306
  radius: number;
@@ -2773,13 +3315,13 @@ declare class Redis {
2773
3315
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2774
3316
  count?: {
2775
3317
  limit: number;
2776
- any?: boolean | undefined;
2777
- } | undefined;
2778
- withCoord?: boolean | undefined;
2779
- withDist?: boolean | undefined;
2780
- withHash?: boolean | undefined;
3318
+ any?: boolean;
3319
+ };
3320
+ withCoord?: boolean;
3321
+ withDist?: boolean;
3322
+ withHash?: boolean;
2781
3323
  } | undefined) => Promise<({
2782
- member: unknown;
3324
+ member: TData;
2783
3325
  } & {
2784
3326
  coord?: {
2785
3327
  long: number;
@@ -2791,7 +3333,7 @@ declare class Redis {
2791
3333
  /**
2792
3334
  * @see https://redis.io/commands/geosearchstore
2793
3335
  */
2794
- geosearchstore: (destination: string, key: string, centerPoint: {
3336
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
2795
3337
  type: "FROMLONLAT" | "fromlonlat";
2796
3338
  coordinate: {
2797
3339
  lon: number;
@@ -2799,7 +3341,7 @@ declare class Redis {
2799
3341
  };
2800
3342
  } | {
2801
3343
  type: "FROMMEMBER" | "frommember";
2802
- member: unknown;
3344
+ member: TData;
2803
3345
  }, shape: {
2804
3346
  type: "BYRADIUS" | "byradius";
2805
3347
  radius: number;
@@ -2814,9 +3356,9 @@ declare class Redis {
2814
3356
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2815
3357
  count?: {
2816
3358
  limit: number;
2817
- any?: boolean | undefined;
2818
- } | undefined;
2819
- storeDist?: boolean | undefined;
3359
+ any?: boolean;
3360
+ };
3361
+ storeDist?: boolean;
2820
3362
  } | undefined) => Promise<number>;
2821
3363
  /**
2822
3364
  * @see https://redis.io/commands/get
@@ -2830,6 +3372,46 @@ declare class Redis {
2830
3372
  * @see https://redis.io/commands/getdel
2831
3373
  */
2832
3374
  getdel: <TData>(key: string) => Promise<TData | null>;
3375
+ /**
3376
+ * @see https://redis.io/commands/getex
3377
+ */
3378
+ getex: <TData>(key: string, opts?: ({
3379
+ ex: number;
3380
+ px?: never;
3381
+ exat?: never;
3382
+ pxat?: never;
3383
+ persist?: never;
3384
+ } | {
3385
+ ex?: never;
3386
+ px: number;
3387
+ exat?: never;
3388
+ pxat?: never;
3389
+ persist?: never;
3390
+ } | {
3391
+ ex?: never;
3392
+ px?: never;
3393
+ exat: number;
3394
+ pxat?: never;
3395
+ persist?: never;
3396
+ } | {
3397
+ ex?: never;
3398
+ px?: never;
3399
+ exat?: never;
3400
+ pxat: number;
3401
+ persist?: never;
3402
+ } | {
3403
+ ex?: never;
3404
+ px?: never;
3405
+ exat?: never;
3406
+ pxat?: never;
3407
+ persist: true;
3408
+ } | {
3409
+ ex?: never;
3410
+ px?: never;
3411
+ exat?: never;
3412
+ pxat?: never;
3413
+ persist?: never;
3414
+ }) | undefined) => Promise<TData | null>;
2833
3415
  /**
2834
3416
  * @see https://redis.io/commands/getrange
2835
3417
  */
@@ -2846,6 +3428,42 @@ declare class Redis {
2846
3428
  * @see https://redis.io/commands/hexists
2847
3429
  */
2848
3430
  hexists: (key: string, field: string) => Promise<number>;
3431
+ /**
3432
+ * @see https://redis.io/commands/hexpire
3433
+ */
3434
+ hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3435
+ /**
3436
+ * @see https://redis.io/commands/hexpireat
3437
+ */
3438
+ hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3439
+ /**
3440
+ * @see https://redis.io/commands/hexpiretime
3441
+ */
3442
+ hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3443
+ /**
3444
+ * @see https://redis.io/commands/httl
3445
+ */
3446
+ httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3447
+ /**
3448
+ * @see https://redis.io/commands/hpexpire
3449
+ */
3450
+ hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3451
+ /**
3452
+ * @see https://redis.io/commands/hpexpireat
3453
+ */
3454
+ hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3455
+ /**
3456
+ * @see https://redis.io/commands/hpexpiretime
3457
+ */
3458
+ hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3459
+ /**
3460
+ * @see https://redis.io/commands/hpttl
3461
+ */
3462
+ hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3463
+ /**
3464
+ * @see https://redis.io/commands/hpersist
3465
+ */
3466
+ hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
2849
3467
  /**
2850
3468
  * @see https://redis.io/commands/hget
2851
3469
  */
@@ -2877,27 +3495,23 @@ declare class Redis {
2877
3495
  /**
2878
3496
  * @see https://redis.io/commands/hmset
2879
3497
  */
2880
- hmset: <TData>(key: string, kv: {
2881
- [field: string]: TData;
2882
- }) => Promise<"OK">;
3498
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2883
3499
  /**
2884
3500
  * @see https://redis.io/commands/hrandfield
2885
3501
  */
2886
3502
  hrandfield: {
2887
- (key: string): Promise<string>;
3503
+ (key: string): Promise<string | null>;
2888
3504
  (key: string, count: number): Promise<string[]>;
2889
3505
  <TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
2890
3506
  };
2891
3507
  /**
2892
3508
  * @see https://redis.io/commands/hscan
2893
3509
  */
2894
- hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3510
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
2895
3511
  /**
2896
3512
  * @see https://redis.io/commands/hset
2897
3513
  */
2898
- hset: <TData>(key: string, kv: {
2899
- [field: string]: TData;
2900
- }) => Promise<number>;
3514
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2901
3515
  /**
2902
3516
  * @see https://redis.io/commands/hsetnx
2903
3517
  */
@@ -2946,13 +3560,17 @@ declare class Redis {
2946
3560
  * @see https://redis.io/commands/lpop
2947
3561
  */
2948
3562
  lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3563
+ /**
3564
+ * @see https://redis.io/commands/lmpop
3565
+ */
3566
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
2949
3567
  /**
2950
3568
  * @see https://redis.io/commands/lpos
2951
3569
  */
2952
3570
  lpos: <TData = number>(key: string, element: unknown, opts?: {
2953
- rank?: number | undefined;
2954
- count?: number | undefined;
2955
- maxLen?: number | undefined;
3571
+ rank?: number;
3572
+ count?: number;
3573
+ maxLen?: number;
2956
3574
  } | undefined) => Promise<TData>;
2957
3575
  /**
2958
3576
  * @see https://redis.io/commands/lpush
@@ -2985,15 +3603,11 @@ declare class Redis {
2985
3603
  /**
2986
3604
  * @see https://redis.io/commands/mset
2987
3605
  */
2988
- mset: <TData>(kv: {
2989
- [key: string]: TData;
2990
- }) => Promise<"OK">;
3606
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
2991
3607
  /**
2992
3608
  * @see https://redis.io/commands/msetnx
2993
3609
  */
2994
- msetnx: <TData>(kv: {
2995
- [key: string]: TData;
2996
- }) => Promise<number>;
3610
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
2997
3611
  /**
2998
3612
  * @see https://redis.io/commands/persist
2999
3613
  */
@@ -3001,11 +3615,11 @@ declare class Redis {
3001
3615
  /**
3002
3616
  * @see https://redis.io/commands/pexpire
3003
3617
  */
3004
- pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
3618
+ pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
3005
3619
  /**
3006
3620
  * @see https://redis.io/commands/pexpireat
3007
3621
  */
3008
- pexpireat: (key: string, unix: number) => Promise<0 | 1>;
3622
+ pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
3009
3623
  /**
3010
3624
  * @see https://redis.io/commands/pfadd
3011
3625
  */
@@ -3026,6 +3640,10 @@ declare class Redis {
3026
3640
  * @see https://redis.io/commands/psetex
3027
3641
  */
3028
3642
  psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
3643
+ /**
3644
+ * @see https://redis.io/commands/psubscribe
3645
+ */
3646
+ psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
3029
3647
  /**
3030
3648
  * @see https://redis.io/commands/pttl
3031
3649
  */
@@ -3061,11 +3679,14 @@ declare class Redis {
3061
3679
  /**
3062
3680
  * @see https://redis.io/commands/sadd
3063
3681
  */
3064
- sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
3682
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
3065
3683
  /**
3066
3684
  * @see https://redis.io/commands/scan
3067
3685
  */
3068
- scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, string[]]>;
3686
+ scan(cursor: string | number): Promise<ScanResultStandard>;
3687
+ scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
3688
+ withType: true;
3689
+ } ? ScanResultWithType : ScanResultStandard>;
3069
3690
  /**
3070
3691
  * @see https://redis.io/commands/scard
3071
3692
  */
@@ -3149,11 +3770,15 @@ declare class Redis {
3149
3770
  /**
3150
3771
  * @see https://redis.io/commands/sscan
3151
3772
  */
3152
- sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3773
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3153
3774
  /**
3154
3775
  * @see https://redis.io/commands/strlen
3155
3776
  */
3156
3777
  strlen: (key: string) => Promise<number>;
3778
+ /**
3779
+ * @see https://redis.io/commands/subscribe
3780
+ */
3781
+ subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
3157
3782
  /**
3158
3783
  * @see https://redis.io/commands/sunion
3159
3784
  */
@@ -3185,11 +3810,9 @@ declare class Redis {
3185
3810
  /**
3186
3811
  * @see https://redis.io/commands/xadd
3187
3812
  */
3188
- xadd: (key: string, id: string, entries: {
3189
- [field: string]: unknown;
3190
- }, opts?: {
3191
- nomkStream?: boolean | undefined;
3192
- trim?: (({
3813
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3814
+ nomkStream?: boolean;
3815
+ trim?: ({
3193
3816
  type: "MAXLEN" | "maxlen";
3194
3817
  threshold: number;
3195
3818
  } | {
@@ -3197,11 +3820,11 @@ declare class Redis {
3197
3820
  threshold: string;
3198
3821
  }) & ({
3199
3822
  comparison: "~";
3200
- limit?: number | undefined;
3823
+ limit?: number;
3201
3824
  } | {
3202
3825
  comparison: "=";
3203
- limit?: undefined;
3204
- })) | undefined;
3826
+ limit?: never;
3827
+ });
3205
3828
  } | undefined) => Promise<string>;
3206
3829
  /**
3207
3830
  * @see https://redis.io/commands/xack
@@ -3217,11 +3840,11 @@ declare class Redis {
3217
3840
  xgroup: (key: string, opts: {
3218
3841
  type: "CREATE";
3219
3842
  group: string;
3220
- id: string;
3843
+ id: `$` | string;
3221
3844
  options?: {
3222
- MKSTREAM?: boolean | undefined;
3223
- ENTRIESREAD?: number | undefined;
3224
- } | undefined;
3845
+ MKSTREAM?: boolean;
3846
+ ENTRIESREAD?: number;
3847
+ };
3225
3848
  } | {
3226
3849
  type: "CREATECONSUMER";
3227
3850
  group: string;
@@ -3236,10 +3859,10 @@ declare class Redis {
3236
3859
  } | {
3237
3860
  type: "SETID";
3238
3861
  group: string;
3239
- id: string;
3862
+ id: `$` | string;
3240
3863
  options?: {
3241
- ENTRIESREAD?: number | undefined;
3242
- } | undefined;
3864
+ ENTRIESREAD?: number;
3865
+ };
3243
3866
  }) => Promise<never>;
3244
3867
  /**
3245
3868
  * @see https://redis.io/commands/xread
@@ -3266,35 +3889,35 @@ declare class Redis {
3266
3889
  * @see https://redis.io/commands/xpending
3267
3890
  */
3268
3891
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3269
- idleTime?: number | undefined;
3270
- consumer?: string | string[] | undefined;
3892
+ idleTime?: number;
3893
+ consumer?: string | string[];
3271
3894
  } | undefined) => Promise<unknown[]>;
3272
3895
  /**
3273
3896
  * @see https://redis.io/commands/xclaim
3274
3897
  */
3275
3898
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3276
- idleMS?: number | undefined;
3277
- timeMS?: number | undefined;
3278
- retryCount?: number | undefined;
3279
- force?: boolean | undefined;
3280
- justId?: boolean | undefined;
3281
- lastId?: number | undefined;
3899
+ idleMS?: number;
3900
+ timeMS?: number;
3901
+ retryCount?: number;
3902
+ force?: boolean;
3903
+ justId?: boolean;
3904
+ lastId?: number;
3282
3905
  } | undefined) => Promise<unknown[]>;
3283
3906
  /**
3284
3907
  * @see https://redis.io/commands/xautoclaim
3285
3908
  */
3286
3909
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3287
- count?: number | undefined;
3288
- justId?: boolean | undefined;
3910
+ count?: number;
3911
+ justId?: boolean;
3289
3912
  } | undefined) => Promise<unknown[]>;
3290
3913
  /**
3291
3914
  * @see https://redis.io/commands/xtrim
3292
3915
  */
3293
3916
  xtrim: (key: string, options: {
3294
3917
  strategy: "MAXLEN" | "MINID";
3295
- exactness?: "~" | "=" | undefined;
3296
- threshold: string | number;
3297
- limit?: number | undefined;
3918
+ exactness?: "~" | "=";
3919
+ threshold: number | string;
3920
+ limit?: number;
3298
3921
  }) => Promise<number>;
3299
3922
  /**
3300
3923
  * @see https://redis.io/commands/xrange
@@ -3307,7 +3930,7 @@ declare class Redis {
3307
3930
  /**
3308
3931
  * @see https://redis.io/commands/zadd
3309
3932
  */
3310
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<number | null>;
3933
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3311
3934
  /**
3312
3935
  * @see https://redis.io/commands/zcard
3313
3936
  */
@@ -3347,21 +3970,11 @@ declare class Redis {
3347
3970
  /**
3348
3971
  * @see https://redis.io/commands/zrange
3349
3972
  */
3350
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
3351
- key: string,
3352
- min: `(${string}` | `[${string}` | "-" | "+",
3353
- max: `(${string}` | `[${string}` | "-" | "+",
3354
- opts: {
3355
- byLex: true;
3356
- } & ZRangeCommandOptions
3357
- ] | [
3358
- key: string,
3359
- min: number | `(${number}` | "-inf" | "+inf",
3360
- max: number | `(${number}` | "-inf" | "+inf",
3361
- opts: {
3362
- byScore: true;
3363
- } & ZRangeCommandOptions
3364
- ]) => Promise<TData>;
3973
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3974
+ byLex: true;
3975
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3976
+ byScore: true;
3977
+ } & ZRangeCommandOptions]) => Promise<TData>;
3365
3978
  /**
3366
3979
  * @see https://redis.io/commands/zrank
3367
3980
  */
@@ -3389,7 +4002,7 @@ declare class Redis {
3389
4002
  /**
3390
4003
  * @see https://redis.io/commands/zscan
3391
4004
  */
3392
- zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
4005
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3393
4006
  /**
3394
4007
  * @see https://redis.io/commands/zscore
3395
4008
  */
@@ -3404,6 +4017,30 @@ declare class Redis {
3404
4017
  zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
3405
4018
  }
3406
4019
 
4020
+ type UpstashErrorOptions = Pick<NonNullable<ConstructorParameters<typeof Error>[1]>, "cause">;
4021
+ /**
4022
+ * Result of a bad request to upstash
4023
+ */
4024
+ declare class UpstashError extends Error {
4025
+ constructor(message: string, options?: ErrorOptions);
4026
+ }
4027
+ declare class UrlError extends Error {
4028
+ constructor(url: string);
4029
+ }
4030
+ declare class UpstashJSONParseError extends UpstashError {
4031
+ constructor(body: string, options?: UpstashErrorOptions);
4032
+ }
4033
+
4034
+ type error_UpstashError = UpstashError;
4035
+ declare const error_UpstashError: typeof UpstashError;
4036
+ type error_UpstashJSONParseError = UpstashJSONParseError;
4037
+ declare const error_UpstashJSONParseError: typeof UpstashJSONParseError;
4038
+ type error_UrlError = UrlError;
4039
+ declare const error_UrlError: typeof UrlError;
4040
+ declare namespace error {
4041
+ export { error_UpstashError as UpstashError, error_UpstashJSONParseError as UpstashJSONParseError, error_UrlError as UrlError };
4042
+ }
4043
+
3407
4044
  /**
3408
4045
  * @see https://redis.io/commands/zdiffstore
3409
4046
  */
@@ -3418,4 +4055,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
3418
4055
  constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3419
4056
  }
3420
4057
 
3421
- export { IncrByCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetSetCommand as H, HDelCommand as I, HExistsCommand as J, HGetCommand as K, HGetAllCommand as L, HIncrByCommand as M, HIncrByFloatCommand as N, HKeysCommand as O, HLenCommand as P, HMGetCommand as Q, RedisOptions as R, HMSetCommand as S, HRandFieldCommand as T, UpstashRequest as U, HScanCommand as V, HSetCommand as W, HSetNXCommand as X, HStrLenCommand as Y, HValsCommand as Z, IncrCommand as _, RequesterConfig as a, SetNxCommand as a$, IncrByFloatCommand as a0, JsonArrAppendCommand as a1, JsonArrIndexCommand as a2, JsonArrInsertCommand as a3, JsonArrLenCommand as a4, JsonArrPopCommand as a5, JsonArrTrimCommand as a6, JsonClearCommand as a7, JsonDelCommand as a8, JsonForgetCommand as a9, MSetNXCommand as aA, PersistCommand as aB, PExpireCommand as aC, PExpireAtCommand as aD, PingCommand as aE, PSetEXCommand as aF, PTtlCommand as aG, PublishCommand as aH, RandomKeyCommand as aI, RenameCommand as aJ, RenameNXCommand as aK, RPopCommand as aL, RPushCommand as aM, RPushXCommand as aN, SAddCommand as aO, ScanCommand as aP, ScanCommandOptions as aQ, SCardCommand as aR, ScriptExistsCommand as aS, ScriptFlushCommand as aT, ScriptLoadCommand as aU, SDiffCommand as aV, SDiffStoreCommand as aW, SetCommand as aX, SetCommandOptions as aY, SetBitCommand as aZ, SetExCommand as a_, JsonGetCommand as aa, JsonMGetCommand as ab, JsonNumIncrByCommand as ac, JsonNumMultByCommand as ad, JsonObjKeysCommand as ae, JsonObjLenCommand as af, JsonRespCommand as ag, JsonSetCommand as ah, JsonStrAppendCommand as ai, JsonStrLenCommand as aj, JsonToggleCommand as ak, JsonTypeCommand as al, KeysCommand as am, LIndexCommand as an, LInsertCommand as ao, LLenCommand as ap, LMoveCommand as aq, LPopCommand as ar, LPushCommand as as, LPushXCommand as at, LRangeCommand as au, LRemCommand as av, LSetCommand as aw, LTrimCommand as ax, MGetCommand as ay, MSetCommand as az, Redis as b, SetRangeCommand as b0, SInterCommand as b1, SInterStoreCommand as b2, SIsMemberCommand as b3, SMembersCommand as b4, SMIsMemberCommand as b5, SMoveCommand as b6, SPopCommand as b7, SRandMemberCommand as b8, SRemCommand as b9, ZRangeCommandOptions as bA, ZRankCommand as bB, ZRemCommand as bC, ZRemRangeByLexCommand as bD, ZRemRangeByRankCommand as bE, ZRemRangeByScoreCommand as bF, ZRevRankCommand as bG, ZScanCommand as bH, ZScoreCommand as bI, ZUnionCommand as bJ, ZUnionCommandOptions as bK, ZUnionStoreCommand as bL, ZUnionStoreCommandOptions as bM, SScanCommand as ba, StrLenCommand as bb, SUnionCommand as bc, SUnionStoreCommand as bd, TimeCommand as be, TouchCommand as bf, TtlCommand as bg, Type as bh, TypeCommand as bi, UnlinkCommand as bj, XAddCommand as bk, XRangeCommand as bl, ScoreMember as bm, ZAddCommandOptions as bn, ZAddCommand as bo, ZCardCommand as bp, ZCountCommand as bq, ZDiffStoreCommand as br, ZIncrByCommand as bs, ZInterStoreCommand as bt, ZInterStoreCommandOptions as bu, ZLexCountCommand as bv, ZMScoreCommand as bw, ZPopMaxCommand as bx, ZPopMinCommand as by, ZRangeCommand as bz, Requester as c, UpstashResponse as d, BitOpCommand as e, BitPosCommand as f, DecrCommand as g, DecrByCommand as h, DelCommand as i, EvalCommand as j, EvalshaCommand as k, ExistsCommand as l, ExpireCommand as m, ExpireAtCommand as n, FlushDBCommand as o, GeoAddCommandOptions as p, GeoMember as q, GeoDistCommand as r, GeoHashCommand as s, GeoPosCommand as t, GeoSearchCommand as u, GeoSearchStoreCommand as v, GetCommand as w, GetBitCommand as x, GetDelCommand as y, GetRangeCommand as z };
4058
+ export { HPersistCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, type HttpClientConfig as H, GetCommand as I, GetBitCommand as J, GetDelCommand as K, GetExCommand as L, GetRangeCommand as M, GetSetCommand as N, HDelCommand as O, Pipeline as P, HExistsCommand as Q, type RedisOptions as R, HExpireCommand as S, HExpireAtCommand as T, type UpstashRequest as U, HExpireTimeCommand as V, HTtlCommand as W, HPExpireCommand as X, HPExpireAtCommand as Y, HPExpireTimeCommand as Z, HPTtlCommand as _, type RequesterConfig as a, RenameNXCommand as a$, HGetCommand as a0, HGetAllCommand as a1, HIncrByCommand as a2, HIncrByFloatCommand as a3, HKeysCommand as a4, HLenCommand as a5, HMGetCommand as a6, HMSetCommand as a7, HRandFieldCommand as a8, HScanCommand as a9, JsonStrLenCommand as aA, JsonToggleCommand as aB, JsonTypeCommand as aC, KeysCommand as aD, LIndexCommand as aE, LInsertCommand as aF, LLenCommand as aG, LMoveCommand as aH, LPopCommand as aI, LPushCommand as aJ, LPushXCommand as aK, LRangeCommand as aL, LRemCommand as aM, LSetCommand as aN, LTrimCommand as aO, MGetCommand as aP, MSetCommand as aQ, MSetNXCommand as aR, PersistCommand as aS, PExpireCommand as aT, PExpireAtCommand as aU, PingCommand as aV, PSetEXCommand as aW, PTtlCommand as aX, PublishCommand as aY, RandomKeyCommand as aZ, RenameCommand as a_, HSetCommand as aa, HSetNXCommand as ab, HStrLenCommand as ac, HValsCommand as ad, IncrCommand as ae, IncrByCommand as af, IncrByFloatCommand as ag, JsonArrAppendCommand as ah, JsonArrIndexCommand as ai, JsonArrInsertCommand as aj, JsonArrLenCommand as ak, JsonArrPopCommand as al, JsonArrTrimCommand as am, JsonClearCommand as an, JsonDelCommand as ao, JsonForgetCommand as ap, JsonGetCommand as aq, JsonMergeCommand as ar, JsonMGetCommand as as, JsonNumIncrByCommand as at, JsonNumMultByCommand as au, JsonObjKeysCommand as av, JsonObjLenCommand as aw, JsonRespCommand as ax, JsonSetCommand as ay, JsonStrAppendCommand as az, Redis as b, type ZUnionCommandOptions as b$, RPopCommand as b0, RPushCommand as b1, RPushXCommand as b2, SAddCommand as b3, ScanCommand as b4, type ScanCommandOptions as b5, SCardCommand as b6, ScriptExistsCommand as b7, ScriptFlushCommand as b8, ScriptLoadCommand as b9, UnlinkCommand as bA, XAddCommand as bB, XRangeCommand as bC, type ScoreMember as bD, type ZAddCommandOptions as bE, ZAddCommand as bF, ZCardCommand as bG, ZCountCommand as bH, ZDiffStoreCommand as bI, ZIncrByCommand as bJ, ZInterStoreCommand as bK, type ZInterStoreCommandOptions as bL, ZLexCountCommand as bM, ZMScoreCommand as bN, ZPopMaxCommand as bO, ZPopMinCommand as bP, ZRangeCommand as bQ, type ZRangeCommandOptions as bR, ZRankCommand as bS, ZRemCommand as bT, ZRemRangeByLexCommand as bU, ZRemRangeByRankCommand as bV, ZRemRangeByScoreCommand as bW, ZRevRankCommand as bX, ZScanCommand as bY, ZScoreCommand as bZ, ZUnionCommand as b_, SDiffCommand as ba, SDiffStoreCommand as bb, SetCommand as bc, type SetCommandOptions as bd, SetBitCommand as be, SetExCommand as bf, SetNxCommand as bg, SetRangeCommand as bh, SInterCommand as bi, SInterStoreCommand as bj, SIsMemberCommand as bk, SMembersCommand as bl, SMIsMemberCommand as bm, SMoveCommand as bn, SPopCommand as bo, SRandMemberCommand as bp, SRemCommand as bq, SScanCommand as br, StrLenCommand as bs, SUnionCommand as bt, SUnionStoreCommand as bu, TimeCommand as bv, TouchCommand as bw, TtlCommand as bx, type Type as by, TypeCommand as bz, type UpstashResponse as c, ZUnionStoreCommand as c0, type ZUnionStoreCommandOptions as c1, type Requester as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalROCommand as k, EvalCommand as l, EvalshaROCommand as m, EvalshaCommand as n, ExistsCommand as o, ExpireCommand as p, type ExpireOption as q, ExpireAtCommand as r, FlushDBCommand as s, type GeoAddCommandOptions as t, type GeoMember as u, GeoDistCommand as v, GeoHashCommand as w, GeoPosCommand as x, GeoSearchCommand as y, GeoSearchStoreCommand as z };