@sap-ux/adp-tooling 0.13.44 → 0.13.45

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.
@@ -8,6 +8,7 @@ export declare const SNAPSHOT_VERSION = "snapshot";
8
8
  export declare const SNAPSHOT_UNTESTED_VERSION = "snapshot-untested";
9
9
  export declare const RESOURCE_BUNDLE_TEXT = "\n\n# This is the resource bundle for ";
10
10
  export declare const TRANSLATION_UUID_TEXT = "\n#__ldi.translation.uuid=";
11
+ export declare const MAIN_I18N_PATH = "i18n/i18n.properties";
11
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.";
12
13
  export declare const S4HANA_APPS_PARAMS: {
13
14
  'sap.app/type': string;
@@ -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.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.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;
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';
@@ -11,6 +11,7 @@ exports.SNAPSHOT_VERSION = 'snapshot';
11
11
  exports.SNAPSHOT_UNTESTED_VERSION = 'snapshot-untested';
12
12
  exports.RESOURCE_BUNDLE_TEXT = '\n\n# This is the resource bundle for ';
13
13
  exports.TRANSLATION_UUID_TEXT = '\n#__ldi.translation.uuid=';
14
+ exports.MAIN_I18N_PATH = 'i18n/i18n.properties';
14
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.';
15
16
  exports.S4HANA_APPS_PARAMS = {
16
17
  'sap.app/type': 'application',
@@ -1,8 +1,7 @@
1
- import type { CustomConfig, AdpWriterConfig } from '../types';
2
- import type { AbapTarget } from '@sap-ux/system-access';
3
1
  import type { Logger } from '@sap-ux/logger';
4
- import type { UI5FlexLayer } from '@sap-ux/project-access';
2
+ import type { AbapTarget } from '@sap-ux/system-access';
5
3
  import type { AppIndex } from '@sap-ux/axios-extension';
4
+ import { type CustomConfig, type AdpWriterConfig, FlexLayer } from '../types';
6
5
  export type PromptDefaults = {
7
6
  id?: string;
8
7
  reference?: string;
@@ -31,7 +30,7 @@ export declare function promptGeneratorInput(defaults: PromptDefaults | undefine
31
30
  */
32
31
  export declare function promptTarget(defaults: PromptDefaults, logger: Logger): Promise<{
33
32
  apps: AppIndex;
34
- layer: UI5FlexLayer;
33
+ layer: FlexLayer;
35
34
  target: AbapTarget;
36
35
  customConfig: CustomConfig;
37
36
  }>;
@@ -167,7 +167,7 @@ async function fetchSystemInformation(target, ignoreCertErrors, logger) {
167
167
  }, true, logger);
168
168
  logger.info('Fetching system information...');
169
169
  const ato = await provider.getAtoInfo();
170
- const layer = ato.tenantType === 'SAP' ? 'VENDOR' : 'CUSTOMER_BASE';
170
+ const layer = ato.tenantType === 'SAP' ? "VENDOR" /* FlexLayer.VENDOR */ : "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
171
171
  const packageJson = (0, project_utils_1.getPackageJSONInfo)();
172
172
  const customConfig = {
173
173
  adp: {
package/dist/index.d.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  export * from './types';
2
2
  export * from './prompts';
3
3
  export * from './common';
4
+ export * from './abap';
5
+ export * from './source';
6
+ export * from './ui5';
4
7
  export * from './base/cf';
8
+ export * from './base/helper';
5
9
  export * from './base/constants';
6
10
  export * from './base/project-builder';
7
11
  export * from './base/abap/manifest-service';
8
- export * from './base/helper';
9
- export * from './abap';
10
- export * from './source';
12
+ export { promptGeneratorInput, PromptDefaults } from './base/prompt';
11
13
  export * from './preview/adp-preview';
14
+ export * from './writer/manifest';
12
15
  export * from './writer/writer-config';
13
- export * from './writer/descriptor-content';
14
- export * from './ui5';
15
- export { getCustomConfig } from './writer/project-utils';
16
16
  export { generate, migrate } from './writer';
17
17
  export { generateChange } from './writer/editors';
18
+ export { getCustomConfig } from './writer/project-utils';
18
19
  export { generateInboundConfig } from './writer/inbound-navigation';
19
- export { promptGeneratorInput, PromptDefaults } from './base/prompt';
20
20
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -14,30 +14,30 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.promptGeneratorInput = exports.generateInboundConfig = exports.generateChange = exports.migrate = exports.generate = exports.getCustomConfig = void 0;
17
+ exports.generateInboundConfig = exports.getCustomConfig = exports.generateChange = exports.migrate = exports.generate = exports.promptGeneratorInput = void 0;
18
18
  __exportStar(require("./types"), exports);
19
19
  __exportStar(require("./prompts"), exports);
20
20
  __exportStar(require("./common"), exports);
21
+ __exportStar(require("./abap"), exports);
22
+ __exportStar(require("./source"), exports);
23
+ __exportStar(require("./ui5"), exports);
21
24
  __exportStar(require("./base/cf"), exports);
25
+ __exportStar(require("./base/helper"), exports);
22
26
  __exportStar(require("./base/constants"), exports);
23
27
  __exportStar(require("./base/project-builder"), exports);
24
28
  __exportStar(require("./base/abap/manifest-service"), exports);
25
- __exportStar(require("./base/helper"), exports);
26
- __exportStar(require("./abap"), exports);
27
- __exportStar(require("./source"), exports);
29
+ var prompt_1 = require("./base/prompt");
30
+ Object.defineProperty(exports, "promptGeneratorInput", { enumerable: true, get: function () { return prompt_1.promptGeneratorInput; } });
28
31
  __exportStar(require("./preview/adp-preview"), exports);
32
+ __exportStar(require("./writer/manifest"), exports);
29
33
  __exportStar(require("./writer/writer-config"), exports);
30
- __exportStar(require("./writer/descriptor-content"), exports);
31
- __exportStar(require("./ui5"), exports);
32
- var project_utils_1 = require("./writer/project-utils");
33
- Object.defineProperty(exports, "getCustomConfig", { enumerable: true, get: function () { return project_utils_1.getCustomConfig; } });
34
34
  var writer_1 = require("./writer");
35
35
  Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return writer_1.generate; } });
36
36
  Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return writer_1.migrate; } });
