@sap-ux/adp-tooling 0.18.101 → 0.18.103

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.
@@ -37,7 +37,7 @@ class ManifestServiceCF {
37
37
  static async init(projectPath, logger) {
38
38
  const service = new ManifestServiceCF(logger);
39
39
  logger.debug('Triggering project build to generate dist folder');
40
- await (0, project_builder_1.runBuild)(projectPath, { ADP_BUILDER_MODE: 'preview' });
40
+ await (0, project_builder_1.runBuild)(projectPath);
41
41
  const manifestPath = (0, node_path_1.join)(projectPath, CF_BUILD_PATH, 'manifest.json');
42
42
  logger.debug(`Reading manifest from '${manifestPath}'`);
43
43
  const manifestContent = (0, node_fs_1.readFileSync)(manifestPath, 'utf-8');
@@ -4,6 +4,23 @@ exports.getPrompts = getPrompts;
4
4
  const i18n_1 = require("../../i18n");
5
5
  const project_access_1 = require("@sap-ux/project-access");
6
6
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
7
+ /**
8
+ * Checks if the selected service has server-side annotations.
9
+ * A server-side annotation is detected when:
10
+ * 1. The service has annotations referenced in its settings
11
+ * 2. The referenced annotation data source has a URI starting with '/'
12
+ *
13
+ * @param {Record<string, ManifestNamespace.DataSource>} dataSources - All data sources from the manifest.
14
+ * @param {string} serviceId - The selected service ID.
15
+ * @returns {boolean} True if server-side annotations are detected for the selected service.
16
+ */
17
+ function hasServerSideAnnotations(dataSources, serviceId) {
18
+ const annotationId = dataSources[serviceId]?.settings?.annotations?.[0];
19
+ if (!annotationId) {
20
+ return false;
21
+ }
22
+ return !!dataSources[annotationId]?.uri?.startsWith('/');
23
+ }
7
24
  /**
8
25
  * Validates the OData Source URI prompt.
9
26
  *
@@ -85,7 +102,8 @@ function getPrompts(dataSources) {
85
102
  guiOptions: {
86
103
  hint: (0, i18n_1.t)('prompts.oDataAnnotationSourceURITooltip')
87
104
  },
88
- validate: validatePromptAnnotationURI
105
+ validate: validatePromptAnnotationURI,
106
+ when: (answers) => hasServerSideAnnotations(dataSources, answers.id)
89
107
  }
90
108
  ];
91
109
  }
@@ -1,6 +1,7 @@
1
- import { type AbapServiceProvider, AdaptationProjectType } from '@sap-ux/axios-extension';
1
+ import type { AbapServiceProvider } from '@sap-ux/axios-extension';
2
2
  import type { ToolsLogger } from '@sap-ux/logger';
3
3
  import type { SourceApplication } from '../types';
4
+ import { SupportedProject } from './systems';
4
5
  /**
5
6
  * Checks whether the application supports manifest-first approach.
6
7
  *
@@ -16,12 +17,12 @@ export declare function isAppSupported(provider: AbapServiceProvider, id: string
16
17
  *
17
18
  * @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
18
19
  * @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
19
- * @param {AdaptationProjectType | undefined} projectType - The project type.
20
+ * @param {SupportedProject | undefined} supportedProject - The supported ADP projects by the system.
20
21
  * @returns {Promise<SourceApplication[]>} If the project type is cloudReady resolves with
21
22
  * applications for which the {@link SourceApplication.cloudDevAdaptationStatus} is `released`.
22
23
  * If the project type is onPremise we display all applications, plus applications with variant descriptor
23
- * in case the {@link isCustomerBase} flag is set to true. In case the {@link projectType} is NOT set
24
+ * in case the {@link isCustomerBase} flag is set to true. In case the {@link supportedProject} is NOT set
24
25
  * we return an empty array.
25
26
  */
26
- export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean, projectType?: AdaptationProjectType): Promise<SourceApplication[]>;
27
+ export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean, supportedProject?: SupportedProject): Promise<SourceApplication[]>;
27
28
  //# sourceMappingURL=applications.d.ts.map
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAppSupported = isAppSupported;
4
4
  exports.loadApps = loadApps;
5
- const axios_extension_1 = require("@sap-ux/axios-extension");
6
5
  const i18n_1 = require("../i18n");
