@upstash/redis 0.0.0-ci.9d28f16cfb77ddb9a5d07572b624fe52810a8598-20231109105522 → 0.0.0-ci.9fafb915a788c2b6f147d77e4196e6584993ee2f-20250220115033

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 | {
@@ -106,6 +134,32 @@ type CommandOptions<TResult, TData> = {
106
134
  * @default true
107
135
  */
108
136
  automaticDeserialization?: boolean;
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
+ };
109
163
  };
110
164
  /**
111
165
  * Command offers default (de)serialization and the exec method to all commands.
@@ -117,6 +171,11 @@ declare class Command<TResult, TData> {
117
171
  readonly command: (string | number | boolean)[];
118
172
  readonly serialize: Serialize;
119
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;
120
179
  /**
121
180
  * Create a new command instance.
122
181
  *
@@ -220,8 +279,8 @@ type ScanCommandOptions = {
220
279
  /**
221
280
  * @see https://redis.io/commands/scan
222
281
  */
223
- declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
224
- constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, string[]], [number, string[]]>);
282
+ declare class ScanCommand extends Command<[string, string[]], [string, string[]]> {
283
+ constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], [string, string[]]>);
225
284
  }
226
285
 
227
286
  type GeoAddCommandOptions = {
@@ -233,11 +292,11 @@ type GeoAddCommandOptions = {
233
292
  } & {
234
293
  ch?: boolean;
235
294
  });
236
- interface GeoMember<TMemberType> {
295
+ type GeoMember<TMemberType> = {
237
296
  latitude: number;
238
297
  longitude: number;
239
298
  member: TMemberType;
240
- }
299
+ };
241
300
  /**
242
301
  * @see https://redis.io/commands/geoadd
243
302
  */
@@ -264,6 +323,28 @@ declare class BitCountCommand extends Command<number, number> {
264
323
  constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
265
324
  }
266
325
 
326
+ type SubCommandArgs<TRest extends unknown[] = []> = [
327
+ encoding: string,
328
+ offset: number | string,
329
+ ...rest: TRest
330
+ ];
331
+ /**
332
+ * @see https://redis.io/commands/bitfield
333
+ */
334
+ declare class BitFieldCommand<T = Promise<number[]>> {
335
+ private client;
336
+ private opts?;
337
+ private execOperation;
338
+ private command;
339
+ constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
340
+ private chain;
341
+ get(...args: SubCommandArgs): this;
342
+ set(...args: SubCommandArgs<[value: number]>): this;
343
+ incrby(...args: SubCommandArgs<[increment: number]>): this;
344
+ overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
345
+ exec(): T;
346
+ }
347
+
267
348
  /**
268
349
  * @see https://redis.io/commands/bitop
269
350
  */
@@ -344,11 +425,9 @@ declare class ExistsCommand extends Command<number, number> {
344
425
  constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
345
426
  }
346
427
 
347
- /**
348
- * @see https://redis.io/commands/expire
349
- */
428
+ type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
350
429
  declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
351
- constructor(cmd: [key: string, seconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
430
+ constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
352
431
  }
353
432
 
354
433
  /**
@@ -388,6 +467,13 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
388
467
  ], opts?: CommandOptions<number | null, number | null>);
389
468
  }
390
469
 
470
+ /**
471
+ * @see https://redis.io/commands/geohash
472
+ */
473
+ declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
474
+ constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
475
+ }
476
+
391
477
  type Coordinates = {
392
478
  lng: number;
393
479
  lat: number;
@@ -399,13 +485,6 @@ declare class GeoPosCommand<TMember = string> extends Command<(string | null)[][
399
485
  constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[][], Coordinates[]>);
400
486
  }
401
487
 
402
- /**
403
- * @see https://redis.io/commands/geohash
404
- */
405
- declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
406
- constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
407
- }
408
-
409
488
  type RadiusOptions$1 = "M" | "KM" | "FT" | "MI";
410
489
  type CenterPoint$1<TMemberType> = {
411
490
  type: "FROMMEMBER" | "frommember";
@@ -530,6 +609,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
530
609
  constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
531
610
  }
532
611
 
612
+ type GetExCommandOptions = {
613
+ ex: number;
614
+ px?: never;
615
+ exat?: never;
616
+ pxat?: never;
617
+ persist?: never;
618
+ } | {
619
+ ex?: never;
620
+ px: number;
621
+ exat?: never;
622
+ pxat?: never;
623
+ persist?: never;
624
+ } | {
625
+ ex?: never;
626
+ px?: never;
627
+ exat: number;
628
+ pxat?: never;
629
+ persist?: never;
630
+ } | {
631
+ ex?: never;
632
+ px?: never;
633
+ exat?: never;
634
+ pxat: number;
635
+ persist?: never;
636
+ } | {
637
+ ex?: never;
638
+ px?: never;
639
+ exat?: never;
640
+ pxat?: never;
641
+ persist: true;
642
+ } | {
643
+ ex?: never;
644
+ px?: never;
645
+ exat?: never;
646
+ pxat?: never;
647
+ persist?: never;
648
+ };
649
+ /**
650
+ * @see https://redis.io/commands/getex
651
+ */
652
+ declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
653
+ constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
654
+ }
655
+
533
656
  /**
534
657
  * @see https://redis.io/commands/getrange
535
658
  */
@@ -619,9 +742,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
619
742
  * @see https://redis.io/commands/hmset
620
743
  */
621
744
  declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
622
- constructor([key, kv]: [key: string, kv: {
623
- [field: string]: TData;
624
- }], opts?: CommandOptions<"OK", "OK">);
745
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
625
746
  }
626
747
 
627
748
  /**
@@ -637,22 +758,20 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
637
758
  * @see https://redis.io/commands/hscan
638
759
  */
639
760
  declare class HScanCommand extends Command<[
640
- number,
761
+ string,
641
762
  (string | number)[]
642
763
  ], [
643
- number,
764
+ string,
644
765
  (string | number)[]
645
766
  ]> {
646
- constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
767
+ constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
647
768
  }
648
769
 
649
770
  /**
650
771
  * @see https://redis.io/commands/hset
651
772
  */
652
773
  declare class HSetCommand<TData> extends Command<number, number> {
653
- constructor([key, kv]: [key: string, kv: {
654
- [field: string]: TData;
655
- }], opts?: CommandOptions<number, number>);
774
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
656
775
  }
657
776
 
658
777
  /**
@@ -778,10 +897,21 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
778
897
  /**
779
898
  * @see https://redis.io/commands/json.mget
780
899
  */
781
- declare class JsonMGetCommand<TData extends (unknown | Record<string, unknown>)[]> extends Command<TData, TData> {
900
+ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
782
901
  constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
783
902
  }
784
903
 
904
+ /**
905
+ * @see https://redis.io/commands/json.mset
906
+ */
907
+ declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
908
+ constructor(cmd: {
909
+ key: string;
910
+ path: string;
911
+ value: TData;
912
+ }[], opts?: CommandOptions<"OK" | null, "OK" | null>);
913
+ }
914
+
785
915
  /**
786
916
  * @see https://redis.io/commands/json.numincrby
787
917
  */
@@ -938,25 +1068,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
938
1068
  * @see https://redis.io/commands/mget
939
1069
  */
940
1070
  declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
941
- constructor(cmd: [string[]] | [...(string[] | string[])], opts?: CommandOptions<(string | null)[], TData>);
1071
+ constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
942
1072
  }
943
1073
 
944
1074
  /**
945
1075
  * @see https://redis.io/commands/mset
946
1076
  */
947
1077
  declare class MSetCommand<TData> extends Command<"OK", "OK"> {
948
- constructor([kv]: [kv: {
949
- [key: string]: TData;
950
- }], opts?: CommandOptions<"OK", "OK">);
1078
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
951
1079
  }
952
1080
 
953
1081
  /**
954
1082
  * @see https://redis.io/commands/msetnx
955
1083
  */
956
1084
  declare class MSetNXCommand<TData = string> extends Command<number, number> {
957
- constructor([kv]: [kv: {
958
- [key: string]: TData;
959
- }], opts?: CommandOptions<number, number>);
1085
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
960
1086
  }
