@sap-ux/adp-tooling 0.13.21 → 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/client/abap-provider.d.ts +32 -47
- package/dist/client/abap-provider.js +63 -90
- package/dist/client/target-applications.d.ts +10 -35
- package/dist/client/target-applications.js +22 -59
- package/dist/preview/routes-handler.js +17 -7
- package/dist/types.d.ts +4 -0
- package/dist/writer/changes/writers/annotations-writer.js +17 -7
- package/dist/writer/project-utils.d.ts +10 -12
- package/dist/writer/project-utils.js +8 -6
- package/dist/writer/writer-config.d.ts +43 -21
- package/dist/writer/writer-config.js +34 -46
- package/package.json +1 -1
|
@@ -1,53 +1,38 @@
|
|
|
1
|
-
import type { AbapTarget } from '@sap-ux/ui5-config';
|
|
2
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { AbapTarget } from '@sap-ux/ui5-config';
|
|
3
3
|
import type { AbapServiceProvider, AxiosRequestConfig, ProviderConfiguration } from '@sap-ux/axios-extension';
|
|
4
|
-
import type { TargetSystems } from './target-systems';
|
|
5
4
|
export type RequestOptions = AxiosRequestConfig & Partial<ProviderConfiguration>;
|
|
5
|
+
interface ProviderOptions {
|
|
6
|
+
system: string;
|
|
7
|
+
client?: string;
|
|
8
|
+
username?: string;
|
|
9
|
+
password?: string;
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
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.
|
|
8
21
|
*/
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
getProvider(): AbapServiceProvider;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves ABAP service provider connected ABAP system.
|
|
29
|
-
*
|
|
30
|
-
* @returns {string | undefined} - the connected system.
|
|
31
|
-
*/
|
|
32
|
-
getSystem(): string | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Configures the ABAP service provider using the specified system details and credentials.
|
|
35
|
-
*
|
|
36
|
-
* @param {string} system - The system identifier.
|
|
37
|
-
* @param {string} [client] - The client, if applicable.
|
|
38
|
-
* @param {string} [username] - The username for authentication.
|
|
39
|
-
* @param {string} [password] - The password for authentication.
|
|
40
|
-
*/
|
|
41
|
-
setProvider(system: string, client?: string, username?: string, password?: string): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Determines the target configuration for the ABAP service provider based on whether the application
|
|
44
|
-
* is running within SAP App Studio or outside of it.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} system - The system identifier, which could be a URL or a system name.
|
|
47
|
-
* @param {RequestOptions} requestOptions - The request options to be configured during this setup.
|
|
48
|
-
* @param {string} [client] - Optional client number, used in systems where multiple clients exist.
|
|
49
|
-
* @returns {Promise<AbapTarget>} - The configuration object for the ABAP service provider, tailored based on the running environment.
|
|
50
|
-
*/
|
|
51
|
-
determineTarget(system: string, requestOptions: RequestOptions, client?: string): Promise<AbapTarget>;
|
|
52
|
-
}
|
|
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 {};
|
|
53
38
|
//# sourceMappingURL=abap-provider.d.ts.map
|
|
@@ -1,106 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getConfiguredProvider = getConfiguredProvider;
|
|
4
|
+
exports.getAbapTarget = getAbapTarget;
|
|
4
5
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
6
|
const system_access_1 = require("@sap-ux/system-access");
|
|
7
|
+
const target_systems_1 = require("./target-systems");
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
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.
|
|
8
18
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param {TargetSystems} targetSystems - The endpoints service for retrieving system details.
|
|
18
|
-
* @param {ToolsLogger} [logger] - The logger.
|
|
19
|
-
*/
|
|
20
|
-
constructor(targetSystems, logger) {
|
|
21
|
-
this.targetSystems = targetSystems;
|
|
22
|
-
this.logger = logger;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves the configured ABAP service provider if set, otherwise throws an error.
|
|
26
|
-
*
|
|
27
|
-
* @returns {AbapServiceProvider} - The configured ABAP service provider.
|
|
28
|
-
*/
|
|
29
|
-
getProvider() {
|
|
30
|
-
if (!this.provider) {
|
|
31
|
-
throw new Error('Provider was not set!');
|
|
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 };
|
|
32
27
|
}
|
|
33
|
-
return
|
|
28
|
+
return await (0, system_access_1.createAbapServiceProvider)(target, requestOptions, false, logger);
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @returns {string | undefined} - the connected system.
|
|
39
|
-
*/
|
|
40
|
-
getSystem() {
|
|
41
|
-
return this.system;
|
|
30
|
+
catch (e) {
|
|
31
|
+
logger?.error(`Failed to instantiate provider for system: ${system}. Reason: ${e.message}`);
|
|
32
|
+
throw new Error(e.message);
|
|
42
33
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.logger?.error(`Failed to instantiate provider for system: ${system}. Reason: ${e.message}`);
|
|
65
|
-
throw new Error(e.message);
|
|
66
|
-
}
|
|
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
|
+
};
|
|
67
55
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if ((0, btp_utils_1.isAppStudio)()) {
|
|
80
|
-
target = {
|
|
81
|
-
destination: system
|
|
82
|
-
};
|
|
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;
|
|
83
67
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
const username = details?.Credentials?.username;
|
|
69
|
+
const password = details?.Credentials?.password;
|
|
70
|
+
if (requestOptions && username && password) {
|
|
71
|
+
requestOptions.auth = {
|
|
72
|
+
username,
|
|
73
|
+
password
|
|
89
74
|
};
|
|
90
|
-
if (details?.Authentication) {
|
|
91
|
-
target.authenticationType = details?.Authentication;
|
|
92
|
-
}
|
|
93
|
-
const username = details?.Credentials?.username;
|
|
94
|
-
const password = details?.Credentials?.password;
|
|
95
|
-
if (username && password) {
|
|
96
|
-
requestOptions.auth = {
|
|
97
|
-
username,
|
|
98
|
-
password
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
75
|
}
|
|
102
|
-
return target;
|
|
103
76
|
}
|
|
77
|
+
return target;
|
|
104
78
|
}
|
|
105
|
-
exports.AbapProvider = AbapProvider;
|
|
106
79
|
//# sourceMappingURL=abap-provider.js.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { App } from '@sap-ux/axios-extension';
|
|
1
|
+
import type { AbapServiceProvider, App } from '@sap-ux/axios-extension';
|
|
3
2
|
import type { TargetApplication } from '../types';
|
|
4
|
-
import type { AbapProvider } from './abap-provider';
|
|
5
3
|
/**
|
|
6
4
|
* Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
|
|
7
5
|
* This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
|
|
@@ -20,37 +18,14 @@ export declare const filterApps: (appA: TargetApplication, appB: TargetApplicati
|
|
|
20
18
|
*/
|
|
21
19
|
export declare const mapApps: (app: Partial<App>) => TargetApplication;
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
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.
|
|
24
29
|
*/
|
|
25
|
-
export declare
|
|
26
|
-
private readonly abapProvider;
|
|
27
|
-
private readonly isCustomerBase;
|
|
28
|
-
private readonly logger?;
|
|
29
|
-
private applications;
|
|
30
|
-
/**
|
|
31
|
-
* Constructs an instance of ApplicationManager.
|
|
32
|
-
*
|
|
33
|
-
* @param {AbapProvider} abapProvider - The instance of AbapProvider class.
|
|
34
|
-
* @param {boolean} isCustomerBase - Indicates if the current base is a customer base, which affects how applications are loaded.
|
|
35
|
-
* @param {ToolsLogger} [logger] - The logger.
|
|
36
|
-
*/
|
|
37
|
-
constructor(abapProvider: AbapProvider, isCustomerBase: boolean, logger?: ToolsLogger | undefined);
|
|
38
|
-
/**
|
|
39
|
-
* Resets the current applications from the state.
|
|
40
|
-
*/
|
|
41
|
-
resetApps(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves the currently loaded list of applications.
|
|
44
|
-
*
|
|
45
|
-
* @returns {TargetApplication[]} An array of applications.
|
|
46
|
-
*/
|
|
47
|
-
getApps(): Promise<TargetApplication[]>;
|
|
48
|
-
/**
|
|
49
|
-
* Loads applications based on system type and user parameters, merging results from different app sources as needed.
|
|
50
|
-
*
|
|
51
|
-
* @returns {TargetApplication[]} list of applications.
|
|
52
|
-
* @throws {Error} Throws an error if the app data cannot be loaded.
|
|
53
|
-
*/
|
|
54
|
-
private loadApps;
|
|
55
|
-
}
|
|
30
|
+
export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<TargetApplication[]>;
|
|
56
31
|
//# sourceMappingURL=target-applications.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mapApps = exports.filterApps = void 0;
|
|
4
|
+
exports.loadApps = loadApps;
|
|
4
5
|
const constants_1 = require("../base/constants");
|
|
5
6
|
/**
|
|
6
7
|
* Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
|
|
@@ -46,67 +47,29 @@ const mapApps = (app) => ({
|
|
|
46
47
|
});
|
|
47
48
|
exports.mapApps = mapApps;
|
|
48
49
|
/**
|
|
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.
|
|
50
58
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
* @param {boolean} isCustomerBase - Indicates if the current base is a customer base, which affects how applications are loaded.
|
|
61
|
-
* @param {ToolsLogger} [logger] - The logger.
|
|
62
|
-
*/
|
|
63
|
-
constructor(abapProvider, isCustomerBase, logger) {
|
|
64
|
-
this.abapProvider = abapProvider;
|
|
65
|
-
this.isCustomerBase = isCustomerBase;
|
|
66
|
-
this.logger = logger;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Resets the current applications from the state.
|
|
70
|
-
*/
|
|
71
|
-
resetApps() {
|
|
72
|
-
this.applications = undefined;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Retrieves the currently loaded list of applications.
|
|
76
|
-
*
|
|
77
|
-
* @returns {TargetApplication[]} An array of applications.
|
|
78
|
-
*/
|
|
79
|
-
async getApps() {
|
|
80
|
-
if (!this.applications) {
|
|
81
|
-
this.applications = await this.loadApps();
|
|
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);
|
|
82
68
|
}
|
|
83
|
-
return
|
|
69
|
+
return result.map(exports.mapApps).sort(exports.filterApps);
|
|
84
70
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
* @returns {TargetApplication[]} list of applications.
|
|
89
|
-
* @throws {Error} Throws an error if the app data cannot be loaded.
|
|
90
|
-
*/
|
|
91
|
-
async loadApps() {
|
|
92
|
-
let result = [];
|
|
93
|
-
try {
|
|
94
|
-
const provider = this.abapProvider.getProvider();
|
|
95
|
-
const isCloudSystem = await provider.isAbapCloud();
|
|
96
|
-
const appIndex = provider.getAppIndex();
|
|
97
|
-
result = await appIndex.search(isCloudSystem ? constants_1.S4HANA_APPS_PARAMS : constants_1.ABAP_APPS_PARAMS);
|
|
98
|
-
if (!isCloudSystem && this.isCustomerBase) {
|
|
99
|
-
const extraApps = await appIndex.search(constants_1.ABAP_VARIANT_APPS_PARAMS);
|
|
100
|
-
result = result.concat(extraApps);
|
|
101
|
-
}
|
|
102
|
-
return result.map(exports.mapApps).sort(exports.filterApps);
|
|
103
|
-
}
|
|
104
|
-
catch (e) {
|
|
105
|
-
const errorMsg = `Could not load applications: ${e.message}`;
|
|
106
|
-
this.logger?.error(errorMsg);
|
|
107
|
-
throw new Error(errorMsg);
|
|
108
|
-
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
throw new Error(`Could not load applications: ${e.message}`);
|
|
109
73
|
}
|
|
110
74
|
}
|
|
111
|
-
exports.TargetApplications = TargetApplications;
|
|
112
75
|
//# sourceMappingURL=target-applications.js.map
|
|
@@ -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
|
@@ -11,6 +11,10 @@ export interface DescriptorVariant {
|
|
|
11
11
|
namespace: string;
|
|
12
12
|
content: DescriptorVariantContent[];
|
|
13
13
|
}
|
|
14
|
+
export type PackageJson = {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
};
|
|
14
18
|
export interface DescriptorVariantContent {
|
|
15
19
|
changeType: string;
|
|
16
20
|
content: Record<string, unknown>;
|
|
@@ -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"));
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type { AdpWriterConfig, CustomConfig } from '../types';
|
|
2
|
+
import type { AdpWriterConfig, CustomConfig, PackageJson } from '../types';
|
|
3
3
|
import type { OperationsType } from '@sap-ux/axios-extension';
|
|
4
|
-
type PackageJSON = {
|
|
5
|
-
name: string;
|
|
6
|
-
version: string;
|
|
7
|
-
};
|
|
8
4
|
/**
|
|
9
5
|
* Retrieves the package name and version from the package.json file located two levels up the directory tree.
|
|
10
6
|
*
|
|
11
|
-
* @returns {
|
|
7
|
+
* @returns {PackageJson} An object containing the `name` and `version` of the package.
|
|
12
8
|
*/
|
|
13
|
-
export declare function getPackageJSONInfo():
|
|
9
|
+
export declare function getPackageJSONInfo(): PackageJson;
|
|
14
10
|
/**
|
|
15
|
-
* Constructs a custom configuration object.
|
|
11
|
+
* Constructs a custom configuration object for the Adaptation Project (ADP).
|
|
16
12
|
*
|
|
17
|
-
* @param {OperationsType} environment - The operations type
|
|
18
|
-
* @
|
|
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.
|
|
19
18
|
*/
|
|
20
|
-
export declare function getCustomConfig(environment: OperationsType): CustomConfig;
|
|
19
|
+
export declare function getCustomConfig(environment: OperationsType, { name: id, version }: PackageJson): CustomConfig;
|
|
21
20
|
/**
|
|
22
21
|
* Writes a given project template files within a specified folder in the project directory.
|
|
23
22
|
*
|
|
@@ -46,5 +45,4 @@ export declare function writeUI5Yaml(projectPath: string, data: AdpWriterConfig,
|
|
|
46
45
|
* @returns {void}
|
|
47
46
|
*/
|
|
48
47
|
export declare function writeUI5DeployYaml(projectPath: string, data: AdpWriterConfig, fs: Editor): Promise<void>;
|
|
49
|
-
export {};
|
|
50
48
|
//# sourceMappingURL=project-utils.d.ts.map
|
|
@@ -13,7 +13,7 @@ const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
|
13
13
|
/**
|
|
14
14
|
* Retrieves the package name and version from the package.json file located two levels up the directory tree.
|
|
15
15
|
*
|
|
16
|
-
* @returns {
|
|
16
|
+
* @returns {PackageJson} An object containing the `name` and `version` of the package.
|
|
17
17
|
*/
|
|
18
18
|
function getPackageJSONInfo() {
|
|
19
19
|
const defaultPackage = {
|
|
@@ -28,13 +28,15 @@ function getPackageJSONInfo() {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Constructs a custom configuration object.
|
|
31
|
+
* Constructs a custom configuration object for the Adaptation Project (ADP).
|
|
32
32
|
*
|
|
33
|
-
* @param {OperationsType} environment - The operations type
|
|
34
|
-
* @
|
|
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.
|
|
35
38
|
*/
|
|
36
|
-
function getCustomConfig(environment) {
|
|
37
|
-
const { name: id, version } = getPackageJSONInfo();
|
|
39
|
+
function getCustomConfig(environment, { name: id, version }) {
|
|
38
40
|
return {
|
|
39
41
|
adp: {
|
|
40
42
|
environment,
|
|
@@ -1,28 +1,50 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param {AbapProvider} abapProvider - The instance of AbapProvider class.
|
|
13
|
-
* @param {FlexLayer} layer - The FlexLayer used to determine the base (customer or otherwise).
|
|
14
|
+
* The FlexLayer indicating the deployment layer (e.g., CUSTOMER_BASE or VENDOR).
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
layer: FlexLayer;
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param {ConfigAnswers} configAnswers - The configuration answers (i.e system, application).
|
|
20
|
-
* @param {object} defaults - Default project parameters.
|
|
21
|
-
* @param {string} defaults.namespace - The namespace for the project.
|
|
22
|
-
* @returns {Promise<AdpWriterConfig>} The generated project configuration.
|
|
18
|
+
* Default project parameters.
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
defaults: {
|
|
21
|
+
/**
|
|
22
|
+
* The default namespace for the project.
|
|
23
|
+
*/
|
|
25
24
|
namespace: string;
|
|
26
|
-
}
|
|
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;
|
|
27
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 {};
|
|
28
50
|
//# sourceMappingURL=writer-config.d.ts.map
|
|
@@ -1,54 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getConfig = getConfig;
|
|
4
|
+
const client_1 = require("../client");
|
|
4
5
|
const project_utils_1 = require("./project-utils");
|
|
5
6
|
const descriptor_content_1 = require("./descriptor-content");
|
|
6
7
|
/**
|
|
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.
|
|
8
19
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
async getConfig(configAnswers, defaults) {
|
|
31
|
-
const provider = this.abapProvider.getProvider();
|
|
32
|
-
const ato = await provider.getAtoInfo();
|
|
33
|
-
const operationsType = ato.operationsType ?? 'P';
|
|
34
|
-
const target = await this.abapProvider.determineTarget(configAnswers.system, {});
|
|
35
|
-
const customConfig = (0, project_utils_1.getCustomConfig)(operationsType);
|
|
36
|
-
return {
|
|
37
|
-
app: {
|
|
38
|
-
id: defaults.namespace,
|
|
39
|
-
reference: configAnswers.application.id,
|
|
40
|
-
layer: this.layer,
|
|
41
|
-
title: '',
|
|
42
|
-
content: [(0, descriptor_content_1.getNewModelEnhanceWithChange)()]
|
|
43
|
-
},
|
|
44
|
-
customConfig,
|
|
45
|
-
target,
|
|
46
|
-
options: {
|
|
47
|
-
fioriTools: true,
|
|
48
|
-
enableTypeScript: false
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
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
|
+
};
|
|
52
41
|
}
|
|
53
|
-
exports.WriterConfig = WriterConfig;
|
|
54
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",
|