@sap-ux/odata-service-writer 0.17.2 → 0.19.0

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/index.js CHANGED
@@ -116,7 +116,7 @@ function generate(basePath, service, fs) {
116
116
  if (service.metadata) {
117
117
  // copy existing `ui5.yaml` as starting point for ui5-mock.yaml
118
118
  if (paths.ui5Yaml && ui5Config) {
119
- const webappPath = yield (0, project_access_1.getWebappPath)(basePath);
119
+ const webappPath = yield (0, project_access_1.getWebappPath)(basePath, fs);
120
120
  const config = {
121
121
  webappPath: webappPath,
122
122
  ui5MockYamlConfig: { path: service.path }
package/dist/updates.js CHANGED
@@ -17,7 +17,7 @@ const semver_1 = __importDefault(require("semver"));
17
17
  * @param templateRoot - root folder contain the ejs templates
18
18
  */
19
19
  function updateManifest(basePath, service, fs, templateRoot) {
20
- var _a;
20
+ var _a, _b, _c;
21
21
  // manifest.json
22
22
  const manifestPath = (0, path_1.join)(basePath, 'webapp', 'manifest.json');
23
23
  // Get component app id
@@ -29,11 +29,26 @@ function updateManifest(basePath, service, fs, templateRoot) {
29
29
  throw new Error((0, i18n_1.t)('error.requiredProjectPropertyNotFound', { property: `'${appProp}'.id`, path: manifestPath }));
30
30
  }
31
31
  const manifestJsonExt = fs.read((0, path_1.join)(templateRoot, 'extend', `manifest.json`));
32
+ const minUI5Version = (_c = (_b = manifest['sap.ui5']) === null || _b === void 0 ? void 0 : _b.dependencies) === null || _c === void 0 ? void 0 : _c.minUI5Version;
33
+ const manifestSettings = Object.assign(service, getModelSettings(minUI5Version));
32
34
  // If the service object includes ejs options, for example 'client' (see: https://ejs.co/#docs),
33
35
  // resulting in unexpected behaviour and problems when webpacking. Passing an empty options object prevents this.
34
- fs.extendJSON(manifestPath, JSON.parse((0, ejs_1.render)(manifestJsonExt, service, {})));
36
+ fs.extendJSON(manifestPath, JSON.parse((0, ejs_1.render)(manifestJsonExt, manifestSettings, {})));
35
37
  }
36
38
  exports.updateManifest = updateManifest;
39
+ /**
40
+ * Determines model settings based on the UI5 version.
41
+ *
42
+ * @param minUI5Version - The minimum UI5 version.
43
+ * @returns updated model settings.
44
+ */
45
+ function getModelSettings(minUI5Version) {
46
+ let includeSynchronizationMode = false;
47
+ if (minUI5Version && semver_1.default.valid(minUI5Version)) {
48
+ includeSynchronizationMode = semver_1.default.satisfies(minUI5Version, '<=1.110');
49
+ }
50
+ return { includeSynchronizationMode };
51
+ }
37
52
  /**
38
53
  * Update the package.json with the required middlewares.
39
54
  *
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%3Aodata-service-writer"
11
11
  },
12
- "version": "0.17.2",
12
+ "version": "0.19.0",
13
13
  "license": "Apache-2.0",
14
14
  "main": "dist/index.js",
15
15
  "files": [
@@ -36,7 +36,9 @@
36
36
  "dataSource": "<%=name%>",
37
37
  "preload": true,
38
38
  "settings": {<%if (version === '4') {%>
39
+ <% if (locals.includeSynchronizationMode) { %>
39
40
  "synchronizationMode": "None",
41
+ <% } %>
40
42
  "operationMode": "Server",
41
43
  "autoExpandSelect": true,
42
44
  "earlyRequests": true<% } %>