@sap-ux/preview-middleware 0.13.71 → 0.13.73

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.
Files changed (36) hide show
  1. package/dist/base/flp.js +14 -13
  2. package/dist/client/adp/api-handler.js +3 -2
  3. package/dist/client/adp/api-handler.ts +6 -4
  4. package/dist/client/adp/command-executor.js +10 -6
  5. package/dist/client/adp/command-executor.ts +9 -5
  6. package/dist/client/adp/controllers/AddFragment.controller.js +6 -6
  7. package/dist/client/adp/controllers/AddFragment.controller.ts +13 -7
  8. package/dist/client/adp/controllers/BaseDialog.controller.js +15 -1
  9. package/dist/client/adp/controllers/BaseDialog.controller.ts +22 -4
  10. package/dist/client/adp/controllers/ControllerExtension.controller.js +20 -23
  11. package/dist/client/adp/controllers/ControllerExtension.controller.ts +35 -26
  12. package/dist/client/adp/controllers/ExtensionPoint.controller.js +2 -3
  13. package/dist/client/adp/controllers/ExtensionPoint.controller.ts +7 -4
  14. package/dist/client/adp/init-dialogs.js +32 -32
  15. package/dist/client/adp/init-dialogs.ts +27 -27
  16. package/dist/client/adp/init.js +6 -4
  17. package/dist/client/adp/init.ts +4 -3
  18. package/dist/client/adp/ui5-version-utils.js +18 -18
  19. package/dist/client/adp/ui5-version-utils.ts +16 -15
  20. package/dist/client/cpe/changes/service.js +9 -6
  21. package/dist/client/cpe/changes/service.ts +13 -8
  22. package/dist/client/cpe/changes/validator.js +2 -2
  23. package/dist/client/cpe/changes/validator.ts +3 -2
  24. package/dist/client/cpe/control-data.ts +4 -1
  25. package/dist/client/cpe/documentation.ts +1 -1
  26. package/dist/client/cpe/error-utils.js +21 -0
  27. package/dist/client/cpe/error-utils.ts +9 -0
  28. package/dist/client/cpe/init.js +7 -5
  29. package/dist/client/cpe/init.ts +4 -3
  30. package/dist/client/cpe/outline/index.js +5 -3
  31. package/dist/client/cpe/outline/index.ts +2 -1
  32. package/dist/client/cpe/selection.js +7 -5
  33. package/dist/client/cpe/selection.ts +4 -3
  34. package/dist/client/flp/init.js +2 -3
  35. package/dist/client/flp/init.ts +29 -19
  36. package/package.json +6 -6
@@ -6,6 +6,7 @@ import type OutlineService from 'sap/ui/rta/command/OutlineService';
6
6
 
7
7
  import { transformNodes } from './nodes';
8
8
  import Log from 'sap/base/Log';
9
+ import { getError } from '../error-utils';
9
10
 
