@cloudbase/manager-node 3.12.1-beta → 4.0.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.
package/CHANGELOG.md
CHANGED
|
@@ -70,6 +70,14 @@ class CloudService {
|
|
|
70
70
|
cam: 'https://cam.tencentcloudapi.com',
|
|
71
71
|
cdn: 'https://cdn.tencentcloudapi.com'
|
|
72
72
|
};
|
|
73
|
+
// 检测环境变量,云梯账号走内网域名
|
|
74
|
+
const USE_INTERNAL_ENDPOINT = "USE_INTERNAL_ENDPOINT";
|
|
75
|
+
const intranetUrlMap = Object.keys(urlMap).map((service) => ({
|
|
76
|
+
[service]: `https://${service}.internal.tencentcloudapi.com`,
|
|
77
|
+
})).reduce((acc, cur) => (Object.assign(Object.assign({}, acc), cur)), {});
|
|
78
|
+
if (USE_INTERNAL_ENDPOINT in process.env) {
|
|
79
|
+
return intranetUrlMap[this.service];
|
|
80
|
+
}
|
|
73
81
|
if (urlMap[this.service]) {
|
|
74
82
|
return urlMap[this.service];
|
|
75
83
|
}
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.fetchStream = exports.fetch = void 0;
|
|
7
7
|
const url_1 = require("url");
|
|
8
8
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
|
-
const https_proxy_agent_1 =
|
|
9
|
+
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
10
10
|
const error_1 = require("../error");
|
|
11
11
|
// 使用 fetch + 代理
|
|
12
12
|
async function fetch(url, config = {}, proxy) {
|
|
13
13
|
if (proxy || process.env.http_proxy) {
|
|
14
|
-
config.agent = new https_proxy_agent_1.
|
|
14
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy || process.env.http_proxy);
|
|
15
15
|
}
|
|
16
16
|
// 解决中文编码问题
|
|
17
17
|
const escapeUrl = new url_1.URL(url).toString();
|
|
@@ -35,7 +35,7 @@ async function fetch(url, config = {}, proxy) {
|
|
|
35
35
|
exports.fetch = fetch;
|
|
36
36
|
async function fetchStream(url, config = {}, proxy) {
|
|
37
37
|
if (proxy || process.env.http_proxy) {
|
|
38
|
-
config.agent = new https_proxy_agent_1.
|
|
38
|
+
config.agent = new https_proxy_agent_1.HttpsProxyAgent(proxy || process.env.http_proxy);
|
|
39
39
|
}
|
|
40
40
|
// 解决中文编码问题
|
|
41
41
|
const escapeUrl = new url_1.URL(url).toString();
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/manager-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "The node manage service api for cloudbase.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "rimraf lib types && npx tsc",
|
|
8
8
|
"test": "jest --runInBand --detectOpenHandles --coverage --testTimeout=50000",
|
|
9
9
|
"lint": "eslint \"./**/*.ts\"",
|
|
10
|
-
"lint:fix": "eslint --fix \"./**/*.ts\""
|
|
10
|
+
"lint:fix": "eslint --fix \"./**/*.ts\"",
|
|
11
|
+
"prepublishOnly": "npm run build"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
|
13
14
|
"type": "git",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"archiver": "^3.1.1",
|
|
37
38
|
"cos-nodejs-sdk-v5": "2.9.0",
|
|
38
39
|
"del": "^5.1.0",
|
|
39
|
-
"https-proxy-agent": "^
|
|
40
|
+
"https-proxy-agent": "^5.0.1",
|
|
40
41
|
"make-dir": "^3.0.0",
|
|
41
42
|
"micromatch": "^4.0.2",
|
|
42
43
|
"node-fetch": "^2.6.0",
|
|
@@ -91,6 +91,18 @@ export class CloudService {
|
|
|
91
91
|
cam: 'https://cam.tencentcloudapi.com',
|
|
92
92
|
cdn: 'https://cdn.tencentcloudapi.com'
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
// 检测环境变量,云梯账号走内网域名
|
|
96
|
+
const USE_INTERNAL_ENDPOINT = "USE_INTERNAL_ENDPOINT"
|
|
97
|
+
|
|
98
|
+
const intranetUrlMap = Object.keys(urlMap).map((service) => ({
|
|
99
|
+
[service]: `https://${service}.internal.tencentcloudapi.com`,
|
|
100
|
+
})).reduce((acc, cur) => ({ ...acc, ...cur }), {})
|
|
101
|
+
|
|
102
|
+
if(USE_INTERNAL_ENDPOINT in process.env) {
|
|
103
|
+
return intranetUrlMap[this.service]
|
|
104
|
+
}
|
|
105
|
+
|
|
94
106
|
if (urlMap[this.service]) {
|
|
95
107
|
return urlMap[this.service]
|
|
96
108
|
} else {
|