@sap-ux/preview-middleware 0.5.5 → 0.5.7

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
@@ -13,6 +13,7 @@ It hosts a local Fiori launchpad based on your configuration as well as offers a
13
13
  | `flp.intent.action` | `string` | `preview` | Optional intent action |
14
14
  | `flp.apps` | `array` | `undefined` | Optional additional local apps that are available in local Fiori launchpad |
15
15
  | `flp.libs` | `boolean` | `undefined` | Optional flag to add a generic script fetching the paths of used libraries not available in UI5. To disable set it to `false`, if not set, then the project is checked for a `load-reuse-libs` script and if available the libraries are fetched as well. |
16
+ | `flp.theme` | `string` | `undefined` | Optional flag for setting the UI5 Theme. |
16
17
  | `adp.target` | | | Required configuration for adaptation projects defining the connected backend |
17
18
  | `adp.ignoreCertErrors` | `boolean` | `false` | Optional setting to ignore certification validation errors when working with e.g. development systems with self signed certificates |
18
19
  | `rta` | | | Optional configuration allowing to add mount points for runtime adaptation |
package/dist/base/flp.js CHANGED
@@ -54,7 +54,7 @@ class FlpSandbox {
54
54
  * @param logger logger instance
55
55
  */
56
56
  constructor(config, project, utils, logger) {
57
- var _a, _b, _c, _d, _e, _f, _g;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h;
58
58
  this.project = project;
59
59
  this.utils = utils;
60
60
  this.logger = logger;
@@ -62,7 +62,8 @@ class FlpSandbox {
62
62
  path: (_b = (_a = config.flp) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : DEFAULT_PATH,
63
63
  intent: (_d = (_c = config.flp) === null || _c === void 0 ? void 0 : _c.intent) !== null && _d !== void 0 ? _d : DEFAULT_INTENT,
64
64
  apps: (_f = (_e = config.flp) === null || _e === void 0 ? void 0 : _e.apps) !== null && _f !== void 0 ? _f : [],
65
- libs: (_g = config.flp) === null || _g === void 0 ? void 0 : _g.libs
65
+ libs: (_g = config.flp) === null || _g === void 0 ? void 0 : _g.libs,
66
+ theme: (_h = config.flp) === null || _h === void 0 ? void 0 : _h.theme
66
67
  };
67
68
  if (!this.config.path.startsWith('/')) {
68
69
  this.config.path = `/${this.config.path}`;
@@ -79,31 +80,32 @@ class FlpSandbox {
79
80
  * @param resources optional additional resource mappings
80
81
  */
81
82
  init(manifest, componentId, resources = {}) {
82
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
- var _k;
83
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
84
+ var _l;
84
85
  return __awaiter(this, void 0, void 0, function* () {
85
86
  const flex = this.createFlexHandler();
86
87
  const supportedThemes = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.supportedThemes) !== null && _b !== void 0 ? _b : [DEFAULT_THEME];
88
+ const ui5Theme = (_c = this.config.theme) !== null && _c !== void 0 ? _c : (supportedThemes.includes(DEFAULT_THEME) ? DEFAULT_THEME : supportedThemes[0]);
87
89
  this.templateConfig = {
88
- basePath: (_c = (0, path_1.relative)((0, path_1.dirname)(this.config.path), '/')) !== null && _c !== void 0 ? _c : '.',
90
+ basePath: (_d = (0, path_1.relative)((0, path_1.dirname)(this.config.path), '/')) !== null && _d !== void 0 ? _d : '.',
89
91
  apps: {},
90
92
  ui5: {
91
- libs: Object.keys((_f = (_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.dependencies) === null || _e === void 0 ? void 0 : _e.libs) !== null && _f !== void 0 ? _f : {}).join(','),
92
- theme: supportedThemes.includes(DEFAULT_THEME) ? DEFAULT_THEME : supportedThemes[0],
93
+ libs: Object.keys((_g = (_f = (_e = manifest['sap.ui5']) === null || _e === void 0 ? void 0 : _e.dependencies) === null || _f === void 0 ? void 0 : _f.libs) !== null && _g !== void 0 ? _g : {}).join(','),
94
+ theme: ui5Theme,
93
95
  flex,
94
96
  resources: Object.assign(Object.assign({}, resources), { [PREVIEW_URL.client.ns]: PREVIEW_URL.client.url })
95
97
  },
96
- locateReuseLibsScript: (_g = this.config.libs) !== null && _g !== void 0 ? _g : (yield this.hasLocateReuseLibsScript())
98
+ locateReuseLibsScript: (_h = this.config.libs) !== null && _h !== void 0 ? _h : (yield this.hasLocateReuseLibsScript())
97
99
  };
98
100
  this.addApp(manifest, {
99
101
  componentId,
100
- target: (_h = resources[componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id]) !== null && _h !== void 0 ? _h : this.templateConfig.basePath,
102
+ target: (_j = resources[componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id]) !== null && _j !== void 0 ? _j : this.templateConfig.basePath,
101
103
  local: '.',
102
104
  intent: this.config.intent
103
105
  });
104
106
  this.addStandardRoutes();
105
107
  if (this.rta) {
106
- (_j = (_k = this.rta).options) !== null && _j !== void 0 ? _j : (_k.options = {});
108
+ (_k = (_l = this.rta).options) !== null && _k !== void 0 ? _k : (_l.options = {});
107
109
  this.rta.options.baseId = componentId !== null && componentId !== void 0 ? componentId : manifest['sap.app'].id;
108
110
  this.addEditorRoutes(this.rta);
109
111
  }
@@ -41,6 +41,7 @@ export interface FlpConfig {
41
41
  */
42
42
  libs?: boolean;
43
43
  apps: App[];
44
+ theme?: string;
44
45
  }
45
46
  /**
46
47
  * Middleware configuration.
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.5.5",
12
+ "version": "0.5.7",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -23,8 +23,8 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "ejs": "3.1.9",
26
- "@sap-ux/logger": "0.3.7",
27
- "@sap-ux/adp-tooling": "0.2.4"
26
+ "@sap-ux/logger": "0.3.8",
27
+ "@sap-ux/adp-tooling": "0.2.5"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/ejs": "3.1.2",
@@ -36,9 +36,9 @@
36
36
  "express": "4.18.2",
37
37
  "nock": "13.2.1",
38
38
  "supertest": "6.3.3",
39
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.1.1",
40
- "@sap-ux/project-access": "1.13.5",
41
- "@sap-ux/store": "0.3.13"
39
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.1.2",
40
+ "@sap-ux/project-access": "1.13.6",
41
+ "@sap-ux/store": "0.3.14"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "express": "4"