7
- const ONPREM_APP_FIELDS = [
6
+ const systems_1 = require("./systems");
7
+ const ONPREM_APP_FIELDS_LIST = [
8
8
  'sap.app/id',
9
9
  'sap.app/ach',
10
10
  'sap.fiori/registrationIds',
@@ -13,22 +13,23 @@ const ONPREM_APP_FIELDS = [
13
13
  'fileType',
14
14
  'repoName'
15
15
  ];
16
- const CLOUD_APP_FIELDS = [...ONPREM_APP_FIELDS, 'sap.fiori/cloudDevAdaptationStatus'];
16
+ const ONPREM_APP_FIELDS_STR = ONPREM_APP_FIELDS_LIST.join(',');
17
+ const CLOUD_APP_FIELDS_STR = [...ONPREM_APP_FIELDS_LIST, 'sap.fiori/cloudDevAdaptationStatus'].join(',');
17
18
  const APPS_WITH_DESCR_FILTER = {
18
- fields: ONPREM_APP_FIELDS.join(','),
19
+ fields: ONPREM_APP_FIELDS_STR,
19
20
  'sap.ui/technology': 'UI5',
20
21
  'sap.app/type': 'application',
21
22
  'fileType': 'appdescr'
22
23
  };
23
24
  const APPS_WITH_VARIANT_DESCR_FILTER = {
24
- fields: ONPREM_APP_FIELDS.join(','),
25
+ fields: ONPREM_APP_FIELDS_STR,
25
26
  'sap.ui/technology': 'UI5',
26
27
  'sap.app/type': 'application',
27
28
  'fileType': 'appdescr_variant',
28
29
  'originLayer': 'VENDOR'
29
30
  };
30
31
  const CLOUD_ONLY_APPS_FILTER = {
31
- fields: CLOUD_APP_FIELDS.join(','),
32
+ fields: CLOUD_APP_FIELDS_STR,
32
33
  'sap.app/type': 'application',
33
34
  'sap.fiori/cloudDevAdaptationStatus': 'released'
34
35
  };
@@ -97,29 +98,46 @@ async function isAppSupported(provider, id, logger) {
97
98
  *
98
99
  * @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
99
100
  * @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
100
- * @param {AdaptationProjectType | undefined} projectType - The project type.
101
+ * @param {SupportedProject | undefined} supportedProject - The supported ADP projects by the system.
101
102
  * @returns {Promise<SourceApplication[]>} If the project type is cloudReady resolves with
102
103
  * applications for which the {@link SourceApplication.cloudDevAdaptationStatus} is `released`.
103
104
  * If the project type is onPremise we display all applications, plus applications with variant descriptor
104
- * in case the {@link isCustomerBase} flag is set to true. In case the {@link projectType} is NOT set
105
+ * in case the {@link isCustomerBase} flag is set to true. In case the {@link supportedProject} is NOT set
105
106
  * we return an empty array.
106
107
  */
107
- async function loadApps(provider, isCustomerBase, projectType) {
108
- if (!projectType) {
108
+ async function loadApps(provider, isCustomerBase, supportedProject) {
109
+ if (!supportedProject) {
109
110
  return [];
110
111
  }
111
112
  try {
112
113
  const appIndexService = provider.getAppIndex();
113
- const appIndex = (await Promise.all([
114
- appIndexService.search(projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY ? CLOUD_ONLY_APPS_FILTER : APPS_WITH_DESCR_FILTER),
115
- projectType === axios_extension_1.AdaptationProjectType.ON_PREMISE && isCustomerBase
116
- ? appIndexService.search(APPS_WITH_VARIANT_DESCR_FILTER)
117
- : Promise.resolve([])
118
- ])).flat();
114
+ const appIndex = (await Promise.all(getAppFilters(isCustomerBase, supportedProject).map((filter) => appIndexService.search(filter)))).flat();
119
115
  return appIndex.map(toSourceApplication).sort(compareByTitleOrId);
120
116
  }
121
117
  catch (error) {
122
118
  throw new Error(`Could not load applications: ${error.message}`);
123
119
  }
124
120
  }
121
+ /**
122
+ * Helper method used to create the application filters required by the app index service.
123
+ *
124
+ * @param {boolean} isCustomerBase Indicates whether the system is customer-based or not.
125
+ * @param {SupportedProject} supportedProject The supported ADP projects by the system.
126
+ * @returns {UI5AppFilter[]} The array of filters dermined by the supported ADP projects from the system.
127
+ */
128
+ function getAppFilters(isCustomerBase, supportedProject) {
129
+ if (supportedProject === systems_1.SupportedProject.CLOUD_READY) {
130
+ return [CLOUD_ONLY_APPS_FILTER];
131
+ }
132
+ const displayAllAppsFilters = [APPS_WITH_DESCR_FILTER, ...(isCustomerBase ? [APPS_WITH_VARIANT_DESCR_FILTER] : [])];
133
+ if (supportedProject === systems_1.SupportedProject.CLOUD_READY_AND_ON_PREM) {
134
+ // In case of a mixed system we want to also include the cloudDevAdaptationStatus property
135
+ // for each application result in the list. The property is available as a column for all apps
136
+ // due to the nature of the system - mixed, so we are safe no error 400 will occur like
137
+ // with older onPremise only systems for which the column is missing. For non cloud app the
138
+ // property cloudDevAdaptationStatus has value an empty string for a cloud app - 'released'.
139
+ return displayAllAppsFilters.map((filter) => ({ ...filter, fields: CLOUD_APP_FIELDS_STR }));
140
+ }
141
+ return displayAllAppsFilters;
142
+ }
125
143
  //# sourceMappingURL=applications.js.map
package/dist/types.d.ts CHANGED
@@ -154,6 +154,7 @@ export interface ConfigAnswers {
154
154
  password: string;
155
155
  storeCredentials?: boolean;
156
156
  application: SourceApplication;
157
+ projectType?: AdaptationProjectType;
157
158
  fioriId?: string;
158
159
  ach?: string;
159
160
  shouldCreateExtProject?: boolean;
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.101",
12
+ "version": "0.18.103",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",