@sap-ux/preview-middleware 0.12.15 → 0.13.0

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 CHANGED
@@ -34,13 +34,13 @@ When this middleware is used together with the `reload-middleware`, then the ord
34
34
 
35
35
  ### `flp.apps`
36
36
  Array of additional application configurations:
37
- | Option | Type | Default Value | Description |
38
- | --------------- | -------- | -------------- | ---------------------------------------------------------------------------------------------------- |
39
- | `target` | `string` | | Target path of the additional application |
40
- | `local` | `string` | | Local path to the folder containing the application |
41
- | `intent` | | | Optional intent to be used for the application |
42
- | `intent.object` | `string` | `(calculated)` | Optional intent object, if it is not provided then it will be calculated based on the application id |
43
- | `intent.action` | `string` | `preview` | Optional intent action |
37
+ | Option | Type | Default Value | Description |
38
+ | ------------------------ | -------- | -------------- | ------------------------------------------------------------------------------------------------------------- |
39
+ | `target` | `string` | | Target path of the additional application |
40
+ | `local` or `componentId` | `string` | | Either a local path to a folder containing the application or the `componentId` of a remote app is required |
41
+ | `intent` | | | Optional intent to be used for the application |
42
+ | `intent.object` | `string` | `(calculated)` | Optional intent object, if it is not provided then it will be calculated based on the application id |
43
+ | `intent.action` | `string` | `preview` | Optional intent action |
44
44
 
45
45
  ### `adp.target`
46
46
  | Option | Type | Description |
@@ -93,7 +93,7 @@ server:
93
93
 
94
94
  ### Additional Applications
95
95
  If you want to test cross application navigation, then you can add additional applications into the local FLP.
96
- With this configuration, an application that is locally available in `../local-folder` will be available at `/apps/other-app` and will also be added as tile to the local FLP.
96
+ With this configuration, an application that is locally available in `../local-folder` will be available at `/apps/other-app` and will also be added as tile to the local FLP as well as one of the UI5 sample apps will be bound to the intent `TheOther-preview`.
97
97
  ```Yaml
98
98
  server:
99
99
  customMiddleware:
@@ -101,8 +101,16 @@ server:
101
101
  afterMiddleware: compression
102
102
  configuration:
103
103
  apps:
104
- - local: ../local-folder
105
- target: /apps/other-app
104
+ - target: /apps/other-app
105
+ local: ../local-folder
106
+ intent:
107
+ object: TheLocal
108
+ action: preview
109
+ - target: /test-resources/sap/ushell/demoapps/AppNavSample
110
+ componentId: sap.ushell.demo.AppNavSample
111
+ intent:
112
+ object: TheOther
113
+ action: preview
106
114
  ```
107
115
 
108
116
  ### Runtime Adaptation Support
package/dist/base/flp.js CHANGED
@@ -268,13 +268,29 @@ class FlpSandbox {
268
268
  * Add additional routes for apps also to be shown in the local FLP.
269
269
  */
270
270
  addRoutesForAdditionalApps() {
271
+ var _a, _b;
271
272
  for (const app of this.config.apps) {
273
+ let manifest;
272
274
  if (app.local) {
273
- const manifest = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(app.local, 'webapp/manifest.json'), 'utf-8'));
274
- this.addApp(manifest, app);
275
+ manifest = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(app.local, 'webapp/manifest.json'), 'utf-8'));
275
276
  this.router.use(app.target, (0, express_1.static)((0, path_1.join)(app.local, 'webapp')));
276
277
  this.logger.info(`Serving additional application at ${app.target} from ${app.local}`);
277
278
  }
279
+ else if (app.componentId) {
280
+ manifest = {
281
+ 'sap.app': {
282
+ id: app.componentId,
283
+ title: app.intent ? `${app.intent.object}-${app.intent.action}` : app.componentId
284
+ }
285
+ };
286
+ }
287
+ if (manifest) {
288
+ this.addApp(manifest, app);
289
+ this.logger.info(`Adding additional intent: ${(_a = app.intent) === null || _a === void 0 ? void 0 : _a.object}-${(_b = app.intent) === null || _b === void 0 ? void 0 : _b.action}`);
290
+ }
291
+ else {
292
+ this.logger.info(`Invalid application config for route ${app.target} because neither componentId nor local folder provided.`);
293
+ }
278
294
  }
279
295
  }
280
296
  /**
@@ -12,7 +12,7 @@ interface Intent {
12
12
  */
13
13
  export interface App {
14
14
  target: string;
15
- local: string;
15
+ local?: string;
16
16
  /**
17
17
  * Optional component id if it differs from the manifest (e.g. for adaptation projects)
18
18
  */
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.12.15",
12
+ "version": "0.13.0",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -41,8 +41,8 @@
41
41
  "dotenv": "16.3.1",
42
42
  "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.3",
43
43
  "@sap-ux/project-access": "1.19.2",
44
- "@sap-ux/axios-extension": "1.11.4",
45
- "@sap-ux/store": "0.5.0"
44
+ "@sap-ux/store": "0.5.0",
45
+ "@sap-ux/axios-extension": "1.11.4"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "express": "4"