@ui5/task-adaptation 1.6.0-rc.4 → 1.6.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +24 -25
  2. package/dist/adapters/abapAdapter.d.ts +13 -2
  3. package/dist/adapters/abapAdapter.js +43 -2
  4. package/dist/adapters/adapter.d.ts +7 -9
  5. package/dist/adapters/adapter.js +1 -10
  6. package/dist/adapters/cfAdapter.d.ts +11 -7
  7. package/dist/adapters/cfAdapter.js +43 -17
  8. package/dist/adapters/commands/addAppVariantIdHierarchyCommand.d.ts +7 -0
  9. package/dist/adapters/commands/addAppVariantIdHierarchyCommand.js +17 -0
  10. package/dist/adapters/commands/applyDescriptorChangesCommand.d.ts +10 -0
  11. package/dist/adapters/commands/applyDescriptorChangesCommand.js +43 -0
  12. package/dist/adapters/commands/command.d.ts +84 -0
  13. package/dist/adapters/commands/command.js +108 -0
  14. package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +12 -0
  15. package/dist/adapters/commands/downloadAnnotationsCommand.js +26 -0
  16. package/dist/{util/i18nMerger.d.ts → adapters/commands/i18nPropertiesMergeCommand.d.ts} +13 -10
  17. package/dist/{util/i18nMerger.js → adapters/commands/i18nPropertiesMergeCommand.js} +30 -30
  18. package/dist/adapters/commands/setAppVariantIdCommand.d.ts +7 -0
  19. package/dist/adapters/commands/setAppVariantIdCommand.js +15 -0
  20. package/dist/adapters/commands/updateCloudDevAdaptationCommand.d.ts +4 -0
  21. package/dist/adapters/commands/updateCloudDevAdaptationCommand.js +11 -0
  22. package/dist/adapters/commands/updateCloudPlatformCommand.d.ts +6 -0
  23. package/dist/adapters/commands/updateCloudPlatformCommand.js +23 -0
  24. package/dist/adapters/commands/updateComponentNameCommand.d.ts +6 -0
  25. package/dist/adapters/commands/updateComponentNameCommand.js +13 -0
  26. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.d.ts +7 -0
  27. package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.js +36 -0
  28. package/dist/adapters/commands/xsAppJsonMergeCommand.d.ts +5 -0
  29. package/dist/adapters/commands/xsAppJsonMergeCommand.js +17 -0
  30. package/dist/adapters/previewAdapter.d.ts +6 -0
  31. package/dist/adapters/previewAdapter.js +8 -0
  32. package/dist/appVariantManager.js +3 -0
  33. package/dist/baseAppManager.d.ts +0 -8
  34. package/dist/baseAppManager.js +3 -69
  35. package/dist/bundle.js +37 -35
  36. package/dist/cache/cacheHolder.js +9 -4
  37. package/dist/index.js +6 -4
  38. package/dist/model/appVariantIdHierarchyItem.d.ts +6 -1
  39. package/dist/model/types.d.ts +6 -0
  40. package/dist/previewManager.js +12 -8
  41. package/dist/processors/abapProcessor.d.ts +3 -9
  42. package/dist/processors/abapProcessor.js +1 -16
  43. package/dist/processors/cfProcessor.d.ts +5 -13
  44. package/dist/processors/cfProcessor.js +1 -91
  45. package/dist/processors/previewProcessor.d.ts +8 -0
  46. package/dist/processors/previewProcessor.js +11 -0
  47. package/dist/processors/processor.d.ts +3 -5
  48. package/dist/processors/processor.js +9 -0
  49. package/dist/repositories/abapRepoManager.d.ts +1 -1
  50. package/dist/repositories/html5RepoManager.js +6 -0
  51. package/dist/util/cf/xsAppJsonUtil.d.ts +3 -13
  52. package/dist/util/cf/xsAppJsonUtil.js +46 -1
  53. package/dist/util/cfUtil.d.ts +3 -3
  54. package/dist/util/cfUtil.js +1 -1
  55. package/dist/util/filesUtil.d.ts +3 -2
  56. package/dist/util/filesUtil.js +20 -4
  57. package/dist/util/fsUtil.d.ts +9 -0
  58. package/dist/util/fsUtil.js +40 -0
  59. package/dist/util/movingHandler/changeFileMoveHandler.js +2 -3
  60. package/dist/util/objectPath.d.ts +19 -0
  61. package/dist/util/objectPath.js +62 -0
  62. package/dist/util/renamingHandlers/jsonRenamingHandler.d.ts +12 -0
  63. package/dist/util/renamingHandlers/jsonRenamingHandler.js +34 -0
  64. package/dist/util/renamingHandlers/manifestRenamingHandler.d.ts +4 -5
  65. package/dist/util/renamingHandlers/manifestRenamingHandler.js +7 -18
  66. package/dist/util/requestUtil.d.ts +1 -1
  67. package/dist/util/requestUtil.js +5 -2
  68. package/dist/util/resourceUtil.d.ts +0 -7
  69. package/dist/util/resourceUtil.js +0 -36
  70. package/package.json +3 -2
  71. package/dist/util/movingHandler/fileMoveHandler.d.ts +0 -8
  72. package/dist/util/movingHandler/fileMoveHandler.js +0 -77
  73. package/scripts/publish.ts +0 -256
  74. package/scripts/test-integration-prep.sh +0 -4
