@upstash/redis 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ type RedisOptions = {
26
26
  latencyLogging?: boolean;
27
27
  enableTelemetry?: boolean;
28
28
  enableAutoPipelining?: boolean;
29
+ readYourWrites?: boolean;
29
30
  };
30
31
 
31
32
  type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
@@ -35,12 +36,21 @@ type UpstashRequest = {
35
36
  * Request body will be serialized to json
36
37
  */
37
38
  body?: unknown;
39
+ upstashSyncToken?: string;
38
40
  };
39
41
  type UpstashResponse<TResult> = {
40
42
  result?: TResult;
41
43
  error?: string;
42
44
  };
43
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;
44
54
  request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
45
55
  }
46
56
  type RetryConfig = false | {
@@ -132,8 +142,7 @@ declare class Command<TResult, TData> {
132
142
  exec(client: Requester): Promise<TData>;
133
143
  }
134
144
 
135
- type ZUnionCommandOptions = {
136
- withScores?: boolean;
145
+ type ZUnionStoreCommandOptions = {
137
146
  aggregate?: "sum" | "min" | "max";
138
147
  } & ({
139
148
  weight: number;
@@ -146,14 +155,15 @@ type ZUnionCommandOptions = {
146
155
  weights?: never;
147
156
  });
148
157
  /**
149
- * @see https://redis.io/commands/zunion
158
+ * @see https://redis.io/commands/zunionstore
150
159
  */
151
- declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
152
- constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
153
- constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
160
+ declare class ZUnionStoreCommand extends Command<number, number> {
161
+ constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
162
+ constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
154
163
  }
155
164
 
156
- type ZUnionStoreCommandOptions = {
165
+ type ZUnionCommandOptions = {
166
+ withScores?: boolean;
157
167
  aggregate?: "sum" | "min" | "max";
158
168
  } & ({
159
169
  weight: number;
@@ -166,11 +176,11 @@ type ZUnionStoreCommandOptions = {
166
176
  weights?: never;
167
177
  });
168
178
  /**
169
- * @see https://redis.io/commands/zunionstore
179
+ * @see https://redis.io/commands/zunion
170
180
  */
171
- declare class ZUnionStoreCommand extends Command<number, number> {
172
- constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
173
- constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
181
+ declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
182
+ constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
183
+ constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
174
184
  }
175
185
 
176
186
  type ZInterStoreCommandOptions = {
@@ -236,11 +246,11 @@ type GeoAddCommandOptions = {
236
246
  } & {
237
247
  ch?: boolean;
238
248
  });
239
- interface GeoMember<TMemberType> {
249
+ type GeoMember<TMemberType> = {
240
250
  latitude: number;
241
251
  longitude: number;
242
252
  member: TMemberType;
243
- }
253
+ };
244
254
  /**
245
255
  * @see https://redis.io/commands/geoadd
246
256
  */
@@ -415,7 +425,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
415
425
  * @see https://redis.io/commands/geohash
416
426
  */
417
427
  declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
418
- constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
428
+ constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
419
429
  }
420
430
 
421
431
  type Coordinates = {
@@ -642,9 +652,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
642
652
  * @see https://redis.io/commands/hmset
643
653
  */
644
654
  declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
645
- constructor([key, kv]: [key: string, kv: {
646
- [field: string]: TData;
647
- }], opts?: CommandOptions<"OK", "OK">);
655
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
648
656
  }
649
657
 
650
658
  /**
@@ -673,9 +681,7 @@ declare class HScanCommand extends Command<[
673
681
  * @see https://redis.io/commands/hset
674
682
  */
675
683
  declare class HSetCommand<TData> extends Command<number, number> {
676
- constructor([key, kv]: [key: string, kv: {
677
- [field: string]: TData;
678
- }], opts?: CommandOptions<number, number>);
684
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
679
685
  }
680
686
 
681
687
  /**
@@ -805,6 +811,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
805
811
  constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
806
812
  }
807
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
+
808
825
  /**
809
826
  * @see https://redis.io/commands/json.numincrby
810
827
  */
@@ -961,25 +978,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
961
978
  * @see https://redis.io/commands/mget
962
979
  */
963
980
  declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
964
- constructor(cmd: [string[]] | [...(string[] | string[])], opts?: CommandOptions<(string | null)[], TData>);
981
+ constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
965
982
  }
966
983
 
967
984
  /**
968
985
  * @see https://redis.io/commands/mset
969
986
  */
970
987
  declare class MSetCommand<TData> extends Command<"OK", "OK"> {
971
- constructor([kv]: [kv: {
972
- [key: string]: TData;
973
- }], opts?: CommandOptions<"OK", "OK">);
988
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
974
989
  }
975
990
 
976
991
  /**
977
992
  * @see https://redis.io/commands/msetnx
978
993
  */
979
994
  declare class MSetNXCommand<TData = string> extends Command<number, number> {
980
- constructor([kv]: [kv: {
981
- [key: string]: TData;
982
- }], opts?: CommandOptions<number, number>);
995
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
983
996
  }
984
997
 
985
998
  /**
@@ -1346,9 +1359,7 @@ declare class XAddCommand extends Command<string, string> {
1346
1359
  constructor([key, id, entries, opts]: [
1347
1360
  key: string,
1348
1361
  id: "*" | string,
1349
- entries: {
1350
- [field: string]: unknown;
1351
- },
1362
+ entries: Record<string, unknown>,
1352
1363
  opts?: XAddCommandOptions
1353
1364
  ], commandOptions?: CommandOptions<string, string>);
1354
1365
  }
@@ -1755,7 +1766,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1755
1766
  * @see https://redis.io/commands/flushdb
1756
1767
  */
1757
1768
  flushdb: (opts?: {
1758
- async?: boolean | undefined;
1769
+ async?: boolean;
1759
1770
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1760
1771
  /**
1761
1772
  * @see https://redis.io/commands/geoadd
@@ -1802,11 +1813,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1802
1813
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1803
1814
  count?: {
1804
1815
  limit: number;
1805
- any?: boolean | undefined;
1806
- } | undefined;
1807
- withCoord?: boolean | undefined;
1808
- withDist?: boolean | undefined;
1809
- withHash?: boolean | undefined;
1816
+ any?: boolean;
1817
+ };
1818
+ withCoord?: boolean;
1819
+ withDist?: boolean;
1820
+ withHash?: boolean;
1810
1821
  } | undefined) => Pipeline<[...TCommands, Command<any, ({
1811
1822
  member: TData;
1812
1823
  } & {
@@ -1843,9 +1854,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1843
1854
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1844
1855
  count?: {
1845
1856
  limit: number;
1846
- any?: boolean | undefined;
1847
- } | undefined;
1848
- storeDist?: boolean | undefined;
1857
+ any?: boolean;
1858
+ };
1859
+ storeDist?: boolean;
1849
1860
  } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1850
1861
  /**
1851
1862
  * @see https://redis.io/commands/get
@@ -1906,13 +1917,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1906
1917
  /**
1907
1918
  * @see https://redis.io/commands/hmset
1908
1919
  */
1909
- hmset: <TData>(key: string, kv: {
1910
- [field: string]: TData;
1911
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
1920
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1912
1921
  /**
1913
1922
  * @see https://redis.io/commands/hrandfield
1914
1923
  */
1915
- hrandfield: <TData extends string | Record<string, unknown> | string[]>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
1924
+ hrandfield: <TData extends string | string[] | Record<string, unknown>>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
1916
1925
  /**
1917
1926
  * @see https://redis.io/commands/hscan
1918
1927
  */
@@ -1920,9 +1929,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1920
1929
  /**
1921
1930
  * @see https://redis.io/commands/hset
1922
1931
  */
1923
- hset: <TData>(key: string, kv: {
1924
- [field: string]: TData;
1925
- }) => Pipeline<[...TCommands, Command<any, number>]>;
1932
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1926
1933
  /**
1927
1934
  * @see https://redis.io/commands/hsetnx
1928
1935
  */
@@ -1979,9 +1986,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1979
1986
  * @see https://redis.io/commands/lpos
1980
1987
  */
1981
1988
  lpos: <TData>(key: string, element: unknown, opts?: {
1982
- rank?: number | undefined;
1983
- count?: number | undefined;
1984
- maxLen?: number | undefined;
1989
+ rank?: number;
1990
+ count?: number;
1991
+ maxLen?: number;
1985
1992
  } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
1986
1993
  /**
1987
1994
  * @see https://redis.io/commands/lpush
@@ -2014,15 +2021,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2014
2021
  /**
2015
2022
  * @see https://redis.io/commands/mset
2016
2023
  */
2017
- mset: <TData>(kv: {
2018
- [key: string]: TData;
2019
- }) => Pipeline<[...TCommands, Command<any, "OK">]>;
2024
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
2020
2025
  /**
2021
2026
  * @see https://redis.io/commands/msetnx
2022
2027
  */
2023
- msetnx: <TData>(kv: {
2024
- [key: string]: TData;
2025
- }) => Pipeline<[...TCommands, Command<any, number>]>;
2028
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
2026
2029
  /**
2027
2030
  * @see https://redis.io/commands/persist
2028
2031
  */
@@ -2211,19 +2214,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2211
2214
  /**
2212
2215
  * @see https://redis.io/commands/zadd
2213
2216
  */
2214
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
2215
- key: string,
2216
- opts: ZAddCommandOptions,
2217
- ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
2218
- ]) => Pipeline<[...TCommands, Command<any, number | null>]>;
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>]>;
2219
2218
  /**
2220
2219
  * @see https://redis.io/commands/xadd
2221
2220
  */
2222
- xadd: (key: string, id: string, entries: {
2223
- [field: string]: unknown;
2224
- }, opts?: {
2225
- nomkStream?: boolean | undefined;
2226
- trim?: (({
2221
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2222
+ nomkStream?: boolean;
2223
+ trim?: ({
2227
2224
  type: "MAXLEN" | "maxlen";
2228
2225
  threshold: number;
2229
2226
  } | {
@@ -2231,11 +2228,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2231
2228
  threshold: string;
2232
2229
  }) & ({
2233
2230
  comparison: "~";
2234
- limit?: number | undefined;
2231
+ limit?: number;
2235
2232
  } | {
2236
2233
  comparison: "=";
2237
- limit?: undefined;
2238
- })) | undefined;
2234
+ limit?: never;
2235
+ });
2239
2236
  } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2240
2237
  /**
2241
2238
  * @see https://redis.io/commands/xack
@@ -2251,11 +2248,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2251
2248
  xgroup: (key: string, opts: {
2252
2249
  type: "CREATE";
2253
2250
  group: string;
2254
- id: string;
2251
+ id: `$` | string;
2255
2252
  options?: {
2256
- MKSTREAM?: boolean | undefined;
2257
- ENTRIESREAD?: number | undefined;
2258
- } | undefined;
2253
+ MKSTREAM?: boolean;
2254
+ ENTRIESREAD?: number;
2255
+ };
2259
2256
  } | {
2260
2257
  type: "CREATECONSUMER";
2261
2258
  group: string;
@@ -2270,10 +2267,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2270
2267
  } | {
2271
2268
  type: "SETID";
2272
2269
  group: string;
2273
- id: string;
2270
+ id: `$` | string;
2274
2271
  options?: {
2275
- ENTRIESREAD?: number | undefined;
2276
- } | undefined;
2272
+ ENTRIESREAD?: number;
2273
+ };
2277
2274
  }) => Pipeline<[...TCommands, Command<any, never>]>;
2278
2275
  /**
2279
2276
  * @see https://redis.io/commands/xread
@@ -2300,35 +2297,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2300
2297
  * @see https://redis.io/commands/xpending
2301
2298
  */
2302
2299
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2303
- idleTime?: number | undefined;
2304
- consumer?: string | string[] | undefined;
2300
+ idleTime?: number;
2301
+ consumer?: string | string[];
2305
2302
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2306
2303
  /**
2307
2304
  * @see https://redis.io/commands/xclaim
2308
2305
  */
2309
2306
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2310
- idleMS?: number | undefined;
2311
- timeMS?: number | undefined;
2312
- retryCount?: number | undefined;
2313
- force?: boolean | undefined;
2314
- justId?: boolean | undefined;
2315
- lastId?: number | undefined;
2307
+ idleMS?: number;
2308
+ timeMS?: number;
2309
+ retryCount?: number;
2310
+ force?: boolean;
2311
+ justId?: boolean;
2312
+ lastId?: number;
2316
2313
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2317
2314
  /**
2318
2315
  * @see https://redis.io/commands/xautoclaim
2319
2316
  */
2320
2317
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2321
- count?: number | undefined;
2322
- justId?: boolean | undefined;
2318
+ count?: number;
2319
+ justId?: boolean;
2323
2320
  } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2324
2321
  /**
2325
2322
  * @see https://redis.io/commands/xtrim
2326
2323
  */
2327
2324
  xtrim: (key: string, options: {
2328
2325
  strategy: "MAXLEN" | "MINID";
2329
- exactness?: "~" | "=" | undefined;
2330
- threshold: string | number;
2331
- limit?: number | undefined;
2326
+ exactness?: "~" | "=";
2327
+ threshold: number | string;
2328
+ limit?: number;
2332
2329
  }) => Pipeline<[...TCommands, Command<any, number>]>;
2333
2330
  /**
2334
2331
  * @see https://redis.io/commands/xrange
@@ -2373,21 +2370,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2373
2370
  /**
2374
2371
  * @see https://redis.io/commands/zrange
2375
2372
  */
2376
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
2377
- key: string,
2378
- min: `(${string}` | `[${string}` | "-" | "+",
2379
- max: `(${string}` | `[${string}` | "-" | "+",
2380
- opts: {
2381
- byLex: true;
2382
- } & ZRangeCommandOptions
2383
- ] | [
2384
- key: string,
2385
- min: number | `(${number}` | "-inf" | "+inf",
2386
- max: number | `(${number}` | "-inf" | "+inf",
2387
- opts: {
2388
- byScore: true;
2389
- } & ZRangeCommandOptions
2390
- ]) => Pipeline<[...TCommands, Command<any, TData>]>;
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>]>;
2391
2378
  /**
2392
2379
  * @see https://redis.io/commands/zrank
2393
2380
  */
@@ -2476,6 +2463,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2476
2463
  * @see https://redis.io/commands/json.mget
2477
2464
  */
2478
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>]>;
2479
2470
  /**
2480
2471
  * @see https://redis.io/commands/json.numincrby
2481
2472
  */
@@ -2501,9 +2492,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
2501
2492
  */
2502
2493
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2503
2494
  nx: true;
2504
- xx?: undefined;
2495
+ xx?: never;
2505
2496
  } | {
2506
- nx?: undefined;
2497
+ nx?: never;
2507
2498
  xx: true;
2508
2499
  } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2509
