@ledgerhq/live-network
Advanced tools
Comparing version 1.1.10 to 1.1.11-custom-exchange.0
# @ledgerhq/live-network | ||
## 1.1.11-custom-exchange.0 | ||
### Patch Changes | ||
- [#5785](https://github.com/LedgerHQ/ledger-live/pull/5785) [`dd5d930`](https://github.com/LedgerHQ/ledger-live/commit/dd5d9308e0e3ef8ca78f879c15bc07313ef3c8c4) Thanks [@lvndry](https://github.com/lvndry)! - Inject https agent in all platform other than mobile | ||
- Updated dependencies [[`2358e87`](https://github.com/LedgerHQ/ledger-live/commit/2358e8748d9ae9398cfc05a0ec20a6b191fc7324)]: | ||
- @ledgerhq/live-env@0.9.0-custom-exchange.0 | ||
## 1.1.10 | ||
@@ -4,0 +13,0 @@ |
@@ -0,1 +1,2 @@ | ||
var _a; | ||
import { LedgerAPI4xx, LedgerAPI5xx, NetworkDown } from "@ledgerhq/errors"; | ||
@@ -70,7 +71,12 @@ import { changes, getEnv } from "@ledgerhq/live-env"; | ||
axios.interceptors.response.use(responseInterceptor, errorInterceptor); | ||
// not react native | ||
if (!(typeof navigator !== "undefined" && navigator.product === "ReactNative")) { | ||
/** | ||
* We only allow HTTPS agent on platforms other than LLM because | ||
* https library is not compatible with react native | ||
*/ | ||
const NETWORK_USE_HTTPS_KEEP_ALIVE = !((_a = getEnv("LEDGER_CLIENT_VERSION")) === null || _a === void 0 ? void 0 : _a.startsWith("llm-")); | ||
if (NETWORK_USE_HTTPS_KEEP_ALIVE) { | ||
// the keepAlive is necessary when we make a lot of request in in parallel, especially for bitcoin sync. Otherwise, it may raise "connect ETIMEDOUT" error | ||
// this should only be needed in Windows as UNIX systems reuse TCP packets by default | ||
// refer to https://stackoverflow.com/questions/63064393/getting-axios-error-connect-etimedout-when-making-high-volume-of-calls | ||
// eslint-disable-next-line global-require,@typescript-eslint/no-var-requires | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const https = require("https"); | ||
@@ -77,0 +83,0 @@ axios.defaults.httpsAgent = new https.Agent({ keepAlive: true }); |
@@ -5,2 +5,3 @@ "use strict"; | ||
}; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -80,7 +81,12 @@ exports.errorInterceptor = exports.responseInterceptor = exports.requestInterceptor = void 0; | ||
axios_1.default.interceptors.response.use(exports.responseInterceptor, exports.errorInterceptor); | ||
// not react native | ||
if (!(typeof navigator !== "undefined" && navigator.product === "ReactNative")) { | ||
/** | ||
* We only allow HTTPS agent on platforms other than LLM because | ||
* https library is not compatible with react native | ||
*/ | ||
const NETWORK_USE_HTTPS_KEEP_ALIVE = !((_a = (0, live_env_1.getEnv)("LEDGER_CLIENT_VERSION")) === null || _a === void 0 ? void 0 : _a.startsWith("llm-")); | ||
if (NETWORK_USE_HTTPS_KEEP_ALIVE) { | ||
// the keepAlive is necessary when we make a lot of request in in parallel, especially for bitcoin sync. Otherwise, it may raise "connect ETIMEDOUT" error | ||
// this should only be needed in Windows as UNIX systems reuse TCP packets by default | ||
// refer to https://stackoverflow.com/questions/63064393/getting-axios-error-connect-etimedout-when-making-high-volume-of-calls | ||
// eslint-disable-next-line global-require,@typescript-eslint/no-var-requires | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const https = require("https"); | ||
@@ -87,0 +93,0 @@ axios_1.default.defaults.httpsAgent = new https.Agent({ keepAlive: true }); |
{ | ||
"name": "@ledgerhq/live-network", | ||
"version": "1.1.10", | ||
"version": "1.1.11-custom-exchange.0", | ||
"description": "Ledger Live network and cache utilities", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
"@ledgerhq/errors": "^6.16.1", | ||
"@ledgerhq/live-env": "^0.8.0", | ||
"@ledgerhq/live-env": "^0.9.0-custom-exchange.0", | ||
"@ledgerhq/live-promise": "^0.0.3", | ||
@@ -59,0 +59,0 @@ "@ledgerhq/logs": "^6.12.0" |
@@ -102,7 +102,12 @@ import { LedgerAPI4xx, LedgerAPI5xx, NetworkDown } from "@ledgerhq/errors"; | ||
// not react native | ||
if (!(typeof navigator !== "undefined" && navigator.product === "ReactNative")) { | ||
/** | ||
* We only allow HTTPS agent on platforms other than LLM because | ||
* https library is not compatible with react native | ||
*/ | ||
const NETWORK_USE_HTTPS_KEEP_ALIVE = !getEnv("LEDGER_CLIENT_VERSION")?.startsWith("llm-"); | ||
if (NETWORK_USE_HTTPS_KEEP_ALIVE) { | ||
// the keepAlive is necessary when we make a lot of request in in parallel, especially for bitcoin sync. Otherwise, it may raise "connect ETIMEDOUT" error | ||
// this should only be needed in Windows as UNIX systems reuse TCP packets by default | ||
// refer to https://stackoverflow.com/questions/63064393/getting-axios-error-connect-etimedout-when-making-high-volume-of-calls | ||
// eslint-disable-next-line global-require,@typescript-eslint/no-var-requires | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const https = require("https"); | ||
@@ -158,3 +163,3 @@ axios.defaults.httpsAgent = new https.Agent({ keepAlive: true }); | ||
invariant(typeof arg === "object", "network takes an object as parameter"); | ||
let promise; | ||
let promise: AxiosPromise; | ||
@@ -161,0 +166,0 @@ if (arg.method === "GET") { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76757
1107
2
+ Added@ledgerhq/live-env@0.9.0(transitive)
- Removed@ledgerhq/live-env@0.8.0(transitive)