@upstash/redis 1.35.0-canary → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/chunk-Q4ZBDYYE.mjs → chunk-QZ3IMTW7.mjs} +775 -86
- package/cloudflare.d.mts +55 -0
- package/cloudflare.d.ts +55 -0
- package/{dist/cloudflare.js → cloudflare.js} +789 -108
- package/{dist/cloudflare.mjs → cloudflare.mjs} +15 -13
- package/fastly.d.mts +48 -0
- package/fastly.d.ts +48 -0
- package/{dist/fastly.js → fastly.js} +785 -104
- package/{dist/fastly.mjs → fastly.mjs} +11 -9
- package/nodejs.d.mts +73 -0
- package/nodejs.d.ts +73 -0
- package/{dist/nodejs.js → nodejs.js} +792 -110
- package/{dist/nodejs.mjs → nodejs.mjs} +18 -15
- package/package.json +1 -1
- package/{dist/zmscore-BhX8yEQc.d.mts → zmscore-DzNHSWxc.d.mts} +575 -46
- package/{dist/zmscore-BhX8yEQc.d.ts → zmscore-DzNHSWxc.d.ts} +575 -46
- package/dist/cloudflare.d.mts +0 -55
- package/dist/cloudflare.d.ts +0 -55
- package/dist/fastly.d.mts +0 -48
- package/dist/fastly.d.ts +0 -48
- package/dist/nodejs.d.mts +0 -73
- package/dist/nodejs.d.ts +0 -73
|
@@ -36,7 +36,23 @@ type UpstashRequest = {
|
|
|
36
36
|
* Request body will be serialized to json
|
|
37
37
|
*/
|
|
38
38
|
body?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Additional headers for the request
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
39
43
|
upstashSyncToken?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Callback for handling streaming messages
|
|
46
|
+
*/
|
|
47
|
+
onMessage?: (data: string) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this request expects a streaming response
|
|
50
|
+
*/
|
|
51
|
+
isStreaming?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Abort signal for the request
|
|
54
|
+
*/
|
|
55
|
+
signal?: AbortSignal;
|
|
40
56
|
};
|
|
41
57
|
type UpstashResponse<TResult> = {
|
|
42
58
|
result?: TResult;
|
|
@@ -119,6 +135,31 @@ type CommandOptions<TResult, TData> = {
|
|
|
119
135
|
*/
|
|
120
136
|
automaticDeserialization?: boolean;
|
|
121
137
|
latencyLogging?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Additional headers to be sent with the request
|
|
140
|
+
*/
|
|
141
|
+
headers?: Record<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Path to append to the URL
|
|
144
|
+
*/
|
|
145
|
+
path?: string[];
|
|
146
|
+
/**
|
|
147
|
+
* Options for streaming requests, mainly used for subscribe, monitor commands
|
|
148
|
+
**/
|
|
149
|
+
streamOptions?: {
|
|
150
|
+
/**
|
|
151
|
+
* Callback to be called when a message is received
|
|
152
|
+
*/
|
|
153
|
+
onMessage?: (data: string) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Whether the request is streaming
|
|
156
|
+
*/
|
|
157
|
+
isStreaming?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Signal to abort the request
|
|
160
|
+
*/
|
|
161
|
+
signal?: AbortSignal;
|
|
162
|
+
};
|
|
122
163
|
};
|
|
123
164
|
/**
|
|
124
165
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -130,6 +171,11 @@ declare class Command<TResult, TData> {
|
|
|
130
171
|
readonly command: (string | number | boolean)[];
|
|
131
172
|
readonly serialize: Serialize;
|
|
132
173
|
readonly deserialize: Deserialize<TResult, TData>;
|
|
174
|
+
protected readonly headers?: Record<string, string>;
|
|
175
|
+
protected readonly path?: string[];
|
|
176
|
+
protected readonly onMessage?: (data: string) => void;
|
|
177
|
+
protected readonly isStreaming: boolean;
|
|
178
|
+
protected readonly signal?: AbortSignal;
|
|
133
179
|
/**
|
|
134
180
|
* Create a new command instance.
|
|
135
181
|
*
|
|
@@ -225,18 +271,6 @@ declare class ScriptFlushCommand extends Command<"OK", "OK"> {
|
|
|
225
271
|
constructor([opts]: [opts?: ScriptFlushCommandOptions], cmdOpts?: CommandOptions<"OK", "OK">);
|
|
226
272
|
}
|
|
227
273
|
|
|
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
274
|
type GeoAddCommandOptions = {
|
|
241
275
|
nx?: boolean;
|
|
242
276
|
xx?: never;
|
|
@@ -262,6 +296,11 @@ declare class GeoAddCommand<TMemberType = string> extends Command<number | null,
|
|
|
262
296
|
], opts?: CommandOptions<number | null, number | null>);
|
|
263
297
|
}
|
|
264
298
|
|
|
299
|
+
type ExpireOption = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
300
|
+
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
301
|
+
constructor(cmd: [key: string, seconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
302
|
+
}
|
|
303
|
+
|
|
265
304
|
/**
|
|
266
305
|
* @see https://redis.io/commands/append
|
|
267
306
|
*/
|
|
@@ -358,6 +397,13 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
358
397
|
constructor(cmd: [message: string], opts?: CommandOptions<string, string>);
|
|
359
398
|
}
|
|
360
399
|
|
|
400
|
+
/**
|
|
401
|
+
* @see https://redis.io/commands/eval_ro
|
|
402
|
+
*/
|
|
403
|
+
declare class EvalROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
404
|
+
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
405
|
+
}
|
|
406
|
+
|
|
361
407
|
/**
|
|
362
408
|
* @see https://redis.io/commands/eval
|
|
363
409
|
*/
|
|
@@ -365,6 +411,13 @@ declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknow
|
|
|
365
411
|
constructor([script, keys, args]: [script: string, keys: string[], args: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
366
412
|
}
|
|
367
413
|
|
|
414
|
+
/**
|
|
415
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
416
|
+
*/
|
|
417
|
+
declare class EvalshaROCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
418
|
+
constructor([sha, keys, args]: [sha: string, keys: string[], args?: TArgs], opts?: CommandOptions<unknown, TData>);
|
|
419
|
+
}
|
|
420
|
+
|
|
368
421
|
/**
|
|
369
422
|
* @see https://redis.io/commands/evalsha
|
|
370
423
|
*/
|
|
@@ -379,16 +432,11 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
379
432
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
380
433
|
}
|
|
381
434
|
|
|
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
435
|
/**
|
|
388
436
|
* @see https://redis.io/commands/expireat
|
|
389
437
|
*/
|
|
390
438
|
declare class ExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
391
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
439
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
392
440
|
}
|
|
393
441
|
|
|
394
442
|
/**
|
|
@@ -563,6 +611,50 @@ declare class GetDelCommand<TData = string> extends Command<unknown | null, TDat
|
|
|
563
611
|
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
564
612
|
}
|
|
565
613
|
|
|
614
|
+
type GetExCommandOptions = {
|
|
615
|
+
ex: number;
|
|
616
|
+
px?: never;
|
|
617
|
+
exat?: never;
|
|
618
|
+
pxat?: never;
|
|
619
|
+
persist?: never;
|
|
620
|
+
} | {
|
|
621
|
+
ex?: never;
|
|
622
|
+
px: number;
|
|
623
|
+
exat?: never;
|
|
624
|
+
pxat?: never;
|
|
625
|
+
persist?: never;
|
|
626
|
+
} | {
|
|
627
|
+
ex?: never;
|
|
628
|
+
px?: never;
|
|
629
|
+
exat: number;
|
|
630
|
+
pxat?: never;
|
|
631
|
+
persist?: never;
|
|
632
|
+
} | {
|
|
633
|
+
ex?: never;
|
|
634
|
+
px?: never;
|
|
635
|
+
exat?: never;
|
|
636
|
+
pxat: number;
|
|
637
|
+
persist?: never;
|
|
638
|
+
} | {
|
|
639
|
+
ex?: never;
|
|
640
|
+
px?: never;
|
|
641
|
+
exat?: never;
|
|
642
|
+
pxat?: never;
|
|
643
|
+
persist: true;
|
|
644
|
+
} | {
|
|
645
|
+
ex?: never;
|
|
646
|
+
px?: never;
|
|
647
|
+
exat?: never;
|
|
648
|
+
pxat?: never;
|
|
649
|
+
persist?: never;
|
|
650
|
+
};
|
|
651
|
+
/**
|
|
652
|
+
* @see https://redis.io/commands/getex
|
|
653
|
+
*/
|
|
654
|
+
declare class GetExCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
655
|
+
constructor([key, opts]: [key: string, opts?: GetExCommandOptions], cmdOpts?: CommandOptions<unknown | null, TData | null>);
|
|
656
|
+
}
|
|
657
|
+
|
|
566
658
|
/**
|
|
567
659
|
* @see https://redis.io/commands/getrange
|
|
568
660
|
*/
|
|
@@ -591,6 +683,58 @@ declare class HExistsCommand extends Command<number, number> {
|
|
|
591
683
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
592
684
|
}
|
|
593
685
|
|
|
686
|
+
declare class HExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
687
|
+
constructor(cmd: [
|
|
688
|
+
key: string,
|
|
689
|
+
fields: (string | number) | (string | number)[],
|
|
690
|
+
seconds: number,
|
|
691
|
+
option?: ExpireOption
|
|
692
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
declare class HExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
696
|
+
constructor(cmd: [
|
|
697
|
+
key: string,
|
|
698
|
+
fields: (string | number) | (string | number)[],
|
|
699
|
+
timestamp: number,
|
|
700
|
+
option?: ExpireOption
|
|
701
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
declare class HExpireTimeCommand extends Command<number[], number[]> {
|
|
705
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
declare class HPersistCommand extends Command<(-2 | -1 | 1)[], (-2 | -1 | 1)[]> {
|
|
709
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<(-2 | -1 | 1)[], (-2 | -1 | 1)[]>);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
declare class HPExpireCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
713
|
+
constructor(cmd: [
|
|
714
|
+
key: string,
|
|
715
|
+
fields: (string | number) | (string | number)[],
|
|
716
|
+
milliseconds: number,
|
|
717
|
+
option?: ExpireOption
|
|
718
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
declare class HPExpireAtCommand extends Command<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]> {
|
|
722
|
+
constructor(cmd: [
|
|
723
|
+
key: string,
|
|
724
|
+
fields: (string | number) | (string | number)[],
|
|
725
|
+
timestamp: number,
|
|
726
|
+
option?: ExpireOption
|
|
727
|
+
], opts?: CommandOptions<(-2 | 0 | 1 | 2)[], (-2 | 0 | 1 | 2)[]>);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
declare class HPExpireTimeCommand extends Command<number[], number[]> {
|
|
731
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
declare class HPTtlCommand extends Command<number[], number[]> {
|
|
735
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
736
|
+
}
|
|
737
|
+
|
|
594
738
|
/**
|
|
595
739
|
* @see https://redis.io/commands/hget
|
|
596
740
|
*/
|
|
@@ -664,6 +808,39 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
664
808
|
constructor(cmd: [key: string, count: number, withValues: boolean], opts?: CommandOptions<string[], Partial<TData>>);
|
|
665
809
|
}
|
|
666
810
|
|
|
811
|
+
type ScanCommandOptionsStandard = {
|
|
812
|
+
match?: string;
|
|
813
|
+
count?: number;
|
|
814
|
+
type?: string;
|
|
815
|
+
withType?: false;
|
|
816
|
+
};
|
|
817
|
+
type ScanCommandOptionsWithType = {
|
|
818
|
+
match?: string;
|
|
819
|
+
count?: number;
|
|
820
|
+
/**
|
|
821
|
+
* Includes types of each key in the result
|
|
822
|
+
*
|
|
823
|
+
* @example
|
|
824
|
+
* ```typescript
|
|
825
|
+
* await redis.scan("0", { withType: true })
|
|
826
|
+
* // ["0", [{ key: "key1", type: "string" }, { key: "key2", type: "list" }]]
|
|
827
|
+
* ```
|
|
828
|
+
*/
|
|
829
|
+
withType: true;
|
|
830
|
+
};
|
|
831
|
+
type ScanCommandOptions = ScanCommandOptionsStandard | ScanCommandOptionsWithType;
|
|
832
|
+
type ScanResultStandard = [string, string[]];
|
|
833
|
+
type ScanResultWithType = [string, {
|
|
834
|
+
key: string;
|
|
835
|
+
type: string;
|
|
836
|
+
}[]];
|
|
837
|
+
/**
|
|
838
|
+
* @see https://redis.io/commands/scan
|
|
839
|
+
*/
|
|
840
|
+
declare class ScanCommand<TData = ScanResultStandard> extends Command<[string, string[]], TData> {
|
|
841
|
+
constructor([cursor, opts]: [cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, string[]], TData>);
|
|
842
|
+
}
|
|
843
|
+
|
|
667
844
|
/**
|
|
668
845
|
* @see https://redis.io/commands/hscan
|
|
669
846
|
*/
|
|
@@ -698,6 +875,10 @@ declare class HStrLenCommand extends Command<number, number> {
|
|
|
698
875
|
constructor(cmd: [key: string, field: string], opts?: CommandOptions<number, number>);
|
|
699
876
|
}
|
|
700
877
|
|
|
878
|
+
declare class HTtlCommand extends Command<number[], number[]> {
|
|
879
|
+
constructor(cmd: [key: string, fields: (string | number) | (string | number)[]], opts?: CommandOptions<number[], number[]>);
|
|
880
|
+
}
|
|
881
|
+
|
|
701
882
|
/**
|
|
702
883
|
* @see https://redis.io/commands/hvals
|
|
703
884
|
*/
|
|
@@ -804,6 +985,13 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
804
985
|
] | [key: string, ...path: string[]], opts?: CommandOptions<TData | null, TData | null>);
|
|
805
986
|
}
|
|
806
987
|
|
|
988
|
+
/**
|
|
989
|
+
* @see https://redis.io/commands/json.merge
|
|
990
|
+
*/
|
|
991
|
+
declare class JsonMergeCommand<TData extends string | number | Record<string, unknown> | Array<unknown>> extends Command<"OK" | null, "OK" | null> {
|
|
992
|
+
constructor(cmd: [key: string, path: string, value: TData], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
993
|
+
}
|
|
994
|
+
|
|
807
995
|
/**
|
|
808
996
|
* @see https://redis.io/commands/json.mget
|
|
809
997
|
*/
|
|
@@ -1006,14 +1194,14 @@ declare class PersistCommand extends Command<"0" | "1", 0 | 1> {
|
|
|
1006
1194
|
* @see https://redis.io/commands/pexpire
|
|
1007
1195
|
*/
|
|
1008
1196
|
declare class PExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
1009
|
-
constructor(cmd: [key: string, milliseconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1197
|
+
constructor(cmd: [key: string, milliseconds: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1010
1198
|
}
|
|
1011
1199
|
|
|
1012
1200
|
/**
|
|
1013
1201
|
* @see https://redis.io/commands/pexpireat
|
|
1014
1202
|
*/
|
|
1015
1203
|
declare class PExpireAtCommand extends Command<"0" | "1", 0 | 1> {
|
|
1016
|
-
constructor(cmd: [key: string, unix: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1204
|
+
constructor(cmd: [key: string, unix: number, option?: ExpireOption], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
1017
1205
|
}
|
|
1018
1206
|
|
|
1019
1207
|
/**
|
|
@@ -1599,9 +1787,78 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1599
1787
|
constructor(cmd: [key: string, member: TData], opts?: CommandOptions<string | null, number | null>);
|
|
1600
1788
|
}
|
|
1601
1789
|
|
|
1790
|
+
type BaseMessageData<TMessage> = {
|
|
1791
|
+
channel: string;
|
|
1792
|
+
message: TMessage;
|
|
1793
|
+
};
|
|
1794
|
+
type PatternMessageData<TMessage> = BaseMessageData<TMessage> & {
|
|
1795
|
+
pattern: string;
|
|
1796
|
+
};
|
|
1797
|
+
type SubscriptionCountEvent = number;
|
|
1798
|
+
type MessageEventMap<TMessage> = {
|
|
1799
|
+
message: BaseMessageData<TMessage>;
|
|
1800
|
+
subscribe: SubscriptionCountEvent;
|
|
1801
|
+
unsubscribe: SubscriptionCountEvent;
|
|
1802
|
+
pmessage: PatternMessageData<TMessage>;
|
|
1803
|
+
psubscribe: SubscriptionCountEvent;
|
|
1804
|
+
punsubscribe: SubscriptionCountEvent;
|
|
1805
|
+
error: Error;
|
|
1806
|
+
[key: `message:${string}`]: BaseMessageData<TMessage>;
|
|
1807
|
+
[key: `pmessage:${string}`]: PatternMessageData<TMessage>;
|
|
1808
|
+
};
|
|
1809
|
+
type EventType = keyof MessageEventMap<any>;
|
|
1810
|
+
type Listener<TMessage, T extends EventType> = (event: MessageEventMap<TMessage>[T]) => void;
|
|
1811
|
+
declare class Subscriber<TMessage = any> extends EventTarget {
|
|
1812
|
+
private subscriptions;
|
|
1813
|
+
private client;
|
|
1814
|
+
private listeners;
|
|
1815
|
+
constructor(client: Requester, channels: string[], isPattern?: boolean);
|
|
1816
|
+
private subscribeToChannel;
|
|
1817
|
+
private subscribeToPattern;
|
|
1818
|
+
private handleMessage;
|
|
1819
|
+
private dispatchToListeners;
|
|
1820
|
+
on<T extends keyof MessageEventMap<TMessage>>(type: T, listener: Listener<TMessage, T>): void;
|
|
1821
|
+
removeAllListeners(): void;
|
|
1822
|
+
unsubscribe(channels?: string[]): Promise<void>;
|
|
1823
|
+
getSubscribedChannels(): string[];
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1602
1826
|
type InferResponseData<T extends unknown[]> = {
|
|
1603
1827
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1604
1828
|
};
|
|
1829
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1830
|
+
/**
|
|
1831
|
+
* Send the pipeline request to upstash.
|
|
1832
|
+
*
|
|
1833
|
+
* Returns an array with the results of all pipelined commands.
|
|
1834
|
+
*
|
|
1835
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1836
|
+
* ```ts
|
|
1837
|
+
* const p = redis.pipeline()
|
|
1838
|
+
* p.get("key")
|
|
1839
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1840
|
+
* ```
|
|
1841
|
+
*
|
|
1842
|
+
* 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.
|
|
1843
|
+
*
|
|
1844
|
+
* 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 }`.
|
|
1845
|
+
*
|
|
1846
|
+
* ```ts
|
|
1847
|
+
* const p = redis.pipeline()
|
|
1848
|
+
* p.get("key")
|
|
1849
|
+
*
|
|
1850
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1851
|
+
* const getResult = result[0].result
|
|
1852
|
+
* const getError = result[0].error
|
|
1853
|
+
* ```
|
|
1854
|
+
*/
|
|
1855
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1856
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1857
|
+
keepErrors: true;
|
|
1858
|
+
}): Promise<{
|
|
1859
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1860
|
+
}>;
|
|
1861
|
+
}
|
|
1605
1862
|
/**
|
|
1606
1863
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1607
1864
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1650,19 +1907,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1650
1907
|
commandOptions?: CommandOptions<any, any>;
|
|
1651
1908
|
multiExec?: boolean;
|
|
1652
1909
|
});
|
|
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>;
|
|
1910
|
+
exec: ExecMethod<TCommands>;
|
|
1666
1911
|
/**
|
|
1667
1912
|
* Returns the length of pipeline before the execution
|
|
1668
1913
|
*/
|
|
@@ -1738,10 +1983,18 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1738
1983
|
* @see https://redis.io/commands/echo
|
|
1739
1984
|
*/
|
|
1740
1985
|
echo: (message: string) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
1986
|
+
/**
|
|
1987
|
+
* @see https://redis.io/commands/eval_ro
|
|
1988
|
+
*/
|
|
1989
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1741
1990
|
/**
|
|
1742
1991
|
* @see https://redis.io/commands/eval
|
|
1743
1992
|
*/
|
|
1744
1993
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1994
|
+
/**
|
|
1995
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
1996
|
+
*/
|
|
1997
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1745
1998
|
/**
|
|
1746
1999
|
* @see https://redis.io/commands/evalsha
|
|
1747
2000
|
*/
|
|
@@ -1753,11 +2006,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1753
2006
|
/**
|
|
1754
2007
|
* @see https://redis.io/commands/expire
|
|
1755
2008
|
*/
|
|
1756
|
-
expire: (key: string, seconds: number, option?:
|
|
2009
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1757
2010
|
/**
|
|
1758
2011
|
* @see https://redis.io/commands/expireat
|
|
1759
2012
|
*/
|
|
1760
|
-
expireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2013
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1761
2014
|
/**
|
|
1762
2015
|
* @see https://redis.io/commands/flushall
|
|
1763
2016
|
*/
|
|
@@ -1870,6 +2123,46 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1870
2123
|
* @see https://redis.io/commands/getdel
|
|
1871
2124
|
*/
|
|
1872
2125
|
getdel: <TData>(key: string) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2126
|
+
/**
|
|
2127
|
+
* @see https://redis.io/commands/getex
|
|
2128
|
+
*/
|
|
2129
|
+
getex: <TData>(key: string, opts?: ({
|
|
2130
|
+
ex: number;
|
|
2131
|
+
px?: never;
|
|
2132
|
+
exat?: never;
|
|
2133
|
+
pxat?: never;
|
|
2134
|
+
persist?: never;
|
|
2135
|
+
} | {
|
|
2136
|
+
ex?: never;
|
|
2137
|
+
px: number;
|
|
2138
|
+
exat?: never;
|
|
2139
|
+
pxat?: never;
|
|
2140
|
+
persist?: never;
|
|
2141
|
+
} | {
|
|
2142
|
+
ex?: never;
|
|
2143
|
+
px?: never;
|
|
2144
|
+
exat: number;
|
|
2145
|
+
pxat?: never;
|
|
2146
|
+
persist?: never;
|
|
2147
|
+
} | {
|
|
2148
|
+
ex?: never;
|
|
2149
|
+
px?: never;
|
|
2150
|
+
exat?: never;
|
|
2151
|
+
pxat: number;
|
|
2152
|
+
persist?: never;
|
|
2153
|
+
} | {
|
|
2154
|
+
ex?: never;
|
|
2155
|
+
px?: never;
|
|
2156
|
+
exat?: never;
|
|
2157
|
+
pxat?: never;
|
|
2158
|
+
persist: true;
|
|
2159
|
+
} | {
|
|
2160
|
+
ex?: never;
|
|
2161
|
+
px?: never;
|
|
2162
|
+
exat?: never;
|
|
2163
|
+
pxat?: never;
|
|
2164
|
+
persist?: never;
|
|
2165
|
+
}) | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
1873
2166
|
/**
|
|
1874
2167
|
* @see https://redis.io/commands/getrange
|
|
1875
2168
|
*/
|
|
@@ -1886,6 +2179,42 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1886
2179
|
* @see https://redis.io/commands/hexists
|
|
1887
2180
|
*/
|
|
1888
2181
|
hexists: (key: string, field: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2182
|
+
/**
|
|
2183
|
+
* @see https://redis.io/commands/hexpire
|
|
2184
|
+
*/
|
|
2185
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2186
|
+
/**
|
|
2187
|
+
* @see https://redis.io/commands/hexpireat
|
|
2188
|
+
*/
|
|
2189
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2190
|
+
/**
|
|
2191
|
+
* @see https://redis.io/commands/hexpiretime
|
|
2192
|
+
*/
|
|
2193
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2194
|
+
/**
|
|
2195
|
+
* @see https://redis.io/commands/httl
|
|
2196
|
+
*/
|
|
2197
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2198
|
+
/**
|
|
2199
|
+
* @see https://redis.io/commands/hpexpire
|
|
2200
|
+
*/
|
|
2201
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2202
|
+
/**
|
|
2203
|
+
* @see https://redis.io/commands/hpexpireat
|
|
2204
|
+
*/
|
|
2205
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, (0 | 1 | 2 | -2)[]>]>;
|
|
2206
|
+
/**
|
|
2207
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
2208
|
+
*/
|
|
2209
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2210
|
+
/**
|
|
2211
|
+
* @see https://redis.io/commands/hpttl
|
|
2212
|
+
*/
|
|
2213
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, number[]>]>;
|
|
2214
|
+
/**
|
|
2215
|
+
* @see https://redis.io/commands/hpersist
|
|
2216
|
+
*/
|
|
2217
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Pipeline<[...TCommands, Command<any, (1 | -2 | -1)[]>]>;
|
|
1889
2218
|
/**
|
|
1890
2219
|
* @see https://redis.io/commands/hget
|
|
1891
2220
|
*/
|
|
@@ -2033,11 +2362,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2033
2362
|
/**
|
|
2034
2363
|
* @see https://redis.io/commands/pexpire
|
|
2035
2364
|
*/
|
|
2036
|
-
pexpire: (key: string, milliseconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2365
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2037
2366
|
/**
|
|
2038
2367
|
* @see https://redis.io/commands/pexpireat
|
|
2039
2368
|
*/
|
|
2040
|
-
pexpireat: (key: string, unix: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2369
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
2041
2370
|
/**
|
|
2042
2371
|
* @see https://redis.io/commands/pfadd
|
|
2043
2372
|
*/
|
|
@@ -2097,7 +2426,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2097
2426
|
/**
|
|
2098
2427
|
* @see https://redis.io/commands/scan
|
|
2099
2428
|
*/
|
|
2100
|
-
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any,
|
|
2429
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2101
2430
|
/**
|
|
2102
2431
|
* @see https://redis.io/commands/scard
|
|
2103
2432
|
*/
|
|
@@ -2459,6 +2788,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2459
2788
|
* @see https://redis.io/commands/json.get
|
|
2460
2789
|
*/
|
|
2461
2790
|
get: (...args: CommandArgs<typeof JsonGetCommand>) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2791
|
+
/**
|
|
2792
|
+
* @see https://redis.io/commands/json.merge
|
|
2793
|
+
*/
|
|
2794
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2462
2795
|
/**
|
|
2463
2796
|
* @see https://redis.io/commands/json.mget
|
|
2464
2797
|
*/
|
|
@@ -2534,9 +2867,20 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2534
2867
|
*/
|
|
2535
2868
|
declare class Script<TResult = unknown> {
|
|
2536
2869
|
readonly script: string;
|
|
2537
|
-
|
|
2870
|
+
/**
|
|
2871
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2872
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2873
|
+
*
|
|
2874
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2875
|
+
* future major release.
|
|
2876
|
+
*/
|
|
2877
|
+
sha1: string;
|
|
2538
2878
|
private readonly redis;
|
|
2539
2879
|
constructor(redis: Redis, script: string);
|
|
2880
|
+
/**
|
|
2881
|
+
* Initialize the script by computing its SHA-1 hash.
|
|
2882
|
+
*/
|
|
2883
|
+
private init;
|
|
2540
2884
|
/**
|
|
2541
2885
|
* Send an `EVAL` command to redis.
|
|
2542
2886
|
*/
|
|
@@ -2558,6 +2902,56 @@ declare class Script<TResult = unknown> {
|
|
|
2558
2902
|
private digest;
|
|
2559
2903
|
}
|
|
2560
2904
|
|
|
2905
|
+
/**
|
|
2906
|
+
* Creates a new script.
|
|
2907
|
+
*
|
|
2908
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
2909
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
2910
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
2911
|
+
*
|
|
2912
|
+
* @example
|
|
2913
|
+
* ```ts
|
|
2914
|
+
* const redis = new Redis({...})
|
|
2915
|
+
*
|
|
2916
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readOnly: true })
|
|
2917
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
2918
|
+
* expect(arg1, "Hello World")
|
|
2919
|
+
* ```
|
|
2920
|
+
*/
|
|
2921
|
+
declare class ScriptRO<TResult = unknown> {
|
|
2922
|
+
readonly script: string;
|
|
2923
|
+
/**
|
|
2924
|
+
* @deprecated This property is initialized to an empty string and will be set in the init method
|
|
2925
|
+
* asynchronously. Do not use this property immidiately after the constructor.
|
|
2926
|
+
*
|
|
2927
|
+
* This property is only exposed for backwards compatibility and will be removed in the
|
|
2928
|
+
* future major release.
|
|
2929
|
+
*/
|
|
2930
|
+
sha1: string;
|
|
2931
|
+
private readonly redis;
|
|
2932
|
+
constructor(redis: Redis, script: string);
|
|
2933
|
+
private init;
|
|
2934
|
+
/**
|
|
2935
|
+
* Send an `EVAL_RO` command to redis.
|
|
2936
|
+
*/
|
|
2937
|
+
evalRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2938
|
+
/**
|
|
2939
|
+
* Calculates the sha1 hash of the script and then calls `EVALSHA_RO`.
|
|
2940
|
+
*/
|
|
2941
|
+
evalshaRo(keys: string[], args: string[]): Promise<TResult>;
|
|
2942
|
+
/**
|
|
2943
|
+
* Optimistically try to run `EVALSHA_RO` first.
|
|
2944
|
+
* If the script is not loaded in redis, it will fall back and try again with `EVAL_RO`.
|
|
2945
|
+
*
|
|
2946
|
+
* Following calls will be able to use the cached script
|
|
2947
|
+
*/
|
|
2948
|
+
exec(keys: string[], args: string[]): Promise<TResult>;
|
|
2949
|
+
/**
|
|
2950
|
+
* Compute the sha1 hash of the script and return its hex representation.
|
|
2951
|
+
*/
|
|
2952
|
+
private digest;
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2561
2955
|
/**
|
|
2562
2956
|
* Serverless redis client for upstash.
|
|
2563
2957
|
*/
|
|
@@ -2578,6 +2972,8 @@ declare class Redis {
|
|
|
2578
2972
|
* ```
|
|
2579
2973
|
*/
|
|
2580
2974
|
constructor(client: Requester, opts?: RedisOptions);
|
|
2975
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
2976
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2581
2977
|
get json(): {
|
|
2582
2978
|
/**
|
|
2583
2979
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2619,6 +3015,10 @@ declare class Redis {
|
|
|
2619
3015
|
* @see https://redis.io/commands/json.get
|
|
2620
3016
|
*/
|
|
2621
3017
|
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
3018
|
+
/**
|
|
3019
|
+
* @see https://redis.io/commands/json.merge
|
|
3020
|
+
*/
|
|
3021
|
+
merge: (key: string, path: string, value: string | number | unknown[] | Record<string, unknown>) => Promise<"OK" | null>;
|
|
2622
3022
|
/**
|
|
2623
3023
|
* @see https://redis.io/commands/json.mget
|
|
2624
3024
|
*/
|
|
@@ -2682,7 +3082,37 @@ declare class Redis {
|
|
|
2682
3082
|
* Technically this is not private, we can hide it from intellisense by doing this
|
|
2683
3083
|
*/
|
|
2684
3084
|
protected addTelemetry: (telemetry: Telemetry) => void;
|
|
2685
|
-
|
|
3085
|
+
/**
|
|
3086
|
+
* Creates a new script.
|
|
3087
|
+
*
|
|
3088
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
3089
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
3090
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
3091
|
+
*
|
|
3092
|
+
* @param script - The script to create
|
|
3093
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
3094
|
+
* @returns A new script
|
|
3095
|
+
*
|
|
3096
|
+
* @example
|
|
3097
|
+
* ```ts
|
|
3098
|
+
* const redis = new Redis({...})
|
|
3099
|
+
*
|
|
3100
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
3101
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
3102
|
+
* expect(arg1, "Hello World")
|
|
3103
|
+
* ```
|
|
3104
|
+
* @example
|
|
3105
|
+
* ```ts
|
|
3106
|
+
* const redis = new Redis({...})
|
|
3107
|
+
*
|
|
3108
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
3109
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
3110
|
+
* expect(arg1, "Hello World")
|
|
3111
|
+
* ```
|
|
3112
|
+
*/
|
|
3113
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(script: string, opts?: {
|
|
3114
|
+
readonly?: TReadonly;
|
|
3115
|
+
}): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>;
|
|
2686
3116
|
/**
|
|
2687
3117
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
2688
3118
|
*
|
|
@@ -2761,14 +3191,26 @@ declare class Redis {
|
|
|
2761
3191
|
* @see https://redis.io/commands/echo
|
|
2762
3192
|
*/
|
|
2763
3193
|
echo: (message: string) => Promise<string>;
|
|
3194
|
+
/**
|
|
3195
|
+
* @see https://redis.io/commands/eval_ro
|
|
3196
|
+
*/
|
|
3197
|
+
evalRo: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2764
3198
|
/**
|
|
2765
3199
|
* @see https://redis.io/commands/eval
|
|
2766
3200
|
*/
|
|
2767
3201
|
eval: <TArgs extends unknown[], TData = unknown>(script: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3202
|
+
/**
|
|
3203
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
3204
|
+
*/
|
|
3205
|
+
evalshaRo: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
2768
3206
|
/**
|
|
2769
3207
|
* @see https://redis.io/commands/evalsha
|
|
2770
3208
|
*/
|
|
2771
3209
|
evalsha: <TArgs extends unknown[], TData = unknown>(sha1: string, keys: string[], args: TArgs) => Promise<TData>;
|
|
3210
|
+
/**
|
|
3211
|
+
* Generic method to execute any Redis command.
|
|
3212
|
+
*/
|
|
3213
|
+
exec: <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) => Promise<TResult>;
|
|
2772
3214
|
/**
|
|
2773
3215
|
* @see https://redis.io/commands/exists
|
|
2774
3216
|
*/
|
|
@@ -2776,11 +3218,11 @@ declare class Redis {
|
|
|
2776
3218
|
/**
|
|
2777
3219
|
* @see https://redis.io/commands/expire
|
|
2778
3220
|
*/
|
|
2779
|
-
expire: (key: string, seconds: number, option?:
|
|
3221
|
+
expire: (key: string, seconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2780
3222
|
/**
|
|
2781
3223
|
* @see https://redis.io/commands/expireat
|
|
2782
3224
|
*/
|
|
2783
|
-
expireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3225
|
+
expireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
2784
3226
|
/**
|
|
2785
3227
|
* @see https://redis.io/commands/flushall
|
|
2786
3228
|
*/
|
|
@@ -2893,6 +3335,46 @@ declare class Redis {
|
|
|
2893
3335
|
* @see https://redis.io/commands/getdel
|
|
2894
3336
|
*/
|
|
2895
3337
|
getdel: <TData>(key: string) => Promise<TData | null>;
|
|
3338
|
+
/**
|
|
3339
|
+
* @see https://redis.io/commands/getex
|
|
3340
|
+
*/
|
|
3341
|
+
getex: <TData>(key: string, opts?: ({
|
|
3342
|
+
ex: number;
|
|
3343
|
+
px?: never;
|
|
3344
|
+
exat?: never;
|
|
3345
|
+
pxat?: never;
|
|
3346
|
+
persist?: never;
|
|
3347
|
+
} | {
|
|
3348
|
+
ex?: never;
|
|
3349
|
+
px: number;
|
|
3350
|
+
exat?: never;
|
|
3351
|
+
pxat?: never;
|
|
3352
|
+
persist?: never;
|
|
3353
|
+
} | {
|
|
3354
|
+
ex?: never;
|
|
3355
|
+
px?: never;
|
|
3356
|
+
exat: number;
|
|
3357
|
+
pxat?: never;
|
|
3358
|
+
persist?: never;
|
|
3359
|
+
} | {
|
|
3360
|
+
ex?: never;
|
|
3361
|
+
px?: never;
|
|
3362
|
+
exat?: never;
|
|
3363
|
+
pxat: number;
|
|
3364
|
+
persist?: never;
|
|
3365
|
+
} | {
|
|
3366
|
+
ex?: never;
|
|
3367
|
+
px?: never;
|
|
3368
|
+
exat?: never;
|
|
3369
|
+
pxat?: never;
|
|
3370
|
+
persist: true;
|
|
3371
|
+
} | {
|
|
3372
|
+
ex?: never;
|
|
3373
|
+
px?: never;
|
|
3374
|
+
exat?: never;
|
|
3375
|
+
pxat?: never;
|
|
3376
|
+
persist?: never;
|
|
3377
|
+
}) | undefined) => Promise<TData | null>;
|
|
2896
3378
|
/**
|
|
2897
3379
|
* @see https://redis.io/commands/getrange
|
|
2898
3380
|
*/
|
|
@@ -2909,6 +3391,42 @@ declare class Redis {
|
|
|
2909
3391
|
* @see https://redis.io/commands/hexists
|
|
2910
3392
|
*/
|
|
2911
3393
|
hexists: (key: string, field: string) => Promise<number>;
|
|
3394
|
+
/**
|
|
3395
|
+
* @see https://redis.io/commands/hexpire
|
|
3396
|
+
*/
|
|
3397
|
+
hexpire: (key: string, fields: string | number | (string | number)[], seconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3398
|
+
/**
|
|
3399
|
+
* @see https://redis.io/commands/hexpireat
|
|
3400
|
+
*/
|
|
3401
|
+
hexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3402
|
+
/**
|
|
3403
|
+
* @see https://redis.io/commands/hexpiretime
|
|
3404
|
+
*/
|
|
3405
|
+
hexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3406
|
+
/**
|
|
3407
|
+
* @see https://redis.io/commands/httl
|
|
3408
|
+
*/
|
|
3409
|
+
httl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3410
|
+
/**
|
|
3411
|
+
* @see https://redis.io/commands/hpexpire
|
|
3412
|
+
*/
|
|
3413
|
+
hpexpire: (key: string, fields: string | number | (string | number)[], milliseconds: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3414
|
+
/**
|
|
3415
|
+
* @see https://redis.io/commands/hpexpireat
|
|
3416
|
+
*/
|
|
3417
|
+
hpexpireat: (key: string, fields: string | number | (string | number)[], timestamp: number, option?: ExpireOption | undefined) => Promise<(0 | 1 | 2 | -2)[]>;
|
|
3418
|
+
/**
|
|
3419
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
3420
|
+
*/
|
|
3421
|
+
hpexpiretime: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3422
|
+
/**
|
|
3423
|
+
* @see https://redis.io/commands/hpttl
|
|
3424
|
+
*/
|
|
3425
|
+
hpttl: (key: string, fields: string | number | (string | number)[]) => Promise<number[]>;
|
|
3426
|
+
/**
|
|
3427
|
+
* @see https://redis.io/commands/hpersist
|
|
3428
|
+
*/
|
|
3429
|
+
hpersist: (key: string, fields: string | number | (string | number)[]) => Promise<(1 | -2 | -1)[]>;
|
|
2912
3430
|
/**
|
|
2913
3431
|
* @see https://redis.io/commands/hget
|
|
2914
3432
|
*/
|
|
@@ -3060,11 +3578,11 @@ declare class Redis {
|
|
|
3060
3578
|
/**
|
|
3061
3579
|
* @see https://redis.io/commands/pexpire
|
|
3062
3580
|
*/
|
|
3063
|
-
pexpire: (key: string, milliseconds: number) => Promise<0 | 1>;
|
|
3581
|
+
pexpire: (key: string, milliseconds: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3064
3582
|
/**
|
|
3065
3583
|
* @see https://redis.io/commands/pexpireat
|
|
3066
3584
|
*/
|
|
3067
|
-
pexpireat: (key: string, unix: number) => Promise<0 | 1>;
|
|
3585
|
+
pexpireat: (key: string, unix: number, option?: ExpireOption | undefined) => Promise<0 | 1>;
|
|
3068
3586
|
/**
|
|
3069
3587
|
* @see https://redis.io/commands/pfadd
|
|
3070
3588
|
*/
|
|
@@ -3085,6 +3603,10 @@ declare class Redis {
|
|
|
3085
3603
|
* @see https://redis.io/commands/psetex
|
|
3086
3604
|
*/
|
|
3087
3605
|
psetex: <TData>(key: string, ttl: number, value: TData) => Promise<string>;
|
|
3606
|
+
/**
|
|
3607
|
+
* @see https://redis.io/commands/psubscribe
|
|
3608
|
+
*/
|
|
3609
|
+
psubscribe: <TMessage>(patterns: string | string[]) => Subscriber<TMessage>;
|
|
3088
3610
|
/**
|
|
3089
3611
|
* @see https://redis.io/commands/pttl
|
|
3090
3612
|
*/
|
|
@@ -3124,7 +3646,10 @@ declare class Redis {
|
|
|
3124
3646
|
/**
|
|
3125
3647
|
* @see https://redis.io/commands/scan
|
|
3126
3648
|
*/
|
|
3127
|
-
scan
|
|
3649
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
3650
|
+
scan<TOptions extends ScanCommandOptions>(cursor: string | number, opts: TOptions): Promise<TOptions extends {
|
|
3651
|
+
withType: true;
|
|
3652
|
+
} ? ScanResultWithType : ScanResultStandard>;
|
|
3128
3653
|
/**
|
|
3129
3654
|
* @see https://redis.io/commands/scard
|
|
3130
3655
|
*/
|
|
@@ -3213,6 +3738,10 @@ declare class Redis {
|
|
|
3213
3738
|
* @see https://redis.io/commands/strlen
|
|
3214
3739
|
*/
|
|
3215
3740
|
strlen: (key: string) => Promise<number>;
|
|
3741
|
+
/**
|
|
3742
|
+
* @see https://redis.io/commands/subscribe
|
|
3743
|
+
*/
|
|
3744
|
+
subscribe: <TMessage>(channels: string | string[]) => Subscriber<TMessage>;
|
|
3216
3745
|
/**
|
|
3217
3746
|
* @see https://redis.io/commands/sunion
|
|
3218
3747
|
*/
|
|
@@ -3483,4 +4012,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3483
4012
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3484
4013
|
}
|
|
3485
4014
|
|
|
3486
|
-
export {
|
|
4015
|
+
export { HGetCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetCommand as H, GetBitCommand as I, GetDelCommand as J, GetExCommand as K, GetRangeCommand as L, GetSetCommand as M, HDelCommand as N, HExistsCommand as O, Pipeline as P, HExpireCommand as Q, type RedisOptions as R, HExpireAtCommand as S, HExpireTimeCommand as T, type UpstashRequest as U, HTtlCommand as V, HPExpireCommand as W, HPExpireAtCommand as X, HPExpireTimeCommand as Y, HPTtlCommand as Z, HPersistCommand as _, type RequesterConfig as a, RPopCommand as a$, HGetAllCommand as a0, HIncrByCommand as a1, HIncrByFloatCommand as a2, HKeysCommand as a3, HLenCommand as a4, HMGetCommand as a5, HMSetCommand as a6, HRandFieldCommand as a7, HScanCommand as a8, HSetCommand as a9, JsonToggleCommand as aA, JsonTypeCommand as aB, KeysCommand as aC, LIndexCommand as aD, LInsertCommand as aE, LLenCommand as aF, LMoveCommand as aG, LPopCommand as aH, LPushCommand as aI, LPushXCommand as aJ, LRangeCommand as aK, LRemCommand as aL, LSetCommand as aM, LTrimCommand as aN, MGetCommand as aO, MSetCommand as aP, MSetNXCommand as aQ, PersistCommand as aR, PExpireCommand as aS, PExpireAtCommand as aT, PingCommand as aU, PSetEXCommand as aV, PTtlCommand as aW, PublishCommand as aX, RandomKeyCommand as aY, RenameCommand as aZ, RenameNXCommand as a_, HSetNXCommand as aa, HStrLenCommand as ab, HValsCommand as ac, IncrCommand as ad, IncrByCommand as ae, IncrByFloatCommand as af, JsonArrAppendCommand as ag, JsonArrIndexCommand as ah, JsonArrInsertCommand as ai, JsonArrLenCommand as aj, JsonArrPopCommand as ak, JsonArrTrimCommand as al, JsonClearCommand as am, JsonDelCommand as an, JsonForgetCommand as ao, JsonGetCommand as ap, JsonMergeCommand as aq, JsonMGetCommand as ar, JsonNumIncrByCommand as as, JsonNumMultByCommand as at, JsonObjKeysCommand as au, JsonObjLenCommand as av, JsonRespCommand as aw, JsonSetCommand as ax, JsonStrAppendCommand as ay, JsonStrLenCommand as az, Redis as b, ZUnionStoreCommand as b$, RPushCommand as b0, RPushXCommand as b1, SAddCommand as b2, ScanCommand as b3, type ScanCommandOptions as b4, SCardCommand as b5, ScriptExistsCommand as b6, ScriptFlushCommand as b7, ScriptLoadCommand as b8, SDiffCommand as b9, XAddCommand as bA, XRangeCommand as bB, type ScoreMember as bC, type ZAddCommandOptions as bD, ZAddCommand as bE, ZCardCommand as bF, ZCountCommand as bG, ZDiffStoreCommand as bH, ZIncrByCommand as bI, ZInterStoreCommand as bJ, type ZInterStoreCommandOptions as bK, ZLexCountCommand as bL, ZMScoreCommand as bM, ZPopMaxCommand as bN, ZPopMinCommand as bO, ZRangeCommand as bP, type ZRangeCommandOptions as bQ, ZRankCommand as bR, ZRemCommand as bS, ZRemRangeByLexCommand as bT, ZRemRangeByRankCommand as bU, ZRemRangeByScoreCommand as bV, ZRevRankCommand as bW, ZScanCommand as bX, ZScoreCommand as bY, ZUnionCommand as bZ, type ZUnionCommandOptions as b_, SDiffStoreCommand as ba, SetCommand as bb, type SetCommandOptions as bc, SetBitCommand as bd, SetExCommand as be, SetNxCommand as bf, SetRangeCommand as bg, SInterCommand as bh, SInterStoreCommand as bi, SIsMemberCommand as bj, SMembersCommand as bk, SMIsMemberCommand as bl, SMoveCommand as bm, SPopCommand as bn, SRandMemberCommand as bo, SRemCommand as bp, SScanCommand as bq, StrLenCommand as br, SUnionCommand as bs, SUnionStoreCommand as bt, TimeCommand as bu, TouchCommand as bv, TtlCommand as bw, type Type as bx, TypeCommand as by, UnlinkCommand as bz, type UpstashResponse as c, type ZUnionStoreCommandOptions as c0, 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 };
|