ibm-cloud-sdk-core 3.2.0 → 3.2.2-beta

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.
Files changed (161) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/{auth → dist/auth}/authenticators/authenticator-interface.d.ts +0 -0
  3. package/{auth → dist/auth}/authenticators/authenticator-interface.js +0 -0
  4. package/{auth → dist/auth}/authenticators/authenticator.d.ts +0 -0
  5. package/{auth → dist/auth}/authenticators/authenticator.js +1 -0
  6. package/{auth → dist/auth}/authenticators/basic-authenticator.d.ts +0 -0
  7. package/{auth → dist/auth}/authenticators/basic-authenticator.js +7 -4
  8. package/{auth → dist/auth}/authenticators/bearer-token-authenticator.d.ts +0 -0
  9. package/{auth → dist/auth}/authenticators/bearer-token-authenticator.js +7 -4
  10. package/{auth → dist/auth}/authenticators/cloud-pak-for-data-authenticator.d.ts +0 -0
  11. package/{auth → dist/auth}/authenticators/cloud-pak-for-data-authenticator.js +4 -1
  12. package/{auth → dist/auth}/authenticators/container-authenticator.d.ts +0 -0
  13. package/{auth → dist/auth}/authenticators/container-authenticator.js +4 -1
  14. package/{auth → dist/auth}/authenticators/iam-authenticator.d.ts +0 -0
  15. package/{auth → dist/auth}/authenticators/iam-authenticator.js +5 -2
  16. package/{auth → dist/auth}/authenticators/iam-request-based-authenticator.d.ts +0 -0
  17. package/{auth → dist/auth}/authenticators/iam-request-based-authenticator.js +4 -1
  18. package/{auth → dist/auth}/authenticators/index.d.ts +0 -0
  19. package/dist/auth/authenticators/index.js +38 -0
  20. package/{auth → dist/auth}/authenticators/no-auth-authenticator.d.ts +0 -0
  21. package/{auth → dist/auth}/authenticators/no-auth-authenticator.js +4 -1
  22. package/{auth → dist/auth}/authenticators/token-request-based-authenticator.d.ts +0 -0
  23. package/{auth → dist/auth}/authenticators/token-request-based-authenticator.js +6 -3
  24. package/{auth → dist/auth}/authenticators/vpc-instance-authenticator.d.ts +0 -0
  25. package/{auth → dist/auth}/authenticators/vpc-instance-authenticator.js +4 -1
  26. package/{auth → dist/auth}/index.d.ts +0 -0
  27. package/dist/auth/index.js +34 -0
  28. package/{auth → dist/auth}/token-managers/container-token-manager.d.ts +0 -0
  29. package/{auth → dist/auth}/token-managers/container-token-manager.js +7 -4
  30. package/{auth → dist/auth}/token-managers/cp4d-token-manager.d.ts +0 -0
  31. package/{auth → dist/auth}/token-managers/cp4d-token-manager.js +6 -3
  32. package/{auth → dist/auth}/token-managers/iam-request-based-token-manager.d.ts +0 -0
  33. package/{auth → dist/auth}/token-managers/iam-request-based-token-manager.js +9 -6
  34. package/{auth → dist/auth}/token-managers/iam-token-manager.d.ts +0 -0
  35. package/{auth → dist/auth}/token-managers/iam-token-manager.js +5 -2
  36. package/{auth → dist/auth}/token-managers/index.d.ts +0 -0
  37. package/{auth → dist/auth}/token-managers/index.js +8 -7
  38. package/{auth → dist/auth}/token-managers/jwt-token-manager.d.ts +0 -0
  39. package/{auth → dist/auth}/token-managers/jwt-token-manager.js +5 -2
  40. package/{auth → dist/auth}/token-managers/token-manager.d.ts +0 -0
  41. package/{auth → dist/auth}/token-managers/token-manager.js +5 -4
  42. package/{auth → dist/auth}/token-managers/vpc-instance-token-manager.d.ts +0 -0
  43. package/{auth → dist/auth}/token-managers/vpc-instance-token-manager.js +11 -8
  44. package/{auth → dist/auth}/utils/file-reading-helpers.browser.d.ts +0 -0
  45. package/{auth → dist/auth}/utils/file-reading-helpers.browser.js +1 -0
  46. package/{auth → dist/auth}/utils/file-reading-helpers.d.ts +0 -0
  47. package/{auth → dist/auth}/utils/file-reading-helpers.js +12 -11
  48. package/{auth → dist/auth}/utils/get-authenticator-from-environment.d.ts +0 -0
  49. package/{auth → dist/auth}/utils/get-authenticator-from-environment.js +3 -2
  50. package/{auth → dist/auth}/utils/helpers.d.ts +0 -0
  51. package/{auth → dist/auth}/utils/helpers.js +5 -4
  52. package/{auth → dist/auth}/utils/index.d.ts +0 -0
  53. package/dist/auth/utils/index.js +46 -0
  54. package/{auth → dist/auth}/utils/read-external-sources.d.ts +0 -0
  55. package/{auth → dist/auth}/utils/read-external-sources.js +6 -5
  56. package/{docs → dist/docs}/ibm-cloud-sdk-core.api.json +0 -0
  57. package/{es → dist/es}/auth/authenticators/authenticator-interface.d.ts +0 -0
  58. package/{es → dist/es}/auth/authenticators/authenticator-interface.js +1 -0
  59. package/{es → dist/es}/auth/authenticators/authenticator.d.ts +0 -0
  60. package/{es → dist/es}/auth/authenticators/authenticator.js +0 -0
  61. package/{es → dist/es}/auth/authenticators/basic-authenticator.d.ts +0 -0
  62. package/{es → dist/es}/auth/authenticators/basic-authenticator.js +0 -0
  63. package/{es → dist/es}/auth/authenticators/bearer-token-authenticator.d.ts +0 -0
  64. package/{es → dist/es}/auth/authenticators/bearer-token-authenticator.js +0 -0
  65. package/{es → dist/es}/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +0 -0
  66. package/{es → dist/es}/auth/authenticators/cloud-pak-for-data-authenticator.js +0 -0
  67. package/{es → dist/es}/auth/authenticators/container-authenticator.d.ts +0 -0
  68. package/{es → dist/es}/auth/authenticators/container-authenticator.js +0 -0
  69. package/{es → dist/es}/auth/authenticators/iam-authenticator.d.ts +0 -0
  70. package/{es → dist/es}/auth/authenticators/iam-authenticator.js +0 -0
  71. package/{es → dist/es}/auth/authenticators/iam-request-based-authenticator.d.ts +0 -0
  72. package/{es → dist/es}/auth/authenticators/iam-request-based-authenticator.js +0 -0
  73. package/{es → dist/es}/auth/authenticators/index.d.ts +0 -0
  74. package/{es → dist/es}/auth/authenticators/index.js +0 -0
  75. package/{es → dist/es}/auth/authenticators/no-auth-authenticator.d.ts +0 -0
  76. package/{es → dist/es}/auth/authenticators/no-auth-authenticator.js +0 -0
  77. package/{es → dist/es}/auth/authenticators/token-request-based-authenticator.d.ts +0 -0
  78. package/{es → dist/es}/auth/authenticators/token-request-based-authenticator.js +0 -0
  79. package/{es → dist/es}/auth/authenticators/vpc-instance-authenticator.d.ts +0 -0
  80. package/{es → dist/es}/auth/authenticators/vpc-instance-authenticator.js +0 -0
  81. package/{es → dist/es}/auth/index.d.ts +0 -0
  82. package/{es → dist/es}/auth/index.js +0 -0
  83. package/{es → dist/es}/auth/token-managers/container-token-manager.d.ts +0 -0
  84. package/{es → dist/es}/auth/token-managers/container-token-manager.js +0 -0
  85. package/{es → dist/es}/auth/token-managers/cp4d-token-manager.d.ts +0 -0
  86. package/{es → dist/es}/auth/token-managers/cp4d-token-manager.js +0 -0
  87. package/{es → dist/es}/auth/token-managers/iam-request-based-token-manager.d.ts +0 -0
  88. package/{es → dist/es}/auth/token-managers/iam-request-based-token-manager.js +0 -0
  89. package/{es → dist/es}/auth/token-managers/iam-token-manager.d.ts +0 -0
  90. package/{es → dist/es}/auth/token-managers/iam-token-manager.js +0 -0
  91. package/{es → dist/es}/auth/token-managers/index.d.ts +0 -0
  92. package/{es → dist/es}/auth/token-managers/index.js +0 -0
  93. package/{es → dist/es}/auth/token-managers/jwt-token-manager.d.ts +0 -0
  94. package/{es → dist/es}/auth/token-managers/jwt-token-manager.js +0 -0
  95. package/{es → dist/es}/auth/token-managers/token-manager.d.ts +0 -0
  96. package/{es → dist/es}/auth/token-managers/token-manager.js +0 -0
  97. package/{es → dist/es}/auth/token-managers/vpc-instance-token-manager.d.ts +0 -0
  98. package/{es → dist/es}/auth/token-managers/vpc-instance-token-manager.js +0 -0
  99. package/{es → dist/es}/auth/utils/file-reading-helpers.browser.d.ts +0 -0
  100. package/{es → dist/es}/auth/utils/file-reading-helpers.browser.js +0 -0
  101. package/{es → dist/es}/auth/utils/file-reading-helpers.d.ts +0 -0
  102. package/{es → dist/es}/auth/utils/file-reading-helpers.js +0 -0
  103. package/{es → dist/es}/auth/utils/get-authenticator-from-environment.d.ts +0 -0
  104. package/{es → dist/es}/auth/utils/get-authenticator-from-environment.js +0 -0
  105. package/{es → dist/es}/auth/utils/helpers.d.ts +0 -0
  106. package/{es → dist/es}/auth/utils/helpers.js +0 -0
  107. package/{es → dist/es}/auth/utils/index.d.ts +0 -0
  108. package/{es → dist/es}/auth/utils/index.js +0 -0
  109. package/{es → dist/es}/auth/utils/read-external-sources.d.ts +0 -0
  110. package/{es → dist/es}/auth/utils/read-external-sources.js +0 -0
  111. package/{es → dist/es}/index.d.ts +0 -0
  112. package/{es → dist/es}/index.js +0 -0
  113. package/{es → dist/es}/lib/base-service.d.ts +0 -0
  114. package/{es → dist/es}/lib/base-service.js +0 -0
  115. package/{es → dist/es}/lib/content-type.d.ts +0 -0
  116. package/{es → dist/es}/lib/content-type.js +0 -0
  117. package/{es → dist/es}/lib/get-new-logger.d.ts +0 -0
  118. package/{es → dist/es}/lib/get-new-logger.js +0 -0
  119. package/{es → dist/es}/lib/helper.d.ts +0 -0
  120. package/{es → dist/es}/lib/helper.js +0 -0
  121. package/{es → dist/es}/lib/logger.d.ts +0 -0
  122. package/{es → dist/es}/lib/logger.js +0 -0
  123. package/{es → dist/es}/lib/querystring.d.ts +0 -0
  124. package/{es → dist/es}/lib/querystring.js +0 -0
  125. package/{es → dist/es}/lib/request-wrapper.d.ts +0 -0
  126. package/{es → dist/es}/lib/request-wrapper.js +31 -25
  127. package/{es → dist/es}/lib/sdk-test-helpers.browser.d.ts +0 -0
  128. package/{es → dist/es}/lib/sdk-test-helpers.browser.js +0 -0
  129. package/{es → dist/es}/lib/sdk-test-helpers.d.ts +0 -0
  130. package/{es → dist/es}/lib/sdk-test-helpers.js +0 -0
  131. package/{es → dist/es}/lib/stream-to-promise.d.ts +0 -0
  132. package/{es → dist/es}/lib/stream-to-promise.js +0 -0
  133. package/{ibm-cloud-sdk-core.d.ts → dist/ibm-cloud-sdk-core.d.ts} +0 -0
  134. package/{index.d.ts → dist/index.d.ts} +0 -0
  135. package/dist/index.js +63 -0
  136. package/{lib → dist/lib}/base-service.d.ts +0 -0
  137. package/{lib → dist/lib}/base-service.js +7 -6
  138. package/{lib → dist/lib}/content-type.d.ts +0 -0
  139. package/{lib → dist/lib}/content-type.js +1 -1
  140. package/{lib → dist/lib}/get-new-logger.d.ts +0 -0
  141. package/{lib → dist/lib}/get-new-logger.js +6 -5
  142. package/{lib → dist/lib}/helper.d.ts +0 -0
  143. package/{lib → dist/lib}/helper.js +21 -18
  144. package/{lib → dist/lib}/logger.d.ts +0 -0
  145. package/{lib → dist/lib}/logger.js +1 -1
  146. package/{lib → dist/lib}/querystring.d.ts +0 -0
  147. package/{lib → dist/lib}/querystring.js +1 -1
  148. package/{lib → dist/lib}/request-wrapper.d.ts +0 -0
  149. package/{lib → dist/lib}/request-wrapper.js +92 -67
  150. package/{lib → dist/lib}/sdk-test-helpers.browser.d.ts +0 -0
  151. package/{lib → dist/lib}/sdk-test-helpers.browser.js +1 -0
  152. package/{lib → dist/lib}/sdk-test-helpers.d.ts +0 -0
  153. package/{lib → dist/lib}/sdk-test-helpers.js +8 -7
  154. package/{lib → dist/lib}/stream-to-promise.d.ts +0 -0
  155. package/{lib → dist/lib}/stream-to-promise.js +1 -0
  156. package/dist/package.json +71 -0
  157. package/package.json +40 -6
  158. package/auth/authenticators/index.js +0 -37
  159. package/auth/index.js +0 -23
  160. package/auth/utils/index.js +0 -34
  161. package/index.js +0 -43
