@sap-ux/adp-tooling 0.18.63 → 0.18.66

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,15 +1,15 @@
1
1
  import { type AbapServiceProvider } from '@sap-ux/axios-extension';
2
2
  import type { ManifestNamespace } from '@sap-ux/project-access';
3
- import type { FlexUISupportedSystem } from '../types';
3
+ import type { FlexUICapability } from '../types';
4
4
  import type { ToolsLogger } from '@sap-ux/logger';
5
5
  /**
6
6
  * Fetches system supports Flex UI features.
7
7
  *
8
8
  * @param {AbapServiceProvider} provider - Instance of the ABAP provider.
9
9
  * @param {boolean} isCustomerBase - Indicates whether the adaptation layer is CUSTOMER_BASE.
10
- * @returns {Promise<FlexUISupportedSystem | undefined>} settings indicating support for onPremise and UI Flex capabilities.
10
+ * @returns {Promise<FlexUICapability | undefined>} settings indicating support for onPremise and UI Flex capabilities.
11
11
  */
12
- export declare function getFlexUISupportedSystem(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<FlexUISupportedSystem>;
12
+ export declare function getFlexUICapability(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<FlexUICapability>;
13
13
  /**
14
14
  * Fetches system UI5 Version from the UI5VersionService, if the request throws
15
15
  * fallback to the legacy api introduced in the UI5RtVersionService.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFlexUISupportedSystem = getFlexUISupportedSystem;
3
+ exports.getFlexUICapability = getFlexUICapability;
4
4
  exports.getSystemUI5Version = getSystemUI5Version;
5
5
  exports.getBaseAppInbounds = getBaseAppInbounds;
6
6
  const axios_extension_1 = require("@sap-ux/axios-extension");
@@ -14,13 +14,13 @@ const FILTER = {
14
14
  *
15
15
  * @param {AbapServiceProvider} provider - Instance of the ABAP provider.
16
16
  * @param {boolean} isCustomerBase - Indicates whether the adaptation layer is CUSTOMER_BASE.
17
- * @returns {Promise<FlexUISupportedSystem | undefined>} settings indicating support for onPremise and UI Flex capabilities.
17
+ * @returns {Promise<FlexUICapability | undefined>} settings indicating support for onPremise and UI Flex capabilities.
18
18
  */
19
- async function getFlexUISupportedSystem(provider, isCustomerBase) {
19
+ async function getFlexUICapability(provider, isCustomerBase) {
20
20
  if (!isCustomerBase) {
21
21
  return {
22
- isOnPremise: true,
23
- isUIFlex: true
22
+ isDtaFolderDeploymentSupported: true,
23
+ isUIFlexSupported: true
24
24
  };
25
25
  }
26
26
  const response = await provider.get(axios_extension_1.AdtCatalogService.ADT_DISCOVERY_SERVICE_PATH, {
@@ -28,9 +28,9 @@ async function getFlexUISupportedSystem(provider, isCustomerBase) {
28
28
  Accept: 'application/*'
29
29
  }
30
30
  });
31
- const isOnPremise = response.data.includes(FILTER.term);
32
- const isUIFlex = response.data.includes(FILTER.scheme);
33
- return { isOnPremise, isUIFlex };
31
+ const isDtaFolderDeploymentSupported = response.data.includes(FILTER.term);
32
+ const isUIFlexSupported = response.data.includes(FILTER.scheme);
33
+ return { isDtaFolderDeploymentSupported, isUIFlexSupported };
34
34
  }
35
35
  /**
36
36
  * Fetches system UI5 Version from the UI5VersionService, if the request throws
@@ -10,22 +10,4 @@ export declare const RESOURCE_BUNDLE_TEXT = "\n\n# This is the resource bundle f
10
10
  export declare const TRANSLATION_UUID_TEXT = "\n#__ldi.translation.uuid=";
11
11
  export declare const MAIN_I18N_PATH = "i18n/i18n.properties";
12
12
  export declare const BASE_I18N_DESCRIPTION = "#Make sure you provide a unique prefix to the newly added keys in this file, to avoid overriding of SAP Fiori application keys.";
13
- export declare const S4HANA_APPS_PARAMS: {
14
- 'sap.app/type': string;
15
- 'sap.fiori/cloudDevAdaptationStatus': string;
16
- fields: string;
17
- };
18
- export declare const ABAP_APPS_PARAMS: {
19
- fields: string;
20
- 'sap.ui/technology': string;
21
- 'sap.app/type': string;
22
- fileType: string;
23
- };
24
- export declare const ABAP_VARIANT_APPS_PARAMS: {
25
- fields: string;
26
- 'sap.ui/technology': string;
27
- 'sap.app/type': string;
28
- fileType: string;
29
- originLayer: string;
30
- };
31
13
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ABAP_VARIANT_APPS_PARAMS = exports.ABAP_APPS_PARAMS = exports.S4HANA_APPS_PARAMS = exports.BASE_I18N_DESCRIPTION = exports.MAIN_I18N_PATH = exports.TRANSLATION_UUID_TEXT = exports.RESOURCE_BUNDLE_TEXT = exports.SNAPSHOT_UNTESTED_VERSION = exports.SNAPSHOT_VERSION = exports.LATEST_VERSION = exports.CURRENT_SYSTEM_VERSION = exports.SNAPSHOT_CDN_URL = exports.UI5_VERSIONS_NEO_CDN_URL = exports.UI5_VERSIONS_CDN_URL = exports.UI5_CDN_URL = void 0;
3
+ exports.BASE_I18N_DESCRIPTION = exports.MAIN_I18N_PATH = exports.TRANSLATION_UUID_TEXT = exports.RESOURCE_BUNDLE_TEXT = exports.SNAPSHOT_UNTESTED_VERSION = exports.SNAPSHOT_VERSION = exports.LATEST_VERSION = exports.CURRENT_SYSTEM_VERSION = exports.SNAPSHOT_CDN_URL = exports.UI5_VERSIONS_NEO_CDN_URL = exports.UI5_VERSIONS_CDN_URL = exports.UI5_CDN_URL = void 0;
4
4
  exports.UI5_CDN_URL = 'https://ui5.sap.com';
5
5
  exports.UI5_VERSIONS_CDN_URL = 'https://sapui5.hana.ondemand.com/version.json';
6
6
  exports.UI5_VERSIONS_NEO_CDN_URL = 'https://ui5.sap.com/neo-app.json';
@@ -13,22 +13,4 @@ exports.RESOURCE_BUNDLE_TEXT = '\n\n# This is the resource bundle for ';
13
13
  exports.TRANSLATION_UUID_TEXT = '\n#__ldi.translation.uuid=';
14
14
  exports.MAIN_I18N_PATH = 'i18n/i18n.properties';
15
15
  exports.BASE_I18N_DESCRIPTION = '#Make sure you provide a unique prefix to the newly added keys in this file, to avoid overriding of SAP Fiori application keys.';
16
- exports.S4HANA_APPS_PARAMS = {
17
- 'sap.app/type': 'application',
18
- 'sap.fiori/cloudDevAdaptationStatus': 'released',
19
- 'fields': 'sap.app/id,repoName,sap.fiori/cloudDevAdaptationStatus,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType'
20
- };
21
- exports.ABAP_APPS_PARAMS = {
22
- 'fields': 'sap.app/id,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType,repoName',
23
- 'sap.ui/technology': 'UI5',
24
- 'sap.app/type': 'application',
25
- 'fileType': 'appdescr'
26
- };
27
- exports.ABAP_VARIANT_APPS_PARAMS = {
28
- 'fields': 'sap.app/id,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType,repoName',
29
- 'sap.ui/technology': 'UI5',
30
- 'sap.app/type': 'application',
31
- 'fileType': 'appdescr_variant',
32
- 'originLayer': 'VENDOR'
33
- };
34
16
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
2
  import type { ReaderCollection } from '@ui5/fs';
3
3
  import type { UI5Config } from '@sap-ux/ui5-config';
4
- import type { Inbound } from '@sap-ux/axios-extension';
4
+ import { type Inbound, AdaptationProjectType } from '@sap-ux/axios-extension';
5
5
  import { type ManifestNamespace, type Manifest } from '@sap-ux/project-access';
6
6
  import type { DescriptorVariant, AdpPreviewConfig, UI5YamlCustomTaskConfiguration } from '../types';
7
7
  /**
@@ -83,6 +83,16 @@ export declare function loadAppVariant(rootProject: ReaderCollection): Promise<D
83
83
  * @returns The `AdpPreviewConfig` object if found, otherwise throws an error.
84
84
  */
85
85
  export declare function getAdpConfig<T = AdpPreviewConfig>(basePath: string, yamlPath: string): Promise<T>;
86
+ /**
87
+ * Returns the project type for an existing Adaptation project based on the information
88
+ * inside the ui5.yaml. If the builder key is presented inside the yaml then we are
89
+ * in a cloudReady project otherwise - onPremise.
90
+ *
91
+ * @param {string} basePath - The path to the adaptation project root folder.
92
+ * @returns {Promise<AdaptationProjectType | undefined>} The project type or undefined in casde the project is
93
+ * NOT an Adaptation project or an error is thrown from reading the configuration file.
94
+ */
95
+ export declare function getExistingAdpProjectType(basePath: string): Promise<AdaptationProjectType | undefined>;
86
96
  /**
87
97
  * Get all files in the webapp folder.
88
98
  *
@@ -10,11 +10,13 @@ exports.extractCfBuildTask = extractCfBuildTask;
10
10
  exports.readManifestFromBuildPath = readManifestFromBuildPath;
11
11
  exports.loadAppVariant = loadAppVariant;
12
12
  exports.getAdpConfig = getAdpConfig;
13
+ exports.getExistingAdpProjectType = getExistingAdpProjectType;
13
14
  exports.getWebappFiles = getWebappFiles;
14
15
  exports.filterAndMapInboundsToManifest = filterAndMapInboundsToManifest;
15
16
  exports.getBaseAppId = getBaseAppId;
16
17
  const node_fs_1 = require("node:fs");
17
18
  const node_path_1 = require("node:path");
19
+ const axios_extension_1 = require("@sap-ux/axios-extension");
18
20
  const project_access_1 = require("@sap-ux/project-access");
19
21
  /**
20
22
  * Get the app descriptor variant.
@@ -153,6 +155,31 @@ async function getAdpConfig(basePath, yamlPath) {
153
155
  throw new Error(`No system configuration found in ${(0, node_path_1.basename)(ui5ConfigPath)}`);
154
156
  }
155
157
  }
158
+ /**
159
+ * Returns the project type for an existing Adaptation project based on the information
160
+ * inside the ui5.yaml. If the builder key is presented inside the yaml then we are
161
+ * in a cloudReady project otherwise - onPremise.
162
+ *
163
+ * @param {string} basePath - The path to the adaptation project root folder.
164
+ * @returns {Promise<AdaptationProjectType | undefined>} The project type or undefined in casde the project is
165
+ * NOT an Adaptation project or an error is thrown from reading the configuration file.
166
+ */
167
+ async function getExistingAdpProjectType(basePath) {
168
+ try {
169
+ const appType = await (0, project_access_1.getAppType)(basePath);
170
+ if (appType !== 'Fiori Adaptation') {
171
+ return undefined;
172
+ }
173
+ const yamlPath = (0, node_path_1.join)(basePath, project_access_1.FileName.Ui5Yaml);
174
+ const ui5Config = await readUi5Config(basePath, yamlPath);
175
+ return ui5Config.hasBuilderKey() ? axios_extension_1.AdaptationProjectType.CLOUD_READY : axios_extension_1.AdaptationProjectType.ON_PREMISE;
176
+ }
177
+ catch {
178
+ // Expected: Project may not be an ADP project or configuration files may be missing/invalid
179
+ // Returning undefined allows callers to handle non-ADP projects gracefully
180
+ return undefined;
181
+ }
182
+ }
156
183
  /**
157
184
  * Get all files in the webapp folder.
158
185
  *
@@ -2,8 +2,8 @@ import type { ReaderCollection } from '@ui5/fs';
2
2
  import type { MiddlewareUtils } from '@ui5/server';
3
3
  import type { NextFunction, Request, Response, Router } from 'express';
4
4
  import type { Logger, ToolsLogger } from '@sap-ux/logger';
5
- import { type UI5FlexLayer } from '@sap-ux/project-access';
6
- import type { MergedAppDescriptor } from '@sap-ux/axios-extension';
5
+ import type { UI5FlexLayer } from '@sap-ux/project-access';
6
+ import type { AdaptationProjectType, MergedAppDescriptor } from '@sap-ux/axios-extension';
7
7
  import type { AdpPreviewConfig, CommonChangeProperties, DescriptorVariant, OperationType, CommonAdditionalChangeInfoProperties } from '../types';
8
8
  import type { Editor } from 'mem-fs-editor';
9
9
  declare global {
@@ -37,7 +37,7 @@ export declare class AdpPreview {
37
37
  private routesHandler;
38
38
  private lrep;
39
39
  private descriptorVariantId;
40
- private isCloud;
40
+ private projectTypeValue?;
41
41
  /**
42
42
  * @returns merged manifest.
43
43
  */
@@ -49,9 +49,9 @@ export declare class AdpPreview {
49
49
  [name: string]: string;
50
50
  };
51
51
  /**
52
- * @returns {boolean} true if the project is an ABAP cloud project, false otherwise.
52
+ * @returns {AdaptationProjectType | undefined} The project type.
53
53
  */
54
- get isCloudProject(): boolean;
54
+ get projectType(): AdaptationProjectType | undefined;
55
55
  /**
56
56
  * Constructor taking the config and a logger as input.
57
57
  *
@@ -9,6 +9,8 @@ const system_access_1 = require("@sap-ux/system-access");
9
9
  const routes_handler_1 = __importDefault(require("./routes-handler"));
10
10
  const change_handler_1 = require("./change-handler");
11
11
  const descriptor_change_handler_1 = require("./descriptor-change-handler");
12
+ const helper_1 = require("../base/helper");
13
+ const node_path_1 = __importDefault(require("node:path"));
12
14
  /**
13
15
  * Instance of an adaptation project handling requests and data transformation.
14
16
  */
@@ -31,7 +33,7 @@ class AdpPreview {
31
33
  routesHandler;
32
34
  lrep;
33
35
  descriptorVariantId;
34
- isCloud;
36
+ projectTypeValue;
35
37
  /**
36
38
  * @returns merged manifest.
37
39
  */
@@ -68,15 +70,10 @@ class AdpPreview {
68
70
  }
69
71
  }
70
72
  /**
71
- * @returns {boolean} true if the project is an ABAP cloud project, false otherwise.
73
+ * @returns {AdaptationProjectType | undefined} The project type.
72
74
  */
73
- get isCloudProject() {
74
- if (this.isCloud !== undefined) {
75
- return this.isCloud;
76
- }
77
- else {
78
- throw new Error('Not initialized');
79
- }
75
+ get projectType() {
76
+ return this.projectTypeValue;
80
77
  }
81
78
  /**
82
79
  * Constructor taking the config and a logger as input.
@@ -108,8 +105,7 @@ class AdpPreview {
108
105
  this.lrep = this.provider.getLayeredRepository();
109
106
  // fetch a merged descriptor from the backend
110
107
  await this.lrep.getCsrfToken();
111
- // check if the project is an ABAP cloud project
112
- this.isCloud = await this.provider.isAbapCloud();
108
+ this.projectTypeValue = await (0, helper_1.getExistingAdpProjectType)(node_path_1.default.resolve());
113
109
  await this.sync();
114
110
  return descriptorVariant.layer;
115
111
  }
@@ -121,7 +117,7 @@ class AdpPreview {
121
117
  */
122
118
  async initCfBuildMode(descriptorVariant) {
123
119
  this.descriptorVariantId = descriptorVariant.id;
124
- this.isCloud = false;
120
+ this.projectTypeValue = undefined;
125
121
  this.routesHandler = new routes_handler_1.default(this.project, this.util, {}, this.logger);
126
122
  return descriptorVariant.layer;
127
123
  }
@@ -1,23 +1,6 @@
1
+ import { type AbapServiceProvider, AdaptationProjectType } from '@sap-ux/axios-extension';
1
2
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { AbapServiceProvider, App } from '@sap-ux/axios-extension';
3
3
  import type { SourceApplication } from '../types';
4
- /**
5
- * Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
6
- * This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
7
- *
8
- * @param {SourceApplication} appA - The first application to compare.
9
- * @param {SourceApplication} appB - The second application to compare.
10
- * @returns {number} A number indicating the sort order.
11
- */
12
- export declare const filterApps: (appA: SourceApplication, appB: SourceApplication) => number;
13
- /**
14
- * Transforms raw application data into a structured Application object.
15
- * This function maps properties from a loosely typed app data structure to a strongly typed Application object.
16
- *
17
- * @param {Partial<App>} app - The raw application data, possibly incomplete.
18
- * @returns {SourceApplication} A structured application object with defined properties, even if some may be empty.
19
- */
20
- export declare const mapApps: (app: Partial<App>) => SourceApplication;
21
4
  /**
22
5
  * Checks whether the application supports manifest-first approach.
23
6
  *
@@ -28,14 +11,17 @@ export declare const mapApps: (app: Partial<App>) => SourceApplication;
28
11
  */
29
12
  export declare function isAppSupported(provider: AbapServiceProvider, id: string, logger: ToolsLogger): Promise<boolean>;
30
13
  /**
31
- * Loads and processes application data from the ABAP service provider.
32
- *
33
- * This function retrieves the application index from the provider and then searches for applications based on system type.
34
- * If the system is not a cloud system and the base is customer-specific, additional variant applications are fetched and merged.
14
+ * Loads and processes application data from the ABAP service provider. This function
15
+ * retrieves the application index from the provider and then searches for applications based on project type.
35
16
  *
36
17
  * @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
37
18
  * @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
38
- * @returns {Promise<SourceApplication[]>} A promise that resolves to a sorted list of applications.
19
+ * @param {AdaptationProjectType | undefined} projectType - The project type.
20
+ * @returns {Promise<SourceApplication[]>} If the project type is cloudReady resolves with
21
+ * applications for which the {@link SourceApplication.cloudDevAdaptationStatus} is `released`.
22
+ * 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
+ * we return an empty array.
39
25
  */
40
- export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean): Promise<SourceApplication[]>;
26
+ export declare function loadApps(provider: AbapServiceProvider, isCustomerBase: boolean, projectType?: AdaptationProjectType): Promise<SourceApplication[]>;
41
27
  //# sourceMappingURL=applications.d.ts.map
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapApps = exports.filterApps = void 0;
4
3
  exports.isAppSupported = isAppSupported;
5
4
  exports.loadApps = loadApps;
5
+ const axios_extension_1 = require("@sap-ux/axios-extension");
6
6
  const i18n_1 = require("../i18n");
7
- const constants_1 = require("../base/constants");
7
+ const APP_FIELDS = 'sap.app/id,sap.app/ach,sap.fiori/registrationIds,sap.app/title,url,fileType,repoName,sap.fiori/cloudDevAdaptationStatus';
8
+ const APPS_WITH_DESCR_FILTER = {
9
+ fields: APP_FIELDS,
10
+ 'sap.ui/technology': 'UI5',
11
+ 'sap.app/type': 'application',
12
+ 'fileType': 'appdescr'
13
+ };
14
+ const APPS_WITH_VARIANT_DESCR_FILTER = {
15
+ fields: APP_FIELDS,
16
+ 'sap.ui/technology': 'UI5',
17
+ 'sap.app/type': 'application',
18
+ 'fileType': 'appdescr_variant',
19
+ 'originLayer': 'VENDOR'
20
+ };
21
+ const CLOUD_ONLY_APPS_FILTER = {
22
+ fields: APP_FIELDS,
23
+ 'sap.ui/technology': 'UI5',
24
+ 'sap.app/type': 'application',
25
+ 'sap.fiori/cloudDevAdaptationStatus': 'released'
26
+ };
8
27
  /**
9
28
  * Compares two applications for sorting, using the title and falling back to the ID if titles are missing or equal.
10
29
  * This function ensures that applications are sorted alphabetically by their title or ID in a case-insensitive manner.
@@ -13,7 +32,7 @@ const constants_1 = require("../base/constants");
13
32
  * @param {SourceApplication} appB - The second application to compare.
14
33
  * @returns {number} A number indicating the sort order.
15
34
  */
16
- const filterApps = (appA, appB) => {
35
+ const compareByTitleOrId = (appA, appB) => {
17
36
  let titleA = appA.title.toUpperCase();
18
37
  let titleB = appB.title.toUpperCase();
19
38
  if (!titleA.trim()) {
@@ -30,7 +49,6 @@ const filterApps = (appA, appB) => {
30
49
  }
31
50
  return 0;
32
51
  };
33
- exports.filterApps = filterApps;
34
52
  /**
35
53
  * Transforms raw application data into a structured Application object.
36
54
  * This function maps properties from a loosely typed app data structure to a strongly typed Application object.
@@ -38,16 +56,16 @@ exports.filterApps = filterApps;
38
56
  * @param {Partial<App>} app - The raw application data, possibly incomplete.
39
57
  * @returns {SourceApplication} A structured application object with defined properties, even if some may be empty.
40
58
  */
41
- const mapApps = (app) => ({
59
+ const toSourceApplication = (app) => ({
42
60
  id: app['sap.app/id'] ?? '',
43
61
  title: app['sap.app/title'] ?? '',
44
62
  ach: app['sap.app/ach'] ?? '',
45
63
  registrationIds: app['sap.fiori/registrationIds'] ?? [],
46
64
  fileType: app['fileType'] ?? '',
47
65
  bspUrl: app['url'] ?? '',
48
- bspName: app['repoName'] ?? ''
66
+ bspName: app['repoName'] ?? '',
67
+ cloudDevAdaptationStatus: app['sap.fiori/cloudDevAdaptationStatus']?.toString() ?? ''
49
68
  });
50
- exports.mapApps = mapApps;
51
69
  /**
52
70
  * Checks whether the application supports manifest-first approach.
53
71
  *
@@ -66,29 +84,34 @@ async function isAppSupported(provider, id, logger) {
66
84
  return true;
67
85
  }
68
86
  /**
69
- * Loads and processes application data from the ABAP service provider.
70
- *
71
- * This function retrieves the application index from the provider and then searches for applications based on system type.
72
- * If the system is not a cloud system and the base is customer-specific, additional variant applications are fetched and merged.
87
+ * Loads and processes application data from the ABAP service provider. This function
88
+ * retrieves the application index from the provider and then searches for applications based on project type.
73
89
  *
74
90
  * @param {AbapServiceProvider} provider - The ABAP service provider used to retrieve application data.
75
91
  * @param {boolean} isCustomerBase - Flag indicating whether the system is customer-based. Affects application selection.
76
- * @returns {Promise<SourceApplication[]>} A promise that resolves to a sorted list of applications.
92
+ * @param {AdaptationProjectType | undefined} projectType - The project type.
93
+ * @returns {Promise<SourceApplication[]>} If the project type is cloudReady resolves with
94
+ * applications for which the {@link SourceApplication.cloudDevAdaptationStatus} is `released`.
95
+ * If the project type is onPremise we display all applications, plus applications with variant descriptor
96
+ * in case the {@link isCustomerBase} flag is set to true. In case the {@link projectType} is NOT set
97
+ * we return an empty array.
77
98
  */
78
- async function loadApps(provider, isCustomerBase) {
79
- let result = [];
99
+ async function loadApps(provider, isCustomerBase, projectType) {
100
+ if (!projectType) {
101
+ return [];
102
+ }
80
103
  try {
81
- const isCloudSystem = await provider.isAbapCloud();
82
- const appIndex = provider.getAppIndex();
83
- result = await appIndex.search(isCloudSystem ? constants_1.S4HANA_APPS_PARAMS : constants_1.ABAP_APPS_PARAMS);
84
- if (!isCloudSystem && isCustomerBase) {
85
- const extraApps = await appIndex.search(constants_1.ABAP_VARIANT_APPS_PARAMS);
86
- result = result.concat(extraApps);
87
- }
88
- return result.map(exports.mapApps).sort(exports.filterApps);
104
+ const appIndexService = provider.getAppIndex();
105
+ const appIndex = (await Promise.all([
106
+ appIndexService.search(projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY ? CLOUD_ONLY_APPS_FILTER : APPS_WITH_DESCR_FILTER),
107
+ projectType === axios_extension_1.AdaptationProjectType.ON_PREMISE && isCustomerBase
108
+ ? appIndexService.search(APPS_WITH_VARIANT_DESCR_FILTER)
109
+ : Promise.resolve([])
110
+ ])).flat();
111
+ return appIndex.map(toSourceApplication).sort(compareByTitleOrId);
89
112
  }
90
- catch (e) {
91
- throw new Error(`Could not load applications: ${e.message}`);
113
+ catch (error) {
114
+ throw new Error(`Could not load applications: ${error.message}`);
92
115
  }
93
116
  }
94
117
  //# sourceMappingURL=applications.js.map
@@ -1,6 +1,19 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
2
  import type { BackendSystem } from '@sap-ux/store';
3
3
  import type { Endpoint } from '../types';
4
+ import { type AbapServiceProvider } from '@sap-ux/axios-extension';
5
+ export declare enum SupportedProject {
6
+ ON_PREM = "onPremise",
7
+ CLOUD_READY = "cloudReady",
8
+ CLOUD_READY_AND_ON_PREM = "cloudReadyAndOnPrem"
9
+ }
10
+ /**
11
+ * Gets the supported project types for the system. A system can support cloudReady, onPremise or both types of project.
12
+ *
13
+ * @param provider - The ABAP service provider.
14
+ * @returns {Promise<SupportedProject>} The supported project types.
15
+ */
16
+ export declare function getSupportedProject(provider: AbapServiceProvider): Promise<SupportedProject>;
4
17
  /**
5
18
  * Retrieves the names of all stored systems, sorted alphabetically.
6
19
  *
@@ -1,9 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SystemLookup = exports.transformBackendSystem = void 0;
3
+ exports.SystemLookup = exports.transformBackendSystem = exports.SupportedProject = void 0;
4
+ exports.getSupportedProject = getSupportedProject;
4
5
  exports.getEndpointNames = getEndpointNames;
5
6
  const store_1 = require("@sap-ux/store");
6
7
  const btp_utils_1 = require("@sap-ux/btp-utils");
8
+ const axios_extension_1 = require("@sap-ux/axios-extension");
9
+ const i18n_1 = require("../i18n");
10
+ var SupportedProject;
11
+ (function (SupportedProject) {
12
+ SupportedProject["ON_PREM"] = "onPremise";
13
+ SupportedProject["CLOUD_READY"] = "cloudReady";
14
+ SupportedProject["CLOUD_READY_AND_ON_PREM"] = "cloudReadyAndOnPrem";
15
+ })(SupportedProject || (exports.SupportedProject = SupportedProject = {}));
16
+ /**
17
+ * Gets the supported project types for the system. A system can support cloudReady, onPremise or both types of project.
18
+ *
19
+ * @param provider - The ABAP service provider.
20
+ * @returns {Promise<SupportedProject>} The supported project types.
21
+ */
22
+ async function getSupportedProject(provider) {
23
+ try {
24
+ const layerdRepositoryService = provider.getLayeredRepository();
25
+ const { adaptationProjectTypes } = await layerdRepositoryService.getSystemInfo();
26
+ const hasCloudReady = adaptationProjectTypes?.includes(axios_extension_1.AdaptationProjectType.CLOUD_READY);
27
+ const hasOnPrem = adaptationProjectTypes?.includes(axios_extension_1.AdaptationProjectType.ON_PREMISE);
28
+ if (hasCloudReady && hasOnPrem) {
29
+ return SupportedProject.CLOUD_READY_AND_ON_PREM;
30
+ }
31
+ else if (hasCloudReady) {
32
+ return SupportedProject.CLOUD_READY;
33
+ }
34
+ else if (hasOnPrem) {
35
+ return SupportedProject.ON_PREM;
36
+ }
37
+ }
38
+ catch (error) {
39
+ // Handle the case where the API is not available and continue to standard onPremise flow.
40
+ if ((0, axios_extension_1.isAxiosError)(error) && [404, 405].includes(error.response?.status ?? 0)) {
41
+ return SupportedProject.ON_PREM;
42
+ }
43
+ throw error;
44
+ }
45
+ throw new Error((0, i18n_1.t)('error.projectTypeNotProvided'));
46
+ }
7
47
  /**
8
48
  * Retrieves the names of all stored systems, sorted alphabetically.
9
49
  *
@@ -106,6 +106,7 @@
106
106
  "failedToGetFDCApps": "Retrieving FDC apps failed: {{error}}",
107
107
  "failedToConnectToFDCService": "Failed to connect to the FDC service: '{{status}}'",
108
108
  "baseAppRequired": "A base app is required for Cloud Foundry project generation. Please select a base app and try again.",
109
+ "projectTypeNotProvided": "The project type is missing.",
109
110
  "invalidXsAppJson": "The xs-app.json file is invalid: {{error}}",
110
111
  "xsAppJsonNotFound": "The xs-app.json file was not found in any of the expected locations: {{paths}}",
111
112
  "noServiceInstanceNameFound": "No serviceInstanceName found in the app-variant-bundler-build configuration",
package/dist/types.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import type { UI5FlexLayer, ManifestNamespace, Manifest, Package } from '@sap-ux/project-access';
2
2
  import type { DestinationAbapTarget, UrlAbapTarget } from '@sap-ux/system-access';
3
3
  import type { Adp, BspApp } from '@sap-ux/ui5-config';
4
- import type { AxiosRequestConfig, KeyUserChangeContent, OperationsType } from '@sap-ux/axios-extension';
4
+ import type { AdaptationProjectType, AxiosRequestConfig, KeyUserChangeContent, OperationsType } from '@sap-ux/axios-extension';
5
5
  import type { Editor } from 'mem-fs-editor';
6
6
  import type { Destination } from '@sap-ux/btp-utils';
7
7
  import type { YUIQuestion } from '@sap-ux/inquirer-common';
8
8
  import type AdmZip from 'adm-zip';
9
+ import type { SupportedProject } from './source';
9
10
  export interface DescriptorVariant {
10
11
  layer: UI5FlexLayer;
11
12
  reference: string;
@@ -150,10 +151,11 @@ export interface SourceApplication {
150
151
  fileType: string;
151
152
  bspUrl: string;
152
153
  bspName: string;
154
+ cloudDevAdaptationStatus: string;
153
155
  }
154
- export interface FlexUISupportedSystem {
155
- isUIFlex: boolean;
156
- isOnPremise: boolean;
156
+ export interface FlexUICapability {
157
+ isUIFlexSupported: boolean;
158
+ isDtaFolderDeploymentSupported: boolean;
157
159
  }
158
160
  export interface UI5Version {
159
161
  latest: VersionDetail;
@@ -685,6 +687,8 @@ export interface CustomConfig {
685
687
  adp: {
686
688
  environment: OperationsType;
687
689
  support: ToolsSupport;
690
+ projectType?: AdaptationProjectType;
691
+ supportedProject?: SupportedProject;
688
692
  };
689
693
  }
690
694
  export type CloudCustomTaskConfigTarget = DestinationAbapTarget | (Pick<UrlAbapTarget, 'url' | 'client' | 'scp' | 'authenticationType'> & {
@@ -10,6 +10,8 @@ exports.enhanceManifestChangeContentWithFlpConfig = enhanceManifestChangeContent
10
10
  exports.enhanceUI5YamlWithCfCustomTask = enhanceUI5YamlWithCfCustomTask;
11
11
  exports.enhanceUI5YamlWithFioriToolsMiddleware = enhanceUI5YamlWithFioriToolsMiddleware;
12
12
  const constants_1 = require("../base/constants");
13
+ const axios_extension_1 = require("@sap-ux/axios-extension");
14
+ const source_1 = require("../source");
13
15
  const VSCODE_URL = 'https://REQUIRED_FOR_VSCODE.example';
14
16
  /**
15
17
  * Generate the configuration for the middlewares required for the ui5.yaml.
@@ -50,7 +52,7 @@ function enhanceUI5YamlWithCustomTask(ui5Config, config) {
50
52
  }
51
53
  ]);
52
54
  }
53
- if (config.customConfig?.adp?.environment === 'C') {
55
+ if (config.customConfig?.adp?.projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY) {
54
56
  const tasks = getAdpCloudCustomTasks(config);
55
57
  ui5Config.addCustomTasks(tasks);
56
58
  }
@@ -211,10 +213,15 @@ function getAdpCloudCustomTasks(config) {
211
213
  };
212
214
  }
213
215
  else {
216
+ const customConfig = config.customConfig?.adp;
217
+ const isCloudProjectInPrivateCloudSystem = customConfig?.projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY &&
218
+ customConfig.supportedProject === source_1.SupportedProject.CLOUD_READY_AND_ON_PREM;
219
+ const client = isCloudProjectInPrivateCloudSystem ? config.target.client : undefined;
214
220
  target = {
215
221
  url: config.target.url ?? VSCODE_URL,
216
222
  authenticationType: config.target.authenticationType,
217
- ignoreCertErrors: false
223
+ ignoreCertErrors: false,
224
+ client
218
225
  };
219
226
  }
220
227
  const configuration = {
@@ -1,6 +1,6 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
2
  import type { Manifest, Package } from '@sap-ux/project-access';
3
- import type { AbapServiceProvider, KeyUserChangeContent } from '@sap-ux/axios-extension';
3
+ import { type AbapServiceProvider, AdaptationProjectType, type KeyUserChangeContent } from '@sap-ux/axios-extension';
4
4
  import type { AdpWriterConfig, AttributesAnswers, CfAdpWriterConfig, ConfigAnswers, CreateCfConfigParams, UI5Version } from '../types';
5
5
  import { FlexLayer } from '../types';
6
6
  export interface ConfigOptions {
@@ -36,6 +36,10 @@ export interface ConfigOptions {
36
36
  * The application manifest.
37
37
  */
38
38
  manifest: Manifest | undefined;
39
+ /**
40
+ * The Adaptation project type.
41
+ */
42
+ projectType?: AdaptationProjectType;
39
43
  /**
40
44
  * Logger instance for debugging and error reporting.
41
45
  */
@@ -4,10 +4,12 @@ exports.getConfig = getConfig;
4
4
  exports.getUi5Config = getUi5Config;
5
5
  exports.getCfConfig = getCfConfig;
6
6
  const node_path_1 = require("node:path");
7
+ const axios_extension_1 = require("@sap-ux/axios-extension");
7
8
  const ui5_1 = require("../ui5");
8
9
  const abap_1 = require("../abap");
9
10
  const types_1 = require("../types");
10
11
  const i18n_1 = require("../i18n");
12
+ const source_1 = require("../source");
11
13
  /**
12
14
  * Generates the configuration object for the Adaptation Project.
13
15
  *
@@ -22,13 +24,13 @@ const i18n_1 = require("../i18n");
22
24
  * @returns {Promise<AdpWriterConfig>} A promise that resolves to the generated ADP writer configuration.
23
25
  */
24
26
  async function getConfig(options) {
25
- const { configAnswers, attributeAnswers, layer, logger, packageJson, provider, publicVersions, systemVersion, manifest, toolsId, keyUserChanges } = options;
27
+ const { configAnswers, attributeAnswers, layer, logger, packageJson, provider, publicVersions, systemVersion, manifest, projectType, toolsId, keyUserChanges } = options;
26
28
  const ato = await provider.getAtoInfo();
27
29
  const operationsType = ato.operationsType ?? 'P';
28
30
  const target = await (0, abap_1.getProviderConfig)(configAnswers.system, logger);
29
- const isCloudProject = await provider.isAbapCloud();
31
+ const isCloudSystem = await provider.isAbapCloud();
30
32
  const isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
31
- const ui5Version = isCloudProject
33
+ const ui5Version = isCloudSystem
32
34
  ? (0, ui5_1.getLatestVersion)(publicVersions)
33
35
  : (0, ui5_1.getVersionToBeUsed)(attributeAnswers.ui5Version, isCustomerBase, publicVersions);
34
36
  const { namespace, title, enableTypeScript } = attributeAnswers;
@@ -42,7 +44,8 @@ async function getConfig(options) {
42
44
  ach,
43
45
  fioriId
44
46
  };
45
- if (isCloudProject) {
47
+ const supportedProject = await (0, source_1.getSupportedProject)(provider);
48
+ if (projectType === axios_extension_1.AdaptationProjectType.CLOUD_READY) {
46
49
  const lrep = provider.getLayeredRepository();
47
50
  const { activeLanguages: languages } = await lrep.getSystemInfo();
48
51
  Object.assign(app, {
@@ -61,7 +64,9 @@ async function getConfig(options) {
61
64
  id: packageJson.name ?? '',
62
65
  version: packageJson.version ?? '',
63
66
  toolsId
64
- }
67
+ },
68
+ projectType,
69
+ supportedProject
65
70
  }
66
71
  },
67
72
  target,
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.63",
12
+ "version": "0.18.66",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -36,18 +36,18 @@
36
36
  "prompts": "2.4.2",
37
37
  "sanitize-filename": "1.6.3",
38
38
  "uuid": "10.0.0",
39
- "@sap-ux/axios-extension": "1.25.11",
40
- "@sap-ux/btp-utils": "1.1.8",
39
+ "@sap-ux/axios-extension": "1.25.14",
40
+ "@sap-ux/btp-utils": "1.1.9",
41
41
  "@sap-ux/i18n": "0.3.7",
42
- "@sap-ux/inquirer-common": "0.11.5",
42
+ "@sap-ux/inquirer-common": "0.11.8",
43
43
  "@sap-ux/logger": "0.8.1",
44
- "@sap-ux/nodejs-utils": "0.2.14",
45
- "@sap-ux/odata-service-writer": "0.29.18",
46
- "@sap-ux/project-access": "1.35.3",
47
- "@sap-ux/project-input-validator": "0.6.55",
44
+ "@sap-ux/nodejs-utils": "0.2.15",
45
+ "@sap-ux/odata-service-writer": "0.29.20",
46
+ "@sap-ux/project-access": "1.35.5",
47
+ "@sap-ux/project-input-validator": "0.6.57",
48
48
  "@sap-ux/store": "1.5.6",
49
- "@sap-ux/system-access": "0.6.51",
50
- "@sap-ux/ui5-config": "0.29.16",
49
+ "@sap-ux/system-access": "0.6.54",
50
+ "@sap-ux/ui5-config": "0.29.17",
51
51
  "@sap-ux/ui5-info": "0.13.12"
52
52
  },
53
53
  "devDependencies": {