@upstash/redis 0.0.0-ci.bbdbea1eb419d86a269ad13ff943dce0e6a5d5f5-20240201100629 → 0.0.0-ci.bc4bc6000996997f106a2dc09f4f13484ce31f21-20241002153615

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,21 @@ type UpstashRequest = {
33
36
  * Request body will be serialized to json
34
37
  */
35
38
  body?: unknown;
39
+ upstashSyncToken?: string;
36
40
  };
37
41
  type UpstashResponse<TResult> = {
38
42
  result?: TResult;
39
43
  error?: string;
40
44
  };
41
45
  interface Requester {
46
+ /**
47
+ * 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.
48
+ */
49
+ readYourWrites?: boolean;
50
+ /**
51
+ * 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.
52
+ */
53
+ upstashSyncToken?: string;
42
54
  request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
43
55
  }
44
56
  type RetryConfig = false | {
@@ -106,6 +118,7 @@ type CommandOptions<TResult, TData> = {
106
118
  * @default true
107
119
  */
108
120
  automaticDeserialization?: boolean;
121
+ latencyLogging?: boolean;
109
122
  };
110
123
  /**
111
124
  * Command offers default (de)serialization and the exec method to all commands.
@@ -220,8 +233,8 @@ type ScanCommandOptions = {
220
233
  /**
221
234
  * @see https://redis.io/commands/scan
222
235
  */
223
- declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
224
- constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, string[]], [number, string[]]>);
236
+ declare class ScanCommand extends Command<[string, string[]], [string, string[]]> {
237
+ constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], [string, string[]]>);
225
238
  }
226
239
 
227
240
  type GeoAddCommandOptions = {
@@ -233,11 +246,11 @@ type GeoAddCommandOptions = {
233
246
  } & {
234
247
  ch?: boolean;
235
248
  });
236
- interface GeoMember<TMemberType> {
249
+ type GeoMember<TMemberType> = {
237
250
  latitude: number;
238
251
  longitude: number;
239
252
  member: TMemberType;
240
- }
253
+ };
241
254
  /**
242
255
  * @see https://redis.io/commands/geoadd
243
256
  */
@@ -264,6 +277,28 @@ declare class BitCountCommand extends Command<number, number> {
264
277
  constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
265
278
  }
266
279
 
280
+ type SubCommandArgs<TRest extends unknown[] = []> = [
281
+ encoding: string,
282
+ offset: number | string,
283
+ ...rest: TRest
284
+ ];
285
+ /**
286
+ * @see https://redis.io/commands/bitfield
287
+ */
288
+ declare class BitFieldCommand<T = Promise<number[]>> {
289
+ private client;
290
+ private opts?;
291
+ private execOperation;
292
+ private command;
293
+ constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
294
+ private chain;
295
+ get(...args: SubCommandArgs): this;
296
+ set(...args: SubCommandArgs<[value: number]>): this;
297
+ incrby(...args: SubCommandArgs<[increment: number]>): this;
298
+ overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
299
+ exec(): T;
300
+ }
301
+
267
302
  /**
268
303
  * @see https://redis.io/commands/bitop
269
304
  */
@@ -390,7 +425,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
390
425
  * @see https://redis.io/commands/geohash
391
426
  */
392
427
  declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
393
- constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
428
+ constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
394
429
  }
395
430
 
396
431
  type Coordinates = {
@@ -617,9 +652,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
617
652
  * @see https://redis.io/commands/hmset
618
653
  */
619
654
  declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
620
- constructor([key, kv]: [key: string, kv: {
621
- [field: string]: TData;
622
- }], opts?: CommandOptions<"OK", "OK">);
655
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
623
656
  }
624
657
 
625
658
  /**
@@ -635,22 +668,20 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
635
668
  * @see https://redis.io/commands/hscan
636
669
  */
637
670
  declare class HScanCommand extends Command<[
638
- number,
671
+ string,
639
672
  (string | number)[]
640
673
  ], [
641
- number,
674
+ string,
642
675
  (string | number)[]
643
676
  ]> {
644
- constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
677
+ constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
645
678
  }
646
679
 
647
680
  /**
648
681
  * @see https://redis.io/commands/hset
649
682
  */
650
683
  declare class HSetCommand<TData> extends Command<number, number> {
651
- constructor([key, kv]: [key: string, kv: {
652
- [field: string]: TData;
653
- }], opts?: CommandOptions<number, number>);
684
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
654
685
  }
655
686
 
656
687
  /**
@@ -780,6 +811,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
780
811
  constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
781
812
  }
782
813
 
814
+ /**
815
+ * @see https://redis.io/commands/json.mset
816
+ */
817
+ declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
818
+ constructor(cmd: {
819
+ key: string;
820
+ path: string;
821
+ value: TData;
822
+ }[], opts?: CommandOptions<"OK" | null, "OK" | null>);
823
+ }
824
+
783
825
  /**
784
826
  * @see https://redis.io/commands/json.numincrby
785
827
  */
@@ -936,25 +978,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
936
978
  * @see https://redis.io/commands/mget
937
979
  */
938
980
  declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
939
- constructor(cmd: [string[]] | [...(string[] | string[])], opts?: CommandOptions<(string | null)[], TData>);
981
+ constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
940
982
  }
941
983
 
942
984
  /**
943
985
  * @see https://redis.io/commands/mset
944
986
  */
945
987
  declare class MSetCommand<TData> extends Command<"OK", "OK"> {
946
- constructor([kv]: [kv: {
947
- [key: string]: TData;
948
- }], opts?: CommandOptions<"OK", "OK">);
988
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
949
989
  }
950
990
 
951
991
  /**
952
992
  * @see https://redis.io/commands/msetnx
953
993
  */
954
994
  declare class MSetNXCommand<TData = string> extends Command<number, number> {
955
- constructor([kv]: [kv: {
956
- [key: string]: TData;
957
- }], opts?: CommandOptions<number, number>);
995
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
958
996
  }
959
997
 
960
998
  /**
@@ -1052,7 +1090,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
1052
1090
  * @see https://redis.io/commands/sadd
1053
1091
  */
1054
1092
  declare class SAddCommand<TData = string> extends Command<number, number> {
1055
- constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1093
+ constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
1056
1094
  }
1057
1095
 
