@sap-ux/preview-middleware 0.25.40 → 0.25.42
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/client/adp/controllers/AddCustomFragment.controller.js +2 -5
- package/dist/client/adp/controllers/AddCustomFragment.controller.ts +2 -5
- package/dist/client/flp/init.js +51 -0
- package/dist/client/flp/init.ts +54 -0
- package/dist/client/messagebundle.properties +1 -0
- package/package.json +6 -6
|
@@ -112,11 +112,8 @@ sap.ui.define(["sap/ui/model/json/JSONModel", "../../i18n", "../command-executor
|
|
|
112
112
|
*/
|
|
113
113
|
buildDialogData: async function _buildDialogData() {
|
|
114
114
|
try {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
await this.addFragmentListToModel();
|
|
118
|
-
isCustomColumnFragment = true;
|
|
119
|
-
}
|
|
115
|
+
const isCustomColumnFragment = this.options.type === 'tableColumn';
|
|
116
|
+
await this.addFragmentListToModel();
|
|
120
117
|
this.model.setProperty('/isCustomColumnFragment', isCustomColumnFragment);
|
|
121
118
|
} catch (e) {
|
|
122
119
|
const error = getError(e);
|
|
@@ -145,11 +145,8 @@ export default class AddCustomFragment extends BaseDialog<AddFragmentModel> {
|
|
|
145
145
|
*/
|
|
146
146
|
async buildDialogData(): Promise<void> {
|
|
147
147
|
try {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
await this.addFragmentListToModel();
|
|
151
|
-
isCustomColumnFragment = true;
|
|
152
|
-
}
|
|
148
|
+
const isCustomColumnFragment = this.options.type === 'tableColumn';
|
|
149
|
+
await this.addFragmentListToModel();
|
|
153
150
|
this.model.setProperty('/isCustomColumnFragment', isCustomColumnFragment);
|
|
154
151
|
} catch (e) {
|
|
155
152
|
const error = getError(e);
|
package/dist/client/flp/init.js
CHANGED
|
@@ -35,6 +35,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
|
|
|
35
35
|
* SAPUI5 delivered namespaces from https://ui5.sap.com/#/api/sap
|
|
36
36
|
*/
|
|
37
37
|
const UI5_LIBS = ['sap.apf', 'sap.base', 'sap.chart', 'sap.collaboration', 'sap.f', 'sap.fe', 'sap.fileviewer', 'sap.gantt', 'sap.landvisz', 'sap.m', 'sap.ndc', 'sap.ovp', 'sap.rules', 'sap.suite', 'sap.tnt', 'sap.ui', 'sap.uiext', 'sap.ushell', 'sap.uxap', 'sap.viz', 'sap.webanalytics', 'sap.zen'];
|
|
38
|
+
const CONTROLLER_EXTENSION_PATH_REGEX = /\/changes\/coding\/.+\.(js|ts)/;
|
|
38
39
|
/**
|
|
39
40
|
* Check whether a specific dependency is a custom library, and if yes, add it to the map.
|
|
40
41
|
*
|
|
@@ -243,6 +244,55 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
|
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Extracts an Error object from a global error event.
|
|
249
|
+
* Handles both synchronous errors (ErrorEvent) and unhandled promise rejections (PromiseRejectionEvent).
|
|
250
|
+
*
|
|
251
|
+
* @param {GlobalErrorEvent} event - The global error or unhandled rejection event.
|
|
252
|
+
* @returns {Error | undefined} The extracted Error instance, or undefined if no Error could be extracted.
|
|
253
|
+
*/
|
|
254
|
+
function extractError(event) {
|
|
255
|
+
if ('error' in event && event.error instanceof Error) {
|
|
256
|
+
return event.error;
|
|
257
|
+
}
|
|
258
|
+
if ('reason' in event && event.reason instanceof Error) {
|
|
259
|
+
return event.reason;
|
|
260
|
+
}
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Reports controller extension errors to the Info Center.
|
|
266
|
+
* Filters events by checking if the stack trace contains 'ControllerExtension',
|
|
267
|
+
* and sends matching errors as error-level messages to the Info Center panel.
|
|
268
|
+
*
|
|
269
|
+
* @param {GlobalErrorEvent} event - The global error or unhandled rejection event.
|
|
270
|
+
*/
|
|
271
|
+
const reportControllerExtensionErrorToInfoCenter = event => {
|
|
272
|
+
const error = extractError(event);
|
|
273
|
+
const stackTrace = error?.stack ?? '';
|
|
274
|
+
if (!CONTROLLER_EXTENSION_PATH_REGEX.test(stackTrace)) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
void sendInfoCenterMessage({
|
|
278
|
+
title: {
|
|
279
|
+
key: 'CONTROLLER_EXTENSION_UNHANDLED_ERROR_TITLE'
|
|
280
|
+
},
|
|
281
|
+
description: error?.message ?? '',
|
|
282
|
+
type: MessageBarType.error,
|
|
283
|
+
details: stackTrace
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Registers global event listeners for uncaught errors and unhandled promise rejections
|
|
289
|
+
* to detect and report controller extension errors to the Info Center.
|
|
290
|
+
*/
|
|
291
|
+
function registerForControllerExtensionErrors() {
|
|
292
|
+
globalThis.addEventListener('error', reportControllerExtensionErrorToInfoCenter);
|
|
293
|
+
globalThis.addEventListener('unhandledrejection', reportControllerExtensionErrorToInfoCenter);
|
|
294
|
+
}
|
|
295
|
+
|
|
246
296
|
/**
|
|
247
297
|
* Apply additional configuration and initialize sandbox.
|
|
248
298
|
*
|
|
@@ -266,6 +316,7 @@ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-privat
|
|
|
266
316
|
const ui5VersionInfo = await getUi5Version();
|
|
267
317
|
// Register RTA if configured
|
|
268
318
|
if (flex) {
|
|
319
|
+
registerForControllerExtensionErrors();
|
|
269
320
|
const flexSettings = JSON.parse(flex);
|
|
270
321
|
scenario = flexSettings.scenario;
|
|
271
322
|
container.attachRendererCreatedEvent(async function () {
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -43,6 +43,10 @@ const UI5_LIBS = [
|
|
|
43
43
|
'sap.zen'
|
|
44
44
|
];
|
|
45
45
|
|
|
46
|
+
const CONTROLLER_EXTENSION_PATH_REGEX = /\/changes\/coding\/.+\.(js|ts)/;
|
|
47
|
+
|
|
48
|
+
type GlobalErrorEvent = ErrorEvent | PromiseRejectionEvent;
|
|
49
|
+
|
|
46
50
|
interface Manifest {
|
|
47
51
|
['sap.ui5']?: {
|
|
48
52
|
dependencies?: {
|
|
@@ -278,6 +282,55 @@ function addCardGenerationUserAction(componentInstance: Component, container: ty
|
|
|
278
282
|
});
|
|
279
283
|
}
|
|
280
284
|
|
|
285
|
+
/**
|
|
286
|
+
* Extracts an Error object from a global error event.
|
|
287
|
+
* Handles both synchronous errors (ErrorEvent) and unhandled promise rejections (PromiseRejectionEvent).
|
|
288
|
+
*
|
|
289
|
+
* @param {GlobalErrorEvent} event - The global error or unhandled rejection event.
|
|
290
|
+
* @returns {Error | undefined} The extracted Error instance, or undefined if no Error could be extracted.
|
|
291
|
+
*/
|
|
292
|
+
function extractError(event: GlobalErrorEvent): Error | undefined {
|
|
293
|
+
if ('error' in event && event.error instanceof Error) {
|
|
294
|
+
return event.error;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if ('reason' in event && event.reason instanceof Error) {
|
|
298
|
+
return event.reason;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return undefined;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Reports controller extension errors to the Info Center.
|
|
306
|
+
* Filters events by checking if the stack trace contains 'ControllerExtension',
|
|
307
|
+
* and sends matching errors as error-level messages to the Info Center panel.
|
|
308
|
+
*
|
|
309
|
+
* @param {GlobalErrorEvent} event - The global error or unhandled rejection event.
|
|
310
|
+
*/
|
|
311
|
+
const reportControllerExtensionErrorToInfoCenter: (event: GlobalErrorEvent) => void = (event) => {
|
|
312
|
+
const error = extractError(event);
|
|
313
|
+
const stackTrace = error?.stack ?? '';
|
|
314
|
+
if (!CONTROLLER_EXTENSION_PATH_REGEX.test(stackTrace)) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
void sendInfoCenterMessage({
|
|
318
|
+
title: { key: 'CONTROLLER_EXTENSION_UNHANDLED_ERROR_TITLE' },
|
|
319
|
+
description: error?.message ?? '',
|
|
320
|
+
type: MessageBarType.error,
|
|
321
|
+
details: stackTrace
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Registers global event listeners for uncaught errors and unhandled promise rejections
|
|
327
|
+
* to detect and report controller extension errors to the Info Center.
|
|
328
|
+
*/
|
|
329
|
+
function registerForControllerExtensionErrors(): void {
|
|
330
|
+
globalThis.addEventListener('error', reportControllerExtensionErrorToInfoCenter);
|
|
331
|
+
globalThis.addEventListener('unhandledrejection', reportControllerExtensionErrorToInfoCenter);
|
|
332
|
+
}
|
|
333
|
+
|
|
281
334
|
/**
|
|
282
335
|
* Apply additional configuration and initialize sandbox.
|
|
283
336
|
*
|
|
@@ -309,6 +362,7 @@ export async function init({
|
|
|
309
362
|
const ui5VersionInfo = await getUi5Version();
|
|
310
363
|
// Register RTA if configured
|
|
311
364
|
if (flex) {
|
|
365
|
+
registerForControllerExtensionErrors();
|
|
312
366
|
const flexSettings = JSON.parse(flex) as FlexSettings;
|
|
313
367
|
scenario = flexSettings.scenario;
|
|
314
368
|
container.attachRendererCreatedEvent(async function () {
|
|
@@ -83,6 +83,7 @@ FLP_UI_INVALID_UI5_VERSION_DESCRIPTION = Invalid version info
|
|
|
83
83
|
FLP_UI_VERSION_RETRIEVAL_FAILURE_DESCRIPTION = Could not get the SAPUI5 version of the application. Using {0} as fallback.
|
|
84
84
|
FLP_UI5_VERSION_WARNING_TITLE = SAPUI5 Version Warning
|
|
85
85
|
FLP_UI5_VERSION_WARNING_DESCRIPTION = The current SAPUI5 version set for this adaptation project is {0}. The minimum version for SAPUI5 Adaptation Project and its SAPUI5 Adaptation Editor is {1}. Install version {1} or higher.
|
|
86
|
+
CONTROLLER_EXTENSION_UNHANDLED_ERROR_TITLE = Controller Extension Unhandled Error
|
|
86
87
|
|
|
87
88
|
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create a new custom column. Make sure the table data is loaded and try again.
|
|
88
89
|
|
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.25.
|
|
12
|
+
"version": "0.25.42",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
28
|
"qrcode": "1.5.4",
|
|
29
29
|
"@sap/bas-sdk": "3.13.6",
|
|
30
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.25",
|
|
30
31
|
"@sap-ux/adp-tooling": "0.18.129",
|
|
31
|
-
"@sap-ux/btp-utils": "1.1.15",
|
|
32
32
|
"@sap-ux/feature-toggle": "0.3.8",
|
|
33
33
|
"@sap-ux/logger": "0.8.5",
|
|
34
|
+
"@sap-ux/btp-utils": "1.1.15",
|
|
34
35
|
"@sap-ux/project-access": "1.36.3",
|
|
35
|
-
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.7.25",
|
|
36
36
|
"@sap-ux/system-access": "0.7.11",
|
|
37
37
|
"@sap-ux/i18n": "0.3.11"
|
|
38
38
|
},
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"nock": "14.0.11",
|
|
54
54
|
"npm-run-all2": "8.0.4",
|
|
55
55
|
"supertest": "7.2.2",
|
|
56
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.25.42",
|
|
56
57
|
"@sap-ux/axios-extension": "1.25.35",
|
|
57
|
-
"@
|
|
58
|
-
"@sap-ux/ui5-info": "0.13.21"
|
|
59
|
-
"@sap-ux/store": "1.5.13"
|
|
58
|
+
"@sap-ux/store": "1.5.13",
|
|
59
|
+
"@sap-ux/ui5-info": "0.13.21"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"express": "4"
|