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

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +6 -45
  2. package/README.md +1 -0
  3. package/dist/adapters/abapAdapter.d.ts +4 -2
  4. package/dist/adapters/abapAdapter.js +4 -2
  5. package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +4 -2
  6. package/dist/adapters/commands/downloadAnnotationsCommand.js +6 -2
  7. package/dist/annotationManager.d.ts +17 -0
  8. package/dist/{annotations/abapAnnotationManager.js → annotationManager.js} +10 -12
  9. package/dist/annotations/serviceRequestor.d.ts +3 -3
  10. package/dist/annotations/serviceRequestor.js +4 -4
  11. package/dist/appVariantManager.js +5 -2
  12. package/dist/bundle.js +6 -6
  13. package/dist/index.js +6 -5
  14. package/dist/model/configuration.d.ts +0 -2
  15. package/dist/model/types.d.ts +1 -0
  16. package/dist/previewManager.d.ts +2 -2
  17. package/dist/previewManager.js +14 -8
  18. package/dist/processors/abapProcessor.d.ts +18 -0
  19. package/dist/processors/abapProcessor.js +43 -0
  20. package/dist/processors/cfProcessor.d.ts +14 -0
  21. package/dist/processors/cfProcessor.js +46 -0
  22. package/dist/processors/previewProcessor.d.ts +8 -0
  23. package/dist/processors/previewProcessor.js +11 -0
  24. package/dist/processors/processor.d.ts +10 -0
  25. package/dist/processors/processor.js +39 -0
  26. package/dist/repositories/{abapRepository.d.ts → abapRepoManager.d.ts} +3 -5
  27. package/dist/repositories/{abapRepository.js → abapRepoManager.js} +4 -17
  28. package/dist/repositories/html5RepoManager.d.ts +12 -0
  29. package/dist/repositories/{html5Repository.js → html5RepoManager.js} +27 -58
  30. package/dist/util/commonUtil.d.ts +0 -1
  31. package/dist/util/commonUtil.js +0 -3
  32. package/dist/util/filesUtil.d.ts +2 -0
  33. package/dist/util/filesUtil.js +7 -0
  34. package/dist/util/fsUtil.d.ts +0 -2
  35. package/dist/util/fsUtil.js +0 -34
  36. package/package.json +4 -7
  37. package/rollup/overrides/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource.js +157 -0
  38. package/dist/annotations/abapAnnotationManager.d.ts +0 -17
  39. package/dist/annotations/annotationManager.d.ts +0 -3
  40. package/dist/annotations/annotationManager.js +0 -2
  41. package/dist/annotations/localAnnotationManager.d.ts +0 -4
  42. package/dist/annotations/localAnnotationManager.js +0 -7
  43. package/dist/landscapeConfiguration.d.ts +0 -9
  44. package/dist/landscapeConfiguration.js +0 -65
  45. package/dist/repositories/html5Repository.d.ts +0 -18
  46. package/dist/repositories/localRepository.d.ts +0 -16
  47. package/dist/repositories/localRepository.js +0 -66
  48. package/dist/repositories/repository.d.ts +0 -8
  49. package/dist/repositories/repository.js +0 -2
  50. package/scripts/publish.ts +0 -256
  51. package/scripts/test-integration-prep.sh +0 -4
package/CHANGELOG.md CHANGED
@@ -2,16 +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.4...HEAD).
6
6
 
7
- <a name="v1.6.4-rc.3"></a>
8
- ## [v1.6.4-rc.3] - 2026-04-07
9
-
10
- <a name="v1.6.4-rc.2"></a>
11
- ## [v1.6.4-rc.2] - 2026-04-06
12
-
13
- <a name="v1.6.4-rc.1"></a>
14
- ## [v1.6.4-rc.1] - 2026-04-06
7
+ <a name="v1.6.4"></a>
8
+ ## [v1.6.4] - 2026-04-10
15
9
 
16
10
  <a name="v1.6.3"></a>