2500
  /**
@@ -2631,7 +2622,11 @@ declare class Redis {
2631
2622
  /**
2632
2623
  * @see https://redis.io/commands/json.mget
2633
2624
  */
2634
- mget: <TData_1>(keys: string[], path: string) => Promise<TData_1>;
2625
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
2626
+ /**
2627
+ * @see https://redis.io/commands/json.mset
2628
+ */
2629
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2635
2630
  /**
2636
2631
  * @see https://redis.io/commands/json.numincrby
2637
2632
  */
@@ -2657,9 +2652,9 @@ declare class Redis {
2657
2652
  */
2658
2653
  set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2659
2654
  nx: true;
2660
- xx?: undefined;
2655
+ xx?: never;
2661
2656
  } | {
2662
- nx?: undefined;
2657
+ nx?: never;
2663
2658
  xx: true;
2664
2659
  } | undefined) => Promise<"OK" | null>;
2665
2660
  /**
@@ -2794,7 +2789,7 @@ declare class Redis {
2794
2789
  * @see https://redis.io/commands/flushdb
2795
2790
  */
2796
2791
  flushdb: (opts?: {
2797
- async?: boolean | undefined;
2792
+ async?: boolean;
2798
2793
  } | undefined) => Promise<"OK">;
2799
2794
  /**
2800
2795
  * @see https://redis.io/commands/geoadd
@@ -2841,11 +2836,11 @@ declare class Redis {
2841
2836
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2842
2837
  count?: {
2843
2838
  limit: number;
2844
- any?: boolean | undefined;
2845
- } | undefined;
2846
- withCoord?: boolean | undefined;
2847
- withDist?: boolean | undefined;
2848
- withHash?: boolean | undefined;
2839
+ any?: boolean;
2840
+ };
2841
+ withCoord?: boolean;
2842
+ withDist?: boolean;
2843
+ withHash?: boolean;
2849
2844
  } | undefined) => Promise<({
2850
2845
  member: TData;
2851
2846
  } & {
@@ -2882,9 +2877,9 @@ declare class Redis {
2882
2877
  }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2883
2878
  count?: {
2884
2879
  limit: number;
2885
- any?: boolean | undefined;
2886
- } | undefined;
2887
- storeDist?: boolean | undefined;
2880
+ any?: boolean;
2881
+ };
2882
+ storeDist?: boolean;
2888
2883
  } | undefined) => Promise<number>;
2889
2884
  /**
2890
2885
  * @see https://redis.io/commands/get
@@ -2945,9 +2940,7 @@ declare class Redis {
2945
2940
  /**
2946
2941
  * @see https://redis.io/commands/hmset
2947
2942
  */
