@upstash/redis 0.0.0-ci.c00b02de3221a40eb48a9e0e9fecd434abda4dc2-20240703080528 → 0.0.0-ci.c21ca079c33c67efb29ee43e778ab181aeed6386-20250530111221

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.
@@ -26,6 +26,7 @@ type RedisOptions = {
26
26
  latencyLogging?: boolean;
27
27
  enableTelemetry?: boolean;
28
28
  enableAutoPipelining?: boolean;
29
+ readYourWrites?: boolean;
29
30
  };
30
31
 
31
32
  type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
@@ -35,12 +36,37 @@ type UpstashRequest = {
35
36
  * Request body will be serialized to json
36
37
  */
37
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;
38
56
  };
39
57
  type UpstashResponse<TResult> = {
40
58
  result?: TResult;
41
59
  error?: string;
42
60
  };
43
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;
44
70
  request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
45
71
  }
46
72
  type RetryConfig = false | {
@@ -109,6 +135,31 @@ type CommandOptions<TResult, TData> = {
109
135
  */
110
136
  automaticDeserialization?: boolean;
111
137
  latencyLogging?: boolean;
138
+ /**
139
+ * Additional headers to be sent with the request
140
+ */
141
+ headers?: Record<string, string>;
142
+ /**
143
+ * Path to append to the URL
144
+ */
145
+ path?: string[];
146
+ /**
147
+ * Options for streaming requests, mainly used for subscribe, monitor commands
148
+ **/
149
+ streamOptions?: {
150
+ /**
151
+ * Callback to be called when a message is received
152
+ */
153
+ onMessage?: (data: string) => void;
154
+ /**
155
+ * Whether the request is streaming
156
+ */
157
+ isStreaming?: boolean;
158
+ /**
159
+ * Signal to abort the request
160
+ */
161
+ signal?: AbortSignal;
162
+ };
112
163
  };
113
164
  /**
114
165
  * Command offers default (de)serialization and the exec method to all commands.
@@ -120,6 +171,11 @@ declare class Command<TResult, TData> {
120
171
  readonly command: (string | number | boolean)[];
121
172
  readonly serialize: Serialize;
122
173
  readonly deserialize: Deserialize<TResult, TData>;
174
+ protected readonly headers?: Record<string, string>;
175
+ protected readonly path?: string[];
176
+ protected readonly onMessage?: (data: string) => void;
177
+ protected readonly isStreaming: boolean;
178
+ protected readonly signal?: AbortSignal;
123
179
  /**
124
180
  * Create a new command instance.
125
181
  *
@@ -132,8 +188,7 @@ declare class Command<TResult, TData> {
132
188
  exec(client: Requester): Promise<TData>;
133
189
  }
134
190
 
135
- type ZUnionCommandOptions = {
136
- withScores?: boolean;
191
+ type ZUnionStoreCommandOptions = {
137
192
  aggregate?: "sum" | "min" | "max";
138
193
  } & ({
139
194
  weight: number;
@@ -146,14 +201,15 @@ type ZUnionCommandOptions = {
146
201
  weights?: never;
147
202
  });
148
203
  /**
149
- * @see https://redis.io/commands/zunion
204
+ * @see https://redis.io/commands/zunionstore
150
205
  */
151
- declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
152
- constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
153
- constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
206
+ declare class ZUnionStoreCommand extends Command<number, number> {
207
+ constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
208
+ constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
154
209
  }
155
210
 
156
- type ZUnionStoreCommandOptions = {
211
+ type ZUnionCommandOptions = {
212
+ withScores?: boolean;
157
213
  aggregate?: "sum" | "min" | "max";
158
214
  } & ({
159
215
  weight: number;
@@ -166,11 +222,11 @@ type ZUnionStoreCommandOptions = {
166
222
  weights?: never;
167
223
  });
168
224
  /**
169
- * @see https://redis.io/commands/zunionstore
225
+ * @see https://redis.io/commands/zunion
170
226
  */
171
- declare class ZUnionStoreCommand extends Command<number, number> {
172
- constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
173
- constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
227
+ declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
228
+ constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
229
+ constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
174
230
  }
175
231
 
176
232
  type ZInterStoreCommandOptions = {
@@ -236,11 +292,11 @@ type GeoAddCommandOptions = {
236
292
  } & {
237
293
  ch?: boolean;
238
294
  });
239
- interface GeoMember<TMemberType> {
295
+ type GeoMember<TMemberType> = {
240
296
  latitude: number;
241
297
  longitude: number;
242
298
  member: TMemberType;
243
- }
299
+ };
244
300
  /**
245
301
  * @see https://redis.io/commands/geoadd
246
302
  */
@@ -252,6 +308,11 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
252
308
  ], opts?: CommandOptions<number | null, number | null>);
253
309
  }
254
310
 
311
+ type ExpireOption = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
312
+ declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
313
+ constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
314
+ }
315
+
255
316
  /**
256
317
  * @see https://redis.io/commands/append
257
318
  */
@@ -270,7 +331,7 @@ declare class BitCountCommand extends Command<number, number> {
270
331
  type SubCommandArgs<TRest extends unknown[] = []> = [
271
332
  encoding: string,
272
333
  offset: number | string,
273
- ...TRest
334
+ ...rest: TRest
274
335
  ];
275
336
  /**
276
337
  * @see https://redis.io/commands/bitfield
@@ -348,6 +409,13 @@ declare class EchoCommand extends Command<string, string> {
348
409
  constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
349
410
  }
350
411
 
412
+ /**
413
+ * @see https://redis.io/commands/eval_ro
414
+ */
415
+ declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
416
+ constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
417
+ }
418
+
351
419
  /**
352
420
  * @see https://redis.io/commands/eval
353
421
  */
@@ -355,6 +423,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
355
423
  constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
356
424
  }
357
425
 
426
+ /**
427
+ * @see https://redis.io/commands/evalsha_ro
428
+ */
429
+ declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
430
+ constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
431
+ }
432
+
358
433
  /**
359
434
  * @see https://redis.io/commands/evalsha
360
435
  */
@@ -369,16 +444,11 @@ declare class ExistsCommand extends Command<number, number> {
369
444
  constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
370
445
  }
371
446
 
372
- type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
373
- declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
374
- constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
375
- }
376
-
377
447
  /**
378
448
  * @see https://redis.io/commands/expireat
379
449
  */
380
450
  declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
381
- constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
451
+ constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
382
452
  }
383
453
 
384
454
  /**
@@ -415,7 +485,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
415
485
  * @see https://redis.io/commands/geohash
416
486
  */
417
487
  declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
418
- constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
488
+ constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
419
489
  }
420
490
 
421
491
  type Coordinates = {
@@ -553,6 +623,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
553
623
  constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
554
624
  }
555
625
 
626
+ type GetExCommandOptions = {
627
+ ex: number;
628
+ px?: never;
629
+ exat?: never;
630
+ pxat?: never;
631
+ persist?: never;
632
+ } | {
633
+ ex?: never;
634
+ px: number;
635
+ exat?: never;
636
+ pxat?: never;
637
+ persist?: never;
638
+ } | {
639
+ ex?: never;
640
+ px?: never;
641
+ exat: number;
642
+ pxat?: never;
643
+ persist?: never;
644
+ } | {
645
+ ex?: never;
646
+ px?: never;
647
+ exat?: never;
648
+ pxat: number;
649
+ persist?: never;
650
+ } | {
651
+ ex?: never;
652
+ px?: never;
653
+ exat?: never;
654
+ pxat?: never;
655
+ persist: true;
656
+ } | {
657
+ ex?: never;
658
+ px?: never;
659
+ exat?: never;
660
+ pxat?: never;
661
+ persist?: never;
662
+ };
663
+ /**
664
+ * @see https://redis.io/commands/getex
665
+ */
666
+ declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
667
+ constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
668
+ }
669
+
556
670
  /**
557
671
  * @see https://redis.io/commands/getrange
558
672
  */
