@sap-ux/generator-adp 1.0.74 → 1.0.75

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.
@@ -375,19 +375,5 @@ export declare class ConfigPrompter {
375
375
  * @returns {boolean} True if the project type classic label must be displayed.
376
376
  */
377
377
  private shouldDisplayProjectTypeClassicLabel;
378
- /**
379
- * Determines whether the given system requires authentication.
380
- *
381
- * Returns `undefined` when no ABAP provider is configured. Otherwise, checks the system
382
- * endpoint's authentication requirement. In SAP Business Application Studio, when the system
383
- * reports that authentication is required, it verifies this by attempting to fetch a CSRF
384
- * token from the layered repository: a `401` response confirms authentication is required,
385
- * while a successful call indicates it is not.
386
- *
387
- * @param {string} system - The system to check.
388
- * @returns {Promise<boolean | undefined>} `true` if authentication is required, `false` if not,
389
- * or `undefined` if no provider is configured.
390
- */
391
- private getIsAuthRequired;
392
378
  }
393
379
  //# sourceMappingURL=configuration.d.ts.map
@@ -5,6 +5,8 @@ const adp_tooling_1 = require("@sap-ux/adp-tooling");
5
5
  const axios_extension_1 = require("@sap-ux/axios-extension");
6
6
  const btp_utils_1 = require("@sap-ux/btp-utils");
7
7
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
8
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
9
+ const feature_toggle_1 = require("@sap-ux/feature-toggle");
8
10
  const i18n_js_1 = require("../../utils/i18n.js");
9
11
  const types_js_1 = require("../types.js");
10
12
  const additional_messages_js_1 = require("./helper/additional-messages.js");
@@ -12,8 +14,6 @@ const choices_js_1 = require("./helper/choices.js");
12
14
  const conditions_js_1 = require("./helper/conditions.js");
13
15
  const message_js_1 = require("./helper/message.js");
14
16
  const validators_js_1 = require("./helper/validators.js");