961
1087
 
962
1088
  /**
@@ -1054,7 +1180,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
1054
1180
  * @see https://redis.io/commands/sadd
1055
1181
  */
1056
1182
  declare class SAddCommand<TData = string> extends Command<number, number> {
1057
- constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1183
+ constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
1058
1184
  }
1059
1185
 
1060
1186
  /**
@@ -1242,13 +1368,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
1242
1368
  * @see https://redis.io/commands/sscan
1243
1369
  */
1244
1370
  declare class SScanCommand extends Command<[
1245
- number,
1371
+ string,
1246
1372
  (string | number)[]
1247
1373
  ], [
1248
- number,
1374
+ string,
1249
1375
  (string | number)[]
1250
1376
  ]> {
1251
- constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
1377
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1252
1378
  }
1253
1379
 
1254
1380
  /**
@@ -1323,9 +1449,7 @@ declare class XAddCommand extends Command<string, string> {
1323
1449
  constructor([key, id, entries, opts]: [
1324
1450
  key: string,
1325
1451
  id: "*" | string,
1326
- entries: {
1327
- [field: string]: unknown;
1328
- },
1452
+ entries: Record<string, unknown>,
1329
1453
  opts?: XAddCommandOptions
1330
1454
  ], commandOptions?: CommandOptions<string, string>);
1331
1455
  }
@@ -1334,7 +1458,55 @@ declare class XRangeCommand<TData extends Record<string, Record<string, unknown>
1334
1458
  constructor([key, start, end, count]: [key: string, start: string, end: string, count?: number], opts?: CommandOptions<unknown[], TData[]>);
1335
1459
  }
1336
1460
 
1337
- type ZAddCommandOptions = ({
1461
+ type XReadCommandOptions = [
1462
+ key: string | string[],
1463
+ id: string | string[],
1464
+ options?: {
1465
+ count?: number;
1466
+ blockMS?: number;
1467
+ }
1468
+ ];
1469
+ type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [key: string, id: string, options?: {
1470
+ count?: number;
1471
+ blockMS?: number;
1472
+ }] : never : K extends string[] ? I extends string[] ? [key: string[], id: string[], options?: {
1473
+ count?: number;
1474
+ blockMS?: number;
1475
+ }] : never : never : never;
1476
+ /**
1477
+ * @see https://redis.io/commands/xread
1478
+ */
1479
+ declare class XReadCommand extends Command<number, unknown[]> {
1480
+ constructor([key, id, options]: XReadOptions, opts?: CommandOptions<number, unknown[]>);
1481
+ }
1482
+
1483
+ type Options = {
1484
+ count?: number;
1485
+ blockMS?: number;
1486
+ NOACK?: boolean;
1487
+ };
1488
+ type XReadGroupCommandOptions = [
1489
+ group: string,
1490
+ consumer: string,
1491
+ key: string | string[],
1492
+ id: string | string[],
1493
+ options?: Options
1494
+ ];
1495
+ type XReadGroupOptions = XReadGroupCommandOptions extends [
1496
+ string,
1497
+ string,
1498
+ infer TKey,
1499
+ infer TId,
1500
+ ...any[]
1501
+ ] ? TKey extends string ? TId extends string ? [group: string, consumer: string, key: string, id: string, options?: Options] : never : TKey extends string[] ? TId extends string[] ? [group: string, consumer: string, key: string[], id: string[], options?: Options] : never : never : never;
1502
+ /**
1503
+ * @see https://redis.io/commands/xreadgroup
1504
+ */
1505
+ declare class XReadGroupCommand extends Command<number, unknown[]> {
1506
+ constructor([group, consumer, key, id, options]: XReadGroupOptions, opts?: CommandOptions<number, unknown[]>);
1507
+ }
1508
+
1509
+ type NXAndXXOptions = {
1338
1510
  nx: true;
1339
1511
  xx?: never;
1340
1512
  } | {
@@ -1343,12 +1515,23 @@ type ZAddCommandOptions = ({
1343
1515
  } | {
1344
1516
  nx?: never;
1345
1517
  xx?: never;
1346
- }) & {
1347
- ch?: true;
1348
1518
  };
1349
- type ZAddCommandOptionsWithIncr = ZAddCommandOptions & {
1350
- incr: true;
1519
+ type LTAndGTOptions = {
1520
+ lt: true;
1521
+ gt?: never;
1522
+ } | {
1523
+ lt?: never;
1524
+ gt: true;
1525
+ } | {
1526
+ lt?: never;
1527
+ gt?: never;
1528
+ };
1529
+ type ZAddCommandOptions = NXAndXXOptions & LTAndGTOptions & {
1530
+ ch?: true;
1531
+ } & {
1532
+ incr?: true;
1351
1533
  };
1534
+ type Arg2<TData> = ScoreMember<TData> | ZAddCommandOptions;
1352
1535
  type ScoreMember<TData> = {
1353
1536
  score: number;
1354
1537
  member: TData;
@@ -1357,12 +1540,7 @@ type ScoreMember<TData> = {
1357
1540
  * @see https://redis.io/commands/zadd
1358
1541
  */
1359
1542
  declare class ZAddCommand<TData = string> extends Command<number | null, number | null> {
1360
- constructor(cmd: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]], opts?: CommandOptions<number | null, number | null>);
1361
- constructor(cmd: [
1362
- key: string,
1363
- opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr,
1364
- ...scoreMemberPairs: ScoreMember<TData>[]
1365
- ], opts?: CommandOptions<number | null, number | null>);
1543
+ constructor([key, arg1, ...arg2]: [string, Arg2<TData>, ...ScoreMember<TData>[]], opts?: CommandOptions<number | null, number | null>);
1366
1544
  }
1367
1545
 
1368
1546
  /**
@@ -1495,13 +1673,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
1495
1673
  * @see https://redis.io/commands/zscan
1496
1674
  */
1497
1675
  declare class ZScanCommand extends Command<[
1498
- number,
1676
+ string,
1499
1677
  (string | number)[]
1500
1678
  ], [
1501
- number,
1679
+ string,
1502
1680
  (string | number)[]
1503
1681
  ]> {
1504
- constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
1682
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1505
1683
  }
1506
1684
 
1507
1685
  /**
@@ -1511,9 +1689,64 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
1511
1689
  constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
1512
1690
  }
1513
1691
 
1692
+ type MessageEvent = {
1693
+ type: string;
1694
+ data: any;
1695
+ channel?: string;
1696
+ pattern?: string;
1697
+ };
1698
+ type Listener = (event: MessageEvent["data"]) => void;
1699
+ declare class Subscriber extends EventTarget {
1700
+ private subscriptions;
1701
+ private client;
1702
+ private listeners;
1703
+ constructor(client: Requester, channels: string[], isPattern?: boolean);
1704
+ private subscribeToChannel;
1705
+ private subscribeToPattern;
1706
+ private handleMessage;
1707
+ private dispatchToListeners;
1708
+ on(type: string, listener: Listener): void;
1709
+ removeAllListeners(): void;
1710
+ unsubscribe(channels?: string[]): Promise<void>;
1711
+ getSubscribedChannels(): string[];
1712
+ }
1713
+
1514
1714
  type InferResponseData<T extends unknown[]> = {
1515
1715
  [K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
1516
1716
  };
1717
+ interface ExecMethod<TCommands extends Command<any, any>[]> {
1718
+ /**
1719
+ * Send the pipeline request to upstash.
1720
+ *
1721
+ * Returns an array with the results of all pipelined commands.
1722
+ *
1723
+ * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1724
+ * ```ts
1725
+ * const p = redis.pipeline()
1726
+ * p.get("key")
1727
+ * const result = p.exec<[{ greeting: string }]>()
1728
+ * ```
1729
+ *
1730
+ * 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.
1731
+ *
1732
+ * 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 }`.
1733
+ *
1734
+ * ```ts
1735
+ * const p = redis.pipeline()
1736
+ * p.get("key")
1737
+ *
1738
+ * const result = await p.exec({ keepErrors: true });
1739
+ * const getResult = result[0].result
1740
+ * const getError = result[0].error
1741
+ * ```
1742
+ */
1743
+ <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
1744
+ <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
1745
+ keepErrors: true;
1746
+ }): Promise<{
1747
+ [K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
1748
+ }>;
1749
+ }
1517
1750
  /**
1518
1751
  * Upstash REST API supports command pipelining to send multiple commands in
1519
1752
  * batch, instead of sending each command one by one and waiting for a response.
@@ -1562,19 +1795,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1562
1795
  commandOptions?: CommandOptions<any, any>;
1563
1796
  multiExec?: boolean;
1564
1797
  });
1565
- /**
1566
- * Send the pipeline request to upstash.
1567
- *
1568
- * Returns an array with the results of all pipelined commands.
1569
- *
1570
- * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1571
- * ```ts
1572
- * const p = redis.pipeline()
1573
- * p.get("key")
1574
- * const result = p.exec<[{ greeting: string }]>()
1575
- * ```
1576
- */
1577
- exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
1798
+ exec: ExecMethod<TCommands>;
1578
1799
  /**
1579
1800
  * Returns the length of pipeline before the execution
1580
1801
  */
