@sap-ux/adp-tooling 0.13.22 → 0.13.25
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.
- package/dist/abap/client.d.ts +18 -0
- package/dist/abap/client.js +43 -0
- package/dist/abap/config.d.ts +19 -0
- package/dist/abap/config.js +50 -0
- package/dist/abap/index.d.ts +4 -0
- package/dist/{client → abap}/index.js +3 -3
- package/dist/abap/provider.d.ts +22 -0
- package/dist/abap/provider.js +33 -0
- package/dist/base/constants/index.d.ts +8 -0
- package/dist/base/constants/index.js +9 -1
- package/dist/base/prompt.js +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/{client/target-applications.d.ts → source/applications.d.ts} +19 -9
- package/dist/{client/target-applications.js → source/applications.js} +24 -5
- package/dist/source/index.d.ts +4 -0
- package/dist/source/index.js +20 -0
- package/dist/source/manifest.d.ts +70 -0
- package/dist/source/manifest.js +123 -0
- package/dist/{client/target-systems.d.ts → source/systems.d.ts} +2 -2
- package/dist/{client/target-systems.js → source/systems.js} +4 -4
- package/dist/translations/adp-tooling.i18n.json +2 -1
- package/dist/types.d.ts +15 -6
- package/dist/ui5/fetch.d.ts +16 -0
- package/dist/ui5/fetch.js +34 -0
- package/dist/ui5/format.d.ts +80 -0
- package/dist/ui5/format.js +135 -0
- package/dist/ui5/index.d.ts +4 -0
- package/dist/ui5/index.js +20 -0
- package/dist/ui5/version-info.d.ts +106 -0
- package/dist/ui5/version-info.js +193 -0
- package/dist/writer/project-utils.d.ts +5 -4
- package/dist/writer/project-utils.js +3 -3
- package/dist/writer/writer-config.d.ts +5 -3
- package/dist/writer/writer-config.js +13 -3
- package/package.json +2 -2
- package/dist/client/abap-provider.d.ts +0 -38
- package/dist/client/abap-provider.js +0 -79
- package/dist/client/index.d.ts +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SystemLookup = exports.transformBackendSystem = void 0;
|
|
4
4
|
exports.getEndpointNames = getEndpointNames;
|
|
5
5
|
const store_1 = require("@sap-ux/store");
|
|
6
6
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
@@ -38,7 +38,7 @@ exports.transformBackendSystem = transformBackendSystem;
|
|
|
38
38
|
* Service class to manage and retrieve information about system systems,
|
|
39
39
|
* including their names, authentication requirements, and specific details.
|
|
40
40
|
*/
|
|
41
|
-
class
|
|
41
|
+
class SystemLookup {
|
|
42
42
|
logger;
|
|
43
43
|
systems;
|
|
44
44
|
/**
|
|
@@ -120,5 +120,5 @@ class TargetSystems {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
exports.
|
|
124
|
-
//# sourceMappingURL=
|
|
123
|
+
exports.SystemLookup = SystemLookup;
|
|
124
|
+
//# sourceMappingURL=systems.js.map
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"errorDuplicateNamesOData": "OData Service Name must be different from OData Annotation Data Source Name",
|
|
68
68
|
"errorInputInvalidValuePrefix": "{{value}} should start with '{{prefix}}'",
|
|
69
69
|
"errorCustomerEmptyValue": "{{value}} should contain at least one character in addition to '{{prefix}}'",
|
|
70
|
-
"errorInvalidDataSourceURI": "Invalid URI.
|
|
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
72
|
},
|
|
72
73
|
"choices": {
|
|
73
74
|
"true": "true",
|
package/dist/types.d.ts
CHANGED
|
@@ -11,10 +11,6 @@ export interface DescriptorVariant {
|
|
|
11
11
|
namespace: string;
|
|
12
12
|
content: DescriptorVariantContent[];
|
|
13
13
|
}
|
|
14
|
-
export type PackageJson = {
|
|
15
|
-
name: string;
|
|
16
|
-
version: string;
|
|
17
|
-
};
|
|
18
14
|
export interface DescriptorVariantContent {
|
|
19
15
|
changeType: string;
|
|
20
16
|
content: Record<string, unknown>;
|
|
@@ -94,9 +90,9 @@ export interface ConfigAnswers {
|
|
|
94
90
|
system: string;
|
|
95
91
|
username: string;
|
|
96
92
|
password: string;
|
|
97
|
-
application:
|
|
93
|
+
application: SourceApplication;
|
|
98
94
|
}
|
|
99
|
-
export interface
|
|
95
|
+
export interface SourceApplication {
|
|
100
96
|
id: string;
|
|
101
97
|
title: string;
|
|
102
98
|
ach: string;
|
|
@@ -105,6 +101,19 @@ export interface TargetApplication {
|
|
|
105
101
|
bspUrl: string;
|
|
106
102
|
bspName: string;
|
|
107
103
|
}
|
|
104
|
+
export interface FlexUISupportedSystem {
|
|
105
|
+
isUIFlex: boolean;
|
|
106
|
+
isOnPremise: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface UI5Version {
|
|
109
|
+
latest: VersionDetail;
|
|
110
|
+
[key: string]: VersionDetail;
|
|
111
|
+
}
|
|
112
|
+
export interface VersionDetail {
|
|
113
|
+
version: string;
|
|
114
|
+
support: string;
|
|
115
|
+
lts: boolean;
|
|
116
|
+
}
|
|
108
117
|
export interface Endpoint extends Partial<Destination> {
|
|
109
118
|
Name: string;
|
|
110
119
|
Url?: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UI5Version } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Fetches public UI5 version data from the SAP CDN.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Promise<UI5Version>} A promise that resolves to the UI5 version data object.
|
|
6
|
+
* @throws Will throw an error if the fetch fails.
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchPublicVersions(): Promise<UI5Version>;
|
|
9
|
+
/**
|
|
10
|
+
* Fetches internal UI5 versions from the Neo CDN and maps them to formatted version strings.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} latestVersion - The latest public UI5 version.
|
|
13
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of formatted internal version strings.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fetchInternalVersions(latestVersion: string): Promise<string[]>;
|
|
16
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchPublicVersions = fetchPublicVersions;
|
|
4
|
+
exports.fetchInternalVersions = fetchInternalVersions;
|
|
5
|
+
const constants_1 = require("../base/constants");
|
|
6
|
+
/**
|
|
7
|
+
* Fetches public UI5 version data from the SAP CDN.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Promise<UI5Version>} A promise that resolves to the UI5 version data object.
|
|
10
|
+
* @throws Will throw an error if the fetch fails.
|
|
11
|
+
*/
|
|
12
|
+
async function fetchPublicVersions() {
|
|
13
|
+
const response = await fetch(constants_1.UI5_VERSIONS_CDN_URL);
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
throw new Error(`Failed to fetch public UI5 versions. Status: ${response.status}`);
|
|
16
|
+
}
|
|
17
|
+
return response.json();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetches internal UI5 versions from the Neo CDN and maps them to formatted version strings.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} latestVersion - The latest public UI5 version.
|
|
23
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of formatted internal version strings.
|
|
24
|
+
*/
|
|
25
|
+
async function fetchInternalVersions(latestVersion) {
|
|
26
|
+
const response = await fetch(constants_1.UI5_VERSIONS_NEO_CDN_URL);
|
|
27
|
+
const data = await response.json();
|
|
28
|
+
return data?.routes?.map((route) => {
|
|
29
|
+
return route.target.version === latestVersion
|
|
30
|
+
? `${route.target.version} ${constants_1.LATEST_VERSION}`
|
|
31
|
+
: route.target.version;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the official base URL for SAP UI5 resources based on the version information.
|
|
3
|
+
* If the version includes 'snapshot', it returns a preview URL; otherwise, it returns the main SAP UI5 CDN URL.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} version - The UI5 version string, which may include qualifiers like 'snapshot'.
|
|
6
|
+
* @returns {string} The base URL for UI5 resources appropriate to the specified version.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getOfficialBaseUI5VersionUrl(version: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Formats a UI5 version string by removing extraneous information and adjusting the format of snapshot versions.
|
|
11
|
+
* Snapshot versions are reformatted from '1.96.0-snapshot' to 'snapshot-1.96'.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} version - The original version string which may include additional descriptors like 'snapshot'.
|
|
14
|
+
* @returns {string} A cleaned-up and, if applicable, restructured version string.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getFormattedVersion(version: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a string representing the current system version with appropriate labels.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} formattedVersion - The version string with timestamps removed.
|
|
21
|
+
* @param {string} snapshotLabel - The snapshot label computed for the version.
|
|
22
|
+
* @param {string} latestLabel - The label for the latest version if applicable.
|
|
23
|
+
* @returns {string} The constructed version string.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildSystemVersionLabel(formattedVersion: string, snapshotLabel: string, latestLabel: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Removes parenthetical information from a version string, typically used to clean up annotations such as "(latest)".
|
|
28
|
+
*
|
|
29
|
+
* @param {string} version - The version string which may include parenthetical information.
|
|
30
|
+
* @returns {string} The version string without the parenthetical content.
|
|
31
|
+
*/
|
|
32
|
+
export declare function removeBracketsFromVersion(version: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Removes the micro part of a version string, simplifying it to include only the major and minor version numbers.
|
|
35
|
+
* For example, it transforms a version string from '1.87.3' to '1.87'.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} version - The full version string that may include major, minor, and micro version numbers.
|
|
38
|
+
* @returns {string} The version string consisting of only the major and minor version numbers.
|
|
39
|
+
*/
|
|
40
|
+
export declare function removeMicroPart(version: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Removes the timestamp part from a version string, typically used to clean up snapshot versions that include a timestamp.
|
|
43
|
+
* Converts a version string like '1.95.0.34566363464' to '1.95.0'.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} version - The version string that may include a timestamp as part of a snapshot version.
|
|
46
|
+
* @returns {string} The version string without the timestamp, including only the major, minor, and micro version numbers.
|
|
47
|
+
*/
|
|
48
|
+
export declare function removeTimestampFromVersion(version: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Conditionally appends a '-snapshot' suffix to a version string if certain criteria are met.
|
|
51
|
+
* The suffix is added only if the version string includes an unreleased snapshot version.
|
|
52
|
+
* For example, it adds '-snapshot' if the version from the system includes a timestamp and differs from the latest released version.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} version - The original version string that may include a timestamp.
|
|
55
|
+
* @param {string} latestVersion - The most recently released version string, used for comparison.
|
|
56
|
+
* @returns {string} The '-snapshot' suffix if applicable; otherwise, an empty string.
|
|
57
|
+
*/
|
|
58
|
+
export declare function addSnapshot(version: string, latestVersion: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Function that parse the UI5 version. Returns NaN for snapshot or snapshot-untested. eturns x.xx for snapshot-x.xx.xx.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} version the UI5 version to parse
|
|
63
|
+
* @returns The major, the minor and the patch version, e.g. 1.86.11
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseUI5Version(version: string): {
|
|
66
|
+
major: number;
|
|
67
|
+
minor: number;
|
|
68
|
+
patch: number;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Determines if a specific feature, introduced in a given version, is supported in the current or specified version.
|
|
72
|
+
* This function checks if the provided version is greater than or equal to the feature introduction version.
|
|
73
|
+
* It also handles edge cases where versions might include 'snapshot' or 'snapshot-untested' strings.
|
|
74
|
+
*
|
|
75
|
+
* @param {string} featureVersion - The version string from which the feature is available (e.g., "1.125.3").
|
|
76
|
+
* @param {string} [version] - The current version string of the application; if not provided, the feature is assumed unsupported.
|
|
77
|
+
* @returns {boolean} - Returns true if the current version supports the feature, false otherwise.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isFeatureSupportedVersion(featureVersion: string, version?: string): boolean;
|
|
80
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOfficialBaseUI5VersionUrl = getOfficialBaseUI5VersionUrl;
|
|
4
|
+
exports.getFormattedVersion = getFormattedVersion;
|
|
5
|
+
exports.buildSystemVersionLabel = buildSystemVersionLabel;
|
|
6
|
+
exports.removeBracketsFromVersion = removeBracketsFromVersion;
|
|
7
|
+
exports.removeMicroPart = removeMicroPart;
|
|
8
|
+
exports.removeTimestampFromVersion = removeTimestampFromVersion;
|
|
9
|
+
exports.addSnapshot = addSnapshot;
|
|
10
|
+
exports.parseUI5Version = parseUI5Version;
|
|
11
|
+
exports.isFeatureSupportedVersion = isFeatureSupportedVersion;
|
|
12
|
+
const constants_1 = require("../base/constants");
|
|
13
|
+
/**
|
|
14
|
+
* Gets the official base URL for SAP UI5 resources based on the version information.
|
|
15
|
+
* If the version includes 'snapshot', it returns a preview URL; otherwise, it returns the main SAP UI5 CDN URL.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} version - The UI5 version string, which may include qualifiers like 'snapshot'.
|
|
18
|
+
* @returns {string} The base URL for UI5 resources appropriate to the specified version.
|
|
19
|
+
*/
|
|
20
|
+
function getOfficialBaseUI5VersionUrl(version) {
|
|
21
|
+
if (version.toLowerCase().includes('snapshot')) {
|
|
22
|
+
return constants_1.SNAPSHOT_CDN_URL;
|
|
23
|
+
}
|
|
24
|
+
return constants_1.UI5_CDN_URL;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Formats a UI5 version string by removing extraneous information and adjusting the format of snapshot versions.
|
|
28
|
+
* Snapshot versions are reformatted from '1.96.0-snapshot' to 'snapshot-1.96'.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} version - The original version string which may include additional descriptors like 'snapshot'.
|
|
31
|
+
* @returns {string} A cleaned-up and, if applicable, restructured version string.
|
|
32
|
+
*/
|
|
33
|
+
function getFormattedVersion(version) {
|
|
34
|
+
version = removeBracketsFromVersion(version);
|
|
35
|
+
return version.toLowerCase().includes('-snapshot') ? `snapshot-${removeMicroPart(version)}` : version;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a string representing the current system version with appropriate labels.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} formattedVersion - The version string with timestamps removed.
|
|
41
|
+
* @param {string} snapshotLabel - The snapshot label computed for the version.
|
|
42
|
+
* @param {string} latestLabel - The label for the latest version if applicable.
|
|
43
|
+
* @returns {string} The constructed version string.
|
|
44
|
+
*/
|
|
45
|
+
function buildSystemVersionLabel(formattedVersion, snapshotLabel, latestLabel) {
|
|
46
|
+
return `${formattedVersion}${snapshotLabel} ${constants_1.CURRENT_SYSTEM_VERSION}${latestLabel}`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Removes parenthetical information from a version string, typically used to clean up annotations such as "(latest)".
|
|
50
|
+
*
|
|
51
|
+
* @param {string} version - The version string which may include parenthetical information.
|
|
52
|
+
* @returns {string} The version string without the parenthetical content.
|
|
53
|
+
*/
|
|
54
|
+
function removeBracketsFromVersion(version) {
|
|
55
|
+
if (version.indexOf('(') !== -1) {
|
|
56
|
+
const versionParts = version.split('(');
|
|
57
|
+
return versionParts[0].trim();
|
|
58
|
+
}
|
|
59
|
+
return version;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Removes the micro part of a version string, simplifying it to include only the major and minor version numbers.
|
|
63
|
+
* For example, it transforms a version string from '1.87.3' to '1.87'.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} version - The full version string that may include major, minor, and micro version numbers.
|
|
66
|
+
* @returns {string} The version string consisting of only the major and minor version numbers.
|
|
67
|
+
*/
|
|
68
|
+
function removeMicroPart(version) {
|
|
69
|
+
const versionParts = version.split('.');
|
|
70
|
+
return `${versionParts[0]}.${versionParts[1]}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Removes the timestamp part from a version string, typically used to clean up snapshot versions that include a timestamp.
|
|
74
|
+
* Converts a version string like '1.95.0.34566363464' to '1.95.0'.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} version - The version string that may include a timestamp as part of a snapshot version.
|
|
77
|
+
* @returns {string} The version string without the timestamp, including only the major, minor, and micro version numbers.
|
|
78
|
+
*/
|
|
79
|
+
function removeTimestampFromVersion(version) {
|
|
80
|
+
const versionParts = version.split('.');
|
|
81
|
+
return `${versionParts[0]}.${versionParts[1]}.${versionParts[2]}`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Conditionally appends a '-snapshot' suffix to a version string if certain criteria are met.
|
|
85
|
+
* The suffix is added only if the version string includes an unreleased snapshot version.
|
|
86
|
+
* For example, it adds '-snapshot' if the version from the system includes a timestamp and differs from the latest released version.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} version - The original version string that may include a timestamp.
|
|
89
|
+
* @param {string} latestVersion - The most recently released version string, used for comparison.
|
|
90
|
+
* @returns {string} The '-snapshot' suffix if applicable; otherwise, an empty string.
|
|
91
|
+
*/
|
|
92
|
+
function addSnapshot(version, latestVersion) {
|
|
93
|
+
const versionParts = version.split('.');
|
|
94
|
+
return versionParts[3] && removeTimestampFromVersion(version) != latestVersion ? '-snapshot' : '';
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Function that parse the UI5 version. Returns NaN for snapshot or snapshot-untested. eturns x.xx for snapshot-x.xx.xx.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} version the UI5 version to parse
|
|
100
|
+
* @returns The major, the minor and the patch version, e.g. 1.86.11
|
|
101
|
+
*/
|
|
102
|
+
function parseUI5Version(version) {
|
|
103
|
+
const versionParts = version ? version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.') : [];
|
|
104
|
+
const major = parseInt(versionParts[0], 10);
|
|
105
|
+
const minor = parseInt(versionParts[1], 10);
|
|
106
|
+
const patch = parseInt(versionParts[2], 10);
|
|
107
|
+
return { major, minor, patch };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Determines if a specific feature, introduced in a given version, is supported in the current or specified version.
|
|
111
|
+
* This function checks if the provided version is greater than or equal to the feature introduction version.
|
|
112
|
+
* It also handles edge cases where versions might include 'snapshot' or 'snapshot-untested' strings.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} featureVersion - The version string from which the feature is available (e.g., "1.125.3").
|
|
115
|
+
* @param {string} [version] - The current version string of the application; if not provided, the feature is assumed unsupported.
|
|
116
|
+
* @returns {boolean} - Returns true if the current version supports the feature, false otherwise.
|
|
117
|
+
*/
|
|
118
|
+
function isFeatureSupportedVersion(featureVersion, version) {
|
|
119
|
+
if (!version || !featureVersion) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const { major: featMajorVersion, minor: featMinorVersion, patch: featPatchVersion } = parseUI5Version(featureVersion);
|
|
123
|
+
const { major, minor, patch } = parseUI5Version(version);
|
|
124
|
+
if (isNaN(major) && isNaN(minor) && isNaN(patch)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (major > featMajorVersion) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
else if (minor < featMinorVersion) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return patch >= featPatchVersion;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./version-info"), exports);
|
|
18
|
+
__exportStar(require("./format"), exports);
|
|
19
|
+
__exportStar(require("./fetch"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { FlexLayer } from '../types';
|
|
2
|
+
import type { UI5Version } from '../types';
|
|
3
|
+
/**
|
|
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.
|
|
7
|
+
*
|
|
8
|
+
* @class UI5VersionInfo
|
|
9
|
+
*/
|
|
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
|
+
}
|
|
106
|
+
//# sourceMappingURL=version-info.d.ts.map
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UI5VersionInfo = void 0;
|
|
4
|
+
const fetch_1 = require("./fetch");
|
|
5
|
+
const format_1 = require("./format");
|
|
6
|
+
const constants_1 = require("../base/constants");
|
|
7
|
+
/**
|
|
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.
|
|
11
|
+
*
|
|
12
|
+
* @class UI5VersionInfo
|
|
13
|
+
*/
|
|
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;
|
|
101
|
+
}
|
|
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 };
|
|
120
|
+
}
|
|
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}\.*/;
|
|
129
|
+
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);
|
|
161
|
+
versions.unshift((0, format_1.buildSystemVersionLabel)(formattedVersion, systemSnapshotLabel, systemLatestLabel));
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
versions = [`${latestVersion} ${constants_1.LATEST_VERSION}`];
|
|
165
|
+
}
|
|
166
|
+
return [...new Set(versions)];
|
|
167
|
+
}
|
|
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;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.UI5VersionInfo = UI5VersionInfo;
|
|
193
|
+
//# sourceMappingURL=version-info.js.map
|