@sap-ux/preview-middleware 0.20.16 → 0.20.19
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/flp.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare class FlpSandbox {
|
|
|
39
39
|
private readonly utils;
|
|
40
40
|
private readonly project;
|
|
41
41
|
private readonly cardGenerator?;
|
|
42
|
+
private projectType;
|
|
42
43
|
/**
|
|
43
44
|
* Constructor setting defaults and keeping reference to workspace resources.
|
|
44
45
|
*
|
|
@@ -72,12 +73,15 @@ export declare class FlpSandbox {
|
|
|
72
73
|
*/
|
|
73
74
|
private getDeveloperModeConfig;
|
|
74
75
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
76
|
+
* Deletes the Fiori Tools local connector (WorkspaceConnector) in case of a not supported UI5 versions.
|
|
77
|
+
* As an alternative the Fiori Tools fake connector (FakeLrepConnector) will be used as defined in preview-middleware-client/src/flp/initConnectors.ts.
|
|
78
|
+
* Also deletes the ABAP connector in case of a CAP project.
|
|
77
79
|
*
|
|
80
|
+
* @param ui5VersionMajor - the major version of UI5
|
|
81
|
+
* @param ui5VersionMinor - the minor version of UI5
|
|
78
82
|
* @private
|
|
79
83
|
*/
|
|
80
|
-
private
|
|
84
|
+
private checkDeleteConnectors;
|
|
81
85
|
/**
|
|
82
86
|
* Generates the FLP sandbox for an editor.
|
|
83
87
|
*
|
package/dist/base/flp.js
CHANGED
|
@@ -69,6 +69,7 @@ class FlpSandbox {
|
|
|
69
69
|
utils;
|
|
70
70
|
project;
|
|
71
71
|
cardGenerator;
|
|
72
|
+
projectType;
|
|
72
73
|
/**
|
|
73
74
|
* Constructor setting defaults and keeping reference to workspace resources.
|
|
74
75
|
*
|
|
@@ -105,6 +106,7 @@ class FlpSandbox {
|
|
|
105
106
|
* @param adp optional reference to the ADP tooling
|
|
106
107
|
*/
|
|
107
108
|
async init(manifest, componentId, resources = {}, adp) {
|
|
109
|
+
this.projectType = await (0, project_access_1.getProjectType)(await (0, project_access_1.findProjectRoot)(process.cwd(), true, true));
|
|
108
110
|
this.createFlexHandler();
|
|
109
111
|
this.flpConfig.libs ??= await this.hasLocateReuseLibsScript();
|
|
110
112
|
const id = manifest['sap.app']?.id ?? '';
|
|
@@ -118,11 +120,10 @@ class FlpSandbox {
|
|
|
118
120
|
intent: this.flpConfig.intent
|
|
119
121
|
}, this.logger);
|
|
120
122
|
this.addStandardRoutes();
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.cardGenerator.path
|
|
125
|
-
}
|
|
123
|
+
if (this.cardGenerator?.path) {
|
|
124
|
+
this.cardGenerator.path = this.cardGenerator.path.startsWith('/')
|
|
125
|
+
? this.cardGenerator.path
|
|
126
|
+
: `/${this.cardGenerator.path}`;
|
|
126
127
|
await this.addCardGeneratorMiddlewareRoute();
|
|
127
128
|
await this.addStoreCardManifestRoute();
|
|
128
129
|
await this.addStoreI18nKeysRoute();
|
|
@@ -176,14 +177,29 @@ class FlpSandbox {
|
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
179
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
180
|
+
* Deletes the Fiori Tools local connector (WorkspaceConnector) in case of a not supported UI5 versions.
|
|
181
|
+
* As an alternative the Fiori Tools fake connector (FakeLrepConnector) will be used as defined in preview-middleware-client/src/flp/initConnectors.ts.
|
|
182
|
+
* Also deletes the ABAP connector in case of a CAP project.
|
|
181
183
|
*
|
|
184
|
+
* @param ui5VersionMajor - the major version of UI5
|
|
185
|
+
* @param ui5VersionMinor - the minor version of UI5
|
|
182
186
|
* @private
|
|
183
187
|
*/
|
|
184
|
-
|
|
185
|
-
(
|
|
186
|
-
|
|
188
|
+
checkDeleteConnectors(ui5VersionMajor, ui5VersionMinor) {
|
|
189
|
+
if (ui5VersionMajor === 1 && ui5VersionMinor < 78) {
|
|
190
|
+
this.templateConfig.ui5.flex?.splice(1, 1);
|
|
191
|
+
this.logger.debug(`The Fiori Tools local connector (WorkspaceConnector) is not being used because the current UI5 version does not support it. The Fiori Tools fake connector (FakeLrepConnector) will be used instead.`);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.logger.debug(`The Fiori Tools local connector (WorkspaceConnector) is being used.`);
|
|
195
|
+
}
|
|
196
|
+
if (this.projectType === 'CAPJava' || this.projectType === 'CAPNodejs') {
|
|
197
|
+
this.templateConfig.ui5.flex?.splice(0, 1);
|
|
198
|
+
this.logger.debug(`The ABAP connector is not being used because the current project type is '${this.projectType}'.`);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.logger.debug(`The ABAP connector is being used.`);
|
|
202
|
+
}
|
|
187
203
|
}
|
|
188
204
|
/**
|
|
189
205
|
* Generates the FLP sandbox for an editor.
|
|
@@ -214,9 +230,7 @@ class FlpSandbox {
|
|
|
214
230
|
};
|
|
215
231
|
config.features = feature_toggle_1.FeatureToggleAccess.getAllFeatureToggles();
|
|
216
232
|
const ui5Version = await this.getUi5Version(req.protocol, req.headers.host, req['ui5-patched-router']?.baseUrl);
|
|
217
|
-
|
|
218
|
-
this.overrideCustomConnector();
|
|
219
|
-
}
|
|
233
|
+
this.checkDeleteConnectors(ui5Version.major, ui5Version.minor);
|
|
220
234
|
if (editor.developerMode === true) {
|
|
221
235
|
config.ui5.bootstrapOptions = serializeUi5Configuration(this.getDeveloperModeConfig(ui5Version.major));
|
|
222
236
|
}
|
|
@@ -353,6 +367,7 @@ class FlpSandbox {
|
|
|
353
367
|
'protocol' in req
|
|
354
368
|
? req.protocol
|
|
355
369
|
: req.headers.referer?.substring(0, req.headers.referer.indexOf(':')) ?? 'http', req.headers.host, 'ui5-patched-router' in req ? req['ui5-patched-router']?.baseUrl : undefined);
|
|
370
|
+
this.checkDeleteConnectors(ui5Version.major, ui5Version.minor);
|
|
356
371
|
const html = (0, ejs_1.render)(this.getSandboxTemplate(ui5Version), this.templateConfig);
|
|
357
372
|
this.sendResponse(res, 'text/html', 200, html);
|
|
358
373
|
}
|
|
@@ -415,7 +430,8 @@ class FlpSandbox {
|
|
|
415
430
|
}
|
|
416
431
|
const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
|
|
417
432
|
const label = version.split(/-(.*)/s)?.[1];
|
|
418
|
-
if (
|
|
433
|
+
if (this.flpConfig.enhancedHomePage &&
|
|
434
|
+
((major < 2 && minor < 123) || major >= 2 || label?.includes('legacy-free'))) {
|
|
419
435
|
this.flpConfig.enhancedHomePage = this.templateConfig.enhancedHomePage = false;
|
|
420
436
|
this.logger.warn(`Feature enhancedHomePage disabled: UI5 version ${version} not supported.`);
|
|
421
437
|
}
|
|
@@ -8,8 +8,8 @@ sap.ui.define(["../utils/version"], function (___utils_version) {
|
|
|
8
8
|
/**
|
|
9
9
|
* Initializes UI5 connectors based on the current UI5 version.
|
|
10
10
|
*
|
|
11
|
-
* For UI5 versions below 1.
|
|
12
|
-
* For UI5 versions 1.
|
|
11
|
+
* For UI5 versions below 1.78, this function dynamically requires and executes a FakeLrepConnector.
|
|
12
|
+
* For UI5 versions 1.78 and above, a local connector that reuses the WorkspaceConnector is being defined in preview-middleware/src/base/config.ts.
|
|
13
13
|
* This setup allows for flexibility in using different connectors based on the UI5 version.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
@@ -18,7 +18,7 @@ sap.ui.define(["../utils/version"], function (___utils_version) {
|
|
|
18
18
|
async function initConnectors() {
|
|
19
19
|
if (isLowerThanMinimalUi5Version(await getUi5Version(), {
|
|
20
20
|
major: 1,
|
|
21
|
-
minor:
|
|
21
|
+
minor: 78
|
|
22
22
|
})) {
|
|
23
23
|
sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector) {
|
|
24
24
|
enableFakeConnector();
|
|
@@ -3,15 +3,15 @@ import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
|
3
3
|
/**
|
|
4
4
|
* Initializes UI5 connectors based on the current UI5 version.
|
|
5
5
|
*
|
|
6
|
-
* For UI5 versions below 1.
|
|
7
|
-
* For UI5 versions 1.
|
|
6
|
+
* For UI5 versions below 1.78, this function dynamically requires and executes a FakeLrepConnector.
|
|
7
|
+
* For UI5 versions 1.78 and above, a local connector that reuses the WorkspaceConnector is being defined in preview-middleware/src/base/config.ts.
|
|
8
8
|
* This setup allows for flexibility in using different connectors based on the UI5 version.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* intiConnectors(); // Simply call the function without any arguments.
|
|
12
12
|
*/
|
|
13
13
|
export default async function initConnectors(): Promise<void> {
|
|
14
|
-
if (isLowerThanMinimalUi5Version(await getUi5Version(), { major: 1, minor:
|
|
14
|
+
if (isLowerThanMinimalUi5Version(await getUi5Version(), { major: 1, minor: 78 })) {
|
|
15
15
|
sap.ui.require(['open/ux/preview/client/flp/enableFakeConnector'], function (enableFakeConnector: () => void) {
|
|
16
16
|
enableFakeConnector();
|
|
17
17
|
});
|
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.19",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,13 +25,13 @@
|
|
|
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.12",
|
|
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",
|
|
32
32
|
"@sap-ux/logger": "0.7.0",
|
|
33
33
|
"@sap-ux/project-access": "1.30.2",
|
|
34
|
-
"@sap-ux/system-access": "0.6.
|
|
34
|
+
"@sap-ux/system-access": "0.6.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@sap-ux-private/playwright": "0.2.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
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.
|
|
53
|
-
"@sap-ux/axios-extension": "1.21.
|
|
52
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.14.5",
|
|
53
|
+
"@sap-ux/axios-extension": "1.21.2",
|
|
54
54
|
"@sap-ux/i18n": "0.3.0",
|
|
55
55
|
"@sap-ux/store": "1.1.0",
|
|
56
56
|
"@sap-ux/ui5-info": "0.11.0"
|