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

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 (61) hide show
  1. package/.env.test +1 -0
  2. package/CHANGELOG.md +10 -57
  3. package/README.md +4 -0
  4. package/dist/adapters/abapAdapter.d.ts +7 -5
  5. package/dist/adapters/abapAdapter.js +9 -11
  6. package/dist/adapters/adapter.d.ts +9 -5
  7. package/dist/adapters/adapter.js +20 -0
  8. package/dist/adapters/cfAdapter.d.ts +8 -5
  9. package/dist/adapters/cfAdapter.js +16 -10
  10. package/dist/adapters/commands/command.d.ts +26 -23
  11. package/dist/adapters/commands/command.js +73 -46
  12. package/dist/adapters/commands/fetchEndpointsCommand.d.ts +9 -0
  13. package/dist/adapters/commands/fetchEndpointsCommand.js +21 -0
  14. package/dist/adapters/commands/fetchPreviewResourcesCommand.d.ts +15 -0
  15. package/dist/adapters/commands/fetchPreviewResourcesCommand.js +102 -0
  16. package/dist/adapters/commands/filterFilesCommand.d.ts +4 -0
  17. package/dist/adapters/commands/filterFilesCommand.js +22 -0
  18. package/dist/adapters/commands/omitDeletedResourcesCommand.d.ts +10 -0
  19. package/dist/adapters/commands/omitDeletedResourcesCommand.js +31 -0
  20. package/dist/adapters/commands/processPreviewResourcesCommand.d.ts +9 -0
  21. package/dist/adapters/commands/processPreviewResourcesCommand.js +51 -0
  22. package/dist/adapters/commands/renameFilesCommand.d.ts +20 -0
  23. package/dist/{util/filesUtil.js → adapters/commands/renameFilesCommand.js} +34 -43
  24. package/dist/adapters/commands/writeResourcesCommand.d.ts +7 -0
  25. package/dist/adapters/commands/writeResourcesCommand.js +20 -0
  26. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.d.ts +3 -3
  27. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.js +4 -4
  28. package/dist/adapters/previewAdapter.d.ts +12 -6
  29. package/dist/adapters/previewAdapter.js +28 -7
  30. package/dist/{appVariantManager.d.ts → appVariant.d.ts} +2 -9
  31. package/dist/{appVariantManager.js → appVariant.js} +14 -26
  32. package/dist/{baseAppManager.js → baseApp.js} +6 -12
  33. package/dist/bundle.js +53 -12
  34. package/dist/cache/cacheHolder.d.ts +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +34 -69
  37. package/dist/model/configuration.d.ts +1 -0
  38. package/dist/model/configuration.js +1 -0
  39. package/dist/model/types.d.ts +9 -2
  40. package/dist/repositories/localRepository.d.ts +2 -3
  41. package/dist/repositories/localRepository.js +54 -33
  42. package/dist/util/cf/xsAppJsonUtil.d.ts +16 -3
  43. package/dist/util/cf/xsAppJsonUtil.js +7 -18
  44. package/dist/util/commonUtil.d.ts +6 -0
  45. package/dist/util/commonUtil.js +17 -0
  46. package/dist/util/fsUtil.d.ts +1 -2
  47. package/dist/util/fsUtil.js +12 -33
  48. package/dist/util/renamingUtil.js +1 -1
  49. package/dist/util/resourceUtil.js +1 -1
  50. package/dist/util/validator/abapValidator.js +2 -2
  51. package/dist/util/validator/validator.d.ts +1 -0
  52. package/dist/util/validator/validator.js +11 -0
  53. package/package.json +11 -12
  54. package/.hyperspace/pull_request_bot.json +0 -19
  55. package/dist/previewManager.d.ts +0 -14
  56. package/dist/previewManager.js +0 -147
  57. package/dist/util/filesUtil.d.ts +0 -19
  58. package/scripts/metadataDownloadHelper.ts +0 -88
  59. package/scripts/publish.ts +0 -256
  60. package/scripts/test-integration-prep.sh +0 -4
  61. /package/dist/{baseAppManager.d.ts → baseApp.d.ts} +0 -0
