@huaweicloud/huaweicloud-sdk-core 3.1.21 → 3.1.23

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
@@ -1,3 +1,86 @@
1
+ # 3.1.23 2023-02-09
2
+
3
+ ### HuaweiCloud SDK CDN
4
+
5
+ - _Features_
6
+ - Support the service `Content Delivery Network`
7
+ - _Bug Fix_
8
+ - None
9
+ - _Change_
10
+ - None
11
+
12
+ ### HuaweiCloud SDK FunctionGraph
13
+
14
+ - _Features_
15
+ - None
16
+ - _Bug Fix_
17
+ - None
18
+ - _Change_
19
+ - Add the response parameter `error_code` to the interface `ListAsyncInvocations`
20
+
21
+ ### HuaweiCloud SDK IoTDA
22
+
23
+ - _Features_
24
+ - None
25
+ - _Bug Fix_
26
+ - None
27
+ - _Change_
28
+ - Add the response parameters `roma_forwarding`, `influxdb_forwarding`, `functiongraph_forwarding`, `mrs_kafka_forwarding`, `dms_rocketmq_forwarding` to the interface `ListRuleActions`
29
+ - Add the request parameters `roma_forwarding`, `influxdb_forwarding`, `functiongraph_forwarding`, `mrs_kafka_forwarding`, `dms_rocketmq_forwarding` to the interface `CreateRuleAction`
30
+ - Changes of the interface `UpdateRuleAction`:
31
+ - Add the request parameters `roma_forwarding`, `influxdb_forwarding`, `functiongraph_forwarding`, `mrs_kafka_forwarding`, `dms_rocketmq_forwarding`
32
+ - Add the response parameters `roma_forwarding`, `influxdb_forwarding`, `functiongraph_forwarding`, `mrs_kafka_forwarding`, `dms_rocketmq_forwarding`
33
+ - Add the response parameters `roma_forwarding`, `influxdb_forwarding`, `functiongraph_forwarding`, `mrs_kafka_forwarding`, `dms_rocketmq_forwarding` to the interface `ShowRuleAction`
34
+
35
+ ### HuaweiCloud SDK OCR
36
+
37
+ - _Features_
38
+ - None
39
+ - _Bug Fix_
40
+ - None
41
+ - _Change_
42
+ - Changes of the interface `RecognizeTollInvoice`:
43
+ - Add the request parameter `return_text_location`
44
+ - Add the response parameter `text_location`
45
+
46
+ # 3.1.22 2023-02-02
47
+
48
+ ### HuaweiCloud SDK AOS
49
+
50
+ - _Features_
51
+ - Support the interface `UpdateStack`
52
+ - _Bug Fix_
53
+ - None
54
+ - _Change_
55
+ - Add the request parameter `executor` to the interface `ApplyExecutionPlan`
56
+ - Changes of the interface `ListStackEvents`:
57
+ - Add the request parameters `filter`, `field`
58
+ - Remove the response parameters `resource_id_key`, `resource_id_value`, `resource_name`, `resource_type`, `time`, `event_type`, `event_message`, `elapsed_seconds`
59
+ - The response parameter `stack_name` changed to required of the interface `GetStackMetadata`
60
+ - Add the request parameter `executor` to the interface `CreateStack`
61
+ - Changes of the interface `ListStackResources`:
62
+ - Add the response parameter `index_key`
63
+ - Remove the enum values `DELETION_SKIPPED` from the response parameter `resource_status`
64
+ - Add the request parameter `executor` to the interface `DeployStack`
65
+
66
+ ### HuaweiCloud SDK IMS
67
+
68
+ - _Features_
69
+ - None
70
+ - _Bug Fix_
71
+ - None
72
+ - _Change_
73
+ - Add the enum values `IsoImage` to the request parameter `type` to the interface `CreateImage`
74
+
75
+ ### HuaweiCloud SDK Moderation
76
+
77
+ - _Features_
78
+ - None
79
+ - _Bug Fix_
80
+ - None
81
+ - _Change_
82
+ - Add the request parameter `white_glossaries` to the interface `RunTextModeration`
83
+
1
84
  # 3.1.21 2023-01-12
2
85
 
3
86
  ### HuaweiCloud SDK FRS
