@sap-ux/adp-tooling 0.13.28 → 0.13.30

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.
@@ -68,7 +68,11 @@
68
68
  "errorInputInvalidValuePrefix": "{{value}} should start with '{{prefix}}'",
69
69
  "errorCustomerEmptyValue": "{{value}} should contain at least one character in addition to '{{prefix}}'",
70
70
  "errorInvalidDataSourceURI": "Invalid URI. The URI must start and end with '/' and contain no spaces.",
71
- "appDoesNotSupportManifest": "The selected application is not supported by the adaptation project. Select a different application. For more information, see SAPUI5 Adaptation Project documentation."
71
+ "appDoesNotSupportManifest": "The selected application is not supported by the adaptation project. Please select a different application. For more information, see SAPUI5 Adaptation Project documentation.",
72
+ "ui5VersionNotReachableError": "The URL of the SAPUI5 version you have selected is not reachable. The URL <URL> should be made accessible through cloud connector and the destination configuration so it can be consumed within the SAPUI5 adaptation project and its SAPUI5 Adaptation Editor.",
73
+ "ui5VersionOutdatedError": "The SAPUI5 version you have selected is not compatible with the SAPUI5 Adaptation Editor. Please select a different version.",
74
+ "ui5VersionDoesNotExistGeneric": "An error occurred when validating the SAPUI5 version: {{error}}. Please select a different version.",
75
+ "ui5VersionNotDetectedError": "The SAPUI5 version of the selected system could not be determined. You will be able to create and edit adaptation projects using the newest version but it will not be usable on this system until the system`s SAPUI5 version is upgraded to version 1.71 or above."
72
76
  },
