@sap-ux/adp-tooling 0.18.0 → 0.18.2
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/cf/app/discovery.d.ts +5 -5
- package/dist/cf/app/discovery.js +7 -7
- package/dist/cf/app/html5-repo.d.ts +3 -3
- package/dist/cf/app/html5-repo.js +10 -10
- package/dist/cf/core/auth.js +2 -2
- package/dist/cf/services/api.d.ts +6 -6
- package/dist/cf/services/api.js +9 -9
- package/dist/cf/services/cli.d.ts +3 -3
- package/dist/cf/services/cli.js +7 -10
- package/dist/cf/utils/validation.d.ts +3 -3
- package/dist/cf/utils/validation.js +3 -3
- package/dist/types.d.ts +9 -9
- package/dist/writer/inbound-navigation.d.ts +4 -4
- package/dist/writer/inbound-navigation.js +15 -9
- package/dist/writer/index.js +0 -8
- package/dist/writer/options.d.ts +2 -2
- package/dist/writer/options.js +16 -12
- package/package.json +2 -2
- package/templates/project/webapp/i18n/i18n.properties +0 -6
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
-
import type { CfConfig, CFApp,
|
|
2
|
+
import type { CfConfig, CFApp, ServiceKeys } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Get the app host ids.
|
|
5
5
|
*
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {ServiceKeys[]} serviceKeys - The service keys.
|
|
7
7
|
* @returns {string[]} The app host ids.
|
|
8
8
|
*/
|
|
9
|
-
export declare function getAppHostIds(
|
|
9
|
+
export declare function getAppHostIds(serviceKeys: ServiceKeys[]): string[];
|
|
10
10
|
/**
|
|
11
11
|
* Discover apps from FDC API based on credentials.
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {ServiceKeys[]} serviceKeys - The service keys containing app host IDs
|
|
14
14
|
* @param {CfConfig} cfConfig - The CF configuration
|
|
15
15
|
* @param {ToolsLogger} logger - The logger
|
|
16
16
|
* @returns {Promise<CFApp[]>} The discovered apps
|
|
17
17
|
*/
|
|
18
|
-
export declare function getCfApps(
|
|
18
|
+
export declare function getCfApps(serviceKeys: ServiceKeys[], cfConfig: CfConfig, logger: ToolsLogger): Promise<CFApp[]>;
|
|
19
19
|
//# sourceMappingURL=discovery.d.ts.map
|
package/dist/cf/app/discovery.js
CHANGED
|
@@ -7,13 +7,13 @@ const api_1 = require("../services/api");
|
|
|
7
7
|
/**
|
|
8
8
|
* Get the app host ids.
|
|
9
9
|
*
|
|
10
|
-
* @param {
|
|
10
|
+
* @param {ServiceKeys[]} serviceKeys - The service keys.
|
|
11
11
|
* @returns {string[]} The app host ids.
|
|
12
12
|
*/
|
|
13
|
-
function getAppHostIds(
|
|
13
|
+
function getAppHostIds(serviceKeys) {
|
|
14
14
|
const appHostIds = [];
|
|
15
|
-
for (const
|
|
16
|
-
const appHostId =
|
|
15
|
+
for (const serviceKey of serviceKeys) {
|
|
16
|
+
const appHostId = serviceKey.credentials['html5-apps-repo']?.app_host_id;
|
|
17
17
|
if (appHostId) {
|
|
18
18
|
// There might be multiple appHostIds separated by comma
|
|
19
19
|
const ids = appHostId.split(',').map((item) => item.trim());
|
|
@@ -25,13 +25,13 @@ function getAppHostIds(credentials) {
|
|
|
25
25
|
/**
|
|
26
26
|
* Discover apps from FDC API based on credentials.
|
|
27
27
|
*
|
|
28
|
-
* @param {
|
|
28
|
+
* @param {ServiceKeys[]} serviceKeys - The service keys containing app host IDs
|
|
29
29
|
* @param {CfConfig} cfConfig - The CF configuration
|
|
30
30
|
* @param {ToolsLogger} logger - The logger
|
|
31
31
|
* @returns {Promise<CFApp[]>} The discovered apps
|
|
32
32
|
*/
|
|
33
|
-
async function getCfApps(
|
|
34
|
-
const appHostIds = getAppHostIds(
|
|
33
|
+
async function getCfApps(serviceKeys, cfConfig, logger) {
|
|
34
|
+
const appHostIds = getAppHostIds(serviceKeys);
|
|
35
35
|
logger?.log(`App Host Ids: ${JSON.stringify(appHostIds)}`);
|
|
36
36
|
// Validate appHostIds array length (max 100 as per API specification)
|
|
37
37
|
if (appHostIds.length > 100) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
-
import type { HTML5Content,
|
|
2
|
+
import type { HTML5Content, ServiceInfo, Uaa, CfAppParams } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Get the OAuth token from HTML5 repository.
|
|
5
5
|
*
|
|
@@ -21,9 +21,9 @@ export declare function downloadZip(token: string, appHostId: string, uri: strin
|
|
|
21
21
|
*
|
|
22
22
|
* @param {string} spaceGuid space guid
|
|
23
23
|
* @param {ToolsLogger} logger logger to log messages
|
|
24
|
-
* @returns {Promise<
|
|
24
|
+
* @returns {Promise<ServiceInfo>} credentials json object
|
|
25
25
|
*/
|
|
26
|
-
export declare function getHtml5RepoCredentials(spaceGuid: string, logger: ToolsLogger): Promise<
|
|
26
|
+
export declare function getHtml5RepoCredentials(spaceGuid: string, logger: ToolsLogger): Promise<ServiceInfo>;
|
|
27
27
|
/**
|
|
28
28
|
* Download base app manifest.json and xs-app.json from HTML5 repository.
|
|
29
29
|
*
|
|
@@ -64,27 +64,27 @@ async function downloadZip(token, appHostId, uri) {
|
|
|
64
64
|
*
|
|
65
65
|
* @param {string} spaceGuid space guid
|
|
66
66
|
* @param {ToolsLogger} logger logger to log messages
|
|
67
|
-
* @returns {Promise<
|
|
67
|
+
* @returns {Promise<ServiceInfo>} credentials json object
|
|
68
68
|
*/
|
|
69
69
|
async function getHtml5RepoCredentials(spaceGuid, logger) {
|
|
70
70
|
try {
|
|
71
|
-
let
|
|
71
|
+
let serviceInfo = await (0, api_1.getServiceInstanceKeys)({
|
|
72
72
|
spaceGuids: [spaceGuid],
|
|
73
73
|
planNames: ['app-runtime'],
|
|
74
74
|
names: [HTML5_APPS_REPO_RUNTIME]
|
|
75
75
|
}, logger);
|
|
76
|
-
if (!serviceKeys?.
|
|
76
|
+
if (!serviceInfo?.serviceKeys?.length) {
|
|
77
77
|
const serviceName = await (0, api_1.getServiceNameByTags)(spaceGuid, ['html5-apps-repo-rt']);
|
|
78
78
|
await (0, api_1.createServiceInstance)('app-runtime', HTML5_APPS_REPO_RUNTIME, serviceName, {
|
|
79
79
|
logger
|
|
80
80
|
});
|
|
81
|
-
|
|
82
|
-
if (!serviceKeys?.
|
|
81
|
+
serviceInfo = await (0, api_1.getServiceInstanceKeys)({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
|
|
82
|
+
if (!serviceInfo?.serviceKeys?.length) {
|
|
83
83
|
logger.debug((0, i18n_1.t)('error.noUaaCredentialsFoundForHtml5Repo'));
|
|
84
84
|
throw new Error((0, i18n_1.t)('error.cannotFindHtml5RepoRuntime'));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
return
|
|
87
|
+
return serviceInfo;
|
|
88
88
|
}
|
|
89
89
|
catch (e) {
|
|
90
90
|
throw new Error((0, i18n_1.t)('error.failedToGetCredentialsFromHtml5Repo', { error: e.message }));
|
|
@@ -102,9 +102,9 @@ async function downloadAppContent(spaceGuid, parameters, logger) {
|
|
|
102
102
|
const { appHostId, appName, appVersion } = parameters;
|
|
103
103
|
const appNameVersion = `${appName}-${appVersion}`;
|
|
104
104
|
try {
|
|
105
|
-
const
|
|
106
|
-
const token = await getToken(
|
|
107
|
-
const uri = `${
|
|
105
|
+
const { serviceKeys, serviceInstance } = await getHtml5RepoCredentials(spaceGuid, logger);
|
|
106
|
+
const token = await getToken(serviceKeys[0]?.credentials.uaa);
|
|
107
|
+
const uri = `${serviceKeys[0]?.credentials.uri}/applications/content/${appNameVersion}?pathSuffixFilter=manifest.json,xs-app.json`;
|
|
108
108
|
const zip = await downloadZip(token, appHostId, uri);
|
|
109
109
|
let admZip;
|
|
110
110
|
try {
|
|
@@ -124,7 +124,7 @@ async function downloadAppContent(spaceGuid, parameters, logger) {
|
|
|
124
124
|
const manifest = JSON.parse(zipEntry.getData().toString('utf8'));
|
|
125
125
|
return {
|
|
126
126
|
entries: admZip.getEntries(),
|
|
127
|
-
serviceInstanceGuid:
|
|
127
|
+
serviceInstanceGuid: serviceInstance.guid,
|
|
128
128
|
manifest: manifest
|
|
129
129
|
};
|
|
130
130
|
}
|
package/dist/cf/core/auth.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isExternalLoginEnabled = isExternalLoginEnabled;
|
|
4
4
|
exports.isLoggedInCf = isLoggedInCf;
|
|
5
|
-
const
|
|
5
|
+
const cf_tools_1 = require("@sap/cf-tools");
|
|
6
6
|
/**
|
|
7
7
|
* Check if the external login is enabled.
|
|
8
8
|
*
|
|
@@ -26,7 +26,7 @@ async function isLoggedInCf(cfConfig, logger) {
|
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
29
|
-
const orgs =
|
|
29
|
+
const orgs = await (0, cf_tools_1.cfGetAvailableOrgs)();
|
|
30
30
|
logger?.log(`Available organizations: ${JSON.stringify(orgs)}`);
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
-
import type { CfConfig, CFApp, RequestArguments,
|
|
2
|
+
import type { CfConfig, CFApp, RequestArguments, GetServiceInstanceParams, MtaYaml, ServiceInfo } from '../../types';
|
|
3
3
|
interface CreateServiceOptions {
|
|
4
4
|
xsSecurityProjectName?: string;
|
|
5
5
|
templatePathOverwrite?: string;
|
|
6
6
|
logger?: ToolsLogger;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get the business service
|
|
9
|
+
* Get the business service info.
|
|
10
10
|
*
|
|
11
11
|
* @param {string} businessService - The business service.
|
|
12
12
|
* @param {CfConfig} config - The CF config.
|
|
13
13
|
* @param {ToolsLogger} logger - The logger.
|
|
14
|
-
* @returns {Promise<
|
|
14
|
+
* @returns {Promise<ServiceInfo | null>} The service info.
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function getBusinessServiceInfo(businessService: string, config: CfConfig, logger: ToolsLogger): Promise<ServiceInfo | null>;
|
|
17
17
|
/**
|
|
18
18
|
* Get the FDC request arguments.
|
|
19
19
|
*
|
|
@@ -64,8 +64,8 @@ export declare function createServices(yamlContent: MtaYaml, initialServices: st
|
|
|
64
64
|
*
|
|
65
65
|
* @param {GetServiceInstanceParams} serviceInstanceQuery - The service instance query.
|
|
66
66
|
* @param {ToolsLogger} logger - The logger.
|
|
67
|
-
* @returns {Promise<
|
|
67
|
+
* @returns {Promise<ServiceInfo | null>} The service instance keys.
|
|
68
68
|
*/
|
|
69
|
-
export declare function getServiceInstanceKeys(serviceInstanceQuery: GetServiceInstanceParams, logger: ToolsLogger): Promise<
|
|
69
|
+
export declare function getServiceInstanceKeys(serviceInstanceQuery: GetServiceInstanceParams, logger: ToolsLogger): Promise<ServiceInfo | null>;
|
|
70
70
|
export {};
|
|
71
71
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/cf/services/api.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.getBusinessServiceInfo = getBusinessServiceInfo;
|
|
40
40
|
exports.getFDCRequestArguments = getFDCRequestArguments;
|
|
41
41
|
exports.getFDCApps = getFDCApps;
|
|
42
42
|
exports.createServiceInstance = createServiceInstance;
|
|
@@ -46,7 +46,7 @@ exports.getServiceInstanceKeys = getServiceInstanceKeys;
|
|
|
46
46
|
const fs = __importStar(require("node:fs"));
|
|
47
47
|
const axios_1 = __importDefault(require("axios"));
|
|
48
48
|
const path = __importStar(require("node:path"));
|
|
49
|
-
const
|
|
49
|
+
const cf_tools_1 = require("@sap/cf-tools");
|
|
50
50
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
51
51
|
const i18n_1 = require("../../i18n");
|
|
52
52
|
const project_1 = require("../project");
|
|
@@ -57,14 +57,14 @@ const PARAM_MAP = new Map([
|
|
|
57
57
|
['names', 'names']
|
|
58
58
|
]);
|
|
59
59
|
/**
|
|
60
|
-
* Get the business service
|
|
60
|
+
* Get the business service info.
|
|
61
61
|
*
|
|
62
62
|
* @param {string} businessService - The business service.
|
|
63
63
|
* @param {CfConfig} config - The CF config.
|
|
64
64
|
* @param {ToolsLogger} logger - The logger.
|
|
65
|
-
* @returns {Promise<
|
|
65
|
+
* @returns {Promise<ServiceInfo | null>} The service info.
|
|
66
66
|
*/
|
|
67
|
-
async function
|
|
67
|
+
async function getBusinessServiceInfo(businessService, config, logger) {
|
|
68
68
|
const serviceKeys = await getServiceInstanceKeys({
|
|
69
69
|
spaceGuids: [config.space.GUID],
|
|
70
70
|
names: [businessService]
|
|
@@ -171,7 +171,7 @@ async function createServiceInstance(plan, serviceInstanceName, serviceName, opt
|
|
|
171
171
|
}
|
|
172
172
|
commandParameters.push('-c', JSON.stringify(xsSecurity));
|
|
173
173
|
}
|
|
174
|
-
await
|
|
174
|
+
await cf_tools_1.Cli.execute(commandParameters);
|
|
175
175
|
logger?.log(`Service instance '${serviceInstanceName}' created successfully`);
|
|
176
176
|
}
|
|
177
177
|
catch (e) {
|
|
@@ -227,7 +227,7 @@ async function createServices(yamlContent, initialServices, timestamp, templateP
|
|
|
227
227
|
*
|
|
228
228
|
* @param {GetServiceInstanceParams} serviceInstanceQuery - The service instance query.
|
|
229
229
|
* @param {ToolsLogger} logger - The logger.
|
|
230
|
-
* @returns {Promise<
|
|
230
|
+
* @returns {Promise<ServiceInfo | null>} The service instance keys.
|
|
231
231
|
*/
|
|
232
232
|
async function getServiceInstanceKeys(serviceInstanceQuery, logger) {
|
|
233
233
|
try {
|
|
@@ -236,7 +236,7 @@ async function getServiceInstanceKeys(serviceInstanceQuery, logger) {
|
|
|
236
236
|
// We can use any instance in the list to connect to HTML5 Repo
|
|
237
237
|
logger?.log(`Use '${serviceInstances[0].name}' HTML5 Repo instance`);
|
|
238
238
|
return {
|
|
239
|
-
|
|
239
|
+
serviceKeys: await getOrCreateServiceKeys(serviceInstances[0], logger),
|
|
240
240
|
serviceInstance: serviceInstances[0]
|
|
241
241
|
};
|
|
242
242
|
}
|
|
@@ -279,7 +279,7 @@ async function getServiceInstance(params) {
|
|
|
279
279
|
*
|
|
280
280
|
* @param {ServiceInstance} serviceInstance - The service instance.
|
|
281
281
|
* @param {ToolsLogger} logger - The logger.
|
|
282
|
-
* @returns {Promise<ServiceKeys
|
|
282
|
+
* @returns {Promise<ServiceKeys[]>} The service instance keys.
|
|
283
283
|
*/
|
|
284
284
|
async function getOrCreateServiceKeys(serviceInstance, logger) {
|
|
285
285
|
const serviceInstanceName = serviceInstance.name;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ServiceKeys } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Checks if Cloud Foundry is installed.
|
|
5
5
|
*
|
|
@@ -11,9 +11,9 @@ export declare function isCfInstalled(logger: ToolsLogger): Promise<boolean>;
|
|
|
11
11
|
* Gets the service instance credentials.
|
|
12
12
|
*
|
|
13
13
|
* @param {string} serviceInstanceGuid - The service instance GUID.
|
|
14
|
-
* @returns {Promise<
|
|
14
|
+
* @returns {Promise<ServiceKeys[]>} The service instance credentials.
|
|
15
15
|
*/
|
|
16
|
-
export declare function getServiceKeys(serviceInstanceGuid: string): Promise<
|
|
16
|
+
export declare function getServiceKeys(serviceInstanceGuid: string): Promise<ServiceKeys[]>;
|
|
17
17
|
/**
|
|
18
18
|
* Creates a service key.
|
|
19
19
|
*
|
package/dist/cf/services/cli.js
CHANGED
|
@@ -4,9 +4,7 @@ exports.isCfInstalled = isCfInstalled;
|
|
|
4
4
|
exports.getServiceKeys = getServiceKeys;
|
|
5
5
|
exports.createServiceKey = createServiceKey;
|
|
6
6
|
exports.requestCfApi = requestCfApi;
|
|
7
|
-
const
|
|
8
|
-
const CFToolsCli = require("@sap/cf-tools/out/src/cli");
|
|
9
|
-
const types_1 = require("@sap/cf-tools/out/src/types");
|
|
7
|
+
const cf_tools_1 = require("@sap/cf-tools");
|
|
10
8
|
const i18n_1 = require("../../i18n");
|
|
11
9
|
const ENV = { env: { 'CF_COLOR': 'false' } };
|
|
12
10
|
/**
|
|
@@ -17,7 +15,7 @@ const ENV = { env: { 'CF_COLOR': 'false' } };
|
|
|
17
15
|
*/
|
|
18
16
|
async function isCfInstalled(logger) {
|
|
19
17
|
try {
|
|
20
|
-
const response = await
|
|
18
|
+
const response = await cf_tools_1.Cli.execute(['version'], ENV);
|
|
21
19
|
if (response.exitCode !== 0) {
|
|
22
20
|
throw new Error(response.stderr);
|
|
23
21
|
}
|
|
@@ -32,16 +30,15 @@ async function isCfInstalled(logger) {
|
|
|
32
30
|
* Gets the service instance credentials.
|
|
33
31
|
*
|
|
34
32
|
* @param {string} serviceInstanceGuid - The service instance GUID.
|
|
35
|
-
* @returns {Promise<
|
|
33
|
+
* @returns {Promise<ServiceKeys[]>} The service instance credentials.
|
|
36
34
|
*/
|
|
37
35
|
async function getServiceKeys(serviceInstanceGuid) {
|
|
38
36
|
try {
|
|
39
|
-
return await
|
|
37
|
+
return await (0, cf_tools_1.cfGetInstanceCredentials)({
|
|
40
38
|
filters: [
|
|
41
39
|
{
|
|
42
40
|
value: serviceInstanceGuid,
|
|
43
|
-
|
|
44
|
-
key: types_1.eFilters.service_instance_guid
|
|
41
|
+
key: cf_tools_1.eFilters.service_instance_guids
|
|
45
42
|
}
|
|
46
43
|
]
|
|
47
44
|
});
|
|
@@ -58,7 +55,7 @@ async function getServiceKeys(serviceInstanceGuid) {
|
|
|
58
55
|
*/
|
|
59
56
|
async function createServiceKey(serviceInstanceName, serviceKeyName) {
|
|
60
57
|
try {
|
|
61
|
-
const cliResult = await
|
|
58
|
+
const cliResult = await cf_tools_1.Cli.execute(['create-service-key', serviceInstanceName, serviceKeyName], ENV);
|
|
62
59
|
if (cliResult.exitCode !== 0) {
|
|
63
60
|
throw new Error(cliResult.stderr);
|
|
64
61
|
}
|
|
@@ -75,7 +72,7 @@ async function createServiceKey(serviceInstanceName, serviceKeyName) {
|
|
|
75
72
|
*/
|
|
76
73
|
async function requestCfApi(url) {
|
|
77
74
|
try {
|
|
78
|
-
const response = await
|
|
75
|
+
const response = await cf_tools_1.Cli.execute(['curl', url], ENV);
|
|
79
76
|
if (response.exitCode === 0) {
|
|
80
77
|
try {
|
|
81
78
|
return JSON.parse(response.stdout);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type AdmZip from 'adm-zip';
|
|
2
2
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
3
|
import type { Manifest } from '@sap-ux/project-access';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ServiceKeys, XsApp } from '../../types';
|
|
5
5
|
/**
|
|
6
6
|
* Validate the smart template application.
|
|
7
7
|
*
|
|
@@ -29,9 +29,9 @@ export declare function extractXSApp(zipEntries: AdmZip.IZipEntry[]): XsApp | un
|
|
|
29
29
|
* Validate the OData endpoints, data sources and routes.
|
|
30
30
|
*
|
|
31
31
|
* @param {AdmZip.IZipEntry[]} zipEntries - The zip entries.
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {ServiceKeys[]} serviceKeys - The service keys.
|
|
33
33
|
* @param {ToolsLogger} logger - The logger.
|
|
34
34
|
* @returns {Promise<string[]>} The messages.
|
|
35
35
|
*/
|
|
36
|
-
export declare function validateODataEndpoints(zipEntries: AdmZip.IZipEntry[],
|
|
36
|
+
export declare function validateODataEndpoints(zipEntries: AdmZip.IZipEntry[], serviceKeys: ServiceKeys[], logger: ToolsLogger): Promise<void>;
|
|
37
37
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -91,11 +91,11 @@ function matchRoutesAndDatasources(dataSources, routes, serviceKeyEndpoints) {
|
|
|
91
91
|
* Validate the OData endpoints, data sources and routes.
|
|
92
92
|
*
|
|
93
93
|
* @param {AdmZip.IZipEntry[]} zipEntries - The zip entries.
|
|
94
|
-
* @param {
|
|
94
|
+
* @param {ServiceKeys[]} serviceKeys - The service keys.
|
|
95
95
|
* @param {ToolsLogger} logger - The logger.
|
|
96
96
|
* @returns {Promise<string[]>} The messages.
|
|
97
97
|
*/
|
|
98
|
-
async function validateODataEndpoints(zipEntries,
|
|
98
|
+
async function validateODataEndpoints(zipEntries, serviceKeys, logger) {
|
|
99
99
|
const messages = [];
|
|
100
100
|
let xsApp;
|
|
101
101
|
try {
|
|
@@ -116,7 +116,7 @@ async function validateODataEndpoints(zipEntries, credentials, logger) {
|
|
|
116
116
|
const dataSources = manifest?.['sap.app']?.dataSources;
|
|
117
117
|
const routes = xsApp?.routes;
|
|
118
118
|
if (dataSources && routes) {
|
|
119
|
-
const serviceKeyEndpoints = [].concat(...
|
|
119
|
+
const serviceKeyEndpoints = [].concat(...serviceKeys.map(({ credentials }) => (credentials.endpoints ? Object.keys(credentials.endpoints) : [])));
|
|
120
120
|
messages.push(...matchRoutesAndDatasources(dataSources, routes, serviceKeyEndpoints));
|
|
121
121
|
}
|
|
122
122
|
else if (routes && !dataSources) {
|
package/dist/types.d.ts
CHANGED
|
@@ -77,7 +77,6 @@ export interface AdpWriterConfig {
|
|
|
77
77
|
name?: string;
|
|
78
78
|
description?: string;
|
|
79
79
|
};
|
|
80
|
-
flp?: FlpConfig;
|
|
81
80
|
customConfig?: CustomConfig;
|
|
82
81
|
/**
|
|
83
82
|
* Optional: configuration for deployment to ABAP
|
|
@@ -195,7 +194,6 @@ export interface InternalInboundNavigation extends NewInboundNavigation {
|
|
|
195
194
|
/** Identifier for the inbound navigation. */
|
|
196
195
|
inboundId: string;
|
|
197
196
|
}
|
|
198
|
-
export type FlpConfig = ChangeInboundNavigation | NewInboundNavigation;
|
|
199
197
|
export interface Language {
|
|
200
198
|
sap: string;
|
|
201
199
|
i18n: string;
|
|
@@ -740,14 +738,16 @@ export interface CfAppParams {
|
|
|
740
738
|
export interface AppParamsExtended extends CfAppParams {
|
|
741
739
|
spaceGuid: string;
|
|
742
740
|
}
|
|
743
|
-
export interface CfCredentials {
|
|
744
|
-
[key: string]: any;
|
|
745
|
-
uaa: Uaa;
|
|
746
|
-
uri: string;
|
|
747
|
-
endpoints: any;
|
|
748
|
-
}
|
|
749
741
|
export interface ServiceKeys {
|
|
750
|
-
credentials:
|
|
742
|
+
credentials: {
|
|
743
|
+
[key: string]: any;
|
|
744
|
+
uaa: Uaa;
|
|
745
|
+
uri: string;
|
|
746
|
+
endpoints: any;
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
export interface ServiceInfo {
|
|
750
|
+
serviceKeys: ServiceKeys[];
|
|
751
751
|
serviceInstance: ServiceInstance;
|
|
752
752
|
}
|
|
753
753
|
export interface HTML5Content {
|
|
@@ -5,11 +5,11 @@ import type { InternalInboundNavigation, DescriptorVariantContent } from '../typ
|
|
|
5
5
|
* Generates and writes the inbound configuration to the manifest.appdescr_variant file.
|
|
6
6
|
*
|
|
7
7
|
* @param basePath - The base path of the project.
|
|
8
|
-
* @param
|
|
8
|
+
* @param configs - The inbound configuration properties.
|
|
9
9
|
* @param fs - Optional mem-fs editor instance.
|
|
10
10
|
* @returns The mem-fs editor instance.
|
|
11
11
|
*/
|
|
12
|
-
export declare function generateInboundConfig(basePath: string,
|
|
12
|
+
export declare function generateInboundConfig(basePath: string, configs: InternalInboundNavigation[], fs?: Editor): Promise<Editor>;
|
|
13
13
|
/**
|
|
14
14
|
* Generates i18n entries for FLP configuration based on the provided configuration and application ID.
|
|
15
15
|
*
|
|
@@ -23,11 +23,11 @@ export declare function getFlpI18nKeys(config: InternalInboundNavigation, appId:
|
|
|
23
23
|
*
|
|
24
24
|
* @param {string} basePath - The base path of the project.
|
|
25
25
|
* @param {string} appId - The application ID used to generate i18n keys.
|
|
26
|
-
* @param {InternalInboundNavigation}
|
|
26
|
+
* @param {InternalInboundNavigation[]} configs - The inbound configuration properties.
|
|
27
27
|
* @param {Editor} fs - The mem-fs editor instance for file operations.
|
|
28
28
|
* @returns {Promise<void>} A promise that resolves when the i18n file is updated.
|
|
29
29
|
*/
|
|
30
|
-
export declare function updateI18n(basePath: string, appId: string,
|
|
30
|
+
export declare function updateI18n(basePath: string, appId: string, configs: InternalInboundNavigation[], fs: Editor): Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* Removes elements with changeType 'appdescr_app_addNewInbound', 'appdescr_app_removeAllInboundsExceptOne' and 'appdescr_app_changeInbound' from the given array.
|
|
33
33
|
*
|
|
@@ -17,22 +17,25 @@ const options_1 = require("./options");
|
|
|
17
17
|
* Generates and writes the inbound configuration to the manifest.appdescr_variant file.
|
|
18
18
|
*
|
|
19
19
|
* @param basePath - The base path of the project.
|
|
20
|
-
* @param
|
|
20
|
+
* @param configs - The inbound configuration properties.
|
|
21
21
|
* @param fs - Optional mem-fs editor instance.
|
|
22
22
|
* @returns The mem-fs editor instance.
|
|
23
23
|
*/
|
|
24
|
-
async function generateInboundConfig(basePath,
|
|
24
|
+
async function generateInboundConfig(basePath, configs, fs) {
|
|
25
25
|
if (!fs) {
|
|
26
26
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
27
27
|
}
|
|
28
28
|
const variant = await (0, __1.getVariant)(basePath, fs);
|
|
29
29
|
variant.content = removeInboundChangeTypes(variant.content);
|
|
30
|
-
if
|
|
31
|
-
|
|
30
|
+
// Set default inbound IDs if missing
|
|
31
|
+
for (const config of configs) {
|
|
32
|
+
if (!config?.inboundId) {
|
|
33
|
+
config.inboundId = `${variant.id}.InboundID`;
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
|
-
(0, options_1.enhanceManifestChangeContentWithFlpConfig)(
|
|
36
|
+
(0, options_1.enhanceManifestChangeContentWithFlpConfig)(configs, variant.id, variant.content);
|
|
34
37
|
await (0, __1.updateVariant)(basePath, variant, fs);
|
|
35
|
-
await updateI18n(basePath, variant.id,
|
|
38
|
+
await updateI18n(basePath, variant.id, configs, fs);
|
|
36
39
|
return fs;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
@@ -64,12 +67,15 @@ function getFlpI18nKeys(config, appId) {
|
|
|
64
67
|
*
|
|
65
68
|
* @param {string} basePath - The base path of the project.
|
|
66
69
|
* @param {string} appId - The application ID used to generate i18n keys.
|
|
67
|
-
* @param {InternalInboundNavigation}
|
|
70
|
+
* @param {InternalInboundNavigation[]} configs - The inbound configuration properties.
|
|
68
71
|
* @param {Editor} fs - The mem-fs editor instance for file operations.
|
|
69
72
|
* @returns {Promise<void>} A promise that resolves when the i18n file is updated.
|
|
70
73
|
*/
|
|
71
|
-
async function updateI18n(basePath, appId,
|
|
72
|
-
|
|
74
|
+
async function updateI18n(basePath, appId, configs, fs) {
|
|
75
|
+
let newEntries = [];
|
|
76
|
+
for (const config of configs) {
|
|
77
|
+
newEntries = newEntries.concat(getFlpI18nKeys(config, appId));
|
|
78
|
+
}
|
|
73
79
|
const i18nPath = node_path_1.default.join(basePath, 'webapp', 'i18n', 'i18n.properties');
|
|
74
80
|
const keysToRemove = [`${appId}_sap.app.crossNavigation.inbounds`];
|
|
75
81
|
await (0, i18n_1.removeAndCreateI18nEntries)(i18nPath, newEntries, keysToRemove, basePath, fs);
|
package/dist/writer/index.js
CHANGED
|
@@ -6,7 +6,6 @@ const node_path_1 = require("node:path");
|
|
|
6
6
|
const mem_fs_1 = require("mem-fs");
|
|
7
7
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
8
8
|
const manifest_1 = require("./manifest");
|
|
9
|
-
const options_1 = require("./options");
|
|
10
9
|
const i18n_1 = require("./i18n");
|
|
11
10
|
const project_utils_1 = require("./project-utils");
|
|
12
11
|
const source_1 = require("../source");
|
|
@@ -24,7 +23,6 @@ function setDefaults(config) {
|
|
|
24
23
|
ui5: { ...config.ui5 },
|
|
25
24
|
deploy: config.deploy ? { ...config.deploy } : undefined,
|
|
26
25
|
options: { ...config.options },
|
|
27
|
-
flp: config.flp ? { ...config.flp } : undefined,
|
|
28
26
|
customConfig: config.customConfig ? { ...config.customConfig } : undefined
|
|
29
27
|
};
|
|
30
28
|
configWithDefaults.app.title ??= `Adaptation of ${config.app.reference}`;
|
|
@@ -36,12 +34,6 @@ function setDefaults(config) {
|
|
|
36
34
|
configWithDefaults.app.i18nDescription ??= (0, i18n_1.getI18nDescription)(configWithDefaults.app.layer, configWithDefaults.app.title);
|
|
37
35
|
configWithDefaults.app.appType ??= (0, source_1.getApplicationType)(configWithDefaults.app.manifest);
|
|
38
36
|
configWithDefaults.app.content ??= (0, manifest_1.getManifestContent)(configWithDefaults);
|
|
39
|
-
if (configWithDefaults.flp && !configWithDefaults.flp.inboundId) {
|
|
40
|
-
configWithDefaults.flp.inboundId = `${configWithDefaults.app.id}.InboundID`;
|
|
41
|
-
}
|
|
42
|
-
if (configWithDefaults.customConfig?.adp.environment === 'C' && configWithDefaults.flp) {
|
|
43
|
-
(0, options_1.enhanceManifestChangeContentWithFlpConfig)(configWithDefaults.flp, configWithDefaults.app.id, configWithDefaults.app.content);
|
|
44
|
-
}
|
|
45
37
|
return configWithDefaults;
|
|
46
38
|
}
|
|
47
39
|
/**
|
package/dist/writer/options.d.ts
CHANGED
|
@@ -56,11 +56,11 @@ export declare function enhanceUI5DeployYaml(ui5Config: UI5Config, config: AdpWr
|
|
|
56
56
|
/**
|
|
57
57
|
* Generate Inbound change content required for manifest.appdescriptor.
|
|
58
58
|
*
|
|
59
|
-
* @param
|
|
59
|
+
* @param flpConfigurations FLP cloud project configuration
|
|
60
60
|
* @param appId Application variant id
|
|
61
61
|
* @param manifestChangeContent Application variant change content
|
|
62
62
|
*/
|
|
63
|
-
export declare function enhanceManifestChangeContentWithFlpConfig(
|
|
63
|
+
export declare function enhanceManifestChangeContentWithFlpConfig(flpConfigurations: InternalInboundNavigation[], appId: string, manifestChangeContent?: Content[]): void;
|
|
64
64
|
/**
|
|
65
65
|
* Generate custom configuration required for the ui5.yaml.
|
|
66
66
|
*
|
package/dist/writer/options.js
CHANGED
|
@@ -267,13 +267,13 @@ function getInboundChangeContentWithNewInboundID(flpConfiguration, appId) {
|
|
|
267
267
|
/**
|
|
268
268
|
* Generate Inbound change content required for manifest.appdescriptor.
|
|
269
269
|
*
|
|
270
|
-
* @param
|
|
270
|
+
* @param flpConfigurations FLP cloud project configuration
|
|
271
271
|
* @param appId Application variant id
|
|
272
272
|
* @param manifestChangeContent Application variant change content
|
|
273
273
|
*/
|
|
274
|
-
function enhanceManifestChangeContentWithFlpConfig(
|
|
275
|
-
const
|
|
276
|
-
|
|
274
|
+
function enhanceManifestChangeContentWithFlpConfig(flpConfigurations, appId, manifestChangeContent = []) {
|
|
275
|
+
for (const [index, flpConfig] of flpConfigurations.entries()) {
|
|
276
|
+
const inboundChangeContent = getInboundChangeContentWithNewInboundID(flpConfig, appId);
|
|
277
277
|
const addInboundChange = {
|
|
278
278
|
changeType: 'appdescr_app_addNewInbound',
|
|
279
279
|
content: inboundChangeContent,
|
|
@@ -281,15 +281,19 @@ function enhanceManifestChangeContentWithFlpConfig(flpConfiguration, appId, mani
|
|
|
281
281
|
'i18n': 'i18n/i18n.properties'
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
|
-
const removeOtherInboundsChange = {
|
|
285
|
-
changeType: 'appdescr_app_removeAllInboundsExceptOne',
|
|
286
|
-
content: {
|
|
287
|
-
'inboundId': flpConfiguration.inboundId
|
|
288
|
-
},
|
|
289
|
-
texts: {}
|
|
290
|
-
};
|
|
291
284
|
manifestChangeContent.push(addInboundChange);
|
|
292
|
-
|
|
285
|
+
// Remove all inbounds except one should be only after the first inbound is added
|
|
286
|
+
// This is implemented this way to avoid issues with the merged on ABAP side
|
|
287
|
+
if (index === 0) {
|
|
288
|
+
const removeOtherInboundsChange = {
|
|
289
|
+
changeType: 'appdescr_app_removeAllInboundsExceptOne',
|
|
290
|
+
content: {
|
|
291
|
+
'inboundId': flpConfig.inboundId
|
|
292
|
+
},
|
|
293
|
+
texts: {}
|
|
294
|
+
};
|
|
295
|
+
manifestChangeContent.push(removeOtherInboundsChange);
|
|
296
|
+
}
|
|
293
297
|
}
|
|
294
298
|
}
|
|
295
299
|
/**
|
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.18.
|
|
12
|
+
"version": "0.18.2",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@sap-devx/yeoman-ui-types": "1.16.9",
|
|
27
|
-
"@sap/cf-tools": "
|
|
27
|
+
"@sap/cf-tools": "3.2.2",
|
|
28
28
|
"adm-zip": "0.5.10",
|
|
29
29
|
"axios": "1.12.2",
|
|
30
30
|
"ejs": "3.1.10",
|
|
@@ -4,9 +4,3 @@
|
|
|
4
4
|
|
|
5
5
|
#XTIT: Application name
|
|
6
6
|
<%- app.id %>_sap.app.title=<%- app.title %>
|
|
7
|
-
<% if (customConfig?.adp.environment === "C" && flp) { %>
|
|
8
|
-
# FLP Configuration
|
|
9
|
-
|
|
10
|
-
<%= app.id %>_sap.app.crossNavigation.inbounds.<%= flp.inboundId %>.title=<%= flp.title %><% if (flp.subTitle) { %>
|
|
11
|
-
<%= app.id %>_sap.app.crossNavigation.inbounds.<%= flp.inboundId %>.subTitle=<%= flp.subTitle %><% } %>
|
|
12
|
-
<% } %>
|