@upstash/redis 1.19.3 → 1.20.0-canary.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.
Files changed (94) hide show
  1. package/README.md +1 -1
  2. package/esm/pkg/commands/command.js +12 -3
  3. package/esm/pkg/commands/json_arrappend.js +9 -0
  4. package/esm/pkg/commands/json_arrindex.js +9 -0
  5. package/esm/pkg/commands/json_arrinsert.js +9 -0
  6. package/esm/pkg/commands/json_arrlen.js +9 -0
  7. package/esm/pkg/commands/json_arrpop.js +9 -0
  8. package/esm/pkg/commands/json_arrtrim.js +12 -0
  9. package/esm/pkg/commands/json_clear.js +9 -0
  10. package/esm/pkg/commands/json_del.js +9 -0
  11. package/esm/pkg/commands/json_forget.js +9 -0
  12. package/esm/pkg/commands/json_get.js +30 -0
  13. package/esm/pkg/commands/json_mget.js +9 -0
  14. package/esm/pkg/commands/json_numincrby.js +9 -0
  15. package/esm/pkg/commands/json_nummultby.js +9 -0
  16. package/esm/pkg/commands/json_objkeys.js +9 -0
  17. package/esm/pkg/commands/json_objlen.js +9 -0
  18. package/esm/pkg/commands/json_resp.js +9 -0
  19. package/esm/pkg/commands/json_set.js +18 -0
  20. package/esm/pkg/commands/json_strappend.js +9 -0
  21. package/esm/pkg/commands/json_strlen.js +9 -0
  22. package/esm/pkg/commands/json_toggle.js +9 -0
  23. package/esm/pkg/commands/json_type.js +9 -0
  24. package/esm/pkg/commands/mod.js +22 -1
  25. package/esm/pkg/pipeline.js +93 -1
  26. package/esm/pkg/redis.js +89 -1
  27. package/esm/version.js +1 -1
  28. package/package.json +41 -16
  29. package/script/pkg/commands/command.js +12 -3
  30. package/script/pkg/commands/json_arrappend.js +13 -0
  31. package/script/pkg/commands/json_arrindex.js +13 -0
  32. package/script/pkg/commands/json_arrinsert.js +13 -0
  33. package/script/pkg/commands/json_arrlen.js +13 -0
  34. package/script/pkg/commands/json_arrpop.js +13 -0
  35. package/script/pkg/commands/json_arrtrim.js +16 -0
  36. package/script/pkg/commands/json_clear.js +13 -0
  37. package/script/pkg/commands/json_del.js +13 -0
  38. package/script/pkg/commands/json_forget.js +13 -0
  39. package/script/pkg/commands/json_get.js +34 -0
  40. package/script/pkg/commands/json_mget.js +13 -0
  41. package/script/pkg/commands/json_numincrby.js +13 -0
  42. package/script/pkg/commands/json_nummultby.js +13 -0
  43. package/script/pkg/commands/json_objkeys.js +13 -0
  44. package/script/pkg/commands/json_objlen.js +13 -0
  45. package/script/pkg/commands/json_resp.js +13 -0
  46. package/script/pkg/commands/json_set.js +22 -0
  47. package/script/pkg/commands/json_strappend.js +13 -0
  48. package/script/pkg/commands/json_strlen.js +13 -0
  49. package/script/pkg/commands/json_toggle.js +13 -0
  50. package/script/pkg/commands/json_type.js +13 -0
  51. package/script/pkg/commands/mod.js +22 -1
  52. package/script/pkg/pipeline.js +92 -0
  53. package/script/pkg/redis.js +88 -0
  54. package/script/version.js +1 -1
  55. package/types/pkg/commands/command.d.ts +5 -5
  56. package/types/pkg/commands/json_arrappend.d.ts +7 -0
  57. package/types/pkg/commands/json_arrindex.d.ts +13 -0
  58. package/types/pkg/commands/json_arrinsert.d.ts +7 -0
  59. package/types/pkg/commands/json_arrlen.d.ts +7 -0
  60. package/types/pkg/commands/json_arrpop.d.ts +7 -0
  61. package/types/pkg/commands/json_arrtrim.d.ts +7 -0
  62. package/types/pkg/commands/json_clear.d.ts +7 -0
  63. package/types/pkg/commands/json_del.d.ts +7 -0
  64. package/types/pkg/commands/json_forget.d.ts +7 -0
  65. package/types/pkg/commands/json_get.d.ts +15 -0
  66. package/types/pkg/commands/json_mget.d.ts +7 -0
  67. package/types/pkg/commands/json_numincrby.d.ts +7 -0
  68. package/types/pkg/commands/json_nummultby.d.ts +7 -0
  69. package/types/pkg/commands/json_objkeys.d.ts +7 -0
  70. package/types/pkg/commands/json_objlen.d.ts +7 -0
  71. package/types/pkg/commands/json_resp.d.ts +7 -0
  72. package/types/pkg/commands/json_set.d.ts +18 -0
  73. package/types/pkg/commands/json_strappend.d.ts +7 -0
  74. package/types/pkg/commands/json_strlen.d.ts +7 -0
  75. package/types/pkg/commands/json_toggle.d.ts +7 -0
  76. package/types/pkg/commands/json_type.d.ts +7 -0
  77. package/types/pkg/commands/mod.d.ts +22 -1
  78. package/types/pkg/commands/scan.d.ts +1 -1
  79. package/types/pkg/commands/script_flush.d.ts +1 -1
  80. package/types/pkg/commands/set.d.ts +1 -1
  81. package/types/pkg/commands/type.d.ts +1 -1
  82. package/types/pkg/commands/zadd.d.ts +3 -3
  83. package/types/pkg/commands/zinterstore.d.ts +1 -1
  84. package/types/pkg/commands/zrange.d.ts +1 -1
  85. package/types/pkg/commands/zunionstore.d.ts +1 -1
  86. package/types/pkg/http.d.ts +6 -6
  87. package/types/pkg/pipeline.d.ts +27 -1
  88. package/types/pkg/redis.d.ts +94 -11
  89. package/types/pkg/types.d.ts +11 -2
  90. package/types/platforms/cloudflare.d.ts +2 -2
  91. package/types/platforms/fastly.d.ts +1 -1
  92. package/types/platforms/node_with_fetch.d.ts +1 -1
  93. package/types/platforms/nodejs.d.ts +1 -1
  94. package/types/version.d.ts +1 -1
