@sap-ux/adp-tooling 0.19.10 → 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/abap/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
2
2
|
import type { ManifestNamespace } from '@sap-ux/project-access';
|
|
3
|
-
import type { FlexUICapability } from '../types';
|
|
3
|
+
import type { FlexUICapability } from '../types.js';
|
|
4
4
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
5
5
|
/**
|
|
6
6
|
* Fetches system supports Flex UI features.
|
package/dist/abap/client.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getFlexUICapability = getFlexUICapability;
|
|
4
|
-
exports.getSystemUI5Version = getSystemUI5Version;
|
|
5
|
-
exports.getBaseAppInbounds = getBaseAppInbounds;
|
|
6
|
-
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
7
|
-
const helper_1 = require("../base/helper");
|
|
1
|
+
import { AdtCatalogService, UI5RtVersionService } from '@sap-ux/axios-extension';
|
|
2
|
+
import { filterAndMapInboundsToManifest } from '../base/helper.js';
|
|
8
3
|
const FILTER = {
|
|
9
4
|
'scheme': 'http://www.sap.com/adt/categories/ui_flex',
|
|
10
5
|
'term': 'dta_folder'
|
|
@@ -16,14 +11,14 @@ const FILTER = {
|
|
|
16
11
|
* @param {boolean} isCustomerBase - Indicates whether the adaptation layer is CUSTOMER_BASE.
|
|
17
12
|
* @returns {Promise<FlexUICapability | undefined>} settings indicating support for onPremise and UI Flex capabilities.
|
|
18
13
|
*/
|
|
19
|
-
async function getFlexUICapability(provider, isCustomerBase) {
|
|
14
|
+
export async function getFlexUICapability(provider, isCustomerBase) {
|
|
20
15
|
if (!isCustomerBase) {
|
|
21
16
|
return {
|
|
22
17
|
isDtaFolderDeploymentSupported: true,
|
|
23
18
|
isUIFlexSupported: true
|
|
24
19
|
};
|
|
25
20
|
}
|
|
26
|
-
const response = await provider.get(
|
|
21
|
+
const response = await provider.get(AdtCatalogService.ADT_DISCOVERY_SERVICE_PATH, {
|
|
27
22
|
headers: {
|
|
28
23
|
Accept: 'application/*'
|
|
29
24
|
}
|
|
@@ -41,14 +36,14 @@ async function getFlexUICapability(provider, isCustomerBase) {
|
|
|
41
36
|
* @throws Throws exceptions only when the ADT api is used.
|
|
42
37
|
* @returns {string | undefined} System UI5 version.
|
|
43
38
|
*/
|
|
44
|
-
async function getSystemUI5Version(provider, logger) {
|
|
39
|
+
export async function getSystemUI5Version(provider, logger) {
|
|
45
40
|
try {
|
|
46
41
|
const ui5VersionService = provider.getUI5VersionService();
|
|
47
42
|
return await ui5VersionService.getUI5Version();
|
|
48
43
|
}
|
|
49
44
|
catch (error) {
|
|
50
45
|
logger.debug(`Could not fetch the system UI5 version: ${error.message}. Try to fetch the UI5 version with the adt api.`);
|
|
51
|
-
const ui5RtVersionService = await provider.getAdtService(
|
|
46
|
+
const ui5RtVersionService = await provider.getAdtService(UI5RtVersionService);
|
|
52
47
|
return ui5RtVersionService?.getUI5Version();
|
|
53
48
|
}
|
|
54
49
|
}
|
|
@@ -59,12 +54,12 @@ async function getSystemUI5Version(provider, logger) {
|
|
|
59
54
|
* @param {AbapServiceProvider} provider - Instance of the ABAP provider.
|
|
60
55
|
* @returns {Promise<ManifestNamespace.Inbound>} list of tile inbounds of the application.
|
|
61
56
|
*/
|
|
62
|
-
async function getBaseAppInbounds(appId, provider) {
|
|
57
|
+
export async function getBaseAppInbounds(appId, provider) {
|
|
63
58
|
const lrepService = provider.getLayeredRepository();
|
|
64
59
|
const inbounds = (await lrepService.getSystemInfo(undefined, undefined, appId)).inbounds;
|
|
65
60
|
if (!inbounds?.length) {
|
|
66
61
|
return undefined;
|
|
67
62
|
}
|
|
68
|
-
return
|
|
63
|
+
return filterAndMapInboundsToManifest(inbounds);
|
|
69
64
|
}
|
|
70
65
|
//# sourceMappingURL=client.js.map
|
package/dist/abap/config.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getProviderConfig = getProviderConfig;
|
|
4
|
-
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
|
-
const source_1 = require("../source");
|
|
1
|
+
import { isAppStudio } from '@sap-ux/btp-utils';
|
|
2
|
+
import { SystemLookup } from '../source/index.js';
|
|
6
3
|
/**
|
|
7
4
|
* Determines the ABAP target configuration based on the running environment and system details.
|
|
8
5
|
*
|
|
@@ -16,15 +13,15 @@ const source_1 = require("../source");
|
|
|
16
13
|
* @param {string} [client] - Optional client number for systems with multiple clients.
|
|
17
14
|
* @returns {Promise<AbapTarget>} A promise that resolves to the configured ABAP configuration.
|
|
18
15
|
*/
|
|
19
|
-
async function getProviderConfig(system, logger, requestOptions, client) {
|
|
16
|
+
export async function getProviderConfig(system, logger, requestOptions, client) {
|
|
20
17
|
let config;
|
|
21
|
-
if (
|
|
18
|
+
if (isAppStudio()) {
|
|
22
19
|
config = {
|
|
23
20
|
destination: system
|
|
24
21
|
};
|
|
25
22
|
}
|
|
26
23
|
else {
|
|
27
|
-
const systemLookup = new
|
|
24
|
+
const systemLookup = new SystemLookup(logger);
|
|
28
25
|
const details = await systemLookup.getSystemByName(system);
|
|
29
26
|
if (!details) {
|
|
30
27
|
throw new Error(`No system details found for system: ${system}`);
|
package/dist/abap/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './client';
|
|
2
|
-
export * from './provider';
|
|
3
|
-
export * from './config';
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './provider.js';
|
|
3
|
+
export * from './config.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/abap/index.js
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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("./client"), exports);
|
|
18
|
-
__exportStar(require("./provider"), exports);
|
|
19
|
-
__exportStar(require("./config"), exports);
|
|
1
|
+
export * from './client.js';
|
|
2
|
+
export * from './provider.js';
|
|
3
|
+
export * from './config.js';
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
package/dist/abap/provider.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getConfiguredProvider = getConfiguredProvider;
|
|
4
|
-
const system_access_1 = require("@sap-ux/system-access");
|
|
5
|
-
const config_1 = require("./config");
|
|
1
|
+
import { createAbapServiceProvider } from '@sap-ux/system-access';
|
|
2
|
+
import { getProviderConfig } from './config.js';
|
|
6
3
|
/**
|
|
7
4
|
* Retrieves a fully configured ABAP service provider for the specified system.
|
|
8
5
|
*
|
|
@@ -14,16 +11,16 @@ const config_1 = require("./config");
|
|
|
14
11
|
* @returns {Promise<AbapServiceProvider>} A promise that resolves to the configured ABAP service provider.
|
|
15
12
|
* @throws {Error} If provider instantiation fails.
|
|
16
13
|
*/
|
|
17
|
-
async function getConfiguredProvider({ system, client, password, username }, logger) {
|
|
14
|
+
export async function getConfiguredProvider({ system, client, password, username }, logger) {
|
|
18
15
|
try {
|
|
19
16
|
const requestOptions = {
|
|
20
17
|
ignoreCertErrors: false
|
|
21
18
|
};
|
|
22
|
-
const config = await
|
|
19
|
+
const config = await getProviderConfig(system, logger, requestOptions, client);
|
|
23
20
|
if (username && password) {
|
|
24
21
|
requestOptions.auth = { username, password };
|
|
25
22
|
}
|
|
26
|
-
return await
|
|
23
|
+
return await createAbapServiceProvider(config, requestOptions, false, logger);
|
|
27
24
|
}
|
|
28
25
|
catch (e) {
|
|
29
26
|
logger?.error(`Failed to instantiate provider for system: ${system}. Reason: ${e.message}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
2
|
import type { Manifest, ManifestNamespace } from '@sap-ux/project-access';
|
|
3
3
|
import { type AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
4
|
-
import type { DescriptorVariant, IManifestService, DataSources } from '../../types';
|
|
4
|
+
import type { DescriptorVariant, IManifestService, DataSources } from '../../types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Retrieves the inbound navigation configurations from the project's manifest.
|
|
7
7
|
*
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ManifestService = void 0;
|
|
7
|
-
exports.getInboundsFromManifest = getInboundsFromManifest;
|
|
8
|
-
exports.getRegistrationIdFromManifest = getRegistrationIdFromManifest;
|
|
9
|
-
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
10
|
-
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
11
|
-
const helper_1 = require("../helper");
|
|
1
|
+
import ZipFile from 'adm-zip';
|
|
2
|
+
import { isAxiosError } from '@sap-ux/axios-extension';
|
|
3
|
+
import { getWebappFiles } from '../helper.js';
|
|
12
4
|
/**
|
|
13
5
|
* Retrieves the inbound navigation configurations from the project's manifest.
|
|
14
6
|
*
|
|
15
7
|
* @param {Manifest} manifest - The manifest file object adhering to the SAP JSON schema for web application manifest files.
|
|
16
8
|
* @returns {ManifestNamespace.Inbound | undefined} The inbound navigation configurations, or `undefined` if no configurations are present.
|
|
17
9
|
*/
|
|
18
|
-
function getInboundsFromManifest(manifest) {
|
|
10
|
+
export function getInboundsFromManifest(manifest) {
|
|
19
11
|
return manifest?.['sap.app']?.crossNavigation?.inbounds;
|
|
20
12
|
}
|
|
21
13
|
/**
|
|
@@ -24,7 +16,7 @@ function getInboundsFromManifest(manifest) {
|
|
|
24
16
|
* @param {Manifest} manifest - The manifest file object adhering to the SAP JSON schema for web application manifest files.
|
|
25
17
|
* @returns {string | undefined} The first registration ID if available, otherwise `undefined`.
|
|
26
18
|
*/
|
|
27
|
-
function getRegistrationIdFromManifest(manifest) {
|
|
19
|
+
export function getRegistrationIdFromManifest(manifest) {
|
|
28
20
|
return manifest?.['sap.fiori']?.registrationIds?.[0];
|
|
29
21
|
}
|
|
30
22
|
/**
|
|
@@ -33,7 +25,7 @@ function getRegistrationIdFromManifest(manifest) {
|
|
|
33
25
|
* It provides methods to fetch the manifest, data sources and metadata of a data source.
|
|
34
26
|
*
|
|
35
27
|
*/
|
|
36
|
-
class ManifestService {
|
|
28
|
+
export class ManifestService {
|
|
37
29
|
provider;
|
|
38
30
|
logger;
|
|
39
31
|
manifest;
|
|
@@ -94,7 +86,7 @@ class ManifestService {
|
|
|
94
86
|
this.manifest = JSON.parse(response.data);
|
|
95
87
|
}
|
|
96
88
|
catch (error) {
|
|
97
|
-
if (
|
|
89
|
+
if (isAxiosError(error)) {
|
|
98
90
|
this.logger.error('Manifest fetching failed');
|
|
99
91
|
}
|
|
100
92
|
else {
|
|
@@ -129,8 +121,8 @@ class ManifestService {
|
|
|
129
121
|
* @returns A promise that resolves to the merged manifest.
|
|
130
122
|
*/
|
|
131
123
|
async fetchMergedManifest(basePath, descriptorVariantId) {
|
|
132
|
-
const zip = new
|
|
133
|
-
const files = await
|
|
124
|
+
const zip = new ZipFile();
|
|
125
|
+
const files = await getWebappFiles(basePath);
|
|
134
126
|
for (const file of files) {
|
|
135
127
|
zip.addFile(file.relativePath, Buffer.from(file.content, 'utf-8'));
|
|
136
128
|
}
|
|
@@ -189,5 +181,4 @@ class ManifestService {
|
|
|
189
181
|
}
|
|
190
182
|
}
|
|
191
183
|
}
|
|
192
|
-
exports.ManifestService = ManifestService;
|
|
193
184
|
//# sourceMappingURL=manifest-service.js.map
|
package/dist/base/cf.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const node_path_1 = require("node:path");
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
3
|
+
import { readUi5Yaml } from '@sap-ux/project-access';
|
|
7
4
|
/**
|
|
8
5
|
* Check if the project is a CF project.
|
|
9
6
|
*
|
|
10
7
|
* @param {string} basePath - The path to the adaptation project.
|
|
11
8
|
* @returns {boolean} true if the project is a CF project, false otherwise
|
|
12
9
|
*/
|
|
13
|
-
async function isCFEnvironment(basePath) {
|
|
14
|
-
const configJsonPath =
|
|
15
|
-
if (
|
|
16
|
-
const config = JSON.parse(
|
|
10
|
+
export async function isCFEnvironment(basePath) {
|
|
11
|
+
const configJsonPath = join(basePath, '.adp', 'config.json');
|
|
12
|
+
if (existsSync(configJsonPath)) {
|
|
13
|
+
const config = JSON.parse(readFileSync(configJsonPath, 'utf-8'));
|
|
17
14
|
if (config.environment === 'CF') {
|
|
18
15
|
return true;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
try {
|
|
22
|
-
const ui5Config = await
|
|
19
|
+
const ui5Config = await readUi5Yaml(basePath, 'ui5.yaml');
|
|
23
20
|
const customMiddleware = ui5Config.findCustomMiddleware('fiori-tools-preview') ??
|
|
24
21
|
ui5Config.findCustomMiddleware('preview-middleware');
|
|
25
22
|
const adpConfig = customMiddleware?.configuration?.adp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import { FlexLayer, type AnnotationsData, type ChangeType, type DescriptorVariant, type InboundContent, type ManifestChangeProperties, type PropertyValueType, type AdpWriterConfig } from '../types';
|
|
2
|
+
import { FlexLayer, type AnnotationsData, type ChangeType, type DescriptorVariant, type InboundContent, type ManifestChangeProperties, type PropertyValueType, type AdpWriterConfig } from '../types.js';
|
|
3
3
|
export type ChangeMetadata = Pick<DescriptorVariant, 'id' | 'layer' | 'namespace'>;
|
|
4
4
|
type InboundChangeData = {
|
|
5
5
|
filePath: string;
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.writeChangeToFolder = writeChangeToFolder;
|
|
10
|
-
exports.writeChangeToFile = writeChangeToFile;
|
|
11
|
-
exports.parseStringToObject = parseStringToObject;
|
|
12
|
-
exports.getParsedPropertyValue = getParsedPropertyValue;
|
|
13
|
-
exports.getChangesByType = getChangesByType;
|
|
14
|
-
exports.findChangeWithInboundId = findChangeWithInboundId;
|
|
15
|
-
exports.getChange = getChange;
|
|
16
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
-
const node_fs_1 = require("node:fs");
|
|
18
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
19
|
-
const types_1 = require("../types");
|
|
20
|
-
const ejs_1 = require("ejs");
|
|
21
|
-
const key_user_translations_1 = require("../writer/i18n/key-user-translations");
|
|
1
|
+
import path, { dirname } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
import { DirName, getWebappPath } from '@sap-ux/project-access';
|
|
6
|
+
import { FlexLayer, TemplateFileName, ChangeTypeMap } from '../types.js';
|
|
7
|
+
import { renderFile } from 'ejs';
|
|
8
|
+
import { replaceTextsWithI18nBindings, writeKeyUserTranslations } from '../writer/i18n/key-user-translations.js';
|
|
22
9
|
/**
|
|
23
10
|
* Writes annotation changes to the specified project path using the provided `mem-fs-editor` instance.
|
|
24
11
|
*
|
|
@@ -30,33 +17,33 @@ const key_user_translations_1 = require("../writer/i18n/key-user-translations");
|
|
|
30
17
|
* @param {string} templatesPath - The path to the templates used for generating changes.
|
|
31
18
|
* @returns {Promise<void>}
|
|
32
19
|
*/
|
|
33
|
-
async function writeAnnotationChange(projectPath, timestamp, annotation, change, fs, templatesPath) {
|
|
20
|
+
export async function writeAnnotationChange(projectPath, timestamp, annotation, change, fs, templatesPath) {
|
|
34
21
|
try {
|
|
35
|
-
const webappPath = await
|
|
36
|
-
const changesFolderPath =
|
|
37
|
-
const annotationsFolderPath =
|
|
22
|
+
const webappPath = await getWebappPath(projectPath, fs);
|
|
23
|
+
const changesFolderPath = path.join(webappPath, DirName.Changes);
|
|
24
|
+
const annotationsFolderPath = path.join(changesFolderPath, DirName.Annotations);
|
|
38
25
|
if (change) {
|
|
39
26
|
const changeFileName = `${change.fileName}.change`;
|
|
40
|
-
const changeFilePath =
|
|
27
|
+
const changeFilePath = path.join(changesFolderPath, changeFileName);
|
|
41
28
|
writeChangeToFile(changeFilePath, change, fs);
|
|
42
29
|
}
|
|
43
30
|
if (!annotation.filePath) {
|
|
44
31
|
const annotationsTemplate = templatesPath
|
|
45
|
-
?
|
|
46
|
-
:
|
|
32
|
+
? path.join(templatesPath, 'changes', TemplateFileName.Annotation)
|
|
33
|
+
: path.join(__dirname, '..', '..', 'templates', 'changes', TemplateFileName.Annotation);
|
|
47
34
|
const { namespaces, serviceUrl } = annotation;
|
|
48
35
|
const schemaNamespace = `local_${timestamp}`;
|
|
49
|
-
|
|
36
|
+
renderFile(annotationsTemplate, { namespaces, path: serviceUrl, schemaNamespace }, {}, (err, str) => {
|
|
50
37
|
if (err) {
|
|
51
38
|
throw new Error('Error rendering template: ' + err.message);
|
|
52
39
|
}
|
|
53
|
-
fs.write(
|
|
40
|
+
fs.write(path.join(annotationsFolderPath, annotation.fileName ?? ''), str);
|
|
54
41
|
});
|
|
55
42
|
}
|
|
56
43
|
else {
|
|
57
|
-
const selectedDir =
|
|
44
|
+
const selectedDir = path.dirname(annotation.filePath);
|
|
58
45
|
if (selectedDir !== annotationsFolderPath) {
|
|
59
|
-
fs.copy(annotation.filePath,
|
|
46
|
+
fs.copy(annotation.filePath, path.join(annotationsFolderPath, annotation.fileName ?? ''));
|
|
60
47
|
}
|
|
61
48
|
}
|
|
62
49
|
}
|
|
@@ -71,7 +58,7 @@ async function writeAnnotationChange(projectPath, timestamp, annotation, change,
|
|
|
71
58
|
* @param config - The writer configuration.
|
|
72
59
|
* @param fs - Yeoman mem-fs editor.
|
|
73
60
|
*/
|
|
74
|
-
async function writeKeyUserChanges(projectPath, config, fs) {
|
|
61
|
+
export async function writeKeyUserChanges(projectPath, config, fs) {
|
|
75
62
|
const changes = config.keyUserChanges;
|
|
76
63
|
if (!changes?.length) {
|
|
77
64
|
return;
|
|
@@ -89,8 +76,8 @@ async function writeKeyUserChanges(projectPath, config, fs) {
|
|
|
89
76
|
const topLevelTexts = entry.texts;
|
|
90
77
|
// Replace content.texts values with i18n bindings and write translations to .properties files
|
|
91
78
|
if (contentTexts && topLevelTexts && Object.keys(topLevelTexts).length > 0) {
|
|
92
|
-
change['texts'] =
|
|
93
|
-
await
|
|
79
|
+
change['texts'] = replaceTextsWithI18nBindings(contentTexts, fileName);
|
|
80
|
+
await writeKeyUserTranslations(projectPath, fileName, topLevelTexts, fs);
|
|
94
81
|
}
|
|
95
82
|
const transformedChange = transformKeyUserChangeForAdp(change, config.app.id, config.app.layer);
|
|
96
83
|
await writeChangeToFolder(projectPath, transformedChange, fs);
|
|
@@ -104,11 +91,11 @@ async function writeKeyUserChanges(projectPath, config, fs) {
|
|
|
104
91
|
* @param layer - The layer of the change.
|
|
105
92
|
* @returns {Record<string, unknown>} The transformed change object.
|
|
106
93
|
*/
|
|
107
|
-
function transformKeyUserChangeForAdp(change, appId, layer) {
|
|
94
|
+
export function transformKeyUserChangeForAdp(change, appId, layer) {
|
|
108
95
|
const transformed = { ...change };
|
|
109
|
-
transformed.layer = layer ??
|
|
96
|
+
transformed.layer = layer ?? FlexLayer.CUSTOMER_BASE;
|
|
110
97
|
transformed.reference = appId;
|
|
111
|
-
transformed.namespace =
|
|
98
|
+
transformed.namespace = path.posix.join('apps', appId, DirName.Changes, '/');
|
|
112
99
|
if (transformed.projectId) {
|
|
113
100
|
transformed.projectId = appId;
|
|
114
101
|
}
|
|
@@ -131,15 +118,15 @@ function transformKeyUserChangeForAdp(change, appId, layer) {
|
|
|
131
118
|
* @param {string} [dir] - An optional subdirectory within the 'changes' directory where the file will be written.
|
|
132
119
|
* @returns {Promise<void>}
|
|
133
120
|
*/
|
|
134
|
-
async function writeChangeToFolder(projectPath, change, fs, dir = '') {
|
|
121
|
+
export async function writeChangeToFolder(projectPath, change, fs, dir = '') {
|
|
135
122
|
try {
|
|
136
|
-
const webappPath = await
|
|
137
|
-
let targetFolderPath =
|
|
123
|
+
const webappPath = await getWebappPath(projectPath, fs);
|
|
124
|
+
let targetFolderPath = path.join(webappPath, DirName.Changes);
|
|
138
125
|
if (dir) {
|
|
139
|
-
targetFolderPath =
|
|
126
|
+
targetFolderPath = path.join(targetFolderPath, dir);
|
|
140
127
|
}
|
|
141
128
|
const fileName = `${change.fileName}.change`;
|
|
142
|
-
const filePath =
|
|
129
|
+
const filePath = path.join(targetFolderPath, fileName);
|
|
143
130
|
writeChangeToFile(filePath, change, fs);
|
|
144
131
|
}
|
|
145
132
|
catch (e) {
|
|
@@ -154,7 +141,7 @@ async function writeChangeToFolder(projectPath, change, fs, dir = '') {
|
|
|
154
141
|
* @param {ManifestChangeProperties} change - The change data to be written to the file.
|
|
155
142
|
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
156
143
|
*/
|
|
157
|
-
function writeChangeToFile(path, change, fs) {
|
|
144
|
+
export function writeChangeToFile(path, change, fs) {
|
|
158
145
|
try {
|
|
159
146
|
fs.writeJSON(path, change);
|
|
160
147
|
}
|
|
@@ -171,7 +158,7 @@ function writeChangeToFile(path, change, fs) {
|
|
|
171
158
|
* // returns { name: "value" }
|
|
172
159
|
* parseStringToObject('"name":"value"');
|
|
173
160
|
*/
|
|
174
|
-
function parseStringToObject(str) {
|
|
161
|
+
export function parseStringToObject(str) {
|
|
175
162
|
return JSON.parse(`{${str}}`);
|
|
176
163
|
}
|
|
177
164
|
/**
|
|
@@ -186,7 +173,7 @@ function parseStringToObject(str) {
|
|
|
186
173
|
* // Returns the string "nonJSONValue" because it cannot be parsed as JSON
|
|
187
174
|
* getParsedPropertyValue('nonJSONValue');
|
|
188
175
|
*/
|
|
189
|
-
function getParsedPropertyValue(propertyValue) {
|
|
176
|
+
export function getParsedPropertyValue(propertyValue) {
|
|
190
177
|
try {
|
|
191
178
|
const value = JSON.parse(propertyValue);
|
|
192
179
|
return value;
|
|
@@ -204,19 +191,19 @@ function getParsedPropertyValue(propertyValue) {
|
|
|
204
191
|
* @param {string} [subDir] - Optional subdirectory within the main changes directory.
|
|
205
192
|
* @returns An array of change objects matching the specified change type.
|
|
206
193
|
*/
|
|
207
|
-
function getChangesByType(projectPath, changeType, subDir) {
|
|
194
|
+
export function getChangesByType(projectPath, changeType, subDir) {
|
|
208
195
|
try {
|
|
209
196
|
let targetDir = `${projectPath}/webapp/changes`;
|
|
210
|
-
if (!
|
|
197
|
+
if (!existsSync(targetDir)) {
|
|
211
198
|
return [];
|
|
212
199
|
}
|
|
213
200
|
if (subDir) {
|
|
214
201
|
targetDir = `${targetDir}/${subDir}`;
|
|
215
|
-
if (!
|
|
202
|
+
if (!existsSync(targetDir)) {
|
|
216
203
|
return [];
|
|
217
204
|
}
|
|
218
205
|
}
|
|
219
|
-
const fileNames =
|
|
206
|
+
const fileNames = readdirSync(targetDir, { withFileTypes: true })
|
|
220
207
|
.filter((dirent) => dirent.isFile() && dirent.name.endsWith('.change'))
|
|
221
208
|
.map((dirent) => dirent.name);
|
|
222
209
|
if (fileNames.length === 0) {
|
|
@@ -224,8 +211,8 @@ function getChangesByType(projectPath, changeType, subDir) {
|
|
|
224
211
|
}
|
|
225
212
|
const changeFiles = fileNames
|
|
226
213
|
.map((fileName) => {
|
|
227
|
-
const filePath =
|
|
228
|
-
const fileContent =
|
|
214
|
+
const filePath = path.resolve(targetDir, fileName);
|
|
215
|
+
const fileContent = readFileSync(filePath, 'utf-8');
|
|
229
216
|
const change = JSON.parse(fileContent);
|
|
230
217
|
return change;
|
|
231
218
|
})
|
|
@@ -245,22 +232,22 @@ function getChangesByType(projectPath, changeType, subDir) {
|
|
|
245
232
|
* @returns {InboundChangeData} An object containing the file path and the change object with the matching inbound ID.
|
|
246
233
|
* @throws {Error} Throws an error if the change file cannot be read or if there's an issue accessing the directory.
|
|
247
234
|
*/
|
|
248
|
-
async function findChangeWithInboundId(projectPath, inboundId, fs) {
|
|
235
|
+
export async function findChangeWithInboundId(projectPath, inboundId, fs) {
|
|
249
236
|
let changeObj;
|
|
250
237
|
let filePath = '';
|
|
251
|
-
const webappPath = await
|
|
252
|
-
const pathToInboundChangeFiles =
|
|
253
|
-
if (!
|
|
238
|
+
const webappPath = await getWebappPath(projectPath, fs);
|
|
239
|
+
const pathToInboundChangeFiles = path.join(webappPath, DirName.Changes);
|
|
240
|
+
if (!existsSync(pathToInboundChangeFiles)) {
|
|
254
241
|
return {
|
|
255
242
|
filePath,
|
|
256
243
|
changeWithInboundId: changeObj
|
|
257
244
|
};
|
|
258
245
|
}
|
|
259
246
|
try {
|
|
260
|
-
const files =
|
|
247
|
+
const files = readdirSync(pathToInboundChangeFiles, { withFileTypes: true }).filter((dirent) => dirent.isFile() && dirent.name.includes('changeInbound'));
|
|
261
248
|
for (const file of files) {
|
|
262
|
-
const pathToFile =
|
|
263
|
-
const change = JSON.parse(
|
|
249
|
+
const pathToFile = path.join(pathToInboundChangeFiles, file.name);
|
|
250
|
+
const change = JSON.parse(readFileSync(pathToFile, 'utf-8'));
|
|
264
251
|
if (change.content?.inboundId === inboundId) {
|
|
265
252
|
changeObj = change;
|
|
266
253
|
filePath = pathToFile;
|
|
@@ -285,15 +272,15 @@ async function findChangeWithInboundId(projectPath, inboundId, fs) {
|
|
|
285
272
|
* @param {ChangeType} changeType - The type of the change.
|
|
286
273
|
* @returns - An object representing the change
|
|
287
274
|
*/
|
|
288
|
-
function getChange({ id, layer, namespace }, timestamp, content, changeType) {
|
|
289
|
-
const changeName =
|
|
275
|
+
export function getChange({ id, layer, namespace }, timestamp, content, changeType) {
|
|
276
|
+
const changeName = ChangeTypeMap[changeType];
|
|
290
277
|
if (!changeName) {
|
|
291
278
|
throw new Error(`Could not extract the change name from the change type: ${changeType}`);
|
|
292
279
|
}
|
|
293
280
|
const fileName = `id_${timestamp}_${changeName}`;
|
|
294
281
|
return {
|
|
295
282
|
fileName,
|
|
296
|
-
namespace:
|
|
283
|
+
namespace: path.posix.join(namespace, DirName.Changes),
|
|
297
284
|
layer,
|
|
298
285
|
fileType: 'change',
|
|
299
286
|
creation: new Date(timestamp).toISOString(),
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.TRANSLATION_UUID_TEXT = '\n#__ldi.translation.uuid=';
|
|
14
|
-
exports.MAIN_I18N_PATH = 'i18n/i18n.properties';
|
|
15
|
-
exports.BASE_I18N_DESCRIPTION = '#Make sure you provide a unique prefix to the newly added keys in this file, to avoid overriding of SAP Fiori application keys.';
|
|
1
|
+
export const UI5_CDN_URL = 'https://ui5.sap.com';
|
|
2
|
+
export const UI5_VERSIONS_CDN_URL = 'https://sapui5.hana.ondemand.com/version.json';
|
|
3
|
+
export const UI5_VERSIONS_NEO_CDN_URL = 'https://ui5.sap.com/neo-app.json';
|
|
4
|
+
export const SNAPSHOT_CDN_URL = 'https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com:443';
|
|
5
|
+
export const CURRENT_SYSTEM_VERSION = '(system version)';
|
|
6
|
+
export const LATEST_VERSION = '(latest)';
|
|
7
|
+
export const SNAPSHOT_VERSION = 'snapshot';
|
|
8
|
+
export const SNAPSHOT_UNTESTED_VERSION = 'snapshot-untested';
|
|
9
|
+
export const RESOURCE_BUNDLE_TEXT = '\n\n# This is the resource bundle for ';
|
|
10
|
+
export const TRANSLATION_UUID_TEXT = '\n#__ldi.translation.uuid=';
|
|
11
|
+
export const MAIN_I18N_PATH = 'i18n/i18n.properties';
|
|
12
|
+
export const BASE_I18N_DESCRIPTION = '#Make sure you provide a unique prefix to the newly added keys in this file, to avoid overriding of SAP Fiori application keys.';
|
|
16
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SystemLookup } from '../source';
|
|
1
|
+
import type { SystemLookup } from '../source/index.js';
|
|
2
2
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
|
-
import type { ConfigAnswers } from '../types';
|
|
3
|
+
import type { ConfigAnswers } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Stores system credentials securely using the @sap-ux/store service.
|
|
6
6
|
* Only stores credentials for ABAP environments when all required fields are provided.
|
package/dist/base/credentials.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storeCredentials = storeCredentials;
|
|
4
|
-
const store_1 = require("@sap-ux/store");
|
|
1
|
+
import { getService, BackendSystem, BackendSystemKey, SystemType } from '@sap-ux/store';
|
|
5
2
|
/**
|
|
6
3
|
* Stores system credentials securely using the @sap-ux/store service.
|
|
7
4
|
* Only stores credentials for ABAP environments when all required fields are provided.
|
|
@@ -11,7 +8,7 @@ const store_1 = require("@sap-ux/store");
|
|
|
11
8
|
* @param {ToolsLogger} logger - Logger for informational and warning messages
|
|
12
9
|
* @returns {Promise<void>} Promise that resolves when credentials are stored or operation completes
|
|
13
10
|
*/
|
|
14
|
-
async function storeCredentials(configAnswers, systemLookup, logger) {
|
|
11
|
+
export async function storeCredentials(configAnswers, systemLookup, logger) {
|
|
15
12
|
if (!configAnswers.username || !configAnswers.password) {
|
|
16
13
|
return;
|
|
17
14
|
}
|
|
@@ -21,21 +18,21 @@ async function storeCredentials(configAnswers, systemLookup, logger) {
|
|
|
21
18
|
logger.warn('Cannot store credentials: system endpoint or URL not found.');
|
|
22
19
|
return;
|
|
23
20
|
}
|
|
24
|
-
const systemService = await
|
|
21
|
+
const systemService = await getService({
|
|
25
22
|
entityName: 'system'
|
|
26
23
|
});
|
|
27
|
-
const backendSystemKey = new
|
|
24
|
+
const backendSystemKey = new BackendSystemKey({
|
|
28
25
|
url: systemEndpoint.Url,
|
|
29
26
|
client: systemEndpoint.Client
|
|
30
27
|
});
|
|
31
28
|
const existingSystem = await systemService.read(backendSystemKey);
|
|
32
|
-
const backendSystem = new
|
|
29
|
+
const backendSystem = new BackendSystem({
|
|
33
30
|
name: configAnswers.system,
|
|
34
31
|
url: systemEndpoint.Url,
|
|
35
32
|
client: systemEndpoint.Client,
|
|
36
33
|
username: configAnswers.username,
|
|
37
34
|
password: configAnswers.password,
|
|
38
|
-
systemType: systemEndpoint.SystemType ||
|
|
35
|
+
systemType: systemEndpoint.SystemType || SystemType.AbapOnPrem,
|
|
39
36
|
connectionType: 'abap_catalog',
|
|
40
37
|
userDisplayName: configAnswers.username
|
|
41
38
|
});
|
package/dist/base/helper.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ToolsLogger } from '@sap-ux/logger';
|
|
|
4
4
|
import type { UI5Config } from '@sap-ux/ui5-config';
|
|
5
5
|
import { type Inbound, AdaptationProjectType } from '@sap-ux/axios-extension';
|
|
6
6
|
import { type ManifestNamespace, type Manifest } from '@sap-ux/project-access';
|
|
7
|
-
import type { DescriptorVariant, AdpPreviewConfig, UI5YamlCustomTaskConfiguration } from '../types';
|
|
7
|
+
import type { DescriptorVariant, AdpPreviewConfig, UI5YamlCustomTaskConfiguration } from '../types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Get the app descriptor variant.
|
|
10
10
|
*
|