@upstash/redis 1.33.0 → 1.33.1-canary

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.
@@ -0,0 +1,3476 @@
1
+ type CommandArgs<TCommand extends new (..._args: any) => any> = ConstructorParameters<TCommand>[0];
2
+ type Telemetry = {
3
+ /**
4
+ * Upstash-Telemetry-Sdk
5
+ * @example @upstash/redis@v1.1.1
6
+ */
7
+ sdk?: string;
8
+ /**
9
+ * Upstash-Telemetry-Platform
10
+ * @example cloudflare
11
+ */
12
+ platform?: string;
13
+ /**
14
+ * Upstash-Telemetry-Runtime
15
+ * @example node@v18
16
+ */
17
+ runtime?: string;
18
+ };
19
+ type RedisOptions = {
20
+ /**
21
+ * Automatically try to deserialize the returned data from upstash using `JSON.deserialize`
22
+ *
23
+ * @default true
24
+ */
25
+ automaticDeserialization?: boolean;
26
+ latencyLogging?: boolean;
27
+ enableTelemetry?: boolean;
28
+ enableAutoPipelining?: boolean;
29
+ };
30
+
31
+ type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
32
+ type UpstashRequest = {
33
+ path?: string[];
34
+ /**
35
+ * Request body will be serialized to json
36
+ */
37
+ body?: unknown;
38
+ };
39
+ type UpstashResponse<TResult> = {
40
+ result?: TResult;
41
+ error?: string;
42
+ };
43
+ type Requester = {
44
+ request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
45
+ };
46
+ type RetryConfig = false | {
47
+ /**
48
+ * The number of retries to attempt before giving up.
49
+ *
50
+ * @default 5
51
+ */
52
+ retries?: number;
53
+ /**
54
+ * A backoff function receives the current retry cound and returns a number in milliseconds to wait before retrying.
55
+ *
56
+ * @default
57
+ * ```ts
58
+ * Math.exp(retryCount) * 50
59
+ * ```
60
+ */
61
+ backoff?: (retryCount: number) => number;
62
+ };
63
+ type RequesterConfig = {
64
+ /**
65
+ * Configure the retry behaviour in case of network errors
66
+ */
67
+ retry?: RetryConfig;
68
+ /**
69
+ * Due to the nature of dynamic and custom data, it is possible to write data to redis that is not
70
+ * valid json and will therefore cause errors when deserializing. This used to happen very
71
+ * frequently with non-utf8 data, such as emojis.
72
+ *
73
+ * By default we will therefore encode the data as base64 on the server, before sending it to the
74
+ * client. The client will then decode the base64 data and parse it as utf8.
75
+ *
76
+ * For very large entries, this can add a few milliseconds, so if you are sure that your data is
77
+ * valid utf8, you can disable this behaviour by setting this option to false.
78
+ *
79
+ * Here's what the response body looks like:
80
+ *
81
+ * ```json
82
+ * {
83
+ * result?: "base64-encoded",
84
+ * error?: string
85
+ * }
86
+ * ```
87
+ *
88
+ * @default "base64"
89
+ */
90
+ responseEncoding?: false | "base64";
91
+ /**
92
+ * Configure the cache behaviour
93
+ * @default "no-store"
94
+ */
95
+ cache?: CacheSetting;
96
+ };
97
+
98
+ type Serialize = (data: unknown) => string | number | boolean;
99
+ type Deserialize<TResult, TData> = (result: TResult) => TData;
100
+ type CommandOptions<TResult, TData> = {
101
+ /**
102
+ * Custom deserializer
103
+ */
104
+ deserialize?: (result: TResult) => TData;
105
+ /**
106
+ * Automatically try to deserialize the returned data from upstash using `JSON.deserialize`
107
+ *
108
+ * @default true
109
+ */
110
+ automaticDeserialization?: boolean;
111
+ latencyLogging?: boolean;
112
+ };
113
+ /**
114
+ * Command offers default (de)serialization and the exec method to all commands.
115
+ *
116
+ * TData represents what the user will enter or receive,
117
+ * TResult is the raw data returned from upstash, which may need to be transformed or parsed.
118
+ */
119
+ declare class Command<TResult, TData> {
120
+ readonly command: (string | number | boolean)[];
121
+ readonly serialize: Serialize;
122
+ readonly deserialize: Deserialize<TResult, TData>;
123
+ /**
124
+ * Create a new command instance.
125
+ *
126
+ * You can define a custom `deserialize` function. By default we try to deserialize as json.
127
+ */
128
+ constructor(command: (string | boolean | number | unknown)[], opts?: CommandOptions<TResult, TData>);
129
+ /**
130
+ * Execute the command using a client.
131
+ */
132
+ exec(client: Requester): Promise<TData>;
133
+ }
134
+
135
+ type ZUnionStoreCommandOptions = {
136
+ aggregate?: "sum" | "min" | "max";
137
+ } & ({
138
+ weight: number;
139
+ weights?: never;
140
+ } | {
141
+ weight?: never;
142
+ weights: number[];
143
+ } | {
144
+ weight?: never;
145
+ weights?: never;
146
+ });
147
+ /**
148
+ * @see https://redis.io/commands/zunionstore
149
+ */
150
+ declare class ZUnionStoreCommand extends Command<number, number> {
151
+ constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
152
+ constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
153
+ }
154
+
155
+ type ZUnionCommandOptions = {
156
+ withScores?: boolean;
157
+ aggregate?: "sum" | "min" | "max";
158
+ } & ({
159
+ weight: number;
160
+ weights?: never;
161
+ } | {
162
+ weight?: never;
163
+ weights: number[];
164
+ } | {
165
+ weight?: never;
166
+ weights?: never;
167
+ });
168
+ /**
169
+ * @see https://redis.io/commands/zunion
170
+ */
171
+ declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
172
+ constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
173
+ constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
174
+ }
175
+
176
+ type ZInterStoreCommandOptions = {
177
+ aggregate?: "sum" | "min" | "max";
178
+ } & ({
179
+ weight: number;
180
+ weights?: never;
181
+ } | {
182
+ weight?: never;
183
+ weights: number[];
184
+ } | {
185
+ weight?: never;
186
+ weights?: never;
187
+ });
188
+ /**
189
+ * @see https://redis.io/commands/zInterstore
190
+ */
191
+ declare class ZInterStoreCommand extends Command<number, number> {
192
+ constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZInterStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
193
+ constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
194
+ }
195
+
196
+ type Type = "string" | "list" | "set" | "zset" | "hash" | "none";
197
+ /**
198
+ * @see https://redis.io/commands/type
199
+ */
200
+ declare class TypeCommand extends Command<Type, Type> {
201
+ constructor(cmd: [key: string], opts?: CommandOptions<Type, Type>);
202
+ }
203
+
204
+ type ScriptFlushCommandOptions = {
205
+ sync: true;
206
+ async?: never;
207
+ } | {
208
+ sync?: never;
209
+ async: true;
210
+ };
211
+ /**
212
+ * @see https://redis.io/commands/script-flush
213
+ */
214
+ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
215
+ constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
216
+ }
217
+
218
+ type ScanCommandOptions = {
219
+ match?: string;
220
+ count?: number;
221
+ type?: string;
222
+ };
223
+ /**
224
+ * @see https://redis.io/commands/scan
225
+ */
226
+ declare class ScanCommand extends Command<[string, string[]], [string, string[]]> {
227
+ constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], [string, string[]]>);
228
+ }
229
+
230
+ type GeoAddCommandOptions = {
231
+ nx?: boolean;
232
+ xx?: never;
233
+ } | ({
234
+ nx?: never;
235
+ xx?: boolean;
236
+ } & {
237
+ ch?: boolean;
238
+ });
239
+ type GeoMember<TMemberType> = {
240
+ latitude: number;
241
+ longitude: number;
242
+ member: TMemberType;
243
+ };
244
+ /**
245
+ * @see https://redis.io/commands/geoadd
246
+ */
247
+ declare class GeoAddCommand<TMemberType = string> extends Command<number | null, number | null> {
248
+ constructor([key, arg1, ...arg2]: [
249
+ string,
250
+ GeoMember<TMemberType> | GeoAddCommandOptions,
251
+ ...GeoMember<TMemberType>[]
252
+ ], opts?: CommandOptions<number | null, number | null>);
253
+ }
254
+
255
+ /**
256
+ * @see https://redis.io/commands/append
257
+ */
258
+ declare class AppendCommand extends Command<number, number> {
259
+ constructor(cmd: [key: string, value: string], opts?: CommandOptions<number, number>);
260
+ }
261
+
262
+ /**
263
+ * @see https://redis.io/commands/bitcount
264
+ */
265
+ declare class BitCountCommand extends Command<number, number> {
266
+ constructor(cmd: [key: string, start?: never, end?: never], opts?: CommandOptions<number, number>);
267
+ constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
268
+ }
269
+
270
+ type SubCommandArgs<TRest extends unknown[] = []> = [
271
+ encoding: string,
272
+ offset: number | string,
273
+ ...TRest
274
+ ];
275
+ /**
276
+ * @see https://redis.io/commands/bitfield
277
+ */
278
+ declare class BitFieldCommand<T = Promise<number[]>> {
279
+ private client;
280
+ private opts?;
281
+ private execOperation;
282
+ private command;
283
+ constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
284
+ private chain;
285
+ get(...args: SubCommandArgs): this;
286
+ set(...args: SubCommandArgs<[value: number]>): this;
287
+ incrby(...args: SubCommandArgs<[increment: number]>): this;
288
+ overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
289
+ exec(): T;
290
+ }
291
+
292
+ /**
293
+ * @see https://redis.io/commands/bitop
294
+ */
295
+ declare class BitOpCommand extends Command<number, number> {
296
+ constructor(cmd: [op: "and" | "or" | "xor", destinationKey: string, ...sourceKeys: string[]], opts?: CommandOptions<number, number>);
297
+ constructor(cmd: [op: "not", destinationKey: string, sourceKey: string], opts?: CommandOptions<number, number>);
298
+ }
299
+
300
+ /**
301
+ * @see https://redis.io/commands/bitpos
302
+ */
303
+ declare class BitPosCommand extends Command<number, number> {
304
+ constructor(cmd: [key: string, bit: 0 | 1, start?: number, end?: number], opts?: CommandOptions<number, number>);
305
+ }
306
+
307
+ /**
308
+ * @see https://redis.io/commands/copy
309
+ */
310
+ declare class CopyCommand extends Command<number, "COPIED" | "NOT_COPIED"> {
311
+ constructor([key, destinationKey, opts]: [key: string, destinationKey: string, opts?: {
312
+ replace: boolean;
313
+ }], commandOptions?: CommandOptions<number, "COPIED" | "NOT_COPIED">);
314
+ }
315
+
316
+ /**
317
+ * @see https://redis.io/commands/dbsize
318
+ */
319
+ declare class DBSizeCommand extends Command<number, number> {
320
+ constructor(opts?: CommandOptions<number, number>);
321
+ }
322
+
323
+ /**
324
+ * @see https://redis.io/commands/decr
325
+ */
326
+ declare class DecrCommand extends Command<number, number> {
327
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
328
+ }
329
+
330
+ /**
331
+ * @see https://redis.io/commands/decrby
332
+ */
333
+ declare class DecrByCommand extends Command<number, number> {
334
+ constructor(cmd: [key: string, decrement: number], opts?: CommandOptions<number, number>);
335
+ }
336
+
337
+ /**
338
+ * @see https://redis.io/commands/del
339
+ */
340
+ declare class DelCommand extends Command<number, number> {
341
+ constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
342
+ }
343
+
344
+ /**
345
+ * @see https://redis.io/commands/echo
346
+ */
347
+ declare class EchoCommand extends Command<string, string> {
348
+ constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
349
+ }
350
+
351
+ /**
352
+ * @see https://redis.io/commands/eval
353
+ */
354
+ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
355
+ constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
356
+ }
357
+
358
+ /**
359
+ * @see https://redis.io/commands/evalsha
360
+ */
361
+ declare class EvalshaCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
362
+ constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
363
+ }
364
+
365
+ /**
366
+ * @see https://redis.io/commands/exists
367
+ */
368
+ declare class ExistsCommand extends Command<number, number> {
369
+ constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
370
+ }
371
+
372
+ type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
373
+ declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
374
+ constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
375
+ }
376
+
377
+ /**
378
+ * @see https://redis.io/commands/expireat
379
+ */
380
+ declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
381
+ constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
382
+ }
383
+
384
+ /**
385
+ * @see https://redis.io/commands/flushall
386
+ */
387
+ declare class FlushAllCommand extends Command<"OK", "OK"> {
388
+ constructor(args?: [{
389
+ async?: boolean;
390
+ }], opts?: CommandOptions<"OK", "OK">);
391
+ }
392
+
393
+ /**
394
+ * @see https://redis.io/commands/flushdb
395
+ */
396
+ declare class FlushDBCommand extends Command<"OK", "OK"> {
397
+ constructor([opts]: [opts?: {
398
+ async?: boolean;
399
+ }], cmdOpts?: CommandOptions<"OK", "OK">);
400
+ }
401
+
402
+ /**
403
+ * @see https://redis.io/commands/geodist
404
+ */
405
+ declare class GeoDistCommand<TMemberType = string> extends Command<number | null, number | null> {
406
+ constructor([key, member1, member2, unit]: [
407
+ key: string,
408
+ member1: TMemberType,
409
+ member2: TMemberType,
410
+ unit?: "M" | "KM" | "FT" | "MI"
411
+ ], opts?: CommandOptions<number | null, number | null>);
412
+ }
413
+
414
+ /**
415
+ * @see https://redis.io/commands/geohash
416
+ */
417
+ declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
418
+ constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
419
+ }
420
+
421
+ type Coordinates = {
422
+ lng: number;
423
+ lat: number;
424
+ };
425
+ /**
426
+ * @see https://redis.io/commands/geopos
427
+ */
428
+ declare class GeoPosCommand<TMember = string> extends Command<(string | null)[][], Coordinates[]> {
429
+ constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[][], Coordinates[]>);
430
+ }
431
+
432
+ type RadiusOptions$1 = "M" | "KM" | "FT" | "MI";
433
+ type CenterPoint$1<TMemberType> = {
434
+ type: "FROMMEMBER" | "frommember";
435
+ member: TMemberType;
436
+ } | {
437
+ type: "FROMLONLAT" | "fromlonlat";
438
+ coordinate: {
439
+ lon: number;
440
+ lat: number;
441
+ };
442
+ };
443
+ type Shape$1 = {
444
+ type: "BYRADIUS" | "byradius";
445
+ radius: number;
446
+ radiusType: RadiusOptions$1;
447
+ } | {
448
+ type: "BYBOX" | "bybox";
449
+ rect: {
450
+ width: number;
451
+ height: number;
452
+ };
453
+ rectType: RadiusOptions$1;
454
+ };
455
+ type GeoSearchCommandOptions$1 = {
456
+ count?: {
457
+ limit: number;
458
+ any?: boolean;
459
+ };
460
+ withCoord?: boolean;
461
+ withDist?: boolean;
462
+ withHash?: boolean;
463
+ };
464
+ type OptionMappings = {
465
+ withHash: "hash";
466
+ withCoord: "coord";
467
+ withDist: "dist";
468
+ };
469
+ type GeoSearchOptions<TOptions> = {
470
+ [K in keyof TOptions as K extends keyof OptionMappings ? OptionMappings[K] : never]: K extends "withHash" ? string : K extends "withCoord" ? {
471
+ long: number;
472
+ lat: number;
473
+ } : K extends "withDist" ? number : never;
474
+ };
475
+ type GeoSearchResponse<TOptions, TMemberType> = ({
476
+ member: TMemberType;
477
+ } & GeoSearchOptions<TOptions>)[];
478
+ /**
479
+ * @see https://redis.io/commands/geosearch
480
+ */
481
+ declare class GeoSearchCommand<TMemberType = string, TOptions extends GeoSearchCommandOptions$1 = GeoSearchCommandOptions$1> extends Command<any[] | any[][], GeoSearchResponse<TOptions, TMemberType>> {
482
+ constructor([key, centerPoint, shape, order, opts]: [
483
+ key: string,
484
+ centerPoint: CenterPoint$1<TMemberType>,
485
+ shape: Shape$1,
486
+ order: "ASC" | "DESC" | "asc" | "desc",
487
+ opts?: TOptions
488
+ ], commandOptions?: CommandOptions<any[] | any[][], GeoSearchResponse<TOptions, TMemberType>>);
489
+ }
490
+
491
+ type RadiusOptions = "M" | "KM" | "FT" | "MI";
492
+ type CenterPoint<TMemberType> = {
493
+ type: "FROMMEMBER" | "frommember";
494
+ member: TMemberType;
495
+ } | {
496
+ type: "FROMLONLAT" | "fromlonlat";
497
+ coordinate: {
498
+ lon: number;
499
+ lat: number;
500
+ };
501
+ };
502
+ type Shape = {
503
+ type: "BYRADIUS" | "byradius";
504
+ radius: number;
505
+ radiusType: RadiusOptions;
506
+ } | {
507
+ type: "BYBOX" | "bybox";
508
+ rect: {
509
+ width: number;
510
+ height: number;
511
+ };
512
+ rectType: RadiusOptions;
513
+ };
514
+ type GeoSearchCommandOptions = {
515
+ count?: {
516
+ limit: number;
517
+ any?: boolean;
518
+ };
519
+ storeDist?: boolean;
520
+ };
521
+ /**
522
+ * @see https://redis.io/commands/geosearchstore
523
+ */
524
+ declare class GeoSearchStoreCommand<TMemberType = string, TOptions extends GeoSearchCommandOptions = GeoSearchCommandOptions> extends Command<any[] | any[][], number> {
525
+ constructor([destination, key, centerPoint, shape, order, opts]: [
526
+ destination: string,
527
+ key: string,
528
+ centerPoint: CenterPoint<TMemberType>,
529
+ shape: Shape,
530
+ order: "ASC" | "DESC" | "asc" | "desc",
531
+ opts?: TOptions
532
+ ], commandOptions?: CommandOptions<any[] | any[][], number>);
533
+ }
534
+
535
+ /**
536
+ * @see https://redis.io/commands/get
537
+ */
538
+ declare class GetCommand<TData = string> extends Command<unknown | null, TData | null> {
539
+ constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
540
+ }
541
+
542
+ /**
543
+ * @see https://redis.io/commands/getbit
544
+ */
545
+ declare class GetBitCommand extends Command<"0" | "1", 0 | 1> {
546
+ constructor(cmd: [key: string, offset: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
547
+ }
548
+
549
+ /**
550
+ * @see https://redis.io/commands/getdel
551
+ */
552
+ declare class GetDelCommand<TData = string> extends Command<unknown | null, TData | null> {
553
+ constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
554
+ }
555
+
556
+ /**
557
+ * @see https://redis.io/commands/getrange
558
+ */
559
+ declare class GetRangeCommand extends Command<string, string> {
560
+ constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<string, string>);
561
+ }
562
+
563
+ /**
564
+ * @see https://redis.io/commands/getset
565
+ */
566
+ declare class GetSetCommand<TData = string> extends Command<unknown | null, TData | null> {
567
+ constructor(cmd: [key: string, value: TData], opts?: CommandOptions<unknown | null, TData | null>);
568
+ }
569
+
570
+ /**
571
+ * @see https://redis.io/commands/hdel
572
+ */
573
+ declare class HDelCommand extends Command<"0" | "1", 0 | 1> {
574
+ constructor(cmd: [key: string, ...fields: string[]], opts?: CommandOptions<"0" | "1", 0 | 1>);
575
+ }
576
+
577
+ /**
578
+ * @see https://redis.io/commands/hexists
579
+ */
580
+ declare class HExistsCommand extends Command<number, number> {
581
+ constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
582
+ }
583
+
584
+ /**
585
+ * @see https://redis.io/commands/hget
586
+ */
587
+ declare class HGetCommand<TData> extends Command<unknown | null, TData | null> {
588
+ constructor(cmd: [key: string, field: string], opts?: CommandOptions<unknown | null, TData | null>);
589
+ }
590
+
591
+ /**
592
+ * @see https://redis.io/commands/hgetall
593
+ */
594
+ declare class HGetAllCommand<TData extends Record<string, unknown>> extends Command<unknown | null, TData | null> {
595
+ constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
596
+ }
597
+
598
+ /**
599
+ * @see https://redis.io/commands/hincrby
600
+ */
601
+ declare class HIncrByCommand extends Command<number, number> {
602
+ constructor(cmd: [key: string, field: string, increment: number], opts?: CommandOptions<number, number>);
603
+ }
604
+
605
+ /**
606
+ * @see https://redis.io/commands/hincrbyfloat
607
+ */
608
+ declare class HIncrByFloatCommand extends Command<number, number> {
609
+ constructor(cmd: [key: string, field: string, increment: number], opts?: CommandOptions<number, number>);
610
+ }
611
+
612
+ /**
613
+ * @see https://redis.io/commands/hkeys
614
+ */
615
+ declare class HKeysCommand extends Command<string[], string[]> {
616
+ constructor([key]: [key: string], opts?: CommandOptions<string[], string[]>);
617
+ }
618
+
619
+ /**
620
+ * @see https://redis.io/commands/hlen
621
+ */
622
+ declare class HLenCommand extends Command<number, number> {
623
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
624
+ }
625
+
626
+ /**
627
+ * hmget returns an object of all requested fields from a hash
628
+ * The field values are returned as an object like this:
629
+ * ```ts
630
+ * {[fieldName: string]: T | null}
631
+ * ```
632
+ *
633
+ * In case the hash does not exist or all fields are empty `null` is returned
634
+ *
635
+ * @see https://redis.io/commands/hmget
636
+ */
637
+ declare class HMGetCommand<TData extends Record<string, unknown>> extends Command<(string | null)[], TData | null> {
638
+ constructor([key, ...fields]: [key: string, ...fields: string[]], opts?: CommandOptions<(string | null)[], TData | null>);
639
+ }
640
+
641
+ /**
642
+ * @see https://redis.io/commands/hmset
643
+ */
644
+ declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
645
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
646
+ }
647
+
648
+ /**
649
+ * @see https://redis.io/commands/hrandfield
650
+ */
651
+ declare class HRandFieldCommand<TData extends string | string[] | Record<string, unknown>> extends Command<string | string[], TData> {
652
+ constructor(cmd: [key: string], opts?: CommandOptions<string, string>);
653
+ constructor(cmd: [key: string, count: number], opts?: CommandOptions<string[], string[]>);
654
+ constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
655
+ }
656
+
657
+ /**
658
+ * @see https://redis.io/commands/hscan
659
+ */
660
+ declare class HScanCommand extends Command<[
661
+ string,
662
+ (string | number)[]
663
+ ], [
664
+ string,
665
+ (string | number)[]
666
+ ]> {
667
+ constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
668
+ }
669
+
670
+ /**
671
+ * @see https://redis.io/commands/hset
672
+ */
673
+ declare class HSetCommand<TData> extends Command<number, number> {
674
+ constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
675
+ }
676
+
677
+ /**
678
+ * @see https://redis.io/commands/hsetnx
679
+ */
680
+ declare class HSetNXCommand<TData> extends Command<"0" | "1", 0 | 1> {
681
+ constructor(cmd: [key: string, field: string, value: TData], opts?: CommandOptions<"0" | "1", 0 | 1>);
682
+ }
683
+
684
+ /**
685
+ * @see https://redis.io/commands/hstrlen
686
+ */
687
+ declare class HStrLenCommand extends Command<number, number> {
688
+ constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
689
+ }
690
+
691
+ /**
692
+ * @see https://redis.io/commands/hvals
693
+ */
694
+ declare class HValsCommand<TData extends unknown[]> extends Command<unknown[], TData> {
695
+ constructor(cmd: [key: string], opts?: CommandOptions<unknown[], TData>);
696
+ }
697
+
698
+ /**
699
+ * @see https://redis.io/commands/incr
700
+ */
701
+ declare class IncrCommand extends Command<number, number> {
702
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
703
+ }
704
+
705
+ /**
706
+ * @see https://redis.io/commands/incrby
707
+ */
708
+ declare class IncrByCommand extends Command<number, number> {
709
+ constructor(cmd: [key: string, value: number], opts?: CommandOptions<number, number>);
710
+ }
711
+
712
+ /**
713
+ * @see https://redis.io/commands/incrbyfloat
714
+ */
715
+ declare class IncrByFloatCommand extends Command<number, number> {
716
+ constructor(cmd: [key: string, value: number], opts?: CommandOptions<number, number>);
717
+ }
718
+
719
+ /**
720
+ * @see https://redis.io/commands/json.arrappend
721
+ */
722
+ declare class JsonArrAppendCommand<TData extends unknown[]> extends Command<(null | string)[], (null | number)[]> {
723
+ constructor(cmd: [key: string, path: string, ...values: TData], opts?: CommandOptions<(null | string)[], (null | number)[]>);
724
+ }
725
+
726
+ /**
727
+ * @see https://redis.io/commands/json.arrindex
728
+ */
729
+ declare class JsonArrIndexCommand<TValue> extends Command<(null | string)[], (null | number)[]> {
730
+ constructor(cmd: [key: string, path: string, value: TValue, start?: number, stop?: number], opts?: CommandOptions<(null | string)[], (null | number)[]>);
731
+ }
732
+
733
+ /**
734
+ * @see https://redis.io/commands/json.arrinsert
735
+ */
736
+ declare class JsonArrInsertCommand<TData extends unknown[]> extends Command<(null | string)[], (null | number)[]> {
737
+ constructor(cmd: [key: string, path: string, index: number, ...values: TData], opts?: CommandOptions<(null | string)[], (null | number)[]>);
738
+ }
739
+
740
+ /**
741
+ * @see https://redis.io/commands/json.arrlen
742
+ */
743
+ declare class JsonArrLenCommand extends Command<(null | string)[], (null | number)[]> {
744
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(null | string)[], (null | number)[]>);
745
+ }
746
+
747
+ /**
748
+ * @see https://redis.io/commands/json.arrpop
749
+ */
750
+ declare class JsonArrPopCommand<TData> extends Command<(null | string)[], (TData | null)[]> {
751
+ constructor(cmd: [key: string, path?: string, index?: number], opts?: CommandOptions<(null | string)[], (TData | null)[]>);
752
+ }
753
+
754
+ /**
755
+ * @see https://redis.io/commands/json.arrtrim
756
+ */
757
+ declare class JsonArrTrimCommand extends Command<(null | string)[], (null | number)[]> {
758
+ constructor(cmd: [key: string, path?: string, start?: number, stop?: number], opts?: CommandOptions<(null | string)[], (null | number)[]>);
759
+ }
760
+
761
+ /**
762
+ * @see https://redis.io/commands/json.clear
763
+ */
764
+ declare class JsonClearCommand extends Command<number, number> {
765
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<number, number>);
766
+ }
767
+
768
+ /**
769
+ * @see https://redis.io/commands/json.del
770
+ */
771
+ declare class JsonDelCommand extends Command<number, number> {
772
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<number, number>);
773
+ }
774
+
775
+ /**
776
+ * @see https://redis.io/commands/json.forget
777
+ */
778
+ declare class JsonForgetCommand extends Command<number, number> {
779
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<number, number>);
780
+ }
781
+
782
+ /**
783
+ * @see https://redis.io/commands/json.get
784
+ */
785
+ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) | (unknown | Record<string, unknown>)[]> extends Command<TData | null, TData | null> {
786
+ constructor(cmd: [
787
+ key: string,
788
+ opts?: {
789
+ indent?: string;
790
+ newline?: string;
791
+ space?: string;
792
+ },
793
+ ...path: string[]
794
+ ] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
795
+ }
796
+
797
+ /**
798
+ * @see https://redis.io/commands/json.mget
799
+ */
800
+ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
801
+ constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
802
+ }
803
+
804
+ /**
805
+ * @see https://redis.io/commands/json.mset
806
+ */
807
+ declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
808
+ constructor(cmd: {
809
+ key: string;
810
+ path: string;
811
+ value: TData;
812
+ }[], opts?: CommandOptions<"OK" | null, "OK" | null>);
813
+ }
814
+
815
+ /**
816
+ * @see https://redis.io/commands/json.numincrby
817
+ */
818
+ declare class JsonNumIncrByCommand extends Command<(null | string)[], (null | number)[]> {
819
+ constructor(cmd: [key: string, path: string, value: number], opts?: CommandOptions<(null | string)[], (null | number)[]>);
820
+ }
821
+
822
+ /**
823
+ * @see https://redis.io/commands/json.nummultby
824
+ */
825
+ declare class JsonNumMultByCommand extends Command<(null | string)[], (null | number)[]> {
826
+ constructor(cmd: [key: string, path: string, value: number], opts?: CommandOptions<(null | string)[], (null | number)[]>);
827
+ }
828
+
829
+ /**
830
+ * @see https://redis.io/commands/json.objkeys
831
+ */
832
+ declare class JsonObjKeysCommand extends Command<(string[] | null)[], (string[] | null)[]> {
833
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(string[] | null)[], (string[] | null)[]>);
834
+ }
835
+
836
+ /**
837
+ * @see https://redis.io/commands/json.objlen
838
+ */
839
+ declare class JsonObjLenCommand extends Command<(number | null)[], (number | null)[]> {
840
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(number | null)[], (number | null)[]>);
841
+ }
842
+
843
+ /**
844
+ * @see https://redis.io/commands/json.resp
845
+ */
846
+ declare class JsonRespCommand<TData extends unknown[]> extends Command<TData, TData> {
847
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<TData, TData>);
848
+ }
849
+
850
+ /**
851
+ * @see https://redis.io/commands/json.set
852
+ */
853
+ declare class JsonSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
854
+ constructor(cmd: [
855
+ key: string,
856
+ path: string,
857
+ value: TData,
858
+ opts?: {
859
+ nx: true;
860
+ xx?: never;
861
+ } | {
862
+ nx?: never;
863
+ xx: true;
864
+ }
865
+ ], opts?: CommandOptions<"OK" | null, "OK" | null>);
866
+ }
867
+
868
+ /**
869
+ * @see https://redis.io/commands/json.strappend
870
+ */
871
+ declare class JsonStrAppendCommand extends Command<(null | string)[], (null | number)[]> {
872
+ constructor(cmd: [key: string, path: string, value: string], opts?: CommandOptions<(null | string)[], (null | number)[]>);
873
+ }
874
+
875
+ /**
876
+ * @see https://redis.io/commands/json.strlen
877
+ */
878
+ declare class JsonStrLenCommand extends Command<(number | null)[], (number | null)[]> {
879
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<(number | null)[], (number | null)[]>);
880
+ }
881
+
882
+ /**
883
+ * @see https://redis.io/commands/json.toggle
884
+ */
885
+ declare class JsonToggleCommand extends Command<number[], number[]> {
886
+ constructor(cmd: [key: string, path: string], opts?: CommandOptions<number[], number[]>);
887
+ }
888
+
889
+ /**
890
+ * @see https://redis.io/commands/json.type
891
+ */
892
+ declare class JsonTypeCommand extends Command<string[], string[]> {
893
+ constructor(cmd: [key: string, path?: string], opts?: CommandOptions<string[], string[]>);
894
+ }
895
+
896
+ /**
897
+ * @see https://redis.io/commands/keys
898
+ */
899
+ declare class KeysCommand extends Command<string[], string[]> {
900
+ constructor(cmd: [pattern: string], opts?: CommandOptions<string[], string[]>);
901
+ }
902
+
903
+ declare class LIndexCommand<TData = string> extends Command<unknown | null, TData | null> {
904
+ constructor(cmd: [key: string, index: number], opts?: CommandOptions<unknown | null, TData | null>);
905
+ }
906
+
907
+ declare class LInsertCommand<TData = string> extends Command<number, number> {
908
+ constructor(cmd: [key: string, direction: "before" | "after", pivot: TData, value: TData], opts?: CommandOptions<number, number>);
909
+ }
910
+
911
+ /**
912
+ * @see https://redis.io/commands/llen
913
+ */
914
+ declare class LLenCommand extends Command<number, number> {
915
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
916
+ }
917
+
918
+ /**
919
+ * @see https://redis.io/commands/lmove
920
+ */
921
+ declare class LMoveCommand<TData = string> extends Command<TData, TData> {
922
+ constructor(cmd: [
923
+ source: string,
924
+ destination: string,
925
+ whereFrom: "left" | "right",
926
+ whereTo: "left" | "right"
927
+ ], opts?: CommandOptions<TData, TData>);
928
+ }
929
+
930
+ /**
931
+ * @see https://redis.io/commands/lpop
932
+ */
933
+ declare class LPopCommand<TData = string> extends Command<unknown | null, TData | null> {
934
+ constructor(cmd: [key: string, count?: number], opts?: CommandOptions<unknown | null, TData | null>);
935
+ }
936
+
937
+ /**
938
+ * @see https://redis.io/commands/lpush
939
+ */
940
+ declare class LPushCommand<TData = string> extends Command<number, number> {
941
+ constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions<number, number>);
942
+ }
943
+
944
+ /**
945
+ * @see https://redis.io/commands/lpushx
946
+ */
947
+ declare class LPushXCommand<TData> extends Command<number, number> {
948
+ constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions<number, number>);
949
+ }
950
+
951
+ declare class LRangeCommand<TData = string> extends Command<unknown[], TData[]> {
952
+ constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<unknown[], TData[]>);
953
+ }
954
+
955
+ declare class LRemCommand<TData> extends Command<number, number> {
956
+ constructor(cmd: [key: string, count: number, value: TData], opts?: CommandOptions<number, number>);
957
+ }
958
+
959
+ declare class LSetCommand<TData = string> extends Command<"OK", "OK"> {
960
+ constructor(cmd: [key: string, index: number, data: TData], opts?: CommandOptions<"OK", "OK">);
961
+ }
962
+
963
+ declare class LTrimCommand extends Command<"OK", "OK"> {
964
+ constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<"OK", "OK">);
965
+ }
966
+
967
+ /**
968
+ * @see https://redis.io/commands/mget
969
+ */
970
+ declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
971
+ constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
972
+ }
973
+
974
+ /**
975
+ * @see https://redis.io/commands/mset
976
+ */
977
+ declare class MSetCommand<TData> extends Command<"OK", "OK"> {
978
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
979
+ }
980
+
981
+ /**
982
+ * @see https://redis.io/commands/msetnx
983
+ */
984
+ declare class MSetNXCommand<TData = string> extends Command<number, number> {
985
+ constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
986
+ }
987
+
988
+ /**
989
+ * @see https://redis.io/commands/persist
990
+ */
991
+ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
992
+ constructor(cmd: [key: string], opts?: CommandOptions<"0" | "1", 0 | 1>);
993
+ }
994
+
995
+ /**
996
+ * @see https://redis.io/commands/pexpire
997
+ */
998
+ declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
999
+ constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
1000
+ }
1001
+
1002
+ /**
1003
+ * @see https://redis.io/commands/pexpireat
1004
+ */
1005
+ declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
1006
+ constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
1007
+ }
1008
+
1009
+ /**
1010
+ * @see https://redis.io/commands/ping
1011
+ */
1012
+ declare class PingCommand extends Command<string | "PONG", string | "PONG"> {
1013
+ constructor(cmd?: [message?: string], opts?: CommandOptions<string | "PONG", string | "PONG">);
1014
+ }
1015
+
1016
+ /**
1017
+ * @see https://redis.io/commands/psetex
1018
+ */
1019
+ declare class PSetEXCommand<TData = string> extends Command<string, string> {
1020
+ constructor(cmd: [key: string, ttl: number, value: TData], opts?: CommandOptions<string, string>);
1021
+ }
1022
+
1023
+ /**
1024
+ * @see https://redis.io/commands/pttl
1025
+ */
1026
+ declare class PTtlCommand extends Command<number, number> {
1027
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
1028
+ }
1029
+
1030
+ /**
1031
+ * @see https://redis.io/commands/publish
1032
+ */
1033
+ declare class PublishCommand<TMessage = unknown> extends Command<number, number> {
1034
+ constructor(cmd: [channel: string, message: TMessage], opts?: CommandOptions<number, number>);
1035
+ }
1036
+
1037
+ /**
1038
+ * @see https://redis.io/commands/randomkey
1039
+ */
1040
+ declare class RandomKeyCommand extends Command<string | null, string | null> {
1041
+ constructor(opts?: CommandOptions<string | null, string | null>);
1042
+ }
1043
+
1044
+ /**
1045
+ * @see https://redis.io/commands/rename
1046
+ */
1047
+ declare class RenameCommand extends Command<"OK", "OK"> {
1048
+ constructor(cmd: [source: string, destination: string], opts?: CommandOptions<"OK", "OK">);
1049
+ }
1050
+
1051
+ /**
1052
+ * @see https://redis.io/commands/renamenx
1053
+ */
1054
+ declare class RenameNXCommand extends Command<"0" | "1", 0 | 1> {
1055
+ constructor(cmd: [source: string, destination: string], opts?: CommandOptions<"0" | "1", 0 | 1>);
1056
+ }
1057
+
1058
+ /**
1059
+ * @see https://redis.io/commands/rpop
1060
+ */
1061
+ declare class RPopCommand<TData extends unknown | unknown[] = string> extends Command<unknown | null, TData | null> {
1062
+ constructor(cmd: [key: string, count?: number], opts?: CommandOptions<unknown | null, TData | null>);
1063
+ }
1064
+
1065
+ /**
1066
+ * @see https://redis.io/commands/rpush
1067
+ */
1068
+ declare class RPushCommand<TData = string> extends Command<number, number> {
1069
+ constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions<number, number>);
1070
+ }
1071
+
1072
+ /**
1073
+ * @see https://redis.io/commands/rpushx
1074
+ */
1075
+ declare class RPushXCommand<TData = string> extends Command<number, number> {
1076
+ constructor(cmd: [key: string, ...elements: TData[]], opts?: CommandOptions<number, number>);
1077
+ }
1078
+
1079
+ /**
1080
+ * @see https://redis.io/commands/sadd
1081
+ */
1082
+ declare class SAddCommand<TData = string> extends Command<number, number> {
1083
+ constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1084
+ }
1085
+
1086
+ /**
1087
+ * @see https://redis.io/commands/scard
1088
+ */
1089
+ declare class SCardCommand extends Command<number, number> {
1090
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
1091
+ }
1092
+
1093
+ /**
1094
+ * @see https://redis.io/commands/script-exists
1095
+ */
1096
+ declare class ScriptExistsCommand<T extends string[]> extends Command<string[], number[]> {
1097
+ constructor(hashes: T, opts?: CommandOptions<string[], number[]>);
1098
+ }
1099
+
1100
+ /**
1101
+ * @see https://redis.io/commands/script-load
1102
+ */
1103
+ declare class ScriptLoadCommand extends Command<string, string> {
1104
+ constructor(args: [script: string], opts?: CommandOptions<string, string>);
1105
+ }
1106
+
1107
+ /**
1108
+ * @see https://redis.io/commands/sdiff
1109
+ */
1110
+ declare class SDiffCommand<TData> extends Command<unknown[], TData[]> {
1111
+ constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions<unknown[], TData[]>);
1112
+ }
1113
+
1114
+ /**
1115
+ * @see https://redis.io/commands/sdiffstore
1116
+ */
1117
+ declare class SDiffStoreCommand extends Command<number, number> {
1118
+ constructor(cmd: [destination: string, ...keys: string[]], opts?: CommandOptions<number, number>);
1119
+ }
1120
+
1121
+ type SetCommandOptions = {
1122
+ get?: boolean;
1123
+ } & ({
1124
+ ex: number;
1125
+ px?: never;
1126
+ exat?: never;
1127
+ pxat?: never;
1128
+ keepTtl?: never;
1129
+ } | {
1130
+ ex?: never;
1131
+ px: number;
1132
+ exat?: never;
1133
+ pxat?: never;
1134
+ keepTtl?: never;
1135
+ } | {
1136
+ ex?: never;
1137
+ px?: never;
1138
+ exat: number;
1139
+ pxat?: never;
1140
+ keepTtl?: never;
1141
+ } | {
1142
+ ex?: never;
1143
+ px?: never;
1144
+ exat?: never;
1145
+ pxat: number;
1146
+ keepTtl?: never;
1147
+ } | {
1148
+ ex?: never;
1149
+ px?: never;
1150
+ exat?: never;
1151
+ pxat?: never;
1152
+ keepTtl: true;
1153
+ } | {
1154
+ ex?: never;
1155
+ px?: never;
1156
+ exat?: never;
1157
+ pxat?: never;
1158
+ keepTtl?: never;
1159
+ }) & ({
1160
+ nx: true;
1161
+ xx?: never;
1162
+ } | {
1163
+ xx: true;
1164
+ nx?: never;
1165
+ } | {
1166
+ xx?: never;
1167
+ nx?: never;
1168
+ });
1169
+ /**
1170
+ * @see https://redis.io/commands/set
1171
+ */
1172
+ declare class SetCommand<TData, TResult = TData | "OK" | null> extends Command<TResult, TData | "OK" | null> {
1173
+ constructor([key, value, opts]: [key: string, value: TData, opts?: SetCommandOptions], cmdOpts?: CommandOptions<TResult, TData>);
1174
+ }
1175
+
1176
+ /**
1177
+ * @see https://redis.io/commands/setbit
1178
+ */
1179
+ declare class SetBitCommand extends Command<"0" | "1", 0 | 1> {
1180
+ constructor(cmd: [key: string, offset: number, value: 0 | 1], opts?: CommandOptions<"0" | "1", 0 | 1>);
1181
+ }
1182
+
1183
+ /**
1184
+ * @see https://redis.io/commands/setex
1185
+ */
1186
+ declare class SetExCommand<TData = string> extends Command<"OK", "OK"> {
1187
+ constructor(cmd: [key: string, ttl: number, value: TData], opts?: CommandOptions<"OK", "OK">);
1188
+ }
1189
+
1190
+ /**
1191
+ * @see https://redis.io/commands/setnx
1192
+ */
1193
+ declare class SetNxCommand<TData = string> extends Command<number, number> {
1194
+ constructor(cmd: [key: string, value: TData], opts?: CommandOptions<number, number>);
1195
+ }
1196
+
1197
+ /**
1198
+ * @see https://redis.io/commands/setrange
1199
+ */
1200
+ declare class SetRangeCommand extends Command<number, number> {
1201
+ constructor(cmd: [key: string, offset: number, value: string], opts?: CommandOptions<number, number>);
1202
+ }
1203
+
1204
+ /**
1205
+ * @see https://redis.io/commands/sinter
1206
+ */
1207
+ declare class SInterCommand<TData = string> extends Command<unknown[], TData[]> {
1208
+ constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions<unknown[], TData[]>);
1209
+ }
1210
+
1211
+ /**
1212
+ * @see https://redis.io/commands/sinterstore
1213
+ */
1214
+ declare class SInterStoreCommand extends Command<number, number> {
1215
+ constructor(cmd: [destination: string, key: string, ...keys: string[]], opts?: CommandOptions<number, number>);
1216
+ }
1217
+
1218
+ /**
1219
+ * @see https://redis.io/commands/sismember
1220
+ */
1221
+ declare class SIsMemberCommand<TData = string> extends Command<"0" | "1", 0 | 1> {
1222
+ constructor(cmd: [key: string, member: TData], opts?: CommandOptions<"0" | "1", 0 | 1>);
1223
+ }
1224
+
1225
+ /**
1226
+ * @see https://redis.io/commands/smembers
1227
+ */
1228
+ declare class SMembersCommand<TData extends unknown[] = string[]> extends Command<unknown[], TData> {
1229
+ constructor(cmd: [key: string], opts?: CommandOptions<unknown[], TData>);
1230
+ }
1231
+
1232
+ /**
1233
+ * @see https://redis.io/commands/smismember
1234
+ */
1235
+ declare class SMIsMemberCommand<TMembers extends unknown[]> extends Command<("0" | "1")[], (0 | 1)[]> {
1236
+ constructor(cmd: [key: string, members: TMembers], opts?: CommandOptions<("0" | "1")[], (0 | 1)[]>);
1237
+ }
1238
+
1239
+ /**
1240
+ * @see https://redis.io/commands/smove
1241
+ */
1242
+ declare class SMoveCommand<TData> extends Command<"0" | "1", 0 | 1> {
1243
+ constructor(cmd: [source: string, destination: string, member: TData], opts?: CommandOptions<"0" | "1", 0 | 1>);
1244
+ }
1245
+
1246
+ /**
1247
+ * @see https://redis.io/commands/spop
1248
+ */
1249
+ declare class SPopCommand<TData> extends Command<string | string[] | null, TData | null> {
1250
+ constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | string[] | null, TData | null>);
1251
+ }
1252
+
1253
+ /**
1254
+ * @see https://redis.io/commands/srandmember
1255
+ */
1256
+ declare class SRandMemberCommand<TData> extends Command<string | null, TData | null> {
1257
+ constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | null, TData | null>);
1258
+ }
1259
+
1260
+ /**
1261
+ * @see https://redis.io/commands/srem
1262
+ */
1263
+ declare class SRemCommand<TData = string> extends Command<number, number> {
1264
+ constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1265
+ }
1266
+
1267
+ /**
1268
+ * @see https://redis.io/commands/sscan
1269
+ */
1270
+ declare class SScanCommand extends Command<[
1271
+ string,
1272
+ (string | number)[]
1273
+ ], [
1274
+ string,
1275
+ (string | number)[]
1276
+ ]> {
1277
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1278
+ }
1279
+
1280
+ /**
1281
+ * @see https://redis.io/commands/strlen
1282
+ */
1283
+ declare class StrLenCommand extends Command<number, number> {
1284
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
1285
+ }
1286
+
1287
+ /**
1288
+ * @see https://redis.io/commands/sunion
1289
+ */
1290
+ declare class SUnionCommand<TData> extends Command<string[], TData[]> {
1291
+ constructor(cmd: [key: string, ...keys: string[]], opts?: CommandOptions<string[], TData[]>);
1292
+ }
1293
+
1294
+ /**
1295
+ * @see https://redis.io/commands/sunionstore
1296
+ */
1297
+ declare class SUnionStoreCommand extends Command<number, number> {
1298
+ constructor(cmd: [destination: string, key: string, ...keys: string[]], opts?: CommandOptions<number, number>);
1299
+ }
1300
+
1301
+ /**
1302
+ * @see https://redis.io/commands/time
1303
+ */
1304
+ declare class TimeCommand extends Command<[number, number], [number, number]> {
1305
+ constructor(opts?: CommandOptions<[number, number], [number, number]>);
1306
+ }
1307
+
1308
+ /**
1309
+ * @see https://redis.io/commands/touch
1310
+ */
1311
+ declare class TouchCommand extends Command<number, number> {
1312
+ constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
1313
+ }
1314
+
1315
+ /**
1316
+ * @see https://redis.io/commands/ttl
1317
+ */
1318
+ declare class TtlCommand extends Command<number, number> {
1319
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
1320
+ }
1321
+
1322
+ /**
1323
+ * @see https://redis.io/commands/unlink
1324
+ */
1325
+ declare class UnlinkCommand extends Command<number, number> {
1326
+ constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
1327
+ }
1328
+
1329
+ type XAddCommandOptions = {
1330
+ nomkStream?: boolean;
1331
+ trim?: ({
1332
+ type: "MAXLEN" | "maxlen";
1333
+ threshold: number;
1334
+ } | {
1335
+ type: "MINID" | "minid";
1336
+ threshold: string;
1337
+ }) & ({
1338
+ comparison: "~";
1339
+ limit?: number;
1340
+ } | {
1341
+ comparison: "=";
1342
+ limit?: never;
1343
+ });
1344
+ };
1345
+ /**
1346
+ * @see https://redis.io/commands/xadd
1347
+ */
1348
+ declare class XAddCommand extends Command<string, string> {
1349
+ constructor([key, id, entries, opts]: [
1350
+ key: string,
1351
+ id: "*" | string,
1352
+ entries: Record<string, unknown>,
1353
+ opts?: XAddCommandOptions
1354
+ ], commandOptions?: CommandOptions<string, string>);
1355
+ }
1356
+
1357
+ declare class XRangeCommand<TData extends Record<string, Record<string, unknown>>> extends Command<string[][], TData> {
1358
+ constructor([key, start, end, count]: [key: string, start: string, end: string, count?: number], opts?: CommandOptions<unknown[], TData[]>);
1359
+ }
1360
+
1361
+ type XReadCommandOptions = [
1362
+ key: string | string[],
1363
+ id: string | string[],
1364
+ options?: {
1365
+ count?: number;
1366
+ blockMS?: number;
1367
+ }
1368
+ ];
1369
+ type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [key: string, id: string, options?: {
1370
+ count?: number;
1371
+ blockMS?: number;
1372
+ }] : never : K extends string[] ? I extends string[] ? [key: string[], id: string[], options?: {
1373
+ count?: number;
1374
+ blockMS?: number;
1375
+ }] : never : never : never;
1376
+ /**
1377
+ * @see https://redis.io/commands/xread
1378
+ */
1379
+ declare class XReadCommand extends Command<number, unknown[]> {
1380
+ constructor([key, id, options]: XReadOptions, opts?: CommandOptions<number, unknown[]>);
1381
+ }
1382
+
1383
+ type Options = {
1384
+ count?: number;
1385
+ blockMS?: number;
1386
+ NOACK?: boolean;
1387
+ };
1388
+ type XReadGroupCommandOptions = [
1389
+ group: string,
1390
+ consumer: string,
1391
+ key: string | string[],
1392
+ id: string | string[],
1393
+ options?: Options
1394
+ ];
1395
+ type XReadGroupOptions = XReadGroupCommandOptions extends [
1396
+ string,
1397
+ string,
1398
+ infer TKey,
1399
+ infer TId,
1400
+ ...any[]
1401
+ ] ? TKey extends string ? TId extends string ? [group: string, consumer: string, key: string, id: string, options?: Options] : never : TKey extends string[] ? TId extends string[] ? [group: string, consumer: string, key: string[], id: string[], options?: Options] : never : never : never;
1402
+ /**
1403
+ * @see https://redis.io/commands/xreadgroup
1404
+ */
1405
+ declare class XReadGroupCommand extends Command<number, unknown[]> {
1406
+ constructor([group, consumer, key, id, options]: XReadGroupOptions, opts?: CommandOptions<number, unknown[]>);
1407
+ }
1408
+
1409
+ type NXAndXXOptions = {
1410
+ nx: true;
1411
+ xx?: never;
1412
+ } | {
1413
+ nx?: never;
1414
+ xx: true;
1415
+ } | {
1416
+ nx?: never;
1417
+ xx?: never;
1418
+ };
1419
+ type LTAndGTOptions = {
1420
+ lt: true;
1421
+ gt?: never;
1422
+ } | {
1423
+ lt?: never;
1424
+ gt: true;
1425
+ } | {
1426
+ lt?: never;
1427
+ gt?: never;
1428
+ };
1429
+ type ZAddCommandOptions = NXAndXXOptions & LTAndGTOptions & {
1430
+ ch?: true;
1431
+ } & {
1432
+ incr?: true;
1433
+ };
1434
+ type Arg2<TData> = ScoreMember<TData> | ZAddCommandOptions;
1435
+ type ScoreMember<TData> = {
1436
+ score: number;
1437
+ member: TData;
1438
+ };
1439
+ /**
1440
+ * @see https://redis.io/commands/zadd
1441
+ */
1442
+ declare class ZAddCommand<TData = string> extends Command<number | null, number | null> {
1443
+ constructor([key, arg1, ...arg2]: [string, Arg2<TData>, ...ScoreMember<TData>[]], opts?: CommandOptions<number | null, number | null>);
1444
+ }
1445
+
1446
+ /**
1447
+ * @see https://redis.io/commands/zcard
1448
+ */
1449
+ declare class ZCardCommand extends Command<number, number> {
1450
+ constructor(cmd: [key: string], opts?: CommandOptions<number, number>);
1451
+ }
1452
+
1453
+ /**
1454
+ * @see https://redis.io/commands/zcount
1455
+ */
1456
+ declare class ZCountCommand extends Command<number, number> {
1457
+ constructor(cmd: [key: string, min: number | string, max: number | string], opts?: CommandOptions<number, number>);
1458
+ }
1459
+
1460
+ /**
1461
+ * @see https://redis.io/commands/zincrby
1462
+ */
1463
+ declare class ZIncrByCommand<TData> extends Command<number, number> {
1464
+ constructor(cmd: [key: string, increment: number, member: TData], opts?: CommandOptions<number, number>);
1465
+ }
1466
+
1467
+ /**
1468
+ * @see https://redis.io/commands/zlexcount
1469
+ */
1470
+ declare class ZLexCountCommand extends Command<number, number> {
1471
+ constructor(cmd: [key: string, min: string, max: string], opts?: CommandOptions<number, number>);
1472
+ }
1473
+
1474
+ /**
1475
+ * @see https://redis.io/commands/zpopmax
1476
+ */
1477
+ declare class ZPopMaxCommand<TData> extends Command<string[], TData[]> {
1478
+ constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string[], TData[]>);
1479
+ }
1480
+
1481
+ /**
1482
+ * @see https://redis.io/commands/zpopmin
1483
+ */
1484
+ declare class ZPopMinCommand<TData> extends Command<string[], TData[]> {
1485
+ constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string[], TData[]>);
1486
+ }
1487
+
1488
+ type ZRangeCommandOptions = {
1489
+ withScores?: boolean;
1490
+ rev?: boolean;
1491
+ } & ({
1492
+ byScore: true;
1493
+ byLex?: never;
1494
+ } | {
1495
+ byScore?: never;
1496
+ byLex: true;
1497
+ } | {
1498
+ byScore?: never;
1499
+ byLex?: never;
1500
+ }) & ({
1501
+ offset: number;
1502
+ count: number;
1503
+ } | {
1504
+ offset?: never;
1505
+ count?: never;
1506
+ });
1507
+ /**
1508
+ * @see https://redis.io/commands/zrange
1509
+ */
1510
+ declare class ZRangeCommand<TData extends unknown[]> extends Command<string[], TData> {
1511
+ constructor(cmd: [key: string, min: number, max: number, opts?: ZRangeCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
1512
+ constructor(cmd: [
1513
+ key: string,
1514
+ min: `(${string}` | `[${string}` | "-" | "+",
1515
+ max: `(${string}` | `[${string}` | "-" | "+",
1516
+ opts: {
1517
+ byLex: true;
1518
+ } & ZRangeCommandOptions
1519
+ ], cmdOpts?: CommandOptions<string[], TData>);
1520
+ constructor(cmd: [
1521
+ key: string,
1522
+ min: number | `(${number}` | "-inf" | "+inf",
1523
+ max: number | `(${number}` | "-inf" | "+inf",
1524
+ opts: {
1525
+ byScore: true;
1526
+ } & ZRangeCommandOptions
1527
+ ], cmdOpts?: CommandOptions<string[], TData>);
1528
+ }
1529
+
1530
+ /**
1531
+ * @see https://redis.io/commands/zrank
1532
+ */
1533
+ declare class ZRankCommand<TData> extends Command<number | null, number | null> {
1534
+ constructor(cmd: [key: string, member: TData], opts?: CommandOptions<number | null, number | null>);
1535
+ }
1536
+
1537
+ /**
1538
+ * @see https://redis.io/commands/zrem
1539
+ */
1540
+ declare class ZRemCommand<TData = string> extends Command<number, number> {
1541
+ constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
1542
+ }
1543
+
1544
+ /**
1545
+ * @see https://redis.io/commands/zremrangebylex
1546
+ */
1547
+ declare class ZRemRangeByLexCommand extends Command<number, number> {
1548
+ constructor(cmd: [key: string, min: string, max: string], opts?: CommandOptions<number, number>);
1549
+ }
1550
+
1551
+ /**
1552
+ * @see https://redis.io/commands/zremrangebyrank
1553
+ */
1554
+ declare class ZRemRangeByRankCommand extends Command<number, number> {
1555
+ constructor(cmd: [key: string, start: number, stop: number], opts?: CommandOptions<number, number>);
1556
+ }
1557
+
1558
+ /**
1559
+ * @see https://redis.io/commands/zremrangebyscore
1560
+ */
1561
+ declare class ZRemRangeByScoreCommand extends Command<number, number> {
1562
+ constructor(cmd: [key: string, min: number, max: number], opts?: CommandOptions<number, number>);
1563
+ }
1564
+
1565
+ /**
1566
+ * @see https://redis.io/commands/zrevrank
1567
+ */
1568
+ declare class ZRevRankCommand<TData> extends Command<number | null, number | null> {
1569
+ constructor(cmd: [key: string, member: TData], opts?: CommandOptions<number | null, number | null>);
1570
+ }
1571
+
1572
+ /**
1573
+ * @see https://redis.io/commands/zscan
1574
+ */
1575
+ declare class ZScanCommand extends Command<[
1576
+ string,
1577
+ (string | number)[]
1578
+ ], [
1579
+ string,
1580
+ (string | number)[]
1581
+ ]> {
1582
+ constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
1583
+ }
1584
+
1585
+ /**
1586
+ * @see https://redis.io/commands/zscore
1587
+ */
1588
+ declare class ZScoreCommand<TData> extends Command<string | null, number | null> {
1589
+ constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
1590
+ }
1591
+
1592
+ type InferResponseData<T extends unknown[]> = {
1593
+ [K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
1594
+ };
1595
+ /**
1596
+ * Upstash REST API supports command pipelining to send multiple commands in
1597
+ * batch, instead of sending each command one by one and waiting for a response.
1598
+ * When using pipelines, several commands are sent using a single HTTP request,
1599
+ * and a single JSON array response is returned. Each item in the response array
1600
+ * corresponds to the command in the same order within the pipeline.
1601
+ *
1602
+ * **NOTE:**
1603
+ *
1604
+ * Execution of the pipeline is not atomic. Even though each command in
1605
+ * the pipeline will be executed in order, commands sent by other clients can
1606
+ * interleave with the pipeline.
1607
+ *
1608
+ * **Examples:**
1609
+ *
1610
+ * ```ts
1611
+ * const p = redis.pipeline() // or redis.multi()
1612
+ * p.set("key","value")
1613
+ * p.get("key")
1614
+ * const res = await p.exec()
1615
+ * ```
1616
+ *
1617
+ * You can also chain commands together
1618
+ * ```ts
1619
+ * const p = redis.pipeline()
1620
+ * const res = await p.set("key","value").get("key").exec()
1621
+ * ```
1622
+ *
1623
+ * Return types are inferred if all commands are chained, but you can still
1624
+ * override the response type manually:
1625
+ * ```ts
1626
+ * redis.pipeline()
1627
+ * .set("key", { greeting: "hello"})
1628
+ * .get("key")
1629
+ * .exec<["OK", { greeting: string } ]>()
1630
+ *
1631
+ * ```
1632
+ */
1633
+ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1634
+ private client;
1635
+ private commands;
1636
+ private commandOptions?;
1637
+ private multiExec;
1638
+ constructor(opts: {
1639
+ client: Requester;
1640
+ commandOptions?: CommandOptions<any, any>;
1641
+ multiExec?: boolean;
1642
+ });
1643
+ /**
1644
+ * Send the pipeline request to upstash.
1645
+ *
1646
+ * Returns an array with the results of all pipelined commands.
1647
+ *
1648
+ * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1649
+ * ```ts
1650
+ * const p = redis.pipeline()
1651
+ * p.get("key")
1652
+ * const result = p.exec<[{ greeting: string }]>()
1653
+ * ```
1654
+ */
1655
+ exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
1656
+ /**
1657
+ * Returns the length of pipeline before the execution
1658
+ */
1659
+ length(): number;
1660
+ /**
1661
+ * Pushes a command into the pipeline and returns a chainable instance of the
1662
+ * pipeline
1663
+ */
1664
+ private chain;
1665
+ /**
1666
+ * @see https://redis.io/commands/append
1667
+ */
1668
+ append: (key: string, value: string) => Pipeline<[...TCommands, Command<any, number>]>;
1669
+ /**
1670
+ * @see https://redis.io/commands/bitcount
1671
+ */
1672
+ bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
1673
+ /**
1674
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
1675
+ *
1676
+ * @example
1677
+ * ```typescript
1678
+ * redis.set("mykey", 0);
1679
+ * const result = await redis.pipeline()
1680
+ * .bitfield("mykey")
1681
+ * .set("u4", 0, 16)
1682
+ * .incr("u4", "#1", 1)
1683
+ * .exec();
1684
+ * console.log(result); // [[0, 1]]
1685
+ * ```
1686
+ *
1687
+ * @see https://redis.io/commands/bitfield
1688
+ */
1689
+ bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
1690
+ /**
1691
+ * @see https://redis.io/commands/bitop
1692
+ */
1693
+ bitop: {
1694
+ (op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>;
1695
+ (op: "not", destinationKey: string, sourceKey: string): Pipeline<[...TCommands, BitOpCommand]>;
1696
+ };
1697
+ /**
1698
+ * @see https://redis.io/commands/bitpos
1699
+ */
1700
+ bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1701
+ /**
1702
+ * @see https://redis.io/commands/copy
1703
+ */
1704
+ copy: (key: string, destinationKey: string, opts?: {
1705
+ replace: boolean;
1706
+ } | undefined) => Pipeline<[...TCommands, Command<any, "COPIED" | "NOT_COPIED">]>;
1707
+ /**
1708
+ * @see https://redis.io/commands/zdiffstore
1709
+ */
1710
+ zdiffstore: (destination: string, numkeys: number, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
1711
+ /**
1712
+ * @see https://redis.io/commands/dbsize
1713
+ */
1714
+ dbsize: () => Pipeline<[...TCommands, Command<any, number>]>;
1715
+ /**
1716
+ * @see https://redis.io/commands/decr
1717
+ */
1718
+ decr: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1719
+ /**
1720
+ * @see https://redis.io/commands/decrby
1721
+ */
1722
+ decrby: (key: string, decrement: number) => Pipeline<[...TCommands, Command<any, number>]>;
1723
+ /**
1724
+ * @see https://redis.io/commands/del
1725
+ */
1726
+ del: (...args: CommandArgs<typeof DelCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
1727
+ /**
1728
+ * @see https://redis.io/commands/echo
1729
+ */
1730
+ echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
1731
+ /**
1732
+ * @see https://redis.io/commands/eval
1733
+ */
1734
+ eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1735
+ /**
1736
+ * @see https://redis.io/commands/evalsha
1737
+ */
1738
+ evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1739
+ /**
1740
+ * @see https://redis.io/commands/exists
1741
+ */
1742
+ exists: (...args: CommandArgs<typeof ExistsCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
1743
+ /**
1744
+ * @see https://redis.io/commands/expire
1745
+ */
1746
+ expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1747
+ /**
1748
+ * @see https://redis.io/commands/expireat
1749
+ */
1750
+ expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1751
+ /**
1752
+ * @see https://redis.io/commands/flushall
1753
+ */
1754
+ flushall: (args?: CommandArgs<typeof FlushAllCommand>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1755
+ /**
1756
+ * @see https://redis.io/commands/flushdb
1757
+ */
1758
+ flushdb: (opts?: {
1759
+ async?: boolean;
1760
+ } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1761
+ /**
1762
+ * @see https://redis.io/commands/geoadd
1763
+ */
1764
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
1765
+ /**
1766
+ * @see https://redis.io/commands/geodist
1767
+ */
1768
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
1769
+ /**
1770
+ * @see https://redis.io/commands/geopos
1771
+ */
1772
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
1773
+ lng: number;
1774
+ lat: number;
1775
+ }[]>]>;
1776
+ /**
1777
+ * @see https://redis.io/commands/geohash
1778
+ */
1779
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
1780
+ /**
1781
+ * @see https://redis.io/commands/geosearch
1782
+ */
1783
+ geosearch: <TData>(key: string, centerPoint: {
1784
+ type: "FROMLONLAT" | "fromlonlat";
1785
+ coordinate: {
1786
+ lon: number;
1787
+ lat: number;
1788
+ };
1789
+ } | {
1790
+ type: "FROMMEMBER" | "frommember";
1791
+ member: TData;
1792
+ }, shape: {
1793
+ type: "BYRADIUS" | "byradius";
1794
+ radius: number;
1795
+ radiusType: "M" | "KM" | "FT" | "MI";
1796
+ } | {
1797
+ type: "BYBOX" | "bybox";
1798
+ rect: {
1799
+ width: number;
1800
+ height: number;
1801
+ };
1802
+ rectType: "M" | "KM" | "FT" | "MI";
1803
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1804
+ count?: {
1805
+ limit: number;
1806
+ any?: boolean;
1807
+ };
1808
+ withCoord?: boolean;
1809
+ withDist?: boolean;
1810
+ withHash?: boolean;
1811
+ } | undefined) => Pipeline<[...TCommands, Command<any, ({
1812
+ member: TData;
1813
+ } & {
1814
+ coord?: {
1815
+ long: number;
1816
+ lat: number;
1817
+ } | undefined;
1818
+ dist?: number | undefined;
1819
+ hash?: string | undefined;
1820
+ })[]>]>;
1821
+ /**
1822
+ * @see https://redis.io/commands/geosearchstore
1823
+ */
1824
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
1825
+ type: "FROMLONLAT" | "fromlonlat";
1826
+ coordinate: {
1827
+ lon: number;
1828
+ lat: number;
1829
+ };
1830
+ } | {
1831
+ type: "FROMMEMBER" | "frommember";
1832
+ member: TData;
1833
+ }, shape: {
1834
+ type: "BYRADIUS" | "byradius";
1835
+ radius: number;
1836
+ radiusType: "M" | "KM" | "FT" | "MI";
1837
+ } | {
1838
+ type: "BYBOX" | "bybox";
1839
+ rect: {
1840
+ width: number;
1841
+ height: number;
1842
+ };
1843
+ rectType: "M" | "KM" | "FT" | "MI";
1844
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1845
+ count?: {
1846
+ limit: number;
1847
+ any?: boolean;
1848
+ };
1849
+ storeDist?: boolean;
1850
+ } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1851
+ /**
1852
+ * @see https://redis.io/commands/get
1853
+ */
1854
+ get: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1855
+ /**
1856
+ * @see https://redis.io/commands/getbit
1857
+ */
1858
+ getbit: (key: string, offset: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1859
+ /**
1860
+ * @see https://redis.io/commands/getdel
1861
+ */
1862
+ getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1863
+ /**
1864
+ * @see https://redis.io/commands/getrange
1865
+ */
1866
+ getrange: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, string>]>;
1867
+ /**
1868
+ * @see https://redis.io/commands/getset
1869
+ */
1870
+ getset: <TData>(key: string, value: TData) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1871
+ /**
1872
+ * @see https://redis.io/commands/hdel
1873
+ */
1874
+ hdel: (key: string, ...fields: string[]) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1875
+ /**
1876
+ * @see https://redis.io/commands/hexists
1877
+ */
1878
+ hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
1879
+ /**
1880
+ * @see https://redis.io/commands/hget
1881
+ */
1882
+ hget: <TData>(key: string, field: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1883
+ /**
1884
+ * @see https://redis.io/commands/hgetall
1885
+ */
1886
+ hgetall: <TData extends Record<string, unknown>>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1887
+ /**
1888
+ * @see https://redis.io/commands/hincrby
1889
+ */
1890
+ hincrby: (key: string, field: string, increment: number) => Pipeline<[...TCommands, Command<any, number>]>;
1891
+ /**
1892
+ * @see https://redis.io/commands/hincrbyfloat
1893
+ */
1894
+ hincrbyfloat: (key: string, field: string, increment: number) => Pipeline<[...TCommands, Command<any, number>]>;
1895
+ /**
1896
+ * @see https://redis.io/commands/hkeys
1897
+ */
1898
+ hkeys: (key: string) => Pipeline<[...TCommands, Command<any, string[]>]>;
1899
+ /**
1900
+ * @see https://redis.io/commands/hlen
1901
+ */
1902
+ hlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1903
+ /**
1904
+ * @see https://redis.io/commands/hmget
1905
+ */
1906
+ hmget: <TData extends Record<string, unknown>>(key: string, ...fields: string[]) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1907
+ /**
1908
+ * @see https://redis.io/commands/hmset
1909
+ */
1910
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1911
+ /**
1912
+ * @see https://redis.io/commands/hrandfield
1913
+ */
1914
+ hrandfield: <TData extends string | string[] | Record<string, unknown>>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
1915
+ /**
1916
+ * @see https://redis.io/commands/hscan
1917
+ */
1918
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
1919
+ /**
1920
+ * @see https://redis.io/commands/hset
1921
+ */
1922
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1923
+ /**
1924
+ * @see https://redis.io/commands/hsetnx
1925
+ */
1926
+ hsetnx: <TData>(key: string, field: string, value: TData) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1927
+ /**
1928
+ * @see https://redis.io/commands/hstrlen
1929
+ */
1930
+ hstrlen: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
1931
+ /**
1932
+ * @see https://redis.io/commands/hvals
1933
+ */
1934
+ hvals: (key: string) => Pipeline<[...TCommands, Command<any, any>]>;
1935
+ /**
1936
+ * @see https://redis.io/commands/incr
1937
+ */
1938
+ incr: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1939
+ /**
1940
+ * @see https://redis.io/commands/incrby
1941
+ */
1942
+ incrby: (key: string, value: number) => Pipeline<[...TCommands, Command<any, number>]>;
1943
+ /**
1944
+ * @see https://redis.io/commands/incrbyfloat
1945
+ */
1946
+ incrbyfloat: (key: string, value: number) => Pipeline<[...TCommands, Command<any, number>]>;
1947
+ /**
1948
+ * @see https://redis.io/commands/keys
1949
+ */
1950
+ keys: (pattern: string) => Pipeline<[...TCommands, Command<any, string[]>]>;
1951
+ /**
1952
+ * @see https://redis.io/commands/lindex
1953
+ */
1954
+ lindex: (key: string, index: number) => Pipeline<[...TCommands, Command<any, any>]>;
1955
+ /**
1956
+ * @see https://redis.io/commands/linsert
1957
+ */
1958
+ linsert: <TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) => Pipeline<[...TCommands, Command<any, number>]>;
1959
+ /**
1960
+ * @see https://redis.io/commands/llen
1961
+ */
1962
+ llen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1963
+ /**
1964
+ * @see https://redis.io/commands/lmove
1965
+ */
1966
+ lmove: <TData = string>(source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right") => Pipeline<[...TCommands, Command<any, TData>]>;
1967
+ /**
1968
+ * @see https://redis.io/commands/lpop
1969
+ */
1970
+ lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1971
+ /**
1972
+ * @see https://redis.io/commands/lmpop
1973
+ */
1974
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
1975
+ /**
1976
+ * @see https://redis.io/commands/lpos
1977
+ */
1978
+ lpos: <TData>(key: string, element: unknown, opts?: {
1979
+ rank?: number;
1980
+ count?: number;
1981
+ maxLen?: number;
1982
+ } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
1983
+ /**
1984
+ * @see https://redis.io/commands/lpush
1985
+ */
1986
+ lpush: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
1987
+ /**
1988
+ * @see https://redis.io/commands/lpushx
1989
+ */
1990
+ lpushx: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
1991
+ /**
1992
+ * @see https://redis.io/commands/lrange
1993
+ */
1994
+ lrange: <TResult = string>(key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, TResult[]>]>;
1995
+ /**
1996
+ * @see https://redis.io/commands/lrem
1997
+ */
1998
+ lrem: <TData>(key: string, count: number, value: TData) => Pipeline<[...TCommands, Command<any, number>]>;
1999
+ /**
2000
+ * @see https://redis.io/commands/lset
2001
+ */
2002
+ lset: <TData>(key: string, index: number, value: TData) => Pipeline<[...TCommands, Command<any, "OK">]>;
2003
+ /**
2004
+ * @see https://redis.io/commands/ltrim
2005
+ */
2006
+ ltrim: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, "OK">]>;
2007
+ /**
2008
+ * @see https://redis.io/commands/mget
2009
+ */
2010
+ mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => Pipeline<[...TCommands, Command<any, TData>]>;
2011
+ /**
2012
+ * @see https://redis.io/commands/mset
2013
+ */
2014
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
2015
+ /**
2016
+ * @see https://redis.io/commands/msetnx
2017
+ */
2018
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
2019
+ /**
2020
+ * @see https://redis.io/commands/persist
2021
+ */
2022
+ persist: (key: string) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2023
+ /**
2024
+ * @see https://redis.io/commands/pexpire
2025
+ */
2026
+ pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2027
+ /**
2028
+ * @see https://redis.io/commands/pexpireat
2029
+ */
2030
+ pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2031
+ /**
2032
+ * @see https://redis.io/commands/pfadd
2033
+ */
2034
+ pfadd: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, number>]>;
2035
+ /**
2036
+ * @see https://redis.io/commands/pfcount
2037
+ */
2038
+ pfcount: (args_0: string, ...args_1: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2039
+ /**
2040
+ * @see https://redis.io/commands/pfmerge
2041
+ */
2042
+ pfmerge: (destination_key: string, ...args_1: string[]) => Pipeline<[...TCommands, Command<any, "OK">]>;
2043
+ /**
2044
+ * @see https://redis.io/commands/ping
2045
+ */
2046
+ ping: (args?: CommandArgs<typeof PingCommand>) => Pipeline<[...TCommands, Command<any, string>]>;
2047
+ /**
2048
+ * @see https://redis.io/commands/psetex
2049
+ */
2050
+ psetex: <TData>(key: string, ttl: number, value: TData) => Pipeline<[...TCommands, Command<any, string>]>;
2051
+ /**
2052
+ * @see https://redis.io/commands/pttl
2053
+ */
2054
+ pttl: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2055
+ /**
2056
+ * @see https://redis.io/commands/publish
2057
+ */
2058
+ publish: (channel: string, message: unknown) => Pipeline<[...TCommands, Command<any, number>]>;
2059
+ /**
2060
+ * @see https://redis.io/commands/randomkey
2061
+ */
2062
+ randomkey: () => Pipeline<[...TCommands, Command<any, string | null>]>;
2063
+ /**
2064
+ * @see https://redis.io/commands/rename
2065
+ */
2066
+ rename: (source: string, destination: string) => Pipeline<[...TCommands, Command<any, "OK">]>;
2067
+ /**
2068
+ * @see https://redis.io/commands/renamenx
2069
+ */
2070
+ renamenx: (source: string, destination: string) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2071
+ /**
2072
+ * @see https://redis.io/commands/rpop
2073
+ */
2074
+ rpop: <TData = string>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2075
+ /**
2076
+ * @see https://redis.io/commands/rpush
2077
+ */
2078
+ rpush: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2079
+ /**
2080
+ * @see https://redis.io/commands/rpushx
2081
+ */
2082
+ rpushx: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2083
+ /**
2084
+ * @see https://redis.io/commands/sadd
2085
+ */
2086
+ sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2087
+ /**
2088
+ * @see https://redis.io/commands/scan
2089
+ */
2090
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, string[]]>]>;
2091
+ /**
2092
+ * @see https://redis.io/commands/scard
2093
+ */
2094
+ scard: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2095
+ /**
2096
+ * @see https://redis.io/commands/script-exists
2097
+ */
2098
+ scriptExists: (...args: CommandArgs<typeof ScriptExistsCommand>) => Pipeline<[...TCommands, Command<any, number[]>]>;
2099
+ /**
2100
+ * @see https://redis.io/commands/script-flush
2101
+ */
2102
+ scriptFlush: (opts?: ScriptFlushCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
2103
+ /**
2104
+ * @see https://redis.io/commands/script-load
2105
+ */
2106
+ scriptLoad: (script: string) => Pipeline<[...TCommands, Command<any, string>]>;
2107
+ sdiff: (key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2108
+ /**
2109
+ * @see https://redis.io/commands/sdiffstore
2110
+ */
2111
+ sdiffstore: (destination: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2112
+ /**
2113
+ * @see https://redis.io/commands/set
2114
+ */
2115
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => Pipeline<[...TCommands, Command<any, "OK" | TData | null>]>;
2116
+ /**
2117
+ * @see https://redis.io/commands/setbit
2118
+ */
2119
+ setbit: (key: string, offset: number, value: 0 | 1) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2120
+ /**
2121
+ * @see https://redis.io/commands/setex
2122
+ */
2123
+ setex: <TData>(key: string, ttl: number, value: TData) => Pipeline<[...TCommands, Command<any, "OK">]>;
2124
+ /**
2125
+ * @see https://redis.io/commands/setnx
2126
+ */
2127
+ setnx: <TData>(key: string, value: TData) => Pipeline<[...TCommands, Command<any, number>]>;
2128
+ /**
2129
+ * @see https://redis.io/commands/setrange
2130
+ */
2131
+ setrange: (key: string, offset: number, value: string) => Pipeline<[...TCommands, Command<any, number>]>;
2132
+ /**
2133
+ * @see https://redis.io/commands/sinter
2134
+ */
2135
+ sinter: (key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, string[]>]>;
2136
+ /**
2137
+ * @see https://redis.io/commands/sinterstore
2138
+ */
2139
+ sinterstore: (destination: string, key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2140
+ /**
2141
+ * @see https://redis.io/commands/sismember
2142
+ */
2143
+ sismember: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2144
+ /**
2145
+ * @see https://redis.io/commands/smembers
2146
+ */
2147
+ smembers: <TData extends unknown[] = string[]>(key: string) => Pipeline<[...TCommands, Command<any, TData>]>;
2148
+ /**
2149
+ * @see https://redis.io/commands/smismember
2150
+ */
2151
+ smismember: <TMembers extends unknown[]>(key: string, members: TMembers) => Pipeline<[...TCommands, Command<any, (0 | 1)[]>]>;
2152
+ /**
2153
+ * @see https://redis.io/commands/smove
2154
+ */
2155
+ smove: <TData>(source: string, destination: string, member: TData) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2156
+ /**
2157
+ * @see https://redis.io/commands/spop
2158
+ */
2159
+ spop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2160
+ /**
2161
+ * @see https://redis.io/commands/srandmember
2162
+ */
2163
+ srandmember: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2164
+ /**
2165
+ * @see https://redis.io/commands/srem
2166
+ */
2167
+ srem: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2168
+ /**
2169
+ * @see https://redis.io/commands/sscan
2170
+ */
2171
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2172
+ /**
2173
+ * @see https://redis.io/commands/strlen
2174
+ */
2175
+ strlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2176
+ /**
2177
+ * @see https://redis.io/commands/sunion
2178
+ */
2179
+ sunion: (key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2180
+ /**
2181
+ * @see https://redis.io/commands/sunionstore
2182
+ */
2183
+ sunionstore: (destination: string, key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2184
+ /**
2185
+ * @see https://redis.io/commands/time
2186
+ */
2187
+ time: () => Pipeline<[...TCommands, Command<any, [number, number]>]>;
2188
+ /**
2189
+ * @see https://redis.io/commands/touch
2190
+ */
2191
+ touch: (...args: CommandArgs<typeof TouchCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
2192
+ /**
2193
+ * @see https://redis.io/commands/ttl
2194
+ */
2195
+ ttl: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2196
+ /**
2197
+ * @see https://redis.io/commands/type
2198
+ */
2199
+ type: (key: string) => Pipeline<[...TCommands, Command<any, Type>]>;
2200
+ /**
2201
+ * @see https://redis.io/commands/unlink
2202
+ */
2203
+ unlink: (...args: CommandArgs<typeof UnlinkCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
2204
+ /**
2205
+ * @see https://redis.io/commands/zadd
2206
+ */
2207
+ 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>]>;
2208
+ /**
2209
+ * @see https://redis.io/commands/xadd
2210
+ */
2211
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2212
+ nomkStream?: boolean;
2213
+ trim?: ({
2214
+ type: "MAXLEN" | "maxlen";
2215
+ threshold: number;
2216
+ } | {
2217
+ type: "MINID" | "minid";
2218
+ threshold: string;
2219
+ }) & ({
2220
+ comparison: "~";
2221
+ limit?: number;
2222
+ } | {
2223
+ comparison: "=";
2224
+ limit?: never;
2225
+ });
2226
+ } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2227
+ /**
2228
+ * @see https://redis.io/commands/xack
2229
+ */
2230
+ xack: (key: string, group: string, id: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2231
+ /**
2232
+ * @see https://redis.io/commands/xdel
2233
+ */
2234
+ xdel: (key: string, ids: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2235
+ /**
2236
+ * @see https://redis.io/commands/xgroup
2237
+ */
2238
+ xgroup: (key: string, opts: {
2239
+ type: "CREATE";
2240
+ group: string;
2241
+ id: `$` | string;
2242
+ options?: {
2243
+ MKSTREAM?: boolean;
2244
+ ENTRIESREAD?: number;
2245
+ };
2246
+ } | {
2247
+ type: "CREATECONSUMER";
2248
+ group: string;
2249
+ consumer: string;
2250
+ } | {
2251
+ type: "DELCONSUMER";
2252
+ group: string;
2253
+ consumer: string;
2254
+ } | {
2255
+ type: "DESTROY";
2256
+ group: string;
2257
+ } | {
2258
+ type: "SETID";
2259
+ group: string;
2260
+ id: `$` | string;
2261
+ options?: {
2262
+ ENTRIESREAD?: number;
2263
+ };
2264
+ }) => Pipeline<[...TCommands, Command<any, never>]>;
2265
+ /**
2266
+ * @see https://redis.io/commands/xread
2267
+ */
2268
+ xread: (...args: CommandArgs<typeof XReadCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2269
+ /**
2270
+ * @see https://redis.io/commands/xreadgroup
2271
+ */
2272
+ xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2273
+ /**
2274
+ * @see https://redis.io/commands/xinfo
2275
+ */
2276
+ xinfo: (key: string, options: {
2277
+ type: "CONSUMERS";
2278
+ group: string;
2279
+ } | {
2280
+ type: "GROUPS";
2281
+ }) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2282
+ /**
2283
+ * @see https://redis.io/commands/xlen
2284
+ */
2285
+ xlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2286
+ /**
2287
+ * @see https://redis.io/commands/xpending
2288
+ */
2289
+ xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2290
+ idleTime?: number;
2291
+ consumer?: string | string[];
2292
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2293
+ /**
2294
+ * @see https://redis.io/commands/xclaim
2295
+ */
2296
+ xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2297
+ idleMS?: number;
2298
+ timeMS?: number;
2299
+ retryCount?: number;
2300
+ force?: boolean;
2301
+ justId?: boolean;
2302
+ lastId?: number;
2303
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2304
+ /**
2305
+ * @see https://redis.io/commands/xautoclaim
2306
+ */
2307
+ xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2308
+ count?: number;
2309
+ justId?: boolean;
2310
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2311
+ /**
2312
+ * @see https://redis.io/commands/xtrim
2313
+ */
2314
+ xtrim: (key: string, options: {
2315
+ strategy: "MAXLEN" | "MINID";
2316
+ exactness?: "~" | "=";
2317
+ threshold: number | string;
2318
+ limit?: number;
2319
+ }) => Pipeline<[...TCommands, Command<any, number>]>;
2320
+ /**
2321
+ * @see https://redis.io/commands/xrange
2322
+ */
2323
+ xrange: (key: string, start: string, end: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
2324
+ /**
2325
+ * @see https://redis.io/commands/xrevrange
2326
+ */
2327
+ xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
2328
+ /**
2329
+ * @see https://redis.io/commands/zcard
2330
+ */
2331
+ zcard: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2332
+ /**
2333
+ * @see https://redis.io/commands/zcount
2334
+ */
2335
+ zcount: (key: string, min: string | number, max: string | number) => Pipeline<[...TCommands, Command<any, number>]>;
2336
+ /**
2337
+ * @see https://redis.io/commands/zincrby
2338
+ */
2339
+ zincrby: <TData>(key: string, increment: number, member: TData) => Pipeline<[...TCommands, Command<any, number>]>;
2340
+ /**
2341
+ * @see https://redis.io/commands/zinterstore
2342
+ */
2343
+ zinterstore: (destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2344
+ /**
2345
+ * @see https://redis.io/commands/zlexcount
2346
+ */
2347
+ zlexcount: (key: string, min: string, max: string) => Pipeline<[...TCommands, Command<any, number>]>;
2348
+ /**
2349
+ * @see https://redis.io/commands/zmscore
2350
+ */
2351
+ zmscore: (key: string, members: unknown[]) => Pipeline<[...TCommands, Command<any, number[] | null>]>;
2352
+ /**
2353
+ * @see https://redis.io/commands/zpopmax
2354
+ */
2355
+ zpopmax: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData[]>]>;
2356
+ /**
2357
+ * @see https://redis.io/commands/zpopmin
2358
+ */
2359
+ zpopmin: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData[]>]>;
2360
+ /**
2361
+ * @see https://redis.io/commands/zrange
2362
+ */
2363
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
2364
+ byLex: true;
2365
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
2366
+ byScore: true;
2367
+ } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
2368
+ /**
2369
+ * @see https://redis.io/commands/zrank
2370
+ */
2371
+ zrank: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, number | null>]>;
2372
+ /**
2373
+ * @see https://redis.io/commands/zrem
2374
+ */
2375
+ zrem: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2376
+ /**
2377
+ * @see https://redis.io/commands/zremrangebylex
2378
+ */
2379
+ zremrangebylex: (key: string, min: string, max: string) => Pipeline<[...TCommands, Command<any, number>]>;
2380
+ /**
2381
+ * @see https://redis.io/commands/zremrangebyrank
2382
+ */
2383
+ zremrangebyrank: (key: string, start: number, stop: number) => Pipeline<[...TCommands, Command<any, number>]>;
2384
+ /**
2385
+ * @see https://redis.io/commands/zremrangebyscore
2386
+ */
2387
+ zremrangebyscore: (key: string, min: number, max: number) => Pipeline<[...TCommands, Command<any, number>]>;
2388
+ /**
2389
+ * @see https://redis.io/commands/zrevrank
2390
+ */
2391
+ zrevrank: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, number | null>]>;
2392
+ /**
2393
+ * @see https://redis.io/commands/zscan
2394
+ */
2395
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2396
+ /**
2397
+ * @see https://redis.io/commands/zscore
2398
+ */
2399
+ zscore: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, number | null>]>;
2400
+ /**
2401
+ * @see https://redis.io/commands/zunionstore
2402
+ */
2403
+ zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2404
+ /**
2405
+ * @see https://redis.io/commands/zunion
2406
+ */
2407
+ zunion: (numKeys: number, keys: string[], opts?: ZUnionCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
2408
+ /**
2409
+ * @see https://redis.io/commands/?group=json
2410
+ */
2411
+ get json(): {
2412
+ /**
2413
+ * @see https://redis.io/commands/json.arrappend
2414
+ */
2415
+ arrappend: (key: string, path: string, ...values: unknown[]) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2416
+ /**
2417
+ * @see https://redis.io/commands/json.arrindex
2418
+ */
2419
+ arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2420
+ /**
2421
+ * @see https://redis.io/commands/json.arrinsert
2422
+ */
2423
+ arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2424
+ /**
2425
+ * @see https://redis.io/commands/json.arrlen
2426
+ */
2427
+ arrlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2428
+ /**
2429
+ * @see https://redis.io/commands/json.arrpop
2430
+ */
2431
+ arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2432
+ /**
2433
+ * @see https://redis.io/commands/json.arrtrim
2434
+ */
2435
+ arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2436
+ /**
2437
+ * @see https://redis.io/commands/json.clear
2438
+ */
2439
+ clear: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2440
+ /**
2441
+ * @see https://redis.io/commands/json.del
2442
+ */
2443
+ del: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2444
+ /**
2445
+ * @see https://redis.io/commands/json.forget
2446
+ */
2447
+ forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2448
+ /**
2449
+ * @see https://redis.io/commands/json.get
2450
+ */
2451
+ get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
2452
+ /**
2453
+ * @see https://redis.io/commands/json.mget
2454
+ */
2455
+ mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
2456
+ /**
2457
+ * @see https://redis.io/commands/json.mset
2458
+ */
2459
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2460
+ /**
2461
+ * @see https://redis.io/commands/json.numincrby
2462
+ */
2463
+ numincrby: (key: string, path: string, value: number) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2464
+ /**
2465
+ * @see https://redis.io/commands/json.nummultby
2466
+ */
2467
+ nummultby: (key: string, path: string, value: number) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2468
+ /**
2469
+ * @see https://redis.io/commands/json.objkeys
2470
+ */
2471
+ objkeys: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (string[] | null)[]>]>;
2472
+ /**
2473
+ * @see https://redis.io/commands/json.objlen
2474
+ */
2475
+ objlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2476
+ /**
2477
+ * @see https://redis.io/commands/json.resp
2478
+ */
2479
+ resp: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
2480
+ /**
2481
+ * @see https://redis.io/commands/json.set
2482
+ */
2483
+ set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2484
+ nx: true;
2485
+ xx?: never;
2486
+ } | {
2487
+ nx?: never;
2488
+ xx: true;
2489
+ } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2490
+ /**
2491
+ * @see https://redis.io/commands/json.strappend
2492
+ */
2493
+ strappend: (key: string, path: string, value: string) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2494
+ /**
2495
+ * @see https://redis.io/commands/json.strlen
2496
+ */
2497
+ strlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2498
+ /**
2499
+ * @see https://redis.io/commands/json.toggle
2500
+ */
2501
+ toggle: (key: string, path: string) => Pipeline<[...TCommands, Command<any, number[]>]>;
2502
+ /**
2503
+ * @see https://redis.io/commands/json.type
2504
+ */
2505
+ type: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, string[]>]>;
2506
+ };
2507
+ }
2508
+
2509
+ /**
2510
+ * Creates a new script.
2511
+ *
2512
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
2513
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
2514
+ * the entire script. Afterwards, the script is cached on the server.
2515
+ *
2516
+ * @example
2517
+ * ```ts
2518
+ * const redis = new Redis({...})
2519
+ *
2520
+ * const script = redis.createScript<string>("return ARGV[1];")
2521
+ * const arg1 = await script.eval([], ["Hello World"])
2522
+ * expect(arg1, "Hello World")
2523
+ * ```
2524
+ */
2525
+ declare class Script<TResult = unknown> {
2526
+ readonly script: string;
2527
+ readonly sha1: string;
2528
+ private readonly redis;
2529
+ constructor(redis: Redis, script: string);
2530
+ /**
2531
+ * Send an `EVAL` command to redis.
2532
+ */
2533
+ eval(keys: string[], args: string[]): Promise<TResult>;
2534
+ /**
2535
+ * Calculates the sha1 hash of the script and then calls `EVALSHA`.
2536
+ */
2537
+ evalsha(keys: string[], args: string[]): Promise<TResult>;
2538
+ /**
2539
+ * Optimistically try to run `EVALSHA` first.
2540
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL`.
2541
+ *
2542
+ * Following calls will be able to use the cached script
2543
+ */
2544
+ exec(keys: string[], args: string[]): Promise<TResult>;
2545
+ /**
2546
+ * Compute the sha1 hash of the script and return its hex representation.
2547
+ */
2548
+ private digest;
2549
+ }
2550
+
2551
+ /**
2552
+ * Serverless redis client for upstash.
2553
+ */
2554
+ declare class Redis {
2555
+ protected client: Requester;
2556
+ protected opts?: CommandOptions<any, any>;
2557
+ protected enableTelemetry: boolean;
2558
+ protected enableAutoPipelining: boolean;
2559
+ /**
2560
+ * Create a new redis client
2561
+ *
2562
+ * @example
2563
+ * ```typescript
2564
+ * const redis = new Redis({
2565
+ * url: "<UPSTASH_REDIS_REST_URL>",
2566
+ * token: "<UPSTASH_REDIS_REST_TOKEN>",
2567
+ * });
2568
+ * ```
2569
+ */
2570
+ constructor(client: Requester, opts?: RedisOptions);
2571
+ get json(): {
2572
+ /**
2573
+ * @see https://redis.io/commands/json.arrappend
2574
+ */
2575
+ arrappend: (key: string, path: string, ...values: unknown[]) => Promise<(number | null)[]>;
2576
+ /**
2577
+ * @see https://redis.io/commands/json.arrindex
2578
+ */
2579
+ arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>;
2580
+ /**
2581
+ * @see https://redis.io/commands/json.arrinsert
2582
+ */
2583
+ arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Promise<(number | null)[]>;
2584
+ /**
2585
+ * @see https://redis.io/commands/json.arrlen
2586
+ */
2587
+ arrlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
2588
+ /**
2589
+ * @see https://redis.io/commands/json.arrpop
2590
+ */
2591
+ arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Promise<unknown[]>;
2592
+ /**
2593
+ * @see https://redis.io/commands/json.arrtrim
2594
+ */
2595
+ arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>;
2596
+ /**
2597
+ * @see https://redis.io/commands/json.clear
2598
+ */
2599
+ clear: (key: string, path?: string | undefined) => Promise<number>;
2600
+ /**
2601
+ * @see https://redis.io/commands/json.del
2602
+ */
2603
+ del: (key: string, path?: string | undefined) => Promise<number>;
2604
+ /**
2605
+ * @see https://redis.io/commands/json.forget
2606
+ */
2607
+ forget: (key: string, path?: string | undefined) => Promise<number>;
2608
+ /**
2609
+ * @see https://redis.io/commands/json.get
2610
+ */
2611
+ get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
2612
+ /**
2613
+ * @see https://redis.io/commands/json.mget
2614
+ */
2615
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
2616
+ /**
2617
+ * @see https://redis.io/commands/json.mset
2618
+ */
2619
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2620
+ /**
2621
+ * @see https://redis.io/commands/json.numincrby
2622
+ */
2623
+ numincrby: (key: string, path: string, value: number) => Promise<(number | null)[]>;
2624
+ /**
2625
+ * @see https://redis.io/commands/json.nummultby
2626
+ */
2627
+ nummultby: (key: string, path: string, value: number) => Promise<(number | null)[]>;
2628
+ /**
2629
+ * @see https://redis.io/commands/json.objkeys
2630
+ */
2631
+ objkeys: (key: string, path?: string | undefined) => Promise<(string[] | null)[]>;
2632
+ /**
2633
+ * @see https://redis.io/commands/json.objlen
2634
+ */
2635
+ objlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
2636
+ /**
2637
+ * @see https://redis.io/commands/json.resp
2638
+ */
2639
+ resp: (key: string, path?: string | undefined) => Promise<any>;
2640
+ /**
2641
+ * @see https://redis.io/commands/json.set
2642
+ */
2643
+ set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2644
+ nx: true;
2645
+ xx?: never;
2646
+ } | {
2647
+ nx?: never;
2648
+ xx: true;
2649
+ } | undefined) => Promise<"OK" | null>;
2650
+ /**
2651
+ * @see https://redis.io/commands/json.strappend
2652
+ */
2653
+ strappend: (key: string, path: string, value: string) => Promise<(number | null)[]>;
2654
+ /**
2655
+ * @see https://redis.io/commands/json.strlen
2656
+ */
2657
+ strlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
2658
+ /**
2659
+ * @see https://redis.io/commands/json.toggle
2660
+ */
2661
+ toggle: (key: string, path: string) => Promise<number[]>;
2662
+ /**
2663
+ * @see https://redis.io/commands/json.type
2664
+ */
2665
+ type: (key: string, path?: string | undefined) => Promise<string[]>;
2666
+ };
2667
+ /**
2668
+ * Wrap a new middleware around the HTTP client.
2669
+ */
2670
+ use: <TResult = unknown>(middleware: (r: UpstashRequest, next: <TResult_1 = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult_1>>) => Promise<UpstashResponse<TResult>>) => void;
2671
+ /**
2672
+ * Technically this is not private, we can hide it from intellisense by doing this
2673
+ */
2674
+ protected addTelemetry: (telemetry: Telemetry) => void;
2675
+ createScript(script: string): Script;
2676
+ /**
2677
+ * Create a new pipeline that allows you to send requests in bulk.
2678
+ *
2679
+ * @see {@link Pipeline}
2680
+ */
2681
+ pipeline: () => Pipeline<[]>;
2682
+ protected autoPipeline: () => Redis;
2683
+ /**
2684
+ * Create a new transaction to allow executing multiple steps atomically.
2685
+ *
2686
+ * All the commands in a transaction are serialized and executed sequentially. A request sent by
2687
+ * another client will never be served in the middle of the execution of a Redis Transaction. This
2688
+ * guarantees that the commands are executed as a single isolated operation.
2689
+ *
2690
+ * @see {@link Pipeline}
2691
+ */
2692
+ multi: () => Pipeline<[]>;
2693
+ /**
2694
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
2695
+ *
2696
+ * @example
2697
+ * ```typescript
2698
+ * redis.set("mykey", 0);
2699
+ * const result = await redis.bitfield("mykey")
2700
+ * .set("u4", 0, 16)
2701
+ * .incr("u4", "#1", 1)
2702
+ * .exec();
2703
+ * console.log(result); // [0, 1]
2704
+ * ```
2705
+ *
2706
+ * @see https://redis.io/commands/bitfield
2707
+ */
2708
+ bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
2709
+ /**
2710
+ * @see https://redis.io/commands/append
2711
+ */
2712
+ append: (key: string, value: string) => Promise<number>;
2713
+ /**
2714
+ * @see https://redis.io/commands/bitcount
2715
+ */
2716
+ bitcount: (key: string, start: number, end: number) => Promise<number>;
2717
+ /**
2718
+ * @see https://redis.io/commands/bitop
2719
+ */
2720
+ bitop: {
2721
+ (op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Promise<number>;
2722
+ (op: "not", destinationKey: string, sourceKey: string): Promise<number>;
2723
+ };
2724
+ /**
2725
+ * @see https://redis.io/commands/bitpos
2726
+ */
2727
+ bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Promise<number>;
2728
+ /**
2729
+ * @see https://redis.io/commands/copy
2730
+ */
2731
+ copy: (key: string, destinationKey: string, opts?: {
2732
+ replace: boolean;
2733
+ } | undefined) => Promise<"COPIED" | "NOT_COPIED">;
2734
+ /**
2735
+ * @see https://redis.io/commands/dbsize
2736
+ */
2737
+ dbsize: () => Promise<number>;
2738
+ /**
2739
+ * @see https://redis.io/commands/decr
2740
+ */
2741
+ decr: (key: string) => Promise<number>;
2742
+ /**
2743
+ * @see https://redis.io/commands/decrby
2744
+ */
2745
+ decrby: (key: string, decrement: number) => Promise<number>;
2746
+ /**
2747
+ * @see https://redis.io/commands/del
2748
+ */
2749
+ del: (...args: CommandArgs<typeof DelCommand>) => Promise<number>;
2750
+ /**
2751
+ * @see https://redis.io/commands/echo
2752
+ */
2753
+ echo: (message: string) => Promise<string>;
2754
+ /**
2755
+ * @see https://redis.io/commands/eval
2756
+ */
2757
+ eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
2758
+ /**
2759
+ * @see https://redis.io/commands/evalsha
2760
+ */
2761
+ evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
2762
+ /**
2763
+ * @see https://redis.io/commands/exists
2764
+ */
2765
+ exists: (...args: CommandArgs<typeof ExistsCommand>) => Promise<number>;
2766
+ /**
2767
+ * @see https://redis.io/commands/expire
2768
+ */
2769
+ expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Promise<0 | 1>;
2770
+ /**
2771
+ * @see https://redis.io/commands/expireat
2772
+ */
2773
+ expireat: (key: string, unix: number) => Promise<0 | 1>;
2774
+ /**
2775
+ * @see https://redis.io/commands/flushall
2776
+ */
2777
+ flushall: (args?: CommandArgs<typeof FlushAllCommand>) => Promise<"OK">;
2778
+ /**
2779
+ * @see https://redis.io/commands/flushdb
2780
+ */
2781
+ flushdb: (opts?: {
2782
+ async?: boolean;
2783
+ } | undefined) => Promise<"OK">;
2784
+ /**
2785
+ * @see https://redis.io/commands/geoadd
2786
+ */
2787
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
2788
+ /**
2789
+ * @see https://redis.io/commands/geopos
2790
+ */
2791
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
2792
+ lng: number;
2793
+ lat: number;
2794
+ }[]>;
2795
+ /**
2796
+ * @see https://redis.io/commands/geodist
2797
+ */
2798
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2799
+ /**
2800
+ * @see https://redis.io/commands/geohash
2801
+ */
2802
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
2803
+ /**
2804
+ * @see https://redis.io/commands/geosearch
2805
+ */
2806
+ geosearch: <TData>(key: string, centerPoint: {
2807
+ type: "FROMLONLAT" | "fromlonlat";
2808
+ coordinate: {
2809
+ lon: number;
2810
+ lat: number;
2811
+ };
2812
+ } | {
2813
+ type: "FROMMEMBER" | "frommember";
2814
+ member: TData;
2815
+ }, shape: {
2816
+ type: "BYRADIUS" | "byradius";
2817
+ radius: number;
2818
+ radiusType: "M" | "KM" | "FT" | "MI";
2819
+ } | {
2820
+ type: "BYBOX" | "bybox";
2821
+ rect: {
2822
+ width: number;
2823
+ height: number;
2824
+ };
2825
+ rectType: "M" | "KM" | "FT" | "MI";
2826
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2827
+ count?: {
2828
+ limit: number;
2829
+ any?: boolean;
2830
+ };
2831
+ withCoord?: boolean;
2832
+ withDist?: boolean;
2833
+ withHash?: boolean;
2834
+ } | undefined) => Promise<({
2835
+ member: TData;
2836
+ } & {
2837
+ coord?: {
2838
+ long: number;
2839
+ lat: number;
2840
+ } | undefined;
2841
+ dist?: number | undefined;
2842
+ hash?: string | undefined;
2843
+ })[]>;
2844
+ /**
2845
+ * @see https://redis.io/commands/geosearchstore
2846
+ */
2847
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
2848
+ type: "FROMLONLAT" | "fromlonlat";
2849
+ coordinate: {
2850
+ lon: number;
2851
+ lat: number;
2852
+ };
2853
+ } | {
2854
+ type: "FROMMEMBER" | "frommember";
2855
+ member: TData;
2856
+ }, shape: {
2857
+ type: "BYRADIUS" | "byradius";
2858
+ radius: number;
2859
+ radiusType: "M" | "KM" | "FT" | "MI";
2860
+ } | {
2861
+ type: "BYBOX" | "bybox";
2862
+ rect: {
2863
+ width: number;
2864
+ height: number;
2865
+ };
2866
+ rectType: "M" | "KM" | "FT" | "MI";
2867
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2868
+ count?: {
2869
+ limit: number;
2870
+ any?: boolean;
2871
+ };
2872
+ storeDist?: boolean;
2873
+ } | undefined) => Promise<number>;
2874
+ /**
2875
+ * @see https://redis.io/commands/get
2876
+ */
2877
+ get: <TData>(key: string) => Promise<TData | null>;
2878
+ /**
2879
+ * @see https://redis.io/commands/getbit
2880
+ */
2881
+ getbit: (key: string, offset: number) => Promise<0 | 1>;
2882
+ /**
2883
+ * @see https://redis.io/commands/getdel
2884
+ */
2885
+ getdel: <TData>(key: string) => Promise<TData | null>;
2886
+ /**
2887
+ * @see https://redis.io/commands/getrange
2888
+ */
2889
+ getrange: (key: string, start: number, end: number) => Promise<string>;
2890
+ /**
2891
+ * @see https://redis.io/commands/getset
2892
+ */
2893
+ getset: <TData>(key: string, value: TData) => Promise<TData | null>;
2894
+ /**
2895
+ * @see https://redis.io/commands/hdel
2896
+ */
2897
+ hdel: (key: string, ...fields: string[]) => Promise<0 | 1>;
2898
+ /**
2899
+ * @see https://redis.io/commands/hexists
2900
+ */
2901
+ hexists: (key: string, field: string) => Promise<number>;
2902
+ /**
2903
+ * @see https://redis.io/commands/hget
2904
+ */
2905
+ hget: <TData>(key: string, field: string) => Promise<TData | null>;
2906
+ /**
2907
+ * @see https://redis.io/commands/hgetall
2908
+ */
2909
+ hgetall: <TData extends Record<string, unknown>>(key: string) => Promise<TData | null>;
2910
+ /**
2911
+ * @see https://redis.io/commands/hincrby
2912
+ */
2913
+ hincrby: (key: string, field: string, increment: number) => Promise<number>;
2914
+ /**
2915
+ * @see https://redis.io/commands/hincrbyfloat
2916
+ */
2917
+ hincrbyfloat: (key: string, field: string, increment: number) => Promise<number>;
2918
+ /**
2919
+ * @see https://redis.io/commands/hkeys
2920
+ */
2921
+ hkeys: (key: string) => Promise<string[]>;
2922
+ /**
2923
+ * @see https://redis.io/commands/hlen
2924
+ */
2925
+ hlen: (key: string) => Promise<number>;
2926
+ /**
2927
+ * @see https://redis.io/commands/hmget
2928
+ */
2929
+ hmget: <TData extends Record<string, unknown>>(key: string, ...fields: string[]) => Promise<TData | null>;
2930
+ /**
2931
+ * @see https://redis.io/commands/hmset
2932
+ */
2933
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2934
+ /**
2935
+ * @see https://redis.io/commands/hrandfield
2936
+ */
2937
+ hrandfield: {
2938
+ (key: string): Promise<string | null>;
2939
+ (key: string, count: number): Promise<string[]>;
2940
+ <TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
2941
+ };
2942
+ /**
2943
+ * @see https://redis.io/commands/hscan
2944
+ */
2945
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
2946
+ /**
2947
+ * @see https://redis.io/commands/hset
2948
+ */
2949
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2950
+ /**
2951
+ * @see https://redis.io/commands/hsetnx
2952
+ */
2953
+ hsetnx: <TData>(key: string, field: string, value: TData) => Promise<0 | 1>;
2954
+ /**
2955
+ * @see https://redis.io/commands/hstrlen
2956
+ */
2957
+ hstrlen: (key: string, field: string) => Promise<number>;
2958
+ /**
2959
+ * @see https://redis.io/commands/hvals
2960
+ */
2961
+ hvals: (key: string) => Promise<any>;
2962
+ /**
2963
+ * @see https://redis.io/commands/incr
2964
+ */
2965
+ incr: (key: string) => Promise<number>;
2966
+ /**
2967
+ * @see https://redis.io/commands/incrby
2968
+ */
2969
+ incrby: (key: string, value: number) => Promise<number>;
2970
+ /**
2971
+ * @see https://redis.io/commands/incrbyfloat
2972
+ */
2973
+ incrbyfloat: (key: string, value: number) => Promise<number>;
2974
+ /**
2975
+ * @see https://redis.io/commands/keys
2976
+ */
2977
+ keys: (pattern: string) => Promise<string[]>;
2978
+ /**
2979
+ * @see https://redis.io/commands/lindex
2980
+ */
2981
+ lindex: (key: string, index: number) => Promise<any>;
2982
+ /**
2983
+ * @see https://redis.io/commands/linsert
2984
+ */
2985
+ linsert: <TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) => Promise<number>;
2986
+ /**
2987
+ * @see https://redis.io/commands/llen
2988
+ */
2989
+ llen: (key: string) => Promise<number>;
2990
+ /**
2991
+ * @see https://redis.io/commands/lmove
2992
+ */
2993
+ lmove: <TData = string>(source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right") => Promise<TData>;
2994
+ /**
2995
+ * @see https://redis.io/commands/lpop
2996
+ */
2997
+ lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
2998
+ /**
2999
+ * @see https://redis.io/commands/lmpop
3000
+ */
3001
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
3002
+ /**
3003
+ * @see https://redis.io/commands/lpos
3004
+ */
3005
+ lpos: <TData = number>(key: string, element: unknown, opts?: {
3006
+ rank?: number;
3007
+ count?: number;
3008
+ maxLen?: number;
3009
+ } | undefined) => Promise<TData>;
3010
+ /**
3011
+ * @see https://redis.io/commands/lpush
3012
+ */
3013
+ lpush: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3014
+ /**
3015
+ * @see https://redis.io/commands/lpushx
3016
+ */
3017
+ lpushx: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3018
+ /**
3019
+ * @see https://redis.io/commands/lrange
3020
+ */
3021
+ lrange: <TResult = string>(key: string, start: number, end: number) => Promise<TResult[]>;
3022
+ /**
3023
+ * @see https://redis.io/commands/lrem
3024
+ */
3025
+ lrem: <TData>(key: string, count: number, value: TData) => Promise<number>;
3026
+ /**
3027
+ * @see https://redis.io/commands/lset
3028
+ */
3029
+ lset: <TData>(key: string, index: number, value: TData) => Promise<"OK">;
3030
+ /**
3031
+ * @see https://redis.io/commands/ltrim
3032
+ */
3033
+ ltrim: (key: string, start: number, end: number) => Promise<"OK">;
3034
+ /**
3035
+ * @see https://redis.io/commands/mget
3036
+ */
3037
+ mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => Promise<TData>;
3038
+ /**
3039
+ * @see https://redis.io/commands/mset
3040
+ */
3041
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
3042
+ /**
3043
+ * @see https://redis.io/commands/msetnx
3044
+ */
3045
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
3046
+ /**
3047
+ * @see https://redis.io/commands/persist
3048
+ */
3049
+ persist: (key: string) => Promise<0 | 1>;
3050
+ /**
3051
+ * @see https://redis.io/commands/pexpire
3052
+ */
3053
+ pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
3054
+ /**
3055
+ * @see https://redis.io/commands/pexpireat
3056
+ */
3057
+ pexpireat: (key: string, unix: number) => Promise<0 | 1>;
3058
+ /**
3059
+ * @see https://redis.io/commands/pfadd
3060
+ */
3061
+ pfadd: (args_0: string, ...args_1: unknown[]) => Promise<number>;
3062
+ /**
3063
+ * @see https://redis.io/commands/pfcount
3064
+ */
3065
+ pfcount: (args_0: string, ...args_1: string[]) => Promise<number>;
3066
+ /**
3067
+ * @see https://redis.io/commands/pfmerge
3068
+ */
3069
+ pfmerge: (destination_key: string, ...args_1: string[]) => Promise<"OK">;
3070
+ /**
3071
+ * @see https://redis.io/commands/ping
3072
+ */
3073
+ ping: (args?: CommandArgs<typeof PingCommand>) => Promise<string>;
3074
+ /**
3075
+ * @see https://redis.io/commands/psetex
3076
+ */
3077
+ psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
3078
+ /**
3079
+ * @see https://redis.io/commands/pttl
3080
+ */
3081
+ pttl: (key: string) => Promise<number>;
3082
+ /**
3083
+ * @see https://redis.io/commands/publish
3084
+ */
3085
+ publish: (channel: string, message: unknown) => Promise<number>;
3086
+ /**
3087
+ * @see https://redis.io/commands/randomkey
3088
+ */
3089
+ randomkey: () => Promise<string | null>;
3090
+ /**
3091
+ * @see https://redis.io/commands/rename
3092
+ */
3093
+ rename: (source: string, destination: string) => Promise<"OK">;
3094
+ /**
3095
+ * @see https://redis.io/commands/renamenx
3096
+ */
3097
+ renamenx: (source: string, destination: string) => Promise<0 | 1>;
3098
+ /**
3099
+ * @see https://redis.io/commands/rpop
3100
+ */
3101
+ rpop: <TData = string>(key: string, count?: number | undefined) => Promise<TData | null>;
3102
+ /**
3103
+ * @see https://redis.io/commands/rpush
3104
+ */
3105
+ rpush: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3106
+ /**
3107
+ * @see https://redis.io/commands/rpushx
3108
+ */
3109
+ rpushx: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3110
+ /**
3111
+ * @see https://redis.io/commands/sadd
3112
+ */
3113
+ sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
3114
+ /**
3115
+ * @see https://redis.io/commands/scan
3116
+ */
3117
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, string[]]>;
3118
+ /**
3119
+ * @see https://redis.io/commands/scard
3120
+ */
3121
+ scard: (key: string) => Promise<number>;
3122
+ /**
3123
+ * @see https://redis.io/commands/script-exists
3124
+ */
3125
+ scriptExists: (...args: CommandArgs<typeof ScriptExistsCommand>) => Promise<number[]>;
3126
+ /**
3127
+ * @see https://redis.io/commands/script-flush
3128
+ */
3129
+ scriptFlush: (opts?: ScriptFlushCommandOptions | undefined) => Promise<"OK">;
3130
+ /**
3131
+ * @see https://redis.io/commands/script-load
3132
+ */
3133
+ scriptLoad: (script: string) => Promise<string>;
3134
+ /**
3135
+ * @see https://redis.io/commands/sdiff
3136
+ */
3137
+ sdiff: (key: string, ...keys: string[]) => Promise<unknown[]>;
3138
+ /**
3139
+ * @see https://redis.io/commands/sdiffstore
3140
+ */
3141
+ sdiffstore: (destination: string, ...keys: string[]) => Promise<number>;
3142
+ /**
3143
+ * @see https://redis.io/commands/set
3144
+ */
3145
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => Promise<"OK" | TData | null>;
3146
+ /**
3147
+ * @see https://redis.io/commands/setbit
3148
+ */
3149
+ setbit: (key: string, offset: number, value: 0 | 1) => Promise<0 | 1>;
3150
+ /**
3151
+ * @see https://redis.io/commands/setex
3152
+ */
3153
+ setex: <TData>(key: string, ttl: number, value: TData) => Promise<"OK">;
3154
+ /**
3155
+ * @see https://redis.io/commands/setnx
3156
+ */
3157
+ setnx: <TData>(key: string, value: TData) => Promise<number>;
3158
+ /**
3159
+ * @see https://redis.io/commands/setrange
3160
+ */
3161
+ setrange: (key: string, offset: number, value: string) => Promise<number>;
3162
+ /**
3163
+ * @see https://redis.io/commands/sinter
3164
+ */
3165
+ sinter: (key: string, ...keys: string[]) => Promise<string[]>;
3166
+ /**
3167
+ * @see https://redis.io/commands/sinterstore
3168
+ */
3169
+ sinterstore: (destination: string, key: string, ...keys: string[]) => Promise<number>;
3170
+ /**
3171
+ * @see https://redis.io/commands/sismember
3172
+ */
3173
+ sismember: <TData>(key: string, member: TData) => Promise<0 | 1>;
3174
+ /**
3175
+ * @see https://redis.io/commands/smismember
3176
+ */
3177
+ smismember: <TMembers extends unknown[]>(key: string, members: TMembers) => Promise<(0 | 1)[]>;
3178
+ /**
3179
+ * @see https://redis.io/commands/smembers
3180
+ */
3181
+ smembers: <TData extends unknown[] = string[]>(key: string) => Promise<TData>;
3182
+ /**
3183
+ * @see https://redis.io/commands/smove
3184
+ */
3185
+ smove: <TData>(source: string, destination: string, member: TData) => Promise<0 | 1>;
3186
+ /**
3187
+ * @see https://redis.io/commands/spop
3188
+ */
3189
+ spop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3190
+ /**
3191
+ * @see https://redis.io/commands/srandmember
3192
+ */
3193
+ srandmember: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3194
+ /**
3195
+ * @see https://redis.io/commands/srem
3196
+ */
3197
+ srem: <TData>(key: string, ...members: TData[]) => Promise<number>;
3198
+ /**
3199
+ * @see https://redis.io/commands/sscan
3200
+ */
3201
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3202
+ /**
3203
+ * @see https://redis.io/commands/strlen
3204
+ */
3205
+ strlen: (key: string) => Promise<number>;
3206
+ /**
3207
+ * @see https://redis.io/commands/sunion
3208
+ */
3209
+ sunion: (key: string, ...keys: string[]) => Promise<unknown[]>;
3210
+ /**
3211
+ * @see https://redis.io/commands/sunionstore
3212
+ */
3213
+ sunionstore: (destination: string, key: string, ...keys: string[]) => Promise<number>;
3214
+ /**
3215
+ * @see https://redis.io/commands/time
3216
+ */
3217
+ time: () => Promise<[number, number]>;
3218
+ /**
3219
+ * @see https://redis.io/commands/touch
3220
+ */
3221
+ touch: (...args: CommandArgs<typeof TouchCommand>) => Promise<number>;
3222
+ /**
3223
+ * @see https://redis.io/commands/ttl
3224
+ */
3225
+ ttl: (key: string) => Promise<number>;
3226
+ /**
3227
+ * @see https://redis.io/commands/type
3228
+ */
3229
+ type: (key: string) => Promise<Type>;
3230
+ /**
3231
+ * @see https://redis.io/commands/unlink
3232
+ */
3233
+ unlink: (...args: CommandArgs<typeof UnlinkCommand>) => Promise<number>;
3234
+ /**
3235
+ * @see https://redis.io/commands/xadd
3236
+ */
3237
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3238
+ nomkStream?: boolean;
3239
+ trim?: ({
3240
+ type: "MAXLEN" | "maxlen";
3241
+ threshold: number;
3242
+ } | {
3243
+ type: "MINID" | "minid";
3244
+ threshold: string;
3245
+ }) & ({
3246
+ comparison: "~";
3247
+ limit?: number;
3248
+ } | {
3249
+ comparison: "=";
3250
+ limit?: never;
3251
+ });
3252
+ } | undefined) => Promise<string>;
3253
+ /**
3254
+ * @see https://redis.io/commands/xack
3255
+ */
3256
+ xack: (key: string, group: string, id: string | string[]) => Promise<number>;
3257
+ /**
3258
+ * @see https://redis.io/commands/xdel
3259
+ */
3260
+ xdel: (key: string, ids: string | string[]) => Promise<number>;
3261
+ /**
3262
+ * @see https://redis.io/commands/xgroup
3263
+ */
3264
+ xgroup: (key: string, opts: {
3265
+ type: "CREATE";
3266
+ group: string;
3267
+ id: `$` | string;
3268
+ options?: {
3269
+ MKSTREAM?: boolean;
3270
+ ENTRIESREAD?: number;
3271
+ };
3272
+ } | {
3273
+ type: "CREATECONSUMER";
3274
+ group: string;
3275
+ consumer: string;
3276
+ } | {
3277
+ type: "DELCONSUMER";
3278
+ group: string;
3279
+ consumer: string;
3280
+ } | {
3281
+ type: "DESTROY";
3282
+ group: string;
3283
+ } | {
3284
+ type: "SETID";
3285
+ group: string;
3286
+ id: `$` | string;
3287
+ options?: {
3288
+ ENTRIESREAD?: number;
3289
+ };
3290
+ }) => Promise<never>;
3291
+ /**
3292
+ * @see https://redis.io/commands/xread
3293
+ */
3294
+ xread: (...args: CommandArgs<typeof XReadCommand>) => Promise<unknown[]>;
3295
+ /**
3296
+ * @see https://redis.io/commands/xreadgroup
3297
+ */
3298
+ xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Promise<unknown[]>;
3299
+ /**
3300
+ * @see https://redis.io/commands/xinfo
3301
+ */
3302
+ xinfo: (key: string, options: {
3303
+ type: "CONSUMERS";
3304
+ group: string;
3305
+ } | {
3306
+ type: "GROUPS";
3307
+ }) => Promise<unknown[]>;
3308
+ /**
3309
+ * @see https://redis.io/commands/xlen
3310
+ */
3311
+ xlen: (key: string) => Promise<number>;
3312
+ /**
3313
+ * @see https://redis.io/commands/xpending
3314
+ */
3315
+ xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3316
+ idleTime?: number;
3317
+ consumer?: string | string[];
3318
+ } | undefined) => Promise<unknown[]>;
3319
+ /**
3320
+ * @see https://redis.io/commands/xclaim
3321
+ */
3322
+ xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3323
+ idleMS?: number;
3324
+ timeMS?: number;
3325
+ retryCount?: number;
3326
+ force?: boolean;
3327
+ justId?: boolean;
3328
+ lastId?: number;
3329
+ } | undefined) => Promise<unknown[]>;
3330
+ /**
3331
+ * @see https://redis.io/commands/xautoclaim
3332
+ */
3333
+ xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3334
+ count?: number;
3335
+ justId?: boolean;
3336
+ } | undefined) => Promise<unknown[]>;
3337
+ /**
3338
+ * @see https://redis.io/commands/xtrim
3339
+ */
3340
+ xtrim: (key: string, options: {
3341
+ strategy: "MAXLEN" | "MINID";
3342
+ exactness?: "~" | "=";
3343
+ threshold: number | string;
3344
+ limit?: number;
3345
+ }) => Promise<number>;
3346
+ /**
3347
+ * @see https://redis.io/commands/xrange
3348
+ */
3349
+ xrange: (key: string, start: string, end: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
3350
+ /**
3351
+ * @see https://redis.io/commands/xrevrange
3352
+ */
3353
+ xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
3354
+ /**
3355
+ * @see https://redis.io/commands/zadd
3356
+ */
3357
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3358
+ /**
3359
+ * @see https://redis.io/commands/zcard
3360
+ */
3361
+ zcard: (key: string) => Promise<number>;
3362
+ /**
3363
+ * @see https://redis.io/commands/zcount
3364
+ */
3365
+ zcount: (key: string, min: string | number, max: string | number) => Promise<number>;
3366
+ /**
3367
+ * @see https://redis.io/commands/zdiffstore
3368
+ */
3369
+ zdiffstore: (destination: string, numkeys: number, ...keys: string[]) => Promise<number>;
3370
+ /**
3371
+ * @see https://redis.io/commands/zincrby
3372
+ */
3373
+ zincrby: <TData>(key: string, increment: number, member: TData) => Promise<number>;
3374
+ /**
3375
+ * @see https://redis.io/commands/zinterstore
3376
+ */
3377
+ zinterstore: (destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions | undefined) => Promise<number>;
3378
+ /**
3379
+ * @see https://redis.io/commands/zlexcount
3380
+ */
3381
+ zlexcount: (key: string, min: string, max: string) => Promise<number>;
3382
+ /**
3383
+ * @see https://redis.io/commands/zmscore
3384
+ */
3385
+ zmscore: (key: string, members: unknown[]) => Promise<number[] | null>;
3386
+ /**
3387
+ * @see https://redis.io/commands/zpopmax
3388
+ */
3389
+ zpopmax: <TData>(key: string, count?: number | undefined) => Promise<TData[]>;
3390
+ /**
3391
+ * @see https://redis.io/commands/zpopmin
3392
+ */
3393
+ zpopmin: <TData>(key: string, count?: number | undefined) => Promise<TData[]>;
3394
+ /**
3395
+ * @see https://redis.io/commands/zrange
3396
+ */
3397
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3398
+ byLex: true;
3399
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3400
+ byScore: true;
3401
+ } & ZRangeCommandOptions]) => Promise<TData>;
3402
+ /**
3403
+ * @see https://redis.io/commands/zrank
3404
+ */
3405
+ zrank: <TData>(key: string, member: TData) => Promise<number | null>;
3406
+ /**
3407
+ * @see https://redis.io/commands/zrem
3408
+ */
3409
+ zrem: <TData>(key: string, ...members: TData[]) => Promise<number>;
3410
+ /**
3411
+ * @see https://redis.io/commands/zremrangebylex
3412
+ */
3413
+ zremrangebylex: (key: string, min: string, max: string) => Promise<number>;
3414
+ /**
3415
+ * @see https://redis.io/commands/zremrangebyrank
3416
+ */
3417
+ zremrangebyrank: (key: string, start: number, stop: number) => Promise<number>;
3418
+ /**
3419
+ * @see https://redis.io/commands/zremrangebyscore
3420
+ */
3421
+ zremrangebyscore: (key: string, min: number, max: number) => Promise<number>;
3422
+ /**
3423
+ * @see https://redis.io/commands/zrevrank
3424
+ */
3425
+ zrevrank: <TData>(key: string, member: TData) => Promise<number | null>;
3426
+ /**
3427
+ * @see https://redis.io/commands/zscan
3428
+ */
3429
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3430
+ /**
3431
+ * @see https://redis.io/commands/zscore
3432
+ */
3433
+ zscore: <TData>(key: string, member: TData) => Promise<number | null>;
3434
+ /**
3435
+ * @see https://redis.io/commands/zunion
3436
+ */
3437
+ zunion: (numKeys: number, keys: string[], opts?: ZUnionCommandOptions | undefined) => Promise<any>;
3438
+ /**
3439
+ * @see https://redis.io/commands/zunionstore
3440
+ */
3441
+ zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
3442
+ }
3443
+
3444
+ /**
3445
+ * Result of a bad request to upstash
3446
+ */
3447
+ declare class UpstashError extends Error {
3448
+ constructor(message: string);
3449
+ }
3450
+ declare class UrlError extends Error {
3451
+ constructor(url: string);
3452
+ }
3453
+
3454
+ type error_UpstashError = UpstashError;
3455
+ declare const error_UpstashError: typeof UpstashError;
3456
+ type error_UrlError = UrlError;
3457
+ declare const error_UrlError: typeof UrlError;
3458
+ declare namespace error {
3459
+ export { error_UpstashError as UpstashError, error_UrlError as UrlError };
3460
+ }
3461
+
3462
+ /**
3463
+ * @see https://redis.io/commands/zdiffstore
3464
+ */
3465
+ declare class ZDiffStoreCommand extends Command<number, number> {
3466
+ constructor(cmd: [destination: string, numkeys: number, ...keys: string[]], opts?: CommandOptions<number, number>);
3467
+ }
3468
+
3469
+ /**
3470
+ * @see https://redis.io/commands/zmscore
3471
+ */
3472
+ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] | null> {
3473
+ constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3474
+ }
3475
+
3476
+ 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 };