@ui5/task-adaptation 1.1.2 → 1.2.0
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 +9 -1
- package/dist/annotationManager.js +1 -1
- package/dist/annotations/comparator/comparator.js +5 -2
- package/dist/annotations/dataSource/dataSourceManager.d.ts +1 -2
- package/dist/annotations/dataSource/dataSourceManager.js +9 -17
- package/dist/annotations/dataSource/dataSourceODataAnnotation.d.ts +1 -1
- package/dist/annotations/dataSource/dataSourceODataAnnotation.js +5 -1
- package/dist/annotations/transformers/traverseReferences.js +2 -2
- package/dist/appVariantManager.js +4 -1
- package/package.json +1 -1
- package/dist/annotations/dataSource/dataSourceODataAnnotationBeta.d.ts +0 -6
- package/dist/annotations/dataSource/dataSourceODataAnnotationBeta.js +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
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.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.2.0...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v1.2.0"></a>
|
|
8
|
+
## [v1.2.0] - 2024-03-05
|
|
9
|
+
|
|
10
|
+
<a name="v1.1.3"></a>
|
|
11
|
+
## [v1.1.3] - 2024-02-26
|
|
6
12
|
|
|
7
13
|
<a name="v1.1.2"></a>
|
|
8
14
|
## [v1.1.2] - 2024-02-23
|
|
@@ -79,6 +85,8 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
|
|
|
79
85
|
<a name="v1.0.0"></a>
|
|
80
86
|
## v1.0.0 - 2020-12-09
|
|
81
87
|
|
|
88
|
+
[v1.2.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.3...v1.2.0
|
|
89
|
+
[v1.1.3]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.2...v1.1.3
|
|
82
90
|
[v1.1.2]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.1...v1.1.2
|
|
83
91
|
[v1.1.1]: https://github.com/SAP/ui5-task-adaptation/compare/v1.1.0...v1.1.1
|
|
84
92
|
[v1.1.0]: https://github.com/SAP/ui5-task-adaptation/compare/v1.0.23...v1.1.0
|
|
@@ -24,7 +24,7 @@ class AnnotationManager {
|
|
|
24
24
|
const i18nManager = new i18nManager_1.default(modelName, id, languages);
|
|
25
25
|
const serviceRequestor = new serviceRequestor_1.default(this.configuration, this.abapRepoManager);
|
|
26
26
|
const dataSourceManager = new dataSourceManager_1.default();
|
|
27
|
-
dataSourceManager.addDataSources(renamedBaseAppManifest["sap.app"]?.dataSources
|
|
27
|
+
dataSourceManager.addDataSources(renamedBaseAppManifest["sap.app"]?.dataSources);
|
|
28
28
|
const annotationFiles = await dataSourceManager.createAnnotationFiles(languages, i18nManager, serviceRequestor);
|
|
29
29
|
const i18nFiles = i18nManager.createFiles(i18nPathName);
|
|
30
30
|
if (i18nManager.hasTranslations()) {
|
|
@@ -114,8 +114,11 @@ class Comparator {
|
|
|
114
114
|
const includer_a = new Includer(a, property);
|
|
115
115
|
const includer_b = new Includer(b, property);
|
|
116
116
|
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// There might be an exceptional case, when the object doesn't
|
|
118
|
+
// contain attributes. In this case we continue traversing, like
|
|
119
|
+
// UI5 does.
|
|
120
|
+
const id_a = a[i]?._attributes?.[idProperty];
|
|
121
|
+
const id_b = b[i]?._attributes?.[idProperty];
|
|
119
122
|
if (id_a !== id_b) {
|
|
120
123
|
// We go down the array and if suddenly the ids for comparing
|
|
121
124
|
// items are not the same, we need to find the item with the
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import I18nManager from "../../i18nManager";
|
|
2
|
-
import { IConfiguration } from "../../model/types";
|
|
3
2
|
import Language from "../../model/language";
|
|
4
3
|
import ServiceRequestor from "../serviceRequestor";
|
|
5
4
|
export default class DataSourceManager {
|
|
@@ -8,6 +7,6 @@ export default class DataSourceManager {
|
|
|
8
7
|
* Parses dataSources from manifest.json.
|
|
9
8
|
* @param dataSourcesJson manifest.json/sap.app/dataSources node
|
|
10
9
|
*/
|
|
11
|
-
addDataSources(dataSourcesJson: any
|
|
10
|
+
addDataSources(dataSourcesJson: any): void;
|
|
12
11
|
createAnnotationFiles(languages: Language[], i18nManager: I18nManager, serviceRequestor: ServiceRequestor): Promise<Map<string, string>>;
|
|
13
12
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const dataSourceOData_1 = require("./dataSourceOData");
|
|
4
4
|
const dataSourceODataAnnotation_1 = require("./dataSourceODataAnnotation");
|
|
5
|
-
const dataSourceODataAnnotationBeta_1 = require("./dataSourceODataAnnotationBeta");
|
|
6
5
|
const path_1 = require("path");
|
|
7
6
|
class DataSourceManager {
|
|
8
7
|
constructor() {
|
|
@@ -12,20 +11,18 @@ class DataSourceManager {
|
|
|
12
11
|
* Parses dataSources from manifest.json.
|
|
13
12
|
* @param dataSourcesJson manifest.json/sap.app/dataSources node
|
|
14
13
|
*/
|
|
15
|
-
addDataSources(dataSourcesJson
|
|
14
|
+
addDataSources(dataSourcesJson) {
|
|
16
15
|
if (!dataSourcesJson) {
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
const odataAnnotationMap = new Map();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.dataSources.push(odata);
|
|
28
|
-
}
|
|
19
|
+
// Loop over OData first to collect linked annotation names
|
|
20
|
+
for (const [name, dataSource] of Object.entries(dataSourcesJson)) {
|
|
21
|
+
if (dataSource.uri?.startsWith("/") && dataSource.type === "OData") {
|
|
22
|
+
const uri = path_1.posix.normalize(dataSource.uri + "/$metadata");
|
|
23
|
+
const odata = new dataSourceOData_1.default(name, uri, dataSource);
|
|
24
|
+
odata.getAnnotations().forEach(annotation => odataAnnotationMap.set(annotation, uri));
|
|
25
|
+
this.dataSources.push(odata);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
// If ODataAnnotation is in OData annotations, pass metadata url to it
|
|
@@ -33,12 +30,7 @@ class DataSourceManager {
|
|
|
33
30
|
const uri = dataSource.uri;
|
|
34
31
|
const metadataUrl = odataAnnotationMap.get(name);
|
|
35
32
|
if (uri?.startsWith("/") && dataSource.type === "ODataAnnotation") {
|
|
36
|
-
|
|
37
|
-
this.dataSources.push(new dataSourceODataAnnotationBeta_1.default(name, uri, dataSource, metadataUrl));
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
this.dataSources.push(new dataSourceODataAnnotation_1.default(name, uri, dataSource));
|
|
41
|
-
}
|
|
33
|
+
this.dataSources.push(new dataSourceODataAnnotation_1.default(name, uri, dataSource, metadataUrl));
|
|
42
34
|
}
|
|
43
35
|
}
|
|
44
36
|
for (const dataSource of this.dataSources) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DataSource from "./dataSource";
|
|
2
2
|
export default class DataSourceODataAnnotation extends DataSource {
|
|
3
3
|
private dataSourceJson;
|
|
4
|
-
constructor(name: string, uri: string, dataSourceJson: any);
|
|
4
|
+
constructor(name: string, uri: string, dataSourceJson: any, metadataUrl: string | undefined);
|
|
5
5
|
updateManifest(): void;
|
|
6
6
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const dataSource_1 = require("./dataSource");
|
|
4
|
+
const traverseReferences_1 = require("../transformers/traverseReferences");
|
|
4
5
|
class DataSourceODataAnnotation extends dataSource_1.default {
|
|
5
|
-
constructor(name, uri, dataSourceJson) {
|
|
6
|
+
constructor(name, uri, dataSourceJson, metadataUrl) {
|
|
6
7
|
super(name, uri);
|
|
7
8
|
this.dataSourceJson = dataSourceJson;
|
|
9
|
+
this.jsonTransformers = [
|
|
10
|
+
new traverseReferences_1.default(metadataUrl)
|
|
11
|
+
];
|
|
8
12
|
}
|
|
9
13
|
updateManifest() {
|
|
10
14
|
this.dataSourceJson.uri = this.getFilename();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const metadataJsonUtil_1 = require("../converter/metadataJsonUtil");
|
|
4
|
-
const
|
|
4
|
+
const dataSourceODataAnnotation_1 = require("../dataSource/dataSourceODataAnnotation");
|
|
5
5
|
const urlUtil_1 = require("../../util/urlUtil");
|
|
6
6
|
class TraverseReferences {
|
|
7
7
|
constructor(metadataUrl) {
|
|
@@ -17,7 +17,7 @@ class TraverseReferences {
|
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
19
|
const name = includes[0]?.namespace;
|
|
20
|
-
const dataSource = new
|
|
20
|
+
const dataSource = new dataSourceODataAnnotation_1.default(name, absoluteUrl, {}, this.metadataUrl);
|
|
21
21
|
promises.push(dataSource.downloadAnnotation(language, serviceRequestor)
|
|
22
22
|
.then(childAnnotation => ({ name, childAnnotation })));
|
|
23
23
|
}
|
|
@@ -63,11 +63,14 @@ class AppVariantManager {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
this.validateManifest(manifest);
|
|
66
|
+
// Order is important: apply manifest.json changes first, then *.change
|
|
67
|
+
// files. UI5 does the same.
|
|
68
|
+
const changes = (manifest.content ?? []).concat(manifestChanges);
|
|
66
69
|
return {
|
|
67
70
|
id: manifest.id,
|
|
68
71
|
reference: manifest.reference,
|
|
69
72
|
layer: manifest.layer,
|
|
70
|
-
changes
|
|
73
|
+
changes
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
76
|
static validateManifest(manifest) {
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const dataSource_1 = require("./dataSource");
|
|
4
|
-
const traverseReferences_1 = require("../transformers/traverseReferences");
|
|
5
|
-
class DataSourceODataAnnotation extends dataSource_1.default {
|
|
6
|
-
constructor(name, uri, dataSourceJson, metadataUrl) {
|
|
7
|
-
super(name, uri);
|
|
8
|
-
this.dataSourceJson = dataSourceJson;
|
|
9
|
-
this.jsonTransformers = [
|
|
10
|
-
new traverseReferences_1.default(metadataUrl)
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
updateManifest() {
|
|
14
|
-
this.dataSourceJson.uri = this.getFilename();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.default = DataSourceODataAnnotation;
|
|
18
|
-
//# sourceMappingURL=dataSourceODataAnnotationBeta.js.map
|