@upstash/redis 0.0.0-ci.e475de1f85007c6e91b7c723aae0092693599d18-20231218001438 → 0.0.0-ci.e4eab2833c7196d06833dccf8f132ddbc18c2cfa-20241008071408

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,3503 @@
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
+ /**
1606
+ * Upstash REST API supports command pipelining to send multiple commands in
1607
+ * batch, instead of sending each command one by one and waiting for a response.
1608
+ * When using pipelines, several commands are sent using a single HTTP request,
1609
+ * and a single JSON array response is returned. Each item in the response array
1610
+ * corresponds to the command in the same order within the pipeline.
1611
+ *
1612
+ * **NOTE:**
1613
+ *
1614
+ * Execution of the pipeline is not atomic. Even though each command in
1615
+ * the pipeline will be executed in order, commands sent by other clients can
1616
+ * interleave with the pipeline.
1617
+ *
1618
+ * **Examples:**
1619
+ *
1620
+ * ```ts
1621
+ * const p = redis.pipeline() // or redis.multi()
1622
+ * p.set("key","value")
1623
+ * p.get("key")
1624
+ * const res = await p.exec()
1625
+ * ```
1626
+ *
1627
+ * You can also chain commands together
1628
+ * ```ts
1629
+ * const p = redis.pipeline()
1630
+ * const res = await p.set("key","value").get("key").exec()
1631
+ * ```
1632
+ *
1633
+ * Return types are inferred if all commands are chained, but you can still
1634
+ * override the response type manually:
1635
+ * ```ts
1636
+ * redis.pipeline()
1637
+ * .set("key", { greeting: "hello"})
1638
+ * .get("key")
1639
+ * .exec<["OK", { greeting: string } ]>()
1640
+ *
1641
+ * ```
1642
+ */
1643
+ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
1644
+ private client;
1645
+ private commands;
1646
+ private commandOptions?;
1647
+ private multiExec;
1648
+ constructor(opts: {
1649
+ client: Requester;
1650
+ commandOptions?: CommandOptions<any, any>;
1651
+ multiExec?: boolean;
1652
+ });
1653
+ /**
1654
+ * Send the pipeline request to upstash.
1655
+ *
1656
+ * Returns an array with the results of all pipelined commands.
1657
+ *
1658
+ * If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
1659
+ * ```ts
1660
+ * const p = redis.pipeline()
1661
+ * p.get("key")
1662
+ * const result = p.exec<[{ greeting: string }]>()
1663
+ * ```
1664
+ *
1665
+ * 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.
1666
+ *
1667
+ * 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 }`.
1668
+ *
1669
+ * ```ts
1670
+ * const p = redis.pipeline()
1671
+ * p.get("key")
1672
+ *
1673
+ * const result = await p.exec({ keepErrors: true });
1674
+ * const getResult = result[0].result
1675
+ * const getError = result[0].error
1676
+ * ```
1677
+ */
1678
+ exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>, TKeepErrors extends true | undefined = undefined>(options?: {
1679
+ keepErrors: TKeepErrors;
1680
+ }) => Promise<TKeepErrors extends true ? UpstashResponse<any>[] : TCommandResults>;
1681
+ /**
1682
+ * Returns the length of pipeline before the execution
1683
+ */
1684
+ length(): number;
1685
+ /**
1686
+ * Pushes a command into the pipeline and returns a chainable instance of the
1687
+ * pipeline
1688
+ */
1689
+ private chain;
1690
+ /**
1691
+ * @see https://redis.io/commands/append
1692
+ */
1693
+ append: (key: string, value: string) => Pipeline<[...TCommands, Command<any, number>]>;
1694
+ /**
1695
+ * @see https://redis.io/commands/bitcount
1696
+ */
1697
+ bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
1698
+ /**
1699
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
1700
+ *
1701
+ * @example
1702
+ * ```typescript
1703
+ * redis.set("mykey", 0);
1704
+ * const result = await redis.pipeline()
1705
+ * .bitfield("mykey")
1706
+ * .set("u4", 0, 16)
1707
+ * .incr("u4", "#1", 1)
1708
+ * .exec();
1709
+ * console.log(result); // [[0, 1]]
1710
+ * ```
1711
+ *
1712
+ * @see https://redis.io/commands/bitfield
1713
+ */
1714
+ bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
1715
+ /**
1716
+ * @see https://redis.io/commands/bitop
1717
+ */
1718
+ bitop: {
1719
+ (op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>;
1720
+ (op: "not", destinationKey: string, sourceKey: string): Pipeline<[...TCommands, BitOpCommand]>;
1721
+ };
1722
+ /**
1723
+ * @see https://redis.io/commands/bitpos
1724
+ */
1725
+ bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1726
+ /**
1727
+ * @see https://redis.io/commands/copy
1728
+ */
1729
+ copy: (key: string, destinationKey: string, opts?: {
1730
+ replace: boolean;
1731
+ } | undefined) => Pipeline<[...TCommands, Command<any, "COPIED" | "NOT_COPIED">]>;
1732
+ /**
1733
+ * @see https://redis.io/commands/zdiffstore
1734
+ */
1735
+ zdiffstore: (destination: string, numkeys: number, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
1736
+ /**
1737
+ * @see https://redis.io/commands/dbsize
1738
+ */
1739
+ dbsize: () => Pipeline<[...TCommands, Command<any, number>]>;
1740
+ /**
1741
+ * @see https://redis.io/commands/decr
1742
+ */
1743
+ decr: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1744
+ /**
1745
+ * @see https://redis.io/commands/decrby
1746
+ */
1747
+ decrby: (key: string, decrement: number) => Pipeline<[...TCommands, Command<any, number>]>;
1748
+ /**
1749
+ * @see https://redis.io/commands/del
1750
+ */
1751
+ del: (...args: CommandArgs<typeof DelCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
1752
+ /**
1753
+ * @see https://redis.io/commands/echo
1754
+ */
1755
+ echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
1756
+ /**
1757
+ * @see https://redis.io/commands/eval
1758
+ */
1759
+ eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1760
+ /**
1761
+ * @see https://redis.io/commands/evalsha
1762
+ */
1763
+ evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
1764
+ /**
1765
+ * @see https://redis.io/commands/exists
1766
+ */
1767
+ exists: (...args: CommandArgs<typeof ExistsCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
1768
+ /**
1769
+ * @see https://redis.io/commands/expire
1770
+ */
1771
+ expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1772
+ /**
1773
+ * @see https://redis.io/commands/expireat
1774
+ */
1775
+ expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1776
+ /**
1777
+ * @see https://redis.io/commands/flushall
1778
+ */
1779
+ flushall: (args?: CommandArgs<typeof FlushAllCommand>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1780
+ /**
1781
+ * @see https://redis.io/commands/flushdb
1782
+ */
1783
+ flushdb: (opts?: {
1784
+ async?: boolean;
1785
+ } | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
1786
+ /**
1787
+ * @see https://redis.io/commands/geoadd
1788
+ */
1789
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
1790
+ /**
1791
+ * @see https://redis.io/commands/geodist
1792
+ */
1793
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
1794
+ /**
1795
+ * @see https://redis.io/commands/geopos
1796
+ */
1797
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
1798
+ lng: number;
1799
+ lat: number;
1800
+ }[]>]>;
1801
+ /**
1802
+ * @see https://redis.io/commands/geohash
1803
+ */
1804
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
1805
+ /**
1806
+ * @see https://redis.io/commands/geosearch
1807
+ */
1808
+ geosearch: <TData>(key: string, centerPoint: {
1809
+ type: "FROMLONLAT" | "fromlonlat";
1810
+ coordinate: {
1811
+ lon: number;
1812
+ lat: number;
1813
+ };
1814
+ } | {
1815
+ type: "FROMMEMBER" | "frommember";
1816
+ member: TData;
1817
+ }, shape: {
1818
+ type: "BYRADIUS" | "byradius";
1819
+ radius: number;
1820
+ radiusType: "M" | "KM" | "FT" | "MI";
1821
+ } | {
1822
+ type: "BYBOX" | "bybox";
1823
+ rect: {
1824
+ width: number;
1825
+ height: number;
1826
+ };
1827
+ rectType: "M" | "KM" | "FT" | "MI";
1828
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1829
+ count?: {
1830
+ limit: number;
1831
+ any?: boolean;
1832
+ };
1833
+ withCoord?: boolean;
1834
+ withDist?: boolean;
1835
+ withHash?: boolean;
1836
+ } | undefined) => Pipeline<[...TCommands, Command<any, ({
1837
+ member: TData;
1838
+ } & {
1839
+ coord?: {
1840
+ long: number;
1841
+ lat: number;
1842
+ } | undefined;
1843
+ dist?: number | undefined;
1844
+ hash?: string | undefined;
1845
+ })[]>]>;
1846
+ /**
1847
+ * @see https://redis.io/commands/geosearchstore
1848
+ */
1849
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
1850
+ type: "FROMLONLAT" | "fromlonlat";
1851
+ coordinate: {
1852
+ lon: number;
1853
+ lat: number;
1854
+ };
1855
+ } | {
1856
+ type: "FROMMEMBER" | "frommember";
1857
+ member: TData;
1858
+ }, shape: {
1859
+ type: "BYRADIUS" | "byradius";
1860
+ radius: number;
1861
+ radiusType: "M" | "KM" | "FT" | "MI";
1862
+ } | {
1863
+ type: "BYBOX" | "bybox";
1864
+ rect: {
1865
+ width: number;
1866
+ height: number;
1867
+ };
1868
+ rectType: "M" | "KM" | "FT" | "MI";
1869
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
1870
+ count?: {
1871
+ limit: number;
1872
+ any?: boolean;
1873
+ };
1874
+ storeDist?: boolean;
1875
+ } | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
1876
+ /**
1877
+ * @see https://redis.io/commands/get
1878
+ */
1879
+ get: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1880
+ /**
1881
+ * @see https://redis.io/commands/getbit
1882
+ */
1883
+ getbit: (key: string, offset: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1884
+ /**
1885
+ * @see https://redis.io/commands/getdel
1886
+ */
1887
+ getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1888
+ /**
1889
+ * @see https://redis.io/commands/getrange
1890
+ */
1891
+ getrange: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, string>]>;
1892
+ /**
1893
+ * @see https://redis.io/commands/getset
1894
+ */
1895
+ getset: <TData>(key: string, value: TData) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1896
+ /**
1897
+ * @see https://redis.io/commands/hdel
1898
+ */
1899
+ hdel: (key: string, ...fields: string[]) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1900
+ /**
1901
+ * @see https://redis.io/commands/hexists
1902
+ */
1903
+ hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
1904
+ /**
1905
+ * @see https://redis.io/commands/hget
1906
+ */
1907
+ hget: <TData>(key: string, field: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1908
+ /**
1909
+ * @see https://redis.io/commands/hgetall
1910
+ */
1911
+ hgetall: <TData extends Record<string, unknown>>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1912
+ /**
1913
+ * @see https://redis.io/commands/hincrby
1914
+ */
1915
+ hincrby: (key: string, field: string, increment: number) => Pipeline<[...TCommands, Command<any, number>]>;
1916
+ /**
1917
+ * @see https://redis.io/commands/hincrbyfloat
1918
+ */
1919
+ hincrbyfloat: (key: string, field: string, increment: number) => Pipeline<[...TCommands, Command<any, number>]>;
1920
+ /**
1921
+ * @see https://redis.io/commands/hkeys
1922
+ */
1923
+ hkeys: (key: string) => Pipeline<[...TCommands, Command<any, string[]>]>;
1924
+ /**
1925
+ * @see https://redis.io/commands/hlen
1926
+ */
1927
+ hlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1928
+ /**
1929
+ * @see https://redis.io/commands/hmget
1930
+ */
1931
+ hmget: <TData extends Record<string, unknown>>(key: string, ...fields: string[]) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1932
+ /**
1933
+ * @see https://redis.io/commands/hmset
1934
+ */
1935
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
1936
+ /**
1937
+ * @see https://redis.io/commands/hrandfield
1938
+ */
1939
+ hrandfield: <TData extends string | string[] | Record<string, unknown>>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
1940
+ /**
1941
+ * @see https://redis.io/commands/hscan
1942
+ */
1943
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
1944
+ /**
1945
+ * @see https://redis.io/commands/hset
1946
+ */
1947
+ hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
1948
+ /**
1949
+ * @see https://redis.io/commands/hsetnx
1950
+ */
1951
+ hsetnx: <TData>(key: string, field: string, value: TData) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
1952
+ /**
1953
+ * @see https://redis.io/commands/hstrlen
1954
+ */
1955
+ hstrlen: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
1956
+ /**
1957
+ * @see https://redis.io/commands/hvals
1958
+ */
1959
+ hvals: (key: string) => Pipeline<[...TCommands, Command<any, any>]>;
1960
+ /**
1961
+ * @see https://redis.io/commands/incr
1962
+ */
1963
+ incr: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1964
+ /**
1965
+ * @see https://redis.io/commands/incrby
1966
+ */
1967
+ incrby: (key: string, value: number) => Pipeline<[...TCommands, Command<any, number>]>;
1968
+ /**
1969
+ * @see https://redis.io/commands/incrbyfloat
1970
+ */
1971
+ incrbyfloat: (key: string, value: number) => Pipeline<[...TCommands, Command<any, number>]>;
1972
+ /**
1973
+ * @see https://redis.io/commands/keys
1974
+ */
1975
+ keys: (pattern: string) => Pipeline<[...TCommands, Command<any, string[]>]>;
1976
+ /**
1977
+ * @see https://redis.io/commands/lindex
1978
+ */
1979
+ lindex: (key: string, index: number) => Pipeline<[...TCommands, Command<any, any>]>;
1980
+ /**
1981
+ * @see https://redis.io/commands/linsert
1982
+ */
1983
+ linsert: <TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) => Pipeline<[...TCommands, Command<any, number>]>;
1984
+ /**
1985
+ * @see https://redis.io/commands/llen
1986
+ */
1987
+ llen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
1988
+ /**
1989
+ * @see https://redis.io/commands/lmove
1990
+ */
1991
+ lmove: <TData = string>(source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right") => Pipeline<[...TCommands, Command<any, TData>]>;
1992
+ /**
1993
+ * @see https://redis.io/commands/lpop
1994
+ */
1995
+ lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
1996
+ /**
1997
+ * @see https://redis.io/commands/lmpop
1998
+ */
1999
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
2000
+ /**
2001
+ * @see https://redis.io/commands/lpos
2002
+ */
2003
+ lpos: <TData>(key: string, element: unknown, opts?: {
2004
+ rank?: number;
2005
+ count?: number;
2006
+ maxLen?: number;
2007
+ } | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
2008
+ /**
2009
+ * @see https://redis.io/commands/lpush
2010
+ */
2011
+ lpush: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2012
+ /**
2013
+ * @see https://redis.io/commands/lpushx
2014
+ */
2015
+ lpushx: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2016
+ /**
2017
+ * @see https://redis.io/commands/lrange
2018
+ */
2019
+ lrange: <TResult = string>(key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, TResult[]>]>;
2020
+ /**
2021
+ * @see https://redis.io/commands/lrem
2022
+ */
2023
+ lrem: <TData>(key: string, count: number, value: TData) => Pipeline<[...TCommands, Command<any, number>]>;
2024
+ /**
2025
+ * @see https://redis.io/commands/lset
2026
+ */
2027
+ lset: <TData>(key: string, index: number, value: TData) => Pipeline<[...TCommands, Command<any, "OK">]>;
2028
+ /**
2029
+ * @see https://redis.io/commands/ltrim
2030
+ */
2031
+ ltrim: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, "OK">]>;
2032
+ /**
2033
+ * @see https://redis.io/commands/mget
2034
+ */
2035
+ mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => Pipeline<[...TCommands, Command<any, TData>]>;
2036
+ /**
2037
+ * @see https://redis.io/commands/mset
2038
+ */
2039
+ mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
2040
+ /**
2041
+ * @see https://redis.io/commands/msetnx
2042
+ */
2043
+ msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
2044
+ /**
2045
+ * @see https://redis.io/commands/persist
2046
+ */
2047
+ persist: (key: string) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2048
+ /**
2049
+ * @see https://redis.io/commands/pexpire
2050
+ */
2051
+ pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2052
+ /**
2053
+ * @see https://redis.io/commands/pexpireat
2054
+ */
2055
+ pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2056
+ /**
2057
+ * @see https://redis.io/commands/pfadd
2058
+ */
2059
+ pfadd: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, number>]>;
2060
+ /**
2061
+ * @see https://redis.io/commands/pfcount
2062
+ */
2063
+ pfcount: (args_0: string, ...args_1: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2064
+ /**
2065
+ * @see https://redis.io/commands/pfmerge
2066
+ */
2067
+ pfmerge: (destination_key: string, ...args_1: string[]) => Pipeline<[...TCommands, Command<any, "OK">]>;
2068
+ /**
2069
+ * @see https://redis.io/commands/ping
2070
+ */
2071
+ ping: (args?: CommandArgs<typeof PingCommand>) => Pipeline<[...TCommands, Command<any, string>]>;
2072
+ /**
2073
+ * @see https://redis.io/commands/psetex
2074
+ */
2075
+ psetex: <TData>(key: string, ttl: number, value: TData) => Pipeline<[...TCommands, Command<any, string>]>;
2076
+ /**
2077
+ * @see https://redis.io/commands/pttl
2078
+ */
2079
+ pttl: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2080
+ /**
2081
+ * @see https://redis.io/commands/publish
2082
+ */
2083
+ publish: (channel: string, message: unknown) => Pipeline<[...TCommands, Command<any, number>]>;
2084
+ /**
2085
+ * @see https://redis.io/commands/randomkey
2086
+ */
2087
+ randomkey: () => Pipeline<[...TCommands, Command<any, string | null>]>;
2088
+ /**
2089
+ * @see https://redis.io/commands/rename
2090
+ */
2091
+ rename: (source: string, destination: string) => Pipeline<[...TCommands, Command<any, "OK">]>;
2092
+ /**
2093
+ * @see https://redis.io/commands/renamenx
2094
+ */
2095
+ renamenx: (source: string, destination: string) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2096
+ /**
2097
+ * @see https://redis.io/commands/rpop
2098
+ */
2099
+ rpop: <TData = string>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2100
+ /**
2101
+ * @see https://redis.io/commands/rpush
2102
+ */
2103
+ rpush: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2104
+ /**
2105
+ * @see https://redis.io/commands/rpushx
2106
+ */
2107
+ rpushx: <TData>(key: string, ...elements: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2108
+ /**
2109
+ * @see https://redis.io/commands/sadd
2110
+ */
2111
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2112
+ /**
2113
+ * @see https://redis.io/commands/scan
2114
+ */
2115
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, string[]]>]>;
2116
+ /**
2117
+ * @see https://redis.io/commands/scard
2118
+ */
2119
+ scard: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2120
+ /**
2121
+ * @see https://redis.io/commands/script-exists
2122
+ */
2123
+ scriptExists: (...args: CommandArgs<typeof ScriptExistsCommand>) => Pipeline<[...TCommands, Command<any, number[]>]>;
2124
+ /**
2125
+ * @see https://redis.io/commands/script-flush
2126
+ */
2127
+ scriptFlush: (opts?: ScriptFlushCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
2128
+ /**
2129
+ * @see https://redis.io/commands/script-load
2130
+ */
2131
+ scriptLoad: (script: string) => Pipeline<[...TCommands, Command<any, string>]>;
2132
+ sdiff: (key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2133
+ /**
2134
+ * @see https://redis.io/commands/sdiffstore
2135
+ */
2136
+ sdiffstore: (destination: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2137
+ /**
2138
+ * @see https://redis.io/commands/set
2139
+ */
2140
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => Pipeline<[...TCommands, Command<any, "OK" | TData | null>]>;
2141
+ /**
2142
+ * @see https://redis.io/commands/setbit
2143
+ */
2144
+ setbit: (key: string, offset: number, value: 0 | 1) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2145
+ /**
2146
+ * @see https://redis.io/commands/setex
2147
+ */
2148
+ setex: <TData>(key: string, ttl: number, value: TData) => Pipeline<[...TCommands, Command<any, "OK">]>;
2149
+ /**
2150
+ * @see https://redis.io/commands/setnx
2151
+ */
2152
+ setnx: <TData>(key: string, value: TData) => Pipeline<[...TCommands, Command<any, number>]>;
2153
+ /**
2154
+ * @see https://redis.io/commands/setrange
2155
+ */
2156
+ setrange: (key: string, offset: number, value: string) => Pipeline<[...TCommands, Command<any, number>]>;
2157
+ /**
2158
+ * @see https://redis.io/commands/sinter
2159
+ */
2160
+ sinter: (key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, string[]>]>;
2161
+ /**
2162
+ * @see https://redis.io/commands/sinterstore
2163
+ */
2164
+ sinterstore: (destination: string, key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2165
+ /**
2166
+ * @see https://redis.io/commands/sismember
2167
+ */
2168
+ sismember: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2169
+ /**
2170
+ * @see https://redis.io/commands/smembers
2171
+ */
2172
+ smembers: <TData extends unknown[] = string[]>(key: string) => Pipeline<[...TCommands, Command<any, TData>]>;
2173
+ /**
2174
+ * @see https://redis.io/commands/smismember
2175
+ */
2176
+ smismember: <TMembers extends unknown[]>(key: string, members: TMembers) => Pipeline<[...TCommands, Command<any, (0 | 1)[]>]>;
2177
+ /**
2178
+ * @see https://redis.io/commands/smove
2179
+ */
2180
+ smove: <TData>(source: string, destination: string, member: TData) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
2181
+ /**
2182
+ * @see https://redis.io/commands/spop
2183
+ */
2184
+ spop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2185
+ /**
2186
+ * @see https://redis.io/commands/srandmember
2187
+ */
2188
+ srandmember: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
2189
+ /**
2190
+ * @see https://redis.io/commands/srem
2191
+ */
2192
+ srem: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2193
+ /**
2194
+ * @see https://redis.io/commands/sscan
2195
+ */
2196
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2197
+ /**
2198
+ * @see https://redis.io/commands/strlen
2199
+ */
2200
+ strlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2201
+ /**
2202
+ * @see https://redis.io/commands/sunion
2203
+ */
2204
+ sunion: (key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2205
+ /**
2206
+ * @see https://redis.io/commands/sunionstore
2207
+ */
2208
+ sunionstore: (destination: string, key: string, ...keys: string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2209
+ /**
2210
+ * @see https://redis.io/commands/time
2211
+ */
2212
+ time: () => Pipeline<[...TCommands, Command<any, [number, number]>]>;
2213
+ /**
2214
+ * @see https://redis.io/commands/touch
2215
+ */
2216
+ touch: (...args: CommandArgs<typeof TouchCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
2217
+ /**
2218
+ * @see https://redis.io/commands/ttl
2219
+ */
2220
+ ttl: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2221
+ /**
2222
+ * @see https://redis.io/commands/type
2223
+ */
2224
+ type: (key: string) => Pipeline<[...TCommands, Command<any, Type>]>;
2225
+ /**
2226
+ * @see https://redis.io/commands/unlink
2227
+ */
2228
+ unlink: (...args: CommandArgs<typeof UnlinkCommand>) => Pipeline<[...TCommands, Command<any, number>]>;
2229
+ /**
2230
+ * @see https://redis.io/commands/zadd
2231
+ */
2232
+ 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>]>;
2233
+ /**
2234
+ * @see https://redis.io/commands/xadd
2235
+ */
2236
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
2237
+ nomkStream?: boolean;
2238
+ trim?: ({
2239
+ type: "MAXLEN" | "maxlen";
2240
+ threshold: number;
2241
+ } | {
2242
+ type: "MINID" | "minid";
2243
+ threshold: string;
2244
+ }) & ({
2245
+ comparison: "~";
2246
+ limit?: number;
2247
+ } | {
2248
+ comparison: "=";
2249
+ limit?: never;
2250
+ });
2251
+ } | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
2252
+ /**
2253
+ * @see https://redis.io/commands/xack
2254
+ */
2255
+ xack: (key: string, group: string, id: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2256
+ /**
2257
+ * @see https://redis.io/commands/xdel
2258
+ */
2259
+ xdel: (key: string, ids: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
2260
+ /**
2261
+ * @see https://redis.io/commands/xgroup
2262
+ */
2263
+ xgroup: (key: string, opts: {
2264
+ type: "CREATE";
2265
+ group: string;
2266
+ id: `$` | string;
2267
+ options?: {
2268
+ MKSTREAM?: boolean;
2269
+ ENTRIESREAD?: number;
2270
+ };
2271
+ } | {
2272
+ type: "CREATECONSUMER";
2273
+ group: string;
2274
+ consumer: string;
2275
+ } | {
2276
+ type: "DELCONSUMER";
2277
+ group: string;
2278
+ consumer: string;
2279
+ } | {
2280
+ type: "DESTROY";
2281
+ group: string;
2282
+ } | {
2283
+ type: "SETID";
2284
+ group: string;
2285
+ id: `$` | string;
2286
+ options?: {
2287
+ ENTRIESREAD?: number;
2288
+ };
2289
+ }) => Pipeline<[...TCommands, Command<any, never>]>;
2290
+ /**
2291
+ * @see https://redis.io/commands/xread
2292
+ */
2293
+ xread: (...args: CommandArgs<typeof XReadCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2294
+ /**
2295
+ * @see https://redis.io/commands/xreadgroup
2296
+ */
2297
+ xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2298
+ /**
2299
+ * @see https://redis.io/commands/xinfo
2300
+ */
2301
+ xinfo: (key: string, options: {
2302
+ type: "CONSUMERS";
2303
+ group: string;
2304
+ } | {
2305
+ type: "GROUPS";
2306
+ }) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2307
+ /**
2308
+ * @see https://redis.io/commands/xlen
2309
+ */
2310
+ xlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2311
+ /**
2312
+ * @see https://redis.io/commands/xpending
2313
+ */
2314
+ xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
2315
+ idleTime?: number;
2316
+ consumer?: string | string[];
2317
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2318
+ /**
2319
+ * @see https://redis.io/commands/xclaim
2320
+ */
2321
+ xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
2322
+ idleMS?: number;
2323
+ timeMS?: number;
2324
+ retryCount?: number;
2325
+ force?: boolean;
2326
+ justId?: boolean;
2327
+ lastId?: number;
2328
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2329
+ /**
2330
+ * @see https://redis.io/commands/xautoclaim
2331
+ */
2332
+ xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
2333
+ count?: number;
2334
+ justId?: boolean;
2335
+ } | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2336
+ /**
2337
+ * @see https://redis.io/commands/xtrim
2338
+ */
2339
+ xtrim: (key: string, options: {
2340
+ strategy: "MAXLEN" | "MINID";
2341
+ exactness?: "~" | "=";
2342
+ threshold: number | string;
2343
+ limit?: number;
2344
+ }) => Pipeline<[...TCommands, Command<any, number>]>;
2345
+ /**
2346
+ * @see https://redis.io/commands/xrange
2347
+ */
2348
+ xrange: (key: string, start: string, end: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
2349
+ /**
2350
+ * @see https://redis.io/commands/xrevrange
2351
+ */
2352
+ xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
2353
+ /**
2354
+ * @see https://redis.io/commands/zcard
2355
+ */
2356
+ zcard: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
2357
+ /**
2358
+ * @see https://redis.io/commands/zcount
2359
+ */
2360
+ zcount: (key: string, min: string | number, max: string | number) => Pipeline<[...TCommands, Command<any, number>]>;
2361
+ /**
2362
+ * @see https://redis.io/commands/zincrby
2363
+ */
2364
+ zincrby: <TData>(key: string, increment: number, member: TData) => Pipeline<[...TCommands, Command<any, number>]>;
2365
+ /**
2366
+ * @see https://redis.io/commands/zinterstore
2367
+ */
2368
+ zinterstore: (destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2369
+ /**
2370
+ * @see https://redis.io/commands/zlexcount
2371
+ */
2372
+ zlexcount: (key: string, min: string, max: string) => Pipeline<[...TCommands, Command<any, number>]>;
2373
+ /**
2374
+ * @see https://redis.io/commands/zmscore
2375
+ */
2376
+ zmscore: (key: string, members: unknown[]) => Pipeline<[...TCommands, Command<any, number[] | null>]>;
2377
+ /**
2378
+ * @see https://redis.io/commands/zpopmax
2379
+ */
2380
+ zpopmax: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData[]>]>;
2381
+ /**
2382
+ * @see https://redis.io/commands/zpopmin
2383
+ */
2384
+ zpopmin: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData[]>]>;
2385
+ /**
2386
+ * @see https://redis.io/commands/zrange
2387
+ */
2388
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
2389
+ byLex: true;
2390
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
2391
+ byScore: true;
2392
+ } & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
2393
+ /**
2394
+ * @see https://redis.io/commands/zrank
2395
+ */
2396
+ zrank: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, number | null>]>;
2397
+ /**
2398
+ * @see https://redis.io/commands/zrem
2399
+ */
2400
+ zrem: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
2401
+ /**
2402
+ * @see https://redis.io/commands/zremrangebylex
2403
+ */
2404
+ zremrangebylex: (key: string, min: string, max: string) => Pipeline<[...TCommands, Command<any, number>]>;
2405
+ /**
2406
+ * @see https://redis.io/commands/zremrangebyrank
2407
+ */
2408
+ zremrangebyrank: (key: string, start: number, stop: number) => Pipeline<[...TCommands, Command<any, number>]>;
2409
+ /**
2410
+ * @see https://redis.io/commands/zremrangebyscore
2411
+ */
2412
+ zremrangebyscore: (key: string, min: number, max: number) => Pipeline<[...TCommands, Command<any, number>]>;
2413
+ /**
2414
+ * @see https://redis.io/commands/zrevrank
2415
+ */
2416
+ zrevrank: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, number | null>]>;
2417
+ /**
2418
+ * @see https://redis.io/commands/zscan
2419
+ */
2420
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
2421
+ /**
2422
+ * @see https://redis.io/commands/zscore
2423
+ */
2424
+ zscore: <TData>(key: string, member: TData) => Pipeline<[...TCommands, Command<any, number | null>]>;
2425
+ /**
2426
+ * @see https://redis.io/commands/zunionstore
2427
+ */
2428
+ zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2429
+ /**
2430
+ * @see https://redis.io/commands/zunion
2431
+ */
2432
+ zunion: (numKeys: number, keys: string[], opts?: ZUnionCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
2433
+ /**
2434
+ * @see https://redis.io/commands/?group=json
2435
+ */
2436
+ get json(): {
2437
+ /**
2438
+ * @see https://redis.io/commands/json.arrappend
2439
+ */
2440
+ arrappend: (key: string, path: string, ...values: unknown[]) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2441
+ /**
2442
+ * @see https://redis.io/commands/json.arrindex
2443
+ */
2444
+ arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2445
+ /**
2446
+ * @see https://redis.io/commands/json.arrinsert
2447
+ */
2448
+ arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2449
+ /**
2450
+ * @see https://redis.io/commands/json.arrlen
2451
+ */
2452
+ arrlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2453
+ /**
2454
+ * @see https://redis.io/commands/json.arrpop
2455
+ */
2456
+ arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
2457
+ /**
2458
+ * @see https://redis.io/commands/json.arrtrim
2459
+ */
2460
+ arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2461
+ /**
2462
+ * @see https://redis.io/commands/json.clear
2463
+ */
2464
+ clear: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2465
+ /**
2466
+ * @see https://redis.io/commands/json.del
2467
+ */
2468
+ del: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2469
+ /**
2470
+ * @see https://redis.io/commands/json.forget
2471
+ */
2472
+ forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
2473
+ /**
2474
+ * @see https://redis.io/commands/json.get
2475
+ */
2476
+ get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
2477
+ /**
2478
+ * @see https://redis.io/commands/json.mget
2479
+ */
2480
+ mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
2481
+ /**
2482
+ * @see https://redis.io/commands/json.mset
2483
+ */
2484
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2485
+ /**
2486
+ * @see https://redis.io/commands/json.numincrby
2487
+ */
2488
+ numincrby: (key: string, path: string, value: number) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2489
+ /**
2490
+ * @see https://redis.io/commands/json.nummultby
2491
+ */
2492
+ nummultby: (key: string, path: string, value: number) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2493
+ /**
2494
+ * @see https://redis.io/commands/json.objkeys
2495
+ */
2496
+ objkeys: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (string[] | null)[]>]>;
2497
+ /**
2498
+ * @see https://redis.io/commands/json.objlen
2499
+ */
2500
+ objlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2501
+ /**
2502
+ * @see https://redis.io/commands/json.resp
2503
+ */
2504
+ resp: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
2505
+ /**
2506
+ * @see https://redis.io/commands/json.set
2507
+ */
2508
+ set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2509
+ nx: true;
2510
+ xx?: never;
2511
+ } | {
2512
+ nx?: never;
2513
+ xx: true;
2514
+ } | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
2515
+ /**
2516
+ * @see https://redis.io/commands/json.strappend
2517
+ */
2518
+ strappend: (key: string, path: string, value: string) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2519
+ /**
2520
+ * @see https://redis.io/commands/json.strlen
2521
+ */
2522
+ strlen: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, (number | null)[]>]>;
2523
+ /**
2524
+ * @see https://redis.io/commands/json.toggle
2525
+ */
2526
+ toggle: (key: string, path: string) => Pipeline<[...TCommands, Command<any, number[]>]>;
2527
+ /**
2528
+ * @see https://redis.io/commands/json.type
2529
+ */
2530
+ type: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, string[]>]>;
2531
+ };
2532
+ }
2533
+
2534
+ /**
2535
+ * Creates a new script.
2536
+ *
2537
+ * Scripts offer the ability to optimistically try to execute a script without having to send the
2538
+ * entire script to the server. If the script is loaded on the server, it tries again by sending
2539
+ * the entire script. Afterwards, the script is cached on the server.
2540
+ *
2541
+ * @example
2542
+ * ```ts
2543
+ * const redis = new Redis({...})
2544
+ *
2545
+ * const script = redis.createScript<string>("return ARGV[1];")
2546
+ * const arg1 = await script.eval([], ["Hello World"])
2547
+ * expect(arg1, "Hello World")
2548
+ * ```
2549
+ */
2550
+ declare class Script<TResult = unknown> {
2551
+ readonly script: string;
2552
+ readonly sha1: string;
2553
+ private readonly redis;
2554
+ constructor(redis: Redis, script: string);
2555
+ /**
2556
+ * Send an `EVAL` command to redis.
2557
+ */
2558
+ eval(keys: string[], args: string[]): Promise<TResult>;
2559
+ /**
2560
+ * Calculates the sha1 hash of the script and then calls `EVALSHA`.
2561
+ */
2562
+ evalsha(keys: string[], args: string[]): Promise<TResult>;
2563
+ /**
2564
+ * Optimistically try to run `EVALSHA` first.
2565
+ * If the script is not loaded in redis, it will fall back and try again with `EVAL`.
2566
+ *
2567
+ * Following calls will be able to use the cached script
2568
+ */
2569
+ exec(keys: string[], args: string[]): Promise<TResult>;
2570
+ /**
2571
+ * Compute the sha1 hash of the script and return its hex representation.
2572
+ */
2573
+ private digest;
2574
+ }
2575
+
2576
+ /**
2577
+ * Serverless redis client for upstash.
2578
+ */
2579
+ declare class Redis {
2580
+ protected client: Requester;
2581
+ protected opts?: CommandOptions<any, any>;
2582
+ protected enableTelemetry: boolean;
2583
+ protected enableAutoPipelining: boolean;
2584
+ /**
2585
+ * Create a new redis client
2586
+ *
2587
+ * @example
2588
+ * ```typescript
2589
+ * const redis = new Redis({
2590
+ * url: "<UPSTASH_REDIS_REST_URL>",
2591
+ * token: "<UPSTASH_REDIS_REST_TOKEN>",
2592
+ * });
2593
+ * ```
2594
+ */
2595
+ constructor(client: Requester, opts?: RedisOptions);
2596
+ get readYourWritesSyncToken(): string | undefined;
2597
+ set readYourWritesSyncToken(session: string | undefined);
2598
+ get json(): {
2599
+ /**
2600
+ * @see https://redis.io/commands/json.arrappend
2601
+ */
2602
+ arrappend: (key: string, path: string, ...values: unknown[]) => Promise<(number | null)[]>;
2603
+ /**
2604
+ * @see https://redis.io/commands/json.arrindex
2605
+ */
2606
+ arrindex: (key: string, path: string, value: unknown, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>;
2607
+ /**
2608
+ * @see https://redis.io/commands/json.arrinsert
2609
+ */
2610
+ arrinsert: (key: string, path: string, index: number, ...values: unknown[]) => Promise<(number | null)[]>;
2611
+ /**
2612
+ * @see https://redis.io/commands/json.arrlen
2613
+ */
2614
+ arrlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
2615
+ /**
2616
+ * @see https://redis.io/commands/json.arrpop
2617
+ */
2618
+ arrpop: (key: string, path?: string | undefined, index?: number | undefined) => Promise<unknown[]>;
2619
+ /**
2620
+ * @see https://redis.io/commands/json.arrtrim
2621
+ */
2622
+ arrtrim: (key: string, path?: string | undefined, start?: number | undefined, stop?: number | undefined) => Promise<(number | null)[]>;
2623
+ /**
2624
+ * @see https://redis.io/commands/json.clear
2625
+ */
2626
+ clear: (key: string, path?: string | undefined) => Promise<number>;
2627
+ /**
2628
+ * @see https://redis.io/commands/json.del
2629
+ */
2630
+ del: (key: string, path?: string | undefined) => Promise<number>;
2631
+ /**
2632
+ * @see https://redis.io/commands/json.forget
2633
+ */
2634
+ forget: (key: string, path?: string | undefined) => Promise<number>;
2635
+ /**
2636
+ * @see https://redis.io/commands/json.get
2637
+ */
2638
+ get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
2639
+ /**
2640
+ * @see https://redis.io/commands/json.mget
2641
+ */
2642
+ mget: <TData>(keys: string[], path: string) => Promise<TData>;
2643
+ /**
2644
+ * @see https://redis.io/commands/json.mset
2645
+ */
2646
+ mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
2647
+ /**
2648
+ * @see https://redis.io/commands/json.numincrby
2649
+ */
2650
+ numincrby: (key: string, path: string, value: number) => Promise<(number | null)[]>;
2651
+ /**
2652
+ * @see https://redis.io/commands/json.nummultby
2653
+ */
2654
+ nummultby: (key: string, path: string, value: number) => Promise<(number | null)[]>;
2655
+ /**
2656
+ * @see https://redis.io/commands/json.objkeys
2657
+ */
2658
+ objkeys: (key: string, path?: string | undefined) => Promise<(string[] | null)[]>;
2659
+ /**
2660
+ * @see https://redis.io/commands/json.objlen
2661
+ */
2662
+ objlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
2663
+ /**
2664
+ * @see https://redis.io/commands/json.resp
2665
+ */
2666
+ resp: (key: string, path?: string | undefined) => Promise<any>;
2667
+ /**
2668
+ * @see https://redis.io/commands/json.set
2669
+ */
2670
+ set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
2671
+ nx: true;
2672
+ xx?: never;
2673
+ } | {
2674
+ nx?: never;
2675
+ xx: true;
2676
+ } | undefined) => Promise<"OK" | null>;
2677
+ /**
2678
+ * @see https://redis.io/commands/json.strappend
2679
+ */
2680
+ strappend: (key: string, path: string, value: string) => Promise<(number | null)[]>;
2681
+ /**
2682
+ * @see https://redis.io/commands/json.strlen
2683
+ */
2684
+ strlen: (key: string, path?: string | undefined) => Promise<(number | null)[]>;
2685
+ /**
2686
+ * @see https://redis.io/commands/json.toggle
2687
+ */
2688
+ toggle: (key: string, path: string) => Promise<number[]>;
2689
+ /**
2690
+ * @see https://redis.io/commands/json.type
2691
+ */
2692
+ type: (key: string, path?: string | undefined) => Promise<string[]>;
2693
+ };
2694
+ /**
2695
+ * Wrap a new middleware around the HTTP client.
2696
+ */
2697
+ use: <TResult = unknown>(middleware: (r: UpstashRequest, next: <TResult_1 = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult_1>>) => Promise<UpstashResponse<TResult>>) => void;
2698
+ /**
2699
+ * Technically this is not private, we can hide it from intellisense by doing this
2700
+ */
2701
+ protected addTelemetry: (telemetry: Telemetry) => void;
2702
+ createScript(script: string): Script;
2703
+ /**
2704
+ * Create a new pipeline that allows you to send requests in bulk.
2705
+ *
2706
+ * @see {@link Pipeline}
2707
+ */
2708
+ pipeline: () => Pipeline<[]>;
2709
+ protected autoPipeline: () => Redis;
2710
+ /**
2711
+ * Create a new transaction to allow executing multiple steps atomically.
2712
+ *
2713
+ * All the commands in a transaction are serialized and executed sequentially. A request sent by
2714
+ * another client will never be served in the middle of the execution of a Redis Transaction. This
2715
+ * guarantees that the commands are executed as a single isolated operation.
2716
+ *
2717
+ * @see {@link Pipeline}
2718
+ */
2719
+ multi: () => Pipeline<[]>;
2720
+ /**
2721
+ * Returns an instance that can be used to execute `BITFIELD` commands on one key.
2722
+ *
2723
+ * @example
2724
+ * ```typescript
2725
+ * redis.set("mykey", 0);
2726
+ * const result = await redis.bitfield("mykey")
2727
+ * .set("u4", 0, 16)
2728
+ * .incr("u4", "#1", 1)
2729
+ * .exec();
2730
+ * console.log(result); // [0, 1]
2731
+ * ```
2732
+ *
2733
+ * @see https://redis.io/commands/bitfield
2734
+ */
2735
+ bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
2736
+ /**
2737
+ * @see https://redis.io/commands/append
2738
+ */
2739
+ append: (key: string, value: string) => Promise<number>;
2740
+ /**
2741
+ * @see https://redis.io/commands/bitcount
2742
+ */
2743
+ bitcount: (key: string, start: number, end: number) => Promise<number>;
2744
+ /**
2745
+ * @see https://redis.io/commands/bitop
2746
+ */
2747
+ bitop: {
2748
+ (op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Promise<number>;
2749
+ (op: "not", destinationKey: string, sourceKey: string): Promise<number>;
2750
+ };
2751
+ /**
2752
+ * @see https://redis.io/commands/bitpos
2753
+ */
2754
+ bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Promise<number>;
2755
+ /**
2756
+ * @see https://redis.io/commands/copy
2757
+ */
2758
+ copy: (key: string, destinationKey: string, opts?: {
2759
+ replace: boolean;
2760
+ } | undefined) => Promise<"COPIED" | "NOT_COPIED">;
2761
+ /**
2762
+ * @see https://redis.io/commands/dbsize
2763
+ */
2764
+ dbsize: () => Promise<number>;
2765
+ /**
2766
+ * @see https://redis.io/commands/decr
2767
+ */
2768
+ decr: (key: string) => Promise<number>;
2769
+ /**
2770
+ * @see https://redis.io/commands/decrby
2771
+ */
2772
+ decrby: (key: string, decrement: number) => Promise<number>;
2773
+ /**
2774
+ * @see https://redis.io/commands/del
2775
+ */
2776
+ del: (...args: CommandArgs<typeof DelCommand>) => Promise<number>;
2777
+ /**
2778
+ * @see https://redis.io/commands/echo
2779
+ */
2780
+ echo: (message: string) => Promise<string>;
2781
+ /**
2782
+ * @see https://redis.io/commands/eval
2783
+ */
2784
+ eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
2785
+ /**
2786
+ * @see https://redis.io/commands/evalsha
2787
+ */
2788
+ evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
2789
+ /**
2790
+ * @see https://redis.io/commands/exists
2791
+ */
2792
+ exists: (...args: CommandArgs<typeof ExistsCommand>) => Promise<number>;
2793
+ /**
2794
+ * @see https://redis.io/commands/expire
2795
+ */
2796
+ expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Promise<0 | 1>;
2797
+ /**
2798
+ * @see https://redis.io/commands/expireat
2799
+ */
2800
+ expireat: (key: string, unix: number) => Promise<0 | 1>;
2801
+ /**
2802
+ * @see https://redis.io/commands/flushall
2803
+ */
2804
+ flushall: (args?: CommandArgs<typeof FlushAllCommand>) => Promise<"OK">;
2805
+ /**
2806
+ * @see https://redis.io/commands/flushdb
2807
+ */
2808
+ flushdb: (opts?: {
2809
+ async?: boolean;
2810
+ } | undefined) => Promise<"OK">;
2811
+ /**
2812
+ * @see https://redis.io/commands/geoadd
2813
+ */
2814
+ geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
2815
+ /**
2816
+ * @see https://redis.io/commands/geopos
2817
+ */
2818
+ geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
2819
+ lng: number;
2820
+ lat: number;
2821
+ }[]>;
2822
+ /**
2823
+ * @see https://redis.io/commands/geodist
2824
+ */
2825
+ geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
2826
+ /**
2827
+ * @see https://redis.io/commands/geohash
2828
+ */
2829
+ geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
2830
+ /**
2831
+ * @see https://redis.io/commands/geosearch
2832
+ */
2833
+ geosearch: <TData>(key: string, centerPoint: {
2834
+ type: "FROMLONLAT" | "fromlonlat";
2835
+ coordinate: {
2836
+ lon: number;
2837
+ lat: number;
2838
+ };
2839
+ } | {
2840
+ type: "FROMMEMBER" | "frommember";
2841
+ member: TData;
2842
+ }, shape: {
2843
+ type: "BYRADIUS" | "byradius";
2844
+ radius: number;
2845
+ radiusType: "M" | "KM" | "FT" | "MI";
2846
+ } | {
2847
+ type: "BYBOX" | "bybox";
2848
+ rect: {
2849
+ width: number;
2850
+ height: number;
2851
+ };
2852
+ rectType: "M" | "KM" | "FT" | "MI";
2853
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2854
+ count?: {
2855
+ limit: number;
2856
+ any?: boolean;
2857
+ };
2858
+ withCoord?: boolean;
2859
+ withDist?: boolean;
2860
+ withHash?: boolean;
2861
+ } | undefined) => Promise<({
2862
+ member: TData;
2863
+ } & {
2864
+ coord?: {
2865
+ long: number;
2866
+ lat: number;
2867
+ } | undefined;
2868
+ dist?: number | undefined;
2869
+ hash?: string | undefined;
2870
+ })[]>;
2871
+ /**
2872
+ * @see https://redis.io/commands/geosearchstore
2873
+ */
2874
+ geosearchstore: <TData>(destination: string, key: string, centerPoint: {
2875
+ type: "FROMLONLAT" | "fromlonlat";
2876
+ coordinate: {
2877
+ lon: number;
2878
+ lat: number;
2879
+ };
2880
+ } | {
2881
+ type: "FROMMEMBER" | "frommember";
2882
+ member: TData;
2883
+ }, shape: {
2884
+ type: "BYRADIUS" | "byradius";
2885
+ radius: number;
2886
+ radiusType: "M" | "KM" | "FT" | "MI";
2887
+ } | {
2888
+ type: "BYBOX" | "bybox";
2889
+ rect: {
2890
+ width: number;
2891
+ height: number;
2892
+ };
2893
+ rectType: "M" | "KM" | "FT" | "MI";
2894
+ }, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
2895
+ count?: {
2896
+ limit: number;
2897
+ any?: boolean;
2898
+ };
2899
+ storeDist?: boolean;
2900
+ } | undefined) => Promise<number>;
2901
+ /**
2902
+ * @see https://redis.io/commands/get
2903
+ */
2904
+ get: <TData>(key: string) => Promise<TData | null>;
2905
+ /**
2906
+ * @see https://redis.io/commands/getbit
2907
+ */
2908
+ getbit: (key: string, offset: number) => Promise<0 | 1>;
2909
+ /**
2910
+ * @see https://redis.io/commands/getdel
2911
+ */
2912
+ getdel: <TData>(key: string) => Promise<TData | null>;
2913
+ /**
2914
+ * @see https://redis.io/commands/getrange
2915
+ */
2916
+ getrange: (key: string, start: number, end: number) => Promise<string>;
2917
+ /**
2918
+ * @see https://redis.io/commands/getset
2919
+ */
2920
+ getset: <TData>(key: string, value: TData) => Promise<TData | null>;
2921
+ /**
2922
+ * @see https://redis.io/commands/hdel
2923
+ */
2924
+ hdel: (key: string, ...fields: string[]) => Promise<0 | 1>;
2925
+ /**
2926
+ * @see https://redis.io/commands/hexists
2927
+ */
2928
+ hexists: (key: string, field: string) => Promise<number>;
2929
+ /**
2930
+ * @see https://redis.io/commands/hget
2931
+ */
2932
+ hget: <TData>(key: string, field: string) => Promise<TData | null>;
2933
+ /**
2934
+ * @see https://redis.io/commands/hgetall
2935
+ */
2936
+ hgetall: <TData extends Record<string, unknown>>(key: string) => Promise<TData | null>;
2937
+ /**
2938
+ * @see https://redis.io/commands/hincrby
2939
+ */
2940
+ hincrby: (key: string, field: string, increment: number) => Promise<number>;
2941
+ /**
2942
+ * @see https://redis.io/commands/hincrbyfloat
2943
+ */
2944
+ hincrbyfloat: (key: string, field: string, increment: number) => Promise<number>;
2945
+ /**
2946
+ * @see https://redis.io/commands/hkeys
2947
+ */
2948
+ hkeys: (key: string) => Promise<string[]>;
2949
+ /**
2950
+ * @see https://redis.io/commands/hlen
2951
+ */
2952
+ hlen: (key: string) => Promise<number>;
2953
+ /**
2954
+ * @see https://redis.io/commands/hmget
2955
+ */
2956
+ hmget: <TData extends Record<string, unknown>>(key: string, ...fields: string[]) => Promise<TData | null>;
2957
+ /**
2958
+ * @see https://redis.io/commands/hmset
2959
+ */
2960
+ hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
2961
+ /**
2962
+ * @see https://redis.io/commands/hrandfield
2963
+ */
2964
+ hrandfield: {
2965
+ (key: string): Promise<string | null>;
2966
+ (key: string, count: number): Promise<string[]>;
2967
+ <TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
2968
+ };
2969
+ /**
2970
+ * @see https://redis.io/commands/hscan
2971
+ */
2972
+ hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
2973
+ /**
2974
+ * @see https://redis.io/commands/hset
2975
+ */
2976
+ hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
2977
+ /**
2978
+ * @see https://redis.io/commands/hsetnx
2979
+ */
2980
+ hsetnx: <TData>(key: string, field: string, value: TData) => Promise<0 | 1>;
2981
+ /**
2982
+ * @see https://redis.io/commands/hstrlen
2983
+ */
2984
+ hstrlen: (key: string, field: string) => Promise<number>;
2985
+ /**
2986
+ * @see https://redis.io/commands/hvals
2987
+ */
2988
+ hvals: (key: string) => Promise<any>;
2989
+ /**
2990
+ * @see https://redis.io/commands/incr
2991
+ */
2992
+ incr: (key: string) => Promise<number>;
2993
+ /**
2994
+ * @see https://redis.io/commands/incrby
2995
+ */
2996
+ incrby: (key: string, value: number) => Promise<number>;
2997
+ /**
2998
+ * @see https://redis.io/commands/incrbyfloat
2999
+ */
3000
+ incrbyfloat: (key: string, value: number) => Promise<number>;
3001
+ /**
3002
+ * @see https://redis.io/commands/keys
3003
+ */
3004
+ keys: (pattern: string) => Promise<string[]>;
3005
+ /**
3006
+ * @see https://redis.io/commands/lindex
3007
+ */
3008
+ lindex: (key: string, index: number) => Promise<any>;
3009
+ /**
3010
+ * @see https://redis.io/commands/linsert
3011
+ */
3012
+ linsert: <TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) => Promise<number>;
3013
+ /**
3014
+ * @see https://redis.io/commands/llen
3015
+ */
3016
+ llen: (key: string) => Promise<number>;
3017
+ /**
3018
+ * @see https://redis.io/commands/lmove
3019
+ */
3020
+ lmove: <TData = string>(source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right") => Promise<TData>;
3021
+ /**
3022
+ * @see https://redis.io/commands/lpop
3023
+ */
3024
+ lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3025
+ /**
3026
+ * @see https://redis.io/commands/lmpop
3027
+ */
3028
+ lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
3029
+ /**
3030
+ * @see https://redis.io/commands/lpos
3031
+ */
3032
+ lpos: <TData = number>(key: string, element: unknown, opts?: {
3033
+ rank?: number;
3034
+ count?: number;
3035
+ maxLen?: number;
3036
+ } | undefined) => Promise<TData>;
3037
+ /**
3038
+ * @see https://redis.io/commands/lpush
3039
+ */
3040
+ lpush: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3041
+ /**
3042
+ * @see https://redis.io/commands/lpushx
3043
+ */
3044
+ lpushx: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3045
+ /**
3046
+ * @see https://redis.io/commands/lrange
3047
+ */
3048
+ lrange: <TResult = string>(key: string, start: number, end: number) => Promise<TResult[]>;
3049
+ /**
3050
+ * @see https://redis.io/commands/lrem
3051
+ */
3052
+ lrem: <TData>(key: string, count: number, value: TData) => Promise<number>;
3053
+ /**
3054
+ * @see https://redis.io/commands/lset
3055
+ */
3056
+ lset: <TData>(key: string, index: number, value: TData) => Promise<"OK">;
3057
+ /**
3058
+ * @see https://redis.io/commands/ltrim
3059
+ */
3060
+ ltrim: (key: string, start: number, end: number) => Promise<"OK">;
3061
+ /**
3062
+ * @see https://redis.io/commands/mget
3063
+ */
3064
+ mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => Promise<TData>;
3065
+ /**
3066
+ * @see https://redis.io/commands/mset
3067
+ */
3068
+ mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
3069
+ /**
3070
+ * @see https://redis.io/commands/msetnx
3071
+ */
3072
+ msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
3073
+ /**
3074
+ * @see https://redis.io/commands/persist
3075
+ */
3076
+ persist: (key: string) => Promise<0 | 1>;
3077
+ /**
3078
+ * @see https://redis.io/commands/pexpire
3079
+ */
3080
+ pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
3081
+ /**
3082
+ * @see https://redis.io/commands/pexpireat
3083
+ */
3084
+ pexpireat: (key: string, unix: number) => Promise<0 | 1>;
3085
+ /**
3086
+ * @see https://redis.io/commands/pfadd
3087
+ */
3088
+ pfadd: (args_0: string, ...args_1: unknown[]) => Promise<number>;
3089
+ /**
3090
+ * @see https://redis.io/commands/pfcount
3091
+ */
3092
+ pfcount: (args_0: string, ...args_1: string[]) => Promise<number>;
3093
+ /**
3094
+ * @see https://redis.io/commands/pfmerge
3095
+ */
3096
+ pfmerge: (destination_key: string, ...args_1: string[]) => Promise<"OK">;
3097
+ /**
3098
+ * @see https://redis.io/commands/ping
3099
+ */
3100
+ ping: (args?: CommandArgs<typeof PingCommand>) => Promise<string>;
3101
+ /**
3102
+ * @see https://redis.io/commands/psetex
3103
+ */
3104
+ psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
3105
+ /**
3106
+ * @see https://redis.io/commands/pttl
3107
+ */
3108
+ pttl: (key: string) => Promise<number>;
3109
+ /**
3110
+ * @see https://redis.io/commands/publish
3111
+ */
3112
+ publish: (channel: string, message: unknown) => Promise<number>;
3113
+ /**
3114
+ * @see https://redis.io/commands/randomkey
3115
+ */
3116
+ randomkey: () => Promise<string | null>;
3117
+ /**
3118
+ * @see https://redis.io/commands/rename
3119
+ */
3120
+ rename: (source: string, destination: string) => Promise<"OK">;
3121
+ /**
3122
+ * @see https://redis.io/commands/renamenx
3123
+ */
3124
+ renamenx: (source: string, destination: string) => Promise<0 | 1>;
3125
+ /**
3126
+ * @see https://redis.io/commands/rpop
3127
+ */
3128
+ rpop: <TData = string>(key: string, count?: number | undefined) => Promise<TData | null>;
3129
+ /**
3130
+ * @see https://redis.io/commands/rpush
3131
+ */
3132
+ rpush: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3133
+ /**
3134
+ * @see https://redis.io/commands/rpushx
3135
+ */
3136
+ rpushx: <TData>(key: string, ...elements: TData[]) => Promise<number>;
3137
+ /**
3138
+ * @see https://redis.io/commands/sadd
3139
+ */
3140
+ sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
3141
+ /**
3142
+ * @see https://redis.io/commands/scan
3143
+ */
3144
+ scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, string[]]>;
3145
+ /**
3146
+ * @see https://redis.io/commands/scard
3147
+ */
3148
+ scard: (key: string) => Promise<number>;
3149
+ /**
3150
+ * @see https://redis.io/commands/script-exists
3151
+ */
3152
+ scriptExists: (...args: CommandArgs<typeof ScriptExistsCommand>) => Promise<number[]>;
3153
+ /**
3154
+ * @see https://redis.io/commands/script-flush
3155
+ */
3156
+ scriptFlush: (opts?: ScriptFlushCommandOptions | undefined) => Promise<"OK">;
3157
+ /**
3158
+ * @see https://redis.io/commands/script-load
3159
+ */
3160
+ scriptLoad: (script: string) => Promise<string>;
3161
+ /**
3162
+ * @see https://redis.io/commands/sdiff
3163
+ */
3164
+ sdiff: (key: string, ...keys: string[]) => Promise<unknown[]>;
3165
+ /**
3166
+ * @see https://redis.io/commands/sdiffstore
3167
+ */
3168
+ sdiffstore: (destination: string, ...keys: string[]) => Promise<number>;
3169
+ /**
3170
+ * @see https://redis.io/commands/set
3171
+ */
3172
+ set: <TData>(key: string, value: TData, opts?: SetCommandOptions) => Promise<"OK" | TData | null>;
3173
+ /**
3174
+ * @see https://redis.io/commands/setbit
3175
+ */
3176
+ setbit: (key: string, offset: number, value: 0 | 1) => Promise<0 | 1>;
3177
+ /**
3178
+ * @see https://redis.io/commands/setex
3179
+ */
3180
+ setex: <TData>(key: string, ttl: number, value: TData) => Promise<"OK">;
3181
+ /**
3182
+ * @see https://redis.io/commands/setnx
3183
+ */
3184
+ setnx: <TData>(key: string, value: TData) => Promise<number>;
3185
+ /**
3186
+ * @see https://redis.io/commands/setrange
3187
+ */
3188
+ setrange: (key: string, offset: number, value: string) => Promise<number>;
3189
+ /**
3190
+ * @see https://redis.io/commands/sinter
3191
+ */
3192
+ sinter: (key: string, ...keys: string[]) => Promise<string[]>;
3193
+ /**
3194
+ * @see https://redis.io/commands/sinterstore
3195
+ */
3196
+ sinterstore: (destination: string, key: string, ...keys: string[]) => Promise<number>;
3197
+ /**
3198
+ * @see https://redis.io/commands/sismember
3199
+ */
3200
+ sismember: <TData>(key: string, member: TData) => Promise<0 | 1>;
3201
+ /**
3202
+ * @see https://redis.io/commands/smismember
3203
+ */
3204
+ smismember: <TMembers extends unknown[]>(key: string, members: TMembers) => Promise<(0 | 1)[]>;
3205
+ /**
3206
+ * @see https://redis.io/commands/smembers
3207
+ */
3208
+ smembers: <TData extends unknown[] = string[]>(key: string) => Promise<TData>;
3209
+ /**
3210
+ * @see https://redis.io/commands/smove
3211
+ */
3212
+ smove: <TData>(source: string, destination: string, member: TData) => Promise<0 | 1>;
3213
+ /**
3214
+ * @see https://redis.io/commands/spop
3215
+ */
3216
+ spop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3217
+ /**
3218
+ * @see https://redis.io/commands/srandmember
3219
+ */
3220
+ srandmember: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
3221
+ /**
3222
+ * @see https://redis.io/commands/srem
3223
+ */
3224
+ srem: <TData>(key: string, ...members: TData[]) => Promise<number>;
3225
+ /**
3226
+ * @see https://redis.io/commands/sscan
3227
+ */
3228
+ sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3229
+ /**
3230
+ * @see https://redis.io/commands/strlen
3231
+ */
3232
+ strlen: (key: string) => Promise<number>;
3233
+ /**
3234
+ * @see https://redis.io/commands/sunion
3235
+ */
3236
+ sunion: (key: string, ...keys: string[]) => Promise<unknown[]>;
3237
+ /**
3238
+ * @see https://redis.io/commands/sunionstore
3239
+ */
3240
+ sunionstore: (destination: string, key: string, ...keys: string[]) => Promise<number>;
3241
+ /**
3242
+ * @see https://redis.io/commands/time
3243
+ */
3244
+ time: () => Promise<[number, number]>;
3245
+ /**
3246
+ * @see https://redis.io/commands/touch
3247
+ */
3248
+ touch: (...args: CommandArgs<typeof TouchCommand>) => Promise<number>;
3249
+ /**
3250
+ * @see https://redis.io/commands/ttl
3251
+ */
3252
+ ttl: (key: string) => Promise<number>;
3253
+ /**
3254
+ * @see https://redis.io/commands/type
3255
+ */
3256
+ type: (key: string) => Promise<Type>;
3257
+ /**
3258
+ * @see https://redis.io/commands/unlink
3259
+ */
3260
+ unlink: (...args: CommandArgs<typeof UnlinkCommand>) => Promise<number>;
3261
+ /**
3262
+ * @see https://redis.io/commands/xadd
3263
+ */
3264
+ xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
3265
+ nomkStream?: boolean;
3266
+ trim?: ({
3267
+ type: "MAXLEN" | "maxlen";
3268
+ threshold: number;
3269
+ } | {
3270
+ type: "MINID" | "minid";
3271
+ threshold: string;
3272
+ }) & ({
3273
+ comparison: "~";
3274
+ limit?: number;
3275
+ } | {
3276
+ comparison: "=";
3277
+ limit?: never;
3278
+ });
3279
+ } | undefined) => Promise<string>;
3280
+ /**
3281
+ * @see https://redis.io/commands/xack
3282
+ */
3283
+ xack: (key: string, group: string, id: string | string[]) => Promise<number>;
3284
+ /**
3285
+ * @see https://redis.io/commands/xdel
3286
+ */
3287
+ xdel: (key: string, ids: string | string[]) => Promise<number>;
3288
+ /**
3289
+ * @see https://redis.io/commands/xgroup
3290
+ */
3291
+ xgroup: (key: string, opts: {
3292
+ type: "CREATE";
3293
+ group: string;
3294
+ id: `$` | string;
3295
+ options?: {
3296
+ MKSTREAM?: boolean;
3297
+ ENTRIESREAD?: number;
3298
+ };
3299
+ } | {
3300
+ type: "CREATECONSUMER";
3301
+ group: string;
3302
+ consumer: string;
3303
+ } | {
3304
+ type: "DELCONSUMER";
3305
+ group: string;
3306
+ consumer: string;
3307
+ } | {
3308
+ type: "DESTROY";
3309
+ group: string;
3310
+ } | {
3311
+ type: "SETID";
3312
+ group: string;
3313
+ id: `$` | string;
3314
+ options?: {
3315
+ ENTRIESREAD?: number;
3316
+ };
3317
+ }) => Promise<never>;
3318
+ /**
3319
+ * @see https://redis.io/commands/xread
3320
+ */
3321
+ xread: (...args: CommandArgs<typeof XReadCommand>) => Promise<unknown[]>;
3322
+ /**
3323
+ * @see https://redis.io/commands/xreadgroup
3324
+ */
3325
+ xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Promise<unknown[]>;
3326
+ /**
3327
+ * @see https://redis.io/commands/xinfo
3328
+ */
3329
+ xinfo: (key: string, options: {
3330
+ type: "CONSUMERS";
3331
+ group: string;
3332
+ } | {
3333
+ type: "GROUPS";
3334
+ }) => Promise<unknown[]>;
3335
+ /**
3336
+ * @see https://redis.io/commands/xlen
3337
+ */
3338
+ xlen: (key: string) => Promise<number>;
3339
+ /**
3340
+ * @see https://redis.io/commands/xpending
3341
+ */
3342
+ xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
3343
+ idleTime?: number;
3344
+ consumer?: string | string[];
3345
+ } | undefined) => Promise<unknown[]>;
3346
+ /**
3347
+ * @see https://redis.io/commands/xclaim
3348
+ */
3349
+ xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
3350
+ idleMS?: number;
3351
+ timeMS?: number;
3352
+ retryCount?: number;
3353
+ force?: boolean;
3354
+ justId?: boolean;
3355
+ lastId?: number;
3356
+ } | undefined) => Promise<unknown[]>;
3357
+ /**
3358
+ * @see https://redis.io/commands/xautoclaim
3359
+ */
3360
+ xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
3361
+ count?: number;
3362
+ justId?: boolean;
3363
+ } | undefined) => Promise<unknown[]>;
3364
+ /**
3365
+ * @see https://redis.io/commands/xtrim
3366
+ */
3367
+ xtrim: (key: string, options: {
3368
+ strategy: "MAXLEN" | "MINID";
3369
+ exactness?: "~" | "=";
3370
+ threshold: number | string;
3371
+ limit?: number;
3372
+ }) => Promise<number>;
3373
+ /**
3374
+ * @see https://redis.io/commands/xrange
3375
+ */
3376
+ xrange: (key: string, start: string, end: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
3377
+ /**
3378
+ * @see https://redis.io/commands/xrevrange
3379
+ */
3380
+ xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
3381
+ /**
3382
+ * @see https://redis.io/commands/zadd
3383
+ */
3384
+ zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
3385
+ /**
3386
+ * @see https://redis.io/commands/zcard
3387
+ */
3388
+ zcard: (key: string) => Promise<number>;
3389
+ /**
3390
+ * @see https://redis.io/commands/zcount
3391
+ */
3392
+ zcount: (key: string, min: string | number, max: string | number) => Promise<number>;
3393
+ /**
3394
+ * @see https://redis.io/commands/zdiffstore
3395
+ */
3396
+ zdiffstore: (destination: string, numkeys: number, ...keys: string[]) => Promise<number>;
3397
+ /**
3398
+ * @see https://redis.io/commands/zincrby
3399
+ */
3400
+ zincrby: <TData>(key: string, increment: number, member: TData) => Promise<number>;
3401
+ /**
3402
+ * @see https://redis.io/commands/zinterstore
3403
+ */
3404
+ zinterstore: (destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions | undefined) => Promise<number>;
3405
+ /**
3406
+ * @see https://redis.io/commands/zlexcount
3407
+ */
3408
+ zlexcount: (key: string, min: string, max: string) => Promise<number>;
3409
+ /**
3410
+ * @see https://redis.io/commands/zmscore
3411
+ */
3412
+ zmscore: (key: string, members: unknown[]) => Promise<number[] | null>;
3413
+ /**
3414
+ * @see https://redis.io/commands/zpopmax
3415
+ */
3416
+ zpopmax: <TData>(key: string, count?: number | undefined) => Promise<TData[]>;
3417
+ /**
3418
+ * @see https://redis.io/commands/zpopmin
3419
+ */
3420
+ zpopmin: <TData>(key: string, count?: number | undefined) => Promise<TData[]>;
3421
+ /**
3422
+ * @see https://redis.io/commands/zrange
3423
+ */
3424
+ zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
3425
+ byLex: true;
3426
+ } & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
3427
+ byScore: true;
3428
+ } & ZRangeCommandOptions]) => Promise<TData>;
3429
+ /**
3430
+ * @see https://redis.io/commands/zrank
3431
+ */
3432
+ zrank: <TData>(key: string, member: TData) => Promise<number | null>;
3433
+ /**
3434
+ * @see https://redis.io/commands/zrem
3435
+ */
3436
+ zrem: <TData>(key: string, ...members: TData[]) => Promise<number>;
3437
+ /**
3438
+ * @see https://redis.io/commands/zremrangebylex
3439
+ */
3440
+ zremrangebylex: (key: string, min: string, max: string) => Promise<number>;
3441
+ /**
3442
+ * @see https://redis.io/commands/zremrangebyrank
3443
+ */
3444
+ zremrangebyrank: (key: string, start: number, stop: number) => Promise<number>;
3445
+ /**
3446
+ * @see https://redis.io/commands/zremrangebyscore
3447
+ */
3448
+ zremrangebyscore: (key: string, min: number, max: number) => Promise<number>;
3449
+ /**
3450
+ * @see https://redis.io/commands/zrevrank
3451
+ */
3452
+ zrevrank: <TData>(key: string, member: TData) => Promise<number | null>;
3453
+ /**
3454
+ * @see https://redis.io/commands/zscan
3455
+ */
3456
+ zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
3457
+ /**
3458
+ * @see https://redis.io/commands/zscore
3459
+ */
3460
+ zscore: <TData>(key: string, member: TData) => Promise<number | null>;
3461
+ /**
3462
+ * @see https://redis.io/commands/zunion
3463
+ */
3464
+ zunion: (numKeys: number, keys: string[], opts?: ZUnionCommandOptions | undefined) => Promise<any>;
3465
+ /**
3466
+ * @see https://redis.io/commands/zunionstore
3467
+ */
3468
+ zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
3469
+ }
3470
+
3471
+ /**
3472
+ * Result of a bad request to upstash
3473
+ */
3474
+ declare class UpstashError extends Error {
3475
+ constructor(message: string);
3476
+ }
3477
+ declare class UrlError extends Error {
3478
+ constructor(url: string);
3479
+ }
3480
+
3481
+ type error_UpstashError = UpstashError;
3482
+ declare const error_UpstashError: typeof UpstashError;
3483
+ type error_UrlError = UrlError;
3484
+ declare const error_UrlError: typeof UrlError;
3485
+ declare namespace error {
3486
+ export { error_UpstashError as UpstashError, error_UrlError as UrlError };
3487
+ }
3488
+
3489
+ /**
3490
+ * @see https://redis.io/commands/zdiffstore
3491
+ */
3492
+ declare class ZDiffStoreCommand extends Command<number, number> {
3493
+ constructor(cmd: [destination: string, numkeys: number, ...keys: string[]], opts?: CommandOptions<number, number>);
3494
+ }
3495
+
3496
+ /**
3497
+ * @see https://redis.io/commands/zmscore
3498
+ */
3499
+ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] | null> {
3500
+ constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
3501
+ }
3502
+
3503
+ 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 };