@upstash/redis 0.0.0-ci.acc0588e9e893d8bbe5651955e3fef342d078490 → 0.0.0-ci.ad5be1ba2d5a9fb932176239f1a30ecd48450c0a-20250220103021

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