@upstash/redis 0.0.0-ci.a0519b405e783d33aa4660281b294551474ad898 → 0.0.0-ci.a08f1ca1ac3e3818ac32fe7e8306468d98e05e0e-20250131161917

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