@@ -1592,6 +1813,23 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1592
1813
  * @see https://redis.io/commands/bitcount
1593
1814
  */
1594
1815
  bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
1816
+ /**
1817
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
1818
+ *
1819
+ * @example
1820
+ * ```typescript
1821
+ * redis.set("mykey", 0);
1822
+ * const result = await redis.pipeline()
1823
+ * .bitfield("mykey")
1824
+ * .set("u4", 0, 16)
1825
+ * .incr("u4", "#1", 1)
1826
+ * .exec();
1827
+ * console.log(result); // [[0, 1]]
1828
+ * ```
1829
+ *
1830
+ * @see https://redis.io/commands/bitfield
1831
+ */
1832
+ bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
1595
1833
  /**
1596
1834
  * @see https://redis.io/commands/bitop
1597
1835
  */
@@ -1648,7 +1886,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1648
1886
  /**
1649
1887
  * @see https://redis.io/commands/expire
1650
1888
  */
1651
- expire: (key: string, seconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1889
+ expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1652
1890
  /**
1653
1891
  * @see https://redis.io/commands/expireat
1654
1892
  */
@@ -1661,8 +1899,98 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1661
1899
  * @see https://redis.io/commands/flushdb
1662
1900
  */
1663
1901
  flushdb: (opts?: {
1664
- async?: boolean | undefined;
1902
+ async?: boolean;
1665
1903
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1904
+ /**
1905
+ * @see https://redis.io/commands/geoadd
1906
+ */
1907
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
1908
+ /**
1909
+ * @see https://redis.io/commands/geodist
1910
+ */
1911
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
1912
+ /**
1913
+ * @see https://redis.io/commands/geopos
1914
+ */
1915
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
1916
+ lng: number;
1917
+ lat: number;
1918
+ }[]>]>;
1919
+ /**
1920
+ * @see https://redis.io/commands/geohash
1921
+ */
1922
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
1923
+ /**
1924
+ * @see https://redis.io/commands/geosearch
1925
+ */
1926
+ geosearch: <TData>(key: string, centerPoint: {
1927
+ type: "FROMLONLAT" | "fromlonlat";
1928
+ coordinate: {
1929
+ lon: number;
1930
+ lat: number;
1931
+ };
1932
+ } | {
1933
+ type: "FROMMEMBER" | "frommember";
1934
+ member: TData;
1935
+ }, shape: {
1936
+ type: "BYRADIUS" | "byradius";
1937
+ radius: number;
1938
+ radiusType: "M" | "KM" | "FT" | "MI";
1939
+ } | {
1940
+ type: "BYBOX" | "bybox";
1941
+ rect: {
1942
+ width: number;
1943
+ height: number;
1944
+ };
1945
+ rectType: "M" | "KM" | "FT" | "MI";
1946
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1947
+ count?: {
1948
+ limit: number;
1949
+ any?: boolean;
1950
+ };
1951
+ withCoord?: boolean;
1952
+ withDist?: boolean;
1953
+ withHash?: boolean;
1954
+ } | undefined) => Pipeline<[...TCommands, Command<any, ({
1955
+ member: TData;
1956
+ } & {
1957
+ coord?: {
1958
+ long: number;
1959
+ lat: number;
1960
+ } | undefined;
1961
+ dist?: number | undefined;
1962
+ hash?: string | undefined;
1963
+ })[]>]>;
1964
+ /**
1965
+ * @see https://redis.io/commands/geosearchstore
1966
+ */
1967
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
1968
+ type: "FROMLONLAT" | "fromlonlat";
1969
+ coordinate: {
1970
+ lon: number;
1971
+ lat: number;
1972
+ };
1973
+ } | {
1974
+ type: "FROMMEMBER" | "frommember";
1975
+ member: TData;
1976
+ }, shape: {
1977
+ type: "BYRADIUS" | "byradius";
1978
+ radius: number;
1979
+ radiusType: "M" | "KM" | "FT" | "MI";
1980
+ } | {
1981
+ type: "BYBOX" | "bybox";
1982
+ rect: {
1983
+ width: number;
1984
+ height: number;
1985
+ };
1986
+ rectType: "M" | "KM" | "FT" | "MI";
1987
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1988
+ count?: {
1989
+ limit: number;
1990
+ any?: boolean;
1991
+ };
1992
+ storeDist?: boolean;
1993
+ } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1666
1994
  /**
1667
1995
  * @see https://redis.io/commands/get
1668
1996
  */
@@ -1675,6 +2003,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1675
2003
  * @see https://redis.io/commands/getdel
1676
2004
  */
1677
2005
  getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2006
