@sap-ux/generator-adp 1.0.8 → 1.0.10

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/generators/add-annotations-to-odata/index.js +20 -15
  2. package/generators/add-component-usages/index.js +21 -16
  3. package/generators/add-new-model/index.js +29 -24
  4. package/generators/app/extension-project/index.js +9 -6
  5. package/generators/app/index.js +135 -129
  6. package/generators/app/layer.js +8 -5
  7. package/generators/app/questions/attributes.js +65 -60
  8. package/generators/app/questions/cf-services.js +52 -48
  9. package/generators/app/questions/configuration.js +129 -125
  10. package/generators/app/questions/helper/additional-messages.js +36 -29
  11. package/generators/app/questions/helper/choices.js +25 -16
  12. package/generators/app/questions/helper/conditions.js +23 -14
  13. package/generators/app/questions/helper/default-values.js +13 -8
  14. package/generators/app/questions/helper/message.js +11 -7
  15. package/generators/app/questions/helper/tooltip.js +7 -4
  16. package/generators/app/questions/helper/validators.js +39 -29
  17. package/generators/app/questions/key-user.js +45 -40
  18. package/generators/app/questions/target-env.js +27 -22
  19. package/generators/app/types.js +16 -13
  20. package/generators/base/questions/credentials.js +18 -15
  21. package/generators/base/sub-gen-auth-base.js +30 -24
  22. package/generators/base/sub-gen-base.js +17 -11
  23. package/generators/change-data-source/index.js +13 -8
  24. package/generators/telemetry/collector.js +10 -6
  25. package/generators/telemetry/events.js +5 -2
  26. package/generators/telemetry/index.js +18 -2
  27. package/generators/types.js +5 -2
  28. package/generators/utils/appWizardCache.js +13 -7
  29. package/generators/utils/deps.d.ts +6 -0
  30. package/generators/utils/deps.js +52 -10
  31. package/generators/utils/i18n.js +20 -12
  32. package/generators/utils/logger.js +7 -4
  33. package/generators/utils/opts.js +6 -3
  34. package/generators/utils/parse-json-input.js +9 -5
  35. package/generators/utils/steps.js +48 -37
  36. package/generators/utils/subgenHelpers.js +14 -9
  37. package/generators/utils/templates.d.ts +4 -0
  38. package/generators/utils/templates.js +13 -7
  39. package/generators/utils/type-guards.js +6 -2
  40. package/generators/utils/workspace.js +13 -7
  41. package/package.json +6 -7
@@ -1,6 +1,9 @@
1
- import { Severity } from '@sap-devx/yeoman-ui-types';
2
- import { AdaptationProjectType } from '@sap-ux/axios-extension';
3
- import { t } from '../../../utils/i18n.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTargetEnvAdditionalMessages = exports.getVersionAdditionalMessages = exports.getAppAdditionalMessages = exports.getSystemAdditionalMessages = void 0;
4
+ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
5
+ const axios_extension_1 = require("@sap-ux/axios-extension");
6
+ const i18n_js_1 = require("../../../utils/i18n.js");
4
7
  /**
5
8
  * Evaluates a system's deployment and flexibility capabilities to generate relevant messages based on the system's characteristics.
6
9
  *
@@ -9,38 +12,39 @@ import { t } from '../../../utils/i18n.js';
9
12
  * @param {AdaptationProjectType|undefined} projectType - The project type.
10
13
  * @returns {IMessageSeverity | undefined} An object containing a message and its severity level.
11
14
  */