15
- const feature_toggle_1 = require("@sap-ux/feature-toggle");
16
- const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
17
17
  /**
18
18
  * A stateful prompter class that creates configuration questions.
19
19
  * It exposes a single public method {@link getPrompts} to retrieve the configuration questions.
@@ -240,7 +240,7 @@ class ConfigPrompter {
240
240
  default: '',
241
241
  validate: (value) => this.validateSystem(value),
242
242
  additionalMessages: () => {
243
- this.systemAdditionalMessage = (0, additional_messages_js_1.getSystemAdditionalMessages)(this.flexUICapability, this.selectedProjectType);
243
+ this.systemAdditionalMessage ??= (0, additional_messages_js_1.getSystemAdditionalMessages)(this.flexUICapability, this.selectedProjectType);
244
244
  return this.systemAdditionalMessage;
245
245
  }
246
246
  };
@@ -651,12 +651,24 @@ class ConfigPrompter {
651
651
  this.selectedProjectType = undefined;
652
652
  this.selectedSystemType = undefined;
653
653
  this.supportedProject = undefined;
654
+ this.systemAdditionalMessage = undefined;
654
655
  const options = {
655
656
  system,
656
657
  client: undefined
657
658
  };
658
659
  this.abapProvider = await (0, adp_tooling_1.getConfiguredProvider)(options, this.logger);
659
- this.isAuthRequired = (await this.getIsAuthRequired(system)) ?? false;
660
+ this.isAuthRequired = await (0, adp_tooling_1.isAuthRequired)(system, this.logger);
661
+ if (this.isAuthRequired && !(0, btp_utils_1.isAppStudio)() && (await this.systemLookup.isBasicAuthConfigured(system))) {
662
+ // In VSCode we display the credentials prompts in case the system is configured with
663
+ // invalid credentials + a warning suggesting the user to check the credentials. In BAS
664
+ // we do to show the prompts for credentials, the generator stop with a validation error
665
+ // suggesting to check the destination configuration in BTP. This will make the ADP generator
666
+ // consistent with the Fiori generator in this use case.
667
+ this.systemAdditionalMessage = {
668
+ message: (0, i18n_js_1.t)('warnings.authenticationFailedUpdateCredentialsMessage'),
669
+ severity: yeoman_ui_types_1.Severity.information
670
+ };
671
+ }
660
672
  if (this.isAuthRequired) {
661
673
  return true;
662
674
  }
@@ -882,38 +894,6 @@ class ConfigPrompter {
882
894
  shouldDisplayProjectTypeClassicLabel(application) {
883
895
  return !(0, feature_toggle_1.isInternalFeaturesSettingEnabled)() && this.isClassicAppOnMixedSystem(application);
884
896
  }
885
- /**
886
- * Determines whether the given system requires authentication.
887
- *
888
- * Returns `undefined` when no ABAP provider is configured. Otherwise, checks the system
889
- * endpoint's authentication requirement. In SAP Business Application Studio, when the system
890
- * reports that authentication is required, it verifies this by attempting to fetch a CSRF
891
- * token from the layered repository: a `401` response confirms authentication is required,
892
- * while a successful call indicates it is not.
893
- *
894
- * @param {string} system - The system to check.
895
- * @returns {Promise<boolean | undefined>} `true` if authentication is required, `false` if not,
896
- * or `undefined` if no provider is configured.
897
- */
898
- async getIsAuthRequired(system) {
899
- if (!this.abapProvider) {
900
- return undefined;
901
- }
902
- const doesSystemRequireAuth = await this.systemLookup.getSystemRequiresAuth(system);
903
- if (!(0, btp_utils_1.isAppStudio)() || !doesSystemRequireAuth) {
904
- return doesSystemRequireAuth;
905
- }
906
- try {
907
- await this.abapProvider.getLayeredRepository().getCsrfToken();
908
- return false;
909
- }
910
- catch (error) {
911
- if ((0, axios_extension_1.isAxiosError)(error) && error.response?.status === 401) {
912
- return true;
913
- }
914
- throw error;
915
- }
916
- }
917
897
  }
918
898
  exports.ConfigPrompter = ConfigPrompter;
919
899
  //# sourceMappingURL=configuration.js.map
@@ -351,7 +351,7 @@ class KeyUserImportPrompter {
351
351
  this.isAuthRequired = false;
352
352
  return await this.loadDataAndValidateKeyUserChanges();
353
353
  }
