@sap-ux/fe-fpm-writer 0.24.15 → 0.25.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.
@@ -21,7 +21,11 @@ const file_1 = require("../common/file");
21
21
  */
22
22
  function enhanceConfig(data, manifestPath, manifest) {
23
23
  // clone input
24
- const config = Object.assign(Object.assign({}, data), { target: Object.assign({}, data.target), settings: Object.assign({}, data.settings) });
24
+ const config = {
25
+ ...data,
26
+ target: { ...data.target },
27
+ settings: { ...data.settings }
28
+ };
25
29
  (0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
26
30
  // set default values for visibility and enabled
27
31
  config.settings.enabled = config.settings.enabled || true;
@@ -52,7 +56,8 @@ function enhanceManifestAndGetActionsElementReference(manifest, target) {
52
56
  // In: 'options/settings/content/body/sections/<customSection>/actions'
53
57
  page.options.settings.content = page.options.settings.content || {};
54
58
  page.options.settings.content[target.control] = page.options.settings.content[target.control] || {};
55
- page.options.settings.content[target.control].sections = page.options.settings.content[target.control].sections || {};
59
+ page.options.settings.content[target.control].sections =
60
+ page.options.settings.content[target.control].sections || {};
56
61
  page.options.settings.content[target.control].sections[target.customSectionKey] =
57
62
  page.options.settings.content[target.control].sections[target.customSectionKey] || {};
58
63
  page.options.settings.content[target.control].sections[target.customSectionKey].actions =
package/dist/app/index.js CHANGED
@@ -18,7 +18,6 @@ exports.MIN_VERSION = '1.94.0';
18
18
  * @returns {Promise<Editor>} the updated mem-fs editor instance
19
19
  */
20
20
  function enableFPM(basePath, config = {}, fs) {
21
- var _a, _b, _c, _d, _e, _f;
22
21
  if (!fs) {
23
22
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
24
23
  }
@@ -28,7 +27,7 @@ function enableFPM(basePath, config = {}, fs) {
28
27
  }
29
28
  const manifest = fs.readJSON(manifestPath);
30
29
  // add FE libs is not yet added
31
- if (!((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.libs) === null || _c === void 0 ? void 0 : _c['sap.fe.templates'])) {
30
+ if (!manifest['sap.ui5']?.dependencies?.libs?.['sap.fe.templates']) {
32
31
  fs.extendJSON(manifestPath, {
33
32
  'sap.ui5': {
34
33
  dependencies: {
@@ -40,7 +39,7 @@ function enableFPM(basePath, config = {}, fs) {
40
39
  });
41
40
  }
42
41
  // if a minUI5Version is set and it is smaller than the minimum required, increase it
43
- const minUI5Version = (_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.dependencies) === null || _e === void 0 ? void 0 : _e.minUI5Version;
42
+ const minUI5Version = manifest['sap.ui5']?.dependencies?.minUI5Version;
44
43
  if (minUI5Version && (0, semver_1.valid)(minUI5Version) && (0, semver_1.lt)(minUI5Version, exports.MIN_VERSION)) {
45
44
  fs.extendJSON(manifestPath, {
46
45
  'sap.ui5': {
@@ -52,7 +51,7 @@ function enableFPM(basePath, config = {}, fs) {
52
51
  }
53
52
  // add type extensions if required
54
53
  if (config.typescript) {
55
- (0, utils_1.addExtensionTypes)(basePath, (_f = manifest['sap.ui5']) === null || _f === void 0 ? void 0 : _f.dependencies.minUI5Version, fs);
54
+ (0, utils_1.addExtensionTypes)(basePath, manifest['sap.ui5']?.dependencies.minUI5Version, fs);
56
55
  }
57
56
  // enable FCL if requested
58
57
  if (config.fcl) {
@@ -41,7 +41,7 @@ exports.getManifestRoot = getManifestRoot;
41
41
  */
42
42
  function enhanceConfig(fs, data, manifestPath, manifest) {
43
43
  // clone input and set defaults
44
- const config = Object.assign({}, data);
44
+ const config = { ...data };
45
45
  (0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
46
46
  // Apply event handler
47
47
  if (config.eventHandler) {
@@ -66,7 +66,6 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
66
66
  * @param {Editor} [fs] - the mem-fs editor instance
67
67
  */
68
68
  function generateCustomColumn(basePath, customColumn, fs) {
69
- var _a;
70
69
  (0, validate_1.validateVersion)(customColumn.minUI5Version);
71
70
  if (!fs) {
72
71
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
@@ -85,7 +84,7 @@ function generateCustomColumn(basePath, customColumn, fs) {
85
84
  tabInfo: customColumn.tabInfo
86
85
  });
87
86
  // add fragment
88
- const viewPath = (0, path_1.join)(completeColumn.path, `${(_a = completeColumn.fragmentFile) !== null && _a !== void 0 ? _a : completeColumn.name}.fragment.xml`);
87
+ const viewPath = (0, path_1.join)(completeColumn.path, `${completeColumn.fragmentFile ?? completeColumn.name}.fragment.xml`);
89
88
  if (completeColumn.control || !fs.exists(viewPath)) {
90
89
  fs.copyTpl((0, templates_1.getTemplatePath)('common/Fragment.xml'), viewPath, completeColumn);
91
90
  }
@@ -79,8 +79,11 @@ function applyEventHandlerConfiguration(fs, config, eventHandler, eventHandlerOp
79
79
  const ext = typescript ? 'ts' : 'js';
80
80
  const controllerPath = (0, path_1.join)(config.path || '', `${fileName}${controllerSuffix ? '.controller' : ''}.${ext}`);
81
81
  if (!fs.exists(controllerPath)) {
82
- fs.copyTpl((0, templates_1.getTemplatePath)(`${templatePath}.${ext}`), controllerPath, Object.assign({ eventHandlerFnName,
83
- parameters }, config));
82
+ fs.copyTpl((0, templates_1.getTemplatePath)(`${templatePath}.${ext}`), controllerPath, {
83
+ eventHandlerFnName,
84
+ parameters,
85
+ ...config
86
+ });
84
87
  }
85
88
  else if (insertScript) {
86
89
  // Read current file content
@@ -65,8 +65,7 @@ exports.insertTextAtPosition = insertTextAtPosition;
65
65
  * @param fs - the memfs editor instance
66
66
  */
67
67
  function addExtensionTypes(basePath, minUI5Version, fs) {
68
- var _a;
69
- const version = (0, semver_1.minor)((_a = (0, semver_1.coerce)(minUI5Version)) !== null && _a !== void 0 ? _a : '1.108.0');
68
+ const version = (0, semver_1.minor)((0, semver_1.coerce)(minUI5Version) ?? '1.108.0');
70
69
  const path = (0, path_1.join)(basePath, '/webapp/ext/sap.fe.d.ts');
71
70
  if (version < 108 && version !== 102 && !fs.exists(path)) {
72
71
  fs.copyTpl((0, templates_1.getTemplatePath)('common/sap.fe.d.ts'), path, { version });
@@ -27,7 +27,6 @@ exports.validateVersion = validateVersion;
27
27
  * @returns true if the path is valid, otherwise, throws and error
28
28
  */
29
29
  function validateBasePath(basePath, fs) {
30
- var _a, _b;
31
30
  if (!fs) {
32
31
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
33
32
  }
@@ -37,9 +36,8 @@ function validateBasePath(basePath, fs) {
37
36
  }
38
37
  else {
39
38
  const manifest = fs.readJSON(manifestPath);
40
- const ui5Dependencies = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.libs;
41
- if (!(ui5Dependencies && (ui5Dependencies['sap.fe.core'] || ui5Dependencies['sap.fe.templates']))) {
42
- throw new Error('Dependencies sap.fe.core or sap.fe.templates are missing in the manifest.json. Fiori elements FPM requires the SAP FE libraries.');
39
+ if ((manifest['sap.ui5']?.dependencies?.libs?.['sap.fe.templates'] !== undefined) === false) {
40
+ throw new Error('Dependency sap.fe.templates is missing in the manifest.json. Fiori elements FPM requires the SAP FE libraries.');
43
41
  }
44
42
  }
45
43
  return true;
@@ -39,9 +39,8 @@ function appendUniqueEntryToArray(values, value) {
39
39
  * @returns {ManifestControllerExtension | undefined} Existing controller extension
40
40
  */
41
41
  function getExistingControllerExtension(manifest, extensionId) {
42
- var _a, _b, _c;
43
- const extensions = (_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.extends) === null || _b === void 0 ? void 0 : _b.extensions) === null || _c === void 0 ? void 0 : _c[UI5_CONTROLLER_EXTENSIONS];
44
- if (extensions === null || extensions === void 0 ? void 0 : extensions.hasOwnProperty(extensionId)) {
42
+ const extensions = manifest['sap.ui5']?.extends?.extensions?.[UI5_CONTROLLER_EXTENSIONS];
43
+ if (extensions?.hasOwnProperty(extensionId)) {
45
44
  return extensions[extensionId];
46
45
  }
47
46
  return undefined;
@@ -107,7 +106,9 @@ function resolvePageDataFromExtension(extensionName) {
107
106
  */
108
107
  function enhanceConfig(data, manifestPath, manifest) {
109
108
  // clone input
110
- const config = Object.assign({}, data);
109
+ const config = {
110
+ ...data
111
+ };
111
112
  // Apply default data
112
113
  (0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
113
114
  // Create `controllerName` with full path/namespace
@@ -19,14 +19,13 @@ const event_handler_1 = require("../common/event-handler");
19
19
  * @returns enhanced configuration
20
20
  */
21
21
  function enhanceConfig(data, manifestPath, manifest) {
22
- var _a, _b;
23
22
  // clone input
24
23
  const config = data;
25
24
  (0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
26
25
  // set default values for requirement, language, the fragment file name
27
- config.required = (_a = config.required) !== null && _a !== void 0 ? _a : false;
26
+ config.required = config.required ?? false;
28
27
  config.typescript = !!config.typescript;
29
- config.fragmentFile = (_b = config.fragmentFile) !== null && _b !== void 0 ? _b : config.name;
28
+ config.fragmentFile = config.fragmentFile ?? config.name;
30
29
  if (config.eventHandler === true) {
31
30
  config.eventHandler = {};
32
31
  }
@@ -78,16 +77,14 @@ exports.generateCustomFilter = generateCustomFilter;
78
77
  * @returns Filters object of the first page
79
78
  */
80
79
  function enhanceManifestAndGetFiltersReference(manifest) {
81
- var _a, _b;
82
- var _c, _d, _e, _f;
83
- if ((_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.targets) {
80
+ if (manifest['sap.ui5']?.routing?.targets) {
84
81
  const pages = manifest['sap.ui5'].routing.targets;
85
82
  const lrPage = Object.values(pages)[0];
86
- lrPage.options || (lrPage.options = {});
87
- (_c = lrPage.options).settings || (_c.settings = {});
88
- (_d = lrPage.options.settings).controlConfiguration || (_d.controlConfiguration = {});
89
- (_e = lrPage.options.settings.controlConfiguration)['@com.sap.vocabularies.UI.v1.SelectionFields'] || (_e['@com.sap.vocabularies.UI.v1.SelectionFields'] = {});
90
- (_f = lrPage.options.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.SelectionFields']).filterFields || (_f.filterFields = {});
83
+ lrPage.options ||= {};
84
+ lrPage.options.settings ||= {};
85
+ lrPage.options.settings.controlConfiguration ||= {};
86
+ lrPage.options.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.SelectionFields'] ||= {};
87
+ lrPage.options.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.SelectionFields'].filterFields ||= {};
91
88
  return lrPage.options.settings.controlConfiguration['@com.sap.vocabularies.UI.v1.SelectionFields'].filterFields;
92
89
  }
93
90
  return {};
@@ -23,11 +23,10 @@ exports.PATTERN_SUFFIX = ':?query:';
23
23
  * @returns the generated pattern as string
24
24
  */
25
25
  function generateRoutePattern(routes, targetEntity, nav) {
26
- var _a;
27
26
  const parts = [];
28
- if ((nav === null || nav === void 0 ? void 0 : nav.sourcePage) && nav.navEntity) {
27
+ if (nav?.sourcePage && nav.navEntity) {
29
28
  const sourceRoute = routes.find((route) => route.name === nav.sourcePage);
30
- if (sourceRoute === null || sourceRoute === void 0 ? void 0 : sourceRoute.pattern) {
29
+ if (sourceRoute?.pattern) {
31
30
  const basePattern = sourceRoute.pattern.replace(exports.PATTERN_SUFFIX, '');
32
31
  if (basePattern) {
33
32
  parts.push(basePattern);
@@ -45,8 +44,8 @@ function generateRoutePattern(routes, targetEntity, nav) {
45
44
  else if (routes.length > 0) {
46
45
  parts.push(targetEntity);
47
46
  }
48
- if (nav === null || nav === void 0 ? void 0 : nav.navKey) {
49
- parts.push(`({${(_a = nav === null || nav === void 0 ? void 0 : nav.navEntity) !== null && _a !== void 0 ? _a : targetEntity}Key})`);
47
+ if (nav?.navKey) {
48
+ parts.push(`({${nav?.navEntity ?? targetEntity}Key})`);
50
49
  }
51
50
  parts.push(exports.PATTERN_SUFFIX);
52
51
  return parts.join('');
@@ -62,11 +61,10 @@ exports.generateRoutePattern = generateRoutePattern;
62
61
  * @returns the target property of a route
63
62
  */
64
63
  function generateRouteTarget(routes, name, fcl, nav) {
65
- var _a;
66
- if (nav === null || nav === void 0 ? void 0 : nav.sourcePage) {
64
+ if (nav?.sourcePage) {
67
65
  const sourceRoute = routes.find((route) => route.name === nav.sourcePage);
68
66
  // FCL only supports 3 columns, therefore, show the page in fullscreen if it is the 4th level of navigation
69
- if (fcl && ((_a = sourceRoute === null || sourceRoute === void 0 ? void 0 : sourceRoute.target) === null || _a === void 0 ? void 0 : _a.constructor) === Array && sourceRoute.target.length < 3) {
67
+ if (fcl && sourceRoute?.target?.constructor === Array && sourceRoute.target.length < 3) {
70
68
  return [...sourceRoute.target, name];
71
69
  }
72
70
  }
@@ -81,17 +79,16 @@ exports.generateRouteTarget = generateRouteTarget;
81
79
  */
82
80
  function getManifestJsonExtensionHelper(config) {
83
81
  return (key, value) => {
84
- var _a, _b, _c;
85
82
  switch (key) {
86
83
  case 'routing':
87
- value.routes = (_a = value.routes) !== null && _a !== void 0 ? _a : [];
84
+ value.routes = value.routes ?? [];
88
85
  break;
89
86
  case 'routes':
90
87
  const routes = value;
91
88
  routes.push({
92
- name: (_b = config.id) !== null && _b !== void 0 ? _b : `${config.entity}${config.name}`,
89
+ name: config.id ?? `${config.entity}${config.name}`,
93
90
  pattern: generateRoutePattern(routes, config.entity, config.navigation),
94
- target: generateRouteTarget(routes, (_c = config.id) !== null && _c !== void 0 ? _c : `${config.entity}${config.name}`, config.fcl, config.navigation)
91
+ target: generateRouteTarget(routes, config.id ?? `${config.entity}${config.name}`, config.fcl, config.navigation)
95
92
  });
96
93
  break;
97
94
  default:
@@ -109,14 +106,13 @@ exports.getManifestJsonExtensionHelper = getManifestJsonExtensionHelper;
109
106
  * @returns fcl configuration
110
107
  */
111
108
  function getFclConfig(manifest, navigation) {
112
- var _a, _b, _c, _d, _e, _f;
113
109
  const config = {};
114
- if (((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.routerClass) === defaults_1.FCL_ROUTER) {
110
+ if (manifest['sap.ui5']?.routing?.config?.routerClass === defaults_1.FCL_ROUTER) {
115
111
  config.fcl = true;
116
112
  if (navigation) {
117
- const sourceRoute = (((_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.routing) === null || _e === void 0 ? void 0 : _e.routes) || []).find((route) => route.name === (navigation === null || navigation === void 0 ? void 0 : navigation.sourcePage));
113
+ const sourceRoute = (manifest['sap.ui5']?.routing?.routes || []).find((route) => route.name === navigation?.sourcePage);
118
114
  config.controlAggregation =
119
- ((_f = sourceRoute === null || sourceRoute === void 0 ? void 0 : sourceRoute.target) !== null && _f !== void 0 ? _f : []).length > 1 ? 'endColumnPages' : 'midColumnPages';
115
+ (sourceRoute?.target ?? []).length > 1 ? 'endColumnPages' : 'midColumnPages';
120
116
  }
121
117
  else {
122
118
  config.controlAggregation = 'beginColumnPages';
@@ -133,13 +129,12 @@ exports.getFclConfig = getFclConfig;
133
129
  * @returns version aware settings object
134
130
  */
135
131
  function initializeTargetSettings(data, addSettings) {
136
- var _a, _b;
137
- const settings = addSettings ? Object.assign({}, addSettings) : {};
138
- (_a = settings.navigation) !== null && _a !== void 0 ? _a : (settings.navigation = {});
132
+ const settings = addSettings ? { ...addSettings } : {};
133
+ settings.navigation ??= {};
139
134
  // starting with UI5 v1.94.0, contextPath is the preferred setting
140
135
  const minVersion = (0, semver_1.coerce)(data.minUI5Version);
141
136
  if (!minVersion || (0, semver_1.gte)(minVersion, '1.94.0')) {
142
- settings.contextPath = (_b = data.contextPath) !== null && _b !== void 0 ? _b : `/${data.entity}`;
137
+ settings.contextPath = data.contextPath ?? `/${data.entity}`;
143
138
  }
144
139
  else {
145
140
  settings.entitySet = data.entity;
@@ -157,25 +152,24 @@ exports.initializeTargetSettings = initializeTargetSettings;
157
152
  */
158
153
  function validatePageConfig(basePath, config, fs) {
159
154
  // common validators
160
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
161
155
  (0, validate_1.validateBasePath)(basePath, fs);
162
156
  // validate config against the manifest
163
- if ((_a = config.navigation) === null || _a === void 0 ? void 0 : _a.sourcePage) {
157
+ if (config.navigation?.sourcePage) {
164
158
  const manifest = fs.readJSON((0, path_1.join)(basePath, 'webapp/manifest.json'));
165
- if (!((_d = (_c = (_b = manifest['sap.ui5']) === null || _b === void 0 ? void 0 : _b.routing) === null || _c === void 0 ? void 0 : _c.targets) === null || _d === void 0 ? void 0 : _d[config.navigation.sourcePage])) {
159
+ if (!manifest['sap.ui5']?.routing?.targets?.[config.navigation.sourcePage]) {
166
160
  throw new Error(`Could not find navigation source ${config.navigation.sourcePage}!`);
167
161
  }
168
162
  const routes = {};
169
- if (((_g = (_f = (_e = manifest['sap.ui5']) === null || _e === void 0 ? void 0 : _e.routing) === null || _f === void 0 ? void 0 : _f.routes) === null || _g === void 0 ? void 0 : _g.constructor) === Array) {
163
+ if (manifest['sap.ui5']?.routing?.routes?.constructor === Array) {
170
164
  manifest['sap.ui5'].routing.routes.forEach((routeWithName) => {
171
165
  routes[routeWithName.name] = routeWithName;
172
166
  });
173
167
  }
174
168
  else {
175
- Object.assign(routes, (_k = (_j = (_h = manifest['sap.ui5']) === null || _h === void 0 ? void 0 : _h.routing) === null || _j === void 0 ? void 0 : _j.routes) !== null && _k !== void 0 ? _k : {});
169
+ Object.assign(routes, manifest['sap.ui5']?.routing?.routes ?? {});
176
170
  }
177
171
  const route = routes[config.navigation.sourcePage];
178
- if (!(route === null || route === void 0 ? void 0 : route.pattern) || !route.target) {
172
+ if (!route?.pattern || !route.target) {
179
173
  throw new Error(`Invalid routing configuration for navigation source ${config.navigation.sourcePage}!`);
180
174
  }
181
175
  }
@@ -62,7 +62,6 @@ exports.getTemplateRoot = getTemplateRoot;
62
62
  * @returns {Promise<Editor>} the updated memfs editor instance
63
63
  */
64
64
  function generate(basePath, data, fs) {
65
- var _a, _b, _c;
66
65
  if (!fs) {
67
66
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
68
67
  }
@@ -86,8 +85,8 @@ function generate(basePath, data, fs) {
86
85
  // i18n.properties
87
86
  const manifest = fs.readJSON(manifestPath);
88
87
  const defaultI18nPath = 'i18n/i18n.properties';
89
- const customI18nPath = (_c = (_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.models) === null || _b === void 0 ? void 0 : _b.i18n) === null || _c === void 0 ? void 0 : _c.uri;
90
- const i18nPath = (0, path_1.join)(basePath, 'webapp', customI18nPath !== null && customI18nPath !== void 0 ? customI18nPath : defaultI18nPath);
88
+ const customI18nPath = manifest?.['sap.ui5']?.models?.i18n?.uri;
89
+ const i18nPath = (0, path_1.join)(basePath, 'webapp', customI18nPath ?? defaultI18nPath);
91
90
  const i18TemplatePath = (0, path_1.join)(root, 'i18n', 'i18n.properties');
92
91
  if (fs.exists(i18nPath)) {
93
92
  fs.append(i18nPath, (0, ejs_1.render)(fs.read(i18TemplatePath), config, {}));
package/dist/page/list.js CHANGED
@@ -10,18 +10,21 @@ const common_1 = require("./common");
10
10
  * @returns enhanced configuration
11
11
  */
12
12
  function enhanceData(data, manifest) {
13
- var _a, _b;
14
- var _c;
15
- const config = Object.assign(Object.assign(Object.assign({}, data), { settings: (0, common_1.initializeTargetSettings)(data, data.settings), name: 'ListReport' }), (0, common_1.getFclConfig)(manifest));
13
+ const config = {
14
+ ...data,
15
+ settings: (0, common_1.initializeTargetSettings)(data, data.settings),
16
+ name: 'ListReport',
17
+ ...(0, common_1.getFclConfig)(manifest)
18
+ };
16
19
  // use standard file name if i18n enhancement required
17
20
  if (config.settings.enhanceI18n === true) {
18
21
  config.settings.enhanceI18n = `i18n/custom${config.entity}${config.name}.properties`;
19
22
  }
20
23
  // move table settings into the correct structure
21
24
  if (config.settings.tableSettings) {
22
- (_a = (_c = config.settings).controlConfiguration) !== null && _a !== void 0 ? _a : (_c.controlConfiguration = {});
25
+ config.settings.controlConfiguration ??= {};
23
26
  const controlConfig = config.settings.controlConfiguration;
24
- (_b = controlConfig['@com.sap.vocabularies.UI.v1.LineItem']) !== null && _b !== void 0 ? _b : (controlConfig['@com.sap.vocabularies.UI.v1.LineItem'] = {});
27
+ controlConfig['@com.sap.vocabularies.UI.v1.LineItem'] ??= {};
25
28
  controlConfig['@com.sap.vocabularies.UI.v1.LineItem'].tableSettings = config.settings.tableSettings;
26
29
  delete config.settings.tableSettings;
27
30
  }
@@ -10,7 +10,12 @@ const common_1 = require("./common");
10
10
  * @returns enhanced configuration
11
11
  */
12
12
  function enhanceData(data, manifest) {
13
- const config = Object.assign(Object.assign(Object.assign({}, data), { settings: (0, common_1.initializeTargetSettings)(data, data.settings), name: 'ObjectPage' }), (0, common_1.getFclConfig)(manifest));
13
+ const config = {
14
+ ...data,
15
+ settings: (0, common_1.initializeTargetSettings)(data, data.settings),
16
+ name: 'ObjectPage',
17
+ ...(0, common_1.getFclConfig)(manifest)
18
+ };
14
19
  // use standard file name if i18n enhancement required
15
20
  if (config.settings.enhanceI18n === true) {
16
21
  config.settings.enhanceI18n = `i18n/custom${config.entity}${config.name}.properties`;
@@ -48,7 +48,7 @@ function getAdditionalDependencies(ui5Version) {
48
48
  * @returns enhanced configuration
49
49
  */
50
50
  function enhanceConfig(fs, data, manifestPath, manifest) {
51
- const config = Object.assign({}, data);
51
+ const config = { ...data };
52
52
  (0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
53
53
  // Apply event handler
54
54
  if (config.eventHandler) {
@@ -78,7 +78,6 @@ function enhanceConfig(fs, data, manifestPath, manifest) {
78
78
  * @returns {Promise<Editor>} the updated mem-fs editor instance
79
79
  */
80
80
  function generate(basePath, customSection, manifestTemplateRoot, fs) {
81
- var _a;
82
81
  (0, validate_1.validateVersion)(customSection.minUI5Version);
83
82
  if (!fs) {
84
83
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
@@ -96,7 +95,7 @@ function generate(basePath, customSection, manifestTemplateRoot, fs) {
96
95
  tabInfo: customSection.tabInfo
97
96
  });
98
97
  // add fragment
99
- const viewPath = (0, path_1.join)(completeSection.path, `${(_a = completeSection.fragmentFile) !== null && _a !== void 0 ? _a : completeSection.name}.fragment.xml`);
98
+ const viewPath = (0, path_1.join)(completeSection.path, `${completeSection.fragmentFile ?? completeSection.name}.fragment.xml`);
100
99
  if (!fs.exists(viewPath)) {
101
100
  fs.copyTpl((0, templates_1.getTemplatePath)('common/FragmentWithVBox.xml'), viewPath, completeSection);
102
101
  }
@@ -17,7 +17,6 @@ const templates_1 = require("../templates");
17
17
  * @param {Manifest} manifest - the application manifest
18
18
  */
19
19
  function mergeViews(config, manifest) {
20
- var _a, _b, _c, _d, _e;
21
20
  const newViews = {
22
21
  paths: [
23
22
  {
@@ -27,8 +26,8 @@ function mergeViews(config, manifest) {
27
26
  }
28
27
  ]
29
28
  };
30
- const existingViews = (_e = (_d = ((_c = (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.routing) === null || _b === void 0 ? void 0 : _b.targets) === null || _c === void 0 ? void 0 : _c[config.target]).options) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.views;
31
- if (existingViews === null || existingViews === void 0 ? void 0 : existingViews.paths) {
29
+ const existingViews = (manifest['sap.ui5']?.routing?.targets?.[config.target]).options?.settings?.views;
30
+ if (existingViews?.paths) {
32
31
  const index = existingViews.paths.findIndex((entry) => entry.key === newViews.paths[0].key);
33
32
  if (index > -1) {
34
33
  existingViews.paths[index] = newViews.paths[0];
@@ -52,7 +51,7 @@ function mergeViews(config, manifest) {
52
51
  * @returns enhanced configuration
53
52
  */
54
53
  function enhanceConfig(fs, data, manifestPath, manifest) {
55
- const config = Object.assign({}, data);
54
+ const config = { ...data };
56
55
  (0, defaults_1.setCommonDefaults)(config, manifestPath, manifest);
57
56
  // apply event handler
58
57
  if (config.eventHandler) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.24.15",
4
+ "version": "0.25.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -33,7 +33,7 @@
33
33
  "@types/mem-fs": "1.1.2",
34
34
  "@types/mem-fs-editor": "7.0.1",
35
35
  "@types/semver": "7.5.2",
36
- "@sap-ux/project-access": "1.21.2"
36
+ "@sap-ux/project-access": "1.23.0"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.x"