@sap-ux/adp-tooling 0.18.1 → 0.18.2

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/types.d.ts CHANGED
@@ -77,7 +77,6 @@ export interface AdpWriterConfig {
77
77
  name?: string;
78
78
  description?: string;
79
79
  };
80
- flp?: FlpConfig;
81
80
  customConfig?: CustomConfig;
82
81
  /**
83
82
  * Optional: configuration for deployment to ABAP
@@ -195,7 +194,6 @@ export interface InternalInboundNavigation extends NewInboundNavigation {
195
194
  /** Identifier for the inbound navigation. */
196
195
  inboundId: string;
197
196
  }
198
- export type FlpConfig = ChangeInboundNavigation | NewInboundNavigation;
199
197
  export interface Language {
200
198
  sap: string;
201
199
  i18n: string;
@@ -5,11 +5,11 @@ import type { InternalInboundNavigation, DescriptorVariantContent } from '../typ
5
5
  * Generates and writes the inbound configuration to the manifest.appdescr_variant file.
6
6
  *
7
7
  * @param basePath - The base path of the project.
8
- * @param config - The inbound configuration properties.
8
+ * @param configs - The inbound configuration properties.
9
9
  * @param fs - Optional mem-fs editor instance.
10
10
  * @returns The mem-fs editor instance.
11
11
  */
12
- export declare function generateInboundConfig(basePath: string, config: InternalInboundNavigation, fs?: Editor): Promise<Editor>;
12
+ export declare function generateInboundConfig(basePath: string, configs: InternalInboundNavigation[], fs?: Editor): Promise<Editor>;
13
13
  /**
14
14
  * Generates i18n entries for FLP configuration based on the provided configuration and application ID.
15
15
  *
@@ -23,11 +23,11 @@ export declare function getFlpI18nKeys(config: InternalInboundNavigation, appId:
23
23
  *
24
24
  * @param {string} basePath - The base path of the project.
25
25
  * @param {string} appId - The application ID used to generate i18n keys.
26
- * @param {InternalInboundNavigation} config - The inbound configuration properties.
26
+ * @param {InternalInboundNavigation[]} configs - The inbound configuration properties.
27
27
  * @param {Editor} fs - The mem-fs editor instance for file operations.
28
28
  * @returns {Promise<void>} A promise that resolves when the i18n file is updated.
29
29
  */
30
- export declare function updateI18n(basePath: string, appId: string, config: InternalInboundNavigation, fs: Editor): Promise<void>;
30
+ export declare function updateI18n(basePath: string, appId: string, configs: InternalInboundNavigation[], fs: Editor): Promise<void>;
31
31
  /**
32
32
  * Removes elements with changeType 'appdescr_app_addNewInbound', 'appdescr_app_removeAllInboundsExceptOne' and 'appdescr_app_changeInbound' from the given array.
33
33
  *
@@ -17,22 +17,25 @@ const options_1 = require("./options");
17
17
  * Generates and writes the inbound configuration to the manifest.appdescr_variant file.
18
18
  *
19
19
  * @param basePath - The base path of the project.
20
- * @param config - The inbound configuration properties.
20
+ * @param configs - The inbound configuration properties.
21
21
  * @param fs - Optional mem-fs editor instance.
22
22
  * @returns The mem-fs editor instance.
23
23
  */
24
- async function generateInboundConfig(basePath, config, fs) {
24
+ async function generateInboundConfig(basePath, configs, fs) {
25
25
  if (!fs) {
26
26
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
27
27
  }
28
28
  const variant = await (0, __1.getVariant)(basePath, fs);
29
29
  variant.content = removeInboundChangeTypes(variant.content);
30
- if (!config?.inboundId) {
31
- config.inboundId = `${variant.id}.InboundID`;
30
+ // Set default inbound IDs if missing
31
+ for (const config of configs) {
32
+ if (!config?.inboundId) {
33
+ config.inboundId = `${variant.id}.InboundID`;
34
+ }
32
35
  }
33
- (0, options_1.enhanceManifestChangeContentWithFlpConfig)(config, variant.id, variant.content);
36
+ (0, options_1.enhanceManifestChangeContentWithFlpConfig)(configs, variant.id, variant.content);
34
37
  await (0, __1.updateVariant)(basePath, variant, fs);
35
- await updateI18n(basePath, variant.id, config, fs);
38
+ await updateI18n(basePath, variant.id, configs, fs);
36
39
  return fs;
37
40
  }
38
41
  /**
@@ -64,12 +67,15 @@ function getFlpI18nKeys(config, appId) {
64
67
  *
65
68
  * @param {string} basePath - The base path of the project.
66
69
  * @param {string} appId - The application ID used to generate i18n keys.
67
- * @param {InternalInboundNavigation} config - The inbound configuration properties.
70
+ * @param {InternalInboundNavigation[]} configs - The inbound configuration properties.
68
71
  * @param {Editor} fs - The mem-fs editor instance for file operations.
69
72
  * @returns {Promise<void>} A promise that resolves when the i18n file is updated.
70
73
  */
71
- async function updateI18n(basePath, appId, config, fs) {
72
- const newEntries = getFlpI18nKeys(config, appId);
74
+ async function updateI18n(basePath, appId, configs, fs) {
75
+ let newEntries = [];
76
+ for (const config of configs) {
77
+ newEntries = newEntries.concat(getFlpI18nKeys(config, appId));
78
+ }
73
79
  const i18nPath = node_path_1.default.join(basePath, 'webapp', 'i18n', 'i18n.properties');
74
80
  const keysToRemove = [`${appId}_sap.app.crossNavigation.inbounds`];
75
81
  await (0, i18n_1.removeAndCreateI18nEntries)(i18nPath, newEntries, keysToRemove, basePath, fs);
@@ -6,7 +6,6 @@ const node_path_1 = require("node:path");
6
6
  const mem_fs_1 = require("mem-fs");
7
7
  const mem_fs_editor_1 = require("mem-fs-editor");
8
8
  const manifest_1 = require("./manifest");
9
- const options_1 = require("./options");
10
9
  const i18n_1 = require("./i18n");
11
10
  const project_utils_1 = require("./project-utils");
12
11
  const source_1 = require("../source");
@@ -24,7 +23,6 @@ function setDefaults(config) {
24
23
  ui5: { ...config.ui5 },
25
24
  deploy: config.deploy ? { ...config.deploy } : undefined,
26
25
  options: { ...config.options },
27
- flp: config.flp ? { ...config.flp } : undefined,
28
26
  customConfig: config.customConfig ? { ...config.customConfig } : undefined
29
27
  };
30
28
  configWithDefaults.app.title ??= `Adaptation of ${config.app.reference}`;
@@ -36,12 +34,6 @@ function setDefaults(config) {
36
34
  configWithDefaults.app.i18nDescription ??= (0, i18n_1.getI18nDescription)(configWithDefaults.app.layer, configWithDefaults.app.title);
37
35
  configWithDefaults.app.appType ??= (0, source_1.getApplicationType)(configWithDefaults.app.manifest);
38
36
  configWithDefaults.app.content ??= (0, manifest_1.getManifestContent)(configWithDefaults);
39
- if (configWithDefaults.flp && !configWithDefaults.flp.inboundId) {
40
- configWithDefaults.flp.inboundId = `${configWithDefaults.app.id}.InboundID`;
41
- }
42
- if (configWithDefaults.customConfig?.adp.environment === 'C' && configWithDefaults.flp) {
43
- (0, options_1.enhanceManifestChangeContentWithFlpConfig)(configWithDefaults.flp, configWithDefaults.app.id, configWithDefaults.app.content);
44
- }
45
37
  return configWithDefaults;
46
38
  }
47
39
  /**
@@ -56,11 +56,11 @@ export declare function enhanceUI5DeployYaml(ui5Config: UI5Config, config: AdpWr
56
56
  /**
57
57
  * Generate Inbound change content required for manifest.appdescriptor.
58
58
  *
59
- * @param flpConfiguration FLP cloud project configuration
59
+ * @param flpConfigurations FLP cloud project configuration
60
60
  * @param appId Application variant id
61
61
  * @param manifestChangeContent Application variant change content
62
62
  */
63
- export declare function enhanceManifestChangeContentWithFlpConfig(flpConfiguration: InternalInboundNavigation, appId: string, manifestChangeContent?: Content[]): void;
63
+ export declare function enhanceManifestChangeContentWithFlpConfig(flpConfigurations: InternalInboundNavigation[], appId: string, manifestChangeContent?: Content[]): void;
64
64
  /**
65
65
  * Generate custom configuration required for the ui5.yaml.
66
66
  *
@@ -267,13 +267,13 @@ function getInboundChangeContentWithNewInboundID(flpConfiguration, appId) {
267
267
  /**
268
268
  * Generate Inbound change content required for manifest.appdescriptor.
269
269
  *
270
- * @param flpConfiguration FLP cloud project configuration
270
+ * @param flpConfigurations FLP cloud project configuration
271
271
  * @param appId Application variant id
272
272
  * @param manifestChangeContent Application variant change content
273
273
  */
274
- function enhanceManifestChangeContentWithFlpConfig(flpConfiguration, appId, manifestChangeContent = []) {
275
- const inboundChangeContent = getInboundChangeContentWithNewInboundID(flpConfiguration, appId);
276
- if (inboundChangeContent) {
274
+ function enhanceManifestChangeContentWithFlpConfig(flpConfigurations, appId, manifestChangeContent = []) {
275
+ for (const [index, flpConfig] of flpConfigurations.entries()) {
276
+ const inboundChangeContent = getInboundChangeContentWithNewInboundID(flpConfig, appId);
277
277
  const addInboundChange = {
278
278
  changeType: 'appdescr_app_addNewInbound',
279
279
  content: inboundChangeContent,
@@ -281,15 +281,19 @@ function enhanceManifestChangeContentWithFlpConfig(flpConfiguration, appId, mani
281
281
  'i18n': 'i18n/i18n.properties'
282
282
  }
283
283
  };
284
- const removeOtherInboundsChange = {
285
- changeType: 'appdescr_app_removeAllInboundsExceptOne',
286
- content: {
287
- 'inboundId': flpConfiguration.inboundId
288
- },
289
- texts: {}
290
- };
291
284
  manifestChangeContent.push(addInboundChange);
292
- manifestChangeContent.push(removeOtherInboundsChange);
285
+ // Remove all inbounds except one should be only after the first inbound is added
286
+ // This is implemented this way to avoid issues with the merged on ABAP side
287
+ if (index === 0) {
288
+ const removeOtherInboundsChange = {
289
+ changeType: 'appdescr_app_removeAllInboundsExceptOne',
290
+ content: {
291
+ 'inboundId': flpConfig.inboundId
292
+ },
293
+ texts: {}
294
+ };
295
+ manifestChangeContent.push(removeOtherInboundsChange);
296
+ }
293
297
  }
294
298
  }
295
299
  /**
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%3Aadp-tooling"
11
11
  },
12
- "version": "0.18.1",
12
+ "version": "0.18.2",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -4,9 +4,3 @@
4
4
 
5
5
  #XTIT: Application name
6
6
  <%- app.id %>_sap.app.title=<%- app.title %>
7
- <% if (customConfig?.adp.environment === "C" && flp) { %>
8
- # FLP Configuration
9
-
10
- <%= app.id %>_sap.app.crossNavigation.inbounds.<%= flp.inboundId %>.title=<%= flp.title %><% if (flp.subTitle) { %>
11
- <%= app.id %>_sap.app.crossNavigation.inbounds.<%= flp.inboundId %>.subTitle=<%= flp.subTitle %><% } %>
12
- <% } %>