+ /**
2007
+ * @see https://redis.io/commands/getex
2008
+ */
2009
+ getex: <TData>(key: string, opts?: ({
2010
+ ex: number;
2011
+ px?: never;
2012
+ exat?: never;
2013
+ pxat?: never;
2014
+ persist?: never;
2015
+ } | {
2016
+ ex?: never;
2017
+ px: number;
2018
+ exat?: never;
2019
+ pxat?: never;
2020
+ persist?: never;
2021
+ } | {
2022
+ ex?: never;
2023
+ px?: never;
2024
+ exat: number;
2025
+ pxat?: never;
2026
+ persist?: never;
2027
+ } | {
2028
+ ex?: never;
2029
+ px?: never;
2030
+ exat?: never;
2031
+ pxat: number;
2032
+ persist?: never;
2033
+ } | {
2034
+ ex?: never;
2035
+ px?: never;
2036
+ exat?: never;
2037
+ pxat?: never;
2038
+ persist: true;
2039
+ } | {
2040
+ ex?: never;
2041
+ px?: never;
2042
+ exat?: never;
2043
+ pxat?: never;
2044
+ persist?: never;
2045
+ }) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1678
2046
  /**
1679
2047
  * @see https://redis.io/commands/getrange
1680
2048
  */
@@ -1722,9 +2090,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1722
2090
  /**
1723
2091
  * @see https://redis.io/commands/hmset
1724
2092
  */
1725
- hmset: <TData>(key: string, kv: {
1726
- [field: string]: TData;
1727
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2093
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1728
2094
  /**
1729
2095
  * @see https://redis.io/commands/hrandfield
1730
2096
  */
@@ -1732,13 +2098,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1732
2098
  /**
1733
2099
  * @see https://redis.io/commands/hscan
1734
2100
  */
1735
- hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2101
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
1736
2102
  /**
1737
2103
  * @see https://redis.io/commands/hset
1738
2104
  */
1739
- hset: <TData>(key: string, kv: {
1740
- [field: string]: TData;
1741
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2105
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1742
2106
  /**
1743
2107
  * @see https://redis.io/commands/hsetnx
1744
2108
  */
@@ -1787,13 +2151,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1787
2151
  * @see https://redis.io/commands/lpop
1788
2152
  */
1789
2153
  lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2154
+ /**
2155
+ * @see https://redis.io/commands/lmpop
2156
+ */
2157
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
1790
2158
  /**
1791
2159
  * @see https://redis.io/commands/lpos
1792
2160
  */
1793
2161
  lpos: <TData>(key: string, element: unknown, opts?: {
1794
- rank?: number | undefined;
1795
- count?: number | undefined;
1796
- maxLen?: number | undefined;
2162
+ rank?: number;
2163
+ count?: number;
2164
+ maxLen?: number;
1797
2165
  } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
1798
2166
  /**
1799
2167
  * @see https://redis.io/commands/lpush
@@ -1826,15 +2194,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1826
2194
  /**
1827
2195
  * @see https://redis.io/commands/mset
1828
2196
  */
1829
- mset: <TData>(kv: {
1830
- [key: string]: TData;
1831
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2197
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1832
2198
  /**
1833
2199
  * @see https://redis.io/commands/msetnx
1834
2200
  */
1835
- msetnx: <TData>(kv: {
1836
- [key: string]: TData;
1837
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2201
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1838
2202
  /**
1839
2203
  * @see https://redis.io/commands/persist
1840
2204
  */
@@ -1848,8 +2212,8 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1848
2212
  */
1849
2213
  pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1850
2214
  /**
1851
- * @see https://redis.io/commands/pfadd
1852
- */
2215
+ * @see https://redis.io/commands/pfadd
2216
+ */
1853
2217
  pfadd: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, number>]>;
1854
2218
  /**
1855
2219
  * @see https://redis.io/commands/pfcount
@@ -1902,11 +2266,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1902
2266
  /**
1903
2267
  * @see https://redis.io/commands/sadd
1904
2268
  */
1905
- sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2269
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
1906
2270
  /**
1907
2271
  * @see https://redis.io/commands/scan
1908
2272
  */
1909
- scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, string[]]>]>;
2273
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, string[]]>]>;
1910
2274
  /**
1911
2275
  * @see https://redis.io/commands/scard
1912
2276
  */
@@ -1987,7 +2351,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1987
2351
  /**
1988
2352
  * @see https://redis.io/commands/sscan
1989
2353
  */
1990
- sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2354
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
1991
2355
  /**
1992
2356
  * @see https://redis.io/commands/strlen
1993
2357
  */
@@ -2023,7 +2387,127 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2023
2387
  /**
2024
2388
  * @see https://redis.io/commands/zadd
2025
2389
  */
2026
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2390
+ 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>]>;
2391
+ /**
2392
+ * @see https://redis.io/commands/xadd
2393
+ */
2394
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2395
+ nomkStream?: boolean;
2396
+ trim?: ({
2397
+ type: "MAXLEN" | "maxlen";
2398
+ threshold: number;
2399
+ } | {
2400
+ type: "MINID" | "minid";
2401
+ threshold: string;
2402
+ }) & ({
2403
+ comparison: "~";
2404
+ limit?: number;
2405
+ } | {
2406
+ comparison: "=";
2407
+ limit?: never;
2408
+ });
2409
+ } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2410
+ /**
2411
+ * @see https://redis.io/commands/xack
2412
+ */
2413
+ xack: (key: string, group: string, id: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2414
+ /**
2415
+ * @see https://redis.io/commands/xdel
2416
+ */
2417
+ xdel: (key: string, ids: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2418
+ /**
2419
+ * @see https://redis.io/commands/xgroup
2420
+ */
2421
+ xgroup: (key: string, opts: {
2422
+ type: "CREATE";
2423
+ group: string;
2424
+ id: `$` | string;
2425
+ options?: {
2426
+ MKSTREAM?: boolean;
2427
+ ENTRIESREAD?: number;
2428
+ };
2429
+ } | {
2430
+ type: "CREATECONSUMER";
2431
+ group: string;
2432
+ consumer: string;
2433
+ } | {
2434
+ type: "DELCONSUMER";
2435
+ group: string;
2436
+ consumer: string;
2437
+ } | {
2438
+ type: "DESTROY";
2439
+ group: string;
2440
+ } | {
2441
+ type: "SETID";
2442
+ group: string;
2443
+ id: `$` | string;
2444
+ options?: {
2445
+ ENTRIESREAD?: number;
2446
+ };
2447
+ }) => Pipeline<[...TCommands, Command<any, never>]>;
2448
+ /**
2449
+ * @see https://redis.io/commands/xread
2450
+ */
2451
+ xread: (...args: CommandArgs<typeof XReadCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2452
+ /**
2453
+ * @see https://redis.io/commands/xreadgroup
2454
+ */
2455
+ xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2456
+ /**
2457
+ * @see https://redis.io/commands/xinfo
2458
+ */
2459
+ xinfo: (key: string, options: {
2460
+ type: "CONSUMERS";
2461
+ group: string;
2462
+ } | {
2463
+ type: "GROUPS";
2464
+ }) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2465
+ /**
2466
+ * @see https://redis.io/commands/xlen
2467
+ */
2468
+ xlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2469
+ /**
2470
+ * @see https://redis.io/commands/xpending
2471
+ */
2472
+ xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2473
+ idleTime?: number;
2474
+ consumer?: string | string[];
2475
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2476
+ /**
2477
+ * @see https://redis.io/commands/xclaim
2478
+ */
2479
+ xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2480
+ idleMS?: number;
2481
+ timeMS?: number;
2482
+ retryCount?: number;
2483
+ force?: boolean;
2484
+ justId?: boolean;
2485
+ lastId?: number;
2486
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2487
+ /**
2488
+ * @see https://redis.io/commands/xautoclaim
2489
+ */
2490
+ xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2491
+ count?: number;
2492
+ justId?: boolean;
2493
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2494
+ /**
2495
+ * @see https://redis.io/commands/xtrim
2496
+ */
2497
+ xtrim: (key: string, options: {
2498
+ strategy: "MAXLEN" | "MINID";
2499
+ exactness?: "~" | "=";
2500
+ threshold: number | string;
2501
+ limit?: number;
2502
+ }) => Pipeline<[...TCommands, Command<any, number>]>;
2503
+ /**
2504
+ * @see https://redis.io/commands/xrange
2505
+ */
2506
+ xrange: (key: string, start: string, end: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
2507
+ /**
2508
+ * @see https://redis.io/commands/xrevrange
2509
+ */
2510
+ xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
2027
2511
  /**
2028
2512
  * @see https://redis.io/commands/zcard
2029
2513
  */
@@ -2059,21 +2543,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2059
2543
  /**
2060
2544
  * @see https://redis.io/commands/zrange
2061
2545
  */
2062
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
2063
- key: string,
2064
- min: `(${string}` | `[${string}` | "-" | "+",
2065
- max: `(${string}` | `[${string}` | "-" | "+",
2066
- opts: {
2067
- byLex: true;
2068
- } & ZRangeCommandOptions
2069
- ] | [
2070
- key: string,
2071
- min: number | `(${number}` | "-inf" | "+inf",
2072
- max: number | `(${number}` | "-inf" | "+inf",
2073
- opts: {
2074
- byScore: true;
2075
- } & ZRangeCommandOptions
2076
- ]) => Pipeline<[...TCommands, Command<any, TData>]>;
2546
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
2547
+ byLex: true;
2548
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
2549
+ byScore: true;
2550
+ } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
2077
2551
  /**
2078
2552
  * @see https://redis.io/commands/zrank
2079
2553
  */
@@ -2101,7 +2575,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2101
2575
  /**
2102
2576
  * @see https://redis.io/commands/zscan
2103
2577
  */
2104
- zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2578
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2105
2579
  /**
2106
2580
  * @see https://redis.io/commands/zscore
2107
2581
  */
@@ -2154,96 +2628,6 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2154
2628
  * @see https://redis.io/commands/json.forget
2155
2629
  */
2156
2630
  forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2157
- /**
2158
- * @see https://redis.io/commands/geoadd
2159
- */
2160
- geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2161
- /**
2162
- * @see https://redis.io/commands/geodist
2163
- */
2164
- geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
2165
- /**
2166
- * @see https://redis.io/commands/geopos
2167
- */
2168
- geopos: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, {
2169
- lng: number;
2170
- lat: number;
2171
- }[]>]>;
2172
- /**
2173
- * @see https://redis.io/commands/geohash
2174
- */
2175
- geohash: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
2176
- /**
2177
- * @see https://redis.io/commands/geosearch
2178
- */
2179
- geosearch: (key: string, centerPoint: {
2180
- type: "FROMLONLAT" | "fromlonlat";
2181
- coordinate: {
2182
- lon: number;
2183
- lat: number;
2184
- };
2185
- } | {
2186
- type: "FROMMEMBER" | "frommember";
2187
- member: unknown;
2188
- }, shape: {
2189
- type: "BYRADIUS" | "byradius";
2190
- radius: number;
2191
- radiusType: "M" | "KM" | "FT" | "MI";
2192
- } | {
2193
- type: "BYBOX" | "bybox";
2194
- rect: {
2195
- width: number;
2196
- height: number;
2197
- };
2198
- rectType: "M" | "KM" | "FT" | "MI";
2199
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2200
- count?: {
2201
- limit: number;
2202
- any?: boolean | undefined;
2203
- } | undefined;
2204
- withCoord?: boolean | undefined;
2205
- withDist?: boolean | undefined;
2206
- withHash?: boolean | undefined;
2207
- } | undefined) => Pipeline<[...TCommands, Command<any, ({
2208
- member: unknown;
2209
- } & {
2210
- coord?: {
2211
- long: number;
2212
- lat: number;
2213
- } | undefined;
2214
- dist?: number | undefined;
2215
- hash?: string | undefined;
2216
- })[]>]>;
2217
- /**
2218
- * @see https://redis.io/commands/geosearchstore
2219
- */
2220
- geosearchstore: (destination: string, key: string, centerPoint: {
2221
- type: "FROMLONLAT" | "fromlonlat";
2222
- coordinate: {
2223
- lon: number;
2224
- lat: number;
2225
- };
2226
- } | {
2227
- type: "FROMMEMBER" | "frommember";
2228
- member: unknown;
2229
- }, shape: {
2230
- type: "BYRADIUS" | "byradius";
2231
- radius: number;
2232
- radiusType: "M" | "KM" | "FT" | "MI";
2233
- } | {
2234
- type: "BYBOX" | "bybox";
2235
- rect: {
2236
- width: number;
2237
- height: number;
2238
- };
2239
- rectType: "M" | "KM" | "FT" | "MI";
2240
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2241
- count?: {
2242
- limit: number;
2243
- any?: boolean | undefined;
2244
- } | undefined;
2245
- storeDist?: boolean | undefined;
2246
- } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2247
2631
  /**
2248
2632
  * @see https://redis.io/commands/json.get
2249
2633
  */
@@ -2252,6 +2636,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2252
2636
  * @see https://redis.io/commands/json.mget
2253
2637
  */
2254
2638
  mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
2639
+ /**
2640
+ * @see https://redis.io/commands/json.mset
2641
+ */
2642
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2255
2643
  /**
2256
2644
  * @see https://redis.io/commands/json.numincrby
2257
2645
  */
@@ -2277,9 +2665,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2277
2665
  */
2278
2666
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2279
2667
  nx: true;
2280
- xx?: undefined;
2668
+ xx?: never;
2281
2669
  } | {
2282
- nx?: undefined;
2670
+ nx?: never;
2283
2671
  xx: true;
2284
2672
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2285
2673
  /**
@@ -2350,6 +2738,7 @@ declare class Redis {
2350
2738
  protected client: Requester;
2351
2739
  protected opts?: CommandOptions<any, any>;
2352
2740
  protected enableTelemetry: boolean;
2741
+ protected enableAutoPipelining: boolean;
2353
2742
  /**
2354
2743
  * Create a new redis client
2355
2744
  *
@@ -2362,6 +2751,8 @@ declare class Redis {
2362
2751
  * ```
2363
2752
  */
2364
2753
  constructor(client: Requester, opts?: RedisOptions);
2754
+ get readYourWritesSyncToken(): string | undefined;
2755
+ set readYourWritesSyncToken(session: string | undefined);
2365
2756
  get json(): {
2366
2757
  /**
2367
2758
  * @see https://redis.io/commands/json.arrappend
@@ -2399,104 +2790,18 @@ declare class Redis {
2399
2790
  * @see https://redis.io/commands/json.forget
2400
2791
  */
2401
2792
  forget: (key: string, path?: string | undefined) => Promise<number>;
2402
- /**
2403
- * @see https://redis.io/commands/geoadd
2404
- */
2405
- geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Promise<number | null>;
2406
- /**
2407
- * @see https://redis.io/commands/geopos
2408
- */
2409
- geopos: (args_0: string, ...args_1: unknown[]) => Promise<{
2410
- lng: number;
2411
- lat: number;
2412
- }[]>;
2413
- /**
2414
- * @see https://redis.io/commands/geodist
2415
- */
2416
- geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2417
- /**
2418
- * @see https://redis.io/commands/geohash
2419
- */
2420
- geohash: (args_0: string, ...args_1: unknown[]) => Promise<(string | null)[]>;
2421
- /**
2422
- * @see https://redis.io/commands/geosearch
2423
- */
2424
- geosearch: (key: string, centerPoint: {
2425
- type: "FROMLONLAT" | "fromlonlat";
2426
- coordinate: {
2427
- lon: number;
2428
- lat: number;
2429
- };
2430
- } | {
2431
- type: "FROMMEMBER" | "frommember";
2432
- member: unknown;
2433
- }, shape: {
2434
- type: "BYRADIUS" | "byradius";
2435
- radius: number;
2436
- radiusType: "M" | "KM" | "FT" | "MI";
2437
- } | {
2438
- type: "BYBOX" | "bybox";
2439
- rect: {
2440
- width: number;
2441
- height: number;
2442
- };
2443
- rectType: "M" | "KM" | "FT" | "MI";
2444
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2445
- count?: {
2446
- limit: number;
2447
- any?: boolean | undefined;
2448
- } | undefined;
2449
- withCoord?: boolean | undefined;
2450
- withDist?: boolean | undefined;
2451
- withHash?: boolean | undefined;
2452
- } | undefined) => Promise<({
2453
- member: unknown;
2454
- } & {
2455
- coord?: {
2456
- long: number;
2457
- lat: number;
2458
- } | undefined;
2459
- dist?: number | undefined;
2460
- hash?: string | undefined;
2461
- })[]>;
2462
- /**
2463
- * @see https://redis.io/commands/geosearchstore
2464
- */
2465
- geosearchstore: (destination: string, key: string, centerPoint: {
2466
- type: "FROMLONLAT" | "fromlonlat";
2467
- coordinate: {
2468
- lon: number;
2469
- lat: number;
2470
- };
2471
- } | {
2472
- type: "FROMMEMBER" | "frommember";
2473
- member: unknown;
2474
- }, shape: {
2475
- type: "BYRADIUS" | "byradius";
2476
- radius: number;
2477
- radiusType: "M" | "KM" | "FT" | "MI";
2478
- } | {
2479
- type: "BYBOX" | "bybox";
2480
- rect: {
2481
- width: number;
2482
- height: number;
2483
- };
2484
- rectType: "M" | "KM" | "FT" | "MI";
2485
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2486
- count?: {
2487
- limit: number;
2488
- any?: boolean | undefined;
2489
- } | undefined;
2490
- storeDist?: boolean | undefined;
2491
- } | undefined) => Promise<number>;
2492
2793
  /**
2493
2794
  * @see https://redis.io/commands/json.get
2494
2795
  */
2495
- get: (...args: CommandArgs<typeof JsonGetCommand>) => Promise<any>;
2796
+ get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
2496
2797
  /**
2497
2798
  * @see https://redis.io/commands/json.mget
2498
2799
  */
2499
- mget: (keys: string[], path: string) => Promise<any>;
2800
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
2801
+ /**
2802
+ * @see https://redis.io/commands/json.mset
2803
+ */
2804
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2500
2805
  /**
2501
2806
  * @see https://redis.io/commands/json.numincrby
2502
2807
  */
@@ -2522,9 +2827,9 @@ declare class Redis {
2522
2827
  */
2523
2828
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2524
2829
  nx: true;
2525
- xx?: undefined;
2830
+ xx?: never;
2526
2831
  } | {
2527
- nx?: undefined;
2832
+ nx?: never;
2528
2833
  xx: true;
2529
2834
  } | undefined) => Promise<"OK" | null>;
2530
2835
  /**
@@ -2559,6 +2864,7 @@ declare class Redis {
2559
2864
  * @see {@link Pipeline}
2560
2865
  */
2561
2866
  pipeline: () => Pipeline<[]>;
2867
+ protected autoPipeline: () => Redis;
2562
2868
  /**
2563
2869
  * Create a new transaction to allow executing multiple steps atomically.
2564
2870
  *
@@ -2569,6 +2875,22 @@ declare class Redis {
2569
2875
  * @see {@link Pipeline}
2570
2876
  */
2571
2877
  multi: () => Pipeline<[]>;
2878
+ /**
2879
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
2880
+ *
2881
+ * @example
2882
+ * ```typescript
2883
+ * redis.set("mykey", 0);
2884
+ * const result = await redis.bitfield("mykey")
2885
+ * .set("u4", 0, 16)
2886
+ * .incr("u4", "#1", 1)
2887
+ * .exec();
2888
+ * console.log(result); // [0, 1]
2889
+ * ```
2890
+ *
2891
+ * @see https://redis.io/commands/bitfield
2892
+ */
2893
+ bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
2572
2894
  /**
2573
2895
  * @see https://redis.io/commands/append
2574
2896
  */
@@ -2622,6 +2944,10 @@ declare class Redis {
2622
2944
  * @see https://redis.io/commands/evalsha
2623
2945
  */
2624
2946
  evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
2947
+ /**
2948
+ * Generic method to execute any Redis command.
2949
+ */
2950
+ exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
2625
2951
  /**
2626
2952
  * @see https://redis.io/commands/exists
2627
2953
  */
@@ -2629,7 +2955,7 @@ declare class Redis {
2629
2955
  /**
2630
2956
  * @see https://redis.io/commands/expire
2631
2957
  */
2632
- expire: (key: string, seconds: number) => Promise<0 | 1>;
2958
+ expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Promise<0 | 1>;
2633
2959
  /**
2634
2960
  * @see https://redis.io/commands/expireat
2635
2961
  */
@@ -2642,8 +2968,98 @@ declare class Redis {
2642
2968
  * @see https://redis.io/commands/flushdb
2643
2969
  */
2644
2970
  flushdb: (opts?: {
2645
- async?: boolean | undefined;
2971
+ async?: boolean;
2646
2972
  } | undefined) => Promise<"OK">;
2973
+ /**
2974
+ * @see https://redis.io/commands/geoadd
2975
+ */
2976
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
2977
+ /**
2978
+ * @see https://redis.io/commands/geopos
2979
+ */
2980
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
2981
+ lng: number;
2982
+ lat: number;
2983
+ }[]>;
2984
+ /**
2985
+ * @see https://redis.io/commands/geodist
2986
+ */
2987
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2988
+ /**
2989
+ * @see https://redis.io/commands/geohash
2990
+ */
2991
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
2992
+ /**
2993
+ * @see https://redis.io/commands/geosearch
2994
+ */
2995
+ geosearch: <TData>(key: string, centerPoint: {
2996
+ type: "FROMLONLAT" | "fromlonlat";
2997
+ coordinate: {
2998
+ lon: number;
2999
+ lat: number;
3000
+ };
3001
+ } | {
3002
+ type: "FROMMEMBER" | "frommember";
3003
+ member: TData;
3004
+ }, shape: {
3005
+ type: "BYRADIUS" | "byradius";
3006
+ radius: number;
3007
+ radiusType: "M" | "KM" | "FT" | "MI";
3008
+ } | {
3009
+ type: "BYBOX" | "bybox";
3010
+ rect: {
3011
+ width: number;
3012
+ height: number;
3013
+ };
3014
+ rectType: "M" | "KM" | "FT" | "MI";
3015
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
3016
+ count?: {
3017
+ limit: number;
3018
+ any?: boolean;
3019
+ };
3020
+ withCoord?: boolean;
3021
+ withDist?: boolean;
3022
+ withHash?: boolean;
3023
+ } | undefined) => Promise<({
3024
+ member: TData;
3025
+ } & {
3026
+ coord?: {
3027
+ long: number;
3028
+ lat: number;
3029
+ } | undefined;
3030
+ dist?: number | undefined;
3031
+ hash?: string | undefined;
3032
+ })[]>;
3033
+ /**
3034
+ * @see https://redis.io/commands/geosearchstore
3035
+ */
3036
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
3037
+ type: "FROMLONLAT" | "fromlonlat";
3038
+ coordinate: {
3039
+ lon: number;
3040
+ lat: number;
3041
+ };
3042
+ } | {
3043
+ type: "FROMMEMBER" | "frommember";
3044
+ member: TData;
3045
+ }, shape: {
3046
+ type: "BYRADIUS" | "byradius";
3047
+ radius: number;
3048
+ radiusType: "M" | "KM" | "FT" | "MI";
3049
+ } | {
3050
+ type: "BYBOX" | "bybox";
3051
+ rect: {
3052
+ width: number;
3053
+ height: number;
3054
+ };
3055
+ rectType: "M" | "KM" | "FT" | "MI";
3056
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
3057
+ count?: {
3058
+ limit: number;
3059
+ any?: boolean;
3060
+ };
3061
+ storeDist?: boolean;
3062
+ } | undefined) => Promise<number>;
2647
3063
  /**
2648
3064
  * @see https://redis.io/commands/get
2649
3065
  */
@@ -2656,6 +3072,46 @@ declare class Redis {
2656
3072
  * @see https://redis.io/commands/getdel
2657
3073
  */
2658
3074
  getdel: <TData>(key: string) => Promise<TData | null>;
3075
+ /**
3076
+ * @see https://redis.io/commands/getex
3077
+ */
3078
+ getex: <TData>(key: string, opts?: ({
3079
+ ex: number;
3080
+ px?: never;
3081
+ exat?: never;
3082
+ pxat?: never;
3083
+ persist?: never;
3084
+ } | {
3085
+ ex?: never;
3086
+ px: number;
3087
+ exat?: never;
3088
+ pxat?: never;
3089
+ persist?: never;
3090
+ } | {
3091
+ ex?: never;
3092
+ px?: never;
3093
+ exat: number;
3094
+ pxat?: never;
3095
+ persist?: never;
3096
+ } | {
3097
+ ex?: never;
3098
+ px?: never;
3099
+ exat?: never;
3100
+ pxat: number;
3101
+ persist?: never;
3102
+ } | {
3103
+ ex?: never;
3104
+ px?: never;
3105
+ exat?: never;
3106
+ pxat?: never;
3107
+ persist: true;
3108
+ } | {
3109
+ ex?: never;
3110
+ px?: never;
3111
+ exat?: never;
3112
+ pxat?: never;
3113
+ persist?: never;
3114
+ }) | undefined) => Promise<TData | null>;
2659
3115
  /**
2660
3116
  * @see https://redis.io/commands/getrange
2661
3117
  */
@@ -2703,27 +3159,23 @@ declare class Redis {
2703
3159
  /**
2704
3160
  * @see https://redis.io/commands/hmset
2705
3161
  */
2706
- hmset: <TData>(key: string, kv: {
2707
- [field: string]: TData;
2708
- }) => Promise<"OK">;
3162
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2709
3163
  /**
2710
3164
  * @see https://redis.io/commands/hrandfield
2711
3165
  */
2712
3166
  hrandfield: {
2713
- (key: string): Promise<string>;
3167
+ (key: string): Promise<string | null>;
2714
3168
  (key: string, count: number): Promise<string[]>;
2715
3169
  <TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
2716
3170
  };
2717
3171
  /**
2718
3172
  * @see https://redis.io/commands/hscan
2719
3173
  */
2720
- hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3174
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
2721
3175
  /**
2722
3176
  * @see https://redis.io/commands/hset
2723
3177
  */
2724
- hset: <TData>(key: string, kv: {
2725
- [field: string]: TData;
2726
- }) => Promise<number>;
3178
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2727
3179
  /**
2728
3180
  * @see https://redis.io/commands/hsetnx
2729
3181
  */
@@ -2772,13 +3224,17 @@ declare class Redis {
2772
3224
  * @see https://redis.io/commands/lpop
2773
3225
  */
2774
3226
  lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3227
+ /**
3228
+ * @see https://redis.io/commands/lmpop
3229
+ */
3230
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
2775
3231
  /**
2776
3232
  * @see https://redis.io/commands/lpos
2777
3233
  */
2778
3234
  lpos: <TData = number>(key: string, element: unknown, opts?: {
2779
- rank?: number | undefined;
2780
- count?: number | undefined;
2781
- maxLen?: number | undefined;
3235
+ rank?: number;
3236
+ count?: number;
3237
+ maxLen?: number;
2782
3238
  } | undefined) => Promise<TData>;
2783
3239
  /**
2784
3240
  * @see https://redis.io/commands/lpush
@@ -2811,15 +3267,11 @@ declare class Redis {
2811
3267
  /**
2812
3268
  * @see https://redis.io/commands/mset
2813
3269
  */
2814
- mset: <TData>(kv: {
2815
- [key: string]: TData;
2816
- }) => Promise<"OK">;
3270
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
2817
3271
  /**
2818
3272
  * @see https://redis.io/commands/msetnx
2819
3273
  */
2820
- msetnx: <TData>(kv: {
2821
- [key: string]: TData;
2822
- }) => Promise<number>;
3274
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
2823
3275
  /**
2824
3276
  * @see https://redis.io/commands/persist
2825
3277
  */
@@ -2833,8 +3285,8 @@ declare class Redis {
2833
3285
  */
2834
3286
  pexpireat: (key: string, unix: number) => Promise<0 | 1>;
2835
3287
  /**
2836
- * @see https://redis.io/commands/pfadd
2837
- */
3288
+ * @see https://redis.io/commands/pfadd
3289
+ */
2838
3290
  pfadd: (args_0: string, ...args_1: unknown[]) => Promise<number>;
2839
3291
  /**
2840
3292
  * @see https://redis.io/commands/pfcount
@@ -2852,6 +3304,10 @@ declare class Redis {
2852
3304
  * @see https://redis.io/commands/psetex
2853
3305
  */
2854
3306
  psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
3307
+ /**
3308
+ * @see https://redis.io/commands/psubscribe
3309
+ */
3310
+ psubscribe: (patterns: string | string[]) => Subscriber;
2855
3311
  /**
2856
3312
  * @see https://redis.io/commands/pttl
2857
3313
  */
@@ -2887,11 +3343,11 @@ declare class Redis {
2887
3343
  /**
2888
3344
  * @see https://redis.io/commands/sadd
2889
3345
  */
2890
- sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
3346
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
2891
3347
  /**
2892
3348
  * @see https://redis.io/commands/scan
2893
3349
  */
2894
- scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, string[]]>;
3350
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, string[]]>;
2895
3351
  /**
2896
3352
  * @see https://redis.io/commands/scard
2897
3353
  */
@@ -2975,11 +3431,15 @@ declare class Redis {
2975
3431
  /**
2976
3432
  * @see https://redis.io/commands/sscan
2977
3433
  */
2978
- sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3434
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
2979
3435
  /**
2980
3436
  * @see https://redis.io/commands/strlen
2981
3437
  */
2982
3438
  strlen: (key: string) => Promise<number>;
3439
+ /**
3440
+ * @see https://redis.io/commands/subscribe
3441
+ */
3442
+ subscribe: (channels: string | string[]) => Subscriber;
2983
3443
  /**
2984
3444
  * @see https://redis.io/commands/sunion
2985
3445
  */
@@ -3011,11 +3471,9 @@ declare class Redis {
3011
3471
  /**
3012
3472
  * @see https://redis.io/commands/xadd
3013
3473
  */
3014
- xadd: (key: string, id: string, entries: {
3015
- [field: string]: unknown;
3016
- }, opts?: {
3017
- nomkStream?: boolean | undefined;
3018
- trim?: (({
3474
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3475
+ nomkStream?: boolean;
3476
+ trim?: ({
3019
3477
  type: "MAXLEN" | "maxlen";
3020
3478
  threshold: number;
3021
3479
  } | {
@@ -3023,20 +3481,117 @@ declare class Redis {
3023
3481
  threshold: string;
3024
3482
  }) & ({
3025
3483
  comparison: "~";
3026
- limit?: number | undefined;
3484
+ limit?: number;
3027
3485
  } | {
3028
3486
  comparison: "=";
3029
- limit?: undefined;
3030
- })) | undefined;
3487
+ limit?: never;
3488
+ });
3031
3489
  } | undefined) => Promise<string>;
3490
+ /**
3491
+ * @see https://redis.io/commands/xack
3492
+ */
3493
+ xack: (key: string, group: string, id: string | string[]) => Promise<number>;
3494
+ /**
3495
+ * @see https://redis.io/commands/xdel
3496
+ */
3497
+ xdel: (key: string, ids: string | string[]) => Promise<number>;
3498
+ /**
3499
+ * @see https://redis.io/commands/xgroup
3500
+ */
3501
+ xgroup: (key: string, opts: {
3502
+ type: "CREATE";
3503
+ group: string;
3504
+ id: `$` | string;
3505
+ options?: {
3506
+ MKSTREAM?: boolean;
3507
+ ENTRIESREAD?: number;
3508
+ };
3509
+ } | {
3510
+ type: "CREATECONSUMER";
3511
+ group: string;
3512
+ consumer: string;
3513
+ } | {
3514
+ type: "DELCONSUMER";
3515
+ group: string;
3516
+ consumer: string;
3517
+ } | {
3518
+ type: "DESTROY";
3519
+ group: string;
3520
+ } | {
3521
+ type: "SETID";
3522
+ group: string;
3523
+ id: `$` | string;
3524
+ options?: {
3525
+ ENTRIESREAD?: number;
3526
+ };
3527
+ }) => Promise<never>;
3528
+ /**
3529
+ * @see https://redis.io/commands/xread
3530
+ */
3531
+ xread: (...args: CommandArgs<typeof XReadCommand>) => Promise<unknown[]>;
3532
+ /**
3533
+ * @see https://redis.io/commands/xreadgroup
3534
+ */
3535
+ xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Promise<unknown[]>;
3536
+ /**
3537
+ * @see https://redis.io/commands/xinfo
3538
+ */
3539
+ xinfo: (key: string, options: {
3540
+ type: "CONSUMERS";
3541
+ group: string;
3542
+ } | {
3543
+ type: "GROUPS";
3544
+ }) => Promise<unknown[]>;
3545
+ /**
3546
+ * @see https://redis.io/commands/xlen
3547
+ */
3548
+ xlen: (key: string) => Promise<number>;
3549
+ /**
3550
+ * @see https://redis.io/commands/xpending
3551
+ */
3552
+ xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3553
+ idleTime?: number;
3554
+ consumer?: string | string[];
3555
+ } | undefined) => Promise<unknown[]>;
3556
+ /**
3557
+ * @see https://redis.io/commands/xclaim
3558
+ */
3559
+ xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3560
+ idleMS?: number;
3561
+ timeMS?: number;
3562
+ retryCount?: number;
3563
+ force?: boolean;
3564
+ justId?: boolean;
3565
+ lastId?: number;
3566
+ } | undefined) => Promise<unknown[]>;
3567
+ /**
3568
+ * @see https://redis.io/commands/xautoclaim
3569
+ */
3570
+ xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3571
+ count?: number;
3572
+ justId?: boolean;
3573
+ } | undefined) => Promise<unknown[]>;
3574
+ /**
3575
+ * @see https://redis.io/commands/xtrim
3576
+ */
3577
+ xtrim: (key: string, options: {
3578
+ strategy: "MAXLEN" | "MINID";
3579
+ exactness?: "~" | "=";
3580
+ threshold: number | string;
3581
+ limit?: number;
3582
+ }) => Promise<number>;
3032
3583
  /**
3033
3584
  * @see https://redis.io/commands/xrange
3034
3585
  */
3035
3586
  xrange: (key: string, start: string, end: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
3587
+ /**
3588
+ * @see https://redis.io/commands/xrevrange
3589
+ */
3590
+ xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
3036
3591
  /**
3037
3592
  * @see https://redis.io/commands/zadd
3038
3593
  */
3039
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<number | null>;
3594
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3040
3595
  /**
3041
3596
  * @see https://redis.io/commands/zcard
3042
3597
  */
@@ -3076,21 +3631,11 @@ declare class Redis {
3076
3631
  /**
3077
3632
  * @see https://redis.io/commands/zrange
3078
3633
  */
3079
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
3080
- key: string,
3081
- min: `(${string}` | `[${string}` | "-" | "+",
3082
- max: `(${string}` | `[${string}` | "-" | "+",
3083
- opts: {
3084
- byLex: true;
3085
- } & ZRangeCommandOptions
3086
- ] | [
3087
- key: string,
3088
- min: number | `(${number}` | "-inf" | "+inf",
3089
- max: number | `(${number}` | "-inf" | "+inf",
3090
- opts: {
3091
- byScore: true;
3092
- } & ZRangeCommandOptions
3093
- ]) => Promise<TData>;
3634
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3635
+ byLex: true;
3636
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3637
+ byScore: true;
3638
+ } & ZRangeCommandOptions]) => Promise<TData>;
3094
3639
  /**
3095
3640
  * @see https://redis.io/commands/zrank
3096
3641
  */
@@ -3118,7 +3663,7 @@ declare class Redis {
3118
3663
  /**
3119
3664
  * @see https://redis.io/commands/zscan
3120
3665
  */
3121
- zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3666
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3122
3667
  /**
3123
3668
  * @see https://redis.io/commands/zscore
3124
3669
  */
@@ -3133,6 +3678,24 @@ declare class Redis {
3133
3678
  zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
3134
3679
  }
3135
3680
 
3681
+ /**
3682
+ * Result of a bad request to upstash
3683
+ */
3684
+ declare class UpstashError extends Error {
3685
+ constructor(message: string);
3686
+ }
3687
+ declare class UrlError extends Error {
3688
+ constructor(url: string);
3689
+ }
3690
+
3691
+ type error_UpstashError = UpstashError;
3692
+ declare const error_UpstashError: typeof UpstashError;
3693
+ type error_UrlError = UrlError;
3694
+ declare const error_UrlError: typeof UrlError;
3695
+ declare namespace error {
3696
+ export { error_UpstashError as UpstashError, error_UrlError as UrlError };
3697
+ }
3698
+
3136
3699
  /**
3137
3700
  * @see https://redis.io/commands/zdiffstore
3138
3701
  */
@@ -3147,4 +3710,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
3147
3710
  constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3148
3711
  }
3149
3712
 
3150
- 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, ZRangeCommand as bA, ZRangeCommandOptions as bB, ZRankCommand as bC, ZRemCommand as bD, ZRemRangeByLexCommand as bE, ZRemRangeByRankCommand as bF, ZRemRangeByScoreCommand as bG, ZRevRankCommand as bH, ZScanCommand as bI, ZScoreCommand as bJ, ZUnionCommand as bK, ZUnionCommandOptions as bL, ZUnionStoreCommand as bM, ZUnionStoreCommandOptions as bN, 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, ZAddCommandOptionsWithIncr as bo, ZAddCommand as bp, ZCardCommand as bq, ZCountCommand as br, ZDiffStoreCommand as bs, ZIncrByCommand as bt, ZInterStoreCommand as bu, ZInterStoreCommandOptions as bv, ZLexCountCommand as bw, ZMScoreCommand as bx, ZPopMaxCommand as by, ZPopMinCommand 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 };
3713
+ export { HStrLenCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetExCommand as H, GetRangeCommand as I, GetSetCommand as J, HDelCommand as K, HExistsCommand as L, HGetCommand as M, HGetAllCommand as N, HIncrByCommand as O, Pipeline as P, HIncrByFloatCommand as Q, type RedisOptions as R, HKeysCommand as S, HLenCommand as T, type UpstashRequest as U, HMGetCommand as V, HMSetCommand as W, HRandFieldCommand as X, HScanCommand as Y, HSetCommand as Z, HSetNXCommand as _, type RequesterConfig as a, type SetCommandOptions as a$, HValsCommand as a0, IncrCommand as a1, IncrByCommand as a2, IncrByFloatCommand as a3, JsonArrAppendCommand as a4, JsonArrIndexCommand as a5, JsonArrInsertCommand as a6, JsonArrLenCommand as a7, JsonArrPopCommand as a8, JsonArrTrimCommand as a9, LTrimCommand as aA, MGetCommand as aB, MSetCommand as aC, MSetNXCommand as aD, PersistCommand as aE, PExpireCommand as aF, PExpireAtCommand as aG, PingCommand as aH, PSetEXCommand as aI, PTtlCommand as aJ, PublishCommand as aK, RandomKeyCommand as aL, RenameCommand as aM, RenameNXCommand as aN, RPopCommand as aO, RPushCommand as aP, RPushXCommand as aQ, SAddCommand as aR, ScanCommand as aS, type ScanCommandOptions as aT, SCardCommand as aU, ScriptExistsCommand as aV, ScriptFlushCommand as aW, ScriptLoadCommand as aX, SDiffCommand as aY, SDiffStoreCommand as aZ, SetCommand as a_, JsonClearCommand as aa, JsonDelCommand as ab, JsonForgetCommand as ac, JsonGetCommand as ad, JsonMGetCommand as ae, JsonNumIncrByCommand as af, JsonNumMultByCommand as ag, JsonObjKeysCommand as ah, JsonObjLenCommand as ai, JsonRespCommand as aj, JsonSetCommand as ak, JsonStrAppendCommand as al, JsonStrLenCommand as am, JsonToggleCommand as an, JsonTypeCommand as ao, KeysCommand as ap, LIndexCommand as aq, LInsertCommand as ar, LLenCommand as as, LMoveCommand as at, LPopCommand as au, LPushCommand as av, LPushXCommand as aw, LRangeCommand as ax, LRemCommand as ay, LSetCommand as az, Redis as b, SetBitCommand as b0, SetExCommand as b1, SetNxCommand as b2, SetRangeCommand as b3, SInterCommand as b4, SInterStoreCommand as b5, SIsMemberCommand as b6, SMembersCommand as b7, SMIsMemberCommand as b8, SMoveCommand as b9, ZPopMaxCommand as bA, ZPopMinCommand as bB, ZRangeCommand as bC, type ZRangeCommandOptions as bD, ZRankCommand as bE, ZRemCommand as bF, ZRemRangeByLexCommand as bG, ZRemRangeByRankCommand as bH, ZRemRangeByScoreCommand as bI, ZRevRankCommand as bJ, ZScanCommand as bK, ZScoreCommand as bL, ZUnionCommand as bM, type ZUnionCommandOptions as bN, ZUnionStoreCommand as bO, type ZUnionStoreCommandOptions as bP, SPopCommand as ba, SRandMemberCommand as bb, SRemCommand as bc, SScanCommand as bd, StrLenCommand as be, SUnionCommand as bf, SUnionStoreCommand as bg, TimeCommand as bh, TouchCommand as bi, TtlCommand as bj, type Type as bk, TypeCommand as bl, UnlinkCommand as bm, XAddCommand as bn, XRangeCommand as bo, type ScoreMember as bp, type ZAddCommandOptions as bq, ZAddCommand as br, ZCardCommand as bs, ZCountCommand as bt, ZDiffStoreCommand as bu, ZIncrByCommand as bv, ZInterStoreCommand as bw, type ZInterStoreCommandOptions as bx, ZLexCountCommand as by, ZMScoreCommand as bz, type UpstashResponse as c, type Requester 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, type GeoAddCommandOptions as q, type 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 };