@sap-ux/adp-tooling 0.14.28 → 0.14.30

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.
@@ -1,4 +1,5 @@
1
1
  import { type AbapServiceProvider } from '@sap-ux/axios-extension';
2
+ import type { ManifestNamespace } from '@sap-ux/project-access';
2
3
  import type { FlexUISupportedSystem } from '../types';
3
4
  /**
4
5
  * Fetches system supports Flex UI features.
@@ -15,4 +16,12 @@ export declare function getFlexUISupportedSystem(provider: AbapServiceProvider,
15
16
  * @returns {string | undefined} System UI5 version.
16
17
  */
17
18
  export declare function getSystemUI5Version(provider: AbapServiceProvider): Promise<string | undefined>;
19
+ /**
20
+ * Retrieves the list of tile inbounds of the application.
21
+ *
22
+ * @param {string} appId - The ID of the application for which to retrieve inbounds.
23
+ * @param {AbapServiceProvider} provider - Instance of the ABAP provider.
24
+ * @returns {Promise<ManifestNamespace.Inbound>} list of tile inbounds of the application.
25
+ */
26
+ export declare function getBaseAppInbounds(appId: string, provider: AbapServiceProvider): Promise<ManifestNamespace.Inbound | undefined>;
18
27
  //# sourceMappingURL=client.d.ts.map
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFlexUISupportedSystem = getFlexUISupportedSystem;
4
4
  exports.getSystemUI5Version = getSystemUI5Version;
5
+ exports.getBaseAppInbounds = getBaseAppInbounds;
5
6
  const axios_extension_1 = require("@sap-ux/axios-extension");