package/CHANGELOG_CN.md CHANGED
@@ -1,3 +1,86 @@
1
+ # 3.1.23 2023-02-09
2
+
3
+ ### HuaweiCloud SDK CDN
4
+
5
+ - _新增特性_
6
+ - 支持内容分发网络服务
7
+ - _解决问题_
8
+ - 无
9
+ - _特性变更_
10
+ - 无
11
+
12
+ ### HuaweiCloud SDK FunctionGraph
13
+
14
+ - _新增特性_
15
+ - 无
16
+ - _解决问题_
17
+ - 无
18
+ - _特性变更_
19
+ - 接口`ListAsyncInvocations`新增响应参数 `error_code`
20
+
21
+ ### HuaweiCloud SDK IoTDA
22
+
23
+ - _新增特性_
24
+ - 无
25
+ - _解决问题_
26
+ - 无
27
+ - _特性变更_
28
+ - 接口`ListRuleActions`新增响应参数 `roma_forwarding`、`influxdb_forwarding`、`functiongraph_forwarding`、`mrs_kafka_forwarding`、`dms_rocketmq_forwarding`
29
+ - 接口`CreateRuleAction`新增请求参数 `roma_forwarding`、`influxdb_forwarding`、`functiongraph_forwarding`、`mrs_kafka_forwarding`、`dms_rocketmq_forwarding`
30
+ - 接口`UpdateRuleAction`:
31
+ - 新增请求参数 `roma_forwarding`、`influxdb_forwarding`、`functiongraph_forwarding`、`mrs_kafka_forwarding`、`dms_rocketmq_forwarding`
32
+ - 新增响应参数 `roma_forwarding`、`influxdb_forwarding`、`functiongraph_forwarding`、`mrs_kafka_forwarding`、`dms_rocketmq_forwarding`
33
+ - 接口`ShowRuleAction`新增响应参数 `roma_forwarding`、`influxdb_forwarding`、`functiongraph_forwarding`、`mrs_kafka_forwarding`、`dms_rocketmq_forwarding`
34
+
35
+ ### HuaweiCloud SDK OCR
36
+
37
+ - _新增特性_
38
+ - 无
39
+ - _解决问题_
40
+ - 无
41
+ - _特性变更_
42
+ - 接口`RecognizeTollInvoice`:
43
+ - 新增请求参数 `return_text_location`
44
+ - 新增响应参数 `text_location`
45
+
46
+ # 3.1.22 2023-02-02
47
+
48
+ ### HuaweiCloud SDK AOS
49
+
50
+ - _新增特性_
51
+ - 支持接口`UpdateStack`
52
+ - _解决问题_
53
+ - 无
54
+ - _特性变更_
55
+ - 接口`ApplyExecutionPlan`新增请求参数 `executor`
56
+ - 接口`ListStackEvents`:
57
+ - 新增请求参数 `filter`、`field`
58
+ - 移除响应参数 `resource_id_key`、`resource_id_value`、`resource_name`、`resource_type`、`time`、`event_type`、`event_message`、`elapsed_seconds`
59
+ - 接口`GetStackMetadata`响应参数`stack_name`改为必填
60
+ - 接口`CreateStack`新增请求参数 `executor`
61
+ - 接口`ListStackResources`:
62
+ - 新增响应参数 `index_key`
63
+ - 响应参数`resource_status`移除枚举值`DELETION_SKIPPED`
64
+ - 接口`DeployStack`新增请求参数 `executor`
65
+
66
+ ### HuaweiCloud SDK IMS
67
+
68
+ - _新增特性_
69
+ - 无
70
+ - _解决问题_
71
+ - 无
72
+ - _特性变更_
73
+ - 接口`CreateImage`请求参数`type`新增枚举值`IsoImage`
74
+
75
+ ### HuaweiCloud SDK Moderation
76
+
77
+ - _新增特性_
78
+ - 无
79
+ - _解决问题_
80
+ - 无
81
+ - _特性变更_
82
+ - 接口`RunTextModeration`新增请求参数 `white_glossaries`
83
+
1
84
  # 3.1.21 2023-01-12
2
85
 
3
86
  ### HuaweiCloud SDK FRS