@@ -3,7 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Command = void 0;
4
4
  const error_js_1 = require("../error.js");
5
5
  const util_js_1 = require("../util.js");
6
- const defaultSerializer = (c) => typeof c === "string" ? c : JSON.stringify(c);
6
+ const defaultSerializer = (c) => {
7
+ switch (typeof c) {
8
+ case "string":
9
+ case "number":
10
+ case "boolean":
11
+ return c;
12
+ default:
13
+ return JSON.stringify(c);
14
+ }
15
+ };
7
16
  /**
8
17
  * Command offers default (de)serialization and the exec method to all commands.
9
18
  *
@@ -40,7 +49,7 @@ class Command {
40
49
  opts.automaticDeserialization
41
50
  ? opts?.deserialize ?? util_js_1.parseResponse
42
51
  : (x) => x;
43
- this.command = command.map(this.serialize);
52
+ this.command = command.map((c) => this.serialize(c));
44
53
  }
45
54
  /**
46
55
  * Execute the command using a client.
@@ -53,7 +62,7 @@ class Command {
53
62
  throw new error_js_1.UpstashError(error);
54
63
  }
55
64
  if (typeof result === "undefined") {
56
- throw new Error(`Request did not return a result`);
65
+ throw new Error("Request did not return a result");
57
66
  }
58
67
  return this.deserialize(result);
59
68
  }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonArrAppendCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.arrappend
7
+ */
8
+ class JsonArrAppendCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.ARRAPPEND", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonArrAppendCommand = JsonArrAppendCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonArrIndexCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.arrindex
7
+ */
8
+ class JsonArrIndexCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.ARRINDEX", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonArrIndexCommand = JsonArrIndexCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonArrInsertCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.arrinsert
7
+ */
8
+ class JsonArrInsertCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.ARRINSERT", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonArrInsertCommand = JsonArrInsertCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonArrLenCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.arrlen
7
+ */
8
+ class JsonArrLenCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.ARRLEN", cmd[0], cmd[1] ?? "$"], opts);
11
+ }
12
+ }
13
+ exports.JsonArrLenCommand = JsonArrLenCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonArrPopCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.arrpop
7
+ */
8
+ class JsonArrPopCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.ARRPOP", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonArrPopCommand = JsonArrPopCommand;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonArrTrimCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.arrtrim
7
+ */
8
+ class JsonArrTrimCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ const path = cmd[1] ?? "$";
11
+ const start = cmd[2] ?? 0;
12
+ const stop = cmd[3] ?? 0;
13
+ super(["JSON.ARRTRIM", cmd[0], path, start, stop], opts);
14
+ }
15
+ }
16
+ exports.JsonArrTrimCommand = JsonArrTrimCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonClearCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.clear
7
+ */
8
+ class JsonClearCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.CLEAR", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonClearCommand = JsonClearCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonDelCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.del
7
+ */
8
+ class JsonDelCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.DEL", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonDelCommand = JsonDelCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonForgetCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.forget
7
+ */
8
+ class JsonForgetCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.DEL", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonForgetCommand = JsonForgetCommand;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonGetCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.get
7
+ */
8
+ class JsonGetCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ const command = ["JSON.GET"];
11
+ if (typeof cmd[1] === "string") {
12
+ // @ts-ignore - we know this is a string
13
+ command.push(...cmd);
14
+ }
15
+ else {
16
+ command.push(cmd[0]);
17
+ if (cmd[1]) {
18
+ if (cmd[1].indent) {
19
+ command.push("INDENT", cmd[1].indent);
20
+ }
21
+ if (cmd[1].newline) {
22
+ command.push("NEWLINE", cmd[1].newline);
23
+ }
24
+ if (cmd[1].space) {
25
+ command.push("SPACE", cmd[1].space);
26
+ }
27
+ }
28
+ // @ts-ignore - we know this is a string
29
+ command.push(...cmd.slice(2));
30
+ }
31
+ super(command, opts);
32
+ }
33
+ }
34
+ exports.JsonGetCommand = JsonGetCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonMGetCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.mget
7
+ */
8
+ class JsonMGetCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.MGET", ...cmd[0], cmd[1]], opts);
11
+ }
12
+ }
13
+ exports.JsonMGetCommand = JsonMGetCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonNumIncrByCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.numincrby
7
+ */
8
+ class JsonNumIncrByCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.NUMINCRBY", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonNumIncrByCommand = JsonNumIncrByCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonNumMultByCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.nummultby
7
+ */
8
+ class JsonNumMultByCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.NUMMULTBY", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonNumMultByCommand = JsonNumMultByCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonObjKeysCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.objkeys
7
+ */
8
+ class JsonObjKeysCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.OBJKEYS", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonObjKeysCommand = JsonObjKeysCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonObjLenCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.objlen
7
+ */
8
+ class JsonObjLenCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.OBJLEN", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonObjLenCommand = JsonObjLenCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonRespCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.resp
7
+ */
8
+ class JsonRespCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.RESP", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonRespCommand = JsonRespCommand;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonSetCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.set
7
+ */
8
+ class JsonSetCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ const command = ["JSON.SET", cmd[0], cmd[1], cmd[2]];
11
+ if (cmd[3]) {
12
+ if (cmd[3].nx) {
13
+ command.push("NX");
14
+ }
15
+ else if (cmd[3].xx) {
16
+ command.push("XX");
17
+ }
18
+ }
19
+ super(command, opts);
20
+ }
21
+ }
22
+ exports.JsonSetCommand = JsonSetCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonStrAppendCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.strappend
7
+ */
8
+ class JsonStrAppendCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.STRAPPEND", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonStrAppendCommand = JsonStrAppendCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonStrLenCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.strlen
7
+ */
8
+ class JsonStrLenCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.STRLEN", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonStrLenCommand = JsonStrLenCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonToggleCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.toggle
7
+ */
8
+ class JsonToggleCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.TOGGLE", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonToggleCommand = JsonToggleCommand;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonTypeCommand = void 0;
4
+ const command_js_1 = require("./command.js");
5
+ /**
6
+ * @see https://redis.io/commands/json.type
7
+ */
8
+ class JsonTypeCommand extends command_js_1.Command {
9
+ constructor(cmd, opts) {
10
+ super(["JSON.TYPE", ...cmd], opts);
11
+ }
12
+ }
13
+ exports.JsonTypeCommand = JsonTypeCommand;
@@ -39,7 +39,6 @@ __exportStar(require("./getset.js"), exports);
39
39
  __exportStar(require("./hdel.js"), exports);
