@sap-ux/preview-middleware 0.13.18 → 0.13.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.
Files changed (35) hide show
  1. package/dist/base/flex.d.ts +5 -15
  2. package/dist/base/flex.js +4 -32
  3. package/dist/base/flp.d.ts +12 -2
  4. package/dist/base/flp.js +27 -5
  5. package/dist/client/adp/api-handler.js +141 -141
  6. package/dist/client/adp/command-executor.js +54 -54
  7. package/dist/client/adp/control-utils.js +44 -44
  8. package/dist/client/adp/controllers/AddFragment.controller.js +185 -206
  9. package/dist/client/adp/controllers/AddFragment.controller.ts +5 -24
  10. package/dist/client/adp/controllers/BaseDialog.controller.js +74 -57
  11. package/dist/client/adp/controllers/BaseDialog.controller.ts +36 -2
  12. package/dist/client/adp/controllers/ControllerExtension.controller.js +179 -179
  13. package/dist/client/adp/controllers/ExtensionPoint.controller.js +90 -100
  14. package/dist/client/adp/controllers/ExtensionPoint.controller.ts +9 -22
  15. package/dist/client/adp/init-dialogs.js +74 -74
  16. package/dist/client/adp/ui5-version-utils.js +63 -63
  17. package/dist/client/adp/utils.js +61 -33
  18. package/dist/client/adp/utils.ts +34 -0
  19. package/dist/client/cpe/changes/flex-change.js +51 -51
  20. package/dist/client/cpe/changes/index.js +10 -10
  21. package/dist/client/cpe/changes/validator.js +35 -35
  22. package/dist/client/cpe/documentation.js +164 -164
  23. package/dist/client/cpe/logger.js +30 -30
  24. package/dist/client/cpe/outline/nodes.js +84 -84
  25. package/dist/client/cpe/outline/utils.js +37 -37
  26. package/dist/client/cpe/types.js +4 -4
  27. package/dist/client/cpe/ui5-utils.js +49 -49
  28. package/dist/client/cpe/utils.js +48 -48
  29. package/dist/client/flp/WorkspaceConnector.js +84 -84
  30. package/dist/client/flp/common.js +28 -28
  31. package/dist/client/flp/enableFakeConnector.js +77 -77
  32. package/dist/client/flp/init.js +220 -220
  33. package/dist/client/flp/initConnectors.js +33 -33
  34. package/dist/client/flp/initRta.js +178 -178
  35. package/package.json +7 -3
@@ -1,19 +1,8 @@
1
1
  /// <reference path="../../../../types/ui5.d.ts" />
2
2
  import type { Logger } from '@sap-ux/logger';
3
3
  import type { ReaderCollection } from '@ui5/fs';
4
- /**
5
- * Structure of a flex change.
6
- */
7
- export interface FlexChange {
8
- [key: string]: string | object | undefined;
9
- changeType: string;
10
- reference: string;
11
- moduleName?: string;
12
- content?: {
13
- codeRef?: string;
14
- fragmentPath?: string;
15
- };
16
- }
4
+ import type { Editor } from 'mem-fs-editor';
5
+ import type { CommonChangeProperties } from '@sap-ux/adp-tooling';
17
6
  /**
18
7
  * Read changes from the file system and return them.
19
8
  *
@@ -21,7 +10,7 @@ export interface FlexChange {
21
10
  * @param logger logger instance
22
11
  * @returns object with the file name as key and the file content as value
23
12
  */
24
- export declare function readChanges(project: ReaderCollection, logger: Logger): Promise<Record<string, FlexChange>>;
13
+ export declare function readChanges(project: ReaderCollection, logger: Logger): Promise<Record<string, CommonChangeProperties>>;
25
14
  /**
26
15
  * Writes flex changes to the user's workspace.
27
16
  *
@@ -29,13 +18,14 @@ export declare function readChanges(project: ReaderCollection, logger: Logger):
29
18
  * @param data.fileName file name that is required for a valid change
30
19
  * @param data.fileType file type that is required
31
20
  * @param webappPath path to the webapp folder
21
+ * @param fs mem-fs editor
32
22
  * @param logger logger instance
33
23
  * @returns object with success flag and optional message
34
24
  */
