@upstash/redis 0.0.0-ci.cadfe394ccdd0faf3ed5d166df7396372f47147e-20240215094904 → 0.0.0-ci.cbfeff9b449dd01c99384632d59c371c0bee875a-20260123181940
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 +15 -2
- package/chunk-SGAAV5RA.mjs +4699 -0
- package/cloudflare.d.mts +11 -6
- package/cloudflare.d.ts +11 -6
- package/cloudflare.js +4805 -1
- package/cloudflare.mjs +97 -1
- package/fastly.d.mts +10 -5
- package/fastly.d.ts +10 -5
- package/fastly.js +4774 -1
- package/fastly.mjs +66 -1
- package/nodejs.d.mts +20 -24
- package/nodejs.d.ts +20 -24
- package/nodejs.js +4827 -1
- package/nodejs.mjs +119 -1
- package/package.json +1 -1
- package/{zmscore-0b710ce5.d.ts → zmscore-0SAuWM0q.d.mts} +1023 -254
- package/zmscore-0SAuWM0q.d.ts +4190 -0
- package/chunk-3HKUW56P.js +0 -1
- package/chunk-GW4BEX5X.mjs +0 -1
|
@@ -23,7 +23,10 @@ type RedisOptions = {
|
|
|
23
23
|
* @default true
|
|
24
24
|
*/
|
|
25
25
|
automaticDeserialization?: boolean;
|
|
26
|
+
latencyLogging?: boolean;
|
|
26
27
|
enableTelemetry?: boolean;
|
|
28
|
+
enableAutoPipelining?: boolean;
|
|
29
|
+
readYourWrites?: boolean;
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
|
@@ -33,12 +36,37 @@ type UpstashRequest = {
|
|
|
33
36
|
* Request body will be serialized to json
|
|
34
37
|
*/
|
|
35
38
|
body?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Additional headers for the request
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
upstashSyncToken?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Callback for handling streaming messages
|
|
46
|
+
*/
|
|
47
|
+
onMessage?: (data: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this request expects a streaming response
|
|
50
|
+
*/
|
|
51
|
+
isStreaming?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Abort signal for the request
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal;
|
|
36
56
|
};
|
|
37
57
|
type UpstashResponse<TResult> = {
|
|
38
58
|
result?: TResult;
|
|
39
59
|
error?: string;
|
|
40
60
|
};
|
|
41
61
|
interface Requester {
|
|
62
|
+
/**
|
|
63
|
+
* When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client.
|
|
64
|
+
*/
|
|
65
|
+
readYourWrites?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* This token is used to ensure that the client is in sync with the server. On each request, we send this token in the header, and the server will return a new token.
|
|
68
|
+
*/
|
|
69
|
+
upstashSyncToken?: string;
|
|
42
70
|
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
43
71
|
}
|
|
44
72
|
type RetryConfig = false | {
|
|
@@ -49,7 +77,7 @@ type RetryConfig = false | {
|
|
|
49
77
|
*/
|
|
50
78
|
retries?: number;
|
|
51
79
|
/**
|
|
52
|
-
* 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.
|
|
53
81
|
*
|
|
54
82
|
* @default
|
|
55
83
|
* ```ts
|
|
@@ -58,6 +86,9 @@ type RetryConfig = false | {
|
|
|
58
86
|
*/
|
|
59
87
|
backoff?: (retryCount: number) => number;
|
|
60
88
|
};
|
|
89
|
+
type Options$1 = {
|
|
90
|
+
backend?: string;
|
|
91
|
+
};
|
|
61
92
|
type RequesterConfig = {
|
|
62
93
|
/**
|
|
63
94
|
* Configure the retry behaviour in case of network errors
|
|
@@ -92,6 +123,19 @@ type RequesterConfig = {
|
|
|
92
123
|
*/
|
|
93
124
|
cache?: CacheSetting;
|
|
94
125
|
};
|
|
126
|
+
type HttpClientConfig = {
|
|
127
|
+
headers?: Record<string, string>;
|
|
128
|
+
baseUrl: string;
|
|
129
|
+
options?: Options$1;
|
|
130
|
+
retry?: RetryConfig;
|
|
131
|
+
agent?: any;
|
|
132
|
+
signal?: AbortSignal | (() => AbortSignal);
|
|
133
|
+
keepAlive?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* When this flag is enabled, any subsequent commands issued by this client are guaranteed to observe the effects of all earlier writes submitted by the same client.
|
|
136
|
+
*/
|
|
137
|
+
readYourWrites?: boolean;
|
|
138
|
+
} & RequesterConfig;
|
|
95
139
|
|
|
96
140
|
type Serialize = (data: unknown) => string | number | boolean;
|
|
97
141
|
type Deserialize<TResult, TData> = (result: TResult) => TData;
|
|
@@ -106,6 +150,32 @@ type CommandOptions<TResult, TData> = {
|
|
|
106
150
|
* @default true
|
|
107
151
|
*/
|
|
108
152
|
automaticDeserialization?: boolean;
|
|
153
|
+
latencyLogging?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Additional headers to be sent with the request
|
|
156
|
+
*/
|
|
157
|
+
headers?: Record<string, string>;
|
|
158
|
+
/**
|
|
159
|
+
* Path to append to the URL
|
|
160
|
+
*/
|
|
161
|
+
path?: string[];
|
|
162
|
+
/**
|
|
163
|
+
* Options for streaming requests, mainly used for subscribe, monitor commands
|
|
164
|
+
**/
|
|
165
|
+
streamOptions?: {
|
|
166
|
+
/**
|
|
167
|
+
* Callback to be called when a message is received
|
|
168
|
+
*/
|
|
169
|
+
onMessage?: (data: string) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the request is streaming
|
|
172
|
+
*/
|
|
173
|
+
isStreaming?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Signal to abort the request
|
|
176
|
+
*/
|
|
177
|
+
signal?: AbortSignal;
|
|
178
|
+
};
|
|
109
179
|
};
|
|
110
180
|
/**
|
|
111
181
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -117,6 +187,11 @@ declare class Command<TResult, TData> {
|
|
|
117
187
|
readonly command: (string | number | boolean)[];
|
|
118
188
|
readonly serialize: Serialize;
|
|
119
189
|
readonly deserialize: Deserialize<TResult, TData>;
|
|
190
|
+
protected readonly headers?: Record<string, string>;
|
|
191
|
+
protected readonly path?: string[];
|
|
192
|
+
protected readonly onMessage?: (data: string) => void;
|
|
193
|
+
protected readonly isStreaming: boolean;
|
|
194
|
+
protected readonly signal?: AbortSignal;
|
|
120
195
|
/**
|
|
121
196
|
* Create a new command instance.
|
|
122
197
|
*
|
|
@@ -212,18 +287,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
|
|
|
212
287
|
constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
|
|
213
288
|
}
|
|
214
289
|
|
|
215
|
-
type ScanCommandOptions = {
|
|
216
|
-
match?: string;
|
|
217
|
-
count?: number;
|
|
218
|
-
type?: string;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* @see https://redis.io/commands/scan
|
|
222
|
-
*/
|
|
223
|
-
declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
|
|
224
|
-
constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[number, string[]], [number, string[]]>);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
290
|
type GeoAddCommandOptions = {
|
|
228
291
|
nx?: boolean;
|
|
229
292
|
xx?: never;
|
|
@@ -233,11 +296,11 @@ type GeoAddCommandOptions = {
|
|
|
233
296
|
} & {
|
|
234
297
|
ch?: boolean;
|
|
235
298
|
});
|
|
236
|
-
|
|
299
|
+
type GeoMember<TMemberType> = {
|
|
237
300
|
latitude: number;
|
|
238
301
|
longitude: number;
|
|
239
302
|
member: TMemberType;
|
|
240
|
-
}
|
|
303
|
+
};
|
|
241
304
|
/**
|
|
242
305
|
* @see https://redis.io/commands/geoadd
|
|
243
306
|
*/
|
|
@@ -249,6 +312,45 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
|
|
|
249
312
|
], opts?: CommandOptions<number | null, number | null>);
|
|
250
313
|
}
|
|
251
314
|
|
|
315
|
+
type ExpireOption = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
316
|
+
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
317
|
+
constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
type FunctionListArgs = {
|
|
321
|
+
/**
|
|
322
|
+
* Pattern for matching library names. Supports glob patterns.
|
|
323
|
+
*
|
|
324
|
+
* Example: "my_library_*"
|
|
325
|
+
*/
|
|
326
|
+
libraryName?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Includes the library source code in the response.
|
|
329
|
+
*
|
|
330
|
+
* @default false
|
|
331
|
+
*/
|
|
332
|
+
withCode?: boolean;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
type FunctionLoadArgs = {
|
|
336
|
+
/**
|
|
337
|
+
* The Lua code to load.
|
|
338
|
+
*
|
|
339
|
+
* Example:
|
|
340
|
+
* ```lua
|
|
341
|
+
* #!lua name=mylib
|
|
342
|
+
* redis.register_function('myfunc', function() return 'ok' end)
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
code: string;
|
|
346
|
+
/**
|
|
347
|
+
* If true, the library will replace the existing library with the same name.
|
|
348
|
+
*
|
|
349
|
+
* @default false
|
|
350
|
+
*/
|
|
351
|
+
replace?: boolean;
|
|
352
|
+
};
|
|
353
|
+
|
|
252
354
|
/**
|
|
253
355
|
* @see https://redis.io/commands/append
|
|
254
356
|
*/
|
|
@@ -264,6 +366,28 @@ declare class BitCountCommand extends Command<number, number> {
|
|
|
264
366
|
constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
|
|
265
367
|
}
|
|
266
368
|
|
|
369
|
+
type SubCommandArgs<TRest extends unknown[] = []> = [
|
|
370
|
+
encoding: string,
|
|
371
|
+
offset: number | string,
|
|
372
|
+
...rest: TRest
|
|
373
|
+
];
|
|
374
|
+
/**
|
|
375
|
+
* @see https://redis.io/commands/bitfield
|
|
376
|
+
*/
|
|
377
|
+
declare class BitFieldCommand<T = Promise<number[]>> {
|
|
378
|
+
private client;
|
|
379
|
+
private opts?;
|
|
380
|
+
private execOperation;
|
|
381
|
+
private command;
|
|
382
|
+
constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
|
|
383
|
+
private chain;
|
|
384
|
+
get(...args: SubCommandArgs): this;
|
|
385
|
+
set(...args: SubCommandArgs<[value: number]>): this;
|
|
386
|
+
incrby(...args: SubCommandArgs<[increment: number]>): this;
|
|
387
|
+
overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
|
|
388
|
+
exec(): T;
|
|
389
|
+
}
|
|
390
|
+
|
|
267
391
|
/**
|
|
268
392
|
* @see https://redis.io/commands/bitop
|
|
269
393
|
*/
|
|
@@ -323,6 +447,13 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
323
447
|
constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
|
|
324
448
|
}
|
|
325
449
|
|
|
450
|
+
/**
|
|
451
|
+
* @see https://redis.io/commands/eval_ro
|
|
452
|
+
*/
|
|
453
|
+
declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
454
|
+
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
455
|
+
}
|
|
456
|
+
|
|
326
457
|
/**
|
|
327
458
|
* @see https://redis.io/commands/eval
|
|
328
459
|
*/
|
|
@@ -330,6 +461,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
|
|
|
330
461
|
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
331
462
|
}
|
|
332
463
|
|
|
464
|
+
/**
|
|
465
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
466
|
+
*/
|
|
467
|
+
declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
468
|
+
constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
469
|
+
}
|
|
470
|
+
|
|
333
471
|
/**
|
|
334
472
|
* @see https://redis.io/commands/evalsha
|
|
335
473
|
*/
|
|
@@ -344,16 +482,11 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
344
482
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
345
483
|
}
|
|
346
484
|
|
|
347
|
-
type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
348
|
-
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
349
|
-
constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
485
|
/**
|
|
353
486
|
* @see https://redis.io/commands/expireat
|
|
354
487
|
*/
|
|
355
488
|
declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
356
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
489
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
357
490
|
}
|
|
358
491
|
|
|
359
492
|
/**
|
|
@@ -390,7 +523,7 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
|
|
|
390
523
|
* @see https://redis.io/commands/geohash
|
|
391
524
|
*/
|
|
392
525
|
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
393
|
-
constructor(cmd: [string, ...
|
|
526
|
+
constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
394
527
|
}
|
|
395
528
|
|
|
396
529
|
type Coordinates = {
|
|
@@ -528,6 +661,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
|
|
|
528
661
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
529
662
|
}
|
|
530
663
|
|
|
664
|
+
type GetExCommandOptions = {
|
|
665
|
+
ex: number;
|
|
666
|
+
px?: never;
|
|
667
|
+
exat?: never;
|
|
668
|
+
pxat?: never;
|
|
669
|
+
persist?: never;
|
|
670
|
+
} | {
|
|
671
|
+
ex?: never;
|
|
672
|
+
px: number;
|
|
673
|
+
exat?: never;
|
|
674
|
+
pxat?: never;
|
|
675
|
+
persist?: never;
|
|
676
|
+
} | {
|
|
677
|
+
ex?: never;
|
|
678
|
+
px?: never;
|
|
679
|
+
exat: number;
|
|
680
|
+
pxat?: never;
|
|
681
|
+
persist?: never;
|
|
682
|
+
} | {
|
|
683
|
+
ex?: never;
|
|
684
|
+
px?: never;
|
|
685
|
+
exat?: never;
|
|
686
|
+
pxat: number;
|
|
687
|
+
persist?: never;
|
|
688
|
+
} | {
|
|
689
|
+
ex?: never;
|
|
690
|
+
px?: never;
|
|
691
|
+
exat?: never;
|
|
692
|
+
pxat?: never;
|
|
693
|
+
persist: true;
|
|
694
|
+
} | {
|
|
695
|
+
ex?: never;
|
|
696
|
+
px?: never;
|
|
697
|
+
exat?: never;
|
|
698
|
+
pxat?: never;
|
|
699
|
+
persist?: never;
|
|
700
|
+
};
|
|
701
|
+
/**
|
|
702
|
+
* @see https://redis.io/commands/getex
|
|
703
|
+
*/
|
|
704
|
+
declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
705
|
+
constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
|
|
706
|
+
}
|
|
707
|
+
|
|
531
708
|
/**
|
|
532
709
|
* @see https://redis.io/commands/getrange
|
|
533
710
|
*/
|
|
@@ -556,6 +733,58 @@ declare class HExistsCommand extends Command<number, number> {
|
|
|
556
733
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
557
734
|
}
|
|
558
735
|
|
|
736
|
+
declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
737
|
+
constructor(cmd: [
|
|
738
|
+
key: string,
|
|
739
|
+
fields: (string | number) | (string | number)[],
|
|
740
|
+
seconds: number,
|
|
741
|
+
option?: ExpireOption
|
|
742
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
746
|
+
constructor(cmd: [
|
|
747
|
+
key: string,
|
|
748
|
+
fields: (string | number) | (string | number)[],
|
|
749
|
+
timestamp: number,
|
|
750
|
+
option?: ExpireOption
|
|
751
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
declare class HExpireTimeCommand extends Command<number[], number[]> {
|
|
755
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
|
|
759
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
763
|
+
constructor(cmd: [
|
|
764
|
+
key: string,
|
|
765
|
+
fields: (string | number) | (string | number)[],
|
|
766
|
+
milliseconds: number,
|
|
767
|
+
option?: ExpireOption
|
|
768
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
772
|
+
constructor(cmd: [
|
|
773
|
+
key: string,
|
|
774
|
+
fields: (string | number) | (string | number)[],
|
|
775
|
+
timestamp: number,
|
|
776
|
+
option?: ExpireOption
|
|
777
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
declare class HPExpireTimeCommand extends Command<number[], number[]> {
|
|
781
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
declare class HPTtlCommand extends Command<number[], number[]> {
|
|
785
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
786
|
+
}
|
|
787
|
+
|
|
559
788
|
/**
|
|
560
789
|
* @see https://redis.io/commands/hget
|
|
561
790
|
*/
|
|
@@ -617,9 +846,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
|
|
|
617
846
|
* @see https://redis.io/commands/hmset
|
|
618
847
|
*/
|
|
619
848
|
declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
|
|
620
|
-
constructor([key, kv]: [key: string, kv:
|
|
621
|
-
[field: string]: TData;
|
|
622
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
849
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
623
850
|
}
|
|
624
851
|
|
|
625
852
|
/**
|
|
@@ -631,26 +858,57 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
631
858
|
constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
|
|
632
859
|
}
|
|
633
860
|
|
|
861
|
+
type ScanCommandOptionsStandard = {
|
|
862
|
+
match?: string;
|
|
863
|
+
count?: number;
|
|
864
|
+
type?: string;
|
|
865
|
+
withType?: false;
|
|
866
|
+
};
|
|
867
|
+
type ScanCommandOptionsWithType = {
|
|
868
|
+
match?: string;
|
|
869
|
+
count?: number;
|
|
870
|
+
/**
|
|
871
|
+
* Includes types of each key in the result
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* ```typescript
|
|
875
|
+
* await redis.scan("0", { withType: true })
|
|
876
|
+
* // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]]
|
|
877
|
+
* ```
|
|
878
|
+
*/
|
|
879
|
+
withType: true;
|
|
880
|
+
};
|
|
881
|
+
type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType;
|
|
882
|
+
type ScanResultStandard = [string, string[]];
|
|
883
|
+
type ScanResultWithType = [string, {
|
|
884
|
+
key: string;
|
|
885
|
+
type: string;
|
|
886
|
+
}[]];
|
|
887
|
+
/**
|
|
888
|
+
* @see https://redis.io/commands/scan
|
|
889
|
+
*/
|
|
890
|
+
declare class ScanCommand<TData = ScanResultStandard> extends Command<[string, string[]], TData> {
|
|
891
|
+
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>);
|
|
892
|
+
}
|
|
893
|
+
|
|
634
894
|
/**
|
|
635
895
|
* @see https://redis.io/commands/hscan
|
|
636
896
|
*/
|
|
637
897
|
declare class HScanCommand extends Command<[
|
|
638
|
-
|
|
898
|
+
string,
|
|
639
899
|
(string | number)[]
|
|
640
900
|
], [
|
|
641
|
-
|
|
901
|
+
string,
|
|
642
902
|
(string | number)[]
|
|
643
903
|
]> {
|
|
644
|
-
constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[
|
|
904
|
+
constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
645
905
|
}
|
|
646
906
|
|
|
647
907
|
/**
|
|
648
908
|
* @see https://redis.io/commands/hset
|
|
649
909
|
*/
|
|
650
910
|
declare class HSetCommand<TData> extends Command<number, number> {
|
|
651
|
-
constructor([key, kv]: [key: string, kv:
|
|
652
|
-
[field: string]: TData;
|
|
653
|
-
}], opts?: CommandOptions<number, number>);
|
|
911
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
654
912
|
}
|
|
655
913
|
|
|
656
914
|
/**
|
|
@@ -667,6 +925,10 @@ declare class HStrLenCommand extends Command<number, number> {
|
|
|
667
925
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
668
926
|
}
|
|
669
927
|
|
|
928
|
+
declare class HTtlCommand extends Command<number[], number[]> {
|
|
929
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
930
|
+
}
|
|
931
|
+
|
|
670
932
|
/**
|
|
671
933
|
* @see https://redis.io/commands/hvals
|
|
672
934
|
*/
|
|
@@ -773,6 +1035,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
773
1035
|
] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
|
|
774
1036
|
}
|
|
775
1037
|
|
|
1038
|
+
/**
|
|
1039
|
+
* @see https://redis.io/commands/json.merge
|
|
1040
|
+
*/
|
|
1041
|
+
declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
|
|
1042
|
+
constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
776
1045
|
/**
|
|
777
1046
|
* @see https://redis.io/commands/json.mget
|
|
778
1047
|
*/
|
|
@@ -780,6 +1049,17 @@ declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
|
|
|
780
1049
|
constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
|
|
781
1050
|
}
|
|
782
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* @see https://redis.io/commands/json.mset
|
|
1054
|
+
*/
|
|
1055
|
+
declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
|
|
1056
|
+
constructor(cmd: {
|
|
1057
|
+
key: string;
|
|
1058
|
+
path: string;
|
|
1059
|
+
value: TData;
|
|
1060
|
+
}[], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
783
1063
|
/**
|
|
784
1064
|
* @see https://redis.io/commands/json.numincrby
|
|
785
1065
|
*/
|
|
@@ -936,25 +1216,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
|
|
|
936
1216
|
* @see https://redis.io/commands/mget
|
|
937
1217
|
*/
|
|
938
1218
|
declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
|
|
939
|
-
constructor(cmd: [string[]] | [...
|
|
1219
|
+
constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
|
|
940
1220
|
}
|
|
941
1221
|
|
|
942
1222
|
/**
|
|
943
1223
|
* @see https://redis.io/commands/mset
|
|
944
1224
|
*/
|
|
945
1225
|
declare class MSetCommand<TData> extends Command<"OK", "OK"> {
|
|
946
|
-
constructor([kv]: [kv:
|
|
947
|
-
[key: string]: TData;
|
|
948
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
1226
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
949
1227
|
}
|
|
950
1228
|
|
|
951
1229
|
/**
|
|
952
1230
|
* @see https://redis.io/commands/msetnx
|
|
953
1231
|
*/
|
|
954
1232
|
declare class MSetNXCommand<TData = string> extends Command<number, number> {
|
|
955
|
-
constructor([kv]: [kv:
|
|
956
|
-
[key: string]: TData;
|
|
957
|
-
}], opts?: CommandOptions<number, number>);
|
|
1233
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
958
1234
|
}
|
|
959
1235
|
|
|
960
1236
|
/**
|
|
@@ -968,14 +1244,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
|
|
|
968
1244
|
* @see https://redis.io/commands/pexpire
|
|
969
1245
|
*/
|
|
970
1246
|
declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
971
|
-
constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1247
|
+
constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
972
1248
|
}
|
|
973
1249
|
|
|
974
1250
|
/**
|
|
975
1251
|
* @see https://redis.io/commands/pexpireat
|
|
976
1252
|
*/
|
|
977
1253
|
declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
978
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1254
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
979
1255
|
}
|
|
980
1256
|
|
|
981
1257
|
/**
|
|
@@ -1052,7 +1328,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
|
|
|
1052
1328
|
* @see https://redis.io/commands/sadd
|
|
1053
1329
|
*/
|
|
1054
1330
|
declare class SAddCommand<TData = string> extends Command<number, number> {
|
|
1055
|
-
constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1331
|
+
constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1056
1332
|
}
|
|
1057
1333
|
|
|
1058
1334
|
/**
|
|
@@ -1240,13 +1516,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
|
|
|
1240
1516
|
* @see https://redis.io/commands/sscan
|
|
1241
1517
|
*/
|
|
1242
1518
|
declare class SScanCommand extends Command<[
|
|
1243
|
-
|
|
1519
|
+
string,
|
|
1244
1520
|
(string | number)[]
|
|
1245
1521
|
], [
|
|
1246
|
-
|
|
1522
|
+
string,
|
|
1247
1523
|
(string | number)[]
|
|
1248
1524
|
]> {
|
|
1249
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1525
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1250
1526
|
}
|
|
1251
1527
|
|
|
1252
1528
|
/**
|
|
@@ -1321,9 +1597,7 @@ declare class XAddCommand extends Command<string, string> {
|
|
|
1321
1597
|
constructor([key, id, entries, opts]: [
|
|
1322
1598
|
key: string,
|
|
1323
1599
|
id: "*" | string,
|
|
1324
|
-
entries:
|
|
1325
|
-
[field: string]: unknown;
|
|
1326
|
-
},
|
|
1600
|
+
entries: Record<string, unknown>,
|
|
1327
1601
|
opts?: XAddCommandOptions
|
|
1328
1602
|
], commandOptions?: CommandOptions<string, string>);
|
|
1329
1603
|
}
|
|
@@ -1337,16 +1611,33 @@ type XReadCommandOptions = [
|
|
|
1337
1611
|
id: string | string[],
|
|
1338
1612
|
options?: {
|
|
1339
1613
|
count?: number;
|
|
1614
|
+
/**
|
|
1615
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1616
|
+
*/
|
|
1340
1617
|
blockMS?: number;
|
|
1341
1618
|
}
|
|
1342
1619
|
];
|
|
1343
|
-
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1620
|
+
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
|
|
1621
|
+
key: string,
|
|
1622
|
+
id: string,
|
|
1623
|
+
options?: {
|
|
1624
|
+
count?: number;
|
|
1625
|
+
/**
|
|
1626
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1627
|
+
*/
|
|
1628
|
+
blockMS?: number;
|
|
1629
|
+
}
|
|
1630
|
+
] : never : K extends string[] ? I extends string[] ? [
|
|
1631
|
+
key: string[],
|
|
1632
|
+
id: string[],
|
|
1633
|
+
options?: {
|
|
1634
|
+
count?: number;
|
|
1635
|
+
/**
|
|
1636
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1637
|
+
*/
|
|
1638
|
+
blockMS?: number;
|
|
1639
|
+
}
|
|
1640
|
+
] : never : never : never;
|
|
1350
1641
|
/**
|
|
1351
1642
|
* @see https://redis.io/commands/xread
|
|
1352
1643
|
*/
|
|
@@ -1356,6 +1647,9 @@ declare class XReadCommand extends Command<number, unknown[]> {
|
|
|
1356
1647
|
|
|
1357
1648
|
type Options = {
|
|
1358
1649
|
count?: number;
|
|
1650
|
+
/**
|
|
1651
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1652
|
+
*/
|
|
1359
1653
|
blockMS?: number;
|
|
1360
1654
|
NOACK?: boolean;
|
|
1361
1655
|
};
|
|
@@ -1533,7 +1827,11 @@ declare class ZRemRangeByRankCommand extends Command<number, number> {
|
|
|
1533
1827
|
* @see https://redis.io/commands/zremrangebyscore
|
|
1534
1828
|
*/
|
|
1535
1829
|
declare class ZRemRangeByScoreCommand extends Command<number, number> {
|
|
1536
|
-
constructor(cmd: [
|
|
1830
|
+
constructor(cmd: [
|
|
1831
|
+
key: string,
|
|
1832
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
1833
|
+
max: number | `(${number}` | "-inf" | "+inf"
|
|
1834
|
+
], opts?: CommandOptions<number, number>);
|
|
1537
1835
|
}
|
|
1538
1836
|
|
|
1539
1837
|
/**
|
|
@@ -1547,13 +1845,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
|
|
|
1547
1845
|
* @see https://redis.io/commands/zscan
|
|
1548
1846
|
*/
|
|
1549
1847
|
declare class ZScanCommand extends Command<[
|
|
1550
|
-
|
|
1848
|
+
string,
|
|
1551
1849
|
(string | number)[]
|
|
1552
1850
|
], [
|
|
1553
|
-
|
|
1851
|
+
string,
|
|
1554
1852
|
(string | number)[]
|
|
1555
1853
|
]> {
|
|
1556
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1854
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1557
1855
|
}
|
|
1558
1856
|
|
|
1559
1857
|
/**
|
|
@@ -1563,9 +1861,79 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1563
1861
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1564
1862
|
}
|
|
1565
1863
|
|
|
1864
|
+
type BaseMessageData<TMessage> = {
|
|
1865
|
+
channel: string;
|
|
1866
|
+
message: TMessage;
|
|
1867
|
+
};
|
|
1868
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1869
|
+
pattern: string;
|
|
1870
|
+
};
|
|
1871
|
+
type SubscriptionCountEvent = number;
|
|
1872
|
+
type MessageEventMap<TMessage> = {
|
|
1873
|
+
message: BaseMessageData<TMessage>;
|
|
1874
|
+
subscribe: SubscriptionCountEvent;
|
|
1875
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1876
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1877
|
+
psubscribe: SubscriptionCountEvent;
|
|
1878
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1879
|
+
error: Error;
|
|
1880
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1881
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1882
|
+
};
|
|
1883
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1884
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1885
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1886
|
+
private subscriptions;
|
|
1887
|
+
private client;
|
|
1888
|
+
private listeners;
|
|
1889
|
+
private opts?;
|
|
1890
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean, opts?: Pick<RedisOptions, "automaticDeserialization">);
|
|
1891
|
+
private subscribeToChannel;
|
|
1892
|
+
private subscribeToPattern;
|
|
1893
|
+
private handleMessage;
|
|
1894
|
+
private dispatchToListeners;
|
|
1895
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1896
|
+
removeAllListeners(): void;
|
|
1897
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1898
|
+
getSubscribedChannels(): string[];
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1566
1901
|
type InferResponseData<T extends unknown[]> = {
|
|
1567
1902
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1568
1903
|
};
|
|
1904
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1905
|
+
/**
|
|
1906
|
+
* Send the pipeline request to upstash.
|
|
1907
|
+
*
|
|
1908
|
+
* Returns an array with the results of all pipelined commands.
|
|
1909
|
+
*
|
|
1910
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1911
|
+
* ```ts
|
|
1912
|
+
* const p = redis.pipeline()
|
|
1913
|
+
* p.get("key")
|
|
1914
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1915
|
+
* ```
|
|
1916
|
+
*
|
|
1917
|
+
* 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.
|
|
1918
|
+
*
|
|
1919
|
+
* 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 }`.
|
|
1920
|
+
*
|
|
1921
|
+
* ```ts
|
|
1922
|
+
* const p = redis.pipeline()
|
|
1923
|
+
* p.get("key")
|
|
1924
|
+
*
|
|
1925
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1926
|
+
* const getResult = result[0].result
|
|
1927
|
+
* const getError = result[0].error
|
|
1928
|
+
* ```
|
|
1929
|
+
*/
|
|
1930
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1931
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1932
|
+
keepErrors: true;
|
|
1933
|
+
}): Promise<{
|
|
1934
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1935
|
+
}>;
|
|
1936
|
+
}
|
|
1569
1937
|
/**
|
|
1570
1938
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1571
1939
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1614,19 +1982,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1614
1982
|
commandOptions?: CommandOptions<any, any>;
|
|
1615
1983
|
multiExec?: boolean;
|
|
1616
1984
|
});
|
|
1617
|
-
|
|
1618
|
-
* Send the pipeline request to upstash.
|
|
1619
|
-
*
|
|
1620
|
-
* Returns an array with the results of all pipelined commands.
|
|
1621
|
-
*
|
|
1622
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1623
|
-
* ```ts
|
|
1624
|
-
* const p = redis.pipeline()
|
|
1625
|
-
* p.get("key")
|
|
1626
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1627
|
-
* ```
|
|
1628
|
-
*/
|
|
1629
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1985
|
+
exec: ExecMethod<TCommands>;
|
|
1630
1986
|
/**
|
|
1631
1987
|
* Returns the length of pipeline before the execution
|
|
1632
1988
|
*/
|
|
@@ -1644,6 +2000,23 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1644
2000
|
* @see https://redis.io/commands/bitcount
|
|
1645
2001
|
*/
|
|
1646
2002
|
bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2003
|
+
/**
|
|
2004
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
2005
|
+
*
|
|
2006
|
+
* @example
|
|
2007
|
+
* ```typescript
|
|
2008
|
+
* redis.set("mykey", 0);
|
|
2009
|
+
* const result = await redis.pipeline()
|
|
2010
|
+
* .bitfield("mykey")
|
|
2011
|
+
* .set("u4", 0, 16)
|
|
2012
|
+
* .incr("u4", "#1", 1)
|
|
2013
|
+
* .exec();
|
|
2014
|
+
* console.log(result); // [[0, 1]]
|
|
2015
|
+
* ```
|
|
2016
|
+
*
|
|
2017
|
+
* @see https://redis.io/commands/bitfield
|
|
2018
|
+
*/
|
|
2019
|
+
bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
|
|
1647
2020
|
/**
|
|
1648
2021
|
* @see https://redis.io/commands/bitop
|
|
1649
2022
|
*/
|
|
@@ -1685,10 +2058,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1685
2058
|
* @see https://redis.io/commands/echo
|
|
1686
2059
|
*/
|
|
1687
2060
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2061
|
+
/**
|
|
2062
|
+
* @see https://redis.io/commands/eval_ro
|
|
2063
|
+
*/
|
|
2064
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1688
2065
|
/**
|
|
1689
2066
|
* @see https://redis.io/commands/eval
|
|
1690
2067
|
*/
|
|
1691
2068
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2069
|
+
/**
|
|
2070
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
2071
|
+
*/
|
|
2072
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1692
2073
|
/**
|
|
1693
2074
|
* @see https://redis.io/commands/evalsha
|
|
1694
2075
|
*/
|
|
@@ -1700,11 +2081,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1700
2081
|
/**
|
|
1701
2082
|
* @see https://redis.io/commands/expire
|
|
1702
2083
|
*/
|
|
1703
|
-
expire: (key: string, seconds: number, option?:
|
|
2084
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1704
2085
|
/**
|
|
1705
2086
|
* @see https://redis.io/commands/expireat
|
|
1706
2087
|
*/
|
|
1707
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2088
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1708
2089
|
/**
|
|
1709
2090
|
* @see https://redis.io/commands/flushall
|
|
1710
2091
|
*/
|
|
@@ -1713,31 +2094,31 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1713
2094
|
* @see https://redis.io/commands/flushdb
|
|
1714
2095
|
*/
|
|
1715
2096
|
flushdb: (opts?: {
|
|
1716
|
-
async?: boolean
|
|
2097
|
+
async?: boolean;
|
|
1717
2098
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1718
2099
|
/**
|
|
1719
2100
|
* @see https://redis.io/commands/geoadd
|
|
1720
2101
|
*/
|
|
1721
|
-
geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<
|
|
2102
|
+
geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
1722
2103
|
/**
|
|
1723
2104
|
* @see https://redis.io/commands/geodist
|
|
1724
2105
|
*/
|
|
1725
|
-
geodist: (key: string, member1:
|
|
2106
|
+
geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
1726
2107
|
/**
|
|
1727
2108
|
* @see https://redis.io/commands/geopos
|
|
1728
2109
|
*/
|
|
1729
|
-
geopos: (args_0: string, ...args_1:
|
|
2110
|
+
geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
|
|
1730
2111
|
lng: number;
|
|
1731
2112
|
lat: number;
|
|
1732
2113
|
}[]>]>;
|
|
1733
2114
|
/**
|
|
1734
2115
|
* @see https://redis.io/commands/geohash
|
|
1735
2116
|
*/
|
|
1736
|
-
geohash: (args_0: string, ...args_1:
|
|
2117
|
+
geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
|
|
1737
2118
|
/**
|
|
1738
2119
|
* @see https://redis.io/commands/geosearch
|
|
1739
2120
|
*/
|
|
1740
|
-
geosearch: (key: string, centerPoint: {
|
|
2121
|
+
geosearch: <TData>(key: string, centerPoint: {
|
|
1741
2122
|
type: "FROMLONLAT" | "fromlonlat";
|
|
1742
2123
|
coordinate: {
|
|
1743
2124
|
lon: number;
|
|
@@ -1745,7 +2126,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1745
2126
|
};
|
|
1746
2127
|
} | {
|
|
1747
2128
|
type: "FROMMEMBER" | "frommember";
|
|
1748
|
-
member:
|
|
2129
|
+
member: TData;
|
|
1749
2130
|
}, shape: {
|
|
1750
2131
|
type: "BYRADIUS" | "byradius";
|
|
1751
2132
|
radius: number;
|
|
@@ -1760,13 +2141,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1760
2141
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1761
2142
|
count?: {
|
|
1762
2143
|
limit: number;
|
|
1763
|
-
any?: boolean
|
|
1764
|
-
}
|
|
1765
|
-
withCoord?: boolean
|
|
1766
|
-
withDist?: boolean
|
|
1767
|
-
withHash?: boolean
|
|
2144
|
+
any?: boolean;
|
|
2145
|
+
};
|
|
2146
|
+
withCoord?: boolean;
|
|
2147
|
+
withDist?: boolean;
|
|
2148
|
+
withHash?: boolean;
|
|
1768
2149
|
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
1769
|
-
member:
|
|
2150
|
+
member: TData;
|
|
1770
2151
|
} & {
|
|
1771
2152
|
coord?: {
|
|
1772
2153
|
long: number;
|
|
@@ -1778,7 +2159,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1778
2159
|
/**
|
|
1779
2160
|
* @see https://redis.io/commands/geosearchstore
|
|
1780
2161
|
*/
|
|
1781
|
-
geosearchstore: (destination: string, key: string, centerPoint: {
|
|
2162
|
+
geosearchstore: <TData>(destination: string, key: string, centerPoint: {
|
|
1782
2163
|
type: "FROMLONLAT" | "fromlonlat";
|
|
1783
2164
|
coordinate: {
|
|
1784
2165
|
lon: number;
|
|
@@ -1786,7 +2167,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1786
2167
|
};
|
|
1787
2168
|
} | {
|
|
1788
2169
|
type: "FROMMEMBER" | "frommember";
|
|
1789
|
-
member:
|
|
2170
|
+
member: TData;
|
|
1790
2171
|
}, shape: {
|
|
1791
2172
|
type: "BYRADIUS" | "byradius";
|
|
1792
2173
|
radius: number;
|
|
@@ -1801,9 +2182,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1801
2182
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1802
2183
|
count?: {
|
|
1803
2184
|
limit: number;
|
|
1804
|
-
any?: boolean
|
|
1805
|
-
}
|
|
1806
|
-
storeDist?: boolean
|
|
2185
|
+
any?: boolean;
|
|
2186
|
+
};
|
|
2187
|
+
storeDist?: boolean;
|
|
1807
2188
|
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1808
2189
|
/**
|
|
1809
2190
|
* @see https://redis.io/commands/get
|
|
@@ -1817,6 +2198,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1817
2198
|
* @see https://redis.io/commands/getdel
|
|
1818
2199
|
*/
|
|
1819
2200
|
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2201
|
+
/**
|
|
2202
|
+
* @see https://redis.io/commands/getex
|
|
2203
|
+
*/
|
|
2204
|
+
getex: <TData>(key: string, opts?: ({
|
|
2205
|
+
ex: number;
|
|
2206
|
+
px?: never;
|
|
2207
|
+
exat?: never;
|
|
2208
|
+
pxat?: never;
|
|
2209
|
+
persist?: never;
|
|
2210
|
+
} | {
|
|
2211
|
+
ex?: never;
|
|
2212
|
+
px: number;
|
|
2213
|
+
exat?: never;
|
|
2214
|
+
pxat?: never;
|
|
2215
|
+
persist?: never;
|
|
2216
|
+
} | {
|
|
2217
|
+
ex?: never;
|
|
2218
|
+
px?: never;
|
|
2219
|
+
exat: number;
|
|
2220
|
+
pxat?: never;
|
|
2221
|
+
persist?: never;
|
|
2222
|
+
} | {
|
|
2223
|
+
ex?: never;
|
|
2224
|
+
px?: never;
|
|
2225
|
+
exat?: never;
|
|
2226
|
+
pxat: number;
|
|
2227
|
+
persist?: never;
|
|
2228
|
+
} | {
|
|
2229
|
+
ex?: never;
|
|
2230
|
+
px?: never;
|
|
2231
|
+
exat?: never;
|
|
2232
|
+
pxat?: never;
|
|
2233
|
+
persist: true;
|
|
2234
|
+
} | {
|
|
2235
|
+
ex?: never;
|
|
2236
|
+
px?: never;
|
|
2237
|
+
exat?: never;
|
|
2238
|
+
pxat?: never;
|
|
2239
|
+
persist?: never;
|
|
2240
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1820
2241
|
/**
|
|
1821
2242
|
* @see https://redis.io/commands/getrange
|
|
1822
2243
|
*/
|
|
@@ -1833,6 +2254,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1833
2254
|
* @see https://redis.io/commands/hexists
|
|
1834
2255
|
*/
|
|
1835
2256
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2257
|
+
/**
|
|
2258
|
+
* @see https://redis.io/commands/hexpire
|
|
2259
|
+
*/
|
|
2260
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2261
|
+
/**
|
|
2262
|
+
* @see https://redis.io/commands/hexpireat
|
|
2263
|
+
*/
|
|
2264
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2265
|
+
/**
|
|
2266
|
+
* @see https://redis.io/commands/hexpiretime
|
|
2267
|
+
*/
|
|
2268
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2269
|
+
/**
|
|
2270
|
+
* @see https://redis.io/commands/httl
|
|
2271
|
+
*/
|
|
2272
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2273
|
+
/**
|
|
2274
|
+
* @see https://redis.io/commands/hpexpire
|
|
2275
|
+
*/
|
|
2276
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2277
|
+
/**
|
|
2278
|
+
* @see https://redis.io/commands/hpexpireat
|
|
2279
|
+
*/
|
|
2280
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2281
|
+
/**
|
|
2282
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
2283
|
+
*/
|
|
2284
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2285
|
+
/**
|
|
2286
|
+
* @see https://redis.io/commands/hpttl
|
|
2287
|
+
*/
|
|
2288
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2289
|
+
/**
|
|
2290
|
+
* @see https://redis.io/commands/hpersist
|
|
2291
|
+
*/
|
|
2292
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
1836
2293
|
/**
|
|
1837
2294
|
* @see https://redis.io/commands/hget
|
|
1838
2295
|
*/
|
|
@@ -1864,9 +2321,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1864
2321
|
/**
|
|
1865
2322
|
* @see https://redis.io/commands/hmset
|
|
1866
2323
|
*/
|
|
1867
|
-
hmset: <TData>(key: string, kv:
|
|
1868
|
-
[field: string]: TData;
|
|
1869
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2324
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1870
2325
|
/**
|
|
1871
2326
|
* @see https://redis.io/commands/hrandfield
|
|
1872
2327
|
*/
|
|
@@ -1874,13 +2329,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1874
2329
|
/**
|
|
1875
2330
|
* @see https://redis.io/commands/hscan
|
|
1876
2331
|
*/
|
|
1877
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2332
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
1878
2333
|
/**
|
|
1879
2334
|
* @see https://redis.io/commands/hset
|
|
1880
2335
|
*/
|
|
1881
|
-
hset: <TData>(key: string, kv:
|
|
1882
|
-
[field: string]: TData;
|
|
1883
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2336
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1884
2337
|
/**
|
|
1885
2338
|
* @see https://redis.io/commands/hsetnx
|
|
1886
2339
|
*/
|
|
@@ -1929,13 +2382,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1929
2382
|
* @see https://redis.io/commands/lpop
|
|
1930
2383
|
*/
|
|
1931
2384
|
lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2385
|
+
/**
|
|
2386
|
+
* @see https://redis.io/commands/lmpop
|
|
2387
|
+
*/
|
|
2388
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
|
|
1932
2389
|
/**
|
|
1933
2390
|
* @see https://redis.io/commands/lpos
|
|
1934
2391
|
*/
|
|
1935
2392
|
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
1936
|
-
rank?: number
|
|
1937
|
-
count?: number
|
|
1938
|
-
maxLen?: number
|
|
2393
|
+
rank?: number;
|
|
2394
|
+
count?: number;
|
|
2395
|
+
maxLen?: number;
|
|
1939
2396
|
} | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1940
2397
|
/**
|
|
1941
2398
|
* @see https://redis.io/commands/lpush
|
|
@@ -1968,15 +2425,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1968
2425
|
/**
|
|
1969
2426
|
* @see https://redis.io/commands/mset
|
|
1970
2427
|
*/
|
|
1971
|
-
mset: <TData>(kv:
|
|
1972
|
-
[key: string]: TData;
|
|
1973
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2428
|
+
mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1974
2429
|
/**
|
|
1975
2430
|
* @see https://redis.io/commands/msetnx
|
|
1976
2431
|
*/
|
|
1977
|
-
msetnx: <TData>(kv:
|
|
1978
|
-
[key: string]: TData;
|
|
1979
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2432
|
+
msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1980
2433
|
/**
|
|
1981
2434
|
* @see https://redis.io/commands/persist
|
|
1982
2435
|
*/
|
|
@@ -1984,11 +2437,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1984
2437
|
/**
|
|
1985
2438
|
* @see https://redis.io/commands/pexpire
|
|
1986
2439
|
*/
|
|
1987
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2440
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1988
2441
|
/**
|
|
1989
2442
|
* @see https://redis.io/commands/pexpireat
|
|
1990
2443
|
*/
|
|
1991
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2444
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1992
2445
|
/**
|
|
1993
2446
|
* @see https://redis.io/commands/pfadd
|
|
1994
2447
|
*/
|
|
@@ -2044,11 +2497,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2044
2497
|
/**
|
|
2045
2498
|
* @see https://redis.io/commands/sadd
|
|
2046
2499
|
*/
|
|
2047
|
-
sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2500
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2048
2501
|
/**
|
|
2049
2502
|
* @see https://redis.io/commands/scan
|
|
2050
2503
|
*/
|
|
2051
|
-
scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2504
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2052
2505
|
/**
|
|
2053
2506
|
* @see https://redis.io/commands/scard
|
|
2054
2507
|
*/
|
|
@@ -2129,7 +2582,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2129
2582
|
/**
|
|
2130
2583
|
* @see https://redis.io/commands/sscan
|
|
2131
2584
|
*/
|
|
2132
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2585
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2133
2586
|
/**
|
|
2134
2587
|
* @see https://redis.io/commands/strlen
|
|
2135
2588
|
*/
|
|
@@ -2165,15 +2618,13 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2165
2618
|
/**
|
|
2166
2619
|
* @see https://redis.io/commands/zadd
|
|
2167
2620
|
*/
|
|
2168
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2621
|
+
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>]>;
|
|
2169
2622
|
/**
|
|
2170
2623
|
* @see https://redis.io/commands/xadd
|
|
2171
2624
|
*/
|
|
2172
|
-
xadd: (key: string, id: string, entries: {
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
nomkStream?: boolean | undefined;
|
|
2176
|
-
trim?: (({
|
|
2625
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
2626
|
+
nomkStream?: boolean;
|
|
2627
|
+
trim?: ({
|
|
2177
2628
|
type: "MAXLEN" | "maxlen";
|
|
2178
2629
|
threshold: number;
|
|
2179
2630
|
} | {
|
|
@@ -2181,11 +2632,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2181
2632
|
threshold: string;
|
|
2182
2633
|
}) & ({
|
|
2183
2634
|
comparison: "~";
|
|
2184
|
-
limit?: number
|
|
2635
|
+
limit?: number;
|
|
2185
2636
|
} | {
|
|
2186
2637
|
comparison: "=";
|
|
2187
|
-
limit?:
|
|
2188
|
-
})
|
|
2638
|
+
limit?: never;
|
|
2639
|
+
});
|
|
2189
2640
|
} | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2190
2641
|
/**
|
|
2191
2642
|
* @see https://redis.io/commands/xack
|
|
@@ -2201,11 +2652,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2201
2652
|
xgroup: (key: string, opts: {
|
|
2202
2653
|
type: "CREATE";
|
|
2203
2654
|
group: string;
|
|
2204
|
-
id: string;
|
|
2655
|
+
id: `$` | string;
|
|
2205
2656
|
options?: {
|
|
2206
|
-
MKSTREAM?: boolean
|
|
2207
|
-
ENTRIESREAD?: number
|
|
2208
|
-
}
|
|
2657
|
+
MKSTREAM?: boolean;
|
|
2658
|
+
ENTRIESREAD?: number;
|
|
2659
|
+
};
|
|
2209
2660
|
} | {
|
|
2210
2661
|
type: "CREATECONSUMER";
|
|
2211
2662
|
group: string;
|
|
@@ -2220,10 +2671,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2220
2671
|
} | {
|
|
2221
2672
|
type: "SETID";
|
|
2222
2673
|
group: string;
|
|
2223
|
-
id: string;
|
|
2674
|
+
id: `$` | string;
|
|
2224
2675
|
options?: {
|
|
2225
|
-
ENTRIESREAD?: number
|
|
2226
|
-
}
|
|
2676
|
+
ENTRIESREAD?: number;
|
|
2677
|
+
};
|
|
2227
2678
|
}) => Pipeline<[...TCommands, Command<any, never>]>;
|
|
2228
2679
|
/**
|
|
2229
2680
|
* @see https://redis.io/commands/xread
|
|
@@ -2250,35 +2701,35 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2250
2701
|
* @see https://redis.io/commands/xpending
|
|
2251
2702
|
*/
|
|
2252
2703
|
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
2253
|
-
idleTime?: number
|
|
2254
|
-
consumer?: string | string[]
|
|
2704
|
+
idleTime?: number;
|
|
2705
|
+
consumer?: string | string[];
|
|
2255
2706
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2256
2707
|
/**
|
|
2257
2708
|
* @see https://redis.io/commands/xclaim
|
|
2258
2709
|
*/
|
|
2259
2710
|
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
2260
|
-
idleMS?: number
|
|
2261
|
-
timeMS?: number
|
|
2262
|
-
retryCount?: number
|
|
2263
|
-
force?: boolean
|
|
2264
|
-
justId?: boolean
|
|
2265
|
-
lastId?: number
|
|
2711
|
+
idleMS?: number;
|
|
2712
|
+
timeMS?: number;
|
|
2713
|
+
retryCount?: number;
|
|
2714
|
+
force?: boolean;
|
|
2715
|
+
justId?: boolean;
|
|
2716
|
+
lastId?: number;
|
|
2266
2717
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2267
2718
|
/**
|
|
2268
2719
|
* @see https://redis.io/commands/xautoclaim
|
|
2269
2720
|
*/
|
|
2270
2721
|
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
2271
|
-
count?: number
|
|
2272
|
-
justId?: boolean
|
|
2722
|
+
count?: number;
|
|
2723
|
+
justId?: boolean;
|
|
2273
2724
|
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2274
2725
|
/**
|
|
2275
2726
|
* @see https://redis.io/commands/xtrim
|
|
2276
2727
|
*/
|
|
2277
2728
|
xtrim: (key: string, options: {
|
|
2278
2729
|
strategy: "MAXLEN" | "MINID";
|
|
2279
|
-
exactness?: "~" | "="
|
|
2280
|
-
threshold:
|
|
2281
|
-
limit?: number
|
|
2730
|
+
exactness?: "~" | "=";
|
|
2731
|
+
threshold: number | string;
|
|
2732
|
+
limit?: number;
|
|
2282
2733
|
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2283
2734
|
/**
|
|
2284
2735
|
* @see https://redis.io/commands/xrange
|
|
@@ -2323,21 +2774,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2323
2774
|
/**
|
|
2324
2775
|
* @see https://redis.io/commands/zrange
|
|
2325
2776
|
*/
|
|
2326
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
byLex: true;
|
|
2332
|
-
} & ZRangeCommandOptions
|
|
2333
|
-
] | [
|
|
2334
|
-
key: string,
|
|
2335
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
2336
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
2337
|
-
opts: {
|
|
2338
|
-
byScore: true;
|
|
2339
|
-
} & ZRangeCommandOptions
|
|
2340
|
-
]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2777
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
2778
|
+
byLex: true;
|
|
2779
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
2780
|
+
byScore: true;
|
|
2781
|
+
} & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2341
2782
|
/**
|
|
2342
2783
|
* @see https://redis.io/commands/zrank
|
|
2343
2784
|
*/
|
|
@@ -2357,7 +2798,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2357
2798
|
/**
|
|
2358
2799
|
* @see https://redis.io/commands/zremrangebyscore
|
|
2359
2800
|
*/
|
|
2360
|
-
zremrangebyscore: (key: string, min: number, max: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2801
|
+
zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2361
2802
|
/**
|
|
2362
2803
|
* @see https://redis.io/commands/zrevrank
|
|
2363
2804
|
*/
|
|
@@ -2365,7 +2806,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2365
2806
|
/**
|
|
2366
2807
|
* @see https://redis.io/commands/zscan
|
|
2367
2808
|
*/
|
|
2368
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2809
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2369
2810
|
/**
|
|
2370
2811
|
* @see https://redis.io/commands/zscore
|
|
2371
2812
|
*/
|
|
@@ -2422,10 +2863,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2422
2863
|
* @see https://redis.io/commands/json.get
|
|
2423
2864
|
*/
|
|
2424
2865
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2866
|
+
/**
|
|
2867
|
+
* @see https://redis.io/commands/json.merge
|
|
2868
|
+
*/
|
|
2869
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2425
2870
|
/**
|
|
2426
2871
|
* @see https://redis.io/commands/json.mget
|
|
2427
2872
|
*/
|
|
2428
2873
|
mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2874
|
+
/**
|
|
2875
|
+
* @see https://redis.io/commands/json.mset
|
|
2876
|
+
*/
|
|
2877
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2429
2878
|
/**
|
|
2430
2879
|
* @see https://redis.io/commands/json.numincrby
|
|
2431
2880
|
*/
|
|
@@ -2451,9 +2900,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2451
2900
|
*/
|
|
2452
2901
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2453
2902
|
nx: true;
|
|
2454
|
-
xx?:
|
|
2903
|
+
xx?: never;
|
|
2455
2904
|
} | {
|
|
2456
|
-
nx?:
|
|
2905
|
+
nx?: never;
|
|
2457
2906
|
xx: true;
|
|
2458
2907
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2459
2908
|
/**
|
|
@@ -2473,6 +2922,52 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2473
2922
|
*/
|
|
2474
2923
|
type: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, string[]>]>;
|
|
2475
2924
|
};
|
|
2925
|
+
get functions(): {
|
|
2926
|
+
/**
|
|
2927
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
2928
|
+
*/
|
|
2929
|
+
load: (args: FunctionLoadArgs) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2930
|
+
/**
|
|
2931
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
2932
|
+
*/
|
|
2933
|
+
list: (args?: FunctionListArgs | undefined) => Pipeline<[...TCommands, Command<any, {
|
|
2934
|
+
libraryName: string;
|
|
2935
|
+
engine: string;
|
|
2936
|
+
functions: {
|
|
2937
|
+
name: string;
|
|
2938
|
+
description?: string;
|
|
2939
|
+
flags: string[];
|
|
2940
|
+
}[];
|
|
2941
|
+
libraryCode?: string;
|
|
2942
|
+
}[]>]>;
|
|
2943
|
+
/**
|
|
2944
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
2945
|
+
*/
|
|
2946
|
+
delete: (libraryName: string) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2947
|
+
/**
|
|
2948
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
2949
|
+
*/
|
|
2950
|
+
flush: () => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2951
|
+
/**
|
|
2952
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
2953
|
+
*/
|
|
2954
|
+
stats: () => Pipeline<[...TCommands, Command<any, {
|
|
2955
|
+
engines: {
|
|
2956
|
+
[k: string]: {
|
|
2957
|
+
librariesCount: unknown;
|
|
2958
|
+
functionsCount: unknown;
|
|
2959
|
+
};
|
|
2960
|
+
};
|
|
2961
|
+
}>]>;
|
|
2962
|
+
/**
|
|
2963
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
2964
|
+
*/
|
|
2965
|
+
call: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2966
|
+
/**
|
|
2967
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
2968
|
+
*/
|
|
2969
|
+
callRo: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2970
|
+
};
|
|
2476
2971
|
}
|
|
2477
2972
|
|
|
2478
2973
|
/**
|
|
@@ -2493,9 +2988,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2493
2988
|
*/
|
|
2494
2989
|
declare class Script<TResult = unknown> {
|
|
2495
2990
|
readonly script: string;
|
|
2496
|
-
|
|
2991
|
+
/**
|
|
2992
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2993
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2994
|
+
*
|
|
2995
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2996
|
+
* future major release.
|
|
2997
|
+
*/
|
|
2998
|
+
sha1: string;
|
|
2497
2999
|
private readonly redis;
|
|
2498
3000
|
constructor(redis: Redis, script: string);
|
|
3001
|
+
/**
|
|
3002
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
3003
|
+
*/
|
|
3004
|
+
private init;
|
|
2499
3005
|
/**
|
|
2500
3006
|
* Send an `EVAL` command to redis.
|
|
2501
3007
|
*/
|
|
@@ -2517,6 +3023,56 @@ declare class Script<TResult = unknown> {
|
|
|
2517
3023
|
private digest;
|
|
2518
3024
|
}
|
|
2519
3025
|
|
|
3026
|
+
/**
|
|
3027
|
+
* Creates a new script.
|
|
3028
|
+
*
|
|
3029
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3030
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3031
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3032
|
+
*
|
|
3033
|
+
* @example
|
|
3034
|
+
* ```ts
|
|
3035
|
+
* const redis = new Redis({...})
|
|
3036
|
+
*
|
|
3037
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
3038
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3039
|
+
* expect(arg1, "Hello World")
|
|
3040
|
+
* ```
|
|
3041
|
+
*/
|
|
3042
|
+
declare class ScriptRO<TResult = unknown> {
|
|
3043
|
+
readonly script: string;
|
|
3044
|
+
/**
|
|
3045
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
3046
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
3047
|
+
*
|
|
3048
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
3049
|
+
* future major release.
|
|
3050
|
+
*/
|
|
3051
|
+
sha1: string;
|
|
3052
|
+
private readonly redis;
|
|
3053
|
+
constructor(redis: Redis, script: string);
|
|
3054
|
+
private init;
|
|
3055
|
+
/**
|
|
3056
|
+
* Send an `EVAL_RO` command to redis.
|
|
3057
|
+
*/
|
|
3058
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
3059
|
+
/**
|
|
3060
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
3061
|
+
*/
|
|
3062
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
3065
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
3066
|
+
*
|
|
3067
|
+
* Following calls will be able to use the cached script
|
|
3068
|
+
*/
|
|
3069
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
3070
|
+
/**
|
|
3071
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
3072
|
+
*/
|
|
3073
|
+
private digest;
|
|
3074
|
+
}
|
|
3075
|
+
|
|
2520
3076
|
/**
|
|
2521
3077
|
* Serverless redis client for upstash.
|
|
2522
3078
|
*/
|
|
@@ -2524,6 +3080,7 @@ declare class Redis {
|
|
|
2524
3080
|
protected client: Requester;
|
|
2525
3081
|
protected opts?: CommandOptions<any, any>;
|
|
2526
3082
|
protected enableTelemetry: boolean;
|
|
3083
|
+
protected enableAutoPipelining: boolean;
|
|
2527
3084
|
/**
|
|
2528
3085
|
* Create a new redis client
|
|
2529
3086
|
*
|
|
@@ -2536,6 +3093,8 @@ declare class Redis {
|
|
|
2536
3093
|
* ```
|
|
2537
3094
|
*/
|
|
2538
3095
|
constructor(client: Requester, opts?: RedisOptions);
|
|
3096
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
3097
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2539
3098
|
get json(): {
|
|
2540
3099
|
/**
|
|
2541
3100
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2577,10 +3136,18 @@ declare class Redis {
|
|
|
2577
3136
|
* @see https://redis.io/commands/json.get
|
|
2578
3137
|
*/
|
|
2579
3138
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3139
|
+
/**
|
|
3140
|
+
* @see https://redis.io/commands/json.merge
|
|
3141
|
+
*/
|
|
3142
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2580
3143
|
/**
|
|
2581
3144
|
* @see https://redis.io/commands/json.mget
|
|
2582
3145
|
*/
|
|
2583
|
-
mget: <
|
|
3146
|
+
mget: <TData>(keys: string[], path: string) => Promise<TData>;
|
|
3147
|
+
/**
|
|
3148
|
+
* @see https://redis.io/commands/json.mset
|
|
3149
|
+
*/
|
|
3150
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
|
|
2584
3151
|
/**
|
|
2585
3152
|
* @see https://redis.io/commands/json.numincrby
|
|
2586
3153
|
*/
|
|
@@ -2606,9 +3173,9 @@ declare class Redis {
|
|
|
2606
3173
|
*/
|
|
2607
3174
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2608
3175
|
nx: true;
|
|
2609
|
-
xx?:
|
|
3176
|
+
xx?: never;
|
|
2610
3177
|
} | {
|
|
2611
|
-
nx?:
|
|
3178
|
+
nx?: never;
|
|
2612
3179
|
xx: true;
|
|
2613
3180
|
} | undefined) => Promise<"OK" | null>;
|
|
2614
3181
|
/**
|
|
@@ -2628,6 +3195,54 @@ declare class Redis {
|
|
|
2628
3195
|
*/
|
|
2629
3196
|
type: (key: string, path?: string | undefined) => Promise<string[]>;
|
|
2630
3197
|
};
|
|
3198
|
+
get functions(): {
|
|
3199
|
+
/**
|
|
3200
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
3201
|
+
*/
|
|
3202
|
+
load: (args: FunctionLoadArgs) => Promise<string>;
|
|
3203
|
+
/**
|
|
3204
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
3205
|
+
*/
|
|
3206
|
+
list: (args?: FunctionListArgs | undefined) => Promise<{
|
|
3207
|
+
libraryName: string;
|
|
3208
|
+
engine: string;
|
|
3209
|
+
functions: {
|
|
3210
|
+
name: string;
|
|
3211
|
+
description?: string;
|
|
3212
|
+
flags: string[];
|
|
3213
|
+
}[];
|
|
3214
|
+
libraryCode?: string;
|
|
3215
|
+
}[]>;
|
|
3216
|
+
/**
|
|
3217
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
3218
|
+
*/
|
|
3219
|
+
delete: (libraryName: string) => Promise<"OK">;
|
|
3220
|
+
/**
|
|
3221
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
3222
|
+
*/
|
|
3223
|
+
flush: () => Promise<"OK">;
|
|
3224
|
+
/**
|
|
3225
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
3226
|
+
*
|
|
3227
|
+
* Note: `running_script` field is not supported and therefore not included in the type.
|
|
3228
|
+
*/
|
|
3229
|
+
stats: () => Promise<{
|
|
3230
|
+
engines: {
|
|
3231
|
+
[k: string]: {
|
|
3232
|
+
librariesCount: unknown;
|
|
3233
|
+
functionsCount: unknown;
|
|
3234
|
+
};
|
|
3235
|
+
};
|
|
3236
|
+
}>;
|
|
3237
|
+
/**
|
|
3238
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
3239
|
+
*/
|
|
3240
|
+
call: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise<TData>;
|
|
3241
|
+
/**
|
|
3242
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
3243
|
+
*/
|
|
3244
|
+
callRo: <TData = unknown>(functionName: string, keys?: string[] | undefined, args?: string[] | undefined) => Promise<TData>;
|
|
3245
|
+
};
|
|
2631
3246
|
/**
|
|
2632
3247
|
* Wrap a new middleware around the HTTP client.
|
|
2633
3248
|
*/
|
|
@@ -2636,13 +3251,44 @@ declare class Redis {
|
|
|
2636
3251
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2637
3252
|
*/
|
|
2638
3253
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2639
|
-
|
|
3254
|
+
/**
|
|
3255
|
+
* Creates a new script.
|
|
3256
|
+
*
|
|
3257
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3258
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3259
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3260
|
+
*
|
|
3261
|
+
* @param script - The script to create
|
|
3262
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3263
|
+
* @returns A new script
|
|
3264
|
+
*
|
|
3265
|
+
* @example
|
|
3266
|
+
* ```ts
|
|
3267
|
+
* const redis = new Redis({...})
|
|
3268
|
+
*
|
|
3269
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3270
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3271
|
+
* expect(arg1, "Hello World")
|
|
3272
|
+
* ```
|
|
3273
|
+
* @example
|
|
3274
|
+
* ```ts
|
|
3275
|
+
* const redis = new Redis({...})
|
|
3276
|
+
*
|
|
3277
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3278
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3279
|
+
* expect(arg1, "Hello World")
|
|
3280
|
+
* ```
|
|
3281
|
+
*/
|
|
3282
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3283
|
+
readonly?: TReadonly;
|
|
3284
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2640
3285
|
/**
|
|
2641
3286
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2642
3287
|
*
|
|
2643
3288
|
* @see {@link Pipeline}
|
|
2644
3289
|
*/
|
|
2645
3290
|
pipeline: () => Pipeline<[]>;
|
|
3291
|
+
protected autoPipeline: () => Redis;
|
|
2646
3292
|
/**
|
|
2647
3293
|
* Create a new transaction to allow executing multiple steps atomically.
|
|
2648
3294
|
*
|
|
@@ -2653,6 +3299,22 @@ declare class Redis {
|
|
|
2653
3299
|
* @see {@link Pipeline}
|
|
2654
3300
|
*/
|
|
2655
3301
|
multi: () => Pipeline<[]>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
3304
|
+
*
|
|
3305
|
+
* @example
|
|
3306
|
+
* ```typescript
|
|
3307
|
+
* redis.set("mykey", 0);
|
|
3308
|
+
* const result = await redis.bitfield("mykey")
|
|
3309
|
+
* .set("u4", 0, 16)
|
|
3310
|
+
* .incr("u4", "#1", 1)
|
|
3311
|
+
* .exec();
|
|
3312
|
+
* console.log(result); // [0, 1]
|
|
3313
|
+
* ```
|
|
3314
|
+
*
|
|
3315
|
+
* @see https://redis.io/commands/bitfield
|
|
3316
|
+
*/
|
|
3317
|
+
bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
|
|
2656
3318
|
/**
|
|
2657
3319
|
* @see https://redis.io/commands/append
|
|
2658
3320
|
*/
|
|
@@ -2698,14 +3360,26 @@ declare class Redis {
|
|
|
2698
3360
|
* @see https://redis.io/commands/echo
|
|
2699
3361
|
*/
|
|
2700
3362
|
echo: (message: string) => Promise<string>;
|
|
3363
|
+
/**
|
|
3364
|
+
* @see https://redis.io/commands/eval_ro
|
|
3365
|
+
*/
|
|
3366
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2701
3367
|
/**
|
|
2702
3368
|
* @see https://redis.io/commands/eval
|
|
2703
3369
|
*/
|
|
2704
3370
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3371
|
+
/**
|
|
3372
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3373
|
+
*/
|
|
3374
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2705
3375
|
/**
|
|
2706
3376
|
* @see https://redis.io/commands/evalsha
|
|
2707
3377
|
*/
|
|
2708
3378
|
evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3379
|
+
/**
|
|
3380
|
+
* Generic method to execute any Redis command.
|
|
3381
|
+
*/
|
|
3382
|
+
exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
|
|
2709
3383
|
/**
|
|
2710
3384
|
* @see https://redis.io/commands/exists
|
|
2711
3385
|
*/
|
|
@@ -2713,11 +3387,11 @@ declare class Redis {
|
|
|
2713
3387
|
/**
|
|
2714
3388
|
* @see https://redis.io/commands/expire
|
|
2715
3389
|
*/
|
|
2716
|
-
expire: (key: string, seconds: number, option?:
|
|
3390
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2717
3391
|
/**
|
|
2718
3392
|
* @see https://redis.io/commands/expireat
|
|
2719
3393
|
*/
|
|
2720
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3394
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2721
3395
|
/**
|
|
2722
3396
|
* @see https://redis.io/commands/flushall
|
|
2723
3397
|
*/
|
|
@@ -2726,31 +3400,31 @@ declare class Redis {
|
|
|
2726
3400
|
* @see https://redis.io/commands/flushdb
|
|
2727
3401
|
*/
|
|
2728
3402
|
flushdb: (opts?: {
|
|
2729
|
-
async?: boolean
|
|
3403
|
+
async?: boolean;
|
|
2730
3404
|
} | undefined) => Promise<"OK">;
|
|
2731
3405
|
/**
|
|
2732
3406
|
* @see https://redis.io/commands/geoadd
|
|
2733
3407
|
*/
|
|
2734
|
-
geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<
|
|
3408
|
+
geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
|
|
2735
3409
|
/**
|
|
2736
3410
|
* @see https://redis.io/commands/geopos
|
|
2737
3411
|
*/
|
|
2738
|
-
geopos: (args_0: string, ...args_1:
|
|
3412
|
+
geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
|
|
2739
3413
|
lng: number;
|
|
2740
3414
|
lat: number;
|
|
2741
3415
|
}[]>;
|
|
2742
3416
|
/**
|
|
2743
3417
|
* @see https://redis.io/commands/geodist
|
|
2744
3418
|
*/
|
|
2745
|
-
geodist: (key: string, member1:
|
|
3419
|
+
geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
|
|
2746
3420
|
/**
|
|
2747
3421
|
* @see https://redis.io/commands/geohash
|
|
2748
3422
|
*/
|
|
2749
|
-
geohash: (args_0: string, ...args_1:
|
|
3423
|
+
geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
|
|
2750
3424
|
/**
|
|
2751
3425
|
* @see https://redis.io/commands/geosearch
|
|
2752
3426
|
*/
|
|
2753
|
-
geosearch: (key: string, centerPoint: {
|
|
3427
|
+
geosearch: <TData>(key: string, centerPoint: {
|
|
2754
3428
|
type: "FROMLONLAT" | "fromlonlat";
|
|
2755
3429
|
coordinate: {
|
|
2756
3430
|
lon: number;
|
|
@@ -2758,7 +3432,7 @@ declare class Redis {
|
|
|
2758
3432
|
};
|
|
2759
3433
|
} | {
|
|
2760
3434
|
type: "FROMMEMBER" | "frommember";
|
|
2761
|
-
member:
|
|
3435
|
+
member: TData;
|
|
2762
3436
|
}, shape: {
|
|
2763
3437
|
type: "BYRADIUS" | "byradius";
|
|
2764
3438
|
radius: number;
|
|
@@ -2773,13 +3447,13 @@ declare class Redis {
|
|
|
2773
3447
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2774
3448
|
count?: {
|
|
2775
3449
|
limit: number;
|
|
2776
|
-
any?: boolean
|
|
2777
|
-
}
|
|
2778
|
-
withCoord?: boolean
|
|
2779
|
-
withDist?: boolean
|
|
2780
|
-
withHash?: boolean
|
|
3450
|
+
any?: boolean;
|
|
3451
|
+
};
|
|
3452
|
+
withCoord?: boolean;
|
|
3453
|
+
withDist?: boolean;
|
|
3454
|
+
withHash?: boolean;
|
|
2781
3455
|
} | undefined) => Promise<({
|
|
2782
|
-
member:
|
|
3456
|
+
member: TData;
|
|
2783
3457
|
} & {
|
|
2784
3458
|
coord?: {
|
|
2785
3459
|
long: number;
|
|
@@ -2791,7 +3465,7 @@ declare class Redis {
|
|
|
2791
3465
|
/**
|
|
2792
3466
|
* @see https://redis.io/commands/geosearchstore
|
|
2793
3467
|
*/
|
|
2794
|
-
geosearchstore: (destination: string, key: string, centerPoint: {
|
|
3468
|
+
geosearchstore: <TData>(destination: string, key: string, centerPoint: {
|
|
2795
3469
|
type: "FROMLONLAT" | "fromlonlat";
|
|
2796
3470
|
coordinate: {
|
|
2797
3471
|
lon: number;
|
|
@@ -2799,7 +3473,7 @@ declare class Redis {
|
|
|
2799
3473
|
};
|
|
2800
3474
|
} | {
|
|
2801
3475
|
type: "FROMMEMBER" | "frommember";
|
|
2802
|
-
member:
|
|
3476
|
+
member: TData;
|
|
2803
3477
|
}, shape: {
|
|
2804
3478
|
type: "BYRADIUS" | "byradius";
|
|
2805
3479
|
radius: number;
|
|
@@ -2814,9 +3488,9 @@ declare class Redis {
|
|
|
2814
3488
|
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2815
3489
|
count?: {
|
|
2816
3490
|
limit: number;
|
|
2817
|
-
any?: boolean
|
|
2818
|
-
}
|
|
2819
|
-
storeDist?: boolean
|
|
3491
|
+
any?: boolean;
|
|
3492
|
+
};
|
|
3493
|
+
storeDist?: boolean;
|
|
2820
3494
|
} | undefined) => Promise<number>;
|
|
2821
3495
|
/**
|
|
2822
3496
|
* @see https://redis.io/commands/get
|
|
@@ -2830,6 +3504,46 @@ declare class Redis {
|
|
|
2830
3504
|
* @see https://redis.io/commands/getdel
|
|
2831
3505
|
*/
|
|
2832
3506
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3507
|
+
/**
|
|
3508
|
+
* @see https://redis.io/commands/getex
|
|
3509
|
+
*/
|
|
3510
|
+
getex: <TData>(key: string, opts?: ({
|
|
3511
|
+
ex: number;
|
|
3512
|
+
px?: never;
|
|
3513
|
+
exat?: never;
|
|
3514
|
+
pxat?: never;
|
|
3515
|
+
persist?: never;
|
|
3516
|
+
} | {
|
|
3517
|
+
ex?: never;
|
|
3518
|
+
px: number;
|
|
3519
|
+
exat?: never;
|
|
3520
|
+
pxat?: never;
|
|
3521
|
+
persist?: never;
|
|
3522
|
+
} | {
|
|
3523
|
+
ex?: never;
|
|
3524
|
+
px?: never;
|
|
3525
|
+
exat: number;
|
|
3526
|
+
pxat?: never;
|
|
3527
|
+
persist?: never;
|
|
3528
|
+
} | {
|
|
3529
|
+
ex?: never;
|
|
3530
|
+
px?: never;
|
|
3531
|
+
exat?: never;
|
|
3532
|
+
pxat: number;
|
|
3533
|
+
persist?: never;
|
|
3534
|
+
} | {
|
|
3535
|
+
ex?: never;
|
|
3536
|
+
px?: never;
|
|
3537
|
+
exat?: never;
|
|
3538
|
+
pxat?: never;
|
|
3539
|
+
persist: true;
|
|
3540
|
+
} | {
|
|
3541
|
+
ex?: never;
|
|
3542
|
+
px?: never;
|
|
3543
|
+
exat?: never;
|
|
3544
|
+
pxat?: never;
|
|
3545
|
+
persist?: never;
|
|
3546
|
+
}) | undefined) => Promise<TData | null>;
|
|
2833
3547
|
/**
|
|
2834
3548
|
* @see https://redis.io/commands/getrange
|
|
2835
3549
|
*/
|
|
@@ -2846,6 +3560,42 @@ declare class Redis {
|
|
|
2846
3560
|
* @see https://redis.io/commands/hexists
|
|
2847
3561
|
*/
|
|
2848
3562
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3563
|
+
/**
|
|
3564
|
+
* @see https://redis.io/commands/hexpire
|
|
3565
|
+
*/
|
|
3566
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3567
|
+
/**
|
|
3568
|
+
* @see https://redis.io/commands/hexpireat
|
|
3569
|
+
*/
|
|
3570
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3571
|
+
/**
|
|
3572
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3573
|
+
*/
|
|
3574
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3575
|
+
/**
|
|
3576
|
+
* @see https://redis.io/commands/httl
|
|
3577
|
+
*/
|
|
3578
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3579
|
+
/**
|
|
3580
|
+
* @see https://redis.io/commands/hpexpire
|
|
3581
|
+
*/
|
|
3582
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3583
|
+
/**
|
|
3584
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3585
|
+
*/
|
|
3586
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3587
|
+
/**
|
|
3588
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3589
|
+
*/
|
|
3590
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3591
|
+
/**
|
|
3592
|
+
* @see https://redis.io/commands/hpttl
|
|
3593
|
+
*/
|
|
3594
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3595
|
+
/**
|
|
3596
|
+
* @see https://redis.io/commands/hpersist
|
|
3597
|
+
*/
|
|
3598
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2849
3599
|
/**
|
|
2850
3600
|
* @see https://redis.io/commands/hget
|
|
2851
3601
|
*/
|
|
@@ -2877,27 +3627,23 @@ declare class Redis {
|
|
|
2877
3627
|
/**
|
|
2878
3628
|
* @see https://redis.io/commands/hmset
|
|
2879
3629
|
*/
|
|
2880
|
-
hmset: <TData>(key: string, kv:
|
|
2881
|
-
[field: string]: TData;
|
|
2882
|
-
}) => Promise<"OK">;
|
|
3630
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
|
|
2883
3631
|
/**
|
|
2884
3632
|
* @see https://redis.io/commands/hrandfield
|
|
2885
3633
|
*/
|
|
2886
3634
|
hrandfield: {
|
|
2887
|
-
(key: string): Promise<string>;
|
|
3635
|
+
(key: string): Promise<string | null>;
|
|
2888
3636
|
(key: string, count: number): Promise<string[]>;
|
|
2889
3637
|
<TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
|
|
2890
3638
|
};
|
|
2891
3639
|
/**
|
|
2892
3640
|
* @see https://redis.io/commands/hscan
|
|
2893
3641
|
*/
|
|
2894
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[
|
|
3642
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
2895
3643
|
/**
|
|
2896
3644
|
* @see https://redis.io/commands/hset
|
|
2897
3645
|
*/
|
|
2898
|
-
hset: <TData>(key: string, kv:
|
|
2899
|
-
[field: string]: TData;
|
|
2900
|
-
}) => Promise<number>;
|
|
3646
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
|
|
2901
3647
|
/**
|
|
2902
3648
|
* @see https://redis.io/commands/hsetnx
|
|
2903
3649
|
*/
|
|
@@ -2946,13 +3692,17 @@ declare class Redis {
|
|
|
2946
3692
|
* @see https://redis.io/commands/lpop
|
|
2947
3693
|
*/
|
|
2948
3694
|
lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
3695
|
+
/**
|
|
3696
|
+
* @see https://redis.io/commands/lmpop
|
|
3697
|
+
*/
|
|
3698
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
|
|
2949
3699
|
/**
|
|
2950
3700
|
* @see https://redis.io/commands/lpos
|
|
2951
3701
|
*/
|
|
2952
3702
|
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
2953
|
-
rank?: number
|
|
2954
|
-
count?: number
|
|
2955
|
-
maxLen?: number
|
|
3703
|
+
rank?: number;
|
|
3704
|
+
count?: number;
|
|
3705
|
+
maxLen?: number;
|
|
2956
3706
|
} | undefined) => Promise<TData>;
|
|
2957
3707
|
/**
|
|
2958
3708
|
* @see https://redis.io/commands/lpush
|
|
@@ -2985,15 +3735,11 @@ declare class Redis {
|
|
|
2985
3735
|
/**
|
|
2986
3736
|
* @see https://redis.io/commands/mset
|
|
2987
3737
|
*/
|
|
2988
|
-
mset: <TData>(kv:
|
|
2989
|
-
[key: string]: TData;
|
|
2990
|
-
}) => Promise<"OK">;
|
|
3738
|
+
mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
|
|
2991
3739
|
/**
|
|
2992
3740
|
* @see https://redis.io/commands/msetnx
|
|
2993
3741
|
*/
|
|
2994
|
-
msetnx: <TData>(kv:
|
|
2995
|
-
[key: string]: TData;
|
|
2996
|
-
}) => Promise<number>;
|
|
3742
|
+
msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
|
|
2997
3743
|
/**
|
|
2998
3744
|
* @see https://redis.io/commands/persist
|
|
2999
3745
|
*/
|
|
@@ -3001,11 +3747,11 @@ declare class Redis {
|
|
|
3001
3747
|
/**
|
|
3002
3748
|
* @see https://redis.io/commands/pexpire
|
|
3003
3749
|
*/
|
|
3004
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3750
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3005
3751
|
/**
|
|
3006
3752
|
* @see https://redis.io/commands/pexpireat
|
|
3007
3753
|
*/
|
|
3008
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3754
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3009
3755
|
/**
|
|
3010
3756
|
* @see https://redis.io/commands/pfadd
|
|
3011
3757
|
*/
|
|
@@ -3026,6 +3772,10 @@ declare class Redis {
|
|
|
3026
3772
|
* @see https://redis.io/commands/psetex
|
|
3027
3773
|
*/
|
|
3028
3774
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3775
|
+
/**
|
|
3776
|
+
* @see https://redis.io/commands/psubscribe
|
|
3777
|
+
*/
|
|
3778
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3029
3779
|
/**
|
|
3030
3780
|
* @see https://redis.io/commands/pttl
|
|
3031
3781
|
*/
|
|
@@ -3061,11 +3811,14 @@ declare class Redis {
|
|
|
3061
3811
|
/**
|
|
3062
3812
|
* @see https://redis.io/commands/sadd
|
|
3063
3813
|
*/
|
|
3064
|
-
sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
|
|
3814
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
|
|
3065
3815
|
/**
|
|
3066
3816
|
* @see https://redis.io/commands/scan
|
|
3067
3817
|
*/
|
|
3068
|
-
scan
|
|
3818
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
3819
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
3820
|
+
withType: true;
|
|
3821
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
3069
3822
|
/**
|
|
3070
3823
|
* @see https://redis.io/commands/scard
|
|
3071
3824
|
*/
|
|
@@ -3149,11 +3902,15 @@ declare class Redis {
|
|
|
3149
3902
|
/**
|
|
3150
3903
|
* @see https://redis.io/commands/sscan
|
|
3151
3904
|
*/
|
|
3152
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
3905
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
3153
3906
|
/**
|
|
3154
3907
|
* @see https://redis.io/commands/strlen
|
|
3155
3908
|
*/
|
|
3156
3909
|
strlen: (key: string) => Promise<number>;
|
|
3910
|
+
/**
|
|
3911
|
+
* @see https://redis.io/commands/subscribe
|
|
3912
|
+
*/
|
|
3913
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3157
3914
|
/**
|
|
3158
3915
|
* @see https://redis.io/commands/sunion
|
|
3159
3916
|
*/
|
|
@@ -3185,11 +3942,9 @@ declare class Redis {
|
|
|
3185
3942
|
/**
|
|
3186
3943
|
* @see https://redis.io/commands/xadd
|
|
3187
3944
|
*/
|
|
3188
|
-
xadd: (key: string, id: string, entries: {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
nomkStream?: boolean | undefined;
|
|
3192
|
-
trim?: (({
|
|
3945
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
3946
|
+
nomkStream?: boolean;
|
|
3947
|
+
trim?: ({
|
|
3193
3948
|
type: "MAXLEN" | "maxlen";
|
|
3194
3949
|
threshold: number;
|
|
3195
3950
|
} | {
|
|
@@ -3197,11 +3952,11 @@ declare class Redis {
|
|
|
3197
3952
|
threshold: string;
|
|
3198
3953
|
}) & ({
|
|
3199
3954
|
comparison: "~";
|
|
3200
|
-
limit?: number
|
|
3955
|
+
limit?: number;
|
|
3201
3956
|
} | {
|
|
3202
3957
|
comparison: "=";
|
|
3203
|
-
limit?:
|
|
3204
|
-
})
|
|
3958
|
+
limit?: never;
|
|
3959
|
+
});
|
|
3205
3960
|
} | undefined) => Promise<string>;
|
|
3206
3961
|
/**
|
|
3207
3962
|
* @see https://redis.io/commands/xack
|
|
@@ -3217,11 +3972,11 @@ declare class Redis {
|
|
|
3217
3972
|
xgroup: (key: string, opts: {
|
|
3218
3973
|
type: "CREATE";
|
|
3219
3974
|
group: string;
|
|
3220
|
-
id: string;
|
|
3975
|
+
id: `$` | string;
|
|
3221
3976
|
options?: {
|
|
3222
|
-
MKSTREAM?: boolean
|
|
3223
|
-
ENTRIESREAD?: number
|
|
3224
|
-
}
|
|
3977
|
+
MKSTREAM?: boolean;
|
|
3978
|
+
ENTRIESREAD?: number;
|
|
3979
|
+
};
|
|
3225
3980
|
} | {
|
|
3226
3981
|
type: "CREATECONSUMER";
|
|
3227
3982
|
group: string;
|
|
@@ -3236,10 +3991,10 @@ declare class Redis {
|
|
|
3236
3991
|
} | {
|
|
3237
3992
|
type: "SETID";
|
|
3238
3993
|
group: string;
|
|
3239
|
-
id: string;
|
|
3994
|
+
id: `$` | string;
|
|
3240
3995
|
options?: {
|
|
3241
|
-
ENTRIESREAD?: number
|
|
3242
|
-
}
|
|
3996
|
+
ENTRIESREAD?: number;
|
|
3997
|
+
};
|
|
3243
3998
|
}) => Promise<never>;
|
|
3244
3999
|
/**
|
|
3245
4000
|
* @see https://redis.io/commands/xread
|
|
@@ -3266,35 +4021,35 @@ declare class Redis {
|
|
|
3266
4021
|
* @see https://redis.io/commands/xpending
|
|
3267
4022
|
*/
|
|
3268
4023
|
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
3269
|
-
idleTime?: number
|
|
3270
|
-
consumer?: string | string[]
|
|
4024
|
+
idleTime?: number;
|
|
4025
|
+
consumer?: string | string[];
|
|
3271
4026
|
} | undefined) => Promise<unknown[]>;
|
|
3272
4027
|
/**
|
|
3273
4028
|
* @see https://redis.io/commands/xclaim
|
|
3274
4029
|
*/
|
|
3275
4030
|
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
3276
|
-
idleMS?: number
|
|
3277
|
-
timeMS?: number
|
|
3278
|
-
retryCount?: number
|
|
3279
|
-
force?: boolean
|
|
3280
|
-
justId?: boolean
|
|
3281
|
-
lastId?: number
|
|
4031
|
+
idleMS?: number;
|
|
4032
|
+
timeMS?: number;
|
|
4033
|
+
retryCount?: number;
|
|
4034
|
+
force?: boolean;
|
|
4035
|
+
justId?: boolean;
|
|
4036
|
+
lastId?: number;
|
|
3282
4037
|
} | undefined) => Promise<unknown[]>;
|
|
3283
4038
|
/**
|
|
3284
4039
|
* @see https://redis.io/commands/xautoclaim
|
|
3285
4040
|
*/
|
|
3286
4041
|
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
3287
|
-
count?: number
|
|
3288
|
-
justId?: boolean
|
|
4042
|
+
count?: number;
|
|
4043
|
+
justId?: boolean;
|
|
3289
4044
|
} | undefined) => Promise<unknown[]>;
|
|
3290
4045
|
/**
|
|
3291
4046
|
* @see https://redis.io/commands/xtrim
|
|
3292
4047
|
*/
|
|
3293
4048
|
xtrim: (key: string, options: {
|
|
3294
4049
|
strategy: "MAXLEN" | "MINID";
|
|
3295
|
-
exactness?: "~" | "="
|
|
3296
|
-
threshold:
|
|
3297
|
-
limit?: number
|
|
4050
|
+
exactness?: "~" | "=";
|
|
4051
|
+
threshold: number | string;
|
|
4052
|
+
limit?: number;
|
|
3298
4053
|
}) => Promise<number>;
|
|
3299
4054
|
/**
|
|
3300
4055
|
* @see https://redis.io/commands/xrange
|
|
@@ -3307,7 +4062,7 @@ declare class Redis {
|
|
|
3307
4062
|
/**
|
|
3308
4063
|
* @see https://redis.io/commands/zadd
|
|
3309
4064
|
*/
|
|
3310
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<number | null>;
|
|
4065
|
+
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
|
|
3311
4066
|
/**
|
|
3312
4067
|
* @see https://redis.io/commands/zcard
|
|
3313
4068
|
*/
|
|
@@ -3347,21 +4102,11 @@ declare class Redis {
|
|
|
3347
4102
|
/**
|
|
3348
4103
|
* @see https://redis.io/commands/zrange
|
|
3349
4104
|
*/
|
|
3350
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
byLex: true;
|
|
3356
|
-
} & ZRangeCommandOptions
|
|
3357
|
-
] | [
|
|
3358
|
-
key: string,
|
|
3359
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
3360
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
3361
|
-
opts: {
|
|
3362
|
-
byScore: true;
|
|
3363
|
-
} & ZRangeCommandOptions
|
|
3364
|
-
]) => Promise<TData>;
|
|
4105
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
4106
|
+
byLex: true;
|
|
4107
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
4108
|
+
byScore: true;
|
|
4109
|
+
} & ZRangeCommandOptions]) => Promise<TData>;
|
|
3365
4110
|
/**
|
|
3366
4111
|
* @see https://redis.io/commands/zrank
|
|
3367
4112
|
*/
|
|
@@ -3381,7 +4126,7 @@ declare class Redis {
|
|
|
3381
4126
|
/**
|
|
3382
4127
|
* @see https://redis.io/commands/zremrangebyscore
|
|
3383
4128
|
*/
|
|
3384
|
-
zremrangebyscore: (key: string, min: number, max: number) => Promise<number>;
|
|
4129
|
+
zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Promise<number>;
|
|
3385
4130
|
/**
|
|
3386
4131
|
* @see https://redis.io/commands/zrevrank
|
|
3387
4132
|
*/
|
|
@@ -3389,7 +4134,7 @@ declare class Redis {
|
|
|
3389
4134
|
/**
|
|
3390
4135
|
* @see https://redis.io/commands/zscan
|
|
3391
4136
|
*/
|
|
3392
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
4137
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
3393
4138
|
/**
|
|
3394
4139
|
* @see https://redis.io/commands/zscore
|
|
3395
4140
|
*/
|
|
@@ -3404,6 +4149,30 @@ declare class Redis {
|
|
|
3404
4149
|
zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
|
|
3405
4150
|
}
|
|
3406
4151
|
|
|
4152
|
+
type UpstashErrorOptions = Pick<NonNullable<ConstructorParameters<typeof Error>[1]>, "cause">;
|
|
4153
|
+
/**
|
|
4154
|
+
* Result of a bad request to upstash
|
|
4155
|
+
*/
|
|
4156
|
+
declare class UpstashError extends Error {
|
|
4157
|
+
constructor(message: string, options?: ErrorOptions);
|
|
4158
|
+
}
|
|
4159
|
+
declare class UrlError extends Error {
|
|
4160
|
+
constructor(url: string);
|
|
4161
|
+
}
|
|
4162
|
+
declare class UpstashJSONParseError extends UpstashError {
|
|
4163
|
+
constructor(body: string, options?: UpstashErrorOptions);
|
|
4164
|
+
}
|
|
4165
|
+
|
|
4166
|
+
type error_UpstashError = UpstashError;
|
|
4167
|
+
declare const error_UpstashError: typeof UpstashError;
|
|
4168
|
+
type error_UpstashJSONParseError = UpstashJSONParseError;
|
|
4169
|
+
declare const error_UpstashJSONParseError: typeof UpstashJSONParseError;
|
|
4170
|
+
type error_UrlError = UrlError;
|
|
4171
|
+
declare const error_UrlError: typeof UrlError;
|
|
4172
|
+
declare namespace error {
|
|
4173
|
+
export { error_UpstashError as UpstashError, error_UpstashJSONParseError as UpstashJSONParseError, error_UrlError as UrlError };
|
|
4174
|
+
}
|
|
4175
|
+
|
|
3407
4176
|
/**
|
|
3408
4177
|
* @see https://redis.io/commands/zdiffstore
|
|
3409
4178
|
*/
|
|
@@ -3418,4 +4187,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3418
4187
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3419
4188
|
}
|
|
3420
4189
|
|
|
3421
|
-
export {
|
|
4190
|
+
export { HPersistCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, type HttpClientConfig as H, GetCommand as I, GetBitCommand as J, GetDelCommand as K, GetExCommand as L, GetRangeCommand as M, GetSetCommand as N, HDelCommand as O, Pipeline as P, HExistsCommand as Q, type RedisOptions as R, HExpireCommand as S, HExpireAtCommand as T, type UpstashRequest as U, HExpireTimeCommand as V, HTtlCommand as W, HPExpireCommand as X, HPExpireAtCommand as Y, HPExpireTimeCommand as Z, HPTtlCommand as _, type RequesterConfig as a, RenameNXCommand as a$, HGetCommand as a0, HGetAllCommand as a1, HIncrByCommand as a2, HIncrByFloatCommand as a3, HKeysCommand as a4, HLenCommand as a5, HMGetCommand as a6, HMSetCommand as a7, HRandFieldCommand as a8, HScanCommand as a9, JsonStrLenCommand as aA, JsonToggleCommand as aB, JsonTypeCommand as aC, KeysCommand as aD, LIndexCommand as aE, LInsertCommand as aF, LLenCommand as aG, LMoveCommand as aH, LPopCommand as aI, LPushCommand as aJ, LPushXCommand as aK, LRangeCommand as aL, LRemCommand as aM, LSetCommand as aN, LTrimCommand as aO, MGetCommand as aP, MSetCommand as aQ, MSetNXCommand as aR, PersistCommand as aS, PExpireCommand as aT, PExpireAtCommand as aU, PingCommand as aV, PSetEXCommand as aW, PTtlCommand as aX, PublishCommand as aY, RandomKeyCommand as aZ, RenameCommand as a_, HSetCommand as aa, HSetNXCommand as ab, HStrLenCommand as ac, HValsCommand as ad, IncrCommand as ae, IncrByCommand as af, IncrByFloatCommand as ag, JsonArrAppendCommand as ah, JsonArrIndexCommand as ai, JsonArrInsertCommand as aj, JsonArrLenCommand as ak, JsonArrPopCommand as al, JsonArrTrimCommand as am, JsonClearCommand as an, JsonDelCommand as ao, JsonForgetCommand as ap, JsonGetCommand as aq, JsonMergeCommand as ar, JsonMGetCommand as as, JsonNumIncrByCommand as at, JsonNumMultByCommand as au, JsonObjKeysCommand as av, JsonObjLenCommand as aw, JsonRespCommand as ax, JsonSetCommand as ay, JsonStrAppendCommand as az, Redis as b, type ZUnionCommandOptions as b$, RPopCommand as b0, RPushCommand as b1, RPushXCommand as b2, SAddCommand as b3, ScanCommand as b4, type ScanCommandOptions as b5, SCardCommand as b6, ScriptExistsCommand as b7, ScriptFlushCommand as b8, ScriptLoadCommand as b9, UnlinkCommand as bA, XAddCommand as bB, XRangeCommand as bC, type ScoreMember as bD, type ZAddCommandOptions as bE, ZAddCommand as bF, ZCardCommand as bG, ZCountCommand as bH, ZDiffStoreCommand as bI, ZIncrByCommand as bJ, ZInterStoreCommand as bK, type ZInterStoreCommandOptions as bL, ZLexCountCommand as bM, ZMScoreCommand as bN, ZPopMaxCommand as bO, ZPopMinCommand as bP, ZRangeCommand as bQ, type ZRangeCommandOptions as bR, ZRankCommand as bS, ZRemCommand as bT, ZRemRangeByLexCommand as bU, ZRemRangeByRankCommand as bV, ZRemRangeByScoreCommand as bW, ZRevRankCommand as bX, ZScanCommand as bY, ZScoreCommand as bZ, ZUnionCommand as b_, SDiffCommand as ba, SDiffStoreCommand as bb, SetCommand as bc, type SetCommandOptions as bd, SetBitCommand as be, SetExCommand as bf, SetNxCommand as bg, SetRangeCommand as bh, SInterCommand as bi, SInterStoreCommand as bj, SIsMemberCommand as bk, SMembersCommand as bl, SMIsMemberCommand as bm, SMoveCommand as bn, SPopCommand as bo, SRandMemberCommand as bp, SRemCommand as bq, SScanCommand as br, StrLenCommand as bs, SUnionCommand as bt, SUnionStoreCommand as bu, TimeCommand as bv, TouchCommand as bw, TtlCommand as bx, type Type as by, TypeCommand as bz, type Requester as c, ZUnionStoreCommand as c0, type ZUnionStoreCommandOptions as c1, type UpstashResponse as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalROCommand as k, EvalCommand as l, EvalshaROCommand as m, EvalshaCommand as n, ExistsCommand as o, ExpireCommand as p, type ExpireOption as q, ExpireAtCommand as r, FlushDBCommand as s, type GeoAddCommandOptions as t, type GeoMember as u, GeoDistCommand as v, GeoHashCommand as w, GeoPosCommand as x, GeoSearchCommand as y, GeoSearchStoreCommand as z };
|