2948
- hmset: <TData>(key: string, kv: {
2949
- [field: string]: TData;
2950
- }) => Promise<"OK">;
2943
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2951
2944
  /**
2952
2945
  * @see https://redis.io/commands/hrandfield
2953
2946
  */
@@ -2963,9 +2956,7 @@ declare class Redis {
2963
2956
  /**
2964
2957
  * @see https://redis.io/commands/hset
2965
2958
  */
2966
- hset: <TData>(key: string, kv: {
2967
- [field: string]: TData;
2968
- }) => Promise<number>;
2959
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2969
2960
  /**
2970
2961
  * @see https://redis.io/commands/hsetnx
2971
2962
  */
@@ -3022,9 +3013,9 @@ declare class Redis {
3022
3013
  * @see https://redis.io/commands/lpos
3023
3014
  */
3024
3015
  lpos: <TData = number>(key: string, element: unknown, opts?: {
3025
- rank?: number | undefined;
3026
- count?: number | undefined;
3027
- maxLen?: number | undefined;
3016
+ rank?: number;
3017
+ count?: number;
3018
+ maxLen?: number;
3028
3019
  } | undefined) => Promise<TData>;
3029
3020
  /**
3030
3021
  * @see https://redis.io/commands/lpush
@@ -3057,15 +3048,11 @@ declare class Redis {
3057
3048
  /**
3058
3049
  * @see https://redis.io/commands/mset
3059
3050
  */
3060
- mset: <TData>(kv: {
3061
- [key: string]: TData;
3062
- }) => Promise<"OK">;
3051
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
3063
3052
  /**
3064
3053
  * @see https://redis.io/commands/msetnx
3065
3054
  */
3066
- msetnx: <TData>(kv: {
3067
- [key: string]: TData;
3068
- }) => Promise<number>;
3055
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
3069
3056
  /**
3070
3057
  * @see https://redis.io/commands/persist
3071
3058
  */
@@ -3257,11 +3244,9 @@ declare class Redis {
3257
3244
  /**
3258
3245
  * @see https://redis.io/commands/xadd
3259
3246
  */
3260
- xadd: (key: string, id: string, entries: {
3261
- [field: string]: unknown;
3262
- }, opts?: {
3263
- nomkStream?: boolean | undefined;
3264
- trim?: (({
3247
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3248
+ nomkStream?: boolean;
3249
+ trim?: ({
3265
3250
  type: "MAXLEN" | "maxlen";
3266
3251
  threshold: number;
3267
3252
  } | {
@@ -3269,11 +3254,11 @@ declare class Redis {
3269
3254
  threshold: string;
3270
3255
  }) & ({
3271
3256
  comparison: "~";
3272
- limit?: number | undefined;
3257
+ limit?: number;
3273
3258
  } | {
3274
3259
  comparison: "=";
3275
- limit?: undefined;
3276
- })) | undefined;
3260
+ limit?: never;
3261
+ });
3277
3262
  } | undefined) => Promise<string>;
3278
3263
  /**
3279
3264
  * @see https://redis.io/commands/xack
@@ -3289,11 +3274,11 @@ declare class Redis {
3289
3274
  xgroup: (key: string, opts: {
3290
3275
  type: "CREATE";
3291
3276
  group: string;
3292
- id: string;
3277
+ id: `$` | string;
3293
3278
  options?: {
3294
- MKSTREAM?: boolean | undefined;
3295
- ENTRIESREAD?: number | undefined;
3296
- } | undefined;
3279
+ MKSTREAM?: boolean;
3280
+ ENTRIESREAD?: number;
3281
+ };
3297
3282
  } | {
3298
3283
  type: "CREATECONSUMER";
3299
3284
  group: string;
@@ -3308,10 +3293,10 @@ declare class Redis {
3308
3293
  } | {
3309
3294
  type: "SETID";
3310
3295
  group: string;
3311
- id: string;
3296
+ id: `$` | string;
3312
3297
  options?: {
3313
- ENTRIESREAD?: number | undefined;
3314
- } | undefined;
3298
+ ENTRIESREAD?: number;
3299
+ };
3315
3300
  }) => Promise<never>;
3316
3301
  /**
3317
3302
  * @see https://redis.io/commands/xread
@@ -3338,35 +3323,35 @@ declare class Redis {
3338
3323
  * @see https://redis.io/commands/xpending
3339
3324
  */
3340
3325
  xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3341
- idleTime?: number | undefined;
3342
- consumer?: string | string[] | undefined;
3326
+ idleTime?: number;
3327
+ consumer?: string | string[];
3343
3328
  } | undefined) => Promise<unknown[]>;
3344
3329
  /**
3345
3330
  * @see https://redis.io/commands/xclaim
3346
3331
  */
3347
3332
  xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3348
- idleMS?: number | undefined;
3349
- timeMS?: number | undefined;
3350
- retryCount?: number | undefined;
3351
- force?: boolean | undefined;
3352
- justId?: boolean | undefined;
3353
- lastId?: number | undefined;
3333
+ idleMS?: number;
3334
+ timeMS?: number;
3335
+ retryCount?: number;
3336
+ force?: boolean;
3337
+ justId?: boolean;
3338
+ lastId?: number;
3354
3339
  } | undefined) => Promise<unknown[]>;