package/.env.test ADDED
@@ -0,0 +1 @@
1
+ UI5_LOG_LVL=error
package/CHANGELOG.md CHANGED
@@ -2,28 +2,16 @@
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.5-rc.3...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5...HEAD).
6
6
 
7
- <a name="v1.6.5-rc.3"></a>
8
- ## [v1.6.5-rc.3] - 2026-04-27
7
+ <a name="v1.6.5"></a>
8
+ ## [v1.6.5] - 2026-06-24
9
9
  ### Reverts
10
- - Release 1.6.5-rc.0
10
+ - Release 1.6.4
11
11
 
12
12
 
13
- <a name="v1.6.5-rc.2"></a>
14
- ## [v1.6.5-rc.2] - 2026-04-14
15
-
16
- <a name="v1.6.5-rc.1"></a>
17
- ## [v1.6.5-rc.1] - 2026-04-13
18
-
19
- <a name="v1.6.4-rc.3"></a>
20
- ## [v1.6.4-rc.3] - 2026-04-07
21
-
22
- <a name="v1.6.4-rc.2"></a>
23
- ## [v1.6.4-rc.2] - 2026-04-06
24
-
25
- <a name="v1.6.4-rc.1"></a>
26
- ## [v1.6.4-rc.1] - 2026-04-06
13
+ <a name="v1.6.4"></a>
14
+ ## [v1.6.4] - 2026-04-10
27
15
 
28
16
  <a name="v1.6.3"></a>
29
17
  ## [v1.6.3] - 2026-03-18
@@ -45,24 +33,6 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
45
33
 
46
34
  <a name="v1.5.4"></a>
47
35
  ## [v1.5.4] - 2026-02-16
48
- ### Bug Fixes
49
- - Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
50
-
51
-
52
- <a name="v1.6.0-rc.4"></a>
53
- ## [v1.6.0-rc.4] - 2026-02-12
54
-
55
- <a name="v1.6.0-rc.3"></a>
56
- ## [v1.6.0-rc.3] - 2026-02-05
57
-
58
- <a name="v1.6.0-rc.2"></a>
59
- ## [v1.6.0-rc.2] - 2026-02-05
60
-
61
- <a name="v1.6.0-rc.1"></a>
62
- ## [v1.6.0-rc.1] - 2026-02-05
63
-
64
- <a name="v1.6.0-rc.0"></a>
65
- ## [v1.6.0-rc.0] - 2026-02-02
66
36
 
67
37
  <a name="v1.5.3"></a>
68
38
  ## [v1.5.3] - 2025-09-29
@@ -73,12 +43,6 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
73
43
  - Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
74
44
 
75
45
 
76
- <a name="v1.5.2-rc.1"></a>
77
- ## [v1.5.2-rc.1] - 2025-08-22
78
-
79
- <a name="v1.5.2-rc.0"></a>
80
- ## [v1.5.2-rc.0] - 2025-08-19
81
-
82
46
  <a name="v1.5.1"></a>
83
47
  ## [v1.5.1] - 2025-08-06
84
48
 
@@ -194,28 +158,17 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
194
158
  <a name="v1.0.0"></a>
195
159
  ## v1.0.0 - 2020-12-09
196
160
 
