@upstash/redis 0.0.0-ci.c00b02de3221a40eb48a9e0e9fecd434abda4dc2-20240703080528 → 0.0.0-ci.c2204f830cf3ca85c9f85a7dc63bd93a0e228f4b-20250403110828

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