@upstash/redis 1.2.0 → 1.3.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 +21 -0
- package/{chunk-HIDCSH5S.mjs → chunk-5LZNFEHI.mjs} +1 -3
- package/{chunk-FR62Y7XB.mjs → chunk-C2RGMNOQ.mjs} +23 -7
- package/{chunk-256N7RVN.mjs → chunk-CTSQDNTV.mjs} +16 -1
- package/{chunk-HZBBCLMC.mjs → chunk-K2UC7PHG.mjs} +66 -6
- package/cloudflare.d.ts +18 -16
- package/cloudflare.js +73 -12
- package/cloudflare.mjs +4 -6
- package/commands.d.ts +37 -3
- package/commands.js +71 -6
- package/commands.mjs +11 -1
- package/fastly.d.ts +23 -21
- package/fastly.js +73 -12
- package/fastly.mjs +4 -6
- package/http.d.ts +13 -6
- package/http.js +1 -3
- package/http.mjs +1 -1
- package/index.d.ts +5 -3
- package/index.js +98 -14
- package/index.mjs +4 -4
- package/nodejs.d.ts +46 -25
- package/nodejs.js +98 -14
- package/nodejs.mjs +4 -4
- package/package.json +1 -1
- package/{redis-a9efcf58.d.ts → redis-338577a3.d.ts} +508 -464
- package/{zunionstore-342168a6.d.ts → zunionstore-633a2e7a.d.ts} +17 -3
package/README.md
CHANGED
|
@@ -235,6 +235,27 @@ const res = new CustomGetCommand("key").exec(client)
|
|
|
235
235
|
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
+
### Additional information
|
|
239
|
+
|
|
240
|
+
#### `keepalive`
|
|
241
|
+
|
|
242
|
+
`@upstash/redis` is trying to reuse connections where possible to minimize latency. Connections can be reused if the client is
|
|
243
|
+
stored in memory and not initialized with every new function invocation. The easiest way to achieve this is by creating the client
|
|
244
|
+
outside of your handler:
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
// Nextjs api route
|
|
248
|
+
import { Redis } from "@upstash/redis"
|
|
249
|
+
|
|
250
|
+
const redis = Redis.fromEnv()
|
|
251
|
+
|
|
252
|
+
export default async function (req, res) {
|
|
253
|
+
// use redis here
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Whenever your hot lambda receives a new request the client is already initialized and the previously established connection to upstash is reused.
|
|
258
|
+
|
|
238
259
|
#### Javascript MAX_SAFE_INTEGER
|
|
239
260
|
|
|
240
261
|
Javascript can not handle numbers larger than `2^53 -1` safely and would return wrong results when trying to deserialize them.
|
|
@@ -7,9 +7,7 @@ import {
|
|
|
7
7
|
var HttpClient = class {
|
|
8
8
|
constructor(config) {
|
|
9
9
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
10
|
-
this.headers = __spreadValues({
|
|
11
|
-
"Content-Type": "application/json"
|
|
12
|
-
}, config.headers);
|
|
10
|
+
this.headers = __spreadValues({ "Content-Type": "application/json" }, config.headers);
|
|
13
11
|
this.options = config.options;
|
|
14
12
|
}
|
|
15
13
|
async request(req) {
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Redis
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CTSQDNTV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
HttpClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5LZNFEHI.mjs";
|
|
7
7
|
|
|
8
8
|
// pkg/nodejs.ts
|
|
9
|
+
import https from "https";
|
|
9
10
|
import "isomorphic-fetch";
|
|
10
11
|
var Redis2 = class extends Redis {
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
constructor(configOrRequester) {
|
|
13
|
+
if ("request" in configOrRequester) {
|
|
14
|
+
super(configOrRequester);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let agent = void 0;
|
|
18
|
+
if (typeof window === "undefined") {
|
|
19
|
+
const protocol = new URL(configOrRequester.url).protocol;
|
|
20
|
+
switch (protocol) {
|
|
21
|
+
case "https:":
|
|
22
|
+
agent = new https.Agent({ keepAlive: true });
|
|
23
|
+
break;
|
|
24
|
+
case "http:":
|
|
25
|
+
agent = new https.Agent({ keepAlive: true });
|
|
26
|
+
break;
|
|
16
27
|
}
|
|
28
|
+
}
|
|
29
|
+
const client = new HttpClient({
|
|
30
|
+
baseUrl: configOrRequester.url,
|
|
31
|
+
headers: { authorization: `Bearer ${configOrRequester.token}` },
|
|
32
|
+
options: { agent }
|
|
17
33
|
});
|
|
18
34
|
super(client);
|
|
19
35
|
}
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
DecrCommand,
|
|
9
9
|
DelCommand,
|
|
10
10
|
EchoCommand,
|
|
11
|
+
EvalCommand,
|
|
12
|
+
EvalshaCommand,
|
|
11
13
|
ExistsCommand,
|
|
12
14
|
ExpireAtCommand,
|
|
13
15
|
ExpireCommand,
|
|
@@ -78,6 +80,9 @@ import {
|
|
|
78
80
|
SUnionCommand,
|
|
79
81
|
SUnionStoreCommand,
|
|
80
82
|
ScanCommand,
|
|
83
|
+
ScriptExistsCommand,
|
|
84
|
+
ScriptFlushCommand,
|
|
85
|
+
ScriptLoadCommand,
|
|
81
86
|
SetBitCommand,
|
|
82
87
|
SetCommand,
|
|
83
88
|
SetExCommand,
|
|
@@ -107,7 +112,7 @@ import {
|
|
|
107
112
|
ZScanCommand,
|
|
108
113
|
ZScoreCommand,
|
|
109
114
|
ZUnionStoreCommand
|
|
110
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-K2UC7PHG.mjs";
|
|
111
116
|
import {
|
|
112
117
|
UpstashError
|
|
113
118
|
} from "./chunk-7YUZYRJS.mjs";
|
|
@@ -139,6 +144,8 @@ var Pipeline = class {
|
|
|
139
144
|
this.decrby = (...args) => this.chain(new DecrByCommand(...args));
|
|
140
145
|
this.del = (...args) => this.chain(new DelCommand(...args));
|
|
141
146
|
this.echo = (...args) => this.chain(new EchoCommand(...args));
|
|
147
|
+
this.eval = (...args) => this.chain(new EvalCommand(...args));
|
|
148
|
+
this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
|
|
142
149
|
this.exists = (...args) => this.chain(new ExistsCommand(...args));
|
|
143
150
|
this.expire = (...args) => this.chain(new ExpireCommand(...args));
|
|
144
151
|
this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
|
|
@@ -196,6 +203,9 @@ var Pipeline = class {
|
|
|
196
203
|
this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
|
|
197
204
|
this.scan = (...args) => this.chain(new ScanCommand(...args));
|
|
198
205
|
this.scard = (...args) => this.chain(new SCardCommand(...args));
|
|
206
|
+
this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
|
|
207
|
+
this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
|
|
208
|
+
this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
|
|
199
209
|
this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
|
|
200
210
|
this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
|
|
201
211
|
this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
|
|
@@ -265,6 +275,8 @@ var Redis = class {
|
|
|
265
275
|
this.decrby = (...args) => new DecrByCommand(...args).exec(this.client);
|
|
266
276
|
this.del = (...args) => new DelCommand(...args).exec(this.client);
|
|
267
277
|
this.echo = (...args) => new EchoCommand(...args).exec(this.client);
|
|
278
|
+
this.eval = (...args) => new EvalCommand(...args).exec(this.client);
|
|
279
|
+
this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
|
|
268
280
|
this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
|
|
269
281
|
this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
|
|
270
282
|
this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
|
|
@@ -322,6 +334,9 @@ var Redis = class {
|
|
|
322
334
|
this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
|
|
323
335
|
this.scan = (...args) => new ScanCommand(...args).exec(this.client);
|
|
324
336
|
this.scard = (...args) => new SCardCommand(...args).exec(this.client);
|
|
337
|
+
this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
|
|
338
|
+
this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
|
|
339
|
+
this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
|
|
325
340
|
this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
|
|
326
341
|
this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
|
|
327
342
|
this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
|
|
@@ -115,6 +115,20 @@ var EchoCommand = class extends Command {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
// pkg/commands/eval.ts
|
|
119
|
+
var EvalCommand = class extends Command {
|
|
120
|
+
constructor(script, keys, args) {
|
|
121
|
+
super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// pkg/commands/evalsha.ts
|
|
126
|
+
var EvalshaCommand = class extends Command {
|
|
127
|
+
constructor(sha, keys, args) {
|
|
128
|
+
super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
118
132
|
// pkg/commands/exists.ts
|
|
119
133
|
var ExistsCommand = class extends Command {
|
|
120
134
|
constructor(...keys) {
|
|
@@ -275,16 +289,18 @@ function deserialize2(fields, result) {
|
|
|
275
289
|
}
|
|
276
290
|
var HMGetCommand = class extends Command {
|
|
277
291
|
constructor(key, ...fields) {
|
|
278
|
-
super(["hmget", key, ...fields], {
|
|
279
|
-
deserialize: (result) => deserialize2(fields, result)
|
|
280
|
-
});
|
|
292
|
+
super(["hmget", key, ...fields], { deserialize: (result) => deserialize2(fields, result) });
|
|
281
293
|
}
|
|
282
294
|
};
|
|
283
295
|
|
|
284
296
|
// pkg/commands/hmset.ts
|
|
285
297
|
var HMSetCommand = class extends Command {
|
|
286
298
|
constructor(key, kv) {
|
|
287
|
-
super([
|
|
299
|
+
super([
|
|
300
|
+
"hmset",
|
|
301
|
+
key,
|
|
302
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
303
|
+
]);
|
|
288
304
|
}
|
|
289
305
|
};
|
|
290
306
|
|
|
@@ -305,7 +321,11 @@ var HScanCommand = class extends Command {
|
|
|
305
321
|
// pkg/commands/hset.ts
|
|
306
322
|
var HSetCommand = class extends Command {
|
|
307
323
|
constructor(key, kv) {
|
|
308
|
-
super([
|
|
324
|
+
super([
|
|
325
|
+
"hset",
|
|
326
|
+
key,
|
|
327
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
328
|
+
]);
|
|
309
329
|
}
|
|
310
330
|
};
|
|
311
331
|
|
|
@@ -438,7 +458,10 @@ var MGetCommand = class extends Command {
|
|
|
438
458
|
// pkg/commands/mset.ts
|
|
439
459
|
var MSetCommand = class extends Command {
|
|
440
460
|
constructor(kv) {
|
|
441
|
-
super([
|
|
461
|
+
super([
|
|
462
|
+
"mset",
|
|
463
|
+
...Object.entries(kv).flatMap(([key, value]) => [key, value])
|
|
464
|
+
]);
|
|
442
465
|
}
|
|
443
466
|
};
|
|
444
467
|
|
|
@@ -572,6 +595,38 @@ var SCardCommand = class extends Command {
|
|
|
572
595
|
}
|
|
573
596
|
};
|
|
574
597
|
|
|
598
|
+
// pkg/commands/script_exists.ts
|
|
599
|
+
var ScriptExistsCommand = class extends Command {
|
|
600
|
+
constructor(...hash) {
|
|
601
|
+
super(["script", "exists", ...hash], {
|
|
602
|
+
deserialize: (result) => {
|
|
603
|
+
const parsed = result;
|
|
604
|
+
return parsed.length === 1 ? parsed[0] : parsed;
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
// pkg/commands/script_flush.ts
|
|
611
|
+
var ScriptFlushCommand = class extends Command {
|
|
612
|
+
constructor(opts) {
|
|
613
|
+
const cmd = ["script", "flush"];
|
|
614
|
+
if (opts == null ? void 0 : opts.sync) {
|
|
615
|
+
cmd.push("sync");
|
|
616
|
+
} else if (opts == null ? void 0 : opts.async) {
|
|
617
|
+
cmd.push("async");
|
|
618
|
+
}
|
|
619
|
+
super(cmd);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
// pkg/commands/script_load.ts
|
|
624
|
+
var ScriptLoadCommand = class extends Command {
|
|
625
|
+
constructor(script) {
|
|
626
|
+
super(["script", "load", script]);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
|
|
575
630
|
// pkg/commands/sdiff.ts
|
|
576
631
|
var SDiffCommand = class extends Command {
|
|
577
632
|
constructor(key, ...keys) {
|
|
@@ -978,6 +1033,8 @@ export {
|
|
|
978
1033
|
DecrByCommand,
|
|
979
1034
|
DelCommand,
|
|
980
1035
|
EchoCommand,
|
|
1036
|
+
EvalCommand,
|
|
1037
|
+
EvalshaCommand,
|
|
981
1038
|
ExistsCommand,
|
|
982
1039
|
ExpireCommand,
|
|
983
1040
|
ExpireAtCommand,
|
|
@@ -1035,6 +1092,9 @@ export {
|
|
|
1035
1092
|
SAddCommand,
|
|
1036
1093
|
ScanCommand,
|
|
1037
1094
|
SCardCommand,
|
|
1095
|
+
ScriptExistsCommand,
|
|
1096
|
+
ScriptFlushCommand,
|
|
1097
|
+
ScriptLoadCommand,
|
|
1038
1098
|
SDiffCommand,
|
|
1039
1099
|
SDiffStoreCommand,
|
|
1040
1100
|
SetCommand,
|
package/cloudflare.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { R as Redis$1 } from './redis-
|
|
1
|
+
import { R as Redis$1 } from './redis-338577a3';
|
|
2
2
|
import './http';
|
|
3
|
-
import '
|
|
3
|
+
import 'https';
|
|
4
|
+
import 'http';
|
|
5
|
+
import './zunionstore-633a2e7a';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Connection credentials for upstash redis.
|
|
@@ -8,12 +10,12 @@ import './zunionstore-342168a6';
|
|
|
8
10
|
*/
|
|
9
11
|
declare type RedisConfigCloudflare = {
|
|
10
12
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
* UPSTASH_REDIS_REST_URL
|
|
14
|
+
*/
|
|
13
15
|
url: string;
|
|
14
16
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
* UPSTASH_REDIS_REST_TOKEN
|
|
18
|
+
*/
|
|
17
19
|
token: string;
|
|
18
20
|
};
|
|
19
21
|
/**
|
|
@@ -21,16 +23,16 @@ declare type RedisConfigCloudflare = {
|
|
|
21
23
|
*/
|
|
22
24
|
declare class Redis extends Redis$1 {
|
|
23
25
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
* Create a new redis client
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const redis = new Redis({
|
|
31
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
32
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
34
36
|
constructor(config: RedisConfigCloudflare);
|
|
35
37
|
static fromEnv(env?: {
|
|
36
38
|
UPSTASH_REDIS_REST_URL: string;
|
package/cloudflare.js
CHANGED
|
@@ -53,9 +53,7 @@ var UpstashError = class extends Error {
|
|
|
53
53
|
var HttpClient = class {
|
|
54
54
|
constructor(config) {
|
|
55
55
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
56
|
-
this.headers = __spreadValues({
|
|
57
|
-
"Content-Type": "application/json"
|
|
58
|
-
}, config.headers);
|
|
56
|
+
this.headers = __spreadValues({ "Content-Type": "application/json" }, config.headers);
|
|
59
57
|
this.options = config.options;
|
|
60
58
|
}
|
|
61
59
|
async request(req) {
|
|
@@ -190,6 +188,20 @@ var EchoCommand = class extends Command {
|
|
|
190
188
|
}
|
|
191
189
|
};
|
|
192
190
|
|
|
191
|
+
// pkg/commands/eval.ts
|
|
192
|
+
var EvalCommand = class extends Command {
|
|
193
|
+
constructor(script, keys, args) {
|
|
194
|
+
super(["eval", script, keys.length, ...keys, ...args != null ? args : []]);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// pkg/commands/evalsha.ts
|
|
199
|
+
var EvalshaCommand = class extends Command {
|
|
200
|
+
constructor(sha, keys, args) {
|
|
201
|
+
super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
193
205
|
// pkg/commands/exists.ts
|
|
194
206
|
var ExistsCommand = class extends Command {
|
|
195
207
|
constructor(...keys) {
|
|
@@ -350,16 +362,18 @@ function deserialize2(fields, result) {
|
|
|
350
362
|
}
|
|
351
363
|
var HMGetCommand = class extends Command {
|
|
352
364
|
constructor(key, ...fields) {
|
|
353
|
-
super(["hmget", key, ...fields], {
|
|
354
|
-
deserialize: (result) => deserialize2(fields, result)
|
|
355
|
-
});
|
|
365
|
+
super(["hmget", key, ...fields], { deserialize: (result) => deserialize2(fields, result) });
|
|
356
366
|
}
|
|
357
367
|
};
|
|
358
368
|
|
|
359
369
|
// pkg/commands/hmset.ts
|
|
360
370
|
var HMSetCommand = class extends Command {
|
|
361
371
|
constructor(key, kv) {
|
|
362
|
-
super([
|
|
372
|
+
super([
|
|
373
|
+
"hmset",
|
|
374
|
+
key,
|
|
375
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
376
|
+
]);
|
|
363
377
|
}
|
|
364
378
|
};
|
|
365
379
|
|
|
@@ -380,7 +394,11 @@ var HScanCommand = class extends Command {
|
|
|
380
394
|
// pkg/commands/hset.ts
|
|
381
395
|
var HSetCommand = class extends Command {
|
|
382
396
|
constructor(key, kv) {
|
|
383
|
-
super([
|
|
397
|
+
super([
|
|
398
|
+
"hset",
|
|
399
|
+
key,
|
|
400
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
401
|
+
]);
|
|
384
402
|
}
|
|
385
403
|
};
|
|
386
404
|
|
|
@@ -513,7 +531,10 @@ var MGetCommand = class extends Command {
|
|
|
513
531
|
// pkg/commands/mset.ts
|
|
514
532
|
var MSetCommand = class extends Command {
|
|
515
533
|
constructor(kv) {
|
|
516
|
-
super([
|
|
534
|
+
super([
|
|
535
|
+
"mset",
|
|
536
|
+
...Object.entries(kv).flatMap(([key, value]) => [key, value])
|
|
537
|
+
]);
|
|
517
538
|
}
|
|
518
539
|
};
|
|
519
540
|
|
|
@@ -647,6 +668,38 @@ var SCardCommand = class extends Command {
|
|
|
647
668
|
}
|
|
648
669
|
};
|
|
649
670
|
|
|
671
|
+
// pkg/commands/script_exists.ts
|
|
672
|
+
var ScriptExistsCommand = class extends Command {
|
|
673
|
+
constructor(...hash) {
|
|
674
|
+
super(["script", "exists", ...hash], {
|
|
675
|
+
deserialize: (result) => {
|
|
676
|
+
const parsed = result;
|
|
677
|
+
return parsed.length === 1 ? parsed[0] : parsed;
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
// pkg/commands/script_flush.ts
|
|
684
|
+
var ScriptFlushCommand = class extends Command {
|
|
685
|
+
constructor(opts) {
|
|
686
|
+
const cmd = ["script", "flush"];
|
|
687
|
+
if (opts == null ? void 0 : opts.sync) {
|
|
688
|
+
cmd.push("sync");
|
|
689
|
+
} else if (opts == null ? void 0 : opts.async) {
|
|
690
|
+
cmd.push("async");
|
|
691
|
+
}
|
|
692
|
+
super(cmd);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
// pkg/commands/script_load.ts
|
|
697
|
+
var ScriptLoadCommand = class extends Command {
|
|
698
|
+
constructor(script) {
|
|
699
|
+
super(["script", "load", script]);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
|
|
650
703
|
// pkg/commands/sdiff.ts
|
|
651
704
|
var SDiffCommand = class extends Command {
|
|
652
705
|
constructor(key, ...keys) {
|
|
@@ -1069,6 +1122,8 @@ var Pipeline = class {
|
|
|
1069
1122
|
this.decrby = (...args) => this.chain(new DecrByCommand(...args));
|
|
1070
1123
|
this.del = (...args) => this.chain(new DelCommand(...args));
|
|
1071
1124
|
this.echo = (...args) => this.chain(new EchoCommand(...args));
|
|
1125
|
+
this.eval = (...args) => this.chain(new EvalCommand(...args));
|
|
1126
|
+
this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
|
|
1072
1127
|
this.exists = (...args) => this.chain(new ExistsCommand(...args));
|
|
1073
1128
|
this.expire = (...args) => this.chain(new ExpireCommand(...args));
|
|
1074
1129
|
this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
|
|
@@ -1126,6 +1181,9 @@ var Pipeline = class {
|
|
|
1126
1181
|
this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
|
|
1127
1182
|
this.scan = (...args) => this.chain(new ScanCommand(...args));
|
|
1128
1183
|
this.scard = (...args) => this.chain(new SCardCommand(...args));
|
|
1184
|
+
this.scriptExists = (...args) => this.chain(new ScriptExistsCommand(...args));
|
|
1185
|
+
this.scriptFlush = (...args) => this.chain(new ScriptFlushCommand(...args));
|
|
1186
|
+
this.scriptLoad = (...args) => this.chain(new ScriptLoadCommand(...args));
|
|
1129
1187
|
this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
|
|
1130
1188
|
this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
|
|
1131
1189
|
this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
|
|
@@ -1195,6 +1253,8 @@ var Redis = class {
|
|
|
1195
1253
|
this.decrby = (...args) => new DecrByCommand(...args).exec(this.client);
|
|
1196
1254
|
this.del = (...args) => new DelCommand(...args).exec(this.client);
|
|
1197
1255
|
this.echo = (...args) => new EchoCommand(...args).exec(this.client);
|
|
1256
|
+
this.eval = (...args) => new EvalCommand(...args).exec(this.client);
|
|
1257
|
+
this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
|
|
1198
1258
|
this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
|
|
1199
1259
|
this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
|
|
1200
1260
|
this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
|
|
@@ -1252,6 +1312,9 @@ var Redis = class {
|
|
|
1252
1312
|
this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
|
|
1253
1313
|
this.scan = (...args) => new ScanCommand(...args).exec(this.client);
|
|
1254
1314
|
this.scard = (...args) => new SCardCommand(...args).exec(this.client);
|
|
1315
|
+
this.scriptExists = (...args) => new ScriptExistsCommand(...args).exec(this.client);
|
|
1316
|
+
this.scriptFlush = (...args) => new ScriptFlushCommand(...args).exec(this.client);
|
|
1317
|
+
this.scriptLoad = (...args) => new ScriptLoadCommand(...args).exec(this.client);
|
|
1255
1318
|
this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
|
|
1256
1319
|
this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
|
|
1257
1320
|
this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
|
|
@@ -1308,9 +1371,7 @@ var Redis2 = class extends Redis {
|
|
|
1308
1371
|
constructor(config) {
|
|
1309
1372
|
const client = new HttpClient({
|
|
1310
1373
|
baseUrl: config.url,
|
|
1311
|
-
headers: {
|
|
1312
|
-
authorization: `Bearer ${config.token}`
|
|
1313
|
-
}
|
|
1374
|
+
headers: { authorization: `Bearer ${config.token}` }
|
|
1314
1375
|
});
|
|
1315
1376
|
super(client);
|
|
1316
1377
|
}
|
package/cloudflare.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Redis
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-CTSQDNTV.mjs";
|
|
4
|
+
import "./chunk-K2UC7PHG.mjs";
|
|
5
5
|
import {
|
|
6
6
|
HttpClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5LZNFEHI.mjs";
|
|
8
8
|
import "./chunk-7YUZYRJS.mjs";
|
|
9
9
|
|
|
10
10
|
// pkg/cloudflare.ts
|
|
@@ -12,9 +12,7 @@ var Redis2 = class extends Redis {
|
|
|
12
12
|
constructor(config) {
|
|
13
13
|
const client = new HttpClient({
|
|
14
14
|
baseUrl: config.url,
|
|
15
|
-
headers: {
|
|
16
|
-
authorization: `Bearer ${config.token}`
|
|
17
|
-
}
|
|
15
|
+
headers: { authorization: `Bearer ${config.token}` }
|
|
18
16
|
});
|
|
19
17
|
super(client);
|
|
20
18
|
}
|
package/commands.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { h as Command, N as NonEmptyArray, S as ScanCommandOptions } from './zunionstore-633a2e7a';
|
|
2
|
+
export { h as Command, i as ScanCommand, S as ScanCommandOptions, c as ScoreMember, j as ScriptFlushCommand, a as ScriptFlushCommandOptions, k as SetCommand, b as SetCommandOptions, T as Type, l as TypeCommand, U as UnlinkCommand, m as ZAddCommand, Z as ZAddCommandOptions, d as ZAddCommandOptionsWithIncr, n as ZInterStoreCommand, e as ZInterStoreCommandOptions, o as ZRangeCommand, f as ZRangeCommandOptions, p as ZUnionStoreCommand, g as ZUnionStoreCommandOptions } from './zunionstore-633a2e7a';
|
|
3
3
|
import './http';
|
|
4
|
+
import 'https';
|
|
5
|
+
import 'http';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* @see https://redis.io/commands/append
|
|
@@ -67,6 +69,20 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
67
69
|
constructor(message: string);
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @see https://redis.io/commands/eval
|
|
74
|
+
*/
|
|
75
|
+
declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
76
|
+
constructor(script: string, keys: string[], args: TArgs);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @see https://redis.io/commands/evalsha
|
|
81
|
+
*/
|
|
82
|
+
declare class EvalshaCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
83
|
+
constructor(sha: string, keys: string[], args?: TArgs);
|
|
84
|
+
}
|
|
85
|
+
|
|
70
86
|
/**
|
|
71
87
|
* @see https://redis.io/commands/exists
|
|
72
88
|
*/
|
|
@@ -467,6 +483,24 @@ declare class SCardCommand extends Command<number, number> {
|
|
|
467
483
|
constructor(key: string);
|
|
468
484
|
}
|
|
469
485
|
|
|
486
|
+
declare type TupleOfLength<T, L extends number, R extends T[] = []> = R["length"] extends L ? R : TupleOfLength<T, L, [
|
|
487
|
+
...R,
|
|
488
|
+
T
|
|
489
|
+
]>;
|
|
490
|
+
/**
|
|
491
|
+
* @see https://redis.io/commands/script-exists
|
|
492
|
+
*/
|
|
493
|
+
declare class ScriptExistsCommand<T extends [string, ...string[]]> extends Command<T extends [string] ? string : TupleOfLength<string, T["length"]>, TupleOfLength<string, T["length"]>> {
|
|
494
|
+
constructor(...hash: T);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* @see https://redis.io/commands/script-load
|
|
499
|
+
*/
|
|
500
|
+
declare class ScriptLoadCommand extends Command<string, string> {
|
|
501
|
+
constructor(script: string);
|
|
502
|
+
}
|
|
503
|
+
|
|
470
504
|
/**
|
|
471
505
|
* @see https://redis.io/commands/sdiff
|
|
472
506
|
*/
|
|
@@ -724,4 +758,4 @@ declare class ZScoreCommand<TData> extends Command<number | null, string | null>
|
|
|
724
758
|
constructor(key: string, member: TData);
|
|
725
759
|
}
|
|
726
760
|
|
|
727
|
-
export { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PExpireAtCommand, PExpireCommand, PSetEXCommand, PTtlCommand, PersistCommand, PingCommand, PublishCommand, RPopCommand, RPushCommand, RPushXCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, SAddCommand, SCardCommand, SDiffCommand, SDiffStoreCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, SUnionCommand, SUnionStoreCommand, SetBitCommand, SetExCommand, SetNxCommand, SetRangeCommand, StrLenCommand, TimeCommand, TouchCommand, TtlCommand, ZCardCommand, ZCountCommand, ZIncrByComand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand };
|
|
761
|
+
export { 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, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PExpireAtCommand, PExpireCommand, PSetEXCommand, PTtlCommand, PersistCommand, PingCommand, PublishCommand, RPopCommand, RPushCommand, RPushXCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, SAddCommand, SCardCommand, SDiffCommand, SDiffStoreCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, SUnionCommand, SUnionStoreCommand, ScriptExistsCommand, ScriptLoadCommand, SetBitCommand, SetExCommand, SetNxCommand, SetRangeCommand, StrLenCommand, TimeCommand, TouchCommand, TtlCommand, ZCardCommand, ZCountCommand, ZIncrByComand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand };
|