@ui5/task-adaptation 1.6.4-rc.3 → 1.6.5-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.3...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.1...HEAD).
6
+
7
+ <a name="v1.6.5-rc.1"></a>
8
+ ## [v1.6.5-rc.1] - 2026-04-13
6
9
 
7
10
  <a name="v1.6.4-rc.3"></a>
8
11
  ## [v1.6.4-rc.3] - 2026-04-07
@@ -182,6 +185,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
182
185
  <a name="v1.0.0"></a>
183
186
  ## v1.0.0 - 2020-12-09
184
187
 
188
+ [v1.6.5-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.3...v1.6.5-rc.1
185
189
  [v1.6.4-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.2...v1.6.4-rc.3
186
190
  [v1.6.4-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.1...v1.6.4-rc.2
187
191
  [v1.6.4-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.3...v1.6.4-rc.1
package/README.md CHANGED
@@ -27,6 +27,7 @@ For more information, see [Create an Adaptation Project](https://help.sap.com/do
27
27
  > [!NOTE]
28
28
  > For SAP S/4HANA (on-premise) systems, a different builder is used.
29
29
 
30
+
30
31
  ## Branch Structure
31
32
  * `main` (npm `latest`) — The stable version, ready for production use.
32
33
  * `rc` (npm `rc`) — Active development. The code here may be unstable and features are subject to change. Use at your own risk.
@@ -2,10 +2,10 @@ import { IAdapter } from "./adapter.js";
2
2
  import { AdaptCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
3
3
  import BaseApp from "../baseAppManager.js";
4
4
  import AppVariant from "../appVariantManager.js";
5
- import AnnotationManager from "../annotations/annotationManager.js";
5
+ import IAnnotationManager from "../annotations/annotationManager.js";
6
6
  export default class AbapAdapter implements IAdapter {
7
7
  private annotationManager;
8
- constructor(annotationManager: AnnotationManager);
8
+ constructor(annotationManager: IAnnotationManager);
9
9
  createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
10
10
  createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
11
11
  createPostCommandChain(): PostCommandChain;
@@ -0,0 +1,4 @@
1
+ import IAnnotationManager from "./annotationManager.js";
2
+ export default class CFAnnotationManager implements IAnnotationManager {
3
+ process(_baseAppManifest: any, _appVariantId: string, _prefix: string): Promise<Map<string, string>>;
4
+ }
@@ -0,0 +1,7 @@
1
+ export default class CFAnnotationManager {
2
+ async process(_baseAppManifest, _appVariantId, _prefix) {
3
+ // No annotation processing needed for cf
4
+ return new Map();
5
+ }
6
+ }
7
+ //# sourceMappingURL=cfAnnotationManager.js.map
package/dist/bundle.js CHANGED
@@ -2788,9 +2788,9 @@ const PROPERTIES_PATTERNS = {
2788
2788
  const SUPPORTED_TYPES = {
2789
2789
  uri: "string",
2790
2790
  type: "string",
2791
- settings: typeof ({}),
2791
+ settings: "object",
2792
2792
  dataSourceCustom: "boolean",
2793
- annotations: typeof []
2793
+ annotations: "array"
2794
2794
  };
2795
2795
  function isDataSourceIdExistingInManifest(oManifestDataSources, sDataSourceId) {
2796
2796
  return Object.keys(oManifestDataSources).includes(sDataSourceId);
@@ -2813,7 +2813,7 @@ function checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource)
2813
2813
  const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
2814
2814
  const sDataSourceOfTypeODataAnnotation = getDataSourceNameByType(oChangeDataSource, "ODataAnnotation");
2815
2815
  if (!(sDataSourceOfTypeOData && sDataSourceOfTypeODataAnnotation)) {
2816
- throw new Error("When adding two data sources it is only allwoed to add a data source with type 'OData' and the other one must be of type 'ODataAnnotation'.");
2816
+ throw new Error("When adding two data sources it is only allowed to add a data source with type 'OData' and the other one must be of type 'ODataAnnotation'.");
2817
2817
  }
2818
2818
  if (!oChangeDataSource[sDataSourceOfTypeOData]?.settings?.annotations?.includes(sDataSourceOfTypeODataAnnotation)) {
2819
2819
  throw new Error(`Data source '${sDataSourceOfTypeOData}' does not include annotation '${sDataSourceOfTypeODataAnnotation}' under 'settings/annotations' array.`);
@@ -2824,9 +2824,9 @@ function checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource)
2824
2824
  checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations);
2825
2825
  }
2826
2826
  function checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource) {
2827
- const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
2828
- if (oChangeDataSource[sDataSourceOfTypeOData].settings?.annotations) {
2829
- checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, oChangeDataSource[sDataSourceOfTypeOData].settings.annotations);
2827
+ const [sDataSourceName, oDataSource] = Object.entries(oChangeDataSource)[0];
2828
+ if (oDataSource.settings?.annotations) {
2829
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceName, oDataSource.settings.annotations);
2830
2830
  }
2831
2831
  }
2832
2832
  function postChecks(oManifestDataSources, oChangeDataSource, aDataSources) {
@@ -7,6 +7,7 @@ import LocalRepository from "./repositories/localRepository.js";
7
7
  import AbapAnnotationManager from "./annotations/abapAnnotationManager.js";
8
8
  import LocalAnnotationManager from "./annotations/localAnnotationManager.js";
9
9
  import { validateObject } from "./util/commonUtil.js";
10
+ import CFAnnotationManager from "./annotations/cfAnnotationManager.js";
10
11
  export function initialize(configuration) {
11
12
  validateObject(configuration, ["type"], "should be specified in ui5.yaml configuration: 'cf' or 'abap'");
12
13
  const repository = getRepository(configuration);
@@ -51,7 +52,7 @@ function getAnnotationManager(configuration, repository) {
51
52
  case "abap":
52
53
  return new AbapAnnotationManager(configuration, repository);
53
54
  case "cf":
54
- return new LocalAnnotationManager();
55
+ return new CFAnnotationManager();
55
56
  default:
56
57
  throw new Error(`No annotation manager found for the given configuration type '${configuration.type}'`);
57
58
  }
@@ -55,11 +55,14 @@ export default class PreviewManager {
55
55
  });
56
56
  }
57
57
  async processPreviewResources(baseAppFiles) {
58
+ if (!PreviewManager.isPreviewRequested()) {
59
+ log.verbose("Preview mode not requested, skipping downloading reuse libraries and xs-app.json processing.");
60
+ return;
61
+ }
58
62
  log.verbose(`Downloading reuse libraries to reuse folder`);
59
63
  const xsAppFiles = new Array();
60
64
  if (this.fetchLibsPromises.size === 0) {
61
65
  log.verbose("No reuse libraries defined in ui5AppInfo.json for preview");
62
- return;
63
66
  }
64
67
  const mergedFiles = new Map();
65
68
  for (const [libName, libFilesPromise] of this.fetchLibsPromises) {
@@ -81,6 +84,9 @@ export default class PreviewManager {
81
84
  xsAppJson = await fetchCredentialsAndEnhanceRoutes(xsAppJson, this.configuration);
82
85
  mergedFiles.set(XS_APP_JSON_FILE, xsAppJson);
83
86
  }
87
+ if (mergedFiles.size === 0) {
88
+ return;
89
+ }
84
90
  await ResourceUtil.writeInProject(REUSE_DIR, mergedFiles);
85
91
  }
86
92
  preReadLibs(reuseLibs, repository) {
@@ -57,10 +57,11 @@ export default class LocalRepository {
57
57
  return FsUtil.readFilesRecursively(cachebusterToken);
58
58
  }
59
59
  getLocalFilesDirectory(appId) {
60
- const baseDir = this.configuration.adpDir
61
- ? path.normalize(this.configuration.adpDir).replace(/\\/g, "/").replace(/\/+$/, "").split("/")
60
+ const adpDirConfigured = process.env.ADP_BUILDER_DIR || this.configuration.adpDir;
61
+ const adpDir = adpDirConfigured
62
+ ? path.normalize(adpDirConfigured).replace(/\\/g, "/").replace(/\/+$/, "").split("/")
62
63
  : [".."];
63
- return path.join(process.cwd(), ...baseDir, appId);
64
+ return path.join(process.cwd(), ...adpDir, appId);
64
65
  }
65
66
  }
66
67
  //# sourceMappingURL=localRepository.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/task-adaptation",
3
- "version": "1.6.4-rc.3",
3
+ "version": "1.6.5-rc.1",
4
4
  "description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -84,8 +84,8 @@
84
84
  "sinon": "^18.0.1",
85
85
  "source-map-support": "^0.5.19",
86
86
  "tsx": "^4.21.0",
87
- "typescript": "^5.9.3",
88
- "typescript-eslint": "^8.48.1",
87
+ "typescript": "^6.0.2",
88
+ "typescript-eslint": "^8.58.0",
89
89
  "yargs": "^17.7.2"
90
90
  },
91
91
  "c8": {
@@ -97,18 +97,13 @@
97
97
  "text-summary"
98
98
  ],
99
99
  "exclude": [
100
- ".eslintrc.js",
101
- "docs/**",
102
- "jsdocs/**",
103
100
  "coverage/**",
104
101
  "test/**",
105
- "lib/processors/jsdoc/lib/**",
106
102
  "dist/**",
107
103
  "src/model/types.ts",
108
104
  "src/util/requestUtil.ts",
109
105
  "src/util/renamingHandlers/renamingHandler.ts",
110
106
  "scripts/**/*.js",
111
- "scripts/git/octokitUtil.ts",
112
107
  "*/**/*.d.ts",
113
108
  "src/annotations/comparator/diffCase.ts",
114
109
  "src/annotations/transformers/transformer.ts",
@@ -117,8 +112,7 @@
117
112
  "src/adapters/adapter.ts",
118
113
  "src/adapters/previewAdapter.ts",
119
114
  "src/repositories/repository.ts",
120
- "src/annotations/annotationManager.ts",
121
- "src/processors/processor.ts"
115
+ "src/annotations/annotationManager.ts"
122
116
  ],
123
117
  "check-coverage": true,
124
118
  "statements": 85,
@@ -0,0 +1,157 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ sap.ui.define([
6
+ "sap/ui/fl/util/DescriptorChangeCheck"
7
+ ], function(
8
+ DescriptorChangeCheck
9
+ ) {
10
+ "use strict";
11
+
12
+ const MANDATORY_PROPERTIES = ["uri"];
13
+ const SUPPORTED_PROPERTIES = [...MANDATORY_PROPERTIES, "type", "settings", "customType"];
14
+ const PROPERTIES_PATTERNS = {
15
+ type: "^(OData|ODataAnnotation|INA|XML|JSON|FHIR|WebSocket|http)$",
16
+ customType: "^false$"
17
+ };
18
+ const SUPPORTED_TYPES = {
19
+ uri: "string",
20
+ type: "string",
21
+ settings: "object",
22
+ dataSourceCustom: "boolean",
23
+ annotations: "array"
24
+ };
25
+
26
+ function isDataSourceIdExistingInManifest(oManifestDataSources, sDataSourceId) {
27
+ return Object.keys(oManifestDataSources).includes(sDataSourceId);
28
+ }
29
+
30
+ function getDataSourceType(oDataSource) {
31
+ return oDataSource.type || "OData";
32
+ }
33
+
34
+ function getDataSourceNameByType(oChangeDataSource, sType) {
35
+ const [sDataSourceName] = Object.entries(oChangeDataSource).find(([, oDataSource]) => getDataSourceType(oDataSource) === sType) || [];
36
+ return sDataSourceName;
37
+ }
38
+
39
+ function checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations) {
40
+ aToBeCheckedInManifestAnnotations.forEach(function(sAnnotation) {
41
+ if (!isDataSourceIdExistingInManifest(oManifestDataSources, sAnnotation)) {
42
+ throw new Error(`Referenced annotation '${sAnnotation}' in the annotation array of data source '${sDataSourceOfTypeOData}' does not exist in the manifest.`);
43
+ }
44
+ });
45
+ }
46
+
47
+ function checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource) {
48
+ const sDataSourceOfTypeOData = getDataSourceNameByType(oChangeDataSource, "OData");
49
+ const sDataSourceOfTypeODataAnnotation = getDataSourceNameByType(oChangeDataSource, "ODataAnnotation");
50
+
51
+ if (!(sDataSourceOfTypeOData && sDataSourceOfTypeODataAnnotation)) {
52
+ throw new Error("When adding two data sources it is only allowed to add a data source with type 'OData' and the other one must be of type 'ODataAnnotation'.");
53
+ }
54
+
55
+ if (!oChangeDataSource[sDataSourceOfTypeOData]?.settings?.annotations?.includes(sDataSourceOfTypeODataAnnotation)) {
56
+ throw new Error(`Data source '${sDataSourceOfTypeOData}' does not include annotation '${sDataSourceOfTypeODataAnnotation}' under 'settings/annotations' array.`);
57
+ }
58
+
59
+ const aToBeCheckedInManifestAnnotations = oChangeDataSource[sDataSourceOfTypeOData].settings.annotations.filter(function(sAnnotation) {
60
+ return sAnnotation !== sDataSourceOfTypeODataAnnotation;
61
+ });
62
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceOfTypeOData, aToBeCheckedInManifestAnnotations);
63
+ }
64
+
65
+ function checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource) {
66
+ const [sDataSourceName, oDataSource] = Object.entries(oChangeDataSource)[0];
67
+ if (oDataSource.settings?.annotations) {
68
+ checkDefinedAnnotationsExistInManifest(oManifestDataSources, sDataSourceName, oDataSource.settings.annotations);
69
+ }
70
+ }
71
+
72
+ function postChecks(oManifestDataSources, oChangeDataSource, aDataSources) {
73
+ aDataSources.forEach(function(sDataSource) {
74
+ if (isDataSourceIdExistingInManifest(oManifestDataSources, sDataSource)) {
75
+ throw new Error(`There is already a dataSource '${sDataSource}' existing in the manifest.`);
76
+ }
77
+
78
+ checkIfAnnotationsPropertyIsAnArray(oChangeDataSource, sDataSource);
79
+ });
80
+ if (aDataSources.length === 1) {
81
+ checksWhenAddingOneDataSource(oManifestDataSources, oChangeDataSource);
82
+ }
83
+ if (aDataSources.length === 2) {
84
+ checksWhenAddingTwoDataSources(oManifestDataSources, oChangeDataSource);
85
+ }
86
+ }
87
+
88
+ function checkIfAnnotationsPropertyIsAnArray(oChangeDataSource, sDataSource) {
89
+ const sDataSourceType = getDataSourceType(oChangeDataSource[sDataSource]);
90
+
91
+ if (oChangeDataSource[sDataSource].settings?.annotations) {
92
+ if (sDataSourceType !== "OData") {
93
+ throw new Error(`Data source '${sDataSource}' which is of type '${sDataSourceType}' contains the annotations array. Only data sources with type 'OData' could contain the 'settings/annotations' array.`);
94
+ }
95
+
96
+ if (!Array.isArray(oChangeDataSource[sDataSource].settings.annotations)) {
97
+ throw new Error("Property 'annotations' must be of type 'array'.");
98
+ }
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Descriptor change merger for change type <code>appdescr_app_addNewDataSource</code>.
104
+ * Adds a new data source to the manifest.json file under the path sap.app.dataSources.
105
+ *
106
+ * Available only for build {@link sap.ui.fl.apply._internal.changes.descriptor.RegistrationBuild}.
107
+ *
108
+ * @namespace
109
+ * @alias sap.ui.fl.apply._internal.changes.descriptor.app.AddNewDataSource
110
+ * @since 1.87
111
+ * @version ${version}
112
+ * @private
113
+ * @ui5-restricted sap.ui.fl.apply._internal
114
+ */
115
+ const AddNewDataSource = {
116
+
117
+ /**
118
+ * Applies the <code>appdescr_app_addNewDataSource</code> change to the manifest.
119
+ *
120
+ * @param {object} oManifest - Original manifest
121
+ * @param {sap.ui.fl.apply._internal.flexObjects.AppDescriptorChange} oChange - Change with type <code>appdescr_app_addNewDataSource</code>
122
+ * @param {object} oChange.content - Details of the change
123
+ * @param {object} oChange.content.dataSource - Data source of <code>sap.app/dataSource</code> that is being changed
124
+ * @returns {object} Updated manifest with changed <code>sap.app/dataSource</code>
125
+ *
126
+ * @private
127
+ * @ui5-restricted sap.ui.fl.apply._internal
128
+ */
129
+ applyChange(oManifest, oChange) {
130
+ oManifest["sap.app"].dataSources ||= {};
131
+ const oChangeContent = oChange.getContent();
132
+
133
+ const aDataSources = DescriptorChangeCheck.getAndCheckContentObject(oChangeContent, {
134
+ sKey: "dataSource",
135
+ sChangeType: oChange.getChangeType(),
136
+ iMaxNumberOfKeys: 2,
137
+ aMandatoryProperties: MANDATORY_PROPERTIES,
138
+ aSupportedProperties: SUPPORTED_PROPERTIES,
139
+ oSupportedPropertyPattern: PROPERTIES_PATTERNS,
140
+ oSupportedPropertyTypes: SUPPORTED_TYPES
141
+ });
142
+
143
+ aDataSources.forEach(function(sDataSource) {
144
+ DescriptorChangeCheck.checkIdNamespaceCompliance(sDataSource, oChange);
145
+ });
146
+
147
+ postChecks(oManifest["sap.app"].dataSources, oChangeContent.dataSource, aDataSources);
148
+
149
+ Object.assign(oManifest["sap.app"].dataSources, oChangeContent.dataSource);
150
+
151
+ return oManifest;
152
+ }
153
+
154
+ };
155
+
156
+ return AddNewDataSource;
157
+ });