3355
3340
  /**
3356
3341
  * @see https://redis.io/commands/xautoclaim
3357
3342
  */
3358
3343
  xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3359
- count?: number | undefined;
3360
- justId?: boolean | undefined;
3344
+ count?: number;
3345
+ justId?: boolean;
3361
3346
  } | undefined) => Promise<unknown[]>;
3362
3347
  /**
3363
3348
  * @see https://redis.io/commands/xtrim
3364
3349
  */
3365
3350
  xtrim: (key: string, options: {
3366
3351
  strategy: "MAXLEN" | "MINID";
3367
- exactness?: "~" | "=" | undefined;
3368
- threshold: string | number;
3369
- limit?: number | undefined;
3352
+ exactness?: "~" | "=";
3353
+ threshold: number | string;
3354
+ limit?: number;
3370
3355
  }) => Promise<number>;
3371
3356
  /**
3372
3357
  * @see https://redis.io/commands/xrange
@@ -3379,11 +3364,7 @@ declare class Redis {
3379
3364
  /**
3380
3365
  * @see https://redis.io/commands/zadd
3381
3366
  */
3382
- zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
3383
- key: string,
3384
- opts: ZAddCommandOptions,
3385
- ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
3386
- ]) => Promise<number | null>;
3367
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3387
3368
  /**
3388
3369
  * @see https://redis.io/commands/zcard
3389
3370
  */
