ibm-cloud-sdk-core 4.0.0 → 4.0.2
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/.secrets.baseline +20 -30
- package/CHANGELOG.md +16 -4
- package/MIGRATION-V4.md +54 -0
- package/auth/authenticators/authenticator-interface.d.ts +3 -4
- package/auth/authenticators/authenticator-interface.js +1 -1
- package/auth/authenticators/authenticator.d.ts +5 -9
- package/auth/authenticators/authenticator.js +4 -8
- package/auth/authenticators/basic-authenticator.d.ts +12 -12
- package/auth/authenticators/basic-authenticator.js +12 -12
- package/auth/authenticators/bearer-token-authenticator.d.ts +11 -14
- package/auth/authenticators/bearer-token-authenticator.js +11 -14
- package/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +15 -15
- package/auth/authenticators/cloud-pak-for-data-authenticator.js +15 -15
- package/auth/authenticators/container-authenticator.d.ts +23 -23
- package/auth/authenticators/container-authenticator.js +23 -23
- package/auth/authenticators/iam-authenticator.d.ts +20 -20
- package/auth/authenticators/iam-authenticator.js +20 -20
- package/auth/authenticators/iam-request-based-authenticator.d.ts +23 -25
- package/auth/authenticators/iam-request-based-authenticator.js +23 -25
- package/auth/authenticators/token-request-based-authenticator.d.ts +19 -24
- package/auth/authenticators/token-request-based-authenticator.js +19 -24
- package/auth/authenticators/vpc-instance-authenticator.d.ts +17 -16
- package/auth/authenticators/vpc-instance-authenticator.js +17 -16
- package/auth/token-managers/container-token-manager.d.ts +23 -25
- package/auth/token-managers/container-token-manager.js +23 -25
- package/auth/token-managers/cp4d-token-manager.d.ts +13 -13
- package/auth/token-managers/cp4d-token-manager.js +13 -13
- package/auth/token-managers/iam-request-based-token-manager.d.ts +26 -31
- package/auth/token-managers/iam-request-based-token-manager.js +26 -31
- package/auth/token-managers/iam-token-manager.d.ts +17 -16
- package/auth/token-managers/iam-token-manager.js +17 -16
- package/auth/token-managers/jwt-token-manager.d.ts +10 -13
- package/auth/token-managers/jwt-token-manager.js +13 -16
- package/auth/token-managers/token-manager.d.ts +23 -35
- package/auth/token-managers/token-manager.js +22 -34
- package/auth/token-managers/vpc-instance-token-manager.d.ts +15 -15
- package/auth/token-managers/vpc-instance-token-manager.js +15 -15
- package/auth/utils/get-authenticator-from-environment.d.ts +2 -2
- package/auth/utils/get-authenticator-from-environment.js +2 -2
- package/auth/utils/helpers.d.ts +34 -32
- package/auth/utils/helpers.js +34 -32
- package/auth/utils/read-external-sources.d.ts +2 -1
- package/auth/utils/read-external-sources.js +5 -4
- package/build/docs/ibm-cloud-sdk-core.atleastone.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.atmostone.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.authenticator._constructor_.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticationtype.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticator.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice._constructor_.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.configureservice.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.createrequest.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.baseservice.enableretries.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.getauthenticator.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.setdefaultheaders.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.baseservice.setserviceurl.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticate.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.buildrequestfileobject.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.checkcredentials.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.computebasicauthheader.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.constructserviceurl.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setcrtokenfilename.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofileid.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofilename.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.requesttoken.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setcrtokenfilename.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofileid.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofilename.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.fileobject.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.fileoptions.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.filestream.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.getauthenticatorfromenvironment.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getcontenttype.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getcurrenttime.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.getformat.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.getmissingparams.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getnewlogger.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.getqueryparam.md +1 -5
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator._constructor_.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.getrefreshtoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.md +7 -7
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setclientidandsecret.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setscope.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.getrefreshtoken.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md +8 -8
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.requesttoken.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md +3 -5
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md +2 -4
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.md +3 -3
- package/build/docs/ibm-cloud-sdk-core.ishtml.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.md +5 -5
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.requesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.md +24 -24
- package/build/docs/ibm-cloud-sdk-core.onlyone.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.qs.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.readexternalsources.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.removesuffix.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.sdklogger.md +7 -7
- package/build/docs/ibm-cloud-sdk-core.streamtopromise.md +3 -1
- package/build/docs/ibm-cloud-sdk-core.striptrailingslash.md +4 -2
- package/build/docs/ibm-cloud-sdk-core.tokenmanager._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.gettoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.md +15 -15
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.pacedrequesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.requesttoken.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.savetokeninfo.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setdisablesslverification.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setheaders.md +2 -4
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator._constructor_.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.authenticate.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.md +9 -9
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setdisablesslverification.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setheaders.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.tolowerkeys.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkforsuccessfulexecution.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkmediaheaders.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkurlandmethod.md +1 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkuserheader.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.expecttobepromise.md +0 -2
- package/build/docs/ibm-cloud-sdk-core.unittestutils.getoptions.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.useroptions.md +9 -9
- package/build/docs/ibm-cloud-sdk-core.validateinput.md +8 -2
- package/build/docs/ibm-cloud-sdk-core.validateparams.md +1 -1
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.md +6 -6
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofilecrn.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofileid.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md +6 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.md +4 -4
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md +2 -2
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md +2 -2
- package/docs/ibm-cloud-sdk-core.api.json +516 -241
- package/es/auth/authenticators/authenticator-interface.d.ts +3 -4
- package/es/auth/authenticators/authenticator-interface.js +1 -1
- package/es/auth/authenticators/authenticator.d.ts +5 -9
- package/es/auth/authenticators/authenticator.js +4 -8
- package/es/auth/authenticators/basic-authenticator.d.ts +12 -12
- package/es/auth/authenticators/basic-authenticator.js +12 -12
- package/es/auth/authenticators/bearer-token-authenticator.d.ts +11 -14
- package/es/auth/authenticators/bearer-token-authenticator.js +11 -14
- package/es/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +15 -15
- package/es/auth/authenticators/cloud-pak-for-data-authenticator.js +15 -15
- package/es/auth/authenticators/container-authenticator.d.ts +23 -23
- package/es/auth/authenticators/container-authenticator.js +23 -23
- package/es/auth/authenticators/iam-authenticator.d.ts +20 -20
- package/es/auth/authenticators/iam-authenticator.js +20 -20
- package/es/auth/authenticators/iam-request-based-authenticator.d.ts +23 -25
- package/es/auth/authenticators/iam-request-based-authenticator.js +23 -25
- package/es/auth/authenticators/token-request-based-authenticator.d.ts +19 -24
- package/es/auth/authenticators/token-request-based-authenticator.js +19 -24
- package/es/auth/authenticators/vpc-instance-authenticator.d.ts +17 -16
- package/es/auth/authenticators/vpc-instance-authenticator.js +17 -16
- package/es/auth/token-managers/container-token-manager.d.ts +23 -25
- package/es/auth/token-managers/container-token-manager.js +23 -25
- package/es/auth/token-managers/cp4d-token-manager.d.ts +13 -13
- package/es/auth/token-managers/cp4d-token-manager.js +13 -13
- package/es/auth/token-managers/iam-request-based-token-manager.d.ts +26 -31
- package/es/auth/token-managers/iam-request-based-token-manager.js +26 -31
- package/es/auth/token-managers/iam-token-manager.d.ts +17 -16
- package/es/auth/token-managers/iam-token-manager.js +17 -16
- package/es/auth/token-managers/jwt-token-manager.d.ts +10 -13
- package/es/auth/token-managers/jwt-token-manager.js +13 -16
- package/es/auth/token-managers/token-manager.d.ts +23 -35
- package/es/auth/token-managers/token-manager.js +22 -34
- package/es/auth/token-managers/vpc-instance-token-manager.d.ts +15 -15
- package/es/auth/token-managers/vpc-instance-token-manager.js +15 -15
- package/es/auth/utils/get-authenticator-from-environment.d.ts +2 -2
- package/es/auth/utils/get-authenticator-from-environment.js +2 -2
- package/es/auth/utils/helpers.d.ts +34 -32
- package/es/auth/utils/helpers.js +34 -32
- package/es/auth/utils/read-external-sources.d.ts +2 -1
- package/es/auth/utils/read-external-sources.js +5 -4
- package/es/lib/base-service.d.ts +31 -32
- package/es/lib/base-service.js +31 -32
- package/es/lib/content-type.js +5 -5
- package/es/lib/get-new-logger.d.ts +2 -2
- package/es/lib/get-new-logger.js +2 -2
- package/es/lib/helper.d.ts +24 -31
- package/es/lib/helper.js +25 -32
- package/es/lib/querystring.d.ts +1 -1
- package/es/lib/querystring.js +3 -3
- package/es/lib/request-wrapper.d.ts +4 -6
- package/es/lib/request-wrapper.js +17 -23
- package/es/lib/sdk-test-helpers.d.ts +14 -19
- package/es/lib/sdk-test-helpers.js +14 -19
- package/es/lib/stream-to-promise.d.ts +3 -3
- package/es/lib/stream-to-promise.js +3 -3
- package/es/tsdoc-metadata.json +1 -1
- package/etc/ibm-cloud-sdk-core.api.md +12 -12
- package/ibm-cloud-sdk-core.d.ts +1402 -1449
- package/lib/base-service.d.ts +31 -32
- package/lib/base-service.js +31 -32
- package/lib/content-type.js +5 -5
- package/lib/get-new-logger.d.ts +2 -2
- package/lib/get-new-logger.js +2 -2
- package/lib/helper.d.ts +24 -31
- package/lib/helper.js +25 -32
- package/lib/querystring.d.ts +1 -1
- package/lib/querystring.js +3 -3
- package/lib/request-wrapper.d.ts +4 -6
- package/lib/request-wrapper.js +17 -23
- package/lib/sdk-test-helpers.d.ts +14 -19
- package/lib/sdk-test-helpers.js +14 -19
- package/lib/stream-to-promise.d.ts +3 -3
- package/lib/stream-to-promise.js +3 -3
- package/package.json +2 -2
- package/temp/ibm-cloud-sdk-core.api.json +516 -241
- package/temp/ibm-cloud-sdk-core.api.md +12 -12
- package/MIGRATION-V1.md +0 -42
package/lib/request-wrapper.js
CHANGED
|
@@ -190,9 +190,8 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
190
190
|
* 2. Checks for missing parameters
|
|
191
191
|
* 3. Encode path and query parameters
|
|
192
192
|
* 4. Call the api
|
|
193
|
-
* @
|
|
194
|
-
* @
|
|
195
|
-
* @throws {Error}
|
|
193
|
+
* @returns ReadableStream|undefined
|
|
194
|
+
* @throws Error
|
|
196
195
|
*/
|
|
197
196
|
RequestWrapper.prototype.sendRequest = function (parameters) {
|
|
198
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -310,9 +309,8 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
310
309
|
};
|
|
311
310
|
/**
|
|
312
311
|
* Format error returned by axios
|
|
313
|
-
* @param
|
|
314
|
-
* @
|
|
315
|
-
* @returns {Error}
|
|
312
|
+
* @param axiosError - the object returned by axios via rejection
|
|
313
|
+
* @returns the Error object
|
|
316
314
|
*/
|
|
317
315
|
RequestWrapper.prototype.formatError = function (axiosError) {
|
|
318
316
|
// return an actual error object,
|
|
@@ -476,10 +474,10 @@ var RequestWrapper = /** @class */ (function () {
|
|
|
476
474
|
}());
|
|
477
475
|
exports.RequestWrapper = RequestWrapper;
|
|
478
476
|
/**
|
|
479
|
-
*
|
|
480
|
-
* @param
|
|
481
|
-
* @param
|
|
482
|
-
* @returns
|
|
477
|
+
* Parses the path.
|
|
478
|
+
* @param path - the path
|
|
479
|
+
* @param params - the params
|
|
480
|
+
* @returns the parsed path
|
|
483
481
|
*/
|
|
484
482
|
function parsePath(path, params) {
|
|
485
483
|
if (!path || !params) {
|
|
@@ -492,9 +490,8 @@ function parsePath(path, params) {
|
|
|
492
490
|
}
|
|
493
491
|
/**
|
|
494
492
|
* Determine if the error is due to bad credentials
|
|
495
|
-
* @
|
|
496
|
-
* @
|
|
497
|
-
* @returns {boolean} true if error is due to authentication
|
|
493
|
+
* @param error - error object returned from axios
|
|
494
|
+
* @returns true if error is due to authentication
|
|
498
495
|
*/
|
|
499
496
|
function isAuthenticationError(error) {
|
|
500
497
|
var isAuthErr = false;
|
|
@@ -509,9 +506,8 @@ function isAuthenticationError(error) {
|
|
|
509
506
|
}
|
|
510
507
|
/**
|
|
511
508
|
* Determine if the error is due to a bad self signed certificate
|
|
512
|
-
* @
|
|
513
|
-
* @
|
|
514
|
-
* @returns {boolean} true if error is due to an SSL error
|
|
509
|
+
* @param error - error object returned from axios
|
|
510
|
+
* @returnstrue if error is due to an SSL error
|
|
515
511
|
*/
|
|
516
512
|
function isSelfSignedCertificateError(error) {
|
|
517
513
|
var result = false;
|
|
@@ -526,10 +522,9 @@ function isSelfSignedCertificateError(error) {
|
|
|
526
522
|
}
|
|
527
523
|
/**
|
|
528
524
|
* Return true if object has a specified property that is a string
|
|
529
|
-
* @
|
|
530
|
-
* @param
|
|
531
|
-
* @
|
|
532
|
-
* @returns {boolean} true if property exists and is string
|
|
525
|
+
* @param obj - object to look for property in
|
|
526
|
+
* @param property - name of the property to look for
|
|
527
|
+
* @returns true if property exists and is string
|
|
533
528
|
*/
|
|
534
529
|
function hasStringProperty(obj, property) {
|
|
535
530
|
return Boolean(obj[property] && typeof obj[property] === 'string');
|
|
@@ -538,9 +533,8 @@ function hasStringProperty(obj, property) {
|
|
|
538
533
|
* Look for service error message in common places, by priority
|
|
539
534
|
* first look in `errors[0].message`, then in `error`, then in
|
|
540
535
|
* `message`, then in `errorMessage`
|
|
541
|
-
* @
|
|
542
|
-
* @
|
|
543
|
-
* @returns {string | undefined} the error message if is was found, undefined otherwise
|
|
536
|
+
* @param response - error response body received from service
|
|
537
|
+
* @returns the error message if is was found, undefined otherwise
|
|
544
538
|
*/
|
|
545
539
|
function parseServiceErrorMessage(response) {
|
|
546
540
|
var message;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -22,10 +22,9 @@
|
|
|
22
22
|
* Takes the request options constructed by the SDK and checks that the `url` and `method` properties
|
|
23
23
|
* were set to their correct values.
|
|
24
24
|
*
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @returns {void}
|
|
25
|
+
* @param options - the options object put together by the SDK, retrieved from the createRequest mock
|
|
26
|
+
* @param url - The URL path of the service endpoint, from the paths section of the API definition
|
|
27
|
+
* @param method - The HTTP method for the request, from the API definition
|
|
29
28
|
*/
|
|
30
29
|
export declare function checkUrlAndMethod(options: any, url: string, method: any): void;
|
|
31
30
|
/**
|
|
@@ -33,10 +32,9 @@ export declare function checkUrlAndMethod(options: any, url: string, method: any
|
|
|
33
32
|
* and checks for the expected values for `Accept` and `Content-Type`. This to verify that the SDK sets
|
|
34
33
|
* the correct values in the code.
|
|
35
34
|
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @returns {void}
|
|
35
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
36
|
+
* @param accept - the expected value for the `Accept` header
|
|
37
|
+
* @param contentType - the expected value for the `Content-Type` header
|
|
40
38
|
*/
|
|
41
39
|
export declare function checkMediaHeaders(createRequestMock: any, accept: string, contentType: string): void;
|
|
42
40
|
/**
|
|
@@ -44,18 +42,16 @@ export declare function checkMediaHeaders(createRequestMock: any, accept: string
|
|
|
44
42
|
* and checks for the expected value for a user-defined header. This is verify that the SDK accepts header
|
|
45
43
|
* parameters and sends them as headers in the request.
|
|
46
44
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @returns {void}
|
|
45
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
46
|
+
* @param userHeaderName - the name of the header passed by the user, e.g. `Contained-Content-Type`
|
|
47
|
+
* @param userHeaderValue - the expected value for the header passed by the user
|
|
51
48
|
*/
|
|
52
49
|
export declare function checkUserHeader(createRequestMock: any, userHeaderName: string, userHeaderValue: string): void;
|
|
53
50
|
/**
|
|
54
51
|
* This method simply ensures that the method executed without any issues by extracting
|
|
55
52
|
* the argument from the mock object for the `createRequest` method and verifying that it is an object.
|
|
56
53
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @returns {void}
|
|
54
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
59
55
|
*/
|
|
60
56
|
export declare function checkForSuccessfulExecution(createRequestMock: any): void;
|
|
61
57
|
/**
|
|
@@ -63,15 +59,14 @@ export declare function checkForSuccessfulExecution(createRequestMock: any): voi
|
|
|
63
59
|
* an object containing all of the SDK method-specific information (like `path` and `body`) used to build a request.
|
|
64
60
|
* This method is just a convenience method for the unit tests to be able to make assertions on the items in the request.
|
|
65
61
|
*
|
|
66
|
-
* @param
|
|
67
|
-
* @returns
|
|
62
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
63
|
+
* @returns Object
|
|
68
64
|
*/
|
|
69
65
|
export declare function getOptions(createRequestMock: any): any;
|
|
70
66
|
/**
|
|
71
67
|
* This method simply ensures that the SDK methods return Promises by checking for
|
|
72
68
|
* the `then` function - common way to assess whether or not an object is a Promise.
|
|
73
69
|
*
|
|
74
|
-
* @param
|
|
75
|
-
* @returns {void}
|
|
70
|
+
* @param sdkPromise - the Promise returned by an SDK method
|
|
76
71
|
*/
|
|
77
72
|
export declare function expectToBePromise(sdkPromise: any): void;
|
package/lib/sdk-test-helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -29,10 +29,9 @@ var expect_1 = __importDefault(require("expect"));
|
|
|
29
29
|
* Takes the request options constructed by the SDK and checks that the `url` and `method` properties
|
|
30
30
|
* were set to their correct values.
|
|
31
31
|
*
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @returns {void}
|
|
32
|
+
* @param options - the options object put together by the SDK, retrieved from the createRequest mock
|
|
33
|
+
* @param url - The URL path of the service endpoint, from the paths section of the API definition
|
|
34
|
+
* @param method - The HTTP method for the request, from the API definition
|
|
36
35
|
*/
|
|
37
36
|
function checkUrlAndMethod(options, url, method) {
|
|
38
37
|
(0, expect_1.default)(options.url).toEqual(url);
|
|
@@ -44,10 +43,9 @@ exports.checkUrlAndMethod = checkUrlAndMethod;
|
|
|
44
43
|
* and checks for the expected values for `Accept` and `Content-Type`. This to verify that the SDK sets
|
|
45
44
|
* the correct values in the code.
|
|
46
45
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @returns {void}
|
|
46
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
47
|
+
* @param accept - the expected value for the `Accept` header
|
|
48
|
+
* @param contentType - the expected value for the `Content-Type` header
|
|
51
49
|
*/
|
|
52
50
|
function checkMediaHeaders(createRequestMock, accept, contentType) {
|
|
53
51
|
var headers = createRequestMock.mock.calls[0][0].defaultOptions.headers;
|
|
@@ -60,10 +58,9 @@ exports.checkMediaHeaders = checkMediaHeaders;
|
|
|
60
58
|
* and checks for the expected value for a user-defined header. This is verify that the SDK accepts header
|
|
61
59
|
* parameters and sends them as headers in the request.
|
|
62
60
|
*
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @returns {void}
|
|
61
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
62
|
+
* @param userHeaderName - the name of the header passed by the user, e.g. `Contained-Content-Type`
|
|
63
|
+
* @param userHeaderValue - the expected value for the header passed by the user
|
|
67
64
|
*/
|
|
68
65
|
function checkUserHeader(createRequestMock, userHeaderName, userHeaderValue) {
|
|
69
66
|
var headers = createRequestMock.mock.calls[0][0].defaultOptions.headers;
|
|
@@ -74,8 +71,7 @@ exports.checkUserHeader = checkUserHeader;
|
|
|
74
71
|
* This method simply ensures that the method executed without any issues by extracting
|
|
75
72
|
* the argument from the mock object for the `createRequest` method and verifying that it is an object.
|
|
76
73
|
*
|
|
77
|
-
* @param
|
|
78
|
-
* @returns {void}
|
|
74
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
79
75
|
*/
|
|
80
76
|
function checkForSuccessfulExecution(createRequestMock) {
|
|
81
77
|
var sdkParams = createRequestMock.mock.calls[0][0];
|
|
@@ -87,8 +83,8 @@ exports.checkForSuccessfulExecution = checkForSuccessfulExecution;
|
|
|
87
83
|
* an object containing all of the SDK method-specific information (like `path` and `body`) used to build a request.
|
|
88
84
|
* This method is just a convenience method for the unit tests to be able to make assertions on the items in the request.
|
|
89
85
|
*
|
|
90
|
-
* @param
|
|
91
|
-
* @returns
|
|
86
|
+
* @param createRequestMock - the jest mock object for the `createRequest` method in the `RequestWrapper` class
|
|
87
|
+
* @returns Object
|
|
92
88
|
*/
|
|
93
89
|
function getOptions(createRequestMock) {
|
|
94
90
|
return createRequestMock.mock.calls[0][0].options;
|
|
@@ -98,8 +94,7 @@ exports.getOptions = getOptions;
|
|
|
98
94
|
* This method simply ensures that the SDK methods return Promises by checking for
|
|
99
95
|
* the `then` function - common way to assess whether or not an object is a Promise.
|
|
100
96
|
*
|
|
101
|
-
* @param
|
|
102
|
-
* @returns {void}
|
|
97
|
+
* @param sdkPromise - the Promise returned by an SDK method
|
|
103
98
|
*/
|
|
104
99
|
function expectToBePromise(sdkPromise) {
|
|
105
100
|
(0, expect_1.default)(typeof sdkPromise.then).toBe('function');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -20,7 +20,7 @@ import { Stream } from 'stream';
|
|
|
20
20
|
* or array of text chunks
|
|
21
21
|
* Essentially a smaller version of concat-stream wrapped in a promise
|
|
22
22
|
*
|
|
23
|
-
* @param
|
|
24
|
-
* @
|
|
23
|
+
* @param stream - optional stream param for when not bound to an existing stream instance.
|
|
24
|
+
* @returns Promise
|
|
25
25
|
*/
|
|
26
26
|
export declare function streamToPromise(stream: Stream): Promise<any>;
|
package/lib/stream-to-promise.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2022.
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -21,8 +21,8 @@ exports.streamToPromise = void 0;
|
|
|
21
21
|
* or array of text chunks
|
|
22
22
|
* Essentially a smaller version of concat-stream wrapped in a promise
|
|
23
23
|
*
|
|
24
|
-
* @param
|
|
25
|
-
* @
|
|
24
|
+
* @param stream - optional stream param for when not bound to an existing stream instance.
|
|
25
|
+
* @returns Promise
|
|
26
26
|
*/
|
|
27
27
|
function streamToPromise(stream) {
|
|
28
28
|
stream = stream || this;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ibm-cloud-sdk-core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "./es/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"file-type": "16.5.4",
|
|
52
52
|
"form-data": "^2.3.3",
|
|
53
53
|
"isstream": "~0.1.2",
|
|
54
|
-
"jsonwebtoken": "^
|
|
54
|
+
"jsonwebtoken": "^9.0.0",
|
|
55
55
|
"lodash.isempty": "^4.4.0",
|
|
56
56
|
"mime-types": "~2.1.18",
|
|
57
57
|
"object.omit": "~3.0.0",
|