73
77
  "choices": {
74
78
  "true": "true",
package/dist/types.d.ts CHANGED
@@ -92,6 +92,14 @@ export interface ConfigAnswers {
92
92
  password: string;
93
93
  application: SourceApplication;
94
94
  }
95
+ export interface AttributesAnswers {
96
+ projectName: string;
97
+ title: string;
98
+ namespace: string;
99
+ targetFolder: string;
100
+ ui5Version: string;
101
+ enableTypeScript: boolean;
102
+ }
95
103
  export interface SourceApplication {
96
104
  id: string;
97
105
  title: string;
@@ -1,4 +1,5 @@
1
1
  export * from './version-info';
2
2
  export * from './format';
3
3
  export * from './fetch';
4
+ export * from './validator';
4
5
  //# sourceMappingURL=index.d.ts.map
package/dist/ui5/index.js CHANGED
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./version-info"), exports);
18
18
  __exportStar(require("./format"), exports);
19
19
  __exportStar(require("./fetch"), exports);
20
+ __exportStar(require("./validator"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Validates a specified UI5 version by checking its availability on the SAP CDN.
3
+ *
4
+ * @param {string} [version] - The version to validate.
5
+ * @returns {Promise<string | boolean>} True if the version is valid, a string message if not, or if an error occurs.
6
+ */
7
+ export declare function validateUI5VersionExists(version: string): Promise<string | boolean>;
8
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateUI5VersionExists = validateUI5VersionExists;
4
+ const project_input_validator_1 = require("@sap-ux/project-input-validator");
5
+ const i18n_1 = require("../i18n");
6
+ const format_1 = require("./format");
7
+ /**
8
+ * Validates a specified UI5 version by checking its availability on the SAP CDN.
9
+ *
10
+ * @param {string} [version] - The version to validate.
11
+ * @returns {Promise<string | boolean>} True if the version is valid, a string message if not, or if an error occurs.
12
+ */
13
+ async function validateUI5VersionExists(version) {
14
+ const validationResult = (0, project_input_validator_1.validateEmptyString)(version);
15
+ if (typeof validationResult === 'string') {
16
+ return validationResult;
17
+ }
18
+ const selectedVersionURL = (0, format_1.getOfficialBaseUI5VersionUrl)(version);
19
+ const resource = version.includes('snapshot') ? 'neo-app.json' : (0, format_1.getFormattedVersion)(version);
20
+ try {
21
+ await fetch(`${selectedVersionURL}/${resource}`);
22
+ return true;
23
+ }
24
+ catch (e) {
25
+ if (version.includes('snapshot')) {
26
+ const message = (0, i18n_1.t)('validators.ui5VersionNotReachableError');
27
+ return `${message.replace('<URL>', selectedVersionURL)}`;
28
+ }
29
+ if (e.response.status === 400 || e.response.status === 404) {
30
+ return (0, i18n_1.t)('validators.ui5VersionOutdatedError');
31
+ }
32
+ return (0, i18n_1.t)('validators.ui5VersionDoesNotExistGeneric', { error: e.message });
33
+ }
34
+ }
35
+ //# sourceMappingURL=validator.js.map
@@ -1,106 +1,73 @@
1
- import { FlexLayer } from '../types';
2
1
  import type { UI5Version } from '../types';
2
+ export interface VersionLabels {
3
+ formattedVersion: string;
4
+ systemSnapshotLabel: string;
5
+ systemLatestLabel: string;
6
+ }
3
7
  /**
4
- * Service class for handling SAP UI5 version information.
5
- * This class provides methods to fetch and validate UI5 versions, retrieve public and internal versions,
6
- * and format or modify version strings as per specific requirements like snapshots.
8
+ * Returns the latest version string from the fetched public versions.
7
9
  *
8
- * @class UI5VersionInfo
10
+ * @param {UI5Version} publicVersions - The public UI5 version data fetched from the CDN.
11
+ * @returns {string} The latest version string.
9
12
  */
10
- export declare class UI5VersionInfo {
11
- /** Singleton instance */
12
- private static instance;
13
- /** Public UI5 version data fetched from CDN */
14
- private publicVersions;
15
- /** All available internal UI5 versions (fetched once and cached) */
16
- private releasedVersions;
17
- /** Indicates if a valid UI5 version was detected on the system */
18
- isVersionDetected: boolean;
19
- /** System-detected UI5 version */
20
- systemVersion?: string;
21
- /** Whether the project is CUSTOMER_BASE layer */
22
- private readonly isCustomerBase;
23
- /**
24
- * Private constructor to enforce singleton pattern.
25
- *
26
- * @param {FlexLayer} layer - Flex layer (used once to configure instance).
27
- */
28
- private constructor();
29
- /**
30
- * Returns the singleton instance of UI5VersionManager.
31
- *
32
- * @param {FlexLayer} layer - Used only during first initialization.
33
- * @returns {UI5VersionManager} Instance.
34
- */
35
- static getInstance(layer: FlexLayer): UI5VersionInfo;
36
- /**
37
- * Retrieves the latest version from the available public versions.
38
- *
39
- * @returns The latest available version.
40
- */
41
- getLatestVersion(): string;
42
- /**
43
- * Fetches public versions from the UI5 CDN.
44
- *
45
- * @returns {Promise<UI5Version>} An object containing version details fetched from the UI5 CDN.
46
- */
47
- getPublicVersions(): Promise<UI5Version>;
48
- /**
49
- * Retrieves and filters internal UI5 versions.
50
- *
51
- * If the versions have not been cached, it calls fetchInternalVersions() to retrieve and cache them.
52
- * It then filters the versions based on the minimum supported version.
53
- *
54
- * @param {string} latestVersion - The latest available version.
55
- * @returns {Promise<string[]>} A promise that resolves to an array of supported internal UI5 version strings.
56
- */
57
- private getInternalVersions;
58
- /**
59
- * Determines the appropriate UI5 version to use based on the provided version string and customer base status.
60
- * This function handles scenarios where a 'snapshot' version might be in use while in external mode,
61
- * or when the environment specifically requires using the latest public version, such as for S4HANA Cloud.
62
- *
63
- * @param {string} version - The current version string, which may include qualifiers like 'snapshot'.
64
- * @param {boolean} isCustomerBase - Flag indicating whether the current mode is based on a customer base.
65
- * @returns {string} The version string to be used.
66
- * @example
67
- * // returns '1.80.2'
68
- * getVersionToBeUsed('1.80.2', false);
69
- * @example
70
- * // returns 'latestVersion' property value from class if 'version' contains 'snapshot'
71
- * getVersionToBeUsed('1.84.6 snapshot', true);
72
- */
73
- getVersionToBeUsed(version: string, isCustomerBase: boolean): string;
74
- /**
75
- * Computes version labels based on the provided version.
76
- *
77
- * @param {string} version - The original version string.
78
- * @returns {VersionLabels} An object with the formatted version, snapshot label, and latest label.
79
- */
80
- private getVersionLabels;
81
- /**
82
- * Determines if the provided version follows the standard version format.
83
- *
84
- * @param {string | undefined} version - The version string to be checked.
85
- * @returns {string | undefined} A system version or undefined.
86
- */
87
- private checkSystemVersionPattern;
88
- /**
89
- * Gets versions relevant based on the system or user type.
90
- * For internal users, all available versions are returned.
91
- * For external users, only versions higher than the current system version are shown.
92
- *
93
- * @param {string} [systemVersion] - The current system version.
94
- * @returns {Promise<string[]>} An array of relevant version strings.
95
- * If the version is not detected, returns the latest released version.
96
- */
97
- getRelevantVersions(systemVersion?: string): Promise<string[]>;
98
- /**
99
- * Fetches versions that are higher than a specified version.
100
- *
101
- * @param {string} version - The baseline version to compare against.
102
- * @returns {Promise<string[]>} An array of versions higher than the specified version.
103
- */
104
- private getHigherVersions;
105
- }
13
+ export declare function getLatestVersion(publicVersions: UI5Version): string;
14
+ /**
15
+ * Determines the appropriate UI5 version to use based on the given version string and the customer base flag.
16
+ *
17
+ * @param {string} version - The current version string, which may include qualifiers like 'snapshot'.
18
+ * @param {boolean} isCustomerBase - Indicates whether the current mode is based on a customer base.
19
+ * @param {UI5Version} publicVersions - The public UI5 version data.
20
+ * @returns {string} The version string to be used.
21
+ */
22
+ export declare function getVersionToBeUsed(version: string, isCustomerBase: boolean, publicVersions: UI5Version): string;
23
+ /**
24
+ * Computes version labels based on the provided version string.
25
+ *
26
+ * @param {string} version - The original version string.
27
+ * @param {UI5Version} publicVersions - The public UI5 version data.
28
+ * @returns {VersionLabels} An object containing:
29
+ * - formattedVersion: the version with any timestamp removed,
30
+ * - systemSnapshotLabel: the snapshot label (if applicable),
31
+ * - systemLatestLabel: a label if the version equals the latest version.
32
+ */
33
+ export declare function getVersionLabels(version: string | undefined, publicVersions: UI5Version): VersionLabels;
34
+ /**
35
+ * Checks whether the provided version string follows the expected format.
36
+ *
37
+ * @param version - The version string to be checked.
38
+ * @returns The version string if it matches the standard format, or undefined otherwise.
39
+ */
40
+ export declare function checkSystemVersionPattern(version: string | undefined): string | undefined;
41
+ /**
42
+ * Retrieves and filters internal UI5 versions.
43
+ *
44
+ * This function fetches internal versions using the provided latest version
45
+ * and then filters them based on a minimum supported version (in this case '1.71.0').
46
+ *
47
+ * @param {string} latestVersion - The latest public version string.
48
+ * @returns {Promise<string[]>} A promise that resolves to an array of internal version strings.
49
+ */
50
+ export declare function getInternalVersions(latestVersion: string): Promise<string[]>;
51
+ /**
52
+ * Fetches versions that are higher than the specified version.
53
+ *
54
+ * @param {string} version - The baseline version to compare against.
55
+ * @param {UI5Version} publicVersions - The public UI5 version data.
56
+ * @returns {Promise<string[]>} A promise that resolves to an array of versions higher than the specified version.
57
+ */
58
+ export declare function getHigherVersions(version: string, publicVersions: UI5Version): Promise<string[]>;
59
+ /**
60
+ * Gets relevant UI5 versions based on the system version and customer base flag.
61
+ *
62
+ * For external users (non-customer base), this function fetches internal versions,
63
+ * adjusts them based on snapshot labels, and adds standard snapshot constants.
64
+ * For customer base users, if there’s no snapshot label, it returns only higher versions.
65
+ * Otherwise, it returns the latest public version.
66
+ *
67
+ * @param {string | undefined} systemVersion - The current system version (can be undefined).
68
+ * @param {boolean} isCustomerBase - Indicates if the project is customer based.
69
+ * @param {UI5Version} publicVersions - The public UI5 version data.
70
+ * @returns {Promise<string[]>} A promise that resolves to an array of relevant version strings.
71
+ */
72
+ export declare function getRelevantVersions(systemVersion: string | undefined, isCustomerBase: boolean, publicVersions: UI5Version): Promise<string[]>;
106
73
  //# sourceMappingURL=version-info.d.ts.map
@@ -1,193 +1,138 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UI5VersionInfo = void 0;
3
+ exports.getLatestVersion = getLatestVersion;
4
+ exports.getVersionToBeUsed = getVersionToBeUsed;
5
+ exports.getVersionLabels = getVersionLabels;
6
+ exports.checkSystemVersionPattern = checkSystemVersionPattern;
7
+ exports.getInternalVersions = getInternalVersions;
8
+ exports.getHigherVersions = getHigherVersions;
9
+ exports.getRelevantVersions = getRelevantVersions;
4
10
  const fetch_1 = require("./fetch");
5
11
  const format_1 = require("./format");
6
12
  const constants_1 = require("../base/constants");
7
13
  /**
8
- * Service class for handling SAP UI5 version information.
9
- * This class provides methods to fetch and validate UI5 versions, retrieve public and internal versions,
10
- * and format or modify version strings as per specific requirements like snapshots.
14
+ * Returns the latest version string from the fetched public versions.
11
15
  *
12
- * @class UI5VersionInfo
16
+ * @param {UI5Version} publicVersions - The public UI5 version data fetched from the CDN.
17
+ * @returns {string} The latest version string.
13
18
  */
14
- class UI5VersionInfo {
15
- /** Singleton instance */
16
- static instance;
17
- /** Public UI5 version data fetched from CDN */
18
- publicVersions;
19
- /** All available internal UI5 versions (fetched once and cached) */
20
- releasedVersions;
21
- /** Indicates if a valid UI5 version was detected on the system */
22
- isVersionDetected;
23
- /** System-detected UI5 version */
24
- systemVersion;
25
- /** Whether the project is CUSTOMER_BASE layer */
26
- isCustomerBase;
27
- /**
28
- * Private constructor to enforce singleton pattern.
29
- *
30
- * @param {FlexLayer} layer - Flex layer (used once to configure instance).
31
- */
32
- constructor(layer) {
33
- this.isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
34
- }
35
- /**
36
- * Returns the singleton instance of UI5VersionManager.
37
- *
38
- * @param {FlexLayer} layer - Used only during first initialization.
39
- * @returns {UI5VersionManager} Instance.
40
- */
41
- static getInstance(layer) {
42
- if (!UI5VersionInfo.instance) {
43
- UI5VersionInfo.instance = new UI5VersionInfo(layer);
44
- }
45
- return UI5VersionInfo.instance;
46
- }
47
- /**
48
- * Retrieves the latest version from the available public versions.
49
- *
50
- * @returns The latest available version.
51
- */
52
- getLatestVersion() {
53
- return this.publicVersions?.latest?.version;
54
- }
55
- /**
56
- * Fetches public versions from the UI5 CDN.
57
- *
58
- * @returns {Promise<UI5Version>} An object containing version details fetched from the UI5 CDN.
59
- */
60
- async getPublicVersions() {
61
- if (!this.publicVersions) {
62
- this.publicVersions = await (0, fetch_1.fetchPublicVersions)();
63
- }
64
- return this.publicVersions;
65
- }
66
- /**
67
- * Retrieves and filters internal UI5 versions.
68
- *
69
- * If the versions have not been cached, it calls fetchInternalVersions() to retrieve and cache them.
70
- * It then filters the versions based on the minimum supported version.
71
- *
72
- * @param {string} latestVersion - The latest available version.
73
- * @returns {Promise<string[]>} A promise that resolves to an array of supported internal UI5 version strings.
74
- */
75
- async getInternalVersions(latestVersion) {
76
- if (!this.releasedVersions) {
77
- this.releasedVersions = await (0, fetch_1.fetchInternalVersions)(latestVersion);
78
- }
79
- return this.releasedVersions.filter(format_1.isFeatureSupportedVersion.bind(this, '1.71.0'));
80
- }
81
- /**
82
- * Determines the appropriate UI5 version to use based on the provided version string and customer base status.
83
- * This function handles scenarios where a 'snapshot' version might be in use while in external mode,
84
- * or when the environment specifically requires using the latest public version, such as for S4HANA Cloud.
85
- *
86
- * @param {string} version - The current version string, which may include qualifiers like 'snapshot'.
87
- * @param {boolean} isCustomerBase - Flag indicating whether the current mode is based on a customer base.
88
- * @returns {string} The version string to be used.
89
- * @example
90
- * // returns '1.80.2'
91
- * getVersionToBeUsed('1.80.2', false);
92
- * @example
93
- * // returns 'latestVersion' property value from class if 'version' contains 'snapshot'
94
- * getVersionToBeUsed('1.84.6 snapshot', true);
95
- */
96
- getVersionToBeUsed(version, isCustomerBase) {
97
- if (!version || (isCustomerBase && version.includes('snapshot'))) {
98
- return this.getLatestVersion();
99
- }
100
- return version;
19
+ function getLatestVersion(publicVersions) {
20
+ return publicVersions?.latest?.version;
21
+ }
22
+ /**
23
+ * Determines the appropriate UI5 version to use based on the given version string and the customer base flag.
24
+ *
25
+ * @param {string} version - The current version string, which may include qualifiers like 'snapshot'.
26
+ * @param {boolean} isCustomerBase - Indicates whether the current mode is based on a customer base.
27
+ * @param {UI5Version} publicVersions - The public UI5 version data.
28
+ * @returns {string} The version string to be used.
29
+ */
30
+ function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
31
+ if (!version || (isCustomerBase && version.includes('snapshot'))) {
32
+ return getLatestVersion(publicVersions);
101
33
  }
102
- /**
103
- * Computes version labels based on the provided version.
104
- *
105
- * @param {string} version - The original version string.
106
- * @returns {VersionLabels} An object with the formatted version, snapshot label, and latest label.
107
- */
108
- getVersionLabels(version) {
109
- let formattedVersion = '';
110
- let systemSnapshotLabel = '';
111
- let systemLatestLabel = '';
112
- if (version) {
113
- const latestVersion = this.getLatestVersion();
114
- formattedVersion = (0, format_1.removeTimestampFromVersion)(version);
115
- this.systemVersion = formattedVersion;
116
- systemSnapshotLabel = (0, format_1.addSnapshot)(version, latestVersion);
117
- systemLatestLabel = formattedVersion === latestVersion ? constants_1.LATEST_VERSION : '';
118
- }
119
- return { formattedVersion, systemSnapshotLabel, systemLatestLabel };
34
+ return version;
35
+ }
36
+ /**
37
+ * Computes version labels based on the provided version string.
38
+ *
39
+ * @param {string} version - The original version string.
40
+ * @param {UI5Version} publicVersions - The public UI5 version data.
41
+ * @returns {VersionLabels} An object containing:
42
+ * - formattedVersion: the version with any timestamp removed,
43
+ * - systemSnapshotLabel: the snapshot label (if applicable),
44
+ * - systemLatestLabel: a label if the version equals the latest version.
45
+ */
46
+ function getVersionLabels(version, publicVersions) {
47
+ let formattedVersion = '';
48
+ let systemSnapshotLabel = '';
49
+ let systemLatestLabel = '';
50
+ if (version) {
51
+ const latestVersion = getLatestVersion(publicVersions);
52
+ formattedVersion = (0, format_1.removeTimestampFromVersion)(version);
53
+ systemSnapshotLabel = (0, format_1.addSnapshot)(version, latestVersion);
54
+ systemLatestLabel = formattedVersion === latestVersion ? constants_1.LATEST_VERSION : '';
120
55
  }
121
- /**
122
- * Determines if the provided version follows the standard version format.
123
- *
124
- * @param {string | undefined} version - The version string to be checked.
125
- * @returns {string | undefined} A system version or undefined.
126
- */
127
- checkSystemVersionPattern(version) {
128
- const pattern = /^[1-9]\.\d{1,3}\.\d{1,2}\.*/;
56
+ return { formattedVersion, systemSnapshotLabel, systemLatestLabel };
57
+ }
58
+ /**
59
+ * Checks whether the provided version string follows the expected format.
60
+ *
61
+ * @param version - The version string to be checked.
62
+ * @returns The version string if it matches the standard format, or undefined otherwise.
63
+ */
64
+ function checkSystemVersionPattern(version) {
65
+ const pattern = /^[1-9]\.\d{1,3}\.\d{1,2}\.*/;
66
+ return version && pattern.test(version) ? version : undefined;
67
+ }
68
+ /**
69
+ * Retrieves and filters internal UI5 versions.
70
+ *
71
+ * This function fetches internal versions using the provided latest version
72
+ * and then filters them based on a minimum supported version (in this case '1.71.0').
73
+ *
74
+ * @param {string} latestVersion - The latest public version string.
75
+ * @returns {Promise<string[]>} A promise that resolves to an array of internal version strings.
76
+ */
77
+ async function getInternalVersions(latestVersion) {
78
+ const releasedVersions = await (0, fetch_1.fetchInternalVersions)(latestVersion);
79
+ return releasedVersions.filter((version) => (0, format_1.isFeatureSupportedVersion)(version, '1.71.0'));
80
+ }
81
+ /**
82
+ * Fetches versions that are higher than the specified version.
83
+ *
84
+ * @param {string} version - The baseline version to compare against.
85
+ * @param {UI5Version} publicVersions - The public UI5 version data.
86
+ * @returns {Promise<string[]>} A promise that resolves to an array of versions higher than the specified version.
87
+ */
88
+ async function getHigherVersions(version, publicVersions) {
89
+ const latestVersion = publicVersions?.latest?.version;
90
+ const radix = 10;
91
+ const [_, baselineMinor, baselineMicro] = version.split('.').map((part) => parseInt(part, radix));
92
+ const higherVersions = Object.keys(publicVersions)
93
+ .filter((key) => key !== 'latest')
94
+ .map((key) => publicVersions[key]['version'])
95
+ .filter((ver) => {
96
+ const [, minor, micro] = ver.split('.').map((part) => parseInt(part, radix));
97
+ return minor > baselineMinor || (minor === baselineMinor && micro > baselineMicro);
98
+ });
99
+ const result = higherVersions.map((ver) => (ver === latestVersion ? `${ver} ${constants_1.LATEST_VERSION}` : ver)).reverse();
100
+ return result;
101
+ }
102
+ /**
103
+ * Gets relevant UI5 versions based on the system version and customer base flag.
104
+ *
105
+ * For external users (non-customer base), this function fetches internal versions,
106
+ * adjusts them based on snapshot labels, and adds standard snapshot constants.
107
+ * For customer base users, if there’s no snapshot label, it returns only higher versions.
108
+ * Otherwise, it returns the latest public version.
109
+ *
110
+ * @param {string | undefined} systemVersion - The current system version (can be undefined).
111
+ * @param {boolean} isCustomerBase - Indicates if the project is customer based.
112
+ * @param {UI5Version} publicVersions - The public UI5 version data.
113
+ * @returns {Promise<string[]>} A promise that resolves to an array of relevant version strings.
114
+ */
115
+ async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions) {
116
+ const version = checkSystemVersionPattern(systemVersion);
117
+ const latestPublicVersion = publicVersions?.latest?.version;
118
+ let versions = [];
119
+ const { formattedVersion, systemSnapshotLabel, systemLatestLabel } = getVersionLabels(version, publicVersions);
120
+ if (!isCustomerBase) {
121
+ versions = await getInternalVersions(latestPublicVersion);
129
122
  if (version) {
130
- this.isVersionDetected = pattern.test(version);
131
- }
132
- this.systemVersion = this.isVersionDetected ? version : undefined;
133
- return this.systemVersion;
134
- }
135
- /**
136
- * Gets versions relevant based on the system or user type.
137
- * For internal users, all available versions are returned.
138
- * For external users, only versions higher than the current system version are shown.
139
- *
140
- * @param {string} [systemVersion] - The current system version.
141
- * @returns {Promise<string[]>} An array of relevant version strings.
142
- * If the version is not detected, returns the latest released version.
143
- */
144
- async getRelevantVersions(systemVersion) {
145
- const version = this.checkSystemVersionPattern(systemVersion);
146
- const publicVersions = await this.getPublicVersions();
147
- const latestVersion = publicVersions?.latest?.version;
148
- let versions;
149
- const { formattedVersion, systemSnapshotLabel, systemLatestLabel } = this.getVersionLabels(version);
150
- if (!this.isCustomerBase) {
151
- versions = await this.getInternalVersions(latestVersion);
152
- if (version) {
153
- const regex = new RegExp(`${formattedVersion} `, 'g');
154
- versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${constants_1.CURRENT_SYSTEM_VERSION}`));
155
- versions.unshift((0, format_1.buildSystemVersionLabel)(formattedVersion, systemSnapshotLabel, systemLatestLabel));
156
- }
157
- versions.unshift(constants_1.SNAPSHOT_VERSION, constants_1.SNAPSHOT_UNTESTED_VERSION);
158
- }
159
- else if (version && systemSnapshotLabel === '') {
160
- versions = await this.getHigherVersions(formattedVersion);
123
+ const regex = new RegExp(`${formattedVersion} `, 'g');
124
+ versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${constants_1.CURRENT_SYSTEM_VERSION}`));
161
125
  versions.unshift((0, format_1.buildSystemVersionLabel)(formattedVersion, systemSnapshotLabel, systemLatestLabel));
162
126
  }
163
- else {
164
- versions = [`${latestVersion} ${constants_1.LATEST_VERSION}`];
165
- }
166
- return [...new Set(versions)];
127
+ versions.unshift(constants_1.SNAPSHOT_VERSION, constants_1.SNAPSHOT_UNTESTED_VERSION);
128
+ }
129
+ else if (version && systemSnapshotLabel === '') {
130
+ versions = await getHigherVersions(formattedVersion, publicVersions);
131
+ versions.unshift((0, format_1.buildSystemVersionLabel)(formattedVersion, systemSnapshotLabel, systemLatestLabel));
167
132
  }
168
- /**
169
- * Fetches versions that are higher than a specified version.
170
- *
171
- * @param {string} version - The baseline version to compare against.
172
- * @returns {Promise<string[]>} An array of versions higher than the specified version.
173
- */
174
- async getHigherVersions(version) {
175
- const publicVersions = await this.getPublicVersions();
176
- const latestVersion = publicVersions?.latest?.version;
177
- const radix = 10;
178
- const [_, baselineMinor, baselineMicro] = version.split('.').map((part) => parseInt(part, radix));
179
- const higherVersions = Object.keys(publicVersions)
180
- .filter((key) => key !== 'latest') // Exclude 'latest' key from the iteration
181
- .map((key) => publicVersions[key]['version'])
182
- .filter((ver) => {
183
- const [, minor, micro] = ver.split('.').map((part) => parseInt(part, radix));
184
- return minor > baselineMinor || (minor === baselineMinor && micro > baselineMicro);
185
- });
186
- const result = higherVersions
187
- .map((ver) => (ver === latestVersion ? `${ver} ${constants_1.LATEST_VERSION}` : ver))
188
- .reverse();
189
- return result;
133
+ else {
134
+ versions = [`${latestPublicVersion} ${constants_1.LATEST_VERSION}`];
190
135
  }
136
+ return [...new Set(versions)];
191
137
  }
192
- exports.UI5VersionInfo = UI5VersionInfo;
193
138
  //# sourceMappingURL=version-info.js.map
@@ -2,7 +2,7 @@ import type { ToolsLogger } from '@sap-ux/logger';
2
2
  import type { Package } from '@sap-ux/project-access';
3
3
  import type { AbapServiceProvider } from '@sap-ux/axios-extension';
4
4
  import { FlexLayer } from '../types';
5
- import type { AdpWriterConfig, ConfigAnswers } from '../types';
5
+ import type { AdpWriterConfig, AttributesAnswers, ConfigAnswers, UI5Version } from '../types';
6
6
  interface ConfigOptions {
7
7
  /**
8
8
  * The ABAP service provider instance used to retrieve system-specific information.
@@ -13,22 +13,21 @@ interface ConfigOptions {
13
13
  */
14
14
  configAnswers: ConfigAnswers;
15
15
  /**
16
- * The FlexLayer indicating the deployment layer (e.g., CUSTOMER_BASE or VENDOR).
16
+ * User-provided project attribute answers.
17
17
  */
18
- layer: FlexLayer;
18
+ attributeAnswers: AttributesAnswers;
19
19
  /**
20
- * Default project parameters.
20
+ * The FlexLayer indicating the deployment layer (e.g., CUSTOMER_BASE or VENDOR).
21
21
  */
22
- defaults: {
23
- /**
24
- * The default namespace for the project.
25
- */
26
- namespace: string;
27
- };
22
+ layer: FlexLayer;
28
23
  /**
29
24
  * The package.json information used to generate custom configuration.
30
25
  */
31
26
  packageJson: Package;
27
+ /**
28
+ * Public UI5 Versions.
29
+ */
30
+ publicVersions: UI5Version;
32
31
  /**
33
32
  * Logger instance for debugging and error reporting.
34
33
  */
@@ -19,21 +19,25 @@ const ui5_1 = require("../ui5");
19
19
  * @returns {Promise<AdpWriterConfig>} A promise that resolves to the generated ADP writer configuration.
20
20
  */
21
21
  async function getConfig(options) {
22
- const { configAnswers, defaults, layer, logger, packageJson, provider } = options;
22
+ const { configAnswers, attributeAnswers, layer, logger, packageJson, provider, publicVersions } = options;
23
23
  const ato = await provider.getAtoInfo();
24
24
  const operationsType = ato.operationsType ?? 'P';
25
25
  const target = await (0, abap_1.getProviderConfig)(configAnswers.system, logger);
26
26
  const customConfig = (0, project_utils_1.getCustomConfig)(operationsType, packageJson);
27
27
  const isCloudProject = await provider.isAbapCloud();
28
28
  const isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
29
- const ui5Info = ui5_1.UI5VersionInfo.getInstance(layer);
30
- const ui5Version = isCloudProject ? ui5Info.getLatestVersion() : ui5Info.getVersionToBeUsed('', isCustomerBase);
29
+ const ui5Version = isCloudProject
30
+ ? (0, ui5_1.getLatestVersion)(publicVersions)
31
+ : (0, ui5_1.getVersionToBeUsed)(attributeAnswers.ui5Version, isCustomerBase, publicVersions);
32
+ const { namespace, title, enableTypeScript } = attributeAnswers;
33
+ const { application: { id, bspName } } = configAnswers;
31
34
  return {
32
35
  app: {
33
- id: defaults.namespace,
34
- reference: configAnswers.application.id,
36
+ id: namespace,
37
+ reference: id,
35
38
  layer,
36
- title: '',
39
+ title,
40
+ bspName,
37
41
  content: [(0, descriptor_content_1.getNewModelEnhanceWithChange)()]
38
42
  },
39
43
  ui5: {
@@ -45,7 +49,7 @@ async function getConfig(options) {
45
49
  target,
46
50
  options: {
47
51
  fioriTools: true,
48
- enableTypeScript: false
52
+ enableTypeScript
49
53
  }
50
54
  };
51
55
  }
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%3Aadp-tooling"
11
11
  },
12
- "version": "0.13.28",
12
+ "version": "0.13.30",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -32,13 +32,13 @@
32
32
  "prompts": "2.4.2",
33
33
  "sanitize-filename": "1.6.3",
34
34
  "uuid": "10.0.0",
35
- "@sap-ux/axios-extension": "1.19.3",
35
+ "@sap-ux/axios-extension": "1.20.0",
36
36
  "@sap-ux/btp-utils": "1.0.3",
37
37
  "@sap-ux/inquirer-common": "0.6.35",
38
38
  "@sap-ux/logger": "0.6.0",
39
39
  "@sap-ux/project-access": "1.29.18",
40
- "@sap-ux/project-input-validator": "0.5.0",
41
- "@sap-ux/system-access": "0.5.35",
40
+ "@sap-ux/project-input-validator": "0.5.1",
41
+ "@sap-ux/system-access": "0.5.36",
42
42
  "@sap-ux/ui5-config": "0.26.5",
43
43
  "@sap-ux/odata-service-writer": "0.26.13",
44
44
  "@sap-ux/nodejs-utils": "0.1.9",