@upstash/redis 0.0.0-ci.c00b02de3221a40eb48a9e0e9fecd434abda4dc2-20240704001524 → 0.0.0-ci.c05bb5d90ded8c71e40139529731d936ba674c9e-20250728152433
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 +1 -2
- package/chunk-PSYAGAHX.mjs +4491 -0
- package/cloudflare.d.mts +8 -4
- package/cloudflare.d.ts +8 -4
- package/cloudflare.js +4593 -1
- package/cloudflare.mjs +93 -1
- package/fastly.d.mts +7 -3
- package/fastly.d.ts +7 -3
- package/fastly.js +4566 -1
- package/fastly.mjs +66 -1
- package/nodejs.d.mts +9 -23
- package/nodejs.d.ts +9 -23
- package/nodejs.js +4613 -1
- package/nodejs.mjs +113 -1
- package/package.json +1 -1
- package/{zmscore-80635339.d.ts → zmscore-BshEAkn7.d.mts} +747 -234
- package/zmscore-BshEAkn7.d.ts +4031 -0
- package/chunk-K5LHLR2R.js +0 -1
- package/chunk-LPQ73WFW.mjs +0 -1
|
@@ -26,6 +26,7 @@ type RedisOptions = {
|
|
|
26
26
|
latencyLogging?: boolean;
|
|
27
27
|
enableTelemetry?: boolean;
|
|
28
28
|
enableAutoPipelining?: boolean;
|
|
29
|
+
readYourWrites?: boolean;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
|
@@ -35,12 +36,37 @@ type UpstashRequest = {
|
|
|
35
36
|
* Request body will be serialized to json
|
|
36
37
|
*/
|
|
37
38
|
body?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Additional headers for the request
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
upstashSyncToken?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Callback for handling streaming messages
|
|
46
|
+
*/
|
|
47
|
+
onMessage?: (data: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this request expects a streaming response
|
|
50
|
+
*/
|
|
51
|
+
isStreaming?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Abort signal for the request
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal;
|
|
38
56
|
};
|
|
39
57
|
type UpstashResponse<TResult> = {
|
|
40
58
|
result?: TResult;
|
|
41
59
|
error?: string;
|
|
42
60
|
};
|
|
43
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;
|
|
44
70
|
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
45
71
|
}
|
|
46
72
|
type RetryConfig = false | {
|
|
@@ -60,6 +86,9 @@ type RetryConfig = false | {
|
|
|
60
86
|
*/
|
|
61
87
|
backoff?: (retryCount: number) => number;
|
|
62
88
|
};
|
|
89
|
+
type Options$1 = {
|
|
90
|
+
backend?: string;
|
|
91
|
+
};
|
|
63
92
|
type RequesterConfig = {
|
|
64
93
|
/**
|
|
65
94
|
* Configure the retry behaviour in case of network errors
|
|
@@ -94,6 +123,19 @@ type RequesterConfig = {
|
|
|
94
123
|
*/
|
|
95
124
|
cache?: CacheSetting;
|
|
96
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;
|
|
97
139
|
|
|
98
140
|
type Serialize = (data: unknown) => string | number | boolean;
|
|
99
141
|
type Deserialize<TResult, TData> = (result: TResult) => TData;
|
|
@@ -109,6 +151,31 @@ type CommandOptions<TResult, TData> = {
|
|
|
109
151
|
*/
|
|
110
152
|
automaticDeserialization?: boolean;
|
|
111
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
|
+
};
|
|
112
179
|
};
|
|
113
180
|
/**
|
|
114
181
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -120,6 +187,11 @@ declare class Command<TResult, TData> {
|
|
|
120
187
|
readonly command: (string | number | boolean)[];
|
|
121
188
|
readonly serialize: Serialize;
|
|
122
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;
|
|
123
195
|
/**
|
|
124
196
|
* Create a new command instance.
|
|
125
197
|
*
|
|
@@ -132,8 +204,7 @@ declare class Command<TResult, TData> {
|
|
|
132
204
|
exec(client: Requester): Promise<TData>;
|
|
133
205
|
}
|
|
134
206
|
|
|
135
|
-
type
|
|
136
|
-
withScores?: boolean;
|
|
207
|
+
type ZUnionStoreCommandOptions = {
|
|
137
208
|
aggregate?: "sum" | "min" | "max";
|
|
138
209
|
} & ({
|
|
139
210
|
weight: number;
|
|
@@ -146,14 +217,15 @@ type ZUnionCommandOptions = {
|
|
|
146
217
|
weights?: never;
|
|
147
218
|
});
|
|
148
219
|
/**
|
|
149
|
-
* @see https://redis.io/commands/
|
|
220
|
+
* @see https://redis.io/commands/zunionstore
|
|
150
221
|
*/
|
|
151
|
-
declare class
|
|
152
|
-
constructor(cmd: [numKeys: 1, key: string, opts?:
|
|
153
|
-
constructor(cmd: [numKeys: number, keys: string[], opts?:
|
|
222
|
+
declare class ZUnionStoreCommand extends Command<number, number> {
|
|
223
|
+
constructor(cmd: [destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
|
|
224
|
+
constructor(cmd: [destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions], cmdOpts?: CommandOptions<number, number>);
|
|
154
225
|
}
|
|
155
226
|
|
|
156
|
-
type
|
|
227
|
+
type ZUnionCommandOptions = {
|
|
228
|
+
withScores?: boolean;
|
|
157
229
|
aggregate?: "sum" | "min" | "max";
|
|
158
230
|
} & ({
|
|
159
231
|
weight: number;
|
|
@@ -166,11 +238,11 @@ type ZUnionStoreCommandOptions = {
|
|
|
166
238
|
weights?: never;
|
|
167
239
|
});
|
|
168
240
|
/**
|
|
169
|
-
* @see https://redis.io/commands/
|
|
241
|
+
* @see https://redis.io/commands/zunion
|
|
170
242
|
*/
|
|
171
|
-
declare class
|
|
172
|
-
constructor(cmd: [
|
|
173
|
-
constructor(cmd: [
|
|
243
|
+
declare class ZUnionCommand<TData extends unknown[]> extends Command<string[], TData> {
|
|
244
|
+
constructor(cmd: [numKeys: 1, key: string, opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
|
|
245
|
+
constructor(cmd: [numKeys: number, keys: string[], opts?: ZUnionCommandOptions], cmdOpts?: CommandOptions<string[], TData>);
|
|
174
246
|
}
|
|
175
247
|
|
|
176
248
|
type ZInterStoreCommandOptions = {
|
|
@@ -215,18 +287,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
|
|
|
215
287
|
constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
|
|
216
288
|
}
|
|
217
289
|
|
|
218
|
-
type ScanCommandOptions = {
|
|
219
|
-
match?: string;
|
|
220
|
-
count?: number;
|
|
221
|
-
type?: string;
|
|
222
|
-
};
|
|
223
|
-
/**
|
|
224
|
-
* @see https://redis.io/commands/scan
|
|
225
|
-
*/
|
|
226
|
-
declare class ScanCommand extends Command<[string, string[]], [string, string[]]> {
|
|
227
|
-
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], [string, string[]]>);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
290
|
type GeoAddCommandOptions = {
|
|
231
291
|
nx?: boolean;
|
|
232
292
|
xx?: never;
|
|
@@ -236,11 +296,11 @@ type GeoAddCommandOptions = {
|
|
|
236
296
|
} & {
|
|
237
297
|
ch?: boolean;
|
|
238
298
|
});
|
|
239
|
-
|
|
299
|
+
type GeoMember<TMemberType> = {
|
|
240
300
|
latitude: number;
|
|
241
301
|
longitude: number;
|
|
242
302
|
member: TMemberType;
|
|
243
|
-
}
|
|
303
|
+
};
|
|
244
304
|
/**
|
|
245
305
|
* @see https://redis.io/commands/geoadd
|
|
246
306
|
*/
|
|
@@ -252,6 +312,11 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
|
|
|
252
312
|
], opts?: CommandOptions<number | null, number | null>);
|
|
253
313
|
}
|
|
254
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
|
+
|
|
255
320
|
/**
|
|
256
321
|
* @see https://redis.io/commands/append
|
|
257
322
|
*/
|
|
@@ -270,7 +335,7 @@ declare class BitCountCommand extends Command<number, number> {
|
|
|
270
335
|
type SubCommandArgs<TRest extends unknown[] = []> = [
|
|
271
336
|
encoding: string,
|
|
272
337
|
offset: number | string,
|
|
273
|
-
...TRest
|
|
338
|
+
...rest: TRest
|
|
274
339
|
];
|
|
275
340
|
/**
|
|
276
341
|
* @see https://redis.io/commands/bitfield
|
|
@@ -348,6 +413,13 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
348
413
|
constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
|
|
349
414
|
}
|
|
350
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
|
+
|
|
351
423
|
/**
|
|
352
424
|
* @see https://redis.io/commands/eval
|
|
353
425
|
*/
|
|
@@ -355,6 +427,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
|
|
|
355
427
|
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
356
428
|
}
|
|
357
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
|
+
|
|
358
437
|
/**
|
|
359
438
|
* @see https://redis.io/commands/evalsha
|
|
360
439
|
*/
|
|
@@ -369,16 +448,11 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
369
448
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
370
449
|
}
|
|
371
450
|
|
|
372
|
-
type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
373
|
-
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
374
|
-
constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
451
|
/**
|
|
378
452
|
* @see https://redis.io/commands/expireat
|
|
379
453
|
*/
|
|
380
454
|
declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
381
|
-
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>);
|
|
382
456
|
}
|
|
383
457
|
|
|
384
458
|
/**
|
|
@@ -415,7 +489,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
|
|
|
415
489
|
* @see https://redis.io/commands/geohash
|
|
416
490
|
*/
|
|
417
491
|
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
418
|
-
constructor(cmd: [string, ...
|
|
492
|
+
constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
419
493
|
}
|
|
420
494
|
|
|
421
495
|
type Coordinates = {
|
|
@@ -553,6 +627,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
|
|
|
553
627
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
554
628
|
}
|
|
555
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
|
+
|
|
556
674
|
/**
|
|
557
675
|
* @see https://redis.io/commands/getrange
|
|
558
676
|
*/
|
|
@@ -581,6 +699,58 @@ declare class HExistsCommand extends Command<number, number> {
|
|
|
581
699
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
582
700
|
}
|
|
583
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
|
+
|
|
584
754
|
/**
|
|
585
755
|
* @see https://redis.io/commands/hget
|
|
586
756
|
*/
|
|
@@ -642,9 +812,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
|
|
|
642
812
|
* @see https://redis.io/commands/hmset
|
|
643
813
|
*/
|
|
644
814
|
declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
|
|
645
|
-
constructor([key, kv]: [key: string, kv:
|
|
646
|
-
[field: string]: TData;
|
|
647
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
815
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
648
816
|
}
|
|
649
817
|
|
|
650
818
|
/**
|
|
@@ -656,6 +824,39 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
656
824
|
constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
|
|
657
825
|
}
|
|
658
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
|
+
|
|
659
860
|
/**
|
|
660
861
|
* @see https://redis.io/commands/hscan
|
|
661
862
|
*/
|
|
@@ -673,9 +874,7 @@ declare class HScanCommand extends Command<[
|
|
|
673
874
|
* @see https://redis.io/commands/hset
|
|
674
875
|
*/
|
|
675
876
|
declare class HSetCommand<TData> extends Command<number, number> {
|
|
676
|
-
constructor([key, kv]: [key: string, kv:
|
|
677
|
-
[field: string]: TData;
|
|
678
|
-
}], opts?: CommandOptions<number, number>);
|
|
877
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
679
878
|
}
|
|
680
879
|
|
|
681
880
|
/**
|
|
@@ -692,6 +891,10 @@ declare class HStrLenCommand extends Command<number, number> {
|
|
|
692
891
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
693
892
|
}
|
|
694
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
|
+
|
|
695
898
|
/**
|
|
696
899
|
* @see https://redis.io/commands/hvals
|
|
697
900
|
*/
|
|
@@ -798,6 +1001,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
798
1001
|
] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
|
|
799
1002
|
}
|
|
800
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
|
+
|
|
801
1011
|
/**
|
|
802
1012
|
* @see https://redis.io/commands/json.mget
|
|
803
1013
|
*/
|
|
@@ -805,6 +1015,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
|
|
|
805
1015
|
constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
|
|
806
1016
|
}
|
|
807
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
|
+
|
|
808
1029
|
/**
|
|
809
1030
|
* @see https://redis.io/commands/json.numincrby
|
|
810
1031
|
*/
|
|
@@ -961,25 +1182,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
|
|
|
961
1182
|
* @see https://redis.io/commands/mget
|
|
962
1183
|
*/
|
|
963
1184
|
declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
|
|
964
|
-
constructor(cmd: [string[]] | [...
|
|
1185
|
+
constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
|
|
965
1186
|
}
|
|
966
1187
|
|
|
967
1188
|
/**
|
|
968
1189
|
* @see https://redis.io/commands/mset
|
|
969
1190
|
*/
|
|
970
1191
|
declare class MSetCommand<TData> extends Command<"OK", "OK"> {
|
|
971
|
-
constructor([kv]: [kv:
|
|
972
|
-
[key: string]: TData;
|
|
973
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
1192
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
974
1193
|
}
|
|
975
1194
|
|
|
976
1195
|
/**
|
|
977
1196
|
* @see https://redis.io/commands/msetnx
|
|
978
1197
|
*/
|
|
979
1198
|
declare class MSetNXCommand<TData = string> extends Command<number, number> {
|
|
980
|
-
constructor([kv]: [kv:
|
|
981
|
-
[key: string]: TData;
|
|
982
|
-
}], opts?: CommandOptions<number, number>);
|
|
1199
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
983
1200
|
}
|
|
984
1201
|
|
|
985
1202
|
/**
|
|
@@ -993,14 +1210,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
|
|
|
993
1210
|
* @see https://redis.io/commands/pexpire
|
|
994
1211
|
*/
|
|
995
1212
|
declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
996
|
-
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>);
|
|
997
1214
|
}
|
|
998
1215
|
|
|
999
1216
|
/**
|
|
1000
1217
|
* @see https://redis.io/commands/pexpireat
|
|
1001
1218
|
*/
|
|
1002
1219
|
declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
1003
|
-
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>);
|
|
1004
1221
|
}
|
|
1005
1222
|
|
|
1006
1223
|
/**
|
|
@@ -1077,7 +1294,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
|
|
|
1077
1294
|
* @see https://redis.io/commands/sadd
|
|
1078
1295
|
*/
|
|
1079
1296
|
declare class SAddCommand<TData = string> extends Command<number, number> {
|
|
1080
|
-
constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1297
|
+
constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1081
1298
|
}
|
|
1082
1299
|
|
|
1083
1300
|
/**
|
|
@@ -1346,9 +1563,7 @@ declare class XAddCommand extends Command<string, string> {
|
|
|
1346
1563
|
constructor([key, id, entries, opts]: [
|
|
1347
1564
|
key: string,
|
|
1348
1565
|
id: "*" | string,
|
|
1349
|
-
entries:
|
|
1350
|
-
[field: string]: unknown;
|
|
1351
|
-
},
|
|
1566
|
+
entries: Record<string, unknown>,
|
|
1352
1567
|
opts?: XAddCommandOptions
|
|
1353
1568
|
], commandOptions?: CommandOptions<string, string>);
|
|
1354
1569
|
}
|
|
@@ -1588,9 +1803,78 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1588
1803
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1589
1804
|
}
|
|
1590
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
|
+
|
|
1591
1842
|
type InferResponseData<T extends unknown[]> = {
|
|
1592
1843
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1593
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
|
+
}
|
|
1594
1878
|
/**
|
|
1595
1879
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1596
1880
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1639,19 +1923,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1639
1923
|
commandOptions?: CommandOptions<any, any>;
|
|
1640
1924
|
multiExec?: boolean;
|
|
1641
1925
|
});
|
|
1642
|
-
|
|
1643
|
-
* Send the pipeline request to upstash.
|
|
1644
|
-
*
|
|
1645
|
-
* Returns an array with the results of all pipelined commands.
|
|
1646
|
-
*
|
|
1647
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1648
|
-
* ```ts
|
|
1649
|
-
* const p = redis.pipeline()
|
|
1650
|
-
* p.get("key")
|
|
1651
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1652
|
-
* ```
|
|
1653
|
-
*/
|
|
1654
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1926
|
+
exec: ExecMethod<TCommands>;
|
|
1655
1927
|
/**
|
|
1656
1928
|
* Returns the length of pipeline before the execution
|
|
1657
1929
|
*/
|
|
@@ -1727,10 +1999,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1727
1999
|
* @see https://redis.io/commands/echo
|
|
1728
2000
|
*/
|
|
1729
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>]>;
|
|
1730
2006
|
/**
|
|
1731
2007
|
* @see https://redis.io/commands/eval
|
|
1732
2008
|
*/
|
|
1733
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>]>;
|
|
1734
2014
|
/**
|
|
1735
2015
|
* @see https://redis.io/commands/evalsha
|
|
1736
2016
|
*/
|
|
@@ -1742,11 +2022,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1742
2022
|
/**
|
|
1743
2023
|
* @see https://redis.io/commands/expire
|
|
1744
2024
|
*/
|
|
1745
|
-
expire: (key: string, seconds: number, option?:
|
|
2025
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1746
2026
|
/**
|
|
1747
2027
|
* @see https://redis.io/commands/expireat
|
|
1748
2028
|
*/
|
|
1749
|
-
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>]>;
|
|
1750
2030
|
/**
|
|
1751
2031
|
* @see https://redis.io/commands/flushall
|
|
1752
2032
|
*/
|
|
@@ -1755,7 +2035,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1755
2035
|
* @see https://redis.io/commands/flushdb
|
|
1756
2036
|
*/
|
|
1757
2037
|
flushdb: (opts?: {
|
|
1758
|
-
async?: boolean
|
|
2038
|
+
async?: boolean;
|
|
1759
2039
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1760
2040
|
/**
|
|
1761
2041
|
* @see https://redis.io/commands/geoadd
|
|
@@ -1802,11 +2082,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1802
2082
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1803
2083
|
count?: {
|
|
1804
2084
|
limit: number;
|
|
1805
|
-
any?: boolean
|
|
1806
|
-
}
|
|
1807
|
-
withCoord?: boolean
|
|
1808
|
-
withDist?: boolean
|
|
1809
|
-
withHash?: boolean
|
|
2085
|
+
any?: boolean;
|
|
2086
|
+
};
|
|
2087
|
+
withCoord?: boolean;
|
|
2088
|
+
withDist?: boolean;
|
|
2089
|
+
withHash?: boolean;
|
|
1810
2090
|
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
1811
2091
|
member: TData;
|
|
1812
2092
|
} & {
|
|
@@ -1843,9 +2123,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1843
2123
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1844
2124
|
count?: {
|
|
1845
2125
|
limit: number;
|
|
1846
|
-
any?: boolean
|
|
1847
|
-
}
|
|
1848
|
-
storeDist?: boolean
|
|
2126
|
+
any?: boolean;
|
|
2127
|
+
};
|
|
2128
|
+
storeDist?: boolean;
|
|
1849
2129
|
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1850
2130
|
/**
|
|
1851
2131
|
* @see https://redis.io/commands/get
|
|
@@ -1859,6 +2139,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1859
2139
|
* @see https://redis.io/commands/getdel
|
|
1860
2140
|
*/
|
|
1861
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>]>;
|
|
1862
2182
|
/**
|
|
1863
2183
|
* @see https://redis.io/commands/getrange
|
|
1864
2184
|
*/
|
|
@@ -1875,6 +2195,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1875
2195
|
* @see https://redis.io/commands/hexists
|
|
1876
2196
|
*/
|
|
1877
2197
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2198
|
+
/**
|
|
2199
|
+
* @see https://redis.io/commands/hexpire
|
|
2200
|
+
*/
|
|
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)[]>]>;
|
|
1878
2234
|
/**
|
|
1879
2235
|
* @see https://redis.io/commands/hget
|
|
1880
2236
|
*/
|
|
@@ -1906,13 +2262,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1906
2262
|
/**
|
|
1907
2263
|
* @see https://redis.io/commands/hmset
|
|
1908
2264
|
*/
|
|
1909
|
-
hmset: <TData>(key: string, kv:
|
|
1910
|
-
[field: string]: TData;
|
|
1911
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2265
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1912
2266
|
/**
|
|
1913
2267
|
* @see https://redis.io/commands/hrandfield
|
|
1914
2268
|
*/
|
|
1915
|
-
hrandfield: <TData extends string | Record<string, unknown
|
|
2269
|
+
hrandfield: <TData extends string | string[] | Record<string, unknown>>(key: string, count?: number, withValues?: boolean) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1916
2270
|
/**
|
|
1917
2271
|
* @see https://redis.io/commands/hscan
|
|
1918
2272
|
*/
|
|
@@ -1920,9 +2274,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1920
2274
|
/**
|
|
1921
2275
|
* @see https://redis.io/commands/hset
|
|
1922
2276
|
*/
|
|
1923
|
-
hset: <TData>(key: string, kv:
|
|
1924
|
-
[field: string]: TData;
|
|
1925
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2277
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1926
2278
|
/**
|
|
1927
2279
|
* @see https://redis.io/commands/hsetnx
|
|
1928
2280
|
*/
|
|
@@ -1979,9 +2331,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1979
2331
|
* @see https://redis.io/commands/lpos
|
|
1980
2332
|
*/
|
|
1981
2333
|
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
1982
|
-
rank?: number
|
|
1983
|
-
count?: number
|
|
1984
|
-
maxLen?: number
|
|
2334
|
+
rank?: number;
|
|
2335
|
+
count?: number;
|
|
2336
|
+
maxLen?: number;
|
|
1985
2337
|
} | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1986
2338
|
/**
|
|
1987
2339
|
* @see https://redis.io/commands/lpush
|
|
@@ -2014,15 +2366,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2014
2366
|
/**
|
|
2015
2367
|
* @see https://redis.io/commands/mset
|
|
2016
2368
|
*/
|
|
2017
|
-
mset: <TData>(kv:
|
|
2018
|
-
[key: string]: TData;
|
|
2019
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2369
|
+
mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2020
2370
|
/**
|
|
2021
2371
|
* @see https://redis.io/commands/msetnx
|
|
2022
2372
|
*/
|
|
2023
|
-
msetnx: <TData>(kv:
|
|
2024
|
-
[key: string]: TData;
|
|
2025
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2373
|
+
msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2026
2374
|
/**
|
|
2027
2375
|
* @see https://redis.io/commands/persist
|
|
2028
2376
|
*/
|
|
@@ -2030,11 +2378,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2030
2378
|
/**
|
|
2031
2379
|
* @see https://redis.io/commands/pexpire
|
|
2032
2380
|
*/
|
|
2033
|
-
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>]>;
|
|
2034
2382
|
/**
|
|
2035
2383
|
* @see https://redis.io/commands/pexpireat
|
|
2036
2384
|
*/
|
|
2037
|
-
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>]>;
|
|
2038
2386
|
/**
|
|
2039
2387
|
* @see https://redis.io/commands/pfadd
|
|
2040
2388
|
*/
|
|
@@ -2090,11 +2438,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2090
2438
|
/**
|
|
2091
2439
|
* @see https://redis.io/commands/sadd
|
|
2092
2440
|
*/
|
|
2093
|
-
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>]>;
|
|
2094
2442
|
/**
|
|
2095
2443
|
* @see https://redis.io/commands/scan
|
|
2096
2444
|
*/
|
|
2097
|
-
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2445
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2098
2446
|
/**
|
|
2099
2447
|
* @see https://redis.io/commands/scard
|
|
2100
2448
|
*/
|
|
@@ -2211,19 +2559,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2211
2559
|
/**
|
|
2212
2560
|
* @see https://redis.io/commands/zadd
|
|
2213
2561
|
*/
|
|
2214
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
|
|
2215
|
-
key: string,
|
|
2216
|
-
opts: ZAddCommandOptions,
|
|
2217
|
-
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
|
|
2218
|
-
]) => 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>]>;
|
|
2219
2563
|
/**
|
|
2220
2564
|
* @see https://redis.io/commands/xadd
|
|
2221
2565
|
*/
|
|
2222
|
-
xadd: (key: string, id: string, entries: {
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
nomkStream?: boolean | undefined;
|
|
2226
|
-
trim?: (({
|
|
2566
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
2567
|
+
nomkStream?: boolean;
|
|
2568
|
+
trim?: ({
|
|
2227
2569
|
type: "MAXLEN" | "maxlen";
|
|
2228
2570
|
threshold: number;
|
|
2229
2571
|
} | {
|
|
@@ -2231,11 +2573,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2231
2573
|
threshold: string;
|
|
2232
2574
|
}) & ({
|
|
2233
2575
|
comparison: "~";
|
|
2234
|
-
limit?: number
|
|
2576
|
+
limit?: number;
|
|
2235
2577
|
} | {
|
|
2236
2578
|
comparison: "=";
|
|
2237
|
-
limit?:
|
|
2238
|
-
})
|
|
2579
|
+
limit?: never;
|
|
2580
|
+
});
|
|
2239
2581
|
} | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2240
2582
|
/**
|
|
2241
2583
|
* @see https://redis.io/commands/xack
|
|
@@ -2251,11 +2593,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2251
2593
|
xgroup: (key: string, opts: {
|
|
2252
2594
|
type: "CREATE";
|
|
2253
2595
|
group: string;
|
|
2254
|
-
id: string;
|
|
2596
|
+
id: `$` | string;
|
|
2255
2597
|
options?: {
|
|
2256
|
-
MKSTREAM?: boolean
|
|
2257
|
-
ENTRIESREAD?: number
|
|
2258
|
-
}
|
|
2598
|
+
MKSTREAM?: boolean;
|
|
2599
|
+
ENTRIESREAD?: number;
|
|
2600
|
+
};
|
|
2259
2601
|
} | {
|
|
2260
2602
|
type: "CREATECONSUMER";
|
|
2261
2603
|
group: string;
|
|
@@ -2270,10 +2612,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2270
2612
|
} | {
|
|
2271
2613
|
type: "SETID";
|
|
2272
2614
|
group: string;
|
|
2273
|
-
id: string;
|
|
2615
|
+
id: `$` | string;
|
|
2274
2616
|
options?: {
|
|
2275
|
-
ENTRIESREAD?: number
|
|
2276
|
-
}
|
|
2617
|
+
ENTRIESREAD?: number;
|
|
2618
|
+
};
|
|
2277
2619
|
}) => Pipeline<[...TCommands, Command<any, never>]>;
|
|
2278
2620
|
/**
|
|
2279
2621
|
* @see https://redis.io/commands/xread
|
|
@@ -2300,35 +2642,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2300
2642
|
* @see https://redis.io/commands/xpending
|
|
2301
2643
|
*/
|
|
2302
2644
|
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
2303
|
-
idleTime?: number
|
|
2304
|
-
consumer?: string | string[]
|
|
2645
|
+
idleTime?: number;
|
|
2646
|
+
consumer?: string | string[];
|
|
2305
2647
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2306
2648
|
/**
|
|
2307
2649
|
* @see https://redis.io/commands/xclaim
|
|
2308
2650
|
*/
|
|
2309
2651
|
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
2310
|
-
idleMS?: number
|
|
2311
|
-
timeMS?: number
|
|
2312
|
-
retryCount?: number
|
|
2313
|
-
force?: boolean
|
|
2314
|
-
justId?: boolean
|
|
2315
|
-
lastId?: number
|
|
2652
|
+
idleMS?: number;
|
|
2653
|
+
timeMS?: number;
|
|
2654
|
+
retryCount?: number;
|
|
2655
|
+
force?: boolean;
|
|
2656
|
+
justId?: boolean;
|
|
2657
|
+
lastId?: number;
|
|
2316
2658
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2317
2659
|
/**
|
|
2318
2660
|
* @see https://redis.io/commands/xautoclaim
|
|
2319
2661
|
*/
|
|
2320
2662
|
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
2321
|
-
count?: number
|
|
2322
|
-
justId?: boolean
|
|
2663
|
+
count?: number;
|
|
2664
|
+
justId?: boolean;
|
|
2323
2665
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2324
2666
|
/**
|
|
2325
2667
|
* @see https://redis.io/commands/xtrim
|
|
2326
2668
|
*/
|
|
2327
2669
|
xtrim: (key: string, options: {
|
|
2328
2670
|
strategy: "MAXLEN" | "MINID";
|
|
2329
|
-
exactness?: "~" | "="
|
|
2330
|
-
threshold:
|
|
2331
|
-
limit?: number
|
|
2671
|
+
exactness?: "~" | "=";
|
|
2672
|
+
threshold: number | string;
|
|
2673
|
+
limit?: number;
|
|
2332
2674
|
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2333
2675
|
/**
|
|
2334
2676
|
* @see https://redis.io/commands/xrange
|
|
@@ -2373,21 +2715,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2373
2715
|
/**
|
|
2374
2716
|
* @see https://redis.io/commands/zrange
|
|
2375
2717
|
*/
|
|
2376
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
byLex: true;
|
|
2382
|
-
} & ZRangeCommandOptions
|
|
2383
|
-
] | [
|
|
2384
|
-
key: string,
|
|
2385
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
2386
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
2387
|
-
opts: {
|
|
2388
|
-
byScore: true;
|
|
2389
|
-
} & ZRangeCommandOptions
|
|
2390
|
-
]) => 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>]>;
|
|
2391
2723
|
/**
|
|
2392
2724
|
* @see https://redis.io/commands/zrank
|
|
2393
2725
|
*/
|
|
@@ -2472,10 +2804,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2472
2804
|
* @see https://redis.io/commands/json.get
|
|
2473
2805
|
*/
|
|
2474
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>]>;
|
|
2475
2811
|
/**
|
|
2476
2812
|
* @see https://redis.io/commands/json.mget
|
|
2477
2813
|
*/
|
|
2478
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>]>;
|
|
2479
2819
|
/**
|
|
2480
2820
|
* @see https://redis.io/commands/json.numincrby
|
|
2481
2821
|
*/
|
|
@@ -2501,9 +2841,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2501
2841
|
*/
|
|
2502
2842
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2503
2843
|
nx: true;
|
|
2504
|
-
xx?:
|
|
2844
|
+
xx?: never;
|
|
2505
2845
|
} | {
|
|
2506
|
-
nx?:
|
|
2846
|
+
nx?: never;
|
|
2507
2847
|
xx: true;
|
|
2508
2848
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2509
2849
|
/**
|
|
@@ -2543,9 +2883,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2543
2883
|
*/
|
|
2544
2884
|
declare class Script<TResult = unknown> {
|
|
2545
2885
|
readonly script: string;
|
|
2546
|
-
|
|
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;
|
|
2547
2894
|
private readonly redis;
|
|
2548
2895
|
constructor(redis: Redis, script: string);
|
|
2896
|
+
/**
|
|
2897
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
2898
|
+
*/
|
|
2899
|
+
private init;
|
|
2549
2900
|
/**
|
|
2550
2901
|
* Send an `EVAL` command to redis.
|
|
2551
2902
|
*/
|
|
@@ -2567,6 +2918,56 @@ declare class Script<TResult = unknown> {
|
|
|
2567
2918
|
private digest;
|
|
2568
2919
|
}
|
|
2569
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
|
+
|
|
2570
2971
|
/**
|
|
2571
2972
|
* Serverless redis client for upstash.
|
|
2572
2973
|
*/
|
|
@@ -2587,6 +2988,8 @@ declare class Redis {
|
|
|
2587
2988
|
* ```
|
|
2588
2989
|
*/
|
|
2589
2990
|
constructor(client: Requester, opts?: RedisOptions);
|
|
2991
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
2992
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2590
2993
|
get json(): {
|
|
2591
2994
|
/**
|
|
2592
2995
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2628,10 +3031,18 @@ declare class Redis {
|
|
|
2628
3031
|
* @see https://redis.io/commands/json.get
|
|
2629
3032
|
*/
|
|
2630
3033
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3034
|
+
/**
|
|
3035
|
+
* @see https://redis.io/commands/json.merge
|
|
3036
|
+
*/
|
|
3037
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2631
3038
|
/**
|
|
2632
3039
|
* @see https://redis.io/commands/json.mget
|
|
2633
3040
|
*/
|
|
2634
|
-
mget: <
|
|
3041
|
+
mget: <TData>(keys: string[], path: string) => Promise<TData>;
|
|
3042
|
+
/**
|
|
3043
|
+
* @see https://redis.io/commands/json.mset
|
|
3044
|
+
*/
|
|
3045
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
|
|
2635
3046
|
/**
|
|
2636
3047
|
* @see https://redis.io/commands/json.numincrby
|
|
2637
3048
|
*/
|
|
@@ -2657,9 +3068,9 @@ declare class Redis {
|
|
|
2657
3068
|
*/
|
|
2658
3069
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2659
3070
|
nx: true;
|
|
2660
|
-
xx?:
|
|
3071
|
+
xx?: never;
|
|
2661
3072
|
} | {
|
|
2662
|
-
nx?:
|
|
3073
|
+
nx?: never;
|
|
2663
3074
|
xx: true;
|
|
2664
3075
|
} | undefined) => Promise<"OK" | null>;
|
|
2665
3076
|
/**
|
|
@@ -2687,7 +3098,37 @@ declare class Redis {
|
|
|
2687
3098
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2688
3099
|
*/
|
|
2689
3100
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2690
|
-
|
|
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>;
|
|
2691
3132
|
/**
|
|
2692
3133
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2693
3134
|
*
|
|
@@ -2766,14 +3207,26 @@ declare class Redis {
|
|
|
2766
3207
|
* @see https://redis.io/commands/echo
|
|
2767
3208
|
*/
|
|
2768
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>;
|
|
2769
3214
|
/**
|
|
2770
3215
|
* @see https://redis.io/commands/eval
|
|
2771
3216
|
*/
|
|
2772
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>;
|
|
2773
3222
|
/**
|
|
2774
3223
|
* @see https://redis.io/commands/evalsha
|
|
2775
3224
|
*/
|
|
2776
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>;
|
|
2777
3230
|
/**
|
|
2778
3231
|
* @see https://redis.io/commands/exists
|
|
2779
3232
|
*/
|
|
@@ -2781,11 +3234,11 @@ declare class Redis {
|
|
|
2781
3234
|
/**
|
|
2782
3235
|
* @see https://redis.io/commands/expire
|
|
2783
3236
|
*/
|
|
2784
|
-
expire: (key: string, seconds: number, option?:
|
|
3237
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2785
3238
|
/**
|
|
2786
3239
|
* @see https://redis.io/commands/expireat
|
|
2787
3240
|
*/
|
|
2788
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3241
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2789
3242
|
/**
|
|
2790
3243
|
* @see https://redis.io/commands/flushall
|
|
2791
3244
|
*/
|
|
@@ -2794,7 +3247,7 @@ declare class Redis {
|
|
|
2794
3247
|
* @see https://redis.io/commands/flushdb
|
|
2795
3248
|
*/
|
|
2796
3249
|
flushdb: (opts?: {
|
|
2797
|
-
async?: boolean
|
|
3250
|
+
async?: boolean;
|
|
2798
3251
|
} | undefined) => Promise<"OK">;
|
|
2799
3252
|
/**
|
|
2800
3253
|
* @see https://redis.io/commands/geoadd
|
|
@@ -2841,11 +3294,11 @@ declare class Redis {
|
|
|
2841
3294
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2842
3295
|
count?: {
|
|
2843
3296
|
limit: number;
|
|
2844
|
-
any?: boolean
|
|
2845
|
-
}
|
|
2846
|
-
withCoord?: boolean
|
|
2847
|
-
withDist?: boolean
|
|
2848
|
-
withHash?: boolean
|
|
3297
|
+
any?: boolean;
|
|
3298
|
+
};
|
|
3299
|
+
withCoord?: boolean;
|
|
3300
|
+
withDist?: boolean;
|
|
3301
|
+
withHash?: boolean;
|
|
2849
3302
|
} | undefined) => Promise<({
|
|
2850
3303
|
member: TData;
|
|
2851
3304
|
} & {
|
|
@@ -2882,9 +3335,9 @@ declare class Redis {
|
|
|
2882
3335
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2883
3336
|
count?: {
|
|
2884
3337
|
limit: number;
|
|
2885
|
-
any?: boolean
|
|
2886
|
-
}
|
|
2887
|
-
storeDist?: boolean
|
|
3338
|
+
any?: boolean;
|
|
3339
|
+
};
|
|
3340
|
+
storeDist?: boolean;
|
|
2888
3341
|
} | undefined) => Promise<number>;
|
|
2889
3342
|
/**
|
|
2890
3343
|
* @see https://redis.io/commands/get
|
|
@@ -2898,6 +3351,46 @@ declare class Redis {
|
|
|
2898
3351
|
* @see https://redis.io/commands/getdel
|
|
2899
3352
|
*/
|
|
2900
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>;
|
|
2901
3394
|
/**
|
|
2902
3395
|
* @see https://redis.io/commands/getrange
|
|
2903
3396
|
*/
|
|
@@ -2914,6 +3407,42 @@ declare class Redis {
|
|
|
2914
3407
|
* @see https://redis.io/commands/hexists
|
|
2915
3408
|
*/
|
|
2916
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)[]>;
|
|
2917
3446
|
/**
|
|
2918
3447
|
* @see https://redis.io/commands/hget
|
|
2919
3448
|
*/
|
|
@@ -2945,9 +3474,7 @@ declare class Redis {
|
|
|
2945
3474
|
/**
|
|
2946
3475
|
* @see https://redis.io/commands/hmset
|
|
2947
3476
|
*/
|
|
2948
|
-
hmset: <TData>(key: string, kv:
|
|
2949
|
-
[field: string]: TData;
|
|
2950
|
-
}) => Promise<"OK">;
|
|
3477
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
|
|
2951
3478
|
/**
|
|
2952
3479
|
* @see https://redis.io/commands/hrandfield
|
|
2953
3480
|
*/
|
|
@@ -2963,9 +3490,7 @@ declare class Redis {
|
|
|
2963
3490
|
/**
|
|
2964
3491
|
* @see https://redis.io/commands/hset
|
|
2965
3492
|
*/
|
|
2966
|
-
hset: <TData>(key: string, kv:
|
|
2967
|
-
[field: string]: TData;
|
|
2968
|
-
}) => Promise<number>;
|
|
3493
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
|
|
2969
3494
|
/**
|
|
2970
3495
|
* @see https://redis.io/commands/hsetnx
|
|
2971
3496
|
*/
|
|
@@ -3022,9 +3547,9 @@ declare class Redis {
|
|
|
3022
3547
|
* @see https://redis.io/commands/lpos
|
|
3023
3548
|
*/
|
|
3024
3549
|
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
3025
|
-
rank?: number
|
|
3026
|
-
count?: number
|
|
3027
|
-
maxLen?: number
|
|
3550
|
+
rank?: number;
|
|
3551
|
+
count?: number;
|
|
3552
|
+
maxLen?: number;
|
|
3028
3553
|
} | undefined) => Promise<TData>;
|
|
3029
3554
|
/**
|
|
3030
3555
|
* @see https://redis.io/commands/lpush
|
|
@@ -3057,15 +3582,11 @@ declare class Redis {
|
|
|
3057
3582
|
/**
|
|
3058
3583
|
* @see https://redis.io/commands/mset
|
|
3059
3584
|
*/
|
|
3060
|
-
mset: <TData>(kv:
|
|
3061
|
-
[key: string]: TData;
|
|
3062
|
-
}) => Promise<"OK">;
|
|
3585
|
+
mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
|
|
3063
3586
|
/**
|
|
3064
3587
|
* @see https://redis.io/commands/msetnx
|
|
3065
3588
|
*/
|
|
3066
|
-
msetnx: <TData>(kv:
|
|
3067
|
-
[key: string]: TData;
|
|
3068
|
-
}) => Promise<number>;
|
|
3589
|
+
msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
|
|
3069
3590
|
/**
|
|
3070
3591
|
* @see https://redis.io/commands/persist
|
|
3071
3592
|
*/
|
|
@@ -3073,11 +3594,11 @@ declare class Redis {
|
|
|
3073
3594
|
/**
|
|
3074
3595
|
* @see https://redis.io/commands/pexpire
|
|
3075
3596
|
*/
|
|
3076
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3597
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3077
3598
|
/**
|
|
3078
3599
|
* @see https://redis.io/commands/pexpireat
|
|
3079
3600
|
*/
|
|
3080
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3601
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3081
3602
|
/**
|
|
3082
3603
|
* @see https://redis.io/commands/pfadd
|
|
3083
3604
|
*/
|
|
@@ -3098,6 +3619,10 @@ declare class Redis {
|
|
|
3098
3619
|
* @see https://redis.io/commands/psetex
|
|
3099
3620
|
*/
|
|
3100
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>;
|
|
3101
3626
|
/**
|
|
3102
3627
|
* @see https://redis.io/commands/pttl
|
|
3103
3628
|
*/
|
|
@@ -3133,11 +3658,14 @@ declare class Redis {
|
|
|
3133
3658
|
/**
|
|
3134
3659
|
* @see https://redis.io/commands/sadd
|
|
3135
3660
|
*/
|
|
3136
|
-
sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
|
|
3661
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
|
|
3137
3662
|
/**
|
|
3138
3663
|
* @see https://redis.io/commands/scan
|
|
3139
3664
|
*/
|
|
3140
|
-
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>;
|
|
3141
3669
|
/**
|
|
3142
3670
|
* @see https://redis.io/commands/scard
|
|
3143
3671
|
*/
|
|
@@ -3226,6 +3754,10 @@ declare class Redis {
|
|
|
3226
3754
|
* @see https://redis.io/commands/strlen
|
|
3227
3755
|
*/
|
|
3228
3756
|
strlen: (key: string) => Promise<number>;
|
|
3757
|
+
/**
|
|
3758
|
+
* @see https://redis.io/commands/subscribe
|
|
3759
|
+
*/
|
|
3760
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3229
3761
|
/**
|
|
3230
3762
|
* @see https://redis.io/commands/sunion
|
|
3231
3763
|
*/
|
|
@@ -3257,11 +3789,9 @@ declare class Redis {
|
|
|
3257
3789
|
/**
|
|
3258
3790
|
* @see https://redis.io/commands/xadd
|
|
3259
3791
|
*/
|
|
3260
|
-
xadd: (key: string, id: string, entries: {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
nomkStream?: boolean | undefined;
|
|
3264
|
-
trim?: (({
|
|
3792
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
3793
|
+
nomkStream?: boolean;
|
|
3794
|
+
trim?: ({
|
|
3265
3795
|
type: "MAXLEN" | "maxlen";
|
|
3266
3796
|
threshold: number;
|
|
3267
3797
|
} | {
|
|
@@ -3269,11 +3799,11 @@ declare class Redis {
|
|
|
3269
3799
|
threshold: string;
|
|
3270
3800
|
}) & ({
|
|
3271
3801
|
comparison: "~";
|
|
3272
|
-
limit?: number
|
|
3802
|
+
limit?: number;
|
|
3273
3803
|
} | {
|
|
3274
3804
|
comparison: "=";
|
|
3275
|
-
limit?:
|
|
3276
|
-
})
|
|
3805
|
+
limit?: never;
|
|
3806
|
+
});
|
|
3277
3807
|
} | undefined) => Promise<string>;
|
|
3278
3808
|
/**
|
|
3279
3809
|
* @see https://redis.io/commands/xack
|
|
@@ -3289,11 +3819,11 @@ declare class Redis {
|
|
|
3289
3819
|
xgroup: (key: string, opts: {
|
|
3290
3820
|
type: "CREATE";
|
|
3291
3821
|
group: string;
|
|
3292
|
-
id: string;
|
|
3822
|
+
id: `$` | string;
|
|
3293
3823
|
options?: {
|
|
3294
|
-
MKSTREAM?: boolean
|
|
3295
|
-
ENTRIESREAD?: number
|
|
3296
|
-
}
|
|
3824
|
+
MKSTREAM?: boolean;
|
|
3825
|
+
ENTRIESREAD?: number;
|
|
3826
|
+
};
|
|
3297
3827
|
} | {
|
|
3298
3828
|
type: "CREATECONSUMER";
|
|
3299
3829
|
group: string;
|
|
@@ -3308,10 +3838,10 @@ declare class Redis {
|
|
|
3308
3838
|
} | {
|
|
3309
3839
|
type: "SETID";
|
|
3310
3840
|
group: string;
|
|
3311
|
-
id: string;
|
|
3841
|
+
id: `$` | string;
|
|
3312
3842
|
options?: {
|
|
3313
|
-
ENTRIESREAD?: number
|
|
3314
|
-
}
|
|
3843
|
+
ENTRIESREAD?: number;
|
|
3844
|
+
};
|
|
3315
3845
|
}) => Promise<never>;
|
|
3316
3846
|
/**
|
|
3317
3847
|
* @see https://redis.io/commands/xread
|
|
@@ -3338,35 +3868,35 @@ declare class Redis {
|
|
|
3338
3868
|
* @see https://redis.io/commands/xpending
|
|
3339
3869
|
*/
|
|
3340
3870
|
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
3341
|
-
idleTime?: number
|
|
3342
|
-
consumer?: string | string[]
|
|
3871
|
+
idleTime?: number;
|
|
3872
|
+
consumer?: string | string[];
|
|
3343
3873
|
} | undefined) => Promise<unknown[]>;
|
|
3344
3874
|
/**
|
|
3345
3875
|
* @see https://redis.io/commands/xclaim
|
|
3346
3876
|
*/
|
|
3347
3877
|
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
3348
|
-
idleMS?: number
|
|
3349
|
-
timeMS?: number
|
|
3350
|
-
retryCount?: number
|
|
3351
|
-
force?: boolean
|
|
3352
|
-
justId?: boolean
|
|
3353
|
-
lastId?: number
|
|
3878
|
+
idleMS?: number;
|
|
3879
|
+
timeMS?: number;
|
|
3880
|
+
retryCount?: number;
|
|
3881
|
+
force?: boolean;
|
|
3882
|
+
justId?: boolean;
|
|
3883
|
+
lastId?: number;
|
|
3354
3884
|
} | undefined) => Promise<unknown[]>;
|
|
3355
3885
|
/**
|
|
3356
3886
|
* @see https://redis.io/commands/xautoclaim
|
|
3357
3887
|
*/
|
|
3358
3888
|
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
3359
|
-
count?: number
|
|
3360
|
-
justId?: boolean
|
|
3889
|
+
count?: number;
|
|
3890
|
+
justId?: boolean;
|
|
3361
3891
|
} | undefined) => Promise<unknown[]>;
|
|
3362
3892
|
/**
|
|
3363
3893
|
* @see https://redis.io/commands/xtrim
|
|
3364
3894
|
*/
|
|
3365
3895
|
xtrim: (key: string, options: {
|
|
3366
3896
|
strategy: "MAXLEN" | "MINID";
|
|
3367
|
-
exactness?: "~" | "="
|
|
3368
|
-
threshold:
|
|
3369
|
-
limit?: number
|
|
3897
|
+
exactness?: "~" | "=";
|
|
3898
|
+
threshold: number | string;
|
|
3899
|
+
limit?: number;
|
|
3370
3900
|
}) => Promise<number>;
|
|
3371
3901
|
/**
|
|
3372
3902
|
* @see https://redis.io/commands/xrange
|
|
@@ -3379,11 +3909,7 @@ declare class Redis {
|
|
|
3379
3909
|
/**
|
|
3380
3910
|
* @see https://redis.io/commands/zadd
|
|
3381
3911
|
*/
|
|
3382
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
|
|
3383
|
-
key: string,
|
|
3384
|
-
opts: ZAddCommandOptions,
|
|
3385
|
-
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
|
|
3386
|
-
]) => 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>;
|
|
3387
3913
|
/**
|
|
3388
3914
|
* @see https://redis.io/commands/zcard
|
|
3389
3915
|
*/
|
|
@@ -3423,21 +3949,11 @@ declare class Redis {
|
|
|
3423
3949
|
/**
|
|
3424
3950
|
* @see https://redis.io/commands/zrange
|
|
3425
3951
|
*/
|
|
3426
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
byLex: true;
|
|
3432
|
-
} & ZRangeCommandOptions
|
|
3433
|
-
] | [
|
|
3434
|
-
key: string,
|
|
3435
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
3436
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
3437
|
-
opts: {
|
|
3438
|
-
byScore: true;
|
|
3439
|
-
} & ZRangeCommandOptions
|
|
3440
|
-
]) => 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>;
|
|
3441
3957
|
/**
|
|
3442
3958
|
* @see https://redis.io/commands/zrank
|
|
3443
3959
|
*/
|
|
@@ -3495,10 +4011,7 @@ declare const error_UpstashError: typeof UpstashError;
|
|
|
3495
4011
|
type error_UrlError = UrlError;
|
|
3496
4012
|
declare const error_UrlError: typeof UrlError;
|
|
3497
4013
|
declare namespace error {
|
|
3498
|
-
export {
|
|
3499
|
-
error_UpstashError as UpstashError,
|
|
3500
|
-
error_UrlError as UrlError,
|
|
3501
|
-
};
|
|
4014
|
+
export { error_UpstashError as UpstashError, error_UrlError as UrlError };
|
|
3502
4015
|
}
|
|
3503
4016
|
|
|
3504
4017
|
/**
|
|
@@ -3515,4 +4028,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3515
4028
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3516
4029
|
}
|
|
3517
4030
|
|
|
3518
|
-
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 };
|