abbot-http-client 0.0.47 → 0.0.49
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/dist/index.cjs +9 -4
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -68,7 +68,8 @@ var defaultConfig = {
|
|
|
68
68
|
trackingId: "",
|
|
69
69
|
userJwt: null
|
|
70
70
|
},
|
|
71
|
-
devMode: false
|
|
71
|
+
devMode: false,
|
|
72
|
+
keepAlive: false
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
// src/utilities.ts
|
|
@@ -85,6 +86,8 @@ function deepMerge(target, source) {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
// src/config/axiosFn.ts
|
|
89
|
+
var import_http = __toESM(require("http"), 1);
|
|
90
|
+
var import_https = __toESM(require("https"), 1);
|
|
88
91
|
function axiosConf(cfg) {
|
|
89
92
|
return import_axios.default.create({
|
|
90
93
|
baseURL: cfg.axios?.baseUrl,
|
|
@@ -98,7 +101,9 @@ function axiosConf(cfg) {
|
|
|
98
101
|
}
|
|
99
102
|
},
|
|
100
103
|
timeout: cfg.axios?.timeout,
|
|
101
|
-
withCredentials: true
|
|
104
|
+
withCredentials: true,
|
|
105
|
+
httpAgent: cfg.keepAlive ? new import_http.default.Agent({ keepAlive: true }) : null,
|
|
106
|
+
httpsAgent: cfg.keepAlive ? new import_https.default.Agent({ keepAlive: true, timeout: 6e4 }) : null
|
|
102
107
|
});
|
|
103
108
|
}
|
|
104
109
|
var Axios = class {
|
|
@@ -479,8 +484,8 @@ var RestError = class extends Error {
|
|
|
479
484
|
|
|
480
485
|
// src/core.ts
|
|
481
486
|
function create(config) {
|
|
482
|
-
const
|
|
483
|
-
return
|
|
487
|
+
const http2 = new AbbotHttp(config);
|
|
488
|
+
return http2;
|
|
484
489
|
}
|
|
485
490
|
// Annotate the CommonJS export names for ESM import in node:
|
|
486
491
|
0 && (module.exports = {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -22,7 +22,8 @@ var defaultConfig = {
|
|
|
22
22
|
trackingId: "",
|
|
23
23
|
userJwt: null
|
|
24
24
|
},
|
|
25
|
-
devMode: false
|
|
25
|
+
devMode: false,
|
|
26
|
+
keepAlive: false
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
// src/utilities.ts
|
|
@@ -39,6 +40,8 @@ function deepMerge(target, source) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
// src/config/axiosFn.ts
|
|
43
|
+
import http from "http";
|
|
44
|
+
import https from "https";
|
|
42
45
|
function axiosConf(cfg) {
|
|
43
46
|
return axios.create({
|
|
44
47
|
baseURL: cfg.axios?.baseUrl,
|
|
@@ -52,7 +55,9 @@ function axiosConf(cfg) {
|
|
|
52
55
|
}
|
|
53
56
|
},
|
|
54
57
|
timeout: cfg.axios?.timeout,
|
|
55
|
-
withCredentials: true
|
|
58
|
+
withCredentials: true,
|
|
59
|
+
httpAgent: cfg.keepAlive ? new http.Agent({ keepAlive: true }) : null,
|
|
60
|
+
httpsAgent: cfg.keepAlive ? new https.Agent({ keepAlive: true, timeout: 6e4 }) : null
|
|
56
61
|
});
|
|
57
62
|
}
|
|
58
63
|
var Axios = class {
|
|
@@ -433,8 +438,8 @@ var RestError = class extends Error {
|
|
|
433
438
|
|
|
434
439
|
// src/core.ts
|
|
435
440
|
function create(config) {
|
|
436
|
-
const
|
|
437
|
-
return
|
|
441
|
+
const http2 = new AbbotHttp(config);
|
|
442
|
+
return http2;
|
|
438
443
|
}
|
|
439
444
|
export {
|
|
440
445
|
AbbotHttp,
|