1058
1096
  /**
@@ -1240,13 +1278,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
1240
1278
  * @see https://redis.io/commands/sscan
1241
1279
  */
1242
1280
  declare class SScanCommand extends Command<[
1243
- number,
1281
+ string,
1244
1282
  (string | number)[]
1245
1283
  ], [
1246
- number,
1284
+ string,
1247
1285
  (string | number)[]
1248
1286
  ]> {
1249
- constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
1287
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1250
1288
  }
1251
1289
 
1252
1290
  /**
@@ -1321,9 +1359,7 @@ declare class XAddCommand extends Command<string, string> {
1321
1359
  constructor([key, id, entries, opts]: [
1322
1360
  key: string,
1323
1361
  id: "*" | string,
1324
- entries: {
1325
- [field: string]: unknown;
1326
- },
1362
+ entries: Record<string, unknown>,
1327
1363
  opts?: XAddCommandOptions
1328
1364
  ], commandOptions?: CommandOptions<string, string>);
1329
1365
  }
@@ -1547,13 +1583,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
1547
1583
  * @see https://redis.io/commands/zscan
1548
1584
  */
1549
1585
  declare class ZScanCommand extends Command<[
1550
- number,
1586
+ string,
1551
1587
  (string | number)[]
1552
1588
  ], [
1553
- number,
1589
+ string,
1554
1590
  (string | number)[]
1555
1591
  ]> {
1556
- constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, (string | number)[]], [number, (string | number)[]]>);
1592
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1557
1593
  }
1558
1594
 
1559
1595
  /**
@@ -1644,6 +1680,23 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1644
1680
  * @see https://redis.io/commands/bitcount
1645
1681
  */
1646
1682
  bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
1683
+ /**
1684
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
1685
+ *
1686
+ * @example
1687
+ * ```typescript
1688
+ * redis.set("mykey", 0);
1689
+ * const result = await redis.pipeline()
1690
+ * .bitfield("mykey")
1691
+ * .set("u4", 0, 16)
1692
+ * .incr("u4", "#1", 1)
1693
+ * .exec();
1694
+ * console.log(result); // [[0, 1]]
1695
+ * ```
1696
+ *
1697
+ * @see https://redis.io/commands/bitfield
1698
+ */
1699
+ bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
1647
1700
  /**
1648
1701
  * @see https://redis.io/commands/bitop
1649
1702
  */
@@ -1713,8 +1766,98 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1713
1766
  * @see https://redis.io/commands/flushdb
1714
1767
  */
1715
1768
  flushdb: (opts?: {
1716
- async?: boolean | undefined;
1769
+ async?: boolean;
1717
1770
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1771
+ /**
1772
+ * @see https://redis.io/commands/geoadd
1773
+ */
1774
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
1775
+ /**
1776
+ * @see https://redis.io/commands/geodist
1777
+ */
1778
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
1779
+ /**
1780
+ * @see https://redis.io/commands/geopos
1781
+ */
1782
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
1783
+ lng: number;
1784
+ lat: number;
1785
+ }[]>]>;
1786
+ /**
1787
+ * @see https://redis.io/commands/geohash
1788
+ */
1789
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
1790
+ /**
1791
+ * @see https://redis.io/commands/geosearch
1792
+ */
1793
+ geosearch: <TData>(key: string, centerPoint: {
1794
+ type: "FROMLONLAT" | "fromlonlat";
1795
+ coordinate: {
1796
+ lon: number;
1797
+ lat: number;
1798
+ };
1799
+ } | {
1800
+ type: "FROMMEMBER" | "frommember";
1801
+ member: TData;
1802
+ }, shape: {
1803
+ type: "BYRADIUS" | "byradius";
1804
+ radius: number;
1805
+ radiusType: "M" | "KM" | "FT" | "MI";
1806
+ } | {
1807
+ type: "BYBOX" | "bybox";
1808
+ rect: {
1809
+ width: number;
1810
+ height: number;
1811
+ };
1812
+ rectType: "M" | "KM" | "FT" | "MI";
1813
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1814
+ count?: {
1815
+ limit: number;
1816
+ any?: boolean;
1817
+ };
1818
+ withCoord?: boolean;
1819
+ withDist?: boolean;
1820
+ withHash?: boolean;
1821
+ } | undefined) => Pipeline<[...TCommands, Command<any, ({
1822
+ member: TData;
1823
+ } & {
1824
+ coord?: {
1825
+ long: number;
1826
+ lat: number;
1827
+ } | undefined;
1828
+ dist?: number | undefined;
1829
+ hash?: string | undefined;
1830
+ })[]>]>;
1831
+ /**
1832
+ * @see https://redis.io/commands/geosearchstore
1833
+ */
1834
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
1835
+ type: "FROMLONLAT" | "fromlonlat";
1836
+ coordinate: {
1837
+ lon: number;
1838
+ lat: number;
1839
+ };
1840
+ } | {
1841
+ type: "FROMMEMBER" | "frommember";
1842
+ member: TData;
1843
+ }, shape: {
1844
+ type: "BYRADIUS" | "byradius";
1845
+ radius: number;
1846
+ radiusType: "M" | "KM" | "FT" | "MI";
1847
+ } | {
1848
+ type: "BYBOX" | "bybox";
1849
+ rect: {
1850
+ width: number;
1851
+ height: number;
1852
+ };
1853
+ rectType: "M" | "KM" | "FT" | "MI";
1854
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1855
+ count?: {
1856
+ limit: number;
1857
+ any?: boolean;
1858
+ };
1859
+ storeDist?: boolean;
1860
+ } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1718
1861
  /**
1719
1862
  * @see https://redis.io/commands/get
1720
1863
  */
@@ -1774,9 +1917,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1774
1917
  /**
1775
1918
  * @see https://redis.io/commands/hmset
1776
1919
  */