17
11
  ## [v1.6.3] - 2026-03-18
@@ -33,24 +27,6 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
33
27
 
34
28
  <a name="v1.5.4"></a>
35
29
  ## [v1.5.4] - 2026-02-16
36
- ### Bug Fixes
37
- - Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
38
-
39
-
40
- <a name="v1.6.0-rc.4"></a>
41
- ## [v1.6.0-rc.4] - 2026-02-12
42
-
43
- <a name="v1.6.0-rc.3"></a>
44
- ## [v1.6.0-rc.3] - 2026-02-05
45
-
46
- <a name="v1.6.0-rc.2"></a>
47
- ## [v1.6.0-rc.2] - 2026-02-05
48
-
49
- <a name="v1.6.0-rc.1"></a>
50
- ## [v1.6.0-rc.1] - 2026-02-05
51
-
52
- <a name="v1.6.0-rc.0"></a>
53
- ## [v1.6.0-rc.0] - 2026-02-02
54
30
 
55
31
  <a name="v1.5.3"></a>
56
32
  ## [v1.5.3] - 2025-09-29
@@ -61,12 +37,6 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
61
37
  - Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
62
38
 
63
39
 
64
- <a name="v1.5.2-rc.1"></a>
65
- ## [v1.5.2-rc.1] - 2025-08-22
66
-
67
- <a name="v1.5.2-rc.0"></a>
68
- ## [v1.5.2-rc.0] - 2025-08-19
69
-
70
40
  <a name="v1.5.1"></a>
71
41
  ## [v1.5.1] - 2025-08-06
72
42
 
@@ -182,25 +152,16 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
182
152
  <a name="v1.0.0"></a>
183
153
  ## v1.0.0 - 2020-12-09
184
154
 
