@upstash/redis 0.0.0-ci.8122a6a6-20221031 → 0.0.0-ci.8132df91-20231017
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 +20 -18
- package/esm/pkg/commands/command.js +12 -3
- package/esm/pkg/commands/geo_add.js +27 -0
- package/esm/pkg/commands/getdel.js +9 -0
- package/esm/pkg/commands/hgetall.js +0 -4
- package/esm/pkg/commands/hrandfield.js +39 -0
- 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/lmove.js +9 -0
- package/esm/pkg/commands/mod.js +29 -0
- package/esm/pkg/commands/set.js +1 -1
- package/esm/pkg/commands/smismember.js +9 -0
- package/esm/pkg/commands/xadd.js +26 -0
- package/esm/pkg/commands/xrange.js +36 -0
- package/esm/pkg/commands/zdiffstore.js +9 -0
- package/esm/pkg/commands/zunion.js +30 -0
- package/esm/pkg/http.js +70 -25
- package/esm/pkg/pipeline.js +162 -7
- package/esm/pkg/redis.js +201 -2
- package/esm/platforms/cloudflare.js +10 -2
- package/esm/platforms/fastly.js +6 -0
- package/esm/platforms/node_with_fetch.js +26 -1
- package/esm/platforms/nodejs.js +23 -0
- package/esm/version.js +1 -0
- package/package.json +53 -20
- package/script/pkg/commands/command.js +12 -3
- package/script/pkg/commands/geo_add.js +31 -0
- package/script/pkg/commands/getdel.js +13 -0
- package/script/pkg/commands/hgetall.js +0 -4
- package/script/pkg/commands/hrandfield.js +43 -0
- 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/lmove.js +13 -0
- package/script/pkg/commands/mod.js +29 -0
- package/script/pkg/commands/set.js +1 -1
- package/script/pkg/commands/smismember.js +13 -0
- package/script/pkg/commands/xadd.js +30 -0
- package/script/pkg/commands/xrange.js +40 -0
- package/script/pkg/commands/zdiffstore.js +13 -0
- package/script/pkg/commands/zunion.js +34 -0
- package/script/pkg/http.js +70 -25
- package/script/pkg/pipeline.js +161 -6
- package/script/pkg/redis.js +200 -1
- package/script/platforms/cloudflare.js +10 -2
- package/script/platforms/fastly.js +6 -0
- package/script/platforms/node_with_fetch.js +26 -1
- package/script/platforms/nodejs.js +23 -0
- package/script/version.js +4 -0
- package/types/pkg/commands/command.d.ts +5 -5
- package/types/pkg/commands/geo_add.d.ts +25 -0
- package/types/pkg/commands/getdel.d.ts +7 -0
- package/types/pkg/commands/hdel.d.ts +1 -1
- package/types/pkg/commands/hrandfield.d.ts +9 -0
- 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/lmove.d.ts +12 -0
- package/types/pkg/commands/mod.d.ts +29 -0
- 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 +3 -3
- package/types/pkg/commands/smembers.d.ts +2 -2
- package/types/pkg/commands/smismember.d.ts +7 -0
- package/types/pkg/commands/type.d.ts +1 -1
- package/types/pkg/commands/xadd.d.ts +31 -0
- package/types/pkg/commands/xrange.d.ts +9 -0
- package/types/pkg/commands/zadd.d.ts +3 -3
- package/types/pkg/commands/zdiffstore.d.ts +7 -0
- package/types/pkg/commands/zinterstore.d.ts +1 -1
- package/types/pkg/commands/zrange.d.ts +1 -1
- package/types/pkg/commands/zunion.d.ts +29 -0
- package/types/pkg/commands/zunionstore.d.ts +1 -1
- package/types/pkg/http.d.ts +46 -7
- package/types/pkg/pipeline.d.ts +253 -124
- package/types/pkg/redis.d.ts +162 -14
- package/types/pkg/types.d.ts +27 -1
- package/types/platforms/cloudflare.d.ts +9 -8
- package/types/platforms/fastly.d.ts +3 -7
- package/types/platforms/node_with_fetch.d.ts +3 -22
- package/types/platforms/nodejs.d.ts +3 -7
- package/types/version.d.ts +1 -0
package/esm/pkg/http.js
CHANGED
|
@@ -25,13 +25,20 @@ export class HttpClient {
|
|
|
25
25
|
writable: true,
|
|
26
26
|
value: void 0
|
|
27
27
|
});
|
|
28
|
+
this.options = {
|
|
29
|
+
backend: config.options?.backend,
|
|
30
|
+
agent: config.agent,
|
|
31
|
+
responseEncoding: config.responseEncoding ?? "base64",
|
|
32
|
+
cache: config.cache,
|
|
33
|
+
};
|
|
28
34
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
29
35
|
this.headers = {
|
|
30
36
|
"Content-Type": "application/json",
|
|
31
|
-
"Upstash-Encoding": "base64",
|
|
32
37
|
...config.headers,
|
|
33
38
|
};
|
|
34
|
-
this.options
|
|
39
|
+
if (this.options.responseEncoding === "base64") {
|
|
40
|
+
this.headers["Upstash-Encoding"] = "base64";
|
|
41
|
+
}
|
|
35
42
|
if (typeof config?.retry === "boolean" && config?.retry === false) {
|
|
36
43
|
this.retry = {
|
|
37
44
|
attempts: 1,
|
|
@@ -46,8 +53,26 @@ export class HttpClient {
|
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
55
|
}
|
|
56
|
+
mergeTelemetry(telemetry) {
|
|
57
|
+
function merge(obj, key, value) {
|
|
58
|
+
if (!value) {
|
|
59
|
+
return obj;
|
|
60
|
+
}
|
|
61
|
+
if (obj[key]) {
|
|
62
|
+
obj[key] = [obj[key], value].join(",");
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
obj[key] = value;
|
|
66
|
+
}
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
this.headers = merge(this.headers, "Upstash-Telemetry-Runtime", telemetry.runtime);
|
|
70
|
+
this.headers = merge(this.headers, "Upstash-Telemetry-Platform", telemetry.platform);
|
|
71
|
+
this.headers = merge(this.headers, "Upstash-Telemetry-Sdk", telemetry.sdk);
|
|
72
|
+
}
|
|
49
73
|
async request(req) {
|
|
50
74
|
const requestOptions = {
|
|
75
|
+
cache: this.options.cache,
|
|
51
76
|
method: "POST",
|
|
52
77
|
headers: this.headers,
|
|
53
78
|
body: JSON.stringify(req.body),
|
|
@@ -75,42 +100,60 @@ export class HttpClient {
|
|
|
75
100
|
}
|
|
76
101
|
const body = (await res.json());
|
|
77
102
|
if (!res.ok) {
|
|
78
|
-
throw new UpstashError(body.error);
|
|
103
|
+
throw new UpstashError(`${body.error}, command was: ${JSON.stringify(req.body)}`);
|
|
79
104
|
}
|
|
80
|
-
|
|
105
|
+
if (this.options?.responseEncoding === "base64") {
|
|
106
|
+
if (Array.isArray(body)) {
|
|
107
|
+
return body.map(({ result, error }) => ({
|
|
108
|
+
result: decode(result),
|
|
109
|
+
error,
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
const result = decode(body.result);
|
|
113
|
+
return { result, error: body.error };
|
|
114
|
+
}
|
|
115
|
+
return body;
|
|
81
116
|
}
|
|
82
117
|
}
|
|
83
118
|
function base64decode(b64) {
|
|
84
119
|
let dec = "";
|
|
85
120
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Using only atob() is not enough because it doesn't work with unicode characters
|
|
123
|
+
*/
|
|
124
|
+
const binString = atob(b64);
|
|
125
|
+
const size = binString.length;
|
|
126
|
+
const bytes = new Uint8Array(size);
|
|
127
|
+
for (let i = 0; i < size; i++) {
|
|
128
|
+
bytes[i] = binString.charCodeAt(i);
|
|
129
|
+
}
|
|
130
|
+
dec = new TextDecoder().decode(bytes);
|
|
94
131
|
}
|
|
95
|
-
catch
|
|
96
|
-
|
|
97
|
-
return dec;
|
|
132
|
+
catch {
|
|
133
|
+
dec = b64;
|
|
98
134
|
}
|
|
135
|
+
return dec;
|
|
136
|
+
// try {
|
|
137
|
+
// return decodeURIComponent(dec);
|
|
138
|
+
// } catch {
|
|
139
|
+
// return dec;
|
|
140
|
+
// }
|
|
99
141
|
}
|
|
100
142
|
function decode(raw) {
|
|
101
143
|
let result = undefined;
|
|
102
|
-
switch (typeof raw
|
|
144
|
+
switch (typeof raw) {
|
|
103
145
|
case "undefined":
|
|
104
146
|
return raw;
|
|
105
|
-
case "number":
|
|
106
|
-
result = raw
|
|
147
|
+
case "number": {
|
|
148
|
+
result = raw;
|
|
107
149
|
break;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
150
|
+
}
|
|
151
|
+
case "object": {
|
|
152
|
+
if (Array.isArray(raw)) {
|
|
153
|
+
result = raw.map((v) => typeof v === "string"
|
|
111
154
|
? base64decode(v)
|
|
112
155
|
: Array.isArray(v)
|
|
113
|
-
? v.map(
|
|
156
|
+
? v.map(decode)
|
|
114
157
|
: v);
|
|
115
158
|
}
|
|
116
159
|
else {
|
|
@@ -119,11 +162,13 @@ function decode(raw) {
|
|
|
119
162
|
result = null;
|
|
120
163
|
}
|
|
121
164
|
break;
|
|
122
|
-
|
|
123
|
-
|
|
165
|
+
}
|
|
166
|
+
case "string": {
|
|
167
|
+
result = raw === "OK" ? "OK" : base64decode(raw);
|
|
124
168
|
break;
|
|
169
|
+
}
|
|
125
170
|
default:
|
|
126
171
|
break;
|
|
127
172
|
}
|
|
128
|
-
return
|
|
173
|
+
return result;
|
|
129
174
|
}
|
package/esm/pkg/pipeline.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, 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, 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, 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, ZUnionCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { UpstashError } from "./error.js";
|
|
3
3
|
import { ZMScoreCommand } from "./commands/zmscore.js";
|
|
4
|
+
import { HRandFieldCommand } from "./commands/hrandfield.js";
|
|
5
|
+
import { ZDiffStoreCommand } from "./commands/zdiffstore.js";
|
|
4
6
|
/**
|
|
5
7
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
6
8
|
* batch, instead of sending each command one by one and waiting for a response.
|
|
@@ -29,7 +31,7 @@ import { ZMScoreCommand } from "./commands/zmscore.js";
|
|
|
29
31
|
* const res = await p.set("key","value").get("key").exec()
|
|
30
32
|
* ```
|
|
31
33
|
*
|
|
32
|
-
*
|
|
34
|
+
* Return types are inferred if all commands are chained, but you can still
|
|
33
35
|
* override the response type manually:
|
|
34
36
|
* ```ts
|
|
35
37
|
* redis.pipeline()
|
|
@@ -70,9 +72,11 @@ export class Pipeline {
|
|
|
70
72
|
*
|
|
71
73
|
* Returns an array with the results of all pipelined commands.
|
|
72
74
|
*
|
|
73
|
-
* You can define a return type manually
|
|
75
|
+
* If all commands are statically chained from start to finish, types are inferred. You can still define a return type manually if necessary though:
|
|
74
76
|
* ```ts
|
|
75
|
-
* redis.pipeline()
|
|
77
|
+
* const p = redis.pipeline()
|
|
78
|
+
* p.get("key")
|
|
79
|
+
* const result = p.exec<[{ greeting: string }]>()
|
|
76
80
|
* ```
|
|
77
81
|
*/
|
|
78
82
|
Object.defineProperty(this, "exec", {
|
|
@@ -132,6 +136,15 @@ export class Pipeline {
|
|
|
132
136
|
writable: true,
|
|
133
137
|
value: (...args) => this.chain(new BitPosCommand(args, this.commandOptions))
|
|
134
138
|
});
|
|
139
|
+
/**
|
|
140
|
+
* @see https://redis.io/commands/zdiffstore
|
|
141
|
+
*/
|
|
142
|
+
Object.defineProperty(this, "zdiffstore", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
configurable: true,
|
|
145
|
+
writable: true,
|
|
146
|
+
value: (...args) => this.chain(new ZDiffStoreCommand(args, this.commandOptions))
|
|
147
|
+
});
|
|
135
148
|
/**
|
|
136
149
|
* @see https://redis.io/commands/dbsize
|
|
137
150
|
*/
|
|
@@ -258,6 +271,15 @@ export class Pipeline {
|
|
|
258
271
|
writable: true,
|
|
259
272
|
value: (...args) => this.chain(new GetBitCommand(args, this.commandOptions))
|
|
260
273
|
});
|
|
274
|
+
/**
|
|
275
|
+
* @see https://redis.io/commands/getdel
|
|
276
|
+
*/
|
|
277
|
+
Object.defineProperty(this, "getdel", {
|
|
278
|
+
enumerable: true,
|
|
279
|
+
configurable: true,
|
|
280
|
+
writable: true,
|
|
281
|
+
value: (...args) => this.chain(new GetDelCommand(args, this.commandOptions))
|
|
282
|
+
});
|
|
261
283
|
/**
|
|
262
284
|
* @see https://redis.io/commands/getrange
|
|
263
285
|
*/
|
|
@@ -366,6 +388,15 @@ export class Pipeline {
|
|
|
366
388
|
writable: true,
|
|
367
389
|
value: (key, kv) => this.chain(new HMSetCommand([key, kv], this.commandOptions))
|
|
368
390
|
});
|
|
391
|
+
/**
|
|
392
|
+
* @see https://redis.io/commands/hrandfield
|
|
393
|
+
*/
|
|
394
|
+
Object.defineProperty(this, "hrandfield", {
|
|
395
|
+
enumerable: true,
|
|
396
|
+
configurable: true,
|
|
397
|
+
writable: true,
|
|
398
|
+
value: (key, count, withValues) => this.chain(new HRandFieldCommand([key, count, withValues], this.commandOptions))
|
|
399
|
+
});
|
|
369
400
|
/**
|
|
370
401
|
* @see https://redis.io/commands/hscan
|
|
371
402
|
*/
|
|
@@ -474,6 +505,15 @@ export class Pipeline {
|
|
|
474
505
|
writable: true,
|
|
475
506
|
value: (...args) => this.chain(new LLenCommand(args, this.commandOptions))
|
|
476
507
|
});
|
|
508
|
+
/**
|
|
509
|
+
* @see https://redis.io/commands/lmove
|
|
510
|
+
*/
|
|
511
|
+
Object.defineProperty(this, "lmove", {
|
|
512
|
+
enumerable: true,
|
|
513
|
+
configurable: true,
|
|
514
|
+
writable: true,
|
|
515
|
+
value: (...args) => this.chain(new LMoveCommand(args, this.commandOptions))
|
|
516
|
+
});
|
|
477
517
|
/**
|
|
478
518
|
* @see https://redis.io/commands/lpop
|
|
479
519
|
*/
|
|
@@ -843,6 +883,15 @@ export class Pipeline {
|
|
|
843
883
|
writable: true,
|
|
844
884
|
value: (...args) => this.chain(new SMembersCommand(args, this.commandOptions))
|
|
845
885
|
});
|
|
886
|
+
/**
|
|
887
|
+
* @see https://redis.io/commands/smismember
|
|
888
|
+
*/
|
|
889
|
+
Object.defineProperty(this, "smismember", {
|
|
890
|
+
enumerable: true,
|
|
891
|
+
configurable: true,
|
|
892
|
+
writable: true,
|
|
893
|
+
value: (key, members) => this.chain(new SMIsMemberCommand([key, members], this.commandOptions))
|
|
894
|
+
});
|
|
846
895
|
/**
|
|
847
896
|
* @see https://redis.io/commands/smove
|
|
848
897
|
*/
|
|
@@ -1136,17 +1185,123 @@ export class Pipeline {
|
|
|
1136
1185
|
writable: true,
|
|
1137
1186
|
value: (...args) => this.chain(new ZUnionStoreCommand(args, this.commandOptions))
|
|
1138
1187
|
});
|
|
1188
|
+
/**
|
|
1189
|
+
* @see https://redis.io/commands/zunion
|
|
1190
|
+
*/
|
|
1191
|
+
Object.defineProperty(this, "zunion", {
|
|
1192
|
+
enumerable: true,
|
|
1193
|
+
configurable: true,
|
|
1194
|
+
writable: true,
|
|
1195
|
+
value: (...args) => this.chain(new ZUnionCommand(args, this.commandOptions))
|
|
1196
|
+
});
|
|
1139
1197
|
this.client = opts.client;
|
|
1140
|
-
this.commands = [];
|
|
1198
|
+
this.commands = []; // the TCommands generic in the class definition is only used for carrying through chained command types and should never be explicitly set when instantiating the class
|
|
1141
1199
|
this.commandOptions = opts.commandOptions;
|
|
1142
1200
|
this.multiExec = opts.multiExec ?? false;
|
|
1143
1201
|
}
|
|
1144
1202
|
/**
|
|
1145
|
-
*
|
|
1203
|
+
* Returns the length of pipeline before the execution
|
|
1204
|
+
*/
|
|
1205
|
+
length() {
|
|
1206
|
+
return this.commands.length;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Pushes a command into the pipeline and returns a chainable instance of the
|
|
1146
1210
|
* pipeline
|
|
1147
1211
|
*/
|
|
1148
1212
|
chain(command) {
|
|
1149
1213
|
this.commands.push(command);
|
|
1150
|
-
return this;
|
|
1214
|
+
return this; // TS thinks we're returning Pipeline<[]> here, because we're not creating a new instance of the class, hence the cast
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* @see https://redis.io/commands/?group=json
|
|
1218
|
+
*/
|
|
1219
|
+
get json() {
|
|
1220
|
+
return {
|
|
1221
|
+
/**
|
|
1222
|
+
* @see https://redis.io/commands/json.arrappend
|
|
1223
|
+
*/
|
|
1224
|
+
arrappend: (...args) => this.chain(new JsonArrAppendCommand(args, this.commandOptions)),
|
|
1225
|
+
/**
|
|
1226
|
+
* @see https://redis.io/commands/json.arrindex
|
|
1227
|
+
*/
|
|
1228
|
+
arrindex: (...args) => this.chain(new JsonArrIndexCommand(args, this.commandOptions)),
|
|
1229
|
+
/**
|
|
1230
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
1231
|
+
*/
|
|
1232
|
+
arrinsert: (...args) => this.chain(new JsonArrInsertCommand(args, this.commandOptions)),
|
|
1233
|
+
/**
|
|
1234
|
+
* @see https://redis.io/commands/json.arrlen
|
|
1235
|
+
*/
|
|
1236
|
+
arrlen: (...args) => this.chain(new JsonArrLenCommand(args, this.commandOptions)),
|
|
1237
|
+
/**
|
|
1238
|
+
* @see https://redis.io/commands/json.arrpop
|
|
1239
|
+
*/
|
|
1240
|
+
arrpop: (...args) => this.chain(new JsonArrPopCommand(args, this.commandOptions)),
|
|
1241
|
+
/**
|
|
1242
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
1243
|
+
*/
|
|
1244
|
+
arrtrim: (...args) => this.chain(new JsonArrTrimCommand(args, this.commandOptions)),
|
|
1245
|
+
/**
|
|
1246
|
+
* @see https://redis.io/commands/json.clear
|
|
1247
|
+
*/
|
|
1248
|
+
clear: (...args) => this.chain(new JsonClearCommand(args, this.commandOptions)),
|
|
1249
|
+
/**
|
|
1250
|
+
* @see https://redis.io/commands/json.del
|
|
1251
|
+
*/
|
|
1252
|
+
del: (...args) => this.chain(new JsonDelCommand(args, this.commandOptions)),
|
|
1253
|
+
/**
|
|
1254
|
+
* @see https://redis.io/commands/json.forget
|
|
1255
|
+
*/
|
|
1256
|
+
forget: (...args) => this.chain(new JsonForgetCommand(args, this.commandOptions)),
|
|
1257
|
+
/**
|
|
1258
|
+
* @see https://redis.io/commands/json.get
|
|
1259
|
+
*/
|
|
1260
|
+
get: (...args) => this.chain(new JsonGetCommand(args, this.commandOptions)),
|
|
1261
|
+
/**
|
|
1262
|
+
* @see https://redis.io/commands/json.mget
|
|
1263
|
+
*/
|
|
1264
|
+
mget: (...args) => this.chain(new JsonMGetCommand(args, this.commandOptions)),
|
|
1265
|
+
/**
|
|
1266
|
+
* @see https://redis.io/commands/json.numincrby
|
|
1267
|
+
*/
|
|
1268
|
+
numincrby: (...args) => this.chain(new JsonNumIncrByCommand(args, this.commandOptions)),
|
|
1269
|
+
/**
|
|
1270
|
+
* @see https://redis.io/commands/json.nummultby
|
|
1271
|
+
*/
|
|
1272
|
+
nummultby: (...args) => this.chain(new JsonNumMultByCommand(args, this.commandOptions)),
|
|
1273
|
+
/**
|
|
1274
|
+
* @see https://redis.io/commands/json.objkeys
|
|
1275
|
+
*/
|
|
1276
|
+
objkeys: (...args) => this.chain(new JsonObjKeysCommand(args, this.commandOptions)),
|
|
1277
|
+
/**
|
|
1278
|
+
* @see https://redis.io/commands/json.objlen
|
|
1279
|
+
*/
|
|
1280
|
+
objlen: (...args) => this.chain(new JsonObjLenCommand(args, this.commandOptions)),
|
|
1281
|
+
/**
|
|
1282
|
+
* @see https://redis.io/commands/json.resp
|
|
1283
|
+
*/
|
|
1284
|
+
resp: (...args) => this.chain(new JsonRespCommand(args, this.commandOptions)),
|
|
1285
|
+
/**
|
|
1286
|
+
* @see https://redis.io/commands/json.set
|
|
1287
|
+
*/
|
|
1288
|
+
set: (...args) => this.chain(new JsonSetCommand(args, this.commandOptions)),
|
|
1289
|
+
/**
|
|
1290
|
+
* @see https://redis.io/commands/json.strappend
|
|
1291
|
+
*/
|
|
1292
|
+
strappend: (...args) => this.chain(new JsonStrAppendCommand(args, this.commandOptions)),
|
|
1293
|
+
/**
|
|
1294
|
+
* @see https://redis.io/commands/json.strlen
|
|
1295
|
+
*/
|
|
1296
|
+
strlen: (...args) => this.chain(new JsonStrLenCommand(args, this.commandOptions)),
|
|
1297
|
+
/**
|
|
1298
|
+
* @see https://redis.io/commands/json.toggle
|
|
1299
|
+
*/
|
|
1300
|
+
toggle: (...args) => this.chain(new JsonToggleCommand(args, this.commandOptions)),
|
|
1301
|
+
/**
|
|
1302
|
+
* @see https://redis.io/commands/json.type
|
|
1303
|
+
*/
|
|
1304
|
+
type: (...args) => this.chain(new JsonTypeCommand(args, this.commandOptions)),
|
|
1305
|
+
};
|
|
1151
1306
|
}
|
|
1152
1307
|
}
|
package/esm/pkg/redis.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, 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, 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, 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, GeoAddCommand, 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, XAddCommand, XRangeCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionCommand, 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";
|
|
5
|
+
import { ZDiffStoreCommand } from "./commands/zdiffstore.js";
|
|
5
6
|
/**
|
|
6
7
|
* Serverless redis client for upstash.
|
|
7
8
|
*/
|
|
@@ -30,6 +31,12 @@ export class Redis {
|
|
|
30
31
|
writable: true,
|
|
31
32
|
value: void 0
|
|
32
33
|
});
|
|
34
|
+
Object.defineProperty(this, "enableTelemetry", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
33
40
|
/**
|
|
34
41
|
* Wrap a new middleware around the HTTP client.
|
|
35
42
|
*/
|
|
@@ -42,6 +49,27 @@ export class Redis {
|
|
|
42
49
|
this.client.request = (req) => middleware(req, makeRequest);
|
|
43
50
|
}
|
|
44
51
|
});
|
|
52
|
+
/**
|
|
53
|
+
* Technically this is not private, we can hide it from intellisense by doing this
|
|
54
|
+
*/
|
|
55
|
+
Object.defineProperty(this, "addTelemetry", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: (telemetry) => {
|
|
60
|
+
if (!this.enableTelemetry) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
// @ts-ignore - The `Requester` interface does not know about this method but it will be there
|
|
65
|
+
// as long as the user uses the standard HttpClient
|
|
66
|
+
this.client.mergeTelemetry(telemetry);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// ignore
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
45
73
|
/**
|
|
46
74
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
47
75
|
*
|
|
@@ -238,6 +266,15 @@ export class Redis {
|
|
|
238
266
|
writable: true,
|
|
239
267
|
value: (...args) => new GetBitCommand(args, this.opts).exec(this.client)
|
|
240
268
|
});
|
|
269
|
+
/**
|
|
270
|
+
* @see https://redis.io/commands/getdel
|
|
271
|
+
*/
|
|
272
|
+
Object.defineProperty(this, "getdel", {
|
|
273
|
+
enumerable: true,
|
|
274
|
+
configurable: true,
|
|
275
|
+
writable: true,
|
|
276
|
+
value: (...args) => new GetDelCommand(args, this.opts).exec(this.client)
|
|
277
|
+
});
|
|
241
278
|
/**
|
|
242
279
|
* @see https://redis.io/commands/getrange
|
|
243
280
|
*/
|
|
@@ -346,6 +383,16 @@ export class Redis {
|
|
|
346
383
|
writable: true,
|
|
347
384
|
value: (key, kv) => new HMSetCommand([key, kv], this.opts).exec(this.client)
|
|
348
385
|
});
|
|
386
|
+
/**
|
|
387
|
+
* @see https://redis.io/commands/hrandfield
|
|
388
|
+
*/
|
|
389
|
+
Object.defineProperty(this, "hrandfield", {
|
|
390
|
+
enumerable: true,
|
|
391
|
+
configurable: true,
|
|
392
|
+
writable: true,
|
|
393
|
+
value: (key, count, withValues) => new HRandFieldCommand([key, count, withValues], this.opts)
|
|
394
|
+
.exec(this.client)
|
|
395
|
+
});
|
|
349
396
|
/**
|
|
350
397
|
* @see https://redis.io/commands/hscan
|
|
351
398
|
*/
|
|
@@ -454,6 +501,15 @@ export class Redis {
|
|
|
454
501
|
writable: true,
|
|
455
502
|
value: (...args) => new LLenCommand(args, this.opts).exec(this.client)
|
|
456
503
|
});
|
|
504
|
+
/**
|
|
505
|
+
* @see https://redis.io/commands/lmove
|
|
506
|
+
*/
|
|
507
|
+
Object.defineProperty(this, "lmove", {
|
|
508
|
+
enumerable: true,
|
|
509
|
+
configurable: true,
|
|
510
|
+
writable: true,
|
|
511
|
+
value: (...args) => new LMoveCommand(args, this.opts).exec(this.client)
|
|
512
|
+
});
|
|
457
513
|
/**
|
|
458
514
|
* @see https://redis.io/commands/lpop
|
|
459
515
|
*/
|
|
@@ -533,7 +589,12 @@ export class Redis {
|
|
|
533
589
|
enumerable: true,
|
|
534
590
|
configurable: true,
|
|
535
591
|
writable: true,
|
|
536
|
-
value: (...args) =>
|
|
592
|
+
value: (...args) => {
|
|
593
|
+
const queries = Array.isArray(args[0])
|
|
594
|
+
? args[0]
|
|
595
|
+
: args;
|
|
596
|
+
return new MGetCommand(queries, this.opts).exec(this.client);
|
|
597
|
+
}
|
|
537
598
|
});
|
|
538
599
|
/**
|
|
539
600
|
* @see https://redis.io/commands/mset
|
|
@@ -814,6 +875,15 @@ export class Redis {
|
|
|
814
875
|
writable: true,
|
|
815
876
|
value: (key, member) => new SIsMemberCommand([key, member], this.opts).exec(this.client)
|
|
816
877
|
});
|
|
878
|
+
/**
|
|
879
|
+
* @see https://redis.io/commands/smismember
|
|
880
|
+
*/
|
|
881
|
+
Object.defineProperty(this, "smismember", {
|
|
882
|
+
enumerable: true,
|
|
883
|
+
configurable: true,
|
|
884
|
+
writable: true,
|
|
885
|
+
value: (key, members) => new SMIsMemberCommand([key, members], this.opts).exec(this.client)
|
|
886
|
+
});
|
|
817
887
|
/**
|
|
818
888
|
* @see https://redis.io/commands/smembers
|
|
819
889
|
*/
|
|
@@ -940,6 +1010,24 @@ export class Redis {
|
|
|
940
1010
|
writable: true,
|
|
941
1011
|
value: (...args) => new UnlinkCommand(args, this.opts).exec(this.client)
|
|
942
1012
|
});
|
|
1013
|
+
/**
|
|
1014
|
+
* @see https://redis.io/commands/xadd
|
|
1015
|
+
*/
|
|
1016
|
+
Object.defineProperty(this, "xadd", {
|
|
1017
|
+
enumerable: true,
|
|
1018
|
+
configurable: true,
|
|
1019
|
+
writable: true,
|
|
1020
|
+
value: (...args) => new XAddCommand(args, this.opts).exec(this.client)
|
|
1021
|
+
});
|
|
1022
|
+
/**
|
|
1023
|
+
* @see https://redis.io/commands/xrange
|
|
1024
|
+
*/
|
|
1025
|
+
Object.defineProperty(this, "xrange", {
|
|
1026
|
+
enumerable: true,
|
|
1027
|
+
configurable: true,
|
|
1028
|
+
writable: true,
|
|
1029
|
+
value: (...args) => new XRangeCommand(args, this.opts).exec(this.client)
|
|
1030
|
+
});
|
|
943
1031
|
/**
|
|
944
1032
|
* @see https://redis.io/commands/zadd
|
|
945
1033
|
*/
|
|
@@ -972,6 +1060,15 @@ export class Redis {
|
|
|
972
1060
|
writable: true,
|
|
973
1061
|
value: (...args) => new ZCountCommand(args, this.opts).exec(this.client)
|
|
974
1062
|
});
|
|
1063
|
+
/**
|
|
1064
|
+
* @see https://redis.io/commands/zdiffstore
|
|
1065
|
+
*/
|
|
1066
|
+
Object.defineProperty(this, "zdiffstore", {
|
|
1067
|
+
enumerable: true,
|
|
1068
|
+
configurable: true,
|
|
1069
|
+
writable: true,
|
|
1070
|
+
value: (...args) => new ZDiffStoreCommand(args, this.opts).exec(this.client)
|
|
1071
|
+
});
|
|
975
1072
|
/**
|
|
976
1073
|
* @see https://redis.io/commands/zincrby
|
|
977
1074
|
*/
|
|
@@ -1107,6 +1204,15 @@ export class Redis {
|
|
|
1107
1204
|
writable: true,
|
|
1108
1205
|
value: (key, member) => new ZScoreCommand([key, member], this.opts).exec(this.client)
|
|
1109
1206
|
});
|
|
1207
|
+
/**
|
|
1208
|
+
* @see https://redis.io/commands/zunion
|
|
1209
|
+
*/
|
|
1210
|
+
Object.defineProperty(this, "zunion", {
|
|
1211
|
+
enumerable: true,
|
|
1212
|
+
configurable: true,
|
|
1213
|
+
writable: true,
|
|
1214
|
+
value: (...args) => new ZUnionCommand(args, this.opts).exec(this.client)
|
|
1215
|
+
});
|
|
1110
1216
|
/**
|
|
1111
1217
|
* @see https://redis.io/commands/zunionstore
|
|
1112
1218
|
*/
|
|
@@ -1118,6 +1224,99 @@ export class Redis {
|
|
|
1118
1224
|
});
|
|
1119
1225
|
this.client = client;
|
|
1120
1226
|
this.opts = opts;
|
|
1227
|
+
this.enableTelemetry = opts?.enableTelemetry ?? true;
|
|
1228
|
+
}
|
|
1229
|
+
get json() {
|
|
1230
|
+
return {
|
|
1231
|
+
/**
|
|
1232
|
+
* @see https://redis.io/commands/json.arrappend
|
|
1233
|
+
*/
|
|
1234
|
+
arrappend: (...args) => new JsonArrAppendCommand(args, this.opts).exec(this.client),
|
|
1235
|
+
/**
|
|
1236
|
+
* @see https://redis.io/commands/json.arrindex
|
|
1237
|
+
*/
|
|
1238
|
+
arrindex: (...args) => new JsonArrIndexCommand(args, this.opts).exec(this.client),
|
|
1239
|
+
/**
|
|
1240
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
1241
|
+
*/
|
|
1242
|
+
arrinsert: (...args) => new JsonArrInsertCommand(args, this.opts).exec(this.client),
|
|
1243
|
+
/**
|
|
1244
|
+
* @see https://redis.io/commands/json.arrlen
|
|
1245
|
+
*/
|
|
1246
|
+
arrlen: (...args) => new JsonArrLenCommand(args, this.opts).exec(this.client),
|
|
1247
|
+
/**
|
|
1248
|
+
* @see https://redis.io/commands/json.arrpop
|
|
1249
|
+
*/
|
|
1250
|
+
arrpop: (...args) => new JsonArrPopCommand(args, this.opts).exec(this.client),
|
|
1251
|
+
/**
|
|
1252
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
1253
|
+
*/
|
|
1254
|
+
arrtrim: (...args) => new JsonArrTrimCommand(args, this.opts).exec(this.client),
|
|
1255
|
+
/**
|
|
1256
|
+
* @see https://redis.io/commands/json.clear
|
|
1257
|
+
*/
|
|
1258
|
+
clear: (...args) => new JsonClearCommand(args, this.opts).exec(this.client),
|
|
1259
|
+
/**
|
|
1260
|
+
* @see https://redis.io/commands/json.del
|
|
1261
|
+
*/
|
|
1262
|
+
del: (...args) => new JsonDelCommand(args, this.opts).exec(this.client),
|
|
1263
|
+
/**
|
|
1264
|
+
* @see https://redis.io/commands/json.forget
|
|
1265
|
+
*/
|
|
1266
|
+
forget: (...args) => new JsonForgetCommand(args, this.opts).exec(this.client),
|
|
1267
|
+
/**
|
|
1268
|
+
* @see https://redis.io/commands/geoadd
|
|
1269
|
+
*/
|
|
1270
|
+
geoadd: (...args) => new GeoAddCommand(args, this.opts).exec(this.client),
|
|
1271
|
+
/**
|
|
1272
|
+
* @see https://redis.io/commands/json.get
|
|
1273
|
+
*/
|
|
1274
|
+
get: (...args) => new JsonGetCommand(args, this.opts).exec(this.client),
|
|
1275
|
+
/**
|
|
1276
|
+
* @see https://redis.io/commands/json.mget
|
|
1277
|
+
*/
|
|
1278
|
+
mget: (...args) => new JsonMGetCommand(args, this.opts).exec(this.client),
|
|
1279
|
+
/**
|
|
1280
|
+
* @see https://redis.io/commands/json.numincrby
|
|
1281
|
+
*/
|
|
1282
|
+
numincrby: (...args) => new JsonNumIncrByCommand(args, this.opts).exec(this.client),
|
|
1283
|
+
/**
|
|
1284
|
+
* @see https://redis.io/commands/json.nummultby
|
|
1285
|
+
*/
|
|
1286
|
+
nummultby: (...args) => new JsonNumMultByCommand(args, this.opts).exec(this.client),
|
|
1287
|
+
/**
|
|
1288
|
+
* @see https://redis.io/commands/json.objkeys
|
|
1289
|
+
*/
|
|
1290
|
+
objkeys: (...args) => new JsonObjKeysCommand(args, this.opts).exec(this.client),
|
|
1291
|
+
/**
|
|
1292
|
+
* @see https://redis.io/commands/json.objlen
|
|
1293
|
+
*/
|
|
1294
|
+
objlen: (...args) => new JsonObjLenCommand(args, this.opts).exec(this.client),
|
|
1295
|
+
/**
|
|
1296
|
+
* @see https://redis.io/commands/json.resp
|
|
1297
|
+
*/
|
|
1298
|
+
resp: (...args) => new JsonRespCommand(args, this.opts).exec(this.client),
|
|
1299
|
+
/**
|
|
1300
|
+
* @see https://redis.io/commands/json.set
|
|
1301
|
+
*/
|
|
1302
|
+
set: (...args) => new JsonSetCommand(args, this.opts).exec(this.client),
|
|
1303
|
+
/**
|
|
1304
|
+
* @see https://redis.io/commands/json.strappend
|
|
1305
|
+
*/
|
|
1306
|
+
strappend: (...args) => new JsonStrAppendCommand(args, this.opts).exec(this.client),
|
|
1307
|
+
/**
|
|
1308
|
+
* @see https://redis.io/commands/json.strlen
|
|
1309
|
+
*/
|
|
1310
|
+
strlen: (...args) => new JsonStrLenCommand(args, this.opts).exec(this.client),
|
|
1311
|
+
/**
|
|
1312
|
+
* @see https://redis.io/commands/json.toggle
|
|
1313
|
+
*/
|
|
1314
|
+
toggle: (...args) => new JsonToggleCommand(args, this.opts).exec(this.client),
|
|
1315
|
+
/**
|
|
1316
|
+
* @see https://redis.io/commands/json.type
|
|
1317
|
+
*/
|
|
1318
|
+
type: (...args) => new JsonTypeCommand(args, this.opts).exec(this.client),
|
|
1319
|
+
};
|
|
1121
1320
|
}
|
|
1122
1321
|
createScript(script) {
|
|
1123
1322
|
return new Script(this, script);
|