1777
- hmset: <TData>(key: string, kv: {
1778
- [field: string]: TData;
1779
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
1920
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1780
1921
  /**
1781
1922
  * @see https://redis.io/commands/hrandfield
1782
1923
  */
@@ -1784,13 +1925,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1784
1925
  /**
1785
1926
  * @see https://redis.io/commands/hscan
1786
1927
  */
1787
- hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
1928
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
1788
1929
  /**
1789
1930
  * @see https://redis.io/commands/hset
1790
1931
  */
1791
- hset: <TData>(key: string, kv: {
1792
- [field: string]: TData;
1793
- }) => Pipeline<[...TCommands, Command<any, number>]>;
1932
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1794
1933
  /**
1795
1934
  * @see https://redis.io/commands/hsetnx
1796
1935
  */
@@ -1839,13 +1978,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1839
1978
  * @see https://redis.io/commands/lpop
1840
1979
  */
1841
1980
  lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1981
+ /**
1982
+ * @see https://redis.io/commands/lmpop
1983
+ */
1984
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
1842
1985
  /**
1843
1986
  * @see https://redis.io/commands/lpos
1844
1987
  */
1845
1988
  lpos: <TData>(key: string, element: unknown, opts?: {
1846
- rank?: number | undefined;
1847
- count?: number | undefined;
1848
- maxLen?: number | undefined;
1989
+ rank?: number;
1990
+ count?: number;
1991
+ maxLen?: number;
1849
1992
  } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
1850
1993
  /**
1851
1994
  * @see https://redis.io/commands/lpush
@@ -1878,15 +2021,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1878
2021
  /**
1879
2022
  * @see https://redis.io/commands/mset
1880
2023
  */
1881
- mset: <TData>(kv: {
1882
- [key: string]: TData;
1883
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2024
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1884
2025
  /**
1885
2026
  * @see https://redis.io/commands/msetnx
1886
2027
  */
1887
- msetnx: <TData>(kv: {
1888
- [key: string]: TData;
1889
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2028
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1890
2029
  /**
1891
2030
  * @see https://redis.io/commands/persist
1892
2031
  */
@@ -1954,11 +2093,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1954
2093
  /**
1955
2094
  * @see https://redis.io/commands/sadd
1956
2095
  */
1957
- sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2096
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
1958
2097
  /**
1959
2098
  * @see https://redis.io/commands/scan
1960
2099
  */
1961
- scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, string[]]>]>;
2100
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, string[]]>]>;
1962
2101
  /**
1963
2102
  * @see https://redis.io/commands/scard
1964
2103
  */
@@ -2039,7 +2178,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2039
2178
  /**
2040
2179
  * @see https://redis.io/commands/sscan
2041
2180
  */
2042
- sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2181
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2043
2182
  /**
2044
2183
  * @see https://redis.io/commands/strlen
2045
2184
  */
@@ -2075,15 +2214,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2075
2214
  /**
2076
2215
  * @see https://redis.io/commands/zadd
2077
2216
  */
2078
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2217
+ 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>]>;
2079
2218
  /**
2080
2219
  * @see https://redis.io/commands/xadd
2081
2220
  */
2082
- xadd: (key: string, id: string, entries: {
2083
- [field: string]: unknown;
2084
- }, opts?: {
2085
- nomkStream?: boolean | undefined;
2086
- trim?: (({
2221
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2222
+ nomkStream?: boolean;
2223
+ trim?: ({
2087
2224
  type: "MAXLEN" | "maxlen";
2088
2225
  threshold: number;
2089
2226
  } | {
@@ -2091,11 +2228,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2091
2228
  threshold: string;
2092
2229
  }) & ({
2093
2230
  comparison: "~";
2094
- limit?: number | undefined;
2231
+ limit?: number;
2095
2232
  } | {
2096
2233
  comparison: "=";
2097
- limit?: undefined;
2098
- })) | undefined;
2234
+ limit?: never;
2235
+ });
2099
2236
  } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2100
2237
  /**
2101
2238
  * @see https://redis.io/commands/xack
@@ -2111,11 +2248,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2111
2248
  xgroup: (key: string, opts: {
2112
2249
  type: "CREATE";
2113
2250
  group: string;
2114
- id: string;
2251
+ id: `$` | string;
2115
2252
  options?: {
2116
- MKSTREAM?: boolean | undefined;
2117
- ENTRIESREAD?: number | undefined;
2118
- } | undefined;
2253
+ MKSTREAM?: boolean;
2254
+ ENTRIESREAD?: number;
2255
+ };
2119
2256
  } | {
2120
2257
  type: "CREATECONSUMER";
2121
2258
  group: string;
@@ -2130,10 +2267,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2130
2267
  } | {
2131
2268
  type: "SETID";
2132
2269
  group: string;
2133
- id: string;
2270
+ id: `$` | string;
2134
2271
  options?: {
2135
- ENTRIESREAD?: number | undefined;
2136
- } | undefined;
2272
+ ENTRIESREAD?: number;
2273
+ };
2137
2274
  }) => Pipeline<[...TCommands, Command<any, never>]>;
2138
2275
  /**
2139
2276
  * @see https://redis.io/commands/xread
@@ -2160,35 +2297,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2160
2297
  * @see https://redis.io/commands/xpending
2161
2298
  */
2162
2299
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2163
- idleTime?: number | undefined;
2164
- consumer?: string | string[] | undefined;
2300
+ idleTime?: number;
2301
+ consumer?: string | string[];
2165
2302
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2166
2303
  /**
2167
2304
  * @see https://redis.io/commands/xclaim
2168
2305
  */
2169
2306
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2170
- idleMS?: number | undefined;
2171
- timeMS?: number | undefined;
2172
- retryCount?: number | undefined;
2173
- force?: boolean | undefined;
2174
- justId?: boolean | undefined;
2175
- lastId?: number | undefined;
2307
+ idleMS?: number;
2308
+ timeMS?: number;
2309
+ retryCount?: number;
2310
+ force?: boolean;
2311
+ justId?: boolean;
2312
+ lastId?: number;
2176
2313
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2177
2314
  /**
2178
2315
  * @see https://redis.io/commands/xautoclaim
2179
2316
  */
2180
2317
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2181
- count?: number | undefined;
2182
- justId?: boolean | undefined;
2318
+ count?: number;
2319
+ justId?: boolean;
2183
2320
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2184
2321
  /**
2185
2322
  * @see https://redis.io/commands/xtrim
2186
2323
  */
2187
2324
  xtrim: (key: string, options: {
2188
2325
  strategy: "MAXLEN" | "MINID";
2189
- exactness?: "~" | "=" | undefined;
2190
- threshold: string | number;
2191
- limit?: number | undefined;
2326
+ exactness?: "~" | "=";
2327
+ threshold: number | string;
2328
+ limit?: number;
2192
2329
  }) => Pipeline<[...TCommands, Command<any, number>]>;
2193
2330
  /**
2194
2331
  * @see https://redis.io/commands/xrange
@@ -2233,21 +2370,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2233
2370
  /**
2234
2371
  * @see https://redis.io/commands/zrange
2235
2372
  */
2236
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
2237
- key: string,
2238
- min: `(${string}` | `[${string}` | "-" | "+",
2239
- max: `(${string}` | `[${string}` | "-" | "+",
2240
- opts: {
2241
- byLex: true;
2242
- } & ZRangeCommandOptions
2243
- ] | [
2244
- key: string,
2245
- min: number | `(${number}` | "-inf" | "+inf",
2246
- max: number | `(${number}` | "-inf" | "+inf",
2247
- opts: {
2248
- byScore: true;
2249
- } & ZRangeCommandOptions
2250
- ]) => Pipeline<[...TCommands, Command<any, TData>]>;
2373
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
2374
+ byLex: true;
2375
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
2376
+ byScore: true;
2377
+ } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
2251
2378
  /**
2252
2379
  * @see https://redis.io/commands/zrank
2253
2380
  */
