@upstash/redis 1.33.0 → 1.34.0

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