@upstash/redis 1.19.3 → 1.20.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/README.md +1 -1
- package/esm/pkg/commands/command.js +12 -3
- package/esm/pkg/commands/json_arrappend.js +9 -0
- package/esm/pkg/commands/json_arrindex.js +9 -0
- package/esm/pkg/commands/json_arrinsert.js +9 -0
- package/esm/pkg/commands/json_arrlen.js +9 -0
- package/esm/pkg/commands/json_arrpop.js +9 -0
- package/esm/pkg/commands/json_arrtrim.js +12 -0
- package/esm/pkg/commands/json_clear.js +9 -0
- package/esm/pkg/commands/json_del.js +9 -0
- package/esm/pkg/commands/json_forget.js +9 -0
- package/esm/pkg/commands/json_get.js +30 -0
- package/esm/pkg/commands/json_mget.js +9 -0
- package/esm/pkg/commands/json_numincrby.js +9 -0
- package/esm/pkg/commands/json_nummultby.js +9 -0
- package/esm/pkg/commands/json_objkeys.js +9 -0
- package/esm/pkg/commands/json_objlen.js +9 -0
- package/esm/pkg/commands/json_resp.js +9 -0
- package/esm/pkg/commands/json_set.js +18 -0
- package/esm/pkg/commands/json_strappend.js +9 -0
- package/esm/pkg/commands/json_strlen.js +9 -0
- package/esm/pkg/commands/json_toggle.js +9 -0
- package/esm/pkg/commands/json_type.js +9 -0
- package/esm/pkg/commands/mod.js +22 -1
- package/esm/pkg/pipeline.js +93 -1
- package/esm/pkg/redis.js +89 -1
- package/esm/version.js +1 -1
- package/package.json +41 -16
- package/script/pkg/commands/command.js +12 -3
- package/script/pkg/commands/json_arrappend.js +13 -0
- package/script/pkg/commands/json_arrindex.js +13 -0
- package/script/pkg/commands/json_arrinsert.js +13 -0
- package/script/pkg/commands/json_arrlen.js +13 -0
- package/script/pkg/commands/json_arrpop.js +13 -0
- package/script/pkg/commands/json_arrtrim.js +16 -0
- package/script/pkg/commands/json_clear.js +13 -0
- package/script/pkg/commands/json_del.js +13 -0
- package/script/pkg/commands/json_forget.js +13 -0
- package/script/pkg/commands/json_get.js +34 -0
- package/script/pkg/commands/json_mget.js +13 -0
- package/script/pkg/commands/json_numincrby.js +13 -0
- package/script/pkg/commands/json_nummultby.js +13 -0
- package/script/pkg/commands/json_objkeys.js +13 -0
- package/script/pkg/commands/json_objlen.js +13 -0
- package/script/pkg/commands/json_resp.js +13 -0
- package/script/pkg/commands/json_set.js +22 -0
- package/script/pkg/commands/json_strappend.js +13 -0
- package/script/pkg/commands/json_strlen.js +13 -0
- package/script/pkg/commands/json_toggle.js +13 -0
- package/script/pkg/commands/json_type.js +13 -0
- package/script/pkg/commands/mod.js +22 -1
- package/script/pkg/pipeline.js +92 -0
- package/script/pkg/redis.js +88 -0
- package/script/version.js +1 -1
- package/types/pkg/commands/command.d.ts +5 -5
- package/types/pkg/commands/json_arrappend.d.ts +7 -0
- package/types/pkg/commands/json_arrindex.d.ts +13 -0
- package/types/pkg/commands/json_arrinsert.d.ts +7 -0
- package/types/pkg/commands/json_arrlen.d.ts +7 -0
- package/types/pkg/commands/json_arrpop.d.ts +7 -0
- package/types/pkg/commands/json_arrtrim.d.ts +7 -0
- package/types/pkg/commands/json_clear.d.ts +7 -0
- package/types/pkg/commands/json_del.d.ts +7 -0
- package/types/pkg/commands/json_forget.d.ts +7 -0
- package/types/pkg/commands/json_get.d.ts +15 -0
- package/types/pkg/commands/json_mget.d.ts +7 -0
- package/types/pkg/commands/json_numincrby.d.ts +7 -0
- package/types/pkg/commands/json_nummultby.d.ts +7 -0
- package/types/pkg/commands/json_objkeys.d.ts +7 -0
- package/types/pkg/commands/json_objlen.d.ts +7 -0
- package/types/pkg/commands/json_resp.d.ts +7 -0
- package/types/pkg/commands/json_set.d.ts +18 -0
- package/types/pkg/commands/json_strappend.d.ts +7 -0
- package/types/pkg/commands/json_strlen.d.ts +7 -0
- package/types/pkg/commands/json_toggle.d.ts +7 -0
- package/types/pkg/commands/json_type.d.ts +7 -0
- package/types/pkg/commands/mod.d.ts +22 -1
- package/types/pkg/commands/scan.d.ts +1 -1
- package/types/pkg/commands/script_flush.d.ts +1 -1
- package/types/pkg/commands/set.d.ts +1 -1
- package/types/pkg/commands/type.d.ts +1 -1
- package/types/pkg/commands/zadd.d.ts +3 -3
- package/types/pkg/commands/zinterstore.d.ts +1 -1
- package/types/pkg/commands/zrange.d.ts +1 -1
- package/types/pkg/commands/zunionstore.d.ts +1 -1
- package/types/pkg/http.d.ts +6 -6
- package/types/pkg/pipeline.d.ts +27 -1
- package/types/pkg/redis.d.ts +94 -11
- package/types/pkg/types.d.ts +11 -2
- package/types/platforms/cloudflare.d.ts +2 -2
- package/types/platforms/fastly.d.ts +1 -1
- package/types/platforms/node_with_fetch.d.ts +1 -1
- package/types/platforms/nodejs.d.ts +1 -1
- package/types/version.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { UpstashError } from "../error.js";
|
|
2
2
|
import { parseResponse } from "../util.js";
|
|
3
|
-
const defaultSerializer = (c) =>
|
|
3
|
+
const defaultSerializer = (c) => {
|
|
4
|
+
switch (typeof c) {
|
|
5
|
+
case "string":
|
|
6
|
+
case "number":
|
|
7
|
+
case "boolean":
|
|
8
|
+
return c;
|
|
9
|
+
default:
|
|
10
|
+
return JSON.stringify(c);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
4
13
|
/**
|
|
5
14
|
* Command offers default (de)serialization and the exec method to all commands.
|
|
6
15
|
*
|
|
@@ -37,7 +46,7 @@ export class Command {
|
|
|
37
46
|
opts.automaticDeserialization
|
|
38
47
|
? opts?.deserialize ?? parseResponse
|
|
39
48
|
: (x) => x;
|
|
40
|
-
this.command = command.map(this.serialize);
|
|
49
|
+
this.command = command.map((c) => this.serialize(c));
|
|
41
50
|
}
|
|
42
51
|
/**
|
|
43
52
|
* Execute the command using a client.
|
|
@@ -50,7 +59,7 @@ export class Command {
|
|
|
50
59
|
throw new UpstashError(error);
|
|
51
60
|
}
|
|
52
61
|
if (typeof result === "undefined") {
|
|
53
|
-
throw new Error(
|
|
62
|
+
throw new Error("Request did not return a result");
|
|
54
63
|
}
|
|
55
64
|
return this.deserialize(result);
|
|
56
65
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
4
|
+
*/
|
|
5
|
+
export class JsonArrTrimCommand extends Command {
|
|
6
|
+
constructor(cmd, opts) {
|
|
7
|
+
const path = cmd[1] ?? "$";
|
|
8
|
+
const start = cmd[2] ?? 0;
|
|
9
|
+
const stop = cmd[3] ?? 0;
|
|
10
|
+
super(["JSON.ARRTRIM", cmd[0], path, start, stop], opts);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/json.get
|
|
4
|
+
*/
|
|
5
|
+
export class JsonGetCommand extends Command {
|
|
6
|
+
constructor(cmd, opts) {
|
|
7
|
+
const command = ["JSON.GET"];
|
|
8
|
+
if (typeof cmd[1] === "string") {
|
|
9
|
+
// @ts-ignore - we know this is a string
|
|
10
|
+
command.push(...cmd);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
command.push(cmd[0]);
|
|
14
|
+
if (cmd[1]) {
|
|
15
|
+
if (cmd[1].indent) {
|
|
16
|
+
command.push("INDENT", cmd[1].indent);
|
|
17
|
+
}
|
|
18
|
+
if (cmd[1].newline) {
|
|
19
|
+
command.push("NEWLINE", cmd[1].newline);
|
|
20
|
+
}
|
|
21
|
+
if (cmd[1].space) {
|
|
22
|
+
command.push("SPACE", cmd[1].space);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// @ts-ignore - we know this is a string
|
|
26
|
+
command.push(...cmd.slice(2));
|
|
27
|
+
}
|
|
28
|
+
super(command, opts);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/json.set
|
|
4
|
+
*/
|
|
5
|
+
export class JsonSetCommand extends Command {
|
|
6
|
+
constructor(cmd, opts) {
|
|
7
|
+
const command = ["JSON.SET", cmd[0], cmd[1], cmd[2]];
|
|
8
|
+
if (cmd[3]) {
|
|
9
|
+
if (cmd[3].nx) {
|
|
10
|
+
command.push("NX");
|
|
11
|
+
}
|
|
12
|
+
else if (cmd[3].xx) {
|
|
13
|
+
command.push("XX");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
super(command, opts);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/esm/pkg/commands/mod.js
CHANGED
|
@@ -23,7 +23,6 @@ export * from "./getset.js";
|
|
|
23
23
|
export * from "./hdel.js";
|
|
24
24
|
export * from "./hexists.js";
|
|
25
25
|
export * from "./hget.js";
|
|
26
|
-
export * from "./smismember.js";
|
|
27
26
|
export * from "./hgetall.js";
|
|
28
27
|
export * from "./hincrby.js";
|
|
29
28
|
export * from "./hincrbyfloat.js";
|
|
@@ -40,6 +39,27 @@ export * from "./hvals.js";
|
|
|
40
39
|
export * from "./incr.js";
|
|
41
40
|
export * from "./incrby.js";
|
|
42
41
|
export * from "./incrbyfloat.js";
|
|
42
|
+
export * from "./json_arrappend.js";
|
|
43
|
+
export * from "./json_arrindex.js";
|
|
44
|
+
export * from "./json_arrinsert.js";
|
|
45
|
+
export * from "./json_arrlen.js";
|
|
46
|
+
export * from "./json_arrpop.js";
|
|
47
|
+
export * from "./json_arrtrim.js";
|
|
48
|
+
export * from "./json_clear.js";
|
|
49
|
+
export * from "./json_del.js";
|
|
50
|
+
export * from "./json_forget.js";
|
|
51
|
+
export * from "./json_get.js";
|
|
52
|
+
export * from "./json_mget.js";
|
|
53
|
+
export * from "./json_numincrby.js";
|
|
54
|
+
export * from "./json_nummultby.js";
|
|
55
|
+
export * from "./json_objkeys.js";
|
|
56
|
+
export * from "./json_objlen.js";
|
|
57
|
+
export * from "./json_resp.js";
|
|
58
|
+
export * from "./json_set.js";
|
|
59
|
+
export * from "./json_strappend.js";
|
|
60
|
+
export * from "./json_strlen.js";
|
|
61
|
+
export * from "./json_toggle.js";
|
|
62
|
+
export * from "./json_type.js";
|
|
43
63
|
export * from "./keys.js";
|
|
44
64
|
export * from "./lindex.js";
|
|
45
65
|
export * from "./linsert.js";
|
|
@@ -86,6 +106,7 @@ export * from "./sinter.js";
|
|
|
86
106
|
export * from "./sinterstore.js";
|
|
87
107
|
export * from "./sismember.js";
|
|
88
108
|
export * from "./smembers.js";
|
|
109
|
+
export * from "./smismember.js";
|
|
89
110
|
export * from "./smove.js";
|
|
90
111
|
export * from "./spop.js";
|
|
91
112
|
export * from "./srandmember.js";
|
package/esm/pkg/pipeline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetDelCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LMoveCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMIsMemberCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
1
|
+
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetDelCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, JsonArrAppendCommand, JsonArrIndexCommand, JsonArrInsertCommand, JsonArrLenCommand, JsonArrPopCommand, JsonArrTrimCommand, JsonClearCommand, JsonDelCommand, JsonForgetCommand, JsonGetCommand, JsonMGetCommand, JsonNumIncrByCommand, JsonNumMultByCommand, JsonObjKeysCommand, JsonObjLenCommand, JsonRespCommand, JsonSetCommand, JsonStrAppendCommand, JsonStrLenCommand, JsonToggleCommand, JsonTypeCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LMoveCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMIsMemberCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { UpstashError } from "./error.js";
|
|
3
3
|
import { ZMScoreCommand } from "./commands/zmscore.js";
|
|
4
4
|
import { HRandFieldCommand } from "./commands/hrandfield.js";
|
|
@@ -1196,4 +1196,96 @@ export class Pipeline {
|
|
|
1196
1196
|
this.commands.push(command);
|
|
1197
1197
|
return this;
|
|
1198
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* @see https://redis.io/commands/?group=json
|
|
1201
|
+
*/
|
|
1202
|
+
get json() {
|
|
1203
|
+
// For some reason we needed to define the types manually, otherwise Deno wouldn't build it
|
|
1204
|
+
return {
|
|
1205
|
+
/**
|
|
1206
|
+
* @see https://redis.io/commands/json.arrappend
|
|
1207
|
+
*/
|
|
1208
|
+
arrappend: (...args) => this.chain(new JsonArrAppendCommand(args, this.commandOptions)),
|
|
1209
|
+
/**
|
|
1210
|
+
* @see https://redis.io/commands/json.arrindex
|
|
1211
|
+
*/
|
|
1212
|
+
arrindex: (...args) => this.chain(new JsonArrIndexCommand(args, this.commandOptions)),
|
|
1213
|
+
/**
|
|
1214
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
1215
|
+
*/
|
|
1216
|
+
arrinsert: (...args) => this.chain(new JsonArrInsertCommand(args, this.commandOptions)),
|
|
1217
|
+
/**
|
|
1218
|
+
* @see https://redis.io/commands/json.arrlen
|
|
1219
|
+
*/
|
|
1220
|
+
arrlen: (...args) => this.chain(new JsonArrLenCommand(args, this.commandOptions)),
|
|
1221
|
+
/**
|
|
1222
|
+
* @see https://redis.io/commands/json.arrpop
|
|
1223
|
+
*/
|
|
1224
|
+
arrpop: (...args) => this.chain(new JsonArrPopCommand(args, this.commandOptions)),
|
|
1225
|
+
/**
|
|
1226
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
1227
|
+
*/
|
|
1228
|
+
arrtrim: (...args) => this.chain(new JsonArrTrimCommand(args, this.commandOptions)),
|
|
1229
|
+
/**
|
|
1230
|
+
* @see https://redis.io/commands/json.clear
|
|
1231
|
+
*/
|
|
1232
|
+
clear: (...args) => this.chain(new JsonClearCommand(args, this.commandOptions)),
|
|
1233
|
+
/**
|
|
1234
|
+
* @see https://redis.io/commands/json.del
|
|
1235
|
+
*/
|
|
1236
|
+
del: (...args) => this.chain(new JsonDelCommand(args, this.commandOptions)),
|
|
1237
|
+
/**
|
|
1238
|
+
* @see https://redis.io/commands/json.forget
|
|
1239
|
+
*/
|
|
1240
|
+
forget: (...args) => this.chain(new JsonForgetCommand(args, this.commandOptions)),
|
|
1241
|
+
/**
|
|
1242
|
+
* @see https://redis.io/commands/json.get
|
|
1243
|
+
*/
|
|
1244
|
+
get: (...args) => this.chain(new JsonGetCommand(args, this.commandOptions)),
|
|
1245
|
+
/**
|
|
1246
|
+
* @see https://redis.io/commands/json.mget
|
|
1247
|
+
*/
|
|
1248
|
+
mget: (...args) => this.chain(new JsonMGetCommand(args, this.commandOptions)),
|
|
1249
|
+
/**
|
|
1250
|
+
* @see https://redis.io/commands/json.numincrby
|
|
1251
|
+
*/
|
|
1252
|
+
numincrby: (...args) => this.chain(new JsonNumIncrByCommand(args, this.commandOptions)),
|
|
1253
|
+
/**
|
|
1254
|
+
* @see https://redis.io/commands/json.nummultby
|
|
1255
|
+
*/
|
|
1256
|
+
nummultby: (...args) => this.chain(new JsonNumMultByCommand(args, this.commandOptions)),
|
|
1257
|
+
/**
|
|
1258
|
+
* @see https://redis.io/commands/json.objkeys
|
|
1259
|
+
*/
|
|
1260
|
+
objkeys: (...args) => this.chain(new JsonObjKeysCommand(args, this.commandOptions)),
|
|
1261
|
+
/**
|
|
1262
|
+
* @see https://redis.io/commands/json.objlen
|
|
1263
|
+
*/
|
|
1264
|
+
objlen: (...args) => this.chain(new JsonObjLenCommand(args, this.commandOptions)),
|
|
1265
|
+
/**
|
|
1266
|
+
* @see https://redis.io/commands/json.resp
|
|
1267
|
+
*/
|
|
1268
|
+
resp: (...args) => this.chain(new JsonRespCommand(args, this.commandOptions)),
|
|
1269
|
+
/**
|
|
1270
|
+
* @see https://redis.io/commands/json.set
|
|
1271
|
+
*/
|
|
1272
|
+
set: (...args) => this.chain(new JsonSetCommand(args, this.commandOptions)),
|
|
1273
|
+
/**
|
|
1274
|
+
* @see https://redis.io/commands/json.strappend
|
|
1275
|
+
*/
|
|
1276
|
+
strappend: (...args) => this.chain(new JsonStrAppendCommand(args, this.commandOptions)),
|
|
1277
|
+
/**
|
|
1278
|
+
* @see https://redis.io/commands/json.strlen
|
|
1279
|
+
*/
|
|
1280
|
+
strlen: (...args) => this.chain(new JsonStrLenCommand(args, this.commandOptions)),
|
|
1281
|
+
/**
|
|
1282
|
+
* @see https://redis.io/commands/json.toggle
|
|
1283
|
+
*/
|
|
1284
|
+
toggle: (...args) => this.chain(new JsonToggleCommand(args, this.commandOptions)),
|
|
1285
|
+
/**
|
|
1286
|
+
* @see https://redis.io/commands/json.type
|
|
1287
|
+
*/
|
|
1288
|
+
type: (...args) => this.chain(new JsonTypeCommand(args, this.commandOptions)),
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1199
1291
|
}
|
package/esm/pkg/redis.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetDelCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HRandFieldCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LMoveCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMIsMemberCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
1
|
+
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetDelCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HRandFieldCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, JsonArrAppendCommand, JsonArrIndexCommand, JsonArrInsertCommand, JsonArrLenCommand, JsonArrPopCommand, JsonArrTrimCommand, JsonClearCommand, JsonDelCommand, JsonForgetCommand, JsonGetCommand, JsonMGetCommand, JsonNumIncrByCommand, JsonNumMultByCommand, JsonObjKeysCommand, JsonObjLenCommand, JsonRespCommand, JsonSetCommand, JsonStrAppendCommand, JsonStrLenCommand, JsonToggleCommand, JsonTypeCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LMoveCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMIsMemberCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { Pipeline } from "./pipeline.js";
|
|
3
3
|
import { Script } from "./script.js";
|
|
4
4
|
import { ZMScoreCommand } from "./commands/zmscore.js";
|
|
@@ -1194,6 +1194,94 @@ export class Redis {
|
|
|
1194
1194
|
this.opts = opts;
|
|
1195
1195
|
this.enableTelemetry = opts?.enableTelemetry ?? true;
|
|
1196
1196
|
}
|
|
1197
|
+
get json() {
|
|
1198
|
+
return {
|
|
1199
|
+
/**
|
|
1200
|
+
* @see https://redis.io/commands/json.arrappend
|
|
1201
|
+
*/
|
|
1202
|
+
arrappend: (...args) => new JsonArrAppendCommand(args, this.opts).exec(this.client),
|
|
1203
|
+
/**
|
|
1204
|
+
* @see https://redis.io/commands/json.arrindex
|
|
1205
|
+
*/
|
|
1206
|
+
arrindex: (...args) => new JsonArrIndexCommand(args, this.opts).exec(this.client),
|
|
1207
|
+
/**
|
|
1208
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
1209
|
+
*/
|
|
1210
|
+
arrinsert: (...args) => new JsonArrInsertCommand(args, this.opts).exec(this.client),
|
|
1211
|
+
/**
|
|
1212
|
+
* @see https://redis.io/commands/json.arrlen
|
|
1213
|
+
*/
|
|
1214
|
+
arrlen: (...args) => new JsonArrLenCommand(args, this.opts).exec(this.client),
|
|
1215
|
+
/**
|
|
1216
|
+
* @see https://redis.io/commands/json.arrpop
|
|
1217
|
+
*/
|
|
1218
|
+
arrpop: (...args) => new JsonArrPopCommand(args, this.opts).exec(this.client),
|
|
1219
|
+
/**
|
|
1220
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
1221
|
+
*/
|
|
1222
|
+
arrtrim: (...args) => new JsonArrTrimCommand(args, this.opts).exec(this.client),
|
|
1223
|
+
/**
|
|
1224
|
+
* @see https://redis.io/commands/json.clear
|
|
1225
|
+
*/
|
|
1226
|
+
clear: (...args) => new JsonClearCommand(args, this.opts).exec(this.client),
|
|
1227
|
+
/**
|
|
1228
|
+
* @see https://redis.io/commands/json.del
|
|
1229
|
+
*/
|
|
1230
|
+
del: (...args) => new JsonDelCommand(args, this.opts).exec(this.client),
|
|
1231
|
+
/**
|
|
1232
|
+
* @see https://redis.io/commands/json.forget
|
|
1233
|
+
*/
|
|
1234
|
+
forget: (...args) => new JsonForgetCommand(args, this.opts).exec(this.client),
|
|
1235
|
+
/**
|
|
1236
|
+
* @see https://redis.io/commands/json.get
|
|
1237
|
+
*/
|
|
1238
|
+
get: (...args) => new JsonGetCommand(args, this.opts).exec(this.client),
|
|
1239
|
+
/**
|
|
1240
|
+
* @see https://redis.io/commands/json.mget
|
|
1241
|
+
*/
|
|
1242
|
+
mget: (...args) => new JsonMGetCommand(args, this.opts).exec(this.client),
|
|
1243
|
+
/**
|
|
1244
|
+
* @see https://redis.io/commands/json.numincrby
|
|
1245
|
+
*/
|
|
1246
|
+
numincrby: (...args) => new JsonNumIncrByCommand(args, this.opts).exec(this.client),
|
|
1247
|
+
/**
|
|
1248
|
+
* @see https://redis.io/commands/json.nummultby
|
|
1249
|
+
*/
|
|
1250
|
+
nummultby: (...args) => new JsonNumMultByCommand(args, this.opts).exec(this.client),
|
|
1251
|
+
/**
|
|
1252
|
+
* @see https://redis.io/commands/json.objkeys
|
|
1253
|
+
*/
|
|
1254
|
+
objkeys: (...args) => new JsonObjKeysCommand(args, this.opts).exec(this.client),
|
|
1255
|
+
/**
|
|
1256
|
+
* @see https://redis.io/commands/json.objlen
|
|
1257
|
+
*/
|
|
1258
|
+
objlen: (...args) => new JsonObjLenCommand(args, this.opts).exec(this.client),
|
|
1259
|
+
/**
|
|
1260
|
+
* @see https://redis.io/commands/json.resp
|
|
1261
|
+
*/
|
|
1262
|
+
resp: (...args) => new JsonRespCommand(args, this.opts).exec(this.client),
|
|
1263
|
+
/**
|
|
1264
|
+
* @see https://redis.io/commands/json.set
|
|
1265
|
+
*/
|
|
1266
|
+
set: (...args) => new JsonSetCommand(args, this.opts).exec(this.client),
|
|
1267
|
+
/**
|
|
1268
|
+
* @see https://redis.io/commands/json.strappend
|
|
1269
|
+
*/
|
|
1270
|
+
strappend: (...args) => new JsonStrAppendCommand(args, this.opts).exec(this.client),
|
|
1271
|
+
/**
|
|
1272
|
+
* @see https://redis.io/commands/json.strlen
|
|
1273
|
+
*/
|
|
1274
|
+
strlen: (...args) => new JsonStrLenCommand(args, this.opts).exec(this.client),
|
|
1275
|
+
/**
|
|
1276
|
+
* @see https://redis.io/commands/json.toggle
|
|
1277
|
+
*/
|
|
1278
|
+
toggle: (...args) => new JsonToggleCommand(args, this.opts).exec(this.client),
|
|
1279
|
+
/**
|
|
1280
|
+
* @see https://redis.io/commands/json.type
|
|
1281
|
+
*/
|
|
1282
|
+
type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client),
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1197
1285
|
createScript(script) {
|
|
1198
1286
|
return new Script(this, script);
|
|
1199
1287
|
}
|
package/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "v1.
|
|
1
|
+
export const VERSION = "v1.20.0";
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"main": "./script/platforms/nodejs.js",
|
|
4
4
|
"types": "./types/platforms/nodejs.d.ts",
|
|
5
5
|
"name": "@upstash/redis",
|
|
6
|
-
"version": "v1.
|
|
6
|
+
"version": "v1.20.0",
|
|
7
7
|
"description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -35,29 +35,54 @@
|
|
|
35
35
|
},
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
|
-
"import":
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./types/platforms/nodejs.d.ts",
|
|
40
|
+
"default": "./esm/platforms/nodejs.js"
|
|
41
|
+
},
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./types/platforms/nodejs.d.ts",
|
|
44
|
+
"default": "./script/platforms/nodejs.js"
|
|
45
|
+
}
|
|
41
46
|
},
|
|
42
47
|
"./nodejs": {
|
|
43
|
-
"import":
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./types/platforms/nodejs.d.ts",
|
|
50
|
+
"default": "./esm/platforms/nodejs.js"
|
|
51
|
+
},
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./types/platforms/nodejs.d.ts",
|
|
54
|
+
"default": "./script/platforms/nodejs.js"
|
|
55
|
+
}
|
|
46
56
|
},
|
|
47
57
|
"./cloudflare": {
|
|
48
|
-
"import":
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
"import": {
|
|
59
|
+
"types": "./types/platforms/cloudflare.d.ts",
|
|
60
|
+
"default": "./esm/platforms/cloudflare.js"
|
|
61
|
+
},
|
|
62
|
+
"require": {
|
|
63
|
+
"types": "./types/platforms/cloudflare.d.ts",
|
|
64
|
+
"default": "./script/platforms/cloudflare.js"
|
|
65
|
+
}
|
|
51
66
|
},
|
|
52
67
|
"./fastly": {
|
|
53
|
-
"import":
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
"import": {
|
|
69
|
+
"types": "./types/platforms/fastly.d.ts",
|
|
70
|
+
"default": "./esm/platforms/fastly.js"
|
|
71
|
+
},
|
|
72
|
+
"require": {
|
|
73
|
+
"types": "./types/platforms/fastly.d.ts",
|
|
74
|
+
"default": "./script/platforms/fastly.js"
|
|
75
|
+
}
|
|
56
76
|
},
|
|
57
77
|
"./with-fetch": {
|
|
58
|
-
"import":
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
"import": {
|
|
79
|
+
"types": "./types/platforms/node_with_fetch.d.ts",
|
|
80
|
+
"default": "./esm/platforms/node_with_fetch.js"
|
|
81
|
+
},
|
|
82
|
+
"require": {
|
|
83
|
+
"types": "./types/platforms/node_with_fetch.d.ts",
|
|
84
|
+
"default": "./script/platforms/node_with_fetch.js"
|
|
85
|
+
}
|
|
61
86
|
}
|
|
62
87
|
}
|
|
63
88
|
}
|