ibm-cloud-sdk-core 5.3.2 → 5.4.1

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 (41) hide show
  1. package/auth/authenticators/authenticator.d.ts +2 -1
  2. package/auth/authenticators/authenticator.js +1 -0
  3. package/auth/authenticators/index.d.ts +3 -1
  4. package/auth/authenticators/index.js +3 -1
  5. package/auth/authenticators/mcsp-authenticator.d.ts +2 -4
  6. package/auth/authenticators/mcsp-authenticator.js +2 -4
  7. package/auth/authenticators/mcspv2-authenticator.d.ts +95 -0
  8. package/auth/authenticators/mcspv2-authenticator.js +85 -0
  9. package/auth/token-managers/index.d.ts +6 -3
  10. package/auth/token-managers/index.js +8 -4
  11. package/auth/token-managers/jwt-token-manager.js +6 -3
  12. package/auth/token-managers/mcspv2-token-manager.d.ts +112 -0
  13. package/auth/token-managers/mcspv2-token-manager.js +176 -0
  14. package/auth/token-managers/token-manager.d.ts +1 -1
  15. package/auth/token-managers/token-manager.js +1 -1
  16. package/auth/utils/get-authenticator-from-environment.d.ts +1 -1
  17. package/auth/utils/get-authenticator-from-environment.js +4 -1
  18. package/docs/ibm-cloud-sdk-core.api.json +293 -5
  19. package/es/auth/authenticators/authenticator.d.ts +2 -1
  20. package/es/auth/authenticators/authenticator.js +1 -0
  21. package/es/auth/authenticators/index.d.ts +3 -1
  22. package/es/auth/authenticators/index.js +1 -0
  23. package/es/auth/authenticators/mcsp-authenticator.d.ts +2 -4
  24. package/es/auth/authenticators/mcsp-authenticator.js +2 -4
  25. package/es/auth/authenticators/mcspv2-authenticator.d.ts +95 -0
  26. package/es/auth/authenticators/mcspv2-authenticator.js +63 -0
  27. package/es/auth/token-managers/index.d.ts +6 -3
  28. package/es/auth/token-managers/index.js +6 -3
  29. package/es/auth/token-managers/jwt-token-manager.js +6 -3
  30. package/es/auth/token-managers/mcspv2-token-manager.d.ts +112 -0
  31. package/es/auth/token-managers/mcspv2-token-manager.js +151 -0
  32. package/es/auth/token-managers/token-manager.d.ts +1 -1
  33. package/es/auth/token-managers/token-manager.js +1 -1
  34. package/es/auth/utils/get-authenticator-from-environment.d.ts +1 -1
  35. package/es/auth/utils/get-authenticator-from-environment.js +5 -2
  36. package/es/lib/request-wrapper.d.ts +1 -1
  37. package/es/lib/request-wrapper.js +8 -3
  38. package/ibm-cloud-sdk-core.d.ts +183 -7
  39. package/lib/request-wrapper.d.ts +1 -1
  40. package/lib/request-wrapper.js +8 -3
  41. package/package.json +2 -2