37
37
  var editors_1 = require("./writer/editors");
38
38
  Object.defineProperty(exports, "generateChange", { enumerable: true, get: function () { return editors_1.generateChange; } });
39
+ var project_utils_1 = require("./writer/project-utils");
40
+ Object.defineProperty(exports, "getCustomConfig", { enumerable: true, get: function () { return project_utils_1.getCustomConfig; } });
39
41
  var inbound_navigation_1 = require("./writer/inbound-navigation");
40
42
  Object.defineProperty(exports, "generateInboundConfig", { enumerable: true, get: function () { return inbound_navigation_1.generateInboundConfig; } });
41
- var prompt_1 = require("./base/prompt");
42
- Object.defineProperty(exports, "promptGeneratorInput", { enumerable: true, get: function () { return prompt_1.promptGeneratorInput; } });
43
43
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
2
  import type { Manifest } from '@sap-ux/project-access';
3
3
  import type { AbapServiceProvider } from '@sap-ux/axios-extension';
4
+ import { ApplicationType } from '../types';
4
5
  /**
5
6
  * Evaluates whether the application described by the manifest is a SAP Fiori Elements version 4 application.
6
7
  *
@@ -22,6 +23,21 @@ export declare function getFioriId(manifest: Manifest | undefined): string;
22
23
  * @returns {Promise<string>} The ACH code as a string if available, otherwise an empty string.
23
24
  */
24
25
  export declare function getAch(manifest: Manifest | undefined): string;
26
+ /**
27
+ * Determines the type of UI5 application based on the content of its manifest file.
28
+ * This function checks various properties within the manifest to classify the application
29
+ * into predefined types such as Fiori Elements, Fiori Elements OVP, Free Style, or None.
30
+ *
31
+ * @param {Manifest} manifest - The manifest configuration object of the application.
32
+ * @returns {ApplicationType} The type of the application as defined by the ApplicationType enum.
33
+ *
34
+ * The classification is done based on the presence and values of specific keys in the manifest:
35
+ * - 'sap.ovp' indicates a Fiori Elements Overview Page (OVP).
36
+ * - 'sap.ui.generic.app' or 'sap.app' with a specific sourceTemplate id indicates a Fiori Elements application.
37
+ * - If none of these conditions are met, the function defaults to categorizing the application as Free Style.
38
+ * - If the manifest is empty, it returns None.
39
+ */
40
+ export declare function getApplicationType(manifest?: Manifest): ApplicationType;
25
41
  /**
26
42
  * Checks if views are loaded synchronously or asynchronously in the UI5 settings of the manifest.
27
43
  * Sets the isAppSync property based on the loading method.
@@ -4,8 +4,10 @@ exports.SourceManifest = void 0;
4
4
  exports.isV4Application = isV4Application;
5
5
  exports.getFioriId = getFioriId;
6
6
  exports.getAch = getAch;
7
+ exports.getApplicationType = getApplicationType;
7
8
  exports.isSyncLoadedView = isSyncLoadedView;
8
9
  const i18n_1 = require("../i18n");
10
+ const types_1 = require("../types");
9
11
  /**
10
12
  * Evaluates whether the application described by the manifest is a SAP Fiori Elements version 4 application.
11
13
  *
@@ -33,6 +35,34 @@ function getFioriId(manifest) {
33
35
  function getAch(manifest) {
34
36
  return manifest?.['sap.app']?.ach?.toString() ?? '';
35
37
  }
38
+ /**
39
+ * Determines the type of UI5 application based on the content of its manifest file.
40
+ * This function checks various properties within the manifest to classify the application
41
+ * into predefined types such as Fiori Elements, Fiori Elements OVP, Free Style, or None.
42
+ *
43
+ * @param {Manifest} manifest - The manifest configuration object of the application.
44
+ * @returns {ApplicationType} The type of the application as defined by the ApplicationType enum.
45
+ *
46
+ * The classification is done based on the presence and values of specific keys in the manifest:
47
+ * - 'sap.ovp' indicates a Fiori Elements Overview Page (OVP).
48
+ * - 'sap.ui.generic.app' or 'sap.app' with a specific sourceTemplate id indicates a Fiori Elements application.
49
+ * - If none of these conditions are met, the function defaults to categorizing the application as Free Style.
50
+ * - If the manifest is empty, it returns None.
51
+ */
52
+ function getApplicationType(manifest) {
53
+ if (!manifest || Object.keys(manifest).length === 0) {
54
+ return types_1.ApplicationType.NONE;
55
+ }
56
+ if (manifest['sap.ovp']) {
57
+ return types_1.ApplicationType.FIORI_ELEMENTS_OVP;
58
+ }
59
+ const isSmartTemplate = !!manifest['sap.ui.generic.app'];
60
+ const hasSmartTemplateId = manifest['sap.app']?.sourceTemplate?.id?.toLowerCase() === 'ui5template.smarttemplate';
61
+ if (hasSmartTemplateId || isSmartTemplate) {
62
+ return types_1.ApplicationType.FIORI_ELEMENTS;
63
+ }
64
+ return types_1.ApplicationType.FREE_STYLE;
65
+ }
36
66
  /**
37
67
  * Checks if views are loaded synchronously or asynchronously in the UI5 settings of the manifest.
38
68
  * Sets the isAppSync property based on the loading method.
@@ -68,7 +68,7 @@
68
68
  "errorInputInvalidValuePrefix": "{{value}} should start with '{{prefix}}'",
69
69
  "errorCustomerEmptyValue": "{{value}} should contain at least one character in addition to '{{prefix}}'",
70
70
  "errorInvalidDataSourceURI": "Invalid URI. The URI must start and end with '/' and contain no spaces.",
71
- "appDoesNotSupportManifest": "The selected application is not supported by the adaptation project. Please select a different application. For more information, see SAPUI5 Adaptation Project documentation.",
71
+ "appDoesNotSupportManifest": "The selected application is not supported by SAPUI5 Adaptation Project as it does not have a manifest.json file. Please select a different application.",
72
72
  "ui5VersionNotReachableError": "The URL of the SAPUI5 version you have selected is not reachable. The URL <URL> should be made accessible through cloud connector and the destination configuration so it can be consumed within the SAPUI5 adaptation project and its SAPUI5 Adaptation Editor.",
73
73
  "ui5VersionOutdatedError": "The SAPUI5 version you have selected is not compatible with the SAPUI5 Adaptation Editor. Please select a different version.",
74
74
  "ui5VersionDoesNotExistGeneric": "An error occurred when validating the SAPUI5 version: {{error}}. Please select a different version.",
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { UI5FlexLayer, ManifestNamespace } from '@sap-ux/project-access';
1
+ import type { UI5FlexLayer, ManifestNamespace, Manifest } 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
4
  import type { OperationsType } from '@sap-ux/axios-extension';
@@ -39,7 +39,7 @@ export interface OnpremApp {
39
39
  id: string;
40
40
  /** Reference associated with the ID of the base application. */
