@sap-ux/preview-middleware 0.20.29 → 0.20.31
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/README.md +6 -5
- package/dist/base/flp.js +13 -1
- package/dist/client/flp/init.js +4 -1
- package/dist/client/flp/init.ts +7 -1
- package/dist/client/flp/initCdm.js +2 -4
- package/dist/client/flp/initCdm.ts +2 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ When this middleware is used together with the `reload-middleware`, then the ord
|
|
|
32
32
|
| `editors.rta` | `array` | optional | `undefined` | Configuration allowing to add mount points for runtime adaptation |
|
|
33
33
|
| `editors.rta.layer` | `string` | optional | `(calculated)` | Property for defining the runtime adaptation layer for changes (default is `CUSTOMER_BASE` or read from the project for adaptation projects) |
|
|
34
34
|
| `editors.rta.endpoints` | `array` | optional | `undefined` | List of mount points for editing
|
|
35
|
-
| `editors.cardGenerator` | --- | optional | `undefined` | Configuration object to enable card generation for an application.
|
|
35
|
+
| `editors.cardGenerator` | --- | optional | `undefined` | Configuration object to enable card generation for an application (only supported for non-CAP apps).
|
|
36
36
|
| `editors.cardGenerator.path` | `string` | optional | `test/flpGeneratorSandbox.html` | The mount point of the local SAP Fiori launchpad which will be considered for card generation.
|
|
37
37
|
| `test` | `array` | optional | `undefined` | List of configurations for automated testing. |
|
|
38
38
|
| `debug` | `boolean` | optional | `false` | Enables the debug output |
|
|
@@ -127,10 +127,11 @@ server:
|
|
|
127
127
|
- name: preview-middleware
|
|
128
128
|
afterMiddleware: compression
|
|
129
129
|
configuration:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
editors:
|
|
131
|
+
rta:
|
|
132
|
+
layer: CUSTOMER_BASE
|
|
133
|
+
endpoints:
|
|
134
|
+
- path: /test/variant-editor.html
|
|
134
135
|
```
|
|
135
136
|
This mount path can be used with a run script that looks as follows.
|
|
136
137
|
```Json
|
package/dist/base/flp.js
CHANGED
|
@@ -395,7 +395,13 @@ class FlpSandbox {
|
|
|
395
395
|
const previewGeneratorPath = this.cardGenerator?.path ?? config_1.CARD_GENERATOR_DEFAULT.previewGeneratorSandbox;
|
|
396
396
|
this.logger.debug(`Add route for ${previewGeneratorPath}`);
|
|
397
397
|
this.router.get(previewGeneratorPath, async (req, res, next) => {
|
|
398
|
-
this.
|
|
398
|
+
if (this.projectType === 'EDMXBackend') {
|
|
399
|
+
this.templateConfig.enableCardGenerator = !!this.cardGenerator?.path;
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
this.logger.warn(`The Card Generator is not available for CAP projects.`);
|
|
403
|
+
this.templateConfig.enableCardGenerator = false;
|
|
404
|
+
}
|
|
399
405
|
await this.flpGetHandler(req, res, next);
|
|
400
406
|
});
|
|
401
407
|
}
|
|
@@ -813,6 +819,9 @@ class FlpSandbox {
|
|
|
813
819
|
* @returns {Promise<void>} A promise that resolves when the route is added.
|
|
814
820
|
*/
|
|
815
821
|
async addStoreCardManifestRoute() {
|
|
822
|
+
if (this.projectType !== 'EDMXBackend') {
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
816
825
|
this.router.use(config_1.CARD_GENERATOR_DEFAULT.cardsStore, (0, express_1.json)());
|
|
817
826
|
this.logger.debug(`Add route for ${config_1.CARD_GENERATOR_DEFAULT.cardsStore}`);
|
|
818
827
|
this.router.post(config_1.CARD_GENERATOR_DEFAULT.cardsStore, async (req, res) => {
|
|
@@ -853,6 +862,9 @@ class FlpSandbox {
|
|
|
853
862
|
* @returns {Promise<void>} A promise that resolves when the route is added.
|
|
854
863
|
*/
|
|
855
864
|
async addStoreI18nKeysRoute() {
|
|
865
|
+
if (this.projectType !== 'EDMXBackend') {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
856
868
|
this.router.use(config_1.CARD_GENERATOR_DEFAULT.i18nStore, (0, express_1.json)());
|
|
857
869
|
this.logger.debug(`Add route for ${config_1.CARD_GENERATOR_DEFAULT.i18nStore}`);
|
|
858
870
|
this.router.post(config_1.CARD_GENERATOR_DEFAULT.i18nStore, async (req, res) => {
|
package/dist/client/flp/init.js
CHANGED
|
@@ -195,6 +195,9 @@ sap.ui.define([
|
|
|
195
195
|
}
|
|
196
196
|
async function init(_ref) {
|
|
197
197
|
let {appUrls, flex, customInit, enhancedHomePage, enableCardGenerator} = _ref;
|
|
198
|
+
if (enhancedHomePage) {
|
|
199
|
+
initCdm();
|
|
200
|
+
}
|
|
198
201
|
const urlParams = new URLSearchParams(window.location.search);
|
|
199
202
|
const container = sap?.ushell?.Container ?? (await __ui5_require_async('sap/ushell/Container')).default;
|
|
200
203
|
let scenario = '';
|
|
@@ -263,7 +266,7 @@ sap.ui.define([
|
|
|
263
266
|
setI18nTitle(resourceBundle);
|
|
264
267
|
registerSAPFonts();
|
|
265
268
|
if (enhancedHomePage) {
|
|
266
|
-
await
|
|
269
|
+
await container.init('cdm');
|
|
267
270
|
}
|
|
268
271
|
const renderer = ui5VersionInfo.major < 2 && !ui5VersionInfo.label?.includes('legacy-free') ? await container.createRenderer(undefined, true) : await container.createRendererInternal(undefined, true);
|
|
269
272
|
renderer.placeAt('content');
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -305,6 +305,12 @@ export async function init({
|
|
|
305
305
|
enhancedHomePage?: boolean | null;
|
|
306
306
|
enableCardGenerator?: boolean
|
|
307
307
|
}): Promise<void> {
|
|
308
|
+
// Set CDM configuration before importing ushell container
|
|
309
|
+
// to ensure proper configuration pickup during bootstrap
|
|
310
|
+
if (enhancedHomePage) {
|
|
311
|
+
initCdm();
|
|
312
|
+
}
|
|
313
|
+
|
|
308
314
|
const urlParams = new URLSearchParams(window.location.search);
|
|
309
315
|
const container = sap?.ushell?.Container ??
|
|
310
316
|
(await import('sap/ushell/Container')).default as unknown as typeof sap.ushell.Container;
|
|
@@ -389,7 +395,7 @@ export async function init({
|
|
|
389
395
|
registerSAPFonts();
|
|
390
396
|
|
|
391
397
|
if (enhancedHomePage) {
|
|
392
|
-
await
|
|
398
|
+
await container.init('cdm');
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
const renderer =
|
|
@@ -6,10 +6,9 @@ sap.ui.define([], function () {
|
|
|
6
6
|
/**
|
|
7
7
|
* Initializes the CDM (Common Data Model) configuration for the SAP Fiori Launchpad.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
10
|
-
* @returns {Promise<void>} A promise that resolves when the initialization is complete.
|
|
9
|
+
* @returns {void}
|
|
11
10
|
*/
|
|
12
|
-
|
|
11
|
+
function initCdm() {
|
|
13
12
|
window['sap-ushell-config'] = {
|
|
14
13
|
defaultRenderer: 'fiori2',
|
|
15
14
|
renderers: {
|
|
@@ -112,7 +111,6 @@ sap.ui.define([], function () {
|
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
};
|
|
115
|
-
await container.init('cdm');
|
|
116
114
|
}
|
|
117
115
|
return initCdm;
|
|
118
116
|
});
|
|
@@ -3,10 +3,9 @@ import { Window } from 'types/global';
|
|
|
3
3
|
/**
|
|
4
4
|
* Initializes the CDM (Common Data Model) configuration for the SAP Fiori Launchpad.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
7
|
-
* @returns {Promise<void>} A promise that resolves when the initialization is complete.
|
|
6
|
+
* @returns {void}
|
|
8
7
|
*/
|
|
9
|
-
export default
|
|
8
|
+
export default function initCdm(): void {
|
|
10
9
|
(window as unknown as Window)['sap-ushell-config'] = {
|
|
11
10
|
defaultRenderer: 'fiori2',
|
|
12
11
|
renderers: {
|
|
@@ -113,6 +112,4 @@ export default async function initCdm(container: typeof sap.ushell.Container): P
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
};
|
|
116
|
-
|
|
117
|
-
await container.init('cdm');
|
|
118
115
|
}
|
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%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.20.
|
|
12
|
+
"version": "0.20.31",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"ejs": "3.1.10",
|
|
26
26
|
"mem-fs": "2.1.0",
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
|
-
"@sap-ux/adp-tooling": "0.14.
|
|
28
|
+
"@sap-ux/adp-tooling": "0.14.20",
|
|
29
29
|
"@sap-ux/btp-utils": "1.1.0",
|
|
30
30
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.6",
|
|
31
31
|
"@sap-ux/feature-toggle": "0.3.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"nock": "13.4.0",
|
|
50
50
|
"npm-run-all2": "6.2.0",
|
|
51
51
|
"supertest": "6.3.3",
|
|
52
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.14.
|
|
52
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.14.7",
|
|
53
53
|
"@sap-ux/axios-extension": "1.21.4",
|
|
54
54
|
"@sap-ux/i18n": "0.3.0",
|
|
55
55
|
"@sap-ux/store": "1.1.0",
|