35
25
  export declare function writeChange(data: object & {
36
26
  fileName?: string;
37
27
  fileType?: string;
38
- }, webappPath: string, logger: Logger): {
28
+ }, webappPath: string, fs: Editor, logger: Logger): {
39
29
  success: boolean;
40
30
  message?: string;
41
31
  };
package/dist/base/flex.js CHANGED
@@ -12,28 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.deleteChange = exports.writeChange = exports.readChanges = void 0;
13
13
  const fs_1 = require("fs");
14
14
  const path_1 = require("path");
15
- /**
16
- * Map of change type specific correction functions.
17
- */
18
- const moduleNameContentMap = {
19
- codeExt: (change) => { var _a, _b; return ((_b = (_a = change.content) === null || _a === void 0 ? void 0 : _a.codeRef) !== null && _b !== void 0 ? _b : '').replace('.js', ''); },
20
- addXML: (change) => { var _a, _b; return (_b = (_a = change.content) === null || _a === void 0 ? void 0 : _a.fragmentPath) !== null && _b !== void 0 ? _b : ''; }
21
- };
22
- /**
23
- * Sets the moduleName property of the provided change to also support old changes with newer UI5 versions.
24
- *
25
- * @param change change to be fixed
26
- * @param logger logger instance
27
- */
28
- function tryFixChange(change, logger) {
29
- try {
30
- const prefix = change.reference.replace(/\./g, '/');
31
- change.moduleName = `${prefix}/changes/${moduleNameContentMap[change.changeType](change)}`;
32
- }
33
- catch (error) {
34
- logger.warn('Could not fix missing module name.');
35
- }
36
- }
37
15
  /**
38
16
  * Read changes from the file system and return them.
39
17
  *
@@ -48,9 +26,6 @@ function readChanges(project, logger) {
48
26
  for (const file of files) {
49
27
  try {
50
28
  const change = JSON.parse(yield file.getString());
51
- if (moduleNameContentMap[change.changeType] && !change.moduleName) {
52
- tryFixChange(change, logger);
53
- }
54
29
  changes[`sap.ui.fl.${(0, path_1.parse)(file.getName()).name}`] = change;
55
30
  logger.debug(`Read change from ${file.getPath()}`);
56
31
  }
@@ -69,20 +44,17 @@ exports.readChanges = readChanges;
69
44
  * @param data.fileName file name that is required for a valid change
70
45
  * @param data.fileType file type that is required
71
46
  * @param webappPath path to the webapp folder
47
+ * @param fs mem-fs editor
72
48
  * @param logger logger instance
73
49
  * @returns object with success flag and optional message
74
50
  */