package/CHANGELOG.md CHANGED
@@ -2,31 +2,31 @@
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.0-rc.4...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.1...HEAD).
6
6
 
7
- <a name="v1.6.0-rc.4"></a>
8
- ## [v1.6.0-rc.4] - 2026-02-12
7
+ <a name="v1.6.1"></a>
8
+ ## [v1.6.1] - 0001-01-01
9
9
 
10
- <a name="v1.6.0-rc.3"></a>
11
- ## [v1.6.0-rc.3] - 2026-02-05
10
+ <a name="v1.6.0"></a>
11
+ ## [v1.6.0] - 2026-02-26
12
12
 
13
- <a name="v1.6.0-rc.2"></a>
14
- ## [v1.6.0-rc.2] - 2026-02-05
13
+ <a name="v0.2.0"></a>
14
+ ## [v0.2.0] - 2026-02-20
15
15
 
16
- <a name="v1.6.0-rc.1"></a>
17
- ## [v1.6.0-rc.1] - 2026-02-05
16
+ <a name="v0.1.0"></a>
17
+ ## [v0.1.0] - 2026-02-20
18
18
 
19
- <a name="v1.6.0-rc.0"></a>
20
- ## [v1.6.0-rc.0] - 2026-02-02
19
+ <a name="v1.5.4"></a>
20
+ ## [v1.5.4] - 2026-02-16
21
21
 
22
- <a name="v1.6.0"></a>
23
- ## [v1.6.0] - 2026-02-02
22
+ <a name="v1.5.3"></a>
23
+ ## [v1.5.3] - 2025-09-29
24
24
 
25
- <a name="v1.5.2-rc.1"></a>
26
- ## [v1.5.2-rc.1] - 2025-08-22
25
+ <a name="v1.5.2"></a>
26
+ ## [v1.5.2] - 2025-08-25
27
+ ### Bug Fixes
28
+ - Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
27
29
 
28
- <a name="v1.5.2-rc.0"></a>
29
- ## [v1.5.2-rc.0] - 2025-08-19
30
30
 
31
31
  <a name="v1.5.1"></a>
32
32
  ## [v1.5.1] - 2025-08-06
@@ -143,14 +143,13 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
143
143
  <a name="v1.0.0"></a>
144
144
  ## v1.0.0 - 2020-12-09
145
145
 