@@ -581,6 +695,58 @@ declare class HExistsCommand extends Command<number, number> {
581
695
  constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
582
696
  }
583
697
 
698
+ declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
699
+ constructor(cmd: [
700
+ key: string,
701
+ fields: (string | number) | (string | number)[],
702
+ seconds: number,
703
+ option?: ExpireOption
704
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
705
+ }
706
+
707
+ declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
708
+ constructor(cmd: [
709
+ key: string,
710
+ fields: (string | number) | (string | number)[],
711
+ timestamp: number,
712
+ option?: ExpireOption
713
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
714
+ }
715
+
716
+ declare class HExpireTimeCommand extends Command<number[], number[]> {
717
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
718
+ }
719
+
720
+ declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
721
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
722
+ }
723
+
724
+ declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
725
+ constructor(cmd: [
726
+ key: string,
727
+ fields: (string | number) | (string | number)[],
728
+ milliseconds: number,
729
+ option?: ExpireOption
730
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
731
+ }
732
+
733
+ declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
734
+ constructor(cmd: [
735
+ key: string,
736
+ fields: (string | number) | (string | number)[],
737
+ timestamp: number,
738
+ option?: ExpireOption
739
+ ], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
740
+ }
741
+
742
+ declare class HPExpireTimeCommand extends Command<number[], number[]> {
743
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
744
+ }
745
+
746
+ declare class HPTtlCommand extends Command<number[], number[]> {
747
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
748
+ }
749
+
584
750
  /**
585
751
  * @see https://redis.io/commands/hget
586
752
  */
@@ -642,9 +808,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
642
808
  * @see https://redis.io/commands/hmset
643
809
  */
644
810
  declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
645
- constructor([key, kv]: [key: string, kv: {
646
- [field: string]: TData;
647
- }], opts?: CommandOptions<"OK", "OK">);
811
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
648
812
  }
649
813
 
650
814
  /**
@@ -673,9 +837,7 @@ declare class HScanCommand extends Command<[
673
837
  * @see https://redis.io/commands/hset
674
838
  */
675
839
  declare class HSetCommand<TData> extends Command<number, number> {
676
- constructor([key, kv]: [key: string, kv: {
677
- [field: string]: TData;
678
- }], opts?: CommandOptions<number, number>);
840
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
679
841
  }
680
842
 
681
843
  /**
@@ -692,6 +854,10 @@ declare class HStrLenCommand extends Command<number, number> {
692
854
  constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
693
855
  }
694
856
 
857
+ declare class HTtlCommand extends Command<number[], number[]> {
858
+ constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
859
+ }
860
+
695
861
  /**
696
862
  * @see https://redis.io/commands/hvals
697
863
  */
@@ -798,6 +964,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
798
964
  ] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
799
965
  }
800
966
 
967
+ /**
968
+ * @see https://redis.io/commands/json.merge
969
+ */
970
+ declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
971
+ constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
972
+ }
973
+
801
974
  /**
802
975
  * @see https://redis.io/commands/json.mget
803
976
  */
@@ -805,6 +978,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
805
978
  constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
806
979
  }
807
980
 
981
+ /**
982
+ * @see https://redis.io/commands/json.mset
983
+ */
984
+ declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
985
+ constructor(cmd: {
986
+ key: string;
987
+ path: string;
988
+ value: TData;
989
+ }[], opts?: CommandOptions<"OK" | null, "OK" | null>);
990
+ }
991
+
808
992
  /**
809
993
  * @see https://redis.io/commands/json.numincrby
810
994
  */
@@ -961,25 +1145,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
961
1145
  * @see https://redis.io/commands/mget
962
1146
  */
963
1147
  declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
964
- constructor(cmd: [string[]] | [...(string[] | string[])], opts?: CommandOptions<(string | null)[], TData>);
1148
+ constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
965
1149
  }
966
1150
 
967
1151
  /**
968
1152
  * @see https://redis.io/commands/mset
969
1153
  */
970
1154
  declare class MSetCommand<TData> extends Command<"OK", "OK"> {
971
- constructor([kv]: [kv: {
972
- [key: string]: TData;
973
- }], opts?: CommandOptions<"OK", "OK">);
1155
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
974
1156
  }
975
1157
 
976
1158
  /**
977
1159
  * @see https://redis.io/commands/msetnx
978
1160
  */
979
1161
  declare class MSetNXCommand<TData = string> extends Command<number, number> {
980
- constructor([kv]: [kv: {
981
- [key: string]: TData;
982
- }], opts?: CommandOptions<number, number>);
1162
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
983
1163
  }
984
1164
 
985
1165
  /**
@@ -993,14 +1173,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
993
1173
  * @see https://redis.io/commands/pexpire
994
1174
  */
995
1175
  declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
996
- constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
1176
+ constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
997
1177
  }
998
1178
 
999
1179
  /**
1000
1180
  * @see https://redis.io/commands/pexpireat
1001
1181
  */
1002
1182
  declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
1003
- constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
1183
+ constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
1004
1184
  }
1005
1185
 
1006
1186
  /**
@@ -1077,7 +1257,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
1077
1257
  * @see https://redis.io/commands/sadd
1078
1258
  */
1079
1259
  declare class SAddCommand<TData = string> extends Command<number, number> {
1080
- constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1260
+ constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
1081
1261
  }
1082
1262
 
1083
1263
  /**
@@ -1346,9 +1526,7 @@ declare class XAddCommand extends Command<string, string> {
1346
1526
  constructor([key, id, entries, opts]: [
1347
1527
  key: string,
1348
1528
  id: "*" | string,
1349
- entries: {
1350
- [field: string]: unknown;
1351
- },
1529
+ entries: Record<string, unknown>,
1352
1530
  opts?: XAddCommandOptions
1353
1531
  ], commandOptions?: CommandOptions<string, string>);
1354
1532
  }
@@ -1588,9 +1766,78 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
1588
1766
  constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
1589
1767
  }
1590
1768
 
1769
+ type BaseMessageData<TMessage> = {
1770
+ channel: string;
1771
+ message: TMessage;
1772
+ };
1773
+ type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
1774
+ pattern: string;
1775
+ };
1776
+ type SubscriptionCountEvent = number;
1777
+ type MessageEventMap<TMessage> = {
1778
+ message: BaseMessageData<TMessage>;
1779
+ subscribe: SubscriptionCountEvent;
1780
+ unsubscribe: SubscriptionCountEvent;
1781
+ pmessage: PatternMessageData<TMessage>;
1782
+ psubscribe: SubscriptionCountEvent;
1783
+ punsubscribe: SubscriptionCountEvent;
1784
+ error: Error;
1785
+ [key: `message:${string}`]: BaseMessageData<TMessage>;
1786
+ [key: `pmessage:${string}`]: PatternMessageData<TMessage>;
1787
+ };
1788
+ type EventType = keyof MessageEventMap<any>;
1789
+ type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
1790
+ declare class Subscriber<TMessage = any> extends EventTarget {
1791
+ private subscriptions;
1792
+ private client;
1793
+ private listeners;
1794
+ constructor(client: Requester, channels: string[], isPattern?: boolean);
1795
+ private subscribeToChannel;
1796
+ private subscribeToPattern;
1797
+ private handleMessage;
1798
+ private dispatchToListeners;
1799
+ on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
1800
+ removeAllListeners(): void;
1801
+ unsubscribe(channels?: string[]): Promise<void>;
1802
+ getSubscribedChannels(): string[];
1803
+ }
1804
+
1591
1805
  type InferResponseData<T extends unknown[]> = {
1592
1806
  [K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
1593
1807
  };
1808
+ interface ExecMethod<TCommands extends Command<any, any>[]> {
1809
+ /**
1810
+ * Send the pipeline request to upstash.
1811
+ *
1812
+ * Returns an array with the results of all pipelined commands.
1813
+ *
1814
+ * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1815
+ * ```ts
1816
+ * const p = redis.pipeline()
1817
+ * p.get("key")
1818
+ * const result = p.exec<[{ greeting: string }]>()
1819
+ * ```
1820
+ *
1821
+ * 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.
1822
+ *
1823
+ * 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 }`.
1824
+ *
1825
+ * ```ts
1826
+ * const p = redis.pipeline()
1827
+ * p.get("key")
1828
+ *
1829
+ * const result = await p.exec({ keepErrors: true });
1830
+ * const getResult = result[0].result
1831
+ * const getError = result[0].error
1832
+ * ```
1833
+ */
1834
+ <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
1835
+ <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
1836
+ keepErrors: true;
1837
+ }): Promise<{
1838
+ [K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
1839
+ }>;
1840
+ }
1594
1841
  /**
1595
1842
  * Upstash REST API supports command pipelining to send multiple commands in
1596
1843
  * batch, instead of sending each command one by one and waiting for a response.
@@ -1639,19 +1886,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1639
1886
  commandOptions?: CommandOptions<any, any>;
1640
1887
  multiExec?: boolean;
1641
1888
  });
1642
- /**
1643
- * Send the pipeline request to upstash.
1644
- *
1645
- * Returns an array with the results of all pipelined commands.
1646
- *
1647
- * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1648
- * ```ts
1649
- * const p = redis.pipeline()
1650
- * p.get("key")
1651
- * const result = p.exec<[{ greeting: string }]>()
1652
- * ```
1653
- */
1654
- exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
1889
+ exec: ExecMethod<TCommands>;
1655
1890
  /**
1656
1891
  * Returns the length of pipeline before the execution
1657
1892
  */