40
40
  __exportStar(require("./hexists.js"), exports);
41
41
  __exportStar(require("./hget.js"), exports);
42
- __exportStar(require("./smismember.js"), exports);
43
42
  __exportStar(require("./hgetall.js"), exports);
44
43
  __exportStar(require("./hincrby.js"), exports);
45
44
  __exportStar(require("./hincrbyfloat.js"), exports);
@@ -56,6 +55,27 @@ __exportStar(require("./hvals.js"), exports);
56
55
  __exportStar(require("./incr.js"), exports);
57
56
  __exportStar(require("./incrby.js"), exports);
58
57
  __exportStar(require("./incrbyfloat.js"), exports);
58
+ __exportStar(require("./json_arrappend.js"), exports);
59
+ __exportStar(require("./json_arrindex.js"), exports);
60
+ __exportStar(require("./json_arrinsert.js"), exports);
61
+ __exportStar(require("./json_arrlen.js"), exports);
62
+ __exportStar(require("./json_arrpop.js"), exports);
63
+ __exportStar(require("./json_arrtrim.js"), exports);
64
+ __exportStar(require("./json_clear.js"), exports);
65
+ __exportStar(require("./json_del.js"), exports);
66
+ __exportStar(require("./json_forget.js"), exports);
67
+ __exportStar(require("./json_get.js"), exports);
68
+ __exportStar(require("./json_mget.js"), exports);
69
+ __exportStar(require("./json_numincrby.js"), exports);
70
+ __exportStar(require("./json_nummultby.js"), exports);
71
+ __exportStar(require("./json_objkeys.js"), exports);
72
+ __exportStar(require("./json_objlen.js"), exports);
73
+ __exportStar(require("./json_resp.js"), exports);
74
+ __exportStar(require("./json_set.js"), exports);
75
+ __exportStar(require("./json_strappend.js"), exports);
76
+ __exportStar(require("./json_strlen.js"), exports);
77
+ __exportStar(require("./json_toggle.js"), exports);
78
+ __exportStar(require("./json_type.js"), exports);
59
79
  __exportStar(require("./keys.js"), exports);
