@upstash/redis 0.0.0-ci.fe7ec0544f213f3f58bb19e23dfafafab828c00c-20241107145222 → 0.0.0-ci.ff91bb10adb82f9d009471b11db70c40b6dbf5f8-20251205205412
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 +9 -0
- package/{chunk-VQ5Q3VDK.mjs → chunk-WTYE7OV3.mjs} +767 -68
- package/cloudflare.d.mts +3 -3
- package/cloudflare.d.ts +3 -3
- package/cloudflare.js +768 -79
- package/cloudflare.mjs +2 -2
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +767 -78
- package/fastly.mjs +1 -1
- package/nodejs.d.mts +14 -6
- package/nodejs.d.ts +14 -6
- package/nodejs.js +775 -82
- package/nodejs.mjs +9 -5
- package/package.json +1 -1
- package/{zmscore-MtjFVHt-.d.mts → zmscore-DhpQcqpW.d.mts} +595 -46
- package/{zmscore-MtjFVHt-.d.ts → zmscore-DhpQcqpW.d.ts} +595 -46
|
@@ -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;
|
|
@@ -61,7 +77,7 @@ type RetryConfig = false | {
|
|
|
61
77
|
*/
|
|
62
78
|
retries?: number;
|
|
63
79
|
/**
|
|
64
|
-
* 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.
|
|
65
81
|
*
|
|
66
82
|
* @default
|
|
67
83
|
* ```ts
|
|
@@ -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
|
/**
|
|
@@ -1373,16 +1577,33 @@ type XReadCommandOptions = [
|
|
|
1373
1577
|
id: string | string[],
|
|
1374
1578
|
options?: {
|
|
1375
1579
|
count?: number;
|
|
1580
|
+
/**
|
|
1581
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1582
|
+
*/
|
|
1376
1583
|
blockMS?: number;
|
|
1377
1584
|
}
|
|
1378
1585
|
];
|
|
1379
|
-
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1586
|
+
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [
|
|
1587
|
+
key: string,
|
|
1588
|
+
id: string,
|
|
1589
|
+
options?: {
|
|
1590
|
+
count?: number;
|
|
1591
|
+
/**
|
|
1592
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1593
|
+
*/
|
|
1594
|
+
blockMS?: number;
|
|
1595
|
+
}
|
|
1596
|
+
] : never : K extends string[] ? I extends string[] ? [
|
|
1597
|
+
key: string[],
|
|
1598
|
+
id: string[],
|
|
1599
|
+
options?: {
|
|
1600
|
+
count?: number;
|
|
1601
|
+
/**
|
|
1602
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1603
|
+
*/
|
|
1604
|
+
blockMS?: number;
|
|
1605
|
+
}
|
|
1606
|
+
] : never : never : never;
|
|
1386
1607
|
/**
|
|
1387
1608
|
* @see https://redis.io/commands/xread
|
|
1388
1609
|
*/
|
|
@@ -1392,6 +1613,9 @@ declare class XReadCommand extends Command<number, unknown[]> {
|
|
|
1392
1613
|
|
|
1393
1614
|
type Options = {
|
|
1394
1615
|
count?: number;
|
|
1616
|
+
/**
|
|
1617
|
+
* @deprecated block is not yet supported in Upstash Redis
|
|
1618
|
+
*/
|
|
1395
1619
|
blockMS?: number;
|
|
1396
1620
|
NOACK?: boolean;
|
|
1397
1621
|
};
|
|
@@ -1569,7 +1793,11 @@ declare class ZRemRangeByRankCommand extends Command<number, number> {
|
|
|
1569
1793
|
* @see https://redis.io/commands/zremrangebyscore
|
|
1570
1794
|
*/
|
|
1571
1795
|
declare class ZRemRangeByScoreCommand extends Command<number, number> {
|
|
1572
|
-
constructor(cmd: [
|
|
1796
|
+
constructor(cmd: [
|
|
1797
|
+
key: string,
|
|
1798
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
1799
|
+
max: number | `(${number}` | "-inf" | "+inf"
|
|
1800
|
+
], opts?: CommandOptions<number, number>);
|
|
1573
1801
|
}
|
|
1574
1802
|
|
|
1575
1803
|
/**
|
|
@@ -1599,6 +1827,43 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1599
1827
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1600
1828
|
}
|
|
1601
1829
|
|
|
1830
|
+
type BaseMessageData<TMessage> = {
|
|
1831
|
+
channel: string;
|
|
1832
|
+
message: TMessage;
|
|
1833
|
+
};
|
|
1834
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1835
|
+
pattern: string;
|
|
1836
|
+
};
|
|
1837
|
+
type SubscriptionCountEvent = number;
|
|
1838
|
+
type MessageEventMap<TMessage> = {
|
|
1839
|
+
message: BaseMessageData<TMessage>;
|
|
1840
|
+
subscribe: SubscriptionCountEvent;
|
|
1841
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1842
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1843
|
+
psubscribe: SubscriptionCountEvent;
|
|
1844
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1845
|
+
error: Error;
|
|
1846
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1847
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1848
|
+
};
|
|
1849
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1850
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1851
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1852
|
+
private subscriptions;
|
|
1853
|
+
private client;
|
|
1854
|
+
private listeners;
|
|
1855
|
+
private opts?;
|
|
1856
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean, opts?: Pick<RedisOptions, "automaticDeserialization">);
|
|
1857
|
+
private subscribeToChannel;
|
|
1858
|
+
private subscribeToPattern;
|
|
1859
|
+
private handleMessage;
|
|
1860
|
+
private dispatchToListeners;
|
|
1861
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1862
|
+
removeAllListeners(): void;
|
|
1863
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1864
|
+
getSubscribedChannels(): string[];
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1602
1867
|
type InferResponseData<T extends unknown[]> = {
|
|
1603
1868
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1604
1869
|
};
|
|
@@ -1759,10 +2024,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1759
2024
|
* @see https://redis.io/commands/echo
|
|
1760
2025
|
*/
|
|
1761
2026
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2027
|
+
/**
|
|
2028
|
+
* @see https://redis.io/commands/eval_ro
|
|
2029
|
+
*/
|
|
2030
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1762
2031
|
/**
|
|
1763
2032
|
* @see https://redis.io/commands/eval
|
|
1764
2033
|
*/
|
|
1765
2034
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2035
|
+
/**
|
|
2036
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
2037
|
+
*/
|
|
2038
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1766
2039
|
/**
|
|
1767
2040
|
* @see https://redis.io/commands/evalsha
|
|
1768
2041
|
*/
|
|
@@ -1774,11 +2047,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1774
2047
|
/**
|
|
1775
2048
|
* @see https://redis.io/commands/expire
|
|
1776
2049
|
*/
|
|
1777
|
-
expire: (key: string, seconds: number, option?:
|
|
2050
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1778
2051
|
/**
|
|
1779
2052
|
* @see https://redis.io/commands/expireat
|
|
1780
2053
|
*/
|
|
1781
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2054
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1782
2055
|
/**
|
|
1783
2056
|
* @see https://redis.io/commands/flushall
|
|
1784
2057
|
*/
|
|
@@ -1891,6 +2164,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1891
2164
|
* @see https://redis.io/commands/getdel
|
|
1892
2165
|
*/
|
|
1893
2166
|
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2167
|
+
/**
|
|
2168
|
+
* @see https://redis.io/commands/getex
|
|
2169
|
+
*/
|
|
2170
|
+
getex: <TData>(key: string, opts?: ({
|
|
2171
|
+
ex: number;
|
|
2172
|
+
px?: never;
|
|
2173
|
+
exat?: never;
|
|
2174
|
+
pxat?: never;
|
|
2175
|
+
persist?: never;
|
|
2176
|
+
} | {
|
|
2177
|
+
ex?: never;
|
|
2178
|
+
px: number;
|
|
2179
|
+
exat?: never;
|
|
2180
|
+
pxat?: never;
|
|
2181
|
+
persist?: never;
|
|
2182
|
+
} | {
|
|
2183
|
+
ex?: never;
|
|
2184
|
+
px?: never;
|
|
2185
|
+
exat: number;
|
|
2186
|
+
pxat?: never;
|
|
2187
|
+
persist?: never;
|
|
2188
|
+
} | {
|
|
2189
|
+
ex?: never;
|
|
2190
|
+
px?: never;
|
|
2191
|
+
exat?: never;
|
|
2192
|
+
pxat: number;
|
|
2193
|
+
persist?: never;
|
|
2194
|
+
} | {
|
|
2195
|
+
ex?: never;
|
|
2196
|
+
px?: never;
|
|
2197
|
+
exat?: never;
|
|
2198
|
+
pxat?: never;
|
|
2199
|
+
persist: true;
|
|
2200
|
+
} | {
|
|
2201
|
+
ex?: never;
|
|
2202
|
+
px?: never;
|
|
2203
|
+
exat?: never;
|
|
2204
|
+
pxat?: never;
|
|
2205
|
+
persist?: never;
|
|
2206
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1894
2207
|
/**
|
|
1895
2208
|
* @see https://redis.io/commands/getrange
|
|
1896
2209
|
*/
|
|
@@ -1907,6 +2220,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1907
2220
|
* @see https://redis.io/commands/hexists
|
|
1908
2221
|
*/
|
|
1909
2222
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2223
|
+
/**
|
|
2224
|
+
* @see https://redis.io/commands/hexpire
|
|
2225
|
+
*/
|
|
2226
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2227
|
+
/**
|
|
2228
|
+
* @see https://redis.io/commands/hexpireat
|
|
2229
|
+
*/
|
|
2230
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2231
|
+
/**
|
|
2232
|
+
* @see https://redis.io/commands/hexpiretime
|
|
2233
|
+
*/
|
|
2234
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2235
|
+
/**
|
|
2236
|
+
* @see https://redis.io/commands/httl
|
|
2237
|
+
*/
|
|
2238
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2239
|
+
/**
|
|
2240
|
+
* @see https://redis.io/commands/hpexpire
|
|
2241
|
+
*/
|
|
2242
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2243
|
+
/**
|
|
2244
|
+
* @see https://redis.io/commands/hpexpireat
|
|
2245
|
+
*/
|
|
2246
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2247
|
+
/**
|
|
2248
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
2249
|
+
*/
|
|
2250
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2251
|
+
/**
|
|
2252
|
+
* @see https://redis.io/commands/hpttl
|
|
2253
|
+
*/
|
|
2254
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2255
|
+
/**
|
|
2256
|
+
* @see https://redis.io/commands/hpersist
|
|
2257
|
+
*/
|
|
2258
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
1910
2259
|
/**
|
|
1911
2260
|
* @see https://redis.io/commands/hget
|
|
1912
2261
|
*/
|
|
@@ -2054,11 +2403,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2054
2403
|
/**
|
|
2055
2404
|
* @see https://redis.io/commands/pexpire
|
|
2056
2405
|
*/
|
|
2057
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2406
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2058
2407
|
/**
|
|
2059
2408
|
* @see https://redis.io/commands/pexpireat
|
|
2060
2409
|
*/
|
|
2061
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2410
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2062
2411
|
/**
|
|
2063
2412
|
* @see https://redis.io/commands/pfadd
|
|
2064
2413
|
*/
|
|
@@ -2118,7 +2467,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2118
2467
|
/**
|
|
2119
2468
|
* @see https://redis.io/commands/scan
|
|
2120
2469
|
*/
|
|
2121
|
-
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2470
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2122
2471
|
/**
|
|
2123
2472
|
* @see https://redis.io/commands/scard
|
|
2124
2473
|
*/
|
|
@@ -2415,7 +2764,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2415
2764
|
/**
|
|
2416
2765
|
* @see https://redis.io/commands/zremrangebyscore
|
|
2417
2766
|
*/
|
|
2418
|
-
zremrangebyscore: (key: string, min: number, max: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2767
|
+
zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2419
2768
|
/**
|
|
2420
2769
|
* @see https://redis.io/commands/zrevrank
|
|
2421
2770
|
*/
|
|
@@ -2480,6 +2829,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2480
2829
|
* @see https://redis.io/commands/json.get
|
|
2481
2830
|
*/
|
|
2482
2831
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2832
|
+
/**
|
|
2833
|
+
* @see https://redis.io/commands/json.merge
|
|
2834
|
+
*/
|
|
2835
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2483
2836
|
/**
|
|
2484
2837
|
* @see https://redis.io/commands/json.mget
|
|
2485
2838
|
*/
|
|
@@ -2555,9 +2908,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2555
2908
|
*/
|
|
2556
2909
|
declare class Script<TResult = unknown> {
|
|
2557
2910
|
readonly script: string;
|
|
2558
|
-
|
|
2911
|
+
/**
|
|
2912
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2913
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2914
|
+
*
|
|
2915
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2916
|
+
* future major release.
|
|
2917
|
+
*/
|
|
2918
|
+
sha1: string;
|
|
2559
2919
|
private readonly redis;
|
|
2560
2920
|
constructor(redis: Redis, script: string);
|
|
2921
|
+
/**
|
|
2922
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
2923
|
+
*/
|
|
2924
|
+
private init;
|
|
2561
2925
|
/**
|
|
2562
2926
|
* Send an `EVAL` command to redis.
|
|
2563
2927
|
*/
|
|
@@ -2579,6 +2943,56 @@ declare class Script<TResult = unknown> {
|
|
|
2579
2943
|
private digest;
|
|
2580
2944
|
}
|
|
2581
2945
|
|
|
2946
|
+
/**
|
|
2947
|
+
* Creates a new script.
|
|
2948
|
+
*
|
|
2949
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
2950
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
2951
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
2952
|
+
*
|
|
2953
|
+
* @example
|
|
2954
|
+
* ```ts
|
|
2955
|
+
* const redis = new Redis({...})
|
|
2956
|
+
*
|
|
2957
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
2958
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
2959
|
+
* expect(arg1, "Hello World")
|
|
2960
|
+
* ```
|
|
2961
|
+
*/
|
|
2962
|
+
declare class ScriptRO<TResult = unknown> {
|
|
2963
|
+
readonly script: string;
|
|
2964
|
+
/**
|
|
2965
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2966
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2967
|
+
*
|
|
2968
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2969
|
+
* future major release.
|
|
2970
|
+
*/
|
|
2971
|
+
sha1: string;
|
|
2972
|
+
private readonly redis;
|
|
2973
|
+
constructor(redis: Redis, script: string);
|
|
2974
|
+
private init;
|
|
2975
|
+
/**
|
|
2976
|
+
* Send an `EVAL_RO` command to redis.
|
|
2977
|
+
*/
|
|
2978
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2979
|
+
/**
|
|
2980
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
2981
|
+
*/
|
|
2982
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2983
|
+
/**
|
|
2984
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
2985
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
2986
|
+
*
|
|
2987
|
+
* Following calls will be able to use the cached script
|
|
2988
|
+
*/
|
|
2989
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
2990
|
+
/**
|
|
2991
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
2992
|
+
*/
|
|
2993
|
+
private digest;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2582
2996
|
/**
|
|
2583
2997
|
* Serverless redis client for upstash.
|
|
2584
2998
|
*/
|
|
@@ -2642,6 +3056,10 @@ declare class Redis {
|
|
|
2642
3056
|
* @see https://redis.io/commands/json.get
|
|
2643
3057
|
*/
|
|
2644
3058
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3059
|
+
/**
|
|
3060
|
+
* @see https://redis.io/commands/json.merge
|
|
3061
|
+
*/
|
|
3062
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2645
3063
|
/**
|
|
2646
3064
|
* @see https://redis.io/commands/json.mget
|
|
2647
3065
|
*/
|
|
@@ -2705,7 +3123,37 @@ declare class Redis {
|
|
|
2705
3123
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2706
3124
|
*/
|
|
2707
3125
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2708
|
-
|
|
3126
|
+
/**
|
|
3127
|
+
* Creates a new script.
|
|
3128
|
+
*
|
|
3129
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3130
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3131
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3132
|
+
*
|
|
3133
|
+
* @param script - The script to create
|
|
3134
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3135
|
+
* @returns A new script
|
|
3136
|
+
*
|
|
3137
|
+
* @example
|
|
3138
|
+
* ```ts
|
|
3139
|
+
* const redis = new Redis({...})
|
|
3140
|
+
*
|
|
3141
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3142
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3143
|
+
* expect(arg1, "Hello World")
|
|
3144
|
+
* ```
|
|
3145
|
+
* @example
|
|
3146
|
+
* ```ts
|
|
3147
|
+
* const redis = new Redis({...})
|
|
3148
|
+
*
|
|
3149
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3150
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3151
|
+
* expect(arg1, "Hello World")
|
|
3152
|
+
* ```
|
|
3153
|
+
*/
|
|
3154
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3155
|
+
readonly?: TReadonly;
|
|
3156
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2709
3157
|
/**
|
|
2710
3158
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2711
3159
|
*
|
|
@@ -2784,10 +3232,18 @@ declare class Redis {
|
|
|
2784
3232
|
* @see https://redis.io/commands/echo
|
|
2785
3233
|
*/
|
|
2786
3234
|
echo: (message: string) => Promise<string>;
|
|
3235
|
+
/**
|
|
3236
|
+
* @see https://redis.io/commands/eval_ro
|
|
3237
|
+
*/
|
|
3238
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2787
3239
|
/**
|
|
2788
3240
|
* @see https://redis.io/commands/eval
|
|
2789
3241
|
*/
|
|
2790
3242
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3243
|
+
/**
|
|
3244
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3245
|
+
*/
|
|
3246
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2791
3247
|
/**
|
|
2792
3248
|
* @see https://redis.io/commands/evalsha
|
|
2793
3249
|
*/
|
|
@@ -2803,11 +3259,11 @@ declare class Redis {
|
|
|
2803
3259
|
/**
|
|
2804
3260
|
* @see https://redis.io/commands/expire
|
|
2805
3261
|
*/
|
|
2806
|
-
expire: (key: string, seconds: number, option?:
|
|
3262
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2807
3263
|
/**
|
|
2808
3264
|
* @see https://redis.io/commands/expireat
|
|
2809
3265
|
*/
|
|
2810
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3266
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2811
3267
|
/**
|
|
2812
3268
|
* @see https://redis.io/commands/flushall
|
|
2813
3269
|
*/
|
|
@@ -2920,6 +3376,46 @@ declare class Redis {
|
|
|
2920
3376
|
* @see https://redis.io/commands/getdel
|
|
2921
3377
|
*/
|
|
2922
3378
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3379
|
+
/**
|
|
3380
|
+
* @see https://redis.io/commands/getex
|
|
3381
|
+
*/
|
|
3382
|
+
getex: <TData>(key: string, opts?: ({
|
|
3383
|
+
ex: number;
|
|
3384
|
+
px?: never;
|
|
3385
|
+
exat?: never;
|
|
3386
|
+
pxat?: never;
|
|
3387
|
+
persist?: never;
|
|
3388
|
+
} | {
|
|
3389
|
+
ex?: never;
|
|
3390
|
+
px: number;
|
|
3391
|
+
exat?: never;
|
|
3392
|
+
pxat?: never;
|
|
3393
|
+
persist?: never;
|
|
3394
|
+
} | {
|
|
3395
|
+
ex?: never;
|
|
3396
|
+
px?: never;
|
|
3397
|
+
exat: number;
|
|
3398
|
+
pxat?: never;
|
|
3399
|
+
persist?: never;
|
|
3400
|
+
} | {
|
|
3401
|
+
ex?: never;
|
|
3402
|
+
px?: never;
|
|
3403
|
+
exat?: never;
|
|
3404
|
+
pxat: number;
|
|
3405
|
+
persist?: never;
|
|
3406
|
+
} | {
|
|
3407
|
+
ex?: never;
|
|
3408
|
+
px?: never;
|
|
3409
|
+
exat?: never;
|
|
3410
|
+
pxat?: never;
|
|
3411
|
+
persist: true;
|
|
3412
|
+
} | {
|
|
3413
|
+
ex?: never;
|
|
3414
|
+
px?: never;
|
|
3415
|
+
exat?: never;
|
|
3416
|
+
pxat?: never;
|
|
3417
|
+
persist?: never;
|
|
3418
|
+
}) | undefined) => Promise<TData | null>;
|
|
2923
3419
|
/**
|
|
2924
3420
|
* @see https://redis.io/commands/getrange
|
|
2925
3421
|
*/
|
|
@@ -2936,6 +3432,42 @@ declare class Redis {
|
|
|
2936
3432
|
* @see https://redis.io/commands/hexists
|
|
2937
3433
|
*/
|
|
2938
3434
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3435
|
+
/**
|
|
3436
|
+
* @see https://redis.io/commands/hexpire
|
|
3437
|
+
*/
|
|
3438
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3439
|
+
/**
|
|
3440
|
+
* @see https://redis.io/commands/hexpireat
|
|
3441
|
+
*/
|
|
3442
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3443
|
+
/**
|
|
3444
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3445
|
+
*/
|
|
3446
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3447
|
+
/**
|
|
3448
|
+
* @see https://redis.io/commands/httl
|
|
3449
|
+
*/
|
|
3450
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3451
|
+
/**
|
|
3452
|
+
* @see https://redis.io/commands/hpexpire
|
|
3453
|
+
*/
|
|
3454
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3455
|
+
/**
|
|
3456
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3457
|
+
*/
|
|
3458
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3459
|
+
/**
|
|
3460
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3461
|
+
*/
|
|
3462
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3463
|
+
/**
|
|
3464
|
+
* @see https://redis.io/commands/hpttl
|
|
3465
|
+
*/
|
|
3466
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3467
|
+
/**
|
|
3468
|
+
* @see https://redis.io/commands/hpersist
|
|
3469
|
+
*/
|
|
3470
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2939
3471
|
/**
|
|
2940
3472
|
* @see https://redis.io/commands/hget
|
|
2941
3473
|
*/
|
|
@@ -3087,11 +3619,11 @@ declare class Redis {
|
|
|
3087
3619
|
/**
|
|
3088
3620
|
* @see https://redis.io/commands/pexpire
|
|
3089
3621
|
*/
|
|
3090
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3622
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3091
3623
|
/**
|
|
3092
3624
|
* @see https://redis.io/commands/pexpireat
|
|
3093
3625
|
*/
|
|
3094
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3626
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3095
3627
|
/**
|
|
3096
3628
|
* @see https://redis.io/commands/pfadd
|
|
3097
3629
|
*/
|
|
@@ -3112,6 +3644,10 @@ declare class Redis {
|
|
|
3112
3644
|
* @see https://redis.io/commands/psetex
|
|
3113
3645
|
*/
|
|
3114
3646
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3647
|
+
/**
|
|
3648
|
+
* @see https://redis.io/commands/psubscribe
|
|
3649
|
+
*/
|
|
3650
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3115
3651
|
/**
|
|
3116
3652
|
* @see https://redis.io/commands/pttl
|
|
3117
3653
|
*/
|
|
@@ -3151,7 +3687,10 @@ declare class Redis {
|
|
|
3151
3687
|
/**
|
|
3152
3688
|
* @see https://redis.io/commands/scan
|
|
3153
3689
|
*/
|
|
3154
|
-
scan
|
|
3690
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
3691
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
3692
|
+
withType: true;
|
|
3693
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
3155
3694
|
/**
|
|
3156
3695
|
* @see https://redis.io/commands/scard
|
|
3157
3696
|
*/
|
|
@@ -3240,6 +3779,10 @@ declare class Redis {
|
|
|
3240
3779
|
* @see https://redis.io/commands/strlen
|
|
3241
3780
|
*/
|
|
3242
3781
|
strlen: (key: string) => Promise<number>;
|
|
3782
|
+
/**
|
|
3783
|
+
* @see https://redis.io/commands/subscribe
|
|
3784
|
+
*/
|
|
3785
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3243
3786
|
/**
|
|
3244
3787
|
* @see https://redis.io/commands/sunion
|
|
3245
3788
|
*/
|
|
@@ -3455,7 +3998,7 @@ declare class Redis {
|
|
|
3455
3998
|
/**
|
|
3456
3999
|
* @see https://redis.io/commands/zremrangebyscore
|
|
3457
4000
|
*/
|
|
3458
|
-
zremrangebyscore: (key: string, min: number, max: number) => Promise<number>;
|
|
4001
|
+
zremrangebyscore: (key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf") => Promise<number>;
|
|
3459
4002
|
/**
|
|
3460
4003
|
* @see https://redis.io/commands/zrevrank
|
|
3461
4004
|
*/
|
|
@@ -3478,22 +4021,28 @@ declare class Redis {
|
|
|
3478
4021
|
zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
|
|
3479
4022
|
}
|
|
3480
4023
|
|
|
4024
|
+
type UpstashErrorOptions = Pick<NonNullable<ConstructorParameters<typeof Error>[1]>, "cause">;
|
|
3481
4025
|
/**
|
|
3482
4026
|
* Result of a bad request to upstash
|
|
3483
4027
|
*/
|
|
3484
4028
|
declare class UpstashError extends Error {
|
|
3485
|
-
constructor(message: string);
|
|
4029
|
+
constructor(message: string, options?: ErrorOptions);
|
|
3486
4030
|
}
|
|
3487
4031
|
declare class UrlError extends Error {
|
|
3488
4032
|
constructor(url: string);
|
|
3489
4033
|
}
|
|
4034
|
+
declare class UpstashJSONParseError extends UpstashError {
|
|
4035
|
+
constructor(body: string, options?: UpstashErrorOptions);
|
|
4036
|
+
}
|
|
3490
4037
|
|
|
3491
4038
|
type error_UpstashError = UpstashError;
|
|
3492
4039
|
declare const error_UpstashError: typeof UpstashError;
|
|
4040
|
+
type error_UpstashJSONParseError = UpstashJSONParseError;
|
|
4041
|
+
declare const error_UpstashJSONParseError: typeof UpstashJSONParseError;
|
|
3493
4042
|
type error_UrlError = UrlError;
|
|
3494
4043
|
declare const error_UrlError: typeof UrlError;
|
|
3495
4044
|
declare namespace error {
|
|
3496
|
-
export { error_UpstashError as UpstashError, error_UrlError as UrlError };
|
|
4045
|
+
export { error_UpstashError as UpstashError, error_UpstashJSONParseError as UpstashJSONParseError, error_UrlError as UrlError };
|
|
3497
4046
|
}
|
|
3498
4047
|
|
|
3499
4048
|
/**
|
|
@@ -3510,4 +4059,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3510
4059
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3511
4060
|
}
|
|
3512
4061
|
|
|
3513
|
-
export {
|
|
4062
|
+
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 };
|