@sap-ux/generator-adp 0.10.12 → 1.0.0

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