@upstash/redis 1.35.0-canary → 1.35.1
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/{dist/chunk-Q4ZBDYYE.mjs → chunk-AIBLSL5D.mjs} +782 -89
- package/cloudflare.d.mts +55 -0
- package/cloudflare.d.ts +55 -0
- package/{dist/cloudflare.js → cloudflare.js} +796 -111
- package/{dist/cloudflare.mjs → cloudflare.mjs} +15 -13
- package/fastly.d.mts +48 -0
- package/fastly.d.ts +48 -0
- package/{dist/fastly.js → fastly.js} +792 -107
- package/{dist/fastly.mjs → fastly.mjs} +11 -9
- package/nodejs.d.mts +73 -0
- package/nodejs.d.ts +73 -0
- package/{dist/nodejs.js → nodejs.js} +799 -113
- package/{dist/nodejs.mjs → nodejs.mjs} +18 -15
- package/package.json +1 -1
- package/{dist/zmscore-BhX8yEQc.d.mts → zmscore-BshEAkn7.d.mts} +591 -46
- package/{dist/zmscore-BhX8yEQc.d.ts → zmscore-BshEAkn7.d.ts} +591 -46
- package/dist/cloudflare.d.mts +0 -55
- package/dist/cloudflare.d.ts +0 -55
- package/dist/fastly.d.mts +0 -48
- package/dist/fastly.d.ts +0 -48
- package/dist/nodejs.d.mts +0 -73
- package/dist/nodejs.d.ts +0 -73
|
@@ -36,7 +36,23 @@ type UpstashRequest = {
|
|
|
36
36
|
* Request body will be serialized to json
|
|
37
37
|
*/
|
|
38
38
|
body?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Additional headers for the request
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
39
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;
|
|
40
56
|
};
|
|
41
57
|
type UpstashResponse<TResult> = {
|
|
42
58
|
result?: TResult;
|
|
@@ -70,6 +86,9 @@ type RetryConfig = false | {
|
|
|
70
86
|
*/
|
|
71
87
|
backoff?: (retryCount: number) => number;
|
|
72
88
|
};
|
|
89
|
+
type Options$1 = {
|
|
90
|
+
backend?: string;
|
|
91
|
+
};
|
|
73
92
|
type RequesterConfig = {
|
|
74
93
|
/**
|
|
75
94
|
* Configure the retry behaviour in case of network errors
|
|
@@ -104,6 +123,19 @@ type RequesterConfig = {
|
|
|
104
123
|
*/
|
|
105
124
|
cache?: CacheSetting;
|
|
106
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;
|
|
107
139
|
|
|
108
140
|
type Serialize = (data: unknown) => string | number | boolean;
|
|
109
141
|
type Deserialize<TResult, TData> = (result: TResult) => TData;
|
|
@@ -119,6 +151,31 @@ type CommandOptions<TResult, TData> = {
|
|
|
119
151
|
*/
|
|
120
152
|
automaticDeserialization?: boolean;
|
|
121
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
|
+
};
|
|
122
179
|
};
|
|
123
180
|
/**
|
|
124
181
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -130,6 +187,11 @@ declare class Command<TResult, TData> {
|
|
|
130
187
|
readonly command: (string | number | boolean)[];
|
|
131
188
|
readonly serialize: Serialize;
|
|
132
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;
|
|
133
195
|
/**
|
|
134
196
|
* Create a new command instance.
|
|
135
197
|
*
|
|
@@ -225,18 +287,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
|
|
|
225
287
|
constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
|
|
226
288
|
}
|
|
227
289
|
|
|
228
|
-
type ScanCommandOptions = {
|
|
229
|
-
match?: string;
|
|
230
|
-
count?: number;
|
|
231
|
-
type?: string;
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* @see https://redis.io/commands/scan
|
|
235
|
-
*/
|
|
236
|
-
declare class ScanCommand extends Command<[string, string[]], [string, string[]]> {
|
|
237
|
-
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], [string, string[]]>);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
290
|
type GeoAddCommandOptions = {
|
|
241
291
|
nx?: boolean;
|
|
242
292
|
xx?: never;
|
|
@@ -262,6 +312,11 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
|
|
|
262
312
|
], opts?: CommandOptions<number | null, number | null>);
|
|
263
313
|
}
|
|
264
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
|
+
|
|
265
320
|
/**
|
|
266
321
|
* @see https://redis.io/commands/append
|
|
267
322
|
*/
|
|
@@ -358,6 +413,13 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
358
413
|
constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
|
|
359
414
|
}
|
|
360
415
|
|
|
416
|
+
/**
|
|
417
|
+
* @see https://redis.io/commands/eval_ro
|
|
418
|
+
*/
|
|
419
|
+
declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
420
|
+
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
421
|
+
}
|
|
422
|
+
|
|
361
423
|
/**
|
|
362
424
|
* @see https://redis.io/commands/eval
|
|
363
425
|
*/
|
|
@@ -365,6 +427,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
|
|
|
365
427
|
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
366
428
|
}
|
|
367
429
|
|
|
430
|
+
/**
|
|
431
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
432
|
+
*/
|
|
433
|
+
declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
434
|
+
constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
435
|
+
}
|
|
436
|
+
|
|
368
437
|
/**
|
|
369
438
|
* @see https://redis.io/commands/evalsha
|
|
370
439
|
*/
|
|
@@ -379,16 +448,11 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
379
448
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
380
449
|
}
|
|
381
450
|
|
|
382
|
-
type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
383
|
-
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
384
|
-
constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
451
|
/**
|
|
388
452
|
* @see https://redis.io/commands/expireat
|
|
389
453
|
*/
|
|
390
454
|
declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
391
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
455
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
392
456
|
}
|
|
393
457
|
|
|
394
458
|
/**
|
|
@@ -563,6 +627,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
|
|
|
563
627
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
564
628
|
}
|
|
565
629
|
|
|
630
|
+
type GetExCommandOptions = {
|
|
631
|
+
ex: number;
|
|
632
|
+
px?: never;
|
|
633
|
+
exat?: never;
|
|
634
|
+
pxat?: never;
|
|
635
|
+
persist?: never;
|
|
636
|
+
} | {
|
|
637
|
+
ex?: never;
|
|
638
|
+
px: number;
|
|
639
|
+
exat?: never;
|
|
640
|
+
pxat?: never;
|
|
641
|
+
persist?: never;
|
|
642
|
+
} | {
|
|
643
|
+
ex?: never;
|
|
644
|
+
px?: never;
|
|
645
|
+
exat: number;
|
|
646
|
+
pxat?: never;
|
|
647
|
+
persist?: never;
|
|
648
|
+
} | {
|
|
649
|
+
ex?: never;
|
|
650
|
+
px?: never;
|
|
651
|
+
exat?: never;
|
|
652
|
+
pxat: number;
|
|
653
|
+
persist?: never;
|
|
654
|
+
} | {
|
|
655
|
+
ex?: never;
|
|
656
|
+
px?: never;
|
|
657
|
+
exat?: never;
|
|
658
|
+
pxat?: never;
|
|
659
|
+
persist: true;
|
|
660
|
+
} | {
|
|
661
|
+
ex?: never;
|
|
662
|
+
px?: never;
|
|
663
|
+
exat?: never;
|
|
664
|
+
pxat?: never;
|
|
665
|
+
persist?: never;
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* @see https://redis.io/commands/getex
|
|
669
|
+
*/
|
|
670
|
+
declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
671
|
+
constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
|
|
672
|
+
}
|
|
673
|
+
|
|
566
674
|
/**
|
|
567
675
|
* @see https://redis.io/commands/getrange
|
|
568
676
|
*/
|
|
@@ -591,6 +699,58 @@ declare class HExistsCommand extends Command<number, number> {
|
|
|
591
699
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
592
700
|
}
|
|
593
701
|
|
|
702
|
+
declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
703
|
+
constructor(cmd: [
|
|
704
|
+
key: string,
|
|
705
|
+
fields: (string | number) | (string | number)[],
|
|
706
|
+
seconds: number,
|
|
707
|
+
option?: ExpireOption
|
|
708
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
712
|
+
constructor(cmd: [
|
|
713
|
+
key: string,
|
|
714
|
+
fields: (string | number) | (string | number)[],
|
|
715
|
+
timestamp: number,
|
|
716
|
+
option?: ExpireOption
|
|
717
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
declare class HExpireTimeCommand extends Command<number[], number[]> {
|
|
721
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
|
|
725
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
729
|
+
constructor(cmd: [
|
|
730
|
+
key: string,
|
|
731
|
+
fields: (string | number) | (string | number)[],
|
|
732
|
+
milliseconds: number,
|
|
733
|
+
option?: ExpireOption
|
|
734
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
738
|
+
constructor(cmd: [
|
|
739
|
+
key: string,
|
|
740
|
+
fields: (string | number) | (string | number)[],
|
|
741
|
+
timestamp: number,
|
|
742
|
+
option?: ExpireOption
|
|
743
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
declare class HPExpireTimeCommand extends Command<number[], number[]> {
|
|
747
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
declare class HPTtlCommand extends Command<number[], number[]> {
|
|
751
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
752
|
+
}
|
|
753
|
+
|
|
594
754
|
/**
|
|
595
755
|
* @see https://redis.io/commands/hget
|
|
596
756
|
*/
|
|
@@ -664,6 +824,39 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
664
824
|
constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
|
|
665
825
|
}
|
|
666
826
|
|
|
827
|
+
type ScanCommandOptionsStandard = {
|
|
828
|
+
match?: string;
|
|
829
|
+
count?: number;
|
|
830
|
+
type?: string;
|
|
831
|
+
withType?: false;
|
|
832
|
+
};
|
|
833
|
+
type ScanCommandOptionsWithType = {
|
|
834
|
+
match?: string;
|
|
835
|
+
count?: number;
|
|
836
|
+
/**
|
|
837
|
+
* Includes types of each key in the result
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* ```typescript
|
|
841
|
+
* await redis.scan("0", { withType: true })
|
|
842
|
+
* // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]]
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
withType: true;
|
|
846
|
+
};
|
|
847
|
+
type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType;
|
|
848
|
+
type ScanResultStandard = [string, string[]];
|
|
849
|
+
type ScanResultWithType = [string, {
|
|
850
|
+
key: string;
|
|
851
|
+
type: string;
|
|
852
|
+
}[]];
|
|
853
|
+
/**
|
|
854
|
+
* @see https://redis.io/commands/scan
|
|
855
|
+
*/
|
|
856
|
+
declare class ScanCommand<TData = ScanResultStandard> extends Command<[string, string[]], TData> {
|
|
857
|
+
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>);
|
|
858
|
+
}
|
|
859
|
+
|
|
667
860
|
/**
|
|
668
861
|
* @see https://redis.io/commands/hscan
|
|
669
862
|
*/
|
|
@@ -698,6 +891,10 @@ declare class HStrLenCommand extends Command<number, number> {
|
|
|
698
891
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
699
892
|
}
|
|
700
893
|
|
|
894
|
+
declare class HTtlCommand extends Command<number[], number[]> {
|
|
895
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
896
|
+
}
|
|
897
|
+
|
|
701
898
|
/**
|
|
702
899
|
* @see https://redis.io/commands/hvals
|
|
703
900
|
*/
|
|
@@ -804,6 +1001,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
804
1001
|
] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
|
|
805
1002
|
}
|
|
806
1003
|
|
|
1004
|
+
/**
|
|
1005
|
+
* @see https://redis.io/commands/json.merge
|
|
1006
|
+
*/
|
|
1007
|
+
declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
|
|
1008
|
+
constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
807
1011
|
/**
|
|
808
1012
|
* @see https://redis.io/commands/json.mget
|
|
809
1013
|
*/
|
|
@@ -1006,14 +1210,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
|
|
|
1006
1210
|
* @see https://redis.io/commands/pexpire
|
|
1007
1211
|
*/
|
|
1008
1212
|
declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
1009
|
-
constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1213
|
+
constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1010
1214
|
}
|
|
1011
1215
|
|
|
1012
1216
|
/**
|
|
1013
1217
|
* @see https://redis.io/commands/pexpireat
|
|
1014
1218
|
*/
|
|
1015
1219
|
declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
1016
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1220
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1017
1221
|
}
|
|
1018
1222
|
|
|
1019
1223
|
/**
|
|
@@ -1599,9 +1803,78 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1599
1803
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1600
1804
|
}
|
|
1601
1805
|
|
|
1806
|
+
type BaseMessageData<TMessage> = {
|
|
1807
|
+
channel: string;
|
|
1808
|
+
message: TMessage;
|
|
1809
|
+
};
|
|
1810
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1811
|
+
pattern: string;
|
|
1812
|
+
};
|
|
1813
|
+
type SubscriptionCountEvent = number;
|
|
1814
|
+
type MessageEventMap<TMessage> = {
|
|
1815
|
+
message: BaseMessageData<TMessage>;
|
|
1816
|
+
subscribe: SubscriptionCountEvent;
|
|
1817
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1818
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1819
|
+
psubscribe: SubscriptionCountEvent;
|
|
1820
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1821
|
+
error: Error;
|
|
1822
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1823
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1824
|
+
};
|
|
1825
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1826
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1827
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1828
|
+
private subscriptions;
|
|
1829
|
+
private client;
|
|
1830
|
+
private listeners;
|
|
1831
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean);
|
|
1832
|
+
private subscribeToChannel;
|
|
1833
|
+
private subscribeToPattern;
|
|
1834
|
+
private handleMessage;
|
|
1835
|
+
private dispatchToListeners;
|
|
1836
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1837
|
+
removeAllListeners(): void;
|
|
1838
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1839
|
+
getSubscribedChannels(): string[];
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1602
1842
|
type InferResponseData<T extends unknown[]> = {
|
|
1603
1843
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1604
1844
|
};
|
|
1845
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1846
|
+
/**
|
|
1847
|
+
* Send the pipeline request to upstash.
|
|
1848
|
+
*
|
|
1849
|
+
* Returns an array with the results of all pipelined commands.
|
|
1850
|
+
*
|
|
1851
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1852
|
+
* ```ts
|
|
1853
|
+
* const p = redis.pipeline()
|
|
1854
|
+
* p.get("key")
|
|
1855
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1856
|
+
* ```
|
|
1857
|
+
*
|
|
1858
|
+
* If one of the commands get an error, the whole pipeline fails. Alternatively, you can set the keepErrors option to true in order to get the errors individually.
|
|
1859
|
+
*
|
|
1860
|
+
* If keepErrors is set to true, a list of objects is returned where each object corresponds to a command and is of type: `{ result: unknown, error?: string }`.
|
|
1861
|
+
*
|
|
1862
|
+
* ```ts
|
|
1863
|
+
* const p = redis.pipeline()
|
|
1864
|
+
* p.get("key")
|
|
1865
|
+
*
|
|
1866
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1867
|
+
* const getResult = result[0].result
|
|
1868
|
+
* const getError = result[0].error
|
|
1869
|
+
* ```
|
|
1870
|
+
*/
|
|
1871
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1872
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1873
|
+
keepErrors: true;
|
|
1874
|
+
}): Promise<{
|
|
1875
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1876
|
+
}>;
|
|
1877
|
+
}
|
|
1605
1878
|
/**
|
|
1606
1879
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1607
1880
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1650,19 +1923,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1650
1923
|
commandOptions?: CommandOptions<any, any>;
|
|
1651
1924
|
multiExec?: boolean;
|
|
1652
1925
|
});
|
|
1653
|
-
|
|
1654
|
-
* Send the pipeline request to upstash.
|
|
1655
|
-
*
|
|
1656
|
-
* Returns an array with the results of all pipelined commands.
|
|
1657
|
-
*
|
|
1658
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1659
|
-
* ```ts
|
|
1660
|
-
* const p = redis.pipeline()
|
|
1661
|
-
* p.get("key")
|
|
1662
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1663
|
-
* ```
|
|
1664
|
-
*/
|
|
1665
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1926
|
+
exec: ExecMethod<TCommands>;
|
|
1666
1927
|
/**
|
|
1667
1928
|
* Returns the length of pipeline before the execution
|
|
1668
1929
|
*/
|
|
@@ -1738,10 +1999,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1738
1999
|
* @see https://redis.io/commands/echo
|
|
1739
2000
|
*/
|
|
1740
2001
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2002
|
+
/**
|
|
2003
|
+
* @see https://redis.io/commands/eval_ro
|
|
2004
|
+
*/
|
|
2005
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1741
2006
|
/**
|
|
1742
2007
|
* @see https://redis.io/commands/eval
|
|
1743
2008
|
*/
|
|
1744
2009
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2010
|
+
/**
|
|
2011
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
2012
|
+
*/
|
|
2013
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1745
2014
|
/**
|
|
1746
2015
|
* @see https://redis.io/commands/evalsha
|
|
1747
2016
|
*/
|
|
@@ -1753,11 +2022,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1753
2022
|
/**
|
|
1754
2023
|
* @see https://redis.io/commands/expire
|
|
1755
2024
|
*/
|
|
1756
|
-
expire: (key: string, seconds: number, option?:
|
|
2025
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1757
2026
|
/**
|
|
1758
2027
|
* @see https://redis.io/commands/expireat
|
|
1759
2028
|
*/
|
|
1760
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2029
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1761
2030
|
/**
|
|
1762
2031
|
* @see https://redis.io/commands/flushall
|
|
1763
2032
|
*/
|
|
@@ -1870,6 +2139,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1870
2139
|
* @see https://redis.io/commands/getdel
|
|
1871
2140
|
*/
|
|
1872
2141
|
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2142
|
+
/**
|
|
2143
|
+
* @see https://redis.io/commands/getex
|
|
2144
|
+
*/
|
|
2145
|
+
getex: <TData>(key: string, opts?: ({
|
|
2146
|
+
ex: number;
|
|
2147
|
+
px?: never;
|
|
2148
|
+
exat?: never;
|
|
2149
|
+
pxat?: never;
|
|
2150
|
+
persist?: never;
|
|
2151
|
+
} | {
|
|
2152
|
+
ex?: never;
|
|
2153
|
+
px: number;
|
|
2154
|
+
exat?: never;
|
|
2155
|
+
pxat?: never;
|
|
2156
|
+
persist?: never;
|
|
2157
|
+
} | {
|
|
2158
|
+
ex?: never;
|
|
2159
|
+
px?: never;
|
|
2160
|
+
exat: number;
|
|
2161
|
+
pxat?: never;
|
|
2162
|
+
persist?: never;
|
|
2163
|
+
} | {
|
|
2164
|
+
ex?: never;
|
|
2165
|
+
px?: never;
|
|
2166
|
+
exat?: never;
|
|
2167
|
+
pxat: number;
|
|
2168
|
+
persist?: never;
|
|
2169
|
+
} | {
|
|
2170
|
+
ex?: never;
|
|
2171
|
+
px?: never;
|
|
2172
|
+
exat?: never;
|
|
2173
|
+
pxat?: never;
|
|
2174
|
+
persist: true;
|
|
2175
|
+
} | {
|
|
2176
|
+
ex?: never;
|
|
2177
|
+
px?: never;
|
|
2178
|
+
exat?: never;
|
|
2179
|
+
pxat?: never;
|
|
2180
|
+
persist?: never;
|
|
2181
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1873
2182
|
/**
|
|
1874
2183
|
* @see https://redis.io/commands/getrange
|
|
1875
2184
|
*/
|
|
@@ -1886,6 +2195,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1886
2195
|
* @see https://redis.io/commands/hexists
|
|
1887
2196
|
*/
|
|
1888
2197
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2198
|
+
/**
|
|
2199
|
+
* @see https://redis.io/commands/hexpire
|
|
2200
|
+
*/
|
|
2201
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2202
|
+
/**
|
|
2203
|
+
* @see https://redis.io/commands/hexpireat
|
|
2204
|
+
*/
|
|
2205
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2206
|
+
/**
|
|
2207
|
+
* @see https://redis.io/commands/hexpiretime
|
|
2208
|
+
*/
|
|
2209
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2210
|
+
/**
|
|
2211
|
+
* @see https://redis.io/commands/httl
|
|
2212
|
+
*/
|
|
2213
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2214
|
+
/**
|
|
2215
|
+
* @see https://redis.io/commands/hpexpire
|
|
2216
|
+
*/
|
|
2217
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2218
|
+
/**
|
|
2219
|
+
* @see https://redis.io/commands/hpexpireat
|
|
2220
|
+
*/
|
|
2221
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2222
|
+
/**
|
|
2223
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
2224
|
+
*/
|
|
2225
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2226
|
+
/**
|
|
2227
|
+
* @see https://redis.io/commands/hpttl
|
|
2228
|
+
*/
|
|
2229
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2230
|
+
/**
|
|
2231
|
+
* @see https://redis.io/commands/hpersist
|
|
2232
|
+
*/
|
|
2233
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
1889
2234
|
/**
|
|
1890
2235
|
* @see https://redis.io/commands/hget
|
|
1891
2236
|
*/
|
|
@@ -2033,11 +2378,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2033
2378
|
/**
|
|
2034
2379
|
* @see https://redis.io/commands/pexpire
|
|
2035
2380
|
*/
|
|
2036
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2381
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2037
2382
|
/**
|
|
2038
2383
|
* @see https://redis.io/commands/pexpireat
|
|
2039
2384
|
*/
|
|
2040
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2385
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2041
2386
|
/**
|
|
2042
2387
|
* @see https://redis.io/commands/pfadd
|
|
2043
2388
|
*/
|
|
@@ -2097,7 +2442,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2097
2442
|
/**
|
|
2098
2443
|
* @see https://redis.io/commands/scan
|
|
2099
2444
|
*/
|
|
2100
|
-
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2445
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2101
2446
|
/**
|
|
2102
2447
|
* @see https://redis.io/commands/scard
|
|
2103
2448
|
*/
|
|
@@ -2459,6 +2804,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2459
2804
|
* @see https://redis.io/commands/json.get
|
|
2460
2805
|
*/
|
|
2461
2806
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2807
|
+
/**
|
|
2808
|
+
* @see https://redis.io/commands/json.merge
|
|
2809
|
+
*/
|
|
2810
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2462
2811
|
/**
|
|
2463
2812
|
* @see https://redis.io/commands/json.mget
|
|
2464
2813
|
*/
|
|
@@ -2534,9 +2883,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2534
2883
|
*/
|
|
2535
2884
|
declare class Script<TResult = unknown> {
|
|
2536
2885
|
readonly script: string;
|
|
2537
|
-
|
|
2886
|
+
/**
|
|
2887
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2888
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2889
|
+
*
|
|
2890
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2891
|
+
* future major release.
|
|
2892
|
+
*/
|
|
2893
|
+
sha1: string;
|
|
2538
2894
|
private readonly redis;
|
|
2539
2895
|
constructor(redis: Redis, script: string);
|
|
2896
|
+
/**
|
|
2897
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
2898
|
+
*/
|
|
2899
|
+
private init;
|
|
2540
2900
|
/**
|
|
2541
2901
|
* Send an `EVAL` command to redis.
|
|
2542
2902
|
*/
|
|
@@ -2558,6 +2918,56 @@ declare class Script<TResult = unknown> {
|
|
|
2558
2918
|
private digest;
|
|
2559
2919
|
}
|
|
2560
2920
|
|
|
2921
|
+
/**
|
|
2922
|
+
* Creates a new script.
|
|
2923
|
+
*
|
|
2924
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
2925
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
2926
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
2927
|
+
*
|
|
2928
|
+
* @example
|
|
2929
|
+
* ```ts
|
|
2930
|
+
* const redis = new Redis({...})
|
|
2931
|
+
*
|
|
2932
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
2933
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
2934
|
+
* expect(arg1, "Hello World")
|
|
2935
|
+
* ```
|
|
2936
|
+
*/
|
|
2937
|
+
declare class ScriptRO<TResult = unknown> {
|
|
2938
|
+
readonly script: string;
|
|
2939
|
+
/**
|
|
2940
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2941
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2942
|
+
*
|
|
2943
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2944
|
+
* future major release.
|
|
2945
|
+
*/
|
|
2946
|
+
sha1: string;
|
|
2947
|
+
private readonly redis;
|
|
2948
|
+
constructor(redis: Redis, script: string);
|
|
2949
|
+
private init;
|
|
2950
|
+
/**
|
|
2951
|
+
* Send an `EVAL_RO` command to redis.
|
|
2952
|
+
*/
|
|
2953
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2954
|
+
/**
|
|
2955
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
2956
|
+
*/
|
|
2957
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2958
|
+
/**
|
|
2959
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
2960
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
2961
|
+
*
|
|
2962
|
+
* Following calls will be able to use the cached script
|
|
2963
|
+
*/
|
|
2964
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
2967
|
+
*/
|
|
2968
|
+
private digest;
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2561
2971
|
/**
|
|
2562
2972
|
* Serverless redis client for upstash.
|
|
2563
2973
|
*/
|
|
@@ -2578,6 +2988,8 @@ declare class Redis {
|
|
|
2578
2988
|
* ```
|
|
2579
2989
|
*/
|
|
2580
2990
|
constructor(client: Requester, opts?: RedisOptions);
|
|
2991
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
2992
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2581
2993
|
get json(): {
|
|
2582
2994
|
/**
|
|
2583
2995
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2619,6 +3031,10 @@ declare class Redis {
|
|
|
2619
3031
|
* @see https://redis.io/commands/json.get
|
|
2620
3032
|
*/
|
|
2621
3033
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3034
|
+
/**
|
|
3035
|
+
* @see https://redis.io/commands/json.merge
|
|
3036
|
+
*/
|
|
3037
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2622
3038
|
/**
|
|
2623
3039
|
* @see https://redis.io/commands/json.mget
|
|
2624
3040
|
*/
|
|
@@ -2682,7 +3098,37 @@ declare class Redis {
|
|
|
2682
3098
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2683
3099
|
*/
|
|
2684
3100
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2685
|
-
|
|
3101
|
+
/**
|
|
3102
|
+
* Creates a new script.
|
|
3103
|
+
*
|
|
3104
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3105
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3106
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3107
|
+
*
|
|
3108
|
+
* @param script - The script to create
|
|
3109
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3110
|
+
* @returns A new script
|
|
3111
|
+
*
|
|
3112
|
+
* @example
|
|
3113
|
+
* ```ts
|
|
3114
|
+
* const redis = new Redis({...})
|
|
3115
|
+
*
|
|
3116
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3117
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3118
|
+
* expect(arg1, "Hello World")
|
|
3119
|
+
* ```
|
|
3120
|
+
* @example
|
|
3121
|
+
* ```ts
|
|
3122
|
+
* const redis = new Redis({...})
|
|
3123
|
+
*
|
|
3124
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3125
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3126
|
+
* expect(arg1, "Hello World")
|
|
3127
|
+
* ```
|
|
3128
|
+
*/
|
|
3129
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3130
|
+
readonly?: TReadonly;
|
|
3131
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2686
3132
|
/**
|
|
2687
3133
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2688
3134
|
*
|
|
@@ -2761,14 +3207,26 @@ declare class Redis {
|
|
|
2761
3207
|
* @see https://redis.io/commands/echo
|
|
2762
3208
|
*/
|
|
2763
3209
|
echo: (message: string) => Promise<string>;
|
|
3210
|
+
/**
|
|
3211
|
+
* @see https://redis.io/commands/eval_ro
|
|
3212
|
+
*/
|
|
3213
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2764
3214
|
/**
|
|
2765
3215
|
* @see https://redis.io/commands/eval
|
|
2766
3216
|
*/
|
|
2767
3217
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3218
|
+
/**
|
|
3219
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3220
|
+
*/
|
|
3221
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2768
3222
|
/**
|
|
2769
3223
|
* @see https://redis.io/commands/evalsha
|
|
2770
3224
|
*/
|
|
2771
3225
|
evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3226
|
+
/**
|
|
3227
|
+
* Generic method to execute any Redis command.
|
|
3228
|
+
*/
|
|
3229
|
+
exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
|
|
2772
3230
|
/**
|
|
2773
3231
|
* @see https://redis.io/commands/exists
|
|
2774
3232
|
*/
|
|
@@ -2776,11 +3234,11 @@ declare class Redis {
|
|
|
2776
3234
|
/**
|
|
2777
3235
|
* @see https://redis.io/commands/expire
|
|
2778
3236
|
*/
|
|
2779
|
-
expire: (key: string, seconds: number, option?:
|
|
3237
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2780
3238
|
/**
|
|
2781
3239
|
* @see https://redis.io/commands/expireat
|
|
2782
3240
|
*/
|
|
2783
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3241
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2784
3242
|
/**
|
|
2785
3243
|
* @see https://redis.io/commands/flushall
|
|
2786
3244
|
*/
|
|
@@ -2893,6 +3351,46 @@ declare class Redis {
|
|
|
2893
3351
|
* @see https://redis.io/commands/getdel
|
|
2894
3352
|
*/
|
|
2895
3353
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3354
|
+
/**
|
|
3355
|
+
* @see https://redis.io/commands/getex
|
|
3356
|
+
*/
|
|
3357
|
+
getex: <TData>(key: string, opts?: ({
|
|
3358
|
+
ex: number;
|
|
3359
|
+
px?: never;
|
|
3360
|
+
exat?: never;
|
|
3361
|
+
pxat?: never;
|
|
3362
|
+
persist?: never;
|
|
3363
|
+
} | {
|
|
3364
|
+
ex?: never;
|
|
3365
|
+
px: number;
|
|
3366
|
+
exat?: never;
|
|
3367
|
+
pxat?: never;
|
|
3368
|
+
persist?: never;
|
|
3369
|
+
} | {
|
|
3370
|
+
ex?: never;
|
|
3371
|
+
px?: never;
|
|
3372
|
+
exat: number;
|
|
3373
|
+
pxat?: never;
|
|
3374
|
+
persist?: never;
|
|
3375
|
+
} | {
|
|
3376
|
+
ex?: never;
|
|
3377
|
+
px?: never;
|
|
3378
|
+
exat?: never;
|
|
3379
|
+
pxat: number;
|
|
3380
|
+
persist?: never;
|
|
3381
|
+
} | {
|
|
3382
|
+
ex?: never;
|
|
3383
|
+
px?: never;
|
|
3384
|
+
exat?: never;
|
|
3385
|
+
pxat?: never;
|
|
3386
|
+
persist: true;
|
|
3387
|
+
} | {
|
|
3388
|
+
ex?: never;
|
|
3389
|
+
px?: never;
|
|
3390
|
+
exat?: never;
|
|
3391
|
+
pxat?: never;
|
|
3392
|
+
persist?: never;
|
|
3393
|
+
}) | undefined) => Promise<TData | null>;
|
|
2896
3394
|
/**
|
|
2897
3395
|
* @see https://redis.io/commands/getrange
|
|
2898
3396
|
*/
|
|
@@ -2909,6 +3407,42 @@ declare class Redis {
|
|
|
2909
3407
|
* @see https://redis.io/commands/hexists
|
|
2910
3408
|
*/
|
|
2911
3409
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3410
|
+
/**
|
|
3411
|
+
* @see https://redis.io/commands/hexpire
|
|
3412
|
+
*/
|
|
3413
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3414
|
+
/**
|
|
3415
|
+
* @see https://redis.io/commands/hexpireat
|
|
3416
|
+
*/
|
|
3417
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3418
|
+
/**
|
|
3419
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3420
|
+
*/
|
|
3421
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3422
|
+
/**
|
|
3423
|
+
* @see https://redis.io/commands/httl
|
|
3424
|
+
*/
|
|
3425
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3426
|
+
/**
|
|
3427
|
+
* @see https://redis.io/commands/hpexpire
|
|
3428
|
+
*/
|
|
3429
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3430
|
+
/**
|
|
3431
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3432
|
+
*/
|
|
3433
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3434
|
+
/**
|
|
3435
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3436
|
+
*/
|
|
3437
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3438
|
+
/**
|
|
3439
|
+
* @see https://redis.io/commands/hpttl
|
|
3440
|
+
*/
|
|
3441
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3442
|
+
/**
|
|
3443
|
+
* @see https://redis.io/commands/hpersist
|
|
3444
|
+
*/
|
|
3445
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2912
3446
|
/**
|
|
2913
3447
|
* @see https://redis.io/commands/hget
|
|
2914
3448
|
*/
|
|
@@ -3060,11 +3594,11 @@ declare class Redis {
|
|
|
3060
3594
|
/**
|
|
3061
3595
|
* @see https://redis.io/commands/pexpire
|
|
3062
3596
|
*/
|
|
3063
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3597
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3064
3598
|
/**
|
|
3065
3599
|
* @see https://redis.io/commands/pexpireat
|
|
3066
3600
|
*/
|
|
3067
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3601
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3068
3602
|
/**
|
|
3069
3603
|
* @see https://redis.io/commands/pfadd
|
|
3070
3604
|
*/
|
|
@@ -3085,6 +3619,10 @@ declare class Redis {
|
|
|
3085
3619
|
* @see https://redis.io/commands/psetex
|
|
3086
3620
|
*/
|
|
3087
3621
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3622
|
+
/**
|
|
3623
|
+
* @see https://redis.io/commands/psubscribe
|
|
3624
|
+
*/
|
|
3625
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3088
3626
|
/**
|
|
3089
3627
|
* @see https://redis.io/commands/pttl
|
|
3090
3628
|
*/
|
|
@@ -3124,7 +3662,10 @@ declare class Redis {
|
|
|
3124
3662
|
/**
|
|
3125
3663
|
* @see https://redis.io/commands/scan
|
|
3126
3664
|
*/
|
|
3127
|
-
scan
|
|
3665
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
3666
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
3667
|
+
withType: true;
|
|
3668
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
3128
3669
|
/**
|
|
3129
3670
|
* @see https://redis.io/commands/scard
|
|
3130
3671
|
*/
|
|
@@ -3213,6 +3754,10 @@ declare class Redis {
|
|
|
3213
3754
|
* @see https://redis.io/commands/strlen
|
|
3214
3755
|
*/
|
|
3215
3756
|
strlen: (key: string) => Promise<number>;
|
|
3757
|
+
/**
|
|
3758
|
+
* @see https://redis.io/commands/subscribe
|
|
3759
|
+
*/
|
|
3760
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3216
3761
|
/**
|
|
3217
3762
|
* @see https://redis.io/commands/sunion
|
|
3218
3763
|
*/
|
|
@@ -3483,4 +4028,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3483
4028
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3484
4029
|
}
|
|
3485
4030
|
|
|
3486
|
-
export {
|
|
4031
|
+
export { HPersistCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, type HttpClientConfig as H, GetCommand as I, GetBitCommand as J, GetDelCommand as K, GetExCommand as L, GetRangeCommand as M, GetSetCommand as N, HDelCommand as O, Pipeline as P, HExistsCommand as Q, type RedisOptions as R, HExpireCommand as S, HExpireAtCommand as T, type UpstashRequest as U, HExpireTimeCommand as V, HTtlCommand as W, HPExpireCommand as X, HPExpireAtCommand as Y, HPExpireTimeCommand as Z, HPTtlCommand as _, type RequesterConfig as a, RenameNXCommand as a$, HGetCommand as a0, HGetAllCommand as a1, HIncrByCommand as a2, HIncrByFloatCommand as a3, HKeysCommand as a4, HLenCommand as a5, HMGetCommand as a6, HMSetCommand as a7, HRandFieldCommand as a8, HScanCommand as a9, JsonStrLenCommand as aA, JsonToggleCommand as aB, JsonTypeCommand as aC, KeysCommand as aD, LIndexCommand as aE, LInsertCommand as aF, LLenCommand as aG, LMoveCommand as aH, LPopCommand as aI, LPushCommand as aJ, LPushXCommand as aK, LRangeCommand as aL, LRemCommand as aM, LSetCommand as aN, LTrimCommand as aO, MGetCommand as aP, MSetCommand as aQ, MSetNXCommand as aR, PersistCommand as aS, PExpireCommand as aT, PExpireAtCommand as aU, PingCommand as aV, PSetEXCommand as aW, PTtlCommand as aX, PublishCommand as aY, RandomKeyCommand as aZ, RenameCommand as a_, HSetCommand as aa, HSetNXCommand as ab, HStrLenCommand as ac, HValsCommand as ad, IncrCommand as ae, IncrByCommand as af, IncrByFloatCommand as ag, JsonArrAppendCommand as ah, JsonArrIndexCommand as ai, JsonArrInsertCommand as aj, JsonArrLenCommand as ak, JsonArrPopCommand as al, JsonArrTrimCommand as am, JsonClearCommand as an, JsonDelCommand as ao, JsonForgetCommand as ap, JsonGetCommand as aq, JsonMergeCommand as ar, JsonMGetCommand as as, JsonNumIncrByCommand as at, JsonNumMultByCommand as au, JsonObjKeysCommand as av, JsonObjLenCommand as aw, JsonRespCommand as ax, JsonSetCommand as ay, JsonStrAppendCommand as az, Redis as b, type ZUnionCommandOptions as b$, RPopCommand as b0, RPushCommand as b1, RPushXCommand as b2, SAddCommand as b3, ScanCommand as b4, type ScanCommandOptions as b5, SCardCommand as b6, ScriptExistsCommand as b7, ScriptFlushCommand as b8, ScriptLoadCommand as b9, UnlinkCommand as bA, XAddCommand as bB, XRangeCommand as bC, type ScoreMember as bD, type ZAddCommandOptions as bE, ZAddCommand as bF, ZCardCommand as bG, ZCountCommand as bH, ZDiffStoreCommand as bI, ZIncrByCommand as bJ, ZInterStoreCommand as bK, type ZInterStoreCommandOptions as bL, ZLexCountCommand as bM, ZMScoreCommand as bN, ZPopMaxCommand as bO, ZPopMinCommand as bP, ZRangeCommand as bQ, type ZRangeCommandOptions as bR, ZRankCommand as bS, ZRemCommand as bT, ZRemRangeByLexCommand as bU, ZRemRangeByRankCommand as bV, ZRemRangeByScoreCommand as bW, ZRevRankCommand as bX, ZScanCommand as bY, ZScoreCommand as bZ, ZUnionCommand as b_, SDiffCommand as ba, SDiffStoreCommand as bb, SetCommand as bc, type SetCommandOptions as bd, SetBitCommand as be, SetExCommand as bf, SetNxCommand as bg, SetRangeCommand as bh, SInterCommand as bi, SInterStoreCommand as bj, SIsMemberCommand as bk, SMembersCommand as bl, SMIsMemberCommand as bm, SMoveCommand as bn, SPopCommand as bo, SRandMemberCommand as bp, SRemCommand as bq, SScanCommand as br, StrLenCommand as bs, SUnionCommand as bt, SUnionStoreCommand as bu, TimeCommand as bv, TouchCommand as bw, TtlCommand as bx, type Type as by, TypeCommand as bz, type UpstashResponse as c, ZUnionStoreCommand as c0, type ZUnionStoreCommandOptions as c1, type Requester as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalROCommand as k, EvalCommand as l, EvalshaROCommand as m, EvalshaCommand as n, ExistsCommand as o, ExpireCommand as p, type ExpireOption as q, ExpireAtCommand as r, FlushDBCommand as s, type GeoAddCommandOptions as t, type GeoMember as u, GeoDistCommand as v, GeoHashCommand as w, GeoPosCommand as x, GeoSearchCommand as y, GeoSearchStoreCommand as z };
|