@sap-ux/adp-tooling 0.18.11 → 0.18.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/helper.d.ts +24 -2
- package/dist/base/helper.js +49 -0
- package/dist/cf/app/discovery.d.ts +16 -0
- package/dist/cf/app/discovery.js +62 -0
- package/dist/cf/services/api.d.ts +9 -1
- package/dist/cf/services/api.js +1 -0
- package/dist/preview/adp-preview.d.ts +8 -1
- package/dist/preview/adp-preview.js +20 -2
- package/dist/preview/routes-handler.d.ts +4 -0
- package/dist/preview/routes-handler.js +14 -0
- package/dist/types.d.ts +21 -0
- package/dist/writer/cf.js +0 -1
- package/dist/writer/options.d.ts +2 -1
- package/dist/writer/options.js +31 -6
- package/dist/writer/project-utils.d.ts +0 -9
- package/dist/writer/project-utils.js +3 -27
- package/dist/writer/writer-config.js +4 -1
- package/package.json +5 -5
- package/templates/cf/_gitignore +5 -6
- package/templates/cf/package.json +3 -7
- package/templates/cf/ui5.yaml +1 -1
- package/templates/cf/ui5-build.yaml +0 -5
package/dist/base/helper.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { ReaderCollection } from '@ui5/fs';
|
|
2
3
|
import type { UI5Config } from '@sap-ux/ui5-config';
|
|
3
4
|
import type { Inbound } from '@sap-ux/axios-extension';
|
|
4
|
-
import { type ManifestNamespace } from '@sap-ux/project-access';
|
|
5
|
-
import type { DescriptorVariant, AdpPreviewConfig } from '../types';
|
|
5
|
+
import { type ManifestNamespace, type Manifest } from '@sap-ux/project-access';
|
|
6
|
+
import type { DescriptorVariant, AdpPreviewConfig, UI5YamlCustomTaskConfiguration } from '../types';
|
|
6
7
|
/**
|
|
7
8
|
* Get the app descriptor variant.
|
|
8
9
|
*
|
|
@@ -52,6 +53,27 @@ export declare function readUi5Config(basePath: string, yamlPath: string): Promi
|
|
|
52
53
|
* @returns The `AdpPreviewConfig` object if found, otherwise `undefined`.
|
|
53
54
|
*/
|
|
54
55
|
export declare function extractAdpConfig(ui5Conf: UI5Config): AdpPreviewConfig | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Extracts the CF build task from the UI5 configuration.
|
|
58
|
+
*
|
|
59
|
+
* @param {UI5Config} ui5Conf - The UI5 configuration.
|
|
60
|
+
* @returns {UI5YamlCustomTaskConfiguration} The CF build task.
|
|
61
|
+
*/
|
|
62
|
+
export declare function extractCfBuildTask(ui5Conf: UI5Config): UI5YamlCustomTaskConfiguration;
|
|
63
|
+
/**
|
|
64
|
+
* Read the manifest from the build output folder.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} cfBuildPath - The path to the build output folder.
|
|
67
|
+
* @returns {Manifest} The manifest.
|
|
68
|
+
*/
|
|
69
|
+
export declare function readManifestFromBuildPath(cfBuildPath: string): Manifest;
|
|
70
|
+
/**
|
|
71
|
+
* Load and parse the app variant descriptor.
|
|
72
|
+
*
|
|
73
|
+
* @param {ReaderCollection} rootProject - The root project.
|
|
74
|
+
* @returns {Promise<DescriptorVariant>} The parsed descriptor variant.
|
|
75
|
+
*/
|
|
76
|
+
export declare function loadAppVariant(rootProject: ReaderCollection): Promise<DescriptorVariant>;
|
|
55
77
|
/**
|
|
56
78
|
* Convenience wrapper that reads the ui5.yaml and directly returns the ADP preview configuration.
|
|
57
79
|
* Throws if the configuration cannot be found.
|
package/dist/base/helper.js
CHANGED
|
@@ -6,6 +6,9 @@ exports.flpConfigurationExists = flpConfigurationExists;
|
|
|
6
6
|
exports.isTypescriptSupported = isTypescriptSupported;
|
|
7
7
|
exports.readUi5Config = readUi5Config;
|
|
8
8
|
exports.extractAdpConfig = extractAdpConfig;
|
|
9
|
+
exports.extractCfBuildTask = extractCfBuildTask;
|
|
10
|
+
exports.readManifestFromBuildPath = readManifestFromBuildPath;
|
|
11
|
+
exports.loadAppVariant = loadAppVariant;
|
|
9
12
|
exports.getAdpConfig = getAdpConfig;
|
|
10
13
|
exports.getWebappFiles = getWebappFiles;
|
|
11
14
|
exports.filterAndMapInboundsToManifest = filterAndMapInboundsToManifest;
|
|
@@ -81,6 +84,52 @@ function extractAdpConfig(ui5Conf) {
|
|
|
81
84
|
ui5Conf.findCustomMiddleware('preview-middleware');
|
|
82
85
|
return customMiddleware?.configuration?.adp;
|
|
83
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Extracts the CF build task from the UI5 configuration.
|
|
89
|
+
*
|
|
90
|
+
* @param {UI5Config} ui5Conf - The UI5 configuration.
|
|
91
|
+
* @returns {UI5YamlCustomTaskConfiguration} The CF build task.
|
|
92
|
+
*/
|
|
93
|
+
function extractCfBuildTask(ui5Conf) {
|
|
94
|
+
const buildTask = ui5Conf.findCustomTask('app-variant-bundler-build')?.configuration;
|
|
95
|
+
if (!buildTask) {
|
|
96
|
+
throw new Error('No CF ADP project found');
|
|
97
|
+
}
|
|
98
|
+
return buildTask;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Read the manifest from the build output folder.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} cfBuildPath - The path to the build output folder.
|
|
104
|
+
* @returns {Manifest} The manifest.
|
|
105
|
+
*/
|
|
106
|
+
function readManifestFromBuildPath(cfBuildPath) {
|
|
107
|
+
const distPath = (0, node_path_1.join)(process.cwd(), cfBuildPath);
|
|
108
|
+
const manifestPath = (0, node_path_1.join)(distPath, 'manifest.json');
|
|
109
|
+
return JSON.parse((0, node_fs_1.readFileSync)(manifestPath, 'utf-8'));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Load and parse the app variant descriptor.
|
|
113
|
+
*
|
|
114
|
+
* @param {ReaderCollection} rootProject - The root project.
|
|
115
|
+
* @returns {Promise<DescriptorVariant>} The parsed descriptor variant.
|
|
116
|
+
*/
|
|
117
|
+
async function loadAppVariant(rootProject) {
|
|
118
|
+
const appVariant = await rootProject.byPath('/manifest.appdescr_variant');
|
|
119
|
+
if (!appVariant) {
|
|
120
|
+
throw new Error('ADP configured but no manifest.appdescr_variant found.');
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const content = await appVariant.getString();
|
|
124
|
+
if (!content || content.trim() === '') {
|
|
125
|
+
throw new Error('ADP configured but manifest.appdescr_variant file is empty.');
|
|
126
|
+
}
|
|
127
|
+
return JSON.parse(content);
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
throw new Error(`Failed to parse manifest.appdescr_variant: ${e.message}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
84
133
|
/**
|
|
85
134
|
* Convenience wrapper that reads the ui5.yaml and directly returns the ADP preview configuration.
|
|
86
135
|
* Throws if the configuration cannot be found.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type AdmZip from 'adm-zip';
|
|
1
2
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
3
|
import type { CfConfig, CFApp, ServiceKeys } from '../../types';
|
|
3
4
|
/**
|
|
@@ -7,6 +8,21 @@ import type { CfConfig, CFApp, ServiceKeys } from '../../types';
|
|
|
7
8
|
* @returns {string[]} The app host ids.
|
|
8
9
|
*/
|
|
9
10
|
export declare function getAppHostIds(serviceKeys: ServiceKeys[]): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Extracts the backend URL from service key credentials. Iterates through all endpoint keys to find the first endpoint with a URL.
|
|
13
|
+
*
|
|
14
|
+
* @param {ServiceKeys[]} serviceKeys - The credentials from service keys.
|
|
15
|
+
* @returns {string | undefined} The backend URL or undefined if not found.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getBackendUrlFromServiceKeys(serviceKeys: ServiceKeys[]): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts OAuth paths from xs-app.json routes that have a source property.
|
|
20
|
+
* These paths should receive OAuth Bearer tokens in the middleware.
|
|
21
|
+
*
|
|
22
|
+
* @param {AdmZip.IZipEntry[]} zipEntries - The zip entries containing xs-app.json.
|
|
23
|
+
* @returns {string[]} Array of path patterns (from route.source) that have a source property.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getOAuthPathsFromXsApp(zipEntries: AdmZip.IZipEntry[]): string[];
|
|
10
26
|
/**
|
|
11
27
|
* Discover apps from FDC API based on credentials.
|
|
12
28
|
*
|
package/dist/cf/app/discovery.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAppHostIds = getAppHostIds;
|
|
4
|
+
exports.getBackendUrlFromServiceKeys = getBackendUrlFromServiceKeys;
|
|
5
|
+
exports.getOAuthPathsFromXsApp = getOAuthPathsFromXsApp;
|
|
4
6
|
exports.getCfApps = getCfApps;
|
|
5
7
|
const i18n_1 = require("../../i18n");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
6
9
|
const api_1 = require("../services/api");
|
|
7
10
|
/**
|
|
8
11
|
* Get the app host ids.
|
|
@@ -22,6 +25,65 @@ function getAppHostIds(serviceKeys) {
|
|
|
22
25
|
}
|
|
23
26
|
return [...new Set(appHostIds)];
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Extracts the backend URL from service key credentials. Iterates through all endpoint keys to find the first endpoint with a URL.
|
|
30
|
+
*
|
|
31
|
+
* @param {ServiceKeys[]} serviceKeys - The credentials from service keys.
|
|
32
|
+
* @returns {string | undefined} The backend URL or undefined if not found.
|
|
33
|
+
*/
|
|
34
|
+
function getBackendUrlFromServiceKeys(serviceKeys) {
|
|
35
|
+
if (!serviceKeys || serviceKeys.length === 0) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const endpoints = serviceKeys[0]?.credentials?.endpoints;
|
|
39
|
+
if (endpoints) {
|
|
40
|
+
for (const key in endpoints) {
|
|
41
|
+
if (Object.hasOwn(endpoints, key)) {
|
|
42
|
+
const endpoint = endpoints[key];
|
|
43
|
+
if (endpoint && typeof endpoint === 'object' && endpoint.url && typeof endpoint.url === 'string') {
|
|
44
|
+
return endpoint.url;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Extracts OAuth paths from xs-app.json routes that have a source property.
|
|
53
|
+
* These paths should receive OAuth Bearer tokens in the middleware.
|
|
54
|
+
*
|
|
55
|
+
* @param {AdmZip.IZipEntry[]} zipEntries - The zip entries containing xs-app.json.
|
|
56
|
+
* @returns {string[]} Array of path patterns (from route.source) that have a source property.
|
|
57
|
+
*/
|
|
58
|
+
function getOAuthPathsFromXsApp(zipEntries) {
|
|
59
|
+
const xsApp = (0, utils_1.extractXSApp)(zipEntries);
|
|
60
|
+
if (!xsApp?.routes) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
const pathsSet = new Set();
|
|
64
|
+
for (const route of xsApp.routes) {
|
|
65
|
+
if (route.service === 'html5-apps-repo-rt' || !route.source) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
let path = route.source;
|
|
69
|
+
// Remove leading ^ and trailing $
|
|
70
|
+
path = path.replace(/^\^/, '').replace(/\$$/, '');
|
|
71
|
+
// Remove capture groups like (.*) or $1
|
|
72
|
+
path = path.replace(/\([^)]*\)/g, '');
|
|
73
|
+
// Remove regex quantifiers
|
|
74
|
+
path = path.replace(/\$\d+/g, '');
|
|
75
|
+
// Clean up any remaining regex characters at the end
|
|
76
|
+
path = path.replace(/\/?\*$/, '');
|
|
77
|
+
// Normalize multiple consecutive slashes to single slash
|
|
78
|
+
while (path.includes('//')) {
|
|
79
|
+
path = path.replaceAll('//', '/');
|
|
80
|
+
}
|
|
81
|
+
if (path) {
|
|
82
|
+
pathsSet.add(path);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return Array.from(pathsSet);
|
|
86
|
+
}
|
|
25
87
|
/**
|
|
26
88
|
* Discover apps from FDC API based on credentials.
|
|
27
89
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
2
|
-
import type { CfConfig, CFApp, RequestArguments, GetServiceInstanceParams, MtaYaml, ServiceInfo } from '../../types';
|
|
2
|
+
import type { CfConfig, CFApp, RequestArguments, ServiceKeys, GetServiceInstanceParams, ServiceInstance, MtaYaml, ServiceInfo } from '../../types';
|
|
3
3
|
interface CreateServiceOptions {
|
|
4
4
|
xsSecurityProjectName?: string;
|
|
5
5
|
templatePathOverwrite?: string;
|
|
@@ -67,5 +67,13 @@ export declare function createServices(yamlContent: MtaYaml, initialServices: st
|
|
|
67
67
|
* @returns {Promise<ServiceInfo | null>} The service instance keys.
|
|
68
68
|
*/
|
|
69
69
|
export declare function getServiceInstanceKeys(serviceInstanceQuery: GetServiceInstanceParams, logger: ToolsLogger): Promise<ServiceInfo | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the service instance keys.
|
|
72
|
+
*
|
|
73
|
+
* @param {ServiceInstance} serviceInstance - The service instance.
|
|
74
|
+
* @param {ToolsLogger} logger - The logger.
|
|
75
|
+
* @returns {Promise<ServiceKeys[]>} The service instance keys.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getOrCreateServiceKeys(serviceInstance: ServiceInstance, logger: ToolsLogger): Promise<ServiceKeys[]>;
|
|
70
78
|
export {};
|
|
71
79
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/cf/services/api.js
CHANGED
|
@@ -43,6 +43,7 @@ exports.createServiceInstance = createServiceInstance;
|
|
|
43
43
|
exports.getServiceNameByTags = getServiceNameByTags;
|
|
44
44
|
exports.createServices = createServices;
|
|
45
45
|
exports.getServiceInstanceKeys = getServiceInstanceKeys;
|
|
46
|
+
exports.getOrCreateServiceKeys = getOrCreateServiceKeys;
|
|
46
47
|
const fs = __importStar(require("node:fs"));
|
|
47
48
|
const axios_1 = __importDefault(require("axios"));
|
|
48
49
|
const path = __importStar(require("node:path"));
|
|
@@ -64,10 +64,17 @@ export declare class AdpPreview {
|
|
|
64
64
|
/**
|
|
65
65
|
* Fetch all required configurations from the backend and initialize all configurations.
|
|
66
66
|
*
|
|
67
|
+
* @param {DescriptorVariant} descriptorVariant - Descriptor variant from the project.
|
|
68
|
+
* @returns {Promise<UI5FlexLayer>} The UI5 flex layer for which editing is enabled.
|
|
69
|
+
*/
|
|
70
|
+
init(descriptorVariant: DescriptorVariant): Promise<UI5FlexLayer>;
|
|
71
|
+
/**
|
|
72
|
+
* Initialize the preview for a CF ADP project using build output.
|
|
73
|
+
*
|
|
67
74
|
* @param descriptorVariant descriptor variant from the project
|
|
68
75
|
* @returns the UI5 flex layer for which editing is enabled
|
|
69
76
|
*/
|
|
70
|
-
|
|
77
|
+
private initCfBuildMode;
|
|
71
78
|
/**
|
|
72
79
|
* Synchronize local changes with the backend.
|
|
73
80
|
* The descriptor is refreshed only if the global flag is set to true.
|
|
@@ -95,10 +95,13 @@ class AdpPreview {
|
|
|
95
95
|
/**
|
|
96
96
|
* Fetch all required configurations from the backend and initialize all configurations.
|
|
97
97
|
*
|
|
98
|
-
* @param descriptorVariant
|
|
99
|
-
* @returns
|
|
98
|
+
* @param {DescriptorVariant} descriptorVariant - Descriptor variant from the project.
|
|
99
|
+
* @returns {Promise<UI5FlexLayer>} The UI5 flex layer for which editing is enabled.
|
|
100
100
|
*/
|
|
101
101
|
async init(descriptorVariant) {
|
|
102
|
+
if (this.config.cfBuildPath) {
|
|
103
|
+
return this.initCfBuildMode(descriptorVariant);
|
|
104
|
+
}
|
|
102
105
|
this.descriptorVariantId = descriptorVariant.id;
|
|
103
106
|
this.provider = await (0, system_access_1.createAbapServiceProvider)(this.config.target, { ignoreCertErrors: this.config.ignoreCertErrors }, true, this.logger);
|
|
104
107
|
this.routesHandler = new routes_handler_1.default(this.project, this.util, this.provider, this.logger);
|
|
@@ -110,11 +113,26 @@ class AdpPreview {
|
|
|
110
113
|
await this.sync();
|
|
111
114
|
return descriptorVariant.layer;
|
|
112
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Initialize the preview for a CF ADP project using build output.
|
|
118
|
+
*
|
|
119
|
+
* @param descriptorVariant descriptor variant from the project
|
|
120
|
+
* @returns the UI5 flex layer for which editing is enabled
|
|
121
|
+
*/
|
|
122
|
+
async initCfBuildMode(descriptorVariant) {
|
|
123
|
+
this.descriptorVariantId = descriptorVariant.id;
|
|
124
|
+
this.isCloud = false;
|
|
125
|
+
this.routesHandler = new routes_handler_1.default(this.project, this.util, {}, this.logger);
|
|
126
|
+
return descriptorVariant.layer;
|
|
127
|
+
}
|
|
113
128
|
/**
|
|
114
129
|
* Synchronize local changes with the backend.
|
|
115
130
|
* The descriptor is refreshed only if the global flag is set to true.
|
|
116
131
|
*/
|
|
117
132
|
async sync() {
|
|
133
|
+
if (this.config.cfBuildPath) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
118
136
|
if (!global.__SAP_UX_MANIFEST_SYNC_REQUIRED__ && this.mergedDescriptor) {
|
|
119
137
|
return;
|
|
120
138
|
}
|
|
@@ -28,6 +28,10 @@ export default class RoutesHandler {
|
|
|
28
28
|
private readonly util;
|
|
29
29
|
private readonly provider;
|
|
30
30
|
private readonly logger;
|
|
31
|
+
/**
|
|
32
|
+
* Whether this is running in build path mode (CF ADP using build output).
|
|
33
|
+
*/
|
|
34
|
+
private readonly isBuildPathMode;
|
|
31
35
|
/**
|
|
32
36
|
* Constructor taking project as input.
|
|
33
37
|
*
|
|
@@ -53,6 +53,10 @@ class RoutesHandler {
|
|
|
53
53
|
util;
|
|
54
54
|
provider;
|
|
55
55
|
logger;
|
|
56
|
+
/**
|
|
57
|
+
* Whether this is running in build path mode (CF ADP using build output).
|
|
58
|
+
*/
|
|
59
|
+
isBuildPathMode;
|
|
56
60
|
/**
|
|
57
61
|
* Constructor taking project as input.
|
|
58
62
|
*
|
|
@@ -66,6 +70,7 @@ class RoutesHandler {
|
|
|
66
70
|
this.util = util;
|
|
67
71
|
this.provider = provider;
|
|
68
72
|
this.logger = logger;
|
|
73
|
+
this.isBuildPathMode = !provider || typeof provider.getLayeredRepository !== 'function';
|
|
69
74
|
}
|
|
70
75
|
/**
|
|
71
76
|
* Reads files from workspace by given search pattern.
|
|
@@ -256,6 +261,15 @@ class RoutesHandler {
|
|
|
256
261
|
handleGetAllAnnotationFilesMappedByDataSource = async (_req, res, next) => {
|
|
257
262
|
try {
|
|
258
263
|
const isRunningInBAS = (0, btp_utils_1.isAppStudio)();
|
|
264
|
+
if (this.isBuildPathMode) {
|
|
265
|
+
// In build path mode (CF ADP), skip ManifestService as it requires ABAP backend
|
|
266
|
+
const apiResponse = {
|
|
267
|
+
isRunningInBAS,
|
|
268
|
+
annotationDataSourceMap: {}
|
|
269
|
+
};
|
|
270
|
+
this.sendFilesResponse(res, apiResponse);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
259
273
|
const manifestService = await this.getManifestService();
|
|
260
274
|
const dataSources = manifestService.getManifestDataSources();
|
|
261
275
|
const apiResponse = {
|
package/dist/types.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export interface AdpPreviewConfig {
|
|
|
35
35
|
* If set to true then certification validation errors are ignored.
|
|
36
36
|
*/
|
|
37
37
|
ignoreCertErrors?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* For CF ADP projects: path to build output folder (e.g., 'dist') to serve resources directly.
|
|
40
|
+
*/
|
|
41
|
+
cfBuildPath?: string;
|
|
38
42
|
}
|
|
39
43
|
export interface OnpremApp {
|
|
40
44
|
/** Application variant id. */
|
|
@@ -786,6 +790,8 @@ export interface UI5YamlCustomTaskConfiguration {
|
|
|
786
790
|
space: string;
|
|
787
791
|
html5RepoRuntime: string;
|
|
788
792
|
sapCloudService: string;
|
|
793
|
+
serviceInstanceName: string;
|
|
794
|
+
serviceInstanceGuid: string;
|
|
789
795
|
}
|
|
790
796
|
export interface UI5YamlCustomTask {
|
|
791
797
|
name: string;
|
|
@@ -922,6 +928,18 @@ export interface CfAdpWriterConfig {
|
|
|
922
928
|
approuter: AppRouterType;
|
|
923
929
|
businessService: string;
|
|
924
930
|
businessSolutionName?: string;
|
|
931
|
+
/**
|
|
932
|
+
* GUID of the business service instance.
|
|
933
|
+
*/
|
|
934
|
+
serviceInstanceGuid?: string;
|
|
935
|
+
/**
|
|
936
|
+
* Backend URL from service instance keys.
|
|
937
|
+
*/
|
|
938
|
+
backendUrl?: string;
|
|
939
|
+
/**
|
|
940
|
+
* OAuth paths extracted from xs-app.json routes that have a source property.
|
|
941
|
+
*/
|
|
942
|
+
oauthPaths?: string[];
|
|
925
943
|
};
|
|
926
944
|
project: {
|
|
927
945
|
name: string;
|
|
@@ -950,6 +968,9 @@ export interface CreateCfConfigParams {
|
|
|
950
968
|
layer: FlexLayer;
|
|
951
969
|
manifest: Manifest;
|
|
952
970
|
html5RepoRuntimeGuid: string;
|
|
971
|
+
serviceInstanceGuid?: string;
|
|
972
|
+
backendUrl?: string;
|
|
973
|
+
oauthPaths?: string[];
|
|
953
974
|
projectPath: string;
|
|
954
975
|
addStandaloneApprouter?: boolean;
|
|
955
976
|
publicVersions: UI5Version;
|
package/dist/writer/cf.js
CHANGED
|
@@ -37,7 +37,6 @@ async function generateCf(basePath, config, logger, fs) {
|
|
|
37
37
|
(0, manifest_1.fillDescriptorContent)(variant.content, app.appType, ui5.version, app.i18nModels);
|
|
38
38
|
await (0, project_utils_1.writeCfTemplates)(basePath, variant, fullConfig, fs);
|
|
39
39
|
await (0, project_utils_1.writeCfUI5Yaml)(fullConfig.project.folder, fullConfig, fs);
|
|
40
|
-
await (0, project_utils_1.writeCfUI5BuildYaml)(fullConfig.project.folder, fullConfig, fs);
|
|
41
40
|
return fs;
|
|
42
41
|
}
|
|
43
42
|
/**
|
package/dist/writer/options.d.ts
CHANGED
|
@@ -72,7 +72,8 @@ export declare function enhanceUI5YamlWithCfCustomTask(ui5Config: UI5Config, con
|
|
|
72
72
|
* Generate custom configuration required for the ui5.yaml.
|
|
73
73
|
*
|
|
74
74
|
* @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
|
|
75
|
+
* @param {CfAdpWriterConfig} config - Full project configuration.
|
|
75
76
|
*/
|
|
76
|
-
export declare function enhanceUI5YamlWithCfCustomMiddleware(ui5Config: UI5Config): void;
|
|
77
|
+
export declare function enhanceUI5YamlWithCfCustomMiddleware(ui5Config: UI5Config, config: CfAdpWriterConfig): void;
|
|
77
78
|
export {};
|
|
78
79
|
//# sourceMappingURL=options.d.ts.map
|
package/dist/writer/options.js
CHANGED
|
@@ -317,7 +317,8 @@ function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
|
|
|
317
317
|
org: cf.org.GUID,
|
|
318
318
|
space: cf.space.GUID,
|
|
319
319
|
sapCloudService: cf.businessSolutionName ?? '',
|
|
320
|
-
serviceInstanceName: cf.businessService
|
|
320
|
+
serviceInstanceName: cf.businessService,
|
|
321
|
+
serviceInstanceGuid: cf.serviceInstanceGuid
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
324
|
]);
|
|
@@ -326,15 +327,36 @@ function enhanceUI5YamlWithCfCustomTask(ui5Config, config) {
|
|
|
326
327
|
* Generate custom configuration required for the ui5.yaml.
|
|
327
328
|
*
|
|
328
329
|
* @param {UI5Config} ui5Config - Configuration representing the ui5.yaml.
|
|
330
|
+
* @param {CfAdpWriterConfig} config - Full project configuration.
|
|
329
331
|
*/
|
|
330
|
-
function enhanceUI5YamlWithCfCustomMiddleware(ui5Config) {
|
|
332
|
+
function enhanceUI5YamlWithCfCustomMiddleware(ui5Config, config) {
|
|
331
333
|
const ui5ConfigOptions = {
|
|
332
334
|
url: constants_1.UI5_CDN_URL
|
|
333
335
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
const oauthPaths = config.cf?.oauthPaths;
|
|
337
|
+
const backendUrl = config.cf?.backendUrl;
|
|
338
|
+
if (oauthPaths && oauthPaths.length > 0 && backendUrl) {
|
|
339
|
+
ui5Config.addCustomMiddleware([
|
|
340
|
+
{
|
|
341
|
+
name: 'backend-proxy-middleware-cf',
|
|
342
|
+
afterMiddleware: 'compression',
|
|
343
|
+
configuration: {
|
|
344
|
+
url: backendUrl,
|
|
345
|
+
paths: oauthPaths
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
]);
|
|
349
|
+
ui5Config.addFioriToolsProxyMiddleware({
|
|
350
|
+
ui5: ui5ConfigOptions,
|
|
351
|
+
backend: []
|
|
352
|
+
}, 'backend-proxy-middleware-cf');
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
ui5Config.addFioriToolsProxyMiddleware({
|
|
356
|
+
ui5: ui5ConfigOptions,
|
|
357
|
+
backend: []
|
|
358
|
+
}, 'compression');
|
|
359
|
+
}
|
|
338
360
|
ui5Config.addCustomMiddleware([
|
|
339
361
|
{
|
|
340
362
|
name: 'fiori-tools-preview',
|
|
@@ -342,6 +364,9 @@ function enhanceUI5YamlWithCfCustomMiddleware(ui5Config) {
|
|
|
342
364
|
configuration: {
|
|
343
365
|
flp: {
|
|
344
366
|
theme: 'sap_horizon'
|
|
367
|
+
},
|
|
368
|
+
adp: {
|
|
369
|
+
cfBuildPath: 'dist'
|
|
345
370
|
}
|
|
346
371
|
}
|
|
347
372
|
}
|
|
@@ -64,15 +64,6 @@ export declare function writeUI5Yaml(projectPath: string, data: AdpWriterConfig,
|
|
|
64
64
|
* @returns {void}
|
|
65
65
|
*/
|
|
66
66
|
export declare function writeCfUI5Yaml(projectPath: string, data: CfAdpWriterConfig, fs: Editor): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* Writes a ui5-build.yaml file for CF project within a specified folder in the project directory.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} projectPath - The root path of the project.
|
|
71
|
-
* @param {CfAdpWriterConfig} data - The data to be populated in the template file.
|
|
72
|
-
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
73
|
-
* @returns {void}
|
|
74
|
-
*/
|
|
75
|
-
export declare function writeCfUI5BuildYaml(projectPath: string, data: CfAdpWriterConfig, fs: Editor): Promise<void>;
|
|
76
67
|
/**
|
|
77
68
|
* Writes a ui5-deploy.yaml file within a specified folder in the project directory.
|
|
78
69
|
*
|
|
@@ -7,7 +7,6 @@ exports.getCfVariant = getCfVariant;
|
|
|
7
7
|
exports.writeTemplateToFolder = writeTemplateToFolder;
|
|
8
8
|
exports.writeUI5Yaml = writeUI5Yaml;
|
|
9
9
|
exports.writeCfUI5Yaml = writeCfUI5Yaml;
|
|
10
|
-
exports.writeCfUI5BuildYaml = writeCfUI5BuildYaml;
|
|
11
10
|
exports.writeUI5DeployYaml = writeUI5DeployYaml;
|
|
12
11
|
exports.writeCfTemplates = writeCfTemplates;
|
|
13
12
|
const node_path_1 = require("node:path");
|
|
@@ -176,35 +175,15 @@ async function writeCfUI5Yaml(projectPath, data, fs) {
|
|
|
176
175
|
const ui5ConfigPath = (0, node_path_1.join)(projectPath, 'ui5.yaml');
|
|
177
176
|
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
178
177
|
const ui5Config = await ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
179
|
-
ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8', paths: { webapp: 'dist' } });
|
|
180
|
-
/** Middlewares */
|
|
181
|
-
(0, options_1.enhanceUI5YamlWithCfCustomMiddleware)(ui5Config);
|
|
182
|
-
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
183
|
-
}
|
|
184
|
-
catch (e) {
|
|
185
|
-
throw new Error(`Could not write ui5.yaml file. Reason: ${e.message}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Writes a ui5-build.yaml file for CF project within a specified folder in the project directory.
|
|
190
|
-
*
|
|
191
|
-
* @param {string} projectPath - The root path of the project.
|
|
192
|
-
* @param {CfAdpWriterConfig} data - The data to be populated in the template file.
|
|
193
|
-
* @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
|
|
194
|
-
* @returns {void}
|
|
195
|
-
*/
|
|
196
|
-
async function writeCfUI5BuildYaml(projectPath, data, fs) {
|
|
197
|
-
try {
|
|
198
|
-
const ui5ConfigPath = (0, node_path_1.join)(projectPath, 'ui5-build.yaml');
|
|
199
|
-
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
200
|
-
const ui5Config = await ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
201
178
|
ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
|
|
202
179
|
/** Builder task */
|
|
203
180
|
(0, options_1.enhanceUI5YamlWithCfCustomTask)(ui5Config, data);
|
|
181
|
+
/** Middlewares */
|
|
182
|
+
(0, options_1.enhanceUI5YamlWithCfCustomMiddleware)(ui5Config, data);
|
|
204
183
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
205
184
|
}
|
|
206
185
|
catch (e) {
|
|
207
|
-
throw new Error(`Could not write ui5
|
|
186
|
+
throw new Error(`Could not write ui5.yaml file. Reason: ${e.message}`);
|
|
208
187
|
}
|
|
209
188
|
}
|
|
210
189
|
/**
|
|
@@ -248,9 +227,6 @@ async function writeCfTemplates(basePath, variant, config, fs) {
|
|
|
248
227
|
fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/ui5.yaml'), (0, node_path_1.join)(project.folder, 'ui5.yaml'), {
|
|
249
228
|
module: project.name
|
|
250
229
|
});
|
|
251
|
-
fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/ui5-build.yaml'), (0, node_path_1.join)(project.folder, 'ui5-build.yaml'), {
|
|
252
|
-
module: project.name
|
|
253
|
-
});
|
|
254
230
|
fs.copyTpl((0, node_path_1.join)(templatePath, 'cf/i18n/i18n.properties'), (0, node_path_1.join)(project.folder, 'webapp/i18n/i18n.properties'), {
|
|
255
231
|
module: project.name,
|
|
256
232
|
moduleTitle: app.title,
|
|
@@ -108,7 +108,10 @@ function getCfConfig(params) {
|
|
|
108
108
|
html5RepoRuntimeGuid: params.html5RepoRuntimeGuid,
|
|
109
109
|
approuter: params.cfServicesAnswers.approuter ?? types_1.AppRouterType.MANAGED,
|
|
110
110
|
businessService: params.cfServicesAnswers.businessService ?? '',
|
|
111
|
-
businessSolutionName: params.cfServicesAnswers.businessSolutionName
|
|
111
|
+
businessSolutionName: params.cfServicesAnswers.businessSolutionName,
|
|
112
|
+
serviceInstanceGuid: params.serviceInstanceGuid,
|
|
113
|
+
backendUrl: params.backendUrl,
|
|
114
|
+
oauthPaths: params.oauthPaths
|
|
112
115
|
},
|
|
113
116
|
project: {
|
|
114
117
|
name: params.attributeAnswers.projectName,
|
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.13",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@sap-ux/axios-extension": "1.24.3",
|
|
40
40
|
"@sap-ux/btp-utils": "1.1.5",
|
|
41
41
|
"@sap-ux/i18n": "0.3.5",
|
|
42
|
-
"@sap-ux/inquirer-common": "0.9.
|
|
42
|
+
"@sap-ux/inquirer-common": "0.9.9",
|
|
43
43
|
"@sap-ux/logger": "0.7.1",
|
|
44
44
|
"@sap-ux/nodejs-utils": "0.2.8",
|
|
45
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
46
|
-
"@sap-ux/project-access": "1.32.
|
|
47
|
-
"@sap-ux/project-input-validator": "0.6.
|
|
45
|
+
"@sap-ux/odata-service-writer": "0.27.33",
|
|
46
|
+
"@sap-ux/project-access": "1.32.12",
|
|
47
|
+
"@sap-ux/project-input-validator": "0.6.34",
|
|
48
48
|
"@sap-ux/store": "1.3.3",
|
|
49
49
|
"@sap-ux/system-access": "0.6.29",
|
|
50
50
|
"@sap-ux/ui5-config": "0.29.10",
|
package/templates/cf/_gitignore
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
/
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*.zip
|
|
6
|
-
UIAdaptation*.html
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
.tmp
|
|
4
|
+
.env
|
|
5
|
+
*.zip
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prestart": "npm run build",
|
|
8
8
|
"start": "fiori run --open /test/flp.html#app-preview",
|
|
9
|
-
"
|
|
9
|
+
"start-editor": "fiori run --open /test/adaptation-editor.html",
|
|
10
|
+
"build": "npm run clean && ui5 build --include-task=generateCachebusterInfo && npm run zip",
|
|
10
11
|
"zip": "cd dist && npx bestzip ../<%= module %>.zip *",
|
|
11
12
|
"clean": "npx rimraf <%= module %>.zip dist",
|
|
12
13
|
"build-ui5": "npm explore @ui5/task-adaptation -- npm run rollup"
|
|
@@ -15,14 +16,9 @@
|
|
|
15
16
|
"type": "git",
|
|
16
17
|
"build": "ui5.js build --verbose --include-task generateCachebusterInfo"
|
|
17
18
|
},
|
|
18
|
-
"ui5": {
|
|
19
|
-
"dependencies": [
|
|
20
|
-
"@sap/ui5-builder-webide-extension",
|
|
21
|
-
"@ui5/task-adaptation"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
19
|
"devDependencies": {
|
|
25
20
|
"@sap/ui5-builder-webide-extension": "^1.1.9",
|
|
21
|
+
"@sap-ux/backend-proxy-middleware-cf": "^0.0.1",
|
|
26
22
|
"@sapui5/ts-types": "^1.141.2",
|
|
27
23
|
"@sap/ux-ui5-tooling": "1",
|
|
28
24
|
"@ui5/cli": "^4.0.33",
|
package/templates/cf/ui5.yaml
CHANGED