@upstash/redis 1.3.0-alpha.1 → 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-T3BIHZ2F.mjs → chunk-C2RGMNOQ.mjs} +23 -7
- package/{chunk-KI7YOGWS.mjs → chunk-CTSQDNTV.mjs} +5 -41
- package/{chunk-5567SQFQ.mjs → chunk-K2UC7PHG.mjs} +58 -6
- package/cloudflare.d.ts +18 -16
- package/cloudflare.js +56 -51
- package/cloudflare.mjs +4 -6
- package/commands.d.ts +30 -3
- package/commands.js +62 -6
- package/commands.mjs +9 -1
- package/fastly.d.ts +23 -21
- package/fastly.js +56 -51
- 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 +81 -53
- package/index.mjs +4 -4
- package/nodejs.d.ts +46 -25
- package/nodejs.js +81 -53
- package/nodejs.mjs +4 -4
- package/package.json +1 -1
- package/{redis-364a4445.d.ts → redis-338577a3.d.ts} +488 -496
- package/{zunionstore-342168a6.d.ts → zunionstore-633a2e7a.d.ts} +17 -3
package/commands.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(commands_exports, {
|
|
|
35
35
|
DelCommand: () => DelCommand,
|
|
36
36
|
EchoCommand: () => EchoCommand,
|
|
37
37
|
EvalCommand: () => EvalCommand,
|
|
38
|
+
EvalshaCommand: () => EvalshaCommand,
|
|
38
39
|
ExistsCommand: () => ExistsCommand,
|
|
39
40
|
ExpireAtCommand: () => ExpireAtCommand,
|
|
40
41
|
ExpireCommand: () => ExpireCommand,
|
|
@@ -105,6 +106,9 @@ __export(commands_exports, {
|
|
|
105
106
|
SUnionCommand: () => SUnionCommand,
|
|
106
107
|
SUnionStoreCommand: () => SUnionStoreCommand,
|
|
107
108
|
ScanCommand: () => ScanCommand,
|
|
109
|
+
ScriptExistsCommand: () => ScriptExistsCommand,
|
|
110
|
+
ScriptFlushCommand: () => ScriptFlushCommand,
|
|
111
|
+
ScriptLoadCommand: () => ScriptLoadCommand,
|
|
108
112
|
SetBitCommand: () => SetBitCommand,
|
|
109
113
|
SetCommand: () => SetCommand,
|
|
110
114
|
SetExCommand: () => SetExCommand,
|
|
@@ -264,6 +268,13 @@ var EvalCommand = class extends Command {
|
|
|
264
268
|
}
|
|
265
269
|
};
|
|
266
270
|
|
|
271
|
+
// pkg/commands/evalsha.ts
|
|
272
|
+
var EvalshaCommand = class extends Command {
|
|
273
|
+
constructor(sha, keys, args) {
|
|
274
|
+
super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
267
278
|
// pkg/commands/exists.ts
|
|
268
279
|
var ExistsCommand = class extends Command {
|
|
269
280
|
constructor(...keys) {
|
|
@@ -424,16 +435,18 @@ function deserialize2(fields, result) {
|
|
|
424
435
|
}
|
|
425
436
|
var HMGetCommand = class extends Command {
|
|
426
437
|
constructor(key, ...fields) {
|
|
427
|
-
super(["hmget", key, ...fields], {
|
|
428
|
-
deserialize: (result) => deserialize2(fields, result)
|
|
429
|
-
});
|
|
438
|
+
super(["hmget", key, ...fields], { deserialize: (result) => deserialize2(fields, result) });
|
|
430
439
|
}
|
|
431
440
|
};
|
|
432
441
|
|
|
433
442
|
// pkg/commands/hmset.ts
|
|
434
443
|
var HMSetCommand = class extends Command {
|
|
435
444
|
constructor(key, kv) {
|
|
436
|
-
super([
|
|
445
|
+
super([
|
|
446
|
+
"hmset",
|
|
447
|
+
key,
|
|
448
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
449
|
+
]);
|
|
437
450
|
}
|
|
438
451
|
};
|
|
439
452
|
|
|
@@ -454,7 +467,11 @@ var HScanCommand = class extends Command {
|
|
|
454
467
|
// pkg/commands/hset.ts
|
|
455
468
|
var HSetCommand = class extends Command {
|
|
456
469
|
constructor(key, kv) {
|
|
457
|
-
super([
|
|
470
|
+
super([
|
|
471
|
+
"hset",
|
|
472
|
+
key,
|
|
473
|
+
...Object.entries(kv).flatMap(([field, value]) => [field, value])
|
|
474
|
+
]);
|
|
458
475
|
}
|
|
459
476
|
};
|
|
460
477
|
|
|
@@ -587,7 +604,10 @@ var MGetCommand = class extends Command {
|
|
|
587
604
|
// pkg/commands/mset.ts
|
|
588
605
|
var MSetCommand = class extends Command {
|
|
589
606
|
constructor(kv) {
|
|
590
|
-
super([
|
|
607
|
+
super([
|
|
608
|
+
"mset",
|
|
609
|
+
...Object.entries(kv).flatMap(([key, value]) => [key, value])
|
|
610
|
+
]);
|
|
591
611
|
}
|
|
592
612
|
};
|
|
593
613
|
|
|
@@ -721,6 +741,38 @@ var SCardCommand = class extends Command {
|
|
|
721
741
|
}
|
|
722
742
|
};
|
|
723
743
|
|
|
744
|
+
// pkg/commands/script_exists.ts
|
|
745
|
+
var ScriptExistsCommand = class extends Command {
|
|
746
|
+
constructor(...hash) {
|
|
747
|
+
super(["script", "exists", ...hash], {
|
|
748
|
+
deserialize: (result) => {
|
|
749
|
+
const parsed = result;
|
|
750
|
+
return parsed.length === 1 ? parsed[0] : parsed;
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
// pkg/commands/script_flush.ts
|
|
757
|
+
var ScriptFlushCommand = class extends Command {
|
|
758
|
+
constructor(opts) {
|
|
759
|
+
const cmd = ["script", "flush"];
|
|
760
|
+
if (opts == null ? void 0 : opts.sync) {
|
|
761
|
+
cmd.push("sync");
|
|
762
|
+
} else if (opts == null ? void 0 : opts.async) {
|
|
763
|
+
cmd.push("async");
|
|
764
|
+
}
|
|
765
|
+
super(cmd);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
// pkg/commands/script_load.ts
|
|
770
|
+
var ScriptLoadCommand = class extends Command {
|
|
771
|
+
constructor(script) {
|
|
772
|
+
super(["script", "load", script]);
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
|
|
724
776
|
// pkg/commands/sdiff.ts
|
|
725
777
|
var SDiffCommand = class extends Command {
|
|
726
778
|
constructor(key, ...keys) {
|
|
@@ -1129,6 +1181,7 @@ module.exports = __toCommonJS(commands_exports);
|
|
|
1129
1181
|
DelCommand,
|
|
1130
1182
|
EchoCommand,
|
|
1131
1183
|
EvalCommand,
|
|
1184
|
+
EvalshaCommand,
|
|
1132
1185
|
ExistsCommand,
|
|
1133
1186
|
ExpireAtCommand,
|
|
1134
1187
|
ExpireCommand,
|
|
@@ -1199,6 +1252,9 @@ module.exports = __toCommonJS(commands_exports);
|
|
|
1199
1252
|
SUnionCommand,
|
|
1200
1253
|
SUnionStoreCommand,
|
|
1201
1254
|
ScanCommand,
|
|
1255
|
+
ScriptExistsCommand,
|
|
1256
|
+
ScriptFlushCommand,
|
|
1257
|
+
ScriptLoadCommand,
|
|
1202
1258
|
SetBitCommand,
|
|
1203
1259
|
SetCommand,
|
|
1204
1260
|
SetExCommand,
|
package/commands.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
DelCommand,
|
|
11
11
|
EchoCommand,
|
|
12
12
|
EvalCommand,
|
|
13
|
+
EvalshaCommand,
|
|
13
14
|
ExistsCommand,
|
|
14
15
|
ExpireAtCommand,
|
|
15
16
|
ExpireCommand,
|
|
@@ -80,6 +81,9 @@ import {
|
|
|
80
81
|
SUnionCommand,
|
|
81
82
|
SUnionStoreCommand,
|
|
82
83
|
ScanCommand,
|
|
84
|
+
ScriptExistsCommand,
|
|
85
|
+
ScriptFlushCommand,
|
|
86
|
+
ScriptLoadCommand,
|
|
83
87
|
SetBitCommand,
|
|
84
88
|
SetCommand,
|
|
85
89
|
SetExCommand,
|
|
@@ -109,7 +113,7 @@ import {
|
|
|
109
113
|
ZScanCommand,
|
|
110
114
|
ZScoreCommand,
|
|
111
115
|
ZUnionStoreCommand
|
|
112
|
-
} from "./chunk-
|
|
116
|
+
} from "./chunk-K2UC7PHG.mjs";
|
|
113
117
|
import "./chunk-7YUZYRJS.mjs";
|
|
114
118
|
export {
|
|
115
119
|
AppendCommand,
|
|
@@ -123,6 +127,7 @@ export {
|
|
|
123
127
|
DelCommand,
|
|
124
128
|
EchoCommand,
|
|
125
129
|
EvalCommand,
|
|
130
|
+
EvalshaCommand,
|
|
126
131
|
ExistsCommand,
|
|
127
132
|
ExpireAtCommand,
|
|
128
133
|
ExpireCommand,
|
|
@@ -193,6 +198,9 @@ export {
|
|
|
193
198
|
SUnionCommand,
|
|
194
199
|
SUnionStoreCommand,
|
|
195
200
|
ScanCommand,
|
|
201
|
+
ScriptExistsCommand,
|
|
202
|
+
ScriptFlushCommand,
|
|
203
|
+
ScriptLoadCommand,
|
|
196
204
|
SetBitCommand,
|
|
197
205
|
SetCommand,
|
|
198
206
|
SetExCommand,
|
package/fastly.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,18 +10,18 @@ import './zunionstore-342168a6';
|
|
|
8
10
|
*/
|
|
9
11
|
declare type RedisConfigFastly = {
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
* A Request can be forwarded to any backend defined on your service. Backends
|
|
22
|
+
* can be created via the Fastly CLI, API, or web interface, and are
|
|
23
|
+
* referenced by name.
|
|
24
|
+
*/
|
|
23
25
|
backend: string;
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
@@ -27,17 +29,17 @@ declare type RedisConfigFastly = {
|
|
|
27
29
|
*/
|
|
28
30
|
declare class Redis extends Redis$1 {
|
|
29
31
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
* Create a new redis client
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const redis = new Redis({
|
|
37
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
38
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
39
|
+
* backend: "upstash-db",
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
41
43
|
constructor(config: RedisConfigFastly);
|
|
42
44
|
}
|
|
43
45
|
|
package/fastly.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) {
|
|
@@ -197,6 +195,13 @@ var EvalCommand = class extends Command {
|
|
|
197
195
|
}
|
|
198
196
|
};
|
|
199
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
|
+
|
|
200
205
|
// pkg/commands/exists.ts
|
|
201
206
|
var ExistsCommand = class extends Command {
|
|
202
207
|
constructor(...keys) {
|
|
@@ -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) {
|
|
@@ -1049,45 +1095,6 @@ var ZUnionStoreCommand = class extends Command {
|
|
|
1049
1095
|
}
|
|
1050
1096
|
};
|
|
1051
1097
|
|
|
1052
|
-
// pkg/commands/evalsha.ts
|
|
1053
|
-
var EvalshaCommand = class extends Command {
|
|
1054
|
-
constructor(sha, keys, args) {
|
|
1055
|
-
super(["evalsha", sha, keys.length, ...keys, ...args != null ? args : []]);
|
|
1056
|
-
}
|
|
1057
|
-
};
|
|
1058
|
-
|
|
1059
|
-
// pkg/commands/script_exists.ts
|
|
1060
|
-
var ScriptExistsCommand = class extends Command {
|
|
1061
|
-
constructor(...hash) {
|
|
1062
|
-
super(["script", "exists", ...hash], {
|
|
1063
|
-
deserialize: (result) => {
|
|
1064
|
-
const parsed = result;
|
|
1065
|
-
return parsed.length === 1 ? parsed[0] : parsed;
|
|
1066
|
-
}
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
};
|
|
1070
|
-
|
|
1071
|
-
// pkg/commands/script_flush.ts
|
|
1072
|
-
var ScriptFlushCommand = class extends Command {
|
|
1073
|
-
constructor(opts) {
|
|
1074
|
-
const cmd = ["script", "flush"];
|
|
1075
|
-
if (opts == null ? void 0 : opts.sync) {
|
|
1076
|
-
cmd.push("sync");
|
|
1077
|
-
} else if (opts == null ? void 0 : opts.async) {
|
|
1078
|
-
cmd.push("async");
|
|
1079
|
-
}
|
|
1080
|
-
super(cmd);
|
|
1081
|
-
}
|
|
1082
|
-
};
|
|
1083
|
-
|
|
1084
|
-
// pkg/commands/script_load.ts
|
|
1085
|
-
var ScriptLoadCommand = class extends Command {
|
|
1086
|
-
constructor(script) {
|
|
1087
|
-
super(["script", "load", script]);
|
|
1088
|
-
}
|
|
1089
|
-
};
|
|
1090
|
-
|
|
1091
1098
|
// pkg/pipeline.ts
|
|
1092
1099
|
var Pipeline = class {
|
|
1093
1100
|
constructor(client) {
|
|
@@ -1364,9 +1371,7 @@ var Redis2 = class extends Redis {
|
|
|
1364
1371
|
constructor(config) {
|
|
1365
1372
|
const client = new HttpClient({
|
|
1366
1373
|
baseUrl: config.url,
|
|
1367
|
-
headers: {
|
|
1368
|
-
authorization: `Bearer ${config.token}`
|
|
1369
|
-
},
|
|
1374
|
+
headers: { authorization: `Bearer ${config.token}` },
|
|
1370
1375
|
options: { backend: config.backend }
|
|
1371
1376
|
});
|
|
1372
1377
|
super(client);
|
package/fastly.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/fastly.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
|
options: { backend: config.backend }
|
|
19
17
|
});
|
|
20
18
|
super(client);
|
package/http.d.ts
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import https from 'https';
|
|
2
|
+
import http from 'http';
|
|
3
|
+
|
|
4
|
+
declare type UpstashRequest = {
|
|
2
5
|
path?: string[];
|
|
3
6
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
* Request body will be serialized to json
|
|
8
|
+
*/
|
|
6
9
|
body?: unknown;
|
|
7
10
|
};
|
|
8
11
|
declare type UpstashResponse<TResult> = {
|
|
9
12
|
result?: TResult;
|
|
10
13
|
error?: string;
|
|
11
14
|
};
|
|
15
|
+
interface Requester {
|
|
16
|
+
request: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>;
|
|
17
|
+
}
|
|
12
18
|
declare type HttpClientConfig = {
|
|
13
19
|
headers?: Record<string, string>;
|
|
14
20
|
baseUrl: string;
|
|
15
21
|
options?: {
|
|
16
22
|
backend?: string;
|
|
23
|
+
agent?: https.Agent | http.Agent;
|
|
17
24
|
};
|
|
18
25
|
};
|
|
19
|
-
declare class HttpClient {
|
|
26
|
+
declare class HttpClient implements Requester {
|
|
20
27
|
baseUrl: string;
|
|
21
28
|
headers: Record<string, string>;
|
|
22
29
|
readonly options?: {
|
|
23
30
|
backend?: string;
|
|
24
31
|
};
|
|
25
32
|
constructor(config: HttpClientConfig);
|
|
26
|
-
request<
|
|
33
|
+
request<TResult>(req: UpstashRequest): Promise<UpstashResponse<TResult>>;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
export { HttpClient, HttpClientConfig,
|
|
36
|
+
export { HttpClient, HttpClientConfig, Requester, UpstashRequest, UpstashResponse };
|
package/http.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) {
|
package/http.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { Redis, RedisConfigNodejs } from './nodejs';
|
|
2
|
-
|
|
3
|
-
import './
|
|
4
|
-
import './zunionstore-
|
|
2
|
+
export { Requester, UpstashRequest, UpstashResponse } from './http';
|
|
3
|
+
import './redis-338577a3';
|
|
4
|
+
import './zunionstore-633a2e7a';
|
|
5
|
+
import 'https';
|
|
6
|
+
import 'http';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Result of a bad request to upstash
|