146
- [v1.6.0-rc.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.3...v1.6.0-rc.4
147
- [v1.6.0-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.2...v1.6.0-rc.3
148
- [v1.6.0-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.1...v1.6.0-rc.2
149
- [v1.6.0-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.0...v1.6.0-rc.1
150
- [v1.6.0-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0...v1.6.0-rc.0
151
- [v1.6.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.1...v1.6.0
152
- [v1.5.2-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.0...v1.5.2-rc.1
153
- [v1.5.2-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2-rc.0
146
+ [v1.6.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0...v1.6.1
147
+ [v1.6.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.2.0...v1.6.0
148
+ [v0.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.1.0...v0.2.0
149
+ [v0.1.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.4...v0.1.0
150
+ [v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.3...v1.5.4
151
+ [v1.5.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2...v1.5.3
152
+ [v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2
154
153
  [v1.5.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.3...v1.5.1
155
154
  [v1.4.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.2...v1.4.3
156
155
  [v1.4.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.0...v1.4.2
@@ -1,3 +1,14 @@
1
- import { BaseAdapter } from "./adapter.js";
2
- export default class AbapAdapter extends BaseAdapter {
1
+ import { IConfiguration } from "../model/configuration.js";
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";
6
+ import AnnotationManager from "../annotationManager.js";
7
+ export default class AbapAdapter implements IAdapter {
8
+ private configuration;
9
+ private annotationManager;
10
+ constructor(configuration: IConfiguration, annotationManager: AnnotationManager);
11
+ createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
12
+ createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
13
+ createPostCommandChain(): PostCommandChain;
3
14
  }
@@ -1,4 +1,45 @@
1
- import { BaseAdapter } from "./adapter.js";
2
- export default class AbapAdapter extends BaseAdapter {
1
+ import { AdaptCommandChain, ManifestUpdateCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
2
+ import AddAppVariantIdHierarchyCommand from "./commands/addAppVariantIdHierarchyCommand.js";
3
+ import ApplyDescriptorChangesCommand from "./commands/applyDescriptorChangesCommand.js";
4
+ import SetAppVariantIdCommand from "./commands/setAppVariantIdCommand.js";
5
+ import UpdateComponentNameCommand from "./commands/updateComponentNameCommand.js";
6
+ import DownloadAnnotationsCommand from "./commands/downloadAnnotationsCommand.js";
7
+ import I18nPropertiesMergeCommand from "./commands/i18nPropertiesMergeCommand.js";
8
+ import UpdateCloudDevAdaptationCommand from "./commands/updateCloudDevAdaptationCommand.js";
9
+ export default class AbapAdapter {
10
+ configuration;
11
+ annotationManager;
12
+ constructor(configuration, annotationManager) {
13
+ this.configuration = configuration;
14
+ this.annotationManager = annotationManager;
15
+ }
16
+ createAdaptCommandChain(baseApp, appVariant) {
17
+ const manifestChanges = appVariant.getProcessedManifestChanges();
18
+ const appVariantIdHierarchyItem = {
19
+ appVariantId: baseApp.id,
20
+ version: baseApp.version,
21
+ layer: "VENDOR"
22
+ };
23
+ return new AdaptCommandChain(baseApp.files, [
24
+ new ManifestUpdateCommandChain([
25
+ new SetAppVariantIdCommand(appVariant.id),
26
+ new UpdateComponentNameCommand(baseApp.id),
27
+ new ApplyDescriptorChangesCommand(manifestChanges, appVariant.prefix),
28
+ new AddAppVariantIdHierarchyCommand(appVariantIdHierarchyItem),
29
+ new UpdateCloudDevAdaptationCommand(),
30
+ ]),
31
+ new DownloadAnnotationsCommand(appVariant.id, appVariant.prefix, this.annotationManager, this.configuration),
32
+ ]);
33
+ }
34
+ createMergeCommandChain(baseApp, appVariant) {
35
+ const manifestChanges = appVariant.getProcessedManifestChanges();
36
+ return new MergeCommandChain([
37
+ new I18nPropertiesMergeCommand(baseApp.i18nPath, appVariant.prefix, manifestChanges),
38
+ ]);
39
+ }
40
+ createPostCommandChain() {
41
+ // No post commands needed for ABAP, return an empty chain
42
+ return new PostCommandChain([]);
43
+ }
3
44
  }
4
45
  //# sourceMappingURL=abapAdapter.js.map
@@ -1,10 +1,8 @@
1
- export interface Adapter {
2
- adapt(files: ReadonlyMap<string, string>, appVariantFiles: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, string>>;
3
- }
4
- export interface Mutator {
5
- mutate(files: Map<string, string>, appVariantFiles: ReadonlyMap<string, string>): Promise<void>;
6
- }
7
- export declare class BaseAdapter implements Adapter {
8
- protected mutators: Mutator[];
9
- adapt(files: ReadonlyMap<string, string>, appVariantFiles: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, string>>;
1
+ import AppVariant from "../appVariantManager.js";
2
+ import BaseApp from "../baseAppManager.js";
3
+ import { AdaptCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
4
+ export interface IAdapter {
5
+ createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
6
+ createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
7
+ createPostCommandChain(): PostCommandChain;
10
8
  }
@@ -1,11 +1,2 @@
1
- export class BaseAdapter {
2
- mutators = [];
3
- async adapt(files, appVariantFiles) {
4
- const filesCopy = new Map(files);
5
- for (const mutator of this.mutators) {
6
- await mutator.mutate(filesCopy, appVariantFiles);
7
- }
8
- return filesCopy;
9
- }
10
- }
1
+ export {};
11
2
  //# sourceMappingURL=adapter.js.map
@@ -1,8 +1,12 @@
1
- import { BaseAdapter, Mutator } from "./adapter.js";
2
- export default class CFAdapter extends BaseAdapter {
3
- protected mutators: XsAppJsonMerger[];
1
+ import { IConfiguration } from "../model/configuration.js";
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";
6
+ export default class CFAdapter implements IAdapter {
7
+ private configuration;
8
+ constructor(configuration: IConfiguration);
9
+ createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
10
+ createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
11
+ createPostCommandChain(): PostCommandChain;
4
12
  }
5
- declare class XsAppJsonMerger implements Mutator {
6
- mutate(files: Map<string, string>, appVariantFiles: ReadonlyMap<string, string>): Promise<void>;
7
- }
8
- export {};
@@ -1,20 +1,46 @@
1
- import { BaseAdapter } from "./adapter.js";
2
- import { merge, XSAPP_JSON_FILENAME } from "../util/cf/xsAppJsonUtil.js";
3
- export default class CFAdapter extends BaseAdapter {
4
- mutators = [
5
- new XsAppJsonMerger()
6
- ];
7
- }
8
- class XsAppJsonMerger {
9
- async mutate(files, appVariantFiles) {
10
- const xsAppJsonFiles = [
11
- appVariantFiles.get(XSAPP_JSON_FILENAME),
12
- files.get(XSAPP_JSON_FILENAME) // base app xs-app.json comes last
13
- ].filter(file => file !== undefined);
14
- const result = merge(xsAppJsonFiles);
15
- if (result) {
16
- files.set(XSAPP_JSON_FILENAME, result);
17
- }
1
+ import { AdaptCommandChain, ManifestUpdateCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
2
+ import XsAppJsonEnhanceRoutesCommand from "./commands/xsAppJsonEnhanceRoutesCommand.js";
3
+ import AddAppVariantIdHierarchyCommand from "./commands/addAppVariantIdHierarchyCommand.js";
4
+ import UpdateCloudDevAdaptationCommand from "./commands/updateCloudDevAdaptationCommand.js";
5
+ import UpdateCloudPlatformCommand from "./commands/updateCloudPlatformCommand.js";
6
+ import ApplyDescriptorChangesCommand from "./commands/applyDescriptorChangesCommand.js";
7
+ import SetAppVariantIdCommand from "./commands/setAppVariantIdCommand.js";
8
+ import UpdateComponentNameCommand from "./commands/updateComponentNameCommand.js";
9
+ import I18nPropertiesMergeCommand from "./commands/i18nPropertiesMergeCommand.js";
10
+ import XsAppJsonMergeCommand from "./commands/xsAppJsonMergeCommand.js";
11
+ export default class CFAdapter {
12
+ configuration;
13
+ constructor(configuration) {
14
+ this.configuration = configuration;
15
+ }
16
+ createAdaptCommandChain(baseApp, appVariant) {
17
+ const manifestChanges = appVariant.getProcessedManifestChanges();
18
+ const appVariantIdHierarchyItem = {
19
+ appVariantId: baseApp.id,
20
+ version: baseApp.version
21
+ };
22
+ return new AdaptCommandChain(baseApp.files, [
23
+ new ManifestUpdateCommandChain([
24
+ new SetAppVariantIdCommand(appVariant.id),
25
+ new UpdateComponentNameCommand(baseApp.id),
26
+ new ApplyDescriptorChangesCommand(manifestChanges, appVariant.prefix),
27
+ new AddAppVariantIdHierarchyCommand(appVariantIdHierarchyItem),
28
+ new UpdateCloudDevAdaptationCommand(),
29
+ new UpdateCloudPlatformCommand(this.configuration.sapCloudService),
30
+ ]),
31
+ ]);
32
+ }
33
+ createMergeCommandChain(baseApp, appVariant) {
34
+ const manifestChanges = appVariant.getProcessedManifestChanges();
35
+ return new MergeCommandChain([
36
+ new I18nPropertiesMergeCommand(baseApp.i18nPath, appVariant.prefix, manifestChanges),
37
+ new XsAppJsonMergeCommand(),
38
+ ]);
39
+ }
40
+ createPostCommandChain() {
41
+ return new PostCommandChain([
42
+ new XsAppJsonEnhanceRoutesCommand(this.configuration),
43
+ ]);
18
44
  }
19
45
  }
20
46
  //# sourceMappingURL=cfAdapter.js.map
@@ -0,0 +1,7 @@
1
+ import { ManifestUpdateCommand } from "./command.js";
2
+ import { IAppVariantIdHierarchyManifestItem } from "../../model/appVariantIdHierarchyItem.js";
3
+ export default class AddAppVariantIdHierarchyLayerCommand extends ManifestUpdateCommand {
4
+ private appVariantIdHierarchyItem;
5
+ constructor(appVariantIdHierarchyItem: IAppVariantIdHierarchyManifestItem);
6
+ execute(manifest: any): Promise<void>;
7
+ }
@@ -0,0 +1,17 @@
1
+ import { ManifestUpdateCommand } from "./command.js";
2
+ import { get } from "../../util/objectPath.js";
3
+ import { getLogger } from "@ui5/logger";
4
+ const log = getLogger("@ui5/task-adaptation::ApplyDescriptorChangesCommand");
5
+ export default class AddAppVariantIdHierarchyLayerCommand extends ManifestUpdateCommand {
6
+ appVariantIdHierarchyItem;
7
+ constructor(appVariantIdHierarchyItem) {
8
+ super();
9
+ this.appVariantIdHierarchyItem = appVariantIdHierarchyItem;
10
+ }
11
+ async execute(manifest) {
12
+ log.verbose(`Adding app variant ID hierarchy item for app variant ${this.appVariantIdHierarchyItem.appVariantId} to manifest`);
13
+ get(manifest, ["sap.ui5", "appVariantIdHierarchy"], [])
14
+ .unshift(this.appVariantIdHierarchyItem);
15
+ }
16
+ }
17
+ //# sourceMappingURL=addAppVariantIdHierarchyCommand.js.map
@@ -0,0 +1,10 @@
1
+ import { ManifestUpdateCommand } from "./command.js";
2
+ import { IChange } from "../../model/types.js";
3
+ export default class ApplyDescriptorChangesCommand extends ManifestUpdateCommand {
4
+ private manifestChanges;
5
+ private prefix;
6
+ constructor(manifestChanges: ReadonlyArray<IChange>, prefix: string);
7
+ execute(manifest: any): Promise<void>;
8
+ private applyDescriptorChanges;
9
+ private adjustAddNewModelEnhanceWith;
10
+ }
@@ -0,0 +1,43 @@
1
+ import BuildStrategy from "../../buildStrategy.js";
2
+ import { AppDescriptorChange, RawApplier, RegistrationBuild } from "../../../dist/bundle.js";
3
+ import { ManifestUpdateCommand } from "./command.js";
4
+ import { getLogger } from "@ui5/logger";
5
+ const log = getLogger("@ui5/task-adaptation::ApplyDescriptorChangesCommand");
6
+ export default class ApplyDescriptorChangesCommand extends ManifestUpdateCommand {
7
+ manifestChanges;
8
+ prefix;
9
+ constructor(manifestChanges, prefix) {
10
+ super();
11
+ this.manifestChanges = manifestChanges;
12
+ this.prefix = prefix;
13
+ }
14
+ async execute(manifest) {
15
+ await this.applyDescriptorChanges(manifest);
16
+ }
17
+ async applyDescriptorChanges(baseAppManifest) {
18
+ log.verbose("Applying appVariant changes");
19
+ const changesContent = new Array();
20
+ const i18nBundleName = this.prefix;
21
+ for (const change of this.manifestChanges) {
22
+ this.adjustAddNewModelEnhanceWith(change, i18nBundleName);
23
+ changesContent.push(new AppDescriptorChange(change));
24
+ }
25
+ if (changesContent.length > 0) {
26
+ const changeHandlers = await Promise.all(changesContent.map(change => RegistrationBuild[change.getChangeType()]()));
27
+ await RawApplier.applyChanges(changeHandlers, baseAppManifest, changesContent, new BuildStrategy());
28
+ }
29
+ }
30
+ adjustAddNewModelEnhanceWith(change, i18nBundleName) {
31
+ if (change.changeType === "appdescr_ui5_addNewModelEnhanceWith") {
32
+ if (change.texts == null) {
33
+ // We need to add texts properties to changes because not all
34
+ // have texts property. Changes without texts property can
35
+ // causes issues in bundle.js This is needed for now, and will
36
+ // be removed as soon as change merger in openUI5 is updated
37
+ change.texts = { i18n: change.content?.bundleUrl || "i18n/i18n.properties" };
38
+ }
39
+ change.texts.i18n = i18nBundleName + "/" + change.texts.i18n;
40
+ }
41
+ }
42
+ }
43
+ //# sourceMappingURL=applyDescriptorChangesCommand.js.map
@@ -0,0 +1,84 @@
1
+ export declare abstract class AdaptCommand {
2
+ readonly commandType = "adapt";
3
+ abstract accept(filename: string): boolean;
4
+ /**
5
+ * Executes the command on the specified file
6
+ * @param files - Map of all files being processed
7
+ * @param filename - The current file being processed
8
+ */
9
+ abstract execute(files: Map<string, string>, filename: string): Promise<void>;
10
+ }
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
+ * @param files - Map of all files being processed
18
+ * @param filename - The current file being processed
19
+ */
20
+ execute(): Promise<ReadonlyMap<string, string>>;
21
+ }
22
+ export declare abstract class MergeCommand {
23
+ readonly commandType = "merge";
24
+ abstract accept(filename: string): boolean;
25
+ /**
26
+ * Executes the command on the specified file
27
+ * @param files - Map of all files being processed
28
+ * @param filename - The current file being processed
29
+ * @param appVariantContent - Content from the app variant
30
+ */
31
+ abstract execute(files: Map<string, string>, filename: string, appVariantContent: string): Promise<void>;
32
+ }
33
+ /**
34
+ * CommandChain implements the Chain of Responsibility pattern
35
+ * It manages a collection of commands and executes them in sequence
36
+ */
37
+ export declare class MergeCommandChain {
38
+ private commands;
39
+ constructor(commands?: MergeCommand[]);
40
+ /**
41
+ * Executes all commands in the chain that accept the given filename
42
+ * @param files - Map of all files being processed
43
+ * @param filename - The current file being processed
44
+ * @param appVariantContent - Content from the app variant
45
+ */
46
+ execute(files: ReadonlyMap<string, string>, appVariantFiles: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, string>>;
47
+ }
48
+ export declare abstract class ManifestUpdateCommand {
49
+ readonly commandType = "manifestUpdate";
50
+ /**
51
+ * The command modifies the manifest in-place.
52
+ * @param manifest base app manifest content as JSON object.
53
+ */
54
+ abstract execute(manifest: any): Promise<void>;
55
+ }
56
+ export declare class ManifestUpdateCommandChain extends AdaptCommand {
57
+ private commands;
58
+ constructor(commands?: ManifestUpdateCommand[]);
59
+ accept: (filename: string) => filename is "manifest.json";
60
+ execute(files: Map<string, string>, filename: string): Promise<void>;
61
+ }
62
+ export declare abstract class PostCommand {
63
+ readonly commandType = "post";
64
+ /**
65
+ * Executes the command on the specified file
66
+ * @param files - Map of all files being processed
67
+ * @param filename - The current file being processed
68
+ * @param appVariantContent - Content from the app variant
69
+ */
70
+ abstract execute(files: Map<string, string>): Promise<void>;
71
+ }
72
+ /**
73
+ * CommandChain implements the Chain of Responsibility pattern
74
+ * It manages a collection of commands and executes them in sequence
75
+ */
76
+ export declare class PostCommandChain {
77
+ protected commands: PostCommand[];
78
+ constructor(commands?: PostCommand[]);
79
+ /**
80
+ * Executes all commands in the chain that accept the given filename
81
+ * @param files - Map of all files being processed
82
+ */
83
+ execute(files: ReadonlyMap<string, string>): Promise<ReadonlyMap<string, string>>;
84
+ }
@@ -0,0 +1,108 @@
1
+ export class AdaptCommand {
2
+ commandType = "adapt";
3
+ }
4
+ export class AdaptCommandChain {
5
+ files;
6
+ commands;
7
+ constructor(files, commands) {
8
+ this.files = files;
9
+ this.commands = commands;
10
+ }
11
+ /**
12
+ * Executes all commands in the chain that accept the given filename
13
+ * @param files - Map of all files being processed
14
+ * @param filename - The current file being processed
15
+ */
16
+ async execute() {
17
+ const filesCopy = new Map(this.files);
18
+ for (const [filename] of filesCopy) {
19
+ for (const command of this.commands) {
20
+ if (command.accept(filename)) {
21
+ await command.execute(filesCopy, filename);
22
+ }
23
+ }
24
+ }
25
+ return filesCopy;
26
+ }
27
+ }
28
+ export class MergeCommand {
29
+ commandType = "merge";
30
+ }
31
+ /**
32
+ * CommandChain implements the Chain of Responsibility pattern
33
+ * It manages a collection of commands and executes them in sequence
34
+ */
35
+ export class MergeCommandChain {
36
+ commands;
37
+ constructor(commands = []) {
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
+ * @param filename - The current file being processed
44
+ * @param appVariantContent - Content from the app variant
45
+ */
46
+ async execute(files, appVariantFiles) {
47
+ const filesCopy = new Map(files);
48
+ for (const [filename, appVariantContent] of appVariantFiles) {
49
+ const acceptedCommands = this.commands.filter(command => command.accept(filename));
50
+ if (acceptedCommands.length > 0) {
51
+ for (const command of acceptedCommands) {
52
+ await command.execute(filesCopy, filename, appVariantContent);
53
+ }
54
+ }
55
+ else {
56
+ filesCopy.set(filename, appVariantContent);
57
+ }
58
+ }
59
+ return filesCopy;
60
+ }
61
+ }
62
+ export class ManifestUpdateCommand {
63
+ commandType = "manifestUpdate";
64
+ }
65
+ export class ManifestUpdateCommandChain extends AdaptCommand {
66
+ commands;
67
+ constructor(commands = []) {
68
+ super();
69
+ this.commands = commands;
70
+ }
71
+ accept = (filename) => filename === "manifest.json";
72
+ async execute(files, filename) {
73
+ const manifestContent = files.get(filename);
74
+ if (!manifestContent) {
75
+ throw new Error("Original application should have manifest.json in root folder");
76
+ }
77
+ const manifest = JSON.parse(manifestContent);
78
+ for (const command of this.commands) {
79
+ await command.execute(manifest);
80
+ }
81
+ files.set(filename, JSON.stringify(manifest));
82
+ }
83
+ }
84
+ export class PostCommand {
85
+ commandType = "post";
86
+ }
87
+ /**
88
+ * CommandChain implements the Chain of Responsibility pattern
89
+ * It manages a collection of commands and executes them in sequence
90
+ */
91
+ export class PostCommandChain {
92
+ commands;
93
+ constructor(commands = []) {
94
+ this.commands = commands;
95
+ }
96
+ /**
97
+ * Executes all commands in the chain that accept the given filename
98
+ * @param files - Map of all files being processed
99
+ */
100
+ async execute(files) {
101
+ const filesCopy = new Map(files);
102
+ for (const command of this.commands) {
103
+ await command.execute(filesCopy);
104
+ }
105
+ return filesCopy;
106
+ }
107
+ }
108
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1,12 @@
1
+ import AnnotationManager from "../../annotationManager.js";
2
+ import { IConfiguration } from "../../model/configuration.js";
3
+ import { AdaptCommand } from "./command.js";
4
+ export default class DownloadAnnotationsCommand extends AdaptCommand {
5
+ private appVariantId;
6
+ private prefix;
7
+ private annotationManager;
8
+ private configuration;
9
+ constructor(appVariantId: string, prefix: string, annotationManager: AnnotationManager, configuration: IConfiguration);
10
+ accept: (filename: string) => filename is "manifest.json";
11
+ execute(files: Map<string, string>, filename: string): Promise<void>;
12
+ }
@@ -0,0 +1,26 @@
1
+ import { AdaptCommand } from "./command.js";
2
+ import Language from "../../model/language.js";
3
+ export default class DownloadAnnotationsCommand extends AdaptCommand {
4
+ appVariantId;
5
+ prefix;
6
+ annotationManager;
7
+ configuration;
8
+ constructor(appVariantId, prefix, annotationManager, configuration) {
9
+ super();
10
+ this.appVariantId = appVariantId;
11
+ this.prefix = prefix;
12
+ this.annotationManager = annotationManager;
13
+ this.configuration = configuration;
14
+ }
15
+ accept = (filename) => filename === "manifest.json";
16
+ async execute(files, filename) {
17
+ const languages = Language.create(this.configuration.languages);
18
+ const baseAppManifest = JSON.parse(files.get(filename));
19
+ let newFiles = await this.annotationManager.process(baseAppManifest, languages, this.appVariantId, this.prefix);
20
+ if (newFiles) {
21
+ newFiles.forEach((value, key) => files.set(key, value));
22
+ }
23
+ files.set(filename, JSON.stringify(baseAppManifest));
24
+ }
25
+ }
26
+ //# sourceMappingURL=downloadAnnotationsCommand.js.map
@@ -1,11 +1,14 @@
1
- import AppVariant from "../appVariantManager.js";
2
- import { IChange } from "../model/types.js";
3
- export default class FileMerger {
4
- static analyzeAppVariantManifestChanges(manifestChanges: ReadonlyArray<IChange>): {
5
- mergePaths: RegExp[];
6
- copyPaths: RegExp[];
7
- };
8
- static merge(baseAppFiles: ReadonlyMap<string, string>, i18nPath: string, appVariant: AppVariant): Map<string, string>;
1
+ import { IChange } from "../../model/types.js";
2
+ import { MergeCommand } from "./command.js";
3
+ export default class I18nPropertiesMergeCommand extends MergeCommand {
4
+ private i18nPath;
5
+ private prefix;
6
+ private mergePaths;
7
+ private copyPaths;
8
+ constructor(i18nPath: string, prefix: string, manifestChanges: ReadonlyArray<IChange>);
9
+ accept: (filename: string) => boolean;
10
+ private analyzeAppVariantManifestChanges;
11
+ execute(files: Map<string, string>, filename: string, appVariantContent: string): Promise<void>;
9
12
  /**
10
13
  * Filters out specific lines from the given string.
11
14
  * Removes lines matching:
@@ -13,7 +16,7 @@ export default class FileMerger {
13
16
  * - ABAP_TRANSLATION
14
17
  * - SAPUI5 TRANSLATION-KEY
15
18
  */
16
- private static filterTranslationMetaLines;
19
+ private filterTranslationMetaLines;
17
20
  /**
18
21
  * Merge/Append base property file with property file from app variant
19
22
  * FIXME Currently merge could duplicate keys which causes undefined
@@ -22,5 +25,5 @@ export default class FileMerger {
22
25
  * app variant Id as prefix => If we filter on them we do not need to remove
23
26
  * existing overwritten keys (as there should be none)
24
27
  */
25
- private static mergePropertiesFiles;
28
+ private mergePropertiesFiles;
26
29
  }