@upstash/redis 1.3.0-alpha.0 → 1.3.1
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-CWZSFQQQ.mjs → chunk-CTSQDNTV.mjs} +13 -1
- package/{chunk-TLMWNHIZ.mjs → chunk-K2UC7PHG.mjs} +60 -8
- package/{chunk-4PD625HD.mjs → chunk-WRHUFPCZ.mjs} +24 -7
- package/cloudflare.d.ts +18 -16
- package/cloudflare.js +66 -14
- package/cloudflare.mjs +4 -6
- package/commands.d.ts +31 -4
- package/commands.js +64 -8
- package/commands.mjs +9 -1
- package/fastly.d.ts +23 -21
- package/fastly.js +66 -14
- 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 +92 -16
- package/index.mjs +4 -4
- package/nodejs.d.ts +25 -4
- package/nodejs.js +92 -16
- package/nodejs.mjs +4 -4
- package/package.json +1 -1
- package/{redis-5b966c20.d.ts → redis-338577a3.d.ts} +506 -471
- 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) {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
DelCommand,
|
|
10
10
|
EchoCommand,
|
|
11
11
|
EvalCommand,
|
|
12
|
+
EvalshaCommand,
|
|
12
13
|
ExistsCommand,
|
|
13
14
|
ExpireAtCommand,
|
|
14
15
|
ExpireCommand,
|
|
@@ -79,6 +80,9 @@ import {
|
|
|
79
80
|
SUnionCommand,
|
|
80
81
|
SUnionStoreCommand,
|
|
81
82
|
ScanCommand,
|
|
83
|
+
ScriptExistsCommand,
|
|
84
|
+
ScriptFlushCommand,
|
|
85
|
+
ScriptLoadCommand,
|
|
82
86
|
SetBitCommand,
|
|
83
87
|
SetCommand,
|
|
84
88
|
SetExCommand,
|
|
@@ -108,7 +112,7 @@ import {
|
|
|
108
112
|
ZScanCommand,
|
|
109
113
|
ZScoreCommand,
|
|
110
114
|
ZUnionStoreCommand
|
|
111
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-K2UC7PHG.mjs";
|
|
112
116
|
import {
|
|
113
117
|
UpstashError
|
|
114
118
|
} from "./chunk-7YUZYRJS.mjs";
|
|
@@ -141,6 +145,7 @@ var Pipeline = class {
|
|
|
141
145
|
this.del = (...args) => this.chain(new DelCommand(...args));
|
|
142
146
|
this.echo = (...args) => this.chain(new EchoCommand(...args));
|
|
143
147
|
this.eval = (...args) => this.chain(new EvalCommand(...args));
|
|
148
|
+
this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
|
|
144
149
|
this.exists = (...args) => this.chain(new ExistsCommand(...args));
|
|
145
150
|
this.expire = (...args) => this.chain(new ExpireCommand(...args));
|
|
146
151
|
this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
|
|
@@ -198,6 +203,9 @@ var Pipeline = class {
|
|
|
198
203
|
this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
|
|
199
204
|
this.scan = (...args) => this.chain(new ScanCommand(...args));
|
|
200
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));
|
|
201
209
|
this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
|
|
202
210
|
this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
|
|
203
211
|
this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
|
|
@@ -268,6 +276,7 @@ var Redis = class {
|
|
|
268
276
|
this.del = (...args) => new DelCommand(...args).exec(this.client);
|
|
269
277
|
this.echo = (...args) => new EchoCommand(...args).exec(this.client);
|
|
270
278
|
this.eval = (...args) => new EvalCommand(...args).exec(this.client);
|
|
279
|
+
this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
|
|
271
280
|
this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
|
|
272
281
|
this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
|
|
273
282
|
this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
|
|
@@ -325,6 +334,9 @@ var Redis = class {
|
|
|
325
334
|
this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
|
|
326
335
|
this.scan = (...args) => new ScanCommand(...args).exec(this.client);
|
|
327
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);
|
|
328
340
|
this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
|
|
329
341
|
this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
|
|
330
342
|
this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
|
|
@@ -117,8 +117,15 @@ var EchoCommand = class extends Command {
|
|
|
117
117
|
|
|
118
118
|
// pkg/commands/eval.ts
|
|
119
119
|
var EvalCommand = class extends Command {
|
|
120
|
-
constructor(script,
|
|
121
|
-
super(["eval", script,
|
|
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 : []]);
|
|
122
129
|
}
|
|
123
130
|
};
|
|
124
131
|
|
|
@@ -282,16 +289,18 @@ function deserialize2(fields, result) {
|
|
|
282
289
|
}
|
|
283
290
|
var HMGetCommand = class extends Command {
|
|
284
291
|
constructor(key, ...fields) {
|
|
285
|
-
super(["hmget", key, ...fields], {
|
|
286
|
-
deserialize: (result) => deserialize2(fields, result)
|
|
287
|
-
});
|
|
292
|
+
super(["hmget", key, ...fields], { deserialize: (result) => deserialize2(fields, result) });
|
|
288
293
|
}
|
|
289
294
|
};
|
|
290
295
|
|
|
291
296
|
// pkg/commands/hmset.ts
|
|
292
297
|
var HMSetCommand = class extends Command {
|
|
293
298
|
constructor(key, kv) {
|
|
294
|
-
super([
|
|
299
|
+
super([
|
|
300
|
+
"hmset",
|
|
301
|
+
key,
|
|
302
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
303
|
+
]);
|
|
295
304
|
}
|
|
296
305
|
};
|
|
297
306
|
|
|
@@ -312,7 +321,11 @@ var HScanCommand = class extends Command {
|
|
|
312
321
|
// pkg/commands/hset.ts
|
|
313
322
|
var HSetCommand = class extends Command {
|
|
314
323
|
constructor(key, kv) {
|
|
315
|
-
super([
|
|
324
|
+
super([
|
|
325
|
+
"hset",
|
|
326
|
+
key,
|
|
327
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
328
|
+
]);
|
|
316
329
|
}
|
|
317
330
|
};
|
|
318
331
|
|
|
@@ -445,7 +458,10 @@ var MGetCommand = class extends Command {
|
|
|
445
458
|
// pkg/commands/mset.ts
|
|
446
459
|
var MSetCommand = class extends Command {
|
|
447
460
|
constructor(kv) {
|
|
448
|
-
super([
|
|
461
|
+
super([
|
|
462
|
+
"mset",
|
|
463
|
+
...Object.entries(kv).flatMap(([key, value]) => [key, value])
|
|
464
|
+
]);
|
|
449
465
|
}
|
|
450
466
|
};
|
|
451
467
|
|
|
@@ -579,6 +595,38 @@ var SCardCommand = class extends Command {
|
|
|
579
595
|
}
|
|
580
596
|
};
|
|
581
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
|
+
|
|
582
630
|
// pkg/commands/sdiff.ts
|
|
583
631
|
var SDiffCommand = class extends Command {
|
|
584
632
|
constructor(key, ...keys) {
|
|
@@ -986,6 +1034,7 @@ export {
|
|
|
986
1034
|
DelCommand,
|
|
987
1035
|
EchoCommand,
|
|
988
1036
|
EvalCommand,
|
|
1037
|
+
EvalshaCommand,
|
|
989
1038
|
ExistsCommand,
|
|
990
1039
|
ExpireCommand,
|
|
991
1040
|
ExpireAtCommand,
|
|
@@ -1043,6 +1092,9 @@ export {
|
|
|
1043
1092
|
SAddCommand,
|
|
1044
1093
|
ScanCommand,
|
|
1045
1094
|
SCardCommand,
|
|
1095
|
+
ScriptExistsCommand,
|
|
1096
|
+
ScriptFlushCommand,
|
|
1097
|
+
ScriptLoadCommand,
|
|
1046
1098
|
SDiffCommand,
|
|
1047
1099
|
SDiffStoreCommand,
|
|
1048
1100
|
SetCommand,
|
|
@@ -1,19 +1,36 @@
|
|
|
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
|
+
var _a;
|
|
14
|
+
if ("request" in configOrRequester) {
|
|
15
|
+
super(configOrRequester);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let agent = void 0;
|
|
19
|
+
if (typeof window === "undefined" && typeof process !== "undefined" && ((_a = process.release) == null ? void 0 : _a.name) === "node") {
|
|
20
|
+
const protocol = new URL(configOrRequester.url).protocol;
|
|
21
|
+
switch (protocol) {
|
|
22
|
+
case "https:":
|
|
23
|
+
agent = new https.Agent({ keepAlive: true });
|
|
24
|
+
break;
|
|
25
|
+
case "http:":
|
|
26
|
+
agent = new https.Agent({ keepAlive: true });
|
|
27
|
+
break;
|
|
16
28
|
}
|
|
29
|
+
}
|
|
30
|
+
const client = new HttpClient({
|
|
31
|
+
baseUrl: configOrRequester.url,
|
|
32
|
+
headers: { authorization: `Bearer ${configOrRequester.token}` },
|
|
33
|
+
options: { agent }
|
|
17
34
|
});
|
|
18
35
|
super(client);
|
|
19
36
|
}
|
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) {
|
|
@@ -192,8 +190,15 @@ var EchoCommand = class extends Command {
|
|
|
192
190
|
|
|
193
191
|
// pkg/commands/eval.ts
|
|
194
192
|
var EvalCommand = class extends Command {
|
|
195
|
-
constructor(script,
|
|
196
|
-
super(["eval", script,
|
|
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 : []]);
|
|
197
202
|
}
|
|
198
203
|
};
|
|
199
204
|
|
|
@@ -357,16 +362,18 @@ function deserialize2(fields, result) {
|
|
|
357
362
|
}
|
|
358
363
|
var HMGetCommand = class extends Command {
|
|
359
364
|
constructor(key, ...fields) {
|
|
360
|
-
super(["hmget", key, ...fields], {
|
|
361
|
-
deserialize: (result) => deserialize2(fields, result)
|
|
362
|
-
});
|
|
365
|
+
super(["hmget", key, ...fields], { deserialize: (result) => deserialize2(fields, result) });
|
|
363
366
|
}
|
|
364
367
|
};
|
|
365
368
|
|
|
366
369
|
// pkg/commands/hmset.ts
|
|
367
370
|
var HMSetCommand = class extends Command {
|
|
368
371
|
constructor(key, kv) {
|
|
369
|
-
super([
|
|
372
|
+
super([
|
|
373
|
+
"hmset",
|
|
374
|
+
key,
|
|
375
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
376
|
+
]);
|
|
370
377
|
}
|
|
371
378
|
};
|
|
372
379
|
|
|
@@ -387,7 +394,11 @@ var HScanCommand = class extends Command {
|
|
|
387
394
|
// pkg/commands/hset.ts
|
|
388
395
|
var HSetCommand = class extends Command {
|
|
389
396
|
constructor(key, kv) {
|
|
390
|
-
super([
|
|
397
|
+
super([
|
|
398
|
+
"hset",
|
|
399
|
+
key,
|
|
400
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
401
|
+
]);
|
|
391
402
|
}
|
|
392
403
|
};
|
|
393
404
|
|
|
@@ -520,7 +531,10 @@ var MGetCommand = class extends Command {
|
|
|
520
531
|
// pkg/commands/mset.ts
|
|
521
532
|
var MSetCommand = class extends Command {
|
|
522
533
|
constructor(kv) {
|
|
523
|
-
super([
|
|
534
|
+
super([
|
|
535
|
+
"mset",
|
|
536
|
+
...Object.entries(kv).flatMap(([key, value]) => [key, value])
|
|
537
|
+
]);
|
|
524
538
|
}
|
|
525
539
|
};
|
|
526
540
|
|
|
@@ -654,6 +668,38 @@ var SCardCommand = class extends Command {
|
|
|
654
668
|
}
|
|
655
669
|
};
|
|
656
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
|
+
|
|
657
703
|
// pkg/commands/sdiff.ts
|
|
658
704
|
var SDiffCommand = class extends Command {
|
|
659
705
|
constructor(key, ...keys) {
|
|
@@ -1077,6 +1123,7 @@ var Pipeline = class {
|
|
|
1077
1123
|
this.del = (...args) => this.chain(new DelCommand(...args));
|
|
1078
1124
|
this.echo = (...args) => this.chain(new EchoCommand(...args));
|
|
1079
1125
|
this.eval = (...args) => this.chain(new EvalCommand(...args));
|
|
1126
|
+
this.evalsha = (...args) => this.chain(new EvalshaCommand(...args));
|
|
1080
1127
|
this.exists = (...args) => this.chain(new ExistsCommand(...args));
|
|
1081
1128
|
this.expire = (...args) => this.chain(new ExpireCommand(...args));
|
|
1082
1129
|
this.expireat = (...args) => this.chain(new ExpireAtCommand(...args));
|
|
@@ -1134,6 +1181,9 @@ var Pipeline = class {
|
|
|
1134
1181
|
this.sadd = (key, ...members) => this.chain(new SAddCommand(key, ...members));
|
|
1135
1182
|
this.scan = (...args) => this.chain(new ScanCommand(...args));
|
|
1136
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));
|
|
1137
1187
|
this.sdiff = (...args) => this.chain(new SDiffCommand(...args));
|
|
1138
1188
|
this.sdiffstore = (...args) => this.chain(new SDiffStoreCommand(...args));
|
|
1139
1189
|
this.set = (key, value, opts) => this.chain(new SetCommand(key, value, opts));
|
|
@@ -1204,6 +1254,7 @@ var Redis = class {
|
|
|
1204
1254
|
this.del = (...args) => new DelCommand(...args).exec(this.client);
|
|
1205
1255
|
this.echo = (...args) => new EchoCommand(...args).exec(this.client);
|
|
1206
1256
|
this.eval = (...args) => new EvalCommand(...args).exec(this.client);
|
|
1257
|
+
this.evalsha = (...args) => new EvalshaCommand(...args).exec(this.client);
|
|
1207
1258
|
this.exists = (...args) => new ExistsCommand(...args).exec(this.client);
|
|
1208
1259
|
this.expire = (...args) => new ExpireCommand(...args).exec(this.client);
|
|
1209
1260
|
this.expireat = (...args) => new ExpireAtCommand(...args).exec(this.client);
|
|
@@ -1261,6 +1312,9 @@ var Redis = class {
|
|
|
1261
1312
|
this.sadd = (key, ...members) => new SAddCommand(key, ...members).exec(this.client);
|
|
1262
1313
|
this.scan = (...args) => new ScanCommand(...args).exec(this.client);
|
|
1263
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);
|
|
1264
1318
|
this.sdiff = (...args) => new SDiffCommand(...args).exec(this.client);
|
|
1265
1319
|
this.sdiffstore = (...args) => new SDiffStoreCommand(...args).exec(this.client);
|
|
1266
1320
|
this.set = (key, value, opts) => new SetCommand(key, value, opts).exec(this.client);
|
|
@@ -1317,9 +1371,7 @@ var Redis2 = class extends Redis {
|
|
|
1317
1371
|
constructor(config) {
|
|
1318
1372
|
const client = new HttpClient({
|
|
1319
1373
|
baseUrl: config.url,
|
|
1320
|
-
headers: {
|
|
1321
|
-
authorization: `Bearer ${config.token}`
|
|
1322
|
-
}
|
|
1374
|
+
headers: { authorization: `Bearer ${config.token}` }
|
|
1323
1375
|
});
|
|
1324
1376
|
super(client);
|
|
1325
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
|
|
@@ -71,7 +73,14 @@ declare class EchoCommand extends Command<string, string> {
|
|
|
71
73
|
* @see https://redis.io/commands/eval
|
|
72
74
|
*/
|
|
73
75
|
declare class EvalCommand<TArgs extends unknown[], TData> extends Command<unknown, TData> {
|
|
74
|
-
constructor(script: string,
|
|
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);
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
/**
|
|
@@ -474,6 +483,24 @@ declare class SCardCommand extends Command<number, number> {
|
|
|
474
483
|
constructor(key: string);
|
|
475
484
|
}
|
|
476
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
|
+
|
|
477
504
|
/**
|
|
478
505
|
* @see https://redis.io/commands/sdiff
|
|
479
506
|
*/
|
|
@@ -731,4 +758,4 @@ declare class ZScoreCommand<TData> extends Command<number | null, string | null>
|
|
|
731
758
|
constructor(key: string, member: TData);
|
|
732
759
|
}
|
|
733
760
|
|
|
734
|
-
export { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, 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 };
|