197
- [v1.6.5-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.2...v1.6.5-rc.3
198
- [v1.6.5-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.1...v1.6.5-rc.2
199
- [v1.6.5-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.3...v1.6.5-rc.1
200
- [v1.6.4-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.2...v1.6.4-rc.3
201
- [v1.6.4-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.1...v1.6.4-rc.2
202
- [v1.6.4-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.3...v1.6.4-rc.1
161
+ [v1.6.5]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4...v1.6.5
162
+ [v1.6.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.3...v1.6.4
203
163
  [v1.6.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.2...v1.6.3
204
164
  [v1.6.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.1...v1.6.2
205
165
  [v1.6.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0...v1.6.1
206
166
  [v1.6.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.2.0...v1.6.0
207
167
  [v0.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.1.0...v0.2.0
208
168
  [v0.1.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.4...v0.1.0
209
- [v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.4...v1.5.4
210
- [v1.6.0-rc.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.3...v1.6.0-rc.4
211
- [v1.6.0-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.2...v1.6.0-rc.3
212
- [v1.6.0-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.1...v1.6.0-rc.2
213
- [v1.6.0-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.0...v1.6.0-rc.1
214
- [v1.6.0-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.3...v1.6.0-rc.0
169
+ [v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.3...v1.5.4
215
170
  [v1.5.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2...v1.5.3
216
- [v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.1...v1.5.2
217
- [v1.5.2-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.0...v1.5.2-rc.1
218
- [v1.5.2-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2-rc.0
171
+ [v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2
219
172
  [v1.5.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.3...v1.5.1
220
173
  [v1.4.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.2...v1.4.3
221
174
  [v1.4.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.0...v1.4.2
package/README.md CHANGED
@@ -23,6 +23,10 @@ target:
23
23
  destination: abc
24
24
  ```
25
25
 
26
+ ### Local/Offline Build
27
+ Specify environment variables `ADP_BUILDER_MODE=local` and `ADP_BUILDER_DIR=<path-to-base-app-files>` to build the Adaptation Project from local base app files offline - without accessing the remote repositories.
28
+
29
+ ### More
26
30
  For more information, see [Create an Adaptation Project](https://help.sap.com/docs/bas/developing-sap-fiori-app-in-sap-business-application-studio/create-project) (on SAP S/4HANA Cloud) or [Create an Adaptation Project](https://help.sap.com/docs/bas/developing-sap-fiori-app-in-sap-business-application-studio/create-adaptation-project-c7b455d488bc4229af7efe0311546752) (on SAP BTP, Cloud Foundry environment).
27
31
  > [!NOTE]
28
32
  > For SAP S/4HANA (on-premise) systems, a different builder is used.
@@ -1,12 +1,14 @@
1
1
  import { IAdapter } from "./adapter.js";
2
- import { AdaptCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
3
- import BaseApp from "../baseAppManager.js";
4
- import AppVariant from "../appVariantManager.js";
2
+ import { AdaptCommandChain, PostCommandChain, SetupCommandChain } from "./commands/command.js";
3
+ import BaseApp from "../baseApp.js";
4
+ import AppVariant from "../appVariant.js";
5
5
  import IAnnotationManager from "../annotations/annotationManager.js";
6
+ import { UI5BuilderTools } from "../model/types.js";
7
+ import IRepository from "../repositories/repository.js";
6
8
  export default class AbapAdapter implements IAdapter {
7
9
  private annotationManager;
8
10
  constructor(annotationManager: IAnnotationManager);
11
+ createSetupCommandChain(_appId: string, _repository: IRepository): SetupCommandChain;
9
12
  createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
10
- createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
11
- createPostCommandChain(): PostCommandChain;
13
+ createPostCommandChain(references: Map<string, string>, adaptationProject: AppVariant, ui5BuilderTools: UI5BuilderTools): PostCommandChain;
12
14
  }
@@ -1,5 +1,5 @@
1
- import { getCommonManifestUpdateCommands } from "./adapter.js";
2
- import { AdaptCommandChain, ManifestUpdateCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
1
+ import { getCommonManifestUpdateCommands, getCommonPostCommands } from "./adapter.js";
2
+ import { AdaptCommandChain, ManifestUpdateCommandChain, PostCommandChain, SetupCommandChain } from "./commands/command.js";
3
3
  import DownloadAnnotationsCommand from "./commands/downloadAnnotationsCommand.js";
4
4
  import I18nPropertiesMergeCommand from "./commands/i18nPropertiesMergeCommand.js";
5
5
  export default class AbapAdapter {
@@ -7,28 +7,26 @@ export default class AbapAdapter {
7
7
  constructor(annotationManager) {
8
8
  this.annotationManager = annotationManager;
9
9
  }
10
+ createSetupCommandChain(_appId, _repository) {
11
+ return new SetupCommandChain([]);
12
+ }
10
13
  createAdaptCommandChain(baseApp, appVariant) {
11
14
  const appVariantIdHierarchyItem = {
12
15
  appVariantId: baseApp.id,
13
16
  version: baseApp.version,
14
17
  layer: "VENDOR"
15
18
  };
16
- return new AdaptCommandChain(baseApp.files, [
19
+ const manifestChanges = appVariant.getProcessedManifestChanges();
20
+ return new AdaptCommandChain(baseApp.files, appVariant.getProcessedFiles(), [
17
21
  new ManifestUpdateCommandChain([
18
22
  ...getCommonManifestUpdateCommands(baseApp, appVariant, appVariantIdHierarchyItem),
19
23
  ]),
20
24
  new DownloadAnnotationsCommand(appVariant.id, appVariant.prefix, this.annotationManager),
21
- ]);
22
- }
23
- createMergeCommandChain(baseApp, appVariant) {
24
- const manifestChanges = appVariant.getProcessedManifestChanges();
25
- return new MergeCommandChain(appVariant.getProcessedFiles(), [
26
25
  new I18nPropertiesMergeCommand(baseApp.i18nPath, appVariant.prefix, manifestChanges),
27
26
  ]);
28
27
  }
29
- createPostCommandChain() {
30
- // No post commands needed for ABAP, return an empty chain
31
- return new PostCommandChain([]);
28
+ createPostCommandChain(references, adaptationProject, ui5BuilderTools) {
29
+ return new PostCommandChain(getCommonPostCommands(references, adaptationProject, ui5BuilderTools));
32
30
  }
33
31
  }
34
32
  //# sourceMappingURL=abapAdapter.js.map
@@ -1,10 +1,14 @@
1
- import AppVariant from "../appVariantManager.js";
2
- import BaseApp from "../baseAppManager.js";
1
+ import AppVariant from "../appVariant.js";
2
+ import BaseApp from "../baseApp.js";
3
3
  import { IAppVariantIdHierarchyManifestItem } from "../model/appVariantIdHierarchyItem.js";
4
- import { AdaptCommandChain, ManifestUpdateCommand, MergeCommandChain, PostCommandChain } from "./commands/command.js";
4
+ import { UI5BuilderTools } from "../model/types.js";
5
+ import IRepository from "../repositories/repository.js";
6
+ import { AdaptCommandChain, IPromiseCommand, ManifestUpdateCommand, PostCommand, PostCommandChain, SetupCommandChain } from "./commands/command.js";
5
7
  export interface IAdapter {
8
+ createSetupCommandChain(appId: string, repository: IRepository): SetupCommandChain;
6
9
  createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
7
- createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
8
- createPostCommandChain(): PostCommandChain;
10
+ createPostCommandChain(references: Map<string, string>, adaptationProject: AppVariant, ui5BuilderTools: UI5BuilderTools): PostCommandChain;
9
11
  }
10
12
  export declare function getCommonManifestUpdateCommands(baseApp: BaseApp, appVariant: AppVariant, appVariantIdHierarchyItem: IAppVariantIdHierarchyManifestItem): ManifestUpdateCommand[];
13
+ export declare function getCommonPostCommands(references: Map<string, string>, adaptationProject: AppVariant, ui5BuilderTools: UI5BuilderTools): PostCommand[];
14
+ export declare function dependsOn<T>(promise: IPromiseCommand<T> | null): Promise<T>;
@@ -1,8 +1,12 @@
1
1
  import AddAppVariantIdHierarchyCommand from "./commands/addAppVariantIdHierarchyCommand.js";
2
2
  import ApplyDescriptorChangesCommand from "./commands/applyDescriptorChangesCommand.js";
3
+ import FilterFilesCommand from "./commands/filterFilesCommand.js";
4
+ import OmitDeletedResourcesCommand from "./commands/omitDeletedResourcesCommand.js";
5
+ import RenameFilesCommand from "./commands/renameFilesCommand.js";
3
6
  import SetAppVariantIdCommand from "./commands/setAppVariantIdCommand.js";
4
7
  import UpdateCloudDevAdaptationCommand from "./commands/updateCloudDevAdaptationCommand.js";
5
8
  import UpdateComponentNameCommand from "./commands/updateComponentNameCommand.js";
9
+ import WriteResourcesCommand from "./commands/writeResourcesCommand.js";
6
10
  export function getCommonManifestUpdateCommands(baseApp, appVariant, appVariantIdHierarchyItem) {
7
11
  const manifestChanges = appVariant.getProcessedManifestChanges();
8
12
  return [
@@ -13,4 +17,20 @@ export function getCommonManifestUpdateCommands(baseApp, appVariant, appVariantI
13
17
  new UpdateCloudDevAdaptationCommand(),
14
18
  ];
15
19
  }
20
+ export function getCommonPostCommands(references, adaptationProject, ui5BuilderTools) {
21
+ const { movedFiles, resources } = adaptationProject;
22
+ const { workspace, taskUtil, projectNamespace } = ui5BuilderTools;
23
+ return [
24
+ new FilterFilesCommand(),
25
+ new RenameFilesCommand(references),
26
+ new OmitDeletedResourcesCommand(taskUtil, movedFiles, resources, projectNamespace),
27
+ new WriteResourcesCommand(workspace, projectNamespace),
28
+ ];
29
+ }
30
+ export function dependsOn(promise) {
31
+ if (!promise) {
32
+ throw new Error("Dependent command was not executed, promise is not available");
33
+ }
34
+ return promise.result;
35
+ }
16
36
  //# sourceMappingURL=adapter.js.map
@@ -1,12 +1,15 @@
1
1
  import { IConfiguration } from "../model/configuration.js";
2
2
  import { IAdapter } from "./adapter.js";
3
- import { AdaptCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
4
- import BaseApp from "../baseAppManager.js";
5
- import AppVariant from "../appVariantManager.js";
3
+ import { AdaptCommandChain, PostCommandChain, SetupCommandChain } from "./commands/command.js";
4
+ import BaseApp from "../baseApp.js";
5
+ import AppVariant from "../appVariant.js";
6
+ import { UI5BuilderTools } from "../model/types.js";
7
+ import IRepository from "../repositories/repository.js";
6
8
  export default class CFAdapter implements IAdapter {
7
9
  private configuration;
10
+ private fetchEndpointsCommand;
8
11
  constructor(configuration: IConfiguration);
12
+ createSetupCommandChain(_appId: string, _repository: IRepository): SetupCommandChain;
9
13
  createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
10
- createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
11
- createPostCommandChain(): PostCommandChain;
14
+ createPostCommandChain(references: Map<string, string>, adaptationProject: AppVariant, ui5BuilderTools: UI5BuilderTools): PostCommandChain;
12
15
  }
@@ -1,36 +1,42 @@
1
- import { getCommonManifestUpdateCommands } from "./adapter.js";
2
- import { AdaptCommandChain, ManifestUpdateCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
1
+ import { dependsOn, getCommonManifestUpdateCommands, getCommonPostCommands } from "./adapter.js";
2
+ import { AdaptCommandChain, ManifestUpdateCommandChain, PostCommandChain, SetupCommandChain } from "./commands/command.js";
3
3
  import XsAppJsonEnhanceRoutesCommand from "./commands/xsAppJsonEnhanceRoutesCommand.js";
4
4
  import UpdateCloudPlatformCommand from "./commands/updateCloudPlatformCommand.js";
5
5
  import I18nPropertiesMergeCommand from "./commands/i18nPropertiesMergeCommand.js";
6
6
  import XsAppJsonMergeCommand from "./commands/xsAppJsonMergeCommand.js";
7
+ import FetchEndpointsCommand from "./commands/fetchEndpointsCommand.js";
7
8
  export default class CFAdapter {
8
9
  configuration;
10
+ fetchEndpointsCommand = null;
9
11
  constructor(configuration) {
10
12
  this.configuration = configuration;
11
13
  }
14
+ createSetupCommandChain(_appId, _repository) {
15
+ this.fetchEndpointsCommand = new FetchEndpointsCommand(this.configuration);
16
+ return new SetupCommandChain([
17
+ this.fetchEndpointsCommand
18
+ ]);
19
+ }
12
20
  createAdaptCommandChain(baseApp, appVariant) {
13
21
  const appVariantIdHierarchyItem = {
14
22
  appVariantId: baseApp.id,
15
23
  version: baseApp.version
16
24
  };
17
- return new AdaptCommandChain(baseApp.files, [
25
+ const manifestChanges = appVariant.getProcessedManifestChanges();
26
+ return new AdaptCommandChain(baseApp.files, appVariant.getProcessedFiles(), [
18
27
  new ManifestUpdateCommandChain([
19
28
  ...getCommonManifestUpdateCommands(baseApp, appVariant, appVariantIdHierarchyItem),
20
29
  new UpdateCloudPlatformCommand(this.configuration.sapCloudService),
21
30
  ]),
22
- ]);
23
- }
24
- createMergeCommandChain(baseApp, appVariant) {
25
- const manifestChanges = appVariant.getProcessedManifestChanges();
26
- return new MergeCommandChain(appVariant.getProcessedFiles(), [
27
31
  new I18nPropertiesMergeCommand(baseApp.i18nPath, appVariant.prefix, manifestChanges),
28
32
  new XsAppJsonMergeCommand(),
29
33
  ]);
30
34
  }
31
- createPostCommandChain() {
35
+ createPostCommandChain(references, adaptationProject, ui5BuilderTools) {
36
+ const serviceCredentialsPromise = dependsOn(this.fetchEndpointsCommand);
32
37
  return new PostCommandChain([
33
- new XsAppJsonEnhanceRoutesCommand(this.configuration),
38
+ new XsAppJsonEnhanceRoutesCommand(serviceCredentialsPromise),
39
+ ...getCommonPostCommands(references, adaptationProject, ui5BuilderTools)
34
40
  ]);
35
41
  }
36
42
  }
@@ -1,3 +1,18 @@
1
+ export declare abstract class SetupCommand {
2
+ readonly commandType = "setup";
3
+ /**
4
+ * Executes the command
5
+ */
6
+ abstract execute(): Promise<void>;
7
+ }
8
+ export declare class SetupCommandChain {
9
+ private commands;
10
+ constructor(commands: SetupCommand[]);
11
+ /**
12
+ * Executes all commands in the chain
13
+ */
14
+ execute(): Promise<void>;
15
+ }
1
16
  export declare abstract class AdaptCommand {
2
17
  readonly commandType = "adapt";
3
18
  abstract accept(filename: string): boolean;
@@ -8,15 +23,6 @@ export declare abstract class AdaptCommand {
8
23
  */
9
24
  abstract execute(files: Map<string, string>, filename: string): Promise<void>;
10
25
  }
11
- export declare class AdaptCommandChain {
12
- private files;
13
- private commands;
14
- constructor(files: ReadonlyMap<string, string>, commands: AdaptCommand[]);
15
- /**
16
- * Executes all commands in the chain that accept the given filename
17
- */
18
- execute(): Promise<ReadonlyMap<string, string>>;
19
- }
20
26
  export declare abstract class MergeCommand {
21
27
  readonly commandType = "merge";
22
28
  abstract accept(filename: string): boolean;
@@ -28,20 +34,6 @@ export declare abstract class MergeCommand {
28
34
  */
29
35
  abstract execute(files: Map<string, string>, filename: string, appVariantContent: string): Promise<void>;
30
36
  }
31
- /**
32
- * CommandChain implements the Chain of Responsibility pattern
33
- * It manages a collection of commands and executes them in sequence
34
- */
35
- export declare class MergeCommandChain {
36
- private appVariantFiles;
37
- private commands;
38
- constructor(appVariantFiles: ReadonlyMap<string, string>, commands?: MergeCommand[]);
39
- /**
40
- * Executes all commands in the chain that accept the given filename
41
- * @param files - Map of all files being processed
42
- */
43
- execute(files: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, string>>;
44
- }
45
37
  export declare abstract class ManifestUpdateCommand {
46
38
  readonly commandType = "manifestUpdate";
47
39
  /**
@@ -77,3 +69,14 @@ export declare class PostCommandChain {
77
69
  */
78
70
  execute(files: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, string>>;
79
71
  }
72
+ export declare class AdaptCommandChain {
73
+ private files;
74
+ private appVariantFiles;
75
+ private adaptCommands;
76
+ private mergeCommands;
77
+ constructor(files: ReadonlyMap<string, string>, appVariantFiles: ReadonlyMap<string, string>, commands: (AdaptCommand | MergeCommand)[]);
78
+ execute(): Promise<ReadonlyMap<string, string>>;
79
+ }
80
+ export interface IPromiseCommand<T> {
81
+ result: Promise<T>;
82
+ }
@@ -1,62 +1,32 @@
1
- export class AdaptCommand {
2
- commandType = "adapt";
1
+ import { getLogger } from "@ui5/logger";
2
+ const log = getLogger("@ui5/task-adaptation::CommandChain");
3
+ export class SetupCommand {
4
+ commandType = "setup";
3
5
  }
4
- export class AdaptCommandChain {
5
- files;
6
+ export class SetupCommandChain {
6
7
  commands;
7
- constructor(files, commands) {
8
- this.files = files;
8
+ constructor(commands) {
9
9
  this.commands = commands;
10
10
  }
11
11
  /**
12
- * Executes all commands in the chain that accept the given filename
12
+ * Executes all commands in the chain
13
13
  */
14
14
  async execute() {
15
- const filesCopy = new Map(this.files);
16
- for (const [filename] of filesCopy) {
17
- for (const command of this.commands) {
18
- if (command.accept(filename)) {
19
- await command.execute(filesCopy, filename);
20
- }
21
- }
15
+ const timings = [];
16
+ for (const command of this.commands) {
17
+ const start = performance.now();
18
+ await command.execute();
19
+ pushTiming(command, timings, start);
22
20
  }
23
- return filesCopy;
21
+ logTimings(this, timings);
24
22
  }
25
23
  }
24
+ export class AdaptCommand {
25
+ commandType = "adapt";
26
+ }
26
27
  export class MergeCommand {
27
28
  commandType = "merge";
28
29
  }
29
- /**
30
- * CommandChain implements the Chain of Responsibility pattern
31
- * It manages a collection of commands and executes them in sequence
32
- */
33
- export class MergeCommandChain {
34
- appVariantFiles;
35
- commands;
36
- constructor(appVariantFiles, commands = []) {
37
- this.appVariantFiles = appVariantFiles;
38
- this.commands = commands;
39
- }
40
- /**
41
- * Executes all commands in the chain that accept the given filename
42
- * @param files - Map of all files being processed
43
- */
44
- async execute(files) {
45
- const filesCopy = new Map(files);
46
- for (const [filename, appVariantContent] of this.appVariantFiles) {
47
- const acceptedCommands = this.commands.filter(command => command.accept(filename));
48
- if (acceptedCommands.length > 0) {
49
- for (const command of acceptedCommands) {
50
- await command.execute(filesCopy, filename, appVariantContent);
51
- }
52
- }
53
- else {
54
- filesCopy.set(filename, appVariantContent);
55
- }
56
- }
57
- return filesCopy;
58
- }
59
- }
60
30
  export class ManifestUpdateCommand {
61
31
  commandType = "manifestUpdate";
62
32
  }
@@ -73,10 +43,14 @@ export class ManifestUpdateCommandChain extends AdaptCommand {
73
43
  throw new Error("Original application should have manifest.json in root folder");
74
44
  }
75
45
  const manifest = JSON.parse(manifestContent);
46
+ const timings = [];
76
47
  for (const command of this.commands) {
48
+ const start = performance.now();
77
49
  await command.execute(manifest);
50
+ pushTiming(command, timings, start);
78
51
  }
79
52
  files.set(filename, JSON.stringify(manifest));
53
+ logTimings(this, timings);
80
54
  }
81
55
  }
82
56
  export class PostCommand {
@@ -97,10 +71,63 @@ export class PostCommandChain {
97
71
  */
98
72
  async execute(files) {
99
73
  const filesCopy = new Map(files);
74
+ const timings = [];
100
75
  for (const command of this.commands) {
76
+ const start = performance.now();
101
77
  await command.execute(filesCopy);
78
+ pushTiming(command, timings, start);
79
+ }
80
+ logTimings(this, timings);
81
+ return filesCopy;
82
+ }
83
+ }
84
+ export class AdaptCommandChain {
85
+ files;
86
+ appVariantFiles;
87
+ adaptCommands;
88
+ mergeCommands;
89
+ constructor(files, appVariantFiles, commands) {
90
+ this.files = files;
91
+ this.appVariantFiles = appVariantFiles;
92
+ this.adaptCommands = commands.filter((c) => c.commandType === "adapt");
93
+ this.mergeCommands = commands.filter((c) => c.commandType === "merge");
94
+ }
95
+ async execute() {
96
+ const filesCopy = new Map(this.files);
97
+ const timings = [];
98
+ for (const command of this.adaptCommands) {
99
+ const start = performance.now();
100
+ for (const [filename] of filesCopy) {
101
+ if (command.accept(filename)) {
102
+ await command.execute(filesCopy, filename);
103
+ }
104
+ }
105
+ pushTiming(command, timings, start);
102
106
  }
107
+ for (const command of this.mergeCommands) {
108
+ const start = performance.now();
109
+ for (const [filename, appVariantContent] of this.appVariantFiles) {
110
+ if (command.accept(filename)) {
111
+ await command.execute(filesCopy, filename, appVariantContent);
112
+ }
113
+ }
114
+ pushTiming(command, timings, start);
115
+ }
116
+ for (const [filename, appVariantContent] of this.appVariantFiles) {
117
+ const accepted = this.mergeCommands.some(command => command.accept(filename));
118
+ if (!accepted) {
119
+ filesCopy.set(filename, appVariantContent);
120
+ }
121
+ }
122
+ logTimings(this, timings);
103
123
  return filesCopy;
104
124
  }
105
125
  }
126
+ function logTimings(chain, timings) {
127
+ log.info(`${chain.constructor.name}:`);
128
+ timings.forEach(({ name, duration }) => log.info(` ${name}: ${duration.toFixed(2)}ms`));
129
+ }
130
+ function pushTiming(command, timings, start) {
131
+ timings.push({ name: command.constructor.name, duration: performance.now() - start });
132
+ }
106
133
  //# sourceMappingURL=command.js.map
@@ -0,0 +1,9 @@
1
+ import { IConfiguration } from "../../model/configuration.js";
2
+ import { ServiceCredentials } from "../../model/types.js";
3
+ import { IPromiseCommand, SetupCommand } from "./command.js";
4
+ export default class FetchEndpointsCommand extends SetupCommand implements IPromiseCommand<ServiceCredentials | undefined> {
5
+ private configuration;
6
+ result: Promise<ServiceCredentials | undefined>;
7
+ constructor(configuration: IConfiguration);
8
+ execute(): Promise<void>;
9
+ }
@@ -0,0 +1,21 @@
1
+ import CFUtil from "../../util/cfUtil.js";
2
+ import { validateObject } from "../../util/commonUtil.js";
3
+ import { SetupCommand } from "./command.js";
4
+ export default class FetchEndpointsCommand extends SetupCommand {
5
+ configuration;
6
+ result = Promise.resolve(undefined);
7
+ constructor(configuration) {
8
+ super();
9
+ this.configuration = configuration;
10
+ }
11
+ async execute() {
12
+ validateObject(this.configuration, ["serviceInstanceName"], "should be specified in ui5.yaml configuration");
13
+ const { serviceInstanceName, space } = this.configuration;
14
+ // Get valid service keys with proper endpoints structure
15
+ this.result = CFUtil.getOrCreateServiceKeyWithEndpoints(serviceInstanceName, space).catch(error => {
16
+ const errorText = error instanceof Error ? error.message : String(error);
17
+ throw new Error(`Failed to get a service key with endpoints for service instance '${serviceInstanceName}' in space '${space}': ${errorText}`);
18
+ });
19
+ }
20
+ }
21
+ //# sourceMappingURL=fetchEndpointsCommand.js.map
@@ -0,0 +1,15 @@
1
+ import { IPromiseCommand, SetupCommand } from "./command.js";
2
+ import { FetchFilesPromise } from "../../model/types.js";
3
+ import IRepository from "../../repositories/repository.js";
4
+ export default class FetchPreviewResourcesCommand extends SetupCommand implements IPromiseCommand<FetchFilesPromise | undefined> {
5
+ private appId;
6
+ private repository;
7
+ result: Promise<FetchFilesPromise | undefined>;
8
+ constructor(appId: string, repository: IRepository);
9
+ execute(): Promise<void>;
10
+ private preparePreview;
11
+ private printMessages;
12
+ private preReadLibs;
13
+ private moveLibraryFiles;
14
+ private modifyRoutes;
15
+ }