@@ -2275,7 +2402,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2275
2402
  /**
2276
2403
  * @see https://redis.io/commands/zscan
2277
2404
  */
2278
- zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [number, (string | number)[]]>]>;
2405
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2279
2406
  /**
2280
2407
  * @see https://redis.io/commands/zscore
2281
2408
  */
@@ -2328,96 +2455,6 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2328
2455
  * @see https://redis.io/commands/json.forget
2329
2456
  */
2330
2457
  forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2331
- /**
2332
- * @see https://redis.io/commands/geoadd
2333
- */
2334
- geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
2335
- /**
2336
- * @see https://redis.io/commands/geodist
2337
- */
2338
- geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
2339
- /**
2340
- * @see https://redis.io/commands/geopos
2341
- */
2342
- geopos: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, {
2343
- lng: number;
2344
- lat: number;
2345
- }[]>]>;
2346
- /**
2347
- * @see https://redis.io/commands/geohash
2348
- */
2349
- geohash: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
2350
- /**
2351
- * @see https://redis.io/commands/geosearch
2352
- */
2353
- geosearch: (key: string, centerPoint: {
2354
- type: "FROMLONLAT" | "fromlonlat";
2355
- coordinate: {
2356
- lon: number;
2357
- lat: number;
2358
- };
2359
- } | {
2360
- type: "FROMMEMBER" | "frommember";
2361
- member: unknown;
2362
- }, shape: {
2363
- type: "BYRADIUS" | "byradius";
2364
- radius: number;
2365
- radiusType: "M" | "KM" | "FT" | "MI";
2366
- } | {
2367
- type: "BYBOX" | "bybox";
2368
- rect: {
2369
- width: number;
2370
- height: number;
2371
- };
2372
- rectType: "M" | "KM" | "FT" | "MI";
2373
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2374
- count?: {
2375
- limit: number;
2376
- any?: boolean | undefined;
2377
- } | undefined;
2378
- withCoord?: boolean | undefined;
2379
- withDist?: boolean | undefined;
2380
- withHash?: boolean | undefined;
2381
- } | undefined) => Pipeline<[...TCommands, Command<any, ({
2382
- member: unknown;
2383
- } & {
2384
- coord?: {
2385
- long: number;
2386
- lat: number;
2387
- } | undefined;
2388
- dist?: number | undefined;
2389
- hash?: string | undefined;
2390
- })[]>]>;
2391
- /**
2392
- * @see https://redis.io/commands/geosearchstore
2393
- */
2394
- geosearchstore: (destination: string, key: string, centerPoint: {
2395
- type: "FROMLONLAT" | "fromlonlat";
2396
- coordinate: {
2397
- lon: number;
2398
- lat: number;
2399
- };
2400
- } | {
2401
- type: "FROMMEMBER" | "frommember";
2402
- member: unknown;
2403
- }, shape: {
2404
- type: "BYRADIUS" | "byradius";
2405
- radius: number;
2406
- radiusType: "M" | "KM" | "FT" | "MI";
2407
- } | {
2408
- type: "BYBOX" | "bybox";
2409
- rect: {
2410
- width: number;
2411
- height: number;
2412
- };
2413
- rectType: "M" | "KM" | "FT" | "MI";
2414
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2415
- count?: {
2416
- limit: number;
2417
- any?: boolean | undefined;
2418
- } | undefined;
2419
- storeDist?: boolean | undefined;
2420
- } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2421
2458
  /**
2422
2459
  * @see https://redis.io/commands/json.get
2423
2460
  */
@@ -2426,6 +2463,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2426
2463
  * @see https://redis.io/commands/json.mget
2427
2464
  */
2428
2465
  mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
2466
+ /**
2467
+ * @see https://redis.io/commands/json.mset
2468
+ */
2469
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2429
2470
  /**
2430
2471
  * @see https://redis.io/commands/json.numincrby
2431
2472
  */
@@ -2451,9 +2492,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2451
2492
  */
2452
2493
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2453
2494
  nx: true;
2454
- xx?: undefined;
2495
+ xx?: never;
2455
2496
  } | {
2456
- nx?: undefined;
2497
+ nx?: never;
2457
2498
  xx: true;
2458
2499
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2459
2500
  /**
@@ -2524,6 +2565,7 @@ declare class Redis {
2524
2565
  protected client: Requester;
2525
2566
  protected opts?: CommandOptions<any, any>;
2526
2567
  protected enableTelemetry: boolean;
2568
+ protected enableAutoPipelining: boolean;
2527
2569
  /**
2528
2570
  * Create a new redis client
2529
2571
  *
@@ -2536,6 +2578,8 @@ declare class Redis {
2536
2578
  * ```
2537
2579
  */
2538
2580
  constructor(client: Requester, opts?: RedisOptions);
2581
+ get readYourWritesSyncToken(): string | undefined;
2582
+ set readYourWritesSyncToken(session: string | undefined);
2539
2583
  get json(): {
2540
2584
  /**
2541
2585
  * @see https://redis.io/commands/json.arrappend
@@ -2573,96 +2617,6 @@ declare class Redis {
2573
2617
  * @see https://redis.io/commands/json.forget
2574
2618
  */
2575
2619
  forget: (key: string, path?: string | undefined) => Promise<number>;
2576
- /**
2577
- * @see https://redis.io/commands/geoadd
2578
- */
2579
- geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Promise<number | null>;
2580
- /**
2581
- * @see https://redis.io/commands/geopos
2582
- */
2583
- geopos: (args_0: string, ...args_1: unknown[]) => Promise<{
2584
- lng: number;
2585
- lat: number;
2586
- }[]>;
2587
- /**
2588
- * @see https://redis.io/commands/geodist
2589
- */
2590
- geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2591
- /**
2592
- * @see https://redis.io/commands/geohash
2593
- */
2594
- geohash: (args_0: string, ...args_1: unknown[]) => Promise<(string | null)[]>;
2595
- /**
2596
- * @see https://redis.io/commands/geosearch
2597
- */
2598
- geosearch: (key: string, centerPoint: {
2599
- type: "FROMLONLAT" | "fromlonlat";
2600
- coordinate: {
2601
- lon: number;
2602
- lat: number;
2603
- };
2604
- } | {
2605
- type: "FROMMEMBER" | "frommember";
2606
- member: unknown;
2607
- }, shape: {
2608
- type: "BYRADIUS" | "byradius";
2609
- radius: number;
2610
- radiusType: "M" | "KM" | "FT" | "MI";
2611
- } | {
2612
- type: "BYBOX" | "bybox";
2613
- rect: {
2614
- width: number;
2615
- height: number;
2616
- };
2617
- rectType: "M" | "KM" | "FT" | "MI";
2618
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2619
- count?: {
2620
- limit: number;
2621
- any?: boolean | undefined;
2622
- } | undefined;
2623
- withCoord?: boolean | undefined;
2624
- withDist?: boolean | undefined;
2625
- withHash?: boolean | undefined;
2626
- } | undefined) => Promise<({
2627
- member: unknown;
2628
- } & {
2629
- coord?: {
2630
- long: number;
2631
- lat: number;
2632
- } | undefined;
2633
- dist?: number | undefined;
2634
- hash?: string | undefined;
2635
- })[]>;
2636
- /**
2637
- * @see https://redis.io/commands/geosearchstore
2638
- */
2639
- geosearchstore: (destination: string, key: string, centerPoint: {
2640
- type: "FROMLONLAT" | "fromlonlat";
2641
- coordinate: {
2642
- lon: number;
2643
- lat: number;
2644
- };
2645
- } | {
2646
- type: "FROMMEMBER" | "frommember";
2647
- member: unknown;
2648
- }, shape: {
2649
- type: "BYRADIUS" | "byradius";
2650
- radius: number;
2651
- radiusType: "M" | "KM" | "FT" | "MI";
2652
- } | {
2653
- type: "BYBOX" | "bybox";
2654
- rect: {
2655
- width: number;
2656
- height: number;
2657
- };
2658
- rectType: "M" | "KM" | "FT" | "MI";
2659
- }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2660
- count?: {
2661
- limit: number;
2662
- any?: boolean | undefined;
2663
- } | undefined;
2664
- storeDist?: boolean | undefined;
2665
- } | undefined) => Promise<number>;
2666
2620
  /**
2667
2621
  * @see https://redis.io/commands/json.get
2668
2622
  */
@@ -2670,7 +2624,11 @@ declare class Redis {
2670
2624
  /**
2671
2625
  * @see https://redis.io/commands/json.mget
2672
2626
  */
2673
- mget: <TData_1>(keys: string[], path: string) => Promise<TData_1>;
2627
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
2628
+ /**
2629
+ * @see https://redis.io/commands/json.mset
2630
+ */
2631
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2674
2632
  /**
2675
2633
  * @see https://redis.io/commands/json.numincrby
2676
2634
  */
@@ -2696,9 +2654,9 @@ declare class Redis {
2696
2654
  */
2697
2655
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2698
2656
  nx: true;
2699
- xx?: undefined;
2657
+ xx?: never;
2700
2658
  } | {
2701
- nx?: undefined;
2659
+ nx?: never;
2702
2660
  xx: true;
2703
2661
  } | undefined) => Promise<"OK" | null>;
2704
2662
  /**
@@ -2733,6 +2691,7 @@ declare class Redis {
2733
2691
  * @see {@link Pipeline}
2734
2692
  */
2735
2693
  pipeline: () => Pipeline<[]>;
2694
+ protected autoPipeline: () => Redis;
2736
2695
  /**
2737
2696
  * Create a new transaction to allow executing multiple steps atomically.
2738
2697
  *
@@ -2743,6 +2702,22 @@ declare class Redis {
2743
2702
  * @see {@link Pipeline}
2744
2703
  */
2745
2704
  multi: () => Pipeline<[]>;
2705
+ /**
2706
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
2707
+ *
2708
+ * @example
2709
+ * ```typescript
2710
+ * redis.set("mykey", 0);
2711
+ * const result = await redis.bitfield("mykey")
2712
+ * .set("u4", 0, 16)
2713
+ * .incr("u4", "#1", 1)
2714
+ * .exec();
2715
+ * console.log(result); // [0, 1]
2716
+ * ```
2717
+ *
2718
+ * @see https://redis.io/commands/bitfield
2719
+ */
2720
+ bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
2746
2721
  /**
2747
2722
  * @see https://redis.io/commands/append
2748
2723
  */
@@ -2816,8 +2791,98 @@ declare class Redis {
2816
2791
  * @see https://redis.io/commands/flushdb
2817
2792
  */
2818
2793
  flushdb: (opts?: {
2819
- async?: boolean | undefined;
2794
+ async?: boolean;
2820
2795
  } | undefined) => Promise<"OK">;
2796
+ /**
2797
+ * @see https://redis.io/commands/geoadd
2798
+ */
2799
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
2800
+ /**
2801
+ * @see https://redis.io/commands/geopos
2802
+ */
2803
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
2804
+ lng: number;
2805
+ lat: number;
2806
+ }[]>;
2807
+ /**
2808
+ * @see https://redis.io/commands/geodist
2809
+ */
2810
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2811
+ /**
2812
+ * @see https://redis.io/commands/geohash
2813
+ */
2814
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
2815
+ /**
2816
+ * @see https://redis.io/commands/geosearch
2817
+ */
2818
+ geosearch: <TData>(key: string, centerPoint: {
2819
+ type: "FROMLONLAT" | "fromlonlat";
2820
+ coordinate: {
2821
+ lon: number;
2822
+ lat: number;
2823
+ };
2824
+ } | {
2825
+ type: "FROMMEMBER" | "frommember";
2826
+ member: TData;
2827
+ }, shape: {
2828
+ type: "BYRADIUS" | "byradius";
2829
+ radius: number;
2830
+ radiusType: "M" | "KM" | "FT" | "MI";
2831
+ } | {
2832
+ type: "BYBOX" | "bybox";
2833
+ rect: {
2834
+ width: number;
2835
+ height: number;
2836
+ };
2837
+ rectType: "M" | "KM" | "FT" | "MI";
2838
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2839
+ count?: {
2840
+ limit: number;
2841
+ any?: boolean;
2842
+ };
2843
+ withCoord?: boolean;
2844
+ withDist?: boolean;
2845
+ withHash?: boolean;
2846
+ } | undefined) => Promise<({
2847
+ member: TData;
2848
+ } & {
2849
+ coord?: {
2850
+ long: number;
2851
+ lat: number;
2852
+ } | undefined;
2853
+ dist?: number | undefined;
2854
+ hash?: string | undefined;
2855
+ })[]>;
2856
+ /**
2857
+ * @see https://redis.io/commands/geosearchstore
2858
+ */
2859
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
2860
+ type: "FROMLONLAT" | "fromlonlat";
2861
+ coordinate: {
2862
+ lon: number;
2863
+ lat: number;
2864
+ };
2865
+ } | {
2866
+ type: "FROMMEMBER" | "frommember";
2867
+ member: TData;
2868
+ }, shape: {
2869
+ type: "BYRADIUS" | "byradius";
2870
+ radius: number;
2871
+ radiusType: "M" | "KM" | "FT" | "MI";
2872
+ } | {
2873
+ type: "BYBOX" | "bybox";
2874
+ rect: {
2875
+ width: number;
2876
+ height: number;
2877
+ };
2878
+ rectType: "M" | "KM" | "FT" | "MI";
2879
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2880
+ count?: {
2881
+ limit: number;
2882
+ any?: boolean;
2883
+ };
2884
+ storeDist?: boolean;
2885
+ } | undefined) => Promise<number>;
2821
2886
  /**
2822
2887
  * @see https://redis.io/commands/get
2823
2888
  */