@@ -3423,21 +3404,11 @@ declare class Redis {
3423
3404
  /**
3424
3405
  * @see https://redis.io/commands/zrange
3425
3406
  */
3426
- zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
3427
- key: string,
3428
- min: `(${string}` | `[${string}` | "-" | "+",
3429
- max: `(${string}` | `[${string}` | "-" | "+",
3430
- opts: {
3431
- byLex: true;
3432
- } & ZRangeCommandOptions
3433
- ] | [
3434
- key: string,
3435
- min: number | `(${number}` | "-inf" | "+inf",
3436
- max: number | `(${number}` | "-inf" | "+inf",
3437
- opts: {
3438
- byScore: true;
3439
- } & ZRangeCommandOptions
3440
- ]) => Promise<TData>;
3407
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3408
+ byLex: true;
3409
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3410
+ byScore: true;
3411
+ } & ZRangeCommandOptions]) => Promise<TData>;
3441
3412
  /**
3442
3413
  * @see https://redis.io/commands/zrank
3443
3414
  */
@@ -3495,10 +3466,7 @@ declare const error_UpstashError: typeof UpstashError;
3495
3466
  type error_UrlError = UrlError;
3496
3467
  declare const error_UrlError: typeof UrlError;
3497
3468
  declare namespace error {
3498
- export {
3499
- error_UpstashError as UpstashError,
3500
- error_UrlError as UrlError,
3501
- };
3469
+ export { error_UpstashError as UpstashError, error_UrlError as UrlError };
3502
3470
  }
