@sap-ux/adp-tooling 0.13.20 → 0.13.22
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/base/constants/index.d.ts +19 -0
- package/dist/base/constants/index.js +22 -0
- package/dist/client/abap-provider.d.ts +38 -0
- package/dist/client/abap-provider.js +79 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +20 -0
- package/dist/client/target-applications.d.ts +31 -0
- package/dist/client/target-applications.js +75 -0
- package/dist/client/target-systems.d.ts +59 -0
- package/dist/client/target-systems.js +124 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -1
- package/dist/preview/routes-handler.js +17 -7
- package/dist/types.d.ts +34 -0
- package/dist/writer/changes/writers/annotations-writer.js +17 -7
- package/dist/writer/descriptor-content.d.ts +8 -0
- package/dist/writer/descriptor-content.js +20 -0
- package/dist/writer/project-utils.d.ts +14 -8
- package/dist/writer/project-utils.js +24 -1
- package/dist/writer/writer-config.d.ts +50 -0
- package/dist/writer/writer-config.js +42 -0
- package/package.json +6 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const S4HANA_APPS_PARAMS: {
|
|
2
|
+
'sap.app/type': string;
|
|
3
|
+
'sap.fiori/cloudDevAdaptationStatus': string;
|
|
4
|
+
fields: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const ABAP_APPS_PARAMS: {
|
|
7
|
+
fields: string;
|
|
8
|
+
'sap.ui/technology': string;
|
|
9
|
+
'sap.app/type': string;
|
|
10
|
+
fileType: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const ABAP_VARIANT_APPS_PARAMS: {
|
|
13
|
+
fields: string;
|
|
14
|
+
'sap.ui/technology': string;
|
|
15
|
+
'sap.app/type': string;
|
|
16
|
+
fileType: string;
|
|
17
|
+
originLayer: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ABAP_VARIANT_APPS_PARAMS = exports.ABAP_APPS_PARAMS = exports.S4HANA_APPS_PARAMS = void 0;
|
|
4
|
+
exports.S4HANA_APPS_PARAMS = {
|
|
5
|
+
'sap.app/type': 'application',
|
|
6
|
+
'sap.fiori/cloudDevAdaptationStatus': 'released',
|
|
7
|
+
'fields': 'sap.app/id,repoName,sap.fiori/cloudDevAdaptationStatus,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType'
|
|
8
|
+
};
|
|
9
|
+
exports.ABAP_APPS_PARAMS = {
|
|
10
|
+
'fields': 'sap.app/id,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType,repoName',
|
|
11
|
+
'sap.ui/technology': 'UI5',
|
|
12
|
+
'sap.app/type': 'application',
|
|
13
|
+
'fileType': 'appdescr'
|
|
14
|
+
};
|
|
15
|
+
exports.ABAP_VARIANT_APPS_PARAMS = {
|
|
16
|
+
'fields': 'sap.app/id,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType,repoName',
|
|
17
|
+
'sap.ui/technology': 'UI5',
|
|
18
|
+
'sap.app/type': 'application',
|
|
19
|
+
'fileType': 'appdescr_variant',
|
|
20
|
+
'originLayer': 'VENDOR'
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { AbapTarget } from '@sap-ux/ui5-config';
|
|
3
|
+
import type { AbapServiceProvider, AxiosRequestConfig, ProviderConfiguration } from '@sap-ux/axios-extension';
|
|
4
|
+
export type RequestOptions = AxiosRequestConfig & Partial<ProviderConfiguration>;
|
|
5
|
+
interface ProviderOptions {
|
|
6
|
+
system: string;
|
|
7
|
+
client?: string;
|
|
8
|
+
username?: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a fully configured ABAP service provider for the specified system.
|
|
13
|
+
*
|
|
14
|
+
* This function uses the provided system identifier (and optional client and credentials)
|
|
15
|
+
* to build an ABAP target configuration, which is then passed to createAbapServiceProvider.
|
|
16
|
+
*
|
|
17
|
+
* @param {ProviderOptions} options - Options for configuring the provider.
|
|
18
|
+
* @param {ToolsLogger} logger - The logger for logging errors and debug messages.
|
|
19
|
+
* @returns {Promise<AbapServiceProvider>} A promise that resolves to the configured ABAP service provider.
|
|
20
|
+
* @throws {Error} If provider instantiation fails.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getConfiguredProvider({ system, client, password, username }: ProviderOptions, logger: ToolsLogger): Promise<AbapServiceProvider>;
|
|
23
|
+
/**
|
|
24
|
+
* Determines the ABAP target configuration based on the running environment and system details.
|
|
25
|
+
*
|
|
26
|
+
* For an App Studio environment, the target is constructed with a destination property.
|
|
27
|
+
* For non-AppStudio environments, the function retrieves system details from the TargetSystems service,
|
|
28
|
+
* maps these details to an AbapTarget, and attaches authentication credentials to the request options if available.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} system - The system identifier (URL or system name).
|
|
31
|
+
* @param {ToolsLogger} logger - The logger for logging errors.
|
|
32
|
+
* @param {RequestOptions} [requestOptions] - Optional request options which will be updated with auth information if available.
|
|
33
|
+
* @param {string} [client] - Optional client number for systems with multiple clients.
|
|
34
|
+
* @returns {Promise<AbapTarget>} A promise that resolves to the configured ABAP target.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getAbapTarget(system: string, logger: ToolsLogger, requestOptions?: RequestOptions, client?: string): Promise<AbapTarget>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=abap-provider.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfiguredProvider = getConfiguredProvider;
|
|
4
|
+
exports.getAbapTarget = getAbapTarget;
|
|
5
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
6
|
+
const system_access_1 = require("@sap-ux/system-access");
|
|
7
|
+
const target_systems_1 = require("./target-systems");
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves a fully configured ABAP service provider for the specified system.
|
|
10
|
+
*
|
|
11
|
+
* This function uses the provided system identifier (and optional client and credentials)
|
|
12
|
+
* to build an ABAP target configuration, which is then passed to createAbapServiceProvider.
|
|
13
|
+
*
|
|
14
|
+
* @param {ProviderOptions} options - Options for configuring the provider.
|
|
15
|
+
* @param {ToolsLogger} logger - The logger for logging errors and debug messages.
|
|
16
|
+
* @returns {Promise<AbapServiceProvider>} A promise that resolves to the configured ABAP service provider.
|
|
17
|
+
* @throws {Error} If provider instantiation fails.
|
|
18
|
+
*/
|
|
19
|
+
async function getConfiguredProvider({ system, client, password, username }, logger) {
|
|
20
|
+
try {
|
|
21
|
+
const requestOptions = {
|
|
22
|
+
ignoreCertErrors: false
|
|
23
|
+
};
|
|
24
|
+
const target = await getAbapTarget(system, logger, requestOptions, client);
|
|
25
|
+
if (username && password) {
|
|
26
|
+
requestOptions.auth = { username, password };
|
|
27
|
+
}
|
|
28
|
+
return await (0, system_access_1.createAbapServiceProvider)(target, requestOptions, false, logger);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
logger?.error(`Failed to instantiate provider for system: ${system}. Reason: ${e.message}`);
|
|
32
|
+
throw new Error(e.message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Determines the ABAP target configuration based on the running environment and system details.
|
|
37
|
+
*
|
|
38
|
+
* For an App Studio environment, the target is constructed with a destination property.
|
|
39
|
+
* For non-AppStudio environments, the function retrieves system details from the TargetSystems service,
|
|
40
|
+
* maps these details to an AbapTarget, and attaches authentication credentials to the request options if available.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} system - The system identifier (URL or system name).
|
|
43
|
+
* @param {ToolsLogger} logger - The logger for logging errors.
|
|
44
|
+
* @param {RequestOptions} [requestOptions] - Optional request options which will be updated with auth information if available.
|
|
45
|
+
* @param {string} [client] - Optional client number for systems with multiple clients.
|
|
46
|
+
* @returns {Promise<AbapTarget>} A promise that resolves to the configured ABAP target.
|
|
47
|
+
*/
|
|
48
|
+
async function getAbapTarget(system, logger, requestOptions, client) {
|
|
49
|
+
let target;
|
|
50
|
+
const targetSystems = new target_systems_1.TargetSystems(logger);
|
|
51
|
+
if ((0, btp_utils_1.isAppStudio)()) {
|
|
52
|
+
target = {
|
|
53
|
+
destination: system
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const details = await targetSystems.getSystemByName(system);
|
|
58
|
+
if (!details) {
|
|
59
|
+
throw new Error(`No system details found for system: ${system}`);
|
|
60
|
+
}
|
|
61
|
+
target = {
|
|
62
|
+
client: details?.Client ?? client,
|
|
63
|
+
url: details?.Url
|
|
64
|
+
};
|
|
65
|
+
if (details?.Authentication) {
|
|
66
|
+
target.authenticationType = details?.Authentication;
|
|
67
|
+
}
|
|
68
|
+
const username = details?.Credentials?.username;
|
|
69
|
+
const password = details?.Credentials?.password;
|
|
70
|
+
if (requestOptions && username && password) {
|
|
71
|
+
requestOptions.auth = {
|
|
72
|
+
username,
|
|
73
|
+
password
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return target;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=abap-provider.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("./target-applications"), exports);
|
|
18
|
+
__exportStar(require("./target-systems"), exports);
|
|
19
|
+
__exportStar(require("./abap-provider"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AbapServiceProvider, App } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { TargetApplication } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
|
|
5
|
+
* This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
|
|
6
|
+
*
|
|
7
|
+
* @param {TargetApplication} appA - The first application to compare.
|
|
8
|
+
* @param {TargetApplication} appB - The second application to compare.
|
|
9
|
+
* @returns {number} A number indicating the sort order.
|
|
10
|
+
*/
|
|
11
|
+
export declare const filterApps: (appA: TargetApplication, appB: TargetApplication) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Transforms raw application data into a structured Application object.
|
|
14
|
+
* This function maps properties from a loosely typed app data structure to a strongly typed Application object.
|
|
15
|
+
*
|
|
16
|
+
* @param {Partial<App>} app - The raw application data, possibly incomplete.
|
|
17
|
+
* @returns {TargetApplication} A structured application object with defined properties, even if some may be empty.
|
|
18
|
+
*/
|
|
19
|
+
export declare const mapApps: (app: Partial<App>) => TargetApplication;
|
|
20
|
+
/**
|
|
21
|
+
* Loads and processes application data from the ABAP service provider.
|
|
22
|
+
*
|
|
23
|
+
* This function retrieves the application index from the provider and then searches for applications based on system type.
|
|
24
|
+
* If the system is not a cloud system and the base is customer-specific, additional variant applications are fetched and merged.
|
|
25
|
+
*
|
|
26
|
+
* @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
|
|
27
|
+
* @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
|
|
28
|
+
* @returns {Promise<TargetApplication[]>} A promise that resolves to a sorted list of applications.
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<TargetApplication[]>;
|
|
31
|
+
//# sourceMappingURL=target-applications.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapApps = exports.filterApps = void 0;
|
|
4
|
+
exports.loadApps = loadApps;
|
|
5
|
+
const constants_1 = require("../base/constants");
|
|
6
|
+
/**
|
|
7
|
+
* Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
|
|
8
|
+
* This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
|
|
9
|
+
*
|
|
10
|
+
* @param {TargetApplication} appA - The first application to compare.
|
|
11
|
+
* @param {TargetApplication} appB - The second application to compare.
|
|
12
|
+
* @returns {number} A number indicating the sort order.
|
|
13
|
+
*/
|
|
14
|
+
const filterApps = (appA, appB) => {
|
|
15
|
+
let titleA = appA.title.toUpperCase();
|
|
16
|
+
let titleB = appB.title.toUpperCase();
|
|
17
|
+
if (!titleA.trim()) {
|
|
18
|
+
titleA = appA.id.toUpperCase();
|
|
19
|
+
}
|
|
20
|
+
if (!titleB.trim()) {
|
|
21
|
+
titleB = appB.id.toUpperCase();
|
|
22
|
+
}
|
|
23
|
+
if (titleA < titleB) {
|
|
24
|
+
return -1;
|
|
25
|
+
}
|
|
26
|
+
if (titleA > titleB) {
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
return 0;
|
|
30
|
+
};
|
|
31
|
+
exports.filterApps = filterApps;
|
|
32
|
+
/**
|
|
33
|
+
* Transforms raw application data into a structured Application object.
|
|
34
|
+
* This function maps properties from a loosely typed app data structure to a strongly typed Application object.
|
|
35
|
+
*
|
|
36
|
+
* @param {Partial<App>} app - The raw application data, possibly incomplete.
|
|
37
|
+
* @returns {TargetApplication} A structured application object with defined properties, even if some may be empty.
|
|
38
|
+
*/
|
|
39
|
+
const mapApps = (app) => ({
|
|
40
|
+
id: app['sap.app/id'] ?? '',
|
|
41
|
+
title: app['sap.app/title'] ?? '',
|
|
42
|
+
ach: app['sap.app/ach'] ?? '',
|
|
43
|
+
registrationIds: app['sap.fiori/registrationIds'] ?? [],
|
|
44
|
+
fileType: app['fileType'] ?? '',
|
|
45
|
+
bspUrl: app['url'] ?? '',
|
|
46
|
+
bspName: app['repoName'] ?? ''
|
|
47
|
+
});
|
|
48
|
+
exports.mapApps = mapApps;
|
|
49
|
+
/**
|
|
50
|
+
* Loads and processes application data from the ABAP service provider.
|
|
51
|
+
*
|
|
52
|
+
* This function retrieves the application index from the provider and then searches for applications based on system type.
|
|
53
|
+
* If the system is not a cloud system and the base is customer-specific, additional variant applications are fetched and merged.
|
|
54
|
+
*
|
|
55
|
+
* @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
|
|
56
|
+
* @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
|
|
57
|
+
* @returns {Promise<TargetApplication[]>} A promise that resolves to a sorted list of applications.
|
|
58
|
+
*/
|
|
59
|
+
async function loadApps(provider, isCustomerBase) {
|
|
60
|
+
let result = [];
|
|
61
|
+
try {
|
|
62
|
+
const isCloudSystem = await provider.isAbapCloud();
|
|
63
|
+
const appIndex = provider.getAppIndex();
|
|
64
|
+
result = await appIndex.search(isCloudSystem ? constants_1.S4HANA_APPS_PARAMS : constants_1.ABAP_APPS_PARAMS);
|
|
65
|
+
if (!isCloudSystem && isCustomerBase) {
|
|
66
|
+
const extraApps = await appIndex.search(constants_1.ABAP_VARIANT_APPS_PARAMS);
|
|
67
|
+
result = result.concat(extraApps);
|
|
68
|
+
}
|
|
69
|
+
return result.map(exports.mapApps).sort(exports.filterApps);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
throw new Error(`Could not load applications: ${e.message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=target-applications.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { BackendSystem } from '@sap-ux/store';
|
|
3
|
+
import type { Endpoint } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves the names of all stored systems, sorted alphabetically.
|
|
6
|
+
*
|
|
7
|
+
* @param {Endpoint[]} systems - Array of system systems.
|
|
8
|
+
* @returns {string[]} An array of endpoint names as strings in sorted order.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getEndpointNames(systems: Endpoint[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Transforms a BackendSystem object into an object matching the legacy Endpoint interface.
|
|
13
|
+
*
|
|
14
|
+
* @param {BackendSystem} system - The backend system to transform.
|
|
15
|
+
* @returns {Endpoint} The transformed endpoint object.
|
|
16
|
+
*/
|
|
17
|
+
export declare const transformBackendSystem: (system: BackendSystem) => Endpoint;
|
|
18
|
+
/**
|
|
19
|
+
* Service class to manage and retrieve information about system systems,
|
|
20
|
+
* including their names, authentication requirements, and specific details.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TargetSystems {
|
|
23
|
+
private readonly logger;
|
|
24
|
+
private systems;
|
|
25
|
+
/**
|
|
26
|
+
* Creates an instance of EndpointsManager.
|
|
27
|
+
*
|
|
28
|
+
* @param {ToolsLogger} logger - The logger.
|
|
29
|
+
*/
|
|
30
|
+
constructor(logger: ToolsLogger);
|
|
31
|
+
/**
|
|
32
|
+
* Returns the stored systems.
|
|
33
|
+
*
|
|
34
|
+
* @returns {Promise<Endpoint[]>} An array of system systems.
|
|
35
|
+
*/
|
|
36
|
+
getSystems(): Promise<Endpoint[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Loads systems from either BAS (via destinations) or from the backend system store.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Promise<Endpoint[]>} A promise that resolves with an array of endpoints.
|
|
41
|
+
* @throws {Error} If fetching the systems fails.
|
|
42
|
+
*/
|
|
43
|
+
private loadSystems;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves a particular system by its name.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} name - The system name or URL.
|
|
48
|
+
* @returns {Promise<Endpoint | undefined>} System details including client, url, and credentials, or undefined if not found.
|
|
49
|
+
*/
|
|
50
|
+
getSystemByName(name: string): Promise<Endpoint | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* Determines whether a system requires authentication based on environment.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} system - The system name or URL.
|
|
55
|
+
* @returns {Promise<boolean>} A promise that resolves to true if authentication is required, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
getSystemRequiresAuth(system: string): Promise<boolean>;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=target-systems.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TargetSystems = exports.transformBackendSystem = void 0;
|
|
4
|
+
exports.getEndpointNames = getEndpointNames;
|
|
5
|
+
const store_1 = require("@sap-ux/store");
|
|
6
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the names of all stored systems, sorted alphabetically.
|
|
9
|
+
*
|
|
10
|
+
* @param {Endpoint[]} systems - Array of system systems.
|
|
11
|
+
* @returns {string[]} An array of endpoint names as strings in sorted order.
|
|
12
|
+
*/
|
|
13
|
+
function getEndpointNames(systems) {
|
|
14
|
+
return systems
|
|
15
|
+
.map((endpoint) => endpoint.Name)
|
|
16
|
+
.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase(), 'en', { sensitivity: 'base' }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Transforms a BackendSystem object into an object matching the legacy Endpoint interface.
|
|
20
|
+
*
|
|
21
|
+
* @param {BackendSystem} system - The backend system to transform.
|
|
22
|
+
* @returns {Endpoint} The transformed endpoint object.
|
|
23
|
+
*/
|
|
24
|
+
const transformBackendSystem = (system) => ({
|
|
25
|
+
Name: system.name,
|
|
26
|
+
Url: system.url,
|
|
27
|
+
Client: system.client,
|
|
28
|
+
UserDisplayName: system.userDisplayName,
|
|
29
|
+
Scp: !!system.serviceKeys,
|
|
30
|
+
Authentication: system.authenticationType,
|
|
31
|
+
Credentials: {
|
|
32
|
+
username: system.username,
|
|
33
|
+
password: system.password
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
exports.transformBackendSystem = transformBackendSystem;
|
|
37
|
+
/**
|
|
38
|
+
* Service class to manage and retrieve information about system systems,
|
|
39
|
+
* including their names, authentication requirements, and specific details.
|
|
40
|
+
*/
|
|
41
|
+
class TargetSystems {
|
|
42
|
+
logger;
|
|
43
|
+
systems;
|
|
44
|
+
/**
|
|
45
|
+
* Creates an instance of EndpointsManager.
|
|
46
|
+
*
|
|
47
|
+
* @param {ToolsLogger} logger - The logger.
|
|
48
|
+
*/
|
|
49
|
+
constructor(logger) {
|
|
50
|
+
this.logger = logger;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the stored systems.
|
|
54
|
+
*
|
|
55
|
+
* @returns {Promise<Endpoint[]>} An array of system systems.
|
|
56
|
+
*/
|
|
57
|
+
async getSystems() {
|
|
58
|
+
if (!this.systems) {
|
|
59
|
+
this.systems = await this.loadSystems();
|
|
60
|
+
}
|
|
61
|
+
return this.systems;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Loads systems from either BAS (via destinations) or from the backend system store.
|
|
65
|
+
*
|
|
66
|
+
* @returns {Promise<Endpoint[]>} A promise that resolves with an array of endpoints.
|
|
67
|
+
* @throws {Error} If fetching the systems fails.
|
|
68
|
+
*/
|
|
69
|
+
async loadSystems() {
|
|
70
|
+
try {
|
|
71
|
+
let endpoints = [];
|
|
72
|
+
if ((0, btp_utils_1.isAppStudio)()) {
|
|
73
|
+
const destinations = await (0, btp_utils_1.listDestinations)({
|
|
74
|
+
stripS4HCApiHosts: true
|
|
75
|
+
});
|
|
76
|
+
endpoints = Object.values(destinations).filter((dest) => dest.WebIDEUsage?.includes('dev_abap'));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const systemStore = await (0, store_1.getService)({
|
|
80
|
+
entityName: 'system'
|
|
81
|
+
});
|
|
82
|
+
const backendSystems = await systemStore?.getAll();
|
|
83
|
+
endpoints = backendSystems.map(exports.transformBackendSystem);
|
|
84
|
+
}
|
|
85
|
+
return endpoints;
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
this.logger?.error(`Failed to fetch systems list. Reason: ${e.message}`);
|
|
89
|
+
throw new Error(e.message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves a particular system by its name.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} name - The system name or URL.
|
|
96
|
+
* @returns {Promise<Endpoint | undefined>} System details including client, url, and credentials, or undefined if not found.
|
|
97
|
+
*/
|
|
98
|
+
async getSystemByName(name) {
|
|
99
|
+
const systems = await this.getSystems();
|
|
100
|
+
const system = systems.find((e) => e.Name === name || e.Url === name);
|
|
101
|
+
if (!system) {
|
|
102
|
+
this.logger.warn(`No endpoint found for system: ${name}`);
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
return system;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Determines whether a system requires authentication based on environment.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} system - The system name or URL.
|
|
111
|
+
* @returns {Promise<boolean>} A promise that resolves to true if authentication is required, false otherwise.
|
|
112
|
+
*/
|
|
113
|
+
async getSystemRequiresAuth(system) {
|
|
114
|
+
const found = await this.getSystemByName(system);
|
|
115
|
+
if ((0, btp_utils_1.isAppStudio)()) {
|
|
116
|
+
return found?.Authentication === 'NoAuthentication';
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return !found;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.TargetSystems = TargetSystems;
|
|
124
|
+
//# sourceMappingURL=target-systems.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,14 @@ export * from './types';
|
|
|
2
2
|
export * from './prompts';
|
|
3
3
|
export * from './common';
|
|
4
4
|
export * from './base/cf';
|
|
5
|
+
export * from './base/constants';
|
|
5
6
|
export * from './base/project-builder';
|
|
6
7
|
export * from './base/abap/manifest-service';
|
|
7
8
|
export * from './base/helper';
|
|
9
|
+
export * from './client';
|
|
8
10
|
export * from './preview/adp-preview';
|
|
11
|
+
export * from './writer/writer-config';
|
|
12
|
+
export { getCustomConfig } from './writer/project-utils';
|
|
9
13
|
export { generate, migrate } from './writer';
|
|
10
14
|
export { generateChange } from './writer/editors';
|
|
11
15
|
export { generateInboundConfig } from './writer/inbound-navigation';
|
package/dist/index.js
CHANGED
|
@@ -14,15 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.promptGeneratorInput = exports.generateInboundConfig = exports.generateChange = exports.migrate = exports.generate = void 0;
|
|
17
|
+
exports.promptGeneratorInput = exports.generateInboundConfig = exports.generateChange = exports.migrate = exports.generate = exports.getCustomConfig = void 0;
|
|
18
18
|
__exportStar(require("./types"), exports);
|
|
19
19
|
__exportStar(require("./prompts"), exports);
|
|
20
20
|
__exportStar(require("./common"), exports);
|
|
21
21
|
__exportStar(require("./base/cf"), exports);
|
|
22
|
+
__exportStar(require("./base/constants"), exports);
|
|
22
23
|
__exportStar(require("./base/project-builder"), exports);
|
|
23
24
|
__exportStar(require("./base/abap/manifest-service"), exports);
|
|
24
25
|
__exportStar(require("./base/helper"), exports);
|
|
26
|
+
__exportStar(require("./client"), exports);
|
|
25
27
|
__exportStar(require("./preview/adp-preview"), exports);
|
|
28
|
+
__exportStar(require("./writer/writer-config"), exports);
|
|
29
|
+
var project_utils_1 = require("./writer/project-utils");
|
|
30
|
+
Object.defineProperty(exports, "getCustomConfig", { enumerable: true, get: function () { return project_utils_1.getCustomConfig; } });
|
|
26
31
|
var writer_1 = require("./writer");
|
|
27
32
|
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return writer_1.generate; } });
|
|
28
33
|
Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return writer_1.migrate; } });
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { DestinationAbapTarget, UrlAbapTarget } from '@sap-ux/system-access
|
|
|
3
3
|
import type { Adp, BspApp } from '@sap-ux/ui5-config';
|
|
4
4
|
import type { OperationsType } from '@sap-ux/axios-extension';
|
|
5
5
|
import type { Editor } from 'mem-fs-editor';
|
|
6
|
+
import type { Destination } from '@sap-ux/btp-utils';
|
|
6
7
|
export interface DescriptorVariant {
|
|
7
8
|
layer: UI5FlexLayer;
|
|
8
9
|
reference: string;
|
|
@@ -10,6 +11,10 @@ export interface DescriptorVariant {
|
|
|
10
11
|
namespace: string;
|
|
11
12
|
content: DescriptorVariantContent[];
|
|
12
13
|
}
|
|
14
|
+
export type PackageJson = {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
};
|
|
13
18
|
export interface DescriptorVariantContent {
|
|
14
19
|
changeType: string;
|
|
15
20
|
content: Record<string, unknown>;
|
|
@@ -82,6 +87,35 @@ export interface AdpWriterConfig {
|
|
|
82
87
|
enableTypeScript?: boolean;
|
|
83
88
|
};
|
|
84
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Interface representing the answers collected from the configuration prompts of Adaptation Project generator.
|
|
92
|
+
*/
|
|
93
|
+
export interface ConfigAnswers {
|
|
94
|
+
system: string;
|
|
95
|
+
username: string;
|
|
96
|
+
password: string;
|
|
97
|
+
application: TargetApplication;
|
|
98
|
+
}
|
|
99
|
+
export interface TargetApplication {
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
ach: string;
|
|
103
|
+
registrationIds: string[];
|
|
104
|
+
fileType: string;
|
|
105
|
+
bspUrl: string;
|
|
106
|
+
bspName: string;
|
|
107
|
+
}
|
|
108
|
+
export interface Endpoint extends Partial<Destination> {
|
|
109
|
+
Name: string;
|
|
110
|
+
Url?: string;
|
|
111
|
+
Client?: string;
|
|
112
|
+
Credentials?: {
|
|
113
|
+
username?: string;
|
|
114
|
+
password?: string;
|
|
115
|
+
};
|
|
116
|
+
UserDisplayName?: string;
|
|
117
|
+
Scp?: boolean;
|
|
118
|
+
}
|
|
85
119
|
export interface ChangeInboundNavigation {
|
|
86
120
|
/** Identifier for the inbound navigation. */
|
|
87
121
|
inboundId: string;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.AnnotationsWriter = void 0;
|
|
27
37
|
const path_1 = __importStar(require("path"));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Content } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a model enhancement change configuration.
|
|
4
|
+
*
|
|
5
|
+
* @returns {Content} The model change configuration.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getNewModelEnhanceWithChange(): Content;
|
|
8
|
+
//# sourceMappingURL=descriptor-content.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNewModelEnhanceWithChange = getNewModelEnhanceWithChange;
|
|
4
|
+
/**
|
|
5
|
+
* Returns a model enhancement change configuration.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Content} The model change configuration.
|
|
8
|
+
*/
|
|
9
|
+
function getNewModelEnhanceWithChange() {
|
|
10
|
+
return {
|
|
11
|
+
changeType: 'appdescr_ui5_addNewModelEnhanceWith',
|
|
12
|
+
content: {
|
|
13
|
+
modelId: 'i18n',
|
|
14
|
+
bundleUrl: 'i18n/i18n.properties',
|
|
15
|
+
supportedLocales: [''],
|
|
16
|
+
fallbackLocale: ''
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=descriptor-content.js.map
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { AdpWriterConfig } from '../types';
|
|
3
|
-
type
|
|
4
|
-
name: string;
|
|
5
|
-
version: string;
|
|
6
|
-
};
|
|
2
|
+
import type { AdpWriterConfig, CustomConfig, PackageJson } from '../types';
|
|
3
|
+
import type { OperationsType } from '@sap-ux/axios-extension';
|
|
7
4
|
/**
|
|
8
5
|
* Retrieves the package name and version from the package.json file located two levels up the directory tree.
|
|
9
6
|
*
|
|
10
|
-
* @returns {
|
|
7
|
+
* @returns {PackageJson} An object containing the `name` and `version` of the package.
|
|
11
8
|
*/
|
|
12
|
-
export declare function getPackageJSONInfo():
|
|
9
|
+
export declare function getPackageJSONInfo(): PackageJson;
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a custom configuration object for the Adaptation Project (ADP).
|
|
12
|
+
*
|
|
13
|
+
* @param {OperationsType} environment - The operations type ('P' for on-premise or 'C' for cloud ready).
|
|
14
|
+
* @param {object} pkg - The parsed contents of `package.json`.
|
|
15
|
+
* @param {string} pkg.name - The name of the tool or package generating the config.
|
|
16
|
+
* @param {string} pkg.version - The version of the tool generating the config.
|
|
17
|
+
* @returns {CustomConfig} The generated ADP custom configuration object.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCustomConfig(environment: OperationsType, { name: id, version }: PackageJson): CustomConfig;
|
|
13
20
|
/**
|
|
14
21
|
* Writes a given project template files within a specified folder in the project directory.
|
|
15
22
|
*
|
|
@@ -38,5 +45,4 @@ export declare function writeUI5Yaml(projectPath: string, data: AdpWriterConfig,
|
|
|
38
45
|
* @returns {void}
|
|
39
46
|
*/
|
|
40
47
|
export declare function writeUI5DeployYaml(projectPath: string, data: AdpWriterConfig, fs: Editor): Promise<void>;
|
|
41
|
-
export {};
|
|
42
48
|
//# sourceMappingURL=project-utils.d.ts.map
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPackageJSONInfo = getPackageJSONInfo;
|
|
4
|
+
exports.getCustomConfig = getCustomConfig;
|
|
4
5
|
exports.writeTemplateToFolder = writeTemplateToFolder;
|
|
5
6
|
exports.writeUI5Yaml = writeUI5Yaml;
|
|
6
7
|
exports.writeUI5DeployYaml = writeUI5DeployYaml;
|
|
7
8
|
const path_1 = require("path");
|
|
8
9
|
const fs_1 = require("fs");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
9
11
|
const options_1 = require("./options");
|
|
10
12
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
11
13
|
/**
|
|
12
14
|
* Retrieves the package name and version from the package.json file located two levels up the directory tree.
|
|
13
15
|
*
|
|
14
|
-
* @returns {
|
|
16
|
+
* @returns {PackageJson} An object containing the `name` and `version` of the package.
|
|
15
17
|
*/
|
|
16
18
|
function getPackageJSONInfo() {
|
|
17
19
|
const defaultPackage = {
|
|
@@ -25,6 +27,27 @@ function getPackageJSONInfo() {
|
|
|
25
27
|
return defaultPackage;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Constructs a custom configuration object for the Adaptation Project (ADP).
|
|
32
|
+
*
|
|
33
|
+
* @param {OperationsType} environment - The operations type ('P' for on-premise or 'C' for cloud ready).
|
|
34
|
+
* @param {object} pkg - The parsed contents of `package.json`.
|
|
35
|
+
* @param {string} pkg.name - The name of the tool or package generating the config.
|
|
36
|
+
* @param {string} pkg.version - The version of the tool generating the config.
|
|
37
|
+
* @returns {CustomConfig} The generated ADP custom configuration object.
|
|
38
|
+
*/
|
|
39
|
+
function getCustomConfig(environment, { name: id, version }) {
|
|
40
|
+
return {
|
|
41
|
+
adp: {
|
|
42
|
+
environment,
|
|
43
|
+
support: {
|
|
44
|
+
id,
|
|
45
|
+
version,
|
|
46
|
+
toolsId: (0, uuid_1.v4)()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
28
51
|
/**
|
|
29
52
|
* Writes a given project template files within a specified folder in the project directory.
|
|
30
53
|
*
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
3
|
+
import type { AdpWriterConfig, ConfigAnswers, FlexLayer, PackageJson } from '../types';
|
|
4
|
+
interface ConfigOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The ABAP service provider instance used to retrieve system-specific information.
|
|
7
|
+
*/
|
|
8
|
+
provider: AbapServiceProvider;
|
|
9
|
+
/**
|
|
10
|
+
* User-provided configuration details, including system and application data.
|
|
11
|
+
*/
|
|
12
|
+
configAnswers: ConfigAnswers;
|
|
13
|
+
/**
|
|
14
|
+
* The FlexLayer indicating the deployment layer (e.g., CUSTOMER_BASE or VENDOR).
|
|
15
|
+
*/
|
|
16
|
+
layer: FlexLayer;
|
|
17
|
+
/**
|
|
18
|
+
* Default project parameters.
|
|
19
|
+
*/
|
|
20
|
+
defaults: {
|
|
21
|
+
/**
|
|
22
|
+
* The default namespace for the project.
|
|
23
|
+
*/
|
|
24
|
+
namespace: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The package.json information used to generate custom configuration.
|
|
28
|
+
*/
|
|
29
|
+
packageJson: PackageJson;
|
|
30
|
+
/**
|
|
31
|
+
* Logger instance for debugging and error reporting.
|
|
32
|
+
*/
|
|
33
|
+
logger: ToolsLogger;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generates the configuration object for the Adaptation Project.
|
|
37
|
+
*
|
|
38
|
+
* @param {ConfigOptions} options - The configuration options.
|
|
39
|
+
* @param {AbapServiceProvider} options.provider - The ABAP service provider instance.
|
|
40
|
+
* @param {ConfigAnswers} options.configAnswers - User-provided configuration details (system, application, etc.).
|
|
41
|
+
* @param {FlexLayer} options.layer - The FlexLayer indicating the deployment layer.
|
|
42
|
+
* @param {object} options.defaults - Default project parameters.
|
|
43
|
+
* @param {string} options.defaults.namespace - The default namespace to be used.
|
|
44
|
+
* @param {PackageJson} options.packageJson - The package.json information for generating custom configuration.
|
|
45
|
+
* @param {ToolsLogger} options.logger - The logger for debugging and error logging.
|
|
46
|
+
* @returns {Promise<AdpWriterConfig>} A promise that resolves to the generated ADP writer configuration.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getConfig(options: ConfigOptions): Promise<AdpWriterConfig>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=writer-config.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfig = getConfig;
|
|
4
|
+
const client_1 = require("../client");
|
|
5
|
+
const project_utils_1 = require("./project-utils");
|
|
6
|
+
const descriptor_content_1 = require("./descriptor-content");
|
|
7
|
+
/**
|
|
8
|
+
* Generates the configuration object for the Adaptation Project.
|
|
9
|
+
*
|
|
10
|
+
* @param {ConfigOptions} options - The configuration options.
|
|
11
|
+
* @param {AbapServiceProvider} options.provider - The ABAP service provider instance.
|
|
12
|
+
* @param {ConfigAnswers} options.configAnswers - User-provided configuration details (system, application, etc.).
|
|
13
|
+
* @param {FlexLayer} options.layer - The FlexLayer indicating the deployment layer.
|
|
14
|
+
* @param {object} options.defaults - Default project parameters.
|
|
15
|
+
* @param {string} options.defaults.namespace - The default namespace to be used.
|
|
16
|
+
* @param {PackageJson} options.packageJson - The package.json information for generating custom configuration.
|
|
17
|
+
* @param {ToolsLogger} options.logger - The logger for debugging and error logging.
|
|
18
|
+
* @returns {Promise<AdpWriterConfig>} A promise that resolves to the generated ADP writer configuration.
|
|
19
|
+
*/
|
|
20
|
+
async function getConfig(options) {
|
|
21
|
+
const { configAnswers, defaults, layer, logger, packageJson, provider } = options;
|
|
22
|
+
const ato = await provider.getAtoInfo();
|
|
23
|
+
const operationsType = ato.operationsType ?? 'P';
|
|
24
|
+
const target = await (0, client_1.getAbapTarget)(configAnswers.system, logger);
|
|
25
|
+
const customConfig = (0, project_utils_1.getCustomConfig)(operationsType, packageJson);
|
|
26
|
+
return {
|
|
27
|
+
app: {
|
|
28
|
+
id: defaults.namespace,
|
|
29
|
+
reference: configAnswers.application.id,
|
|
30
|
+
layer,
|
|
31
|
+
title: '',
|
|
32
|
+
content: [(0, descriptor_content_1.getNewModelEnhanceWithChange)()]
|
|
33
|
+
},
|
|
34
|
+
customConfig,
|
|
35
|
+
target,
|
|
36
|
+
options: {
|
|
37
|
+
fioriTools: true,
|
|
38
|
+
enableTypeScript: false
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=writer-config.js.map
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.13.
|
|
12
|
+
"version": "0.13.22",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -32,17 +32,18 @@
|
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
33
|
"sanitize-filename": "1.6.3",
|
|
34
34
|
"uuid": "10.0.0",
|
|
35
|
-
"@sap-ux/axios-extension": "1.19.
|
|
35
|
+
"@sap-ux/axios-extension": "1.19.2",
|
|
36
36
|
"@sap-ux/btp-utils": "1.0.2",
|
|
37
|
-
"@sap-ux/inquirer-common": "0.6.
|
|
37
|
+
"@sap-ux/inquirer-common": "0.6.32",
|
|
38
38
|
"@sap-ux/logger": "0.6.0",
|
|
39
39
|
"@sap-ux/project-access": "1.29.18",
|
|
40
40
|
"@sap-ux/project-input-validator": "0.5.0",
|
|
41
|
-
"@sap-ux/system-access": "0.5.
|
|
41
|
+
"@sap-ux/system-access": "0.5.34",
|
|
42
42
|
"@sap-ux/ui5-config": "0.26.5",
|
|
43
43
|
"@sap-ux/odata-service-writer": "0.26.13",
|
|
44
44
|
"@sap-ux/nodejs-utils": "0.1.8",
|
|
45
|
-
"@sap-ux/i18n": "0.2.3"
|
|
45
|
+
"@sap-ux/i18n": "0.2.3",
|
|
46
|
+
"@sap-ux/store": "1.0.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@types/adm-zip": "0.5.5",
|