@@ -1727,10 +1962,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1727
1962
  * @see https://redis.io/commands/echo
1728
1963
  */
1729
1964
  echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
1965
+ /**
1966
+ * @see https://redis.io/commands/eval_ro
1967
+ */
1968
+ evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1730
1969
  /**
1731
1970
  * @see https://redis.io/commands/eval
1732
1971
  */
1733
1972
  eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1973
+ /**
1974
+ * @see https://redis.io/commands/evalsha_ro
1975
+ */
1976
+ evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1734
1977
  /**
1735
1978
  * @see https://redis.io/commands/evalsha
1736
1979
  */
@@ -1742,11 +1985,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1742
1985
  /**
1743
1986
  * @see https://redis.io/commands/expire
1744
1987
  */
1745
- expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1988
+ expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1746
1989
  /**
1747
1990
  * @see https://redis.io/commands/expireat
1748
1991
  */
1749
- expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1992
+ expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1750
1993
  /**
1751
1994
  * @see https://redis.io/commands/flushall
1752
1995
  */
@@ -1755,7 +1998,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1755
1998
  * @see https://redis.io/commands/flushdb
1756
1999
  */
1757
2000
  flushdb: (opts?: {
1758
- async?: boolean | undefined;
2001
+ async?: boolean;
1759
2002
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1760
2003
  /**
1761
2004
  * @see https://redis.io/commands/geoadd
@@ -1802,11 +2045,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1802
2045
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1803
2046
  count?: {
1804
2047
  limit: number;
1805
- any?: boolean | undefined;
1806
- } | undefined;
1807
- withCoord?: boolean | undefined;
1808
- withDist?: boolean | undefined;
1809
- withHash?: boolean | undefined;
2048
+ any?: boolean;
2049
+ };
2050
+ withCoord?: boolean;
2051
+ withDist?: boolean;
2052
+ withHash?: boolean;
1810
2053
  } | undefined) => Pipeline<[...TCommands, Command<any, ({
1811
2054
  member: TData;
1812
2055
  } & {
@@ -1843,9 +2086,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1843
2086
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1844
2087
  count?: {
1845
2088
  limit: number;
1846
- any?: boolean | undefined;
1847
- } | undefined;
1848
- storeDist?: boolean | undefined;
2089
+ any?: boolean;
2090
+ };
2091
+ storeDist?: boolean;
1849
2092
  } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1850
2093
  /**
1851
2094
  * @see https://redis.io/commands/get
@@ -1859,6 +2102,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1859
2102
  * @see https://redis.io/commands/getdel
1860
2103
  */
1861
2104
  getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2105
+ /**
2106
+ * @see https://redis.io/commands/getex
2107
+ */
2108
+ getex: <TData>(key: string, opts?: ({
2109
+ ex: number;
2110
+ px?: never;
2111
+ exat?: never;
2112
+ pxat?: never;
2113
+ persist?: never;
2114
+ } | {
2115
+ ex?: never;
2116
+ px: number;
2117
+ exat?: never;
2118
+ pxat?: never;
2119
+ persist?: never;
2120
+ } | {
2121
+ ex?: never;
2122
+ px?: never;
2123
+ exat: number;
2124
+ pxat?: never;
2125
+ persist?: never;
2126
+ } | {
2127
+ ex?: never;
2128
+ px?: never;
2129
+ exat?: never;
2130
+ pxat: number;
2131
+ persist?: never;
2132
+ } | {
2133
+ ex?: never;
2134
+ px?: never;
2135
+ exat?: never;
2136
+ pxat?: never;
2137
+ persist: true;
2138
+ } | {
2139
+ ex?: never;
2140
+ px?: never;
2141
+ exat?: never;
2142
+ pxat?: never;
2143
+ persist?: never;
2144
+ }) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1862
2145
  /**
1863
2146
  * @see https://redis.io/commands/getrange
1864
2147
  */
@@ -1875,6 +2158,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1875
2158
  * @see https://redis.io/commands/hexists
1876
2159
  */
1877
2160
  hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
2161
+ /**
2162
+ * @see https://redis.io/commands/hexpire
2163
+ */
2164
+ hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2165
+ /**
2166
+ * @see https://redis.io/commands/hexpireat
2167
+ */
2168
+ hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2169
+ /**
2170
+ * @see https://redis.io/commands/hexpiretime
2171
+ */
2172
+ hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2173
+ /**
2174
+ * @see https://redis.io/commands/httl
2175
+ */
2176
+ httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2177
+ /**
2178
+ * @see https://redis.io/commands/hpexpire
2179
+ */
2180
+ hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2181
+ /**
2182
+ * @see https://redis.io/commands/hpexpireat
2183
+ */
2184
+ hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
2185
+ /**
2186
+ * @see https://redis.io/commands/hpexpiretime
2187
+ */
2188
+ hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2189
+ /**
2190
+ * @see https://redis.io/commands/hpttl
2191
+ */
2192
+ hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
2193
+ /**
2194
+ * @see https://redis.io/commands/hpersist
2195
+ */
2196
+ hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
1878
2197
  /**
1879
2198
  * @see https://redis.io/commands/hget
1880
2199
  */
@@ -1906,13 +2225,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1906
2225
  /**
1907
2226
  * @see https://redis.io/commands/hmset
1908
2227
  */
1909
- hmset: <TData>(key: string, kv: {
1910
- [field: string]: TData;
1911
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2228
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1912
2229
  /**
1913
2230
  * @see https://redis.io/commands/hrandfield
1914
2231
  */
1915
- hrandfield: <TData extends string | Record<string, unknown> | string[]>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
2232
+ hrandfield: <TData extends string | string[] | Record<string, unknown>>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
1916
2233
  /**
1917
2234
  * @see https://redis.io/commands/hscan
1918
2235
  */
@@ -1920,9 +2237,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1920
2237
  /**
1921
2238
  * @see https://redis.io/commands/hset
1922
2239
  */
1923
- hset: <TData>(key: string, kv: {
1924
- [field: string]: TData;
1925
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2240
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1926
2241
  /**
1927
2242
  * @see https://redis.io/commands/hsetnx
1928
2243
  */
@@ -1979,9 +2294,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1979
2294
  * @see https://redis.io/commands/lpos
1980
2295
  */
1981
2296
  lpos: <TData>(key: string, element: unknown, opts?: {
1982
- rank?: number | undefined;
1983
- count?: number | undefined;
1984
- maxLen?: number | undefined;
2297
+ rank?: number;
2298
+ count?: number;
2299
+ maxLen?: number;
1985
2300
  } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
1986
2301
  /**
1987
2302
  * @see https://redis.io/commands/lpush
@@ -2014,15 +2329,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2014
2329
  /**
2015
2330
  * @see https://redis.io/commands/mset
2016
2331
  */
2017
- mset: <TData>(kv: {
2018
- [key: string]: TData;
2019
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2332
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
2020
2333
  /**
2021
2334
  * @see https://redis.io/commands/msetnx
2022
2335
  */
2023
- msetnx: <TData>(kv: {
2024
- [key: string]: TData;
2025
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2336
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
2026
2337
  /**
2027
2338
  * @see https://redis.io/commands/persist
2028
2339
  */
@@ -2030,11 +2341,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2030
2341
  /**
2031
2342
  * @see https://redis.io/commands/pexpire
2032
2343
  */
2033
- pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2344
+ pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2034
2345
  /**
2035
2346
  * @see https://redis.io/commands/pexpireat
2036
2347
  */
2037
- pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2348
+ pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2038
2349
  /**
2039
2350
  * @see https://redis.io/commands/pfadd
2040
2351
  */
@@ -2090,7 +2401,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2090
2401
  /**
2091
2402
  * @see https://redis.io/commands/sadd
2092
2403
  */
2093
- sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2404
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2094
2405
  /**
2095
2406
  * @see https://redis.io/commands/scan
2096
2407
  */
@@ -2211,19 +2522,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2211
2522
  /**
2212
2523
  * @see https://redis.io/commands/zadd
2213
2524
  */
2214
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
2215
- key: string,
2216
- opts: ZAddCommandOptions,
2217
- ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
2218
- ]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2525
+ 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>]>;
2219
2526
  /**
2220
2527
  * @see https://redis.io/commands/xadd
2221
2528
  */
2222
- xadd: (key: string, id: string, entries: {
2223
- [field: string]: unknown;
2224
- }, opts?: {
2225
- nomkStream?: boolean | undefined;
2226
- trim?: (({
2529
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2530
+ nomkStream?: boolean;
2531
+ trim?: ({
2227
2532
  type: "MAXLEN" | "maxlen";
2228
2533
  threshold: number;
2229
2534
  } | {
@@ -2231,11 +2536,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2231
2536
  threshold: string;
2232
2537
  }) & ({
2233
2538
  comparison: "~";
2234
- limit?: number | undefined;
2539
+ limit?: number;
2235
2540
  } | {
2236
2541
  comparison: "=";
2237
- limit?: undefined;
2238
- })) | undefined;
2542
+ limit?: never;
2543
+ });
2239
2544
  } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2240
2545
  /**
2241
2546
  * @see https://redis.io/commands/xack
@@ -2251,11 +2556,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2251
2556
  xgroup: (key: string, opts: {
2252
2557
  type: "CREATE";
2253
2558
  group: string;
2254
- id: string;
2559
+ id: `$` | string;
2255
2560
  options?: {
2256
- MKSTREAM?: boolean | undefined;
2257
- ENTRIESREAD?: number | undefined;
2258
- } | undefined;
2561
+ MKSTREAM?: boolean;
2562
+ ENTRIESREAD?: number;
2563
+ };
2259
2564
  } | {
2260
2565
  type: "CREATECONSUMER";
2261
2566
  group: string;
@@ -2270,10 +2575,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2270
2575
  } | {
2271
2576
  type: "SETID";
2272
2577
  group: string;
2273
- id: string;
2578
+ id: `$` | string;
2274
2579
  options?: {
2275
- ENTRIESREAD?: number | undefined;
2276
- } | undefined;
2580
+ ENTRIESREAD?: number;
2581
+ };
2277
2582
  }) => Pipeline<[...TCommands, Command<any, never>]>;
2278
2583
  /**
2279
2584
  * @see https://redis.io/commands/xread
@@ -2300,35 +2605,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2300
2605
  * @see https://redis.io/commands/xpending
2301
2606
  */
2302
2607
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2303
- idleTime?: number | undefined;
2304
- consumer?: string | string[] | undefined;
2608
+ idleTime?: number;
2609
+ consumer?: string | string[];
2305
2610
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2306
2611
  /**
2307
2612
  * @see https://redis.io/commands/xclaim
2308
2613
  */
2309
2614
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2310
- idleMS?: number | undefined;
2311
- timeMS?: number | undefined;
2312
- retryCount?: number | undefined;
2313
- force?: boolean | undefined;
2314
- justId?: boolean | undefined;
2315
- lastId?: number | undefined;
2615
+ idleMS?: number;
2616
+ timeMS?: number;
2617
+ retryCount?: number;
2618
+ force?: boolean;
2619
+ justId?: boolean;
2620
+ lastId?: number;
2316
2621
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2317
2622
  /**
2318
2623
  * @see https://redis.io/commands/xautoclaim
2319
2624
  */
2320
2625
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2321
- count?: number | undefined;
2322
- justId?: boolean | undefined;
2626
+ count?: number;
2627
+ justId?: boolean;
2323
2628
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2324
2629
  /**
2325
2630
  * @see https://redis.io/commands/xtrim
2326
2631
  */
2327
2632
  xtrim: (key: string, options: {
2328
2633
  strategy: "MAXLEN" | "MINID";
2329
- exactness?: "~" | "=" | undefined;
2330
- threshold: string | number;
2331
- limit?: number | undefined;
2634
+ exactness?: "~" | "=";
2635
+ threshold: number | string;
2636
+ limit?: number;
2332
2637
  }) => Pipeline<[...TCommands, Command<any, number>]>;
2333
2638
  /**
2334
2639
  * @see https://redis.io/commands/xrange
@@ -2373,21 +2678,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2373
2678
  /**
2374
2679
  * @see https://redis.io/commands/zrange
2375
2680
  */
2376
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
2377
- key: string,
2378
- min: `(${string}` | `[${string}` | "-" | "+",
2379
- max: `(${string}` | `[${string}` | "-" | "+",
2380
- opts: {
2381
- byLex: true;
2382
- } & ZRangeCommandOptions
2383
- ] | [
2384
- key: string,
2385
- min: number | `(${number}` | "-inf" | "+inf",
2386
- max: number | `(${number}` | "-inf" | "+inf",
2387
- opts: {
2388
- byScore: true;
2389
- } & ZRangeCommandOptions
2390
- ]) => Pipeline<[...TCommands, Command<any, TData>]>;
2681
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
2682
+ byLex: true;
2683
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
2684
+ byScore: true;
2685
+ } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
2391
2686
  /**
2392
2687
  * @see https://redis.io/commands/zrank
2393
2688
  */
@@ -2472,10 +2767,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2472
2767
  * @see https://redis.io/commands/json.get
2473
2768
  */
2474
2769
  get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
2770
+ /**
2771
+ * @see https://redis.io/commands/json.merge
2772
+ */
2773
+ merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2475
2774
  /**
2476
2775
  * @see https://redis.io/commands/json.mget
2477
2776
  */
2478
2777
  mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
2778
+ /**
2779
+ * @see https://redis.io/commands/json.mset
2780
+ */
2781
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2479
2782
  /**
2480
2783
  * @see https://redis.io/commands/json.numincrby
2481
2784
  */
@@ -2501,9 +2804,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2501
2804
  */
2502
2805
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2503
2806
  nx: true;
2504
- xx?: undefined;
2807
+ xx?: never;
2505
2808
  } | {
2506
- nx?: undefined;
2809
+ nx?: never;
2507
2810
  xx: true;
2508
2811
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2509
2812
  /**
@@ -2543,9 +2846,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2543
2846
  */
2544
2847
  declare class Script<TResult = unknown> {
2545
2848
  readonly script: string;
2546
- readonly sha1: string;
2849
+ /**
2850
+ * @deprecated This property is initialized to an empty string and will be set in the init method
2851
+ * asynchronously. Do not use this property immidiately after the constructor.
2852
+ *
2853
+ * This property is only exposed for backwards compatibility and will be removed in the
2854
+ * future major release.
2855
+ */
2856
+ sha1: string;
2547
2857
  private readonly redis;
2548
2858
  constructor(redis: Redis, script: string);
2859
+ /**
2860
+ * Initialize the script by computing its SHA-1 hash.
2861
+ */
2862
+ private init;
2549
2863
  /**
2550
2864
  * Send an `EVAL` command to redis.
2551
2865
  */
@@ -2567,6 +2881,56 @@ declare class Script<TResult = unknown> {
2567
2881
  private digest;
2568
2882
  }
2569
2883
 
2884
+ /**
2885
+ * Creates a new script.
2886
+ *
2887
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
2888
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
2889
+ * the entire script. Afterwards, the script is cached on the server.
2890
+ *
2891
+ * @example
2892
+ * ```ts
2893
+ * const redis = new Redis({...})
2894
+ *
2895
+ * const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
2896
+ * const arg1 = await script.evalRo([], ["Hello World"])
2897
+ * expect(arg1, "Hello World")
2898
+ * ```
2899
+ */
2900
+ declare class ScriptRO<TResult = unknown> {
2901
+ readonly script: string;
2902
+ /**
2903
+ * @deprecated This property is initialized to an empty string and will be set in the init method
2904
+ * asynchronously. Do not use this property immidiately after the constructor.
2905
+ *
2906
+ * This property is only exposed for backwards compatibility and will be removed in the
2907
+ * future major release.
2908
+ */
2909
+ sha1: string;
2910
+ private readonly redis;
2911
+ constructor(redis: Redis, script: string);
2912
+ private init;
2913
+ /**
2914
+ * Send an `EVAL_RO` command to redis.
2915
+ */
2916
+ evalRo(keys: string[], args: string[]): Promise<TResult>;
2917
+ /**
2918
+ * Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
2919
+ */
2920
+ evalshaRo(keys: string[], args: string[]): Promise<TResult>;
2921
+ /**
2922
+ * Optimistically try to run `EVALSHA_RO` first.
2923
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
2924
+ *
2925
+ * Following calls will be able to use the cached script
2926
+ */
2927
+ exec(keys: string[], args: string[]): Promise<TResult>;
2928
+ /**
2929
+ * Compute the sha1 hash of the script and return its hex representation.
2930
+ */
2931
+ private digest;
2932
+ }
2933
+
2570
2934
  /**
2571
2935
  * Serverless redis client for upstash.
2572
2936
  */
@@ -2587,6 +2951,8 @@ declare class Redis {
2587
2951
  * ```
2588
2952
  */
2589
2953
  constructor(client: Requester, opts?: RedisOptions);
2954
+ get readYourWritesSyncToken(): string | undefined;
2955
+ set readYourWritesSyncToken(session: string | undefined);
2590
2956
  get json(): {
2591
2957
  /**
2592
2958
  * @see https://redis.io/commands/json.arrappend
@@ -2628,10 +2994,18 @@ declare class Redis {
2628
2994
  * @see https://redis.io/commands/json.get
2629
2995
  */
2630
2996
  get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
2997
+ /**
2998
+ * @see https://redis.io/commands/json.merge
2999
+ */
3000
+ merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
2631
3001
  /**
2632
3002
  * @see https://redis.io/commands/json.mget
2633
3003
  */
2634
- mget: <TData_1>(keys: string[], path: string) => Promise<TData_1>;
3004
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
3005
+ /**
3006
+ * @see https://redis.io/commands/json.mset
3007
+ */
3008
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2635
3009
  /**
2636
3010
  * @see https://redis.io/commands/json.numincrby
2637
3011
  */
@@ -2657,9 +3031,9 @@ declare class Redis {
2657
3031
  */
2658
3032
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2659
3033
  nx: true;
2660
- xx?: undefined;
3034
+ xx?: never;
2661
3035
  } | {
2662
- nx?: undefined;
3036
+ nx?: never;
2663
3037
  xx: true;
2664
3038
  } | undefined) => Promise<"OK" | null>;
2665
3039
  /**
@@ -2687,7 +3061,37 @@ declare class Redis {
2687
3061
  * Technically this is not private, we can hide it from intellisense by doing this
2688
3062
  */
2689
3063
  protected addTelemetry: (telemetry: Telemetry) => void;
2690
- createScript(script: string): Script;
3064
+ /**
3065
+ * Creates a new script.
3066
+ *
3067
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
3068
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
3069
+ * the entire script. Afterwards, the script is cached on the server.
3070
+ *
3071
+ * @param script - The script to create
3072
+ * @param opts - Optional options to pass to the script `{ readonly?: boolean }`
3073
+ * @returns A new script
3074
+ *
3075
+ * @example
3076
+ * ```ts
3077
+ * const redis = new Redis({...})
3078
+ *
3079
+ * const script = redis.createScript<string>("return ARGV[1];")
3080
+ * const arg1 = await script.eval([], ["Hello World"])
3081
+ * expect(arg1, "Hello World")
3082
+ * ```
3083
+ * @example
3084
+ * ```ts
3085
+ * const redis = new Redis({...})
3086
+ *
3087
+ * const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
3088
+ * const arg1 = await script.evalRo([], ["Hello World"])
3089
+ * expect(arg1, "Hello World")
3090
+ * ```
3091
+ */
3092
+ createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
3093
+ readonly?: TReadonly;
3094
+ }): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
2691
3095
  /**
2692
3096
  * Create a new pipeline that allows you to send requests in bulk.
2693
3097
  *
@@ -2766,14 +3170,26 @@ declare class Redis {
2766
3170
  * @see https://redis.io/commands/echo
2767
3171
  */
2768
3172
  echo: (message: string) => Promise<string>;
3173
+ /**
3174
+ * @see https://redis.io/commands/eval_ro
3175
+ */
3176
+ evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
2769
3177
  /**
2770
3178
  * @see https://redis.io/commands/eval
2771
3179
  */
2772
3180
  eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
3181
+ /**
3182
+ * @see https://redis.io/commands/evalsha_ro
3183
+ */
3184
+ evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
2773
3185
  /**
2774
3186
  * @see https://redis.io/commands/evalsha
2775
3187
  */
2776
3188
  evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
3189
+ /**
3190
+ * Generic method to execute any Redis command.
3191
+ */
3192
+ exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
2777
3193
  /**
2778
3194
  * @see https://redis.io/commands/exists
2779
3195
  */
@@ -2781,11 +3197,11 @@ declare class Redis {
2781
3197
  /**
2782
3198
  * @see https://redis.io/commands/expire
2783
3199
  */
2784
- expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Promise<0 | 1>;
3200
+ expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
2785
3201
  /**
2786
3202
  * @see https://redis.io/commands/expireat
2787
3203
  */
2788
- expireat: (key: string, unix: number) => Promise<0 | 1>;
3204
+ expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
2789
3205
  /**
2790
3206
  * @see https://redis.io/commands/flushall
2791
3207
  */
@@ -2794,7 +3210,7 @@ declare class Redis {
2794
3210
  * @see https://redis.io/commands/flushdb
2795
3211
  */
2796
3212
  flushdb: (opts?: {
2797
- async?: boolean | undefined;
3213
+ async?: boolean;
2798
3214
  } | undefined) => Promise<"OK">;
2799
3215
  /**
2800
3216
  * @see https://redis.io/commands/geoadd
@@ -2841,11 +3257,11 @@ declare class Redis {
2841
3257
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2842
3258
  count?: {
2843
3259
  limit: number;
2844
- any?: boolean | undefined;
2845
- } | undefined;
2846
- withCoord?: boolean | undefined;
2847
- withDist?: boolean | undefined;
2848
- withHash?: boolean | undefined;
3260
+ any?: boolean;
3261
+ };
3262
+ withCoord?: boolean;
3263
+ withDist?: boolean;
3264
+ withHash?: boolean;
2849
3265
  } | undefined) => Promise<({
2850
3266
  member: TData;
2851
3267
  } & {
@@ -2882,9 +3298,9 @@ declare class Redis {
2882
3298
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2883
3299
  count?: {
2884
3300
  limit: number;
2885
- any?: boolean | undefined;
2886
- } | undefined;
2887
- storeDist?: boolean | undefined;
3301
+ any?: boolean;
3302
+ };
3303
+ storeDist?: boolean;
2888
3304
  } | undefined) => Promise<number>;
2889
3305
  /**
2890
3306
  * @see https://redis.io/commands/get
@@ -2898,6 +3314,46 @@ declare class Redis {
2898
3314
  * @see https://redis.io/commands/getdel
2899
3315
  */
2900
3316
  getdel: <TData>(key: string) => Promise<TData | null>;
3317
+ /**
3318
+ * @see https://redis.io/commands/getex
3319
+ */
3320
+ getex: <TData>(key: string, opts?: ({
3321
+ ex: number;
3322
+ px?: never;
3323
+ exat?: never;
3324
+ pxat?: never;
3325
+ persist?: never;
3326
+ } | {
3327
+ ex?: never;
3328
+ px: number;
3329
+ exat?: never;
3330
+ pxat?: never;
3331
+ persist?: never;
3332
+ } | {
3333
+ ex?: never;
3334
+ px?: never;
3335
+ exat: number;
3336
+ pxat?: never;
3337
+ persist?: never;
3338
+ } | {
3339
+ ex?: never;
3340
+ px?: never;
3341
+ exat?: never;
3342
+ pxat: number;
3343
+ persist?: never;
3344
+ } | {
3345
+ ex?: never;
3346
+ px?: never;
3347
+ exat?: never;
3348
+ pxat?: never;
3349
+ persist: true;
3350
+ } | {
3351
+ ex?: never;
3352
+ px?: never;
3353
+ exat?: never;
3354
+ pxat?: never;
3355
+ persist?: never;
3356
+ }) | undefined) => Promise<TData | null>;
2901
3357
  /**
2902
3358
  * @see https://redis.io/commands/getrange
2903
3359
  */
@@ -2914,6 +3370,42 @@ declare class Redis {
2914
3370
  * @see https://redis.io/commands/hexists
2915
3371
  */
2916
3372
  hexists: (key: string, field: string) => Promise<number>;
3373
+ /**
3374
+ * @see https://redis.io/commands/hexpire
3375
+ */
3376
+ hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3377
+ /**
3378
+ * @see https://redis.io/commands/hexpireat
3379
+ */
3380
+ hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3381
+ /**
3382
+ * @see https://redis.io/commands/hexpiretime
3383
+ */
3384
+ hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3385
+ /**
3386
+ * @see https://redis.io/commands/httl
3387
+ */
3388
+ httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3389
+ /**
3390
+ * @see https://redis.io/commands/hpexpire
3391
+ */
3392
+ hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3393
+ /**
3394
+ * @see https://redis.io/commands/hpexpireat
3395
+ */
3396
+ hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
3397
+ /**
3398
+ * @see https://redis.io/commands/hpexpiretime
3399
+ */
3400
+ hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3401
+ /**
3402
+ * @see https://redis.io/commands/hpttl
3403
+ */
3404
+ hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
3405
+ /**
3406
+ * @see https://redis.io/commands/hpersist
3407
+ */
3408
+ hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
2917
3409
  /**
2918
3410
  * @see https://redis.io/commands/hget
2919
3411
  */
@@ -2945,9 +3437,7 @@ declare class Redis {
2945
3437
  /**
2946
3438
  * @see https://redis.io/commands/hmset
2947
3439
  */
2948
- hmset: <TData>(key: string, kv: {
2949
- [field: string]: TData;
2950
- }) => Promise<"OK">;
3440
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2951
3441
  /**
2952
3442
  * @see https://redis.io/commands/hrandfield
2953
3443
  */
@@ -2963,9 +3453,7 @@ declare class Redis {
2963
3453
  /**
2964
3454
  * @see https://redis.io/commands/hset
2965
3455
  */
2966
- hset: <TData>(key: string, kv: {
2967
- [field: string]: TData;
2968
- }) => Promise<number>;
3456
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2969
3457
  /**
2970
3458
  * @see https://redis.io/commands/hsetnx
2971
3459
  */
@@ -3022,9 +3510,9 @@ declare class Redis {
3022
3510
  * @see https://redis.io/commands/lpos
3023
3511
  */
3024
3512
  lpos: <TData = number>(key: string, element: unknown, opts?: {
3025
- rank?: number | undefined;
3026
- count?: number | undefined;
3027
- maxLen?: number | undefined;
3513
+ rank?: number;
3514
+ count?: number;
3515
+ maxLen?: number;
3028
3516
  } | undefined) => Promise<TData>;
3029
3517
  /**
3030
3518
  * @see https://redis.io/commands/lpush
@@ -3057,15 +3545,11 @@ declare class Redis {
3057
3545
  /**
3058
3546
  * @see https://redis.io/commands/mset
3059
3547
  */
3060
- mset: <TData>(kv: {
3061
- [key: string]: TData;
3062
- }) => Promise<"OK">;
3548
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
3063
3549
  /**
3064
3550
  * @see https://redis.io/commands/msetnx
3065
3551
  */
3066
- msetnx: <TData>(kv: {
3067
- [key: string]: TData;
3068
- }) => Promise<number>;
3552
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
3069
3553
  /**
3070
3554
  * @see https://redis.io/commands/persist
3071
3555
  */
@@ -3073,11 +3557,11 @@ declare class Redis {
3073
3557
  /**
3074
3558
  * @see https://redis.io/commands/pexpire
3075
3559
  */
3076
- pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
3560
+ pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
3077
3561
  /**
3078
3562
  * @see https://redis.io/commands/pexpireat
3079
3563
  */
3080
- pexpireat: (key: string, unix: number) => Promise<0 | 1>;
3564
+ pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
3081
3565
  /**
3082
3566
  * @see https://redis.io/commands/pfadd
3083
3567
  */
@@ -3098,6 +3582,10 @@ declare class Redis {
3098
3582
  * @see https://redis.io/commands/psetex
3099
3583
  */
3100
3584
  psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
3585
+ /**
3586
+ * @see https://redis.io/commands/psubscribe
3587
+ */
3588
+ psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
3101
3589
  /**
3102
3590
  * @see https://redis.io/commands/pttl
3103
3591
  */
@@ -3133,7 +3621,7 @@ declare class Redis {
3133
3621
  /**
3134
3622
  * @see https://redis.io/commands/sadd
3135
3623
  */
3136
- sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
3624
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
3137
3625
  /**
3138
3626
  * @see https://redis.io/commands/scan
3139
3627
  */
@@ -3226,6 +3714,10 @@ declare class Redis {
3226
3714
  * @see https://redis.io/commands/strlen
3227
3715
  */
3228
3716
  strlen: (key: string) => Promise<number>;
3717
+ /**
3718
+ * @see https://redis.io/commands/subscribe
3719
+ */
3720
+ subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
3229
3721
  /**
3230
3722
  * @see https://redis.io/commands/sunion
3231
3723
  */
@@ -3257,11 +3749,9 @@ declare class Redis {
3257
3749
  /**
3258
3750
  * @see https://redis.io/commands/xadd
3259
3751
  */
3260
- xadd: (key: string, id: string, entries: {
3261
- [field: string]: unknown;
3262
- }, opts?: {
3263
- nomkStream?: boolean | undefined;
3264
- trim?: (({
3752
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3753
+ nomkStream?: boolean;
3754
+ trim?: ({
3265
3755
  type: "MAXLEN" | "maxlen";
3266
3756
  threshold: number;
3267
3757
  } | {
@@ -3269,11 +3759,11 @@ declare class Redis {
3269
3759
  threshold: string;
3270
3760
  }) & ({
3271
3761
  comparison: "~";
3272
- limit?: number | undefined;
3762
+ limit?: number;
3273
3763
  } | {
3274
3764
  comparison: "=";
3275
- limit?: undefined;
3276
- })) | undefined;
3765
+ limit?: never;
3766
+ });
3277
3767
  } | undefined) => Promise<string>;
3278
3768
  /**
3279
3769
  * @see https://redis.io/commands/xack
@@ -3289,11 +3779,11 @@ declare class Redis {
3289
3779
  xgroup: (key: string, opts: {
3290
3780
  type: "CREATE";
3291
3781
  group: string;
3292
- id: string;
3782
+ id: `$` | string;
3293
3783
  options?: {
3294
- MKSTREAM?: boolean | undefined;
3295
- ENTRIESREAD?: number | undefined;
3296
- } | undefined;
3784
+ MKSTREAM?: boolean;
3785
+ ENTRIESREAD?: number;
3786
+ };
3297
3787
  } | {
3298
3788
  type: "CREATECONSUMER";
3299
3789
  group: string;
@@ -3308,10 +3798,10 @@ declare class Redis {
3308
3798
  } | {
3309
3799
  type: "SETID";
3310
3800
  group: string;
3311
- id: string;
3801
+ id: `$` | string;
3312
3802
  options?: {
3313
- ENTRIESREAD?: number | undefined;
3314
- } | undefined;
3803
+ ENTRIESREAD?: number;
3804
+ };
3315
3805
  }) => Promise<never>;
3316
3806
  /**
3317
3807
  * @see https://redis.io/commands/xread
@@ -3338,35 +3828,35 @@ declare class Redis {
3338
3828
  * @see https://redis.io/commands/xpending
3339
3829
  */
3340
3830
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3341
- idleTime?: number | undefined;
3342
- consumer?: string | string[] | undefined;
3831
+ idleTime?: number;
3832
+ consumer?: string | string[];
3343
3833
  } | undefined) => Promise<unknown[]>;
3344
3834
  /**
3345
3835
  * @see https://redis.io/commands/xclaim
3346
3836
  */
3347
3837
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3348
- idleMS?: number | undefined;
3349
- timeMS?: number | undefined;
3350
- retryCount?: number | undefined;
3351
- force?: boolean | undefined;
3352
- justId?: boolean | undefined;
3353
- lastId?: number | undefined;
3838
+ idleMS?: number;
3839
+ timeMS?: number;
3840
+ retryCount?: number;
3841
+ force?: boolean;
3842
+ justId?: boolean;
3843
+ lastId?: number;
3354
3844
  } | undefined) => Promise<unknown[]>;
3355
3845
  /**
3356
3846
  * @see https://redis.io/commands/xautoclaim
3357
3847
  */
3358
3848
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3359
- count?: number | undefined;
3360
- justId?: boolean | undefined;
3849
+ count?: number;
3850
+ justId?: boolean;
3361
3851
  } | undefined) => Promise<unknown[]>;
3362
3852
  /**
3363
3853
  * @see https://redis.io/commands/xtrim
3364
3854
  */
3365
3855
  xtrim: (key: string, options: {
3366
3856
  strategy: "MAXLEN" | "MINID";
3367
- exactness?: "~" | "=" | undefined;
3368
- threshold: string | number;
3369
- limit?: number | undefined;
3857
+ exactness?: "~" | "=";
3858
+ threshold: number | string;
3859
+ limit?: number;
3370
3860
  }) => Promise<number>;
3371
3861
  /**
3372
3862
  * @see https://redis.io/commands/xrange
@@ -3379,11 +3869,7 @@ declare class Redis {
3379
3869
  /**
3380
3870
  * @see https://redis.io/commands/zadd
3381
3871
  */
3382
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
3383
- key: string,
3384
- opts: ZAddCommandOptions,
3385
- ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
3386
- ]) => Promise<number | null>;
3872
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3387
3873
  /**
3388
3874
  * @see https://redis.io/commands/zcard
3389
3875
  */
@@ -3423,21 +3909,11 @@ declare class Redis {
3423
3909
  /**
3424
3910
  * @see https://redis.io/commands/zrange
3425
3911
  */
3426
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
3427
- key: string,
3428
- min: `(${string}` | `[${string}` | "-" | "+",
3429
- max: `(${string}` | `[${string}` | "-" | "+",
3430
- opts: {
3431
- byLex: true;
3432
- } & ZRangeCommandOptions
3433
- ] | [
3434
- key: string,
3435
- min: number | `(${number}` | "-inf" | "+inf",
3436
- max: number | `(${number}` | "-inf" | "+inf",
3437
- opts: {
3438
- byScore: true;
3439
- } & ZRangeCommandOptions
3440
- ]) => Promise<TData>;
3912
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3913
+ byLex: true;
3914
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3915
+ byScore: true;
3916
+ } & ZRangeCommandOptions]) => Promise<TData>;
3441
3917
  /**
3442
3918
  * @see https://redis.io/commands/zrank
3443
3919
  */
@@ -3495,10 +3971,7 @@ declare const error_UpstashError: typeof UpstashError;
3495
3971
  type error_UrlError = UrlError;
3496
3972
  declare const error_UrlError: typeof UrlError;
3497
3973
  declare namespace error {
3498
- export {
3499
- error_UpstashError as UpstashError,
3500
- error_UrlError as UrlError,
3501
- };
3974
+ export { error_UpstashError as UpstashError, error_UrlError as UrlError };
3502
3975
  }
3503
3976
 
3504
3977
  /**
@@ -3515,4 +3988,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
3515
3988
  constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3516
3989
  }
3517
3990
 
3518
- export { HValsCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetRangeCommand as H, GetSetCommand as I, HDelCommand as J, HExistsCommand as K, HGetCommand as L, HGetAllCommand as M, HIncrByCommand as N, HIncrByFloatCommand as O, Pipeline as P, HKeysCommand as Q, RedisOptions as R, HLenCommand as S, HMGetCommand as T, UpstashRequest as U, HMSetCommand as V, HRandFieldCommand as W, HScanCommand as X, HSetCommand as Y, HSetNXCommand as Z, HStrLenCommand as _, RequesterConfig as a, SetBitCommand as a$, IncrCommand as a0, IncrByCommand as a1, IncrByFloatCommand as a2, JsonArrAppendCommand as a3, JsonArrIndexCommand as a4, JsonArrInsertCommand as a5, JsonArrLenCommand as a6, JsonArrPopCommand as a7, JsonArrTrimCommand as a8, JsonClearCommand as a9, MGetCommand as aA, MSetCommand as aB, MSetNXCommand as aC, PersistCommand as aD, PExpireCommand as aE, PExpireAtCommand as aF, PingCommand as aG, PSetEXCommand as aH, PTtlCommand as aI, PublishCommand as aJ, RandomKeyCommand as aK, RenameCommand as aL, RenameNXCommand as aM, RPopCommand as aN, RPushCommand as aO, RPushXCommand as aP, SAddCommand as aQ, ScanCommand as aR, ScanCommandOptions as aS, SCardCommand as aT, ScriptExistsCommand as aU, ScriptFlushCommand as aV, ScriptLoadCommand as aW, SDiffCommand as aX, SDiffStoreCommand as aY, SetCommand as aZ, SetCommandOptions as a_, JsonDelCommand as aa, JsonForgetCommand as ab, JsonGetCommand as ac, JsonMGetCommand as ad, JsonNumIncrByCommand as ae, JsonNumMultByCommand as af, JsonObjKeysCommand as ag, JsonObjLenCommand as ah, JsonRespCommand as ai, JsonSetCommand as aj, JsonStrAppendCommand as ak, JsonStrLenCommand as al, JsonToggleCommand as am, JsonTypeCommand as an, KeysCommand as ao, LIndexCommand as ap, LInsertCommand as aq, LLenCommand as ar, LMoveCommand as as, LPopCommand as at, LPushCommand as au, LPushXCommand as av, LRangeCommand as aw, LRemCommand as ax, LSetCommand as ay, LTrimCommand as az, Redis as b, SetExCommand as b0, SetNxCommand as b1, SetRangeCommand as b2, SInterCommand as b3, SInterStoreCommand as b4, SIsMemberCommand as b5, SMembersCommand as b6, SMIsMemberCommand as b7, SMoveCommand as b8, SPopCommand as b9, ZPopMinCommand as bA, ZRangeCommand as bB, ZRangeCommandOptions as bC, ZRankCommand as bD, ZRemCommand as bE, ZRemRangeByLexCommand as bF, ZRemRangeByRankCommand as bG, ZRemRangeByScoreCommand as bH, ZRevRankCommand as bI, ZScanCommand as bJ, ZScoreCommand as bK, ZUnionCommand as bL, ZUnionCommandOptions as bM, ZUnionStoreCommand as bN, ZUnionStoreCommandOptions as bO, SRandMemberCommand as ba, SRemCommand as bb, SScanCommand as bc, StrLenCommand as bd, SUnionCommand as be, SUnionStoreCommand as bf, TimeCommand as bg, TouchCommand as bh, TtlCommand as bi, Type as bj, TypeCommand as bk, UnlinkCommand as bl, XAddCommand as bm, XRangeCommand as bn, ScoreMember as bo, ZAddCommandOptions as bp, ZAddCommand as bq, ZCardCommand as br, ZCountCommand as bs, ZDiffStoreCommand as bt, ZIncrByCommand as bu, ZInterStoreCommand as bv, ZInterStoreCommandOptions as bw, ZLexCountCommand as bx, ZMScoreCommand as by, ZPopMaxCommand as bz, Requester as c, UpstashResponse as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalCommand as k, EvalshaCommand as l, ExistsCommand as m, ExpireCommand as n, ExpireAtCommand as o, FlushDBCommand as p, GeoAddCommandOptions as q, GeoMember as r, GeoDistCommand as s, GeoHashCommand as t, GeoPosCommand as u, GeoSearchCommand as v, GeoSearchStoreCommand as w, GetCommand as x, GetBitCommand as y, GetDelCommand as z };
3991
+ export { HGetCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetCommand as H, GetBitCommand as I, GetDelCommand as J, GetExCommand as K, GetRangeCommand as L, GetSetCommand as M, HDelCommand as N, HExistsCommand as O, Pipeline as P, HExpireCommand as Q, type RedisOptions as R, HExpireAtCommand as S, HExpireTimeCommand as T, type UpstashRequest as U, HTtlCommand as V, HPExpireCommand as W, HPExpireAtCommand as X, HPExpireTimeCommand as Y, HPTtlCommand as Z, HPersistCommand as _, type RequesterConfig as a, RPopCommand as a$, HGetAllCommand as a0, HIncrByCommand as a1, HIncrByFloatCommand as a2, HKeysCommand as a3, HLenCommand as a4, HMGetCommand as a5, HMSetCommand as a6, HRandFieldCommand as a7, HScanCommand as a8, HSetCommand as a9, JsonToggleCommand as aA, JsonTypeCommand as aB, KeysCommand as aC, LIndexCommand as aD, LInsertCommand as aE, LLenCommand as aF, LMoveCommand as aG, LPopCommand as aH, LPushCommand as aI, LPushXCommand as aJ, LRangeCommand as aK, LRemCommand as aL, LSetCommand as aM, LTrimCommand as aN, MGetCommand as aO, MSetCommand as aP, MSetNXCommand as aQ, PersistCommand as aR, PExpireCommand as aS, PExpireAtCommand as aT, PingCommand as aU, PSetEXCommand as aV, PTtlCommand as aW, PublishCommand as aX, RandomKeyCommand as aY, RenameCommand as aZ, RenameNXCommand as a_, HSetNXCommand as aa, HStrLenCommand as ab, HValsCommand as ac, IncrCommand as ad, IncrByCommand as ae, IncrByFloatCommand as af, JsonArrAppendCommand as ag, JsonArrIndexCommand as ah, JsonArrInsertCommand as ai, JsonArrLenCommand as aj, JsonArrPopCommand as ak, JsonArrTrimCommand as al, JsonClearCommand as am, JsonDelCommand as an, JsonForgetCommand as ao, JsonGetCommand as ap, JsonMergeCommand as aq, JsonMGetCommand as ar, JsonNumIncrByCommand as as, JsonNumMultByCommand as at, JsonObjKeysCommand as au, JsonObjLenCommand as av, JsonRespCommand as aw, JsonSetCommand as ax, JsonStrAppendCommand as ay, JsonStrLenCommand as az, Redis as b, ZUnionStoreCommand as b$, RPushCommand as b0, RPushXCommand as b1, SAddCommand as b2, ScanCommand as b3, type ScanCommandOptions as b4, SCardCommand as b5, ScriptExistsCommand as b6, ScriptFlushCommand as b7, ScriptLoadCommand as b8, SDiffCommand as b9, XAddCommand as bA, XRangeCommand as bB, type ScoreMember as bC, type ZAddCommandOptions as bD, ZAddCommand as bE, ZCardCommand as bF, ZCountCommand as bG, ZDiffStoreCommand as bH, ZIncrByCommand as bI, ZInterStoreCommand as bJ, type ZInterStoreCommandOptions as bK, ZLexCountCommand as bL, ZMScoreCommand as bM, ZPopMaxCommand as bN, ZPopMinCommand as bO, ZRangeCommand as bP, type ZRangeCommandOptions as bQ, ZRankCommand as bR, ZRemCommand as bS, ZRemRangeByLexCommand as bT, ZRemRangeByRankCommand as bU, ZRemRangeByScoreCommand as bV, ZRevRankCommand as bW, ZScanCommand as bX, ZScoreCommand as bY, ZUnionCommand as bZ, type ZUnionCommandOptions as b_, SDiffStoreCommand as ba, SetCommand as bb, type SetCommandOptions as bc, SetBitCommand as bd, SetExCommand as be, SetNxCommand as bf, SetRangeCommand as bg, SInterCommand as bh, SInterStoreCommand as bi, SIsMemberCommand as bj, SMembersCommand as bk, SMIsMemberCommand as bl, SMoveCommand as bm, SPopCommand as bn, SRandMemberCommand as bo, SRemCommand as bp, SScanCommand as bq, StrLenCommand as br, SUnionCommand as bs, SUnionStoreCommand as bt, TimeCommand as bu, TouchCommand as bv, TtlCommand as bw, type Type as bx, TypeCommand as by, UnlinkCommand as bz, type UpstashResponse as c, type ZUnionStoreCommandOptions as c0, 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 };