@ui5/task-adaptation 1.6.4 → 1.6.5-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -6
- package/dist/adapters/abapAdapter.d.ts +2 -4
- package/dist/adapters/abapAdapter.js +2 -4
- package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +2 -4
- package/dist/adapters/commands/downloadAnnotationsCommand.js +2 -6
- package/dist/annotations/abapAnnotationManager.d.ts +17 -0
- package/dist/{annotationManager.js → annotations/abapAnnotationManager.js} +12 -10
- package/dist/annotations/annotationManager.d.ts +3 -0
- package/dist/annotations/annotationManager.js +2 -0
- package/dist/annotations/cfAnnotationManager.d.ts +4 -0
- package/dist/annotations/cfAnnotationManager.js +7 -0
- package/dist/annotations/localAnnotationManager.d.ts +4 -0
- package/dist/annotations/localAnnotationManager.js +7 -0
- package/dist/annotations/serviceRequestor.d.ts +3 -3
- package/dist/annotations/serviceRequestor.js +4 -4
- package/dist/index.js +5 -6
- package/dist/landscapeConfiguration.d.ts +9 -0
- package/dist/landscapeConfiguration.js +94 -0
- package/dist/model/configuration.d.ts +7 -1
- package/dist/model/configuration.js +2 -1
- package/dist/previewManager.d.ts +2 -2
- package/dist/previewManager.js +7 -7
- package/dist/repositories/abapProvider.d.ts +1 -1
- package/dist/repositories/abapProvider.js +3 -18
- package/dist/repositories/{abapRepoManager.d.ts → abapRepository.d.ts} +5 -3
- package/dist/repositories/{abapRepoManager.js → abapRepository.js} +17 -4
- package/dist/repositories/html5Repository.d.ts +19 -0
- package/dist/repositories/{html5RepoManager.js → html5Repository.js} +59 -27
- package/dist/repositories/localRepository.d.ts +16 -0
- package/dist/repositories/localRepository.js +67 -0
- package/dist/repositories/repository.d.ts +8 -0
- package/dist/repositories/repository.js +2 -0
- package/dist/util/commonUtil.d.ts +1 -0
- package/dist/util/commonUtil.js +3 -0
- package/dist/util/fsUtil.d.ts +2 -0
- package/dist/util/fsUtil.js +34 -0
- package/dist/util/validator/abapValidator.d.ts +8 -0
- package/dist/util/validator/abapValidator.js +26 -0
- package/dist/util/validator/cfValidator.d.ts +6 -0
- package/dist/util/validator/cfValidator.js +8 -0
- package/dist/util/validator/validator.d.ts +6 -0
- package/dist/util/validator/validator.js +4 -0
- package/package.json +4 -7
- package/scripts/publish.ts +256 -0
- package/scripts/test-integration-prep.sh +4 -0
- package/dist/annotationManager.d.ts +0 -17
- package/dist/processors/abapProcessor.d.ts +0 -18
- package/dist/processors/abapProcessor.js +0 -43
- package/dist/processors/cfProcessor.d.ts +0 -14
- package/dist/processors/cfProcessor.js +0 -46
- package/dist/processors/previewProcessor.d.ts +0 -8
- package/dist/processors/previewProcessor.js +0 -11
- package/dist/processors/processor.d.ts +0 -10
- package/dist/processors/processor.js +0 -39
- package/dist/repositories/html5RepoManager.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,22 @@
|
|
|
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
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.2...HEAD).
|
|
6
6
|
|
|
7
|
-
<a name="v1.6.
|
|
8
|
-
## [v1.6.
|
|
7
|
+
<a name="v1.6.5-rc.2"></a>
|
|
8
|
+
## [v1.6.5-rc.2] - 2026-04-14
|
|
9
|
+
|
|
10
|
+
<a name="v1.6.5-rc.1"></a>
|
|
11
|
+
## [v1.6.5-rc.1] - 2026-04-13
|
|
12
|
+
|
|
13
|
+
<a name="v1.6.4-rc.3"></a>
|
|
14
|
+
## [v1.6.4-rc.3] - 2026-04-07
|
|
15
|
+
|
|
16
|
+
<a name="v1.6.4-rc.2"></a>
|
|
17
|
+
## [v1.6.4-rc.2] - 2026-04-06
|
|
18
|
+
|
|
19
|
+
<a name="v1.6.4-rc.1"></a>
|
|
20
|
+
## [v1.6.4-rc.1] - 2026-04-06
|
|
9
21
|
|
|
10
22
|
<a name="v1.6.3"></a>
|
|
11
23
|
## [v1.6.3] - 2026-03-18
|
|
@@ -27,6 +39,24 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
|
|
|
27
39
|
|
|
28
40
|
<a name="v1.5.4"></a>
|
|
29
41
|
## [v1.5.4] - 2026-02-16
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
- Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<a name="v1.6.0-rc.4"></a>
|
|
47
|
+
## [v1.6.0-rc.4] - 2026-02-12
|
|
48
|
+
|
|
49
|
+
<a name="v1.6.0-rc.3"></a>
|
|
50
|
+
## [v1.6.0-rc.3] - 2026-02-05
|
|
51
|
+
|
|
52
|
+
<a name="v1.6.0-rc.2"></a>
|
|
53
|
+
## [v1.6.0-rc.2] - 2026-02-05
|
|
54
|
+
|
|
55
|
+
<a name="v1.6.0-rc.1"></a>
|
|
56
|
+
## [v1.6.0-rc.1] - 2026-02-05
|
|
57
|
+
|
|
58
|
+
<a name="v1.6.0-rc.0"></a>
|
|
59
|
+
## [v1.6.0-rc.0] - 2026-02-02
|
|
30
60
|
|
|
31
61
|
<a name="v1.5.3"></a>
|
|
32
62
|
## [v1.5.3] - 2025-09-29
|
|
@@ -37,6 +67,12 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
|
|
|
37
67
|
- Removed moved changes [`babdc1b`](https://github.com/SAP/ui5-task-adaptation/commit/babdc1bce8e407b2638e014cfaa4e6547bba10ac)
|
|
38
68
|
|
|
39
69
|
|
|
70
|
+
<a name="v1.5.2-rc.1"></a>
|
|
71
|
+
## [v1.5.2-rc.1] - 2025-08-22
|
|
72
|
+
|
|
73
|
+
<a name="v1.5.2-rc.0"></a>
|
|
74
|
+
## [v1.5.2-rc.0] - 2025-08-19
|
|
75
|
+
|
|
40
76
|
<a name="v1.5.1"></a>
|
|
41
77
|
## [v1.5.1] - 2025-08-06
|
|
42
78
|
|
|
@@ -152,16 +188,27 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
|
|
|
152
188
|
<a name="v1.0.0"></a>
|
|
153
189
|
## v1.0.0 - 2020-12-09
|
|
154
190
|
|
|
155
|
-
[v1.6.
|
|
191
|
+
[v1.6.5-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5-rc.1...v1.6.5-rc.2
|
|
192
|
+
[v1.6.5-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.3...v1.6.5-rc.1
|
|
193
|
+
[v1.6.4-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.2...v1.6.4-rc.3
|
|
194
|
+
[v1.6.4-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4-rc.1...v1.6.4-rc.2
|
|
195
|
+
[v1.6.4-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.3...v1.6.4-rc.1
|
|
156
196
|
[v1.6.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.2...v1.6.3
|
|
157
197
|
[v1.6.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.1...v1.6.2
|
|
158
198
|
[v1.6.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0...v1.6.1
|
|
159
199
|
[v1.6.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.2.0...v1.6.0
|
|
160
200
|
[v0.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v0.1.0...v0.2.0
|
|
161
201
|
[v0.1.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.4...v0.1.0
|
|
162
|
-
[v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.
|
|
202
|
+
[v1.5.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.4...v1.5.4
|
|
203
|
+
[v1.6.0-rc.4]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.3...v1.6.0-rc.4
|
|
204
|
+
[v1.6.0-rc.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.2...v1.6.0-rc.3
|
|
205
|
+
[v1.6.0-rc.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.1...v1.6.0-rc.2
|
|
206
|
+
[v1.6.0-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.0-rc.0...v1.6.0-rc.1
|
|
207
|
+
[v1.6.0-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.3...v1.6.0-rc.0
|
|
163
208
|
[v1.5.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2...v1.5.3
|
|
164
|
-
[v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2
|
|
209
|
+
[v1.5.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.1...v1.5.2
|
|
210
|
+
[v1.5.2-rc.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.2-rc.0...v1.5.2-rc.1
|
|
211
|
+
[v1.5.2-rc.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.5.1...v1.5.2-rc.0
|
|
165
212
|
[v1.5.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.3...v1.5.1
|
|
166
213
|
[v1.4.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.2...v1.4.3
|
|
167
214
|
[v1.4.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.4.0...v1.4.2
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { IConfiguration } from "../model/configuration.js";
|
|
2
1
|
import { IAdapter } from "./adapter.js";
|
|
3
2
|
import { AdaptCommandChain, MergeCommandChain, PostCommandChain } from "./commands/command.js";
|
|
4
3
|
import BaseApp from "../baseAppManager.js";
|
|
5
4
|
import AppVariant from "../appVariantManager.js";
|
|
6
|
-
import
|
|
5
|
+
import IAnnotationManager from "../annotations/annotationManager.js";
|
|
7
6
|
export default class AbapAdapter implements IAdapter {
|
|
8
|
-
private configuration;
|
|
9
7
|
private annotationManager;
|
|
10
|
-
constructor(
|
|
8
|
+
constructor(annotationManager: IAnnotationManager);
|
|
11
9
|
createAdaptCommandChain(baseApp: BaseApp, appVariant: AppVariant): AdaptCommandChain;
|
|
12
10
|
createMergeCommandChain(baseApp: BaseApp, appVariant: AppVariant): MergeCommandChain;
|
|
13
11
|
createPostCommandChain(): PostCommandChain;
|
|
@@ -3,10 +3,8 @@ 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;
|
|
7
6
|
annotationManager;
|
|
8
|
-
constructor(
|
|
9
|
-
this.configuration = configuration;
|
|
7
|
+
constructor(annotationManager) {
|
|
10
8
|
this.annotationManager = annotationManager;
|
|
11
9
|
}
|
|
12
10
|
createAdaptCommandChain(baseApp, appVariant) {
|
|
@@ -19,7 +17,7 @@ export default class AbapAdapter {
|
|
|
19
17
|
new ManifestUpdateCommandChain([
|
|
20
18
|
...getCommonManifestUpdateCommands(baseApp, appVariant, appVariantIdHierarchyItem),
|
|
21
19
|
]),
|
|
22
|
-
new DownloadAnnotationsCommand(appVariant.id, appVariant.prefix, this.annotationManager
|
|
20
|
+
new DownloadAnnotationsCommand(appVariant.id, appVariant.prefix, this.annotationManager),
|
|
23
21
|
]);
|
|
24
22
|
}
|
|
25
23
|
createMergeCommandChain(baseApp, appVariant) {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import AnnotationManager from "../../annotationManager.js";
|
|
2
|
-
import { IConfiguration } from "../../model/configuration.js";
|
|
3
1
|
import { AdaptCommand } from "./command.js";
|
|
2
|
+
import IAnnotationManager from "../../annotations/annotationManager.js";
|
|
4
3
|
export default class DownloadAnnotationsCommand extends AdaptCommand {
|
|
5
4
|
private appVariantId;
|
|
6
5
|
private prefix;
|
|
7
6
|
private annotationManager;
|
|
8
|
-
|
|
9
|
-
constructor(appVariantId: string, prefix: string, annotationManager: AnnotationManager, configuration: IConfiguration);
|
|
7
|
+
constructor(appVariantId: string, prefix: string, annotationManager: IAnnotationManager);
|
|
10
8
|
accept: (filename: string) => filename is "manifest.json";
|
|
11
9
|
execute(files: Map<string, string>, filename: string): Promise<void>;
|
|
12
10
|
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { AdaptCommand } from "./command.js";
|
|
2
|
-
import Language from "../../model/language.js";
|
|
3
2
|
export default class DownloadAnnotationsCommand extends AdaptCommand {
|
|
4
3
|
appVariantId;
|
|
5
4
|
prefix;
|
|
6
5
|
annotationManager;
|
|
7
|
-
|
|
8
|
-
constructor(appVariantId, prefix, annotationManager, configuration) {
|
|
6
|
+
constructor(appVariantId, prefix, annotationManager) {
|
|
9
7
|
super();
|
|
10
8
|
this.appVariantId = appVariantId;
|
|
11
9
|
this.prefix = prefix;
|
|
12
10
|
this.annotationManager = annotationManager;
|
|
13
|
-
this.configuration = configuration;
|
|
14
11
|
}
|
|
15
12
|
accept = (filename) => filename === "manifest.json";
|
|
16
13
|
async execute(files, filename) {
|
|
17
|
-
const languages = Language.create(this.configuration.languages);
|
|
18
14
|
const baseAppManifest = JSON.parse(files.get(filename));
|
|
19
|
-
let newFiles = await this.annotationManager.process(baseAppManifest,
|
|
15
|
+
let newFiles = await this.annotationManager.process(baseAppManifest, this.appVariantId, this.prefix);
|
|
20
16
|
if (newFiles) {
|
|
21
17
|
newFiles.forEach((value, key) => files.set(key, value));
|
|
22
18
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IConfiguration } from "../model/types.js";
|
|
2
|
+
import IAnnotationManager from "./annotationManager.js";
|
|
3
|
+
import IRepository from "../repositories/repository.js";
|
|
4
|
+
export interface IAnnotationFiles {
|
|
5
|
+
annotationName: string;
|
|
6
|
+
annotationFileName: string;
|
|
7
|
+
}
|
|
8
|
+
export default class AbapAnnotationManager implements IAnnotationManager {
|
|
9
|
+
private repository;
|
|
10
|
+
private configuration;
|
|
11
|
+
constructor(configuration: IConfiguration, repository: IRepository);
|
|
12
|
+
ANNOTATIONS_FOLDER: string;
|
|
13
|
+
process(baseAppManifest: any, appVariantId: string, prefix: string): Promise<Map<string, string>>;
|
|
14
|
+
private updateManifestModel;
|
|
15
|
+
private createManifestModel;
|
|
16
|
+
private enhanceManifestModel;
|
|
17
|
+
}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import DataSourceManager from "./
|
|
2
|
-
import I18nManager from "
|
|
3
|
-
import
|
|
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";
|
|
4
5
|
import { posix as path } from "path";
|
|
5
6
|
const I18N_DEFAULT_PATH = "i18n/annotations";
|
|
6
7
|
const I18N_DEFAULT_MODEL_NAME = "@i18n";
|
|
7
8
|
const SAPUI5 = "sap.ui5";
|
|
8
|
-
export default class
|
|
9
|
-
|
|
9
|
+
export default class AbapAnnotationManager {
|
|
10
|
+
repository;
|
|
10
11
|
configuration;
|
|
11
|
-
constructor(configuration,
|
|
12
|
+
constructor(configuration, repository) {
|
|
12
13
|
this.configuration = configuration;
|
|
13
|
-
this.
|
|
14
|
+
this.repository = repository;
|
|
14
15
|
}
|
|
15
16
|
ANNOTATIONS_FOLDER = "annotations";
|
|
16
|
-
async process(baseAppManifest,
|
|
17
|
+
async process(baseAppManifest, appVariantId, prefix) {
|
|
18
|
+
const languages = Language.create(this.configuration.languages);
|
|
17
19
|
//TODO: switch to this after resolving @i18n custom model
|
|
18
20
|
const modelName = I18N_DEFAULT_MODEL_NAME; //`i18n_a9n_${normalisedId}`;
|
|
19
21
|
const i18nPathName = path.join(prefix, I18N_DEFAULT_PATH);
|
|
20
22
|
const i18nManager = new I18nManager(modelName, appVariantId, languages);
|
|
21
|
-
const serviceRequestor = new ServiceRequestor(this.configuration, this.
|
|
23
|
+
const serviceRequestor = new ServiceRequestor(this.configuration, this.repository);
|
|
22
24
|
const dataSourceManager = new DataSourceManager();
|
|
23
25
|
dataSourceManager.addDataSources(baseAppManifest["sap.app"]?.dataSources);
|
|
24
26
|
const annotationFiles = await dataSourceManager.createAnnotationFiles(languages, i18nManager, serviceRequestor);
|
|
@@ -69,4 +71,4 @@ export default class AnnotationManager {
|
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
//# sourceMappingURL=
|
|
74
|
+
//# sourceMappingURL=abapAnnotationManager.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import AbapRepoManager from "../repositories/abapRepoManager.js";
|
|
2
1
|
import { IConfiguration } from "../model/types.js";
|
|
3
2
|
import Language from "../model/language.js";
|
|
3
|
+
import IRepository from "../repositories/repository.js";
|
|
4
4
|
export default class ServiceRequestor {
|
|
5
|
-
private
|
|
5
|
+
private repository;
|
|
6
6
|
private configuration;
|
|
7
|
-
constructor(configuration: IConfiguration,
|
|
7
|
+
constructor(configuration: IConfiguration, repository: IRepository);
|
|
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
|
-
|
|
38
|
+
repository;
|
|
39
39
|
configuration;
|
|
40
|
-
constructor(configuration,
|
|
41
|
-
this.
|
|
40
|
+
constructor(configuration, repository) {
|
|
41
|
+
this.repository = repository;
|
|
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.
|
|
50
|
+
let files = await this.repository.downloadAnnotationFile(uri);
|
|
51
51
|
if (!files || files.size === 0) {
|
|
52
52
|
throw new Error(`No files were fetched for '${name}' by '${uri}'`);
|
|
53
53
|
}
|
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";
|
|
7
6
|
import FilesUtil from "./util/filesUtil.js";
|
|
8
7
|
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,11 +13,10 @@ export default ({ workspace, options, taskUtil }) => {
|
|
|
13
13
|
dotenv.config();
|
|
14
14
|
async function process(workspace, taskUtil) {
|
|
15
15
|
logBuilderVersion();
|
|
16
|
-
const
|
|
17
|
-
const adapter = processor.getAdapter();
|
|
16
|
+
const { repository, adapter } = initialize(options.configuration);
|
|
18
17
|
const adaptationProject = await AppVariant.fromWorkspace(workspace, options.projectNamespace);
|
|
19
|
-
const previewManagerPromise = PreviewManager.createFromRoot(adaptationProject.reference,
|
|
20
|
-
const appVariantIdHierarchy = await
|
|
18
|
+
const previewManagerPromise = PreviewManager.createFromRoot(adaptationProject.reference, repository, options.configuration);
|
|
19
|
+
const appVariantIdHierarchy = await repository.getAppVariantIdHierarchy(adaptationProject.reference);
|
|
21
20
|
if (appVariantIdHierarchy.length === 0) {
|
|
22
21
|
throw new Error(`No app variant found for reference ${adaptationProject.reference}`);
|
|
23
22
|
}
|
|
@@ -25,7 +24,7 @@ export default ({ workspace, options, taskUtil }) => {
|
|
|
25
24
|
// latest app variant on top. We reverse the list to process original
|
|
26
25
|
// application first and then app variants in chronological order.
|
|
27
26
|
const reversedHierarchy = appVariantIdHierarchy.toReversed();
|
|
28
|
-
const fetchFilesPromises = reversedHierarchy.map(({ repoName, cachebusterToken }) =>
|
|
27
|
+
const fetchFilesPromises = reversedHierarchy.map(({ repoName, cachebusterToken }) => repository.fetch(repoName, cachebusterToken));
|
|
29
28
|
fetchFilesPromises.push(Promise.resolve(adaptationProject.files));
|
|
30
29
|
const appVariants = new Array();
|
|
31
30
|
const adapt = async (baseAppFiles, appVariantFiles) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IConfiguration } from "./model/types.js";
|
|
2
|
+
import { IAdapter } from "./adapters/adapter.js";
|
|
3
|
+
import IRepository from "./repositories/repository.js";
|
|
4
|
+
import IAnnotationManager from "./annotations/annotationManager.js";
|
|
5
|
+
export declare function initialize(configuration: IConfiguration): {
|
|
6
|
+
adapter: IAdapter;
|
|
7
|
+
repository: IRepository;
|
|
8
|
+
annotationManager: IAnnotationManager;
|
|
9
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import AbapAdapter from "./adapters/abapAdapter.js";
|
|
2
|
+
import CFAdapter from "./adapters/cfAdapter.js";
|
|
3
|
+
import PreviewAdapter from "./adapters/previewAdapter.js";
|
|
4
|
+
import AbapRepository from "./repositories/abapRepository.js";
|
|
5
|
+
import HTML5Repository from "./repositories/html5Repository.js";
|
|
6
|
+
import LocalRepository from "./repositories/localRepository.js";
|
|
7
|
+
import AbapAnnotationManager from "./annotations/abapAnnotationManager.js";
|
|
8
|
+
import CFAnnotationManager from "./annotations/cfAnnotationManager.js";
|
|
9
|
+
import CFValidator from "./util/validator/cfValidator.js";
|
|
10
|
+
import AbapValidator from "./util/validator/abapValidator.js";
|
|
11
|
+
import { isOneOf } from "./util/validator/validator.js";
|
|
12
|
+
import { LANDSCAPE_TYPES } from "./model/configuration.js";
|
|
13
|
+
import { getLogger } from "@ui5/logger";
|
|
14
|
+
import LocalAnnotationManager from "./annotations/localAnnotationManager.js";
|
|
15
|
+
const log = getLogger("@ui5/task-adaptation::LandscapeConfiguration");
|
|
16
|
+
export function initialize(configuration) {
|
|
17
|
+
const type = getTypeByConfiguration(configuration);
|
|
18
|
+
const enhancedConfig = { ...configuration, type };
|
|
19
|
+
const repository = getRepository(enhancedConfig);
|
|
20
|
+
const annotationManager = getAnnotationManager(enhancedConfig, repository);
|
|
21
|
+
return {
|
|
22
|
+
adapter: getAdapter(enhancedConfig, annotationManager),
|
|
23
|
+
repository,
|
|
24
|
+
annotationManager
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function getTypeByConfiguration(configuration) {
|
|
28
|
+
const validators = [
|
|
29
|
+
new CFValidator(),
|
|
30
|
+
new AbapValidator(),
|
|
31
|
+
];
|
|
32
|
+
if (isOneOf(LANDSCAPE_TYPES, configuration.type)) {
|
|
33
|
+
return configuration.type;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
log.warn("Deprecated behavior: type is not specified or invalid. Should be either 'cf' or 'abap'. Trying to detect the type based on provided configuration");
|
|
37
|
+
for (const validator of validators) {
|
|
38
|
+
try {
|
|
39
|
+
validator.validateConfiguration(configuration);
|
|
40
|
+
return validator.type;
|
|
41
|
+
}
|
|
42
|
+
catch (_error) {
|
|
43
|
+
// Continue to the next validator if validation fails
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw new Error("'type' should be specified in ui5.yaml configuration: 'cf' or 'abap'");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getAdapter(configuration, annotationManager) {
|
|
50
|
+
if (isPreview(configuration)) {
|
|
51
|
+
return new PreviewAdapter(configuration);
|
|
52
|
+
}
|
|
53
|
+
switch (configuration.type) {
|
|
54
|
+
case "abap":
|
|
55
|
+
return new AbapAdapter(annotationManager);
|
|
56
|
+
case "cf":
|
|
57
|
+
return new CFAdapter(configuration);
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`No adapter found for the given configuration type '${configuration.type}'`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function getRepository(configuration) {
|
|
63
|
+
if (isLocal(configuration)) {
|
|
64
|
+
return new LocalRepository(configuration);
|
|
65
|
+
}
|
|
66
|
+
switch (configuration.type) {
|
|
67
|
+
case "abap":
|
|
68
|
+
return new AbapRepository(configuration);
|
|
69
|
+
case "cf":
|
|
70
|
+
return new HTML5Repository(configuration);
|
|
71
|
+
default:
|
|
72
|
+
throw new Error(`No repository found for the given configuration type '${configuration.type}'`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function getAnnotationManager(configuration, repository) {
|
|
76
|
+
if (isLocal(configuration)) {
|
|
77
|
+
return new LocalAnnotationManager();
|
|
78
|
+
}
|
|
79
|
+
switch (configuration.type) {
|
|
80
|
+
case "abap":
|
|
81
|
+
return new AbapAnnotationManager(configuration, repository);
|
|
82
|
+
case "cf":
|
|
83
|
+
return new CFAnnotationManager();
|
|
84
|
+
default:
|
|
85
|
+
throw new Error(`No annotation manager found for the given configuration type '${configuration.type}'`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function isLocal(configuration) {
|
|
89
|
+
return process.env.ADP_BUILDER_MODE === "local" || configuration.mode === "local";
|
|
90
|
+
}
|
|
91
|
+
function isPreview(configuration) {
|
|
92
|
+
return process.env.ADP_BUILDER_MODE === "preview" || configuration.mode === "preview";
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=landscapeConfiguration.js.map
|
|
@@ -8,14 +8,20 @@ export interface IConfiguration {
|
|
|
8
8
|
org?: string;
|
|
9
9
|
sapCloudService?: string;
|
|
10
10
|
destination?: string;
|
|
11
|
-
type?:
|
|
11
|
+
type?: LandscapeType;
|
|
12
|
+
mode?: LandscapeMode;
|
|
12
13
|
languages?: any[] | undefined;
|
|
13
14
|
enableAnnotationCache?: boolean;
|
|
14
15
|
enableBetaFeatures?: boolean;
|
|
15
16
|
writeTempFiles?: any;
|
|
16
17
|
target?: AbapTarget & IAbapTargetMeta;
|
|
17
18
|
serviceInstanceName?: string;
|
|
19
|
+
adpDir?: string;
|
|
18
20
|
}
|
|
21
|
+
export declare const LANDSCAPE_TYPES: readonly ["cf", "abap"];
|
|
22
|
+
export type LandscapeType = typeof LANDSCAPE_TYPES[number];
|
|
23
|
+
export declare const LANDSCAPE_MODES: readonly ["preview", "local", "default"];
|
|
24
|
+
export type LandscapeMode = typeof LANDSCAPE_MODES[number];
|
|
19
25
|
export interface IAbapTargetMeta {
|
|
20
26
|
name?: string;
|
|
21
27
|
ignoreCertErrors?: boolean;
|
package/dist/previewManager.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import IProcessor from "./processors/processor.js";
|
|
2
1
|
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,
|
|
6
|
+
static createFromRoot(appId: string, repository: IRepository, configuration: IConfiguration): Promise<PreviewManager>;
|
|
7
7
|
static isPreviewRequested(): boolean;
|
|
8
8
|
private constructor();
|
|
9
9
|
processPreviewResources(baseAppFiles: ReadonlyMap<string, string>): Promise<void>;
|
package/dist/previewManager.js
CHANGED
|
@@ -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,
|
|
13
|
+
static async createFromRoot(appId, repository, 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,
|
|
26
|
+
return new PreviewManager(appId, ui5AppInfo, repository, configuration);
|
|
27
27
|
}
|
|
28
28
|
static isPreviewRequested() {
|
|
29
29
|
return process.env.ADP_BUILDER_MODE === "preview";
|
|
30
30
|
}
|
|
31
|
-
constructor(appId, ui5AppInfo,
|
|
31
|
+
constructor(appId, ui5AppInfo, repository, 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,
|
|
44
|
+
this.fetchLibsPromises = this.preReadLibs(reuseLibs, repository);
|
|
45
45
|
}
|
|
46
46
|
const logMap = {
|
|
47
47
|
Error: log.error,
|
|
@@ -89,13 +89,13 @@ export default class PreviewManager {
|
|
|
89
89
|
}
|
|
90
90
|
await ResourceUtil.writeInProject(REUSE_DIR, mergedFiles);
|
|
91
91
|
}
|
|
92
|
-
preReadLibs(reuseLibs,
|
|
92
|
+
preReadLibs(reuseLibs, repository) {
|
|
93
93
|
const promises = new Map();
|
|
94
94
|
reuseLibs.forEach(lib => {
|
|
95
95
|
log.info(`Downloading reuse library '${lib.html5AppName}' version '${lib.html5AppVersion}'`);
|
|
96
|
-
const promise =
|
|
96
|
+
const promise = repository
|
|
97
97
|
.fetchReuseLib(lib.html5AppName, lib.html5CacheBusterToken, lib)
|
|
98
|
-
.then(libFiles => PreviewManager.moveLibraryFiles(libFiles, lib.html5AppName, lib.name));
|
|
98
|
+
.then((libFiles) => PreviewManager.moveLibraryFiles(libFiles, lib.html5AppName, lib.name));
|
|
99
99
|
promises.set(lib.html5AppName, promise);
|
|
100
100
|
});
|
|
101
101
|
return promises;
|
|
@@ -2,6 +2,6 @@ import type { AbapServiceProvider } from "@sap-ux/axios-extension";
|
|
|
2
2
|
import { IConfiguration } from "../model/types.js";
|
|
3
3
|
export default class AbapProvider {
|
|
4
4
|
private provider;
|
|
5
|
+
private abapValidator;
|
|
5
6
|
get({ target, destination }: IConfiguration): Promise<AbapServiceProvider>;
|
|
6
|
-
private static validateAndGetAbapTarget;
|
|
7
7
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createAbapServiceProvider } from "@sap-ux/system-access";
|
|
2
|
-
import BtpUtils from "@sap-ux/btp-utils";
|
|
3
2
|
import { getLogger } from "@ui5/logger";
|
|
4
|
-
import
|
|
3
|
+
import AbapValidator from "../util/validator/abapValidator.js";
|
|
5
4
|
const log = getLogger("@ui5/task-adaptation::AbapProvider");
|
|
6
5
|
log.debug = (message) => log.verbose(message);
|
|
7
6
|
export default class AbapProvider {
|
|
8
7
|
provider = null;
|
|
8
|
+
abapValidator = new AbapValidator();
|
|
9
9
|
async get({ target, destination }) {
|
|
10
10
|
if (!this.provider) {
|
|
11
|
-
const abapTarget =
|
|
11
|
+
const abapTarget = this.abapValidator.validateAndGetAbapTarget(target, destination);
|
|
12
12
|
if (abapTarget) {
|
|
13
13
|
this.provider = await createAbapServiceProvider(abapTarget, { ignoreCertErrors: abapTarget.ignoreCertErrors }, true, log);
|
|
14
14
|
}
|
|
@@ -18,20 +18,5 @@ export default class AbapProvider {
|
|
|
18
18
|
}
|
|
19
19
|
return this.provider;
|
|
20
20
|
}
|
|
21
|
-
static validateAndGetAbapTarget(target, destination) {
|
|
22
|
-
if (target) {
|
|
23
|
-
// if target configuration appears, we validate that it should be
|
|
24
|
-
// either target/destination for BAS or target/url for IDE we're
|
|
25
|
-
// trying to detect is it destination for BAS or url for IDE
|
|
26
|
-
const abapTargetProperties = BtpUtils.isAppStudio() ? ["destination"] : ["url"];
|
|
27
|
-
validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
|
|
28
|
-
return target;
|
|
29
|
-
}
|
|
30
|
-
else if (destination) {
|
|
31
|
-
log.warn("Destination is deprecated, use target/destination configuration instead");
|
|
32
|
-
return { destination };
|
|
33
|
-
}
|
|
34
|
-
throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
|
|
35
|
-
}
|
|
36
21
|
}
|
|
37
22
|
//# sourceMappingURL=abapProvider.js.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { IConfiguration, IMetadata } from "../model/types.js";
|
|
1
|
+
import { IConfiguration, IMetadata, IReuseLibInfo } from "../model/types.js";
|
|
2
2
|
import AbapProvider from "./abapProvider.js";
|
|
3
3
|
import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
|
|
4
|
-
|
|
4
|
+
import IRepository from "./repository.js";
|
|
5
|
+
export default class AbapRepository implements IRepository {
|
|
5
6
|
private configuration;
|
|
6
7
|
private abapProvider;
|
|
7
8
|
constructor(configuration: IConfiguration, abapProvider?: AbapProvider);
|
|
9
|
+
fetchReuseLib(_libName: string, _cachebusterToken: string, _lib: IReuseLibInfo): Promise<Map<string, string>>;
|
|
8
10
|
getAppVariantIdHierarchy(id: string): Promise<IAppVariantIdHierarchyItem[]>;
|
|
9
11
|
getAnnotationMetadata(uri: string): Promise<IMetadata>;
|
|
10
12
|
downloadAnnotationFile(uri: string): Promise<Map<string, any>>;
|
|
11
13
|
getMetadata(id: string): Promise<IMetadata>;
|
|
12
|
-
fetch(repoName: string): Promise<Map<string, string>>;
|
|
14
|
+
fetch(repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
|
|
13
15
|
}
|