12
- export const getSystemAdditionalMessages = (flexUICapability, projectType) => {
15
+ const getSystemAdditionalMessages = (flexUICapability, projectType) => {
13
16
  if (!flexUICapability || !projectType) {
14
17
  return undefined;
15
18
  }
16
- if (projectType === AdaptationProjectType.CLOUD_READY) {
19
+ if (projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY) {
17
20
  return {
18
- message: t('prompts.projectTypeCloudReadyLabel'),
19
- severity: Severity.information
21
+ message: (0, i18n_js_1.t)('prompts.projectTypeCloudReadyLabel'),
22
+ severity: yeoman_ui_types_1.Severity.information
20
23
  };
21
24
  }
22
25
  const { isDtaFolderDeploymentSupported, isUIFlexSupported } = flexUICapability;
23
26
  if (isUIFlexSupported) {
24
27
  return isDtaFolderDeploymentSupported
25
28
  ? {
26
- message: t('prompts.projectTypeClassicLabel'),
27
- severity: Severity.information
29
+ message: (0, i18n_js_1.t)('prompts.projectTypeClassicLabel'),
30
+ severity: yeoman_ui_types_1.Severity.information
28
31
  }
29
32
  : {
30
- message: t('error.notDeployableSystemError'),
31
- severity: Severity.error
33
+ message: (0, i18n_js_1.t)('error.notDeployableSystemError'),
34
+ severity: yeoman_ui_types_1.Severity.error
32
35
  };
33
36
  }
34
37
  return isDtaFolderDeploymentSupported
35
38
  ? {
36
- message: t('error.notFlexEnabledError'),
37
- severity: Severity.warning
39
+ message: (0, i18n_js_1.t)('error.notFlexEnabledError'),
40
+ severity: yeoman_ui_types_1.Severity.warning
38
41
  }
39
42
  : {
40
- message: t('error.notDeployableNotFlexEnabledSystemError'),
41
- severity: Severity.warning
43
+ message: (0, i18n_js_1.t)('error.notDeployableNotFlexEnabledSystemError'),
44
+ severity: yeoman_ui_types_1.Severity.warning
42
45
  };
43
46
  };
47
+ exports.getSystemAdditionalMessages = getSystemAdditionalMessages;
44
48
  /**
45
49
  * Provides an additional contextual message for the selected application, based on its compatibility,
46
50
  * feature support, or sync-loading behavior.
@@ -50,51 +54,53 @@ export const getSystemAdditionalMessages = (flexUICapability, projectType) => {
50
54
  * @param {boolean} isApplicationSupported - Indicates whether the application is supported at all.
51
55
  * @returns {IMessageSeverity | undefined} Message object or undefined if no message is applicable.
52
56
  */
53
- export const getAppAdditionalMessages = (app, { hasSyncViews, isSupported, isPartiallySupported, isV4AppInternalMode }, isApplicationSupported) => {
57
+ const getAppAdditionalMessages = (app, { hasSyncViews, isSupported, isPartiallySupported, isV4AppInternalMode }, isApplicationSupported) => {
54
58
  if (!app) {
55
59
  return undefined;
56
60
  }
57
61
  if (hasSyncViews && isApplicationSupported) {
58
62
  return {
59
- message: t('prompts.appInfoLabel'),
60
- severity: Severity.information
63
+ message: (0, i18n_js_1.t)('prompts.appInfoLabel'),
64
+ severity: yeoman_ui_types_1.Severity.information
61
65
  };
62
66
  }
63
67
  if (!isSupported && !isPartiallySupported && isApplicationSupported) {
64
68
  return {
65
- message: t('prompts.notSupportedAdpOverAdpLabel'),
66
- severity: Severity.warning
69
+ message: (0, i18n_js_1.t)('prompts.notSupportedAdpOverAdpLabel'),
70
+ severity: yeoman_ui_types_1.Severity.warning
67
71
  };
68
72
  }
69
73
  if (isPartiallySupported && isApplicationSupported) {
70
74
  return {
71
- message: t('prompts.isPartiallySupportedAdpOverAdpLabel'),
72
- severity: Severity.warning
75
+ message: (0, i18n_js_1.t)('prompts.isPartiallySupportedAdpOverAdpLabel'),
76
+ severity: yeoman_ui_types_1.Severity.warning
73
77
  };
74
78
  }
75
79
  if (isV4AppInternalMode) {
76
80
  return {
77
- message: t('prompts.v4AppNotOfficialLabel'),
78
- severity: Severity.warning
81
+ message: (0, i18n_js_1.t)('prompts.v4AppNotOfficialLabel'),
82
+ severity: yeoman_ui_types_1.Severity.warning
79
83
  };
80
84
  }
81
85
  return undefined;
82
86
  };
87
+ exports.getAppAdditionalMessages = getAppAdditionalMessages;
83
88
  /**
84
89
  * Provides additional messages related to UI5 version detection based on system and authentication conditions.
85
90
  *
86
91
  * @param {boolean} isVersionDetected - Flag indicating that the system ui5 version was detected.
87
92
  * @returns {object | undefined} An object containing a message and its severity level if conditions are met; otherwise, undefined.
88
93
  */
89
- export const getVersionAdditionalMessages = (isVersionDetected) => {
94
+ const getVersionAdditionalMessages = (isVersionDetected) => {
90
95
  if (!isVersionDetected) {
91
96
  return {
92
- message: t('validators.ui5VersionNotDetectedError'),
93
- severity: Severity.warning
97
+ message: (0, i18n_js_1.t)('validators.ui5VersionNotDetectedError'),
98
+ severity: yeoman_ui_types_1.Severity.warning
94
99
  };
95
100
  }
96
101
  return undefined;
97
102
  };
103
+ exports.getVersionAdditionalMessages = getVersionAdditionalMessages;
98
104
  /**
99
105
  * Provides additional messages related to the target environment.
100
106
  *
@@ -103,13 +109,14 @@ export const getVersionAdditionalMessages = (isVersionDetected) => {
103
109
  * @param {any} cfConfig - The Cloud Foundry configuration.
104
110
  * @returns {IMessageSeverity | undefined} Message object or undefined if no message is applicable.
105
111
  */
106
- export const getTargetEnvAdditionalMessages = (value, isCFLoggedIn, cfConfig) => {
112
+ const getTargetEnvAdditionalMessages = (value, isCFLoggedIn, cfConfig) => {
107
113
  if (value === 'CF' && isCFLoggedIn) {
108
114
  return {
109
115
  message: `You are logged in to Cloud Foundry: ${cfConfig.url} / ${cfConfig.org?.Name} / ${cfConfig.space?.Name}.`,
110
- severity: Severity.information
116
+ severity: yeoman_ui_types_1.Severity.information
111
117
  };
112
118
  }
113
119
  return undefined;
114
120
  };
121
+ exports.getTargetEnvAdditionalMessages = getTargetEnvAdditionalMessages;
115
122
  //# sourceMappingURL=additional-messages.js.map
@@ -1,6 +1,9 @@
1
- import { AppRouterType, getEndpointNames } from '@sap-ux/adp-tooling';
2
- import { AdaptationProjectType } from '@sap-ux/axios-extension';
3
- import { t } from '../../../utils/i18n.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getKeyUserSystemChoices = exports.getAdaptationChoices = exports.getProjectTypeChoices = exports.getAppRouterChoices = exports.getCFAppChoices = exports.getApplicationChoices = void 0;
4
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
5
+ const axios_extension_1 = require("@sap-ux/axios-extension");
6
+ const i18n_js_1 = require("../../../utils/i18n.js");
4
7
  /**
5
8
  * Creates a list of choices from a list of applications, formatted for display or selection in a UI.
6
9
  * Each choice consists of an application's title (or ID if no title), followed by its registration IDs and ACH, formatted for easy reading.
@@ -8,7 +11,7 @@ import { t } from '../../../utils/i18n.js';
8
11
  * @param {SourceApplication[]} apps - An array of applications to be transformed into display choices.
9
12
  * @returns {Choice[]} An array of objects each containing a value (the full application object) and a name (a formatted string).
10
13
  */
11
- export const getApplicationChoices = (apps) => {
14
+ const getApplicationChoices = (apps) => {
12
15
  return Array.isArray(apps)
13
16
  ? apps.map((app) => {
14
17
  const name = app.title
@@ -21,60 +24,65 @@ export const getApplicationChoices = (apps) => {
21
24
  })
22
25
  : apps;
23
26
  };
27
+ exports.getApplicationChoices = getApplicationChoices;
24
28
  /**
25
29
  * Get the choices for the base app.
26
30
  *
27
31
  * @param {CFApp[]} apps - The apps to get the choices for.
28
32
  * @returns {Array<{ name: string; value: CFApp }>} The choices for the base app.
29
33
  */
30
- export const getCFAppChoices = (apps) => {
34
+ const getCFAppChoices = (apps) => {
31
35
  return apps.map((app) => ({
32
36
  name: `${app.title} (${app.appId} ${app.appVersion})`,
33
37
  value: app
34
38
  }));
35
39
  };
40
+ exports.getCFAppChoices = getCFAppChoices;
36
41
  /**
37
42
  * Get the choices for the approuter.
38
43
  *
39
44
  * @param {boolean} isInternalUsage - Whether the user is using internal features.
40
45
  * @returns {Array<{ name: AppRouterType; value: AppRouterType }>} The choices for the approuter.
41
46
  */
42
- export const getAppRouterChoices = (isInternalUsage) => {
47
+ const getAppRouterChoices = (isInternalUsage) => {
43
48
  const options = [
44
49
  {
45
- name: AppRouterType.MANAGED,
46
- value: AppRouterType.MANAGED
50
+ name: adp_tooling_1.AppRouterType.MANAGED,
51
+ value: adp_tooling_1.AppRouterType.MANAGED
47
52
  }
48
53
  ];
49
54
  if (isInternalUsage) {
50
55
  options.push({
51
- name: AppRouterType.STANDALONE,
52
- value: AppRouterType.STANDALONE
56
+ name: adp_tooling_1.AppRouterType.STANDALONE,
57
+ value: adp_tooling_1.AppRouterType.STANDALONE
53
58
  });
54
59
  }
55
60
  return options;
56
61
  };
62
+ exports.getAppRouterChoices = getAppRouterChoices;
57
63
  /**
58
64
  * Creates the list of choices for the project type prompt.
59
65
  *
60
66
  * @returns {{ name: string; value: AdaptationProjectType }[]} The localized project type choices.
61
67
  */
62
- export const getProjectTypeChoices = () => [
63
- { name: t('prompts.projectTypeCloudReadyName'), value: AdaptationProjectType.CLOUD_READY },
64
- { name: t('prompts.projectTypeOnPremName'), value: AdaptationProjectType.ON_PREMISE }
68
+ const getProjectTypeChoices = () => [
69
+ { name: (0, i18n_js_1.t)('prompts.projectTypeCloudReadyName'), value: axios_extension_1.AdaptationProjectType.CLOUD_READY },
70
+ { name: (0, i18n_js_1.t)('prompts.projectTypeOnPremName'), value: axios_extension_1.AdaptationProjectType.ON_PREMISE }
65
71
  ];
72
+ exports.getProjectTypeChoices = getProjectTypeChoices;
66
73
  /**
67
74
  * Returns the choices for the adaptation prompt.
68
75
  *
69
76
  * @param {AdaptationDescriptor[]} adaptations - The adaptations to get the choices for.
70
77
  * @returns {Array<{ name: string; value: AdaptationDescriptor }>} The choices for the adaptation prompt.
71
78
  */
72
- export const getAdaptationChoices = (adaptations) => {
79
+ const getAdaptationChoices = (adaptations) => {
73
80
  return adaptations?.map((adaptation) => ({
74
81
  name: adaptation.title ? `${adaptation.title} (${adaptation.id})` : adaptation.id,
75
82
  value: adaptation
76
83
  }));
77
84
  };
85
+ exports.getAdaptationChoices = getAdaptationChoices;
78
86
  /**
79
87
  * Returns the choices for the system prompt.
80
88
  *
@@ -82,8 +90,8 @@ export const getAdaptationChoices = (adaptations) => {
82
90
  * @param {string} defaultSystem - The default system.
83
91
  * @returns {Array<{ name: string; value: string }>} The choices for the system prompt.
84
92
  */
85
- export const getKeyUserSystemChoices = (systems, defaultSystem) => {
86
- const endpointNames = getEndpointNames(systems);
93
+ const getKeyUserSystemChoices = (systems, defaultSystem) => {
94
+ const endpointNames = (0, adp_tooling_1.getEndpointNames)(systems);
87
95
  return endpointNames.map((name) => {
88
96
  return {
89
97
  name: name === defaultSystem ? `${name} (Source system)` : name,
@@ -91,4 +99,5 @@ export const getKeyUserSystemChoices = (systems, defaultSystem) => {
91
99
  };
92
100
  });
93
101
  };
102
+ exports.getKeyUserSystemChoices = getKeyUserSystemChoices;
94
103
  //# sourceMappingURL=choices.js.map
@@ -1,6 +1,15 @@
1
- import { isAppStudio } from '@sap-ux/btp-utils';
2
- import { AppRouterType } from '@sap-ux/adp-tooling';
3
- import { AdaptationProjectType } from '@sap-ux/axios-extension';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showCredentialQuestion = showCredentialQuestion;
4
+ exports.showApplicationQuestion = showApplicationQuestion;
5
+ exports.showExtensionProjectQuestion = showExtensionProjectQuestion;
6
+ exports.showInternalQuestions = showInternalQuestions;
7
+ exports.showBusinessSolutionNameQuestion = showBusinessSolutionNameQuestion;
8
+ exports.shouldShowBaseAppPrompt = shouldShowBaseAppPrompt;
9
+ exports.showStoreCredentialsQuestion = showStoreCredentialsQuestion;
10
+ const btp_utils_1 = require("@sap-ux/btp-utils");
11
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
12
+ const axios_extension_1 = require("@sap-ux/axios-extension");
4
13
  /**
5
14
  * Determines if a credential question should be shown.
6
15
  * In this simplified approach, we show credentials if a system is provided and the login was not successful.
@@ -9,7 +18,7 @@ import { AdaptationProjectType } from '@sap-ux/axios-extension';
9
18
  * @param {boolean} isAuthRequired - A flag indicating whether system authentication is needed.
10
19
  * @returns {boolean} True if credentials should be requested.
11
20
  */
12
- export function showCredentialQuestion(answers, isAuthRequired) {
21
+ function showCredentialQuestion(answers, isAuthRequired) {
13
22
  return !!answers.system && isAuthRequired;
14
23
  }
15
24
  /**
@@ -21,7 +30,7 @@ export function showCredentialQuestion(answers, isAuthRequired) {
21
30
  * @param {boolean} isLoginSuccessful - A flag indicating that system login was successful.
22
31
  * @returns {boolean} True if the application question should be shown.
23
32
  */
24
- export function showApplicationQuestion(answers, appsLoaded, isAuthRequired, isLoginSuccessful) {
33
+ function showApplicationQuestion(answers, appsLoaded, isAuthRequired, isLoginSuccessful) {
25
34
  return !!answers.system && appsLoaded && (isAuthRequired ? isLoginSuccessful : true);
26
35
  }
27
36
  /**
@@ -35,11 +44,11 @@ export function showApplicationQuestion(answers, appsLoaded, isAuthRequired, isL
35
44
  * @param {FlexUICapability | undefined} params.flexUICapability - The system type info (e.g., onPremise/UIFlex).
36
45
  * @returns {boolean} True if an extension project is allowed, otherwise false or undefined.
37
46
  */
38
- export function showExtensionProjectQuestion({ isApplicationSelected, isApplicationSupported, hasSyncViews, projectType, flexUICapability }) {
39
- if (!isApplicationSelected || projectType === AdaptationProjectType.CLOUD_READY) {
47
+ function showExtensionProjectQuestion({ isApplicationSelected, isApplicationSupported, hasSyncViews, projectType, flexUICapability }) {
48
+ if (!isApplicationSelected || projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY) {
40
49
  return false;
41
50
  }
42
- const isDtaDeploymentSupportedAppStudio = !!flexUICapability?.isDtaFolderDeploymentSupported && isAppStudio();
51
+ const isDtaDeploymentSupportedAppStudio = !!flexUICapability?.isDtaFolderDeploymentSupported && (0, btp_utils_1.isAppStudio)();
43
52
  const nonFlexOrNonOnPremise = flexUICapability && (!flexUICapability?.isDtaFolderDeploymentSupported || !flexUICapability?.isUIFlexSupported);
44
53
  return (isDtaDeploymentSupportedAppStudio &&
45
54
  (!isApplicationSupported || (isApplicationSupported && (nonFlexOrNonOnPremise || hasSyncViews))));
@@ -52,7 +61,7 @@ export function showExtensionProjectQuestion({ isApplicationSelected, isApplicat
52
61
  * @param {boolean} isApplicationSupported - Whether the selected application is supported.
53
62
  * @returns {boolean | undefined} True if an internal question for ACH and FioriId question will be shown, otherwise false.
54
63
  */
55
- export function showInternalQuestions(answers, isCustomerBase, isApplicationSupported) {
64
+ function showInternalQuestions(answers, isCustomerBase, isApplicationSupported) {
56
65
  return !!answers.system && answers.application && !isCustomerBase && isApplicationSupported;
57
66
  }
58
67
  /**
@@ -64,8 +73,8 @@ export function showInternalQuestions(answers, isCustomerBase, isApplicationSupp
64
73
  * @param {string} businessService - The business service to be used.
65
74
  * @returns {boolean} True if the business solution name question should be shown, otherwise false.
66
75
  */
67
- export function showBusinessSolutionNameQuestion(answers, isCFLoggedIn, showSolutionNamePrompt, businessService) {
68
- return isCFLoggedIn && answers.approuter === AppRouterType.MANAGED && showSolutionNamePrompt && !!businessService;
76
+ function showBusinessSolutionNameQuestion(answers, isCFLoggedIn, showSolutionNamePrompt, businessService) {
77
+ return isCFLoggedIn && answers.approuter === adp_tooling_1.AppRouterType.MANAGED && showSolutionNamePrompt && !!businessService;
69
78
  }
70
79
  /**
71
80
  * Determines if the base app prompt should be shown.
@@ -75,7 +84,7 @@ export function showBusinessSolutionNameQuestion(answers, isCFLoggedIn, showSolu
75
84
  * @param {CFApp[]} apps - The base apps available.
76
85
  * @returns {boolean} True if the base app prompt should be shown, otherwise false.
77
86
  */
78
- export function shouldShowBaseAppPrompt(answers, isCFLoggedIn, apps) {
87
+ function shouldShowBaseAppPrompt(answers, isCFLoggedIn, apps) {
79
88
  return isCFLoggedIn && !!answers.businessService && !!apps.length;
80
89
  }
81
90
  /**
@@ -86,7 +95,7 @@ export function shouldShowBaseAppPrompt(answers, isCFLoggedIn, apps) {
86
95
  * @param {boolean} isAuthRequired - A flag indicating whether system authentication is needed.
87
96
  * @returns {boolean} True if the store credentials question should be shown.
88
97
  */
89
- export function showStoreCredentialsQuestion(answers, isLoginSuccessful, isAuthRequired) {
90
- return !isAppStudio() && showCredentialQuestion(answers, isAuthRequired) && isLoginSuccessful && !!answers.password;
98
+ function showStoreCredentialsQuestion(answers, isLoginSuccessful, isAuthRequired) {
99
+ return !(0, btp_utils_1.isAppStudio)() && showCredentialQuestion(answers, isAuthRequired) && isLoginSuccessful && !!answers.password;
91
100
  }
92
101
  //# sourceMappingURL=conditions.js.map
@@ -1,6 +1,11 @@
1
- import { join } from 'node:path';
2
- import { existsSync } from 'node:fs';
3
- import { validateUI5VersionExists } from '@sap-ux/adp-tooling';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultNamespace = getDefaultNamespace;
4
+ exports.getDefaultProjectName = getDefaultProjectName;
5
+ exports.getDefaultVersion = getDefaultVersion;
6
+ const node_path_1 = require("node:path");
7
+ const node_fs_1 = require("node:fs");
8
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
4
9
  const DEFAULT_PREFIX = 'app.variant';
5
10
  /**
6
11
  * Generates a namespace for a project based on its layer.
@@ -9,7 +14,7 @@ const DEFAULT_PREFIX = 'app.variant';
9
14
  * @param {FlexLayer} isCustomerBase - Indicates the deployment layer (e.g., CUSTOMER_BASE).
10
15
  * @returns {string} The namespace string, prefixed appropriately if it's a customer base project.
11
16
  */
12
- export function getDefaultNamespace(projectName, isCustomerBase) {
17
+ function getDefaultNamespace(projectName, isCustomerBase) {
13
18
  return isCustomerBase ? `customer.${projectName}` : projectName;
14
19
  }
15
20
  /**
@@ -19,10 +24,10 @@ export function getDefaultNamespace(projectName, isCustomerBase) {
19
24
  * @param {string} dirName - Directory name to search for.
20
25
  * @returns {string} A default project name with an incremented index if similar projects exist.
21
26
  */
22
- export function getDefaultProjectName(basePath, dirName = DEFAULT_PREFIX) {
27
+ function getDefaultProjectName(basePath, dirName = DEFAULT_PREFIX) {
23
28
  let newDir = dirName;
24
29
  let index = 1;
25
- while (existsSync(join(basePath, newDir))) {
30
+ while ((0, node_fs_1.existsSync)((0, node_path_1.join)(basePath, newDir))) {
26
31
  index++;
27
32
  newDir = `${dirName}${index}`;
28
33
  }
@@ -35,11 +40,11 @@ export function getDefaultProjectName(basePath, dirName = DEFAULT_PREFIX) {
35
40
  * @param {string[]} ui5Versions Array of available versions.
36
41
  * @returns {Promise<string>} The valid UI5 version or an empty string if the first version is not valid or if there are no versions.
37
42
  */
38
- export async function getDefaultVersion(ui5Versions) {
43
+ async function getDefaultVersion(ui5Versions) {
39
44
  if (ui5Versions?.length === 0) {
40
45
  return '';
41
46
  }
42
- const isValid = await validateUI5VersionExists(ui5Versions[0]);
47
+ const isValid = await (0, adp_tooling_1.validateUI5VersionExists)(ui5Versions[0]);
43
48
  return isValid === true ? ui5Versions[0] : '';
44
49
  }
45
50
  //# sourceMappingURL=default-values.js.map
@@ -1,5 +1,8 @@
1
- import { isAppStudio } from '@sap-ux/btp-utils';
2
- import { t } from '../../../utils/i18n.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExtProjectMessage = void 0;
4
+ const btp_utils_1 = require("@sap-ux/btp-utils");
5
+ const i18n_js_1 = require("../../../utils/i18n.js");
3
6
  /**
4
7
  * Creates a message for extension project prompt based on the provided parameters.
5
8
  *
@@ -8,12 +11,13 @@ import { t } from '../../../utils/i18n.js';
8
11
  * @param {string} [errorMessage] - Optional validation error message (only used in BAS).
9
12
  * @returns {string} A message for confirm extension project prompt.
10
13
  */
11
- export const getExtProjectMessage = (isApplicationSupported, hasSyncViews, errorMessage) => {
12
- if (isAppStudio() && errorMessage) {
13
- return `${errorMessage} ${t('prompts.extProjectSuggestion')}`;
14
+ const getExtProjectMessage = (isApplicationSupported, hasSyncViews, errorMessage) => {
15
+ if ((0, btp_utils_1.isAppStudio)() && errorMessage) {
16
+ return `${errorMessage} ${(0, i18n_js_1.t)('prompts.extProjectSuggestion')}`;
14
17
  }
15
18
  return isApplicationSupported && hasSyncViews
16
- ? t('prompts.createExtProjectWithSyncViewsLabel')
17
- : t('prompts.createExtProjectLabel');
19
+ ? (0, i18n_js_1.t)('prompts.createExtProjectWithSyncViewsLabel')
20
+ : (0, i18n_js_1.t)('prompts.createExtProjectLabel');
18
21
  };
22
+ exports.getExtProjectMessage = getExtProjectMessage;
19
23
  //# sourceMappingURL=message.js.map
@@ -1,14 +1,17 @@
1
- import { t } from '../../../utils/i18n.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProjectNameTooltip = getProjectNameTooltip;
4
+ const i18n_js_1 = require("../../../utils/i18n.js");
2
5
  /**
3
6
  * Returns a tooltip message for project name input fields, customized based on the project's user layer.
4
7
  *
5
8
  * @param {boolean} isCustomerBase - Determines if the tooltip is for a customer base project.
6
9
  * @returns {string} A tooltip message with specific validation rules.
7
10
  */
8
- export function getProjectNameTooltip(isCustomerBase) {
11
+ function getProjectNameTooltip(isCustomerBase) {
9
12
  const baseType = isCustomerBase ? 'Ext' : 'Int';
10
- const lengthErrorMsg = t(`prompts.projectNameLengthError${baseType}`);
11
- const validationErrorMsg = t(`prompts.projectNameValidationError${baseType}`);
13
+ const lengthErrorMsg = (0, i18n_js_1.t)(`prompts.projectNameLengthError${baseType}`);
14
+ const validationErrorMsg = (0, i18n_js_1.t)(`prompts.projectNameValidationError${baseType}`);
12
15
  return `${lengthErrorMsg} ${validationErrorMsg}`;
13
16
  }
14
17
  //# sourceMappingURL=tooltip.js.map
@@ -1,8 +1,18 @@
1
- import fs from 'node:fs';
2
- import { getMtaServices, isMtaProject } from '@sap-ux/adp-tooling';
3
- import { validateEmptyString, validateNamespaceAdp, validateProjectName } from '@sap-ux/project-input-validator';
4
- import { t } from '../../../utils/i18n.js';
5
- import { isString } from '../../../utils/type-guards.js';
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateExtensibilityExtension = validateExtensibilityExtension;
7
+ exports.validateJsonInput = validateJsonInput;
8
+ exports.validateEnvironment = validateEnvironment;
9
+ exports.validateProjectPath = validateProjectPath;
10
+ exports.validateBusinessSolutionName = validateBusinessSolutionName;
11
+ const node_fs_1 = __importDefault(require("node:fs"));
12
+ const adp_tooling_1 = require("@sap-ux/adp-tooling");
13
+ const project_input_validator_1 = require("@sap-ux/project-input-validator");
14
+ const i18n_js_1 = require("../../../utils/i18n.js");
15
+ const type_guards_js_1 = require("../../../utils/type-guards.js");
6
16
  /**
7
17
  * Validates whether the extensibility extension is available. If the extension is not found,
8
18
  * an error message is returned advising on the necessary action.
@@ -14,14 +24,14 @@ import { isString } from '../../../utils/type-guards.js';
14
24
  * @param {boolean} params.isExtensibilityExtInstalled - Whether the extensibility extension is installed.
15
25
  * @returns {boolean | string} Returns true if app is supported and contains sync views, or an error message if not.
16
26
  */
17
- export function validateExtensibilityExtension({ value, isApplicationSupported, hasSyncViews, isExtensibilityExtInstalled }) {
27
+ function validateExtensibilityExtension({ value, isApplicationSupported, hasSyncViews, isExtensibilityExtInstalled }) {
18
28
  if (value) {
19
29
  if (!isExtensibilityExtInstalled) {
20
- return t('error.extensibilityExtensionNotFound');
30
+ return (0, i18n_js_1.t)('error.extensibilityExtensionNotFound');
21
31
  }
22
32
  return true;
23
33
  }
24
- return isApplicationSupported && hasSyncViews ? true : t('prompts.createExtProjectContinueLabel');
34
+ return isApplicationSupported && hasSyncViews ? true : (0, i18n_js_1.t)('prompts.createExtProjectContinueLabel');
25
35
  }
26
36
  /**
27
37
  * Validates the input parameters for an adaptation project configuration.
@@ -39,18 +49,18 @@ export function validateExtensibilityExtension({ value, isApplicationSupported,
39
49
  * - If the system cannot be resolved.
40
50
  * @returns {Promise<void>} Resolves if all validations pass, otherwise throws an error.
41
51
  */
42
- export async function validateJsonInput(systemLookup, isCustomerBase, { projectName, targetFolder, namespace, system }) {
43
- let validationResult = validateProjectName(projectName, targetFolder, isCustomerBase, false);
44
- if (isString(validationResult)) {
52
+ async function validateJsonInput(systemLookup, isCustomerBase, { projectName, targetFolder, namespace, system }) {
53
+ let validationResult = (0, project_input_validator_1.validateProjectName)(projectName, targetFolder, isCustomerBase, false);
54
+ if ((0, type_guards_js_1.isString)(validationResult)) {
45
55
  throw new Error(validationResult);
46
56
  }
47
- validationResult = validateNamespaceAdp(namespace, projectName, isCustomerBase);
48
- if (isString(validationResult)) {
57
+ validationResult = (0, project_input_validator_1.validateNamespaceAdp)(namespace, projectName, isCustomerBase);
58
+ if ((0, type_guards_js_1.isString)(validationResult)) {
49
59
  throw new Error(validationResult);
50
60
  }
51
61
  const systemEndpoint = await systemLookup.getSystemByName(system);
52
62
  if (!systemEndpoint) {
53
- throw new Error(t('error.systemNotFound', { system }));
63
+ throw new Error((0, i18n_js_1.t)('error.systemNotFound', { system }));
54
64
  }
55
65
  }
56
66
  /**
@@ -61,12 +71,12 @@ export async function validateJsonInput(systemLookup, isCustomerBase, { projectN
61
71
  * @param {CfConfig} cfConfig - The CF configuration.
62
72
  * @returns {Promise<string | boolean>} Returns true if the environment is valid, otherwise returns an error message.
63
73
  */
64
- export async function validateEnvironment(value, isCFLoggedIn, cfConfig) {
74
+ async function validateEnvironment(value, isCFLoggedIn, cfConfig) {
65
75
  if (value === 'CF' && !isCFLoggedIn) {
66
- return t('error.cfNotLoggedIn');
76
+ return (0, i18n_js_1.t)('error.cfNotLoggedIn');
67
77
  }
68
78
  if (value === 'CF' && isCFLoggedIn && (!cfConfig?.org?.Name || !cfConfig?.space?.Name)) {
69
- return t('error.cfOrgSpaceMissing');
79
+ return (0, i18n_js_1.t)('error.cfOrgSpaceMissing');
70
80
  }
71
81
  return true;
72
82
  }
@@ -77,26 +87,26 @@ export async function validateEnvironment(value, isCFLoggedIn, cfConfig) {
77
87
  * @param {ToolsLogger} logger - The logger.
78
88
  * @returns {Promise<string | boolean>} Returns true if the project path is valid, otherwise returns an error message.
79
89
  */
80
- export async function validateProjectPath(projectPath, logger) {
81
- const validationResult = validateEmptyString(projectPath);
90
+ async function validateProjectPath(projectPath, logger) {
91
+ const validationResult = (0, project_input_validator_1.validateEmptyString)(projectPath);
82
92
  if (typeof validationResult === 'string') {
83
93
  return validationResult;
84
94
  }
85
- if (!fs.existsSync(projectPath)) {
86
- return t('error.projectDoesNotExist');
95
+ if (!node_fs_1.default.existsSync(projectPath)) {
96
+ return (0, i18n_js_1.t)('error.projectDoesNotExist');
87
97
  }
88
- if (!isMtaProject(projectPath)) {
89
- return t('error.projectDoesNotExistMta');
98
+ if (!(0, adp_tooling_1.isMtaProject)(projectPath)) {
99
+ return (0, i18n_js_1.t)('error.projectDoesNotExistMta');
90
100
  }
91
101
  try {
92
- const services = await getMtaServices(projectPath, logger);
102
+ const services = await (0, adp_tooling_1.getMtaServices)(projectPath, logger);
93
103
  if (services.length < 1) {
94
- return t('error.noAdaptableBusinessServiceFoundInMta');
104
+ return (0, i18n_js_1.t)('error.noAdaptableBusinessServiceFoundInMta');
95
105
  }
96
106
  }
97
107
  catch (e) {
98
108
  logger?.error(`Failed to get MTA services: ${e.message}`);
99
- return t('error.noAdaptableBusinessServiceFoundInMta');
109
+ return (0, i18n_js_1.t)('error.noAdaptableBusinessServiceFoundInMta');
100
110
  }
101
111
  return true;
102
112
  }
@@ -106,14 +116,14 @@ export async function validateProjectPath(projectPath, logger) {
106
116
  * @param {string} value - Value to validate.
107
117
  * @returns {string | boolean} Validation result.
108
118
  */
109
- export function validateBusinessSolutionName(value) {
110
- const validationResult = validateEmptyString(value);
119
+ function validateBusinessSolutionName(value) {
120
+ const validationResult = (0, project_input_validator_1.validateEmptyString)(value);
111
121
  if (typeof validationResult === 'string') {
112
122
  return validationResult;
113
123
  }
114
124
  if (/^[a-z0-9][a-z0-9._-]*$/.test(value)) {
115
125
  return true;
116
126
  }
117
- return t('error.businessSolutionNameInvalid');
127
+ return (0, i18n_js_1.t)('error.businessSolutionNameInvalid');
118
128
  }
119
129
  //# sourceMappingURL=validators.js.map