60
80
  __exportStar(require("./lindex.js"), exports);
61
81
  __exportStar(require("./linsert.js"), exports);
@@ -102,6 +122,7 @@ __exportStar(require("./sinter.js"), exports);
102
122
  __exportStar(require("./sinterstore.js"), exports);
103
123
  __exportStar(require("./sismember.js"), exports);
104
124
  __exportStar(require("./smembers.js"), exports);
125
+ __exportStar(require("./smismember.js"), exports);
105
126
  __exportStar(require("./smove.js"), exports);
106
127
  __exportStar(require("./spop.js"), exports);
107
128
  __exportStar(require("./srandmember.js"), exports);
@@ -1199,5 +1199,97 @@ class Pipeline {
1199
1199
  this.commands.push(command);
1200
1200
  return this;
1201
1201
  }
1202
+ /**
1203
+ * @see https://redis.io/commands/?group=json
1204
+ */
1205
+ get json() {
1206
+ // For some reason we needed to define the types manually, otherwise Deno wouldn't build it
1207
+ return {
1208
+ /**
1209
+ * @see https://redis.io/commands/json.arrappend
1210
+ */
1211
+ arrappend: (...args) => this.chain(new mod_js_1.JsonArrAppendCommand(args, this.commandOptions)),
1212
+ /**
1213
+ * @see https://redis.io/commands/json.arrindex
1214
+ */
1215
+ arrindex: (...args) => this.chain(new mod_js_1.JsonArrIndexCommand(args, this.commandOptions)),
1216
+ /**
1217
+ * @see https://redis.io/commands/json.arrinsert
1218
+ */
1219
+ arrinsert: (...args) => this.chain(new mod_js_1.JsonArrInsertCommand(args, this.commandOptions)),
1220
+ /**
1221
+ * @see https://redis.io/commands/json.arrlen
1222
+ */
1223
+ arrlen: (...args) => this.chain(new mod_js_1.JsonArrLenCommand(args, this.commandOptions)),
1224
+ /**
1225
+ * @see https://redis.io/commands/json.arrpop
1226
+ */
1227
+ arrpop: (...args) => this.chain(new mod_js_1.JsonArrPopCommand(args, this.commandOptions)),
1228
+ /**
1229
+ * @see https://redis.io/commands/json.arrtrim
1230
+ */
1231
+ arrtrim: (...args) => this.chain(new mod_js_1.JsonArrTrimCommand(args, this.commandOptions)),
1232
+ /**
1233
+ * @see https://redis.io/commands/json.clear
1234
+ */
1235
+ clear: (...args) => this.chain(new mod_js_1.JsonClearCommand(args, this.commandOptions)),
1236
+ /**
1237
+ * @see https://redis.io/commands/json.del
1238
+ */
1239
+ del: (...args) => this.chain(new mod_js_1.JsonDelCommand(args, this.commandOptions)),
1240
+ /**
1241
+ * @see https://redis.io/commands/json.forget
1242
+ */
1243
+ forget: (...args) => this.chain(new mod_js_1.JsonForgetCommand(args, this.commandOptions)),
1244
+ /**
1245
+ * @see https://redis.io/commands/json.get
1246
+ */
1247
+ get: (...args) => this.chain(new mod_js_1.JsonGetCommand(args, this.commandOptions)),
1248
+ /**
1249
+ * @see https://redis.io/commands/json.mget
1250
+ */
1251
+ mget: (...args) => this.chain(new mod_js_1.JsonMGetCommand(args, this.commandOptions)),
1252
+ /**
1253
+ * @see https://redis.io/commands/json.numincrby
1254
+ */
1255
+ numincrby: (...args) => this.chain(new mod_js_1.JsonNumIncrByCommand(args, this.commandOptions)),
1256
+ /**
1257
+ * @see https://redis.io/commands/json.nummultby
1258
+ */
1259
+ nummultby: (...args) => this.chain(new mod_js_1.JsonNumMultByCommand(args, this.commandOptions)),
1260
+ /**
1261
+ * @see https://redis.io/commands/json.objkeys
1262
+ */
1263
+ objkeys: (...args) => this.chain(new mod_js_1.JsonObjKeysCommand(args, this.commandOptions)),
1264
+ /**
1265
+ * @see https://redis.io/commands/json.objlen
1266
+ */
1267
+ objlen: (...args) => this.chain(new mod_js_1.JsonObjLenCommand(args, this.commandOptions)),
1268
+ /**
1269
+ * @see https://redis.io/commands/json.resp
1270
+ */
1271
+ resp: (...args) => this.chain(new mod_js_1.JsonRespCommand(args, this.commandOptions)),
1272
+ /**
1273
+ * @see https://redis.io/commands/json.set
1274
+ */
1275
+ set: (...args) => this.chain(new mod_js_1.JsonSetCommand(args, this.commandOptions)),
1276
+ /**
1277
+ * @see https://redis.io/commands/json.strappend
1278
+ */
1279
+ strappend: (...args) => this.chain(new mod_js_1.JsonStrAppendCommand(args, this.commandOptions)),
1280
+ /**
1281
+ * @see https://redis.io/commands/json.strlen
1282
+ */
1283
+ strlen: (...args) => this.chain(new mod_js_1.JsonStrLenCommand(args, this.commandOptions)),
1284
+ /**
1285
+ * @see https://redis.io/commands/json.toggle
1286
+ */
1287
+ toggle: (...args) => this.chain(new mod_js_1.JsonToggleCommand(args, this.commandOptions)),
1288
+ /**
1289
+ * @see https://redis.io/commands/json.type
1290
+ */
1291
+ type: (...args) => this.chain(new mod_js_1.JsonTypeCommand(args, this.commandOptions)),
1292
+ };
1293
+ }
1202
1294
  }
