@upstash/redis 0.0.0-ci.affbf5278b52d3b6175f5dc17ccc071f9c67ecb9-20231214001340 → 0.0.0-ci.b0035d14ef89d56d2b550d89f21e16029101a04a-20241009150620
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/chunk-FVBRZKF4.mjs +3807 -0
- package/cloudflare.d.mts +15 -5
- package/cloudflare.d.ts +15 -5
- package/cloudflare.js +3919 -1
- package/cloudflare.mjs +93 -1
- package/fastly.d.mts +10 -5
- package/fastly.d.ts +10 -5
- package/fastly.js +3892 -1
- package/fastly.mjs +66 -1
- package/nodejs.d.mts +17 -24
- package/nodejs.d.ts +17 -24
- package/nodejs.js +3939 -1
- package/nodejs.mjs +113 -1
- package/package.json +1 -1
- package/{zmscore-415f6c9f.d.ts → zmscore-Dc6Llqgr.d.mts} +681 -331
- package/zmscore-Dc6Llqgr.d.ts +3509 -0
- package/chunk-U26HH7AN.mjs +0 -1
- package/chunk-UIEOT6TU.js +0 -1
|
@@ -23,7 +23,10 @@ type RedisOptions = {
|
|
|
23
23
|
* @default true
|
|
24
24
|
*/
|
|
25
25
|
automaticDeserialization?: boolean;
|
|
26
|
+
latencyLogging?: boolean;
|
|
26
27
|
enableTelemetry?: boolean;
|
|
28
|
+
enableAutoPipelining?: boolean;
|
|
29
|
+
readYourWrites?: boolean;
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
type CacheSetting = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload";
|
|
@@ -33,12 +36,21 @@ type UpstashRequest = {
|
|
|
33
36
|
* Request body will be serialized to json
|
|
34
37
|
*/
|
|
35
38
|
body?: unknown;
|
|
39
|
+
upstashSyncToken?: string;
|
|
36
40
|
};
|
|
37
41
|
type UpstashResponse<TResult> = {
|
|
38
42
|
result?: TResult;
|
|
39
43
|
error?: string;
|
|
40
44
|
};
|
|
41
45
|
interface Requester {
|
|
46
|
+
/**
|
|
47
|
+
* 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.
|
|
48
|
+
*/
|
|
49
|
+
readYourWrites?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* This token is used to ensure that the client is in sync with the server. On each request, we send this token in the header, and the server will return a new token.
|
|
52
|
+
*/
|
|
53
|
+
upstashSyncToken?: string;
|
|
42
54
|
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
43
55
|
}
|
|
44
56
|
type RetryConfig = false | {
|
|
@@ -106,6 +118,7 @@ type CommandOptions<TResult, TData> = {
|
|
|
106
118
|
* @default true
|
|
107
119
|
*/
|
|
108
120
|
automaticDeserialization?: boolean;
|
|
121
|
+
latencyLogging?: boolean;
|
|
109
122
|
};
|
|
110
123
|
/**
|
|
111
124
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
@@ -220,8 +233,8 @@ type ScanCommandOptions = {
|
|
|
220
233
|
/**
|
|
221
234
|
* @see https://redis.io/commands/scan
|
|
222
235
|
*/
|
|
223
|
-
declare class ScanCommand extends Command<[
|
|
224
|
-
constructor([cursor, opts]: [cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
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[]]>);
|
|
225
238
|
}
|
|
226
239
|
|
|
227
240
|
type GeoAddCommandOptions = {
|
|
@@ -233,11 +246,11 @@ type GeoAddCommandOptions = {
|
|
|
233
246
|
} & {
|
|
234
247
|
ch?: boolean;
|
|
235
248
|
});
|
|
236
|
-
|
|
249
|
+
type GeoMember<TMemberType> = {
|
|
237
250
|
latitude: number;
|
|
238
251
|
longitude: number;
|
|
239
252
|
member: TMemberType;
|
|
240
|
-
}
|
|
253
|
+
};
|
|
241
254
|
/**
|
|
242
255
|
* @see https://redis.io/commands/geoadd
|
|
243
256
|
*/
|
|
@@ -264,6 +277,28 @@ declare class BitCountCommand extends Command<number, number> {
|
|
|
264
277
|
constructor(cmd: [key: string, start: number, end: number], opts?: CommandOptions<number, number>);
|
|
265
278
|
}
|
|
266
279
|
|
|
280
|
+
type SubCommandArgs<TRest extends unknown[] = []> = [
|
|
281
|
+
encoding: string,
|
|
282
|
+
offset: number | string,
|
|
283
|
+
...rest: TRest
|
|
284
|
+
];
|
|
285
|
+
/**
|
|
286
|
+
* @see https://redis.io/commands/bitfield
|
|
287
|
+
*/
|
|
288
|
+
declare class BitFieldCommand<T = Promise<number[]>> {
|
|
289
|
+
private client;
|
|
290
|
+
private opts?;
|
|
291
|
+
private execOperation;
|
|
292
|
+
private command;
|
|
293
|
+
constructor(args: [key: string], client: Requester, opts?: CommandOptions<number[], number[]> | undefined, execOperation?: (command: Command<number[], number[]>) => T);
|
|
294
|
+
private chain;
|
|
295
|
+
get(...args: SubCommandArgs): this;
|
|
296
|
+
set(...args: SubCommandArgs<[value: number]>): this;
|
|
297
|
+
incrby(...args: SubCommandArgs<[increment: number]>): this;
|
|
298
|
+
overflow(overflow: "WRAP" | "SAT" | "FAIL"): this;
|
|
299
|
+
exec(): T;
|
|
300
|
+
}
|
|
301
|
+
|
|
267
302
|
/**
|
|
268
303
|
* @see https://redis.io/commands/bitop
|
|
269
304
|
*/
|
|
@@ -344,11 +379,9 @@ declare class ExistsCommand extends Command<number, number> {
|
|
|
344
379
|
constructor(cmd: [...keys: string[]], opts?: CommandOptions<number, number>);
|
|
345
380
|
}
|
|
346
381
|
|
|
347
|
-
|
|
348
|
-
* @see https://redis.io/commands/expire
|
|
349
|
-
*/
|
|
382
|
+
type ExpireOptions = "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt";
|
|
350
383
|
declare class ExpireCommand extends Command<"0" | "1", 0 | 1> {
|
|
351
|
-
constructor(cmd: [key: string, seconds: number], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
384
|
+
constructor(cmd: [key: string, seconds: number, option?: ExpireOptions], opts?: CommandOptions<"0" | "1", 0 | 1>);
|
|
352
385
|
}
|
|
353
386
|
|
|
354
387
|
/**
|
|
@@ -388,6 +421,13 @@ declare class GeoDistCommand<TMemberType = string> extends Command<number | null
|
|
|
388
421
|
], opts?: CommandOptions<number | null, number | null>);
|
|
389
422
|
}
|
|
390
423
|
|
|
424
|
+
/**
|
|
425
|
+
* @see https://redis.io/commands/geohash
|
|
426
|
+
*/
|
|
427
|
+
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
428
|
+
constructor(cmd: [string, ...TMember[]], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
429
|
+
}
|
|
430
|
+
|
|
391
431
|
type Coordinates = {
|
|
392
432
|
lng: number;
|
|
393
433
|
lat: number;
|
|
@@ -399,13 +439,6 @@ declare class GeoPosCommand<TMember = string> extends Command<(string | null)[][
|
|
|
399
439
|
constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[][], Coordinates[]>);
|
|
400
440
|
}
|
|
401
441
|
|
|
402
|
-
/**
|
|
403
|
-
* @see https://redis.io/commands/geohash
|
|
404
|
-
*/
|
|
405
|
-
declare class GeoHashCommand<TMember = string> extends Command<(string | null)[], (string | null)[]> {
|
|
406
|
-
constructor(cmd: [string, ...(TMember[] | TMember[])], opts?: CommandOptions<(string | null)[], (string | null)[]>);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
442
|
type RadiusOptions$1 = "M" | "KM" | "FT" | "MI";
|
|
410
443
|
type CenterPoint$1<TMemberType> = {
|
|
411
444
|
type: "FROMMEMBER" | "frommember";
|
|
@@ -619,9 +652,7 @@ declare class HMGetCommand<TData extends Record<string, unknown>> extends Comman
|
|
|
619
652
|
* @see https://redis.io/commands/hmset
|
|
620
653
|
*/
|
|
621
654
|
declare class HMSetCommand<TData> extends Command<"OK", "OK"> {
|
|
622
|
-
constructor([key, kv]: [key: string, kv:
|
|
623
|
-
[field: string]: TData;
|
|
624
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
655
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
625
656
|
}
|
|
626
657
|
|
|
627
658
|
/**
|
|
@@ -637,22 +668,20 @@ declare class HRandFieldCommand<TData extends string | string[] | Record<string,
|
|
|
637
668
|
* @see https://redis.io/commands/hscan
|
|
638
669
|
*/
|
|
639
670
|
declare class HScanCommand extends Command<[
|
|
640
|
-
|
|
671
|
+
string,
|
|
641
672
|
(string | number)[]
|
|
642
673
|
], [
|
|
643
|
-
|
|
674
|
+
string,
|
|
644
675
|
(string | number)[]
|
|
645
676
|
]> {
|
|
646
|
-
constructor([key, cursor, cmdOpts]: [key: string, cursor: number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[
|
|
677
|
+
constructor([key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
647
678
|
}
|
|
648
679
|
|
|
649
680
|
/**
|
|
650
681
|
* @see https://redis.io/commands/hset
|
|
651
682
|
*/
|
|
652
683
|
declare class HSetCommand<TData> extends Command<number, number> {
|
|
653
|
-
constructor([key, kv]: [key: string, kv:
|
|
654
|
-
[field: string]: TData;
|
|
655
|
-
}], opts?: CommandOptions<number, number>);
|
|
684
|
+
constructor([key, kv]: [key: string, kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
656
685
|
}
|
|
657
686
|
|
|
658
687
|
/**
|
|
@@ -778,10 +807,21 @@ declare class JsonGetCommand<TData extends (unknown | Record<string, unknown>) |
|
|
|
778
807
|
/**
|
|
779
808
|
* @see https://redis.io/commands/json.mget
|
|
780
809
|
*/
|
|
781
|
-
declare class JsonMGetCommand<TData
|
|
810
|
+
declare class JsonMGetCommand<TData = unknown[]> extends Command<TData, TData> {
|
|
782
811
|
constructor(cmd: [keys: string[], path: string], opts?: CommandOptions<TData, TData>);
|
|
783
812
|
}
|
|
784
813
|
|
|
814
|
+
/**
|
|
815
|
+
* @see https://redis.io/commands/json.mset
|
|
816
|
+
*/
|
|
817
|
+
declare class JsonMSetCommand<TData extends number | string | boolean | Record<string, unknown> | (number | string | boolean | Record<string, unknown>)[]> extends Command<"OK" | null, "OK" | null> {
|
|
818
|
+
constructor(cmd: {
|
|
819
|
+
key: string;
|
|
820
|
+
path: string;
|
|
821
|
+
value: TData;
|
|
822
|
+
}[], opts?: CommandOptions<"OK" | null, "OK" | null>);
|
|
823
|
+
}
|
|
824
|
+
|
|
785
825
|
/**
|
|
786
826
|
* @see https://redis.io/commands/json.numincrby
|
|
787
827
|
*/
|
|
@@ -938,25 +978,21 @@ declare class LTrimCommand extends Command<"OK", "OK"> {
|
|
|
938
978
|
* @see https://redis.io/commands/mget
|
|
939
979
|
*/
|
|
940
980
|
declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
|
|
941
|
-
constructor(cmd: [string[]] | [...
|
|
981
|
+
constructor(cmd: [string[]] | [...string[]], opts?: CommandOptions<(string | null)[], TData>);
|
|
942
982
|
}
|
|
943
983
|
|
|
944
984
|
/**
|
|
945
985
|
* @see https://redis.io/commands/mset
|
|
946
986
|
*/
|
|
947
987
|
declare class MSetCommand<TData> extends Command<"OK", "OK"> {
|
|
948
|
-
constructor([kv]: [kv:
|
|
949
|
-
[key: string]: TData;
|
|
950
|
-
}], opts?: CommandOptions<"OK", "OK">);
|
|
988
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<"OK", "OK">);
|
|
951
989
|
}
|
|
952
990
|
|
|
953
991
|
/**
|
|
954
992
|
* @see https://redis.io/commands/msetnx
|
|
955
993
|
*/
|
|
956
994
|
declare class MSetNXCommand<TData = string> extends Command<number, number> {
|
|
957
|
-
constructor([kv]: [kv:
|
|
958
|
-
[key: string]: TData;
|
|
959
|
-
}], opts?: CommandOptions<number, number>);
|
|
995
|
+
constructor([kv]: [kv: Record<string, TData>], opts?: CommandOptions<number, number>);
|
|
960
996
|
}
|
|
961
997
|
|
|
962
998
|
/**
|
|
@@ -1054,7 +1090,7 @@ declare class RPushXCommand<TData = string> extends Command<number, number> {
|
|
|
1054
1090
|
* @see https://redis.io/commands/sadd
|
|
1055
1091
|
*/
|
|
1056
1092
|
declare class SAddCommand<TData = string> extends Command<number, number> {
|
|
1057
|
-
constructor(cmd: [key: string, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1093
|
+
constructor(cmd: [key: string, member: TData, ...members: TData[]], opts?: CommandOptions<number, number>);
|
|
1058
1094
|
}
|
|
1059
1095
|
|
|
1060
1096
|
/**
|
|
@@ -1242,13 +1278,13 @@ declare class SRemCommand<TData = string> extends Command<number, number> {
|
|
|
1242
1278
|
* @see https://redis.io/commands/sscan
|
|
1243
1279
|
*/
|
|
1244
1280
|
declare class SScanCommand extends Command<[
|
|
1245
|
-
|
|
1281
|
+
string,
|
|
1246
1282
|
(string | number)[]
|
|
1247
1283
|
], [
|
|
1248
|
-
|
|
1284
|
+
string,
|
|
1249
1285
|
(string | number)[]
|
|
1250
1286
|
]> {
|
|
1251
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1287
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1252
1288
|
}
|
|
1253
1289
|
|
|
1254
1290
|
/**
|
|
@@ -1323,9 +1359,7 @@ declare class XAddCommand extends Command<string, string> {
|
|
|
1323
1359
|
constructor([key, id, entries, opts]: [
|
|
1324
1360
|
key: string,
|
|
1325
1361
|
id: "*" | string,
|
|
1326
|
-
entries:
|
|
1327
|
-
[field: string]: unknown;
|
|
1328
|
-
},
|
|
1362
|
+
entries: Record<string, unknown>,
|
|
1329
1363
|
opts?: XAddCommandOptions
|
|
1330
1364
|
], commandOptions?: CommandOptions<string, string>);
|
|
1331
1365
|
}
|
|
@@ -1334,6 +1368,54 @@ declare class XRangeCommand<TData extends Record<string, Record<string, unknown>
|
|
|
1334
1368
|
constructor([key, start, end, count]: [key: string, start: string, end: string, count?: number], opts?: CommandOptions<unknown[], TData[]>);
|
|
1335
1369
|
}
|
|
1336
1370
|
|
|
1371
|
+
type XReadCommandOptions = [
|
|
1372
|
+
key: string | string[],
|
|
1373
|
+
id: string | string[],
|
|
1374
|
+
options?: {
|
|
1375
|
+
count?: number;
|
|
1376
|
+
blockMS?: number;
|
|
1377
|
+
}
|
|
1378
|
+
];
|
|
1379
|
+
type XReadOptions = XReadCommandOptions extends [infer K, infer I, ...any[]] ? K extends string ? I extends string ? [key: string, id: string, options?: {
|
|
1380
|
+
count?: number;
|
|
1381
|
+
blockMS?: number;
|
|
1382
|
+
}] : never : K extends string[] ? I extends string[] ? [key: string[], id: string[], options?: {
|
|
1383
|
+
count?: number;
|
|
1384
|
+
blockMS?: number;
|
|
1385
|
+
}] : never : never : never;
|
|
1386
|
+
/**
|
|
1387
|
+
* @see https://redis.io/commands/xread
|
|
1388
|
+
*/
|
|
1389
|
+
declare class XReadCommand extends Command<number, unknown[]> {
|
|
1390
|
+
constructor([key, id, options]: XReadOptions, opts?: CommandOptions<number, unknown[]>);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
type Options = {
|
|
1394
|
+
count?: number;
|
|
1395
|
+
blockMS?: number;
|
|
1396
|
+
NOACK?: boolean;
|
|
1397
|
+
};
|
|
1398
|
+
type XReadGroupCommandOptions = [
|
|
1399
|
+
group: string,
|
|
1400
|
+
consumer: string,
|
|
1401
|
+
key: string | string[],
|
|
1402
|
+
id: string | string[],
|
|
1403
|
+
options?: Options
|
|
1404
|
+
];
|
|
1405
|
+
type XReadGroupOptions = XReadGroupCommandOptions extends [
|
|
1406
|
+
string,
|
|
1407
|
+
string,
|
|
1408
|
+
infer TKey,
|
|
1409
|
+
infer TId,
|
|
1410
|
+
...any[]
|
|
1411
|
+
] ? TKey extends string ? TId extends string ? [group: string, consumer: string, key: string, id: string, options?: Options] : never : TKey extends string[] ? TId extends string[] ? [group: string, consumer: string, key: string[], id: string[], options?: Options] : never : never : never;
|
|
1412
|
+
/**
|
|
1413
|
+
* @see https://redis.io/commands/xreadgroup
|
|
1414
|
+
*/
|
|
1415
|
+
declare class XReadGroupCommand extends Command<number, unknown[]> {
|
|
1416
|
+
constructor([group, consumer, key, id, options]: XReadGroupOptions, opts?: CommandOptions<number, unknown[]>);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1337
1419
|
type NXAndXXOptions = {
|
|
1338
1420
|
nx: true;
|
|
1339
1421
|
xx?: never;
|
|
@@ -1501,13 +1583,13 @@ declare class ZRevRankCommand<TData> extends Command<number | null, number | nul
|
|
|
1501
1583
|
* @see https://redis.io/commands/zscan
|
|
1502
1584
|
*/
|
|
1503
1585
|
declare class ZScanCommand extends Command<[
|
|
1504
|
-
|
|
1586
|
+
string,
|
|
1505
1587
|
(string | number)[]
|
|
1506
1588
|
], [
|
|
1507
|
-
|
|
1589
|
+
string,
|
|
1508
1590
|
(string | number)[]
|
|
1509
1591
|
]> {
|
|
1510
|
-
constructor([key, cursor, opts]: [key: string, cursor: number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[
|
|
1592
|
+
constructor([key, cursor, opts]: [key: string, cursor: string | number, opts?: ScanCommandOptions], cmdOpts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]>);
|
|
1511
1593
|
}
|
|
1512
1594
|
|
|
1513
1595
|
/**
|
|
@@ -1520,6 +1602,39 @@ declare class ZScoreCommand<TData> extends Command<string | null, number | null>
|
|
|
1520
1602
|
type InferResponseData<T extends unknown[]> = {
|
|
1521
1603
|
[K in keyof T]: T[K] extends Command<any, infer TData> ? TData : unknown;
|
|
1522
1604
|
};
|
|
1605
|
+
interface ExecMethod<TCommands extends Command<any, any>[]> {
|
|
1606
|
+
/**
|
|
1607
|
+
* Send the pipeline request to upstash.
|
|
1608
|
+
*
|
|
1609
|
+
* Returns an array with the results of all pipelined commands.
|
|
1610
|
+
*
|
|
1611
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1612
|
+
* ```ts
|
|
1613
|
+
* const p = redis.pipeline()
|
|
1614
|
+
* p.get("key")
|
|
1615
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
1616
|
+
* ```
|
|
1617
|
+
*
|
|
1618
|
+
* 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.
|
|
1619
|
+
*
|
|
1620
|
+
* 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 }`.
|
|
1621
|
+
*
|
|
1622
|
+
* ```ts
|
|
1623
|
+
* const p = redis.pipeline()
|
|
1624
|
+
* p.get("key")
|
|
1625
|
+
*
|
|
1626
|
+
* const result = await p.exec({ keepErrors: true });
|
|
1627
|
+
* const getResult = result[0].result
|
|
1628
|
+
* const getError = result[0].error
|
|
1629
|
+
* ```
|
|
1630
|
+
*/
|
|
1631
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(): Promise<TCommandResults>;
|
|
1632
|
+
<TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>(options: {
|
|
1633
|
+
keepErrors: true;
|
|
1634
|
+
}): Promise<{
|
|
1635
|
+
[K in keyof TCommandResults]: UpstashResponse<TCommandResults[K]>;
|
|
1636
|
+
}>;
|
|
1637
|
+
}
|
|
1523
1638
|
/**
|
|
1524
1639
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
1525
1640
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -1568,19 +1683,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1568
1683
|
commandOptions?: CommandOptions<any, any>;
|
|
1569
1684
|
multiExec?: boolean;
|
|
1570
1685
|
});
|
|
1571
|
-
|
|
1572
|
-
* Send the pipeline request to upstash.
|
|
1573
|
-
*
|
|
1574
|
-
* Returns an array with the results of all pipelined commands.
|
|
1575
|
-
*
|
|
1576
|
-
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
1577
|
-
* ```ts
|
|
1578
|
-
* const p = redis.pipeline()
|
|
1579
|
-
* p.get("key")
|
|
1580
|
-
* const result = p.exec<[{ greeting: string }]>()
|
|
1581
|
-
* ```
|
|
1582
|
-
*/
|
|
1583
|
-
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
1686
|
+
exec: ExecMethod<TCommands>;
|
|
1584
1687
|
/**
|
|
1585
1688
|
* Returns the length of pipeline before the execution
|
|
1586
1689
|
*/
|
|
@@ -1598,15 +1701,29 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1598
1701
|
* @see https://redis.io/commands/bitcount
|
|
1599
1702
|
*/
|
|
1600
1703
|
bitcount: (key: string, start: number, end: number) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1704
|
+
/**
|
|
1705
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
1706
|
+
*
|
|
1707
|
+
* @example
|
|
1708
|
+
* ```typescript
|
|
1709
|
+
* redis.set("mykey", 0);
|
|
1710
|
+
* const result = await redis.pipeline()
|
|
1711
|
+
* .bitfield("mykey")
|
|
1712
|
+
* .set("u4", 0, 16)
|
|
1713
|
+
* .incr("u4", "#1", 1)
|
|
1714
|
+
* .exec();
|
|
1715
|
+
* console.log(result); // [[0, 1]]
|
|
1716
|
+
* ```
|
|
1717
|
+
*
|
|
1718
|
+
* @see https://redis.io/commands/bitfield
|
|
1719
|
+
*/
|
|
1720
|
+
bitfield: (key: string) => BitFieldCommand<Pipeline<[...TCommands, Command<any, number[]>]>>;
|
|
1601
1721
|
/**
|
|
1602
1722
|
* @see https://redis.io/commands/bitop
|
|
1603
1723
|
*/
|
|
1604
1724
|
bitop: {
|
|
1605
1725
|
(op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]): Pipeline<[...TCommands, BitOpCommand]>;
|
|
1606
|
-
(op: "not", destinationKey: string, sourceKey: string): Pipeline<[
|
|
1607
|
-
...TCommands,
|
|
1608
|
-
BitOpCommand
|
|
1609
|
-
]>;
|
|
1726
|
+
(op: "not", destinationKey: string, sourceKey: string): Pipeline<[...TCommands, BitOpCommand]>;
|
|
1610
1727
|
};
|
|
1611
1728
|
/**
|
|
1612
1729
|
* @see https://redis.io/commands/bitpos
|
|
@@ -1657,7 +1774,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1657
1774
|
/**
|
|
1658
1775
|
* @see https://redis.io/commands/expire
|
|
1659
1776
|
*/
|
|
1660
|
-
expire: (key: string, seconds: number) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1777
|
+
expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Pipeline<[...TCommands, Command<any, 0 | 1>]>;
|
|
1661
1778
|
/**
|
|
1662
1779
|
* @see https://redis.io/commands/expireat
|
|
1663
1780
|
*/
|
|
@@ -1670,8 +1787,98 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1670
1787
|
* @see https://redis.io/commands/flushdb
|
|
1671
1788
|
*/
|
|
1672
1789
|
flushdb: (opts?: {
|
|
1673
|
-
async?: boolean
|
|
1790
|
+
async?: boolean;
|
|
1674
1791
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1792
|
+
/**
|
|
1793
|
+
* @see https://redis.io/commands/geoadd
|
|
1794
|
+
*/
|
|
1795
|
+
geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
1796
|
+
/**
|
|
1797
|
+
* @see https://redis.io/commands/geodist
|
|
1798
|
+
*/
|
|
1799
|
+
geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
1800
|
+
/**
|
|
1801
|
+
* @see https://redis.io/commands/geopos
|
|
1802
|
+
*/
|
|
1803
|
+
geopos: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, {
|
|
1804
|
+
lng: number;
|
|
1805
|
+
lat: number;
|
|
1806
|
+
}[]>]>;
|
|
1807
|
+
/**
|
|
1808
|
+
* @see https://redis.io/commands/geohash
|
|
1809
|
+
*/
|
|
1810
|
+
geohash: <TData>(args_0: string, ...args_1: TData[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
|
|
1811
|
+
/**
|
|
1812
|
+
* @see https://redis.io/commands/geosearch
|
|
1813
|
+
*/
|
|
1814
|
+
geosearch: <TData>(key: string, centerPoint: {
|
|
1815
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
1816
|
+
coordinate: {
|
|
1817
|
+
lon: number;
|
|
1818
|
+
lat: number;
|
|
1819
|
+
};
|
|
1820
|
+
} | {
|
|
1821
|
+
type: "FROMMEMBER" | "frommember";
|
|
1822
|
+
member: TData;
|
|
1823
|
+
}, shape: {
|
|
1824
|
+
type: "BYRADIUS" | "byradius";
|
|
1825
|
+
radius: number;
|
|
1826
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
1827
|
+
} | {
|
|
1828
|
+
type: "BYBOX" | "bybox";
|
|
1829
|
+
rect: {
|
|
1830
|
+
width: number;
|
|
1831
|
+
height: number;
|
|
1832
|
+
};
|
|
1833
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
1834
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1835
|
+
count?: {
|
|
1836
|
+
limit: number;
|
|
1837
|
+
any?: boolean;
|
|
1838
|
+
};
|
|
1839
|
+
withCoord?: boolean;
|
|
1840
|
+
withDist?: boolean;
|
|
1841
|
+
withHash?: boolean;
|
|
1842
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
1843
|
+
member: TData;
|
|
1844
|
+
} & {
|
|
1845
|
+
coord?: {
|
|
1846
|
+
long: number;
|
|
1847
|
+
lat: number;
|
|
1848
|
+
} | undefined;
|
|
1849
|
+
dist?: number | undefined;
|
|
1850
|
+
hash?: string | undefined;
|
|
1851
|
+
})[]>]>;
|
|
1852
|
+
/**
|
|
1853
|
+
* @see https://redis.io/commands/geosearchstore
|
|
1854
|
+
*/
|
|
1855
|
+
geosearchstore: <TData>(destination: string, key: string, centerPoint: {
|
|
1856
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
1857
|
+
coordinate: {
|
|
1858
|
+
lon: number;
|
|
1859
|
+
lat: number;
|
|
1860
|
+
};
|
|
1861
|
+
} | {
|
|
1862
|
+
type: "FROMMEMBER" | "frommember";
|
|
1863
|
+
member: TData;
|
|
1864
|
+
}, shape: {
|
|
1865
|
+
type: "BYRADIUS" | "byradius";
|
|
1866
|
+
radius: number;
|
|
1867
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
1868
|
+
} | {
|
|
1869
|
+
type: "BYBOX" | "bybox";
|
|
1870
|
+
rect: {
|
|
1871
|
+
width: number;
|
|
1872
|
+
height: number;
|
|
1873
|
+
};
|
|
1874
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
1875
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
1876
|
+
count?: {
|
|
1877
|
+
limit: number;
|
|
1878
|
+
any?: boolean;
|
|
1879
|
+
};
|
|
1880
|
+
storeDist?: boolean;
|
|
1881
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1675
1882
|
/**
|
|
1676
1883
|
* @see https://redis.io/commands/get
|
|
1677
1884
|
*/
|
|
@@ -1731,9 +1938,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1731
1938
|
/**
|
|
1732
1939
|
* @see https://redis.io/commands/hmset
|
|
1733
1940
|
*/
|
|
1734
|
-
hmset: <TData>(key: string, kv:
|
|
1735
|
-
[field: string]: TData;
|
|
1736
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1941
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1737
1942
|
/**
|
|
1738
1943
|
* @see https://redis.io/commands/hrandfield
|
|
1739
1944
|
*/
|
|
@@ -1741,13 +1946,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1741
1946
|
/**
|
|
1742
1947
|
* @see https://redis.io/commands/hscan
|
|
1743
1948
|
*/
|
|
1744
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
1949
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
1745
1950
|
/**
|
|
1746
1951
|
* @see https://redis.io/commands/hset
|
|
1747
1952
|
*/
|
|
1748
|
-
hset: <TData>(key: string, kv:
|
|
1749
|
-
[field: string]: TData;
|
|
1750
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1953
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1751
1954
|
/**
|
|
1752
1955
|
* @see https://redis.io/commands/hsetnx
|
|
1753
1956
|
*/
|
|
@@ -1796,13 +1999,17 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1796
1999
|
* @see https://redis.io/commands/lpop
|
|
1797
2000
|
*/
|
|
1798
2001
|
lpop: <TData>(key: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, TData | null>]>;
|
|
2002
|
+
/**
|
|
2003
|
+
* @see https://redis.io/commands/lmpop
|
|
2004
|
+
*/
|
|
2005
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Pipeline<[...TCommands, Command<any, [string, TData[]] | null>]>;
|
|
1799
2006
|
/**
|
|
1800
2007
|
* @see https://redis.io/commands/lpos
|
|
1801
2008
|
*/
|
|
1802
2009
|
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
1803
|
-
rank?: number
|
|
1804
|
-
count?: number
|
|
1805
|
-
maxLen?: number
|
|
2010
|
+
rank?: number;
|
|
2011
|
+
count?: number;
|
|
2012
|
+
maxLen?: number;
|
|
1806
2013
|
} | undefined) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
1807
2014
|
/**
|
|
1808
2015
|
* @see https://redis.io/commands/lpush
|
|
@@ -1835,15 +2042,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1835
2042
|
/**
|
|
1836
2043
|
* @see https://redis.io/commands/mset
|
|
1837
2044
|
*/
|
|
1838
|
-
mset: <TData>(kv:
|
|
1839
|
-
[key: string]: TData;
|
|
1840
|
-
}) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
2045
|
+
mset: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, "OK">]>;
|
|
1841
2046
|
/**
|
|
1842
2047
|
* @see https://redis.io/commands/msetnx
|
|
1843
2048
|
*/
|
|
1844
|
-
msetnx: <TData>(kv:
|
|
1845
|
-
[key: string]: TData;
|
|
1846
|
-
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2049
|
+
msetnx: <TData>(kv: Record<string, TData>) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1847
2050
|
/**
|
|
1848
2051
|
* @see https://redis.io/commands/persist
|
|
1849
2052
|
*/
|
|
@@ -1911,11 +2114,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1911
2114
|
/**
|
|
1912
2115
|
* @see https://redis.io/commands/sadd
|
|
1913
2116
|
*/
|
|
1914
|
-
sadd: <TData>(key: string, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2117
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
1915
2118
|
/**
|
|
1916
2119
|
* @see https://redis.io/commands/scan
|
|
1917
2120
|
*/
|
|
1918
|
-
scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2121
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, string[]]>]>;
|
|
1919
2122
|
/**
|
|
1920
2123
|
* @see https://redis.io/commands/scard
|
|
1921
2124
|
*/
|
|
@@ -1996,7 +2199,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
1996
2199
|
/**
|
|
1997
2200
|
* @see https://redis.io/commands/sscan
|
|
1998
2201
|
*/
|
|
1999
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2202
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2000
2203
|
/**
|
|
2001
2204
|
* @see https://redis.io/commands/strlen
|
|
2002
2205
|
*/
|
|
@@ -2032,7 +2235,127 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2032
2235
|
/**
|
|
2033
2236
|
* @see https://redis.io/commands/zadd
|
|
2034
2237
|
*/
|
|
2035
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2238
|
+
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2239
|
+
/**
|
|
2240
|
+
* @see https://redis.io/commands/xadd
|
|
2241
|
+
*/
|
|
2242
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
2243
|
+
nomkStream?: boolean;
|
|
2244
|
+
trim?: ({
|
|
2245
|
+
type: "MAXLEN" | "maxlen";
|
|
2246
|
+
threshold: number;
|
|
2247
|
+
} | {
|
|
2248
|
+
type: "MINID" | "minid";
|
|
2249
|
+
threshold: string;
|
|
2250
|
+
}) & ({
|
|
2251
|
+
comparison: "~";
|
|
2252
|
+
limit?: number;
|
|
2253
|
+
} | {
|
|
2254
|
+
comparison: "=";
|
|
2255
|
+
limit?: never;
|
|
2256
|
+
});
|
|
2257
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, string>]>;
|
|
2258
|
+
/**
|
|
2259
|
+
* @see https://redis.io/commands/xack
|
|
2260
|
+
*/
|
|
2261
|
+
xack: (key: string, group: string, id: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2262
|
+
/**
|
|
2263
|
+
* @see https://redis.io/commands/xdel
|
|
2264
|
+
*/
|
|
2265
|
+
xdel: (key: string, ids: string | string[]) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2266
|
+
/**
|
|
2267
|
+
* @see https://redis.io/commands/xgroup
|
|
2268
|
+
*/
|
|
2269
|
+
xgroup: (key: string, opts: {
|
|
2270
|
+
type: "CREATE";
|
|
2271
|
+
group: string;
|
|
2272
|
+
id: `$` | string;
|
|
2273
|
+
options?: {
|
|
2274
|
+
MKSTREAM?: boolean;
|
|
2275
|
+
ENTRIESREAD?: number;
|
|
2276
|
+
};
|
|
2277
|
+
} | {
|
|
2278
|
+
type: "CREATECONSUMER";
|
|
2279
|
+
group: string;
|
|
2280
|
+
consumer: string;
|
|
2281
|
+
} | {
|
|
2282
|
+
type: "DELCONSUMER";
|
|
2283
|
+
group: string;
|
|
2284
|
+
consumer: string;
|
|
2285
|
+
} | {
|
|
2286
|
+
type: "DESTROY";
|
|
2287
|
+
group: string;
|
|
2288
|
+
} | {
|
|
2289
|
+
type: "SETID";
|
|
2290
|
+
group: string;
|
|
2291
|
+
id: `$` | string;
|
|
2292
|
+
options?: {
|
|
2293
|
+
ENTRIESREAD?: number;
|
|
2294
|
+
};
|
|
2295
|
+
}) => Pipeline<[...TCommands, Command<any, never>]>;
|
|
2296
|
+
/**
|
|
2297
|
+
* @see https://redis.io/commands/xread
|
|
2298
|
+
*/
|
|
2299
|
+
xread: (...args: CommandArgs<typeof XReadCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2300
|
+
/**
|
|
2301
|
+
* @see https://redis.io/commands/xreadgroup
|
|
2302
|
+
*/
|
|
2303
|
+
xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2304
|
+
/**
|
|
2305
|
+
* @see https://redis.io/commands/xinfo
|
|
2306
|
+
*/
|
|
2307
|
+
xinfo: (key: string, options: {
|
|
2308
|
+
type: "CONSUMERS";
|
|
2309
|
+
group: string;
|
|
2310
|
+
} | {
|
|
2311
|
+
type: "GROUPS";
|
|
2312
|
+
}) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2313
|
+
/**
|
|
2314
|
+
* @see https://redis.io/commands/xlen
|
|
2315
|
+
*/
|
|
2316
|
+
xlen: (key: string) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2317
|
+
/**
|
|
2318
|
+
* @see https://redis.io/commands/xpending
|
|
2319
|
+
*/
|
|
2320
|
+
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
2321
|
+
idleTime?: number;
|
|
2322
|
+
consumer?: string | string[];
|
|
2323
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2324
|
+
/**
|
|
2325
|
+
* @see https://redis.io/commands/xclaim
|
|
2326
|
+
*/
|
|
2327
|
+
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
2328
|
+
idleMS?: number;
|
|
2329
|
+
timeMS?: number;
|
|
2330
|
+
retryCount?: number;
|
|
2331
|
+
force?: boolean;
|
|
2332
|
+
justId?: boolean;
|
|
2333
|
+
lastId?: number;
|
|
2334
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2335
|
+
/**
|
|
2336
|
+
* @see https://redis.io/commands/xautoclaim
|
|
2337
|
+
*/
|
|
2338
|
+
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
2339
|
+
count?: number;
|
|
2340
|
+
justId?: boolean;
|
|
2341
|
+
} | undefined) => Pipeline<[...TCommands, Command<any, unknown[]>]>;
|
|
2342
|
+
/**
|
|
2343
|
+
* @see https://redis.io/commands/xtrim
|
|
2344
|
+
*/
|
|
2345
|
+
xtrim: (key: string, options: {
|
|
2346
|
+
strategy: "MAXLEN" | "MINID";
|
|
2347
|
+
exactness?: "~" | "=";
|
|
2348
|
+
threshold: number | string;
|
|
2349
|
+
limit?: number;
|
|
2350
|
+
}) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2351
|
+
/**
|
|
2352
|
+
* @see https://redis.io/commands/xrange
|
|
2353
|
+
*/
|
|
2354
|
+
xrange: (key: string, start: string, end: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
|
|
2355
|
+
/**
|
|
2356
|
+
* @see https://redis.io/commands/xrevrange
|
|
2357
|
+
*/
|
|
2358
|
+
xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Pipeline<[...TCommands, Command<any, Record<string, Record<string, unknown>>>]>;
|
|
2036
2359
|
/**
|
|
2037
2360
|
* @see https://redis.io/commands/zcard
|
|
2038
2361
|
*/
|
|
@@ -2068,21 +2391,11 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2068
2391
|
/**
|
|
2069
2392
|
* @see https://redis.io/commands/zrange
|
|
2070
2393
|
*/
|
|
2071
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
byLex: true;
|
|
2077
|
-
} & ZRangeCommandOptions
|
|
2078
|
-
] | [
|
|
2079
|
-
key: string,
|
|
2080
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
2081
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
2082
|
-
opts: {
|
|
2083
|
-
byScore: true;
|
|
2084
|
-
} & ZRangeCommandOptions
|
|
2085
|
-
]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2394
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
2395
|
+
byLex: true;
|
|
2396
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
2397
|
+
byScore: true;
|
|
2398
|
+
} & ZRangeCommandOptions]) => Pipeline<[...TCommands, Command<any, TData>]>;
|
|
2086
2399
|
/**
|
|
2087
2400
|
* @see https://redis.io/commands/zrank
|
|
2088
2401
|
*/
|
|
@@ -2110,7 +2423,7 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2110
2423
|
/**
|
|
2111
2424
|
* @see https://redis.io/commands/zscan
|
|
2112
2425
|
*/
|
|
2113
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [
|
|
2426
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Pipeline<[...TCommands, Command<any, [string, (string | number)[]]>]>;
|
|
2114
2427
|
/**
|
|
2115
2428
|
* @see https://redis.io/commands/zscore
|
|
2116
2429
|
*/
|
|
@@ -2163,96 +2476,6 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2163
2476
|
* @see https://redis.io/commands/json.forget
|
|
2164
2477
|
*/
|
|
2165
2478
|
forget: (key: string, path?: string | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2166
|
-
/**
|
|
2167
|
-
* @see https://redis.io/commands/geoadd
|
|
2168
|
-
*/
|
|
2169
|
-
geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2170
|
-
/**
|
|
2171
|
-
* @see https://redis.io/commands/geodist
|
|
2172
|
-
*/
|
|
2173
|
-
geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Pipeline<[...TCommands, Command<any, number | null>]>;
|
|
2174
|
-
/**
|
|
2175
|
-
* @see https://redis.io/commands/geopos
|
|
2176
|
-
*/
|
|
2177
|
-
geopos: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, {
|
|
2178
|
-
lng: number;
|
|
2179
|
-
lat: number;
|
|
2180
|
-
}[]>]>;
|
|
2181
|
-
/**
|
|
2182
|
-
* @see https://redis.io/commands/geohash
|
|
2183
|
-
*/
|
|
2184
|
-
geohash: (args_0: string, ...args_1: unknown[]) => Pipeline<[...TCommands, Command<any, (string | null)[]>]>;
|
|
2185
|
-
/**
|
|
2186
|
-
* @see https://redis.io/commands/geosearch
|
|
2187
|
-
*/
|
|
2188
|
-
geosearch: (key: string, centerPoint: {
|
|
2189
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2190
|
-
coordinate: {
|
|
2191
|
-
lon: number;
|
|
2192
|
-
lat: number;
|
|
2193
|
-
};
|
|
2194
|
-
} | {
|
|
2195
|
-
type: "FROMMEMBER" | "frommember";
|
|
2196
|
-
member: unknown;
|
|
2197
|
-
}, shape: {
|
|
2198
|
-
type: "BYRADIUS" | "byradius";
|
|
2199
|
-
radius: number;
|
|
2200
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2201
|
-
} | {
|
|
2202
|
-
type: "BYBOX" | "bybox";
|
|
2203
|
-
rect: {
|
|
2204
|
-
width: number;
|
|
2205
|
-
height: number;
|
|
2206
|
-
};
|
|
2207
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2208
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2209
|
-
count?: {
|
|
2210
|
-
limit: number;
|
|
2211
|
-
any?: boolean | undefined;
|
|
2212
|
-
} | undefined;
|
|
2213
|
-
withCoord?: boolean | undefined;
|
|
2214
|
-
withDist?: boolean | undefined;
|
|
2215
|
-
withHash?: boolean | undefined;
|
|
2216
|
-
} | undefined) => Pipeline<[...TCommands, Command<any, ({
|
|
2217
|
-
member: unknown;
|
|
2218
|
-
} & {
|
|
2219
|
-
coord?: {
|
|
2220
|
-
long: number;
|
|
2221
|
-
lat: number;
|
|
2222
|
-
} | undefined;
|
|
2223
|
-
dist?: number | undefined;
|
|
2224
|
-
hash?: string | undefined;
|
|
2225
|
-
})[]>]>;
|
|
2226
|
-
/**
|
|
2227
|
-
* @see https://redis.io/commands/geosearchstore
|
|
2228
|
-
*/
|
|
2229
|
-
geosearchstore: (destination: string, key: string, centerPoint: {
|
|
2230
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2231
|
-
coordinate: {
|
|
2232
|
-
lon: number;
|
|
2233
|
-
lat: number;
|
|
2234
|
-
};
|
|
2235
|
-
} | {
|
|
2236
|
-
type: "FROMMEMBER" | "frommember";
|
|
2237
|
-
member: unknown;
|
|
2238
|
-
}, shape: {
|
|
2239
|
-
type: "BYRADIUS" | "byradius";
|
|
2240
|
-
radius: number;
|
|
2241
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2242
|
-
} | {
|
|
2243
|
-
type: "BYBOX" | "bybox";
|
|
2244
|
-
rect: {
|
|
2245
|
-
width: number;
|
|
2246
|
-
height: number;
|
|
2247
|
-
};
|
|
2248
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2249
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2250
|
-
count?: {
|
|
2251
|
-
limit: number;
|
|
2252
|
-
any?: boolean | undefined;
|
|
2253
|
-
} | undefined;
|
|
2254
|
-
storeDist?: boolean | undefined;
|
|
2255
|
-
} | undefined) => Pipeline<[...TCommands, Command<any, number>]>;
|
|
2256
2479
|
/**
|
|
2257
2480
|
* @see https://redis.io/commands/json.get
|
|
2258
2481
|
*/
|
|
@@ -2261,6 +2484,10 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2261
2484
|
* @see https://redis.io/commands/json.mget
|
|
2262
2485
|
*/
|
|
2263
2486
|
mget: (keys: string[], path: string) => Pipeline<[...TCommands, Command<any, any>]>;
|
|
2487
|
+
/**
|
|
2488
|
+
* @see https://redis.io/commands/json.mset
|
|
2489
|
+
*/
|
|
2490
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2264
2491
|
/**
|
|
2265
2492
|
* @see https://redis.io/commands/json.numincrby
|
|
2266
2493
|
*/
|
|
@@ -2286,9 +2513,9 @@ declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
2286
2513
|
*/
|
|
2287
2514
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2288
2515
|
nx: true;
|
|
2289
|
-
xx?:
|
|
2516
|
+
xx?: never;
|
|
2290
2517
|
} | {
|
|
2291
|
-
nx?:
|
|
2518
|
+
nx?: never;
|
|
2292
2519
|
xx: true;
|
|
2293
2520
|
} | undefined) => Pipeline<[...TCommands, Command<any, "OK" | null>]>;
|
|
2294
2521
|
/**
|
|
@@ -2359,6 +2586,7 @@ declare class Redis {
|
|
|
2359
2586
|
protected client: Requester;
|
|
2360
2587
|
protected opts?: CommandOptions<any, any>;
|
|
2361
2588
|
protected enableTelemetry: boolean;
|
|
2589
|
+
protected enableAutoPipelining: boolean;
|
|
2362
2590
|
/**
|
|
2363
2591
|
* Create a new redis client
|
|
2364
2592
|
*
|
|
@@ -2371,6 +2599,8 @@ declare class Redis {
|
|
|
2371
2599
|
* ```
|
|
2372
2600
|
*/
|
|
2373
2601
|
constructor(client: Requester, opts?: RedisOptions);
|
|
2602
|
+
get readYourWritesSyncToken(): string | undefined;
|
|
2603
|
+
set readYourWritesSyncToken(session: string | undefined);
|
|
2374
2604
|
get json(): {
|
|
2375
2605
|
/**
|
|
2376
2606
|
* @see https://redis.io/commands/json.arrappend
|
|
@@ -2408,104 +2638,18 @@ declare class Redis {
|
|
|
2408
2638
|
* @see https://redis.io/commands/json.forget
|
|
2409
2639
|
*/
|
|
2410
2640
|
forget: (key: string, path?: string | undefined) => Promise<number>;
|
|
2411
|
-
/**
|
|
2412
|
-
* @see https://redis.io/commands/geoadd
|
|
2413
|
-
*/
|
|
2414
|
-
geoadd: (args_0: string, args_1: GeoAddCommandOptions | GeoMember<unknown>, ...args_2: GeoMember<unknown>[]) => Promise<number | null>;
|
|
2415
|
-
/**
|
|
2416
|
-
* @see https://redis.io/commands/geopos
|
|
2417
|
-
*/
|
|
2418
|
-
geopos: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
2419
|
-
lng: number;
|
|
2420
|
-
lat: number;
|
|
2421
|
-
}[]>;
|
|
2422
|
-
/**
|
|
2423
|
-
* @see https://redis.io/commands/geodist
|
|
2424
|
-
*/
|
|
2425
|
-
geodist: (key: string, member1: unknown, member2: unknown, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
|
|
2426
|
-
/**
|
|
2427
|
-
* @see https://redis.io/commands/geohash
|
|
2428
|
-
*/
|
|
2429
|
-
geohash: (args_0: string, ...args_1: unknown[]) => Promise<(string | null)[]>;
|
|
2430
|
-
/**
|
|
2431
|
-
* @see https://redis.io/commands/geosearch
|
|
2432
|
-
*/
|
|
2433
|
-
geosearch: (key: string, centerPoint: {
|
|
2434
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2435
|
-
coordinate: {
|
|
2436
|
-
lon: number;
|
|
2437
|
-
lat: number;
|
|
2438
|
-
};
|
|
2439
|
-
} | {
|
|
2440
|
-
type: "FROMMEMBER" | "frommember";
|
|
2441
|
-
member: unknown;
|
|
2442
|
-
}, shape: {
|
|
2443
|
-
type: "BYRADIUS" | "byradius";
|
|
2444
|
-
radius: number;
|
|
2445
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2446
|
-
} | {
|
|
2447
|
-
type: "BYBOX" | "bybox";
|
|
2448
|
-
rect: {
|
|
2449
|
-
width: number;
|
|
2450
|
-
height: number;
|
|
2451
|
-
};
|
|
2452
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2453
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2454
|
-
count?: {
|
|
2455
|
-
limit: number;
|
|
2456
|
-
any?: boolean | undefined;
|
|
2457
|
-
} | undefined;
|
|
2458
|
-
withCoord?: boolean | undefined;
|
|
2459
|
-
withDist?: boolean | undefined;
|
|
2460
|
-
withHash?: boolean | undefined;
|
|
2461
|
-
} | undefined) => Promise<({
|
|
2462
|
-
member: unknown;
|
|
2463
|
-
} & {
|
|
2464
|
-
coord?: {
|
|
2465
|
-
long: number;
|
|
2466
|
-
lat: number;
|
|
2467
|
-
} | undefined;
|
|
2468
|
-
dist?: number | undefined;
|
|
2469
|
-
hash?: string | undefined;
|
|
2470
|
-
})[]>;
|
|
2471
|
-
/**
|
|
2472
|
-
* @see https://redis.io/commands/geosearchstore
|
|
2473
|
-
*/
|
|
2474
|
-
geosearchstore: (destination: string, key: string, centerPoint: {
|
|
2475
|
-
type: "FROMLONLAT" | "fromlonlat";
|
|
2476
|
-
coordinate: {
|
|
2477
|
-
lon: number;
|
|
2478
|
-
lat: number;
|
|
2479
|
-
};
|
|
2480
|
-
} | {
|
|
2481
|
-
type: "FROMMEMBER" | "frommember";
|
|
2482
|
-
member: unknown;
|
|
2483
|
-
}, shape: {
|
|
2484
|
-
type: "BYRADIUS" | "byradius";
|
|
2485
|
-
radius: number;
|
|
2486
|
-
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2487
|
-
} | {
|
|
2488
|
-
type: "BYBOX" | "bybox";
|
|
2489
|
-
rect: {
|
|
2490
|
-
width: number;
|
|
2491
|
-
height: number;
|
|
2492
|
-
};
|
|
2493
|
-
rectType: "M" | "KM" | "FT" | "MI";
|
|
2494
|
-
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2495
|
-
count?: {
|
|
2496
|
-
limit: number;
|
|
2497
|
-
any?: boolean | undefined;
|
|
2498
|
-
} | undefined;
|
|
2499
|
-
storeDist?: boolean | undefined;
|
|
2500
|
-
} | undefined) => Promise<number>;
|
|
2501
2641
|
/**
|
|
2502
2642
|
* @see https://redis.io/commands/json.get
|
|
2503
2643
|
*/
|
|
2504
|
-
get: (...args: CommandArgs<typeof JsonGetCommand>) => Promise<
|
|
2644
|
+
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) => Promise<TData | null>;
|
|
2505
2645
|
/**
|
|
2506
2646
|
* @see https://redis.io/commands/json.mget
|
|
2507
2647
|
*/
|
|
2508
|
-
mget: (keys: string[], path: string) => Promise<
|
|
2648
|
+
mget: <TData>(keys: string[], path: string) => Promise<TData>;
|
|
2649
|
+
/**
|
|
2650
|
+
* @see https://redis.io/commands/json.mset
|
|
2651
|
+
*/
|
|
2652
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) => Promise<"OK" | null>;
|
|
2509
2653
|
/**
|
|
2510
2654
|
* @see https://redis.io/commands/json.numincrby
|
|
2511
2655
|
*/
|
|
@@ -2531,9 +2675,9 @@ declare class Redis {
|
|
|
2531
2675
|
*/
|
|
2532
2676
|
set: (key: string, path: string, value: string | number | boolean | Record<string, unknown> | (string | number | boolean | Record<string, unknown>)[], opts?: {
|
|
2533
2677
|
nx: true;
|
|
2534
|
-
xx?:
|
|
2678
|
+
xx?: never;
|
|
2535
2679
|
} | {
|
|
2536
|
-
nx?:
|
|
2680
|
+
nx?: never;
|
|
2537
2681
|
xx: true;
|
|
2538
2682
|
} | undefined) => Promise<"OK" | null>;
|
|
2539
2683
|
/**
|
|
@@ -2568,6 +2712,7 @@ declare class Redis {
|
|
|
2568
2712
|
* @see {@link Pipeline}
|
|
2569
2713
|
*/
|
|
2570
2714
|
pipeline: () => Pipeline<[]>;
|
|
2715
|
+
protected autoPipeline: () => Redis;
|
|
2571
2716
|
/**
|
|
2572
2717
|
* Create a new transaction to allow executing multiple steps atomically.
|
|
2573
2718
|
*
|
|
@@ -2578,6 +2723,22 @@ declare class Redis {
|
|
|
2578
2723
|
* @see {@link Pipeline}
|
|
2579
2724
|
*/
|
|
2580
2725
|
multi: () => Pipeline<[]>;
|
|
2726
|
+
/**
|
|
2727
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
2728
|
+
*
|
|
2729
|
+
* @example
|
|
2730
|
+
* ```typescript
|
|
2731
|
+
* redis.set("mykey", 0);
|
|
2732
|
+
* const result = await redis.bitfield("mykey")
|
|
2733
|
+
* .set("u4", 0, 16)
|
|
2734
|
+
* .incr("u4", "#1", 1)
|
|
2735
|
+
* .exec();
|
|
2736
|
+
* console.log(result); // [0, 1]
|
|
2737
|
+
* ```
|
|
2738
|
+
*
|
|
2739
|
+
* @see https://redis.io/commands/bitfield
|
|
2740
|
+
*/
|
|
2741
|
+
bitfield: (key: string) => BitFieldCommand<Promise<number[]>>;
|
|
2581
2742
|
/**
|
|
2582
2743
|
* @see https://redis.io/commands/append
|
|
2583
2744
|
*/
|
|
@@ -2638,7 +2799,7 @@ declare class Redis {
|
|
|
2638
2799
|
/**
|
|
2639
2800
|
* @see https://redis.io/commands/expire
|
|
2640
2801
|
*/
|
|
2641
|
-
expire: (key: string, seconds: number) => Promise<0 | 1>;
|
|
2802
|
+
expire: (key: string, seconds: number, option?: ("NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") | undefined) => Promise<0 | 1>;
|
|
2642
2803
|
/**
|
|
2643
2804
|
* @see https://redis.io/commands/expireat
|
|
2644
2805
|
*/
|
|
@@ -2651,8 +2812,98 @@ declare class Redis {
|
|
|
2651
2812
|
* @see https://redis.io/commands/flushdb
|
|
2652
2813
|
*/
|
|
2653
2814
|
flushdb: (opts?: {
|
|
2654
|
-
async?: boolean
|
|
2815
|
+
async?: boolean;
|
|
2655
2816
|
} | undefined) => Promise<"OK">;
|
|
2817
|
+
/**
|
|
2818
|
+
* @see https://redis.io/commands/geoadd
|
|
2819
|
+
*/
|
|
2820
|
+
geoadd: <TData>(args_0: string, args_1: GeoAddCommandOptions | GeoMember<TData>, ...args_2: GeoMember<TData>[]) => Promise<number | null>;
|
|
2821
|
+
/**
|
|
2822
|
+
* @see https://redis.io/commands/geopos
|
|
2823
|
+
*/
|
|
2824
|
+
geopos: <TData>(args_0: string, ...args_1: TData[]) => Promise<{
|
|
2825
|
+
lng: number;
|
|
2826
|
+
lat: number;
|
|
2827
|
+
}[]>;
|
|
2828
|
+
/**
|
|
2829
|
+
* @see https://redis.io/commands/geodist
|
|
2830
|
+
*/
|
|
2831
|
+
geodist: <TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI" | undefined) => Promise<number | null>;
|
|
2832
|
+
/**
|
|
2833
|
+
* @see https://redis.io/commands/geohash
|
|
2834
|
+
*/
|
|
2835
|
+
geohash: <TData>(args_0: string, ...args_1: TData[]) => Promise<(string | null)[]>;
|
|
2836
|
+
/**
|
|
2837
|
+
* @see https://redis.io/commands/geosearch
|
|
2838
|
+
*/
|
|
2839
|
+
geosearch: <TData>(key: string, centerPoint: {
|
|
2840
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
2841
|
+
coordinate: {
|
|
2842
|
+
lon: number;
|
|
2843
|
+
lat: number;
|
|
2844
|
+
};
|
|
2845
|
+
} | {
|
|
2846
|
+
type: "FROMMEMBER" | "frommember";
|
|
2847
|
+
member: TData;
|
|
2848
|
+
}, shape: {
|
|
2849
|
+
type: "BYRADIUS" | "byradius";
|
|
2850
|
+
radius: number;
|
|
2851
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2852
|
+
} | {
|
|
2853
|
+
type: "BYBOX" | "bybox";
|
|
2854
|
+
rect: {
|
|
2855
|
+
width: number;
|
|
2856
|
+
height: number;
|
|
2857
|
+
};
|
|
2858
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
2859
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2860
|
+
count?: {
|
|
2861
|
+
limit: number;
|
|
2862
|
+
any?: boolean;
|
|
2863
|
+
};
|
|
2864
|
+
withCoord?: boolean;
|
|
2865
|
+
withDist?: boolean;
|
|
2866
|
+
withHash?: boolean;
|
|
2867
|
+
} | undefined) => Promise<({
|
|
2868
|
+
member: TData;
|
|
2869
|
+
} & {
|
|
2870
|
+
coord?: {
|
|
2871
|
+
long: number;
|
|
2872
|
+
lat: number;
|
|
2873
|
+
} | undefined;
|
|
2874
|
+
dist?: number | undefined;
|
|
2875
|
+
hash?: string | undefined;
|
|
2876
|
+
})[]>;
|
|
2877
|
+
/**
|
|
2878
|
+
* @see https://redis.io/commands/geosearchstore
|
|
2879
|
+
*/
|
|
2880
|
+
geosearchstore: <TData>(destination: string, key: string, centerPoint: {
|
|
2881
|
+
type: "FROMLONLAT" | "fromlonlat";
|
|
2882
|
+
coordinate: {
|
|
2883
|
+
lon: number;
|
|
2884
|
+
lat: number;
|
|
2885
|
+
};
|
|
2886
|
+
} | {
|
|
2887
|
+
type: "FROMMEMBER" | "frommember";
|
|
2888
|
+
member: TData;
|
|
2889
|
+
}, shape: {
|
|
2890
|
+
type: "BYRADIUS" | "byradius";
|
|
2891
|
+
radius: number;
|
|
2892
|
+
radiusType: "M" | "KM" | "FT" | "MI";
|
|
2893
|
+
} | {
|
|
2894
|
+
type: "BYBOX" | "bybox";
|
|
2895
|
+
rect: {
|
|
2896
|
+
width: number;
|
|
2897
|
+
height: number;
|
|
2898
|
+
};
|
|
2899
|
+
rectType: "M" | "KM" | "FT" | "MI";
|
|
2900
|
+
}, order: "ASC" | "DESC" | "asc" | "desc", opts?: {
|
|
2901
|
+
count?: {
|
|
2902
|
+
limit: number;
|
|
2903
|
+
any?: boolean;
|
|
2904
|
+
};
|
|
2905
|
+
storeDist?: boolean;
|
|
2906
|
+
} | undefined) => Promise<number>;
|
|
2656
2907
|
/**
|
|
2657
2908
|
* @see https://redis.io/commands/get
|
|
2658
2909
|
*/
|
|
@@ -2712,27 +2963,23 @@ declare class Redis {
|
|
|
2712
2963
|
/**
|
|
2713
2964
|
* @see https://redis.io/commands/hmset
|
|
2714
2965
|
*/
|
|
2715
|
-
hmset: <TData>(key: string, kv:
|
|
2716
|
-
[field: string]: TData;
|
|
2717
|
-
}) => Promise<"OK">;
|
|
2966
|
+
hmset: <TData>(key: string, kv: Record<string, TData>) => Promise<"OK">;
|
|
2718
2967
|
/**
|
|
2719
2968
|
* @see https://redis.io/commands/hrandfield
|
|
2720
2969
|
*/
|
|
2721
2970
|
hrandfield: {
|
|
2722
|
-
(key: string): Promise<string>;
|
|
2971
|
+
(key: string): Promise<string | null>;
|
|
2723
2972
|
(key: string, count: number): Promise<string[]>;
|
|
2724
2973
|
<TData extends Record<string, unknown>>(key: string, count: number, withValues: boolean): Promise<Partial<TData>>;
|
|
2725
2974
|
};
|
|
2726
2975
|
/**
|
|
2727
2976
|
* @see https://redis.io/commands/hscan
|
|
2728
2977
|
*/
|
|
2729
|
-
hscan: (key: string, cursor: number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[
|
|
2978
|
+
hscan: (key: string, cursor: string | number, cmdOpts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
2730
2979
|
/**
|
|
2731
2980
|
* @see https://redis.io/commands/hset
|
|
2732
2981
|
*/
|
|
2733
|
-
hset: <TData>(key: string, kv:
|
|
2734
|
-
[field: string]: TData;
|
|
2735
|
-
}) => Promise<number>;
|
|
2982
|
+
hset: <TData>(key: string, kv: Record<string, TData>) => Promise<number>;
|
|
2736
2983
|
/**
|
|
2737
2984
|
* @see https://redis.io/commands/hsetnx
|
|
2738
2985
|
*/
|
|
@@ -2781,13 +3028,17 @@ declare class Redis {
|
|
|
2781
3028
|
* @see https://redis.io/commands/lpop
|
|
2782
3029
|
*/
|
|
2783
3030
|
lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
3031
|
+
/**
|
|
3032
|
+
* @see https://redis.io/commands/lmpop
|
|
3033
|
+
*/
|
|
3034
|
+
lmpop: <TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number | undefined) => Promise<[string, TData[]] | null>;
|
|
2784
3035
|
/**
|
|
2785
3036
|
* @see https://redis.io/commands/lpos
|
|
2786
3037
|
*/
|
|
2787
3038
|
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
2788
|
-
rank?: number
|
|
2789
|
-
count?: number
|
|
2790
|
-
maxLen?: number
|
|
3039
|
+
rank?: number;
|
|
3040
|
+
count?: number;
|
|
3041
|
+
maxLen?: number;
|
|
2791
3042
|
} | undefined) => Promise<TData>;
|
|
2792
3043
|
/**
|
|
2793
3044
|
* @see https://redis.io/commands/lpush
|
|
@@ -2820,15 +3071,11 @@ declare class Redis {
|
|
|
2820
3071
|
/**
|
|
2821
3072
|
* @see https://redis.io/commands/mset
|
|
2822
3073
|
*/
|
|
2823
|
-
mset: <TData>(kv:
|
|
2824
|
-
[key: string]: TData;
|
|
2825
|
-
}) => Promise<"OK">;
|
|
3074
|
+
mset: <TData>(kv: Record<string, TData>) => Promise<"OK">;
|
|
2826
3075
|
/**
|
|
2827
3076
|
* @see https://redis.io/commands/msetnx
|
|
2828
3077
|
*/
|
|
2829
|
-
msetnx: <TData>(kv:
|
|
2830
|
-
[key: string]: TData;
|
|
2831
|
-
}) => Promise<number>;
|
|
3078
|
+
msetnx: <TData>(kv: Record<string, TData>) => Promise<number>;
|
|
2832
3079
|
/**
|
|
2833
3080
|
* @see https://redis.io/commands/persist
|
|
2834
3081
|
*/
|
|
@@ -2896,11 +3143,11 @@ declare class Redis {
|
|
|
2896
3143
|
/**
|
|
2897
3144
|
* @see https://redis.io/commands/sadd
|
|
2898
3145
|
*/
|
|
2899
|
-
sadd: <TData>(key: string, ...members: TData[]) => Promise<number>;
|
|
3146
|
+
sadd: <TData>(key: string, member: TData, ...members: TData[]) => Promise<number>;
|
|
2900
3147
|
/**
|
|
2901
3148
|
* @see https://redis.io/commands/scan
|
|
2902
3149
|
*/
|
|
2903
|
-
scan: (cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
3150
|
+
scan: (cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, string[]]>;
|
|
2904
3151
|
/**
|
|
2905
3152
|
* @see https://redis.io/commands/scard
|
|
2906
3153
|
*/
|
|
@@ -2984,7 +3231,7 @@ declare class Redis {
|
|
|
2984
3231
|
/**
|
|
2985
3232
|
* @see https://redis.io/commands/sscan
|
|
2986
3233
|
*/
|
|
2987
|
-
sscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
3234
|
+
sscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
2988
3235
|
/**
|
|
2989
3236
|
* @see https://redis.io/commands/strlen
|
|
2990
3237
|
*/
|
|
@@ -3020,11 +3267,9 @@ declare class Redis {
|
|
|
3020
3267
|
/**
|
|
3021
3268
|
* @see https://redis.io/commands/xadd
|
|
3022
3269
|
*/
|
|
3023
|
-
xadd: (key: string, id: string, entries: {
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
nomkStream?: boolean | undefined;
|
|
3027
|
-
trim?: (({
|
|
3270
|
+
xadd: (key: string, id: string, entries: Record<string, unknown>, opts?: {
|
|
3271
|
+
nomkStream?: boolean;
|
|
3272
|
+
trim?: ({
|
|
3028
3273
|
type: "MAXLEN" | "maxlen";
|
|
3029
3274
|
threshold: number;
|
|
3030
3275
|
} | {
|
|
@@ -3032,20 +3277,117 @@ declare class Redis {
|
|
|
3032
3277
|
threshold: string;
|
|
3033
3278
|
}) & ({
|
|
3034
3279
|
comparison: "~";
|
|
3035
|
-
limit?: number
|
|
3280
|
+
limit?: number;
|
|
3036
3281
|
} | {
|
|
3037
3282
|
comparison: "=";
|
|
3038
|
-
limit?:
|
|
3039
|
-
})
|
|
3283
|
+
limit?: never;
|
|
3284
|
+
});
|
|
3040
3285
|
} | undefined) => Promise<string>;
|
|
3286
|
+
/**
|
|
3287
|
+
* @see https://redis.io/commands/xack
|
|
3288
|
+
*/
|
|
3289
|
+
xack: (key: string, group: string, id: string | string[]) => Promise<number>;
|
|
3290
|
+
/**
|
|
3291
|
+
* @see https://redis.io/commands/xdel
|
|
3292
|
+
*/
|
|
3293
|
+
xdel: (key: string, ids: string | string[]) => Promise<number>;
|
|
3294
|
+
/**
|
|
3295
|
+
* @see https://redis.io/commands/xgroup
|
|
3296
|
+
*/
|
|
3297
|
+
xgroup: (key: string, opts: {
|
|
3298
|
+
type: "CREATE";
|
|
3299
|
+
group: string;
|
|
3300
|
+
id: `$` | string;
|
|
3301
|
+
options?: {
|
|
3302
|
+
MKSTREAM?: boolean;
|
|
3303
|
+
ENTRIESREAD?: number;
|
|
3304
|
+
};
|
|
3305
|
+
} | {
|
|
3306
|
+
type: "CREATECONSUMER";
|
|
3307
|
+
group: string;
|
|
3308
|
+
consumer: string;
|
|
3309
|
+
} | {
|
|
3310
|
+
type: "DELCONSUMER";
|
|
3311
|
+
group: string;
|
|
3312
|
+
consumer: string;
|
|
3313
|
+
} | {
|
|
3314
|
+
type: "DESTROY";
|
|
3315
|
+
group: string;
|
|
3316
|
+
} | {
|
|
3317
|
+
type: "SETID";
|
|
3318
|
+
group: string;
|
|
3319
|
+
id: `$` | string;
|
|
3320
|
+
options?: {
|
|
3321
|
+
ENTRIESREAD?: number;
|
|
3322
|
+
};
|
|
3323
|
+
}) => Promise<never>;
|
|
3324
|
+
/**
|
|
3325
|
+
* @see https://redis.io/commands/xread
|
|
3326
|
+
*/
|
|
3327
|
+
xread: (...args: CommandArgs<typeof XReadCommand>) => Promise<unknown[]>;
|
|
3328
|
+
/**
|
|
3329
|
+
* @see https://redis.io/commands/xreadgroup
|
|
3330
|
+
*/
|
|
3331
|
+
xreadgroup: (...args: CommandArgs<typeof XReadGroupCommand>) => Promise<unknown[]>;
|
|
3332
|
+
/**
|
|
3333
|
+
* @see https://redis.io/commands/xinfo
|
|
3334
|
+
*/
|
|
3335
|
+
xinfo: (key: string, options: {
|
|
3336
|
+
type: "CONSUMERS";
|
|
3337
|
+
group: string;
|
|
3338
|
+
} | {
|
|
3339
|
+
type: "GROUPS";
|
|
3340
|
+
}) => Promise<unknown[]>;
|
|
3341
|
+
/**
|
|
3342
|
+
* @see https://redis.io/commands/xlen
|
|
3343
|
+
*/
|
|
3344
|
+
xlen: (key: string) => Promise<number>;
|
|
3345
|
+
/**
|
|
3346
|
+
* @see https://redis.io/commands/xpending
|
|
3347
|
+
*/
|
|
3348
|
+
xpending: (key: string, group: string, start: string, end: string, count: number, options?: {
|
|
3349
|
+
idleTime?: number;
|
|
3350
|
+
consumer?: string | string[];
|
|
3351
|
+
} | undefined) => Promise<unknown[]>;
|
|
3352
|
+
/**
|
|
3353
|
+
* @see https://redis.io/commands/xclaim
|
|
3354
|
+
*/
|
|
3355
|
+
xclaim: (key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: {
|
|
3356
|
+
idleMS?: number;
|
|
3357
|
+
timeMS?: number;
|
|
3358
|
+
retryCount?: number;
|
|
3359
|
+
force?: boolean;
|
|
3360
|
+
justId?: boolean;
|
|
3361
|
+
lastId?: number;
|
|
3362
|
+
} | undefined) => Promise<unknown[]>;
|
|
3363
|
+
/**
|
|
3364
|
+
* @see https://redis.io/commands/xautoclaim
|
|
3365
|
+
*/
|
|
3366
|
+
xautoclaim: (key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: {
|
|
3367
|
+
count?: number;
|
|
3368
|
+
justId?: boolean;
|
|
3369
|
+
} | undefined) => Promise<unknown[]>;
|
|
3370
|
+
/**
|
|
3371
|
+
* @see https://redis.io/commands/xtrim
|
|
3372
|
+
*/
|
|
3373
|
+
xtrim: (key: string, options: {
|
|
3374
|
+
strategy: "MAXLEN" | "MINID";
|
|
3375
|
+
exactness?: "~" | "=";
|
|
3376
|
+
threshold: number | string;
|
|
3377
|
+
limit?: number;
|
|
3378
|
+
}) => Promise<number>;
|
|
3041
3379
|
/**
|
|
3042
3380
|
* @see https://redis.io/commands/xrange
|
|
3043
3381
|
*/
|
|
3044
3382
|
xrange: (key: string, start: string, end: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
|
|
3383
|
+
/**
|
|
3384
|
+
* @see https://redis.io/commands/xrevrange
|
|
3385
|
+
*/
|
|
3386
|
+
xrevrange: (key: string, end: string, start: string, count?: number | undefined) => Promise<Record<string, Record<string, unknown>>>;
|
|
3045
3387
|
/**
|
|
3046
3388
|
* @see https://redis.io/commands/zadd
|
|
3047
3389
|
*/
|
|
3048
|
-
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<number | null>;
|
|
3390
|
+
zadd: <TData>(...args: [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [key: string, opts: ZAddCommandOptions, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]]) => Promise<number | null>;
|
|
3049
3391
|
/**
|
|
3050
3392
|
* @see https://redis.io/commands/zcard
|
|
3051
3393
|
*/
|
|
@@ -3085,21 +3427,11 @@ declare class Redis {
|
|
|
3085
3427
|
/**
|
|
3086
3428
|
* @see https://redis.io/commands/zrange
|
|
3087
3429
|
*/
|
|
3088
|
-
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
byLex: true;
|
|
3094
|
-
} & ZRangeCommandOptions
|
|
3095
|
-
] | [
|
|
3096
|
-
key: string,
|
|
3097
|
-
min: number | `(${number}` | "-inf" | "+inf",
|
|
3098
|
-
max: number | `(${number}` | "-inf" | "+inf",
|
|
3099
|
-
opts: {
|
|
3100
|
-
byScore: true;
|
|
3101
|
-
} & ZRangeCommandOptions
|
|
3102
|
-
]) => Promise<TData>;
|
|
3430
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
3431
|
+
byLex: true;
|
|
3432
|
+
} & ZRangeCommandOptions] | [key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
3433
|
+
byScore: true;
|
|
3434
|
+
} & ZRangeCommandOptions]) => Promise<TData>;
|
|
3103
3435
|
/**
|
|
3104
3436
|
* @see https://redis.io/commands/zrank
|
|
3105
3437
|
*/
|
|
@@ -3127,7 +3459,7 @@ declare class Redis {
|
|
|
3127
3459
|
/**
|
|
3128
3460
|
* @see https://redis.io/commands/zscan
|
|
3129
3461
|
*/
|
|
3130
|
-
zscan: (key: string, cursor: number, opts?: ScanCommandOptions | undefined) => Promise<[
|
|
3462
|
+
zscan: (key: string, cursor: string | number, opts?: ScanCommandOptions | undefined) => Promise<[string, (string | number)[]]>;
|
|
3131
3463
|
/**
|
|
3132
3464
|
* @see https://redis.io/commands/zscore
|
|
3133
3465
|
*/
|
|
@@ -3142,6 +3474,24 @@ declare class Redis {
|
|
|
3142
3474
|
zunionstore: (destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions | undefined) => Promise<number>;
|
|
3143
3475
|
}
|
|
3144
3476
|
|
|
3477
|
+
/**
|
|
3478
|
+
* Result of a bad request to upstash
|
|
3479
|
+
*/
|
|
3480
|
+
declare class UpstashError extends Error {
|
|
3481
|
+
constructor(message: string);
|
|
3482
|
+
}
|
|
3483
|
+
declare class UrlError extends Error {
|
|
3484
|
+
constructor(url: string);
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3487
|
+
type error_UpstashError = UpstashError;
|
|
3488
|
+
declare const error_UpstashError: typeof UpstashError;
|
|
3489
|
+
type error_UrlError = UrlError;
|
|
3490
|
+
declare const error_UrlError: typeof UrlError;
|
|
3491
|
+
declare namespace error {
|
|
3492
|
+
export { error_UpstashError as UpstashError, error_UrlError as UrlError };
|
|
3493
|
+
}
|
|
3494
|
+
|
|
3145
3495
|
/**
|
|
3146
3496
|
* @see https://redis.io/commands/zdiffstore
|
|
3147
3497
|
*/
|
|
@@ -3156,4 +3506,4 @@ declare class ZMScoreCommand<TData> extends Command<string[] | null, number[] |
|
|
|
3156
3506
|
constructor(cmd: [key: string, members: TData[]], opts?: CommandOptions<string[] | null, number[] | null>);
|
|
3157
3507
|
}
|
|
3158
3508
|
|
|
3159
|
-
export {
|
|
3509
|
+
export { HValsCommand as $, AppendCommand as A, BitCountCommand as B, CopyCommand as C, DBSizeCommand as D, EchoCommand as E, FlushAllCommand as F, GeoAddCommand as G, GetRangeCommand as H, GetSetCommand as I, HDelCommand as J, HExistsCommand as K, HGetCommand as L, HGetAllCommand as M, HIncrByCommand as N, HIncrByFloatCommand as O, Pipeline as P, HKeysCommand as Q, type RedisOptions as R, HLenCommand as S, HMGetCommand as T, type UpstashRequest as U, HMSetCommand as V, HRandFieldCommand as W, HScanCommand as X, HSetCommand as Y, HSetNXCommand as Z, HStrLenCommand as _, type RequesterConfig as a, SetBitCommand as a$, IncrCommand as a0, IncrByCommand as a1, IncrByFloatCommand as a2, JsonArrAppendCommand as a3, JsonArrIndexCommand as a4, JsonArrInsertCommand as a5, JsonArrLenCommand as a6, JsonArrPopCommand as a7, JsonArrTrimCommand as a8, JsonClearCommand as a9, MGetCommand as aA, MSetCommand as aB, MSetNXCommand as aC, PersistCommand as aD, PExpireCommand as aE, PExpireAtCommand as aF, PingCommand as aG, PSetEXCommand as aH, PTtlCommand as aI, PublishCommand as aJ, RandomKeyCommand as aK, RenameCommand as aL, RenameNXCommand as aM, RPopCommand as aN, RPushCommand as aO, RPushXCommand as aP, SAddCommand as aQ, ScanCommand as aR, type ScanCommandOptions as aS, SCardCommand as aT, ScriptExistsCommand as aU, ScriptFlushCommand as aV, ScriptLoadCommand as aW, SDiffCommand as aX, SDiffStoreCommand as aY, SetCommand as aZ, type SetCommandOptions as a_, JsonDelCommand as aa, JsonForgetCommand as ab, JsonGetCommand as ac, JsonMGetCommand as ad, JsonNumIncrByCommand as ae, JsonNumMultByCommand as af, JsonObjKeysCommand as ag, JsonObjLenCommand as ah, JsonRespCommand as ai, JsonSetCommand as aj, JsonStrAppendCommand as ak, JsonStrLenCommand as al, JsonToggleCommand as am, JsonTypeCommand as an, KeysCommand as ao, LIndexCommand as ap, LInsertCommand as aq, LLenCommand as ar, LMoveCommand as as, LPopCommand as at, LPushCommand as au, LPushXCommand as av, LRangeCommand as aw, LRemCommand as ax, LSetCommand as ay, LTrimCommand as az, Redis as b, SetExCommand as b0, SetNxCommand as b1, SetRangeCommand as b2, SInterCommand as b3, SInterStoreCommand as b4, SIsMemberCommand as b5, SMembersCommand as b6, SMIsMemberCommand as b7, SMoveCommand as b8, SPopCommand as b9, ZPopMinCommand as bA, ZRangeCommand as bB, type ZRangeCommandOptions as bC, ZRankCommand as bD, ZRemCommand as bE, ZRemRangeByLexCommand as bF, ZRemRangeByRankCommand as bG, ZRemRangeByScoreCommand as bH, ZRevRankCommand as bI, ZScanCommand as bJ, ZScoreCommand as bK, ZUnionCommand as bL, type ZUnionCommandOptions as bM, ZUnionStoreCommand as bN, type ZUnionStoreCommandOptions as bO, SRandMemberCommand as ba, SRemCommand as bb, SScanCommand as bc, StrLenCommand as bd, SUnionCommand as be, SUnionStoreCommand as bf, TimeCommand as bg, TouchCommand as bh, TtlCommand as bi, type Type as bj, TypeCommand as bk, UnlinkCommand as bl, XAddCommand as bm, XRangeCommand as bn, type ScoreMember as bo, type ZAddCommandOptions as bp, ZAddCommand as bq, ZCardCommand as br, ZCountCommand as bs, ZDiffStoreCommand as bt, ZIncrByCommand as bu, ZInterStoreCommand as bv, type ZInterStoreCommandOptions as bw, ZLexCountCommand as bx, ZMScoreCommand as by, ZPopMaxCommand as bz, type UpstashResponse as c, type Requester as d, error as e, BitOpCommand as f, BitPosCommand as g, DecrCommand as h, DecrByCommand as i, DelCommand as j, EvalCommand as k, EvalshaCommand as l, ExistsCommand as m, ExpireCommand as n, ExpireAtCommand as o, FlushDBCommand as p, type GeoAddCommandOptions as q, type GeoMember as r, GeoDistCommand as s, GeoHashCommand as t, GeoPosCommand as u, GeoSearchCommand as v, GeoSearchStoreCommand as w, GetCommand as x, GetBitCommand as y, GetDelCommand as z };
|