@sap-ux/adp-tooling 0.19.11 → 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.
- package/dist/abap/client.d.ts +1 -1
- package/dist/abap/client.js +8 -13
- package/dist/abap/config.js +5 -8
- package/dist/abap/index.d.ts +3 -3
- package/dist/abap/index.js +3 -19
- package/dist/abap/provider.js +5 -8
- package/dist/base/abap/manifest-service.d.ts +1 -1
- package/dist/base/abap/manifest-service.js +9 -18
- package/dist/base/cf.js +8 -11
- package/dist/base/change-utils.d.ts +1 -1
- package/dist/base/change-utils.js +49 -62
- package/dist/base/constants/index.js +12 -15
- package/dist/base/credentials.d.ts +2 -2
- package/dist/base/credentials.js +6 -9
- package/dist/base/helper.d.ts +1 -1
- package/dist/base/helper.js +40 -57
- package/dist/base/project-builder.js +3 -6
- package/dist/base/prompt.d.ts +1 -1
- package/dist/base/prompt.js +19 -25
- package/dist/btp/api.d.ts +1 -1
- package/dist/btp/api.js +10 -18
- package/dist/btp/index.d.ts +1 -1
- package/dist/btp/index.js +1 -17
- package/dist/cf/app/discovery.d.ts +1 -1
- package/dist/cf/app/discovery.js +11 -18
- package/dist/cf/app/html5-repo.d.ts +1 -1
- package/dist/cf/app/html5-repo.js +24 -32
- package/dist/cf/app/index.d.ts +2 -2
- package/dist/cf/app/index.js +2 -18
- package/dist/cf/core/auth.d.ts +1 -1
- package/dist/cf/core/auth.js +4 -8
- package/dist/cf/core/config.d.ts +1 -1
- package/dist/cf/core/config.js +9 -15
- package/dist/cf/core/index.d.ts +2 -2
- package/dist/cf/core/index.js +2 -18
- package/dist/cf/deploy.d.ts +1 -1
- package/dist/cf/deploy.js +33 -44
- package/dist/cf/index.d.ts +6 -6
- package/dist/cf/index.js +6 -22
- package/dist/cf/project/index.d.ts +3 -3
- package/dist/cf/project/index.js +3 -19
- package/dist/cf/project/mta.d.ts +1 -1
- package/dist/cf/project/mta.js +23 -66
- package/dist/cf/project/yaml-loader.d.ts +1 -1
- package/dist/cf/project/yaml-loader.js +8 -16
- package/dist/cf/project/yaml.d.ts +2 -2
- package/dist/cf/project/yaml.js +28 -72
- package/dist/cf/services/api.d.ts +1 -1
- package/dist/cf/services/api.js +46 -93
- package/dist/cf/services/cli.d.ts +1 -1
- package/dist/cf/services/cli.js +31 -42
- package/dist/cf/services/destinations.js +12 -48
- package/dist/cf/services/index.d.ts +5 -5
- package/dist/cf/services/index.js +5 -21
- package/dist/cf/services/manifest.d.ts +1 -1
- package/dist/cf/services/manifest.js +9 -13
- package/dist/cf/services/ssh.js +14 -22
- package/dist/cf/utils/index.d.ts +1 -1
- package/dist/cf/utils/index.js +1 -17
- package/dist/cf/utils/validation.d.ts +1 -1
- package/dist/cf/utils/validation.js +12 -18
- package/dist/common/flp-parameters.d.ts +1 -1
- package/dist/common/flp-parameters.js +1 -4
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -17
- package/dist/i18n.js +8 -16
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -46
- package/dist/preview/adp-preview.d.ts +1 -1
- package/dist/preview/adp-preview.js +41 -39
- package/dist/preview/change-handler.d.ts +1 -1
- package/dist/preview/change-handler.js +51 -59
- package/dist/preview/descriptor-change-handler.d.ts +1 -1
- package/dist/preview/descriptor-change-handler.js +18 -21
- package/dist/preview/ovp-routes-handler.js +11 -13
- package/dist/preview/routes-handler.js +36 -71
- package/dist/preview/utils.d.ts +1 -1
- package/dist/preview/utils.js +5 -8
- package/dist/prompts/add-annotations-to-odata/index.d.ts +1 -1
- package/dist/prompts/add-annotations-to-odata/index.js +24 -26
- package/dist/prompts/add-component-usages/index.d.ts +1 -1
- package/dist/prompts/add-component-usages/index.js +41 -43
- package/dist/prompts/add-new-model/index.d.ts +1 -1
- package/dist/prompts/add-new-model/index.js +75 -80
- package/dist/prompts/change-data-source/index.d.ts +1 -1
- package/dist/prompts/change-data-source/index.js +19 -22
- package/dist/prompts/change-inbound/index.d.ts +1 -1
- package/dist/prompts/change-inbound/index.js +11 -14
- package/dist/prompts/index.d.ts +5 -5
- package/dist/prompts/index.js +5 -15
- package/dist/source/applications.d.ts +2 -2
- package/dist/source/applications.js +7 -11
- package/dist/source/index.d.ts +3 -3
- package/dist/source/index.js +3 -19
- package/dist/source/manifest.d.ts +1 -1
- package/dist/source/manifest.js +15 -25
- package/dist/source/systems.d.ts +1 -1
- package/dist/source/systems.js +20 -27
- package/dist/types.d.ts +1 -1
- package/dist/types.js +64 -17
- package/dist/ui5/fetch.d.ts +1 -1
- package/dist/ui5/fetch.js +8 -12
- package/dist/ui5/format.d.ts +1 -1
- package/dist/ui5/format.js +17 -29
- package/dist/ui5/index.d.ts +4 -4
- package/dist/ui5/index.js +4 -20
- package/dist/ui5/network.d.ts +1 -1
- package/dist/ui5/network.js +1 -4
- package/dist/ui5/validator.js +14 -20
- package/dist/ui5/version-info.d.ts +1 -1
- package/dist/ui5/version-info.js +25 -36
- package/dist/writer/cf.d.ts +1 -1
- package/dist/writer/cf.js +35 -43
- package/dist/writer/changes/writer-factory.d.ts +2 -2
- package/dist/writer/changes/writer-factory.js +10 -13
- package/dist/writer/changes/writers/annotations-writer.d.ts +1 -1
- package/dist/writer/changes/writers/annotations-writer.js +11 -46
- package/dist/writer/changes/writers/component-usages-writer.d.ts +1 -1
- package/dist/writer/changes/writers/component-usages-writer.js +9 -12
- package/dist/writer/changes/writers/data-source-writer.d.ts +1 -1
- package/dist/writer/changes/writers/data-source-writer.js +7 -10
- package/dist/writer/changes/writers/inbound-writer.d.ts +1 -1
- package/dist/writer/changes/writers/inbound-writer.js +10 -13
- package/dist/writer/changes/writers/index.d.ts +5 -5
- package/dist/writer/changes/writers/index.js +5 -21
- package/dist/writer/changes/writers/new-model-writer.d.ts +1 -1
- package/dist/writer/changes/writers/new-model-writer.js +16 -20
- package/dist/writer/editors.d.ts +1 -1
- package/dist/writer/editors.js +6 -9
- package/dist/writer/i18n/index.d.ts +1 -1
- package/dist/writer/i18n/index.js +13 -17
- package/dist/writer/i18n/key-user-translations.js +9 -14
- package/dist/writer/inbound-navigation.d.ts +1 -1
- package/dist/writer/inbound-navigation.js +18 -27
- package/dist/writer/index.d.ts +1 -1
- package/dist/writer/index.js +36 -37
- package/dist/writer/manifest/descriptor-content.d.ts +2 -2
- package/dist/writer/manifest/descriptor-content.js +9 -15
- package/dist/writer/manifest/index.d.ts +1 -1
- package/dist/writer/manifest/index.js +1 -17
- package/dist/writer/options.d.ts +1 -1
- package/dist/writer/options.js +16 -27
- package/dist/writer/project-utils.d.ts +1 -1
- package/dist/writer/project-utils.js +49 -57
- package/dist/writer/writer-config.d.ts +2 -2
- package/dist/writer/writer-config.js +25 -30
- package/package.json +19 -17
package/dist/ui5/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
__exportStar(require("./validator"), exports);
|
|
1
|
+
export * from './version-info.js';
|
|
2
|
+
export * from './format.js';
|
|
3
|
+
export * from './fetch.js';
|
|
4
|
+
export * from './validator.js';
|
|
21
5
|
//# sourceMappingURL=index.js.map
|
package/dist/ui5/network.d.ts
CHANGED
package/dist/ui5/network.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isOfflineError = isOfflineError;
|
|
4
1
|
/**
|
|
5
2
|
* In VS Code extension host, we can't rely on navigator.onLine.
|
|
6
3
|
* Focus on error messages that indicate network connectivity issues
|
|
@@ -28,7 +25,7 @@ const networkErrorMessages = [
|
|
|
28
25
|
* @param {string} [error.code] - The error code string.
|
|
29
26
|
* @returns {boolean} True if the error indicates offline/network issues.
|
|
30
27
|
*/
|
|
31
|
-
function isOfflineError(error) {
|
|
28
|
+
export function isOfflineError(error) {
|
|
32
29
|
return networkErrorMessages.some((msg) => error.message?.includes(msg) || error.name?.includes(msg) || error.code?.includes(msg));
|
|
33
30
|
}
|
|
34
31
|
//# sourceMappingURL=network.js.map
|
package/dist/ui5/validator.js
CHANGED
|
@@ -1,43 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.validateUI5VersionExists = validateUI5VersionExists;
|
|
7
|
-
const project_input_validator_1 = require("@sap-ux/project-input-validator");
|
|
8
|
-
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
const i18n_1 = require("../i18n");
|
|
10
|
-
const format_1 = require("./format");
|
|
11
|
-
const network_1 = require("./network");
|
|
1
|
+
import { validateEmptyString } from '@sap-ux/project-input-validator';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { t } from '../i18n.js';
|
|
4
|
+
import { getOfficialBaseUI5VersionUrl, getFormattedVersion } from './format.js';
|
|
5
|
+
import { isOfflineError } from './network.js';
|
|
12
6
|
/**
|
|
13
7
|
* Validates a specified UI5 version by checking its availability on the SAP CDN.
|
|
14
8
|
*
|
|
15
9
|
* @param {string} [version] - The version to validate.
|
|
16
10
|
* @returns {Promise<string | boolean>} True if the version is valid, a string message if not, or if an error occurs.
|
|
17
11
|
*/
|
|
18
|
-
async function validateUI5VersionExists(version) {
|
|
19
|
-
const validationResult =
|
|
12
|
+
export async function validateUI5VersionExists(version) {
|
|
13
|
+
const validationResult = validateEmptyString(version);
|
|
20
14
|
if (typeof validationResult === 'string') {
|
|
21
15
|
return validationResult;
|
|
22
16
|
}
|
|
23
|
-
const selectedVersionURL =
|
|
24
|
-
const resource = version.includes('snapshot') ? 'neo-app.json' :
|
|
17
|
+
const selectedVersionURL = getOfficialBaseUI5VersionUrl(version);
|
|
18
|
+
const resource = version.includes('snapshot') ? 'neo-app.json' : getFormattedVersion(version);
|
|
25
19
|
try {
|
|
26
|
-
await
|
|
20
|
+
await axios.get(`${selectedVersionURL}/${resource}`);
|
|
27
21
|
return true;
|
|
28
22
|
}
|
|
29
23
|
catch (e) {
|
|
30
24
|
if (version.includes('snapshot')) {
|
|
31
|
-
const message =
|
|
25
|
+
const message = t('validators.ui5VersionNotReachableError');
|
|
32
26
|
return `${message.replace('<URL>', selectedVersionURL)}`;
|
|
33
27
|
}
|
|
34
28
|
if (e.response?.status === 400 || e.response?.status === 404) {
|
|
35
|
-
return
|
|
29
|
+
return t('validators.ui5VersionOutdatedError');
|
|
36
30
|
}
|
|
37
|
-
if (
|
|
31
|
+
if (isOfflineError(e)) {
|
|
38
32
|
return true;
|
|
39
33
|
}
|
|
40
|
-
return
|
|
34
|
+
return t('validators.ui5VersionDoesNotExistGeneric', { error: e.message });
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
37
|
//# sourceMappingURL=validator.js.map
|
package/dist/ui5/version-info.js
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.getMinUI5VersionForManifest = getMinUI5VersionForManifest;
|
|
5
|
-
exports.shouldSetMinUI5Version = shouldSetMinUI5Version;
|
|
6
|
-
exports.getVersionToBeUsed = getVersionToBeUsed;
|
|
7
|
-
exports.getVersionLabels = getVersionLabels;
|
|
8
|
-
exports.checkSystemVersionPattern = checkSystemVersionPattern;
|
|
9
|
-
exports.getInternalVersions = getInternalVersions;
|
|
10
|
-
exports.getHigherVersions = getHigherVersions;
|
|
11
|
-
exports.getRelevantVersions = getRelevantVersions;
|
|
12
|
-
const fetch_1 = require("./fetch");
|
|
13
|
-
const format_1 = require("./format");
|
|
14
|
-
const constants_1 = require("../base/constants");
|
|
1
|
+
import { fetchInternalVersions } from './fetch.js';
|
|
2
|
+
import { isFeatureSupportedVersion, addSnapshot, buildSystemVersionLabel, formatUi5Version } from './format.js';
|
|
3
|
+
import { CURRENT_SYSTEM_VERSION, LATEST_VERSION, SNAPSHOT_UNTESTED_VERSION, SNAPSHOT_VERSION } from '../base/constants/index.js';
|
|
15
4
|
/**
|
|
16
5
|
* Returns the latest version string from the fetched public versions.
|
|
17
6
|
*
|
|
18
7
|
* @param {UI5Version} publicVersions - The public UI5 version data fetched from the CDN.
|
|
19
8
|
* @returns {string} The latest version string.
|
|
20
9
|
*/
|
|
21
|
-
function getLatestVersion(publicVersions) {
|
|
10
|
+
export function getLatestVersion(publicVersions) {
|
|
22
11
|
return publicVersions?.latest?.version;
|
|
23
12
|
}
|
|
24
13
|
/**
|
|
@@ -31,7 +20,7 @@ function getLatestVersion(publicVersions) {
|
|
|
31
20
|
* @returns {string} The SAP UI5 version string to be set in the manifest, which can be either
|
|
32
21
|
* the current system version or the latest stable version, depending on the presence of 'snapshot'.
|
|
33
22
|
*/
|
|
34
|
-
function getMinUI5VersionForManifest(publicVersions, systemVersion) {
|
|
23
|
+
export function getMinUI5VersionForManifest(publicVersions, systemVersion) {
|
|
35
24
|
if (!systemVersion || systemVersion?.includes('snapshot')) {
|
|
36
25
|
return getLatestVersion(publicVersions);
|
|
37
26
|
}
|
|
@@ -44,7 +33,7 @@ function getMinUI5VersionForManifest(publicVersions, systemVersion) {
|
|
|
44
33
|
* @returns {boolean} True if the minimum UI5 version should be set (i.e., the detected version is
|
|
45
34
|
* available and the minor version is 90 or higher); otherwise, false.
|
|
46
35
|
*/
|
|
47
|
-
function shouldSetMinUI5Version(systemVersion) {
|
|
36
|
+
export function shouldSetMinUI5Version(systemVersion) {
|
|
48
37
|
if (!systemVersion) {
|
|
49
38
|
return false;
|
|
50
39
|
}
|
|
@@ -60,7 +49,7 @@ function shouldSetMinUI5Version(systemVersion) {
|
|
|
60
49
|
* @param {UI5Version} publicVersions - The public UI5 version data.
|
|
61
50
|
* @returns {string} The version string to be used.
|
|
62
51
|
*/
|
|
63
|
-
function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
|
|
52
|
+
export function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
|
|
64
53
|
if (!version || (isCustomerBase && version.includes('snapshot'))) {
|
|
65
54
|
return getLatestVersion(publicVersions);
|
|
66
55
|
}
|
|
@@ -76,15 +65,15 @@ function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
|
|
|
76
65
|
* - systemSnapshotLabel: the snapshot label (if applicable),
|
|
77
66
|
* - systemLatestLabel: a label if the version equals the latest version.
|
|
78
67
|
*/
|
|
79
|
-
function getVersionLabels(version, publicVersions) {
|
|
68
|
+
export function getVersionLabels(version, publicVersions) {
|
|
80
69
|
let formattedVersion = '';
|
|
81
70
|
let systemSnapshotLabel = '';
|
|
82
71
|
let systemLatestLabel = '';
|
|
83
72
|
if (version) {
|
|
84
73
|
const latestVersion = getLatestVersion(publicVersions);
|
|
85
|
-
formattedVersion =
|
|
86
|
-
systemSnapshotLabel =
|
|
87
|
-
systemLatestLabel = formattedVersion === latestVersion ?
|
|
74
|
+
formattedVersion = formatUi5Version(version);
|
|
75
|
+
systemSnapshotLabel = addSnapshot(version, latestVersion);
|
|
76
|
+
systemLatestLabel = formattedVersion === latestVersion ? LATEST_VERSION : '';
|
|
88
77
|
}
|
|
89
78
|
return { formattedVersion, systemSnapshotLabel, systemLatestLabel };
|
|
90
79
|
}
|
|
@@ -94,12 +83,12 @@ function getVersionLabels(version, publicVersions) {
|
|
|
94
83
|
* @param version - The version string to be checked.
|
|
95
84
|
* @returns The version string if it matches the standard format, or undefined otherwise.
|
|
96
85
|
*/
|
|
97
|
-
function checkSystemVersionPattern(version) {
|
|
86
|
+
export function checkSystemVersionPattern(version) {
|
|
98
87
|
const pattern = /^[1-9]\.\d{1,3}\.\d{1,2}\.*/;
|
|
99
88
|
if (!version || !pattern.test(version)) {
|
|
100
89
|
return undefined;
|
|
101
90
|
}
|
|
102
|
-
return
|
|
91
|
+
return formatUi5Version(version);
|
|
103
92
|
}
|
|
104
93
|
/**
|
|
105
94
|
* Retrieves and filters internal UI5 versions.
|
|
@@ -110,9 +99,9 @@ function checkSystemVersionPattern(version) {
|
|
|
110
99
|
* @param {string} latestVersion - The latest public version string.
|
|
111
100
|
* @returns {Promise<string[]>} A promise that resolves to an array of internal version strings.
|
|
112
101
|
*/
|
|
113
|
-
async function getInternalVersions(latestVersion) {
|
|
114
|
-
const releasedVersions = await
|
|
115
|
-
return releasedVersions.filter((version) =>
|
|
102
|
+
export async function getInternalVersions(latestVersion) {
|
|
103
|
+
const releasedVersions = await fetchInternalVersions(latestVersion);
|
|
104
|
+
return releasedVersions.filter((version) => isFeatureSupportedVersion('1.71.0', version));
|
|
116
105
|
}
|
|
117
106
|
/**
|
|
118
107
|
* Fetches versions that are higher than the specified version.
|
|
@@ -121,7 +110,7 @@ async function getInternalVersions(latestVersion) {
|
|
|
121
110
|
* @param {UI5Version} publicVersions - The public UI5 version data.
|
|
122
111
|
* @returns {Promise<string[]>} A promise that resolves to an array of versions higher than the specified version.
|
|
123
112
|
*/
|
|
124
|
-
async function getHigherVersions(version, publicVersions) {
|
|
113
|
+
export async function getHigherVersions(version, publicVersions) {
|
|
125
114
|
const latestVersion = publicVersions?.latest?.version;
|
|
126
115
|
const radix = 10;
|
|
127
116
|
const [_, baselineMinor, baselineMicro] = version.split('.').map((part) => Number.parseInt(part, radix));
|
|
@@ -132,7 +121,7 @@ async function getHigherVersions(version, publicVersions) {
|
|
|
132
121
|
const [, minor, micro] = ver.split('.').map((part) => Number.parseInt(part, radix));
|
|
133
122
|
return minor > baselineMinor || (minor === baselineMinor && micro > baselineMicro);
|
|
134
123
|
});
|
|
135
|
-
const result = higherVersions.map((ver) => (ver === latestVersion ? `${ver} ${
|
|
124
|
+
const result = higherVersions.map((ver) => (ver === latestVersion ? `${ver} ${LATEST_VERSION}` : ver)).reverse();
|
|
136
125
|
return result;
|
|
137
126
|
}
|
|
138
127
|
/**
|
|
@@ -148,7 +137,7 @@ async function getHigherVersions(version, publicVersions) {
|
|
|
148
137
|
* @param {UI5Version} publicVersions - The public UI5 version data.
|
|
149
138
|
* @returns {Promise<string[]>} A promise that resolves to an array of relevant version strings.
|
|
150
139
|
*/
|
|
151
|
-
async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions) {
|
|
140
|
+
export async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions) {
|
|
152
141
|
let formattedVersion = '', systemSnapshotLabel = '', systemLatestLabel = '';
|
|
153
142
|
const latestPublicVersion = publicVersions?.latest?.version;
|
|
154
143
|
let versions = [];
|
|
@@ -159,21 +148,21 @@ async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions
|
|
|
159
148
|
versions = await getInternalVersions(latestPublicVersion);
|
|
160
149
|
if (formattedVersion) {
|
|
161
150
|
const regex = new RegExp(`${formattedVersion} `, 'g');
|
|
162
|
-
versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${
|
|
163
|
-
versions.unshift(
|
|
151
|
+
versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${CURRENT_SYSTEM_VERSION}`));
|
|
152
|
+
versions.unshift(buildSystemVersionLabel(formattedVersion, systemSnapshotLabel, systemLatestLabel));
|
|
164
153
|
}
|
|
165
|
-
versions.unshift(
|
|
154
|
+
versions.unshift(SNAPSHOT_VERSION, SNAPSHOT_UNTESTED_VERSION);
|
|
166
155
|
}
|
|
167
156
|
else if (formattedVersion && systemSnapshotLabel === '') {
|
|
168
157
|
versions = await getHigherVersions(formattedVersion, publicVersions);
|
|
169
158
|
if (!versions.length && formattedVersion !== latestPublicVersion) {
|
|
170
|
-
versions = [`${formattedVersion} ${
|
|
159
|
+
versions = [`${formattedVersion} ${CURRENT_SYSTEM_VERSION}`, `${latestPublicVersion} ${LATEST_VERSION}`];
|
|
171
160
|
return [...new Set(versions)];
|
|
172
161
|
}
|
|
173
|
-
versions.unshift(
|
|
162
|
+
versions.unshift(buildSystemVersionLabel(formattedVersion, systemSnapshotLabel, systemLatestLabel));
|
|
174
163
|
}
|
|
175
164
|
else {
|
|
176
|
-
versions = [`${latestPublicVersion} ${
|
|
165
|
+
versions = [`${latestPublicVersion} ${LATEST_VERSION}`];
|
|
177
166
|
}
|
|
178
167
|
return [...new Set(versions)];
|
|
179
168
|
}
|
package/dist/writer/cf.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Editor } from 'mem-fs-editor';
|
|
2
2
|
import { type ToolsLogger } from '@sap-ux/logger';
|
|
3
|
-
import type { CfAdpWriterConfig, CfConfig, CfUi5AppInfo } from '../types';
|
|
3
|
+
import type { CfAdpWriterConfig, CfConfig, CfUi5AppInfo } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Writes the CF adp-project template to the mem-fs-editor instance.
|
|
6
6
|
*
|
package/dist/writer/cf.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const cf_1 = require("../cf");
|
|
15
|
-
const source_1 = require("../source");
|
|
16
|
-
const manifest_1 = require("./manifest");
|
|
17
|
-
const project_utils_1 = require("./project-utils");
|
|
18
|
-
const i18n_1 = require("./i18n");
|
|
19
|
-
const project_builder_1 = require("../base/project-builder");
|
|
20
|
-
const helper_1 = require("../base/helper");
|
|
21
|
-
const discovery_1 = require("../cf/app/discovery");
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { create as createStorage } from 'mem-fs';
|
|
4
|
+
import { create } from 'mem-fs-editor';
|
|
5
|
+
import { readUi5Yaml } from '@sap-ux/project-access';
|
|
6
|
+
import { adjustMtaYaml, getOrCreateServiceInstanceKeys, getCfUi5AppInfo, getProjectNameForXsSecurity } from '../cf/index.js';
|
|
7
|
+
import { getApplicationType } from '../source/index.js';
|
|
8
|
+
import { fillDescriptorContent } from './manifest/index.js';
|
|
9
|
+
import { getCfVariant, writeCfTemplates, writeCfUI5Yaml } from './project-utils.js';
|
|
10
|
+
import { getI18nDescription, getI18nModels, writeI18nModels } from './i18n/index.js';
|
|
11
|
+
import { runBuild } from '../base/project-builder.js';
|
|
12
|
+
import { getBaseAppId } from '../base/helper.js';
|
|
13
|
+
import { getAppHostIds } from '../cf/app/discovery.js';
|
|
22
14
|
/**
|
|
23
15
|
* Writes the CF adp-project template to the mem-fs-editor instance.
|
|
24
16
|
*
|
|
@@ -28,14 +20,14 @@ const discovery_1 = require("../cf/app/discovery");
|
|
|
28
20
|
* @param {Editor} fs - The memfs editor instance.
|
|
29
21
|
* @returns {Promise<Editor>} The updated memfs editor instance.
|
|
30
22
|
*/
|
|
31
|
-
async function generateCf(basePath, config, logger, fs) {
|
|
23
|
+
export async function generateCf(basePath, config, logger, fs) {
|
|
32
24
|
if (!fs) {
|
|
33
|
-
fs =
|
|
25
|
+
fs = create(createStorage());
|
|
34
26
|
}
|
|
35
27
|
const timestamp = Date.now().toString();
|
|
36
28
|
const fullConfig = setDefaults(config);
|
|
37
29
|
const { app, cf, ui5, project } = fullConfig;
|
|
38
|
-
const yamlContent = await
|
|
30
|
+
const yamlContent = await adjustMtaYaml({
|
|
39
31
|
projectPath: basePath,
|
|
40
32
|
adpProjectName: project.name,
|
|
41
33
|
appRouterType: cf.approuter,
|
|
@@ -45,13 +37,13 @@ async function generateCf(basePath, config, logger, fs) {
|
|
|
45
37
|
spaceGuid: cf.space.GUID
|
|
46
38
|
}, fs, timestamp, config.options?.templatePathOverwrite, logger);
|
|
47
39
|
if (fullConfig.app.i18nModels) {
|
|
48
|
-
|
|
40
|
+
writeI18nModels(basePath, fullConfig.app.i18nModels, fs);
|
|
49
41
|
}
|
|
50
|
-
const variant =
|
|
51
|
-
|
|
52
|
-
fullConfig.project.xsSecurityAppName =
|
|
53
|
-
await
|
|
54
|
-
await
|
|
42
|
+
const variant = getCfVariant(fullConfig);
|
|
43
|
+
fillDescriptorContent(variant.content, app.appType, ui5.version, app.i18nModels);
|
|
44
|
+
fullConfig.project.xsSecurityAppName = getProjectNameForXsSecurity(yamlContent, timestamp);
|
|
45
|
+
await writeCfTemplates(basePath, variant, fullConfig, fs);
|
|
46
|
+
await writeCfUI5Yaml(fullConfig.project.folder, fullConfig, fs);
|
|
55
47
|
return fs;
|
|
56
48
|
}
|
|
57
49
|
/**
|
|
@@ -65,9 +57,9 @@ function setDefaults(config) {
|
|
|
65
57
|
...config,
|
|
66
58
|
app: {
|
|
67
59
|
...config.app,
|
|
68
|
-
appType: config.app.appType ??
|
|
69
|
-
i18nModels: config.app.i18nModels ??
|
|
70
|
-
i18nDescription: config.app.i18nDescription ??
|
|
60
|
+
appType: config.app.appType ?? getApplicationType(config.app.manifest),
|
|
61
|
+
i18nModels: config.app.i18nModels ?? getI18nModels(config.app.manifest, config.app.layer, config.app.id),
|
|
62
|
+
i18nDescription: config.app.i18nDescription ?? getI18nDescription(config.app.layer, config.app.title)
|
|
71
63
|
},
|
|
72
64
|
options: {
|
|
73
65
|
addStandaloneApprouter: false,
|
|
@@ -84,10 +76,10 @@ function setDefaults(config) {
|
|
|
84
76
|
* @param ui5AppInfo - ui5AppInfo.json content
|
|
85
77
|
* @param logger - logger instance
|
|
86
78
|
*/
|
|
87
|
-
async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
|
|
79
|
+
export async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
|
|
88
80
|
try {
|
|
89
|
-
const ui5AppInfoTargetPath =
|
|
90
|
-
|
|
81
|
+
const ui5AppInfoTargetPath = join(basePath, 'ui5AppInfo.json');
|
|
82
|
+
fs.writeFileSync(ui5AppInfoTargetPath, JSON.stringify(ui5AppInfo, null, 2), 'utf-8');
|
|
91
83
|
logger?.info(`Written ui5AppInfo.json to ${basePath}`);
|
|
92
84
|
}
|
|
93
85
|
catch (error) {
|
|
@@ -104,29 +96,29 @@ async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
|
|
|
104
96
|
* @param cfConfig - CF configuration
|
|
105
97
|
* @param logger - logger instance
|
|
106
98
|
*/
|
|
107
|
-
async function setupCfPreview(basePath, yamlPath, cfConfig, logger) {
|
|
108
|
-
const ui5Config = await
|
|
99
|
+
export async function setupCfPreview(basePath, yamlPath, cfConfig, logger) {
|
|
100
|
+
const ui5Config = await readUi5Yaml(basePath, yamlPath);
|
|
109
101
|
const bundlerTask = ui5Config.findCustomTask('app-variant-bundler-build');
|
|
110
102
|
const serviceInstanceName = bundlerTask?.configuration?.serviceInstanceName;
|
|
111
103
|
if (!serviceInstanceName) {
|
|
112
104
|
throw new Error('No serviceInstanceName found in app-variant-bundler-build configuration');
|
|
113
105
|
}
|
|
114
|
-
const serviceInfo = await
|
|
106
|
+
const serviceInfo = await getOrCreateServiceInstanceKeys({
|
|
115
107
|
names: [serviceInstanceName],
|
|
116
108
|
spaceGuids: [bundlerTask?.configuration?.space ?? '']
|
|
117
109
|
}, logger);
|
|
118
110
|
if (!serviceInfo || serviceInfo.serviceKeys.length === 0) {
|
|
119
111
|
throw new Error(`No service keys found for service instance: ${serviceInstanceName}`);
|
|
120
112
|
}
|
|
121
|
-
const appId = await
|
|
122
|
-
const appHostIds =
|
|
123
|
-
const ui5AppInfo = await
|
|
113
|
+
const appId = await getBaseAppId(basePath);
|
|
114
|
+
const appHostIds = getAppHostIds(serviceInfo.serviceKeys);
|
|
115
|
+
const ui5AppInfo = await getCfUi5AppInfo(appId, appHostIds, cfConfig, logger);
|
|
124
116
|
if (appHostIds.length === 0) {
|
|
125
117
|
throw new Error('No app host IDs found in service keys.');
|
|
126
118
|
}
|
|
127
119
|
await writeUi5AppInfo(basePath, ui5AppInfo, logger);
|
|
128
120
|
logger?.log('Starting build');
|
|
129
|
-
await
|
|
121
|
+
await runBuild(basePath, { ADP_BUILDER_MODE: 'preview' });
|
|
130
122
|
logger?.log('Build completed');
|
|
131
123
|
}
|
|
132
124
|
//# sourceMappingURL=cf.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import { ChangeType } from '../../types';
|
|
3
|
-
import type { IWriterData } from '../../types';
|
|
2
|
+
import { ChangeType } from '../../types.js';
|
|
3
|
+
import type { IWriterData } from '../../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Handles the creation of a writer instance based on the generator type.
|
|
6
6
|
*/
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.WriterFactory = void 0;
|
|
4
|
-
const writers_1 = require("./writers");
|
|
1
|
+
import { ChangeType } from '../../types.js';
|
|
2
|
+
import { AnnotationsWriter, ComponentUsagesWriter, NewModelWriter, DataSourceWriter, InboundWriter } from './writers/index.js';
|
|
5
3
|
/**
|
|
6
4
|
* Handles the creation of a writer instance based on the generator type.
|
|
7
5
|
*/
|
|
8
|
-
class WriterFactory {
|
|
6
|
+
export class WriterFactory {
|
|
9
7
|
static writers = new Map([
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
8
|
+
[ChangeType.ADD_ANNOTATIONS_TO_ODATA, AnnotationsWriter],
|
|
9
|
+
[ChangeType.ADD_COMPONENT_USAGES, ComponentUsagesWriter],
|
|
10
|
+
[ChangeType.ADD_LIBRARY_REFERENCE, ComponentUsagesWriter],
|
|
11
|
+
[ChangeType.ADD_NEW_MODEL, NewModelWriter],
|
|
12
|
+
[ChangeType.CHANGE_DATA_SOURCE, DataSourceWriter],
|
|
13
|
+
[ChangeType.CHANGE_INBOUND, InboundWriter]
|
|
16
14
|
]);
|
|
17
15
|
/**
|
|
18
16
|
* Creates an instance of a writer based on the specified generator type.
|
|
@@ -29,11 +27,10 @@ class WriterFactory {
|
|
|
29
27
|
if (!WriterClass) {
|
|
30
28
|
throw new Error(`Unsupported generator type: ${type}`);
|
|
31
29
|
}
|
|
32
|
-
if (type ===
|
|
30
|
+
if (type === ChangeType.ADD_ANNOTATIONS_TO_ODATA) {
|
|
33
31
|
return new WriterClass(fs, projectPath, templatesPath);
|
|
34
32
|
}
|
|
35
33
|
return new WriterClass(fs, projectPath);
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
exports.WriterFactory = WriterFactory;
|
|
39
36
|
//# sourceMappingURL=writer-factory.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import { type IWriter, type AnnotationsData } from '../../../types';
|
|
2
|
+
import { type IWriter, type AnnotationsData } from '../../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Handles the creation and writing of annotations data changes for a project.
|
|
5
5
|
*/
|
|
@@ -1,45 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AnnotationsWriter = void 0;
|
|
37
|
-
const node_path_1 = __importStar(require("node:path"));
|
|
38
|
-
const change_utils_1 = require("../../../base/change-utils");
|
|
1
|
+
import path, { isAbsolute } from 'node:path';
|
|
2
|
+
import { ChangeType } from '../../../types.js';
|
|
3
|
+
import { FlexLayer } from '../../../types.js';
|
|
4
|
+
import { getChange, writeAnnotationChange } from '../../../base/change-utils.js';
|
|
39
5
|
/**
|
|
40
6
|
* Handles the creation and writing of annotations data changes for a project.
|
|
41
7
|
*/
|
|
42
|
-
class AnnotationsWriter {
|
|
8
|
+
export class AnnotationsWriter {
|
|
43
9
|
fs;
|
|
44
10
|
projectPath;
|
|
45
11
|
templatesPath;
|
|
@@ -62,7 +28,7 @@ class AnnotationsWriter {
|
|
|
62
28
|
constructContent(data) {
|
|
63
29
|
const { variant: { layer }, annotation: { dataSource, fileName } } = data;
|
|
64
30
|
const annotationFileNameWithoutExtension = fileName?.toLocaleLowerCase().replace('.xml', '');
|
|
65
|
-
const annotationNameSpace = layer ===
|
|
31
|
+
const annotationNameSpace = layer === FlexLayer.CUSTOMER_BASE
|
|
66
32
|
? `customer.annotation.${annotationFileNameWithoutExtension}`
|
|
67
33
|
: `annotation.${annotationFileNameWithoutExtension}`;
|
|
68
34
|
return {
|
|
@@ -84,7 +50,7 @@ class AnnotationsWriter {
|
|
|
84
50
|
* @returns {string | undefined} The determined filename for the annotation file.
|
|
85
51
|
*/
|
|
86
52
|
getAnnotationFileName({ annotation }) {
|
|
87
|
-
return annotation.filePath ?
|
|
53
|
+
return annotation.filePath ? path.basename(annotation.filePath) : `annotation_${Date.now()}.xml`;
|
|
88
54
|
}
|
|
89
55
|
/**
|
|
90
56
|
* Writes the annotation change to the project based on the provided data.
|
|
@@ -96,19 +62,18 @@ class AnnotationsWriter {
|
|
|
96
62
|
const { variant, annotation } = data;
|
|
97
63
|
annotation.fileName = annotation.fileName ?? this.getAnnotationFileName(data);
|
|
98
64
|
if (annotation.filePath) {
|
|
99
|
-
annotation.filePath =
|
|
65
|
+
annotation.filePath = isAbsolute(annotation.filePath)
|
|
100
66
|
? annotation.filePath
|
|
101
|
-
:
|
|
67
|
+
: path.join(this.projectPath, annotation.filePath);
|
|
102
68
|
}
|
|
103
69
|
const content = this.constructContent(data);
|
|
104
70
|
const timestamp = Date.now();
|
|
105
71
|
let change;
|
|
106
72
|
// When created via command change need to be created else change is created via RTA.
|
|
107
73
|
if (data.isCommand) {
|
|
108
|
-
change =
|
|
74
|
+
change = getChange(variant, timestamp, content, ChangeType.ADD_ANNOTATIONS_TO_ODATA);
|
|
109
75
|
}
|
|
110
|
-
await
|
|
76
|
+
await writeAnnotationChange(this.projectPath, timestamp, data.annotation, change, this.fs, this.templatesPath);
|
|
111
77
|
}
|
|
112
78
|
}
|
|
113
|
-
exports.AnnotationsWriter = AnnotationsWriter;
|
|
114
79
|
//# sourceMappingURL=annotations-writer.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { IWriter, ComponentUsagesData } from '../../../types';
|
|
2
|
+
import type { IWriter, ComponentUsagesData } from '../../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Handles the creation and writing of component usages data changes for a project.
|
|
5
5
|
*/
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ComponentUsagesWriter = void 0;
|
|
4
|
-
const change_utils_1 = require("../../../base/change-utils");
|
|
1
|
+
import { ChangeType } from '../../../types.js';
|
|
2
|
+
import { parseStringToObject, getChange, writeChangeToFolder } from '../../../base/change-utils.js';
|
|
5
3
|
/**
|
|
6
4
|
* Handles the creation and writing of component usages data changes for a project.
|
|
7
5
|
*/
|
|
8
|
-
class ComponentUsagesWriter {
|
|
6
|
+
export class ComponentUsagesWriter {
|
|
9
7
|
fs;
|
|
10
8
|
projectPath;
|
|
11
9
|
/**
|
|
@@ -28,8 +26,8 @@ class ComponentUsagesWriter {
|
|
|
28
26
|
[usageId]: {
|
|
29
27
|
name,
|
|
30
28
|
lazy: isLazy === 'true',
|
|
31
|
-
settings:
|
|
32
|
-
componentData:
|
|
29
|
+
settings: parseStringToObject(settings),
|
|
30
|
+
componentData: parseStringToObject(data)
|
|
33
31
|
}
|
|
34
32
|
};
|
|
35
33
|
return {
|
|
@@ -61,16 +59,15 @@ class ComponentUsagesWriter {
|
|
|
61
59
|
async write(data) {
|
|
62
60
|
const componentUsagesContent = this.constructContent(data);
|
|
63
61
|
const timestamp = Date.now();
|
|
64
|
-
const compUsagesChange =
|
|
65
|
-
await
|
|
62
|
+
const compUsagesChange = getChange(data.variant, timestamp, componentUsagesContent, ChangeType.ADD_COMPONENT_USAGES);
|
|
63
|
+
await writeChangeToFolder(this.projectPath, compUsagesChange, this.fs);
|
|
66
64
|
if (!('library' in data)) {
|
|
67
65
|
return;
|
|
68
66
|
}
|
|
69
67
|
const libRefContent = this.constructLibContent(data);
|
|
70
68
|
const libTimestamp = timestamp + 1;
|
|
71
|
-
const refLibChange =
|
|
72
|
-
await
|
|
69
|
+
const refLibChange = getChange(data.variant, libTimestamp, libRefContent, ChangeType.ADD_LIBRARY_REFERENCE);
|
|
70
|
+
await writeChangeToFolder(this.projectPath, refLibChange, this.fs);
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
|
-
exports.ComponentUsagesWriter = ComponentUsagesWriter;
|
|
76
73
|
//# sourceMappingURL=component-usages-writer.js.map
|