@@ -2877,27 +2942,23 @@ declare class Redis {
2877
2942
  /**
2878
2943
  * @see https://redis.io/commands/hmset
2879
2944
  */
2880
- hmset: <TData>(key: string, kv: {
2881
- [field: string]: TData;
2882
- }) => Promise<"OK">;
2945
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2883
2946
  /**
2884
2947
  * @see https://redis.io/commands/hrandfield
2885
2948
  */
2886
2949
  hrandfield: {
2887
- (key: string): Promise<string>;
2950
+ (key: string): Promise<string | null>;
2888
2951
  (key: string, count: number): Promise<string[]>;
2889
2952
  <TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
2890
2953
  };
2891
2954
  /**
2892
2955
  * @see https://redis.io/commands/hscan
2893
2956
  */
2894
- hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
2957
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
2895
2958
  /**
2896
2959
  * @see https://redis.io/commands/hset
2897
2960
  */
2898
- hset: <TData>(key: string, kv: {
2899
- [field: string]: TData;
2900
- }) => Promise<number>;
2961
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2901
2962
  /**
2902
2963
  * @see https://redis.io/commands/hsetnx
2903
2964
  */
@@ -2946,13 +3007,17 @@ declare class Redis {
2946
3007
  * @see https://redis.io/commands/lpop
2947
3008
  */
2948
3009
  lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3010
+ /**
3011
+ * @see https://redis.io/commands/lmpop
3012
+ */
3013
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
2949
3014
  /**
2950
3015
  * @see https://redis.io/commands/lpos
2951
3016
  */
2952
3017
  lpos: <TData = number>(key: string, element: unknown, opts?: {
2953
- rank?: number | undefined;
2954
- count?: number | undefined;
2955
- maxLen?: number | undefined;
3018
+ rank?: number;
3019
+ count?: number;
3020
+ maxLen?: number;
2956
3021
  } | undefined) => Promise<TData>;
2957
3022
  /**
2958
3023
  * @see https://redis.io/commands/lpush
@@ -2985,15 +3050,11 @@ declare class Redis {
2985
3050
  /**
2986
3051
  * @see https://redis.io/commands/mset
2987
3052
  */
2988
- mset: <TData>(kv: {
2989
- [key: string]: TData;
2990
- }) => Promise<"OK">;
3053
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
2991
3054
  /**
2992
3055
  * @see https://redis.io/commands/msetnx
2993
3056
  */
2994
- msetnx: <TData>(kv: {
2995
- [key: string]: TData;
2996
- }) => Promise<number>;
3057
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
2997
3058
  /**
2998
3059
  * @see https://redis.io/commands/persist
2999
3060
  */
@@ -3061,11 +3122,11 @@ declare class Redis {
3061
3122
  /**
3062
3123
  * @see https://redis.io/commands/sadd
3063
3124
  */
3064
- sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
3125
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
3065
3126
  /**
3066
3127
  * @see https://redis.io/commands/scan
3067
3128
  */
3068
- scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, string[]]>;
3129
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, string[]]>;
3069
3130
  /**
3070
3131
  * @see https://redis.io/commands/scard
3071
3132
  */
@@ -3149,7 +3210,7 @@ declare class Redis {
3149
3210
  /**
3150
3211
  * @see https://redis.io/commands/sscan
3151
3212
  */
3152
- sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3213
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3153
3214
  /**
3154
3215
  * @see https://redis.io/commands/strlen
3155
3216
  */
@@ -3185,11 +3246,9 @@ declare class Redis {
3185
3246
  /**
3186
3247
  * @see https://redis.io/commands/xadd
3187
3248
  */
3188
- xadd: (key: string, id: string, entries: {
3189
- [field: string]: unknown;
3190
- }, opts?: {
3191
- nomkStream?: boolean | undefined;
3192
- trim?: (({
3249
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3250
+ nomkStream?: boolean;
3251
+ trim?: ({
3193
3252
  type: "MAXLEN" | "maxlen";
3194
3253
  threshold: number;
3195
3254
  } | {
@@ -3197,11 +3256,11 @@ declare class Redis {
3197
3256
  threshold: string;
3198
3257
  }) & ({
3199
3258
  comparison: "~";
3200
- limit?: number | undefined;
3259
+ limit?: number;
3201
3260
  } | {
3202
3261
  comparison: "=";
3203
- limit?: undefined;
3204
- })) | undefined;
3262
+ limit?: never;
3263
+ });
3205
3264
  } | undefined) => Promise<string>;
3206
3265
  /**
3207
3266
  * @see https://redis.io/commands/xack
@@ -3217,11 +3276,11 @@ declare class Redis {
3217
3276
  xgroup: (key: string, opts: {
3218
3277
  type: "CREATE";
3219
3278
  group: string;
3220
- id: string;
3279
+ id: `$` | string;
3221
3280
  options?: {
3222
- MKSTREAM?: boolean | undefined;
3223
- ENTRIESREAD?: number | undefined;
3224
- } | undefined;
3281
+ MKSTREAM?: boolean;
3282
+ ENTRIESREAD?: number;
3283
+ };
3225
3284
  } | {
3226
3285
  type: "CREATECONSUMER";
3227
3286
  group: string;
@@ -3236,10 +3295,10 @@ declare class Redis {
3236
3295
  } | {
3237
3296
  type: "SETID";
3238
3297
  group: string;
3239
- id: string;
3298
+ id: `$` | string;
3240
3299
  options?: {
3241
- ENTRIESREAD?: number | undefined;
3242
- } | undefined;
3300
+ ENTRIESREAD?: number;
3301
+ };
3243
3302
  }) => Promise<never>;
3244
3303
  /**
3245
3304
  * @see https://redis.io/commands/xread
@@ -3266,35 +3325,35 @@ declare class Redis {
3266
3325
  * @see https://redis.io/commands/xpending
3267
3326
  */
3268
3327
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3269
- idleTime?: number | undefined;
3270
- consumer?: string | string[] | undefined;
3328
+ idleTime?: number;
3329
+ consumer?: string | string[];
3271
3330
  } | undefined) => Promise<unknown[]>;
3272
3331
  /**
3273
3332
  * @see https://redis.io/commands/xclaim
3274
3333
  */
3275
3334
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3276
- idleMS?: number | undefined;
3277
- timeMS?: number | undefined;
3278
- retryCount?: number | undefined;
3279
- force?: boolean | undefined;
3280
- justId?: boolean | undefined;
3281
- lastId?: number | undefined;
3335
+ idleMS?: number;
3336
+ timeMS?: number;
3337
+ retryCount?: number;
3338
+ force?: boolean;
3339
+ justId?: boolean;
3340
+ lastId?: number;
3282
3341
  } | undefined) => Promise<unknown[]>;
