ibm-cloud-sdk-core 2.17.4 → 2.17.8
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 +28 -0
- package/README.md +0 -1
- package/docs/ibm-cloud-sdk-core.api.json +1 -1
- package/es/lib/request-wrapper.js +7 -24
- package/es/tsdoc-metadata.json +1 -1
- package/lib/request-wrapper.js +8 -25
- package/package.json +4 -2
- package/temp/ibm-cloud-sdk-core.api.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [2.17.8](https://github.com/IBM/node-sdk-core/compare/v2.17.7...v2.17.8) (2022-01-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* avoid errors during logging of requests/responses ([#188](https://github.com/IBM/node-sdk-core/issues/188)) ([d05ea1a](https://github.com/IBM/node-sdk-core/commit/d05ea1a560a35a33a44aea0c5f9d24af65929d0b))
|
|
7
|
+
|
|
8
|
+
## [2.17.7](https://github.com/IBM/node-sdk-core/compare/v2.17.6...v2.17.7) (2022-01-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* remove 'module' entry from package.json ([#187](https://github.com/IBM/node-sdk-core/issues/187)) ([3a0aea5](https://github.com/IBM/node-sdk-core/commit/3a0aea5109f01d61ad54c79a7a6f2606fb845ab8))
|
|
14
|
+
|
|
15
|
+
## [2.17.6](https://github.com/IBM/node-sdk-core/compare/v2.17.5...v2.17.6) (2022-01-05)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* use npm8 and package-lock v2 ([#186](https://github.com/IBM/node-sdk-core/issues/186)) ([6b1122c](https://github.com/IBM/node-sdk-core/commit/6b1122c5318c304454414dcd9cafb9b151c5b51a))
|
|
21
|
+
|
|
22
|
+
## [2.17.5](https://github.com/IBM/node-sdk-core/compare/v2.17.4...v2.17.5) (2021-12-17)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* avoid Buffer re-encode during compression ([#184](https://github.com/IBM/node-sdk-core/issues/184)) ([8b82f36](https://github.com/IBM/node-sdk-core/commit/8b82f36bf6d4ac0163563ce3a10f0a395bd87627))
|
|
28
|
+
|
|
1
29
|
## [2.17.4](https://github.com/IBM/node-sdk-core/compare/v2.17.3...v2.17.4) (2021-12-16)
|
|
2
30
|
|
|
3
31
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
[](https://app.travis-ci.com/IBM/node-sdk-core)
|
|
2
2
|
[](https://www.npmjs.com/package/ibm-cloud-sdk-core)
|
|
3
|
-
[](https://codecov.io/gh/IBM/node-sdk-core)
|
|
4
3
|
[](https://github.com/semantic-release/semantic-release)
|
|
5
4
|
[](https://cla-assistant.io/ibm/node-sdk-core)
|
|
6
5
|
|
|
@@ -99,40 +99,20 @@ export class RequestWrapper {
|
|
|
99
99
|
if (process.env.NODE_DEBUG === 'axios' || process.env.DEBUG) {
|
|
100
100
|
this.axiosInstance.interceptors.request.use((config) => {
|
|
101
101
|
logger.debug('Request:');
|
|
102
|
-
|
|
103
|
-
logger.debug(JSON.stringify(config, null, 2));
|
|
104
|
-
}
|
|
105
|
-
catch (_a) {
|
|
106
|
-
logger.error(config);
|
|
107
|
-
}
|
|
102
|
+
logger.debug(config);
|
|
108
103
|
return config;
|
|
109
104
|
}, (error) => {
|
|
110
105
|
logger.error('Error: ');
|
|
111
|
-
|
|
112
|
-
logger.error(JSON.stringify(error, null, 2));
|
|
113
|
-
}
|
|
114
|
-
catch (_a) {
|
|
115
|
-
logger.error(error);
|
|
116
|
-
}
|
|
106
|
+
logger.error(error);
|
|
117
107
|
return Promise.reject(error);
|
|
118
108
|
});
|
|
119
109
|
this.axiosInstance.interceptors.response.use((response) => {
|
|
120
110
|
logger.debug('Response:');
|
|
121
|
-
|
|
122
|
-
logger.debug(JSON.stringify(response, null, 2));
|
|
123
|
-
}
|
|
124
|
-
catch (_a) {
|
|
125
|
-
logger.error(response);
|
|
126
|
-
}
|
|
111
|
+
logger.debug(response);
|
|
127
112
|
return response;
|
|
128
113
|
}, (error) => {
|
|
129
114
|
logger.error('Error: ');
|
|
130
|
-
|
|
131
|
-
logger.error(JSON.stringify(error, null, 2));
|
|
132
|
-
}
|
|
133
|
-
catch (_a) {
|
|
134
|
-
logger.error(error);
|
|
135
|
-
}
|
|
115
|
+
logger.error(error);
|
|
136
116
|
return Promise.reject(error);
|
|
137
117
|
});
|
|
138
118
|
}
|
|
@@ -363,6 +343,9 @@ export class RequestWrapper {
|
|
|
363
343
|
const streamData = yield streamToPromise(data);
|
|
364
344
|
reqBuffer = Buffer.isBuffer(streamData) ? streamData : Buffer.from(streamData);
|
|
365
345
|
}
|
|
346
|
+
else if (Buffer.isBuffer(data)) {
|
|
347
|
+
reqBuffer = data;
|
|
348
|
+
}
|
|
366
349
|
else if (data.toString && data.toString() !== '[object Object]' && !Array.isArray(data)) {
|
|
367
350
|
// this handles pretty much any primitive that isnt a JSON object or array
|
|
368
351
|
reqBuffer = Buffer.from(data.toString());
|
package/es/tsdoc-metadata.json
CHANGED
package/lib/request-wrapper.js
CHANGED
|
@@ -149,40 +149,20 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
149
149
|
if (process.env.NODE_DEBUG === 'axios' || process.env.DEBUG) {
|
|
150
150
|
this.axiosInstance.interceptors.request.use(function (config) {
|
|
151
151
|
logger_1.default.debug('Request:');
|
|
152
|
-
|
|
153
|
-
logger_1.default.debug(JSON.stringify(config, null, 2));
|
|
154
|
-
}
|
|
155
|
-
catch (_a) {
|
|
156
|
-
logger_1.default.error(config);
|
|
157
|
-
}
|
|
152
|
+
logger_1.default.debug(config);
|
|
158
153
|
return config;
|
|
159
154
|
}, function (error) {
|
|
160
155
|
logger_1.default.error('Error: ');
|
|
161
|
-
|
|
162
|
-
logger_1.default.error(JSON.stringify(error, null, 2));
|
|
163
|
-
}
|
|
164
|
-
catch (_a) {
|
|
165
|
-
logger_1.default.error(error);
|
|
166
|
-
}
|
|
156
|
+
logger_1.default.error(error);
|
|
167
157
|
return Promise.reject(error);
|
|
168
158
|
});
|
|
169
159
|
this.axiosInstance.interceptors.response.use(function (response) {
|
|
170
160
|
logger_1.default.debug('Response:');
|
|
171
|
-
|
|
172
|
-
logger_1.default.debug(JSON.stringify(response, null, 2));
|
|
173
|
-
}
|
|
174
|
-
catch (_a) {
|
|
175
|
-
logger_1.default.error(response);
|
|
176
|
-
}
|
|
161
|
+
logger_1.default.debug(response);
|
|
177
162
|
return response;
|
|
178
163
|
}, function (error) {
|
|
179
164
|
logger_1.default.error('Error: ');
|
|
180
|
-
|
|
181
|
-
logger_1.default.error(JSON.stringify(error, null, 2));
|
|
182
|
-
}
|
|
183
|
-
catch (_a) {
|
|
184
|
-
logger_1.default.error(error);
|
|
185
|
-
}
|
|
165
|
+
logger_1.default.error(error);
|
|
186
166
|
return Promise.reject(error);
|
|
187
167
|
});
|
|
188
168
|
}
|
|
@@ -429,7 +409,10 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
429
409
|
reqBuffer = Buffer.isBuffer(streamData) ? streamData : Buffer.from(streamData);
|
|
430
410
|
return [3 /*break*/, 4];
|
|
431
411
|
case 3:
|
|
432
|
-
if (
|
|
412
|
+
if (Buffer.isBuffer(data)) {
|
|
413
|
+
reqBuffer = data;
|
|
414
|
+
}
|
|
415
|
+
else if (data.toString && data.toString() !== '[object Object]' && !Array.isArray(data)) {
|
|
433
416
|
// this handles pretty much any primitive that isnt a JSON object or array
|
|
434
417
|
reqBuffer = Buffer.from(data.toString());
|
|
435
418
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ibm-cloud-sdk-core",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.8",
|
|
4
4
|
"description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"module": "./es/index.js",
|
|
7
6
|
"typings": "./es/index.d.ts",
|
|
8
7
|
"sideEffects": false,
|
|
9
8
|
"repository": {
|
|
@@ -32,6 +31,9 @@
|
|
|
32
31
|
}
|
|
33
32
|
],
|
|
34
33
|
"license": "Apache-2.0",
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
35
37
|
"bugs": {
|
|
36
38
|
"url": "https://github.com/IBM/node-sdk-core/issues"
|
|
37
39
|
},
|