@sap-ux/adp-tooling 0.13.22 → 0.13.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abap/client.d.ts +18 -0
- package/dist/abap/client.js +43 -0
- package/dist/abap/config.d.ts +19 -0
- package/dist/abap/config.js +50 -0
- package/dist/abap/index.d.ts +4 -0
- package/dist/{client → abap}/index.js +3 -3
- package/dist/abap/provider.d.ts +22 -0
- package/dist/abap/provider.js +33 -0
- package/dist/base/constants/index.d.ts +8 -0
- package/dist/base/constants/index.js +9 -1
- package/dist/base/prompt.js +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/{client/target-applications.d.ts → source/applications.d.ts} +19 -9
- package/dist/{client/target-applications.js → source/applications.js} +24 -5
- package/dist/source/index.d.ts +4 -0
- package/dist/source/index.js +20 -0
- package/dist/source/manifest.d.ts +70 -0
- package/dist/source/manifest.js +123 -0
- package/dist/{client/target-systems.d.ts → source/systems.d.ts} +2 -2
- package/dist/{client/target-systems.js → source/systems.js} +4 -4
- package/dist/translations/adp-tooling.i18n.json +2 -1
- package/dist/types.d.ts +15 -6
- package/dist/ui5/fetch.d.ts +16 -0
- package/dist/ui5/fetch.js +34 -0
- package/dist/ui5/format.d.ts +80 -0
- package/dist/ui5/format.js +135 -0
- package/dist/ui5/index.d.ts +4 -0
- package/dist/ui5/index.js +20 -0
- package/dist/ui5/version-info.d.ts +106 -0
- package/dist/ui5/version-info.js +193 -0
- package/dist/writer/project-utils.d.ts +5 -4
- package/dist/writer/project-utils.js +3 -3
- package/dist/writer/writer-config.d.ts +5 -3
- package/dist/writer/writer-config.js +13 -3
- package/package.json +1 -1
- package/dist/client/abap-provider.d.ts +0 -38
- package/dist/client/abap-provider.js +0 -79
- package/dist/client/index.d.ts +0 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { FlexUISupportedSystem } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Fetches system supports Flex UI features.
|
|
5
|
+
*
|
|
6
|
+
* @param {AbapServiceProvider} provider - Instance of the ABAP provider.
|
|
7
|
+
* @param {boolean} isCustomerBase - Indicates whether the adaptation layer is CUSTOMER_BASE.
|
|
8
|
+
* @returns {Promise<FlexUISupportedSystem | undefined>} settings indicating support for onPremise and UI Flex capabilities.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getFlexUISupportedSystem(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<FlexUISupportedSystem>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetches system UI5 Version from UI5RtVersionService.
|
|
13
|
+
*
|
|
14
|
+
* @param {AbapServiceProvider} provider - Instance of the ABAP provider.
|
|
15
|
+
* @returns {string | undefined} System UI5 version.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSystemUI5Version(provider: AbapServiceProvider): Promise<string | undefined>;
|
|
18
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFlexUISupportedSystem = getFlexUISupportedSystem;
|
|
4
|
+
exports.getSystemUI5Version = getSystemUI5Version;
|
|
5
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
6
|
+
const FILTER = {
|
|
7
|
+
'scheme': 'http://www.sap.com/adt/categories/ui_flex',
|
|
8
|
+
'term': 'dta_folder'
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Fetches system supports Flex UI features.
|
|
12
|
+
*
|
|
13
|
+
* @param {AbapServiceProvider} provider - Instance of the ABAP provider.
|
|
14
|
+
* @param {boolean} isCustomerBase - Indicates whether the adaptation layer is CUSTOMER_BASE.
|
|
15
|
+
* @returns {Promise<FlexUISupportedSystem | undefined>} settings indicating support for onPremise and UI Flex capabilities.
|
|
16
|
+
*/
|
|
17
|
+
async function getFlexUISupportedSystem(provider, isCustomerBase) {
|
|
18
|
+
if (!isCustomerBase) {
|
|
19
|
+
return {
|
|
20
|
+
isOnPremise: true,
|
|
21
|
+
isUIFlex: true
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const response = await provider.get(axios_extension_1.AdtCatalogService.ADT_DISCOVERY_SERVICE_PATH, {
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: 'application/*'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const isOnPremise = response.data.includes(FILTER.term);
|
|
30
|
+
const isUIFlex = response.data.includes(FILTER.scheme);
|
|
31
|
+
return { isOnPremise, isUIFlex };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Fetches system UI5 Version from UI5RtVersionService.
|
|
35
|
+
*
|
|
36
|
+
* @param {AbapServiceProvider} provider - Instance of the ABAP provider.
|
|
37
|
+
* @returns {string | undefined} System UI5 version.
|
|
38
|
+
*/
|
|
39
|
+
async function getSystemUI5Version(provider) {
|
|
40
|
+
const service = await provider.getAdtService(axios_extension_1.UI5RtVersionService);
|
|
41
|
+
return service?.getUI5Version();
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { AbapTarget } from '@sap-ux/ui5-config';
|
|
3
|
+
import type { AxiosRequestConfig, ProviderConfiguration } from '@sap-ux/axios-extension';
|
|
4
|
+
export type RequestOptions = AxiosRequestConfig & Partial<ProviderConfiguration>;
|
|
5
|
+
/**
|
|
6
|
+
* Determines the ABAP target configuration based on the running environment and system details.
|
|
7
|
+
*
|
|
8
|
+
* For an App Studio environment, the config is constructed with a destination property.
|
|
9
|
+
* For non-AppStudio environments, the function retrieves system details from the SystemLookup service,
|
|
10
|
+
* maps these details to an AbapTarget, and attaches authentication credentials to the request options if available.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} system - The system identifier (URL or system name).
|
|
13
|
+
* @param {ToolsLogger} logger - The logger for logging errors.
|
|
14
|
+
* @param {RequestOptions} [requestOptions] - Optional request options which will be updated with auth information if available.
|
|
15
|
+
* @param {string} [client] - Optional client number for systems with multiple clients.
|
|
16
|
+
* @returns {Promise<AbapTarget>} A promise that resolves to the configured ABAP configuration.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getProviderConfig(system: string, logger: ToolsLogger, requestOptions?: RequestOptions, client?: string): Promise<AbapTarget>;
|
|
19
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProviderConfig = getProviderConfig;
|
|
4
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
5
|
+
const source_1 = require("../source");
|
|
6
|
+
/**
|
|
7
|
+
* Determines the ABAP target configuration based on the running environment and system details.
|
|
8
|
+
*
|
|
9
|
+
* For an App Studio environment, the config is constructed with a destination property.
|
|
10
|
+
* For non-AppStudio environments, the function retrieves system details from the SystemLookup service,
|
|
11
|
+
* maps these details to an AbapTarget, and attaches authentication credentials to the request options if available.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} system - The system identifier (URL or system name).
|
|
14
|
+
* @param {ToolsLogger} logger - The logger for logging errors.
|
|
15
|
+
* @param {RequestOptions} [requestOptions] - Optional request options which will be updated with auth information if available.
|
|
16
|
+
* @param {string} [client] - Optional client number for systems with multiple clients.
|
|
17
|
+
* @returns {Promise<AbapTarget>} A promise that resolves to the configured ABAP configuration.
|
|
18
|
+
*/
|
|
19
|
+
async function getProviderConfig(system, logger, requestOptions, client) {
|
|
20
|
+
let config;
|
|
21
|
+
if ((0, btp_utils_1.isAppStudio)()) {
|
|
22
|
+
config = {
|
|
23
|
+
destination: system
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const systemLookup = new source_1.SystemLookup(logger);
|
|
28
|
+
const details = await systemLookup.getSystemByName(system);
|
|
29
|
+
if (!details) {
|
|
30
|
+
throw new Error(`No system details found for system: ${system}`);
|
|
31
|
+
}
|
|
32
|
+
config = {
|
|
33
|
+
client: details?.Client ?? client,
|
|
34
|
+
url: details?.Url
|
|
35
|
+
};
|
|
36
|
+
if (details?.Authentication) {
|
|
37
|
+
config.authenticationType = details?.Authentication;
|
|
38
|
+
}
|
|
39
|
+
const username = details?.Credentials?.username;
|
|
40
|
+
const password = details?.Credentials?.password;
|
|
41
|
+
if (requestOptions && username && password) {
|
|
42
|
+
requestOptions.auth = {
|
|
43
|
+
username,
|
|
44
|
+
password
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -14,7 +14,7 @@ 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
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./client"), exports);
|
|
18
|
+
__exportStar(require("./provider"), exports);
|
|
19
|
+
__exportStar(require("./config"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
3
|
+
interface ProviderOptions {
|
|
4
|
+
system: string;
|
|
5
|
+
client?: string;
|
|
6
|
+
username?: string;
|
|
7
|
+
password?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a fully configured ABAP service provider for the specified system.
|
|
11
|
+
*
|
|
12
|
+
* This function uses the provided system identifier (and optional client and credentials)
|
|
13
|
+
* to build an ABAP target configuration, which is then passed to createAbapServiceProvider.
|
|
14
|
+
*
|
|
15
|
+
* @param {ProviderOptions} options - Options for configuring the provider.
|
|
16
|
+
* @param {ToolsLogger} logger - The logger for logging errors and debug messages.
|
|
17
|
+
* @returns {Promise<AbapServiceProvider>} A promise that resolves to the configured ABAP service provider.
|
|
18
|
+
* @throws {Error} If provider instantiation fails.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getConfiguredProvider({ system, client, password, username }: ProviderOptions, logger: ToolsLogger): Promise<AbapServiceProvider>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfiguredProvider = getConfiguredProvider;
|
|
4
|
+
const system_access_1 = require("@sap-ux/system-access");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves a fully configured ABAP service provider for the specified system.
|
|
8
|
+
*
|
|
9
|
+
* This function uses the provided system identifier (and optional client and credentials)
|
|
10
|
+
* to build an ABAP target configuration, which is then passed to createAbapServiceProvider.
|
|
11
|
+
*
|
|
12
|
+
* @param {ProviderOptions} options - Options for configuring the provider.
|
|
13
|
+
* @param {ToolsLogger} logger - The logger for logging errors and debug messages.
|
|
14
|
+
* @returns {Promise<AbapServiceProvider>} A promise that resolves to the configured ABAP service provider.
|
|
15
|
+
* @throws {Error} If provider instantiation fails.
|
|
16
|
+
*/
|
|
17
|
+
async function getConfiguredProvider({ system, client, password, username }, logger) {
|
|
18
|
+
try {
|
|
19
|
+
const requestOptions = {
|
|
20
|
+
ignoreCertErrors: false
|
|
21
|
+
};
|
|
22
|
+
const config = await (0, config_1.getProviderConfig)(system, logger, requestOptions, client);
|
|
23
|
+
if (username && password) {
|
|
24
|
+
requestOptions.auth = { username, password };
|
|
25
|
+
}
|
|
26
|
+
return await (0, system_access_1.createAbapServiceProvider)(config, requestOptions, false, logger);
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
logger?.error(`Failed to instantiate provider for system: ${system}. Reason: ${e.message}`);
|
|
30
|
+
throw new Error(e.message);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export declare const UI5_CDN_URL = "https://ui5.sap.com";
|
|
2
|
+
export declare const UI5_VERSIONS_CDN_URL = "https://sapui5.hana.ondemand.com/version.json";
|
|
3
|
+
export declare const UI5_VERSIONS_NEO_CDN_URL = "https://ui5.sap.com/neo-app.json";
|
|
4
|
+
export declare const SNAPSHOT_CDN_URL = "https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com:443";
|
|
5
|
+
export declare const CURRENT_SYSTEM_VERSION = "(system version)";
|
|
6
|
+
export declare const LATEST_VERSION = "(latest)";
|
|
7
|
+
export declare const SNAPSHOT_VERSION = "snapshot";
|
|
8
|
+
export declare const SNAPSHOT_UNTESTED_VERSION = "snapshot-untested";
|
|
1
9
|
export declare const S4HANA_APPS_PARAMS: {
|
|
2
10
|
'sap.app/type': string;
|
|
3
11
|
'sap.fiori/cloudDevAdaptationStatus': string;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ABAP_VARIANT_APPS_PARAMS = exports.ABAP_APPS_PARAMS = exports.S4HANA_APPS_PARAMS = void 0;
|
|
3
|
+
exports.ABAP_VARIANT_APPS_PARAMS = exports.ABAP_APPS_PARAMS = exports.S4HANA_APPS_PARAMS = exports.SNAPSHOT_UNTESTED_VERSION = exports.SNAPSHOT_VERSION = exports.LATEST_VERSION = exports.CURRENT_SYSTEM_VERSION = exports.SNAPSHOT_CDN_URL = exports.UI5_VERSIONS_NEO_CDN_URL = exports.UI5_VERSIONS_CDN_URL = exports.UI5_CDN_URL = void 0;
|
|
4
|
+
exports.UI5_CDN_URL = 'https://ui5.sap.com';
|
|
5
|
+
exports.UI5_VERSIONS_CDN_URL = 'https://sapui5.hana.ondemand.com/version.json';
|
|
6
|
+
exports.UI5_VERSIONS_NEO_CDN_URL = 'https://ui5.sap.com/neo-app.json';
|
|
7
|
+
exports.SNAPSHOT_CDN_URL = 'https://sapui5preview-sapui5.dispatcher.int.sap.eu2.hana.ondemand.com:443';
|
|
8
|
+
exports.CURRENT_SYSTEM_VERSION = '(system version)';
|
|
9
|
+
exports.LATEST_VERSION = '(latest)';
|
|
10
|
+
exports.SNAPSHOT_VERSION = 'snapshot';
|
|
11
|
+
exports.SNAPSHOT_UNTESTED_VERSION = 'snapshot-untested';
|
|
4
12
|
exports.S4HANA_APPS_PARAMS = {
|
|
5
13
|
'sap.app/type': 'application',
|
|
6
14
|
'sap.fiori/cloudDevAdaptationStatus': 'released',
|
package/dist/base/prompt.js
CHANGED
|
@@ -173,8 +173,8 @@ async function fetchSystemInformation(target, ignoreCertErrors, logger) {
|
|
|
173
173
|
adp: {
|
|
174
174
|
environment: ato.operationsType ?? 'P',
|
|
175
175
|
support: {
|
|
176
|
-
id: packageJson.name,
|
|
177
|
-
version: packageJson.version,
|
|
176
|
+
id: packageJson.name ?? '',
|
|
177
|
+
version: packageJson.version ?? '',
|
|
178
178
|
toolsId: (0, uuid_1.v4)()
|
|
179
179
|
}
|
|
180
180
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ export * from './base/constants';
|
|
|
6
6
|
export * from './base/project-builder';
|
|
7
7
|
export * from './base/abap/manifest-service';
|
|
8
8
|
export * from './base/helper';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './abap';
|
|
10
|
+
export * from './source';
|
|
10
11
|
export * from './preview/adp-preview';
|
|
11
12
|
export * from './writer/writer-config';
|
|
13
|
+
export * from './ui5';
|
|
12
14
|
export { getCustomConfig } from './writer/project-utils';
|
|
13
15
|
export { generate, migrate } from './writer';
|
|
14
16
|
export { generateChange } from './writer/editors';
|
package/dist/index.js
CHANGED
|
@@ -23,9 +23,11 @@ __exportStar(require("./base/constants"), exports);
|
|
|
23
23
|
__exportStar(require("./base/project-builder"), exports);
|
|
24
24
|
__exportStar(require("./base/abap/manifest-service"), exports);
|
|
25
25
|
__exportStar(require("./base/helper"), exports);
|
|
26
|
-
__exportStar(require("./
|
|
26
|
+
__exportStar(require("./abap"), exports);
|
|
27
|
+
__exportStar(require("./source"), exports);
|
|
27
28
|
__exportStar(require("./preview/adp-preview"), exports);
|
|
28
29
|
__exportStar(require("./writer/writer-config"), exports);
|
|
30
|
+
__exportStar(require("./ui5"), exports);
|
|
29
31
|
var project_utils_1 = require("./writer/project-utils");
|
|
30
32
|
Object.defineProperty(exports, "getCustomConfig", { enumerable: true, get: function () { return project_utils_1.getCustomConfig; } });
|
|
31
33
|
var writer_1 = require("./writer");
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
1
2
|
import type { AbapServiceProvider, App } from '@sap-ux/axios-extension';
|
|
2
|
-
import type {
|
|
3
|
+
import type { SourceApplication } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
|
|
5
6
|
* This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
|
|
6
7
|
*
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {SourceApplication} appA - The first application to compare.
|
|
9
|
+
* @param {SourceApplication} appB - The second application to compare.
|
|
9
10
|
* @returns {number} A number indicating the sort order.
|
|
10
11
|
*/
|
|
11
|
-
export declare const filterApps: (appA:
|
|
12
|
+
export declare const filterApps: (appA: SourceApplication, appB: SourceApplication) => number;
|
|
12
13
|
/**
|
|
13
14
|
* Transforms raw application data into a structured Application object.
|
|
14
15
|
* This function maps properties from a loosely typed app data structure to a strongly typed Application object.
|
|
15
16
|
*
|
|
16
17
|
* @param {Partial<App>} app - The raw application data, possibly incomplete.
|
|
17
|
-
* @returns {
|
|
18
|
+
* @returns {SourceApplication} A structured application object with defined properties, even if some may be empty.
|
|
18
19
|
*/
|
|
19
|
-
export declare const mapApps: (app: Partial<App>) =>
|
|
20
|
+
export declare const mapApps: (app: Partial<App>) => SourceApplication;
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether the application supports manifest-first approach.
|
|
23
|
+
*
|
|
24
|
+
* @param {AbapServiceProvider} provider - The ABAP service provider for communicating with the system.
|
|
25
|
+
* @param {string} id - The ID of the application whose manifest should be managed.
|
|
26
|
+
* @param {ToolsLogger} logger - Optional logger for debugging purposes.
|
|
27
|
+
* @returns {Promise<boolean>} True if supported, otherwise throws an error.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isAppSupported(provider: AbapServiceProvider, id: string, logger: ToolsLogger): Promise<boolean>;
|
|
20
30
|
/**
|
|
21
31
|
* Loads and processes application data from the ABAP service provider.
|
|
22
32
|
*
|
|
@@ -25,7 +35,7 @@ export declare const mapApps: (app: Partial<App>) => TargetApplication;
|
|
|
25
35
|
*
|
|
26
36
|
* @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
|
|
27
37
|
* @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
|
|
28
|
-
* @returns {Promise<
|
|
38
|
+
* @returns {Promise<SourceApplication[]>} A promise that resolves to a sorted list of applications.
|
|
29
39
|
*/
|
|
30
|
-
export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<
|
|
31
|
-
//# sourceMappingURL=
|
|
40
|
+
export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<SourceApplication[]>;
|
|
41
|
+
//# sourceMappingURL=applications.d.ts.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapApps = exports.filterApps = void 0;
|
|
4
|
+
exports.isAppSupported = isAppSupported;
|
|
4
5
|
exports.loadApps = loadApps;
|
|
6
|
+
const i18n_1 = require("../i18n");
|
|
5
7
|
const constants_1 = require("../base/constants");
|
|
6
8
|
/**
|
|
7
9
|
* Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
|
|
8
10
|
* This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
|
|
9
11
|
*
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
+
* @param {SourceApplication} appA - The first application to compare.
|
|
13
|
+
* @param {SourceApplication} appB - The second application to compare.
|
|
12
14
|
* @returns {number} A number indicating the sort order.
|
|
13
15
|
*/
|
|
14
16
|
const filterApps = (appA, appB) => {
|
|
@@ -34,7 +36,7 @@ exports.filterApps = filterApps;
|
|
|
34
36
|
* This function maps properties from a loosely typed app data structure to a strongly typed Application object.
|
|
35
37
|
*
|
|
36
38
|
* @param {Partial<App>} app - The raw application data, possibly incomplete.
|
|
37
|
-
* @returns {
|
|
39
|
+
* @returns {SourceApplication} A structured application object with defined properties, even if some may be empty.
|
|
38
40
|
*/
|
|
39
41
|
const mapApps = (app) => ({
|
|
40
42
|
id: app['sap.app/id'] ?? '',
|
|
@@ -46,6 +48,23 @@ const mapApps = (app) => ({
|
|
|
46
48
|
bspName: app['repoName'] ?? ''
|
|
47
49
|
});
|
|
48
50
|
exports.mapApps = mapApps;
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether the application supports manifest-first approach.
|
|
53
|
+
*
|
|
54
|
+
* @param {AbapServiceProvider} provider - The ABAP service provider for communicating with the system.
|
|
55
|
+
* @param {string} id - The ID of the application whose manifest should be managed.
|
|
56
|
+
* @param {ToolsLogger} logger - Optional logger for debugging purposes.
|
|
57
|
+
* @returns {Promise<boolean>} True if supported, otherwise throws an error.
|
|
58
|
+
*/
|
|
59
|
+
async function isAppSupported(provider, id, logger) {
|
|
60
|
+
const appIndex = provider.getAppIndex();
|
|
61
|
+
const isSupported = await appIndex.getIsManiFirstSupported(id);
|
|
62
|
+
if (!isSupported) {
|
|
63
|
+
logger?.debug(`Application '${id}' is not supported by Adaptation Project`);
|
|
64
|
+
throw new Error((0, i18n_1.t)('validators.appDoesNotSupportManifest'));
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
49
68
|
/**
|
|
50
69
|
* Loads and processes application data from the ABAP service provider.
|
|
51
70
|
*
|
|
@@ -54,7 +73,7 @@ exports.mapApps = mapApps;
|
|
|
54
73
|
*
|
|
55
74
|
* @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
|
|
56
75
|
* @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
|
|
57
|
-
* @returns {Promise<
|
|
76
|
+
* @returns {Promise<SourceApplication[]>} A promise that resolves to a sorted list of applications.
|
|
58
77
|
*/
|
|
59
78
|
async function loadApps(provider, isCustomerBase) {
|
|
60
79
|
let result = [];
|
|
@@ -72,4 +91,4 @@ async function loadApps(provider, isCustomerBase) {
|
|
|
72
91
|
throw new Error(`Could not load applications: ${e.message}`);
|
|
73
92
|
}
|
|
74
93
|
}
|
|
75
|
-
//# sourceMappingURL=
|
|
94
|
+
//# sourceMappingURL=applications.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("./applications"), exports);
|
|
18
|
+
__exportStar(require("./manifest"), exports);
|
|
19
|
+
__exportStar(require("./systems"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
+
import type { Manifest } from '@sap-ux/project-access';
|
|
3
|
+
import type { AbapServiceProvider } from '@sap-ux/axios-extension';
|
|
4
|
+
/**
|
|
5
|
+
* Evaluates whether the application described by the manifest is a SAP Fiori Elements version 4 application.
|
|
6
|
+
*
|
|
7
|
+
* @param {Manifest} manifest - The application manifest to evaluate.
|
|
8
|
+
* @returns {boolean} True if the application uses SAP Fiori Elements version 4 libraries.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isV4Application(manifest?: Manifest): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if views are loaded synchronously or asynchronously in the UI5 settings of the manifest.
|
|
13
|
+
* Sets the isAppSync property based on the loading method.
|
|
14
|
+
*
|
|
15
|
+
* @param {Manifest['sap.ui5']} ui5Settings - The UI5 settings part of the manifest.
|
|
16
|
+
* @returns {boolean} Boolean if views are loaded synchronously or asynchronously.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isSyncLoadedView(ui5Settings?: Manifest['sap.ui5']): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Service class for handling operations related to application manifests.
|
|
21
|
+
* Manifest and URL are lazily loaded and stored internally.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SourceManifest {
|
|
24
|
+
private readonly provider;
|
|
25
|
+
private readonly appId;
|
|
26
|
+
private readonly logger?;
|
|
27
|
+
/**
|
|
28
|
+
* The parsed manifest object, loaded once and cached internally.
|
|
29
|
+
*/
|
|
30
|
+
private manifest?;
|
|
31
|
+
/**
|
|
32
|
+
* The manifest URL for the specified application, loaded once and cached internally.
|
|
33
|
+
*/
|
|
34
|
+
private manifestUrl?;
|
|
35
|
+
/**
|
|
36
|
+
* Creates an instance of SourceManifest.
|
|
37
|
+
*
|
|
38
|
+
* @param {AbapServiceProvider} provider - The ABAP service provider for communicating with the system.
|
|
39
|
+
* @param {string} appId - The ID of the application whose manifest should be managed.
|
|
40
|
+
* @param {ToolsLogger} logger - Optional logger for debugging purposes.
|
|
41
|
+
*/
|
|
42
|
+
constructor(provider: AbapServiceProvider, appId: string, logger?: ToolsLogger | undefined);
|
|
43
|
+
/**
|
|
44
|
+
* Returns the manifest URL, loading it if not already available.
|
|
45
|
+
*
|
|
46
|
+
* @returns {Promise<string>} A promise resolving to the manifest URL string.
|
|
47
|
+
*/
|
|
48
|
+
getManifestUrl(): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the parsed manifest, loading it if not already available.
|
|
51
|
+
*
|
|
52
|
+
* @returns A promise resolving to the parsed manifest object.
|
|
53
|
+
*/
|
|
54
|
+
getManifest(): Promise<Manifest>;
|
|
55
|
+
/**
|
|
56
|
+
* Loads the manifest URL from the system using the application ID.
|
|
57
|
+
* The result is stored internally for future access.
|
|
58
|
+
*
|
|
59
|
+
* @returns {Promise<string>} A promise that resolves once the URL has been fetched and set.
|
|
60
|
+
*/
|
|
61
|
+
private loadManifestUrl;
|
|
62
|
+
/**
|
|
63
|
+
* Loads the manifest from the system and stores it internally.
|
|
64
|
+
* Requires a manifest URL to be available (loads it if necessary).
|
|
65
|
+
*
|
|
66
|
+
* @returns {Promise<Manifest>} A promise that resolves once the manifest has been fetched and parsed.
|
|
67
|
+
*/
|
|
68
|
+
private loadManifest;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceManifest = void 0;
|
|
4
|
+
exports.isV4Application = isV4Application;
|
|
5
|
+
exports.isSyncLoadedView = isSyncLoadedView;
|
|
6
|
+
const i18n_1 = require("../i18n");
|
|
7
|
+
/**
|
|
8
|
+
* Evaluates whether the application described by the manifest is a SAP Fiori Elements version 4 application.
|
|
9
|
+
*
|
|
10
|
+
* @param {Manifest} manifest - The application manifest to evaluate.
|
|
11
|
+
* @returns {boolean} True if the application uses SAP Fiori Elements version 4 libraries.
|
|
12
|
+
*/
|
|
13
|
+
function isV4Application(manifest) {
|
|
14
|
+
return !!manifest?.['sap.ui5']?.dependencies?.libs?.['sap.fe.templates'];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks if views are loaded synchronously or asynchronously in the UI5 settings of the manifest.
|
|
18
|
+
* Sets the isAppSync property based on the loading method.
|
|
19
|
+
*
|
|
20
|
+
* @param {Manifest['sap.ui5']} ui5Settings - The UI5 settings part of the manifest.
|
|
21
|
+
* @returns {boolean} Boolean if views are loaded synchronously or asynchronously.
|
|
22
|
+
*/
|
|
23
|
+
function isSyncLoadedView(ui5Settings) {
|
|
24
|
+
if (ui5Settings?.rootView) {
|
|
25
|
+
const rootView = ui5Settings?.rootView;
|
|
26
|
+
return !rootView.async;
|
|
27
|
+
}
|
|
28
|
+
if (ui5Settings?.routing && ui5Settings['routing']['config']) {
|
|
29
|
+
return !ui5Settings['routing']['config']['async'];
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Service class for handling operations related to application manifests.
|
|
35
|
+
* Manifest and URL are lazily loaded and stored internally.
|
|
36
|
+
*/
|
|
37
|
+
class SourceManifest {
|
|
38
|
+
provider;
|
|
39
|
+
appId;
|
|
40
|
+
logger;
|
|
41
|
+
/**
|
|
42
|
+
* The parsed manifest object, loaded once and cached internally.
|
|
43
|
+
*/
|
|
44
|
+
manifest;
|
|
45
|
+
/**
|
|
46
|
+
* The manifest URL for the specified application, loaded once and cached internally.
|
|
47
|
+
*/
|
|
48
|
+
manifestUrl;
|
|
49
|
+
/**
|
|
50
|
+
* Creates an instance of SourceManifest.
|
|
51
|
+
*
|
|
52
|
+
* @param {AbapServiceProvider} provider - The ABAP service provider for communicating with the system.
|
|
53
|
+
* @param {string} appId - The ID of the application whose manifest should be managed.
|
|
54
|
+
* @param {ToolsLogger} logger - Optional logger for debugging purposes.
|
|
55
|
+
*/
|
|
56
|
+
constructor(provider, appId, logger) {
|
|
57
|
+
this.provider = provider;
|
|
58
|
+
this.appId = appId;
|
|
59
|
+
this.logger = logger;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns the manifest URL, loading it if not already available.
|
|
63
|
+
*
|
|
64
|
+
* @returns {Promise<string>} A promise resolving to the manifest URL string.
|
|
65
|
+
*/
|
|
66
|
+
async getManifestUrl() {
|
|
67
|
+
if (!this.manifestUrl) {
|
|
68
|
+
this.manifestUrl = await this.loadManifestUrl();
|
|
69
|
+
}
|
|
70
|
+
return this.manifestUrl;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns the parsed manifest, loading it if not already available.
|
|
74
|
+
*
|
|
75
|
+
* @returns A promise resolving to the parsed manifest object.
|
|
76
|
+
*/
|
|
77
|
+
async getManifest() {
|
|
78
|
+
if (!this.manifest) {
|
|
79
|
+
this.manifest = await this.loadManifest();
|
|
80
|
+
}
|
|
81
|
+
return this.manifest;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Loads the manifest URL from the system using the application ID.
|
|
85
|
+
* The result is stored internally for future access.
|
|
86
|
+
*
|
|
87
|
+
* @returns {Promise<string>} A promise that resolves once the URL has been fetched and set.
|
|
88
|
+
*/
|
|
89
|
+
async loadManifestUrl() {
|
|
90
|
+
const appIndex = this.provider.getAppIndex();
|
|
91
|
+
const data = await appIndex.getAppInfo(this.appId);
|
|
92
|
+
const appInfo = data ? Object.values(data)[0] : undefined;
|
|
93
|
+
const url = appInfo?.manifestUrl ?? appInfo?.manifest ?? '';
|
|
94
|
+
if (!url) {
|
|
95
|
+
this.logger?.debug(`Manifest URL for app '${this.appId}' was not found!`);
|
|
96
|
+
throw new Error((0, i18n_1.t)('validators.appDoesNotSupportManifest'));
|
|
97
|
+
}
|
|
98
|
+
return url;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Loads the manifest from the system and stores it internally.
|
|
102
|
+
* Requires a manifest URL to be available (loads it if necessary).
|
|
103
|
+
*
|
|
104
|
+
* @returns {Promise<Manifest>} A promise that resolves once the manifest has been fetched and parsed.
|
|
105
|
+
*/
|
|
106
|
+
async loadManifest() {
|
|
107
|
+
const url = this.manifestUrl ?? (await this.loadManifestUrl());
|
|
108
|
+
try {
|
|
109
|
+
const response = await this.provider.request({ url });
|
|
110
|
+
const manifest = JSON.parse(response.data);
|
|
111
|
+
if (typeof manifest !== 'object' || manifest === null) {
|
|
112
|
+
throw new Error('Manifest parsing error. Manifest is not in expected format.');
|
|
113
|
+
}
|
|
114
|
+
return manifest;
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
this.logger?.debug(`Failed to load manifest for '${this.appId}', error: ${e.message}`);
|
|
118
|
+
throw new Error(`Failed to load manifest from URL: ${e.message}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.SourceManifest = SourceManifest;
|
|
123
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -19,7 +19,7 @@ export declare const transformBackendSystem: (system: BackendSystem) => Endpoint
|
|
|
19
19
|
* Service class to manage and retrieve information about system systems,
|
|
20
20
|
* including their names, authentication requirements, and specific details.
|
|
21
21
|
*/
|
|
22
|
-
export declare class
|
|
22
|
+
export declare class SystemLookup {
|
|
23
23
|
private readonly logger;
|
|
24
24
|
private systems;
|
|
25
25
|
/**
|
|
@@ -56,4 +56,4 @@ export declare class TargetSystems {
|
|
|
56
56
|
*/
|
|
57
57
|
getSystemRequiresAuth(system: string): Promise<boolean>;
|
|
58
58
|
}
|
|
59
|
-
//# sourceMappingURL=
|
|
59
|
+
//# sourceMappingURL=systems.d.ts.map
|