1203
1295
  exports.Pipeline = Pipeline;
@@ -1197,6 +1197,94 @@ class Redis {
1197
1197
  this.opts = opts;
1198
1198
  this.enableTelemetry = opts?.enableTelemetry ?? true;
1199
1199
  }
1200
+ get json() {
1201
+ return {
1202
+ /**
1203
+ * @see https://redis.io/commands/json.arrappend
1204
+ */
1205
+ arrappend: (...args) => new mod_js_1.JsonArrAppendCommand(args, this.opts).exec(this.client),
1206
+ /**
1207
+ * @see https://redis.io/commands/json.arrindex
1208
+ */
1209
+ arrindex: (...args) => new mod_js_1.JsonArrIndexCommand(args, this.opts).exec(this.client),
1210
+ /**
1211
+ * @see https://redis.io/commands/json.arrinsert
1212
+ */
1213
+ arrinsert: (...args) => new mod_js_1.JsonArrInsertCommand(args, this.opts).exec(this.client),
1214
+ /**
1215
+ * @see https://redis.io/commands/json.arrlen
1216
+ */
1217
+ arrlen: (...args) => new mod_js_1.JsonArrLenCommand(args, this.opts).exec(this.client),
1218
+ /**
1219
+ * @see https://redis.io/commands/json.arrpop
1220
+ */
1221
+ arrpop: (...args) => new mod_js_1.JsonArrPopCommand(args, this.opts).exec(this.client),
1222
+ /**
1223
+ * @see https://redis.io/commands/json.arrtrim
1224
+ */
1225
+ arrtrim: (...args) => new mod_js_1.JsonArrTrimCommand(args, this.opts).exec(this.client),
1226
+ /**
1227
+ * @see https://redis.io/commands/json.clear
1228
+ */
1229
+ clear: (...args) => new mod_js_1.JsonClearCommand(args, this.opts).exec(this.client),
1230
+ /**
1231
+ * @see https://redis.io/commands/json.del
1232
+ */
1233
+ del: (...args) => new mod_js_1.JsonDelCommand(args, this.opts).exec(this.client),
1234
+ /**
1235
+ * @see https://redis.io/commands/json.forget
1236
+ */
1237
+ forget: (...args) => new mod_js_1.JsonForgetCommand(args, this.opts).exec(this.client),
1238
+ /**
1239
+ * @see https://redis.io/commands/json.get
1240
+ */
1241
+ get: (...args) => new mod_js_1.JsonGetCommand(args, this.opts).exec(this.client),
1242
+ /**
1243
+ * @see https://redis.io/commands/json.mget
1244
+ */
1245
+ mget: (...args) => new mod_js_1.JsonMGetCommand(args, this.opts).exec(this.client),
1246
+ /**
1247
+ * @see https://redis.io/commands/json.numincrby
1248
+ */
1249
+ numincrby: (...args) => new mod_js_1.JsonNumIncrByCommand(args, this.opts).exec(this.client),
1250
+ /**
1251
+ * @see https://redis.io/commands/json.nummultby
1252
+ */
1253
+ nummultby: (...args) => new mod_js_1.JsonNumMultByCommand(args, this.opts).exec(this.client),
1254
+ /**
1255
+ * @see https://redis.io/commands/json.objkeys
1256
+ */
1257
+ objkeys: (...args) => new mod_js_1.JsonObjKeysCommand(args, this.opts).exec(this.client),
1258
+ /**
1259
+ * @see https://redis.io/commands/json.objlen
1260
+ */
1261
+ objlen: (...args) => new mod_js_1.JsonObjLenCommand(args, this.opts).exec(this.client),
1262
+ /**
1263
+ * @see https://redis.io/commands/json.resp
1264
+ */
1265
+ resp: (...args) => new mod_js_1.JsonRespCommand(args, this.opts).exec(this.client),
1266
+ /**
1267
+ * @see https://redis.io/commands/json.set
1268
+ */
1269
+ set: (...args) => new mod_js_1.JsonSetCommand(args, this.opts).exec(this.client),
1270
+ /**
1271
+ * @see https://redis.io/commands/json.strappend
1272
+ */
1273
+ strappend: (...args) => new mod_js_1.JsonStrAppendCommand(args, this.opts).exec(this.client),
1274
+ /**
1275
+ * @see https://redis.io/commands/json.strlen
1276
+ */
1277
+ strlen: (...args) => new mod_js_1.JsonStrLenCommand(args, this.opts).exec(this.client),
1278
+ /**
1279
+ * @see https://redis.io/commands/json.toggle
1280
+ */
1281
+ toggle: (...args) => new mod_js_1.JsonToggleCommand(args, this.opts).exec(this.client),
1282
+ /**
1283
+ * @see https://redis.io/commands/json.type
1284
+ */
1285
+ type: (...args) => new mod_js_1.JsonTypeCommand(args, this.opts).exec(this.client),
1286
+ };
1287
+ }
1200
1288
  createScript(script) {
1201
1289
  return new script_js_1.Script(this, script);
1202
1290
  }