package/ClientBuilder.js CHANGED
@@ -57,7 +57,7 @@ var ClientBuilder = /** @class */ (function () {
57
57
  return this;
58
58
  };
59
59
  ClientBuilder.prototype.build = function () {
60
- var _a;
60
+ var _a, _b;
61
61
  var axiosOptions = {
62
62
  disableSslVerification: true
63
63
  };
@@ -68,6 +68,9 @@ var ClientBuilder = /** @class */ (function () {
68
68
  axiosOptions.headers = axiosOptions.headers || {};
69
69
  axiosOptions.headers["User-Agent"] = this.userOptions.customUserAgent;
70
70
  }
71
+ if ((_b = this.userOptions) === null || _b === void 0 ? void 0 : _b.axiosRequestConfig) {
72
+ axiosOptions.axiosRequestConfig = this.userOptions.axiosRequestConfig;
73
+ }
71
74
  if (!this.credential) {
72
75
  this.credential = this.getCredentialFromEnvironment();
73
76
  }
package/HcClient.js CHANGED
@@ -60,6 +60,7 @@ exports.HcClient = void 0;
60
60
  var IHttpRequestBuilder_1 = require("./http/IHttpRequestBuilder");
61
61
  var ExceptionUtil_1 = require("./exception/ExceptionUtil");
62
62
  var logger_1 = require("./logger");
63
+ var SdkStreamResponse_1 = require("./SdkStreamResponse");
63
64
  var HcClient = /** @class */ (function () {
64
65
  function HcClient(client) {
65
66
  this.proxyAgent = '';
@@ -158,6 +159,9 @@ var HcClient = /** @class */ (function () {
158
159
  httpRequest['responseHeaders'] = options['responseHeaders'];
159
160
  }
160
161
  httpRequest.proxy = this.proxyAgent;
162
+ if (options.axiosRequestConfig) {
163
+ httpRequest.axiosRequestConfig = options.axiosRequestConfig;
164
+ }
161
165
  return [2 /*return*/, httpRequest];
162
166
  }
163
167
  });
@@ -166,15 +170,21 @@ var HcClient = /** @class */ (function () {
166
170
  HcClient.prototype.extractResponse = function (result) {
167
171
  var headers = result.headers;
168
172
  var contentType = headers['content-type'];
169
- contentType = contentType.toLowerCase();
170
- if (contentType && (contentType.startsWith('application/octet-stream') || contentType.startsWith("image"))) {
171
- return result.data;
173
+ contentType = contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase();
174
+ if (contentType
175
+ && (contentType.startsWith('application/octet-stream')
176
+ || contentType.startsWith("image")
177
+ || contentType.startsWith("application/zip"))) {
178
+ var streamRes = new SdkStreamResponse_1.SdkStreamResponse();
179
+ streamRes.body = result.data;
180
+ streamRes.httpStatusCode = result.statusCode;
181
+ return streamRes;
172
182
  }
173
183
  else {
174
184
  var response = result.data instanceof Object ? result.data : {};
175
185
  var sdkRespone = response;
176
186
  sdkRespone.httpStatusCode = result.statusCode;
177
- return response;
187
+ return sdkRespone;
178
188
  }
179
189
  };
180
190
  HcClient.loggerName = 'HcClient';
package/README_CN.md CHANGED
@@ -120,7 +120,7 @@ client.withProxyAgent("http://username:password@proxy.huaweicloud.com:8080")
120
120
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
121
121
  ```
122
122
 
123
- ### 2. 客户端认证信息 [:top:](#用户手册-top)
123
+ ### 2. 认证信息配置 [:top:](#用户手册-top)
124
124
 
125
125
  华为云服务存在两种部署方式,Region 级服务和 Global 级服务。
126
126
 
@@ -0,0 +1,4 @@
1
+ export declare class SdkStreamResponse {
2
+ httpStatusCode?: number;
3
+ body?: any;
4
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Huawei Technologies Co.,Ltd.
4
+ *
5
+ * Licensed to the Apache Software Foundation (ASF) under one
6
+ * or more contributor license agreements. See the NOTICE file
7
+ * distributed with this work for additional information
8
+ * regarding copyright ownership. The ASF licenses this file
9
+ * to you under the Apache License, Version 2.0 (the
10
+ * "License"); you may not use this file except in compliance
11
+ * with the License. You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing,
16
+ * software distributed under the License is distributed on an
17
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ * KIND, either express or implied. See the License for the
19
+ * specific language governing permissions and limitations
20
+ * under the License.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.SdkStreamResponse = void 0;
24
+ var SdkStreamResponse = /** @class */ (function () {
25
+ function SdkStreamResponse() {
26
+ }
27
+ return SdkStreamResponse;
28
+ }());
29
+ exports.SdkStreamResponse = SdkStreamResponse;
package/UserOptions.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { AxiosRequestConfig } from "axios";
1
2
  export declare class UserOptions {
2
3
  customUserAgent?: string;
4
+ axiosRequestConfig?: AxiosRequestConfig;
3
5
  }
@@ -76,6 +76,7 @@ var AKSKSigner = /** @class */ (function () {
76
76
  };
77
77
  ;
78
78
  AKSKSigner.sign = function (request, credential) {
79
+ var _a;
79
80
  var authenticationHeaders = {};
80
81
  var dateTimeStamp = request.headers[this.HeaderXDate];
81
82
  if (dateTimeStamp) {
@@ -98,7 +99,7 @@ var AKSKSigner = /** @class */ (function () {
98
99
  var allHeaders = {};
99
100
  var current_headers = {};
100
101
  Object.assign(current_headers, request.headers);
101
- if (current_headers['content-type'].indexOf('multipart/form-data') !== -1) {
102
+ if (((_a = current_headers['content-type']) === null || _a === void 0 ? void 0 : _a.indexOf('multipart/form-data')) !== -1) {
102
103
  delete current_headers['content-type'];
103
104
  }
104
105
  Object.assign(allHeaders, current_headers, authenticationHeaders);
@@ -1,3 +1,4 @@
1
+ import { AxiosRequestConfig } from 'axios';
1
2
  import { IHttpRequest } from './IHttpRequest';
2
3
  import { HttpClient } from './HttpClient';
3
4
  import { Logger, LogLevel } from '../logger';
@@ -24,4 +25,5 @@ export interface ClientOptions {
24
25
  headers?: any;
25
26
  logger?: Logger;
26
27
  logLevel?: LogLevel;
28
+ axiosRequestConfig?: AxiosRequestConfig;
27
29
  }
@@ -93,13 +93,17 @@ var DefaultHttpClient = /** @class */ (function () {
93
93
  if (this.defaultOption.proxy && this.defaultOption.proxy !== '') {
94
94
  proxyAgent = HttpsProxyAgent(this.defaultOption.proxy);
95
95
  }
96
- this.axiosInstance = axios_1.default.create({
96
+ var axiosRequestConfig = {
97
97
  maxContentLength: Infinity,
98
98
  headers: Object.assign(this.DEFAULT_HEADERS, this.defaultOption.headers),
99
99
  proxy: false,
100
100
  httpAgent: proxyAgent,
101
101
  httpsAgent: proxyAgent
102
- });
102
+ };
103
+ if (this.defaultOption.axiosRequestConfig) {
104
+ Object.assign(axiosRequestConfig, this.defaultOption.axiosRequestConfig);
105
+ }
106
+ this.axiosInstance = axios_1.default.create(axiosRequestConfig);
103
107
  this.axiosInstance.interceptors.request.use(function (request) {
104
108
  var url = request.url, method = request.method, data = request.data, headers = request.headers;
105
109
  _this.logger.debug("Request: ".concat(method.toUpperCase(), " ").concat(url, " ").concat(JSON.stringify(headers), " ").concat(JSON.stringify(data)));
@@ -132,7 +136,7 @@ var DefaultHttpClient = /** @class */ (function () {
132
136
  DefaultHttpClient.httpResponse = res;
133
137
  var result = _this._convertResponse(httpRequest, res);
134
138
  return {
135
- data: result instanceof String ? undefined : result,
139
+ data: result,
136
140
  statusCode: res.status,
137
141
  headers: res.headers
138
142
  };
@@ -174,6 +178,9 @@ var DefaultHttpClient = /** @class */ (function () {
174
178
  return (0, querystring_1.stringify)(params);
175
179
  },
176
180
  };
181
+ if (httpRequest.axiosRequestConfig) {
182
+ Object.assign(requestParams, httpRequest.axiosRequestConfig);
183
+ }
177
184
  methods = ['PUT', 'POST', 'PATCH', 'DELETE'];
178
185
  if (method && methods.indexOf(method.toUpperCase()) !== -1) {
179
186
  requestParams = Object.assign(requestParams, {
@@ -1,3 +1,4 @@
1
+ import { AxiosRequestConfig } from "axios";
1
2
  export interface IHttpRequest {
2
3
  params?: any;
3
4
  endpoint?: string | undefined;
@@ -10,8 +11,10 @@ export interface IHttpRequest {
10
11
  proxy?: any;
11
12
  getPathParams?: () => any;
12
13
  responseHeaders?: any;
14
+ axiosRequestConfig?: AxiosRequestConfig;
13
15
  }
14
16
  export declare class HttpRequestImpl implements IHttpRequest {
17
+ axiosRequestConfig?: AxiosRequestConfig;
15
18
  params: any;
16
19
  endpoint: string | undefined;
17
20
  contentType: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaweicloud/huaweicloud-sdk-core",
3
- "version": "3.1.21",
3
+ "version": "3.1.23",
4
4
  "description": "Core code for Huaweicloud SDK for Node.js",
5
5
  "main": "huaweicloud-sdk-core.js",
6
6
  "typings": "huaweicloud-sdk-core.d.ts",
@@ -36,7 +36,7 @@
36
36
  "@types/lodash": "^4.14.172",
37
37
  "@types/mocha": "^8.2.2",
38
38
  "@types/node": "^14.14.37",
39
- "@types/sinon": "^10.0.2",
39
+ "@types/sinon": "^10.0.13",
40
40
  "busboy": "^0.3.1",
41
41
  "chai": "^4.3.4",
42
42
  "chai-like": "^1.1.1",
@@ -47,8 +47,8 @@
47
47
  "nock": "^13.1.0",
48
48
  "nyc": "^15.1.0",
49
49
  "shx": "^0.3.2",
50
- "sinon": "^11.1.2",
51
- "ts-node": "^9.1.1",
50
+ "sinon": "^15.0.1",
51
+ "ts-node": "^10.9.1",
52
52
  "tslint": "^6.1.3",
53
53
  "typescript": "^4.1.0"
54
54
  }