@upstash/redis 0.0.0-ci.e9b0c868305a820aaed7d68c8407b277da5a093e-20241008121230 → 0.0.0-ci.e9ff702fe7d2dd2495b4383b5432fe9b93f5a6e7-20250729064656
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/{chunk-3A3BS427.mjs → chunk-IRVZXPJO.mjs} +767 -87
- package/cloudflare.d.mts +3 -3
- package/cloudflare.d.ts +3 -3
- package/cloudflare.js +772 -104
- package/cloudflare.mjs +6 -8
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +772 -104
- package/fastly.mjs +6 -8
- package/nodejs.d.mts +3 -3
- package/nodejs.d.ts +3 -3
- package/nodejs.js +774 -106
- package/nodejs.mjs +8 -10
- package/package.json +1 -1
- package/{zmscore-BLgYk16R.d.mts → zmscore-CgRD7oFR.d.mts} +616 -53
- package/{zmscore-BLgYk16R.d.ts → zmscore-CgRD7oFR.d.ts} +616 -53
|
@@ -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
|
/**
|
|
@@ -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
|
};
|
|
@@ -1599,9 +1823,78 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1599
1823
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1600
1824
|
}
|
|
1601
1825
|
|
|
1826
|
+
type BaseMessageData<TMessage> = {
|
|
1827
|
+
channel: string;
|
|
1828
|
+
message: TMessage;
|
|
1829
|
+
};
|
|
1830
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1831
|
+
pattern: string;
|
|
1832
|
+
};
|
|
1833
|
+
type SubscriptionCountEvent = number;
|
|
1834
|
+
type MessageEventMap<TMessage> = {
|
|
1835
|
+
message: BaseMessageData<TMessage>;
|
|
1836
|
+
subscribe: SubscriptionCountEvent;
|
|
1837
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1838
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1839
|
+
psubscribe: SubscriptionCountEvent;
|
|
1840
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1841
|
+
error: Error;
|
|
1842
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1843
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1844
|
+
};
|
|
1845
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1846
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1847
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1848
|
+
private subscriptions;
|
|
1849
|
+
private client;
|
|
1850
|
+
private listeners;
|
|
1851
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean);
|
|
1852
|
+
private subscribeToChannel;
|
|
1853
|
+
private subscribeToPattern;
|
|
1854
|
+
private handleMessage;
|
|
1855
|
+
private dispatchToListeners;
|
|
1856
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1857
|
+
removeAllListeners(): void;
|
|
1858
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1859
|
+
getSubscribedChannels(): string[];
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1602
1862
|
type InferResponseData<T extends unknown[]> = {
|
|
1603
1863
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1604
1864
|
};
|
|
1865
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1866
|
+
/**
|
|
1867
|
+
* Send the pipeline request to upstash.
|
|
1868
|
+
*
|
|
1869
|
+
* Returns an array with the results of all pipelined commands.
|
|
1870
|
+
*
|
|
1871
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1872
|
+
* ```ts
|
|
1873
|
+
* const p = redis.pipeline()
|
|
1874
|
+
* p.get("key")
|
|
1875
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1876
|
+
* ```
|
|
1877
|
+
*
|
|
1878
|
+
* 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.
|
|
1879
|
+
*
|
|
1880
|
+
* 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 }`.
|
|
1881
|
+
*
|
|
1882
|
+
* ```ts
|
|
1883
|
+
* const p = redis.pipeline()
|
|
1884
|
+
* p.get("key")
|
|
1885
|
+
*
|
|
1886
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1887
|
+
* const getResult = result[0].result
|
|
1888
|
+
* const getError = result[0].error
|
|
1889
|
+
* ```
|
|
1890
|
+
*/
|
|
1891
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1892
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1893
|
+
keepErrors: true;
|
|
1894
|
+
}): Promise<{
|
|
1895
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1896
|
+
}>;
|
|
1897
|
+
}
|
|
1605
1898
|
/**
|
|
1606
1899
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1607
1900
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1650,19 +1943,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1650
1943
|
commandOptions?: CommandOptions<any, any>;
|
|
1651
1944
|
multiExec?: boolean;
|
|
1652
1945
|
});
|
|
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>;
|
|
1946
|
+
exec: ExecMethod<TCommands>;
|
|
1666
1947
|
/**
|
|
1667
1948
|
* Returns the length of pipeline before the execution
|
|
1668
1949
|
*/
|
|
@@ -1738,10 +2019,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1738
2019
|
* @see https://redis.io/commands/echo
|
|
1739
2020
|
*/
|
|
1740
2021
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2022
|
+
/**
|
|
2023
|
+
* @see https://redis.io/commands/eval_ro
|
|
2024
|
+
*/
|
|
2025
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1741
2026
|
/**
|
|
1742
2027
|
* @see https://redis.io/commands/eval
|
|
1743
2028
|
*/
|
|
1744
2029
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2030
|
+
/**
|
|
2031
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
2032
|
+
*/
|
|
2033
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1745
2034
|
/**
|
|
1746
2035
|
* @see https://redis.io/commands/evalsha
|
|
1747
2036
|
*/
|
|
@@ -1753,11 +2042,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1753
2042
|
/**
|
|
1754
2043
|
* @see https://redis.io/commands/expire
|
|
1755
2044
|
*/
|
|
1756
|
-
expire: (key: string, seconds: number, option?:
|
|
2045
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1757
2046
|
/**
|
|
1758
2047
|
* @see https://redis.io/commands/expireat
|
|
1759
2048
|
*/
|
|
1760
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2049
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1761
2050
|
/**
|
|
1762
2051
|
* @see https://redis.io/commands/flushall
|
|
1763
2052
|
*/
|
|
@@ -1870,6 +2159,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1870
2159
|
* @see https://redis.io/commands/getdel
|
|
1871
2160
|
*/
|
|
1872
2161
|
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2162
|
+
/**
|
|
2163
|
+
* @see https://redis.io/commands/getex
|
|
2164
|
+
*/
|
|
2165
|
+
getex: <TData>(key: string, opts?: ({
|
|
2166
|
+
ex: number;
|
|
2167
|
+
px?: never;
|
|
2168
|
+
exat?: never;
|
|
2169
|
+
pxat?: never;
|
|
2170
|
+
persist?: never;
|
|
2171
|
+
} | {
|
|
2172
|
+
ex?: never;
|
|
2173
|
+
px: number;
|
|
2174
|
+
exat?: never;
|
|
2175
|
+
pxat?: never;
|
|
2176
|
+
persist?: never;
|
|
2177
|
+
} | {
|
|
2178
|
+
ex?: never;
|
|
2179
|
+
px?: never;
|
|
2180
|
+
exat: number;
|
|
2181
|
+
pxat?: never;
|
|
2182
|
+
persist?: never;
|
|
2183
|
+
} | {
|
|
2184
|
+
ex?: never;
|
|
2185
|
+
px?: never;
|
|
2186
|
+
exat?: never;
|
|
2187
|
+
pxat: number;
|
|
2188
|
+
persist?: never;
|
|
2189
|
+
} | {
|
|
2190
|
+
ex?: never;
|
|
2191
|
+
px?: never;
|
|
2192
|
+
exat?: never;
|
|
2193
|
+
pxat?: never;
|
|
2194
|
+
persist: true;
|
|
2195
|
+
} | {
|
|
2196
|
+
ex?: never;
|
|
2197
|
+
px?: never;
|
|
2198
|
+
exat?: never;
|
|
2199
|
+
pxat?: never;
|
|
2200
|
+
persist?: never;
|
|
2201
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1873
2202
|
/**
|
|
1874
2203
|
* @see https://redis.io/commands/getrange
|
|
1875
2204
|
*/
|
|
@@ -1886,6 +2215,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1886
2215
|
* @see https://redis.io/commands/hexists
|
|
1887
2216
|
*/
|
|
1888
2217
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2218
|
+
/**
|
|
2219
|
+
* @see https://redis.io/commands/hexpire
|
|
2220
|
+
*/
|
|
2221
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2222
|
+
/**
|
|
2223
|
+
* @see https://redis.io/commands/hexpireat
|
|
2224
|
+
*/
|
|
2225
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2226
|
+
/**
|
|
2227
|
+
* @see https://redis.io/commands/hexpiretime
|
|
2228
|
+
*/
|
|
2229
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2230
|
+
/**
|
|
2231
|
+
* @see https://redis.io/commands/httl
|
|
2232
|
+
*/
|
|
2233
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2234
|
+
/**
|
|
2235
|
+
* @see https://redis.io/commands/hpexpire
|
|
2236
|
+
*/
|
|
2237
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2238
|
+
/**
|
|
2239
|
+
* @see https://redis.io/commands/hpexpireat
|
|
2240
|
+
*/
|
|
2241
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2242
|
+
/**
|
|
2243
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
2244
|
+
*/
|
|
2245
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2246
|
+
/**
|
|
2247
|
+
* @see https://redis.io/commands/hpttl
|
|
2248
|
+
*/
|
|
2249
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2250
|
+
/**
|
|
2251
|
+
* @see https://redis.io/commands/hpersist
|
|
2252
|
+
*/
|
|
2253
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
1889
2254
|
/**
|
|
1890
2255
|
* @see https://redis.io/commands/hget
|
|
1891
2256
|
*/
|
|
@@ -2033,11 +2398,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2033
2398
|
/**
|
|
2034
2399
|
* @see https://redis.io/commands/pexpire
|
|
2035
2400
|
*/
|
|
2036
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2401
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2037
2402
|
/**
|
|
2038
2403
|
* @see https://redis.io/commands/pexpireat
|
|
2039
2404
|
*/
|
|
2040
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2405
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2041
2406
|
/**
|
|
2042
2407
|
* @see https://redis.io/commands/pfadd
|
|
2043
2408
|
*/
|
|
@@ -2097,7 +2462,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2097
2462
|
/**
|
|
2098
2463
|
* @see https://redis.io/commands/scan
|
|
2099
2464
|
*/
|
|
2100
|
-
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2465
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2101
2466
|
/**
|
|
2102
2467
|
* @see https://redis.io/commands/scard
|
|
2103
2468
|
*/
|
|
@@ -2459,6 +2824,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2459
2824
|
* @see https://redis.io/commands/json.get
|
|
2460
2825
|
*/
|
|
2461
2826
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2827
|
+
/**
|
|
2828
|
+
* @see https://redis.io/commands/json.merge
|
|
2829
|
+
*/
|
|
2830
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2462
2831
|
/**
|
|
2463
2832
|
* @see https://redis.io/commands/json.mget
|
|
2464
2833
|
*/
|
|
@@ -2534,9 +2903,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2534
2903
|
*/
|
|
2535
2904
|
declare class Script<TResult = unknown> {
|
|
2536
2905
|
readonly script: string;
|
|
2537
|
-
|
|
2906
|
+
/**
|
|
2907
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2908
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2909
|
+
*
|
|
2910
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2911
|
+
* future major release.
|
|
2912
|
+
*/
|
|
2913
|
+
sha1: string;
|
|
2538
2914
|
private readonly redis;
|
|
2539
2915
|
constructor(redis: Redis, script: string);
|
|
2916
|
+
/**
|
|
2917
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
2918
|
+
*/
|
|
2919
|
+
private init;
|
|
2540
2920
|
/**
|
|
2541
2921
|
* Send an `EVAL` command to redis.
|
|
2542
2922
|
*/
|
|
@@ -2558,6 +2938,56 @@ declare class Script<TResult = unknown> {
|
|
|
2558
2938
|
private digest;
|
|
2559
2939
|
}
|
|
2560
2940
|
|
|
2941
|
+
/**
|
|
2942
|
+
* Creates a new script.
|
|
2943
|
+
*
|
|
2944
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
2945
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
2946
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
2947
|
+
*
|
|
2948
|
+
* @example
|
|
2949
|
+
* ```ts
|
|
2950
|
+
* const redis = new Redis({...})
|
|
2951
|
+
*
|
|
2952
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
2953
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
2954
|
+
* expect(arg1, "Hello World")
|
|
2955
|
+
* ```
|
|
2956
|
+
*/
|
|
2957
|
+
declare class ScriptRO<TResult = unknown> {
|
|
2958
|
+
readonly script: string;
|
|
2959
|
+
/**
|
|
2960
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2961
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2962
|
+
*
|
|
2963
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2964
|
+
* future major release.
|
|
2965
|
+
*/
|
|
2966
|
+
sha1: string;
|
|
2967
|
+
private readonly redis;
|
|
2968
|
+
constructor(redis: Redis, script: string);
|
|
2969
|
+
private init;
|
|
2970
|
+
/**
|
|
2971
|
+
* Send an `EVAL_RO` command to redis.
|
|
2972
|
+
*/
|
|
2973
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2974
|
+
/**
|
|
2975
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
2976
|
+
*/
|
|
2977
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2978
|
+
/**
|
|
2979
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
2980
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
2981
|
+
*
|
|
2982
|
+
* Following calls will be able to use the cached script
|
|
2983
|
+
*/
|
|
2984
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
2985
|
+
/**
|
|
2986
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
2987
|
+
*/
|
|
2988
|
+
private digest;
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2561
2991
|
/**
|
|
2562
2992
|
* Serverless redis client for upstash.
|
|
2563
2993
|
*/
|
|
@@ -2621,6 +3051,10 @@ declare class Redis {
|
|
|
2621
3051
|
* @see https://redis.io/commands/json.get
|
|
2622
3052
|
*/
|
|
2623
3053
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3054
|
+
/**
|
|
3055
|
+
* @see https://redis.io/commands/json.merge
|
|
3056
|
+
*/
|
|
3057
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2624
3058
|
/**
|
|
2625
3059
|
* @see https://redis.io/commands/json.mget
|
|
2626
3060
|
*/
|
|
@@ -2684,7 +3118,37 @@ declare class Redis {
|
|
|
2684
3118
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2685
3119
|
*/
|
|
2686
3120
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2687
|
-
|
|
3121
|
+
/**
|
|
3122
|
+
* Creates a new script.
|
|
3123
|
+
*
|
|
3124
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3125
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3126
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3127
|
+
*
|
|
3128
|
+
* @param script - The script to create
|
|
3129
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3130
|
+
* @returns A new script
|
|
3131
|
+
*
|
|
3132
|
+
* @example
|
|
3133
|
+
* ```ts
|
|
3134
|
+
* const redis = new Redis({...})
|
|
3135
|
+
*
|
|
3136
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3137
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3138
|
+
* expect(arg1, "Hello World")
|
|
3139
|
+
* ```
|
|
3140
|
+
* @example
|
|
3141
|
+
* ```ts
|
|
3142
|
+
* const redis = new Redis({...})
|
|
3143
|
+
*
|
|
3144
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3145
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3146
|
+
* expect(arg1, "Hello World")
|
|
3147
|
+
* ```
|
|
3148
|
+
*/
|
|
3149
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3150
|
+
readonly?: TReadonly;
|
|
3151
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2688
3152
|
/**
|
|
2689
3153
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2690
3154
|
*
|
|
@@ -2763,14 +3227,26 @@ declare class Redis {
|
|
|
2763
3227
|
* @see https://redis.io/commands/echo
|
|
2764
3228
|
*/
|
|
2765
3229
|
echo: (message: string) => Promise<string>;
|
|
3230
|
+
/**
|
|
3231
|
+
* @see https://redis.io/commands/eval_ro
|
|
3232
|
+
*/
|
|
3233
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2766
3234
|
/**
|
|
2767
3235
|
* @see https://redis.io/commands/eval
|
|
2768
3236
|
*/
|
|
2769
3237
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3238
|
+
/**
|
|
3239
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3240
|
+
*/
|
|
3241
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2770
3242
|
/**
|
|
2771
3243
|
* @see https://redis.io/commands/evalsha
|
|
2772
3244
|
*/
|
|
2773
3245
|
evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3246
|
+
/**
|
|
3247
|
+
* Generic method to execute any Redis command.
|
|
3248
|
+
*/
|
|
3249
|
+
exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
|
|
2774
3250
|
/**
|
|
2775
3251
|
* @see https://redis.io/commands/exists
|
|
2776
3252
|
*/
|
|
@@ -2778,11 +3254,11 @@ declare class Redis {
|
|
|
2778
3254
|
/**
|
|
2779
3255
|
* @see https://redis.io/commands/expire
|
|
2780
3256
|
*/
|
|
2781
|
-
expire: (key: string, seconds: number, option?:
|
|
3257
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2782
3258
|
/**
|
|
2783
3259
|
* @see https://redis.io/commands/expireat
|
|
2784
3260
|
*/
|
|
2785
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3261
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2786
3262
|
/**
|
|
2787
3263
|
* @see https://redis.io/commands/flushall
|
|
2788
3264
|
*/
|
|
@@ -2895,6 +3371,46 @@ declare class Redis {
|
|
|
2895
3371
|
* @see https://redis.io/commands/getdel
|
|
2896
3372
|
*/
|
|
2897
3373
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3374
|
+
/**
|
|
3375
|
+
* @see https://redis.io/commands/getex
|
|
3376
|
+
*/
|
|
3377
|
+
getex: <TData>(key: string, opts?: ({
|
|
3378
|
+
ex: number;
|
|
3379
|
+
px?: never;
|
|
3380
|
+
exat?: never;
|
|
3381
|
+
pxat?: never;
|
|
3382
|
+
persist?: never;
|
|
3383
|
+
} | {
|
|
3384
|
+
ex?: never;
|
|
3385
|
+
px: number;
|
|
3386
|
+
exat?: never;
|
|
3387
|
+
pxat?: never;
|
|
3388
|
+
persist?: never;
|
|
3389
|
+
} | {
|
|
3390
|
+
ex?: never;
|
|
3391
|
+
px?: never;
|
|
3392
|
+
exat: number;
|
|
3393
|
+
pxat?: never;
|
|
3394
|
+
persist?: never;
|
|
3395
|
+
} | {
|
|
3396
|
+
ex?: never;
|
|
3397
|
+
px?: never;
|
|
3398
|
+
exat?: never;
|
|
3399
|
+
pxat: number;
|
|
3400
|
+
persist?: never;
|
|
3401
|
+
} | {
|
|
3402
|
+
ex?: never;
|
|
3403
|
+
px?: never;
|
|
3404
|
+
exat?: never;
|
|
3405
|
+
pxat?: never;
|
|
3406
|
+
persist: true;
|
|
3407
|
+
} | {
|
|
3408
|
+
ex?: never;
|
|
3409
|
+
px?: never;
|
|
3410
|
+
exat?: never;
|
|
3411
|
+
pxat?: never;
|
|
3412
|
+
persist?: never;
|
|
3413
|
+
}) | undefined) => Promise<TData | null>;
|
|
2898
3414
|
/**
|
|
2899
3415
|
* @see https://redis.io/commands/getrange
|
|
2900
3416
|
*/
|
|
@@ -2911,6 +3427,42 @@ declare class Redis {
|
|
|
2911
3427
|
* @see https://redis.io/commands/hexists
|
|
2912
3428
|
*/
|
|
2913
3429
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3430
|
+
/**
|
|
3431
|
+
* @see https://redis.io/commands/hexpire
|
|
3432
|
+
*/
|
|
3433
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3434
|
+
/**
|
|
3435
|
+
* @see https://redis.io/commands/hexpireat
|
|
3436
|
+
*/
|
|
3437
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3438
|
+
/**
|
|
3439
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3440
|
+
*/
|
|
3441
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3442
|
+
/**
|
|
3443
|
+
* @see https://redis.io/commands/httl
|
|
3444
|
+
*/
|
|
3445
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3446
|
+
/**
|
|
3447
|
+
* @see https://redis.io/commands/hpexpire
|
|
3448
|
+
*/
|
|
3449
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3450
|
+
/**
|
|
3451
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3452
|
+
*/
|
|
3453
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3454
|
+
/**
|
|
3455
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3456
|
+
*/
|
|
3457
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3458
|
+
/**
|
|
3459
|
+
* @see https://redis.io/commands/hpttl
|
|
3460
|
+
*/
|
|
3461
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3462
|
+
/**
|
|
3463
|
+
* @see https://redis.io/commands/hpersist
|
|
3464
|
+
*/
|
|
3465
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2914
3466
|
/**
|
|
2915
3467
|
* @see https://redis.io/commands/hget
|
|
2916
3468
|
*/
|
|
@@ -3062,11 +3614,11 @@ declare class Redis {
|
|
|
3062
3614
|
/**
|
|
3063
3615
|
* @see https://redis.io/commands/pexpire
|
|
3064
3616
|
*/
|
|
3065
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3617
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3066
3618
|
/**
|
|
3067
3619
|
* @see https://redis.io/commands/pexpireat
|
|
3068
3620
|
*/
|
|
3069
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3621
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3070
3622
|
/**
|
|
3071
3623
|
* @see https://redis.io/commands/pfadd
|
|
3072
3624
|
*/
|
|
@@ -3087,6 +3639,10 @@ declare class Redis {
|
|
|
3087
3639
|
* @see https://redis.io/commands/psetex
|
|
3088
3640
|
*/
|
|
3089
3641
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3642
|
+
/**
|
|
3643
|
+
* @see https://redis.io/commands/psubscribe
|
|
3644
|
+
*/
|
|
3645
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3090
3646
|
/**
|
|
3091
3647
|
* @see https://redis.io/commands/pttl
|
|
3092
3648
|
*/
|
|
@@ -3126,7 +3682,10 @@ declare class Redis {
|
|
|
3126
3682
|
/**
|
|
3127
3683
|
* @see https://redis.io/commands/scan
|
|
3128
3684
|
*/
|
|
3129
|
-
scan
|
|
3685
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
3686
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
3687
|
+
withType: true;
|
|
3688
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
3130
3689
|
/**
|
|
3131
3690
|
* @see https://redis.io/commands/scard
|
|
3132
3691
|
*/
|
|
@@ -3215,6 +3774,10 @@ declare class Redis {
|
|
|
3215
3774
|
* @see https://redis.io/commands/strlen
|
|
3216
3775
|
*/
|
|
3217
3776
|
strlen: (key: string) => Promise<number>;
|
|
3777
|
+
/**
|
|
3778
|
+
* @see https://redis.io/commands/subscribe
|
|
3779
|
+
*/
|
|
3780
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3218
3781
|
/**
|
|
3219
3782
|
* @see https://redis.io/commands/sunion
|
|
3220
3783
|
*/
|
|
@@ -3485,4 +4048,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3485
4048
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3486
4049
|
}
|
|
3487
4050
|
|
|
3488
|
-
export {
|
|
4051
|
+
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 };
|