@upstash/redis 0.0.0-ci.d9c08accc3bdd7a1d21f3d860e54e9cb1570f23e-20231215001420 → 0.0.0-ci.da1a5cb507eab3a0864199c49d02985f16e8bcd0-20250729064120
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.
- package/README.md +6 -2
- package/chunk-PSYAGAHX.mjs +4491 -0
- package/cloudflare.d.mts +15 -5
- package/cloudflare.d.ts +15 -5
- package/cloudflare.js +4593 -1
- package/cloudflare.mjs +93 -1
- package/fastly.d.mts +10 -5
- package/fastly.d.ts +10 -5
- package/fastly.js +4566 -1
- package/fastly.mjs +66 -1
- package/nodejs.d.mts +17 -24
- package/nodejs.d.ts +17 -24
- package/nodejs.js +4613 -1
- package/nodejs.mjs +113 -1
- package/package.json +1 -1
- package/{zmscore-415f6c9f.d.ts → zmscore-BshEAkn7.d.mts} +1227 -355
- package/zmscore-BshEAkn7.d.ts +4031 -0
- package/chunk-OYFBHYRC.js +0 -1
- package/chunk-QR3OMNVI.mjs +0 -1
|
@@ -23,7 +23,10 @@ type RedisOptions = {
|
|
|
23
23
|
* @default true
|
|
24
24
|
*/
|
|
25
25
|
automaticDeserialization?: boolean;
|
|
26
|
+
latencyLogging?: boolean;
|
|
26
27
|
enableTelemetry?: boolean;
|
|
28
|
+
enableAutoPipelining?: boolean;
|
|
29
|
+
readYourWrites?: boolean;
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
|
@@ -33,12 +36,37 @@ type UpstashRequest = {
|
|
|
33
36
|
* Request body will be serialized to json
|
|
34
37
|
*/
|
|
35
38
|
body?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Additional headers for the request
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
upstashSyncToken?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Callback for handling streaming messages
|
|
46
|
+
*/
|
|
47
|
+
onMessage?: (data: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this request expects a streaming response
|
|
50
|
+
*/
|
|
51
|
+
isStreaming?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Abort signal for the request
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal;
|
|
36
56
|
};
|
|
37
57
|
type UpstashResponse<TResult> = {
|
|
38
58
|
result?: TResult;
|
|
39
59
|
error?: string;
|
|
40
60
|
};
|
|
41
61
|
interface Requester {
|
|
62
|
+
/**
|
|
63
|
+
* When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client.
|
|
64
|
+
*/
|
|
65
|
+
readYourWrites?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* This token is used to ensure that the client is in sync with the server. On each request, we send this token in the header, and the server will return a new token.
|
|
68
|
+
*/
|
|
69
|
+
upstashSyncToken?: string;
|
|
42
70
|
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
43
71
|
}
|
|
44
72
|
type RetryConfig = false | {
|
|
@@ -58,6 +86,9 @@ type RetryConfig = false | {
|
|
|
58
86
|
*/
|
|
59
87
|
backoff?: (retryCount: number) => number;
|
|
60
88
|
};
|
|
89
|
+
type Options$1 = {
|
|
90
|
+
backend?: string;
|
|
91
|
+
};
|
|
61
92
|
type RequesterConfig = {
|
|
62
93
|
/**
|
|
63
94
|
* Configure the retry behaviour in case of network errors
|
|
@@ -92,6 +123,19 @@ type RequesterConfig = {
|
|
|
92
123
|
*/
|
|
93
124
|
cache?: CacheSetting;
|
|
94
125
|
};
|
|
126
|
+
type HttpClientConfig = {
|
|
127
|
+
headers?: Record<string, string>;
|
|
128
|
+
baseUrl: string;
|
|
129
|
+
options?: Options$1;
|
|
130
|
+
retry?: RetryConfig;
|
|
131
|
+
agent?: any;
|
|
132
|
+
signal?: AbortSignal | (() => AbortSignal);
|
|
133
|
+
keepAlive?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* 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.
|
|
136
|
+
*/
|
|
137
|
+
readYourWrites?: boolean;
|
|
138
|
+
} & RequesterConfig;
|
|
95
139
|
|
|
96
140
|
type Serialize = (data: unknown) => string | number | boolean;
|
|
97
141
|
type Deserialize<TResult, TData> = (result: TResult) => TData;
|
|
@@ -106,6 +150,32 @@ type CommandOptions<TResult, TData> = {
|
|
|
106
150
|
* @default true
|
|
107
151
|
*/
|
|
108
152
|
automaticDeserialization?: boolean;
|
|
153
|
+
latencyLogging?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Additional headers to be sent with the request
|
|
156
|
+
*/
|
|
157
|
+
headers?: Record<string, string>;
|
|
158
|
+
/**
|
|
159
|
+
* Path to append to the URL
|
|
160
|
+
*/
|
|
161
|
+
path?: string[];
|
|
162
|
+
/**
|
|
163
|
+
* Options for streaming requests, mainly used for subscribe, monitor commands
|
|
164
|
+
**/
|
|
165
|
+
streamOptions?: {
|
|
166
|
+
/**
|
|
167
|
+
* Callback to be called when a message is received
|
|
168
|
+
*/
|
|
169
|
+
onMessage?: (data: string) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the request is streaming
|
|
172
|
+
*/
|
|
173
|
+
isStreaming?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Signal to abort the request
|
|
176
|
+
*/
|
|
177
|
+
signal?: AbortSignal;
|
|
178
|
+
};
|
|
109
179
|
};
|
|
110
180
|
/**
|
|
111
181
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -117,6 +187,11 @@ declare class Command<TResult, TData> {
|
|
|
117
187
|
readonly command: (string | number | boolean)[];
|
|
118
188
|
readonly serialize: Serialize;
|
|
119
189
|
readonly deserialize: Deserialize<TResult, TData>;
|
|
190
|
+
protected readonly headers?: Record<string, string>;
|
|
191
|
+
protected readonly path?: string[];
|
|
192
|
+
protected readonly onMessage?: (data: string) => void;
|
|
193
|
+
protected readonly isStreaming: boolean;
|
|
194
|
+
protected readonly signal?: AbortSignal;
|
|
120
195
|
/**
|
|
121
196
|
* Create a new command instance.
|
|
122
197
|
*
|
|
@@ -212,18 +287,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
|
|
|
212
287
|
constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
|
|
213
288
|
}
|
|
214
289
|
|
|
215
|
-
type ScanCommandOptions = {
|
|
216
|
-
match?: string;
|
|
217
|
-
count?: number;
|
|
218
|
-
type?: string;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* @see https://redis.io/commands/scan
|
|
222
|
-
*/
|
|
223
|
-
declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
|
|
224
|
-
constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, string[]], [number, string[]]>);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
290
|
type GeoAddCommandOptions = {
|
|
228
291
|
nx?: boolean;
|
|
229
292
|
xx?: never;
|
|
@@ -233,11 +296,11 @@ type GeoAddCommandOptions = {
|
|
|
233
296
|
} & {
|
|
234
297
|
ch?: boolean;
|
|
235
298
|
});
|
|
236
|
-
|
|
299
|
+
type GeoMember<TMemberType> = {
|
|
237
300
|
latitude: number;
|
|
238
301
|
longitude: number;
|
|
239
302
|
member: TMemberType;
|
|
240
|
-
}
|
|
303
|
+
};
|
|
241
304
|
/**
|
|
242
305
|
* @see https://redis.io/commands/geoadd
|
|
243
306
|
*/
|
|
@@ -249,6 +312,11 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
|
|
|
249
312
|
], opts?: CommandOptions<number | null, number | null>);
|
|
250
313
|
}
|
|
251
314
|
|
|
315
|
+
type ExpireOption = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
316
|
+
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
317
|
+
constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
318
|
+
}
|
|
319
|
+
|
|
252
320
|
/**
|
|
253
321
|
* @see https://redis.io/commands/append
|
|
254
322
|
*/
|
|
@@ -264,6 +332,28 @@ declare class BitCountCommand extends Command<number, number> {
|
|
|
264
332
|
constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
|
|
265
333
|
}
|
|
266
334
|
|
|
335
|
+
type SubCommandArgs<TRest extends unknown[] = []> = [
|
|
336
|
+
encoding: string,
|
|
337
|
+
offset: number | string,
|
|
338
|
+
...rest: TRest
|
|
339
|
+
];
|
|
340
|
+
/**
|
|
341
|
+
* @see https://redis.io/commands/bitfield
|
|
342
|
+
*/
|
|
343
|
+
declare class BitFieldCommand<T = Promise<number[]>> {
|
|
344
|
+
private client;
|
|
345
|
+
private opts?;
|
|
346
|
+
private execOperation;
|
|
347
|
+
private command;
|
|
348
|
+
constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
|
|
349
|
+
private chain;
|
|
350
|
+
get(...args: SubCommandArgs): this;
|
|
351
|
+
set(...args: SubCommandArgs<[value: number]>): this;
|
|
352
|
+
incrby(...args: SubCommandArgs<[increment: number]>): this;
|
|
353
|
+
overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
|
|
354
|
+
exec(): T;
|
|
355
|
+
}
|
|
356
|
+
|
|
267
357
|
/**
|
|
268
358
|
* @see https://redis.io/commands/bitop
|
|
269
359
|
*/
|
|
@@ -323,6 +413,13 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
323
413
|
constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
|
|
324
414
|
}
|
|
325
415
|
|
|
416
|
+
/**
|
|
417
|
+
* @see https://redis.io/commands/eval_ro
|
|
418
|
+
*/
|
|
419
|
+
declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
420
|
+
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
421
|
+
}
|
|
422
|
+
|
|
326
423
|
/**
|
|
327
424
|
* @see https://redis.io/commands/eval
|
|
328
425
|
*/
|
|
@@ -330,6 +427,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
|
|
|
330
427
|
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
331
428
|
}
|
|
332
429
|
|
|
430
|
+
/**
|
|
431
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
432
|
+
*/
|
|
433
|
+
declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
434
|
+
constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
435
|
+
}
|
|
436
|
+
|
|
333
437
|
/**
|
|
334
438
|
* @see https://redis.io/commands/evalsha
|
|
335
439
|
*/
|
|
@@ -344,18 +448,11 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
344
448
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
345
449
|
}
|
|
346
450
|
|
|
347
|
-
/**
|
|
348
|
-
* @see https://redis.io/commands/expire
|
|
349
|
-
*/
|
|
350
|
-
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
351
|
-
constructor(cmd: [key: string, seconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
451
|
/**
|
|
355
452
|
* @see https://redis.io/commands/expireat
|
|
356
453
|
*/
|
|
357
454
|
declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
358
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
455
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
359
456
|
}
|
|
360
457
|
|
|
361
458
|
/**
|
|
@@ -388,6 +485,13 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
|
|
|
388
485
|
], opts?: CommandOptions<number | null, number | null>);
|
|
389
486
|
}
|
|
390
487
|
|
|
488
|
+
/**
|
|
489
|
+
* @see https://redis.io/commands/geohash
|
|
490
|
+
*/
|
|
491
|
+
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
492
|
+
constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
493
|
+
}
|
|
494
|
+
|
|
391
495
|
type Coordinates = {
|
|
392
496
|
lng: number;
|
|
393
497
|
lat: number;
|
|
@@ -399,13 +503,6 @@ declare class GeoPosCommand<TMember = string> extends Command<(string | null)[][
|
|
|
399
503
|
constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[][], Coordinates[]>);
|
|
400
504
|
}
|
|
401
505
|
|
|
402
|
-
/**
|
|
403
|
-
* @see https://redis.io/commands/geohash
|
|
404
|
-
*/
|
|
405
|
-
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
406
|
-
constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
506
|
type RadiusOptions$1 = "M" | "KM" | "FT" | "MI";
|
|
410
507
|
type CenterPoint$1<TMemberType> = {
|
|
411
508
|
type: "FROMMEMBER" | "frommember";
|
|
@@ -530,6 +627,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
|
|
|
530
627
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
531
628
|
}
|
|
532
629
|
|
|
630
|
+
type GetExCommandOptions = {
|
|
631
|
+
ex: number;
|
|
632
|
+
px?: never;
|
|
633
|
+
exat?: never;
|
|
634
|
+
pxat?: never;
|
|
635
|
+
persist?: never;
|
|
636
|
+
} | {
|
|
637
|
+
ex?: never;
|
|
638
|
+
px: number;
|
|
639
|
+
exat?: never;
|
|
640
|
+
pxat?: never;
|
|
641
|
+
persist?: never;
|
|
642
|
+
} | {
|
|
643
|
+
ex?: never;
|
|
644
|
+
px?: never;
|
|
645
|
+
exat: number;
|
|
646
|
+
pxat?: never;
|
|
647
|
+
persist?: never;
|
|
648
|
+
} | {
|
|
649
|
+
ex?: never;
|
|
650
|
+
px?: never;
|
|
651
|
+
exat?: never;
|
|
652
|
+
pxat: number;
|
|
653
|
+
persist?: never;
|
|
654
|
+
} | {
|
|
655
|
+
ex?: never;
|
|
656
|
+
px?: never;
|
|
657
|
+
exat?: never;
|
|
658
|
+
pxat?: never;
|
|
659
|
+
persist: true;
|
|
660
|
+
} | {
|
|
661
|
+
ex?: never;
|
|
662
|
+
px?: never;
|
|
663
|
+
exat?: never;
|
|
664
|
+
pxat?: never;
|
|
665
|
+
persist?: never;
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* @see https://redis.io/commands/getex
|
|
669
|
+
*/
|
|
670
|
+
declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
671
|
+
constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
|
|
672
|
+
}
|
|
673
|
+
|
|
533
674
|
/**
|
|
534
675
|
* @see https://redis.io/commands/getrange
|
|
535
676
|
*/
|
|
@@ -558,6 +699,58 @@ declare class HExistsCommand extends Command<number, number> {
|
|
|
558
699
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
559
700
|
}
|
|
560
701
|
|
|
702
|
+
declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
703
|
+
constructor(cmd: [
|
|
704
|
+
key: string,
|
|
705
|
+
fields: (string | number) | (string | number)[],
|
|
706
|
+
seconds: number,
|
|
707
|
+
option?: ExpireOption
|
|
708
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
712
|
+
constructor(cmd: [
|
|
713
|
+
key: string,
|
|
714
|
+
fields: (string | number) | (string | number)[],
|
|
715
|
+
timestamp: number,
|
|
716
|
+
option?: ExpireOption
|
|
717
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
declare class HExpireTimeCommand extends Command<number[], number[]> {
|
|
721
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
|
|
725
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
729
|
+
constructor(cmd: [
|
|
730
|
+
key: string,
|
|
731
|
+
fields: (string | number) | (string | number)[],
|
|
732
|
+
milliseconds: number,
|
|
733
|
+
option?: ExpireOption
|
|
734
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
738
|
+
constructor(cmd: [
|
|
739
|
+
key: string,
|
|
740
|
+
fields: (string | number) | (string | number)[],
|
|
741
|
+
timestamp: number,
|
|
742
|
+
option?: ExpireOption
|
|
743
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
declare class HPExpireTimeCommand extends Command<number[], number[]> {
|
|
747
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
declare class HPTtlCommand extends Command<number[], number[]> {
|
|
751
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
752
|
+
}
|
|
753
|
+
|
|
561
754
|
/**
|
|
562
755
|
* @see https://redis.io/commands/hget
|
|
563
756
|
*/
|
|
@@ -619,9 +812,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
|
|
|
619
812
|
* @see https://redis.io/commands/hmset
|
|
620
813
|
*/
|
|
621
814
|
declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
|
|
622
|
-
constructor([key, kv]: [key: string, kv:
|
|
623
|
-
[field: string]: TData;
|
|
624
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
815
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
625
816
|
}
|
|
626
817
|
|
|
627
818
|
/**
|
|
@@ -633,26 +824,57 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
633
824
|
constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
|
|
634
825
|
}
|
|
635
826
|
|
|
827
|
+
type ScanCommandOptionsStandard = {
|
|
828
|
+
match?: string;
|
|
829
|
+
count?: number;
|
|
830
|
+
type?: string;
|
|
831
|
+
withType?: false;
|
|
832
|
+
};
|
|
833
|
+
type ScanCommandOptionsWithType = {
|
|
834
|
+
match?: string;
|
|
835
|
+
count?: number;
|
|
836
|
+
/**
|
|
837
|
+
* Includes types of each key in the result
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* ```typescript
|
|
841
|
+
* await redis.scan("0", { withType: true })
|
|
842
|
+
* // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]]
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
withType: true;
|
|
846
|
+
};
|
|
847
|
+
type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType;
|
|
848
|
+
type ScanResultStandard = [string, string[]];
|
|
849
|
+
type ScanResultWithType = [string, {
|
|
850
|
+
key: string;
|
|
851
|
+
type: string;
|
|
852
|
+
}[]];
|
|
853
|
+
/**
|
|
854
|
+
* @see https://redis.io/commands/scan
|
|
855
|
+
*/
|
|
856
|
+
declare class ScanCommand<TData = ScanResultStandard> extends Command<[string, string[]], TData> {
|
|
857
|
+
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>);
|
|
858
|
+
}
|
|
859
|
+
|
|
636
860
|
/**
|
|
637
861
|
* @see https://redis.io/commands/hscan
|
|
638
862
|
*/
|
|
639
863
|
declare class HScanCommand extends Command<[
|
|
640
|
-
|
|
864
|
+
string,
|
|
641
865
|
(string | number)[]
|
|
642
866
|
], [
|
|
643
|
-
|
|
867
|
+
string,
|
|
644
868
|
(string | number)[]
|
|
645
869
|
]> {
|
|
646
|
-
constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[
|
|
870
|
+
constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
647
871
|
}
|
|
648
872
|
|
|
649
873
|
/**
|
|
650
874
|
* @see https://redis.io/commands/hset
|
|
651
875
|
*/
|
|
652
876
|
declare class HSetCommand<TData> extends Command<number, number> {
|
|
653
|
-
constructor([key, kv]: [key: string, kv:
|
|
654
|
-
[field: string]: TData;
|
|
655
|
-
}], opts?: CommandOptions<number, number>);
|
|
877
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
656
878
|
}
|
|
657
879
|
|
|
658
880
|
/**
|
|
@@ -669,6 +891,10 @@ declare class HStrLenCommand extends Command<number, number> {
|
|
|
669
891
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
670
892
|
}
|
|
671
893
|
|
|
894
|
+
declare class HTtlCommand extends Command<number[], number[]> {
|
|
895
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
896
|
+
}
|
|
897
|
+
|
|
672
898
|
/**
|
|
673
899
|
* @see https://redis.io/commands/hvals
|
|
674
900
|
*/
|
|
@@ -775,13 +1001,31 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
775
1001
|
] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
|
|
776
1002
|
}
|
|
777
1003
|
|
|
1004
|
+
/**
|
|
1005
|
+
* @see https://redis.io/commands/json.merge
|
|
1006
|
+
*/
|
|
1007
|
+
declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
|
|
1008
|
+
constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
778
1011
|
/**
|
|
779
1012
|
* @see https://redis.io/commands/json.mget
|
|
780
1013
|
*/
|
|
781
|
-
declare class JsonMGetCommand<TData
|
|
1014
|
+
declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
|
|
782
1015
|
constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
|
|
783
1016
|
}
|
|
784
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* @see https://redis.io/commands/json.mset
|
|
1020
|
+
*/
|
|
1021
|
+
declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
|
|
1022
|
+
constructor(cmd: {
|
|
1023
|
+
key: string;
|
|
1024
|
+
path: string;
|
|
1025
|
+
value: TData;
|
|
1026
|
+
}[], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
785
1029
|
/**
|
|
786
1030
|
* @see https://redis.io/commands/json.numincrby
|
|
787
1031
|
*/
|
|
@@ -938,25 +1182,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
|
|
|
938
1182
|
* @see https://redis.io/commands/mget
|
|
939
1183
|
*/
|
|
940
1184
|
declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
|
|
941
|
-
constructor(cmd: [string[]] | [...
|
|
1185
|
+
constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
|
|
942
1186
|
}
|
|
943
1187
|
|
|
944
1188
|
/**
|
|
945
1189
|
* @see https://redis.io/commands/mset
|
|
946
1190
|
*/
|
|
947
1191
|
declare class MSetCommand<TData> extends Command<"OK", "OK"> {
|
|
948
|
-
constructor([kv]: [kv:
|
|
949
|
-
[key: string]: TData;
|
|
950
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
1192
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
951
1193
|
}
|
|
952
1194
|
|
|
953
1195
|
/**
|
|
954
1196
|
* @see https://redis.io/commands/msetnx
|
|
955
1197
|
*/
|
|
956
1198
|
declare class MSetNXCommand<TData = string> extends Command<number, number> {
|
|
957
|
-
constructor([kv]: [kv:
|
|
958
|
-
[key: string]: TData;
|
|
959
|
-
}], opts?: CommandOptions<number, number>);
|
|
1199
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
960
1200
|
}
|
|
961
1201
|
|
|
962
1202
|
/**
|
|
@@ -970,14 +1210,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
|
|
|
970
1210
|
* @see https://redis.io/commands/pexpire
|
|
971
1211
|
*/
|
|
972
1212
|
declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
973
|
-
constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1213
|
+
constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
974
1214
|
}
|
|
975
1215
|
|
|
976
1216
|
/**
|
|
977
1217
|
* @see https://redis.io/commands/pexpireat
|
|
978
1218
|
*/
|
|
979
1219
|
declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
980
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1220
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
981
1221
|
}
|
|
982
1222
|
|
|
983
1223
|
/**
|
|
@@ -1054,7 +1294,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
|
|
|
1054
1294
|
* @see https://redis.io/commands/sadd
|
|
1055
1295
|
*/
|
|
1056
1296
|
declare class SAddCommand<TData = string> extends Command<number, number> {
|
|
1057
|
-
constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1297
|
+
constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1058
1298
|
}
|
|
1059
1299
|
|
|
1060
1300
|
/**
|
|
@@ -1242,13 +1482,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
|
|
|
1242
1482
|
* @see https://redis.io/commands/sscan
|
|
1243
1483
|
*/
|
|
1244
1484
|
declare class SScanCommand extends Command<[
|
|
1245
|
-
|
|
1485
|
+
string,
|
|
1246
1486
|
(string | number)[]
|
|
1247
1487
|
], [
|
|
1248
|
-
|
|
1488
|
+
string,
|
|
1249
1489
|
(string | number)[]
|
|
1250
1490
|
]> {
|
|
1251
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1491
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1252
1492
|
}
|
|
1253
1493
|
|
|
1254
1494
|
/**
|
|
@@ -1323,9 +1563,7 @@ declare class XAddCommand extends Command<string, string> {
|
|
|
1323
1563
|
constructor([key, id, entries, opts]: [
|
|
1324
1564
|
key: string,
|
|
1325
1565
|
id: "*" | string,
|
|
1326
|
-
entries:
|
|
1327
|
-
[field: string]: unknown;
|
|
1328
|
-
},
|
|
1566
|
+
entries: Record<string, unknown>,
|
|
1329
1567
|
opts?: XAddCommandOptions
|
|
1330
1568
|
], commandOptions?: CommandOptions<string, string>);
|
|
1331
1569
|
}
|
|
@@ -1334,6 +1572,54 @@ declare class XRangeCommand<TData extends Record<string, Record<string, unknown>
|
|
|
1334
1572
|
constructor([key, start, end, count]: [key: string, start: string, end: string, count?: number], opts?: CommandOptions<unknown[], TData[]>);
|
|
1335
1573
|
}
|
|
1336
1574
|
|
|
1575
|
+
type XReadCommandOptions = [
|
|
1576
|
+
key: string | string[],
|
|
1577
|
+
id: string | string[],
|
|
1578
|
+
options?: {
|
|
1579
|
+
count?: number;
|
|
1580
|
+
blockMS?: number;
|
|
1581
|
+
}
|
|
1582
|
+
];
|
|
1583
|
+
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [key: string, id: string, options?: {
|
|
1584
|
+
count?: number;
|
|
1585
|
+
blockMS?: number;
|
|
1586
|
+
}] : never : K extends string[] ? I extends string[] ? [key: string[], id: string[], options?: {
|
|
1587
|
+
count?: number;
|
|
1588
|
+
blockMS?: number;
|
|
1589
|
+
}] : never : never : never;
|
|
1590
|
+
/**
|
|
1591
|
+
* @see https://redis.io/commands/xread
|
|
1592
|
+
*/
|
|
1593
|
+
declare class XReadCommand extends Command<number, unknown[]> {
|
|
1594
|
+
constructor([key, id, options]: XReadOptions, opts?: CommandOptions<number, unknown[]>);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
type Options = {
|
|
1598
|
+
count?: number;
|
|
1599
|
+
blockMS?: number;
|
|
1600
|
+
NOACK?: boolean;
|
|
1601
|
+
};
|
|
1602
|
+
type XReadGroupCommandOptions = [
|
|
1603
|
+
group: string,
|
|
1604
|
+
consumer: string,
|
|
1605
|
+
key: string | string[],
|
|
1606
|
+
id: string | string[],
|
|
1607
|
+
options?: Options
|
|
1608
|
+
];
|
|
1609
|
+
type XReadGroupOptions = XReadGroupCommandOptions extends [
|
|
1610
|
+
string,
|
|
1611
|
+
string,
|
|
1612
|
+
infer TKey,
|
|
1613
|
+
infer TId,
|
|
1614
|
+
...any[]
|
|
1615
|
+
] ? 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;
|
|
1616
|
+
/**
|
|
1617
|
+
* @see https://redis.io/commands/xreadgroup
|
|
1618
|
+
*/
|
|
1619
|
+
declare class XReadGroupCommand extends Command<number, unknown[]> {
|
|
1620
|
+
constructor([group, consumer, key, id, options]: XReadGroupOptions, opts?: CommandOptions<number, unknown[]>);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1337
1623
|
type NXAndXXOptions = {
|
|
1338
1624
|
nx: true;
|
|
1339
1625
|
xx?: never;
|
|
@@ -1501,13 +1787,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
|
|
|
1501
1787
|
* @see https://redis.io/commands/zscan
|
|
1502
1788
|
*/
|
|
1503
1789
|
declare class ZScanCommand extends Command<[
|
|
1504
|
-
|
|
1790
|
+
string,
|
|
1505
1791
|
(string | number)[]
|
|
1506
1792
|
], [
|
|
1507
|
-
|
|
1793
|
+
string,
|
|
1508
1794
|
(string | number)[]
|
|
1509
1795
|
]> {
|
|
1510
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1796
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1511
1797
|
}
|
|
1512
1798
|
|
|
1513
1799
|
/**
|
|
@@ -1517,9 +1803,78 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1517
1803
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1518
1804
|
}
|
|
1519
1805
|
|
|
1806
|
+
type BaseMessageData<TMessage> = {
|
|
1807
|
+
channel: string;
|
|
1808
|
+
message: TMessage;
|
|
1809
|
+
};
|
|
1810
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1811
|
+
pattern: string;
|
|
1812
|
+
};
|
|
1813
|
+
type SubscriptionCountEvent = number;
|
|
1814
|
+
type MessageEventMap<TMessage> = {
|
|
1815
|
+
message: BaseMessageData<TMessage>;
|
|
1816
|
+
subscribe: SubscriptionCountEvent;
|
|
1817
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1818
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1819
|
+
psubscribe: SubscriptionCountEvent;
|
|
1820
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1821
|
+
error: Error;
|
|
1822
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1823
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1824
|
+
};
|
|
1825
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1826
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1827
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1828
|
+
private subscriptions;
|
|
1829
|
+
private client;
|
|
1830
|
+
private listeners;
|
|
1831
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean);
|
|
1832
|
+
private subscribeToChannel;
|
|
1833
|
+
private subscribeToPattern;
|
|
1834
|
+
private handleMessage;
|
|
1835
|
+
private dispatchToListeners;
|
|
1836
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1837
|
+
removeAllListeners(): void;
|
|
1838
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1839
|
+
getSubscribedChannels(): string[];
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1520
1842
|
type InferResponseData<T extends unknown[]> = {
|
|
1521
1843
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1522
1844
|
};
|
|
1845
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1846
|
+
/**
|
|
1847
|
+
* Send the pipeline request to upstash.
|
|
1848
|
+
*
|
|
1849
|
+
* Returns an array with the results of all pipelined commands.
|
|
1850
|
+
*
|
|
1851
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1852
|
+
* ```ts
|
|
1853
|
+
* const p = redis.pipeline()
|
|
1854
|
+
* p.get("key")
|
|
1855
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1856
|
+
* ```
|
|
1857
|
+
*
|
|
1858
|
+
* 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.
|
|
1859
|
+
*
|
|
1860
|
+
* 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 }`.
|
|
1861
|
+
*
|
|
1862
|
+
* ```ts
|
|
1863
|
+
* const p = redis.pipeline()
|
|
1864
|
+
* p.get("key")
|
|
1865
|
+
*
|
|
1866
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1867
|
+
* const getResult = result[0].result
|
|
1868
|
+
* const getError = result[0].error
|
|
1869
|
+
* ```
|
|
1870
|
+
*/
|
|
1871
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1872
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1873
|
+
keepErrors: true;
|
|
1874
|
+
}): Promise<{
|
|
1875
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1876
|
+
}>;
|
|
1877
|
+
}
|
|
1523
1878
|
/**
|
|
1524
1879
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1525
1880
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1568,19 +1923,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1568
1923
|
commandOptions?: CommandOptions<any, any>;
|
|
1569
1924
|
multiExec?: boolean;
|
|
1570
1925
|
});
|
|
1571
|
-
|
|
1572
|
-
* Send the pipeline request to upstash.
|
|
1573
|
-
*
|
|
1574
|
-
* Returns an array with the results of all pipelined commands.
|
|
1575
|
-
*
|
|
1576
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1577
|
-
* ```ts
|
|
1578
|
-
* const p = redis.pipeline()
|
|
1579
|
-
* p.get("key")
|
|
1580
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1581
|
-
* ```
|
|
1582
|
-
*/
|
|
1583
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1926
|
+
exec: ExecMethod<TCommands>;
|
|
1584
1927
|
/**
|
|
1585
1928
|
* Returns the length of pipeline before the execution
|
|
1586
1929
|
*/
|
|
@@ -1598,15 +1941,29 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1598
1941
|
* @see https://redis.io/commands/bitcount
|
|
1599
1942
|
*/
|
|
1600
1943
|
bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1944
|
+
/**
|
|
1945
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
1946
|
+
*
|
|
1947
|
+
* @example
|
|
1948
|
+
* ```typescript
|
|
1949
|
+
* redis.set("mykey", 0);
|
|
1950
|
+
* const result = await redis.pipeline()
|
|
1951
|
+
* .bitfield("mykey")
|
|
1952
|
+
* .set("u4", 0, 16)
|
|
1953
|
+
* .incr("u4", "#1", 1)
|
|
1954
|
+
* .exec();
|
|
1955
|
+
* console.log(result); // [[0, 1]]
|
|
1956
|
+
* ```
|
|
1957
|
+
*
|
|
1958
|
+
* @see https://redis.io/commands/bitfield
|
|
1959
|
+
*/
|
|
1960
|
+
bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
|
|
1601
1961
|
/**
|
|
1602
1962
|
* @see https://redis.io/commands/bitop
|
|
1603
1963
|
*/
|
|
1604
1964
|
bitop: {
|
|
1605
1965
|
(op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>;
|
|
1606
|
-
(op: "not", destinationKey: string, sourceKey: string): Pipeline<[
|
|
1607
|
-
...TCommands,
|
|
1608
|
-
BitOpCommand
|
|
1609
|
-
]>;
|
|
1966
|
+
(op: "not", destinationKey: string, sourceKey: string): Pipeline<[...TCommands, BitOpCommand]>;
|
|
1610
1967
|
};
|
|
1611
1968
|
/**
|
|
1612
1969
|
* @see https://redis.io/commands/bitpos
|
|
@@ -1642,10 +1999,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1642
1999
|
* @see https://redis.io/commands/echo
|
|
1643
2000
|
*/
|
|
1644
2001
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2002
|
+
/**
|
|
2003
|
+
* @see https://redis.io/commands/eval_ro
|
|
2004
|
+
*/
|
|
2005
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1645
2006
|
/**
|
|
1646
2007
|
* @see https://redis.io/commands/eval
|
|
1647
2008
|
*/
|
|
1648
2009
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2010
|
+
/**
|
|
2011
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
2012
|
+
*/
|
|
2013
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1649
2014
|
/**
|
|
1650
2015
|
* @see https://redis.io/commands/evalsha
|
|
1651
2016
|
*/
|
|
@@ -1657,11 +2022,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1657
2022
|
/**
|
|
1658
2023
|
* @see https://redis.io/commands/expire
|
|
1659
2024
|
*/
|
|
1660
|
-
expire: (key: string, seconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2025
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1661
2026
|
/**
|
|
1662
2027
|
* @see https://redis.io/commands/expireat
|
|
1663
2028
|
*/
|
|
1664
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2029
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1665
2030
|
/**
|
|
1666
2031
|
* @see https://redis.io/commands/flushall
|
|
1667
2032
|
*/
|
|
@@ -1670,8 +2035,98 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1670
2035
|
* @see https://redis.io/commands/flushdb
|
|
1671
2036
|
*/
|
|
1672
2037
|
flushdb: (opts?: {
|
|
1673
|
-
async?: boolean
|
|
2038
|
+
async?: boolean;
|
|
1674
2039
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2040
|
+
/**
|
|
2041
|
+
* @see https://redis.io/commands/geoadd
|
|
2042
|
+
*/
|
|
2043
|
+
geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2044
|
+
/**
|
|
2045
|
+
* @see https://redis.io/commands/geodist
|
|
2046
|
+
*/
|
|
2047
|
+
geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2048
|
+
/**
|
|
2049
|
+
* @see https://redis.io/commands/geopos
|
|
2050
|
+
*/
|
|
2051
|
+
geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
|
|
2052
|
+
lng: number;
|
|
2053
|
+
lat: number;
|
|
2054
|
+
}[]>]>;
|
|
2055
|
+
/**
|
|
2056
|
+
* @see https://redis.io/commands/geohash
|
|
2057
|
+
*/
|
|
2058
|
+
geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
|
|
2059
|
+
/**
|
|
2060
|
+
* @see https://redis.io/commands/geosearch
|
|
2061
|
+
*/
|
|
2062
|
+
geosearch: <TData>(key: string, centerPoint: {
|
|
2063
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
2064
|
+
coordinate: {
|
|
2065
|
+
lon: number;
|
|
2066
|
+
lat: number;
|
|
2067
|
+
};
|
|
2068
|
+
} | {
|
|
2069
|
+
type: "FROMMEMBER" | "frommember";
|
|
2070
|
+
member: TData;
|
|
2071
|
+
}, shape: {
|
|
2072
|
+
type: "BYRADIUS" | "byradius";
|
|
2073
|
+
radius: number;
|
|
2074
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2075
|
+
} | {
|
|
2076
|
+
type: "BYBOX" | "bybox";
|
|
2077
|
+
rect: {
|
|
2078
|
+
width: number;
|
|
2079
|
+
height: number;
|
|
2080
|
+
};
|
|
2081
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
2082
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2083
|
+
count?: {
|
|
2084
|
+
limit: number;
|
|
2085
|
+
any?: boolean;
|
|
2086
|
+
};
|
|
2087
|
+
withCoord?: boolean;
|
|
2088
|
+
withDist?: boolean;
|
|
2089
|
+
withHash?: boolean;
|
|
2090
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
2091
|
+
member: TData;
|
|
2092
|
+
} & {
|
|
2093
|
+
coord?: {
|
|
2094
|
+
long: number;
|
|
2095
|
+
lat: number;
|
|
2096
|
+
} | undefined;
|
|
2097
|
+
dist?: number | undefined;
|
|
2098
|
+
hash?: string | undefined;
|
|
2099
|
+
})[]>]>;
|
|
2100
|
+
/**
|
|
2101
|
+
* @see https://redis.io/commands/geosearchstore
|
|
2102
|
+
*/
|
|
2103
|
+
geosearchstore: <TData>(destination: string, key: string, centerPoint: {
|
|
2104
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
2105
|
+
coordinate: {
|
|
2106
|
+
lon: number;
|
|
2107
|
+
lat: number;
|
|
2108
|
+
};
|
|
2109
|
+
} | {
|
|
2110
|
+
type: "FROMMEMBER" | "frommember";
|
|
2111
|
+
member: TData;
|
|
2112
|
+
}, shape: {
|
|
2113
|
+
type: "BYRADIUS" | "byradius";
|
|
2114
|
+
radius: number;
|
|
2115
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2116
|
+
} | {
|
|
2117
|
+
type: "BYBOX" | "bybox";
|
|
2118
|
+
rect: {
|
|
2119
|
+
width: number;
|
|
2120
|
+
height: number;
|
|
2121
|
+
};
|
|
2122
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
2123
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2124
|
+
count?: {
|
|
2125
|
+
limit: number;
|
|
2126
|
+
any?: boolean;
|
|
2127
|
+
};
|
|
2128
|
+
storeDist?: boolean;
|
|
2129
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1675
2130
|
/**
|
|
1676
2131
|
* @see https://redis.io/commands/get
|
|
1677
2132
|
*/
|
|
@@ -1684,6 +2139,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1684
2139
|
* @see https://redis.io/commands/getdel
|
|
1685
2140
|
*/
|
|
1686
2141
|
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2142
|
+
/**
|
|
2143
|
+
* @see https://redis.io/commands/getex
|
|
2144
|
+
*/
|
|
2145
|
+
getex: <TData>(key: string, opts?: ({
|
|
2146
|
+
ex: number;
|
|
2147
|
+
px?: never;
|
|
2148
|
+
exat?: never;
|
|
2149
|
+
pxat?: never;
|
|
2150
|
+
persist?: never;
|
|
2151
|
+
} | {
|
|
2152
|
+
ex?: never;
|
|
2153
|
+
px: number;
|
|
2154
|
+
exat?: never;
|
|
2155
|
+
pxat?: never;
|
|
2156
|
+
persist?: never;
|
|
2157
|
+
} | {
|
|
2158
|
+
ex?: never;
|
|
2159
|
+
px?: never;
|
|
2160
|
+
exat: number;
|
|
2161
|
+
pxat?: never;
|
|
2162
|
+
persist?: never;
|
|
2163
|
+
} | {
|
|
2164
|
+
ex?: never;
|
|
2165
|
+
px?: never;
|
|
2166
|
+
exat?: never;
|
|
2167
|
+
pxat: number;
|
|
2168
|
+
persist?: never;
|
|
2169
|
+
} | {
|
|
2170
|
+
ex?: never;
|
|
2171
|
+
px?: never;
|
|
2172
|
+
exat?: never;
|
|
2173
|
+
pxat?: never;
|
|
2174
|
+
persist: true;
|
|
2175
|
+
} | {
|
|
2176
|
+
ex?: never;
|
|
2177
|
+
px?: never;
|
|
2178
|
+
exat?: never;
|
|
2179
|
+
pxat?: never;
|
|
2180
|
+
persist?: never;
|
|
2181
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1687
2182
|
/**
|
|
1688
2183
|
* @see https://redis.io/commands/getrange
|
|
1689
2184
|
*/
|
|
@@ -1701,9 +2196,45 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1701
2196
|
*/
|
|
1702
2197
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1703
2198
|
/**
|
|
1704
|
-
* @see https://redis.io/commands/
|
|
2199
|
+
* @see https://redis.io/commands/hexpire
|
|
1705
2200
|
*/
|
|
1706
|
-
|
|
2201
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2202
|
+
/**
|
|
2203
|
+
* @see https://redis.io/commands/hexpireat
|
|
2204
|
+
*/
|
|
2205
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2206
|
+
/**
|
|
2207
|
+
* @see https://redis.io/commands/hexpiretime
|
|
2208
|
+
*/
|
|
2209
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2210
|
+
/**
|
|
2211
|
+
* @see https://redis.io/commands/httl
|
|
2212
|
+
*/
|
|
2213
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2214
|
+
/**
|
|
2215
|
+
* @see https://redis.io/commands/hpexpire
|
|
2216
|
+
*/
|
|
2217
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2218
|
+
/**
|
|
2219
|
+
* @see https://redis.io/commands/hpexpireat
|
|
2220
|
+
*/
|
|
2221
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2222
|
+
/**
|
|
2223
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
2224
|
+
*/
|
|
2225
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2226
|
+
/**
|
|
2227
|
+
* @see https://redis.io/commands/hpttl
|
|
2228
|
+
*/
|
|
2229
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2230
|
+
/**
|
|
2231
|
+
* @see https://redis.io/commands/hpersist
|
|
2232
|
+
*/
|
|
2233
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
2234
|
+
/**
|
|
2235
|
+
* @see https://redis.io/commands/hget
|
|
2236
|
+
*/
|
|
2237
|
+
hget: <TData>(key: string, field: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1707
2238
|
/**
|
|
1708
2239
|
* @see https://redis.io/commands/hgetall
|
|
1709
2240
|
*/
|
|
@@ -1731,9 +2262,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1731
2262
|
/**
|
|
1732
2263
|
* @see https://redis.io/commands/hmset
|
|
1733
2264
|
*/
|
|
1734
|
-
hmset: <TData>(key: string, kv:
|
|
1735
|
-
[field: string]: TData;
|
|
1736
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2265
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1737
2266
|
/**
|
|
1738
2267
|
* @see https://redis.io/commands/hrandfield
|
|
1739
2268
|
*/
|
|
@@ -1741,13 +2270,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1741
2270
|
/**
|
|
1742
2271
|
* @see https://redis.io/commands/hscan
|
|
1743
2272
|
*/
|
|
1744
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2273
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
1745
2274
|
/**
|
|
1746
2275
|
* @see https://redis.io/commands/hset
|
|
1747
2276
|
*/
|
|
1748
|
-
hset: <TData>(key: string, kv:
|
|
1749
|
-
[field: string]: TData;
|
|
1750
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2277
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1751
2278
|
/**
|
|
1752
2279
|
* @see https://redis.io/commands/hsetnx
|
|
1753
2280
|
*/
|
|
@@ -1796,13 +2323,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1796
2323
|
* @see https://redis.io/commands/lpop
|
|
1797
2324
|
*/
|
|
1798
2325
|
lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2326
|
+
/**
|
|
2327
|
+
* @see https://redis.io/commands/lmpop
|
|
2328
|
+
*/
|
|
2329
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
|
|
1799
2330
|
/**
|
|
1800
2331
|
* @see https://redis.io/commands/lpos
|
|
1801
2332
|
*/
|
|
1802
2333
|
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
1803
|
-
rank?: number
|
|
1804
|
-
count?: number
|
|
1805
|
-
maxLen?: number
|
|
2334
|
+
rank?: number;
|
|
2335
|
+
count?: number;
|
|
2336
|
+
maxLen?: number;
|
|
1806
2337
|
} | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1807
2338
|
/**
|
|
1808
2339
|
* @see https://redis.io/commands/lpush
|
|
@@ -1835,15 +2366,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1835
2366
|
/**
|
|
1836
2367
|
* @see https://redis.io/commands/mset
|
|
1837
2368
|
*/
|
|
1838
|
-
mset: <TData>(kv:
|
|
1839
|
-
[key: string]: TData;
|
|
1840
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2369
|
+
mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1841
2370
|
/**
|
|
1842
2371
|
* @see https://redis.io/commands/msetnx
|
|
1843
2372
|
*/
|
|
1844
|
-
msetnx: <TData>(kv:
|
|
1845
|
-
[key: string]: TData;
|
|
1846
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2373
|
+
msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1847
2374
|
/**
|
|
1848
2375
|
* @see https://redis.io/commands/persist
|
|
1849
2376
|
*/
|
|
@@ -1851,11 +2378,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1851
2378
|
/**
|
|
1852
2379
|
* @see https://redis.io/commands/pexpire
|
|
1853
2380
|
*/
|
|
1854
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2381
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1855
2382
|
/**
|
|
1856
2383
|
* @see https://redis.io/commands/pexpireat
|
|
1857
2384
|
*/
|
|
1858
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2385
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1859
2386
|
/**
|
|
1860
2387
|
* @see https://redis.io/commands/pfadd
|
|
1861
2388
|
*/
|
|
@@ -1911,11 +2438,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1911
2438
|
/**
|
|
1912
2439
|
* @see https://redis.io/commands/sadd
|
|
1913
2440
|
*/
|
|
1914
|
-
sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2441
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1915
2442
|
/**
|
|
1916
2443
|
* @see https://redis.io/commands/scan
|
|
1917
2444
|
*/
|
|
1918
|
-
scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2445
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
1919
2446
|
/**
|
|
1920
2447
|
* @see https://redis.io/commands/scard
|
|
1921
2448
|
*/
|
|
@@ -1996,7 +2523,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1996
2523
|
/**
|
|
1997
2524
|
* @see https://redis.io/commands/sscan
|
|
1998
2525
|
*/
|
|
1999
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2526
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2000
2527
|
/**
|
|
2001
2528
|
* @see https://redis.io/commands/strlen
|
|
2002
2529
|
*/
|
|
@@ -2032,7 +2559,127 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2032
2559
|
/**
|
|
2033
2560
|
* @see https://redis.io/commands/zadd
|
|
2034
2561
|
*/
|
|
2035
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2562
|
+
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>]>;
|
|
2563
|
+
/**
|
|
2564
|
+
* @see https://redis.io/commands/xadd
|
|
2565
|
+
*/
|
|
2566
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
2567
|
+
nomkStream?: boolean;
|
|
2568
|
+
trim?: ({
|
|
2569
|
+
type: "MAXLEN" | "maxlen";
|
|
2570
|
+
threshold: number;
|
|
2571
|
+
} | {
|
|
2572
|
+
type: "MINID" | "minid";
|
|
2573
|
+
threshold: string;
|
|
2574
|
+
}) & ({
|
|
2575
|
+
comparison: "~";
|
|
2576
|
+
limit?: number;
|
|
2577
|
+
} | {
|
|
2578
|
+
comparison: "=";
|
|
2579
|
+
limit?: never;
|
|
2580
|
+
});
|
|
2581
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2582
|
+
/**
|
|
2583
|
+
* @see https://redis.io/commands/xack
|
|
2584
|
+
*/
|
|
2585
|
+
xack: (key: string, group: string, id: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2586
|
+
/**
|
|
2587
|
+
* @see https://redis.io/commands/xdel
|
|
2588
|
+
*/
|
|
2589
|
+
xdel: (key: string, ids: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2590
|
+
/**
|
|
2591
|
+
* @see https://redis.io/commands/xgroup
|
|
2592
|
+
*/
|
|
2593
|
+
xgroup: (key: string, opts: {
|
|
2594
|
+
type: "CREATE";
|
|
2595
|
+
group: string;
|
|
2596
|
+
id: `$` | string;
|
|
2597
|
+
options?: {
|
|
2598
|
+
MKSTREAM?: boolean;
|
|
2599
|
+
ENTRIESREAD?: number;
|
|
2600
|
+
};
|
|
2601
|
+
} | {
|
|
2602
|
+
type: "CREATECONSUMER";
|
|
2603
|
+
group: string;
|
|
2604
|
+
consumer: string;
|
|
2605
|
+
} | {
|
|
2606
|
+
type: "DELCONSUMER";
|
|
2607
|
+
group: string;
|
|
2608
|
+
consumer: string;
|
|
2609
|
+
} | {
|
|
2610
|
+
type: "DESTROY";
|
|
2611
|
+
group: string;
|
|
2612
|
+
} | {
|
|
2613
|
+
type: "SETID";
|
|
2614
|
+
group: string;
|
|
2615
|
+
id: `$` | string;
|
|
2616
|
+
options?: {
|
|
2617
|
+
ENTRIESREAD?: number;
|
|
2618
|
+
};
|
|
2619
|
+
}) => Pipeline<[...TCommands, Command<any, never>]>;
|
|
2620
|
+
/**
|
|
2621
|
+
* @see https://redis.io/commands/xread
|
|
2622
|
+
*/
|
|
2623
|
+
xread: (...args: CommandArgs<typeof XReadCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2624
|
+
/**
|
|
2625
|
+
* @see https://redis.io/commands/xreadgroup
|
|
2626
|
+
*/
|
|
2627
|
+
xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2628
|
+
/**
|
|
2629
|
+
* @see https://redis.io/commands/xinfo
|
|
2630
|
+
*/
|
|
2631
|
+
xinfo: (key: string, options: {
|
|
2632
|
+
type: "CONSUMERS";
|
|
2633
|
+
group: string;
|
|
2634
|
+
} | {
|
|
2635
|
+
type: "GROUPS";
|
|
2636
|
+
}) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2637
|
+
/**
|
|
2638
|
+
* @see https://redis.io/commands/xlen
|
|
2639
|
+
*/
|
|
2640
|
+
xlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2641
|
+
/**
|
|
2642
|
+
* @see https://redis.io/commands/xpending
|
|
2643
|
+
*/
|
|
2644
|
+
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
2645
|
+
idleTime?: number;
|
|
2646
|
+
consumer?: string | string[];
|
|
2647
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2648
|
+
/**
|
|
2649
|
+
* @see https://redis.io/commands/xclaim
|
|
2650
|
+
*/
|
|
2651
|
+
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
2652
|
+
idleMS?: number;
|
|
2653
|
+
timeMS?: number;
|
|
2654
|
+
retryCount?: number;
|
|
2655
|
+
force?: boolean;
|
|
2656
|
+
justId?: boolean;
|
|
2657
|
+
lastId?: number;
|
|
2658
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2659
|
+
/**
|
|
2660
|
+
* @see https://redis.io/commands/xautoclaim
|
|
2661
|
+
*/
|
|
2662
|
+
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
2663
|
+
count?: number;
|
|
2664
|
+
justId?: boolean;
|
|
2665
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2666
|
+
/**
|
|
2667
|
+
* @see https://redis.io/commands/xtrim
|
|
2668
|
+
*/
|
|
2669
|
+
xtrim: (key: string, options: {
|
|
2670
|
+
strategy: "MAXLEN" | "MINID";
|
|
2671
|
+
exactness?: "~" | "=";
|
|
2672
|
+
threshold: number | string;
|
|
2673
|
+
limit?: number;
|
|
2674
|
+
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2675
|
+
/**
|
|
2676
|
+
* @see https://redis.io/commands/xrange
|
|
2677
|
+
*/
|
|
2678
|
+
xrange: (key: string, start: string, end: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
|
|
2679
|
+
/**
|
|
2680
|
+
* @see https://redis.io/commands/xrevrange
|
|
2681
|
+
*/
|
|
2682
|
+
xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
|
|
2036
2683
|
/**
|
|
2037
2684
|
* @see https://redis.io/commands/zcard
|
|
2038
2685
|
*/
|
|
@@ -2068,21 +2715,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2068
2715
|
/**
|
|
2069
2716
|
* @see https://redis.io/commands/zrange
|
|
2070
2717
|
*/
|
|
2071
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
byLex: true;
|
|
2077
|
-
} & ZRangeCommandOptions
|
|
2078
|
-
] | [
|
|
2079
|
-
key: string,
|
|
2080
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
2081
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
2082
|
-
opts: {
|
|
2083
|
-
byScore: true;
|
|
2084
|
-
} & ZRangeCommandOptions
|
|
2085
|
-
]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2718
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
2719
|
+
byLex: true;
|
|
2720
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
2721
|
+
byScore: true;
|
|
2722
|
+
} & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2086
2723
|
/**
|
|
2087
2724
|
* @see https://redis.io/commands/zrank
|
|
2088
2725
|
*/
|
|
@@ -2110,7 +2747,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2110
2747
|
/**
|
|
2111
2748
|
* @see https://redis.io/commands/zscan
|
|
2112
2749
|
*/
|
|
2113
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2750
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2114
2751
|
/**
|
|
2115
2752
|
* @see https://redis.io/commands/zscore
|
|
2116
2753
|
*/
|
|
@@ -2163,104 +2800,22 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2163
2800
|
* @see https://redis.io/commands/json.forget
|
|
2164
2801
|
*/
|
|
2165
2802
|
forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2166
|
-
/**
|
|
2167
|
-
* @see https://redis.io/commands/geoadd
|
|
2168
|
-
*/
|
|
2169
|
-
geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2170
|
-
/**
|
|
2171
|
-
* @see https://redis.io/commands/geodist
|
|
2172
|
-
*/
|
|
2173
|
-
geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2174
|
-
/**
|
|
2175
|
-
* @see https://redis.io/commands/geopos
|
|
2176
|
-
*/
|
|
2177
|
-
geopos: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, {
|
|
2178
|
-
lng: number;
|
|
2179
|
-
lat: number;
|
|
2180
|
-
}[]>]>;
|
|
2181
|
-
/**
|
|
2182
|
-
* @see https://redis.io/commands/geohash
|
|
2183
|
-
*/
|
|
2184
|
-
geohash: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
|
|
2185
|
-
/**
|
|
2186
|
-
* @see https://redis.io/commands/geosearch
|
|
2187
|
-
*/
|
|
2188
|
-
geosearch: (key: string, centerPoint: {
|
|
2189
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2190
|
-
coordinate: {
|
|
2191
|
-
lon: number;
|
|
2192
|
-
lat: number;
|
|
2193
|
-
};
|
|
2194
|
-
} | {
|
|
2195
|
-
type: "FROMMEMBER" | "frommember";
|
|
2196
|
-
member: unknown;
|
|
2197
|
-
}, shape: {
|
|
2198
|
-
type: "BYRADIUS" | "byradius";
|
|
2199
|
-
radius: number;
|
|
2200
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2201
|
-
} | {
|
|
2202
|
-
type: "BYBOX" | "bybox";
|
|
2203
|
-
rect: {
|
|
2204
|
-
width: number;
|
|
2205
|
-
height: number;
|
|
2206
|
-
};
|
|
2207
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2208
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2209
|
-
count?: {
|
|
2210
|
-
limit: number;
|
|
2211
|
-
any?: boolean | undefined;
|
|
2212
|
-
} | undefined;
|
|
2213
|
-
withCoord?: boolean | undefined;
|
|
2214
|
-
withDist?: boolean | undefined;
|
|
2215
|
-
withHash?: boolean | undefined;
|
|
2216
|
-
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
2217
|
-
member: unknown;
|
|
2218
|
-
} & {
|
|
2219
|
-
coord?: {
|
|
2220
|
-
long: number;
|
|
2221
|
-
lat: number;
|
|
2222
|
-
} | undefined;
|
|
2223
|
-
dist?: number | undefined;
|
|
2224
|
-
hash?: string | undefined;
|
|
2225
|
-
})[]>]>;
|
|
2226
|
-
/**
|
|
2227
|
-
* @see https://redis.io/commands/geosearchstore
|
|
2228
|
-
*/
|
|
2229
|
-
geosearchstore: (destination: string, key: string, centerPoint: {
|
|
2230
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2231
|
-
coordinate: {
|
|
2232
|
-
lon: number;
|
|
2233
|
-
lat: number;
|
|
2234
|
-
};
|
|
2235
|
-
} | {
|
|
2236
|
-
type: "FROMMEMBER" | "frommember";
|
|
2237
|
-
member: unknown;
|
|
2238
|
-
}, shape: {
|
|
2239
|
-
type: "BYRADIUS" | "byradius";
|
|
2240
|
-
radius: number;
|
|
2241
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2242
|
-
} | {
|
|
2243
|
-
type: "BYBOX" | "bybox";
|
|
2244
|
-
rect: {
|
|
2245
|
-
width: number;
|
|
2246
|
-
height: number;
|
|
2247
|
-
};
|
|
2248
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2249
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2250
|
-
count?: {
|
|
2251
|
-
limit: number;
|
|
2252
|
-
any?: boolean | undefined;
|
|
2253
|
-
} | undefined;
|
|
2254
|
-
storeDist?: boolean | undefined;
|
|
2255
|
-
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2256
2803
|
/**
|
|
2257
2804
|
* @see https://redis.io/commands/json.get
|
|
2258
2805
|
*/
|
|
2259
2806
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2807
|
+
/**
|
|
2808
|
+
* @see https://redis.io/commands/json.merge
|
|
2809
|
+
*/
|
|
2810
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2260
2811
|
/**
|
|
2261
2812
|
* @see https://redis.io/commands/json.mget
|
|
2262
2813
|
*/
|
|
2263
2814
|
mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2815
|
+
/**
|
|
2816
|
+
* @see https://redis.io/commands/json.mset
|
|
2817
|
+
*/
|
|
2818
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2264
2819
|
/**
|
|
2265
2820
|
* @see https://redis.io/commands/json.numincrby
|
|
2266
2821
|
*/
|
|
@@ -2286,9 +2841,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2286
2841
|
*/
|
|
2287
2842
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2288
2843
|
nx: true;
|
|
2289
|
-
xx?:
|
|
2844
|
+
xx?: never;
|
|
2290
2845
|
} | {
|
|
2291
|
-
nx?:
|
|
2846
|
+
nx?: never;
|
|
2292
2847
|
xx: true;
|
|
2293
2848
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2294
2849
|
/**
|
|
@@ -2328,9 +2883,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2328
2883
|
*/
|
|
2329
2884
|
declare class Script<TResult = unknown> {
|
|
2330
2885
|
readonly script: string;
|
|
2331
|
-
|
|
2886
|
+
/**
|
|
2887
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2888
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2889
|
+
*
|
|
2890
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2891
|
+
* future major release.
|
|
2892
|
+
*/
|
|
2893
|
+
sha1: string;
|
|
2332
2894
|
private readonly redis;
|
|
2333
2895
|
constructor(redis: Redis, script: string);
|
|
2896
|
+
/**
|
|
2897
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
2898
|
+
*/
|
|
2899
|
+
private init;
|
|
2334
2900
|
/**
|
|
2335
2901
|
* Send an `EVAL` command to redis.
|
|
2336
2902
|
*/
|
|
@@ -2352,6 +2918,56 @@ declare class Script<TResult = unknown> {
|
|
|
2352
2918
|
private digest;
|
|
2353
2919
|
}
|
|
2354
2920
|
|
|
2921
|
+
/**
|
|
2922
|
+
* Creates a new script.
|
|
2923
|
+
*
|
|
2924
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
2925
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
2926
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
2927
|
+
*
|
|
2928
|
+
* @example
|
|
2929
|
+
* ```ts
|
|
2930
|
+
* const redis = new Redis({...})
|
|
2931
|
+
*
|
|
2932
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
2933
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
2934
|
+
* expect(arg1, "Hello World")
|
|
2935
|
+
* ```
|
|
2936
|
+
*/
|
|
2937
|
+
declare class ScriptRO<TResult = unknown> {
|
|
2938
|
+
readonly script: string;
|
|
2939
|
+
/**
|
|
2940
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2941
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2942
|
+
*
|
|
2943
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2944
|
+
* future major release.
|
|
2945
|
+
*/
|
|
2946
|
+
sha1: string;
|
|
2947
|
+
private readonly redis;
|
|
2948
|
+
constructor(redis: Redis, script: string);
|
|
2949
|
+
private init;
|
|
2950
|
+
/**
|
|
2951
|
+
* Send an `EVAL_RO` command to redis.
|
|
2952
|
+
*/
|
|
2953
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2954
|
+
/**
|
|
2955
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
2956
|
+
*/
|
|
2957
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2958
|
+
/**
|
|
2959
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
2960
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
2961
|
+
*
|
|
2962
|
+
* Following calls will be able to use the cached script
|
|
2963
|
+
*/
|
|
2964
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
2967
|
+
*/
|
|
2968
|
+
private digest;
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2355
2971
|
/**
|
|
2356
2972
|
* Serverless redis client for upstash.
|
|
2357
2973
|
*/
|
|
@@ -2359,6 +2975,7 @@ declare class Redis {
|
|
|
2359
2975
|
protected client: Requester;
|
|
2360
2976
|
protected opts?: CommandOptions<any, any>;
|
|
2361
2977
|
protected enableTelemetry: boolean;
|
|
2978
|
+
protected enableAutoPipelining: boolean;
|
|
2362
2979
|
/**
|
|
2363
2980
|
* Create a new redis client
|
|
2364
2981
|
*
|
|
@@ -2371,6 +2988,8 @@ declare class Redis {
|
|
|
2371
2988
|
* ```
|
|
2372
2989
|
*/
|
|
2373
2990
|
constructor(client: Requester, opts?: RedisOptions);
|
|
2991
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
2992
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2374
2993
|
get json(): {
|
|
2375
2994
|
/**
|
|
2376
2995
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2409,103 +3028,21 @@ declare class Redis {
|
|
|
2409
3028
|
*/
|
|
2410
3029
|
forget: (key: string, path?: string | undefined) => Promise<number>;
|
|
2411
3030
|
/**
|
|
2412
|
-
* @see https://redis.io/commands/
|
|
2413
|
-
*/
|
|
2414
|
-
geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Promise<number | null>;
|
|
2415
|
-
/**
|
|
2416
|
-
* @see https://redis.io/commands/geopos
|
|
2417
|
-
*/
|
|
2418
|
-
geopos: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
2419
|
-
lng: number;
|
|
2420
|
-
lat: number;
|
|
2421
|
-
}[]>;
|
|
2422
|
-
/**
|
|
2423
|
-
* @see https://redis.io/commands/geodist
|
|
2424
|
-
*/
|
|
2425
|
-
geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
|
|
2426
|
-
/**
|
|
2427
|
-
* @see https://redis.io/commands/geohash
|
|
3031
|
+
* @see https://redis.io/commands/json.get
|
|
2428
3032
|
*/
|
|
2429
|
-
|
|
3033
|
+
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
2430
3034
|
/**
|
|
2431
|
-
* @see https://redis.io/commands/
|
|
3035
|
+
* @see https://redis.io/commands/json.merge
|
|
2432
3036
|
*/
|
|
2433
|
-
|
|
2434
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2435
|
-
coordinate: {
|
|
2436
|
-
lon: number;
|
|
2437
|
-
lat: number;
|
|
2438
|
-
};
|
|
2439
|
-
} | {
|
|
2440
|
-
type: "FROMMEMBER" | "frommember";
|
|
2441
|
-
member: unknown;
|
|
2442
|
-
}, shape: {
|
|
2443
|
-
type: "BYRADIUS" | "byradius";
|
|
2444
|
-
radius: number;
|
|
2445
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2446
|
-
} | {
|
|
2447
|
-
type: "BYBOX" | "bybox";
|
|
2448
|
-
rect: {
|
|
2449
|
-
width: number;
|
|
2450
|
-
height: number;
|
|
2451
|
-
};
|
|
2452
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2453
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2454
|
-
count?: {
|
|
2455
|
-
limit: number;
|
|
2456
|
-
any?: boolean | undefined;
|
|
2457
|
-
} | undefined;
|
|
2458
|
-
withCoord?: boolean | undefined;
|
|
2459
|
-
withDist?: boolean | undefined;
|
|
2460
|
-
withHash?: boolean | undefined;
|
|
2461
|
-
} | undefined) => Promise<({
|
|
2462
|
-
member: unknown;
|
|
2463
|
-
} & {
|
|
2464
|
-
coord?: {
|
|
2465
|
-
long: number;
|
|
2466
|
-
lat: number;
|
|
2467
|
-
} | undefined;
|
|
2468
|
-
dist?: number | undefined;
|
|
2469
|
-
hash?: string | undefined;
|
|
2470
|
-
})[]>;
|
|
3037
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2471
3038
|
/**
|
|
2472
|
-
* @see https://redis.io/commands/
|
|
2473
|
-
*/
|
|
2474
|
-
geosearchstore: (destination: string, key: string, centerPoint: {
|
|
2475
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2476
|
-
coordinate: {
|
|
2477
|
-
lon: number;
|
|
2478
|
-
lat: number;
|
|
2479
|
-
};
|
|
2480
|
-
} | {
|
|
2481
|
-
type: "FROMMEMBER" | "frommember";
|
|
2482
|
-
member: unknown;
|
|
2483
|
-
}, shape: {
|
|
2484
|
-
type: "BYRADIUS" | "byradius";
|
|
2485
|
-
radius: number;
|
|
2486
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2487
|
-
} | {
|
|
2488
|
-
type: "BYBOX" | "bybox";
|
|
2489
|
-
rect: {
|
|
2490
|
-
width: number;
|
|
2491
|
-
height: number;
|
|
2492
|
-
};
|
|
2493
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2494
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2495
|
-
count?: {
|
|
2496
|
-
limit: number;
|
|
2497
|
-
any?: boolean | undefined;
|
|
2498
|
-
} | undefined;
|
|
2499
|
-
storeDist?: boolean | undefined;
|
|
2500
|
-
} | undefined) => Promise<number>;
|
|
2501
|
-
/**
|
|
2502
|
-
* @see https://redis.io/commands/json.get
|
|
3039
|
+
* @see https://redis.io/commands/json.mget
|
|
2503
3040
|
*/
|
|
2504
|
-
|
|
3041
|
+
mget: <TData>(keys: string[], path: string) => Promise<TData>;
|
|
2505
3042
|
/**
|
|
2506
|
-
* @see https://redis.io/commands/json.
|
|
3043
|
+
* @see https://redis.io/commands/json.mset
|
|
2507
3044
|
*/
|
|
2508
|
-
|
|
3045
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
|
|
2509
3046
|
/**
|
|
2510
3047
|
* @see https://redis.io/commands/json.numincrby
|
|
2511
3048
|
*/
|
|
@@ -2531,9 +3068,9 @@ declare class Redis {
|
|
|
2531
3068
|
*/
|
|
2532
3069
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2533
3070
|
nx: true;
|
|
2534
|
-
xx?:
|
|
3071
|
+
xx?: never;
|
|
2535
3072
|
} | {
|
|
2536
|
-
nx?:
|
|
3073
|
+
nx?: never;
|
|
2537
3074
|
xx: true;
|
|
2538
3075
|
} | undefined) => Promise<"OK" | null>;
|
|
2539
3076
|
/**
|
|
@@ -2561,13 +3098,44 @@ declare class Redis {
|
|
|
2561
3098
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2562
3099
|
*/
|
|
2563
3100
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2564
|
-
|
|
3101
|
+
/**
|
|
3102
|
+
* Creates a new script.
|
|
3103
|
+
*
|
|
3104
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3105
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3106
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3107
|
+
*
|
|
3108
|
+
* @param script - The script to create
|
|
3109
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3110
|
+
* @returns A new script
|
|
3111
|
+
*
|
|
3112
|
+
* @example
|
|
3113
|
+
* ```ts
|
|
3114
|
+
* const redis = new Redis({...})
|
|
3115
|
+
*
|
|
3116
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3117
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3118
|
+
* expect(arg1, "Hello World")
|
|
3119
|
+
* ```
|
|
3120
|
+
* @example
|
|
3121
|
+
* ```ts
|
|
3122
|
+
* const redis = new Redis({...})
|
|
3123
|
+
*
|
|
3124
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3125
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3126
|
+
* expect(arg1, "Hello World")
|
|
3127
|
+
* ```
|
|
3128
|
+
*/
|
|
3129
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3130
|
+
readonly?: TReadonly;
|
|
3131
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2565
3132
|
/**
|
|
2566
3133
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2567
3134
|
*
|
|
2568
3135
|
* @see {@link Pipeline}
|
|
2569
3136
|
*/
|
|
2570
3137
|
pipeline: () => Pipeline<[]>;
|
|
3138
|
+
protected autoPipeline: () => Redis;
|
|
2571
3139
|
/**
|
|
2572
3140
|
* Create a new transaction to allow executing multiple steps atomically.
|
|
2573
3141
|
*
|
|
@@ -2578,6 +3146,22 @@ declare class Redis {
|
|
|
2578
3146
|
* @see {@link Pipeline}
|
|
2579
3147
|
*/
|
|
2580
3148
|
multi: () => Pipeline<[]>;
|
|
3149
|
+
/**
|
|
3150
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
3151
|
+
*
|
|
3152
|
+
* @example
|
|
3153
|
+
* ```typescript
|
|
3154
|
+
* redis.set("mykey", 0);
|
|
3155
|
+
* const result = await redis.bitfield("mykey")
|
|
3156
|
+
* .set("u4", 0, 16)
|
|
3157
|
+
* .incr("u4", "#1", 1)
|
|
3158
|
+
* .exec();
|
|
3159
|
+
* console.log(result); // [0, 1]
|
|
3160
|
+
* ```
|
|
3161
|
+
*
|
|
3162
|
+
* @see https://redis.io/commands/bitfield
|
|
3163
|
+
*/
|
|
3164
|
+
bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
|
|
2581
3165
|
/**
|
|
2582
3166
|
* @see https://redis.io/commands/append
|
|
2583
3167
|
*/
|
|
@@ -2623,14 +3207,26 @@ declare class Redis {
|
|
|
2623
3207
|
* @see https://redis.io/commands/echo
|
|
2624
3208
|
*/
|
|
2625
3209
|
echo: (message: string) => Promise<string>;
|
|
3210
|
+
/**
|
|
3211
|
+
* @see https://redis.io/commands/eval_ro
|
|
3212
|
+
*/
|
|
3213
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2626
3214
|
/**
|
|
2627
3215
|
* @see https://redis.io/commands/eval
|
|
2628
3216
|
*/
|
|
2629
3217
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3218
|
+
/**
|
|
3219
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3220
|
+
*/
|
|
3221
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2630
3222
|
/**
|
|
2631
3223
|
* @see https://redis.io/commands/evalsha
|
|
2632
3224
|
*/
|
|
2633
3225
|
evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3226
|
+
/**
|
|
3227
|
+
* Generic method to execute any Redis command.
|
|
3228
|
+
*/
|
|
3229
|
+
exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
|
|
2634
3230
|
/**
|
|
2635
3231
|
* @see https://redis.io/commands/exists
|
|
2636
3232
|
*/
|
|
@@ -2638,11 +3234,11 @@ declare class Redis {
|
|
|
2638
3234
|
/**
|
|
2639
3235
|
* @see https://redis.io/commands/expire
|
|
2640
3236
|
*/
|
|
2641
|
-
expire: (key: string, seconds: number) => Promise<0 | 1>;
|
|
3237
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2642
3238
|
/**
|
|
2643
3239
|
* @see https://redis.io/commands/expireat
|
|
2644
3240
|
*/
|
|
2645
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3241
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2646
3242
|
/**
|
|
2647
3243
|
* @see https://redis.io/commands/flushall
|
|
2648
3244
|
*/
|
|
@@ -2651,8 +3247,98 @@ declare class Redis {
|
|
|
2651
3247
|
* @see https://redis.io/commands/flushdb
|
|
2652
3248
|
*/
|
|
2653
3249
|
flushdb: (opts?: {
|
|
2654
|
-
async?: boolean
|
|
3250
|
+
async?: boolean;
|
|
2655
3251
|
} | undefined) => Promise<"OK">;
|
|
3252
|
+
/**
|
|
3253
|
+
* @see https://redis.io/commands/geoadd
|
|
3254
|
+
*/
|
|
3255
|
+
geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
|
|
3256
|
+
/**
|
|
3257
|
+
* @see https://redis.io/commands/geopos
|
|
3258
|
+
*/
|
|
3259
|
+
geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
|
|
3260
|
+
lng: number;
|
|
3261
|
+
lat: number;
|
|
3262
|
+
}[]>;
|
|
3263
|
+
/**
|
|
3264
|
+
* @see https://redis.io/commands/geodist
|
|
3265
|
+
*/
|
|
3266
|
+
geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
|
|
3267
|
+
/**
|
|
3268
|
+
* @see https://redis.io/commands/geohash
|
|
3269
|
+
*/
|
|
3270
|
+
geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
|
|
3271
|
+
/**
|
|
3272
|
+
* @see https://redis.io/commands/geosearch
|
|
3273
|
+
*/
|
|
3274
|
+
geosearch: <TData>(key: string, centerPoint: {
|
|
3275
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
3276
|
+
coordinate: {
|
|
3277
|
+
lon: number;
|
|
3278
|
+
lat: number;
|
|
3279
|
+
};
|
|
3280
|
+
} | {
|
|
3281
|
+
type: "FROMMEMBER" | "frommember";
|
|
3282
|
+
member: TData;
|
|
3283
|
+
}, shape: {
|
|
3284
|
+
type: "BYRADIUS" | "byradius";
|
|
3285
|
+
radius: number;
|
|
3286
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
3287
|
+
} | {
|
|
3288
|
+
type: "BYBOX" | "bybox";
|
|
3289
|
+
rect: {
|
|
3290
|
+
width: number;
|
|
3291
|
+
height: number;
|
|
3292
|
+
};
|
|
3293
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
3294
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
3295
|
+
count?: {
|
|
3296
|
+
limit: number;
|
|
3297
|
+
any?: boolean;
|
|
3298
|
+
};
|
|
3299
|
+
withCoord?: boolean;
|
|
3300
|
+
withDist?: boolean;
|
|
3301
|
+
withHash?: boolean;
|
|
3302
|
+
} | undefined) => Promise<({
|
|
3303
|
+
member: TData;
|
|
3304
|
+
} & {
|
|
3305
|
+
coord?: {
|
|
3306
|
+
long: number;
|
|
3307
|
+
lat: number;
|
|
3308
|
+
} | undefined;
|
|
3309
|
+
dist?: number | undefined;
|
|
3310
|
+
hash?: string | undefined;
|
|
3311
|
+
})[]>;
|
|
3312
|
+
/**
|
|
3313
|
+
* @see https://redis.io/commands/geosearchstore
|
|
3314
|
+
*/
|
|
3315
|
+
geosearchstore: <TData>(destination: string, key: string, centerPoint: {
|
|
3316
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
3317
|
+
coordinate: {
|
|
3318
|
+
lon: number;
|
|
3319
|
+
lat: number;
|
|
3320
|
+
};
|
|
3321
|
+
} | {
|
|
3322
|
+
type: "FROMMEMBER" | "frommember";
|
|
3323
|
+
member: TData;
|
|
3324
|
+
}, shape: {
|
|
3325
|
+
type: "BYRADIUS" | "byradius";
|
|
3326
|
+
radius: number;
|
|
3327
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
3328
|
+
} | {
|
|
3329
|
+
type: "BYBOX" | "bybox";
|
|
3330
|
+
rect: {
|
|
3331
|
+
width: number;
|
|
3332
|
+
height: number;
|
|
3333
|
+
};
|
|
3334
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
3335
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
3336
|
+
count?: {
|
|
3337
|
+
limit: number;
|
|
3338
|
+
any?: boolean;
|
|
3339
|
+
};
|
|
3340
|
+
storeDist?: boolean;
|
|
3341
|
+
} | undefined) => Promise<number>;
|
|
2656
3342
|
/**
|
|
2657
3343
|
* @see https://redis.io/commands/get
|
|
2658
3344
|
*/
|
|
@@ -2665,6 +3351,46 @@ declare class Redis {
|
|
|
2665
3351
|
* @see https://redis.io/commands/getdel
|
|
2666
3352
|
*/
|
|
2667
3353
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3354
|
+
/**
|
|
3355
|
+
* @see https://redis.io/commands/getex
|
|
3356
|
+
*/
|
|
3357
|
+
getex: <TData>(key: string, opts?: ({
|
|
3358
|
+
ex: number;
|
|
3359
|
+
px?: never;
|
|
3360
|
+
exat?: never;
|
|
3361
|
+
pxat?: never;
|
|
3362
|
+
persist?: never;
|
|
3363
|
+
} | {
|
|
3364
|
+
ex?: never;
|
|
3365
|
+
px: number;
|
|
3366
|
+
exat?: never;
|
|
3367
|
+
pxat?: never;
|
|
3368
|
+
persist?: never;
|
|
3369
|
+
} | {
|
|
3370
|
+
ex?: never;
|
|
3371
|
+
px?: never;
|
|
3372
|
+
exat: number;
|
|
3373
|
+
pxat?: never;
|
|
3374
|
+
persist?: never;
|
|
3375
|
+
} | {
|
|
3376
|
+
ex?: never;
|
|
3377
|
+
px?: never;
|
|
3378
|
+
exat?: never;
|
|
3379
|
+
pxat: number;
|
|
3380
|
+
persist?: never;
|
|
3381
|
+
} | {
|
|
3382
|
+
ex?: never;
|
|
3383
|
+
px?: never;
|
|
3384
|
+
exat?: never;
|
|
3385
|
+
pxat?: never;
|
|
3386
|
+
persist: true;
|
|
3387
|
+
} | {
|
|
3388
|
+
ex?: never;
|
|
3389
|
+
px?: never;
|
|
3390
|
+
exat?: never;
|
|
3391
|
+
pxat?: never;
|
|
3392
|
+
persist?: never;
|
|
3393
|
+
}) | undefined) => Promise<TData | null>;
|
|
2668
3394
|
/**
|
|
2669
3395
|
* @see https://redis.io/commands/getrange
|
|
2670
3396
|
*/
|
|
@@ -2681,6 +3407,42 @@ declare class Redis {
|
|
|
2681
3407
|
* @see https://redis.io/commands/hexists
|
|
2682
3408
|
*/
|
|
2683
3409
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3410
|
+
/**
|
|
3411
|
+
* @see https://redis.io/commands/hexpire
|
|
3412
|
+
*/
|
|
3413
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3414
|
+
/**
|
|
3415
|
+
* @see https://redis.io/commands/hexpireat
|
|
3416
|
+
*/
|
|
3417
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3418
|
+
/**
|
|
3419
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3420
|
+
*/
|
|
3421
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3422
|
+
/**
|
|
3423
|
+
* @see https://redis.io/commands/httl
|
|
3424
|
+
*/
|
|
3425
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3426
|
+
/**
|
|
3427
|
+
* @see https://redis.io/commands/hpexpire
|
|
3428
|
+
*/
|
|
3429
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3430
|
+
/**
|
|
3431
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3432
|
+
*/
|
|
3433
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3434
|
+
/**
|
|
3435
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3436
|
+
*/
|
|
3437
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3438
|
+
/**
|
|
3439
|
+
* @see https://redis.io/commands/hpttl
|
|
3440
|
+
*/
|
|
3441
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3442
|
+
/**
|
|
3443
|
+
* @see https://redis.io/commands/hpersist
|
|
3444
|
+
*/
|
|
3445
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2684
3446
|
/**
|
|
2685
3447
|
* @see https://redis.io/commands/hget
|
|
2686
3448
|
*/
|
|
@@ -2712,27 +3474,23 @@ declare class Redis {
|
|
|
2712
3474
|
/**
|
|
2713
3475
|
* @see https://redis.io/commands/hmset
|
|
2714
3476
|
*/
|
|
2715
|
-
hmset: <TData>(key: string, kv:
|
|
2716
|
-
[field: string]: TData;
|
|
2717
|
-
}) => Promise<"OK">;
|
|
3477
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
|
|
2718
3478
|
/**
|
|
2719
3479
|
* @see https://redis.io/commands/hrandfield
|
|
2720
3480
|
*/
|
|
2721
3481
|
hrandfield: {
|
|
2722
|
-
(key: string): Promise<string>;
|
|
3482
|
+
(key: string): Promise<string | null>;
|
|
2723
3483
|
(key: string, count: number): Promise<string[]>;
|
|
2724
3484
|
<TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
|
|
2725
3485
|
};
|
|
2726
3486
|
/**
|
|
2727
3487
|
* @see https://redis.io/commands/hscan
|
|
2728
3488
|
*/
|
|
2729
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[
|
|
3489
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
2730
3490
|
/**
|
|
2731
3491
|
* @see https://redis.io/commands/hset
|
|
2732
3492
|
*/
|
|
2733
|
-
hset: <TData>(key: string, kv:
|
|
2734
|
-
[field: string]: TData;
|
|
2735
|
-
}) => Promise<number>;
|
|
3493
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
|
|
2736
3494
|
/**
|
|
2737
3495
|
* @see https://redis.io/commands/hsetnx
|
|
2738
3496
|
*/
|
|
@@ -2781,13 +3539,17 @@ declare class Redis {
|
|
|
2781
3539
|
* @see https://redis.io/commands/lpop
|
|
2782
3540
|
*/
|
|
2783
3541
|
lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
3542
|
+
/**
|
|
3543
|
+
* @see https://redis.io/commands/lmpop
|
|
3544
|
+
*/
|
|
3545
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
|
|
2784
3546
|
/**
|
|
2785
3547
|
* @see https://redis.io/commands/lpos
|
|
2786
3548
|
*/
|
|
2787
3549
|
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
2788
|
-
rank?: number
|
|
2789
|
-
count?: number
|
|
2790
|
-
maxLen?: number
|
|
3550
|
+
rank?: number;
|
|
3551
|
+
count?: number;
|
|
3552
|
+
maxLen?: number;
|
|
2791
3553
|
} | undefined) => Promise<TData>;
|
|
2792
3554
|
/**
|
|
2793
3555
|
* @see https://redis.io/commands/lpush
|
|
@@ -2820,15 +3582,11 @@ declare class Redis {
|
|
|
2820
3582
|
/**
|
|
2821
3583
|
* @see https://redis.io/commands/mset
|
|
2822
3584
|
*/
|
|
2823
|
-
mset: <TData>(kv:
|
|
2824
|
-
[key: string]: TData;
|
|
2825
|
-
}) => Promise<"OK">;
|
|
3585
|
+
mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
|
|
2826
3586
|
/**
|
|
2827
3587
|
* @see https://redis.io/commands/msetnx
|
|
2828
3588
|
*/
|
|
2829
|
-
msetnx: <TData>(kv:
|
|
2830
|
-
[key: string]: TData;
|
|
2831
|
-
}) => Promise<number>;
|
|
3589
|
+
msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
|
|
2832
3590
|
/**
|
|
2833
3591
|
* @see https://redis.io/commands/persist
|
|
2834
3592
|
*/
|
|
@@ -2836,11 +3594,11 @@ declare class Redis {
|
|
|
2836
3594
|
/**
|
|
2837
3595
|
* @see https://redis.io/commands/pexpire
|
|
2838
3596
|
*/
|
|
2839
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3597
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2840
3598
|
/**
|
|
2841
3599
|
* @see https://redis.io/commands/pexpireat
|
|
2842
3600
|
*/
|
|
2843
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3601
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2844
3602
|
/**
|
|
2845
3603
|
* @see https://redis.io/commands/pfadd
|
|
2846
3604
|
*/
|
|
@@ -2861,6 +3619,10 @@ declare class Redis {
|
|
|
2861
3619
|
* @see https://redis.io/commands/psetex
|
|
2862
3620
|
*/
|
|
2863
3621
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3622
|
+
/**
|
|
3623
|
+
* @see https://redis.io/commands/psubscribe
|
|
3624
|
+
*/
|
|
3625
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
2864
3626
|
/**
|
|
2865
3627
|
* @see https://redis.io/commands/pttl
|
|
2866
3628
|
*/
|
|
@@ -2896,11 +3658,14 @@ declare class Redis {
|
|
|
2896
3658
|
/**
|
|
2897
3659
|
* @see https://redis.io/commands/sadd
|
|
2898
3660
|
*/
|
|
2899
|
-
sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
|
|
3661
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
|
|
2900
3662
|
/**
|
|
2901
3663
|
* @see https://redis.io/commands/scan
|
|
2902
3664
|
*/
|
|
2903
|
-
scan
|
|
3665
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
3666
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
3667
|
+
withType: true;
|
|
3668
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
2904
3669
|
/**
|
|
2905
3670
|
* @see https://redis.io/commands/scard
|
|
2906
3671
|
*/
|
|
@@ -2984,11 +3749,15 @@ declare class Redis {
|
|
|
2984
3749
|
/**
|
|
2985
3750
|
* @see https://redis.io/commands/sscan
|
|
2986
3751
|
*/
|
|
2987
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
3752
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
2988
3753
|
/**
|
|
2989
3754
|
* @see https://redis.io/commands/strlen
|
|
2990
3755
|
*/
|
|
2991
3756
|
strlen: (key: string) => Promise<number>;
|
|
3757
|
+
/**
|
|
3758
|
+
* @see https://redis.io/commands/subscribe
|
|
3759
|
+
*/
|
|
3760
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
2992
3761
|
/**
|
|
2993
3762
|
* @see https://redis.io/commands/sunion
|
|
2994
3763
|
*/
|
|
@@ -3020,11 +3789,9 @@ declare class Redis {
|
|
|
3020
3789
|
/**
|
|
3021
3790
|
* @see https://redis.io/commands/xadd
|
|
3022
3791
|
*/
|
|
3023
|
-
xadd: (key: string, id: string, entries: {
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
nomkStream?: boolean | undefined;
|
|
3027
|
-
trim?: (({
|
|
3792
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
3793
|
+
nomkStream?: boolean;
|
|
3794
|
+
trim?: ({
|
|
3028
3795
|
type: "MAXLEN" | "maxlen";
|
|
3029
3796
|
threshold: number;
|
|
3030
3797
|
} | {
|
|
@@ -3032,20 +3799,117 @@ declare class Redis {
|
|
|
3032
3799
|
threshold: string;
|
|
3033
3800
|
}) & ({
|
|
3034
3801
|
comparison: "~";
|
|
3035
|
-
limit?: number
|
|
3802
|
+
limit?: number;
|
|
3036
3803
|
} | {
|
|
3037
3804
|
comparison: "=";
|
|
3038
|
-
limit?:
|
|
3039
|
-
})
|
|
3805
|
+
limit?: never;
|
|
3806
|
+
});
|
|
3040
3807
|
} | undefined) => Promise<string>;
|
|
3808
|
+
/**
|
|
3809
|
+
* @see https://redis.io/commands/xack
|
|
3810
|
+
*/
|
|
3811
|
+
xack: (key: string, group: string, id: string | string[]) => Promise<number>;
|
|
3812
|
+
/**
|
|
3813
|
+
* @see https://redis.io/commands/xdel
|
|
3814
|
+
*/
|
|
3815
|
+
xdel: (key: string, ids: string | string[]) => Promise<number>;
|
|
3816
|
+
/**
|
|
3817
|
+
* @see https://redis.io/commands/xgroup
|
|
3818
|
+
*/
|
|
3819
|
+
xgroup: (key: string, opts: {
|
|
3820
|
+
type: "CREATE";
|
|
3821
|
+
group: string;
|
|
3822
|
+
id: `$` | string;
|
|
3823
|
+
options?: {
|
|
3824
|
+
MKSTREAM?: boolean;
|
|
3825
|
+
ENTRIESREAD?: number;
|
|
3826
|
+
};
|
|
3827
|
+
} | {
|
|
3828
|
+
type: "CREATECONSUMER";
|
|
3829
|
+
group: string;
|
|
3830
|
+
consumer: string;
|
|
3831
|
+
} | {
|
|
3832
|
+
type: "DELCONSUMER";
|
|
3833
|
+
group: string;
|
|
3834
|
+
consumer: string;
|
|
3835
|
+
} | {
|
|
3836
|
+
type: "DESTROY";
|
|
3837
|
+
group: string;
|
|
3838
|
+
} | {
|
|
3839
|
+
type: "SETID";
|
|
3840
|
+
group: string;
|
|
3841
|
+
id: `$` | string;
|
|
3842
|
+
options?: {
|
|
3843
|
+
ENTRIESREAD?: number;
|
|
3844
|
+
};
|
|
3845
|
+
}) => Promise<never>;
|
|
3846
|
+
/**
|
|
3847
|
+
* @see https://redis.io/commands/xread
|
|
3848
|
+
*/
|
|
3849
|
+
xread: (...args: CommandArgs<typeof XReadCommand>) => Promise<unknown[]>;
|
|
3850
|
+
/**
|
|
3851
|
+
* @see https://redis.io/commands/xreadgroup
|
|
3852
|
+
*/
|
|
3853
|
+
xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Promise<unknown[]>;
|
|
3854
|
+
/**
|
|
3855
|
+
* @see https://redis.io/commands/xinfo
|
|
3856
|
+
*/
|
|
3857
|
+
xinfo: (key: string, options: {
|
|
3858
|
+
type: "CONSUMERS";
|
|
3859
|
+
group: string;
|
|
3860
|
+
} | {
|
|
3861
|
+
type: "GROUPS";
|
|
3862
|
+
}) => Promise<unknown[]>;
|
|
3863
|
+
/**
|
|
3864
|
+
* @see https://redis.io/commands/xlen
|
|
3865
|
+
*/
|
|
3866
|
+
xlen: (key: string) => Promise<number>;
|
|
3867
|
+
/**
|
|
3868
|
+
* @see https://redis.io/commands/xpending
|
|
3869
|
+
*/
|
|
3870
|
+
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
3871
|
+
idleTime?: number;
|
|
3872
|
+
consumer?: string | string[];
|
|
3873
|
+
} | undefined) => Promise<unknown[]>;
|
|
3874
|
+
/**
|
|
3875
|
+
* @see https://redis.io/commands/xclaim
|
|
3876
|
+
*/
|
|
3877
|
+
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
3878
|
+
idleMS?: number;
|
|
3879
|
+
timeMS?: number;
|
|
3880
|
+
retryCount?: number;
|
|
3881
|
+
force?: boolean;
|
|
3882
|
+
justId?: boolean;
|
|
3883
|
+
lastId?: number;
|
|
3884
|
+
} | undefined) => Promise<unknown[]>;
|
|
3885
|
+
/**
|
|
3886
|
+
* @see https://redis.io/commands/xautoclaim
|
|
3887
|
+
*/
|
|
3888
|
+
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
3889
|
+
count?: number;
|
|
3890
|
+
justId?: boolean;
|
|
3891
|
+
} | undefined) => Promise<unknown[]>;
|
|
3892
|
+
/**
|
|
3893
|
+
* @see https://redis.io/commands/xtrim
|
|
3894
|
+
*/
|
|
3895
|
+
xtrim: (key: string, options: {
|
|
3896
|
+
strategy: "MAXLEN" | "MINID";
|
|
3897
|
+
exactness?: "~" | "=";
|
|
3898
|
+
threshold: number | string;
|
|
3899
|
+
limit?: number;
|
|
3900
|
+
}) => Promise<number>;
|
|
3041
3901
|
/**
|
|
3042
3902
|
* @see https://redis.io/commands/xrange
|
|
3043
3903
|
*/
|
|
3044
3904
|
xrange: (key: string, start: string, end: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
|
|
3905
|
+
/**
|
|
3906
|
+
* @see https://redis.io/commands/xrevrange
|
|
3907
|
+
*/
|
|
3908
|
+
xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
|
|
3045
3909
|
/**
|
|
3046
3910
|
* @see https://redis.io/commands/zadd
|
|
3047
3911
|
*/
|
|
3048
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<number | null>;
|
|
3912
|
+
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
|
|
3049
3913
|
/**
|
|
3050
3914
|
* @see https://redis.io/commands/zcard
|
|
3051
3915
|
*/
|
|
@@ -3085,21 +3949,11 @@ declare class Redis {
|
|
|
3085
3949
|
/**
|
|
3086
3950
|
* @see https://redis.io/commands/zrange
|
|
3087
3951
|
*/
|
|
3088
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
byLex: true;
|
|
3094
|
-
} & ZRangeCommandOptions
|
|
3095
|
-
] | [
|
|
3096
|
-
key: string,
|
|
3097
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
3098
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
3099
|
-
opts: {
|
|
3100
|
-
byScore: true;
|
|
3101
|
-
} & ZRangeCommandOptions
|
|
3102
|
-
]) => Promise<TData>;
|
|
3952
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
3953
|
+
byLex: true;
|
|
3954
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
3955
|
+
byScore: true;
|
|
3956
|
+
} & ZRangeCommandOptions]) => Promise<TData>;
|
|
3103
3957
|
/**
|
|
3104
3958
|
* @see https://redis.io/commands/zrank
|
|
3105
3959
|
*/
|
|
@@ -3127,7 +3981,7 @@ declare class Redis {
|
|
|
3127
3981
|
/**
|
|
3128
3982
|
* @see https://redis.io/commands/zscan
|
|
3129
3983
|
*/
|
|
3130
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
3984
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
3131
3985
|
/**
|
|
3132
3986
|
* @see https://redis.io/commands/zscore
|
|
3133
3987
|
*/
|
|
@@ -3142,6 +3996,24 @@ declare class Redis {
|
|
|
3142
3996
|
zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
|
|
3143
3997
|
}
|
|
3144
3998
|
|
|
3999
|
+
/**
|
|
4000
|
+
* Result of a bad request to upstash
|
|
4001
|
+
*/
|
|
4002
|
+
declare class UpstashError extends Error {
|
|
4003
|
+
constructor(message: string);
|
|
4004
|
+
}
|
|
4005
|
+
declare class UrlError extends Error {
|
|
4006
|
+
constructor(url: string);
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
type error_UpstashError = UpstashError;
|
|
4010
|
+
declare const error_UpstashError: typeof UpstashError;
|
|
4011
|
+
type error_UrlError = UrlError;
|
|
4012
|
+
declare const error_UrlError: typeof UrlError;
|
|
4013
|
+
declare namespace error {
|
|
4014
|
+
export { error_UpstashError as UpstashError, error_UrlError as UrlError };
|
|
4015
|
+
}
|
|
4016
|
+
|
|
3145
4017
|
/**
|
|
3146
4018
|
* @see https://redis.io/commands/zdiffstore
|
|
3147
4019
|
*/
|
|
@@ -3156,4 +4028,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3156
4028
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3157
4029
|
}
|
|
3158
4030
|
|
|
3159
|
-
export {
|
|
4031
|
+
export { HPersistCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, type HttpClientConfig as H, GetCommand as I, GetBitCommand as J, GetDelCommand as K, GetExCommand as L, GetRangeCommand as M, GetSetCommand as N, HDelCommand as O, Pipeline as P, HExistsCommand as Q, type RedisOptions as R, HExpireCommand as S, HExpireAtCommand as T, type UpstashRequest as U, HExpireTimeCommand as V, HTtlCommand as W, HPExpireCommand as X, HPExpireAtCommand as Y, HPExpireTimeCommand as Z, HPTtlCommand as _, type RequesterConfig as a, RenameNXCommand as a$, HGetCommand as a0, HGetAllCommand as a1, HIncrByCommand as a2, HIncrByFloatCommand as a3, HKeysCommand as a4, HLenCommand as a5, HMGetCommand as a6, HMSetCommand as a7, HRandFieldCommand as a8, HScanCommand as a9, JsonStrLenCommand as aA, JsonToggleCommand as aB, JsonTypeCommand as aC, KeysCommand as aD, LIndexCommand as aE, LInsertCommand as aF, LLenCommand as aG, LMoveCommand as aH, LPopCommand as aI, LPushCommand as aJ, LPushXCommand as aK, LRangeCommand as aL, LRemCommand as aM, LSetCommand as aN, LTrimCommand as aO, MGetCommand as aP, MSetCommand as aQ, MSetNXCommand as aR, PersistCommand as aS, PExpireCommand as aT, PExpireAtCommand as aU, PingCommand as aV, PSetEXCommand as aW, PTtlCommand as aX, PublishCommand as aY, RandomKeyCommand as aZ, RenameCommand as a_, HSetCommand as aa, HSetNXCommand as ab, HStrLenCommand as ac, HValsCommand as ad, IncrCommand as ae, IncrByCommand as af, IncrByFloatCommand as ag, JsonArrAppendCommand as ah, JsonArrIndexCommand as ai, JsonArrInsertCommand as aj, JsonArrLenCommand as ak, JsonArrPopCommand as al, JsonArrTrimCommand as am, JsonClearCommand as an, JsonDelCommand as ao, JsonForgetCommand as ap, JsonGetCommand as aq, JsonMergeCommand as ar, JsonMGetCommand as as, JsonNumIncrByCommand as at, JsonNumMultByCommand as au, JsonObjKeysCommand as av, JsonObjLenCommand as aw, JsonRespCommand as ax, JsonSetCommand as ay, JsonStrAppendCommand as az, Redis as b, type ZUnionCommandOptions as b$, RPopCommand as b0, RPushCommand as b1, RPushXCommand as b2, SAddCommand as b3, ScanCommand as b4, type ScanCommandOptions as b5, SCardCommand as b6, ScriptExistsCommand as b7, ScriptFlushCommand as b8, ScriptLoadCommand as b9, UnlinkCommand as bA, XAddCommand as bB, XRangeCommand as bC, type ScoreMember as bD, type ZAddCommandOptions as bE, ZAddCommand as bF, ZCardCommand as bG, ZCountCommand as bH, ZDiffStoreCommand as bI, ZIncrByCommand as bJ, ZInterStoreCommand as bK, type ZInterStoreCommandOptions as bL, ZLexCountCommand as bM, ZMScoreCommand as bN, ZPopMaxCommand as bO, ZPopMinCommand as bP, ZRangeCommand as bQ, type ZRangeCommandOptions as bR, ZRankCommand as bS, ZRemCommand as bT, ZRemRangeByLexCommand as bU, ZRemRangeByRankCommand as bV, ZRemRangeByScoreCommand as bW, ZRevRankCommand as bX, ZScanCommand as bY, ZScoreCommand as bZ, ZUnionCommand as b_, SDiffCommand as ba, SDiffStoreCommand as bb, SetCommand as bc, type SetCommandOptions as bd, SetBitCommand as be, SetExCommand as bf, SetNxCommand as bg, SetRangeCommand as bh, SInterCommand as bi, SInterStoreCommand as bj, SIsMemberCommand as bk, SMembersCommand as bl, SMIsMemberCommand as bm, SMoveCommand as bn, SPopCommand as bo, SRandMemberCommand as bp, SRemCommand as bq, SScanCommand as br, StrLenCommand as bs, SUnionCommand as bt, SUnionStoreCommand as bu, TimeCommand as bv, TouchCommand as bw, TtlCommand as bx, type Type as by, TypeCommand as bz, type UpstashResponse as c, ZUnionStoreCommand as c0, type ZUnionStoreCommandOptions as c1, type Requester as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalROCommand as k, EvalCommand as l, EvalshaROCommand as m, EvalshaCommand as n, ExistsCommand as o, ExpireCommand as p, type ExpireOption as q, ExpireAtCommand as r, FlushDBCommand as s, type GeoAddCommandOptions as t, type GeoMember as u, GeoDistCommand as v, GeoHashCommand as w, GeoPosCommand as x, GeoSearchCommand as y, GeoSearchStoreCommand as z };
|