@upstash/redis 0.0.0-ci.fd62df5f23c9d3ce31f52781474d711bbed876d2-20231031095501 → 0.0.0-ci.ff7a0b135b28ff50a7e2634a78123684be3ed71f-20241105152627

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