@@ -55,6 +55,7 @@ export declare class Authenticator implements AuthenticatorInterface {
55
55
  static AUTHTYPE_NOAUTH: string;
56
56
  static AUTHTYPE_VPC: string;
57
57
  static AUTHTYPE_MCSP: string;
58
+ static AUTHTYPE_MCSPV2: string;
58
59
  static AUTHTYPE_UNKNOWN: string;
59
60
  /**
60
61
  * Create a new Authenticator instance.
@@ -739,7 +740,7 @@ export declare class IamAssumeAuthenticator extends IamRequestBasedAuthenticator
739
740
  *
740
741
  * @throws Error: the configuration options are not valid.
741
742
  */
742
- constructor(options: Options_14);
743
+ constructor(options: Options_16);
743
744
  /**
744
745
  * Returns the authenticator's type ('iamAssume').
745
746
  *
@@ -783,7 +784,7 @@ export declare class IamAssumeTokenManager extends IamRequestBasedTokenManager {
783
784
  *
784
785
  * @throws Error: the configuration options are not valid.
785
786
  */
786
- constructor(options: Options_13);
787
+ constructor(options: Options_15);
787
788
  /**
788
789
  * Request an IAM token using a standard access token and a trusted profile.
789
790
  */
@@ -1148,8 +1149,6 @@ export declare class McspAuthenticator extends TokenRequestBasedAuthenticator {
1148
1149
  * @param options - Configuration options for CloudPakForData authentication.
1149
1150
  * This should be an object containing these fields:
1150
1151
  * - url: (required) the endpoint URL for the CloudPakForData token service
1151
- * - username: (required) the username used to obtain a bearer token
1152
- * - password: (optional) the password used to obtain a bearer token (required if apikey is not specified)
1153
1152
  * - apikey: (optional) the API key used to obtain a bearer token (required if password is not specified)
1154
1153
  * - disableSslVerification: (optional) a flag that indicates whether verification of the token server's SSL certificate
1155
1154
  * should be disabled or not
@@ -1159,7 +1158,7 @@ export declare class McspAuthenticator extends TokenRequestBasedAuthenticator {
1159
1158
  */
1160
1159
  constructor(options: Options_12);
1161
1160
  /**
1162
- * Returns the authenticator's type ('cp4d').
1161
+ * Returns the authenticator's type ('mcsp').
1163
1162
  *
1164
1163
  * @returns a string that indicates the authenticator's type
1165
1164
  */
@@ -1192,6 +1191,95 @@ export declare class McspTokenManager extends JwtTokenManager {
1192
1191
  protected requestToken(): Promise<any>;
1193
1192
  }
1194
1193
 
1194
+ /**
1195
+ * The McspV2Authenticator invokes the MCSP v2 token-exchange operation (POST /api/2.0/\{scopeCollectionType\}/\{scopeId\}/apikeys/token)
1196
+ * to obtain an access token for an apikey, and adds the access token to requests via an Authorization header
1197
+ * of the form: "Authorization: Bearer <access-token>"
1198
+ */
1199
+ export declare class McspV2Authenticator extends TokenRequestBasedAuthenticator {
1200
+ protected tokenManager: McspV2TokenManager;
1201
+ /**
1202
+ * Create a new McspV2Authenticator instance.
1203
+ *
1204
+ * @param options - Configuration options for MCSP v2 authentication.
1205
+ * This should be an object containing these fields:
1206
+ * - url: (required) the endpoint URL for the CloudPakForData token service.
1207
+ * - apikey: (optional) the API key used to obtain a bearer token (required if password is not specified).
1208
+ * - scopeCollectionType: (required) The scope collection type of item(s). Valid values are: "accounts", "subscriptions", "services".
1209
+ * - scopeId: (required) the scope identifier of item(s).
1210
+ * - includeBuiltinActions: (optional) a flag to include builtin actions in the "actions" claim in the MCSP access token (default: false).
1211
+ * - includeCustomActions: (optional) a flag to include custom actions in the "actions" claim in the MCSP access token (default: false).
1212
+ * - includeRoles: (optional) a flag to include the "roles" claim in the MCSP access token (default: true).
1213
+ * - prefixRoles: (optional) a flag to add a prefix with the scope level where the role is defined in the "roles" claim (default: false).
1214
+ * - callerExtClaim: (optional) a map (object) containing keys and values to be injected into the access token as the "callerExt" claim.
1215
+ * The keys used in this map must be enabled in the apikey by setting the "callerExtClaimNames" property when the apikey is created.
1216
+ * This property is typically only used in scenarios involving an apikey with identityType `SERVICEID`.
1217
+ * - disableSslVerification: (optional) a flag to disable verification of the token server's SSL certificate; defaults to false.
1218
+ * - headers: (optional) a set of HTTP headers to be sent with each request to the token service.
1219
+ *
1220
+ * @throws Error: the input configuration failed validation
1221
+ */
1222
+ constructor(options: Options_14);
1223
+ /**
1224
+ * Returns the authenticator's type ('mcspv2').
1225
+ *
1226
+ * @returns a string that indicates the authenticator's type
1227
+ */
1228
+ authenticationType(): string;
1229
+ }
1230
+
1231
+ /**
1232
+ * Token Manager for Multi-Cloud Saas Platform (MCSP) V2 authentication.
1233
+ *
1234
+ * The McspV2TokenManager will invoke the MCSP token service's 'POST /api/2.0/\{scopeCollectionType\}/\{scopeId\}/apikeys/token'
1235
+ * operation to obtain an MCSP access token for an apikey.
1236
+ */
1237
+ export declare class McspV2TokenManager extends JwtTokenManager {
1238
+ protected requiredOptions: string[];
1239
+ private apikey;
1240
+ private scopeCollectionType;
1241
+ private scopeId;
1242
+ private includeBuiltinActions;
1243
+ private includeCustomActions;
1244
+ private includeRoles;
1245
+ private prefixRoles;
1246
+ private callerExtClaim;
1247
+ /**
1248
+ * Create a new McspV2TokenManager instance.
1249
+ *
1250
+ * @param options - Configuration options.
1251
+ * This should be an object containing these fields:
1252
+ * - url: (required) the endpoint URL for the CloudPakForData token service.
1253
+ * - apikey: (optional) the API key used to obtain a bearer token (required if password is not specified).
1254
+ * - scopeCollectionType: (required) The scope collection type of item(s). Valid values are: "accounts", "subscriptions", "services".
1255
+ * - scopeId: (required) the scope identifier of item(s).
1256
+ * - includeBuiltinActions: (optional) a flag to include builtin actions in the "actions" claim in the MCSP access token (default: false).
1257
+ * - includeCustomActions: (optional) a flag to include custom actions in the "actions" claim in the MCSP access token (default: false).
1258
+ * - includeRoles: (optional) a flag to include the "roles" claim in the MCSP access token (default: true).
1259
+ * - prefixRoles: (optional) a flag to add a prefix with the scope level where the role is defined in the "roles" claim (default: false).
1260
+ * - callerExtClaim: (optional) a map (object) containing keys and values to be injected into the access token as the "callerExt" claim.
1261
+ * The keys used in this map must be enabled in the apikey by setting the "callerExtClaimNames" property when the apikey is created.
1262
+ * This property is typically only used in scenarios involving an apikey with identityType `SERVICEID`.
1263
+ * - disableSslVerification: (optional) a flag to disable verification of the token server's SSL certificate; defaults to false.
1264
+ * - headers: (optional) a set of HTTP headers to be sent with each request to the token service.
1265
+ *
1266
+ * @throws Error: the input configuration failed validation
1267
+ */
1268
+ constructor(options: Options_13);
1269
+ private PATH_TEMPLATE;
1270
+ protected requestToken(): Promise<any>;
1271
+ /**
1272
+ * Parses the Options configuration property named by 'fieldName' as a boolean value.
1273
+ * The value in the Options object could be either boolean or string and this function
1274
+ * will do its best to parse it correctly.
1275
+ * @param options - the Options object containing the configuration
1276
+ * @param fieldName - the name of the field to parse as a boolean
1277
+ * @param defaultValue - the default value to use in case the specified field is not present in Options
1278
+ * @returns boolean the boolean value to be used for the configuration property
1279
+ */
1280
+ private static parseBoolean;
1281
+ }
1282
+
1195
1283
  /**
1196
1284
  * NoAuthAuthenticator is a placeholder authenticator implementation which
1197
1285
  * performs no authentication of outgoing REST API requests. It might be
@@ -1251,8 +1339,96 @@ declare interface Options_12 extends BaseOptions {
1251
1339
  url: string;
1252
1340
  }
1253
1341
 
1342
+ /**
1343
+ * Configuration options for MCSP v2 token retrieval.
1344
+ */
1345
+ declare interface Options_13 extends JwtTokenManagerOptions {
1346
+ /**
1347
+ * (required) The API key used to obtain an MCSP access token.
1348
+ */
1349
+ apikey: string;
1350
+ /**
1351
+ * (required) The URL representing the MCSP token service endpoint.
1352
+ */
1353
+ url: string;
1354
+ /**
1355
+ * (required) The scope collection type of item(s).
1356
+ * Valid values are: "accounts", "subscriptions", "services".
1357
+ */
1358
+ scopeCollectionType: string;
1359
+ /**
1360
+ * (required) The scope identifier of item(s).
1361
+ */
1362
+ scopeId: string;
1363
+ /**
1364
+ * (optional) A flag to include builtin actions in the "actions" claim in the MCSP access token (default: false).
1365
+ */
1366
+ includeBuiltinActions?: boolean;
1367
+ /**
1368
+ * (optional) A flag to include custom actions in the "actions" claim in the MCSP access token (default: false).
1369
+ */
1370
+ includeCustomActions?: boolean;
1371
+ /**
1372
+ * (optional) A flag to include the "roles" claim in the MCSP access token (default: true).
1373
+ */
1374
+ includeRoles?: boolean;
1375
+ /**
1376
+ * (optional) A flag to add a prefix with the scope level where the role is defined in the "roles" claim (default: false).
1377
+ */
1378
+ prefixRoles?: boolean;
1379
+ /**
1380
+ * (optional) A map (object) containing keys and values to be injected into the access token as the "callerExt" claim.
1381
+ * The keys used in this map must be enabled in the apikey by setting the "callerExtClaimNames" property when the apikey is created.
1382
+ * This property is typically only used in scenarios involving an apikey with identityType `SERVICEID`.
1383
+ */
1384
+ callerExtClaim?: object;
1385
+ }
1386
+
1387
+ /** Configuration options for Multi-Cloud Saas Platform (MCSP) v2 authentication. */
1388
+ declare interface Options_14 extends BaseOptions {
1389
+ /**
1390
+ * (required) The API key used to obtain an MCSP access token.
1391
+ */
1392
+ apikey: string;
1393
+ /**
1394
+ * (required) The URL representing the MCSP token service endpoint.
1395
+ */
1396
+ url: string;
1397
+ /**
1398
+ * (required) The scope collection type of item(s).
1399
+ * Valid values are: "accounts", "subscriptions", "services".
1400
+ */
1401
+ scopeCollectionType: string;
1402
+ /**
1403
+ * (required) The scope identifier of item(s).
1404
+ */
1405
+ scopeId: string;
1406
+ /**
1407
+ * (optional) A flag to include builtin actions in the "actions" claim in the MCSP access token (default: false).
1408
+ */
1409
+ includeBuiltinActions?: boolean;
1410
+ /**
1411
+ * (optional) A flag to include custom actions in the "actions" claim in the MCSP access token (default: false).
1412
+ */
1413
+ includeCustomActions?: boolean;
1414
+ /**
1415
+ * (optional) A flag to include the "roles" claim in the MCSP access token (default: true).
1416
+ */
1417
+ includeRoles?: boolean;
1418
+ /**
1419
+ * (optional) A flag to add a prefix with the scope level where the role is defined in the "roles" claim (default: false).
1420
+ */
1421
+ prefixRoles?: boolean;
1422
+ /**
1423
+ * (optional) A map (object) containing keys and values to be injected into the access token as the "callerExt" claim.
1424
+ * The keys used in this map must be enabled in the apikey by setting the "callerExtClaimNames" property when the apikey is created.
1425
+ * This property is typically only used in scenarios involving an apikey with identityType `SERVICEID`.
1426
+ */
1427
+ callerExtClaim?: object;
1428
+ }
1429
+
1254
1430
  /** Configuration options for IAM Assume token retrieval. */
1255
- declare interface Options_13 extends IamRequestOptions {
1431
+ declare interface Options_15 extends IamRequestOptions {
1256
1432
  apikey: string;
1257
1433
  iamProfileId?: string;
1258
1434
  iamProfileCrn?: string;
@@ -1261,7 +1437,7 @@ declare interface Options_13 extends IamRequestOptions {
1261
1437
  }
1262
1438
 
1263
1439
  /** Configuration options for IAM Assume authentication. */
1264
- declare interface Options_14 extends IamRequestOptions_2 {
1440
+ declare interface Options_16 extends IamRequestOptions_2 {
1265
1441
  /** The IAM api key */
1266
1442
  apikey: string;
1267
1443
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2014, 2024.
2
+ * (C) Copyright IBM Corp. 2014, 2025.
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.
@@ -76,7 +76,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
76
76
  Object.defineProperty(exports, "__esModule", { value: true });
77
77
  exports.RequestWrapper = void 0;
78
78
  /**
79
- * (C) Copyright IBM Corp. 2014, 2024.
79
+ * (C) Copyright IBM Corp. 2014, 2025.
80
80
  *
81
81
  * Licensed under the Apache License, Version 2.0 (the "License");
82
82
  * you may not use this file except in compliance with the License.
@@ -179,10 +179,15 @@ var RequestWrapper = /** @class */ (function () {
179
179
  * @returns the string representation of the request
180
180
  */
181
181
  RequestWrapper.prototype.formatAxiosRequest = function (request) {
182
- var method = request.method, url = request.url, data = request.data, headers = request.headers;
182
+ var method = request.method, url = request.url, data = request.data, headers = request.headers, params = request.params;
183
+ var queryString = (0, querystring_1.stringify)(params);
184
+ if (queryString) {
185
+ queryString = "?".concat(queryString);
186
+ }
183
187
  var headersOutput = this.formatAxiosHeaders(headers);
184
188
  var body = this.formatAxiosBody(data);
185
- var output = "".concat((method || '??').toUpperCase(), " ").concat(url || '??', "\n").concat(headersOutput, "\n").concat(body);
189
+ var urlStr = url ? url + queryString : '??';
190
+ var output = "".concat((method || '??').toUpperCase(), " ").concat(urlStr, "\n").concat(headersOutput, "\n").concat(body);
186
191
  return (0, private_helpers_1.redactSecrets)(output);
187
192
  };
188
193
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibm-cloud-sdk-core",
3
- "version": "5.3.2",
3
+ "version": "5.4.1",
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",
@@ -43,7 +43,7 @@
43
43
  "dotenv": "^16.4.5",
44
44
  "extend": "3.0.2",
45
45
  "file-type": "16.5.4",
46
- "form-data": "4.0.0",
46
+ "form-data": "^4.0.4",
47
47
  "isstream": "0.1.2",
48
48
  "jsonwebtoken": "^9.0.2",
49
49
  "mime-types": "2.1.35",