75
- function writeChange(data, webappPath, logger) {
51
+ function writeChange(data, webappPath, fs, logger) {
76
52
  const fileName = data.fileName;
77
53
  const fileType = data.fileType;
78
54
  if (fileName && fileType) {
79
55
  logger.debug(`Write change ${fileName}.${fileType}`);
80
- const path = (0, path_1.join)(webappPath, 'changes');
81
- if (!(0, fs_1.existsSync)(path)) {
82
- (0, fs_1.mkdirSync)(path);
83
- }
84
- const filePath = (0, path_1.join)(path, fileName + '.' + fileType);
85
- (0, fs_1.writeFileSync)(filePath, JSON.stringify(data, null, 2));
56
+ const filePath = (0, path_1.join)(webappPath, 'changes', fileName + '.' + fileType);
57
+ fs.writeJSON(filePath, data);
86
58
  const message = `FILE_CREATED ${fileName}.${fileType}`;
87
59
  return { success: true, message };
88
60
  }
@@ -1,11 +1,12 @@
1
1
  /// <reference path="../../../../types/ui5.d.ts" />
2
2
  import type { ReaderCollection } from '@ui5/fs';
3
+ import type { Editor as MemFsEditor } from 'mem-fs-editor';
3
4
  import type { Router } from 'express';
4
- import type { App, FlpConfig, MiddlewareConfig, RtaConfig, TestConfig } from '../types';
5
5
  import type { Logger, ToolsLogger } from '@sap-ux/logger';
6
6
  import type { MiddlewareUtils } from '@ui5/server';
7
7
  import type { Manifest, UI5FlexLayer } from '@sap-ux/project-access';
8
- import { type AdpPreviewConfig } from '@sap-ux/adp-tooling';
8
+ import { type AdpPreviewConfig, type CommonChangeProperties, type OperationType } from '@sap-ux/adp-tooling';
9
+ import type { App, FlpConfig, MiddlewareConfig, RtaConfig, TestConfig } from '../types';
9
10
  /**
10
11
  * Enhanced request handler that exposes a list of endpoints for the cds-plugin-ui5.
11
12
  */
@@ -53,6 +54,7 @@ export interface TemplateConfig {
53
54
  };
54
55
  locateReuseLibsScript?: boolean;
55
56
  }
57
+ type OnChangeRequestHandler = (type: OperationType, change: CommonChangeProperties, fs: MemFsEditor, logger: Logger) => Promise<void>;
56
58
  /**
57
59
  * Class handling preview of a sandbox FLP.
58
60
  */
@@ -60,6 +62,7 @@ export declare class FlpSandbox {
60
62
  private readonly project;
61
63
  private readonly utils;
62
64
  private readonly logger;
65
+ protected onChangeRequest: OnChangeRequestHandler | undefined;
63
66
  protected templateConfig: TemplateConfig;
64
67
  readonly config: FlpConfig;
65
68
  readonly rta?: RtaConfig;
@@ -74,6 +77,12 @@ export declare class FlpSandbox {
74
77
  * @param logger logger instance
75
78
  */
76
79
  constructor(config: Partial<MiddlewareConfig>, project: ReaderCollection, utils: MiddlewareUtils, logger: Logger);
80
+ /**
81
+ * Registers a handler function to be called when a change request occurs.
82
+ *
83
+ * @param {OnChangeRequestHandler} handler - The function to be executed when a change request occurs.
84
+ */
85
+ addOnChangeRequestHandler(handler: OnChangeRequestHandler): void;
77
86
  /**
78
87
  * Initialize the FLP sandbox router.
79
88
  *
@@ -173,4 +182,5 @@ export declare class FlpSandbox {
173
182
  * @param logger logger instance
174
183
  */
175
184
  export declare function initAdp(rootProject: ReaderCollection, config: AdpPreviewConfig, flp: FlpSandbox, util: MiddlewareUtils, logger: ToolsLogger): Promise<void>;
185
+ export {};
176
186
  //# sourceMappingURL=flp.d.ts.map
package/dist/base/flp.js CHANGED
@@ -10,13 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.initAdp = exports.FlpSandbox = void 0;
13
+ const mem_fs_1 = require("mem-fs");
14
+ const mem_fs_editor_1 = require("mem-fs-editor");
13
15
  const ejs_1 = require("ejs");
14
16
  const fs_1 = require("fs");
15
17
  const path_1 = require("path");
16
18
  const express_1 = require("express");
17
- const flex_1 = require("./flex");
18
- const project_access_1 = require("@sap-ux/project-access");
19
19
  const adp_tooling_1 = require("@sap-ux/adp-tooling");
20
+ const project_access_1 = require("@sap-ux/project-access");
21
+ const flex_1 = require("./flex");
20
22
  const test_1 = require("./test");
21
23
  const DEVELOPER_MODE_CONFIG = new Map([
22
24
  // Run application in design time mode
@@ -114,6 +116,14 @@ class FlpSandbox {
114
116
  logger.debug(`Config: ${JSON.stringify({ flp: this.config, rta: this.rta, test: this.test })}`);
115
117
  this.router = (0, express_1.Router)();
116
118
  }
119
+ /**
120
+ * Registers a handler function to be called when a change request occurs.
121
+ *
122
+ * @param {OnChangeRequestHandler} handler - The function to be executed when a change request occurs.
123
+ */
124
+ addOnChangeRequestHandler(handler) {
125
+ this.onChangeRequest = handler;
126
+ }
117
127
  /**
118
128
  * Initialize the FLP sandbox router.
119
129
  *
@@ -321,16 +331,27 @@ class FlpSandbox {
321
331
  * Create required routes for flex.
322
332
  */
323
333
  createFlexHandler() {
334
+ const fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
324
335
  const api = `${PREVIEW_URL.api}/changes`;
325
336
  this.router.use(api, (0, express_1.json)());
326
337
  this.router.get(api, ((_req, res) => __awaiter(this, void 0, void 0, function* () {
327
- this.sendResponse(res, 'application/json', 200, JSON.stringify(yield (0, flex_1.readChanges)(this.project, this.logger)));
338
+ const changes = yield (0, flex_1.readChanges)(this.project, this.logger);
339
+ if (this.onChangeRequest) {
340
+ for (const change of Object.values(changes)) {
341
+ yield this.onChangeRequest('read', change, fs, this.logger);
342
+ }
343
+ }
344
+ res.status(200).contentType('application/json').send(changes);
328
345
  })));
329
346
  this.router.post(api, ((req, res) => __awaiter(this, void 0, void 0, function* () {
330
347
  try {
331
- const { success, message } = (0, flex_1.writeChange)(req.body, this.utils.getProject().getSourcePath(), this.logger);
348
+ const change = req.body;
349
+ if (this.onChangeRequest) {
350
+ yield this.onChangeRequest('write', change, fs, this.logger);
351
+ }
352
+ const { success, message } = (0, flex_1.writeChange)(change, this.utils.getProject().getSourcePath(), fs, this.logger);
332
353
  if (success) {
333
- this.sendResponse(res, 'text/plain', 200, message !== null && message !== void 0 ? message : '');
354
+ fs.commit(() => res.status(200).send(message));
334
355
  }
335
356
  else {
336
357
  this.sendResponse(res, 'text/plain', 400, 'INVALID_DATA');
@@ -565,6 +586,7 @@ function initAdp(rootProject, config, flp, util, logger) {
565
586
  const { name, manifest } = descriptor;
566
587
  yield flp.init(manifest, name, adp.resources);
567
588
  flp.router.use(adp.descriptor.url, adp.proxy.bind(adp));
589
+ flp.addOnChangeRequestHandler(adp.onChangeRequest.bind(adp));
568
590
  flp.router.use((0, express_1.json)());
569
591
  adp.addApis(flp.router);
570
592
  }
@@ -1,143 +1,143 @@
1
- "use strict";
2
-
3
- sap.ui.define([], function () {
4
- "use strict";
5
-
6
- var ApiEndpoints = /*#__PURE__*/function (ApiEndpoints) {
7
- ApiEndpoints["CHANGES"] = "/preview/api/changes";
8
- ApiEndpoints["FRAGMENT"] = "/adp/api/fragment";
9
- ApiEndpoints["CONTROLLER"] = "/adp/api/controller";
10
- ApiEndpoints["CODE_EXT"] = "/adp/api/code_ext";
11
- ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
12
- return ApiEndpoints;
13
- }(ApiEndpoints || {});
14
- var RequestMethod = /*#__PURE__*/function (RequestMethod) {
15
- RequestMethod["GET"] = "GET";
16
- RequestMethod["PUT"] = "PUT";
17
- RequestMethod["POST"] = "POST";
18
- RequestMethod["PATCH"] = "PATCH";
19
- RequestMethod["DELETE"] = "DELETE";
20
- return RequestMethod;
21
- }(RequestMethod || {});
22
- /**
23
- * Requests a given endpoint
24
- *
25
- * @param endpoint API Endpoint
26
- * @param method RequestMethod
27
- * @param data Data to be sent to the server
28
- * @returns Data from the server request
29
- */
30
- async function request(endpoint, method, data) {
31
- const config = {
32
- method,
33
- body: JSON.stringify(data),
34
- headers: {
35
- 'content-type': 'application/json'
36
- }
37
- };
38
- try {
39
- const response = await fetch(endpoint, config);
40
- if (!response.ok) {
41
- const errorData = await response.json();
42
- const message = errorData?.message ?? '';
43
- throw new Error(`Request failed, status: ${response.status}. ${message}`.trim());
44
- }
45
- switch (method) {
46
- case RequestMethod.GET:
47
- return response.json();
48
- case RequestMethod.POST:
49
- /**
50
- * Since POST usually creates something
51
- * and returns nothing (or a message) we just parse the text from res.send(msg)
52
- */
53
- return response.text();
54
- default:
55
- return response.json();
56
- }
57
- } catch (e) {
58
- throw new Error(e.message);
59
- }
60
- }
61
-
62
- /**
63
- * Retrieves all XML fragments from the project's workspace
64
- *
65
- * @returns Generic Promise<T>
66
- */
67
- async function getFragments() {
68
- return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
69
- }
70
-
71
- /**
72
- * Writes an XML fragment to the project's workspace
73
- *
74
- * @param data Data to be send to the server
75
- * @returns Generic Promise<T>
76
- */
77
- async function writeFragment(data) {
78
- return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
79
- }
80
-
81
- /**
82
- * Retrieves manifest.appdescr_variant from the project's workspace
83
- *
84
- * @returns Generic Promise<T>
85
- */
86
- async function getManifestAppdescr() {
87
- return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
88
- }
89
-
90
- /**
91
- * Retrieves all controller extensions from the project's workspace
92
- *
93
- * @returns Generic Promise<T>
94
- */
95
- async function readControllers() {
96
- return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
97
- }
98
-
99
- /**
100
- * Writes a Controller to the project's workspace
101
- *
102
- * @param data Data to be send to the server
103
- * @returns Generic Promise<T>
104
- */
105
- async function writeController(data) {
106
- return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
107
- }
108
-
109
- /**
110
- * Checks for existing controller in the project's workspace
111
- *
112
- * @param controllerName Name of the controller
113
- * @returns {CodeExtResponse} Returns path to existing controller if found
114
- */
115
- async function getExistingController(controllerName) {
116
- return request(`${ApiEndpoints.CODE_EXT}/${controllerName}`, RequestMethod.GET);
117
- }
118
-
119
- /**
120
- * Writes a change object to the project's workspace
121
- *
122
- * @param data Data to be send to the server
123
- * @returns Generic Promise<T>
124
- */
125
- async function writeChange(data) {
126
- return request(ApiEndpoints.CHANGES, RequestMethod.POST, data);
127
- }
128
- var __exports = {
129
- __esModule: true
130
- };
131
- __exports.ApiEndpoints = ApiEndpoints;
132
- __exports.RequestMethod = RequestMethod;
133
- __exports.request = request;
134
- __exports.getFragments = getFragments;
135
- __exports.writeFragment = writeFragment;
136
- __exports.getManifestAppdescr = getManifestAppdescr;
137
- __exports.readControllers = readControllers;
138
- __exports.writeController = writeController;
139
- __exports.getExistingController = getExistingController;
140
- __exports.writeChange = writeChange;
141
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ var ApiEndpoints = /*#__PURE__*/function (ApiEndpoints) {
7
+ ApiEndpoints["CHANGES"] = "/preview/api/changes";
8
+ ApiEndpoints["FRAGMENT"] = "/adp/api/fragment";
9
+ ApiEndpoints["CONTROLLER"] = "/adp/api/controller";
10
+ ApiEndpoints["CODE_EXT"] = "/adp/api/code_ext";
11
+ ApiEndpoints["MANIFEST_APP_DESCRIPTOR"] = "/manifest.appdescr_variant";
12
+ return ApiEndpoints;
13
+ }(ApiEndpoints || {});
14
+ var RequestMethod = /*#__PURE__*/function (RequestMethod) {
15
+ RequestMethod["GET"] = "GET";
16
+ RequestMethod["PUT"] = "PUT";
17
+ RequestMethod["POST"] = "POST";
18
+ RequestMethod["PATCH"] = "PATCH";
19
+ RequestMethod["DELETE"] = "DELETE";
20
+ return RequestMethod;
21
+ }(RequestMethod || {});
22
+ /**
23
+ * Requests a given endpoint
24
+ *
25
+ * @param endpoint API Endpoint
26
+ * @param method RequestMethod
27
+ * @param data Data to be sent to the server
28
+ * @returns Data from the server request
29
+ */
30
+ async function request(endpoint, method, data) {
31
+ const config = {
32
+ method,
33
+ body: JSON.stringify(data),
34
+ headers: {
35
+ 'content-type': 'application/json'
36
+ }
37
+ };
38
+ try {
39
+ const response = await fetch(endpoint, config);
40
+ if (!response.ok) {
41
+ const errorData = await response.json();
42
+ const message = errorData?.message ?? '';
43
+ throw new Error(`Request failed, status: ${response.status}. ${message}`.trim());
44
+ }
45
+ switch (method) {
46
+ case RequestMethod.GET:
47
+ return response.json();
48
+ case RequestMethod.POST:
49
+ /**
50
+ * Since POST usually creates something
51
+ * and returns nothing (or a message) we just parse the text from res.send(msg)
52
+ */
53
+ return response.text();
54
+ default:
55
+ return response.json();
56
+ }
57
+ } catch (e) {
58
+ throw new Error(e.message);
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Retrieves all XML fragments from the project's workspace
64
+ *
65
+ * @returns Generic Promise<T>
66
+ */
67
+ async function getFragments() {
68
+ return request(ApiEndpoints.FRAGMENT, RequestMethod.GET);
69
+ }
70
+
71
+ /**
72
+ * Writes an XML fragment to the project's workspace
73
+ *
74
+ * @param data Data to be send to the server
75
+ * @returns Generic Promise<T>
76
+ */
77
+ async function writeFragment(data) {
78
+ return request(ApiEndpoints.FRAGMENT, RequestMethod.POST, data);
79
+ }
80
+
81
+ /**
82
+ * Retrieves manifest.appdescr_variant from the project's workspace
83
+ *
84
+ * @returns Generic Promise<T>
85
+ */
86
+ async function getManifestAppdescr() {
87
+ return request(ApiEndpoints.MANIFEST_APP_DESCRIPTOR, RequestMethod.GET);
88
+ }
89
+
90
+ /**
91
+ * Retrieves all controller extensions from the project's workspace
92
+ *
93
+ * @returns Generic Promise<T>
94
+ */
95
+ async function readControllers() {
96
+ return request(ApiEndpoints.CONTROLLER, RequestMethod.GET);
97
+ }
98
+
99
+ /**
100
+ * Writes a Controller to the project's workspace
101
+ *
102
+ * @param data Data to be send to the server
103
+ * @returns Generic Promise<T>
104
+ */
105
+ async function writeController(data) {
106
+ return request(ApiEndpoints.CONTROLLER, RequestMethod.POST, data);
107
+ }
108
+
109
+ /**
110
+ * Checks for existing controller in the project's workspace
111
+ *
112
+ * @param controllerName Name of the controller
113
+ * @returns {CodeExtResponse} Returns path to existing controller if found
114
+ */
115
+ async function getExistingController(controllerName) {
116
+ return request(`${ApiEndpoints.CODE_EXT}/${controllerName}`, RequestMethod.GET);
117
+ }
118
+
119
+ /**
120
+ * Writes a change object to the project's workspace
121
+ *
122
+ * @param data Data to be send to the server
123
+ * @returns Generic Promise<T>
124
+ */
125
+ async function writeChange(data) {
126
+ return request(ApiEndpoints.CHANGES, RequestMethod.POST, data);
127
+ }
128
+ var __exports = {
129
+ __esModule: true
130
+ };
131
+ __exports.ApiEndpoints = ApiEndpoints;
132
+ __exports.RequestMethod = RequestMethod;
133
+ __exports.request = request;
134
+ __exports.getFragments = getFragments;
135
+ __exports.writeFragment = writeFragment;
136
+ __exports.getManifestAppdescr = getManifestAppdescr;
137
+ __exports.readControllers = readControllers;
138
+ __exports.writeController = writeController;
139
+ __exports.getExistingController = getExistingController;
140
+ __exports.writeChange = writeChange;
141
+ return __exports;
142
142
  });
143
143
  //# sourceMappingURL=api-handler.js.map
@@ -1,56 +1,56 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory"], function (MessageToast, CommandFactory) {
4
- "use strict";
5
-
6
- /**
7
- * Class responsible for handling rta calls
8
- */
9
- class CommandExecutor {
10
- /**
11
- *
12
- * @param rta Runtime Authoring
13
- */
14
- constructor(rta) {
15
- this.rta = rta;
16
- }
17
-
18
- /**
19
- * Generates command based on given values
20
- *
21
- * @param runtimeControl Managed object
22
- * @param commandName Command name
23
- * @param modifiedValue Modified value/s
24
- * @param designMetadata Design time metadata
25
- * @param flexSettings Additional flex settings
26
- */
27
- async getCommand(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings) {
28
- try {
29
- return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
30
- } catch (e) {
31
- const errorMsg = `Could not get command for '${commandName}'. ${e.message}`;
32
- MessageToast.show(errorMsg);
33
- throw new Error(errorMsg);
34
- }
35
- }
36
-
37
- /**
38
- * Pushed and executes the provided command
39
- *
40
- * @param command Command
41
- */
42
- async pushAndExecuteCommand(command) {
43
- try {
44
- /**
45
- * The change will have pending state and will only be saved to the workspace when the user clicks save icon
46
- */
47
- await this.rta.getCommandStack().pushAndExecute(command);
48
- } catch (e) {
49
- MessageToast.show(e.message);
50
- throw new Error(e.message);
51
- }
52
- }
53
- }
54
- return CommandExecutor;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/m/MessageToast", "sap/ui/rta/command/CommandFactory"], function (MessageToast, CommandFactory) {
4
+ "use strict";
5
+
6
+ /**
7
+ * Class responsible for handling rta calls
8
+ */
9
+ class CommandExecutor {
10
+ /**
11
+ *
12
+ * @param rta Runtime Authoring
13
+ */
14
+ constructor(rta) {
15
+ this.rta = rta;
16
+ }
17
+
18
+ /**
19
+ * Generates command based on given values
20
+ *
21
+ * @param runtimeControl Managed object
22
+ * @param commandName Command name
23
+ * @param modifiedValue Modified value/s
24
+ * @param designMetadata Design time metadata
25
+ * @param flexSettings Additional flex settings
26
+ */
27
+ async getCommand(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings) {
28
+ try {
29
+ return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
30
+ } catch (e) {
31
+ const errorMsg = `Could not get command for '${commandName}'. ${e.message}`;
32
+ MessageToast.show(errorMsg);
33
+ throw new Error(errorMsg);
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Pushed and executes the provided command
39
+ *
40
+ * @param command Command
41
+ */
42
+ async pushAndExecuteCommand(command) {
43
+ try {
44
+ /**
45
+ * The change will have pending state and will only be saved to the workspace when the user clicks save icon
46
+ */
47
+ await this.rta.getCommandStack().pushAndExecute(command);
48
+ } catch (e) {
49
+ MessageToast.show(e.message);
50
+ throw new Error(e.message);
51
+ }
52
+ }
53
+ }
54
+ return CommandExecutor;
55
55
  });
56
56
  //# sourceMappingURL=command-executor.js.map