@taquito/http-utils 23.0.3 → 24.0.0-beta.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.
@@ -29,22 +29,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  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
+ const https_1 = require("https");
33
+ const http_1 = require("http");
32
34
  let fetch = globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch;
33
- let createAgent = undefined;
35
+ let createAgent;
34
36
  // Will only use browser fetch if we are in a browser environment,
35
37
  // default to the more stable node-fetch otherwise
36
38
  const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
37
39
  if (isNode) {
38
- fetch = require('node-fetch');
40
+ // Handle both ESM and CJS default export patterns for webpack compatibility
41
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
42
+ const nodeFetch = require('node-fetch');
43
+ fetch = nodeFetch.default || nodeFetch;
39
44
  if (Number(process.versions.node.split('.')[0]) >= 19) {
40
45
  // 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'));
46
+ createAgent = (url) => {
44
47
  return url.startsWith('https')
45
- ? new HttpsAgent({ keepAlive: false })
46
- : new HttpAgent({ keepAlive: false });
47
- });
48
+ ? new https_1.Agent({ keepAlive: false })
49
+ : new http_1.Agent({ keepAlive: false });
50
+ };
48
51
  }
49
52
  }
50
53
  const errors_1 = require("./errors");
@@ -112,7 +115,7 @@ class HttpBackend {
112
115
  try {
113
116
  const response = yield fetch(urlWithQuery, Object.assign({ keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
114
117
  method,
115
- headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: yield createAgent(urlWithQuery) } : {})));
118
+ headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: createAgent(urlWithQuery) } : {})));
116
119
  if (typeof response === 'undefined') {
117
120
  throw new Error('Response is undefined');
118
121
  }
@@ -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": "42048d039f6d4345fc59d04b03650bcb8e27bb62",
7
- "version": "23.0.3"
6
+ "commitHash": "7912b77f57f943dff619383900bd46a7a593a244",
7
+ "version": "24.0.0-beta.0"
8
8
  };
@@ -1,3 +1,5 @@
1
+ import { Agent } from 'https';
2
+ import { Agent as Agent$1 } from 'http';
1
3
  import { NetworkError } from '@taquito/core';
2
4
 
3
5
  /******************************************************************************
@@ -14,7 +16,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
16
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
17
  PERFORMANCE OF THIS SOFTWARE.
16
18
  ***************************************************************************** */
17
- /* global Reflect, Promise, SuppressedError, Symbol */
19
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
20
 
19
21
 
20
22
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -397,8 +399,8 @@ var STATUS_CODE;
397
399
 
398
400
  // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
399
401
  const VERSION = {
400
- "commitHash": "42048d039f6d4345fc59d04b03650bcb8e27bb62",
401
- "version": "23.0.3"
402
+ "commitHash": "7912b77f57f943dff619383900bd46a7a593a244",
403
+ "version": "24.0.0-beta.0"
402
404
  };
403
405
 
404
406
  /**
@@ -407,21 +409,22 @@ const VERSION = {
407
409
  */
408
410
  var _a;
409
411
  let fetch = globalThis === null || globalThis === void 0 ? void 0 : globalThis.fetch;
410
- let createAgent = undefined;
412
+ let createAgent;
411
413
  // Will only use browser fetch if we are in a browser environment,
412
414
  // default to the more stable node-fetch otherwise
413
415
  const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
414
416
  if (isNode) {
415
- fetch = require('node-fetch');
417
+ // Handle both ESM and CJS default export patterns for webpack compatibility
418
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
419
+ const nodeFetch = require('node-fetch');
420
+ fetch = nodeFetch.default || nodeFetch;
416
421
  if (Number(process.versions.node.split('.')[0]) >= 19) {
417
422
  // 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');
423
+ createAgent = (url) => {
421
424
  return url.startsWith('https')
422
- ? new HttpsAgent({ keepAlive: false })
423
- : new HttpAgent({ keepAlive: false });
424
- });
425
+ ? new Agent({ keepAlive: false })
426
+ : new Agent$1({ keepAlive: false });
427
+ };
425
428
  }
426
429
  }
