@ui5/task-adaptation 1.1.0 → 1.1.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 +9 -1
- package/README.md +1 -1
- package/dist/annotationManager.d.ts +0 -3
- package/dist/annotationManager.js +8 -43
- package/dist/annotations/comparator/comparator.d.ts +47 -0
- package/dist/annotations/comparator/comparator.js +276 -0
- package/dist/annotations/comparator/diffCase.d.ts +4 -0
- package/dist/annotations/comparator/diffCase.js +3 -0
- package/dist/annotations/comparator/interchangableCase.d.ts +25 -0
- package/dist/annotations/comparator/interchangableCase.js +65 -0
- package/dist/annotations/converter/metadataJsonReferenceUtil.d.ts +12 -0
- package/dist/annotations/converter/metadataJsonReferenceUtil.js +50 -0
- package/dist/annotations/converter/metadataJsonUtil.d.ts +30 -0
- package/dist/annotations/converter/metadataJsonUtil.js +73 -0
- package/dist/annotations/converter/ui5JsonConverter.d.ts +21 -0
- package/dist/annotations/converter/ui5JsonConverter.js +253 -0
- package/dist/annotations/converter/ui5MetadataJsonUtil.d.ts +3 -0
- package/dist/annotations/converter/ui5MetadataJsonUtil.js +13 -0
- package/dist/annotations/converter/ui5XmlConverter.d.ts +5 -0
- package/dist/annotations/converter/ui5XmlConverter.js +17 -0
- package/dist/annotations/dataSource/dataSource.d.ts +34 -0
- package/dist/annotations/dataSource/dataSource.js +62 -0
- package/dist/annotations/dataSource/dataSourceManager.d.ts +13 -0
- package/dist/annotations/dataSource/dataSourceManager.js +58 -0
- package/dist/annotations/dataSource/dataSourceOData.d.ts +17 -0
- package/dist/annotations/dataSource/dataSourceOData.js +47 -0
- package/dist/annotations/dataSource/dataSourceODataAnnotation.d.ts +6 -0
- package/dist/annotations/dataSource/dataSourceODataAnnotation.js +14 -0
- package/dist/annotations/dataSource/dataSourceODataAnnotationBeta.d.ts +6 -0
- package/dist/annotations/dataSource/dataSourceODataAnnotationBeta.js +18 -0
- package/dist/annotations/serviceRequestor.d.ts +1 -9
- package/dist/annotations/serviceRequestor.js +52 -17
- package/dist/annotations/transformers/convertV2ToV4.d.ts +4 -0
- package/dist/annotations/transformers/convertV2ToV4.js +16 -0
- package/dist/annotations/transformers/makeAnnotationNamespaceUnique.d.ts +6 -0
- package/dist/annotations/transformers/makeAnnotationNamespaceUnique.js +44 -0
- package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.d.ts +4 -0
- package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.js +17 -0
- package/dist/annotations/transformers/transformer.d.ts +12 -0
- package/dist/annotations/transformers/transformer.js +3 -0
- package/dist/annotations/transformers/traverseReferences.d.ts +9 -0
- package/dist/annotations/transformers/traverseReferences.js +67 -0
- package/dist/appVariantManager.d.ts +4 -2
- package/dist/appVariantManager.js +44 -18
- package/dist/baseAppManager.d.ts +2 -1
- package/dist/baseAppManager.js +26 -31
- package/dist/bundle-odata.js +5498 -0
- package/dist/bundle.js +1786 -13
- package/dist/i18nManager.d.ts +5 -7
- package/dist/i18nManager.js +29 -32
- package/dist/index.js +4 -3
- package/dist/model/annotationDiffStructureError.js +2 -0
- package/dist/model/language.js +1 -1
- package/dist/model/serverError.d.ts +3 -0
- package/dist/model/serverError.js +9 -0
- package/dist/model/types.d.ts +13 -2
- package/dist/repositories/abapRepoManager.js +2 -2
- package/dist/util/commonUtil.d.ts +7 -0
- package/dist/util/commonUtil.js +72 -18
- package/dist/util/i18nMerger.d.ts +1 -1
- package/dist/util/i18nMerger.js +3 -4
- package/dist/util/requestUtil.js +4 -0
- package/dist/util/resourceUtil.d.ts +3 -0
- package/dist/util/resourceUtil.js +14 -1
- package/dist/util/urlUtil.d.ts +4 -0
- package/dist/util/urlUtil.js +21 -0
- package/package.json +9 -6
- package/scripts/bundler.ts +4 -33
- package/scripts/metadataDownloadHelper.ts +7 -5
- package/scripts/rollup/bundleDefinition-odata.js +9 -0
- package/scripts/rollup/overrides/sap/ui/performance/Measurement.js +4 -0
- package/scripts/rollup/ui5Resolve.ts +34 -5
- package/scripts/rollup.ts +12 -3
- package/dist/annotations/oDataModel.d.ts +0 -20
- package/dist/annotations/oDataModel.js +0 -46
- package/dist/annotations/oDataV2Model.d.ts +0 -4
- package/dist/annotations/oDataV2Model.js +0 -13
- package/dist/util/jsonDiffUtil.d.ts +0 -28
- package/dist/util/jsonDiffUtil.js +0 -74
- package/scripts/rollup/overrides/sap/ui/thirdparty/URI.js +0 -16
|
@@ -53,16 +53,17 @@ export default class MetadataDownloadHelper {
|
|
|
53
53
|
return fs.readFile(filePath, { encoding: "utf8" });
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
static fetchMetadataFileByUri(host: string,
|
|
56
|
+
static fetchMetadataFileByUri(host: string, url: string) {
|
|
57
57
|
const REQUEST_OPTIONS_XML = {
|
|
58
58
|
headers: {
|
|
59
59
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
|
60
60
|
'Cookie': process.env.cookie,
|
|
61
61
|
},
|
|
62
|
-
httpsAgent
|
|
62
|
+
httpsAgent,
|
|
63
|
+
timeout: 4000
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
-
return RequestUtil.get(host +
|
|
65
|
+
url = url.endsWith("/") ? `${url}$metadata` : `${url}/$metadata`;
|
|
66
|
+
return RequestUtil.get(host + url, REQUEST_OPTIONS_XML);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -76,7 +77,8 @@ const hostArgIndex = args.findIndex(arg => arg.startsWith('--host='));
|
|
|
76
77
|
if (hostArgIndex !== -1) {
|
|
77
78
|
// Extract the value of the `--host=` argument
|
|
78
79
|
const hostArg = args[hostArgIndex];
|
|
79
|
-
|
|
80
|
+
let host = hostArg.split('=')[1];
|
|
81
|
+
host = host.endsWith("/") ? host.substring(0, host.lastIndexOf("/")) : host;
|
|
80
82
|
|
|
81
83
|
// Use the `host` variable as needed
|
|
82
84
|
MetadataDownloadHelper.fetchAllUrls(host);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import URI from "sap/ui/thirdparty/URI";
|
|
2
|
+
import V2MetadataConverter from "sap/ui/model/odata/v4/lib/_V2MetadataConverter";
|
|
3
|
+
import V4MetadataConverter from "sap/ui/model/odata/v4/lib/_V4MetadataConverter";
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
URI,
|
|
7
|
+
V4MetadataConverter,
|
|
8
|
+
V2MetadataConverter
|
|
9
|
+
};
|
|
@@ -10,6 +10,23 @@ const log = require("@ui5/logger").getLogger("rollup-plugin-ui5-resolve-task-ada
|
|
|
10
10
|
const { resourceFactory } = require("@ui5/fs");
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
interface TransformCase {
|
|
14
|
+
accept(code: string, id: string): string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
class UriTransformCase implements TransformCase {
|
|
18
|
+
accept(code: string, id: string) {
|
|
19
|
+
if (id !== "sap/ui/thirdparty/URI") {
|
|
20
|
+
return code;
|
|
21
|
+
}
|
|
22
|
+
const header = code.substring(0, code.indexOf("(function"));
|
|
23
|
+
const neededCode = code.substring(code.indexOf("root) {") + 8, code.lastIndexOf("}));"))
|
|
24
|
+
.replace(/root/g, "window");
|
|
25
|
+
return header + "define('sap/ui/thirdparty/URI', [], function () {" + neededCode + "});";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
13
30
|
export default function (options: any) {
|
|
14
31
|
|
|
15
32
|
let dependencies: any;
|
|
@@ -45,7 +62,7 @@ export default function (options: any) {
|
|
|
45
62
|
* Right before writing result to dist
|
|
46
63
|
*/
|
|
47
64
|
renderChunk: (code: string) => {
|
|
48
|
-
return
|
|
65
|
+
return `var window = {};\n${code}`;
|
|
49
66
|
},
|
|
50
67
|
|
|
51
68
|
|
|
@@ -93,12 +110,13 @@ export default function (options: any) {
|
|
|
93
110
|
}
|
|
94
111
|
|
|
95
112
|
code = replaceRequireAsync(code);
|
|
113
|
+
code = transform(code, id);
|
|
96
114
|
|
|
97
115
|
code = code
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
.replace(/sap\.ui\.define/g, "define")
|
|
117
|
+
.replace(/\, \/\* bExport\= \*\/ true\)/g, ")")
|
|
118
|
+
.replace(/},.*(true|false)\);$/g, "});")
|
|
119
|
+
.replace(/},.*(true|false)\);(\n\/\/# sourceMappingURL=)*/g, "});\n//# sourceMappingURL=");
|
|
102
120
|
return convertAMDtoES6(code);
|
|
103
121
|
}
|
|
104
122
|
|
|
@@ -106,6 +124,17 @@ export default function (options: any) {
|
|
|
106
124
|
};
|
|
107
125
|
|
|
108
126
|
|
|
127
|
+
function transform(code: string, id: string) {
|
|
128
|
+
const transformers = [
|
|
129
|
+
new UriTransformCase()
|
|
130
|
+
];
|
|
131
|
+
for (const transformer of transformers) {
|
|
132
|
+
code = transformer.accept(code, id);
|
|
133
|
+
}
|
|
134
|
+
return code;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
109
138
|
function replaceRequireAsync(code: string) {
|
|
110
139
|
const requireAsyncPattern = /requireAsync((.bind\(this, ")|(\("))+(?<url>[\/\w]*)"\)/mg;
|
|
111
140
|
let match, defineUrls = new Array<string>(), defineVars = new Array<string>(), matches = new Map();
|
package/scripts/rollup.ts
CHANGED
|
@@ -65,14 +65,23 @@ export default class Builder {
|
|
|
65
65
|
project,
|
|
66
66
|
"bundleDefinition.js",
|
|
67
67
|
"./dist/bundle.js",
|
|
68
|
-
"/sap.ui.fl",
|
|
69
68
|
[
|
|
70
69
|
"/resources/sap/ui/fl/**",
|
|
71
70
|
"/resources/sap/suite/ui/generic/template/**"
|
|
71
|
+
]);
|
|
72
|
+
await Bundler.run(
|
|
73
|
+
project,
|
|
74
|
+
"bundleDefinition-odata.js",
|
|
75
|
+
"./dist/bundle-odata.js",
|
|
76
|
+
[
|
|
77
|
+
"/resources/sap/ui/model/**",
|
|
78
|
+
"sap/ui/util/XMLHelper",
|
|
79
|
+
"sap/ui/core/Core"
|
|
72
80
|
],
|
|
73
81
|
[
|
|
74
|
-
"sap/ui/
|
|
75
|
-
]
|
|
82
|
+
"sap/ui/performance/Measurement"
|
|
83
|
+
]
|
|
84
|
+
);
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
87
|
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import ServiceRequestor, { ILanguageJsonContent, ILanguageXmlContent } from "./serviceRequestor";
|
|
2
|
-
import Language from "../model/language";
|
|
3
|
-
export default class ODataModel {
|
|
4
|
-
protected oDataAnnotations: Map<string, any>;
|
|
5
|
-
private serviceRequestor;
|
|
6
|
-
constructor(serviceRequestor: ServiceRequestor);
|
|
7
|
-
getAnnotationJsons(languages: Language[]): AnnotationJsonPerName[];
|
|
8
|
-
private getPromisesPerLanguage;
|
|
9
|
-
private createAnnotationJsons;
|
|
10
|
-
protected afterXmlDownload({ language, xml }: ILanguageXmlContent): Promise<ILanguageJsonContent>;
|
|
11
|
-
protected transformJsons(annotationJsons: Map<Language, any>): Promise<Map<Language, any>>;
|
|
12
|
-
}
|
|
13
|
-
export interface PromisePerAnnotation {
|
|
14
|
-
promisesPerLanguage: Promise<ILanguageXmlContent>[];
|
|
15
|
-
annotationName: string;
|
|
16
|
-
}
|
|
17
|
-
export interface AnnotationJsonPerName {
|
|
18
|
-
annotationName: string;
|
|
19
|
-
annotationJsons: Promise<Map<Language, any>>;
|
|
20
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const xmlUtil_1 = require("../util/xmlUtil");
|
|
4
|
-
class ODataModel {
|
|
5
|
-
constructor(serviceRequestor) {
|
|
6
|
-
this.oDataAnnotations = new Map();
|
|
7
|
-
this.serviceRequestor = serviceRequestor;
|
|
8
|
-
}
|
|
9
|
-
getAnnotationJsons(languages) {
|
|
10
|
-
const result = [];
|
|
11
|
-
const promisesPerLanguagePerName = this.getPromisesPerLanguage(languages);
|
|
12
|
-
for (const { promisesPerLanguage, annotationName } of promisesPerLanguagePerName) {
|
|
13
|
-
result.push({
|
|
14
|
-
annotationName,
|
|
15
|
-
annotationJsons: this.createAnnotationJsons(promisesPerLanguage)
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
getPromisesPerLanguage(languages) {
|
|
21
|
-
return [...this.oDataAnnotations].map(([annotationName, uri]) => ({
|
|
22
|
-
promisesPerLanguage: languages.map(language => this.serviceRequestor.downloadAnnotation(uri, annotationName, language)
|
|
23
|
-
.then(this.afterXmlDownload)),
|
|
24
|
-
annotationName
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
async createAnnotationJsons(promisesPerLanguage) {
|
|
28
|
-
const annotationJsons = new Map();
|
|
29
|
-
for (const promise of promisesPerLanguage) {
|
|
30
|
-
const { language, json } = await promise;
|
|
31
|
-
annotationJsons.set(language, json);
|
|
32
|
-
}
|
|
33
|
-
return this.transformJsons(annotationJsons);
|
|
34
|
-
}
|
|
35
|
-
async afterXmlDownload({ language, xml }) {
|
|
36
|
-
return {
|
|
37
|
-
json: xmlUtil_1.default.xmlToJson(xml),
|
|
38
|
-
language
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
async transformJsons(annotationJsons) {
|
|
42
|
-
return annotationJsons;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.default = ODataModel;
|
|
46
|
-
//# sourceMappingURL=oDataModel.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const oDataModel_1 = require("./oDataModel");
|
|
4
|
-
class ODataV2Model extends oDataModel_1.default {
|
|
5
|
-
addDataSource({ uri, type }, name) {
|
|
6
|
-
if (uri?.startsWith("/") &&
|
|
7
|
-
type === "ODataAnnotation") {
|
|
8
|
-
this.oDataAnnotations.set(name, uri);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = ODataV2Model;
|
|
13
|
-
//# sourceMappingURL=oDataV2Model.js.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import Language from "../model/language";
|
|
2
|
-
export interface IJsonContent {
|
|
3
|
-
language: Language;
|
|
4
|
-
json: any;
|
|
5
|
-
}
|
|
6
|
-
export interface IDiffProperty {
|
|
7
|
-
object: any;
|
|
8
|
-
property: string | number;
|
|
9
|
-
type: DiffTypeEnum;
|
|
10
|
-
}
|
|
11
|
-
export declare enum DiffTypeEnum {
|
|
12
|
-
MINUS = 0,
|
|
13
|
-
PLUS = 1,
|
|
14
|
-
DELTA = 2
|
|
15
|
-
}
|
|
16
|
-
export interface IDiffJson {
|
|
17
|
-
json: any;
|
|
18
|
-
properties: Set<IDiffProperty>;
|
|
19
|
-
}
|
|
20
|
-
export interface IDiffOptions {
|
|
21
|
-
restoreOriginalValue: boolean;
|
|
22
|
-
throwErrorOnDiffStructure: boolean;
|
|
23
|
-
}
|
|
24
|
-
export default class JsonDiffUtil {
|
|
25
|
-
static diff(jsonA: any, jsonB: any, options?: IDiffOptions): IDiffJson;
|
|
26
|
-
private static findDiffsAndRestoreStructure;
|
|
27
|
-
private static traverseDiffRecursive;
|
|
28
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DiffTypeEnum = void 0;
|
|
4
|
-
const jsonDiff = require("json-diff");
|
|
5
|
-
const annotationDiffStructureError_1 = require("../model/annotationDiffStructureError");
|
|
6
|
-
var DiffTypeEnum;
|
|
7
|
-
(function (DiffTypeEnum) {
|
|
8
|
-
DiffTypeEnum[DiffTypeEnum["MINUS"] = 0] = "MINUS";
|
|
9
|
-
DiffTypeEnum[DiffTypeEnum["PLUS"] = 1] = "PLUS";
|
|
10
|
-
DiffTypeEnum[DiffTypeEnum["DELTA"] = 2] = "DELTA";
|
|
11
|
-
})(DiffTypeEnum = exports.DiffTypeEnum || (exports.DiffTypeEnum = {}));
|
|
12
|
-
class JsonDiffUtil {
|
|
13
|
-
static diff(jsonA, jsonB, options = {
|
|
14
|
-
throwErrorOnDiffStructure: true,
|
|
15
|
-
restoreOriginalValue: false
|
|
16
|
-
}) {
|
|
17
|
-
const json = jsonDiff.diff(jsonA, jsonB, { full: true, sort: false });
|
|
18
|
-
const properties = this.findDiffsAndRestoreStructure(json, options);
|
|
19
|
-
return {
|
|
20
|
-
json,
|
|
21
|
-
properties
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
static findDiffsAndRestoreStructure(object, options) {
|
|
25
|
-
const properties = new Set();
|
|
26
|
-
this.traverseDiffRecursive(properties, { object }, "object", options);
|
|
27
|
-
return properties;
|
|
28
|
-
}
|
|
29
|
-
static traverseDiffRecursive(properties, object, property, options) {
|
|
30
|
-
const current = object[property];
|
|
31
|
-
if (typeof current !== "object") {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(current)) {
|
|
35
|
-
for (let i = 0; i < current.length; i++) {
|
|
36
|
-
const item = current[i];
|
|
37
|
-
if (["~", " ", "-", "+"].some(sign => item[0] === sign)) {
|
|
38
|
-
current[i] = item[1];
|
|
39
|
-
// This is a sign from json-diff plugin, that the property contains differences.
|
|
40
|
-
// We will remove these signs, to restore the original structure
|
|
41
|
-
if (item[0] === "~") {
|
|
42
|
-
this.traverseDiffRecursive(properties, item, 1, options);
|
|
43
|
-
}
|
|
44
|
-
else if (item[0] === "+" || item[0] === "-") {
|
|
45
|
-
if (options.throwErrorOnDiffStructure) {
|
|
46
|
-
throw new annotationDiffStructureError_1.default(item[1]);
|
|
47
|
-
}
|
|
48
|
-
properties.add({
|
|
49
|
-
object: object[property],
|
|
50
|
-
property: i,
|
|
51
|
-
type: item[0] === "+" ? DiffTypeEnum.PLUS : DiffTypeEnum.MINUS
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
for (const key of Object.keys(current)) {
|
|
59
|
-
if (key == "__old" || key == "__new") {
|
|
60
|
-
if (options.restoreOriginalValue) {
|
|
61
|
-
object[property] = current["__old"];
|
|
62
|
-
}
|
|
63
|
-
properties.add({ object, property, type: DiffTypeEnum.DELTA });
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.traverseDiffRecursive(properties, current, key, options);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.default = JsonDiffUtil;
|
|
74
|
-
//# sourceMappingURL=jsonDiffUtil.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { posix as path } from "path";
|
|
2
|
-
|
|
3
|
-
export default class URI {
|
|
4
|
-
constructor(value) {
|
|
5
|
-
this.value = value;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
normalize() {
|
|
9
|
-
this.value = path.normalize(this.value).replace(/\\/g, "/");
|
|
10
|
-
return this;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
path() {
|
|
14
|
-
return this.value;
|
|
15
|
-
}
|
|
16
|
-
}
|