@taquito/http-utils 22.0.0 → 23.0.0-beta.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.
|
@@ -30,11 +30,22 @@ var _a;
|
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.HttpBackend = exports.HttpTimeoutError = exports.HttpResponseError = exports.HttpRequestFailed = exports.VERSION = void 0;
|
|
32
32
|
let fetch = globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch;
|
|
33
|
+
let createAgent = undefined;
|
|
33
34
|
// Will only use browser fetch if we are in a browser environment,
|
|
34
35
|
// default to the more stable node-fetch otherwise
|
|
35
36
|
const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
36
37
|
if (isNode) {
|
|
37
38
|
fetch = require('node-fetch');
|
|
39
|
+
if (Number(process.versions.node.split('.')[0]) >= 19) {
|
|
40
|
+
// we need agent with keepalive false for node 19 and above
|
|
41
|
+
createAgent = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const { Agent: HttpsAgent } = yield Promise.resolve().then(() => require('https'));
|
|
43
|
+
const { Agent: HttpAgent } = yield Promise.resolve().then(() => require('http'));
|
|
44
|
+
return url.startsWith('https')
|
|
45
|
+
? new HttpsAgent({ keepAlive: false })
|
|
46
|
+
: new HttpAgent({ keepAlive: false });
|
|
47
|
+
});
|
|
48
|
+
}
|
|
38
49
|
}
|
|
39
50
|
const errors_1 = require("./errors");
|
|
40
51
|
__exportStar(require("./status_code"), exports);
|
|
@@ -99,13 +110,9 @@ class HttpBackend {
|
|
|
99
110
|
const controller = new AbortController();
|
|
100
111
|
const t = setTimeout(() => controller.abort(), timeout);
|
|
101
112
|
try {
|
|
102
|
-
const response = yield fetch(urlWithQuery, {
|
|
103
|
-
keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
|
|
113
|
+
const response = yield fetch(urlWithQuery, Object.assign({ keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
|
|
104
114
|
method,
|
|
105
|
-
headers,
|
|
106
|
-
body: JSON.stringify(data),
|
|
107
|
-
signal: controller.signal,
|
|
108
|
-
});
|
|
115
|
+
headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: yield createAgent(urlWithQuery) } : {})));
|
|
109
116
|
if (typeof response === 'undefined') {
|
|
110
117
|
throw new Error('Response is undefined');
|
|
111
118
|
}
|
package/dist/lib/version.js
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
5
5
|
exports.VERSION = {
|
|
6
|
-
"commitHash": "
|
|
7
|
-
"version": "
|
|
6
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
7
|
+
"version": "23.0.0-beta.1"
|
|
8
8
|
};
|
|
@@ -397,8 +397,8 @@ var STATUS_CODE;
|
|
|
397
397
|
|
|
398
398
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
399
399
|
const VERSION = {
|
|
400
|
-
"commitHash": "
|
|
401
|
-
"version": "
|
|
400
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
401
|
+
"version": "23.0.0-beta.1"
|
|
402
402
|
};
|
|
403
403
|
|
|
404
404
|
/**
|
|
@@ -407,11 +407,22 @@ const VERSION = {
|
|
|
407
407
|
*/
|
|
408
408
|
var _a;
|
|
409
409
|
let fetch = globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch;
|
|
410
|
+
let createAgent = undefined;
|
|
410
411
|
// Will only use browser fetch if we are in a browser environment,
|
|
411
412
|
// default to the more stable node-fetch otherwise
|
|
412
413
|
const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
413
414
|
if (isNode) {
|
|
414
415
|
fetch = require('node-fetch');
|
|
416
|
+
if (Number(process.versions.node.split('.')[0]) >= 19) {
|
|
417
|
+
// we need agent with keepalive false for node 19 and above
|
|
418
|
+
createAgent = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
419
|
+
const { Agent: HttpsAgent } = yield import('https');
|
|
420
|
+
const { Agent: HttpAgent } = yield import('http');
|
|
421
|
+
return url.startsWith('https')
|
|
422
|
+
? new HttpsAgent({ keepAlive: false })
|
|
423
|
+
: new HttpAgent({ keepAlive: false });
|
|
424
|
+
});
|
|
425
|
+
}
|
|
415
426
|
}
|
|
416
427
|
class HttpBackend {
|
|
417
428
|
constructor(timeout = 30000) {
|
|
@@ -468,13 +479,9 @@ class HttpBackend {
|
|
|
468
479
|
const controller = new AbortController();
|
|
469
480
|
const t = setTimeout(() => controller.abort(), timeout);
|
|
470
481
|
try {
|
|
471
|
-
const response = yield fetch(urlWithQuery, {
|
|
472
|
-
keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
|
|
482
|
+
const response = yield fetch(urlWithQuery, Object.assign({ keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
|
|
473
483
|
method,
|
|
474
|
-
headers,
|
|
475
|
-
body: JSON.stringify(data),
|
|
476
|
-
signal: controller.signal,
|
|
477
|
-
});
|
|
484
|
+
headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: yield createAgent(urlWithQuery) } : {})));
|
|
478
485
|
if (typeof response === 'undefined') {
|
|
479
486
|
throw new Error('Response is undefined');
|
|
480
487
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-http-utils.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taquito-http-utils.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -401,8 +401,8 @@
|
|
|
401
401
|
|
|
402
402
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
403
403
|
const VERSION = {
|
|
404
|
-
"commitHash": "
|
|
405
|
-
"version": "
|
|
404
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
405
|
+
"version": "23.0.0-beta.1"
|
|
406
406
|
};
|
|
407
407
|
|
|
408
408
|
/**
|
|
@@ -411,11 +411,22 @@
|
|
|
411
411
|
*/
|
|
412
412
|
var _a;
|
|
413
413
|
let fetch = globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch;
|
|
414
|
+
let createAgent = undefined;
|
|
414
415
|
// Will only use browser fetch if we are in a browser environment,
|
|
415
416
|
// default to the more stable node-fetch otherwise
|
|
416
417
|
const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
417
418
|
if (isNode) {
|
|
418
419
|
fetch = require('node-fetch');
|
|
420
|
+
if (Number(process.versions.node.split('.')[0]) >= 19) {
|
|
421
|
+
// we need agent with keepalive false for node 19 and above
|
|
422
|
+
createAgent = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
423
|
+
const { Agent: HttpsAgent } = yield import('https');
|
|
424
|
+
const { Agent: HttpAgent } = yield import('http');
|
|
425
|
+
return url.startsWith('https')
|
|
426
|
+
? new HttpsAgent({ keepAlive: false })
|
|
427
|
+
: new HttpAgent({ keepAlive: false });
|
|
428
|
+
});
|
|
429
|
+
}
|
|
419
430
|
}
|
|
420
431
|
class HttpBackend {
|
|
421
432
|
constructor(timeout = 30000) {
|
|
@@ -472,13 +483,9 @@
|
|
|
472
483
|
const controller = new AbortController();
|
|
473
484
|
const t = setTimeout(() => controller.abort(), timeout);
|
|
474
485
|
try {
|
|
475
|
-
const response = yield fetch(urlWithQuery, {
|
|
476
|
-
keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
|
|
486
|
+
const response = yield fetch(urlWithQuery, Object.assign({ keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
|
|
477
487
|
method,
|
|
478
|
-
headers,
|
|
479
|
-
body: JSON.stringify(data),
|
|
480
|
-
signal: controller.signal,
|
|
481
|
-
});
|
|
488
|
+
headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: yield createAgent(urlWithQuery) } : {})));
|
|
482
489
|
if (typeof response === 'undefined') {
|
|
483
490
|
throw new Error('Response is undefined');
|
|
484
491
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-http-utils.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taquito-http-utils.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taquito/http-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tezos"
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"signature.json",
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
|
+
"browser": {
|
|
16
|
+
"http": false,
|
|
17
|
+
"https": false
|
|
18
|
+
},
|
|
15
19
|
"author": "Simon Boissonneault-Robert <simon@ecadlabs.com>",
|
|
16
20
|
"repository": {
|
|
17
21
|
"type": "git",
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
]
|
|
59
63
|
},
|
|
60
64
|
"dependencies": {
|
|
61
|
-
"@taquito/core": "^
|
|
65
|
+
"@taquito/core": "^23.0.0-beta.1",
|
|
62
66
|
"node-fetch": "^2.7.0"
|
|
63
67
|
},
|
|
64
68
|
"devDependencies": {
|
|
@@ -90,5 +94,5 @@
|
|
|
90
94
|
"ts-toolbelt": "^9.6.0",
|
|
91
95
|
"typescript": "~5.5.4"
|
|
92
96
|
},
|
|
93
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "1469d6f0d55134a4b853598a2eec48e6f71b3da3"
|
|
94
98
|
}
|