package/script/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "v1.19.3";
4
+ exports.VERSION = "v1.20.0-canary.0";
@@ -1,7 +1,7 @@
1
1
  import { Requester } from "../http.js";
2
- declare type Serialize = (data: unknown) => string;
3
- declare type Deserialize<TResult, TData> = (result: TResult) => TData;
4
- export declare type CommandOptions<TResult, TData> = {
2
+ type Serialize = (data: unknown) => string | number | boolean;
3
+ type Deserialize<TResult, TData> = (result: TResult) => TData;
4
+ export type CommandOptions<TResult, TData> = {
5
5
  /**
6
6
  * Custom deserializer
7
7
  */
@@ -20,7 +20,7 @@ export declare type CommandOptions<TResult, TData> = {
20
20
  * TResult is the raw data returned from upstash, which may need to be transformed or parsed.
21
21
  */
22
22
  export declare class Command<TResult, TData> {
23
- readonly command: string[];
23
+ readonly command: (string | number | boolean)[];
24
24
  readonly serialize: Serialize;
25
25
  readonly deserialize: Deserialize<TResult, TData>;
26
26
  /**
@@ -28,7 +28,7 @@ export declare class Command<TResult, TData> {
28
28
  *
29
29
  * You can define a custom `deserialize` function. By default we try to deserialize as json.
30
30
  */
31
- constructor(command: (string | unknown)[], opts?: CommandOptions<TResult, TData>);
31
+ constructor(command: (string | boolean | number | unknown)[], opts?: CommandOptions<TResult, TData>);
32
32
  /**
33
33
  * Execute the command using a client.
34
34
  */
@@ -0,0 +1,7 @@
1
+ import { Command, CommandOptions } from "./command.js";
2
+ /**
3
+ * @see https://redis.io/commands/json.arrappend
4
+ */
5
+ export declare class JsonArrAppendCommand<TData extends unknown[]> extends Command<(null | string)[], (null | number)[]> {
6
+ constructor(cmd: [key: string, path: string, ...values: TData], opts?: CommandOptions<(null | string)[], (null | number)[]>);
7
+ }