10
11
  /**
11
12
  *
@@ -23,7 +24,7 @@ export async function initOutline(rta: RuntimeAuthoring, sendAction: (action: Ex
23
24
 
24
25
  sendAction(outlineChanged(outlineNodes));
25
26
  } catch (error) {
26
- Log.error('Outline sync failed!', error);
27
+ Log.error('Outline sync failed!', getError(error));
27
28
  }
28
29
  }
29
30
  await syncOutline();
@@ -7,8 +7,9 @@ sap.ui.define([
7
7
  './documentation',
8
8
  'sap/ui/dt/OverlayRegistry',
9
9
  'sap/ui/dt/OverlayUtil',
10
- './ui5-utils'
11
- ], function (___sap_ux_private_control_property_editor_common, ___control_data, ___utils, Log, ___documentation, OverlayRegistry, OverlayUtil, ___ui5_utils) {
10
+ './ui5-utils',
11
+ './error-utils'
12
+ ], function (___sap_ux_private_control_property_editor_common, ___control_data, ___utils, Log, ___documentation, OverlayRegistry, OverlayUtil, ___ui5_utils, ___error_utils) {
12
13
  'use strict';
13
14
  const controlSelected = ___sap_ux_private_control_property_editor_common['controlSelected'];
14
15
  const propertyChanged = ___sap_ux_private_control_property_editor_common['propertyChanged'];
@@ -18,6 +19,7 @@ sap.ui.define([
18
19
  const getRuntimeControl = ___utils['getRuntimeControl'];
19
20
  const getDocumentation = ___documentation['getDocumentation'];
20
21
  const getComponent = ___ui5_utils['getComponent'];
22
+ const getError = ___error_utils['getError'];
21
23
  function propertyChangeId(controlId, propertyName) {
22
24
  return [
23
25
  controlId,
@@ -45,7 +47,7 @@ sap.ui.define([
45
47
  controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
46
48
  });
47
49
  } catch (e) {
48
- Log.error('Document loading failed', e);
50
+ Log.error('Document loading failed', getError(e));
49
51
  }
50
52
  }
51
53
  class SelectionService {
@@ -58,7 +60,7 @@ sap.ui.define([
58
60
  const eventOrigin = new Set();
59
61
  const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
60
62
  this.rta.attachSelectionChange(event => {
61
- onselectionChange(event).catch(error => Log.error('Event interrupted: ', error));
63
+ onselectionChange(event).catch(error => Log.error('Event interrupted: ', getError(error)));
62
64
  });
63
65
  subscribe(async action => {
64
66
  if (selectControl.match(action)) {
@@ -126,7 +128,7 @@ sap.ui.define([
126
128
  });
127
129
  }
128
130
  } catch (error) {
129
- Log.error('Failed to report telemetry', error);
131
+ Log.error('Failed to report telemetry', getError(error));
130
132
  } finally {
131
133
  const controlData = buildControlData(runtimeControl, overlayControl);
132
134
  await addDocumentationForProperties(runtimeControl, controlData);
@@ -20,6 +20,7 @@ import { getDocumentation } from './documentation';
20
20
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
21
21
  import OverlayUtil from 'sap/ui/dt/OverlayUtil';
22
22
  import { getComponent } from './ui5-utils';
23
+ import { getError } from './error-utils';
23
24
 
24
25
  export interface PropertyChangeParams {
25
26
  name: string;
@@ -78,7 +79,7 @@ async function addDocumentationForProperties(control: ManagedObject, controlData
78
79
  controlProp.documentation = getPropertyDocument(property, controlProp.ui5Type, document);
79
80
  });
80
81
  } catch (e) {
81
- Log.error('Document loading failed', e);
82
+ Log.error('Document loading failed', getError(e));
82
83
  }
83
84
  }
84
85
 
@@ -105,7 +106,7 @@ export class SelectionService implements Service {
105
106
  const eventOrigin: Set<string> = new Set();
106
107
  const onselectionChange = this.createOnSelectionChangeHandler(sendAction, eventOrigin);
107
108
  this.rta.attachSelectionChange((event) => {
108
- onselectionChange(event).catch((error) => Log.error('Event interrupted: ', error));
109
+ onselectionChange(event).catch((error) => Log.error('Event interrupted: ', getError(error)));
109
110
  });
110
111
  subscribe(async (action: ExternalAction): Promise<void> => {
111
112
  if (selectControl.match(action)) {
@@ -192,7 +193,7 @@ export class SelectionService implements Service {
192
193
  reportTelemetry({ category: 'Overlay Selection', controlName: name });
193
194
  }
194
195
  } catch (error) {
195
- Log.error('Failed to report telemetry', error);
196
+ Log.error('Failed to report telemetry', getError(error));
196
197
  } finally {
197
198
  const controlData = buildControlData(runtimeControl, overlayControl);
198
199
  await addDocumentationForProperties(runtimeControl, controlData);
@@ -7,7 +7,6 @@ sap.ui.define(["sap/base/Log", "sap/ui/core/IconPool", "sap/base/i18n/ResourceBu
7
7
  * SAPUI5 delivered namespaces from https://ui5.sap.com/#/api/sap
8
8
  */
9
9
  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'];
