@upstash/redis 0.0.0-ci.8895aca4ac4b6a7430f4e15b010a71fd1735c231-20240408001502 → 0.0.0-ci.893d5822fe6324e13932f920ba66e56179dfdb9f-20260130092901
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 +10 -2
- package/chunk-NQMT65VO.mjs +4838 -0
- package/cloudflare.d.mts +11 -6
- package/cloudflare.d.ts +11 -6
- package/cloudflare.js +4944 -1
- package/cloudflare.mjs +97 -1
- package/fastly.d.mts +10 -5
- package/fastly.d.ts +10 -5
- package/fastly.js +4913 -1
- package/fastly.mjs +66 -1
- package/nodejs.d.mts +19 -24
- package/nodejs.d.ts +19 -24
- package/nodejs.js +4966 -1
- package/nodejs.mjs +119 -1
- package/package.json +1 -1
- package/{zmscore-07021e27.d.ts → zmscore-BjNXmrug.d.mts} +1356 -259
- package/zmscore-BjNXmrug.d.ts +4528 -0
- package/chunk-EO6YIZRF.mjs +0 -1
- package/chunk-N4VE2BCR.js +0 -1
|
@@ -25,6 +25,8 @@ type RedisOptions = {
|
|
|
25
25
|
automaticDeserialization?: boolean;
|
|
26
26
|
latencyLogging?: boolean;
|
|
27
27
|
enableTelemetry?: boolean;
|
|
28
|
+
enableAutoPipelining?: boolean;
|
|
29
|
+
readYourWrites?: boolean;
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
|
@@ -34,12 +36,37 @@ type UpstashRequest = {
|
|
|
34
36
|
* Request body will be serialized to json
|
|
35
37
|
*/
|
|
36
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;
|
|
37
56
|
};
|
|
38
57
|
type UpstashResponse<TResult> = {
|
|
39
58
|
result?: TResult;
|
|
40
59
|
error?: string;
|
|
41
60
|
};
|
|
42
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;
|
|
43
70
|
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
44
71
|
}
|
|
45
72
|
type RetryConfig = false | {
|
|
@@ -50,7 +77,7 @@ type RetryConfig = false | {
|
|
|
50
77
|
*/
|
|
51
78
|
retries?: number;
|
|
52
79
|
/**
|
|
53
|
-
* A backoff function receives the current retry
|
|
80
|
+
* A backoff function receives the current retry count and returns a number in milliseconds to wait before retrying.
|
|
54
81
|
*
|
|
55
82
|
* @default
|
|
56
83
|
* ```ts
|
|
@@ -59,6 +86,9 @@ type RetryConfig = false | {
|
|
|
59
86
|
*/
|
|
60
87
|
backoff?: (retryCount: number) => number;
|
|
61
88
|
};
|
|
89
|
+
type Options$1 = {
|
|
90
|
+
backend?: string;
|
|
91
|
+
};
|
|
62
92
|
type RequesterConfig = {
|
|
63
93
|
/**
|
|
64
94
|
* Configure the retry behaviour in case of network errors
|
|
@@ -93,6 +123,19 @@ type RequesterConfig = {
|
|
|
93
123
|
*/
|
|
94
124
|
cache?: CacheSetting;
|
|
95
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;
|
|
96
139
|
|
|
97
140
|
type Serialize = (data: unknown) => string | number | boolean;
|
|
98
141
|
type Deserialize<TResult, TData> = (result: TResult) => TData;
|
|
@@ -108,6 +151,31 @@ type CommandOptions<TResult, TData> = {
|
|
|
108
151
|
*/
|
|
109
152
|
automaticDeserialization?: boolean;
|
|
110
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
|
+
};
|
|
111
179
|
};
|
|
112
180
|
/**
|
|
113
181
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -119,6 +187,11 @@ declare class Command<TResult, TData> {
|
|
|
119
187
|
readonly command: (string | number | boolean)[];
|
|
120
188
|
readonly serialize: Serialize;
|
|
121
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;
|
|
122
195
|
/**
|
|
123
196
|
* Create a new command instance.
|
|
124
197
|
*
|
|
@@ -214,18 +287,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
|
|
|
214
287
|
constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
|
|
215
288
|
}
|
|
216
289
|
|
|
217
|
-
type ScanCommandOptions = {
|
|
218
|
-
match?: string;
|
|
219
|
-
count?: number;
|
|
220
|
-
type?: string;
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* @see https://redis.io/commands/scan
|
|
224
|
-
*/
|
|
225
|
-
declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
|
|
226
|
-
constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, string[]], [number, string[]]>);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
290
|
type GeoAddCommandOptions = {
|
|
230
291
|
nx?: boolean;
|
|
231
292
|
xx?: never;
|
|
@@ -235,11 +296,11 @@ type GeoAddCommandOptions = {
|
|
|
235
296
|
} & {
|
|
236
297
|
ch?: boolean;
|
|
237
298
|
});
|
|
238
|
-
|
|
299
|
+
type GeoMember<TMemberType> = {
|
|
239
300
|
latitude: number;
|
|
240
301
|
longitude: number;
|
|
241
302
|
member: TMemberType;
|
|
242
|
-
}
|
|
303
|
+
};
|
|
243
304
|
/**
|
|
244
305
|
* @see https://redis.io/commands/geoadd
|
|
245
306
|
*/
|
|
@@ -251,6 +312,53 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
|
|
|
251
312
|
], opts?: CommandOptions<number | null, number | null>);
|
|
252
313
|
}
|
|
253
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
|
+
|
|
320
|
+
type ClientSetInfoAttribute = "LIB-NAME" | "lib-name" | "LIB-VER" | "lib-ver";
|
|
321
|
+
/**
|
|
322
|
+
* @see https://redis.io/commands/client-setinfo
|
|
323
|
+
*/
|
|
324
|
+
declare class ClientSetInfoCommand extends Command<string, string> {
|
|
325
|
+
constructor([attribute, value]: [attribute: ClientSetInfoAttribute, value: string], opts?: CommandOptions<string, string>);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
type FunctionListArgs = {
|
|
329
|
+
/**
|
|
330
|
+
* Pattern for matching library names. Supports glob patterns.
|
|
331
|
+
*
|
|
332
|
+
* Example: "my_library_*"
|
|
333
|
+
*/
|
|
334
|
+
libraryName?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Includes the library source code in the response.
|
|
337
|
+
*
|
|
338
|
+
* @default false
|
|
339
|
+
*/
|
|
340
|
+
withCode?: boolean;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
type FunctionLoadArgs = {
|
|
344
|
+
/**
|
|
345
|
+
* The Lua code to load.
|
|
346
|
+
*
|
|
347
|
+
* Example:
|
|
348
|
+
* ```lua
|
|
349
|
+
* #!lua name=mylib
|
|
350
|
+
* redis.register_function('myfunc', function() return 'ok' end)
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
code: string;
|
|
354
|
+
/**
|
|
355
|
+
* If true, the library will replace the existing library with the same name.
|
|
356
|
+
*
|
|
357
|
+
* @default false
|
|
358
|
+
*/
|
|
359
|
+
replace?: boolean;
|
|
360
|
+
};
|
|
361
|
+
|
|
254
362
|
/**
|
|
255
363
|
* @see https://redis.io/commands/append
|
|
256
364
|
*/
|
|
@@ -266,12 +374,36 @@ declare class BitCountCommand extends Command<number, number> {
|
|
|
266
374
|
constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
|
|
267
375
|
}
|
|
268
376
|
|
|
377
|
+
type SubCommandArgs<TRest extends unknown[] = []> = [
|
|
378
|
+
encoding: string,
|
|
379
|
+
offset: number | string,
|
|
380
|
+
...rest: TRest
|
|
381
|
+
];
|
|
382
|
+
/**
|
|
383
|
+
* @see https://redis.io/commands/bitfield
|
|
384
|
+
*/
|
|
385
|
+
declare class BitFieldCommand<T = Promise<number[]>> {
|
|
386
|
+
private client;
|
|
387
|
+
private opts?;
|
|
388
|
+
private execOperation;
|
|
389
|
+
private command;
|
|
390
|
+
constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
|
|
391
|
+
private chain;
|
|
392
|
+
get(...args: SubCommandArgs): this;
|
|
393
|
+
set(...args: SubCommandArgs<[value: number]>): this;
|
|
394
|
+
incrby(...args: SubCommandArgs<[increment: number]>): this;
|
|
395
|
+
overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
|
|
396
|
+
exec(): T;
|
|
397
|
+
}
|
|
398
|
+
|
|
269
399
|
/**
|
|
270
400
|
* @see https://redis.io/commands/bitop
|
|
271
401
|
*/
|
|
272
402
|
declare class BitOpCommand extends Command<number, number> {
|
|
273
403
|
constructor(cmd: [op: "and" | "or" | "xor", destinationKey: string, ...sourceKeys: string[]], opts?: CommandOptions<number, number>);
|
|
274
404
|
constructor(cmd: [op: "not", destinationKey: string, sourceKey: string], opts?: CommandOptions<number, number>);
|
|
405
|
+
constructor(cmd: [op: "diff" | "diff1" | "andor", destinationKey: string, x: string, ...y: string[]], opts?: CommandOptions<number, number>);
|
|
406
|
+
constructor(cmd: [op: "one", destinationKey: string, ...sourceKeys: string[]], opts?: CommandOptions<number, number>);
|
|
275
407
|
}
|
|
276
408
|
|
|
277
409
|
/**
|
|
@@ -325,6 +457,13 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
325
457
|
constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
|
|
326
458
|
}
|
|
327
459
|
|
|
460
|
+
/**
|
|
461
|
+
* @see https://redis.io/commands/eval_ro
|
|
462
|
+
*/
|
|
463
|
+
declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
464
|
+
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
465
|
+
}
|
|
466
|
+
|
|
328
467
|
/**
|
|
329
468
|
* @see https://redis.io/commands/eval
|
|
330
469
|
*/
|
|
@@ -332,6 +471,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
|
|
|
332
471
|
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
333
472
|
}
|
|
334
473
|
|
|
474
|
+
/**
|
|
475
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
476
|
+
*/
|
|
477
|
+
declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
478
|
+
constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
479
|
+
}
|
|
480
|
+
|
|
335
481
|
/**
|
|
336
482
|
* @see https://redis.io/commands/evalsha
|
|
337
483
|
*/
|
|
@@ -346,16 +492,11 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
346
492
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
347
493
|
}
|
|
348
494
|
|
|
349
|
-
type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
350
|
-
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
351
|
-
constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
495
|
/**
|
|
355
496
|
* @see https://redis.io/commands/expireat
|
|
356
497
|
*/
|
|
357
498
|
declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
358
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
499
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
359
500
|
}
|
|
360
501
|
|
|
361
502
|
/**
|
|
@@ -392,7 +533,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
|
|
|
392
533
|
* @see https://redis.io/commands/geohash
|
|
393
534
|
*/
|
|
394
535
|
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
395
|
-
constructor(cmd: [string, ...
|
|
536
|
+
constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
396
537
|
}
|
|
397
538
|
|
|
398
539
|
type Coordinates = {
|
|
@@ -530,6 +671,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
|
|
|
530
671
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
531
672
|
}
|
|
532
673
|
|
|
674
|
+
type GetExCommandOptions = {
|
|
675
|
+
ex: number;
|
|
676
|
+
px?: never;
|
|
677
|
+
exat?: never;
|
|
678
|
+
pxat?: never;
|
|
679
|
+
persist?: never;
|
|
680
|
+
} | {
|
|
681
|
+
ex?: never;
|
|
682
|
+
px: number;
|
|
683
|
+
exat?: never;
|
|
684
|
+
pxat?: never;
|
|
685
|
+
persist?: never;
|
|
686
|
+
} | {
|
|
687
|
+
ex?: never;
|
|
688
|
+
px?: never;
|
|
689
|
+
exat: number;
|
|
690
|
+
pxat?: never;
|
|
691
|
+
persist?: never;
|
|
692
|
+
} | {
|
|
693
|
+
ex?: never;
|
|
694
|
+
px?: never;
|
|
695
|
+
exat?: never;
|
|
696
|
+
pxat: number;
|
|
697
|
+
persist?: never;
|
|
698
|
+
} | {
|
|
699
|
+
ex?: never;
|
|
700
|
+
px?: never;
|
|
701
|
+
exat?: never;
|
|
702
|
+
pxat?: never;
|
|
703
|
+
persist: true;
|
|
704
|
+
} | {
|
|
705
|
+
ex?: never;
|
|
706
|
+
px?: never;
|
|
707
|
+
exat?: never;
|
|
708
|
+
pxat?: never;
|
|
709
|
+
persist?: never;
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* @see https://redis.io/commands/getex
|
|
713
|
+
*/
|
|
714
|
+
declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
715
|
+
constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
|
|
716
|
+
}
|
|
717
|
+
|
|
533
718
|
/**
|
|
534
719
|
* @see https://redis.io/commands/getrange
|
|
535
720
|
*/
|
|
@@ -558,6 +743,58 @@ declare class HExistsCommand extends Command<number, number> {
|
|
|
558
743
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
559
744
|
}
|
|
560
745
|
|
|
746
|
+
declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
747
|
+
constructor(cmd: [
|
|
748
|
+
key: string,
|
|
749
|
+
fields: (string | number) | (string | number)[],
|
|
750
|
+
seconds: number,
|
|
751
|
+
option?: ExpireOption
|
|
752
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
756
|
+
constructor(cmd: [
|
|
757
|
+
key: string,
|
|
758
|
+
fields: (string | number) | (string | number)[],
|
|
759
|
+
timestamp: number,
|
|
760
|
+
option?: ExpireOption
|
|
761
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
declare class HExpireTimeCommand extends Command<number[], number[]> {
|
|
765
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
|
|
769
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
773
|
+
constructor(cmd: [
|
|
774
|
+
key: string,
|
|
775
|
+
fields: (string | number) | (string | number)[],
|
|
776
|
+
milliseconds: number,
|
|
777
|
+
option?: ExpireOption
|
|
778
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
782
|
+
constructor(cmd: [
|
|
783
|
+
key: string,
|
|
784
|
+
fields: (string | number) | (string | number)[],
|
|
785
|
+
timestamp: number,
|
|
786
|
+
option?: ExpireOption
|
|
787
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
declare class HPExpireTimeCommand extends Command<number[], number[]> {
|
|
791
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
declare class HPTtlCommand extends Command<number[], number[]> {
|
|
795
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
796
|
+
}
|
|
797
|
+
|
|
561
798
|
/**
|
|
562
799
|
* @see https://redis.io/commands/hget
|
|
563
800
|
*/
|
|
@@ -572,6 +809,71 @@ declare class HGetAllCommand<TData extends Record<string, unknown>> extends Comm
|
|
|
572
809
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
573
810
|
}
|
|
574
811
|
|
|
812
|
+
/**
|
|
813
|
+
* HGETDEL returns the values of the specified fields and then atomically deletes them from the hash
|
|
814
|
+
* The field values are returned as an object like this:
|
|
815
|
+
* ```ts
|
|
816
|
+
* {[fieldName: string]: T | null}
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
* In case all fields are non-existent or the hash doesn't exist, `null` is returned
|
|
820
|
+
*
|
|
821
|
+
* @see https://redis.io/commands/hgetdel
|
|
822
|
+
*/
|
|
823
|
+
declare class HGetDelCommand<TData extends Record<string, unknown>> extends Command<(string | null)[], TData | null> {
|
|
824
|
+
constructor([key, ...fields]: [key: string, ...fields: (string | number)[]], opts?: CommandOptions<(string | null)[], TData | null>);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
type HGetExCommandOptions = {
|
|
828
|
+
ex: number;
|
|
829
|
+
px?: never;
|
|
830
|
+
exat?: never;
|
|
831
|
+
pxat?: never;
|
|
832
|
+
persist?: never;
|
|
833
|
+
} | {
|
|
834
|
+
ex?: never;
|
|
835
|
+
px: number;
|
|
836
|
+
exat?: never;
|
|
837
|
+
pxat?: never;
|
|
838
|
+
persist?: never;
|
|
839
|
+
} | {
|
|
840
|
+
ex?: never;
|
|
841
|
+
px?: never;
|
|
842
|
+
exat: number;
|
|
843
|
+
pxat?: never;
|
|
844
|
+
persist?: never;
|
|
845
|
+
} | {
|
|
846
|
+
ex?: never;
|
|
847
|
+
px?: never;
|
|
848
|
+
exat?: never;
|
|
849
|
+
pxat: number;
|
|
850
|
+
persist?: never;
|
|
851
|
+
} | {
|
|
852
|
+
ex?: never;
|
|
853
|
+
px?: never;
|
|
854
|
+
exat?: never;
|
|
855
|
+
pxat?: never;
|
|
856
|
+
persist: true;
|
|
857
|
+
};
|
|
858
|
+
/**
|
|
859
|
+
* HGETEX returns the values of the specified fields and optionally sets their expiration time or TTL
|
|
860
|
+
* The field values are returned as an object like this:
|
|
861
|
+
* ```ts
|
|
862
|
+
* {[fieldName: string]: T | null}
|
|
863
|
+
* ```
|
|
864
|
+
*
|
|
865
|
+
* In case all fields are non-existent or the hash doesn't exist, `null` is returned
|
|
866
|
+
*
|
|
867
|
+
* @see https://redis.io/commands/hgetex
|
|
868
|
+
*/
|
|
869
|
+
declare class HGetExCommand<TData extends Record<string, unknown>> extends Command<(string | null)[], TData | null> {
|
|
870
|
+
constructor([key, opts, ...fields]: [
|
|
871
|
+
key: string,
|
|
872
|
+
opts: HGetExCommandOptions,
|
|
873
|
+
...fields: (string | number)[]
|
|
874
|
+
], cmdOpts?: CommandOptions<(string | null)[], TData | null>);
|
|
875
|
+
}
|
|
876
|
+
|
|
575
877
|
/**
|
|
576
878
|
* @see https://redis.io/commands/hincrby
|
|
577
879
|
*/
|
|
@@ -619,9 +921,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
|
|
|
619
921
|
* @see https://redis.io/commands/hmset
|
|
620
922
|
*/
|
|
621
923
|
declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
|
|
622
|
-
constructor([key, kv]: [key: string, kv:
|
|
623
|
-
[field: string]: TData;
|
|
624
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
924
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
625
925
|
}
|
|
626
926
|
|
|
627
927
|
/**
|
|
@@ -633,26 +933,109 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
633
933
|
constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
|
|
634
934
|
}
|
|
635
935
|
|
|
936
|
+
type ScanCommandOptionsStandard = {
|
|
937
|
+
match?: string;
|
|
938
|
+
count?: number;
|
|
939
|
+
type?: string;
|
|
940
|
+
withType?: false;
|
|
941
|
+
};
|
|
942
|
+
type ScanCommandOptionsWithType = {
|
|
943
|
+
match?: string;
|
|
944
|
+
count?: number;
|
|
945
|
+
/**
|
|
946
|
+
* Includes types of each key in the result
|
|
947
|
+
*
|
|
948
|
+
* @example
|
|
949
|
+
* ```typescript
|
|
950
|
+
* await redis.scan("0", { withType: true })
|
|
951
|
+
* // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]]
|
|
952
|
+
* ```
|
|
953
|
+
*/
|
|
954
|
+
withType: true;
|
|
955
|
+
};
|
|
956
|
+
type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType;
|
|
957
|
+
type ScanResultStandard = [string, string[]];
|
|
958
|
+
type ScanResultWithType = [string, {
|
|
959
|
+
key: string;
|
|
960
|
+
type: string;
|
|
961
|
+
}[]];
|
|
962
|
+
/**
|
|
963
|
+
* @see https://redis.io/commands/scan
|
|
964
|
+
*/
|
|
965
|
+
declare class ScanCommand<TData = ScanResultStandard> extends Command<[string, string[]], TData> {
|
|
966
|
+
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>);
|
|
967
|
+
}
|
|
968
|
+
|
|
636
969
|
/**
|
|
637
970
|
* @see https://redis.io/commands/hscan
|
|
638
971
|
*/
|
|
639
972
|
declare class HScanCommand extends Command<[
|
|
640
|
-
|
|
973
|
+
string,
|
|
641
974
|
(string | number)[]
|
|
642
975
|
], [
|
|
643
|
-
|
|
976
|
+
string,
|
|
644
977
|
(string | number)[]
|
|
645
978
|
]> {
|
|
646
|
-
constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[
|
|
979
|
+
constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
647
980
|
}
|
|
648
981
|
|
|
649
982
|
/**
|
|
650
983
|
* @see https://redis.io/commands/hset
|
|
651
984
|
*/
|
|
652
985
|
declare class HSetCommand<TData> extends Command<number, number> {
|
|
653
|
-
constructor([key, kv]: [key: string, kv:
|
|
654
|
-
|
|
655
|
-
|
|
986
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
type HSetExConditionalOptions = "FNX" | "fnx" | "FXX" | "fxx";
|
|
990
|
+
type HSetExExpirationOptions = {
|
|
991
|
+
ex: number;
|
|
992
|
+
px?: never;
|
|
993
|
+
exat?: never;
|
|
994
|
+
pxat?: never;
|
|
995
|
+
keepttl?: never;
|
|
996
|
+
} | {
|
|
997
|
+
ex?: never;
|
|
998
|
+
px: number;
|
|
999
|
+
exat?: never;
|
|
1000
|
+
pxat?: never;
|
|
1001
|
+
keepttl?: never;
|
|
1002
|
+
} | {
|
|
1003
|
+
ex?: never;
|
|
1004
|
+
px?: never;
|
|
1005
|
+
exat: number;
|
|
1006
|
+
pxat?: never;
|
|
1007
|
+
keepttl?: never;
|
|
1008
|
+
} | {
|
|
1009
|
+
ex?: never;
|
|
1010
|
+
px?: never;
|
|
1011
|
+
exat?: never;
|
|
1012
|
+
pxat: number;
|
|
1013
|
+
keepttl?: never;
|
|
1014
|
+
} | {
|
|
1015
|
+
ex?: never;
|
|
1016
|
+
px?: never;
|
|
1017
|
+
exat?: never;
|
|
1018
|
+
pxat?: never;
|
|
1019
|
+
keepttl: true;
|
|
1020
|
+
} | {
|
|
1021
|
+
ex?: never;
|
|
1022
|
+
px?: never;
|
|
1023
|
+
exat?: never;
|
|
1024
|
+
pxat?: never;
|
|
1025
|
+
keepttl?: never;
|
|
1026
|
+
};
|
|
1027
|
+
type HSetExCommandOptions = {
|
|
1028
|
+
conditional?: HSetExConditionalOptions;
|
|
1029
|
+
expiration?: HSetExExpirationOptions;
|
|
1030
|
+
};
|
|
1031
|
+
/**
|
|
1032
|
+
* HSETEX sets the specified fields with their values and optionally sets their expiration time or TTL
|
|
1033
|
+
* Returns 1 on success and 0 otherwise.
|
|
1034
|
+
*
|
|
1035
|
+
* @see https://redis.io/commands/hsetex
|
|
1036
|
+
*/
|
|
1037
|
+
declare class HSetExCommand<TData> extends Command<number, number> {
|
|
1038
|
+
constructor([key, opts, kv]: [key: string, opts: HSetExCommandOptions, kv: Record<string, TData>], cmdOpts?: CommandOptions<number, number>);
|
|
656
1039
|
}
|
|
657
1040
|
|
|
658
1041
|
/**
|
|
@@ -669,6 +1052,10 @@ declare class HStrLenCommand extends Command<number, number> {
|
|
|
669
1052
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
670
1053
|
}
|
|
671
1054
|
|
|
1055
|
+
declare class HTtlCommand extends Command<number[], number[]> {
|
|
1056
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
672
1059
|
/**
|
|
673
1060
|
* @see https://redis.io/commands/hvals
|
|
674
1061
|
*/
|
|
@@ -775,6 +1162,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
775
1162
|
] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
|
|
776
1163
|
}
|
|
777
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* @see https://redis.io/commands/json.merge
|
|
1167
|
+
*/
|
|
1168
|
+
declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
|
|
1169
|
+
constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
778
1172
|
/**
|
|
779
1173
|
* @see https://redis.io/commands/json.mget
|
|
780
1174
|
*/
|
|
@@ -782,6 +1176,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
|
|
|
782
1176
|
constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
|
|
783
1177
|
}
|
|
784
1178
|
|
|
1179
|
+
/**
|
|
1180
|
+
* @see https://redis.io/commands/json.mset
|
|
1181
|
+
*/
|
|
1182
|
+
declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
|
|
1183
|
+
constructor(cmd: {
|
|
1184
|
+
key: string;
|
|
1185
|
+
path: string;
|
|
1186
|
+
value: TData;
|
|
1187
|
+
}[], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
785
1190
|
/**
|
|
786
1191
|
* @see https://redis.io/commands/json.numincrby
|
|
787
1192
|
*/
|
|
@@ -938,25 +1343,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
|
|
|
938
1343
|
* @see https://redis.io/commands/mget
|
|
939
1344
|
*/
|
|
940
1345
|
declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
|
|
941
|
-
constructor(cmd: [string[]] | [...
|
|
1346
|
+
constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
|
|
942
1347
|
}
|
|
943
1348
|
|
|
944
1349
|
/**
|
|
945
1350
|
* @see https://redis.io/commands/mset
|
|
946
1351
|
*/
|
|
947
1352
|
declare class MSetCommand<TData> extends Command<"OK", "OK"> {
|
|
948
|
-
constructor([kv]: [kv:
|
|
949
|
-
[key: string]: TData;
|
|
950
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
1353
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
951
1354
|
}
|
|
952
1355
|
|
|
953
1356
|
/**
|
|
954
1357
|
* @see https://redis.io/commands/msetnx
|
|
955
1358
|
*/
|
|
956
1359
|
declare class MSetNXCommand<TData = string> extends Command<number, number> {
|
|
957
|
-
constructor([kv]: [kv:
|
|
958
|
-
[key: string]: TData;
|
|
959
|
-
}], opts?: CommandOptions<number, number>);
|
|
1360
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
960
1361
|
}
|
|
961
1362
|
|
|
962
1363
|
/**
|
|
@@ -970,14 +1371,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
|
|
|
970
1371
|
* @see https://redis.io/commands/pexpire
|
|
971
1372
|
*/
|
|
972
1373
|
declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
973
|
-
constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1374
|
+
constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
974
1375
|
}
|
|
975
1376
|
|
|
976
1377
|
/**
|
|
977
1378
|
* @see https://redis.io/commands/pexpireat
|
|
978
1379
|
*/
|
|
979
1380
|
declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
980
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1381
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
981
1382
|
}
|
|
982
1383
|
|
|
983
1384
|
/**
|
|
@@ -1054,7 +1455,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
|
|
|
1054
1455
|
* @see https://redis.io/commands/sadd
|
|
1055
1456
|
*/
|
|
1056
1457
|
declare class SAddCommand<TData = string> extends Command<number, number> {
|
|
1057
|
-
constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1458
|
+
constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1058
1459
|
}
|
|
1059
1460
|
|
|
1060
1461
|
/**
|
|
@@ -1242,13 +1643,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
|
|
|
1242
1643
|
* @see https://redis.io/commands/sscan
|
|
1243
1644
|
*/
|
|
1244
1645
|
declare class SScanCommand extends Command<[
|
|
1245
|
-
|
|
1646
|
+
string,
|
|
1246
1647
|
(string | number)[]
|
|
1247
1648
|
], [
|
|
1248
|
-
|
|
1649
|
+
string,
|
|
1249
1650
|
(string | number)[]
|
|
1250
1651
|
]> {
|
|
1251
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1652
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1252
1653
|
}
|
|
1253
1654
|
|
|
1254
1655
|
/**
|
|
@@ -1300,6 +1701,14 @@ declare class UnlinkCommand extends Command<number, number> {
|
|
|
1300
1701
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
1301
1702
|
}
|
|
1302
1703
|
|
|
1704
|
+
type XAckDelOption = "KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked";
|
|
1705
|
+
/**
|
|
1706
|
+
* @see https://redis.io/commands/xackdel
|
|
1707
|
+
*/
|
|
1708
|
+
declare class XAckDelCommand extends Command<number[], number[]> {
|
|
1709
|
+
constructor([key, group, opts, ...ids]: [key: string, group: string, opts: XAckDelOption, ...ids: string[]], cmdOpts?: CommandOptions<number[], number[]>);
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1303
1712
|
type XAddCommandOptions = {
|
|
1304
1713
|
nomkStream?: boolean;
|
|
1305
1714
|
trim?: ({
|
|
@@ -1318,18 +1727,29 @@ type XAddCommandOptions = {
|
|
|
1318
1727
|
};
|
|
1319
1728
|
/**
|
|
1320
1729
|
* @see https://redis.io/commands/xadd
|
|
1730
|
+
*
|
|
1731
|
+
* Stream ID formats:
|
|
1732
|
+
* - "*" - Fully automatic ID generation
|
|
1733
|
+
* - "<ms>-<seq>" - Explicit ID (e.g., "1526919030474-55")
|
|
1734
|
+
* - "<ms>-*" - Auto-generate sequence number for the given millisecond timestamp (Redis 8+)
|
|
1321
1735
|
*/
|
|
1322
1736
|
declare class XAddCommand extends Command<string, string> {
|
|
1323
1737
|
constructor([key, id, entries, opts]: [
|
|
1324
1738
|
key: string,
|
|
1325
|
-
id: "*" | string,
|
|
1326
|
-
entries:
|
|
1327
|
-
[field: string]: unknown;
|
|
1328
|
-
},
|
|
1739
|
+
id: "*" | `${number}-*` | string,
|
|
1740
|
+
entries: Record<string, unknown>,
|
|
1329
1741
|
opts?: XAddCommandOptions
|
|
1330
1742
|
], commandOptions?: CommandOptions<string, string>);
|
|
1331
1743
|
}
|
|
1332
1744
|
|
|
1745
|
+
type XDelExOption = "KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked";
|
|
1746
|
+
/**
|
|
1747
|
+
* @see https://redis.io/commands/xdelex
|
|
1748
|
+
*/
|
|
1749
|
+
declare class XDelExCommand extends Command<number[], number[]> {
|
|
1750
|
+
constructor([key, opts, ...ids]: [key: string, opts?: XDelExOption, ...ids: string[]], cmdOpts?: CommandOptions<number[], number[]>);
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1333
1753
|
declare class XRangeCommand<TData extends Record<string, Record<string, unknown>>> extends Command<string[][], TData> {
|
|
1334
1754
|
constructor([key, start, end, count]: [key: string, start: string, end: string, count?: number], opts?: CommandOptions<unknown[], TData[]>);
|
|
1335
1755
|
}
|
|
@@ -1339,16 +1759,33 @@ type XReadCommandOptions = [
|
|
|
1339
1759
|
id: string | string[],
|
|
1340
1760
|
options?: {
|
|
1341
1761
|
count?: number;
|
|
1762
|
+
/**
|
|
1763
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1764
|
+
*/
|
|
1342
1765
|
blockMS?: number;
|
|
1343
1766
|
}
|
|
1344
1767
|
];
|
|
1345
|
-
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1768
|
+
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
|
|
1769
|
+
key: string,
|
|
1770
|
+
id: string,
|
|
1771
|
+
options?: {
|
|
1772
|
+
count?: number;
|
|
1773
|
+
/**
|
|
1774
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1775
|
+
*/
|
|
1776
|
+
blockMS?: number;
|
|
1777
|
+
}
|
|
1778
|
+
] : never : K extends string[] ? I extends string[] ? [
|
|
1779
|
+
key: string[],
|
|
1780
|
+
id: string[],
|
|
1781
|
+
options?: {
|
|
1782
|
+
count?: number;
|
|
1783
|
+
/**
|
|
1784
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1785
|
+
*/
|
|
1786
|
+
blockMS?: number;
|
|
1787
|
+
}
|
|
1788
|
+
] : never : never : never;
|
|
1352
1789
|
/**
|
|
1353
1790
|
* @see https://redis.io/commands/xread
|
|
1354
1791
|
*/
|
|
@@ -1358,6 +1795,9 @@ declare class XReadCommand extends Command<number, unknown[]> {
|
|
|
1358
1795
|
|
|
1359
1796
|
type Options = {
|
|
1360
1797
|
count?: number;
|
|
1798
|
+
/**
|
|
1799
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1800
|
+
*/
|
|
1361
1801
|
blockMS?: number;
|
|
1362
1802
|
NOACK?: boolean;
|
|
1363
1803
|
};
|
|
@@ -1535,7 +1975,11 @@ declare class ZRemRangeByRankCommand extends Command<number, number> {
|
|
|
1535
1975
|
* @see https://redis.io/commands/zremrangebyscore
|
|
1536
1976
|
*/
|
|
1537
1977
|
declare class ZRemRangeByScoreCommand extends Command<number, number> {
|
|
1538
|
-
constructor(cmd: [
|
|
1978
|
+
constructor(cmd: [
|
|
1979
|
+
key: string,
|
|
1980
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
1981
|
+
max: number | `(${number}` | "-inf" | "+inf"
|
|
1982
|
+
], opts?: CommandOptions<number, number>);
|
|
1539
1983
|
}
|
|
1540
1984
|
|
|
1541
1985
|
/**
|
|
@@ -1549,13 +1993,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
|
|
|
1549
1993
|
* @see https://redis.io/commands/zscan
|
|
1550
1994
|
*/
|
|
1551
1995
|
declare class ZScanCommand extends Command<[
|
|
1552
|
-
|
|
1996
|
+
string,
|
|
1553
1997
|
(string | number)[]
|
|
1554
1998
|
], [
|
|
1555
|
-
|
|
1999
|
+
string,
|
|
1556
2000
|
(string | number)[]
|
|
1557
2001
|
]> {
|
|
1558
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
2002
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1559
2003
|
}
|
|
1560
2004
|
|
|
1561
2005
|
/**
|
|
@@ -1565,9 +2009,79 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1565
2009
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1566
2010
|
}
|
|
1567
2011
|
|
|
2012
|
+
type BaseMessageData<TMessage> = {
|
|
2013
|
+
channel: string;
|
|
2014
|
+
message: TMessage;
|
|
2015
|
+
};
|
|
2016
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
2017
|
+
pattern: string;
|
|
2018
|
+
};
|
|
2019
|
+
type SubscriptionCountEvent = number;
|
|
2020
|
+
type MessageEventMap<TMessage> = {
|
|
2021
|
+
message: BaseMessageData<TMessage>;
|
|
2022
|
+
subscribe: SubscriptionCountEvent;
|
|
2023
|
+
unsubscribe: SubscriptionCountEvent;
|
|
2024
|
+
pmessage: PatternMessageData<TMessage>;
|
|
2025
|
+
psubscribe: SubscriptionCountEvent;
|
|
2026
|
+
punsubscribe: SubscriptionCountEvent;
|
|
2027
|
+
error: Error;
|
|
2028
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
2029
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
2030
|
+
};
|
|
2031
|
+
type EventType = keyof MessageEventMap<any>;
|
|
2032
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
2033
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
2034
|
+
private subscriptions;
|
|
2035
|
+
private client;
|
|
2036
|
+
private listeners;
|
|
2037
|
+
private opts?;
|
|
2038
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean, opts?: Pick<RedisOptions, "automaticDeserialization">);
|
|
2039
|
+
private subscribeToChannel;
|
|
2040
|
+
private subscribeToPattern;
|
|
2041
|
+
private handleMessage;
|
|
2042
|
+
private dispatchToListeners;
|
|
2043
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
2044
|
+
removeAllListeners(): void;
|
|
2045
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
2046
|
+
getSubscribedChannels(): string[];
|
|
2047
|
+
}
|
|
2048
|
+
|
|
1568
2049
|
type InferResponseData<T extends unknown[]> = {
|
|
1569
2050
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1570
2051
|
};
|
|
2052
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
2053
|
+
/**
|
|
2054
|
+
* Send the pipeline request to upstash.
|
|
2055
|
+
*
|
|
2056
|
+
* Returns an array with the results of all pipelined commands.
|
|
2057
|
+
*
|
|
2058
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
2059
|
+
* ```ts
|
|
2060
|
+
* const p = redis.pipeline()
|
|
2061
|
+
* p.get("key")
|
|
2062
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
2063
|
+
* ```
|
|
2064
|
+
*
|
|
2065
|
+
* 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.
|
|
2066
|
+
*
|
|
2067
|
+
* 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 }`.
|
|
2068
|
+
*
|
|
2069
|
+
* ```ts
|
|
2070
|
+
* const p = redis.pipeline()
|
|
2071
|
+
* p.get("key")
|
|
2072
|
+
*
|
|
2073
|
+
* const result = await p.exec({ keepErrors: true });
|
|
2074
|
+
* const getResult = result[0].result
|
|
2075
|
+
* const getError = result[0].error
|
|
2076
|
+
* ```
|
|
2077
|
+
*/
|
|
2078
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
2079
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
2080
|
+
keepErrors: true;
|
|
2081
|
+
}): Promise<{
|
|
2082
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
2083
|
+
}>;
|
|
2084
|
+
}
|
|
1571
2085
|
/**
|
|
1572
2086
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1573
2087
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1616,19 +2130,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1616
2130
|
commandOptions?: CommandOptions<any, any>;
|
|
1617
2131
|
multiExec?: boolean;
|
|
1618
2132
|
});
|
|
1619
|
-
|
|
1620
|
-
* Send the pipeline request to upstash.
|
|
1621
|
-
*
|
|
1622
|
-
* Returns an array with the results of all pipelined commands.
|
|
1623
|
-
*
|
|
1624
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1625
|
-
* ```ts
|
|
1626
|
-
* const p = redis.pipeline()
|
|
1627
|
-
* p.get("key")
|
|
1628
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1629
|
-
* ```
|
|
1630
|
-
*/
|
|
1631
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
2133
|
+
exec: ExecMethod<TCommands>;
|
|
1632
2134
|
/**
|
|
1633
2135
|
* Returns the length of pipeline before the execution
|
|
1634
2136
|
*/
|
|
@@ -1646,17 +2148,40 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1646
2148
|
* @see https://redis.io/commands/bitcount
|
|
1647
2149
|
*/
|
|
1648
2150
|
bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2151
|
+
/**
|
|
2152
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
2153
|
+
*
|
|
2154
|
+
* @example
|
|
2155
|
+
* ```typescript
|
|
2156
|
+
* redis.set("mykey", 0);
|
|
2157
|
+
* const result = await redis.pipeline()
|
|
2158
|
+
* .bitfield("mykey")
|
|
2159
|
+
* .set("u4", 0, 16)
|
|
2160
|
+
* .incr("u4", "#1", 1)
|
|
2161
|
+
* .exec();
|
|
2162
|
+
* console.log(result); // [[0, 1]]
|
|
2163
|
+
* ```
|
|
2164
|
+
*
|
|
2165
|
+
* @see https://redis.io/commands/bitfield
|
|
2166
|
+
*/
|
|
2167
|
+
bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
|
|
1649
2168
|
/**
|
|
1650
2169
|
* @see https://redis.io/commands/bitop
|
|
1651
2170
|
*/
|
|
1652
2171
|
bitop: {
|
|
1653
2172
|
(op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>;
|
|
1654
2173
|
(op: "not", destinationKey: string, sourceKey: string): Pipeline<[...TCommands, BitOpCommand]>;
|
|
2174
|
+
(op: "diff" | "diff1" | "andor", destinationKey: string, x: string, ...y: string[]): Pipeline<[...TCommands, BitOpCommand]>;
|
|
2175
|
+
(op: "one", destinationKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>;
|
|
1655
2176
|
};
|
|
1656
2177
|
/**
|
|
1657
2178
|
* @see https://redis.io/commands/bitpos
|
|
1658
2179
|
*/
|
|
1659
2180
|
bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2181
|
+
/**
|
|
2182
|
+
* @see https://redis.io/commands/client-setinfo
|
|
2183
|
+
*/
|
|
2184
|
+
clientSetinfo: (attribute: ClientSetInfoAttribute, value: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
1660
2185
|
/**
|
|
1661
2186
|
* @see https://redis.io/commands/copy
|
|
1662
2187
|
*/
|
|
@@ -1687,10 +2212,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1687
2212
|
* @see https://redis.io/commands/echo
|
|
1688
2213
|
*/
|
|
1689
2214
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2215
|
+
/**
|
|
2216
|
+
* @see https://redis.io/commands/eval_ro
|
|
2217
|
+
*/
|
|
2218
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1690
2219
|
/**
|
|
1691
2220
|
* @see https://redis.io/commands/eval
|
|
1692
2221
|
*/
|
|
1693
2222
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2223
|
+
/**
|
|
2224
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
2225
|
+
*/
|
|
2226
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1694
2227
|
/**
|
|
1695
2228
|
* @see https://redis.io/commands/evalsha
|
|
1696
2229
|
*/
|
|
@@ -1702,11 +2235,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1702
2235
|
/**
|
|
1703
2236
|
* @see https://redis.io/commands/expire
|
|
1704
2237
|
*/
|
|
1705
|
-
expire: (key: string, seconds: number, option?:
|
|
2238
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1706
2239
|
/**
|
|
1707
2240
|
* @see https://redis.io/commands/expireat
|
|
1708
2241
|
*/
|
|
1709
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2242
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1710
2243
|
/**
|
|
1711
2244
|
* @see https://redis.io/commands/flushall
|
|
1712
2245
|
*/
|
|
@@ -1715,7 +2248,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1715
2248
|
* @see https://redis.io/commands/flushdb
|
|
1716
2249
|
*/
|
|
1717
2250
|
flushdb: (opts?: {
|
|
1718
|
-
async?: boolean
|
|
2251
|
+
async?: boolean;
|
|
1719
2252
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1720
2253
|
/**
|
|
1721
2254
|
* @see https://redis.io/commands/geoadd
|
|
@@ -1762,11 +2295,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1762
2295
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1763
2296
|
count?: {
|
|
1764
2297
|
limit: number;
|
|
1765
|
-
any?: boolean
|
|
1766
|
-
}
|
|
1767
|
-
withCoord?: boolean
|
|
1768
|
-
withDist?: boolean
|
|
1769
|
-
withHash?: boolean
|
|
2298
|
+
any?: boolean;
|
|
2299
|
+
};
|
|
2300
|
+
withCoord?: boolean;
|
|
2301
|
+
withDist?: boolean;
|
|
2302
|
+
withHash?: boolean;
|
|
1770
2303
|
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
1771
2304
|
member: TData;
|
|
1772
2305
|
} & {
|
|
@@ -1803,38 +2336,114 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1803
2336
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1804
2337
|
count?: {
|
|
1805
2338
|
limit: number;
|
|
1806
|
-
any?: boolean
|
|
1807
|
-
}
|
|
1808
|
-
storeDist?: boolean
|
|
2339
|
+
any?: boolean;
|
|
2340
|
+
};
|
|
2341
|
+
storeDist?: boolean;
|
|
1809
2342
|
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1810
2343
|
/**
|
|
1811
|
-
* @see https://redis.io/commands/get
|
|
2344
|
+
* @see https://redis.io/commands/get
|
|
2345
|
+
*/
|
|
2346
|
+
get: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2347
|
+
/**
|
|
2348
|
+
* @see https://redis.io/commands/getbit
|
|
2349
|
+
*/
|
|
2350
|
+
getbit: (key: string, offset: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2351
|
+
/**
|
|
2352
|
+
* @see https://redis.io/commands/getdel
|
|
2353
|
+
*/
|
|
2354
|
+
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2355
|
+
/**
|
|
2356
|
+
* @see https://redis.io/commands/getex
|
|
2357
|
+
*/
|
|
2358
|
+
getex: <TData>(key: string, opts?: ({
|
|
2359
|
+
ex: number;
|
|
2360
|
+
px?: never;
|
|
2361
|
+
exat?: never;
|
|
2362
|
+
pxat?: never;
|
|
2363
|
+
persist?: never;
|
|
2364
|
+
} | {
|
|
2365
|
+
ex?: never;
|
|
2366
|
+
px: number;
|
|
2367
|
+
exat?: never;
|
|
2368
|
+
pxat?: never;
|
|
2369
|
+
persist?: never;
|
|
2370
|
+
} | {
|
|
2371
|
+
ex?: never;
|
|
2372
|
+
px?: never;
|
|
2373
|
+
exat: number;
|
|
2374
|
+
pxat?: never;
|
|
2375
|
+
persist?: never;
|
|
2376
|
+
} | {
|
|
2377
|
+
ex?: never;
|
|
2378
|
+
px?: never;
|
|
2379
|
+
exat?: never;
|
|
2380
|
+
pxat: number;
|
|
2381
|
+
persist?: never;
|
|
2382
|
+
} | {
|
|
2383
|
+
ex?: never;
|
|
2384
|
+
px?: never;
|
|
2385
|
+
exat?: never;
|
|
2386
|
+
pxat?: never;
|
|
2387
|
+
persist: true;
|
|
2388
|
+
} | {
|
|
2389
|
+
ex?: never;
|
|
2390
|
+
px?: never;
|
|
2391
|
+
exat?: never;
|
|
2392
|
+
pxat?: never;
|
|
2393
|
+
persist?: never;
|
|
2394
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2395
|
+
/**
|
|
2396
|
+
* @see https://redis.io/commands/getrange
|
|
2397
|
+
*/
|
|
2398
|
+
getrange: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2399
|
+
/**
|
|
2400
|
+
* @see https://redis.io/commands/getset
|
|
2401
|
+
*/
|
|
2402
|
+
getset: <TData>(key: string, value: TData) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2403
|
+
/**
|
|
2404
|
+
* @see https://redis.io/commands/hdel
|
|
2405
|
+
*/
|
|
2406
|
+
hdel: (key: string, ...fields: string[]) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2407
|
+
/**
|
|
2408
|
+
* @see https://redis.io/commands/hexists
|
|
2409
|
+
*/
|
|
2410
|
+
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2411
|
+
/**
|
|
2412
|
+
* @see https://redis.io/commands/hexpire
|
|
2413
|
+
*/
|
|
2414
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2415
|
+
/**
|
|
2416
|
+
* @see https://redis.io/commands/hexpireat
|
|
1812
2417
|
*/
|
|
1813
|
-
|
|
2418
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
1814
2419
|
/**
|
|
1815
|
-
* @see https://redis.io/commands/
|
|
2420
|
+
* @see https://redis.io/commands/hexpiretime
|
|
1816
2421
|
*/
|
|
1817
|
-
|
|
2422
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
1818
2423
|
/**
|
|
1819
|
-
* @see https://redis.io/commands/
|
|
2424
|
+
* @see https://redis.io/commands/httl
|
|
1820
2425
|
*/
|
|
1821
|
-
|
|
2426
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
1822
2427
|
/**
|
|
1823
|
-
* @see https://redis.io/commands/
|
|
2428
|
+
* @see https://redis.io/commands/hpexpire
|
|
1824
2429
|
*/
|
|
1825
|
-
|
|
2430
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
1826
2431
|
/**
|
|
1827
|
-
* @see https://redis.io/commands/
|
|
2432
|
+
* @see https://redis.io/commands/hpexpireat
|
|
1828
2433
|
*/
|
|
1829
|
-
|
|
2434
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
1830
2435
|
/**
|
|
1831
|
-
* @see https://redis.io/commands/
|
|
2436
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
1832
2437
|
*/
|
|
1833
|
-
|
|
2438
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
1834
2439
|
/**
|
|
1835
|
-
* @see https://redis.io/commands/
|
|
2440
|
+
* @see https://redis.io/commands/hpttl
|
|
1836
2441
|
*/
|
|
1837
|
-
|
|
2442
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2443
|
+
/**
|
|
2444
|
+
* @see https://redis.io/commands/hpersist
|
|
2445
|
+
*/
|
|
2446
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
1838
2447
|
/**
|
|
1839
2448
|
* @see https://redis.io/commands/hget
|
|
1840
2449
|
*/
|
|
@@ -1843,6 +2452,44 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1843
2452
|
* @see https://redis.io/commands/hgetall
|
|
1844
2453
|
*/
|
|
1845
2454
|
hgetall: <TData extends Record<string, unknown>>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2455
|
+
/**
|
|
2456
|
+
* @see https://redis.io/commands/hgetdel
|
|
2457
|
+
*/
|
|
2458
|
+
hgetdel: <TData extends Record<string, unknown>>(key: string, ...fields: (string | number)[]) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2459
|
+
/**
|
|
2460
|
+
* @see https://redis.io/commands/hgetex
|
|
2461
|
+
*/
|
|
2462
|
+
hgetex: <TData extends Record<string, unknown>>(key: string, opts: {
|
|
2463
|
+
ex: number;
|
|
2464
|
+
px?: never;
|
|
2465
|
+
exat?: never;
|
|
2466
|
+
pxat?: never;
|
|
2467
|
+
persist?: never;
|
|
2468
|
+
} | {
|
|
2469
|
+
ex?: never;
|
|
2470
|
+
px: number;
|
|
2471
|
+
exat?: never;
|
|
2472
|
+
pxat?: never;
|
|
2473
|
+
persist?: never;
|
|
2474
|
+
} | {
|
|
2475
|
+
ex?: never;
|
|
2476
|
+
px?: never;
|
|
2477
|
+
exat: number;
|
|
2478
|
+
pxat?: never;
|
|
2479
|
+
persist?: never;
|
|
2480
|
+
} | {
|
|
2481
|
+
ex?: never;
|
|
2482
|
+
px?: never;
|
|
2483
|
+
exat?: never;
|
|
2484
|
+
pxat: number;
|
|
2485
|
+
persist?: never;
|
|
2486
|
+
} | {
|
|
2487
|
+
ex?: never;
|
|
2488
|
+
px?: never;
|
|
2489
|
+
exat?: never;
|
|
2490
|
+
pxat?: never;
|
|
2491
|
+
persist: true;
|
|
2492
|
+
}, ...fields: (string | number)[]) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1846
2493
|
/**
|
|
1847
2494
|
* @see https://redis.io/commands/hincrby
|
|
1848
2495
|
*/
|
|
@@ -1866,9 +2513,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1866
2513
|
/**
|
|
1867
2514
|
* @see https://redis.io/commands/hmset
|
|
1868
2515
|
*/
|
|
1869
|
-
hmset: <TData>(key: string, kv:
|
|
1870
|
-
[field: string]: TData;
|
|
1871
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2516
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1872
2517
|
/**
|
|
1873
2518
|
* @see https://redis.io/commands/hrandfield
|
|
1874
2519
|
*/
|
|
@@ -1876,13 +2521,54 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1876
2521
|
/**
|
|
1877
2522
|
* @see https://redis.io/commands/hscan
|
|
1878
2523
|
*/
|
|
1879
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2524
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
1880
2525
|
/**
|
|
1881
2526
|
* @see https://redis.io/commands/hset
|
|
1882
2527
|
*/
|
|
1883
|
-
hset: <TData>(key: string, kv:
|
|
1884
|
-
|
|
1885
|
-
|
|
2528
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2529
|
+
/**
|
|
2530
|
+
* @see https://redis.io/commands/hsetex
|
|
2531
|
+
*/
|
|
2532
|
+
hsetex: <TData>(key: string, opts: {
|
|
2533
|
+
conditional?: "FNX" | "fnx" | "FXX" | "fxx";
|
|
2534
|
+
expiration?: {
|
|
2535
|
+
ex: number;
|
|
2536
|
+
px?: never;
|
|
2537
|
+
exat?: never;
|
|
2538
|
+
pxat?: never;
|
|
2539
|
+
keepttl?: never;
|
|
2540
|
+
} | {
|
|
2541
|
+
ex?: never;
|
|
2542
|
+
px: number;
|
|
2543
|
+
exat?: never;
|
|
2544
|
+
pxat?: never;
|
|
2545
|
+
keepttl?: never;
|
|
2546
|
+
} | {
|
|
2547
|
+
ex?: never;
|
|
2548
|
+
px?: never;
|
|
2549
|
+
exat: number;
|
|
2550
|
+
pxat?: never;
|
|
2551
|
+
keepttl?: never;
|
|
2552
|
+
} | {
|
|
2553
|
+
ex?: never;
|
|
2554
|
+
px?: never;
|
|
2555
|
+
exat?: never;
|
|
2556
|
+
pxat: number;
|
|
2557
|
+
keepttl?: never;
|
|
2558
|
+
} | {
|
|
2559
|
+
ex?: never;
|
|
2560
|
+
px?: never;
|
|
2561
|
+
exat?: never;
|
|
2562
|
+
pxat?: never;
|
|
2563
|
+
keepttl: true;
|
|
2564
|
+
} | {
|
|
2565
|
+
ex?: never;
|
|
2566
|
+
px?: never;
|
|
2567
|
+
exat?: never;
|
|
2568
|
+
pxat?: never;
|
|
2569
|
+
keepttl?: never;
|
|
2570
|
+
};
|
|
2571
|
+
}, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1886
2572
|
/**
|
|
1887
2573
|
* @see https://redis.io/commands/hsetnx
|
|
1888
2574
|
*/
|
|
@@ -1931,13 +2617,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1931
2617
|
* @see https://redis.io/commands/lpop
|
|
1932
2618
|
*/
|
|
1933
2619
|
lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2620
|
+
/**
|
|
2621
|
+
* @see https://redis.io/commands/lmpop
|
|
2622
|
+
*/
|
|
2623
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
|
|
1934
2624
|
/**
|
|
1935
2625
|
* @see https://redis.io/commands/lpos
|
|
1936
2626
|
*/
|
|
1937
2627
|
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
1938
|
-
rank?: number
|
|
1939
|
-
count?: number
|
|
1940
|
-
maxLen?: number
|
|
2628
|
+
rank?: number;
|
|
2629
|
+
count?: number;
|
|
2630
|
+
maxLen?: number;
|
|
1941
2631
|
} | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1942
2632
|
/**
|
|
1943
2633
|
* @see https://redis.io/commands/lpush
|
|
@@ -1970,15 +2660,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1970
2660
|
/**
|
|
1971
2661
|
* @see https://redis.io/commands/mset
|
|
1972
2662
|
*/
|
|
1973
|
-
mset: <TData>(kv:
|
|
1974
|
-
[key: string]: TData;
|
|
1975
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2663
|
+
mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1976
2664
|
/**
|
|
1977
2665
|
* @see https://redis.io/commands/msetnx
|
|
1978
2666
|
*/
|
|
1979
|
-
msetnx: <TData>(kv:
|
|
1980
|
-
[key: string]: TData;
|
|
1981
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2667
|
+
msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1982
2668
|
/**
|
|
1983
2669
|
* @see https://redis.io/commands/persist
|
|
1984
2670
|
*/
|
|
@@ -1986,11 +2672,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1986
2672
|
/**
|
|
1987
2673
|
* @see https://redis.io/commands/pexpire
|
|
1988
2674
|
*/
|
|
1989
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2675
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1990
2676
|
/**
|
|
1991
2677
|
* @see https://redis.io/commands/pexpireat
|
|
1992
2678
|
*/
|
|
1993
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2679
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1994
2680
|
/**
|
|
1995
2681
|
* @see https://redis.io/commands/pfadd
|
|
1996
2682
|
*/
|
|
@@ -2046,11 +2732,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2046
2732
|
/**
|
|
2047
2733
|
* @see https://redis.io/commands/sadd
|
|
2048
2734
|
*/
|
|
2049
|
-
sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2735
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2050
2736
|
/**
|
|
2051
2737
|
* @see https://redis.io/commands/scan
|
|
2052
2738
|
*/
|
|
2053
|
-
scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2739
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2054
2740
|
/**
|
|
2055
2741
|
* @see https://redis.io/commands/scard
|
|
2056
2742
|
*/
|
|
@@ -2131,7 +2817,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2131
2817
|
/**
|
|
2132
2818
|
* @see https://redis.io/commands/sscan
|
|
2133
2819
|
*/
|
|
2134
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2820
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2135
2821
|
/**
|
|
2136
2822
|
* @see https://redis.io/commands/strlen
|
|
2137
2823
|
*/
|
|
@@ -2167,19 +2853,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2167
2853
|
/**
|
|
2168
2854
|
* @see https://redis.io/commands/zadd
|
|
2169
2855
|
*/
|
|
2170
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
|
|
2171
|
-
key: string,
|
|
2172
|
-
opts: ZAddCommandOptions,
|
|
2173
|
-
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
|
|
2174
|
-
]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2856
|
+
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>]>;
|
|
2175
2857
|
/**
|
|
2176
2858
|
* @see https://redis.io/commands/xadd
|
|
2177
2859
|
*/
|
|
2178
|
-
xadd: (key: string, id: string, entries: {
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
nomkStream?: boolean | undefined;
|
|
2182
|
-
trim?: (({
|
|
2860
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
2861
|
+
nomkStream?: boolean;
|
|
2862
|
+
trim?: ({
|
|
2183
2863
|
type: "MAXLEN" | "maxlen";
|
|
2184
2864
|
threshold: number;
|
|
2185
2865
|
} | {
|
|
@@ -2187,31 +2867,39 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2187
2867
|
threshold: string;
|
|
2188
2868
|
}) & ({
|
|
2189
2869
|
comparison: "~";
|
|
2190
|
-
limit?: number
|
|
2870
|
+
limit?: number;
|
|
2191
2871
|
} | {
|
|
2192
2872
|
comparison: "=";
|
|
2193
|
-
limit?:
|
|
2194
|
-
})
|
|
2873
|
+
limit?: never;
|
|
2874
|
+
});
|
|
2195
2875
|
} | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2196
2876
|
/**
|
|
2197
2877
|
* @see https://redis.io/commands/xack
|
|
2198
2878
|
*/
|
|
2199
2879
|
xack: (key: string, group: string, id: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2880
|
+
/**
|
|
2881
|
+
* @see https://redis.io/commands/xackdel
|
|
2882
|
+
*/
|
|
2883
|
+
xackdel: (key: string, group: string, opts: "KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked", ...ids: string[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2200
2884
|
/**
|
|
2201
2885
|
* @see https://redis.io/commands/xdel
|
|
2202
2886
|
*/
|
|
2203
2887
|
xdel: (key: string, ids: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2888
|
+
/**
|
|
2889
|
+
* @see https://redis.io/commands/xdelex
|
|
2890
|
+
*/
|
|
2891
|
+
xdelex: (key: string, opts?: ("KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked") | undefined, ...ids: string[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2204
2892
|
/**
|
|
2205
2893
|
* @see https://redis.io/commands/xgroup
|
|
2206
2894
|
*/
|
|
2207
2895
|
xgroup: (key: string, opts: {
|
|
2208
2896
|
type: "CREATE";
|
|
2209
2897
|
group: string;
|
|
2210
|
-
id: string;
|
|
2898
|
+
id: `$` | string;
|
|
2211
2899
|
options?: {
|
|
2212
|
-
MKSTREAM?: boolean
|
|
2213
|
-
ENTRIESREAD?: number
|
|
2214
|
-
}
|
|
2900
|
+
MKSTREAM?: boolean;
|
|
2901
|
+
ENTRIESREAD?: number;
|
|
2902
|
+
};
|
|
2215
2903
|
} | {
|
|
2216
2904
|
type: "CREATECONSUMER";
|
|
2217
2905
|
group: string;
|
|
@@ -2226,10 +2914,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2226
2914
|
} | {
|
|
2227
2915
|
type: "SETID";
|
|
2228
2916
|
group: string;
|
|
2229
|
-
id: string;
|
|
2917
|
+
id: `$` | string;
|
|
2230
2918
|
options?: {
|
|
2231
|
-
ENTRIESREAD?: number
|
|
2232
|
-
}
|
|
2919
|
+
ENTRIESREAD?: number;
|
|
2920
|
+
};
|
|
2233
2921
|
}) => Pipeline<[...TCommands, Command<any, never>]>;
|
|
2234
2922
|
/**
|
|
2235
2923
|
* @see https://redis.io/commands/xread
|
|
@@ -2256,35 +2944,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2256
2944
|
* @see https://redis.io/commands/xpending
|
|
2257
2945
|
*/
|
|
2258
2946
|
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
2259
|
-
idleTime?: number
|
|
2260
|
-
consumer?: string | string[]
|
|
2947
|
+
idleTime?: number;
|
|
2948
|
+
consumer?: string | string[];
|
|
2261
2949
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2262
2950
|
/**
|
|
2263
2951
|
* @see https://redis.io/commands/xclaim
|
|
2264
2952
|
*/
|
|
2265
2953
|
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
2266
|
-
idleMS?: number
|
|
2267
|
-
timeMS?: number
|
|
2268
|
-
retryCount?: number
|
|
2269
|
-
force?: boolean
|
|
2270
|
-
justId?: boolean
|
|
2271
|
-
lastId?: number
|
|
2954
|
+
idleMS?: number;
|
|
2955
|
+
timeMS?: number;
|
|
2956
|
+
retryCount?: number;
|
|
2957
|
+
force?: boolean;
|
|
2958
|
+
justId?: boolean;
|
|
2959
|
+
lastId?: number;
|
|
2272
2960
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2273
2961
|
/**
|
|
2274
2962
|
* @see https://redis.io/commands/xautoclaim
|
|
2275
2963
|
*/
|
|
2276
2964
|
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
2277
|
-
count?: number
|
|
2278
|
-
justId?: boolean
|
|
2965
|
+
count?: number;
|
|
2966
|
+
justId?: boolean;
|
|
2279
2967
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2280
2968
|
/**
|
|
2281
2969
|
* @see https://redis.io/commands/xtrim
|
|
2282
2970
|
*/
|
|
2283
2971
|
xtrim: (key: string, options: {
|
|
2284
2972
|
strategy: "MAXLEN" | "MINID";
|
|
2285
|
-
exactness?: "~" | "="
|
|
2286
|
-
threshold:
|
|
2287
|
-
limit?: number
|
|
2973
|
+
exactness?: "~" | "=";
|
|
2974
|
+
threshold: number | string;
|
|
2975
|
+
limit?: number;
|
|
2288
2976
|
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2289
2977
|
/**
|
|
2290
2978
|
* @see https://redis.io/commands/xrange
|
|
@@ -2329,21 +3017,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2329
3017
|
/**
|
|
2330
3018
|
* @see https://redis.io/commands/zrange
|
|
2331
3019
|
*/
|
|
2332
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
byLex: true;
|
|
2338
|
-
} & ZRangeCommandOptions
|
|
2339
|
-
] | [
|
|
2340
|
-
key: string,
|
|
2341
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
2342
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
2343
|
-
opts: {
|
|
2344
|
-
byScore: true;
|
|
2345
|
-
} & ZRangeCommandOptions
|
|
2346
|
-
]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
3020
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
3021
|
+
byLex: true;
|
|
3022
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
3023
|
+
byScore: true;
|
|
3024
|
+
} & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2347
3025
|
/**
|
|
2348
3026
|
* @see https://redis.io/commands/zrank
|
|
2349
3027
|
*/
|
|
@@ -2363,7 +3041,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2363
3041
|
/**
|
|
2364
3042
|
* @see https://redis.io/commands/zremrangebyscore
|
|
2365
3043
|
*/
|
|
2366
|
-
zremrangebyscore: (key: string, min: number, max: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
3044
|
+
zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2367
3045
|
/**
|
|
2368
3046
|
* @see https://redis.io/commands/zrevrank
|
|
2369
3047
|
*/
|
|
@@ -2371,7 +3049,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2371
3049
|
/**
|
|
2372
3050
|
* @see https://redis.io/commands/zscan
|
|
2373
3051
|
*/
|
|
2374
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
3052
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2375
3053
|
/**
|
|
2376
3054
|
* @see https://redis.io/commands/zscore
|
|
2377
3055
|
*/
|
|
@@ -2428,10 +3106,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2428
3106
|
* @see https://redis.io/commands/json.get
|
|
2429
3107
|
*/
|
|
2430
3108
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
3109
|
+
/**
|
|
3110
|
+
* @see https://redis.io/commands/json.merge
|
|
3111
|
+
*/
|
|
3112
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2431
3113
|
/**
|
|
2432
3114
|
* @see https://redis.io/commands/json.mget
|
|
2433
3115
|
*/
|
|
2434
3116
|
mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
3117
|
+
/**
|
|
3118
|
+
* @see https://redis.io/commands/json.mset
|
|
3119
|
+
*/
|
|
3120
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2435
3121
|
/**
|
|
2436
3122
|
* @see https://redis.io/commands/json.numincrby
|
|
2437
3123
|
*/
|
|
@@ -2457,9 +3143,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2457
3143
|
*/
|
|
2458
3144
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2459
3145
|
nx: true;
|
|
2460
|
-
xx?:
|
|
3146
|
+
xx?: never;
|
|
2461
3147
|
} | {
|
|
2462
|
-
nx?:
|
|
3148
|
+
nx?: never;
|
|
2463
3149
|
xx: true;
|
|
2464
3150
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2465
3151
|
/**
|
|
@@ -2479,6 +3165,52 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2479
3165
|
*/
|
|
2480
3166
|
type: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, string[]>]>;
|
|
2481
3167
|
};
|
|
3168
|
+
get functions(): {
|
|
3169
|
+
/**
|
|
3170
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
3171
|
+
*/
|
|
3172
|
+
load: (args: FunctionLoadArgs) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
3173
|
+
/**
|
|
3174
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
3175
|
+
*/
|
|
3176
|
+
list: (args?: FunctionListArgs | undefined) => Pipeline<[...TCommands, Command<any, {
|
|
3177
|
+
libraryName: string;
|
|
3178
|
+
engine: string;
|
|
3179
|
+
functions: {
|
|
3180
|
+
name: string;
|
|
3181
|
+
description?: string;
|
|
3182
|
+
flags: string[];
|
|
3183
|
+
}[];
|
|
3184
|
+
libraryCode?: string;
|
|
3185
|
+
}[]>]>;
|
|
3186
|
+
/**
|
|
3187
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
3188
|
+
*/
|
|
3189
|
+
delete: (libraryName: string) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
3190
|
+
/**
|
|
3191
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
3192
|
+
*/
|
|
3193
|
+
flush: () => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
3194
|
+
/**
|
|
3195
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
3196
|
+
*/
|
|
3197
|
+
stats: () => Pipeline<[...TCommands, Command<any, {
|
|
3198
|
+
engines: {
|
|
3199
|
+
[k: string]: {
|
|
3200
|
+
librariesCount: unknown;
|
|
3201
|
+
functionsCount: unknown;
|
|
3202
|
+
};
|
|
3203
|
+
};
|
|
3204
|
+
}>]>;
|
|
3205
|
+
/**
|
|
3206
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
3207
|
+
*/
|
|
3208
|
+
call: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
3209
|
+
/**
|
|
3210
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
3211
|
+
*/
|
|
3212
|
+
callRo: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
3213
|
+
};
|
|
2482
3214
|
}
|
|
2483
3215
|
|
|
2484
3216
|
/**
|
|
@@ -2499,9 +3231,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2499
3231
|
*/
|
|
2500
3232
|
declare class Script<TResult = unknown> {
|
|
2501
3233
|
readonly script: string;
|
|
2502
|
-
|
|
3234
|
+
/**
|
|
3235
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
3236
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
3237
|
+
*
|
|
3238
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
3239
|
+
* future major release.
|
|
3240
|
+
*/
|
|
3241
|
+
sha1: string;
|
|
2503
3242
|
private readonly redis;
|
|
2504
3243
|
constructor(redis: Redis, script: string);
|
|
3244
|
+
/**
|
|
3245
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
3246
|
+
*/
|
|
3247
|
+
private init;
|
|
2505
3248
|
/**
|
|
2506
3249
|
* Send an `EVAL` command to redis.
|
|
2507
3250
|
*/
|
|
@@ -2523,6 +3266,56 @@ declare class Script<TResult = unknown> {
|
|
|
2523
3266
|
private digest;
|
|
2524
3267
|
}
|
|
2525
3268
|
|
|
3269
|
+
/**
|
|
3270
|
+
* Creates a new script.
|
|
3271
|
+
*
|
|
3272
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3273
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3274
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3275
|
+
*
|
|
3276
|
+
* @example
|
|
3277
|
+
* ```ts
|
|
3278
|
+
* const redis = new Redis({...})
|
|
3279
|
+
*
|
|
3280
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
3281
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3282
|
+
* expect(arg1, "Hello World")
|
|
3283
|
+
* ```
|
|
3284
|
+
*/
|
|
3285
|
+
declare class ScriptRO<TResult = unknown> {
|
|
3286
|
+
readonly script: string;
|
|
3287
|
+
/**
|
|
3288
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
3289
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
3290
|
+
*
|
|
3291
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
3292
|
+
* future major release.
|
|
3293
|
+
*/
|
|
3294
|
+
sha1: string;
|
|
3295
|
+
private readonly redis;
|
|
3296
|
+
constructor(redis: Redis, script: string);
|
|
3297
|
+
private init;
|
|
3298
|
+
/**
|
|
3299
|
+
* Send an `EVAL_RO` command to redis.
|
|
3300
|
+
*/
|
|
3301
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
3304
|
+
*/
|
|
3305
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
3306
|
+
/**
|
|
3307
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
3308
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
3309
|
+
*
|
|
3310
|
+
* Following calls will be able to use the cached script
|
|
3311
|
+
*/
|
|
3312
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
3313
|
+
/**
|
|
3314
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
3315
|
+
*/
|
|
3316
|
+
private digest;
|
|
3317
|
+
}
|
|
3318
|
+
|
|
2526
3319
|
/**
|
|
2527
3320
|
* Serverless redis client for upstash.
|
|
2528
3321
|
*/
|
|
@@ -2530,6 +3323,7 @@ declare class Redis {
|
|
|
2530
3323
|
protected client: Requester;
|
|
2531
3324
|
protected opts?: CommandOptions<any, any>;
|
|
2532
3325
|
protected enableTelemetry: boolean;
|
|
3326
|
+
protected enableAutoPipelining: boolean;
|
|
2533
3327
|
/**
|
|
2534
3328
|
* Create a new redis client
|
|
2535
3329
|
*
|
|
@@ -2542,6 +3336,8 @@ declare class Redis {
|
|
|
2542
3336
|
* ```
|
|
2543
3337
|
*/
|
|
2544
3338
|
constructor(client: Requester, opts?: RedisOptions);
|
|
3339
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
3340
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2545
3341
|
get json(): {
|
|
2546
3342
|
/**
|
|
2547
3343
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2583,10 +3379,18 @@ declare class Redis {
|
|
|
2583
3379
|
* @see https://redis.io/commands/json.get
|
|
2584
3380
|
*/
|
|
2585
3381
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3382
|
+
/**
|
|
3383
|
+
* @see https://redis.io/commands/json.merge
|
|
3384
|
+
*/
|
|
3385
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2586
3386
|
/**
|
|
2587
3387
|
* @see https://redis.io/commands/json.mget
|
|
2588
3388
|
*/
|
|
2589
|
-
mget: <
|
|
3389
|
+
mget: <TData>(keys: string[], path: string) => Promise<TData>;
|
|
3390
|
+
/**
|
|
3391
|
+
* @see https://redis.io/commands/json.mset
|
|
3392
|
+
*/
|
|
3393
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
|
|
2590
3394
|
/**
|
|
2591
3395
|
* @see https://redis.io/commands/json.numincrby
|
|
2592
3396
|
*/
|
|
@@ -2612,9 +3416,9 @@ declare class Redis {
|
|
|
2612
3416
|
*/
|
|
2613
3417
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2614
3418
|
nx: true;
|
|
2615
|
-
xx?:
|
|
3419
|
+
xx?: never;
|
|
2616
3420
|
} | {
|
|
2617
|
-
nx?:
|
|
3421
|
+
nx?: never;
|
|
2618
3422
|
xx: true;
|
|
2619
3423
|
} | undefined) => Promise<"OK" | null>;
|
|
2620
3424
|
/**
|
|
@@ -2634,6 +3438,54 @@ declare class Redis {
|
|
|
2634
3438
|
*/
|
|
2635
3439
|
type: (key: string, path?: string | undefined) => Promise<string[]>;
|
|
2636
3440
|
};
|
|
3441
|
+
get functions(): {
|
|
3442
|
+
/**
|
|
3443
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
3444
|
+
*/
|
|
3445
|
+
load: (args: FunctionLoadArgs) => Promise<string>;
|
|
3446
|
+
/**
|
|
3447
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
3448
|
+
*/
|
|
3449
|
+
list: (args?: FunctionListArgs | undefined) => Promise<{
|
|
3450
|
+
libraryName: string;
|
|
3451
|
+
engine: string;
|
|
3452
|
+
functions: {
|
|
3453
|
+
name: string;
|
|
3454
|
+
description?: string;
|
|
3455
|
+
flags: string[];
|
|
3456
|
+
}[];
|
|
3457
|
+
libraryCode?: string;
|
|
3458
|
+
}[]>;
|
|
3459
|
+
/**
|
|
3460
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
3461
|
+
*/
|
|
3462
|
+
delete: (libraryName: string) => Promise<"OK">;
|
|
3463
|
+
/**
|
|
3464
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
3465
|
+
*/
|
|
3466
|
+
flush: () => Promise<"OK">;
|
|
3467
|
+
/**
|
|
3468
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
3469
|
+
*
|
|
3470
|
+
* Note: `running_script` field is not supported and therefore not included in the type.
|
|
3471
|
+
*/
|
|
3472
|
+
stats: () => Promise<{
|
|
3473
|
+
engines: {
|
|
3474
|
+
[k: string]: {
|
|
3475
|
+
librariesCount: unknown;
|
|
3476
|
+
functionsCount: unknown;
|
|
3477
|
+
};
|
|
3478
|
+
};
|
|
3479
|
+
}>;
|
|
3480
|
+
/**
|
|
3481
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
3482
|
+
*/
|
|
3483
|
+
call: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise<TData>;
|
|
3484
|
+
/**
|
|
3485
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
3486
|
+
*/
|
|
3487
|
+
callRo: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise<TData>;
|
|
3488
|
+
};
|
|
2637
3489
|
/**
|
|
2638
3490
|
* Wrap a new middleware around the HTTP client.
|
|
2639
3491
|
*/
|
|
@@ -2642,13 +3494,44 @@ declare class Redis {
|
|
|
2642
3494
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2643
3495
|
*/
|
|
2644
3496
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2645
|
-
|
|
3497
|
+
/**
|
|
3498
|
+
* Creates a new script.
|
|
3499
|
+
*
|
|
3500
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3501
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3502
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3503
|
+
*
|
|
3504
|
+
* @param script - The script to create
|
|
3505
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3506
|
+
* @returns A new script
|
|
3507
|
+
*
|
|
3508
|
+
* @example
|
|
3509
|
+
* ```ts
|
|
3510
|
+
* const redis = new Redis({...})
|
|
3511
|
+
*
|
|
3512
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3513
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3514
|
+
* expect(arg1, "Hello World")
|
|
3515
|
+
* ```
|
|
3516
|
+
* @example
|
|
3517
|
+
* ```ts
|
|
3518
|
+
* const redis = new Redis({...})
|
|
3519
|
+
*
|
|
3520
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3521
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3522
|
+
* expect(arg1, "Hello World")
|
|
3523
|
+
* ```
|
|
3524
|
+
*/
|
|
3525
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3526
|
+
readonly?: TReadonly;
|
|
3527
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2646
3528
|
/**
|
|
2647
3529
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2648
3530
|
*
|
|
2649
3531
|
* @see {@link Pipeline}
|
|
2650
3532
|
*/
|
|
2651
3533
|
pipeline: () => Pipeline<[]>;
|
|
3534
|
+
protected autoPipeline: () => Redis;
|
|
2652
3535
|
/**
|
|
2653
3536
|
* Create a new transaction to allow executing multiple steps atomically.
|
|
2654
3537
|
*
|
|
@@ -2659,6 +3542,22 @@ declare class Redis {
|
|
|
2659
3542
|
* @see {@link Pipeline}
|
|
2660
3543
|
*/
|
|
2661
3544
|
multi: () => Pipeline<[]>;
|
|
3545
|
+
/**
|
|
3546
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
3547
|
+
*
|
|
3548
|
+
* @example
|
|
3549
|
+
* ```typescript
|
|
3550
|
+
* redis.set("mykey", 0);
|
|
3551
|
+
* const result = await redis.bitfield("mykey")
|
|
3552
|
+
* .set("u4", 0, 16)
|
|
3553
|
+
* .incr("u4", "#1", 1)
|
|
3554
|
+
* .exec();
|
|
3555
|
+
* console.log(result); // [0, 1]
|
|
3556
|
+
* ```
|
|
3557
|
+
*
|
|
3558
|
+
* @see https://redis.io/commands/bitfield
|
|
3559
|
+
*/
|
|
3560
|
+
bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
|
|
2662
3561
|
/**
|
|
2663
3562
|
* @see https://redis.io/commands/append
|
|
2664
3563
|
*/
|
|
@@ -2673,11 +3572,17 @@ declare class Redis {
|
|
|
2673
3572
|
bitop: {
|
|
2674
3573
|
(op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Promise<number>;
|
|
2675
3574
|
(op: "not", destinationKey: string, sourceKey: string): Promise<number>;
|
|
3575
|
+
(op: "diff" | "diff1" | "andor", destinationKey: string, x: string, ...y: string[]): Promise<number>;
|
|
3576
|
+
(op: "one", destinationKey: string, ...sourceKeys: string[]): Promise<number>;
|
|
2676
3577
|
};
|
|
2677
3578
|
/**
|
|
2678
3579
|
* @see https://redis.io/commands/bitpos
|
|
2679
3580
|
*/
|
|
2680
3581
|
bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Promise<number>;
|
|
3582
|
+
/**
|
|
3583
|
+
* @see https://redis.io/commands/client-setinfo
|
|
3584
|
+
*/
|
|
3585
|
+
clientSetinfo: (attribute: ClientSetInfoAttribute, value: string) => Promise<string>;
|
|
2681
3586
|
/**
|
|
2682
3587
|
* @see https://redis.io/commands/copy
|
|
2683
3588
|
*/
|
|
@@ -2704,14 +3609,26 @@ declare class Redis {
|
|
|
2704
3609
|
* @see https://redis.io/commands/echo
|
|
2705
3610
|
*/
|
|
2706
3611
|
echo: (message: string) => Promise<string>;
|
|
3612
|
+
/**
|
|
3613
|
+
* @see https://redis.io/commands/eval_ro
|
|
3614
|
+
*/
|
|
3615
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2707
3616
|
/**
|
|
2708
3617
|
* @see https://redis.io/commands/eval
|
|
2709
3618
|
*/
|
|
2710
3619
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3620
|
+
/**
|
|
3621
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3622
|
+
*/
|
|
3623
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2711
3624
|
/**
|
|
2712
3625
|
* @see https://redis.io/commands/evalsha
|
|
2713
3626
|
*/
|
|
2714
3627
|
evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3628
|
+
/**
|
|
3629
|
+
* Generic method to execute any Redis command.
|
|
3630
|
+
*/
|
|
3631
|
+
exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
|
|
2715
3632
|
/**
|
|
2716
3633
|
* @see https://redis.io/commands/exists
|
|
2717
3634
|
*/
|
|
@@ -2719,11 +3636,11 @@ declare class Redis {
|
|
|
2719
3636
|
/**
|
|
2720
3637
|
* @see https://redis.io/commands/expire
|
|
2721
3638
|
*/
|
|
2722
|
-
expire: (key: string, seconds: number, option?:
|
|
3639
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2723
3640
|
/**
|
|
2724
3641
|
* @see https://redis.io/commands/expireat
|
|
2725
3642
|
*/
|
|
2726
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3643
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2727
3644
|
/**
|
|
2728
3645
|
* @see https://redis.io/commands/flushall
|
|
2729
3646
|
*/
|
|
@@ -2732,7 +3649,7 @@ declare class Redis {
|
|
|
2732
3649
|
* @see https://redis.io/commands/flushdb
|
|
2733
3650
|
*/
|
|
2734
3651
|
flushdb: (opts?: {
|
|
2735
|
-
async?: boolean
|
|
3652
|
+
async?: boolean;
|
|
2736
3653
|
} | undefined) => Promise<"OK">;
|
|
2737
3654
|
/**
|
|
2738
3655
|
* @see https://redis.io/commands/geoadd
|
|
@@ -2779,11 +3696,11 @@ declare class Redis {
|
|
|
2779
3696
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2780
3697
|
count?: {
|
|
2781
3698
|
limit: number;
|
|
2782
|
-
any?: boolean
|
|
2783
|
-
}
|
|
2784
|
-
withCoord?: boolean
|
|
2785
|
-
withDist?: boolean
|
|
2786
|
-
withHash?: boolean
|
|
3699
|
+
any?: boolean;
|
|
3700
|
+
};
|
|
3701
|
+
withCoord?: boolean;
|
|
3702
|
+
withDist?: boolean;
|
|
3703
|
+
withHash?: boolean;
|
|
2787
3704
|
} | undefined) => Promise<({
|
|
2788
3705
|
member: TData;
|
|
2789
3706
|
} & {
|
|
@@ -2820,9 +3737,9 @@ declare class Redis {
|
|
|
2820
3737
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2821
3738
|
count?: {
|
|
2822
3739
|
limit: number;
|
|
2823
|
-
any?: boolean
|
|
2824
|
-
}
|
|
2825
|
-
storeDist?: boolean
|
|
3740
|
+
any?: boolean;
|
|
3741
|
+
};
|
|
3742
|
+
storeDist?: boolean;
|
|
2826
3743
|
} | undefined) => Promise<number>;
|
|
2827
3744
|
/**
|
|
2828
3745
|
* @see https://redis.io/commands/get
|
|
@@ -2836,6 +3753,46 @@ declare class Redis {
|
|
|
2836
3753
|
* @see https://redis.io/commands/getdel
|
|
2837
3754
|
*/
|
|
2838
3755
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3756
|
+
/**
|
|
3757
|
+
* @see https://redis.io/commands/getex
|
|
3758
|
+
*/
|
|
3759
|
+
getex: <TData>(key: string, opts?: ({
|
|
3760
|
+
ex: number;
|
|
3761
|
+
px?: never;
|
|
3762
|
+
exat?: never;
|
|
3763
|
+
pxat?: never;
|
|
3764
|
+
persist?: never;
|
|
3765
|
+
} | {
|
|
3766
|
+
ex?: never;
|
|
3767
|
+
px: number;
|
|
3768
|
+
exat?: never;
|
|
3769
|
+
pxat?: never;
|
|
3770
|
+
persist?: never;
|
|
3771
|
+
} | {
|
|
3772
|
+
ex?: never;
|
|
3773
|
+
px?: never;
|
|
3774
|
+
exat: number;
|
|
3775
|
+
pxat?: never;
|
|
3776
|
+
persist?: never;
|
|
3777
|
+
} | {
|
|
3778
|
+
ex?: never;
|
|
3779
|
+
px?: never;
|
|
3780
|
+
exat?: never;
|
|
3781
|
+
pxat: number;
|
|
3782
|
+
persist?: never;
|
|
3783
|
+
} | {
|
|
3784
|
+
ex?: never;
|
|
3785
|
+
px?: never;
|
|
3786
|
+
exat?: never;
|
|
3787
|
+
pxat?: never;
|
|
3788
|
+
persist: true;
|
|
3789
|
+
} | {
|
|
3790
|
+
ex?: never;
|
|
3791
|
+
px?: never;
|
|
3792
|
+
exat?: never;
|
|
3793
|
+
pxat?: never;
|
|
3794
|
+
persist?: never;
|
|
3795
|
+
}) | undefined) => Promise<TData | null>;
|
|
2839
3796
|
/**
|
|
2840
3797
|
* @see https://redis.io/commands/getrange
|
|
2841
3798
|
*/
|
|
@@ -2852,6 +3809,42 @@ declare class Redis {
|
|
|
2852
3809
|
* @see https://redis.io/commands/hexists
|
|
2853
3810
|
*/
|
|
2854
3811
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3812
|
+
/**
|
|
3813
|
+
* @see https://redis.io/commands/hexpire
|
|
3814
|
+
*/
|
|
3815
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3816
|
+
/**
|
|
3817
|
+
* @see https://redis.io/commands/hexpireat
|
|
3818
|
+
*/
|
|
3819
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3820
|
+
/**
|
|
3821
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3822
|
+
*/
|
|
3823
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3824
|
+
/**
|
|
3825
|
+
* @see https://redis.io/commands/httl
|
|
3826
|
+
*/
|
|
3827
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3828
|
+
/**
|
|
3829
|
+
* @see https://redis.io/commands/hpexpire
|
|
3830
|
+
*/
|
|
3831
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3832
|
+
/**
|
|
3833
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3834
|
+
*/
|
|
3835
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3836
|
+
/**
|
|
3837
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3838
|
+
*/
|
|
3839
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3840
|
+
/**
|
|
3841
|
+
* @see https://redis.io/commands/hpttl
|
|
3842
|
+
*/
|
|
3843
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3844
|
+
/**
|
|
3845
|
+
* @see https://redis.io/commands/hpersist
|
|
3846
|
+
*/
|
|
3847
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2855
3848
|
/**
|
|
2856
3849
|
* @see https://redis.io/commands/hget
|
|
2857
3850
|
*/
|
|
@@ -2860,6 +3853,44 @@ declare class Redis {
|
|
|
2860
3853
|
* @see https://redis.io/commands/hgetall
|
|
2861
3854
|
*/
|
|
2862
3855
|
hgetall: <TData extends Record<string, unknown>>(key: string) => Promise<TData | null>;
|
|
3856
|
+
/**
|
|
3857
|
+
* @see https://redis.io/commands/hgetdel
|
|
3858
|
+
*/
|
|
3859
|
+
hgetdel: <TData extends Record<string, unknown>>(key: string, ...fields: (string | number)[]) => Promise<TData | null>;
|
|
3860
|
+
/**
|
|
3861
|
+
* @see https://redis.io/commands/hgetex
|
|
3862
|
+
*/
|
|
3863
|
+
hgetex: <TData extends Record<string, unknown>>(key: string, opts: {
|
|
3864
|
+
ex: number;
|
|
3865
|
+
px?: never;
|
|
3866
|
+
exat?: never;
|
|
3867
|
+
pxat?: never;
|
|
3868
|
+
persist?: never;
|
|
3869
|
+
} | {
|
|
3870
|
+
ex?: never;
|
|
3871
|
+
px: number;
|
|
3872
|
+
exat?: never;
|
|
3873
|
+
pxat?: never;
|
|
3874
|
+
persist?: never;
|
|
3875
|
+
} | {
|
|
3876
|
+
ex?: never;
|
|
3877
|
+
px?: never;
|
|
3878
|
+
exat: number;
|
|
3879
|
+
pxat?: never;
|
|
3880
|
+
persist?: never;
|
|
3881
|
+
} | {
|
|
3882
|
+
ex?: never;
|
|
3883
|
+
px?: never;
|
|
3884
|
+
exat?: never;
|
|
3885
|
+
pxat: number;
|
|
3886
|
+
persist?: never;
|
|
3887
|
+
} | {
|
|
3888
|
+
ex?: never;
|
|
3889
|
+
px?: never;
|
|
3890
|
+
exat?: never;
|
|
3891
|
+
pxat?: never;
|
|
3892
|
+
persist: true;
|
|
3893
|
+
}, ...fields: (string | number)[]) => Promise<TData | null>;
|
|
2863
3894
|
/**
|
|
2864
3895
|
* @see https://redis.io/commands/hincrby
|
|
2865
3896
|
*/
|
|
@@ -2883,27 +3914,66 @@ declare class Redis {
|
|
|
2883
3914
|
/**
|
|
2884
3915
|
* @see https://redis.io/commands/hmset
|
|
2885
3916
|
*/
|
|
2886
|
-
hmset: <TData>(key: string, kv:
|
|
2887
|
-
[field: string]: TData;
|
|
2888
|
-
}) => Promise<"OK">;
|
|
3917
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
|
|
2889
3918
|
/**
|
|
2890
3919
|
* @see https://redis.io/commands/hrandfield
|
|
2891
3920
|
*/
|
|
2892
3921
|
hrandfield: {
|
|
2893
|
-
(key: string): Promise<string>;
|
|
3922
|
+
(key: string): Promise<string | null>;
|
|
2894
3923
|
(key: string, count: number): Promise<string[]>;
|
|
2895
3924
|
<TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
|
|
2896
3925
|
};
|
|
2897
3926
|
/**
|
|
2898
3927
|
* @see https://redis.io/commands/hscan
|
|
2899
3928
|
*/
|
|
2900
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[
|
|
3929
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
2901
3930
|
/**
|
|
2902
3931
|
* @see https://redis.io/commands/hset
|
|
2903
3932
|
*/
|
|
2904
|
-
hset: <TData>(key: string, kv:
|
|
2905
|
-
|
|
2906
|
-
|
|
3933
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
|
|
3934
|
+
/**
|
|
3935
|
+
* @see https://redis.io/commands/hsetex
|
|
3936
|
+
*/
|
|
3937
|
+
hsetex: <TData>(key: string, opts: {
|
|
3938
|
+
conditional?: "FNX" | "fnx" | "FXX" | "fxx";
|
|
3939
|
+
expiration?: {
|
|
3940
|
+
ex: number;
|
|
3941
|
+
px?: never;
|
|
3942
|
+
exat?: never;
|
|
3943
|
+
pxat?: never;
|
|
3944
|
+
keepttl?: never;
|
|
3945
|
+
} | {
|
|
3946
|
+
ex?: never;
|
|
3947
|
+
px: number;
|
|
3948
|
+
exat?: never;
|
|
3949
|
+
pxat?: never;
|
|
3950
|
+
keepttl?: never;
|
|
3951
|
+
} | {
|
|
3952
|
+
ex?: never;
|
|
3953
|
+
px?: never;
|
|
3954
|
+
exat: number;
|
|
3955
|
+
pxat?: never;
|
|
3956
|
+
keepttl?: never;
|
|
3957
|
+
} | {
|
|
3958
|
+
ex?: never;
|
|
3959
|
+
px?: never;
|
|
3960
|
+
exat?: never;
|
|
3961
|
+
pxat: number;
|
|
3962
|
+
keepttl?: never;
|
|
3963
|
+
} | {
|
|
3964
|
+
ex?: never;
|
|
3965
|
+
px?: never;
|
|
3966
|
+
exat?: never;
|
|
3967
|
+
pxat?: never;
|
|
3968
|
+
keepttl: true;
|
|
3969
|
+
} | {
|
|
3970
|
+
ex?: never;
|
|
3971
|
+
px?: never;
|
|
3972
|
+
exat?: never;
|
|
3973
|
+
pxat?: never;
|
|
3974
|
+
keepttl?: never;
|
|
3975
|
+
};
|
|
3976
|
+
}, kv: Record<string, TData>) => Promise<number>;
|
|
2907
3977
|
/**
|
|
2908
3978
|
* @see https://redis.io/commands/hsetnx
|
|
2909
3979
|
*/
|
|
@@ -2952,13 +4022,17 @@ declare class Redis {
|
|
|
2952
4022
|
* @see https://redis.io/commands/lpop
|
|
2953
4023
|
*/
|
|
2954
4024
|
lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
4025
|
+
/**
|
|
4026
|
+
* @see https://redis.io/commands/lmpop
|
|
4027
|
+
*/
|
|
4028
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
|
|
2955
4029
|
/**
|
|
2956
4030
|
* @see https://redis.io/commands/lpos
|
|
2957
4031
|
*/
|
|
2958
4032
|
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
2959
|
-
rank?: number
|
|
2960
|
-
count?: number
|
|
2961
|
-
maxLen?: number
|
|
4033
|
+
rank?: number;
|
|
4034
|
+
count?: number;
|
|
4035
|
+
maxLen?: number;
|
|
2962
4036
|
} | undefined) => Promise<TData>;
|
|
2963
4037
|
/**
|
|
2964
4038
|
* @see https://redis.io/commands/lpush
|
|
@@ -2991,15 +4065,11 @@ declare class Redis {
|
|
|
2991
4065
|
/**
|
|
2992
4066
|
* @see https://redis.io/commands/mset
|
|
2993
4067
|
*/
|
|
2994
|
-
mset: <TData>(kv:
|
|
2995
|
-
[key: string]: TData;
|
|
2996
|
-
}) => Promise<"OK">;
|
|
4068
|
+
mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
|
|
2997
4069
|
/**
|
|
2998
4070
|
* @see https://redis.io/commands/msetnx
|
|
2999
4071
|
*/
|
|
3000
|
-
msetnx: <TData>(kv:
|
|
3001
|
-
[key: string]: TData;
|
|
3002
|
-
}) => Promise<number>;
|
|
4072
|
+
msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
|
|
3003
4073
|
/**
|
|
3004
4074
|
* @see https://redis.io/commands/persist
|
|
3005
4075
|
*/
|
|
@@ -3007,11 +4077,11 @@ declare class Redis {
|
|
|
3007
4077
|
/**
|
|
3008
4078
|
* @see https://redis.io/commands/pexpire
|
|
3009
4079
|
*/
|
|
3010
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
4080
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3011
4081
|
/**
|
|
3012
4082
|
* @see https://redis.io/commands/pexpireat
|
|
3013
4083
|
*/
|
|
3014
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
4084
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3015
4085
|
/**
|
|
3016
4086
|
* @see https://redis.io/commands/pfadd
|
|
3017
4087
|
*/
|
|
@@ -3032,6 +4102,10 @@ declare class Redis {
|
|
|
3032
4102
|
* @see https://redis.io/commands/psetex
|
|
3033
4103
|
*/
|
|
3034
4104
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
4105
|
+
/**
|
|
4106
|
+
* @see https://redis.io/commands/psubscribe
|
|
4107
|
+
*/
|
|
4108
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3035
4109
|
/**
|
|
3036
4110
|
* @see https://redis.io/commands/pttl
|
|
3037
4111
|
*/
|
|
@@ -3067,11 +4141,14 @@ declare class Redis {
|
|
|
3067
4141
|
/**
|
|
3068
4142
|
* @see https://redis.io/commands/sadd
|
|
3069
4143
|
*/
|
|
3070
|
-
sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
|
|
4144
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
|
|
3071
4145
|
/**
|
|
3072
4146
|
* @see https://redis.io/commands/scan
|
|
3073
4147
|
*/
|
|
3074
|
-
scan
|
|
4148
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
4149
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
4150
|
+
withType: true;
|
|
4151
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
3075
4152
|
/**
|
|
3076
4153
|
* @see https://redis.io/commands/scard
|
|
3077
4154
|
*/
|
|
@@ -3155,11 +4232,15 @@ declare class Redis {
|
|
|
3155
4232
|
/**
|
|
3156
4233
|
* @see https://redis.io/commands/sscan
|
|
3157
4234
|
*/
|
|
3158
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
4235
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
3159
4236
|
/**
|
|
3160
4237
|
* @see https://redis.io/commands/strlen
|
|
3161
4238
|
*/
|
|
3162
4239
|
strlen: (key: string) => Promise<number>;
|
|
4240
|
+
/**
|
|
4241
|
+
* @see https://redis.io/commands/subscribe
|
|
4242
|
+
*/
|
|
4243
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3163
4244
|
/**
|
|
3164
4245
|
* @see https://redis.io/commands/sunion
|
|
3165
4246
|
*/
|
|
@@ -3191,11 +4272,9 @@ declare class Redis {
|
|
|
3191
4272
|
/**
|
|
3192
4273
|
* @see https://redis.io/commands/xadd
|
|
3193
4274
|
*/
|
|
3194
|
-
xadd: (key: string, id: string, entries: {
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
nomkStream?: boolean | undefined;
|
|
3198
|
-
trim?: (({
|
|
4275
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
4276
|
+
nomkStream?: boolean;
|
|
4277
|
+
trim?: ({
|
|
3199
4278
|
type: "MAXLEN" | "maxlen";
|
|
3200
4279
|
threshold: number;
|
|
3201
4280
|
} | {
|
|
@@ -3203,31 +4282,39 @@ declare class Redis {
|
|
|
3203
4282
|
threshold: string;
|
|
3204
4283
|
}) & ({
|
|
3205
4284
|
comparison: "~";
|
|
3206
|
-
limit?: number
|
|
4285
|
+
limit?: number;
|
|
3207
4286
|
} | {
|
|
3208
4287
|
comparison: "=";
|
|
3209
|
-
limit?:
|
|
3210
|
-
})
|
|
4288
|
+
limit?: never;
|
|
4289
|
+
});
|
|
3211
4290
|
} | undefined) => Promise<string>;
|
|
3212
4291
|
/**
|
|
3213
4292
|
* @see https://redis.io/commands/xack
|
|
3214
4293
|
*/
|
|
3215
4294
|
xack: (key: string, group: string, id: string | string[]) => Promise<number>;
|
|
4295
|
+
/**
|
|
4296
|
+
* @see https://redis.io/commands/xackdel
|
|
4297
|
+
*/
|
|
4298
|
+
xackdel: (key: string, group: string, opts: "KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked", ...ids: string[]) => Promise<number[]>;
|
|
3216
4299
|
/**
|
|
3217
4300
|
* @see https://redis.io/commands/xdel
|
|
3218
4301
|
*/
|
|
3219
4302
|
xdel: (key: string, ids: string | string[]) => Promise<number>;
|
|
4303
|
+
/**
|
|
4304
|
+
* @see https://redis.io/commands/xdelex
|
|
4305
|
+
*/
|
|
4306
|
+
xdelex: (key: string, opts?: ("KEEPREF" | "keepref" | "DELREF" | "delref" | "ACKED" | "acked") | undefined, ...ids: string[]) => Promise<number[]>;
|
|
3220
4307
|
/**
|
|
3221
4308
|
* @see https://redis.io/commands/xgroup
|
|
3222
4309
|
*/
|
|
3223
4310
|
xgroup: (key: string, opts: {
|
|
3224
4311
|
type: "CREATE";
|
|
3225
4312
|
group: string;
|
|
3226
|
-
id: string;
|
|
4313
|
+
id: `$` | string;
|
|
3227
4314
|
options?: {
|
|
3228
|
-
MKSTREAM?: boolean
|
|
3229
|
-
ENTRIESREAD?: number
|
|
3230
|
-
}
|
|
4315
|
+
MKSTREAM?: boolean;
|
|
4316
|
+
ENTRIESREAD?: number;
|
|
4317
|
+
};
|
|
3231
4318
|
} | {
|
|
3232
4319
|
type: "CREATECONSUMER";
|
|
3233
4320
|
group: string;
|
|
@@ -3242,10 +4329,10 @@ declare class Redis {
|
|
|
3242
4329
|
} | {
|
|
3243
4330
|
type: "SETID";
|
|
3244
4331
|
group: string;
|
|
3245
|
-
id: string;
|
|
4332
|
+
id: `$` | string;
|
|
3246
4333
|
options?: {
|
|
3247
|
-
ENTRIESREAD?: number
|
|
3248
|
-
}
|
|
4334
|
+
ENTRIESREAD?: number;
|
|
4335
|
+
};
|
|
3249
4336
|
}) => Promise<never>;
|
|
3250
4337
|
/**
|
|
3251
4338
|
* @see https://redis.io/commands/xread
|
|
@@ -3272,35 +4359,35 @@ declare class Redis {
|
|
|
3272
4359
|
* @see https://redis.io/commands/xpending
|
|
3273
4360
|
*/
|
|
3274
4361
|
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
3275
|
-
idleTime?: number
|
|
3276
|
-
consumer?: string | string[]
|
|
4362
|
+
idleTime?: number;
|
|
4363
|
+
consumer?: string | string[];
|
|
3277
4364
|
} | undefined) => Promise<unknown[]>;
|
|
3278
4365
|
/**
|
|
3279
4366
|
* @see https://redis.io/commands/xclaim
|
|
3280
4367
|
*/
|
|
3281
4368
|
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
3282
|
-
idleMS?: number
|
|
3283
|
-
timeMS?: number
|
|
3284
|
-
retryCount?: number
|
|
3285
|
-
force?: boolean
|
|
3286
|
-
justId?: boolean
|
|
3287
|
-
lastId?: number
|
|
4369
|
+
idleMS?: number;
|
|
4370
|
+
timeMS?: number;
|
|
4371
|
+
retryCount?: number;
|
|
4372
|
+
force?: boolean;
|
|
4373
|
+
justId?: boolean;
|
|
4374
|
+
lastId?: number;
|
|
3288
4375
|
} | undefined) => Promise<unknown[]>;
|
|
3289
4376
|
/**
|
|
3290
4377
|
* @see https://redis.io/commands/xautoclaim
|
|
3291
4378
|
*/
|
|
3292
4379
|
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
3293
|
-
count?: number
|
|
3294
|
-
justId?: boolean
|
|
4380
|
+
count?: number;
|
|
4381
|
+
justId?: boolean;
|
|
3295
4382
|
} | undefined) => Promise<unknown[]>;
|
|
3296
4383
|
/**
|
|
3297
4384
|
* @see https://redis.io/commands/xtrim
|
|
3298
4385
|
*/
|
|
3299
4386
|
xtrim: (key: string, options: {
|
|
3300
4387
|
strategy: "MAXLEN" | "MINID";
|
|
3301
|
-
exactness?: "~" | "="
|
|
3302
|
-
threshold:
|
|
3303
|
-
limit?: number
|
|
4388
|
+
exactness?: "~" | "=";
|
|
4389
|
+
threshold: number | string;
|
|
4390
|
+
limit?: number;
|
|
3304
4391
|
}) => Promise<number>;
|
|
3305
4392
|
/**
|
|
3306
4393
|
* @see https://redis.io/commands/xrange
|
|
@@ -3313,11 +4400,7 @@ declare class Redis {
|
|
|
3313
4400
|
/**
|
|
3314
4401
|
* @see https://redis.io/commands/zadd
|
|
3315
4402
|
*/
|
|
3316
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [
|
|
3317
|
-
key: string,
|
|
3318
|
-
opts: ZAddCommandOptions,
|
|
3319
|
-
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
|
|
3320
|
-
]) => Promise<number | null>;
|
|
4403
|
+
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
|
|
3321
4404
|
/**
|
|
3322
4405
|
* @see https://redis.io/commands/zcard
|
|
3323
4406
|
*/
|
|
@@ -3357,21 +4440,11 @@ declare class Redis {
|
|
|
3357
4440
|
/**
|
|
3358
4441
|
* @see https://redis.io/commands/zrange
|
|
3359
4442
|
*/
|
|
3360
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
byLex: true;
|
|
3366
|
-
} & ZRangeCommandOptions
|
|
3367
|
-
] | [
|
|
3368
|
-
key: string,
|
|
3369
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
3370
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
3371
|
-
opts: {
|
|
3372
|
-
byScore: true;
|
|
3373
|
-
} & ZRangeCommandOptions
|
|
3374
|
-
]) => Promise<TData>;
|
|
4443
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
4444
|
+
byLex: true;
|
|
4445
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
4446
|
+
byScore: true;
|
|
4447
|
+
} & ZRangeCommandOptions]) => Promise<TData>;
|
|
3375
4448
|
/**
|
|
3376
4449
|
* @see https://redis.io/commands/zrank
|
|
3377
4450
|
*/
|
|
@@ -3391,7 +4464,7 @@ declare class Redis {
|
|
|
3391
4464
|
/**
|
|
3392
4465
|
* @see https://redis.io/commands/zremrangebyscore
|
|
3393
4466
|
*/
|
|
3394
|
-
zremrangebyscore: (key: string, min: number, max: number) => Promise<number>;
|
|
4467
|
+
zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Promise<number>;
|
|
3395
4468
|
/**
|
|
3396
4469
|
* @see https://redis.io/commands/zrevrank
|
|
3397
4470
|
*/
|
|
@@ -3399,7 +4472,7 @@ declare class Redis {
|
|
|
3399
4472
|
/**
|
|
3400
4473
|
* @see https://redis.io/commands/zscan
|
|
3401
4474
|
*/
|
|
3402
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
4475
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
3403
4476
|
/**
|
|
3404
4477
|
* @see https://redis.io/commands/zscore
|
|
3405
4478
|
*/
|
|
@@ -3414,6 +4487,30 @@ declare class Redis {
|
|
|
3414
4487
|
zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
|
|
3415
4488
|
}
|
|
3416
4489
|
|
|
4490
|
+
type UpstashErrorOptions = Pick<NonNullable<ConstructorParameters<typeof Error>[1]>, "cause">;
|
|
4491
|
+
/**
|
|
4492
|
+
* Result of a bad request to upstash
|
|
4493
|
+
*/
|
|
4494
|
+
declare class UpstashError extends Error {
|
|
4495
|
+
constructor(message: string, options?: ErrorOptions);
|
|
4496
|
+
}
|
|
4497
|
+
declare class UrlError extends Error {
|
|
4498
|
+
constructor(url: string);
|
|
4499
|
+
}
|
|
4500
|
+
declare class UpstashJSONParseError extends UpstashError {
|
|
4501
|
+
constructor(body: string, options?: UpstashErrorOptions);
|
|
4502
|
+
}
|
|
4503
|
+
|
|
4504
|
+
type error_UpstashError = UpstashError;
|
|
4505
|
+
declare const error_UpstashError: typeof UpstashError;
|
|
4506
|
+
type error_UpstashJSONParseError = UpstashJSONParseError;
|
|
4507
|
+
declare const error_UpstashJSONParseError: typeof UpstashJSONParseError;
|
|
4508
|
+
type error_UrlError = UrlError;
|
|
4509
|
+
declare const error_UrlError: typeof UrlError;
|
|
4510
|
+
declare namespace error {
|
|
4511
|
+
export { error_UpstashError as UpstashError, error_UpstashJSONParseError as UpstashJSONParseError, error_UrlError as UrlError };
|
|
4512
|
+
}
|
|
4513
|
+
|
|
3417
4514
|
/**
|
|
3418
4515
|
* @see https://redis.io/commands/zdiffstore
|
|
3419
4516
|
*/
|
|
@@ -3428,4 +4525,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3428
4525
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3429
4526
|
}
|
|
3430
4527
|
|
|
3431
|
-
export {
|
|
4528
|
+
export { HPExpireTimeCommand as $, AppendCommand as A, BitCountCommand as B, ClientSetInfoCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, type HttpClientConfig as H, GeoSearchCommand as I, GeoSearchStoreCommand as J, GetCommand as K, GetBitCommand as L, GetDelCommand as M, GetExCommand as N, GetRangeCommand as O, Pipeline as P, GetSetCommand as Q, type RedisOptions as R, HDelCommand as S, HExistsCommand as T, type UpstashRequest as U, HExpireCommand as V, HExpireAtCommand as W, HExpireTimeCommand as X, HTtlCommand as Y, HPExpireCommand as Z, HPExpireAtCommand as _, type RequesterConfig as a, PSetEXCommand as a$, HPTtlCommand as a0, HPersistCommand as a1, HGetCommand as a2, HGetAllCommand as a3, HGetDelCommand as a4, HGetExCommand as a5, HIncrByCommand as a6, HIncrByFloatCommand as a7, HKeysCommand as a8, HLenCommand as a9, JsonObjKeysCommand as aA, JsonObjLenCommand as aB, JsonRespCommand as aC, JsonSetCommand as aD, JsonStrAppendCommand as aE, JsonStrLenCommand as aF, JsonToggleCommand as aG, JsonTypeCommand as aH, KeysCommand as aI, LIndexCommand as aJ, LInsertCommand as aK, LLenCommand as aL, LMoveCommand as aM, LPopCommand as aN, LPushCommand as aO, LPushXCommand as aP, LRangeCommand as aQ, LRemCommand as aR, LSetCommand as aS, LTrimCommand as aT, MGetCommand as aU, MSetCommand as aV, MSetNXCommand as aW, PersistCommand as aX, PExpireCommand as aY, PExpireAtCommand as aZ, PingCommand as a_, HMGetCommand as aa, HMSetCommand as ab, HRandFieldCommand as ac, HScanCommand as ad, HSetCommand as ae, HSetExCommand as af, HSetNXCommand as ag, HStrLenCommand as ah, HValsCommand as ai, IncrCommand as aj, IncrByCommand as ak, IncrByFloatCommand as al, JsonArrAppendCommand as am, JsonArrIndexCommand as an, JsonArrInsertCommand as ao, JsonArrLenCommand as ap, JsonArrPopCommand as aq, JsonArrTrimCommand as ar, JsonClearCommand as as, JsonDelCommand as at, JsonForgetCommand as au, JsonGetCommand as av, JsonMergeCommand as aw, JsonMGetCommand as ax, JsonNumIncrByCommand as ay, JsonNumMultByCommand as az, Redis as b, ZRemRangeByLexCommand as b$, PTtlCommand as b0, PublishCommand as b1, RandomKeyCommand as b2, RenameCommand as b3, RenameNXCommand as b4, RPopCommand as b5, RPushCommand as b6, RPushXCommand as b7, SAddCommand as b8, ScanCommand as b9, TimeCommand as bA, TouchCommand as bB, TtlCommand as bC, type Type as bD, TypeCommand as bE, UnlinkCommand as bF, XAddCommand as bG, XAckDelCommand as bH, XDelExCommand as bI, XRangeCommand as bJ, type ScoreMember as bK, type ZAddCommandOptions as bL, ZAddCommand as bM, ZCardCommand as bN, ZCountCommand as bO, ZDiffStoreCommand as bP, ZIncrByCommand as bQ, ZInterStoreCommand as bR, type ZInterStoreCommandOptions as bS, ZLexCountCommand as bT, ZMScoreCommand as bU, ZPopMaxCommand as bV, ZPopMinCommand as bW, ZRangeCommand as bX, type ZRangeCommandOptions as bY, ZRankCommand as bZ, ZRemCommand as b_, type ScanCommandOptions as ba, SCardCommand as bb, ScriptExistsCommand as bc, ScriptFlushCommand as bd, ScriptLoadCommand as be, SDiffCommand as bf, SDiffStoreCommand as bg, SetCommand as bh, type SetCommandOptions as bi, SetBitCommand as bj, SetExCommand as bk, SetNxCommand as bl, SetRangeCommand as bm, SInterCommand as bn, SInterStoreCommand as bo, SIsMemberCommand as bp, SMembersCommand as bq, SMIsMemberCommand as br, SMoveCommand as bs, SPopCommand as bt, SRandMemberCommand as bu, SRemCommand as bv, SScanCommand as bw, StrLenCommand as bx, SUnionCommand as by, SUnionStoreCommand as bz, type Requester as c, ZRemRangeByRankCommand as c0, ZRemRangeByScoreCommand as c1, ZRevRankCommand as c2, ZScanCommand as c3, ZScoreCommand as c4, ZUnionCommand as c5, type ZUnionCommandOptions as c6, ZUnionStoreCommand as c7, type ZUnionStoreCommandOptions as c8, type UpstashResponse as d, error as e, BitOpCommand as f, BitPosCommand as g, type ClientSetInfoAttribute as h, CopyCommand as i, DecrCommand as j, DecrByCommand as k, DelCommand as l, EvalROCommand as m, EvalCommand as n, EvalshaROCommand as o, EvalshaCommand as p, ExistsCommand as q, ExpireCommand as r, type ExpireOption as s, ExpireAtCommand as t, FlushDBCommand as u, type GeoAddCommandOptions as v, type GeoMember as w, GeoDistCommand as x, GeoHashCommand as y, GeoPosCommand as z };
|