@upstash/redis 0.0.0-ci.f5cad9e7bda3d77569d9df207b4e1565f75d6154 → 0.0.0-ci.f725f60c40a2b7f0e25dd9bf83a931c24624cdf6-20260123181037

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