427
430
  class HttpBackend {
@@ -481,7 +484,7 @@ class HttpBackend {
481
484
  try {
482
485
  const response = yield fetch(urlWithQuery, Object.assign({ keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
483
486
  method,
484
- headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: yield createAgent(urlWithQuery) } : {})));
487
+ headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: createAgent(urlWithQuery) } : {})));
485
488
  if (typeof response === 'undefined') {
486
489
  throw new Error('Response is undefined');
487
490
  }
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-http-utils.es6.js","sources":[],"sourcesContent":[],"names":[],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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@taquito/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoHttpUtils = {}, global.core));
5
- })(this, (function (exports, core) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('https'), require('http'), require('@taquito/core')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'https', 'http', '@taquito/core'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoHttpUtils = {}, global.https, global.http, global.core));
5
+ })(this, (function (exports, https, http, core) { 'use strict';
6
6
 
7
7
  /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -18,7 +18,7 @@
18
18
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
19
  PERFORMANCE OF THIS SOFTWARE.
20
20
  ***************************************************************************** */
21
- /* global Reflect, Promise, SuppressedError, Symbol */
21
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
22
22
 
23
23
 
24
24
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -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": "42048d039f6d4345fc59d04b03650bcb8e27bb62",
405
- "version": "23.0.3"
404
+ "commitHash": "7912b77f57f943dff619383900bd46a7a593a244",
405
+ "version": "24.0.0-beta.0"
406
406
  };
407
407
 
408
408
  /**
@@ -411,21 +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
+ let createAgent;
415
415
  // Will only use browser fetch if we are in a browser environment,
416
416
  // default to the more stable node-fetch otherwise
417
417
  const isNode = typeof process !== 'undefined' && !!((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node);
418
418
  if (isNode) {
419
- fetch = require('node-fetch');
419
+ // Handle both ESM and CJS default export patterns for webpack compatibility
420
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
421
+ const nodeFetch = require('node-fetch');
422
+ fetch = nodeFetch.default || nodeFetch;
420
423
  if (Number(process.versions.node.split('.')[0]) >= 19) {
421
424
  // 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
+ createAgent = (url) => {
425
426
  return url.startsWith('https')
426
- ? new HttpsAgent({ keepAlive: false })
427
- : new HttpAgent({ keepAlive: false });
428
- });
427
+ ? new https.Agent({ keepAlive: false })
428
+ : new http.Agent({ keepAlive: false });
429
+ };
429
430
  }
430
431
  }
431
432
  class HttpBackend {
@@ -485,7 +486,7 @@
485
486
  try {
486
487
  const response = yield fetch(urlWithQuery, Object.assign({ keepalive: false, // Disable keepalive (keepalive defaults to true starting from Node 19 & 20)
487
488
  method,
488
- headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: yield createAgent(urlWithQuery) } : {})));
489
+ headers, body: JSON.stringify(data), signal: controller.signal }, (isNode && createAgent ? { agent: createAgent(urlWithQuery) } : {})));
489
490
  if (typeof response === 'undefined') {
490
491
  throw new Error('Response is undefined');
491
492
  }
@@ -1 +1 @@
1
- {"version":3,"file":"taquito-http-utils.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taquito/http-utils",
3
- "version": "23.0.3",
3
+ "version": "24.0.0-beta.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "tezos"
@@ -14,7 +14,8 @@
14
14
  ],
15
15
  "browser": {
16
16
  "http": false,
17
- "https": false
17
+ "https": false,
18
+ "node-fetch": false
18
19
  },
19
20
  "author": "Simon Boissonneault-Robert <simon@ecadlabs.com>",
20
21
  "repository": {
@@ -26,7 +27,7 @@
26
27
  },
27
28
  "license": "Apache-2.0",
28
29
  "engines": {
29
- "node": ">=18"
30
+ "node": ">=20"
30
31
  },
31
32
  "scripts": {
32
33
  "lint": "eslint --ext .js,.ts .",
@@ -62,13 +63,13 @@
62
63
  ]
63
64
  },
64
65
  "dependencies": {
65
- "@taquito/core": "^23.0.3",
66
+ "@taquito/core": "^24.0.0-beta.0",
66
67
  "node-fetch": "^2.7.0"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@types/bluebird": "^3.5.42",
70
71
  "@types/jest": "^29.5.12",
71
- "@types/node": "^18",
72
+ "@types/node": "^20",
72
73
  "@types/node-fetch": "^2.6.11",
73
74
  "@types/superagent": "^8.1.8",
74
75
  "@typescript-eslint/eslint-plugin": "^6.21.0",
@@ -87,6 +88,7 @@
87
88
  "rimraf": "^6.0.1",
88
89
  "rollup": "^4.22.4",
89
90
  "rollup-plugin-json": "^4.0.0",
91
+ "rollup-plugin-polyfill-node": "^0.13.0",
90
92
  "rollup-plugin-typescript2": "^0.36.0",
91
93
  "shelljs": "^0.8.5",
92
94
  "ts-jest": "^29.2.3",
@@ -94,5 +96,5 @@
94
96
  "ts-toolbelt": "^9.6.0",
95
97
  "typescript": "~5.5.4"
96
98
  },
97
- "gitHead": "2abf349e97af45f11210b3121078b9d96699d5da"
99
+ "gitHead": "f212ea3edaf1fac34d738b5d00a9892ab7a3b721"
98
100
  }