@upstash/redis 1.0.3 → 1.1.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/{chunk-2EIGUPGW.mjs → chunk-256N7RVN.mjs} +6 -3
- package/{chunk-WPH7MAB2.mjs → chunk-FR62Y7XB.mjs} +1 -1
- package/{chunk-HGM7M7CJ.mjs → chunk-HZBBCLMC.mjs} +14 -0
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +45 -30
- package/cloudflare.mjs +2 -2
- package/commands.d.ts +10 -3
- package/commands.js +15 -0
- package/commands.mjs +3 -1
- package/fastly.d.ts +2 -2
- package/fastly.js +45 -30
- package/fastly.mjs +2 -2
- package/index.d.ts +2 -2
- package/index.js +17 -2
- package/index.mjs +3 -3
- package/nodejs.d.ts +2 -2
- package/nodejs.js +17 -2
- package/nodejs.mjs +3 -3
- package/package.json +1 -1
- package/{redis-8b6ea223.d.ts → redis-a9efcf58.d.ts} +39 -3
- package/{zunionstore-e1cc0e90.d.ts → zunionstore-342168a6.d.ts} +17 -2
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
PTtlCommand,
|
|
56
56
|
PersistCommand,
|
|
57
57
|
PingCommand,
|
|
58
|
+
PublishCommand,
|
|
58
59
|
RPopCommand,
|
|
59
60
|
RPushCommand,
|
|
60
61
|
RPushXCommand,
|
|
@@ -106,7 +107,7 @@ import {
|
|
|
106
107
|
ZScanCommand,
|
|
107
108
|
ZScoreCommand,
|
|
108
109
|
ZUnionStoreCommand
|
|
109
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-HZBBCLMC.mjs";
|
|
110
111
|
import {
|
|
111
112
|
UpstashError
|
|
112
113
|
} from "./chunk-7YUZYRJS.mjs";
|
|
@@ -185,6 +186,7 @@ var Pipeline = class {
|
|
|
185
186
|
this.ping = (...args) => this.chain(new PingCommand(...args));
|
|
186
187
|
this.psetex = (key, ttl, value) => this.chain(new PSetEXCommand(key, ttl, value));
|
|
187
188
|
this.pttl = (...args) => this.chain(new PTtlCommand(...args));
|
|
189
|
+
this.publish = (...args) => this.chain(new PublishCommand(...args));
|
|
188
190
|
this.randomkey = () => this.chain(new RandomKeyCommand());
|
|
189
191
|
this.rename = (...args) => this.chain(new RenameCommand(...args));
|
|
190
192
|
this.renamenx = (...args) => this.chain(new RenameNXCommand(...args));
|
|
@@ -231,7 +233,7 @@ var Pipeline = class {
|
|
|
231
233
|
this.zlexcount = (...args) => this.chain(new ZLexCountCommand(...args));
|
|
232
234
|
this.zpopmax = (...args) => this.chain(new ZPopMaxCommand(...args));
|
|
233
235
|
this.zpopmin = (...args) => this.chain(new ZPopMinCommand(...args));
|
|
234
|
-
this.zrange = (...args) => this.chain(new ZRangeCommand(
|
|
236
|
+
this.zrange = (...args) => this.chain(new ZRangeCommand(args[0], args[1], args[2], args[3]));
|
|
235
237
|
this.zrank = (key, member) => this.chain(new ZRankCommand(key, member));
|
|
236
238
|
this.zrem = (key, ...members) => this.chain(new ZRemCommand(key, ...members));
|
|
237
239
|
this.zremrangebylex = (...args) => this.chain(new ZRemRangeByLexCommand(...args));
|
|
@@ -310,6 +312,7 @@ var Redis = class {
|
|
|
310
312
|
this.ping = (...args) => new PingCommand(...args).exec(this.client);
|
|
311
313
|
this.psetex = (key, ttl, value) => new PSetEXCommand(key, ttl, value).exec(this.client);
|
|
312
314
|
this.pttl = (...args) => new PTtlCommand(...args).exec(this.client);
|
|
315
|
+
this.publish = (...args) => new PublishCommand(...args).exec(this.client);
|
|
313
316
|
this.randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
314
317
|
this.rename = (...args) => new RenameCommand(...args).exec(this.client);
|
|
315
318
|
this.renamenx = (...args) => new RenameNXCommand(...args).exec(this.client);
|
|
@@ -356,7 +359,7 @@ var Redis = class {
|
|
|
356
359
|
this.zlexcount = (...args) => new ZLexCountCommand(...args).exec(this.client);
|
|
357
360
|
this.zpopmax = (...args) => new ZPopMaxCommand(...args).exec(this.client);
|
|
358
361
|
this.zpopmin = (...args) => new ZPopMinCommand(...args).exec(this.client);
|
|
359
|
-
this.zrange = (...args) => new ZRangeCommand(
|
|
362
|
+
this.zrange = (...args) => new ZRangeCommand(args[0], args[1], args[2], args[3]).exec(this.client);
|
|
360
363
|
this.zrank = (key, member) => new ZRankCommand(key, member).exec(this.client);
|
|
361
364
|
this.zrem = (key, ...members) => new ZRemCommand(key, ...members).exec(this.client);
|
|
362
365
|
this.zremrangebylex = (...args) => new ZRemRangeByLexCommand(...args).exec(this.client);
|
|
@@ -495,6 +495,13 @@ var PTtlCommand = class extends Command {
|
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
497
|
|
|
498
|
+
// pkg/commands/publish.ts
|
|
499
|
+
var PublishCommand = class extends Command {
|
|
500
|
+
constructor(channel, message) {
|
|
501
|
+
super(["publish", channel, message]);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
498
505
|
// pkg/commands/randomkey.ts
|
|
499
506
|
var RandomKeyCommand = class extends Command {
|
|
500
507
|
constructor() {
|
|
@@ -861,6 +868,12 @@ var ZPopMinCommand = class extends Command {
|
|
|
861
868
|
var ZRangeCommand = class extends Command {
|
|
862
869
|
constructor(key, min, max, opts) {
|
|
863
870
|
const command = ["zrange", key, min, max];
|
|
871
|
+
if (opts == null ? void 0 : opts.byScore) {
|
|
872
|
+
command.push("byscore");
|
|
873
|
+
}
|
|
874
|
+
if (opts == null ? void 0 : opts.byLex) {
|
|
875
|
+
command.push("bylex");
|
|
876
|
+
}
|
|
864
877
|
if (opts == null ? void 0 : opts.withScores) {
|
|
865
878
|
command.push("withscores");
|
|
866
879
|
}
|
|
@@ -1012,6 +1025,7 @@ export {
|
|
|
1012
1025
|
PingCommand,
|
|
1013
1026
|
PSetEXCommand,
|
|
1014
1027
|
PTtlCommand,
|
|
1028
|
+
PublishCommand,
|
|
1015
1029
|
RandomKeyCommand,
|
|
1016
1030
|
RenameCommand,
|
|
1017
1031
|
RenameNXCommand,
|
package/cloudflare.d.ts
CHANGED
package/cloudflare.js
CHANGED
|
@@ -49,6 +49,34 @@ var UpstashError = class extends Error {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
// pkg/http.ts
|
|
53
|
+
var HttpClient = class {
|
|
54
|
+
constructor(config) {
|
|
55
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
56
|
+
this.headers = __spreadValues({
|
|
57
|
+
"Content-Type": "application/json"
|
|
58
|
+
}, config.headers);
|
|
59
|
+
this.options = config.options;
|
|
60
|
+
}
|
|
61
|
+
async request(req) {
|
|
62
|
+
var _a;
|
|
63
|
+
if (!req.path) {
|
|
64
|
+
req.path = [];
|
|
65
|
+
}
|
|
66
|
+
const res = await fetch([this.baseUrl, ...req.path].join("/"), {
|
|
67
|
+
method: "POST",
|
|
68
|
+
headers: this.headers,
|
|
69
|
+
body: JSON.stringify(req.body),
|
|
70
|
+
backend: (_a = this.options) == null ? void 0 : _a.backend
|
|
71
|
+
});
|
|
72
|
+
const body = await res.json();
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
throw new UpstashError(body.error);
|
|
75
|
+
}
|
|
76
|
+
return body;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
52
80
|
// pkg/util.ts
|
|
53
81
|
function parseRecursive(obj) {
|
|
54
82
|
const parsed = Array.isArray(obj) ? obj.map((o) => {
|
|
@@ -542,6 +570,13 @@ var PTtlCommand = class extends Command {
|
|
|
542
570
|
}
|
|
543
571
|
};
|
|
544
572
|
|
|
573
|
+
// pkg/commands/publish.ts
|
|
574
|
+
var PublishCommand = class extends Command {
|
|
575
|
+
constructor(channel, message) {
|
|
576
|
+
super(["publish", channel, message]);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
545
580
|
// pkg/commands/randomkey.ts
|
|
546
581
|
var RandomKeyCommand = class extends Command {
|
|
547
582
|
constructor() {
|
|
@@ -908,6 +943,12 @@ var ZPopMinCommand = class extends Command {
|
|
|
908
943
|
var ZRangeCommand = class extends Command {
|
|
909
944
|
constructor(key, min, max, opts) {
|
|
910
945
|
const command = ["zrange", key, min, max];
|
|
946
|
+
if (opts == null ? void 0 : opts.byScore) {
|
|
947
|
+
command.push("byscore");
|
|
948
|
+
}
|
|
949
|
+
if (opts == null ? void 0 : opts.byLex) {
|
|
950
|
+
command.push("bylex");
|
|
951
|
+
}
|
|
911
952
|
if (opts == null ? void 0 : opts.withScores) {
|
|
912
953
|
command.push("withscores");
|
|
913
954
|
}
|
|
@@ -1075,6 +1116,7 @@ var Pipeline = class {
|
|
|
1075
1116
|
this.ping = (...args) => this.chain(new PingCommand(...args));
|
|
1076
1117
|
this.psetex = (key, ttl, value) => this.chain(new PSetEXCommand(key, ttl, value));
|
|
1077
1118
|
this.pttl = (...args) => this.chain(new PTtlCommand(...args));
|
|
1119
|
+
this.publish = (...args) => this.chain(new PublishCommand(...args));
|
|
1078
1120
|
this.randomkey = () => this.chain(new RandomKeyCommand());
|
|
1079
1121
|
this.rename = (...args) => this.chain(new RenameCommand(...args));
|
|
1080
1122
|
this.renamenx = (...args) => this.chain(new RenameNXCommand(...args));
|
|
@@ -1121,7 +1163,7 @@ var Pipeline = class {
|
|
|
1121
1163
|
this.zlexcount = (...args) => this.chain(new ZLexCountCommand(...args));
|
|
1122
1164
|
this.zpopmax = (...args) => this.chain(new ZPopMaxCommand(...args));
|
|
1123
1165
|
this.zpopmin = (...args) => this.chain(new ZPopMinCommand(...args));
|
|
1124
|
-
this.zrange = (...args) => this.chain(new ZRangeCommand(
|
|
1166
|
+
this.zrange = (...args) => this.chain(new ZRangeCommand(args[0], args[1], args[2], args[3]));
|
|
1125
1167
|
this.zrank = (key, member) => this.chain(new ZRankCommand(key, member));
|
|
1126
1168
|
this.zrem = (key, ...members) => this.chain(new ZRemCommand(key, ...members));
|
|
1127
1169
|
this.zremrangebylex = (...args) => this.chain(new ZRemRangeByLexCommand(...args));
|
|
@@ -1200,6 +1242,7 @@ var Redis = class {
|
|
|
1200
1242
|
this.ping = (...args) => new PingCommand(...args).exec(this.client);
|
|
1201
1243
|
this.psetex = (key, ttl, value) => new PSetEXCommand(key, ttl, value).exec(this.client);
|
|
1202
1244
|
this.pttl = (...args) => new PTtlCommand(...args).exec(this.client);
|
|
1245
|
+
this.publish = (...args) => new PublishCommand(...args).exec(this.client);
|
|
1203
1246
|
this.randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
1204
1247
|
this.rename = (...args) => new RenameCommand(...args).exec(this.client);
|
|
1205
1248
|
this.renamenx = (...args) => new RenameNXCommand(...args).exec(this.client);
|
|
@@ -1246,7 +1289,7 @@ var Redis = class {
|
|
|
1246
1289
|
this.zlexcount = (...args) => new ZLexCountCommand(...args).exec(this.client);
|
|
1247
1290
|
this.zpopmax = (...args) => new ZPopMaxCommand(...args).exec(this.client);
|
|
1248
1291
|
this.zpopmin = (...args) => new ZPopMinCommand(...args).exec(this.client);
|
|
1249
|
-
this.zrange = (...args) => new ZRangeCommand(
|
|
1292
|
+
this.zrange = (...args) => new ZRangeCommand(args[0], args[1], args[2], args[3]).exec(this.client);
|
|
1250
1293
|
this.zrank = (key, member) => new ZRankCommand(key, member).exec(this.client);
|
|
1251
1294
|
this.zrem = (key, ...members) => new ZRemCommand(key, ...members).exec(this.client);
|
|
1252
1295
|
this.zremrangebylex = (...args) => new ZRemRangeByLexCommand(...args).exec(this.client);
|
|
@@ -1260,34 +1303,6 @@ var Redis = class {
|
|
|
1260
1303
|
}
|
|
1261
1304
|
};
|
|
1262
1305
|
|
|
1263
|
-
// pkg/http.ts
|
|
1264
|
-
var HttpClient = class {
|
|
1265
|
-
constructor(config) {
|
|
1266
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
1267
|
-
this.headers = __spreadValues({
|
|
1268
|
-
"Content-Type": "application/json"
|
|
1269
|
-
}, config.headers);
|
|
1270
|
-
this.options = config.options;
|
|
1271
|
-
}
|
|
1272
|
-
async request(req) {
|
|
1273
|
-
var _a;
|
|
1274
|
-
if (!req.path) {
|
|
1275
|
-
req.path = [];
|
|
1276
|
-
}
|
|
1277
|
-
const res = await fetch([this.baseUrl, ...req.path].join("/"), {
|
|
1278
|
-
method: "POST",
|
|
1279
|
-
headers: this.headers,
|
|
1280
|
-
body: JSON.stringify(req.body),
|
|
1281
|
-
backend: (_a = this.options) == null ? void 0 : _a.backend
|
|
1282
|
-
});
|
|
1283
|
-
const body = await res.json();
|
|
1284
|
-
if (!res.ok) {
|
|
1285
|
-
throw new UpstashError(body.error);
|
|
1286
|
-
}
|
|
1287
|
-
return body;
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
|
|
1291
1306
|
// pkg/cloudflare.ts
|
|
1292
1307
|
var Redis2 = class extends Redis {
|
|
1293
1308
|
constructor(config) {
|
package/cloudflare.mjs
CHANGED
package/commands.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as Command, N as NonEmptyArray, S as ScanCommandOptions } from './zunionstore-
|
|
2
|
-
export { g as Command, h as ScanCommand, S as ScanCommandOptions, b as ScoreMember, i as SetCommand, a as SetCommandOptions, T as Type, j as TypeCommand, U as UnlinkCommand, k as ZAddCommand, Z as ZAddCommandOptions, c as ZAddCommandOptionsWithIncr, l as ZInterStoreCommand, d as ZInterStoreCommandOptions, m as ZRangeCommand, e as ZRangeCommandOptions, n as ZUnionStoreCommand, f as ZUnionStoreCommandOptions } from './zunionstore-
|
|
1
|
+
import { g as Command, N as NonEmptyArray, S as ScanCommandOptions } from './zunionstore-342168a6';
|
|
2
|
+
export { g as Command, h as ScanCommand, S as ScanCommandOptions, b as ScoreMember, i as SetCommand, a as SetCommandOptions, T as Type, j as TypeCommand, U as UnlinkCommand, k as ZAddCommand, Z as ZAddCommandOptions, c as ZAddCommandOptionsWithIncr, l as ZInterStoreCommand, d as ZInterStoreCommandOptions, m as ZRangeCommand, e as ZRangeCommandOptions, n as ZUnionStoreCommand, f as ZUnionStoreCommandOptions } from './zunionstore-342168a6';
|
|
3
3
|
import './http';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -404,6 +404,13 @@ declare class PTtlCommand extends Command<number, number> {
|
|
|
404
404
|
constructor(key: string);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
/**
|
|
408
|
+
* @see https://redis.io/commands/publish
|
|
409
|
+
*/
|
|
410
|
+
declare class PublishCommand<TMessage = unknown> extends Command<number, number> {
|
|
411
|
+
constructor(channel: string, message: TMessage);
|
|
412
|
+
}
|
|
413
|
+
|
|
407
414
|
/**
|
|
408
415
|
* @see https://redis.io/commands/randomkey
|
|
409
416
|
*/
|
|
@@ -717,4 +724,4 @@ declare class ZScoreCommand<TData> extends Command<number | null, string | null>
|
|
|
717
724
|
constructor(key: string, member: TData);
|
|
718
725
|
}
|
|
719
726
|
|
|
720
|
-
export { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PExpireAtCommand, PExpireCommand, PSetEXCommand, PTtlCommand, PersistCommand, PingCommand, RPopCommand, RPushCommand, RPushXCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, SAddCommand, SCardCommand, SDiffCommand, SDiffStoreCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, SUnionCommand, SUnionStoreCommand, SetBitCommand, SetExCommand, SetNxCommand, SetRangeCommand, StrLenCommand, TimeCommand, TouchCommand, TtlCommand, ZCardCommand, ZCountCommand, ZIncrByComand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand };
|
|
727
|
+
export { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PExpireAtCommand, PExpireCommand, PSetEXCommand, PTtlCommand, PersistCommand, PingCommand, PublishCommand, RPopCommand, RPushCommand, RPushXCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, SAddCommand, SCardCommand, SDiffCommand, SDiffStoreCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, SUnionCommand, SUnionStoreCommand, SetBitCommand, SetExCommand, SetNxCommand, SetRangeCommand, StrLenCommand, TimeCommand, TouchCommand, TtlCommand, ZCardCommand, ZCountCommand, ZIncrByComand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand };
|
package/commands.js
CHANGED
|
@@ -81,6 +81,7 @@ __export(commands_exports, {
|
|
|
81
81
|
PTtlCommand: () => PTtlCommand,
|
|
82
82
|
PersistCommand: () => PersistCommand,
|
|
83
83
|
PingCommand: () => PingCommand,
|
|
84
|
+
PublishCommand: () => PublishCommand,
|
|
84
85
|
RPopCommand: () => RPopCommand,
|
|
85
86
|
RPushCommand: () => RPushCommand,
|
|
86
87
|
RPushXCommand: () => RPushXCommand,
|
|
@@ -635,6 +636,13 @@ var PTtlCommand = class extends Command {
|
|
|
635
636
|
}
|
|
636
637
|
};
|
|
637
638
|
|
|
639
|
+
// pkg/commands/publish.ts
|
|
640
|
+
var PublishCommand = class extends Command {
|
|
641
|
+
constructor(channel, message) {
|
|
642
|
+
super(["publish", channel, message]);
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
|
|
638
646
|
// pkg/commands/randomkey.ts
|
|
639
647
|
var RandomKeyCommand = class extends Command {
|
|
640
648
|
constructor() {
|
|
@@ -1001,6 +1009,12 @@ var ZPopMinCommand = class extends Command {
|
|
|
1001
1009
|
var ZRangeCommand = class extends Command {
|
|
1002
1010
|
constructor(key, min, max, opts) {
|
|
1003
1011
|
const command = ["zrange", key, min, max];
|
|
1012
|
+
if (opts == null ? void 0 : opts.byScore) {
|
|
1013
|
+
command.push("byscore");
|
|
1014
|
+
}
|
|
1015
|
+
if (opts == null ? void 0 : opts.byLex) {
|
|
1016
|
+
command.push("bylex");
|
|
1017
|
+
}
|
|
1004
1018
|
if (opts == null ? void 0 : opts.withScores) {
|
|
1005
1019
|
command.push("withscores");
|
|
1006
1020
|
}
|
|
@@ -1153,6 +1167,7 @@ module.exports = __toCommonJS(commands_exports);
|
|
|
1153
1167
|
PTtlCommand,
|
|
1154
1168
|
PersistCommand,
|
|
1155
1169
|
PingCommand,
|
|
1170
|
+
PublishCommand,
|
|
1156
1171
|
RPopCommand,
|
|
1157
1172
|
RPushCommand,
|
|
1158
1173
|
RPushXCommand,
|
package/commands.mjs
CHANGED
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
PTtlCommand,
|
|
57
57
|
PersistCommand,
|
|
58
58
|
PingCommand,
|
|
59
|
+
PublishCommand,
|
|
59
60
|
RPopCommand,
|
|
60
61
|
RPushCommand,
|
|
61
62
|
RPushXCommand,
|
|
@@ -107,7 +108,7 @@ import {
|
|
|
107
108
|
ZScanCommand,
|
|
108
109
|
ZScoreCommand,
|
|
109
110
|
ZUnionStoreCommand
|
|
110
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-HZBBCLMC.mjs";
|
|
111
112
|
import "./chunk-7YUZYRJS.mjs";
|
|
112
113
|
export {
|
|
113
114
|
AppendCommand,
|
|
@@ -167,6 +168,7 @@ export {
|
|
|
167
168
|
PTtlCommand,
|
|
168
169
|
PersistCommand,
|
|
169
170
|
PingCommand,
|
|
171
|
+
PublishCommand,
|
|
170
172
|
RPopCommand,
|
|
171
173
|
RPushCommand,
|
|
172
174
|
RPushXCommand,
|
package/fastly.d.ts
CHANGED
package/fastly.js
CHANGED
|
@@ -49,6 +49,34 @@ var UpstashError = class extends Error {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
// pkg/http.ts
|
|
53
|
+
var HttpClient = class {
|
|
54
|
+
constructor(config) {
|
|
55
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
56
|
+
this.headers = __spreadValues({
|
|
57
|
+
"Content-Type": "application/json"
|
|
58
|
+
}, config.headers);
|
|
59
|
+
this.options = config.options;
|
|
60
|
+
}
|
|
61
|
+
async request(req) {
|
|
62
|
+
var _a;
|
|
63
|
+
if (!req.path) {
|
|
64
|
+
req.path = [];
|
|
65
|
+
}
|
|
66
|
+
const res = await fetch([this.baseUrl, ...req.path].join("/"), {
|
|
67
|
+
method: "POST",
|
|
68
|
+
headers: this.headers,
|
|
69
|
+
body: JSON.stringify(req.body),
|
|
70
|
+
backend: (_a = this.options) == null ? void 0 : _a.backend
|
|
71
|
+
});
|
|
72
|
+
const body = await res.json();
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
throw new UpstashError(body.error);
|
|
75
|
+
}
|
|
76
|
+
return body;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
52
80
|
// pkg/util.ts
|
|
53
81
|
function parseRecursive(obj) {
|
|
54
82
|
const parsed = Array.isArray(obj) ? obj.map((o) => {
|
|
@@ -542,6 +570,13 @@ var PTtlCommand = class extends Command {
|
|
|
542
570
|
}
|
|
543
571
|
};
|
|
544
572
|
|
|
573
|
+
// pkg/commands/publish.ts
|
|
574
|
+
var PublishCommand = class extends Command {
|
|
575
|
+
constructor(channel, message) {
|
|
576
|
+
super(["publish", channel, message]);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
|
|
545
580
|
// pkg/commands/randomkey.ts
|
|
546
581
|
var RandomKeyCommand = class extends Command {
|
|
547
582
|
constructor() {
|
|
@@ -908,6 +943,12 @@ var ZPopMinCommand = class extends Command {
|
|
|
908
943
|
var ZRangeCommand = class extends Command {
|
|
909
944
|
constructor(key, min, max, opts) {
|
|
910
945
|
const command = ["zrange", key, min, max];
|
|
946
|
+
if (opts == null ? void 0 : opts.byScore) {
|
|
947
|
+
command.push("byscore");
|
|
948
|
+
}
|
|
949
|
+
if (opts == null ? void 0 : opts.byLex) {
|
|
950
|
+
command.push("bylex");
|
|
951
|
+
}
|
|
911
952
|
if (opts == null ? void 0 : opts.withScores) {
|
|
912
953
|
command.push("withscores");
|
|
913
954
|
}
|
|
@@ -1075,6 +1116,7 @@ var Pipeline = class {
|
|
|
1075
1116
|
this.ping = (...args) => this.chain(new PingCommand(...args));
|
|
1076
1117
|
this.psetex = (key, ttl, value) => this.chain(new PSetEXCommand(key, ttl, value));
|
|
1077
1118
|
this.pttl = (...args) => this.chain(new PTtlCommand(...args));
|
|
1119
|
+
this.publish = (...args) => this.chain(new PublishCommand(...args));
|
|
1078
1120
|
this.randomkey = () => this.chain(new RandomKeyCommand());
|
|
1079
1121
|
this.rename = (...args) => this.chain(new RenameCommand(...args));
|
|
1080
1122
|
this.renamenx = (...args) => this.chain(new RenameNXCommand(...args));
|
|
@@ -1121,7 +1163,7 @@ var Pipeline = class {
|
|
|
1121
1163
|
this.zlexcount = (...args) => this.chain(new ZLexCountCommand(...args));
|
|
1122
1164
|
this.zpopmax = (...args) => this.chain(new ZPopMaxCommand(...args));
|
|
1123
1165
|
this.zpopmin = (...args) => this.chain(new ZPopMinCommand(...args));
|
|
1124
|
-
this.zrange = (...args) => this.chain(new ZRangeCommand(
|
|
1166
|
+
this.zrange = (...args) => this.chain(new ZRangeCommand(args[0], args[1], args[2], args[3]));
|
|
1125
1167
|
this.zrank = (key, member) => this.chain(new ZRankCommand(key, member));
|
|
1126
1168
|
this.zrem = (key, ...members) => this.chain(new ZRemCommand(key, ...members));
|
|
1127
1169
|
this.zremrangebylex = (...args) => this.chain(new ZRemRangeByLexCommand(...args));
|
|
@@ -1200,6 +1242,7 @@ var Redis = class {
|
|
|
1200
1242
|
this.ping = (...args) => new PingCommand(...args).exec(this.client);
|
|
1201
1243
|
this.psetex = (key, ttl, value) => new PSetEXCommand(key, ttl, value).exec(this.client);
|
|
1202
1244
|
this.pttl = (...args) => new PTtlCommand(...args).exec(this.client);
|
|
1245
|
+
this.publish = (...args) => new PublishCommand(...args).exec(this.client);
|
|
1203
1246
|
this.randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
1204
1247
|
this.rename = (...args) => new RenameCommand(...args).exec(this.client);
|
|
1205
1248
|
this.renamenx = (...args) => new RenameNXCommand(...args).exec(this.client);
|
|
@@ -1246,7 +1289,7 @@ var Redis = class {
|
|
|
1246
1289
|
this.zlexcount = (...args) => new ZLexCountCommand(...args).exec(this.client);
|
|
1247
1290
|
this.zpopmax = (...args) => new ZPopMaxCommand(...args).exec(this.client);
|
|
1248
1291
|
this.zpopmin = (...args) => new ZPopMinCommand(...args).exec(this.client);
|
|
1249
|
-
this.zrange = (...args) => new ZRangeCommand(
|
|
1292
|
+
this.zrange = (...args) => new ZRangeCommand(args[0], args[1], args[2], args[3]).exec(this.client);
|
|
1250
1293
|
this.zrank = (key, member) => new ZRankCommand(key, member).exec(this.client);
|
|
1251
1294
|
this.zrem = (key, ...members) => new ZRemCommand(key, ...members).exec(this.client);
|
|
1252
1295
|
this.zremrangebylex = (...args) => new ZRemRangeByLexCommand(...args).exec(this.client);
|
|
@@ -1260,34 +1303,6 @@ var Redis = class {
|
|
|
1260
1303
|
}
|
|
1261
1304
|
};
|
|
1262
1305
|
|
|
1263
|
-
// pkg/http.ts
|
|
1264
|
-
var HttpClient = class {
|
|
1265
|
-
constructor(config) {
|
|
1266
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
1267
|
-
this.headers = __spreadValues({
|
|
1268
|
-
"Content-Type": "application/json"
|
|
1269
|
-
}, config.headers);
|
|
1270
|
-
this.options = config.options;
|
|
1271
|
-
}
|
|
1272
|
-
async request(req) {
|
|
1273
|
-
var _a;
|
|
1274
|
-
if (!req.path) {
|
|
1275
|
-
req.path = [];
|
|
1276
|
-
}
|
|
1277
|
-
const res = await fetch([this.baseUrl, ...req.path].join("/"), {
|
|
1278
|
-
method: "POST",
|
|
1279
|
-
headers: this.headers,
|
|
1280
|
-
body: JSON.stringify(req.body),
|
|
1281
|
-
backend: (_a = this.options) == null ? void 0 : _a.backend
|
|
1282
|
-
});
|
|
1283
|
-
const body = await res.json();
|
|
1284
|
-
if (!res.ok) {
|
|
1285
|
-
throw new UpstashError(body.error);
|
|
1286
|
-
}
|
|
1287
|
-
return body;
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
|
|
1291
1306
|
// pkg/fastly.ts
|
|
1292
1307
|
var Redis2 = class extends Redis {
|
|
1293
1308
|
constructor(config) {
|
package/fastly.mjs
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -543,6 +543,13 @@ var PTtlCommand = class extends Command {
|
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
545
|
|
|
546
|
+
// pkg/commands/publish.ts
|
|
547
|
+
var PublishCommand = class extends Command {
|
|
548
|
+
constructor(channel, message) {
|
|
549
|
+
super(["publish", channel, message]);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
|
|
546
553
|
// pkg/commands/randomkey.ts
|
|
547
554
|
var RandomKeyCommand = class extends Command {
|
|
548
555
|
constructor() {
|
|
@@ -909,6 +916,12 @@ var ZPopMinCommand = class extends Command {
|
|
|
909
916
|
var ZRangeCommand = class extends Command {
|
|
910
917
|
constructor(key, min, max, opts) {
|
|
911
918
|
const command = ["zrange", key, min, max];
|
|
919
|
+
if (opts == null ? void 0 : opts.byScore) {
|
|
920
|
+
command.push("byscore");
|
|
921
|
+
}
|
|
922
|
+
if (opts == null ? void 0 : opts.byLex) {
|
|
923
|
+
command.push("bylex");
|
|
924
|
+
}
|
|
912
925
|
if (opts == null ? void 0 : opts.withScores) {
|
|
913
926
|
command.push("withscores");
|
|
914
927
|
}
|
|
@@ -1076,6 +1089,7 @@ var Pipeline = class {
|
|
|
1076
1089
|
this.ping = (...args) => this.chain(new PingCommand(...args));
|
|
1077
1090
|
this.psetex = (key, ttl, value) => this.chain(new PSetEXCommand(key, ttl, value));
|
|
1078
1091
|
this.pttl = (...args) => this.chain(new PTtlCommand(...args));
|
|
1092
|
+
this.publish = (...args) => this.chain(new PublishCommand(...args));
|
|
1079
1093
|
this.randomkey = () => this.chain(new RandomKeyCommand());
|
|
1080
1094
|
this.rename = (...args) => this.chain(new RenameCommand(...args));
|
|
1081
1095
|
this.renamenx = (...args) => this.chain(new RenameNXCommand(...args));
|
|
@@ -1122,7 +1136,7 @@ var Pipeline = class {
|
|
|
1122
1136
|
this.zlexcount = (...args) => this.chain(new ZLexCountCommand(...args));
|
|
1123
1137
|
this.zpopmax = (...args) => this.chain(new ZPopMaxCommand(...args));
|
|
1124
1138
|
this.zpopmin = (...args) => this.chain(new ZPopMinCommand(...args));
|
|
1125
|
-
this.zrange = (...args) => this.chain(new ZRangeCommand(
|
|
1139
|
+
this.zrange = (...args) => this.chain(new ZRangeCommand(args[0], args[1], args[2], args[3]));
|
|
1126
1140
|
this.zrank = (key, member) => this.chain(new ZRankCommand(key, member));
|
|
1127
1141
|
this.zrem = (key, ...members) => this.chain(new ZRemCommand(key, ...members));
|
|
1128
1142
|
this.zremrangebylex = (...args) => this.chain(new ZRemRangeByLexCommand(...args));
|
|
@@ -1201,6 +1215,7 @@ var Redis = class {
|
|
|
1201
1215
|
this.ping = (...args) => new PingCommand(...args).exec(this.client);
|
|
1202
1216
|
this.psetex = (key, ttl, value) => new PSetEXCommand(key, ttl, value).exec(this.client);
|
|
1203
1217
|
this.pttl = (...args) => new PTtlCommand(...args).exec(this.client);
|
|
1218
|
+
this.publish = (...args) => new PublishCommand(...args).exec(this.client);
|
|
1204
1219
|
this.randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
1205
1220
|
this.rename = (...args) => new RenameCommand(...args).exec(this.client);
|
|
1206
1221
|
this.renamenx = (...args) => new RenameNXCommand(...args).exec(this.client);
|
|
@@ -1247,7 +1262,7 @@ var Redis = class {
|
|
|
1247
1262
|
this.zlexcount = (...args) => new ZLexCountCommand(...args).exec(this.client);
|
|
1248
1263
|
this.zpopmax = (...args) => new ZPopMaxCommand(...args).exec(this.client);
|
|
1249
1264
|
this.zpopmin = (...args) => new ZPopMinCommand(...args).exec(this.client);
|
|
1250
|
-
this.zrange = (...args) => new ZRangeCommand(
|
|
1265
|
+
this.zrange = (...args) => new ZRangeCommand(args[0], args[1], args[2], args[3]).exec(this.client);
|
|
1251
1266
|
this.zrank = (key, member) => new ZRankCommand(key, member).exec(this.client);
|
|
1252
1267
|
this.zrem = (key, ...members) => new ZRemCommand(key, ...members).exec(this.client);
|
|
1253
1268
|
this.zremrangebylex = (...args) => new ZRemRangeByLexCommand(...args).exec(this.client);
|
package/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Redis
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-FR62Y7XB.mjs";
|
|
4
|
+
import "./chunk-256N7RVN.mjs";
|
|
5
|
+
import "./chunk-HZBBCLMC.mjs";
|
|
6
6
|
import "./chunk-HIDCSH5S.mjs";
|
|
7
7
|
import {
|
|
8
8
|
UpstashError
|
package/nodejs.d.ts
CHANGED
package/nodejs.js
CHANGED
|
@@ -542,6 +542,13 @@ var PTtlCommand = class extends Command {
|
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
544
|
|
|
545
|
+
// pkg/commands/publish.ts
|
|
546
|
+
var PublishCommand = class extends Command {
|
|
547
|
+
constructor(channel, message) {
|
|
548
|
+
super(["publish", channel, message]);
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
|
|
545
552
|
// pkg/commands/randomkey.ts
|
|
546
553
|
var RandomKeyCommand = class extends Command {
|
|
547
554
|
constructor() {
|
|
@@ -908,6 +915,12 @@ var ZPopMinCommand = class extends Command {
|
|
|
908
915
|
var ZRangeCommand = class extends Command {
|
|
909
916
|
constructor(key, min, max, opts) {
|
|
910
917
|
const command = ["zrange", key, min, max];
|
|
918
|
+
if (opts == null ? void 0 : opts.byScore) {
|
|
919
|
+
command.push("byscore");
|
|
920
|
+
}
|
|
921
|
+
if (opts == null ? void 0 : opts.byLex) {
|
|
922
|
+
command.push("bylex");
|
|
923
|
+
}
|
|
911
924
|
if (opts == null ? void 0 : opts.withScores) {
|
|
912
925
|
command.push("withscores");
|
|
913
926
|
}
|
|
@@ -1075,6 +1088,7 @@ var Pipeline = class {
|
|
|
1075
1088
|
this.ping = (...args) => this.chain(new PingCommand(...args));
|
|
1076
1089
|
this.psetex = (key, ttl, value) => this.chain(new PSetEXCommand(key, ttl, value));
|
|
1077
1090
|
this.pttl = (...args) => this.chain(new PTtlCommand(...args));
|
|
1091
|
+
this.publish = (...args) => this.chain(new PublishCommand(...args));
|
|
1078
1092
|
this.randomkey = () => this.chain(new RandomKeyCommand());
|
|
1079
1093
|
this.rename = (...args) => this.chain(new RenameCommand(...args));
|
|
1080
1094
|
this.renamenx = (...args) => this.chain(new RenameNXCommand(...args));
|
|
@@ -1121,7 +1135,7 @@ var Pipeline = class {
|
|
|
1121
1135
|
this.zlexcount = (...args) => this.chain(new ZLexCountCommand(...args));
|
|
1122
1136
|
this.zpopmax = (...args) => this.chain(new ZPopMaxCommand(...args));
|
|
1123
1137
|
this.zpopmin = (...args) => this.chain(new ZPopMinCommand(...args));
|
|
1124
|
-
this.zrange = (...args) => this.chain(new ZRangeCommand(
|
|
1138
|
+
this.zrange = (...args) => this.chain(new ZRangeCommand(args[0], args[1], args[2], args[3]));
|
|
1125
1139
|
this.zrank = (key, member) => this.chain(new ZRankCommand(key, member));
|
|
1126
1140
|
this.zrem = (key, ...members) => this.chain(new ZRemCommand(key, ...members));
|
|
1127
1141
|
this.zremrangebylex = (...args) => this.chain(new ZRemRangeByLexCommand(...args));
|
|
@@ -1200,6 +1214,7 @@ var Redis = class {
|
|
|
1200
1214
|
this.ping = (...args) => new PingCommand(...args).exec(this.client);
|
|
1201
1215
|
this.psetex = (key, ttl, value) => new PSetEXCommand(key, ttl, value).exec(this.client);
|
|
1202
1216
|
this.pttl = (...args) => new PTtlCommand(...args).exec(this.client);
|
|
1217
|
+
this.publish = (...args) => new PublishCommand(...args).exec(this.client);
|
|
1203
1218
|
this.randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
1204
1219
|
this.rename = (...args) => new RenameCommand(...args).exec(this.client);
|
|
1205
1220
|
this.renamenx = (...args) => new RenameNXCommand(...args).exec(this.client);
|
|
@@ -1246,7 +1261,7 @@ var Redis = class {
|
|
|
1246
1261
|
this.zlexcount = (...args) => new ZLexCountCommand(...args).exec(this.client);
|
|
1247
1262
|
this.zpopmax = (...args) => new ZPopMaxCommand(...args).exec(this.client);
|
|
1248
1263
|
this.zpopmin = (...args) => new ZPopMinCommand(...args).exec(this.client);
|
|
1249
|
-
this.zrange = (...args) => new ZRangeCommand(
|
|
1264
|
+
this.zrange = (...args) => new ZRangeCommand(args[0], args[1], args[2], args[3]).exec(this.client);
|
|
1250
1265
|
this.zrank = (key, member) => new ZRankCommand(key, member).exec(this.client);
|
|
1251
1266
|
this.zrem = (key, ...members) => new ZRemCommand(key, ...members).exec(this.client);
|
|
1252
1267
|
this.zremrangebylex = (...args) => new ZRemRangeByLexCommand(...args).exec(this.client);
|
package/nodejs.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Redis
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-FR62Y7XB.mjs";
|
|
4
|
+
import "./chunk-256N7RVN.mjs";
|
|
5
|
+
import "./chunk-HZBBCLMC.mjs";
|
|
6
6
|
import "./chunk-HIDCSH5S.mjs";
|
|
7
7
|
import "./chunk-7YUZYRJS.mjs";
|
|
8
8
|
export {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/redis", "version": "v1.0
|
|
1
|
+
{ "name": "@upstash/redis", "version": "v1.1.0", "engines": { "node": ">=10" }, "description": "An HTTP/REST based Redis client built on top of Upstash REST API.", "main": "./index.js", "module": "./index.mjs", "types": "./index.d.ts", "scripts": { "test": "jest -i", "fmt": "pnpm lint && pnpm prettier --write .", "lint": "eslint --ext .ts --fix --ignore-path .gitignore .", "build": "tsup && cp package.json ./dist/ && pnpm size-limit" }, "repository": { "type": "git", "url": "git+https://github.com/upstash/upstash-redis.git" }, "keywords": [ "redis", "database", "serverless", "edge", "upstash" ], "author": "Andreas Thomas <andreas.thomas@chronark.com>", "license": "MIT", "bugs": { "url": "https://github.com/upstash/upstash-redis/issues" }, "homepage": "https://github.com/upstash/upstash-redis#readme", "directories": { "examples": "examples" }, "devDependencies": { "@jest/globals": "^27.4.6", "@size-limit/preset-small-lib": "^7.0.8", "@trivago/prettier-plugin-sort-imports": "^3.2.0", "@types/jest": "^27.4.0", "@types/node": "^17.0.8", "@typescript-eslint/eslint-plugin": "^5.9.1", "@typescript-eslint/parser": "^5.9.1", "dotenv": "^12.0.3", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "jest": "^27.4.7", "prettier": "^2.5.1", "size-limit": "^7.0.8", "ts-jest": "^27.1.3", "tsup": "^5.11.11", "typescript": "^4.5.5" }, "dependencies": { "isomorphic-fetch": "^3.0.0" }, "browser": { "isomorphic-fetch": false }, "size-limit": [ { "path": "dist/index.js", "limit": "5 KB" }, { "path": "dist/index.mjs", "limit": "5 KB" }, { "path": "dist/cloudflare.js", "limit": "5 KB" }, { "path": "dist/cloudflare.mjs", "limit": "5 KB" }, { "path": "dist/nodejs.js", "limit": "5 KB" }, { "path": "dist/nodejs.mjs", "limit": "5 KB" }, { "path": "dist/fastly.js", "limit": "5 KB" }, { "path": "dist/fastly.mjs", "limit": "5 KB" } ] }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from './http';
|
|
2
|
-
import { S as ScanCommandOptions, a as SetCommandOptions, C as CommandArgs, U as UnlinkCommand, b as ScoreMember, Z as ZAddCommandOptions, c as ZAddCommandOptionsWithIncr, d as ZInterStoreCommandOptions, e as ZRangeCommandOptions, f as ZUnionStoreCommandOptions, T as Type } from './zunionstore-
|
|
2
|
+
import { S as ScanCommandOptions, a as SetCommandOptions, C as CommandArgs, U as UnlinkCommand, b as ScoreMember, Z as ZAddCommandOptions, c as ZAddCommandOptionsWithIncr, d as ZInterStoreCommandOptions, e as ZRangeCommandOptions, f as ZUnionStoreCommandOptions, T as Type } from './zunionstore-342168a6';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
@@ -299,6 +299,10 @@ declare class Pipeline {
|
|
|
299
299
|
* @see https://redis.io/commands/pttl
|
|
300
300
|
*/
|
|
301
301
|
pttl: (key: string) => this;
|
|
302
|
+
/**
|
|
303
|
+
* @see https://redis.io/commands/publish
|
|
304
|
+
*/
|
|
305
|
+
publish: (channel: string, message: unknown) => this;
|
|
302
306
|
/**
|
|
303
307
|
* @see https://redis.io/commands/randomkey
|
|
304
308
|
*/
|
|
@@ -466,7 +470,21 @@ declare class Pipeline {
|
|
|
466
470
|
/**
|
|
467
471
|
* @see https://redis.io/commands/zrange
|
|
468
472
|
*/
|
|
469
|
-
zrange: <TData extends unknown[]>(key: string, min: number
|
|
473
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
474
|
+
key: string,
|
|
475
|
+
min: `(${string}` | `[${string}` | "-" | "+",
|
|
476
|
+
max: `(${string}` | `[${string}` | "-" | "+",
|
|
477
|
+
opts: {
|
|
478
|
+
byLex: true;
|
|
479
|
+
} & ZRangeCommandOptions
|
|
480
|
+
] | [
|
|
481
|
+
key: string,
|
|
482
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
483
|
+
max: number | `(${number}` | "-inf" | "+inf",
|
|
484
|
+
opts: {
|
|
485
|
+
byScore: true;
|
|
486
|
+
} & ZRangeCommandOptions
|
|
487
|
+
]) => this;
|
|
470
488
|
/**
|
|
471
489
|
* @see https://redis.io/commands/zrank
|
|
472
490
|
*/
|
|
@@ -767,6 +785,10 @@ declare class Redis {
|
|
|
767
785
|
* @see https://redis.io/commands/pttl
|
|
768
786
|
*/
|
|
769
787
|
pttl: (key: string) => Promise<number>;
|
|
788
|
+
/**
|
|
789
|
+
* @see https://redis.io/commands/publish
|
|
790
|
+
*/
|
|
791
|
+
publish: (channel: string, message: unknown) => Promise<number>;
|
|
770
792
|
/**
|
|
771
793
|
* @see https://redis.io/commands/randomkey
|
|
772
794
|
*/
|
|
@@ -934,7 +956,21 @@ declare class Redis {
|
|
|
934
956
|
/**
|
|
935
957
|
* @see https://redis.io/commands/zrange
|
|
936
958
|
*/
|
|
937
|
-
zrange: <TData extends unknown[]>(key: string, min: number
|
|
959
|
+
zrange: <TData extends unknown[]>(...args: [key: string, min: number, max: number, opts?: ZRangeCommandOptions] | [
|
|
960
|
+
key: string,
|
|
961
|
+
min: `(${string}` | `[${string}` | "-" | "+",
|
|
962
|
+
max: `(${string}` | `[${string}` | "-" | "+",
|
|
963
|
+
opts: {
|
|
964
|
+
byLex: true;
|
|
965
|
+
} & ZRangeCommandOptions
|
|
966
|
+
] | [
|
|
967
|
+
key: string,
|
|
968
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
969
|
+
max: number | `(${number}` | "-inf" | "+inf",
|
|
970
|
+
opts: {
|
|
971
|
+
byScore: true;
|
|
972
|
+
} & ZRangeCommandOptions
|
|
973
|
+
]) => Promise<TData>;
|
|
938
974
|
/**
|
|
939
975
|
* @see https://redis.io/commands/zrank
|
|
940
976
|
*/
|
|
@@ -127,12 +127,27 @@ declare class ZInterStoreCommand extends Command<number, number> {
|
|
|
127
127
|
|
|
128
128
|
declare type ZRangeCommandOptions = {
|
|
129
129
|
withScores?: boolean;
|
|
130
|
-
}
|
|
130
|
+
} & ({
|
|
131
|
+
byScore: true;
|
|
132
|
+
byLex?: never;
|
|
133
|
+
} | {
|
|
134
|
+
byScore?: never;
|
|
135
|
+
byLex: true;
|
|
136
|
+
} | {
|
|
137
|
+
byScore?: never;
|
|
138
|
+
byLex?: never;
|
|
139
|
+
});
|
|
131
140
|
/**
|
|
132
141
|
* @see https://redis.io/commands/zrange
|
|
133
142
|
*/
|
|
134
143
|
declare class ZRangeCommand<TData extends unknown[]> extends Command<TData, string[]> {
|
|
135
|
-
constructor(key: string, min: number
|
|
144
|
+
constructor(key: string, min: number, max: number, opts?: ZRangeCommandOptions);
|
|
145
|
+
constructor(key: string, min: `(${string}` | `[${string}` | "-" | "+", max: `(${string}` | `[${string}` | "-" | "+", opts: {
|
|
146
|
+
byLex: true;
|
|
147
|
+
} & ZRangeCommandOptions);
|
|
148
|
+
constructor(key: string, min: number | `(${number}` | "-inf" | "+inf", max: number | `(${number}` | "-inf" | "+inf", opts: {
|
|
149
|
+
byScore: true;
|
|
150
|
+
} & ZRangeCommandOptions);
|
|
136
151
|
}
|
|
137
152
|
|
|
138
153
|
declare type ZUnionStoreCommandOptions = {
|