@sap-ux/deploy-tooling 0.14.38 → 0.14.40

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.
@@ -80,25 +80,25 @@ function handle401Error(command, provider, config, logger, archive) {
80
80
  var _a, _b;
81
81
  return __awaiter(this, void 0, void 0, function* () {
82
82
  logger.warn(`${command === tryDeploy ? 'Deployment' : 'Undeployment'} failed with authentication error.`);
83
- logger.info('Please maintain correct credentials to avoid seeing this error\n\t(see help: https://www.npmjs.com/package/@sap/ux-ui5-tooling#setting-environment-variables-in-a-env-file)');
84
- logger.info('Please enter your credentials.');
85
- const credentials = yield (0, system_access_1.getCredentialsWithPrompts)((_b = (_a = provider.defaults) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.username);
86
- if (Object.keys(credentials).length) {
87
- if (config.target.serviceKey) {
88
- config.target.serviceKey.uaa.username = credentials.username;
89
- config.target.serviceKey.uaa.password = credentials.password;
90
- }
91
- else {
92
- config.credentials = credentials;
83
+ if (yield (0, validate_1.checkForCredentials)(config.target.destination, logger)) {
84
+ logger.info('Please maintain correct credentials to avoid seeing this error\n\t(see help: https://www.npmjs.com/package/@sap/ux-ui5-tooling#setting-environment-variables-in-a-env-file)');
85
+ logger.info('Please enter your credentials.');
86
+ const credentials = yield (0, system_access_1.getCredentialsWithPrompts)((_b = (_a = provider.defaults) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.username);
87
+ if (Object.keys(credentials).length) {
88
+ if (config.target.serviceKey) {
89
+ config.target.serviceKey.uaa.username = credentials.username;
90
+ config.target.serviceKey.uaa.password = credentials.password;
91
+ }
92
+ else {
93
+ config.credentials = credentials;
94
+ }
95
+ // Need to re-init the provider with the updated credentials
96
+ provider = yield createProvider(config, logger);
97
+ yield command(provider, config, logger, archive);
98
+ return true;
93
99
  }
94
- // Need to re-init the provider with the updated credentials
95
- provider = yield createProvider(config, logger);
96
- yield command(provider, config, logger, archive);
97
- return true;
98
- }
99
- else {
100
- return false;
101
100
  }
101
+ return false;
102
102
  });
103
103
  }
104
104
  /**
@@ -56,8 +56,16 @@ export declare function formatSummary(summary: SummaryRecord[]): string;
56
56
  * Returns true if specified destination is on-premise and if environment is App Studio
57
57
  * to show additional info.
58
58
  *
59
- * @param destination Indentifier for destination to be checked.
59
+ * @param destination Identifier for destination to be checked.
60
60
  * @returns Promise boolean.
61
61
  */
62
62
  export declare function showAdditionalInfoForOnPrem(destination: string): Promise<boolean>;
63
+ /**
64
+ * Validates if the credentials are required for the destination based on the Authentication type.
65
+ *
66
+ * @param destination Identifier for destination to be checked.
67
+ * @param logger Logger from the calling context.
68
+ * @returns Promise boolean.
69
+ */
70
+ export declare function checkForCredentials(destination: string | undefined, logger: Logger): Promise<boolean>;
63
71
  //# sourceMappingURL=validate.d.ts.map
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.showAdditionalInfoForOnPrem = exports.formatSummary = exports.validateBeforeDeploy = exports.summaryMessage = exports.SummaryStatus = void 0;
12
+ exports.checkForCredentials = exports.showAdditionalInfoForOnPrem = exports.formatSummary = exports.validateBeforeDeploy = exports.summaryMessage = exports.SummaryStatus = void 0;
13
13
  const axios_extension_1 = require("@sap-ux/axios-extension");
14
14
  const chalk_1 = require("chalk");
15
15
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
@@ -33,6 +33,7 @@ exports.summaryMessage = {
33
33
  transportNotRequired: 'Transport Request is not required for local package',
34
34
  atoAdtAccessError: 'Development prefix could not be validated. Please check manually.'
35
35
  };
36
+ let cachedDestinationsList = {};
36
37
  /**
37
38
  * Validation of deploy configuration before running deploy-test.
38
39
  *
@@ -351,7 +352,7 @@ function validateTransportRequestWithAdt(input, output, provider, logger) {
351
352
  * Returns true if specified destination is on-premise and if environment is App Studio
352
353
  * to show additional info.
353
354
  *
354
- * @param destination Indentifier for destination to be checked.
355
+ * @param destination Identifier for destination to be checked.
355
356
  * @returns Promise boolean.
356
357
  */
357
358
  function showAdditionalInfoForOnPrem(destination) {
@@ -365,4 +366,38 @@ function showAdditionalInfoForOnPrem(destination) {
365
366
  });
366
367
  }
367
368
  exports.showAdditionalInfoForOnPrem = showAdditionalInfoForOnPrem;
369
+ /**
370
+ * Validates if the credentials are required for the destination based on the Authentication type.
371
+ *
372
+ * @param destination Identifier for destination to be checked.
373
+ * @param logger Logger from the calling context.
374
+ * @returns Promise boolean.
375
+ */
376
+ function checkForCredentials(destination, logger) {
377
+ return __awaiter(this, void 0, void 0, function* () {
378
+ let check = true;
379
+ if (destination && (0, btp_utils_1.isAppStudio)()) {
380
+ const destinations = yield getDestinations();
381
+ if (destinations[destination].Authentication === btp_utils_1.Authentication.SAML_ASSERTION) {
382
+ logger.warn(`The SAP BTP destination is misconfigured, please check you have the appropriate trusts and permissions enabled.`);
383
+ check = false;
384
+ }
385
+ }
386
+ return check;
387
+ });
388
+ }
389
+ exports.checkForCredentials = checkForCredentials;
390
+ /**
391
+ * Return a list of Destinations.
392
+ *
393
+ * @returns Array of Destination objects
394
+ */
395
+ function getDestinations() {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ if (Object.keys(cachedDestinationsList).length === 0) {
398
+ cachedDestinationsList = yield (0, btp_utils_1.listDestinations)();
399
+ }
400
+ return cachedDestinationsList;
401
+ });
402
+ }
368
403
  //# sourceMappingURL=validate.js.map
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Adeploy-tooling"
11
11
  },
12
- "version": "0.14.38",
12
+ "version": "0.14.40",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -35,14 +35,14 @@
35
35
  "@sap-ux/axios-extension": "1.13.1",
36
36
  "@sap-ux/btp-utils": "0.14.4",
37
37
  "@sap-ux/logger": "0.5.1",
38
- "@sap-ux/system-access": "0.4.1",
38
+ "@sap-ux/system-access": "0.4.2",
39
39
  "@sap-ux/ui5-config": "0.22.8",
40
40
  "@sap-ux/project-input-validator": "0.2.3"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/prompts": "2.4.4",
44
44
  "@types/adm-zip": "0.5.5",
45
- "@sap-ux/store": "0.5.0"
45
+ "@sap-ux/store": "0.6.0"
46
46
  },
47
47
  "ui5": {
48
48
  "dependencies": []