41
41
  reference: string;
42
- layer?: UI5FlexLayer;
42
+ layer?: FlexLayer;
43
43
  fioriId?: string;
44
44
  ach?: string;
45
45
  title?: string;
@@ -47,6 +47,12 @@ export interface OnpremApp {
47
47
  content?: Content[];
48
48
  /** Optional: Description about i18n.properties. */
49
49
  i18nDescription?: string;
50
+ /** Optional: I18n resource models derived from the manifest. */
51
+ i18nModels?: ResourceModel[];
52
+ /** Optional: Application type derived from the manifest. */
53
+ appType?: ApplicationType;
54
+ /** The manifest of the application */
55
+ manifest?: Manifest;
50
56
  }
51
57
  export interface CloudApp extends OnpremApp {
52
58
  /** bspName associated with the ABAP Cloud repository name of the base application. */
@@ -63,6 +69,7 @@ export interface AdpWriterConfig {
63
69
  minVersion?: string;
64
70
  version?: string;
65
71
  frameworkUrl?: string;
72
+ shouldSetMinVersion?: boolean;
66
73
  };
67
74
  package?: {
68
75
  name?: string;
@@ -127,6 +134,18 @@ export interface VersionDetail {
127
134
  support: string;
128
135
  lts: boolean;
129
136
  }
137
+ export interface ResourceModel {
138
+ key: string;
139
+ path: string;
140
+ content?: string;
141
+ }
142
+ export interface SapModel {
143
+ type?: string;
144
+ uri?: string;
145
+ settings?: {
146
+ bundleName?: string;
147
+ };
148
+ }
130
149
  export interface Endpoint extends Partial<Destination> {
131
150
  Name: string;
132
151
  Url?: string;
@@ -313,6 +332,12 @@ export type ParameterRules = {
313
332
  */
314
333
  isReference(param: string): ParamCheck;
315
334
  };
335
+ export declare enum ApplicationType {
336
+ FIORI_ELEMENTS = "FioriElements",
337
+ FIORI_ELEMENTS_OVP = "FioriElementsOVP",
338
+ FREE_STYLE = "FreeStyle",
339
+ NONE = ""
340
+ }
316
341
  export declare const enum TemplateFileName {
317
342
  Fragment = "fragment.xml",
318
343
  Controller = "controller.ejs",
package/dist/types.js CHANGED
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangeTypeMap = void 0;
3
+ exports.ChangeTypeMap = exports.ApplicationType = void 0;
4
+ var ApplicationType;
5
+ (function (ApplicationType) {
6
+ ApplicationType["FIORI_ELEMENTS"] = "FioriElements";
7
+ ApplicationType["FIORI_ELEMENTS_OVP"] = "FioriElementsOVP";
8
+ ApplicationType["FREE_STYLE"] = "FreeStyle";
9
+ ApplicationType["NONE"] = "";
10
+ })(ApplicationType || (exports.ApplicationType = ApplicationType = {}));
4
11
  /**
5
12
  * A mapping of ChangeType values to their respective change names.
6
13
  */
@@ -1,4 +1,6 @@
1
- import { FlexLayer } from '../../types';
1
+ import type { Editor } from 'mem-fs-editor';
2
+ import type { Manifest } from '@sap-ux/project-access';
3
+ import { FlexLayer, type ResourceModel, type SapModel } from '../../types';
2
4
  /**
3
5
  * Generates an internationalization description string for a specific layer within an application.
4
6
  *
@@ -7,4 +9,39 @@ import { FlexLayer } from '../../types';
7
9
  * @returns {string} The internationalization description string.
8
10
  */
9
11
  export declare function getI18nDescription(layer: FlexLayer, appTitle?: string): string;
12
+ /**
13
+ * Writes internationalization (i18n) model files to the specified paths within the project structure.
14
+ *
15
+ * @param {string} basePath - The base path of the project where i18n files are located, typically the root.
16
+ * @param {ResourceModel[]} [i18nModels] - An optional array of i18n models to be written. Each model contains
17
+ * the key, path, and content for an i18n file.
18
+ * @param {Editor} fs - The file system editor interface used for writing files.
19
+
20
+ *
21
+ * This function ensures that:
22
+ * - Only i18n models that are not the main i18n file (`i18n/i18n.properties`) are processed.
23
+ * - Models are written only if they have content and do not match the main i18n path.
24
+ * - The file path for each model is constructed using the provided base path and model's specified path.
25
+ */
26
+ export declare function writeI18nModels(basePath: string, i18nModels: ResourceModel[] | undefined, fs: Editor): void;
27
+ /**
28
+ * Extracts the resource model path from a given UI5 model.
29
+ *
30
+ * @param {SapModel} ui5Model - The UI5 model object.
31
+ * @param {string} modelObjectKey - The key of the model object.
32
+ * @param {string} appId - Application ID.
33
+ * @returns {string} The calculated resource model path.
34
+ */
35
+ export declare function extractResourceModelPath(ui5Model: SapModel, modelObjectKey: string, appId: string): string;
36
+ /**
37
+ * Extracts and constructs resource models from the application manifest based on the specified layer and application information.
38
+ * This function filters out resource models and attaches a generated i18n description, along with the path derived from the model.
39
+ *
40
+ * @param {Manifest| undefined} manifest - The application manifest containing model configurations.
41
+ * @param {FlexLayer} layer - The UI5 Flex layer.
42
+ * @param {string} id - The application identifier.
43
+ * @param {string} [title] - The application title.
44
+ * @returns {ResourceModel[] | undefined} An array of resource models or undefined if no models meet the criteria.
45
+ */
46
+ export declare function getI18nModels(manifest: Manifest | undefined, layer: FlexLayer, id: string, title?: string): ResourceModel[] | undefined;
10
47
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getI18nDescription = getI18nDescription;
4
+ exports.writeI18nModels = writeI18nModels;
5
+ exports.extractResourceModelPath = extractResourceModelPath;
6
+ exports.getI18nModels = getI18nModels;
4
7
  const uuid_1 = require("uuid");
5
8
  const __1 = require("../..");
6
9
  /**
@@ -15,4 +18,79 @@ function getI18nDescription(layer, appTitle) {
15
18
  ? __1.BASE_I18N_DESCRIPTION
16
19
  : __1.BASE_I18N_DESCRIPTION + __1.RESOURCE_BUNDLE_TEXT + appTitle + __1.TRANSLATION_UUID_TEXT + (0, uuid_1.v4)();
17
20
  }
21
+ /**
22
+ * Writes internationalization (i18n) model files to the specified paths within the project structure.
23
+ *
24
+ * @param {string} basePath - The base path of the project where i18n files are located, typically the root.
25
+ * @param {ResourceModel[]} [i18nModels] - An optional array of i18n models to be written. Each model contains
26
+ * the key, path, and content for an i18n file.
27
+ * @param {Editor} fs - The file system editor interface used for writing files.
28
+
29
+ *
30
+ * This function ensures that:
31
+ * - Only i18n models that are not the main i18n file (`i18n/i18n.properties`) are processed.
32
+ * - Models are written only if they have content and do not match the main i18n path.
33
+ * - The file path for each model is constructed using the provided base path and model's specified path.
34
+ */
35
+ function writeI18nModels(basePath, i18nModels, fs) {
36
+ if (!i18nModels?.length) {
37
+ return;
38
+ }
39
+ for (const { key, path, content } of i18nModels) {
40
+ const isMainFile = key === 'i18n' || path === __1.MAIN_I18N_PATH;
41
+ if (!isMainFile && content) {
42
+ const i18nPath = `${basePath}/webapp/${path}`;
43
+ fs.write(i18nPath, content);
44
+ }
45
+ }
46
+ }
47
+ /**
48
+ * Extracts the resource model path from a given UI5 model.
49
+ *
50
+ * @param {SapModel} ui5Model - The UI5 model object.
51
+ * @param {string} modelObjectKey - The key of the model object.
52
+ * @param {string} appId - Application ID.
53
+ * @returns {string} The calculated resource model path.
54
+ */
55
+ function extractResourceModelPath(ui5Model, modelObjectKey, appId) {
56
+ let resourceModelPath = '';
57
+ if (ui5Model?.uri) {
58
+ resourceModelPath = ui5Model.uri;
59
+ }
60
+ else if (ui5Model?.settings) {
61
+ const bundleName = ui5Model.settings?.bundleName;
62
+ if (bundleName?.indexOf(appId) === 0) {
63
+ const fileLocation = bundleName.slice(appId.length, bundleName.length);
64
+ resourceModelPath = fileLocation.replace(/\./g, '/').substring(1, fileLocation.length) + '.properties';
65
+ }
66
+ else {
67
+ resourceModelPath = `i18n/${modelObjectKey}.properties`;
68
+ }
69
+ }
70
+ return resourceModelPath;
71
+ }
72
+ /**
73
+ * Extracts and constructs resource models from the application manifest based on the specified layer and application information.
74
+ * This function filters out resource models and attaches a generated i18n description, along with the path derived from the model.
75
+ *
76
+ * @param {Manifest| undefined} manifest - The application manifest containing model configurations.
77
+ * @param {FlexLayer} layer - The UI5 Flex layer.
78
+ * @param {string} id - The application identifier.
79
+ * @param {string} [title] - The application title.
80
+ * @returns {ResourceModel[] | undefined} An array of resource models or undefined if no models meet the criteria.
81
+ */
82
+ function getI18nModels(manifest, layer, id, title) {
83
+ if (!manifest) {
84
+ return undefined;
85
+ }
86
+ const models = manifest['sap.ui5']?.models ?? {};
87
+ return Object.entries(models).reduce((acc, [key, ui5Model]) => {
88
+ if (ui5Model?.type === 'sap.ui.model.resource.ResourceModel') {
89
+ const content = getI18nDescription(layer, title);
90
+ const path = extractResourceModelPath(ui5Model, key, id);
91
+ acc.push({ key, path, content });
92
+ }
93
+ return acc;
94
+ }, []);
95
+ }
18
96
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { type Editor } from 'mem-fs-editor';
2
- import type { AdpWriterConfig } from '../types';
2
+ import { type AdpWriterConfig } from '../types';
3
3
  /**
4
4
  * Writes the adp-project template to the mem-fs-editor instance.
5
5
  *
@@ -5,8 +5,11 @@ exports.migrate = migrate;
5
5
  const path_1 = require("path");
6
6
  const mem_fs_1 = require("mem-fs");
7
7
  const mem_fs_editor_1 = require("mem-fs-editor");
8
+ const manifest_1 = require("./manifest");
8
9
  const options_1 = require("./options");
10
+ const i18n_1 = require("./i18n");
9
11
  const project_utils_1 = require("./project-utils");
12
+ const source_1 = require("../source");
10
13
  const baseTmplPath = (0, path_1.join)(__dirname, '../../templates');
11
14
  /**
12
15
  * Set default values for optional properties.
@@ -25,14 +28,21 @@ function setDefaults(config) {
25
28
  customConfig: config.customConfig ? { ...config.customConfig } : undefined
26
29
  };
27
30
  configWithDefaults.app.title ??= `Adaptation of ${config.app.reference}`;
28
- configWithDefaults.app.layer ??= 'CUSTOMER_BASE';
31
+ configWithDefaults.app.layer ??= "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
29
32
  configWithDefaults.package ??= config.package ? { ...config.package } : {};
30
33
  configWithDefaults.package.name ??= config.app.id.toLowerCase().replace(/\./g, '-');
31
34
  configWithDefaults.package.description ??= configWithDefaults.app.title;
35
+ configWithDefaults.app.i18nModels ??= (0, i18n_1.getI18nModels)(configWithDefaults.app.manifest, configWithDefaults.app.layer, configWithDefaults.app.reference, configWithDefaults.app.title);
36
+ configWithDefaults.app.i18nDescription ??= (0, i18n_1.getI18nDescription)(configWithDefaults.app.layer, configWithDefaults.app.title);
37
+ configWithDefaults.app.appType ??= (0, source_1.getApplicationType)(configWithDefaults.app.manifest);
38
+ configWithDefaults.app.content ??= (0, manifest_1.getManifestContent)(configWithDefaults);
32
39
  if (configWithDefaults.flp && !configWithDefaults.flp.inboundId) {
33
40
  configWithDefaults.flp.addInboundId = true;
34
41
  configWithDefaults.flp.inboundId = `${configWithDefaults.app.id}.InboundID`;
35
42
  }
43
+ if (configWithDefaults.customConfig?.adp.environment === 'C' && configWithDefaults.flp) {
44
+ (0, options_1.enhanceManifestChangeContentWithFlpConfig)(configWithDefaults.flp, configWithDefaults.app.id, configWithDefaults.app.content);
45
+ }
36
46
  return configWithDefaults;
37
47
  }
38
48
  /**
@@ -48,9 +58,7 @@ async function generate(basePath, config, fs) {
48
58
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
49
59
  }
50
60
  const fullConfig = setDefaults(config);
51
- if (fullConfig.customConfig?.adp.environment === 'C' && fullConfig.flp) {
52
- (0, options_1.enhanceManifestChangeContentWithFlpConfig)(fullConfig.flp, fullConfig.app.id, fullConfig.app.content);
53
- }
61
+ (0, i18n_1.writeI18nModels)(basePath, fullConfig.app.i18nModels, fs);
54
62
  (0, project_utils_1.writeTemplateToFolder)(baseTmplPath, (0, path_1.join)(basePath), fullConfig, fs);
55
63
  await (0, project_utils_1.writeUI5DeployYaml)(basePath, fullConfig, fs);
56
64
  await (0, project_utils_1.writeUI5Yaml)(basePath, fullConfig, fs);
@@ -0,0 +1,50 @@
1
+ import { ApplicationType } from '../../types';
2
+ import type { Content, AdpWriterConfig, ResourceModel } from '../../types';
3
+ /**
4
+ * Creates a descriptor change object for a resource model.
5
+ *
6
+ * @param {string} modelId - The identifier for the model.
7
+ * @param {string} path - The path to the resource bundle or i18n properties file.
8
+ * @param {ApplicationType} type - The type of the application (e.g., FREE_STYLE, FIORI_ELEMENTS, etc.).
9
+ * @param {string} ui5Version - The UI5 version to check for feature support.
10
+ * @returns {Content} The descriptor change content object structured according to the UI5 enhancement specifications.
11
+ *
12
+ * This function checks if the 'fallbackLocale' feature is supported from UI5 version 1.84.0 onwards.
13
+ * If supported and the application type is FREE_STYLE, it includes specific properties for localization.
14
+ * Otherwise, it prepares a standard model enhancement structure.
15
+ */
16
+ export declare function createDescriptorChangeForResourceModel(modelId: string, path: string, type?: ApplicationType, ui5Version?: string): Content;
17
+ /**
18
+ * Populates a content array with descriptor changes for each resource model provided.
19
+ *
20
+ * @param {Content[]} content - The array to be filled with descriptor change objects.
21
+ * @param {ApplicationType} type - The type of the application (e.g., FREE_STYLE, FIORI_ELEMENTS, etc.).
22
+ * @param {string} systemVersion - The UI5 system version used to determine feature support.
23
+ * @param {ResourceModel[]} [i18nModels] - Optional array of resource models from which to create descriptor changes.
24
+ *
25
+ * Each descriptor change is generated based on the provided system version and application type,
26
+ * taking into account whether certain UI5 features are supported.
27
+ */
28
+ export declare function fillDescriptorContent(content: Content[], type?: ApplicationType, systemVersion?: string, i18nModels?: ResourceModel[]): void;
29
+ /**
30
+ * Adds support data entries for Fiori registration IDs and application component hierarchy (ACH) to a content array.
31
+ *
32
+ * @param {Content[]} content - The array to which support data entries will be added.
33
+ * @param {string} [fioriId] - The Fiori ID to set in the registration.
34
+ * @param {string} [ach] - The application component hierarchy code, which will be converted to uppercase.
35
+ */
36
+ export declare function fillSupportData(content: Content[], fioriId?: string, ach?: string): void;
37
+ /**
38
+ * Generates an array of content objects for a `manifest.appdescr_variant` file based on the application configuration.
39
+ * This function populates descriptor content and, depending on the application layer, may include additional
40
+ * support data. It also handles setting the minimum UI5 version if specified in the configuration.
41
+ *
42
+ * @param {AdpWriterConfig} config - Configuration object containing application and UI5 specific settings.
43
+ * `app` contains properties like application type, layer, and identifiers.
44
+ * `ui5` may include version details and flags for setting minimum UI5 version.
45
+ * @returns {Content[]} An array of content objects for the application manifest. Each object describes a specific
46
+ * change or setting necessary for the application configuration, such as setting minimum UI5 version,
47
+ * updating title, or adding support data.
48
+ */
49
+ export declare function getManifestContent(config: AdpWriterConfig): Content[];
50
+ //# sourceMappingURL=descriptor-content.d.ts.map
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDescriptorChangeForResourceModel = createDescriptorChangeForResourceModel;
4
+ exports.fillDescriptorContent = fillDescriptorContent;
5
+ exports.fillSupportData = fillSupportData;
6
+ exports.getManifestContent = getManifestContent;
7
+ const ui5_1 = require("../../ui5");
8
+ const types_1 = require("../../types");
9
+ /**
10
+ * Creates a descriptor change object for a resource model.
11
+ *
12
+ * @param {string} modelId - The identifier for the model.
13
+ * @param {string} path - The path to the resource bundle or i18n properties file.
14
+ * @param {ApplicationType} type - The type of the application (e.g., FREE_STYLE, FIORI_ELEMENTS, etc.).
15
+ * @param {string} ui5Version - The UI5 version to check for feature support.
16
+ * @returns {Content} The descriptor change content object structured according to the UI5 enhancement specifications.
17
+ *
18
+ * This function checks if the 'fallbackLocale' feature is supported from UI5 version 1.84.0 onwards.
19
+ * If supported and the application type is FREE_STYLE, it includes specific properties for localization.
20
+ * Otherwise, it prepares a standard model enhancement structure.
21
+ */
22
+ function createDescriptorChangeForResourceModel(modelId, path, type, ui5Version) {
23
+ const fallbackLocaleSupported = (0, ui5_1.isFeatureSupportedVersion)('1.84.0', ui5Version);
24
+ if (type === types_1.ApplicationType.FREE_STYLE && fallbackLocaleSupported) {
25
+ return {
26
+ changeType: 'appdescr_ui5_addNewModelEnhanceWith',
27
+ content: {
28
+ modelId,
29
+ bundleUrl: path,
30
+ supportedLocales: [''],
31
+ fallbackLocale: ''
32
+ }
33
+ };
34
+ }
35
+ return {
36
+ changeType: 'appdescr_ui5_addNewModelEnhanceWith',
37
+ content: {
38
+ modelId
39
+ },
40
+ texts: {
41
+ 'i18n': path
42
+ }
43
+ };
44
+ }
45
+ /**
46
+ * Populates a content array with descriptor changes for each resource model provided.
47
+ *
48
+ * @param {Content[]} content - The array to be filled with descriptor change objects.
49
+ * @param {ApplicationType} type - The type of the application (e.g., FREE_STYLE, FIORI_ELEMENTS, etc.).
50
+ * @param {string} systemVersion - The UI5 system version used to determine feature support.
51
+ * @param {ResourceModel[]} [i18nModels] - Optional array of resource models from which to create descriptor changes.
52
+ *
53
+ * Each descriptor change is generated based on the provided system version and application type,
54
+ * taking into account whether certain UI5 features are supported.
55
+ */
56
+ function fillDescriptorContent(content, type, systemVersion, i18nModels) {
57
+ if (i18nModels) {
58
+ i18nModels.forEach((i18nModel) => {
59
+ content.push(createDescriptorChangeForResourceModel(i18nModel.key, i18nModel.path, type, systemVersion));
60
+ });
61
+ }
62
+ }
63
+ /**
64
+ * Adds support data entries for Fiori registration IDs and application component hierarchy (ACH) to a content array.
65
+ *
66
+ * @param {Content[]} content - The array to which support data entries will be added.
67
+ * @param {string} [fioriId] - The Fiori ID to set in the registration.
68
+ * @param {string} [ach] - The application component hierarchy code, which will be converted to uppercase.
69
+ */
70
+ function fillSupportData(content, fioriId, ach) {
71
+ if (fioriId) {
72
+ content.push({
73
+ changeType: 'appdescr_fiori_setRegistrationIds',
74
+ content: {
75
+ registrationIds: [fioriId]
76
+ }
77
+ });
78
+ }
79
+ if (ach) {
80
+ content.push({
81
+ changeType: 'appdescr_app_setAch',
82
+ content: {
83
+ ach: ach?.toUpperCase()
84
+ }
85
+ });
86
+ }
87
+ }
88
+ /**
89
+ * Generates an array of content objects for a `manifest.appdescr_variant` file based on the application configuration.
90
+ * This function populates descriptor content and, depending on the application layer, may include additional
91
+ * support data. It also handles setting the minimum UI5 version if specified in the configuration.
92
+ *
93
+ * @param {AdpWriterConfig} config - Configuration object containing application and UI5 specific settings.
94
+ * `app` contains properties like application type, layer, and identifiers.
95
+ * `ui5` may include version details and flags for setting minimum UI5 version.
96
+ * @returns {Content[]} An array of content objects for the application manifest. Each object describes a specific
97
+ * change or setting necessary for the application configuration, such as setting minimum UI5 version,
98
+ * updating title, or adding support data.
99
+ */
100
+ function getManifestContent(config) {
101
+ const { app, ui5 } = config;
102
+ const { ach, fioriId, appType, layer, i18nModels } = app;
103
+ const isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
104
+ const content = [];
105
+ fillDescriptorContent(content, appType, ui5?.version, i18nModels);
106
+ if (!isCustomerBase) {
107
+ fillSupportData(content, fioriId, ach);
108
+ }
109
+ if (ui5?.shouldSetMinVersion) {
110
+ content.push({
111
+ changeType: 'appdescr_ui5_setMinUI5Version',
112
+ content: {
113
+ minUI5Version: ui5?.minVersion
114
+ }
115
+ });
116
+ }
117
+ content.push({
118
+ changeType: 'appdescr_app_setTitle',
119
+ content: {},
120
+ texts: {
121
+ i18n: 'i18n/i18n.properties'
122
+ }
123
+ });
124
+ return content;
125
+ }
126
+ //# sourceMappingURL=descriptor-content.js.map
@@ -0,0 +1,2 @@
1
+ export * from './descriptor-content';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./descriptor-content"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -115,6 +115,13 @@ function addFioriToolsMiddlewares(ui5Config, config) {
115
115
  const backendConfig = { ...config.target };
116
116
  backendConfig.url ??= VSCODE_URL;
117
117
  backendConfig.path = '/sap';
118
+ const ui5ConfigOptions = {
119
+ url: config?.ui5?.frameworkUrl
120
+ };
121
+ const version = config?.ui5?.version;
122
+ if (version) {
123
+ ui5ConfigOptions.version = version;
124
+ }
118
125
  ui5Config.addFioriToolsAppReloadMiddleware();
119
126
  ui5Config.addCustomMiddleware([
120
127
  {
@@ -129,10 +136,7 @@ function addFioriToolsMiddlewares(ui5Config, config) {
129
136
  }
130
137
  ]);
131
138
  ui5Config.addFioriToolsProxydMiddleware({
132
- ui5: {
133
- url: config?.ui5?.frameworkUrl,
134
- version: config?.ui5?.minVersion ?? '' //default to latest if version is not set
135
- },
139
+ ui5: ui5ConfigOptions,
136
140
  backend: [backendConfig]
137
141
  }, 'fiori-tools-preview');
138
142
  }
@@ -1,9 +1,9 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { Package } from '@sap-ux/project-access';
2
+ import type { Manifest, Package } from '@sap-ux/project-access';
3
3
  import type { AbapServiceProvider } from '@sap-ux/axios-extension';
4
4
  import { FlexLayer } from '../types';
5
5
  import type { AdpWriterConfig, AttributesAnswers, ConfigAnswers, UI5Version } from '../types';
6
- interface ConfigOptions {
6
+ export interface ConfigOptions {
7
7
  /**
8
8
  * The ABAP service provider instance used to retrieve system-specific information.
9
9
  */
@@ -32,6 +32,10 @@ interface ConfigOptions {
32
32
  * System UI5 Version.
33
33
  */
34
34
  systemVersion: string | undefined;
35
+ /**
36
+ * The application manifest.
37
+ */
38
+ manifest: Manifest | undefined;
35
39
  /**
36
40
  * Logger instance for debugging and error reporting.
37
41
  */
@@ -51,5 +55,13 @@ interface ConfigOptions {
51
55
  * @returns {Promise<AdpWriterConfig>} A promise that resolves to the generated ADP writer configuration.
52
56
  */
53
57
  export declare function getConfig(options: ConfigOptions): Promise<AdpWriterConfig>;
54
- export {};
58
+ /**
59
+ * Generates the configuration details required for a SAPUI5 application based on system and selected UI5 versions.
60
+ *
61
+ * @param {string} ui5Version - The selected UI5 version.
62
+ * @param {UI5Version} publicVersions - The publicly available UI5 versions.
63
+ * @param {string | undefined} systemVersion - The SAPUI5 version detected on the target system.
64
+ * @returns {AdpWriterConfig['ui5']} An object containing the required UI5 configuration for the writer config.
65
+ */
66
+ export declare function getUi5Config(ui5Version: string, publicVersions: UI5Version, systemVersion: string | undefined): AdpWriterConfig['ui5'];
55
67
  //# sourceMappingURL=writer-config.d.ts.map
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getConfig = getConfig;
4
+ exports.getUi5Config = getUi5Config;
5
+ const ui5_1 = require("../ui5");
4
6
  const abap_1 = require("../abap");
5
- const i18n_1 = require("./i18n");
6
7
  const project_utils_1 = require("./project-utils");
7
- const descriptor_content_1 = require("./descriptor-content");
8
- const ui5_1 = require("../ui5");
9
8
  /**
10
9
  * Generates the configuration object for the Adaptation Project.
11
10
  *
@@ -20,7 +19,7 @@ const ui5_1 = require("../ui5");
20
19
  * @returns {Promise<AdpWriterConfig>} A promise that resolves to the generated ADP writer configuration.
21
20
  */
22
21
  async function getConfig(options) {
23
- const { configAnswers, attributeAnswers, layer, logger, packageJson, provider, publicVersions, systemVersion } = options;
22
+ const { configAnswers, attributeAnswers, layer, logger, packageJson, provider, publicVersions, systemVersion, manifest } = options;
24
23
  const ato = await provider.getAtoInfo();
25
24
  const operationsType = ato.operationsType ?? 'P';
26
25
  const target = await (0, abap_1.getProviderConfig)(configAnswers.system, logger);
@@ -37,8 +36,9 @@ async function getConfig(options) {
37
36
  reference: id,
38
37
  layer,
39
38
  title,
40
- content: (0, descriptor_content_1.getManifestContent)(layer, systemVersion, publicVersions, fioriId, ach),
41
- i18nDescription: (0, i18n_1.getI18nDescription)(layer, title)
39
+ manifest,
40
+ ach,
41
+ fioriId
42
42
  };
43
43
  if (isCloudProject) {
44
44
  const lrep = provider.getLayeredRepository();
@@ -48,13 +48,10 @@ async function getConfig(options) {
48
48
  languages
49
49
  });
50
50
  }
51
+ const ui5 = getUi5Config(ui5Version, publicVersions, systemVersion);
51
52
  return {
52
53
  app,
53
- ui5: {
54
- minVersion: ui5Version?.split(' ')?.[0],
55
- version: (0, ui5_1.getFormattedVersion)(ui5Version),
56
- frameworkUrl: (0, ui5_1.getOfficialBaseUI5VersionUrl)(ui5Version)
57
- },
54
+ ui5,
58
55
  customConfig,
59
56
  target,
60
57
  options: {
@@ -63,4 +60,20 @@ async function getConfig(options) {
63
60
  }
64
61
  };
65
62
  }
63
+ /**
64
+ * Generates the configuration details required for a SAPUI5 application based on system and selected UI5 versions.
65
+ *
66
+ * @param {string} ui5Version - The selected UI5 version.
67
+ * @param {UI5Version} publicVersions - The publicly available UI5 versions.
68
+ * @param {string | undefined} systemVersion - The SAPUI5 version detected on the target system.
69
+ * @returns {AdpWriterConfig['ui5']} An object containing the required UI5 configuration for the writer config.
70
+ */
71
+ function getUi5Config(ui5Version, publicVersions, systemVersion) {
72
+ return {
73
+ minVersion: (0, ui5_1.getMinUI5VersionForManifest)(publicVersions, systemVersion),
74
+ version: (0, ui5_1.getFormattedVersion)(ui5Version),
75
+ frameworkUrl: (0, ui5_1.getOfficialBaseUI5VersionUrl)(ui5Version),
76
+ shouldSetMinVersion: (0, ui5_1.shouldSetMinUI5Version)(systemVersion)
77
+ };
78
+ }
66
79
  //# sourceMappingURL=writer-config.js.map
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.13.44",
12
+ "version": "0.13.45",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -6,16 +6,5 @@
6
6
  "id": "<%- app.id %>",
7
7
  "namespace": "apps/<%- app.reference %>/appVariants/<%- app.id %>/",
8
8
  "version": "0.1.0",
9
- "content": [
10
- <%if(app.content){-%><% for(let change of app.content){-%>
11
- <%- JSON.stringify(change, undefined, 4) %><%-","%>
12
- <%}-%><%}-%>
13
- {
14
- "changeType": "appdescr_app_setTitle",
15
- "content": {},
16
- "texts": {
17
- "i18n": "i18n/i18n.properties"
18
- }
19
- }
20
- ]
9
+ "content": <%- JSON.stringify(app.content || [], null, 2).split('\n').map((line, index) => index === 0 ? line : ' ' + line).join('\n') %>
21
10
  }
@@ -1,27 +0,0 @@
1
- import { FlexLayer, type Content, type UI5Version } from '../types';
2
- /**
3
- * Returns a model enhancement change configuration.
4
- *
5
- * @returns {Content} The model change configuration.
6
- */
7
- export declare function getNewModelEnhanceWithChange(): Content;
8
- /**
9
- * Adds support data entries for Fiori registration IDs and application component hierarchy (ACH) to a content array.
10
- *
11
- * @param {Content[]} content - The array to which support data entries will be added.
12
- * @param {string} [fioriId] - The Fiori ID to set in the registration.
13
- * @param {string} [ach] - The application component hierarchy code, which will be converted to uppercase.
14
- */
15
- export declare function fillSupportData(content: Content[], fioriId?: string, ach?: string): void;
16
- /**
17
- * Generates an array of content objects for a `manifest.appdescr_variant` file based on the application configuration.
18
- *
19
- * @param {FlexLayer} layer - The deployment layer of the application (e.g., CUSTOMER_BASE or VENDOR).
20
- * @param {string | undefined} systemVersion - The minimum required SAPUI5 version for the application.
21
- * @param {UI5Version} publicVersions - Publicly available SAPUI5 versions.
22
- * @param {string} [fioriId] - Optional Fiori ID to be added to support information.
23
- * @param {string} [ach] - Optional ACH ID used for support analytics.
24
- * @returns {Content[]} An array of content objects describing descriptor variant changes to be applied to the manifest.
25
- */
26
- export declare function getManifestContent(layer: FlexLayer, systemVersion: string | undefined, publicVersions: UI5Version, fioriId?: string, ach?: string): Content[];
27
- //# sourceMappingURL=descriptor-content.d.ts.map
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNewModelEnhanceWithChange = getNewModelEnhanceWithChange;
4
- exports.fillSupportData = fillSupportData;
5
- exports.getManifestContent = getManifestContent;
6
- const ui5_1 = require("../ui5");
7
- /**
8
- * Returns a model enhancement change configuration.
9
- *
10
- * @returns {Content} The model change configuration.
11
- */
12
- function getNewModelEnhanceWithChange() {
13
- return {
14
- changeType: 'appdescr_ui5_addNewModelEnhanceWith',
15
- content: {
16
- modelId: 'i18n',
17
- bundleUrl: 'i18n/i18n.properties',
18
- supportedLocales: [''],
19
- fallbackLocale: ''
20
- }
21
- };
22
- }
23
- /**
24
- * Adds support data entries for Fiori registration IDs and application component hierarchy (ACH) to a content array.
25
- *
26
- * @param {Content[]} content - The array to which support data entries will be added.
27
- * @param {string} [fioriId] - The Fiori ID to set in the registration.
28
- * @param {string} [ach] - The application component hierarchy code, which will be converted to uppercase.
29
- */
30
- function fillSupportData(content, fioriId, ach) {
31
- if (fioriId) {
32
- content.push({
33
- changeType: 'appdescr_fiori_setRegistrationIds',
34
- content: {
35
- registrationIds: [fioriId]
36
- }
37
- });
38
- }
39
- if (ach) {
40
- content.push({
41
- changeType: 'appdescr_app_setAch',
42
- content: {
43
- ach: ach?.toUpperCase()
44
- }
45
- });
46
- }
47
- }
48
- /**
49
- * Generates an array of content objects for a `manifest.appdescr_variant` file based on the application configuration.
50
- *
51
- * @param {FlexLayer} layer - The deployment layer of the application (e.g., CUSTOMER_BASE or VENDOR).
52
- * @param {string | undefined} systemVersion - The minimum required SAPUI5 version for the application.
53
- * @param {UI5Version} publicVersions - Publicly available SAPUI5 versions.
54
- * @param {string} [fioriId] - Optional Fiori ID to be added to support information.
55
- * @param {string} [ach] - Optional ACH ID used for support analytics.
56
- * @returns {Content[]} An array of content objects describing descriptor variant changes to be applied to the manifest.
57
- */
58
- function getManifestContent(layer, systemVersion, publicVersions, fioriId, ach) {
59
- const isCustomerBase = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */;
60
- const content = [];
61
- if (!isCustomerBase) {
62
- fillSupportData(content, fioriId, ach);
63
- }
64
- if ((0, ui5_1.shouldSetMinUI5Version)(systemVersion)) {
65
- content.push({
66
- changeType: 'appdescr_ui5_setMinUI5Version',
67
- content: {
68
- minUI5Version: (0, ui5_1.getMinUI5VersionForManifest)(publicVersions, systemVersion)
69
- }
70
- });
71
- }
72
- content.push(getNewModelEnhanceWithChange());
73
- return content;
74
- }
75
- //# sourceMappingURL=descriptor-content.js.map