10
-
11
10
  /**
12
11
  * Check whether a specific dependency is a custom library, and if yes, add it to the map.
13
12
  *
@@ -38,7 +37,7 @@ sap.ui.define(["sap/base/Log", "sap/ui/core/IconPool", "sap/base/i18n/ResourceBu
38
37
  promises.push(fetch(`${url}/manifest.json`).then(async resp => {
39
38
  const manifest = await resp.json();
40
39
  if (manifest) {
41
- if (manifest['sap.ui5'] && manifest['sap.ui5'].dependencies) {
40
+ if (manifest['sap.ui5']?.dependencies) {
42
41
  if (manifest['sap.ui5'].dependencies.libs) {
43
42
  addKeys(manifest['sap.ui5'].dependencies.libs, result);
44
43
  }
@@ -46,7 +45,7 @@ sap.ui.define(["sap/base/Log", "sap/ui/core/IconPool", "sap/base/i18n/ResourceBu
46
45
  addKeys(manifest['sap.ui5'].dependencies.components, result);
47
46
  }
48
47
  }
49
- if (manifest['sap.ui5'] && manifest['sap.ui5'].componentUsages) {
48
+ if (manifest['sap.ui5']?.componentUsages) {
50
49
  addKeys(manifest['sap.ui5'].componentUsages, result);
51
50
  }
52
51
  }
@@ -1,7 +1,7 @@
1
1
  import Log from 'sap/base/Log';
2
2
  import type AppLifeCycle from 'sap/ushell/services/AppLifeCycle';
3
3
  import type { InitRtaScript, RTAPlugin, StartAdaptation } from 'sap/ui/rta/api/startAdaptation';
4
- import type { RTAOptions } from 'sap/ui/rta/RuntimeAuthoring';
4
+ import type { FlexSettings, RTAOptions } from 'sap/ui/rta/RuntimeAuthoring';
5
5
  import IconPool from 'sap/ui/core/IconPool';
6
6
  import ResourceBundle from 'sap/base/i18n/ResourceBundle';
7
7
  import AppState from 'sap/ushell/services/AppState';
@@ -34,6 +34,27 @@ const UI5_LIBS = [
34
34
  'sap.zen'
35
35
  ];
36
36
 
37
+ interface Manifest {
38
+ ['sap.ui5']?: {
39
+ dependencies?: {
40
+ libs: Record<string, unknown>;
41
+ components: Record<string, unknown>;
42
+ };
43
+ componentUsages?: Record<string, unknown>;
44
+ };
45
+ }
46
+
47
+ type AppIndexData = Record<
48
+ string,
49
+ {
50
+ dependencies?: {
51
+ url?: string;
52
+ type?: string;
53
+ componentId: string;
54
+ }[];
55
+ }
56
+ >;
57
+
37
58
  /**
38
59
  * Check whether a specific dependency is a custom library, and if yes, add it to the map.
39
60
  *
@@ -65,9 +86,9 @@ async function getManifestLibs(appUrls: string[]): Promise<string> {
65
86
  for (const url of appUrls) {
66
87
  promises.push(
67
88
  fetch(`${url}/manifest.json`).then(async (resp) => {
68
- const manifest = await resp.json();
89
+ const manifest = (await resp.json()) as Manifest;
69
90
  if (manifest) {
70
- if (manifest['sap.ui5'] && manifest['sap.ui5'].dependencies) {
91
+ if (manifest['sap.ui5']?.dependencies) {
71
92
  if (manifest['sap.ui5'].dependencies.libs) {
72
93
  addKeys(manifest['sap.ui5'].dependencies.libs, result);
73
94
  }
@@ -75,7 +96,7 @@ async function getManifestLibs(appUrls: string[]): Promise<string> {
75
96
  addKeys(manifest['sap.ui5'].dependencies.components, result);
76
97
  }
77
98
  }
78
- if (manifest['sap.ui5'] && manifest['sap.ui5'].componentUsages) {
99
+ if (manifest['sap.ui5']?.componentUsages) {
79
100
  addKeys(manifest['sap.ui5'].componentUsages, result);
80
101
  }
81
102
  }
@@ -90,18 +111,7 @@ async function getManifestLibs(appUrls: string[]): Promise<string> {
90
111
  *
91
112
  * @param dataFromAppIndex data returned from the app index service
92
113
  */
93
- function registerModules(
94
- dataFromAppIndex: Record<
95
- string,
96
- {
97
- dependencies?: {
98
- url?: string;
99
- type?: string;
100
- componentId: string;
101
- }[];
102
- }
103
- >
104
- ) {
114
+ function registerModules(dataFromAppIndex: AppIndexData) {
105
115
  Object.keys(dataFromAppIndex).forEach(function (moduleDefinitionKey) {
106
116
  const moduleDefinition = dataFromAppIndex[moduleDefinitionKey];
107
117
  if (moduleDefinition && moduleDefinition.dependencies) {
@@ -151,7 +161,7 @@ export async function registerComponentDependencyPaths(appUrls: string[], urlPar
151
161
  }
152
162
  const response = await fetch(url);
153
163
  try {
154
- registerModules(await response.json());
164
+ registerModules((await response.json()) as AppIndexData);
155
165
  } catch (error) {
156
166
  Log.error(`Registering of reuse libs failed. Error:${error}`);
157
167
  }
@@ -224,7 +234,7 @@ export async function init({
224
234
  const version = sap.ui.version;
225
235
  const minor = parseInt(version.split('.')[1], 10);
226
236
  const view = event.getParameter('componentInstance');
227
- const flexSettings = JSON.parse(flex);
237
+ const flexSettings = JSON.parse(flex) as FlexSettings;
228
238
  const pluginScript = flexSettings.pluginScript ?? '';
229
239
 
230
240
  let libs: string[] = [];
@@ -235,7 +245,7 @@ export async function init({
235
245
  }
236
246
 
237
247
  if (flexSettings.pluginScript) {
238
- libs.push(pluginScript);
248
+ libs.push(pluginScript as string);
239
249
  delete flexSettings.pluginScript;
240
250
  }
241
251
 
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.13.71",
12
+ "version": "0.13.73",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,11 +25,11 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/logger": "0.5.1",
29
28
  "@sap-ux/btp-utils": "0.14.4",
30
- "@sap-ux/adp-tooling": "0.11.5",
29
+ "@sap-ux/project-access": "1.22.3",
30
+ "@sap-ux/adp-tooling": "0.11.6",
31
31
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.23",
32
- "@sap-ux/project-access": "1.22.2"
32
+ "@sap-ux/logger": "0.5.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/ejs": "3.1.2",
@@ -45,10 +45,10 @@
45
45
  "supertest": "6.3.3",
46
46
  "@sap-ux-private/playwright": "0.0.3",
47
47
  "dotenv": "16.3.1",
48
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.15",
49
48
  "@sap-ux/axios-extension": "1.14.1",
50
- "@sap-ux/ui5-info": "0.5.0",
49
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.16",
51
50
  "@sap-ux/store": "0.6.0",
51
+ "@sap-ux/ui5-info": "0.5.0",
52
52
  "@sap-ux/i18n": "0.0.7"
53
53
  },
54
54
  "peerDependencies": {