185
- [v1.6.4-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.2...v1.6.4-rc.3
186
- [v1.6.4-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.1...v1.6.4-rc.2
187
- [v1.6.4-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.3...v1.6.4-rc.1
155
+ [v1.6.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.3...v1.6.4
188
156
  [v1.6.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.2...v1.6.3
189
157
  [v1.6.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.1...v1.6.2
190
158
  [v1.6.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0...v1.6.1
191
159
  [v1.6.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.2.0...v1.6.0
192
160
  [v0.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.1.0...v0.2.0
193
161
  [v0.1.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.4...v0.1.0
194
- [v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.4...v1.5.4
195
- [v1.6.0-rc.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.3...v1.6.0-rc.4
196
- [v1.6.0-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.2...v1.6.0-rc.3
197
- [v1.6.0-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.1...v1.6.0-rc.2
198
- [v1.6.0-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.0...v1.6.0-rc.1
199
- [v1.6.0-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.3...v1.6.0-rc.0
162
+ [v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.3...v1.5.4
200
163
  [v1.5.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2...v1.5.3
201
- [v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.1...v1.5.2
202
- [v1.5.2-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.0...v1.5.2-rc.1
203
- [v1.5.2-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2-rc.0
164
+ [v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2
204
165
  [v1.5.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.3...v1.5.1
205
166
  [v1.4.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.2...v1.4.3
206
167
  [v1.4.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.0...v1.4.2
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.
@@ -1,11 +1,13 @@
1
+ import { IConfiguration } from "../model/configuration.js";
1
2
  import { IAdapter } from "./adapter.js";
2
3
  import { AdaptCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
3
4
  import BaseApp from "../baseAppManager.js";
4
5
  import AppVariant from "../appVariantManager.js";
5
- import AnnotationManager from "../annotations/annotationManager.js";
6
+ import AnnotationManager from "../annotationManager.js";
6
7
  export default class AbapAdapter implements IAdapter {
8
+ private configuration;
7
9
  private annotationManager;
8
- constructor(annotationManager: AnnotationManager);
10
+ constructor(configuration: IConfiguration, annotationManager: AnnotationManager);
9
11
  createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
10
12
  createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
11
13
  createPostCommandChain(): PostCommandChain;
@@ -3,8 +3,10 @@ import { AdaptCommandChain, ManifestUpdateCommandChain, MergeCommandChain, PostC
3
3
  import DownloadAnnotationsCommand from "./commands/downloadAnnotationsCommand.js";
4
4
  import I18nPropertiesMergeCommand from "./commands/i18nPropertiesMergeCommand.js";
5
5
  export default class AbapAdapter {
6
+ configuration;
6
7
  annotationManager;
7
- constructor(annotationManager) {
8
+ constructor(configuration, annotationManager) {
9
+ this.configuration = configuration;
8
10
  this.annotationManager = annotationManager;
9
11
  }
10
12
  createAdaptCommandChain(baseApp, appVariant) {
@@ -17,7 +19,7 @@ export default class AbapAdapter {
17
19
  new ManifestUpdateCommandChain([
18
20
  ...getCommonManifestUpdateCommands(baseApp, appVariant, appVariantIdHierarchyItem),
19
21
  ]),
20
- new DownloadAnnotationsCommand(appVariant.id, appVariant.prefix, this.annotationManager),
22
+ new DownloadAnnotationsCommand(appVariant.id, appVariant.prefix, this.annotationManager, this.configuration),
21
23
  ]);
22
24
  }
23
25
  createMergeCommandChain(baseApp, appVariant) {
@@ -1,10 +1,12 @@
1
+ import AnnotationManager from "../../annotationManager.js";
2
+ import { IConfiguration } from "../../model/configuration.js";
1
3
  import { AdaptCommand } from "./command.js";
2
- import IAnnotationManager from "../../annotations/annotationManager.js";
3
4
  export default class DownloadAnnotationsCommand extends AdaptCommand {
4
5
  private appVariantId;
5
6
  private prefix;
6
7
  private annotationManager;
7
- constructor(appVariantId: string, prefix: string, annotationManager: IAnnotationManager);
8
+ private configuration;
9
+ constructor(appVariantId: string, prefix: string, annotationManager: AnnotationManager, configuration: IConfiguration);
8
10
  accept: (filename: string) => filename is "manifest.json";
9
11
  execute(files: Map<string, string>, filename: string): Promise<void>;
10
12
  }
@@ -1,18 +1,22 @@
1
1
  import { AdaptCommand } from "./command.js";
2
+ import Language from "../../model/language.js";
2
3
  export default class DownloadAnnotationsCommand extends AdaptCommand {
3
4
  appVariantId;
4
5
  prefix;
5
6
  annotationManager;
6
- constructor(appVariantId, prefix, annotationManager) {
7
+ configuration;
8
+ constructor(appVariantId, prefix, annotationManager, configuration) {
7
9
  super();
8
10
  this.appVariantId = appVariantId;
9
11
  this.prefix = prefix;
10
12
  this.annotationManager = annotationManager;
13
+ this.configuration = configuration;
11
14
  }
12
15
  accept = (filename) => filename === "manifest.json";
13
16
  async execute(files, filename) {
17
+ const languages = Language.create(this.configuration.languages);
14
18
  const baseAppManifest = JSON.parse(files.get(filename));
15
- let newFiles = await this.annotationManager.process(baseAppManifest, this.appVariantId, this.prefix);
19
+ let newFiles = await this.annotationManager.process(baseAppManifest, languages, this.appVariantId, this.prefix);
16
20
  if (newFiles) {
17
21
  newFiles.forEach((value, key) => files.set(key, value));
18
22
  }
@@ -0,0 +1,17 @@
1
+ import AbapRepoManager from "./repositories/abapRepoManager.js";
2
+ import { IConfiguration } from "./model/types.js";
3
+ import Language from "./model/language.js";
4
+ export interface IAnnotationFiles {
5
+ annotationName: string;
6
+ annotationFileName: string;
7
+ }
8
+ export default class AnnotationManager {
9
+ private abapRepoManager;
10
+ private configuration;
11
+ constructor(configuration: IConfiguration, abapRepoManager: AbapRepoManager);
12
+ ANNOTATIONS_FOLDER: string;
13
+ process(baseAppManifest: any, languages: Language[], appVariantId: string, prefix: string): Promise<Map<string, string>>;
14
+ private updateManifestModel;
15
+ private createManifestModel;
16
+ private enhanceManifestModel;
17
+ }
@@ -1,26 +1,24 @@
1
- import DataSourceManager from "./dataSource/dataSourceManager.js";
2
- import I18nManager from "../i18nManager.js";
3
- import Language from "../model/language.js";
4
- import ServiceRequestor from "./serviceRequestor.js";
1
+ import DataSourceManager from "./annotations/dataSource/dataSourceManager.js";
2
+ import I18nManager from "./i18nManager.js";
3
+ import ServiceRequestor from "./annotations/serviceRequestor.js";
5
4
  import { posix as path } from "path";
6
5
  const I18N_DEFAULT_PATH = "i18n/annotations";
7
6
  const I18N_DEFAULT_MODEL_NAME = "@i18n";
8
7
  const SAPUI5 = "sap.ui5";
9
- export default class AbapAnnotationManager {
10
- repository;
8
+ export default class AnnotationManager {
9
+ abapRepoManager;
11
10
  configuration;
12
- constructor(configuration, repository) {
11
+ constructor(configuration, abapRepoManager) {
13
12
  this.configuration = configuration;
14
- this.repository = repository;
13
+ this.abapRepoManager = abapRepoManager;
15
14
  }
16
15
  ANNOTATIONS_FOLDER = "annotations";
17
- async process(baseAppManifest, appVariantId, prefix) {
18
- const languages = Language.create(this.configuration.languages);
16
+ async process(baseAppManifest, languages, appVariantId, prefix) {
19
17
  //TODO: switch to this after resolving @i18n custom model
20
18
  const modelName = I18N_DEFAULT_MODEL_NAME; //`i18n_a9n_${normalisedId}`;
21
19
  const i18nPathName = path.join(prefix, I18N_DEFAULT_PATH);
22
20
  const i18nManager = new I18nManager(modelName, appVariantId, languages);
23
- const serviceRequestor = new ServiceRequestor(this.configuration, this.repository);
21
+ const serviceRequestor = new ServiceRequestor(this.configuration, this.abapRepoManager);
24
22
  const dataSourceManager = new DataSourceManager();
25
23
  dataSourceManager.addDataSources(baseAppManifest["sap.app"]?.dataSources);
26
24
  const annotationFiles = await dataSourceManager.createAnnotationFiles(languages, i18nManager, serviceRequestor);
@@ -71,4 +69,4 @@ export default class AbapAnnotationManager {
71
69
  }
72
70
  }
73
71
  }
74
- //# sourceMappingURL=abapAnnotationManager.js.map
72
+ //# sourceMappingURL=annotationManager.js.map
@@ -1,9 +1,9 @@
1
+ import AbapRepoManager from "../repositories/abapRepoManager.js";
1
2
  import { IConfiguration } from "../model/types.js";
2
3
  import Language from "../model/language.js";
3
- import IRepository from "../repositories/repository.js";
4
4
  export default class ServiceRequestor {
5
- private repository;
5
+ private abapRepoManager;
6
6
  private configuration;
7
- constructor(configuration: IConfiguration, repository: IRepository);
7
+ constructor(configuration: IConfiguration, abapRepoManager: AbapRepoManager);
8
8
  downloadAnnotation(uri: string, name: string, language: Language): Promise<string>;
9
9
  }
@@ -35,10 +35,10 @@ function retryOnError(maxRetries) {
35
35
  };
36
36
  }
37
37
  export default class ServiceRequestor {
38
- repository;
38
+ abapRepoManager;
39
39
  configuration;
40
- constructor(configuration, repository) {
41
- this.repository = repository;
40
+ constructor(configuration, abapRepoManager) {
41
+ this.abapRepoManager = abapRepoManager;
42
42
  this.configuration = configuration;
43
43
  }
44
44
  //@ts-ignore tsx (esbuild) is not yet implemented the new decorators, but
@@ -47,7 +47,7 @@ export default class ServiceRequestor {
47
47
  async downloadAnnotation(uri, name, language) {
48
48
  uri += `?sap-language=${language.sap}`;
49
49
  log.verbose(`Getting annotation '${name}' ${language} by '${uri}'`);
50
- let files = await this.repository.downloadAnnotationFile(uri);
50
+ let files = await this.abapRepoManager.downloadAnnotationFile(uri);
51
51
  if (!files || files.size === 0) {
52
52
  throw new Error(`No files were fetched for '${name}' by '${uri}'`);
53
53
  }
@@ -62,18 +62,21 @@ export default class AppVariant {
62
62
  }
63
63
  ;
64
64
  getProcessedManifestChanges() {
65
- // Order: manifest changes first, then *.change files
65
+ // Order: manifest changes first, then *.change files sorted by creation ASC
66
66
  const manifestChanges = structuredClone(this.content) ?? [];
67
+ const changeFileChanges = [];
67
68
  this.files.forEach((content, filename) => {
68
69
  if (filename.endsWith(CHANGES_EXT)) {
69
70
  const change = JSON.parse(content);
70
71
  if (isManifestChange(filename, content)) {
71
72
  const { newFilename } = moveFile(filename, content, this.prefix, this.id);
72
73
  this.updateRelativePaths(change, newFilename);
73
- manifestChanges.push(change);
74
+ changeFileChanges.push(change);
74
75
  }
75
76
  }
76
77
  });
78
+ changeFileChanges.sort(FilesUtil.sortByTimeStamp);
79
+ manifestChanges.push(...changeFileChanges);
77
80
  if (this.layer) {
78
81
  manifestChanges.forEach(change => change.layer = this.layer ?? change.layer);
79
82
  }
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) {
package/dist/index.js CHANGED
@@ -3,9 +3,9 @@ import { logBuilderVersion } from "./util/commonUtil.js";
3
3
  import AppVariant from "./appVariantManager.js";
4
4
  import BaseApp from "./baseAppManager.js";
5
5
  import ResourceUtil from "./util/resourceUtil.js";
6
+ import { determineProcessor } from "./processors/processor.js";
6
7
  import FilesUtil from "./util/filesUtil.js";
7
8
  import PreviewManager from "./previewManager.js";
8
- import { initialize } from "./landscapeConfiguration.js";
9
9
  /**
10
10
  * Creates an appVariant bundle from the provided resources.
11
11
  */
@@ -13,10 +13,11 @@ export default ({ workspace, options, taskUtil }) => {
13
13
  dotenv.config();
14
14
  async function process(workspace, taskUtil) {
15
15
  logBuilderVersion();
16
- const { repository, adapter } = initialize(options.configuration);
16
+ const processor = determineProcessor(options.configuration);
17
+ const adapter = processor.getAdapter();
17
18
  const adaptationProject = await AppVariant.fromWorkspace(workspace, options.projectNamespace);
18
- const previewManagerPromise = PreviewManager.createFromRoot(adaptationProject.reference, repository, options.configuration);
19
- const appVariantIdHierarchy = await repository.getAppVariantIdHierarchy(adaptationProject.reference);
19
+ const previewManagerPromise = PreviewManager.createFromRoot(adaptationProject.reference, processor, options.configuration);
20
+ const appVariantIdHierarchy = await processor.getAppVariantIdHierarchy(adaptationProject.reference);
20
21
  if (appVariantIdHierarchy.length === 0) {
21
22
  throw new Error(`No app variant found for reference ${adaptationProject.reference}`);
22
23
  }
@@ -24,7 +25,7 @@ export default ({ workspace, options, taskUtil }) => {
24
25
  // latest app variant on top. We reverse the list to process original
25
26
  // application first and then app variants in chronological order.
26
27
  const reversedHierarchy = appVariantIdHierarchy.toReversed();
27
- const fetchFilesPromises = reversedHierarchy.map(({ repoName, cachebusterToken }) => repository.fetch(repoName, cachebusterToken));
28
+ const fetchFilesPromises = reversedHierarchy.map(({ repoName, cachebusterToken }) => processor.fetch(repoName, cachebusterToken));
28
29
  fetchFilesPromises.push(Promise.resolve(adaptationProject.files));
29
30
  const appVariants = new Array();
30
31
  const adapt = async (baseAppFiles, appVariantFiles) => {
@@ -9,14 +9,12 @@ export interface IConfiguration {
9
9
  sapCloudService?: string;
10
10
  destination?: string;
11
11
  type?: "cf" | "abap";
12
- mode?: "preview" | "local" | "default";
13
12
  languages?: any[] | undefined;
14
13
  enableAnnotationCache?: boolean;
15
14
  enableBetaFeatures?: boolean;
16
15
  writeTempFiles?: any;
17
16
  target?: AbapTarget & IAbapTargetMeta;
18
17
  serviceInstanceName?: string;
19
- adpDir?: string;
20
18
  }
21
19
  export interface IAbapTargetMeta {
22
20
  name?: string;
@@ -61,6 +61,7 @@ export interface IChange {
61
61
  layer?: string;
62
62
  content?: IChangeContent;
63
63
  filename: string;
64
+ creation: string;
64
65
  }
65
66
  export interface IChangeText {
66
67
  i18n: string;
@@ -1,9 +1,9 @@
1
+ import IProcessor from "./processors/processor.js";
1
2
  import { IConfiguration } from "./model/types.js";
2
- import IRepository from "./repositories/repository.js";
3
3
  export default class PreviewManager {
4
4
  private readonly fetchLibsPromises;
5
5
  private readonly configuration;
6
- static createFromRoot(appId: string, repository: IRepository, configuration: IConfiguration): Promise<PreviewManager>;
6
+ static createFromRoot(appId: string, processor: IProcessor, configuration: IConfiguration): Promise<PreviewManager>;
7
7
  static isPreviewRequested(): boolean;
8
8
  private constructor();
9
9
  processPreviewResources(baseAppFiles: ReadonlyMap<string, string>): Promise<void>;
@@ -10,7 +10,7 @@ const XS_APP_JSON_FILE = "xs-app.json";
10
10
  export default class PreviewManager {
11
11
  fetchLibsPromises = new Map();
12
12
  configuration;
13
- static async createFromRoot(appId, repository, configuration) {
13
+ static async createFromRoot(appId, processor, configuration) {
14
14
  let ui5AppInfo = "";
15
15
  if (PreviewManager.isPreviewRequested()) {
16
16
  try {
@@ -23,12 +23,12 @@ export default class PreviewManager {
23
23
  else {
24
24
  log.verbose("Preview mode not requested (env variable ADP_BUILDER_MODE=preview is not set), skipping preview resources processing.");
25
25
  }
26
- return new PreviewManager(appId, ui5AppInfo, repository, configuration);
26
+ return new PreviewManager(appId, ui5AppInfo, processor, configuration);
27
27
  }
28
28
  static isPreviewRequested() {
29
29
  return process.env.ADP_BUILDER_MODE === "preview";
30
30
  }
31
- constructor(appId, ui5AppInfo, repository, configuration) {
31
+ constructor(appId, ui5AppInfo, processor, configuration) {
32
32
  this.configuration = configuration;
33
33
  // If no ui5AppInfo is provided, no preview processing is needed
34
34
  if (!ui5AppInfo) {
@@ -41,7 +41,7 @@ export default class PreviewManager {
41
41
  }
42
42
  const reuseLibs = appInfo.asyncHints.libs.filter(lib => lib.html5AppHostId && lib.html5AppName && lib.html5AppVersion);
43
43
  if (reuseLibs.length > 0) {
44
- this.fetchLibsPromises = this.preReadLibs(reuseLibs, repository);
44
+ this.fetchLibsPromises = this.preReadLibs(reuseLibs, processor);
45
45
  }
46
46
  const logMap = {
47
47
  Error: log.error,
@@ -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,15 +84,18 @@ 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
- preReadLibs(reuseLibs, repository) {
92
+ preReadLibs(reuseLibs, processor) {
87
93
  const promises = new Map();
88
94
  reuseLibs.forEach(lib => {
89
95
  log.info(`Downloading reuse library '${lib.html5AppName}' version '${lib.html5AppVersion}'`);
90
- const promise = repository
96
+ const promise = processor
91
97
  .fetchReuseLib(lib.html5AppName, lib.html5CacheBusterToken, lib)
92
- .then((libFiles) => PreviewManager.moveLibraryFiles(libFiles, lib.html5AppName, lib.name));
98
+ .then(libFiles => PreviewManager.moveLibraryFiles(libFiles, lib.html5AppName, lib.name));
93
99
  promises.set(lib.html5AppName, promise);
94
100
  });
95
101
  return promises;
@@ -0,0 +1,18 @@
1
+ import AbapRepoManager from "../repositories/abapRepoManager.js";
2
+ import AnnotationManager from "../annotationManager.js";
3
+ import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
4
+ import { IConfiguration } from "../model/types.js";
5
+ import IProcessor from "./processor.js";
6
+ import { IAdapter } from "../adapters/adapter.js";
7
+ export default class AbapProcessor implements IProcessor {
8
+ private abapRepoManager;
9
+ private configuration;
10
+ private annotationManager;
11
+ constructor(configuration: IConfiguration, abapRepoManager: AbapRepoManager, annotationManager: AnnotationManager);
12
+ getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
13
+ getAdapter(): IAdapter;
14
+ fetch(repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
15
+ fetchReuseLib(): Promise<Map<string, string>>;
16
+ validateConfiguration(): void;
17
+ getConfigurationType(): string;
18
+ }
@@ -0,0 +1,43 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { cached } from "../cache/cacheHolder.js";
8
+ import { validateObject } from "../util/commonUtil.js";
9
+ import AbapAdapter from "../adapters/abapAdapter.js";
10
+ export default class AbapProcessor {
11
+ abapRepoManager;
12
+ configuration;
13
+ annotationManager;
14
+ constructor(configuration, abapRepoManager, annotationManager) {
15
+ this.configuration = configuration;
16
+ this.abapRepoManager = abapRepoManager;
17
+ this.annotationManager = annotationManager;
18
+ }
19
+ getAppVariantIdHierarchy(appId) {
20
+ return this.abapRepoManager.getAppVariantIdHierarchy(appId);
21
+ }
22
+ getAdapter() {
23
+ return new AbapAdapter(this.configuration, this.annotationManager);
24
+ }
25
+ fetch(repoName, _cachebusterToken) {
26
+ return this.abapRepoManager.fetch(repoName);
27
+ }
28
+ fetchReuseLib() {
29
+ throw new Error("Preview is not available on SAP S/4HANA On-Premise or Cloud Systems. Please create a ticket on CA-UI5-FL-ADP-BAS component.");
30
+ }
31
+ validateConfiguration() {
32
+ // validate general app config
33
+ const properties = ["appName"];
34
+ validateObject(this.configuration, properties, "should be specified in ui5.yaml configuration");
35
+ }
36
+ getConfigurationType() {
37
+ return "abap";
38
+ }
39
+ }
40
+ __decorate([
41
+ cached()
42
+ ], AbapProcessor.prototype, "fetch", null);
43
+ //# sourceMappingURL=abapProcessor.js.map
@@ -0,0 +1,14 @@
1
+ import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
2
+ import { IConfiguration, IReuseLibInfo } from "../model/types.js";
3
+ import IProcessor from "./processor.js";
4
+ import { IAdapter } from "../adapters/adapter.js";
5
+ export default class CFProcessor implements IProcessor {
6
+ protected configuration: IConfiguration;
7
+ constructor(configuration: IConfiguration);
8
+ getAdapter(): IAdapter;
9
+ getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
10
+ fetch(_repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
11
+ fetchReuseLib(_libName: string, _cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
12
+ validateConfiguration(): void;
13
+ getConfigurationType(): string;
14
+ }
@@ -0,0 +1,46 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import HTML5RepoManager from "../repositories/html5RepoManager.js";
8
+ import { cached } from "../cache/cacheHolder.js";
9
+ import { validateObject } from "../util/commonUtil.js";
10
+ import CFAdapter from "../adapters/cfAdapter.js";
11
+ export default class CFProcessor {
12
+ configuration;
13
+ constructor(configuration) {
14
+ this.configuration = configuration;
15
+ }
16
+ getAdapter() {
17
+ return new CFAdapter(this.configuration);
18
+ }
19
+ async getAppVariantIdHierarchy(appId) {
20
+ const metadata = await HTML5RepoManager.getMetadata(this.configuration);
21
+ return [{
22
+ repoName: this.configuration.appName,
23
+ appVariantId: appId,
24
+ cachebusterToken: metadata.changedOn
25
+ }];
26
+ }
27
+ fetch(_repoName, _cachebusterToken) {
28
+ return HTML5RepoManager.getBaseAppFiles(this.configuration);
29
+ }
30
+ fetchReuseLib(_libName, _cachebusterToken, lib) {
31
+ return HTML5RepoManager.getReuseLibFiles(this.configuration, lib);
32
+ }
33
+ validateConfiguration() {
34
+ validateObject(this.configuration, ["appHostId", "appName", "appVersion"], "should be specified in ui5.yaml configuration");
35
+ }
36
+ getConfigurationType() {
37
+ return "cf";
38
+ }
39
+ }
40
+ __decorate([
41
+ cached()
42
+ ], CFProcessor.prototype, "fetch", null);
43
+ __decorate([
44
+ cached()
45
+ ], CFProcessor.prototype, "fetchReuseLib", null);
46
+ //# sourceMappingURL=cfProcessor.js.map
@@ -0,0 +1,8 @@
1
+ import { IAdapter } from "../adapters/adapter.js";
2
+ import { IConfiguration } from "../model/types.js";
3
+ import CFProcessor from "./cfProcessor.js";
4
+ import IProcessor from "./processor.js";
5
+ export default class PreviewProcessor extends CFProcessor implements IProcessor {
6
+ constructor(configuration: IConfiguration);
7
+ getAdapter(): IAdapter;
8
+ }
@@ -0,0 +1,11 @@
1
+ import PreviewAdapter from "../adapters/previewAdapter.js";
2
+ import CFProcessor from "./cfProcessor.js";
3
+ export default class PreviewProcessor extends CFProcessor {
4
+ constructor(configuration) {
5
+ super(configuration);
6
+ }
7
+ getAdapter() {
8
+ return new PreviewAdapter(this.configuration);
9
+ }
10
+ }
11
+ //# sourceMappingURL=previewProcessor.js.map
@@ -0,0 +1,10 @@
1
+ import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
2
+ import { IConfiguration, IReuseLibInfo } from "../model/types.js";
3
+ import { IAdapter } from "../adapters/adapter.js";
4
+ export default interface IProcessor {
5
+ getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
6
+ getAdapter(): IAdapter;
7
+ fetch(repoName: string, cachebusterToken: string): Promise<Map<string, string>>;
8
+ fetchReuseLib(repoName: string, cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
9
+ }
10
+ export declare function determineProcessor(configuration: IConfiguration): IProcessor;