@sap-ux/preview-middleware 0.13.37 → 0.13.39
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/init.js +27 -10
- package/dist/client/adp/init.ts +34 -10
- package/dist/client/cpe/connector-service.js +45 -0
- package/dist/client/cpe/connector-service.ts +35 -0
- package/dist/client/cpe/init.js +6 -13
- package/dist/client/cpe/init.ts +5 -15
- package/dist/client/flp/enableFakeConnector.js +7 -0
- package/dist/client/flp/enableFakeConnector.ts +8 -1
- package/package.json +8 -7
package/dist/client/adp/init.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
sap.ui.define([
|
|
3
3
|
'sap/base/Log',
|
|
4
|
-
'sap/ui/core/ElementRegistry',
|
|
5
4
|
'../cpe/init',
|
|
6
5
|
'./init-dialogs',
|
|
7
6
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
8
7
|
'sap/ui/VersionInfo',
|
|
9
8
|
'./ui5-version-utils'
|
|
10
|
-
], function (log,
|
|
9
|
+
], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common, VersionInfo, ___ui5_version_utils) {
|
|
11
10
|
'use strict';
|
|
12
11
|
function _interopRequireDefault(obj) {
|
|
13
12
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -52,7 +51,7 @@ sap.ui.define([
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
const syncViewsIds = getAllSyncViewsIds();
|
|
54
|
+
const syncViewsIds = await getAllSyncViewsIds(minor);
|
|
56
55
|
initDialogs(rta, syncViewsIds);
|
|
57
56
|
if (minor > 77) {
|
|
58
57
|
const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
|
|
@@ -76,16 +75,34 @@ sap.ui.define([
|
|
|
76
75
|
}
|
|
77
76
|
log.debug('ADP init executed.');
|
|
78
77
|
};
|
|
79
|
-
function getAllSyncViewsIds() {
|
|
80
|
-
const elements = UI5ElementRegistry.all();
|
|
78
|
+
async function getAllSyncViewsIds(minor) {
|
|
81
79
|
const syncViewIds = [];
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
try {
|
|
81
|
+
if (minor < 120) {
|
|
82
|
+
const Element = (await __ui5_require_async('sap/ui/core/Element')).default;
|
|
83
|
+
const elements = Element.registry.filter(() => true);
|
|
84
|
+
elements.forEach(ui5Element => {
|
|
85
|
+
if (isSyncView(ui5Element)) {
|
|
86
|
+
syncViewIds.push(ui5Element.getId());
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
|
|
91
|
+
const elements = ElementRegistry.all();
|
|
92
|
+
Object.entries(elements).forEach(_ref => {
|
|
93
|
+
let [key, ui5Element] = _ref;
|
|
94
|
+
if (isSyncView(ui5Element)) {
|
|
95
|
+
syncViewIds.push(key);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
86
98
|
}
|
|
87
|
-
})
|
|
99
|
+
} catch (error) {
|
|
100
|
+
log.error('Could not get application sync views', error);
|
|
101
|
+
}
|
|
88
102
|
return syncViewIds;
|
|
89
103
|
}
|
|
104
|
+
const isSyncView = element => {
|
|
105
|
+
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
106
|
+
};
|
|
90
107
|
return __exports;
|
|
91
108
|
});
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import log from 'sap/base/Log';
|
|
2
2
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
3
|
-
import UI5ElementRegistry from 'sap/ui/core/ElementRegistry';
|
|
4
|
-
|
|
5
3
|
import init from '../cpe/init';
|
|
6
4
|
import { initDialogs } from './init-dialogs';
|
|
7
5
|
import {
|
|
@@ -46,7 +44,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
46
44
|
}
|
|
47
45
|
);
|
|
48
46
|
|
|
49
|
-
const syncViewsIds = getAllSyncViewsIds();
|
|
47
|
+
const syncViewsIds = await getAllSyncViewsIds(minor);
|
|
50
48
|
initDialogs(rta, syncViewsIds);
|
|
51
49
|
|
|
52
50
|
if (minor > 77) {
|
|
@@ -77,19 +75,45 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
/**
|
|
80
|
-
*
|
|
81
78
|
* Get Ids for all sync views
|
|
79
|
+
*
|
|
80
|
+
* @param minor UI5 Version
|
|
82
81
|
*
|
|
83
82
|
* @returns array of Ids for application sync views
|
|
84
83
|
*/
|
|
85
|
-
function getAllSyncViewsIds(): string[] {
|
|
86
|
-
const elements = UI5ElementRegistry.all() as Record<string, UI5Element>;
|
|
84
|
+
async function getAllSyncViewsIds(minor: number): Promise<string[]> {
|
|
87
85
|
const syncViewIds: string[] = [];
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
86
|
+
try {
|
|
87
|
+
if (minor < 120) {
|
|
88
|
+
const Element = (await import('sap/ui/core/Element')).default;
|
|
89
|
+
const elements = Element.registry.filter(() => true) as UI5Element[];
|
|
90
|
+
elements.forEach((ui5Element) => {
|
|
91
|
+
if (isSyncView(ui5Element)) {
|
|
92
|
+
syncViewIds.push(ui5Element.getId());
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
const ElementRegistry = (await import('sap/ui/core/ElementRegistry')).default;
|
|
97
|
+
const elements = ElementRegistry.all() as Record<string, UI5Element>;
|
|
98
|
+
Object.entries(elements).forEach(([key, ui5Element]) => {
|
|
99
|
+
if (isSyncView(ui5Element)) {
|
|
100
|
+
syncViewIds.push(key);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
91
103
|
}
|
|
92
|
-
})
|
|
104
|
+
} catch (error) {
|
|
105
|
+
log.error('Could not get application sync views', error);
|
|
106
|
+
}
|
|
93
107
|
|
|
94
108
|
return syncViewIds;
|
|
95
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Check if element is sync view
|
|
113
|
+
*
|
|
114
|
+
* @param element UI5Element
|
|
115
|
+
* @returns boolean if element is sync view or not
|
|
116
|
+
*/
|
|
117
|
+
const isSyncView = (element: UI5Element): boolean => {
|
|
118
|
+
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
119
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
4
|
+
'sap/ui/VersionInfo'
|
|
5
|
+
], function (___sap_ux_private_control_property_editor_common, VersionInfo) {
|
|
6
|
+
'use strict';
|
|
7
|
+
function __ui5_require_async(path) {
|
|
8
|
+
return new Promise(function (resolve, reject) {
|
|
9
|
+
sap.ui.require([path], function (module) {
|
|
10
|
+
if (!(module && module.__esModule)) {
|
|
11
|
+
module = module === null || !(typeof module === 'object' && path.endsWith('/library')) ? { default: module } : module;
|
|
12
|
+
Object.defineProperty(module, '__esModule', { value: true });
|
|
13
|
+
}
|
|
14
|
+
resolve(module);
|
|
15
|
+
}, function (err) {
|
|
16
|
+
reject(err);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const storageFileChanged = ___sap_ux_private_control_property_editor_common['storageFileChanged'];
|
|
21
|
+
class WorkspaceConnectorService {
|
|
22
|
+
async init(sendAction) {
|
|
23
|
+
const {version} = await VersionInfo.load();
|
|
24
|
+
const versionParts = version.split('.');
|
|
25
|
+
const minor = parseInt(versionParts[1], 10);
|
|
26
|
+
if (minor > 72) {
|
|
27
|
+
const connector = (await __ui5_require_async('open/ux/preview/client/flp/WorkspaceConnector')).default;
|
|
28
|
+
connector.storage.fileChangeRequestNotifier = notifier(sendAction);
|
|
29
|
+
} else {
|
|
30
|
+
const FakeLrepConnector = (await __ui5_require_async('sap/ui/fl/FakeLrepConnector')).default;
|
|
31
|
+
FakeLrepConnector.fileChangeRequestNotifier = notifier(sendAction);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function notifier(sendAction) {
|
|
36
|
+
return (fileName, kind, changeType) => {
|
|
37
|
+
if (changeType && changeType !== 'appdescr_fe_changePageConfiguration' || kind === 'delete') {
|
|
38
|
+
sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var __exports = { __esModule: true };
|
|
43
|
+
__exports.WorkspaceConnectorService = WorkspaceConnectorService;
|
|
44
|
+
return __exports;
|
|
45
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ExternalAction, storageFileChanged } from '@sap-ux-private/control-property-editor-common';
|
|
2
|
+
import { ActionSenderFunction } from './types';
|
|
3
|
+
import VersionInfo from 'sap/ui/VersionInfo';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A Class of WorkspaceConnectorService
|
|
7
|
+
*/
|
|
8
|
+
export class WorkspaceConnectorService {
|
|
9
|
+
/**
|
|
10
|
+
* Initializes connector service.
|
|
11
|
+
*
|
|
12
|
+
* @param sendAction action sender function
|
|
13
|
+
*/
|
|
14
|
+
public async init(sendAction: ActionSenderFunction): Promise<void> {
|
|
15
|
+
const { version } = (await VersionInfo.load()) as { version: string };
|
|
16
|
+
const versionParts = version.split('.');
|
|
17
|
+
const minor = parseInt(versionParts[1], 10);
|
|
18
|
+
if (minor > 72) {
|
|
19
|
+
const connector = (await import('open/ux/preview/client/flp/WorkspaceConnector')).default;
|
|
20
|
+
// hook the file deletion listener to the UI5 workspace connector
|
|
21
|
+
connector.storage.fileChangeRequestNotifier = notifier(sendAction);
|
|
22
|
+
} else {
|
|
23
|
+
const FakeLrepConnector = (await import('sap/ui/fl/FakeLrepConnector')).default;
|
|
24
|
+
FakeLrepConnector.fileChangeRequestNotifier = notifier(sendAction);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function notifier(sendAction: (action: ExternalAction) => void) {
|
|
30
|
+
return (fileName: string, kind: 'delete' | 'create', changeType?: string) => {
|
|
31
|
+
if ((changeType && changeType !== 'appdescr_fe_changePageConfiguration') || kind === 'delete') {
|
|
32
|
+
sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
package/dist/client/cpe/init.js
CHANGED
|
@@ -8,23 +8,19 @@ sap.ui.define([
|
|
|
8
8
|
'sap/base/Log',
|
|
9
9
|
'./logger',
|
|
10
10
|
'./ui5-utils',
|
|
11
|
-
'
|
|
12
|
-
], function (___sap_ux_private_control_property_editor_common, ___outline_index, ___selection, ___changes_service, ___documentation, Log, ___logger, ___ui5_utils,
|
|
11
|
+
'./connector-service'
|
|
12
|
+
], function (___sap_ux_private_control_property_editor_common, ___outline_index, ___selection, ___changes_service, ___documentation, Log, ___logger, ___ui5_utils, ___connector_service) {
|
|
13
13
|
'use strict';
|
|
14
|
-
function _interopRequireDefault(obj) {
|
|
15
|
-
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
16
|
-
}
|
|
17
14
|
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
18
15
|
const iconsLoaded = ___sap_ux_private_control_property_editor_common['iconsLoaded'];
|
|
19
16
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
20
|
-
const storageFileChanged = ___sap_ux_private_control_property_editor_common['storageFileChanged'];
|
|
21
17
|
const initOutline = ___outline_index['initOutline'];
|
|
22
18
|
const SelectionService = ___selection['SelectionService'];
|
|
23
19
|
const ChangeService = ___changes_service['ChangeService'];
|
|
24
20
|
const loadDefaultLibraries = ___documentation['loadDefaultLibraries'];
|
|
25
21
|
const logger = ___logger['logger'];
|
|
26
22
|
const getIcons = ___ui5_utils['getIcons'];
|
|
27
|
-
const
|
|
23
|
+
const WorkspaceConnectorService = ___connector_service['WorkspaceConnectorService'];
|
|
28
24
|
function init(rta) {
|
|
29
25
|
Log.info('Initializing Control Property Editor');
|
|
30
26
|
const flexSettings = rta.getFlexSettings();
|
|
@@ -37,9 +33,11 @@ sap.ui.define([
|
|
|
37
33
|
}
|
|
38
34
|
const selectionService = new SelectionService(rta);
|
|
39
35
|
const changesService = new ChangeService({ rta }, selectionService);
|
|
36
|
+
const connectorService = new WorkspaceConnectorService();
|
|
40
37
|
const services = [
|
|
41
38
|
selectionService,
|
|
42
|
-
changesService
|
|
39
|
+
changesService,
|
|
40
|
+
connectorService
|
|
43
41
|
];
|
|
44
42
|
try {
|
|
45
43
|
loadDefaultLibraries();
|
|
@@ -57,11 +55,6 @@ sap.ui.define([
|
|
|
57
55
|
}
|
|
58
56
|
initOutline(rta, sendAction).catch(error => Log.error('Error during initialization of Control Property Editor', error));
|
|
59
57
|
const icons = getIcons();
|
|
60
|
-
workspaceConnector.storage.fileChangeRequestNotifier = (fileName, kind, changeType) => {
|
|
61
|
-
if (changeType && changeType !== 'appdescr_fe_changePageConfiguration' || kind === 'delete') {
|
|
62
|
-
sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
58
|
sendAction(iconsLoaded(icons));
|
|
66
59
|
} catch (error) {
|
|
67
60
|
Log.error('Error during initialization of Control Property Editor', error);
|
package/dist/client/cpe/init.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type { ExternalAction } from '@sap-ux-private/control-property-editor-com
|
|
|
2
2
|
import {
|
|
3
3
|
startPostMessageCommunication,
|
|
4
4
|
iconsLoaded,
|
|
5
|
-
enableTelemetry
|
|
6
|
-
storageFileChanged
|
|
5
|
+
enableTelemetry
|
|
7
6
|
} from '@sap-ux-private/control-property-editor-common';
|
|
8
7
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
9
8
|
|
|
@@ -15,7 +14,7 @@ import { loadDefaultLibraries } from './documentation';
|
|
|
15
14
|
import Log from 'sap/base/Log';
|
|
16
15
|
import { logger } from './logger';
|
|
17
16
|
import { getIcons } from './ui5-utils';
|
|
18
|
-
import
|
|
17
|
+
import { WorkspaceConnectorService } from './connector-service';
|
|
19
18
|
|
|
20
19
|
export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
21
20
|
Log.info('Initializing Control Property Editor');
|
|
@@ -38,7 +37,9 @@ export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
|
38
37
|
const selectionService = new SelectionService(rta);
|
|
39
38
|
|
|
40
39
|
const changesService = new ChangeService({ rta }, selectionService);
|
|
41
|
-
const
|
|
40
|
+
const connectorService = new WorkspaceConnectorService();
|
|
41
|
+
|
|
42
|
+
const services: Service[] = [selectionService, changesService, connectorService];
|
|
42
43
|
try {
|
|
43
44
|
loadDefaultLibraries();
|
|
44
45
|
const { sendAction } = startPostMessageCommunication<ExternalAction>(
|
|
@@ -65,17 +66,6 @@ export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
|
65
66
|
);
|
|
66
67
|
const icons = getIcons();
|
|
67
68
|
|
|
68
|
-
// hook the file deletion listener to the UI5 workspace connector
|
|
69
|
-
workspaceConnector.storage.fileChangeRequestNotifier = (
|
|
70
|
-
fileName: string,
|
|
71
|
-
kind: 'delete' | 'create',
|
|
72
|
-
changeType?: string
|
|
73
|
-
) => {
|
|
74
|
-
if ((changeType && changeType !== 'appdescr_fe_changePageConfiguration') || kind === 'delete') {
|
|
75
|
-
sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
69
|
sendAction(iconsLoaded(icons));
|
|
80
70
|
} catch (error) {
|
|
81
71
|
Log.error('Error during initialization of Control Property Editor', error);
|
|
@@ -19,6 +19,13 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./comm
|
|
|
19
19
|
change.support ??= {};
|
|
20
20
|
change.support.generator = settings.generator;
|
|
21
21
|
}
|
|
22
|
+
if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
23
|
+
try {
|
|
24
|
+
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
// exceptions in the listener call are ignored
|
|
27
|
+
}
|
|
28
|
+
}
|
|
22
29
|
return fetch(CHANGES_API_PATH, {
|
|
23
30
|
method: 'POST',
|
|
24
31
|
body: JSON.stringify(change, null, 2),
|
|
@@ -37,6 +37,14 @@ export async function create(changes: FlexChange[]): Promise<void> {
|
|
|
37
37
|
change.support.generator = settings.generator;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
|
|
41
|
+
try {
|
|
42
|
+
FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// exceptions in the listener call are ignored
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
return fetch(CHANGES_API_PATH, {
|
|
41
49
|
method: 'POST',
|
|
42
50
|
body: JSON.stringify(change, null, 2),
|
|
@@ -88,6 +96,5 @@ export default function (): void {
|
|
|
88
96
|
loadChanges,
|
|
89
97
|
loadSettings: () => Promise.resolve()
|
|
90
98
|
});
|
|
91
|
-
|
|
92
99
|
FakeLrepConnector.enableFakeConnector();
|
|
93
100
|
}
|
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.
|
|
12
|
+
"version": "0.13.39",
|
|
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/btp-utils": "0.14.4",
|
|
29
|
-
"@sap-ux/adp-tooling": "0.10.5",
|
|
30
28
|
"@sap-ux/logger": "0.5.1",
|
|
31
|
-
"@sap-ux/
|
|
32
|
-
"@sap-ux/
|
|
29
|
+
"@sap-ux/adp-tooling": "0.10.5",
|
|
30
|
+
"@sap-ux/btp-utils": "0.14.4",
|
|
31
|
+
"@sap-ux/project-access": "1.20.0",
|
|
32
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.20"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/ejs": "3.1.2",
|
|
@@ -45,9 +45,10 @@
|
|
|
45
45
|
"supertest": "6.3.3",
|
|
46
46
|
"@sap-ux-private/playwright": "0.0.3",
|
|
47
47
|
"dotenv": "16.3.1",
|
|
48
|
-
"@sap-ux/i18n": "0.0.6",
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.10",
|
|
50
48
|
"@sap-ux/axios-extension": "1.12.3",
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.12",
|
|
50
|
+
"@sap-ux/i18n": "0.0.6",
|
|
51
|
+
"@sap-ux/ui5-info": "0.5.0",
|
|
51
52
|
"@sap-ux/store": "0.5.0"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|