3283
3342
  /**
3284
3343
  * @see https://redis.io/commands/xautoclaim
3285
3344
  */
3286
3345
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3287
- count?: number | undefined;
3288
- justId?: boolean | undefined;
3346
+ count?: number;
3347
+ justId?: boolean;
3289
3348
  } | undefined) => Promise<unknown[]>;
3290
3349
  /**
3291
3350
  * @see https://redis.io/commands/xtrim
3292
3351
  */
3293
3352
  xtrim: (key: string, options: {
3294
3353
  strategy: "MAXLEN" | "MINID";
3295
- exactness?: "~" | "=" | undefined;
3296
- threshold: string | number;
3297
- limit?: number | undefined;
3354
+ exactness?: "~" | "=";
3355
+ threshold: number | string;
3356
+ limit?: number;
3298
3357
  }) => Promise<number>;
3299
3358
  /**
3300
3359
  * @see https://redis.io/commands/xrange
@@ -3307,7 +3366,7 @@ declare class Redis {
3307
3366
  /**
3308
3367
  * @see https://redis.io/commands/zadd
3309
3368
  */
3310
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<number | null>;
3369
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3311
3370
  /**
3312
3371
  * @see https://redis.io/commands/zcard
3313
3372
  */
@@ -3347,21 +3406,11 @@ declare class Redis {
3347
3406
  /**
3348
3407
  * @see https://redis.io/commands/zrange
3349
3408
  */
3350
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
3351
- key: string,
3352
- min: `(${string}` | `[${string}` | "-" | "+",
3353
- max: `(${string}` | `[${string}` | "-" | "+",
3354
- opts: {
3355
- byLex: true;
3356
- } & ZRangeCommandOptions
3357
- ] | [
3358
- key: string,
3359
- min: number | `(${number}` | "-inf" | "+inf",
3360
- max: number | `(${number}` | "-inf" | "+inf",
3361
- opts: {
3362
- byScore: true;
3363
- } & ZRangeCommandOptions
3364
- ]) => Promise<TData>;
3409
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3410
+ byLex: true;
3411
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3412
+ byScore: true;
3413
+ } & ZRangeCommandOptions]) => Promise<TData>;
3365
3414
  /**
3366
3415
  * @see https://redis.io/commands/zrank
3367
3416
  */