7
+ const helper_1 = require("../base/helper");
6
8
  const FILTER = {
7
9
  'scheme': 'http://www.sap.com/adt/categories/ui_flex',
8
10
  'term': 'dta_folder'
@@ -40,4 +42,19 @@ async function getSystemUI5Version(provider) {
40
42
  const service = await provider.getAdtService(axios_extension_1.UI5RtVersionService);
41
43
  return service?.getUI5Version();
42
44
  }
45
+ /**
46
+ * Retrieves the list of tile inbounds of the application.
47
+ *
48
+ * @param {string} appId - The ID of the application for which to retrieve inbounds.
49
+ * @param {AbapServiceProvider} provider - Instance of the ABAP provider.
50
+ * @returns {Promise<ManifestNamespace.Inbound>} list of tile inbounds of the application.
51
+ */
52
+ async function getBaseAppInbounds(appId, provider) {
53
+ const lrepService = provider.getLayeredRepository();
54
+ const inbounds = (await lrepService.getSystemInfo(undefined, undefined, appId)).inbounds;
55
+ if (!inbounds?.length) {
56
+ return undefined;
57
+ }
58
+ return (0, helper_1.filterAndMapInboundsToManifest)(inbounds);
59
+ }
43
60
  //# sourceMappingURL=client.js.map
@@ -1,4 +1,6 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
+ import { type ManifestNamespace } from '@sap-ux/project-access';
3
+ import type { Inbound } from '@sap-ux/axios-extension';
2
4
  import type { DescriptorVariant, AdpPreviewConfig } from '../types';
3
5
  /**
4
6
  * Get the app descriptor variant.
@@ -22,11 +24,10 @@ export declare function updateVariant(basePath: string, variant: DescriptorVaria
22
24
  * This function determines whether there are changes of type `appdescr_app_changeInbound`
23
25
  * or `appdescr_app_addNewInbound` present in the content of the descriptor variant.
24
26
  *
25
- * @param {string} basePath - The base path of the project where the manifest.appdescr_variant is located.
27
+ * @param {DescriptorVariant} variant - The descriptor variant object to check for FLP configuration changes.
26
28
  * @returns {Promise<boolean>} Returns `true` if FLP configuration changes exist, otherwise `false`.
27
- * @throws {Error} Throws an error if the variant could not be retrieved.
28
29
  */
29
- export declare function flpConfigurationExists(basePath: string): Promise<boolean>;
30
+ export declare function flpConfigurationExists(variant: DescriptorVariant): boolean;
30
31
  /**
31
32
  * Checks whether TypeScript is supported in the project by verifying the existence of `tsconfig.json`.
32
33
  *
@@ -53,4 +54,11 @@ export declare function getWebappFiles(basePath: string): Promise<{
53
54
  relativePath: string;
54
55
  content: string;
55
56
  }[]>;
57
+ /**
58
+ * Transforms an array of inbound objects from the SystemInfo API format into a ManifestNamespace.Inbound object.
59
+ *
60
+ * @param {Inbound[]} inbounds - The array of inbound objects to transform.
61
+ * @returns {ManifestNamespace.Inbound | undefined} The transformed inbounds or undefined if input is empty.
62
+ */
63
+ export declare function filterAndMapInboundsToManifest(inbounds: Inbound[]): ManifestNamespace.Inbound | undefined;
56
64
  //# sourceMappingURL=helper.d.ts.map
@@ -6,6 +6,7 @@ exports.flpConfigurationExists = flpConfigurationExists;
6
6
  exports.isTypescriptSupported = isTypescriptSupported;
7
7
  exports.getAdpConfig = getAdpConfig;
8
8
  exports.getWebappFiles = getWebappFiles;
9
+ exports.filterAndMapInboundsToManifest = filterAndMapInboundsToManifest;
9
10
  const fs_1 = require("fs");
10
11
  const path_1 = require("path");
11
12
  const project_access_1 = require("@sap-ux/project-access");
@@ -39,18 +40,11 @@ async function updateVariant(basePath, variant, fs) {
39
40
  * This function determines whether there are changes of type `appdescr_app_changeInbound`
40
41
  * or `appdescr_app_addNewInbound` present in the content of the descriptor variant.
41
42
  *
42
- * @param {string} basePath - The base path of the project where the manifest.appdescr_variant is located.
43
+ * @param {DescriptorVariant} variant - The descriptor variant object to check for FLP configuration changes.
43
44
  * @returns {Promise<boolean>} Returns `true` if FLP configuration changes exist, otherwise `false`.
44
- * @throws {Error} Throws an error if the variant could not be retrieved.
45
45
  */
46
- async function flpConfigurationExists(basePath) {
47
- try {
48
- const variant = await getVariant(basePath);
49
- return variant.content?.some(({ changeType }) => changeType === 'appdescr_app_changeInbound' || changeType === 'appdescr_app_addNewInbound');
50
- }
51
- catch (error) {
52
- throw new Error(`Failed to check if FLP configuration exists: ${error.message}`);
53
- }
46
+ function flpConfigurationExists(variant) {
47
+ return variant.content?.some(({ changeType }) => changeType === 'appdescr_app_changeInbound' || changeType === 'appdescr_app_addNewInbound');
54
48
  }
55
49
  /**
56
50
  * Checks whether TypeScript is supported in the project by verifying the existence of `tsconfig.json`.
@@ -114,4 +108,27 @@ async function getWebappFiles(basePath) {
114
108
  getFilesRecursivelySync(dir);
115
109
  return files;
116
110
  }
111
+ /**
112
+ * Transforms an array of inbound objects from the SystemInfo API format into a ManifestNamespace.Inbound object.
113
+ *
114
+ * @param {Inbound[]} inbounds - The array of inbound objects to transform.
115
+ * @returns {ManifestNamespace.Inbound | undefined} The transformed inbounds or undefined if input is empty.
116
+ */
117
+ function filterAndMapInboundsToManifest(inbounds) {
118
+ if (!inbounds || inbounds.length === 0) {
119
+ return undefined;
120
+ }
121
+ return inbounds.reduce((acc, inbound) => {
122
+ // Skip if hideLauncher is not false
123
+ if (!inbound?.content || inbound.content.hideLauncher !== false) {
124
+ return acc;
125
+ }
126
+ const { semanticObject, action } = inbound.content;
127
+ if (semanticObject && action) {
128
+ const key = `${semanticObject}-${action}`;
129
+ acc[key] = inbound.content;
130
+ }
131
+ return acc;
132
+ }, {});
133
+ }
117
134
  //# sourceMappingURL=helper.js.map
package/dist/types.d.ts CHANGED
@@ -182,12 +182,12 @@ export interface NewInboundNavigation {
182
182
  title: string;
183
183
  /** Optional: Subtitle associated with the inbound navigation. */
184
184
  subTitle?: string;
185
+ /** Icon associated with the inbound navigation. */
186
+ icon?: string;
185
187
  }
186
188
  export interface InternalInboundNavigation extends NewInboundNavigation {
187
189
  /** Identifier for the inbound navigation. */
188
190
  inboundId: string;
189
- /** Flag indicating if the new inbound navigation should be added. */
190
- addInboundId?: boolean;
191
191
  }
192
192
  export type FlpConfig = ChangeInboundNavigation | NewInboundNavigation;
193
193
  export interface Language {
@@ -664,6 +664,8 @@ export interface AddInboundModel {
664
664
  title: string;
665
665
  /** Optional: Subtitle associated with the inbound navigation data. */
666
666
  subTitle?: string;
667
+ /** Optional: Icon associated with the inbound navigation data. */
668
+ icon?: string;
667
669
  signature: AddInboundSignitureModel;
668
670
  }
669
671
  export interface AddInboundSignitureModel {
@@ -1,6 +1,6 @@
1
1
  import { type Editor } from 'mem-fs-editor';
2
2
  import { type NewI18nEntry } from '@sap-ux/i18n';
3
- import type { InternalInboundNavigation } from '../types';
3
+ import type { InternalInboundNavigation, DescriptorVariantContent } from '../types';
4
4
  /**
5
5
  * Generates and writes the inbound configuration to the manifest.appdescr_variant file.
6
6
  *
@@ -28,4 +28,11 @@ export declare function getFlpI18nKeys(config: InternalInboundNavigation, appId:
28
28
  * @returns {Promise<void>} A promise that resolves when the i18n file is updated.
29
29
  */
30
30
  export declare function updateI18n(basePath: string, appId: string, config: InternalInboundNavigation, fs: Editor): Promise<void>;
31
+ /**
32
+ * Removes elements with changeType 'appdescr_app_addNewInbound', 'appdescr_app_removeAllInboundsExceptOne' and 'appdescr_app_changeInbound' from the given array.
33
+ *
34
+ * @param content The array of manifest change objects.
35
+ * @returns A new array with the specified elements removed.
36
+ */
37
+ export declare function removeInboundChangeTypes(content: DescriptorVariantContent[]): DescriptorVariantContent[];
31
38
  //# sourceMappingURL=inbound-navigation.d.ts.map
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.generateInboundConfig = generateInboundConfig;
7
7
  exports.getFlpI18nKeys = getFlpI18nKeys;
8
8
  exports.updateI18n = updateI18n;
9
+ exports.removeInboundChangeTypes = removeInboundChangeTypes;
9
10
  const path_1 = __importDefault(require("path"));
10
11
  const mem_fs_1 = require("mem-fs");
11
12
  const mem_fs_editor_1 = require("mem-fs-editor");
@@ -25,8 +26,8 @@ async function generateInboundConfig(basePath, config, fs) {
25
26
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
26
27
  }
27
28
  const variant = await (0, __1.getVariant)(basePath, fs);
29
+ variant.content = removeInboundChangeTypes(variant.content);
28
30
  if (!config?.inboundId) {
29
- config.addInboundId = true;
30
31
  config.inboundId = `${variant.id}.InboundID`;
31
32
  }
32
33
  (0, options_1.enhanceManifestChangeContentWithFlpConfig)(config, variant.id, variant.content);
@@ -44,9 +45,17 @@ async function generateInboundConfig(basePath, config, fs) {
44
45
  function getFlpI18nKeys(config, appId) {
45
46
  const newEntries = [];
46
47
  const baseKey = `${appId}_sap.app.crossNavigation.inbounds.${config.inboundId}`;
47
- newEntries.push({ key: `${baseKey}.title`, value: config.title });
48
+ newEntries.push({
49
+ key: `${baseKey}.title`,
50
+ value: config.title,
51
+ annotation: { textType: i18n_1.SapShortTextType.TableTitle, note: 'Fiori Launchpad Tile Title' }
52
+ });
48
53
  if (config?.subTitle) {
49
- newEntries.push({ key: `${baseKey}.subTitle`, value: config.subTitle });
54
+ newEntries.push({
55
+ key: `${baseKey}.subTitle`,
56
+ value: config.subTitle,
57
+ annotation: { textType: i18n_1.SapShortTextType.TableTitle, note: 'Fiori Launchpad Tile Subtitle' }
58
+ });
50
59
  }
51
60
  return newEntries;
52
61
  }
@@ -62,6 +71,18 @@ function getFlpI18nKeys(config, appId) {
62
71
  async function updateI18n(basePath, appId, config, fs) {
63
72
  const newEntries = getFlpI18nKeys(config, appId);
64
73
  const i18nPath = path_1.default.join(basePath, 'webapp', 'i18n', 'i18n.properties');
65
- await (0, i18n_1.createPropertiesI18nEntries)(i18nPath, newEntries, basePath, fs);
74
+ const keysToRemove = [`${appId}_sap.app.crossNavigation.inbounds`];
75
+ await (0, i18n_1.removeAndCreateI18nEntries)(i18nPath, newEntries, keysToRemove, basePath, fs);
76
+ }
77
+ /**
78
+ * Removes elements with changeType 'appdescr_app_addNewInbound', 'appdescr_app_removeAllInboundsExceptOne' and 'appdescr_app_changeInbound' from the given array.
79
+ *
80
+ * @param content The array of manifest change objects.
81
+ * @returns A new array with the specified elements removed.
82
+ */
83
+ function removeInboundChangeTypes(content) {
84
+ return content.filter((item) => item.changeType !== 'appdescr_app_addNewInbound' &&
85
+ item.changeType !== 'appdescr_app_changeInbound' &&
86
+ item.changeType !== 'appdescr_app_removeAllInboundsExceptOne');
66
87
  }
67
88
  //# sourceMappingURL=inbound-navigation.js.map
@@ -37,7 +37,6 @@ function setDefaults(config) {
37
37
  configWithDefaults.app.appType ??= (0, source_1.getApplicationType)(configWithDefaults.app.manifest);
38
38
  configWithDefaults.app.content ??= (0, manifest_1.getManifestContent)(configWithDefaults);
39
39
  if (configWithDefaults.flp && !configWithDefaults.flp.inboundId) {
40
- configWithDefaults.flp.addInboundId = true;
41
40
  configWithDefaults.flp.inboundId = `${configWithDefaults.app.id}.InboundID`;
42
41
  }
43
42
  if (configWithDefaults.customConfig?.adp.environment === 'C' && configWithDefaults.flp) {
@@ -7,7 +7,6 @@ exports.enhanceUI5YamlWithTranspileMiddleware = enhanceUI5YamlWithTranspileMiddl
7
7
  exports.hasDeployConfig = hasDeployConfig;
8
8
  exports.enhanceUI5DeployYaml = enhanceUI5DeployYaml;
9
9
  exports.enhanceManifestChangeContentWithFlpConfig = enhanceManifestChangeContentWithFlpConfig;
10
- const common_1 = require("../common");
11
10
  const VSCODE_URL = 'https://REQUIRED_FOR_VSCODE.example';
12
11
  /**
13
12
  * Generate the configuration for the middlewares required for the ui5.yaml.
@@ -234,47 +233,6 @@ function getAdpCloudCustomTasks(config) {
234
233
  }
235
234
  ];
236
235
  }
237
- /**
238
- * Get a Inbound change content with provided inboundId.
239
- *
240
- * @param flpConfiguration FLP cloud project configuration
241
- * @param appId application id
242
- * @returns Inbound change content.
243
- */
244
- function getInboundChangeContentWithExistingInboundId(flpConfiguration, appId) {
245
- const inboundContent = {
246
- inboundId: flpConfiguration.inboundId,
247
- entityPropertyChange: [
248
- {
249
- propertyPath: 'title',
250
- operation: 'UPSERT',
251
- propertyValue: `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.title}}`
252
- }
253
- ]
254
- };
255
- if (flpConfiguration.subTitle) {
256
- inboundContent.entityPropertyChange.push({
257
- propertyPath: 'subTitle',
258
- operation: 'UPSERT',
259
- propertyValue: `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.subTitle}}`
260
- });
261
- }
262
- inboundContent.entityPropertyChange.push({
263
- propertyPath: 'signature/parameters/sap-appvar-id',
264
- operation: 'UPSERT',
265
- propertyValue: {
266
- required: true,
267
- filter: {
268
- value: appId,
269
- format: 'plain'
270
- },
271
- launcherValue: {
272
- value: appId
273
- }
274
- }
275
- });
276
- return inboundContent;
277
- }
278
236
  /**
279
237
  * Get a Inbound change content without provided inboundId.
280
238
  *
@@ -283,14 +241,13 @@ function getInboundChangeContentWithExistingInboundId(flpConfiguration, appId) {
283
241
  * @returns Inbound change content.
284
242
  */
285
243
  function getInboundChangeContentWithNewInboundID(flpConfiguration, appId) {
286
- const parameters = flpConfiguration?.additionalParameters
287
- ? (0, common_1.parseParameters)(flpConfiguration?.additionalParameters)
288
- : {};
244
+ const parameters = flpConfiguration?.additionalParameters ? JSON.parse(flpConfiguration.additionalParameters) : {};
289
245
  const content = {
290
246
  inbound: {
291
247
  [flpConfiguration.inboundId]: {
292
248
  action: flpConfiguration.action,
293
249
  semanticObject: flpConfiguration.semanticObject,
250
+ icon: flpConfiguration.icon,
294
251
  title: `{{${appId}_sap.app.crossNavigation.inbounds.${flpConfiguration.inboundId}.title}}`,
295
252
  signature: {
296
253
  additionalParameters: 'allowed',
@@ -322,12 +279,10 @@ function getInboundChangeContentWithNewInboundID(flpConfiguration, appId) {
322
279
  * @param manifestChangeContent Application variant change content
323
280
  */
324
281
  function enhanceManifestChangeContentWithFlpConfig(flpConfiguration, appId, manifestChangeContent = []) {
325
- const inboundChangeContent = flpConfiguration.addInboundId
326
- ? getInboundChangeContentWithNewInboundID(flpConfiguration, appId)
327
- : getInboundChangeContentWithExistingInboundId(flpConfiguration, appId);
282
+ const inboundChangeContent = getInboundChangeContentWithNewInboundID(flpConfiguration, appId);
328
283
  if (inboundChangeContent) {
329
284
  const addInboundChange = {
330
- changeType: flpConfiguration.addInboundId ? 'appdescr_app_addNewInbound' : 'appdescr_app_changeInbound',
285
+ changeType: 'appdescr_app_addNewInbound',
331
286
  content: inboundChangeContent,
332
287
  texts: {
333
288
  'i18n': 'i18n/i18n.properties'
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.14.28",
12
+ "version": "0.14.30",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -23,6 +23,7 @@
23
23
  "!dist/**/*.map"
24
24
  ],
25
25
  "dependencies": {
26
+ "@sap-devx/yeoman-ui-types": "1.16.9",
26
27
  "adm-zip": "0.5.10",
27
28
  "ejs": "3.1.10",
28
29
  "i18next": "23.11.2",
@@ -32,18 +33,18 @@
32
33
  "prompts": "2.4.2",
33
34
  "sanitize-filename": "1.6.3",
34
35
  "uuid": "10.0.0",
35
- "@sap-ux/axios-extension": "1.22.2",
36
+ "@sap-ux/axios-extension": "1.22.3",
36
37
  "@sap-ux/btp-utils": "1.1.0",
37
- "@sap-ux/inquirer-common": "0.7.13",
38
+ "@sap-ux/inquirer-common": "0.7.15",
38
39
  "@sap-ux/logger": "0.7.0",
39
- "@sap-ux/project-access": "1.30.2",
40
- "@sap-ux/project-input-validator": "0.6.3",
41
- "@sap-ux/system-access": "0.6.7",
40
+ "@sap-ux/project-access": "1.30.3",
41
+ "@sap-ux/project-input-validator": "0.6.4",
42
+ "@sap-ux/system-access": "0.6.8",
42
43
  "@sap-ux/ui5-config": "0.28.2",
43
44
  "@sap-ux/ui5-info": "0.12.0",
44
- "@sap-ux/odata-service-writer": "0.27.5",
45
+ "@sap-ux/odata-service-writer": "0.27.6",
45
46
  "@sap-ux/nodejs-utils": "0.2.1",
46
- "@sap-ux/i18n": "0.3.0",
47
+ "@sap-ux/i18n": "0.3.1",
47
48
  "@sap-ux/store": "1.1.0"
48
49
  },
49
50
  "devDependencies": {