@@ -25,13 +25,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
25
  */
26
26
  import axios from 'axios';
27
27
  import * as rax from 'retry-axios';
28
- import axiosCookieJarSupport from 'axios-cookiejar-support';
28
+ import { wrapper as axiosCookieJarSupport } from 'axios-cookiejar-support';
29
29
  import extend from 'extend';
30
30
  import FormData from 'form-data';
31
31
  import { Agent } from 'https';
32
32
  import isStream from 'isstream';
33
33
  import { stringify } from 'querystring';
34
34
  import { gzipSync } from 'zlib';
35
+ import { CookieJar } from 'tough-cookie';
35
36
  import { buildRequestFileObject, isEmptyObject, isFileData, isFileWithMetadata, stripTrailingSlash, } from './helper';
36
37
  import logger from './logger';
37
38
  import { streamToPromise } from './stream-to-promise';
@@ -73,8 +74,15 @@ export class RequestWrapper {
73
74
  // if a cookie jar is provided, wrap the axios instance and update defaults
74
75
  if (axiosOptions.jar) {
75
76
  axiosCookieJarSupport(this.axiosInstance);
76
- this.axiosInstance.defaults.withCredentials = true;
77
- this.axiosInstance.defaults.jar = axiosOptions.jar;
77
+ // axios-cookiejar-support < 2.x accepted a boolean
78
+ // some SDKs might be using that, so create a default
79
+ // CookieJar if detecting true.
80
+ if (axiosOptions.jar === true) {
81
+ this.axiosInstance.defaults.jar = new CookieJar();
82
+ }
83
+ else {
84
+ this.axiosInstance.defaults.jar = axiosOptions.jar;
85
+ }
78
86
  }
79
87
  // get retry config properties and conditionally enable retries
80
88
  if (axiosOptions.enableRetries) {
@@ -130,29 +138,27 @@ export class RequestWrapper {
130
138
  const multipartForm = new FormData();
131
139
  // Form params
132
140
  if (formData) {
133
- Object.keys(formData).forEach((key) => {
134
- const values = Array.isArray(formData[key]) ? formData[key] : [formData[key]];
141
+ for (const key of Object.keys(formData)) { // eslint-disable-line
142
+ let values = Array.isArray(formData[key]) ? formData[key] : [formData[key]];
135
143
  // Skip keys with undefined/null values or empty object value
136
- values
137
- .filter((v) => v != null && !isEmptyObject(v))
138
- .forEach((value) => __awaiter(this, void 0, void 0, function* () {
139
- // Special case of empty file object
140
- if (Object.prototype.hasOwnProperty.call(value, 'contentType') &&
141
- !Object.prototype.hasOwnProperty.call(value, 'data')) {
142
- return;
143
- }
144
- if (isFileWithMetadata(value)) {
145
- const fileObj = yield buildRequestFileObject(value);
146
- multipartForm.append(key, fileObj.value, fileObj.options);
147
- }
148
- else {
149
- if (typeof value === 'object' && !isFileData(value)) {
150
- value = JSON.stringify(value);
144
+ values = values.filter((v) => v != null && !isEmptyObject(v));
145
+ for (let value of values) { // eslint-disable-line
146
+ // Ignore special case of empty file object
147
+ if (!Object.prototype.hasOwnProperty.call(value, 'contentType') ||
148
+ Object.prototype.hasOwnProperty.call(value, 'data')) {
149
+ if (isFileWithMetadata(value)) {
150
+ const fileObj = yield buildRequestFileObject(value); // eslint-disable-line
151
+ multipartForm.append(key, fileObj.value, fileObj.options);
152
+ }
153
+ else {
154
+ if (typeof value === 'object' && !isFileData(value)) {
155
+ value = JSON.stringify(value);
156
+ }
157
+ multipartForm.append(key, value);
151
158
  }
152
- multipartForm.append(key, value);
153
159
  }
154
- }));
155
- });
160
+ }
161
+ }
156
162
  }
157
163
  // Path params
158
164
  url = parsePath(url, path);
@@ -195,7 +201,7 @@ export class RequestWrapper {
195
201
  data,
196
202
  raxConfig: this.raxConfig,
197
203
  responseType: options.responseType || 'json',
198
- paramsSerializer: (params) => stringify(params),
204
+ paramsSerializer: { serialize: (params) => stringify(params) },
199
205
  };
200
206
  return this.axiosInstance(requestParams).then((res) => {
201
207
  // sometimes error responses will still trigger the `then` block - escape that behavior here
@@ -299,7 +305,7 @@ export class RequestWrapper {
299
305
  instance: axiosInstance,
300
306
  backoffType: 'exponential',
301
307
  checkRetryAfter: true,
302
- maxRetryDelay: 30 * 1000,
308
+ maxRetryDelay: 30 * 1000, // default to 30 sec max delay
303
309
  };
304
310
  if (retryOptions) {
305
311
  if (typeof retryOptions.maxRetries === 'number') {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /**
3
+ * (C) Copyright IBM Corp. 2019, 2021.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
41
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
42
+ };
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.getNewLogger = exports.unitTestUtils = exports.contentType = exports.qs = exports.BaseService = void 0;
48
+ /**
49
+ * @module ibm-cloud-sdk-core
50
+ */
51
+ var unitTestUtils = __importStar(require("./lib/sdk-test-helpers"));
52
+ exports.unitTestUtils = unitTestUtils;
53
+ var base_service_1 = require("./lib/base-service");
54
+ Object.defineProperty(exports, "BaseService", { enumerable: true, get: function () { return base_service_1.BaseService; } });
55
+ __exportStar(require("./auth"), exports);
56
+ __exportStar(require("./lib/helper"), exports);
57
+ var querystring_1 = require("./lib/querystring");
58
+ Object.defineProperty(exports, "qs", { enumerable: true, get: function () { return __importDefault(querystring_1).default; } });
59
+ var content_type_1 = require("./lib/content-type");
60
+ Object.defineProperty(exports, "contentType", { enumerable: true, get: function () { return __importDefault(content_type_1).default; } });
61
+ __exportStar(require("./lib/stream-to-promise"), exports);
62
+ var get_new_logger_1 = require("./lib/get-new-logger");
63
+ Object.defineProperty(exports, "getNewLogger", { enumerable: true, get: function () { return get_new_logger_1.getNewLogger; } });
File without changes
@@ -29,6 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.BaseService = void 0;
32
33
  var auth_1 = require("../auth");
33
34
  var helper_1 = require("./helper");
34
35
  var logger_1 = __importDefault(require("./logger"));
@@ -56,7 +57,7 @@ var BaseService = /** @class */ (function () {
56
57
  function BaseService(userOptions) {
57
58
  if (!(this instanceof BaseService)) {
58
59
  var err = 'the "new" keyword is required to create service instances';
59
- logger_1.default.error("Error creating an instance of BaseService: " + err);
60
+ logger_1.default.error("Error creating an instance of BaseService: ".concat(err));
60
61
  throw new Error(err);
61
62
  }
62
63
  var baseServiceOptions = {};
@@ -66,10 +67,10 @@ var BaseService = /** @class */ (function () {
66
67
  options.serviceUrl = options.url;
67
68
  }
68
69
  if (options.serviceUrl) {
69
- baseServiceOptions.serviceUrl = helper_1.stripTrailingSlash(options.serviceUrl);
70
+ baseServiceOptions.serviceUrl = (0, helper_1.stripTrailingSlash)(options.serviceUrl);
70
71
  }
71
72
  // check serviceUrl for common user errors
72
- var credentialProblems = auth_1.checkCredentials(options, ['serviceUrl']);
73
+ var credentialProblems = (0, auth_1.checkCredentials)(options, ['serviceUrl']);
73
74
  if (credentialProblems) {
74
75
  logger_1.default.error(credentialProblems.message);
75
76
  throw credentialProblems;
@@ -103,7 +104,7 @@ var BaseService = /** @class */ (function () {
103
104
  */
104
105
  BaseService.prototype.setServiceUrl = function (url) {
105
106
  if (url) {
106
- this.baseOptions.serviceUrl = helper_1.stripTrailingSlash(url);
107
+ this.baseOptions.serviceUrl = (0, helper_1.stripTrailingSlash)(url);
107
108
  }
108
109
  };
109
110
  /**
@@ -201,7 +202,7 @@ var BaseService = /** @class */ (function () {
201
202
  // eslint-disable-next-line class-methods-use-this
202
203
  BaseService.prototype.readOptionsFromExternalConfig = function (serviceName) {
203
204
  var results = {};
204
- var properties = auth_1.readExternalSources(serviceName);
205
+ var properties = (0, auth_1.readExternalSources)(serviceName);
205
206
  if (properties !== null) {
206
207
  // the user can define the following client-level variables in the credentials file:
207
208
  // - url
@@ -209,7 +210,7 @@ var BaseService = /** @class */ (function () {
209
210
  // - enableGzip
210
211
  var url = properties.url, disableSsl = properties.disableSsl, enableGzip = properties.enableGzip, enableRetries = properties.enableRetries, maxRetries = properties.maxRetries, retryInterval = properties.retryInterval;
211
212
  if (url) {
212
- results.serviceUrl = helper_1.stripTrailingSlash(url);
213
+ results.serviceUrl = (0, helper_1.stripTrailingSlash)(url);
213
214
  }
214
215
  if (disableSsl === true) {
215
216
  results.disableSslVerification = disableSsl;
File without changes
@@ -62,7 +62,7 @@ var fromHeader = function (buffer) {
62
62
  * @return {String|undefined}
63
63
  */
64
64
  var fromFilename = function (file) {
65
- var ext = path_1.extname(
65
+ var ext = (0, path_1.extname)(
66
66
  // eslint-disable-next-line @typescript-eslint/dot-notation
67
67
  (typeof file === 'string' && file) || file['name'] || '');
68
68
  return filenameContentTypes[ext];
File without changes
@@ -18,6 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.getNewLogger = void 0;
21
22
  var debug_1 = __importDefault(require("debug"));
22
23
  /**
23
24
  * Return a new logger, formatted with a particular name. The logging functions, in
@@ -35,11 +36,11 @@ var debug_1 = __importDefault(require("debug"));
35
36
  * @returns {SDKLogger} the new logger
36
37
  */
37
38
  function getNewLogger(moduleName) {
38
- var debug = debug_1.default(moduleName + ":debug");
39
- var error = debug_1.default(moduleName + ":error");
40
- var info = debug_1.default(moduleName + ":info");
41
- var verbose = debug_1.default(moduleName + ":verbose");
42
- var warn = debug_1.default(moduleName + ":warning");
39
+ var debug = (0, debug_1.default)("".concat(moduleName, ":debug"));
40
+ var error = (0, debug_1.default)("".concat(moduleName, ":error"));
41
+ var info = (0, debug_1.default)("".concat(moduleName, ":info"));
42
+ var verbose = (0, debug_1.default)("".concat(moduleName, ":verbose"));
43
+ var warn = (0, debug_1.default)("".concat(moduleName, ":warning"));
43
44
  // enable loggers if axios flag is set & mimic log levels severity
44
45
  if (process.env.NODE_DEBUG === 'axios') {
45
46
  debug.enabled = true;
File without changes
@@ -50,17 +50,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __spreadArrays = (this && this.__spreadArrays) || function () {
54
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
55
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
56
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
57
- r[k] = a[j];
58
- return r;
53
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
54
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
55
+ if (ar || !(i in from)) {
56
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
57
+ ar[i] = from[i];
58
+ }
59
+ }
60
+ return to.concat(ar || Array.prototype.slice.call(from));
59
61
  };
60
62
  var __importDefault = (this && this.__importDefault) || function (mod) {
61
63
  return (mod && mod.__esModule) ? mod : { "default": mod };
62
64
  };
63
65
  Object.defineProperty(exports, "__esModule", { value: true });
66
+ exports.constructServiceUrl = exports.toLowerKeys = exports.buildRequestFileObject = exports.getFormat = exports.isHTML = exports.validateParams = exports.getMissingParams = exports.getQueryParam = exports.stripTrailingSlash = exports.getContentType = exports.isEmptyObject = exports.isFileData = exports.isFileWithMetadata = void 0;
64
67
  var isstream_1 = require("isstream");
65
68
  var mime_types_1 = require("mime-types");
66
69
  var path_1 = require("path");
@@ -71,14 +74,14 @@ function isFileObject(obj) {
71
74
  return Boolean(obj && obj.value);
72
75
  }
73
76
  function isFileStream(obj) {
74
- return Boolean(obj && isstream_1.isReadable(obj) && obj.path);
77
+ return Boolean(obj && (0, isstream_1.isReadable)(obj) && obj.path);
75
78
  }
76
79
  function isFileWithMetadata(obj) {
77
80
  return Boolean(obj && obj.data && isFileData(obj.data));
78
81
  }
79
82
  exports.isFileWithMetadata = isFileWithMetadata;
80
83
  function isFileData(obj) {
81
- return Boolean(obj && (isstream_1.isReadable(obj) || Buffer.isBuffer(obj)));
84
+ return Boolean(obj && ((0, isstream_1.isReadable)(obj) || Buffer.isBuffer(obj)));
82
85
  }
83
86
  exports.isFileData = isFileData;
84
87
  function isEmptyObject(obj) {
@@ -98,7 +101,7 @@ function getContentType(inputData) {
98
101
  case 0:
99
102
  contentType = null;
100
103
  if (!isFileStream(inputData)) return [3 /*break*/, 1];
101
- mimeType = mime_types_1.lookup(inputData.path);
104
+ mimeType = (0, mime_types_1.lookup)(inputData.path);
102
105
  contentType = { mime: mimeType || null };
103
106
  return [3 /*break*/, 3];
104
107
  case 1:
@@ -162,7 +165,7 @@ function getMissingParams(params, requires) {
162
165
  });
163
166
  }
164
167
  return missing.length > 0
165
- ? new Error("Missing required parameters: " + missing.join(', '))
168
+ ? new Error("Missing required parameters: ".concat(missing.join(', ')))
166
169
  : null;
167
170
  }
168
171
  exports.getMissingParams = getMissingParams;
@@ -210,10 +213,10 @@ function validateParams(params, requiredParams, allParams) {
210
213
  // Return an Error object identifying the errors we found.
211
214
  var errorMsg = 'Parameter validation errors:';
212
215
  if (missing.length > 0) {
213
- errorMsg += "\n Missing required parameters: " + missing.join(', ');
216
+ errorMsg += "\n Missing required parameters: ".concat(missing.join(', '));
214
217
  }
215
218
  if (invalid.length > 0) {
216
- errorMsg += "\n Found invalid parameters: " + invalid.join(', ');
219
+ errorMsg += "\n Found invalid parameters: ".concat(invalid.join(', '));
217
220
  }
218
221
  return new Error(errorMsg);
219
222
  }
@@ -234,7 +237,7 @@ function isMissing(value) {
234
237
  * @returns {boolean} true if 'text' has html tags
235
238
  */
236
239
  function isHTML(text) {
237
- logger_1.default.debug("Determining if the text " + text + " is HTML.");
240
+ logger_1.default.debug("Determining if the text ".concat(text, " is HTML."));
238
241
  return /<[a-z][\s\S]*>/i.test(text);
239
242
  }
240
243
  exports.isHTML = isHTML;
@@ -300,7 +303,7 @@ function buildRequestFileObject(fileParam) {
300
303
  filename = fileObj.value.path;
301
304
  }
302
305
  // toString handles the case when path is a buffer
303
- fileObj.options.filename = filename ? path_1.basename(filename.toString()) : '_';
306
+ fileObj.options.filename = filename ? (0, path_1.basename)(filename.toString()) : '_';
304
307
  if (!(!fileObj.options.contentType && isFileData(fileObj.value))) return [3 /*break*/, 2];
305
308
  _a = fileObj.options;
306
309
  return [4 /*yield*/, getContentType(fileObj.value)];
@@ -323,12 +326,12 @@ exports.buildRequestFileObject = buildRequestFileObject;
323
326
  function toLowerKeys(obj) {
324
327
  var lowerCaseObj = {};
325
328
  if (obj) {
326
- lowerCaseObj = Object.assign.apply(Object, __spreadArrays([{}], Object.keys(obj).map(function (key) {
329
+ lowerCaseObj = Object.assign.apply(Object, __spreadArray([{}], Object.keys(obj).map(function (key) {
327
330
  var _a;
328
331
  return (_a = {},
329
332
  _a[key.toLowerCase()] = obj[key],
330
333
  _a);
331
- })));
334
+ }), false));
332
335
  }
333
336
  return lowerCaseObj;
334
337
  }
@@ -353,7 +356,7 @@ function constructServiceUrl(parameterizedUrl, defaultUrlVariables, providedUrlV
353
356
  // Verify the provided variable names.
354
357
  providedUrlVariables.forEach(function (_, name) {
355
358
  if (!defaultUrlVariables.has(name)) {
356
- throw new Error("'" + name + "' is an invalid variable name.\n Valid variable names: [" + Array.from(defaultUrlVariables.keys()).sort() + "].");
359
+ throw new Error("'".concat(name, "' is an invalid variable name.\n Valid variable names: [").concat(Array.from(defaultUrlVariables.keys()).sort(), "]."));
357
360
  }
358
361
  });
359
362
  // Format the URL with provided or default variable values.
@@ -362,7 +365,7 @@ function constructServiceUrl(parameterizedUrl, defaultUrlVariables, providedUrlV
362
365
  // Use the default variable value if none was provided.
363
366
  var providedValue = providedUrlVariables.get(name);
364
367
  var formatValue = providedValue !== undefined ? providedValue : defaultValue;
365
- formattedUrl = formattedUrl.replace("{" + name + "}", formatValue);
368
+ formattedUrl = formattedUrl.replace("{".concat(name, "}"), formatValue);
366
369
  });
367
370
  return formattedUrl;
368
371
  }
File without changes
@@ -16,4 +16,4 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  var get_new_logger_1 = require("./get-new-logger");
19
- exports.default = get_new_logger_1.getNewLogger('ibm-cloud-sdk-core');
19
+ exports.default = (0, get_new_logger_1.getNewLogger)('ibm-cloud-sdk-core');
File without changes
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  */
24
24
  var stringify = function (queryParams) {
25
25
  return Object.keys(queryParams)
26
- .map(function (key) { return key + "=" + encodeURIComponent(queryParams[key]); })
26
+ .map(function (key) { return "".concat(key, "=").concat(encodeURIComponent(queryParams[key])); })
27
27
  .join('&');
28
28
  };
29
29
  exports.default = {
File without changes