@@ -3389,7 +3438,7 @@ declare class Redis {
3389
3438
  /**
3390
3439
  * @see https://redis.io/commands/zscan
3391
3440
  */
3392
- zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[number, (string | number)[]]>;
3441
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3393
3442
  /**
3394
3443
  * @see https://redis.io/commands/zscore
3395
3444
  */
@@ -3404,6 +3453,24 @@ declare class Redis {
3404
3453
  zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
3405
3454
  }
3406
3455
 
3456
+ /**
3457
+ * Result of a bad request to upstash
3458
+ */
3459
+ declare class UpstashError extends Error {
3460
+ constructor(message: string);
3461
+ }
3462
+ declare class UrlError extends Error {
3463
+ constructor(url: string);
3464
+ }
3465
+
3466
+ type error_UpstashError = UpstashError;
3467
+ declare const error_UpstashError: typeof UpstashError;
3468
+ type error_UrlError = UrlError;
3469
+ declare const error_UrlError: typeof UrlError;
3470
+ declare namespace error {
3471
+ export { error_UpstashError as UpstashError, error_UrlError as UrlError };
3472
+ }
3473
+
3407
3474
  /**
3408
3475
  * @see https://redis.io/commands/zdiffstore
3409
3476
  */
@@ -3418,4 +3485,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
3418
3485
  constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3419
3486
  }