3503
3471
 
3504
3472
  /**
@@ -3515,4 +3483,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
3515
3483
  constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3516
3484
  }
3517
3485
 
3518
- export { HValsCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetRangeCommand as H, GetSetCommand as I, HDelCommand as J, HExistsCommand as K, HGetCommand as L, HGetAllCommand as M, HIncrByCommand as N, HIncrByFloatCommand as O, Pipeline as P, HKeysCommand as Q, RedisOptions as R, HLenCommand as S, HMGetCommand as T, UpstashRequest as U, HMSetCommand as V, HRandFieldCommand as W, HScanCommand as X, HSetCommand as Y, HSetNXCommand as Z, HStrLenCommand as _, RequesterConfig as a, SetBitCommand as a$, IncrCommand as a0, IncrByCommand as a1, IncrByFloatCommand as a2, JsonArrAppendCommand as a3, JsonArrIndexCommand as a4, JsonArrInsertCommand as a5, JsonArrLenCommand as a6, JsonArrPopCommand as a7, JsonArrTrimCommand as a8, JsonClearCommand as a9, MGetCommand as aA, MSetCommand as aB, MSetNXCommand as aC, PersistCommand as aD, PExpireCommand as aE, PExpireAtCommand as aF, PingCommand as aG, PSetEXCommand as aH, PTtlCommand as aI, PublishCommand as aJ, RandomKeyCommand as aK, RenameCommand as aL, RenameNXCommand as aM, RPopCommand as aN, RPushCommand as aO, RPushXCommand as aP, SAddCommand as aQ, ScanCommand as aR, ScanCommandOptions as aS, SCardCommand as aT, ScriptExistsCommand as aU, ScriptFlushCommand as aV, ScriptLoadCommand as aW, SDiffCommand as aX, SDiffStoreCommand as aY, SetCommand as aZ, SetCommandOptions as a_, JsonDelCommand as aa, JsonForgetCommand as ab, JsonGetCommand as ac, JsonMGetCommand as ad, JsonNumIncrByCommand as ae, JsonNumMultByCommand as af, JsonObjKeysCommand as ag, JsonObjLenCommand as ah, JsonRespCommand as ai, JsonSetCommand as aj, JsonStrAppendCommand as ak, JsonStrLenCommand as al, JsonToggleCommand as am, JsonTypeCommand as an, KeysCommand as ao, LIndexCommand as ap, LInsertCommand as aq, LLenCommand as ar, LMoveCommand as as, LPopCommand as at, LPushCommand as au, LPushXCommand as av, LRangeCommand as aw, LRemCommand as ax, LSetCommand as ay, LTrimCommand as az, Redis as b, SetExCommand as b0, SetNxCommand as b1, SetRangeCommand as b2, SInterCommand as b3, SInterStoreCommand as b4, SIsMemberCommand as b5, SMembersCommand as b6, SMIsMemberCommand as b7, SMoveCommand as b8, SPopCommand as b9, ZPopMinCommand as bA, ZRangeCommand as bB, ZRangeCommandOptions as bC, ZRankCommand as bD, ZRemCommand as bE, ZRemRangeByLexCommand as bF, ZRemRangeByRankCommand as bG, ZRemRangeByScoreCommand as bH, ZRevRankCommand as bI, ZScanCommand as bJ, ZScoreCommand as bK, ZUnionCommand as bL, ZUnionCommandOptions as bM, ZUnionStoreCommand as bN, ZUnionStoreCommandOptions as bO, SRandMemberCommand as ba, SRemCommand as bb, SScanCommand as bc, StrLenCommand as bd, SUnionCommand as be, SUnionStoreCommand as bf, TimeCommand as bg, TouchCommand as bh, TtlCommand as bi, Type as bj, TypeCommand as bk, UnlinkCommand as bl, XAddCommand as bm, XRangeCommand as bn, ScoreMember as bo, ZAddCommandOptions as bp, ZAddCommand as bq, ZCardCommand as br, ZCountCommand as bs, ZDiffStoreCommand as bt, ZIncrByCommand as bu, ZInterStoreCommand as bv, ZInterStoreCommandOptions as bw, ZLexCountCommand as bx, ZMScoreCommand as by, ZPopMaxCommand as bz, Requester as c, UpstashResponse as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalCommand as k, EvalshaCommand as l, ExistsCommand as m, ExpireCommand as n, ExpireAtCommand as o, FlushDBCommand as p, GeoAddCommandOptions as q, GeoMember as r, GeoDistCommand as s, GeoHashCommand as t, GeoPosCommand as u, GeoSearchCommand as v, GeoSearchStoreCommand as w, GetCommand as x, GetBitCommand as y, GetDelCommand as z };
3486
+ 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 };