354
- this.isAuthRequired = await this.systemLookup.getSystemRequiresAuth(system);
354
+ this.isAuthRequired = await (0, adp_tooling_1.isAuthRequired)(system, this.logger);
355
355
  if (!this.isAuthRequired) {
356
356
  const options = {
357
357
  system,
@@ -1,7 +1,6 @@
1
1
  import type { Manifest } from '@sap-ux/project-access';
2
2
  import { type AbapTarget } from '@sap-ux/system-access';
3
3
  import type { DescriptorVariant, IManifestService } from '@sap-ux/adp-tooling';
4
- import { SystemLookup } from '@sap-ux/adp-tooling';
5
4
  import SubGeneratorBase from './sub-gen-base.js';
6
5
  import type { GeneratorOpts } from '../utils/opts.js';
7
6
  import type { GeneratorTypes } from '../types.js';
@@ -38,10 +37,6 @@ export default class SubGeneratorWithAuthBase extends SubGeneratorBase {
38
37
  * The descriptor variant.
39
38
  */
40
39
  protected variant: DescriptorVariant;
41
- /**
42
- * The system lookup instance.
43
- */
44
- protected systemLookup: SystemLookup;
45
40
  /**
46
41
  * Whether this is a CF project.
47
42
  */
@@ -45,10 +45,6 @@ class SubGeneratorWithAuthBase extends sub_gen_base_js_1.default {
45
45
  * The descriptor variant.
46
46
  */
47
47
  variant;
48
- /**
49
- * The system lookup instance.
50
- */
51
- systemLookup;
52
48
  /**
53
49
  * Whether this is a CF project.
54
50
  */
@@ -78,7 +74,6 @@ class SubGeneratorWithAuthBase extends sub_gen_base_js_1.default {
78
74
  */
79
75
  async onInit() {
80
76
  await (0, i18n_js_1.initI18n)();
81
- this.systemLookup = new adp_tooling_1.SystemLookup(this.logger);
82
77
  this.isCFProject = await (0, adp_tooling_1.isCFEnvironment)(this.projectPath);
83
78
  if (this.isCFProject) {
84
79
  this.system = '';
@@ -93,7 +88,7 @@ class SubGeneratorWithAuthBase extends sub_gen_base_js_1.default {
93
88
  this.logger.log(`Successfully retrieved abap target\n${JSON.stringify(this.abapTarget, null, 2)}`);
94
89
  this._registerPrompts(new yeoman_ui_types_1.Prompts((0, steps_js_1.getSubGenAuthPages)(this.generatorType, this.system)));
95
90
  try {
96
- this.requiresAuth = await this.systemLookup.getSystemRequiresAuth(this.system);
91
+ this.requiresAuth = await (0, adp_tooling_1.isAuthRequired)(this.system, this.logger);
97
92
  this.logger.log(`System ${this.system} requires authentication: ${this.requiresAuth}`);
98
93
  if (!this.requiresAuth) {
99
94
  // Remove the credential page when authentication is not required
@@ -101,6 +96,8 @@ class SubGeneratorWithAuthBase extends sub_gen_base_js_1.default {
101
96
  }
102
97
  }
103
98
  catch (error) {
99
+ // Remove the credential page in case an error occures.
100
+ this.prompts.splice(0, 1, []);
104
101
  await this.handleRuntimeCrash(error.message);
105
102
  }
106
103
  }
@@ -89,7 +89,8 @@
89
89
  "emptyAnnotationFile": "An empty annotation file will be created in the webapp/changes/annotations folder of your project."
90
90
  },
91
91
  "warnings": {
92
- "passwordStoreWarning": "Passwords are stored in your operating system's credential manager and are protected by its security policies."
92
+ "passwordStoreWarning": "Passwords are stored in your operating system's credential manager and are protected by its security policies.",
93
+ "authenticationFailedUpdateCredentialsMessage": "Authentication failed. Please try updating the credentials."
93
94
  },
94
95
  "error": {
95
96
  "selectCannotBeEmptyError": "The {{value}} has to be selected.",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "SAPUI5 Adaptation Project",
4
4
  "homepage": "https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/ada9567b767941aba8d49fdb4fdedea7.html",
5
5
  "description": "Adaptation project allows you to create an app variant for an existing SAP Fiori elements-based or SAPUI5 freestyle application, without changing the original application.",
6
- "version": "1.0.74",
6
+ "version": "1.0.75",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,7 +30,7 @@
30
30
  "i18next": "26.3.6",
31
31
  "yeoman-generator": "5.10.0",
32
32
  "uuid": "11.1.1",
33
- "@sap-ux/adp-tooling": "1.0.68",
33
+ "@sap-ux/adp-tooling": "1.0.69",
34
34
  "@sap-ux/axios-extension": "2.1.4",
35
35
  "@sap-ux/btp-utils": "2.0.8",
36
36
  "@sap-ux/feature-toggle": "1.0.5",
@@ -58,7 +58,7 @@
58
58
  "fs-extra": "11.4.1",
59
59
  "rimraf": "6.1.3",
60
60
  "yeoman-test": "6.3.0",
61
- "@sap-ux/deploy-config-sub-generator": "1.0.84"
61
+ "@sap-ux/deploy-config-sub-generator": "1.0.85"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22.x"