3420
3487
 
3421
- export { IncrByCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetSetCommand as H, HDelCommand as I, HExistsCommand as J, HGetCommand as K, HGetAllCommand as L, HIncrByCommand as M, HIncrByFloatCommand as N, HKeysCommand as O, HLenCommand as P, HMGetCommand as Q, RedisOptions as R, HMSetCommand as S, HRandFieldCommand as T, UpstashRequest as U, HScanCommand as V, HSetCommand as W, HSetNXCommand as X, HStrLenCommand as Y, HValsCommand as Z, IncrCommand as _, RequesterConfig as a, SetNxCommand as a$, IncrByFloatCommand as a0, JsonArrAppendCommand as a1, JsonArrIndexCommand as a2, JsonArrInsertCommand as a3, JsonArrLenCommand as a4, JsonArrPopCommand as a5, JsonArrTrimCommand as a6, JsonClearCommand as a7, JsonDelCommand as a8, JsonForgetCommand as a9, MSetNXCommand as aA, PersistCommand as aB, PExpireCommand as aC, PExpireAtCommand as aD, PingCommand as aE, PSetEXCommand as aF, PTtlCommand as aG, PublishCommand as aH, RandomKeyCommand as aI, RenameCommand as aJ, RenameNXCommand as aK, RPopCommand as aL, RPushCommand as aM, RPushXCommand as aN, SAddCommand as aO, ScanCommand as aP, ScanCommandOptions as aQ, SCardCommand as aR, ScriptExistsCommand as aS, ScriptFlushCommand as aT, ScriptLoadCommand as aU, SDiffCommand as aV, SDiffStoreCommand as aW, SetCommand as aX, SetCommandOptions as aY, SetBitCommand as aZ, SetExCommand as a_, JsonGetCommand as aa, JsonMGetCommand as ab, JsonNumIncrByCommand as ac, JsonNumMultByCommand as ad, JsonObjKeysCommand as ae, JsonObjLenCommand as af, JsonRespCommand as ag, JsonSetCommand as ah, JsonStrAppendCommand as ai, JsonStrLenCommand as aj, JsonToggleCommand as ak, JsonTypeCommand as al, KeysCommand as am, LIndexCommand as an, LInsertCommand as ao, LLenCommand as ap, LMoveCommand as aq, LPopCommand as ar, LPushCommand as as, LPushXCommand as at, LRangeCommand as au, LRemCommand as av, LSetCommand as aw, LTrimCommand as ax, MGetCommand as ay, MSetCommand as az, Redis as b, SetRangeCommand as b0, SInterCommand as b1, SInterStoreCommand as b2, SIsMemberCommand as b3, SMembersCommand as b4, SMIsMemberCommand as b5, SMoveCommand as b6, SPopCommand as b7, SRandMemberCommand as b8, SRemCommand as b9, ZRangeCommandOptions as bA, ZRankCommand as bB, ZRemCommand as bC, ZRemRangeByLexCommand as bD, ZRemRangeByRankCommand as bE, ZRemRangeByScoreCommand as bF, ZRevRankCommand as bG, ZScanCommand as bH, ZScoreCommand as bI, ZUnionCommand as bJ, ZUnionCommandOptions as bK, ZUnionStoreCommand as bL, ZUnionStoreCommandOptions as bM, SScanCommand as ba, StrLenCommand as bb, SUnionCommand as bc, SUnionStoreCommand as bd, TimeCommand as be, TouchCommand as bf, TtlCommand as bg, Type as bh, TypeCommand as bi, UnlinkCommand as bj, XAddCommand as bk, XRangeCommand as bl, ScoreMember as bm, ZAddCommandOptions as bn, ZAddCommand as bo, ZCardCommand as bp, ZCountCommand as bq, ZDiffStoreCommand as br, ZIncrByCommand as bs, ZInterStoreCommand as bt, ZInterStoreCommandOptions as bu, ZLexCountCommand as bv, ZMScoreCommand as bw, ZPopMaxCommand as bx, ZPopMinCommand as by, ZRangeCommand as bz, Requester as c, UpstashResponse as d, BitOpCommand as e, BitPosCommand as f, DecrCommand as g, DecrByCommand as h, DelCommand as i, EvalCommand as j, EvalshaCommand as k, ExistsCommand as l, ExpireCommand as m, ExpireAtCommand as n, FlushDBCommand as o, GeoAddCommandOptions as p, GeoMember as q, GeoDistCommand as r, GeoHashCommand as s, GeoPosCommand as t, GeoSearchCommand as u, GeoSearchStoreCommand as v, GetCommand as w, GetBitCommand as x, GetDelCommand as y, GetRangeCommand as z };
3488
+ 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, type RedisOptions as R, HLenCommand as S, HMGetCommand as T, type UpstashRequest as U, HMSetCommand as V, HRandFieldCommand as W, HScanCommand as X, HSetCommand as Y, HSetNXCommand as Z, HStrLenCommand as _, type 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, type ScanCommandOptions as aS, SCardCommand as aT, ScriptExistsCommand as aU, ScriptFlushCommand as aV, ScriptLoadCommand as aW, SDiffCommand as aX, SDiffStoreCommand as aY, SetCommand as aZ, type 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, type 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, type ZUnionCommandOptions as bM, ZUnionStoreCommand as bN, type 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 Type as bj, TypeCommand as bk, UnlinkCommand as bl, XAddCommand as bm, XRangeCommand as bn, type ScoreMember as bo, type ZAddCommandOptions as bp, ZAddCommand as bq, ZCardCommand as br, ZCountCommand as bs, ZDiffStoreCommand as bt, ZIncrByCommand as bu, ZInterStoreCommand as bv, type ZInterStoreCommandOptions as bw, ZLexCountCommand as bx, ZMScoreCommand as by, ZPopMaxCommand 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 };