Socket
Socket
Sign inDemoInstall

ibm-cloud-sdk-core

Package Overview
Dependencies
Maintainers
3
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibm-cloud-sdk-core - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [3.2.1](https://github.com/IBM/node-sdk-core/compare/v3.2.0...v3.2.1) (2022-10-21)
### Bug Fixes
* allow for synchronous building of file requests ([#211](https://github.com/IBM/node-sdk-core/issues/211)) ([dcce4ea](https://github.com/IBM/node-sdk-core/commit/dcce4ea78189e4619cde2d736436a30128cf4b59))
# [3.2.0](https://github.com/IBM/node-sdk-core/compare/v3.1.0...v3.2.0) (2022-10-12)

@@ -2,0 +9,0 @@

38

es/lib/request-wrapper.js

@@ -133,25 +133,23 @@ /* eslint-disable class-methods-use-this */

if (formData) {
Object.keys(formData).forEach((key) => {
const values = Array.isArray(formData[key]) ? formData[key] : [formData[key]];
for (const key of Object.keys(formData)) { // eslint-disable-line
let values = Array.isArray(formData[key]) ? formData[key] : [formData[key]];
// Skip keys with undefined/null values or empty object value
values
.filter((v) => v != null && !isEmptyObject(v))
.forEach((value) => __awaiter(this, void 0, void 0, function* () {
// Special case of empty file object
if (Object.prototype.hasOwnProperty.call(value, 'contentType') &&
!Object.prototype.hasOwnProperty.call(value, 'data')) {
return;
}
if (isFileWithMetadata(value)) {
const fileObj = yield buildRequestFileObject(value);
multipartForm.append(key, fileObj.value, fileObj.options);
}
else {
if (typeof value === 'object' && !isFileData(value)) {
value = JSON.stringify(value);
values = values.filter((v) => v != null && !isEmptyObject(v));
for (let value of values) { // eslint-disable-line
// Ignore special case of empty file object
if (!Object.prototype.hasOwnProperty.call(value, 'contentType') ||
Object.prototype.hasOwnProperty.call(value, 'data')) {
if (isFileWithMetadata(value)) {
const fileObj = yield buildRequestFileObject(value); // eslint-disable-line
multipartForm.append(key, fileObj.value, fileObj.options);
}
multipartForm.append(key, value);
else {
if (typeof value === 'object' && !isFileData(value)) {
value = JSON.stringify(value);
}
multipartForm.append(key, value);
}
}
}));
});
}
}
}

@@ -158,0 +156,0 @@ // Path params

@@ -178,6 +178,6 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var options, path, body, form, formData, qs, method, serviceUrl, headers, url, multipartForm, data, requestParams;
var options, path, body, form, formData, qs, method, serviceUrl, headers, url, multipartForm, _i, _a, key, values, _b, values_1, value, fileObj, data, requestParams;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -188,37 +188,37 @@ options = extend_1.default(true, {}, parameters.defaultOptions, parameters.options);

multipartForm = new form_data_1.default();
// Form params
if (formData) {
Object.keys(formData).forEach(function (key) {
var values = Array.isArray(formData[key]) ? formData[key] : [formData[key]];
// Skip keys with undefined/null values or empty object value
values
.filter(function (v) { return v != null && !helper_1.isEmptyObject(v); })
.forEach(function (value) { return __awaiter(_this, void 0, void 0, function () {
var fileObj;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
// Special case of empty file object
if (Object.prototype.hasOwnProperty.call(value, 'contentType') &&
!Object.prototype.hasOwnProperty.call(value, 'data')) {
return [2 /*return*/];
}
if (!helper_1.isFileWithMetadata(value)) return [3 /*break*/, 2];
return [4 /*yield*/, helper_1.buildRequestFileObject(value)];
case 1:
fileObj = _a.sent();
multipartForm.append(key, fileObj.value, fileObj.options);
return [3 /*break*/, 3];
case 2:
if (typeof value === 'object' && !helper_1.isFileData(value)) {
value = JSON.stringify(value);
}
multipartForm.append(key, value);
_a.label = 3;
case 3: return [2 /*return*/];
}
});
}); });
});
if (!formData) return [3 /*break*/, 7];
_i = 0, _a = Object.keys(formData);
_c.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 7];
key = _a[_i];
values = Array.isArray(formData[key]) ? formData[key] : [formData[key]];
// Skip keys with undefined/null values or empty object value
values = values.filter(function (v) { return v != null && !helper_1.isEmptyObject(v); });
_b = 0, values_1 = values;
_c.label = 2;
case 2:
if (!(_b < values_1.length)) return [3 /*break*/, 6];
value = values_1[_b];
if (!(!Object.prototype.hasOwnProperty.call(value, 'contentType') ||
Object.prototype.hasOwnProperty.call(value, 'data'))) return [3 /*break*/, 5];
if (!helper_1.isFileWithMetadata(value)) return [3 /*break*/, 4];
return [4 /*yield*/, helper_1.buildRequestFileObject(value)];
case 3:
fileObj = _c.sent();
multipartForm.append(key, fileObj.value, fileObj.options);
return [3 /*break*/, 5];
case 4:
if (typeof value === 'object' && !helper_1.isFileData(value)) {
value = JSON.stringify(value);
}
multipartForm.append(key, value);
_c.label = 5;
case 5:
_b++;
return [3 /*break*/, 2];
case 6:
_i++;
return [3 /*break*/, 1];
case 7:
// Path params

@@ -253,8 +253,8 @@ url = parsePath(url, path);

headers['Accept-Encoding'] = headers['Accept-Encoding'] || 'gzip';
if (!this.compressRequestData) return [3 /*break*/, 2];
if (!this.compressRequestData) return [3 /*break*/, 9];
return [4 /*yield*/, this.gzipRequestBody(data, headers)];
case 1:
data = _a.sent();
_a.label = 2;
case 2:
case 8:
data = _c.sent();
_c.label = 9;
case 9:
requestParams = {

@@ -261,0 +261,0 @@ url: url,

{
"name": "ibm-cloud-sdk-core",
"version": "3.2.0",
"version": "3.2.1",
"description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc