@ui5/task-adaptation 1.2.0 → 1.3.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 +5 -1
- package/dist/annotationManager.d.ts +3 -3
- package/dist/annotationManager.js +15 -16
- package/dist/annotations/comparator/comparator.js +30 -26
- package/dist/annotations/comparator/diffCase.js +1 -2
- package/dist/annotations/comparator/interchangableCase.d.ts +1 -1
- package/dist/annotations/comparator/interchangableCase.js +7 -12
- package/dist/annotations/converter/metadataJsonReferenceUtil.js +7 -9
- package/dist/annotations/converter/metadataJsonUtil.js +7 -10
- package/dist/annotations/converter/ui5JsonConverter.js +5 -6
- package/dist/annotations/converter/ui5MetadataJsonUtil.js +1 -4
- package/dist/annotations/converter/ui5XmlConverter.js +4 -7
- package/dist/annotations/dataSource/dataSource.d.ts +5 -5
- package/dist/annotations/dataSource/dataSource.js +8 -8
- package/dist/annotations/dataSource/dataSourceManager.d.ts +3 -3
- package/dist/annotations/dataSource/dataSourceManager.js +8 -13
- package/dist/annotations/dataSource/dataSourceOData.d.ts +3 -3
- package/dist/annotations/dataSource/dataSourceOData.js +13 -15
- package/dist/annotations/dataSource/dataSourceODataAnnotation.d.ts +1 -1
- package/dist/annotations/dataSource/dataSourceODataAnnotation.js +5 -7
- package/dist/annotations/serviceRequestor.d.ts +3 -3
- package/dist/annotations/serviceRequestor.js +15 -13
- package/dist/annotations/transformers/convertV2ToV4.d.ts +1 -1
- package/dist/annotations/transformers/convertV2ToV4.js +7 -10
- package/dist/annotations/transformers/makeAnnotationNamespaceUnique.d.ts +1 -1
- package/dist/annotations/transformers/makeAnnotationNamespaceUnique.js +8 -11
- package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.d.ts +1 -1
- package/dist/annotations/transformers/removeAllSchemaNodesExceptAnnotations.js +3 -6
- package/dist/annotations/transformers/transformer.d.ts +2 -2
- package/dist/annotations/transformers/transformer.js +1 -2
- package/dist/annotations/transformers/traverseReferences.d.ts +1 -1
- package/dist/annotations/transformers/traverseReferences.js +16 -17
- package/dist/appVariantManager.d.ts +1 -1
- package/dist/appVariantManager.js +17 -20
- package/dist/baseAppManager.d.ts +2 -2
- package/dist/baseAppManager.js +18 -20
- package/dist/buildStrategy.js +2 -4
- package/dist/bundle.d.ts +25 -0
- package/dist/bundle.js +3696 -219
- package/dist/cache/annotationsCacheManager.d.ts +2 -2
- package/dist/cache/annotationsCacheManager.js +3 -5
- package/dist/cache/baseAppFilesCacheManager.d.ts +1 -1
- package/dist/cache/baseAppFilesCacheManager.js +3 -6
- package/dist/cache/cacheManager.d.ts +1 -1
- package/dist/cache/cacheManager.js +9 -12
- package/dist/i18nManager.d.ts +3 -3
- package/dist/i18nManager.js +23 -23
- package/dist/index.d.ts +6 -1
- package/dist/index.js +14 -16
- package/dist/model/annotationDiffStructureError.js +1 -4
- package/dist/model/language.js +4 -4
- package/dist/model/noAuthorizationProvidedError.js +1 -4
- package/dist/model/serverError.js +1 -4
- package/dist/model/types.d.ts +1 -1
- package/dist/model/types.js +1 -2
- package/dist/processors/abapProcessor.d.ts +5 -5
- package/dist/processors/abapProcessor.js +9 -8
- package/dist/processors/cfProcessor.d.ts +3 -3
- package/dist/processors/cfProcessor.js +7 -8
- package/dist/processors/processor.d.ts +1 -1
- package/dist/processors/processor.js +11 -15
- package/dist/repositories/abapRepoManager.d.ts +1 -1
- package/dist/repositories/abapRepoManager.js +14 -14
- package/dist/repositories/html5RepoManager.d.ts +1 -1
- package/dist/repositories/html5RepoManager.js +12 -14
- package/dist/util/cfUtil.d.ts +1 -1
- package/dist/util/cfUtil.js +12 -14
- package/dist/util/commonUtil.d.ts +2 -2
- package/dist/util/commonUtil.js +19 -32
- package/dist/util/i18nMerger.d.ts +6 -2
- package/dist/util/i18nMerger.js +10 -14
- package/dist/util/requestUtil.d.ts +1 -1
- package/dist/util/requestUtil.js +9 -12
- package/dist/util/resourceUtil.js +8 -11
- package/dist/util/urlUtil.d.ts +2 -2
- package/dist/util/urlUtil.js +3 -6
- package/dist/util/xmlUtil.js +2 -5
- package/dist/util/zipUtil.js +2 -6
- package/eslint.config.js +52 -0
- package/package.json +44 -51
- package/scripts/metadataDownloadHelper.ts +8 -7
- package/scripts/rollup/bundle.d.ts +25 -0
- package/scripts/rollup/bundleDefinition.js +11 -1
- package/scripts/{bundler.ts → rollup/bundler.ts} +6 -17
- package/scripts/rollup/overrides/sap/base/config.js +10 -0
- package/scripts/rollup/project/package.json +2 -1
- package/scripts/rollup/project/ui5.yaml +1 -1
- package/scripts/rollup/ui5Resolve.ts +14 -38
- package/scripts/rollup.ts +67 -23
- package/types/ui5.d.ts +44 -0
- package/dist/bundle-odata.js +0 -5498
- package/scripts/rollup/bundleDefinition-odata.js +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CacheManager from "./cacheManager";
|
|
2
|
-
import { IConfiguration } from "../model/types";
|
|
1
|
+
import CacheManager from "./cacheManager.js";
|
|
2
|
+
import { IConfiguration } from "../model/types.js";
|
|
3
3
|
export default class AnnotationsCacheManager extends CacheManager {
|
|
4
4
|
private tempSubFolder;
|
|
5
5
|
constructor(configuration: IConfiguration, tempSubFolder: string);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class AnnotationsCacheManager extends cacheManager_1.default {
|
|
1
|
+
import CacheManager from "./cacheManager.js";
|
|
2
|
+
export default class AnnotationsCacheManager extends CacheManager {
|
|
3
|
+
tempSubFolder;
|
|
5
4
|
constructor(configuration, tempSubFolder) {
|
|
6
5
|
super(configuration);
|
|
7
6
|
this.tempSubFolder = tempSubFolder;
|
|
@@ -14,5 +13,4 @@ class AnnotationsCacheManager extends cacheManager_1.default {
|
|
|
14
13
|
return "annotationsmetadata.json";
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
exports.default = AnnotationsCacheManager;
|
|
18
16
|
//# sourceMappingURL=annotationsCacheManager.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class BaseAppFilesCacheManager extends cacheManager_1.default {
|
|
1
|
+
import CacheManager from "./cacheManager.js";
|
|
2
|
+
export default class BaseAppFilesCacheManager extends CacheManager {
|
|
3
|
+
static METADATA_FILENAME = "html5metadata.json";
|
|
5
4
|
getTempId() {
|
|
6
5
|
const { appHostId, appName, appVersion } = this.configuration;
|
|
7
6
|
return super.normalizeId(`ui5-${appHostId}-${appName}-${appVersion}`);
|
|
@@ -10,6 +9,4 @@ class BaseAppFilesCacheManager extends cacheManager_1.default {
|
|
|
10
9
|
return BaseAppFilesCacheManager.METADATA_FILENAME;
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
|
-
exports.default = BaseAppFilesCacheManager;
|
|
14
|
-
BaseAppFilesCacheManager.METADATA_FILENAME = "html5metadata.json";
|
|
15
12
|
//# sourceMappingURL=baseAppFilesCacheManager.js.map
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const tempFolder = require('temp-dir');
|
|
8
|
-
class CacheManager {
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import ResourceUtil from "../util/resourceUtil.js";
|
|
4
|
+
import tempFolder from "temp-dir";
|
|
5
|
+
export default class CacheManager {
|
|
6
|
+
configuration;
|
|
9
7
|
constructor(configuration) {
|
|
10
8
|
this.configuration = configuration;
|
|
11
9
|
}
|
|
@@ -41,18 +39,18 @@ class CacheManager {
|
|
|
41
39
|
writeTemp(files, metadata) {
|
|
42
40
|
this.deleteTemp();
|
|
43
41
|
const filesToCache = this.getFilesToCache(files, metadata);
|
|
44
|
-
return
|
|
42
|
+
return ResourceUtil.write(this.getTempFolder(), filesToCache);
|
|
45
43
|
}
|
|
46
44
|
async readTemp() {
|
|
47
45
|
const files = new Map();
|
|
48
46
|
const tempFolder = this.getTempFolder();
|
|
49
47
|
if (fs.existsSync(tempFolder)) {
|
|
50
|
-
|
|
48
|
+
ResourceUtil.read(tempFolder, tempFolder, files, [this.getMetadataFilename()]);
|
|
51
49
|
}
|
|
52
50
|
return files;
|
|
53
51
|
}
|
|
54
52
|
deleteTemp() {
|
|
55
|
-
|
|
53
|
+
fs.rmSync(this.getTempFolder(), { recursive: true, force: true });
|
|
56
54
|
}
|
|
57
55
|
normalizeId(id) {
|
|
58
56
|
return id.replace(/\/\\/g, "_");
|
|
@@ -64,5 +62,4 @@ class CacheManager {
|
|
|
64
62
|
return filesClone;
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
|
-
exports.default = CacheManager;
|
|
68
65
|
//# sourceMappingURL=cacheManager.js.map
|
package/dist/i18nManager.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IDiffProperty } from "./annotations/comparator/comparator";
|
|
2
|
-
import { IJsonPerLanguage, IJsonPromisePerLanguage } from "./model/types";
|
|
3
|
-
import Language from "./model/language";
|
|
1
|
+
import { IDiffProperty } from "./annotations/comparator/comparator.js";
|
|
2
|
+
import { IJsonPerLanguage, IJsonPromisePerLanguage } from "./model/types.js";
|
|
3
|
+
import Language from "./model/language.js";
|
|
4
4
|
export declare class PropertyValue {
|
|
5
5
|
value: string;
|
|
6
6
|
isReference: boolean;
|
package/dist/i18nManager.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const annotationDiffStructureError_1 = require("./model/annotationDiffStructureError");
|
|
6
|
-
const commonUtil_1 = require("./util/commonUtil");
|
|
7
|
-
const posix_1 = require("path/posix"); // Ensure standardized dir separators to ensure Windows compatibility
|
|
1
|
+
import Comparator from "./annotations/comparator/comparator.js";
|
|
2
|
+
import AnnotationDiffStructureError from "./model/annotationDiffStructureError.js";
|
|
3
|
+
import { getUniqueName } from "./util/commonUtil.js";
|
|
4
|
+
import { join } from "path/posix"; // Ensure standardized dir separators to ensure Windows compatibility
|
|
8
5
|
// To generate keys, english language is more common, so compare all other
|
|
9
6
|
// languages with it
|
|
10
|
-
class PropertyValue {
|
|
7
|
+
export class PropertyValue {
|
|
8
|
+
value;
|
|
9
|
+
isReference = false;
|
|
10
|
+
qualifier;
|
|
11
|
+
language;
|
|
12
|
+
static OLD = "__old";
|
|
13
|
+
static NEW = "__new";
|
|
11
14
|
constructor(qualifier, language, value) {
|
|
12
|
-
this.isReference = false;
|
|
13
15
|
this.qualifier = qualifier;
|
|
14
16
|
this.language = language;
|
|
15
17
|
this.value = value;
|
|
@@ -28,12 +30,9 @@ class PropertyValue {
|
|
|
28
30
|
return new PropertyValue(PropertyValue.NEW, language, value);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
PropertyValue.NEW = "__new";
|
|
34
|
-
class I18nFileContent {
|
|
33
|
+
export class I18nFileContent {
|
|
34
|
+
properties = new Map();
|
|
35
35
|
constructor(languages) {
|
|
36
|
-
this.properties = new Map();
|
|
37
36
|
languages.forEach(language => this.properties.set(language, new Map()));
|
|
38
37
|
}
|
|
39
38
|
add(prop, key) {
|
|
@@ -74,18 +73,20 @@ class I18nFileContent {
|
|
|
74
73
|
if (language.i18n) {
|
|
75
74
|
filename += "_" + language.i18n;
|
|
76
75
|
}
|
|
77
|
-
const filepath =
|
|
76
|
+
const filepath = join(i18nPathName, filename + ".properties");
|
|
78
77
|
files.set(filepath, [...i18nLines].map(([key, value]) => `${key}=${value}`).join("\n"));
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
return files;
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
export default class I18nManager {
|
|
84
|
+
modelName;
|
|
85
|
+
appVariantId;
|
|
86
|
+
references = new Map();
|
|
87
|
+
existingKeys = new Set();
|
|
88
|
+
i18nFileContent;
|
|
86
89
|
constructor(modelName, appVariantId, languages) {
|
|
87
|
-
this.references = new Map();
|
|
88
|
-
this.existingKeys = new Set();
|
|
89
90
|
this.modelName = modelName;
|
|
90
91
|
this.appVariantId = appVariantId;
|
|
91
92
|
this.i18nFileContent = new I18nFileContent(languages);
|
|
@@ -136,13 +137,13 @@ class I18nManager {
|
|
|
136
137
|
let p = defaultAnnotation;
|
|
137
138
|
for (const c of annotationJsons.map(([language, json]) => ({ language, json }))) {
|
|
138
139
|
try {
|
|
139
|
-
const comparator = new
|
|
140
|
+
const comparator = new Comparator(await p.json, await c.json);
|
|
140
141
|
const pDiff = comparator.compare();
|
|
141
142
|
this.processDiff(pDiff.properties, p.language, c.language);
|
|
142
143
|
p.json = pDiff.json;
|
|
143
144
|
}
|
|
144
145
|
catch (error) {
|
|
145
|
-
if (error instanceof
|
|
146
|
+
if (error instanceof AnnotationDiffStructureError) {
|
|
146
147
|
throw new Error(`The structure of the OData annotation xml of language '${p.language}' is different from xml of language '${c.language}' near element: ${error.message}`);
|
|
147
148
|
}
|
|
148
149
|
throw error;
|
|
@@ -188,7 +189,7 @@ class I18nManager {
|
|
|
188
189
|
throw new Error("Failed to create unique key from: " + JSON.stringify(value));
|
|
189
190
|
}
|
|
190
191
|
const propertyName = value.replace(/\W/gi, "_").toUpperCase();
|
|
191
|
-
const key =
|
|
192
|
+
const key = getUniqueName([...this.existingKeys.keys()], propertyName);
|
|
192
193
|
this.existingKeys.add(key);
|
|
193
194
|
return key;
|
|
194
195
|
}
|
|
@@ -199,5 +200,4 @@ class I18nManager {
|
|
|
199
200
|
propertyValues.forEach(prop => prop.set(diff, this.references));
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
|
-
exports.default = I18nManager;
|
|
203
203
|
//# sourceMappingURL=i18nManager.js.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const i18nMerger_1 = require("./util/i18nMerger");
|
|
8
|
-
const processor_1 = require("./processors/processor");
|
|
1
|
+
import * as dotenv from "dotenv";
|
|
2
|
+
import { logBetaUsage, logBuilderVersion } from "./util/commonUtil.js";
|
|
3
|
+
import AppVariantManager from "./appVariantManager.js";
|
|
4
|
+
import BaseAppManager from "./baseAppManager.js";
|
|
5
|
+
import I18NMerger from "./util/i18nMerger.js";
|
|
6
|
+
import { determineProcessor } from "./processors/processor.js";
|
|
9
7
|
/**
|
|
10
8
|
* Creates an appVariant bundle from the provided resources.
|
|
11
9
|
*/
|
|
12
|
-
|
|
10
|
+
export default ({ workspace, options, taskUtil }) => {
|
|
13
11
|
dotenv.config();
|
|
14
12
|
async function process(workspace, taskUtil) {
|
|
15
|
-
await
|
|
16
|
-
|
|
17
|
-
const processor =
|
|
18
|
-
const appVariantResources = await
|
|
19
|
-
const appVariantInfo = await
|
|
13
|
+
await logBuilderVersion();
|
|
14
|
+
logBetaUsage();
|
|
15
|
+
const processor = determineProcessor(options.configuration);
|
|
16
|
+
const appVariantResources = await AppVariantManager.getAppVariantResourcesToProcess(workspace);
|
|
17
|
+
const appVariantInfo = await AppVariantManager.process(appVariantResources, options.projectNamespace, taskUtil);
|
|
20
18
|
const baseAppFiles = await processor.getBaseAppFiles(appVariantInfo.reference);
|
|
21
|
-
const { resources, manifestInfo } = await
|
|
22
|
-
const mergedResources = await
|
|
19
|
+
const { resources, manifestInfo } = await BaseAppManager.process(baseAppFiles, appVariantInfo, options, processor);
|
|
20
|
+
const mergedResources = await I18NMerger.mergeI18NFiles(resources, appVariantResources, options.projectNamespace, manifestInfo.i18nPath, appVariantInfo, taskUtil);
|
|
23
21
|
await Promise.all(mergedResources.map(resource => workspace.write(resource)));
|
|
24
22
|
}
|
|
25
23
|
return process(workspace, taskUtil);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class AnnotationDiffStructureError extends Error {
|
|
1
|
+
export default class AnnotationDiffStructureError extends Error {
|
|
4
2
|
constructor(json) {
|
|
5
3
|
super(JSON.stringify(json));
|
|
6
4
|
this.name = "AnnotationDiffStructureError";
|
|
7
5
|
this.message = `The structure of the OData annotation xml is different near element: ${JSON.stringify(json)}`;
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
exports.default = AnnotationDiffStructureError;
|
|
11
8
|
//# sourceMappingURL=annotationDiffStructureError.js.map
|
package/dist/model/language.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default class Language {
|
|
2
|
+
sap;
|
|
3
|
+
i18n;
|
|
4
|
+
isDefault;
|
|
4
5
|
constructor(sap, i18n) {
|
|
5
6
|
this.sap = sap;
|
|
6
7
|
this.i18n = i18n;
|
|
@@ -33,5 +34,4 @@ class Language {
|
|
|
33
34
|
}
|
|
34
35
|
;
|
|
35
36
|
}
|
|
36
|
-
exports.default = Language;
|
|
37
37
|
//# sourceMappingURL=language.js.map
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class NoAuthorizationProvidedError extends Error {
|
|
1
|
+
export default class NoAuthorizationProvidedError extends Error {
|
|
4
2
|
constructor(uri) {
|
|
5
3
|
super(`Request requires authorization: '${uri}'`);
|
|
6
4
|
}
|
|
7
5
|
}
|
|
8
|
-
exports.default = NoAuthorizationProvidedError;
|
|
9
6
|
//# sourceMappingURL=noAuthorizationProvidedError.js.map
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class ServerError extends Error {
|
|
1
|
+
export default class ServerError extends Error {
|
|
4
2
|
constructor(uri, error) {
|
|
5
3
|
super(`Request ${uri} failed with Server error: ${error.response.status}${error.response.data ?? ""}`);
|
|
6
4
|
}
|
|
7
5
|
}
|
|
8
|
-
exports.default = ServerError;
|
|
9
6
|
//# sourceMappingURL=serverError.js.map
|
package/dist/model/types.d.ts
CHANGED
package/dist/model/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import AbapRepoManager from "../repositories/abapRepoManager";
|
|
2
|
-
import AnnotationManager from "../annotationManager";
|
|
3
|
-
import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager";
|
|
4
|
-
import { IConfiguration } from "../model/types";
|
|
5
|
-
import IProcessor from "./processor";
|
|
1
|
+
import AbapRepoManager from "../repositories/abapRepoManager.js";
|
|
2
|
+
import AnnotationManager from "../annotationManager.js";
|
|
3
|
+
import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager.js";
|
|
4
|
+
import { IConfiguration } from "../model/types.js";
|
|
5
|
+
import IProcessor from "./processor.js";
|
|
6
6
|
export default class AbapProcessor implements IProcessor {
|
|
7
7
|
private abapRepoManager;
|
|
8
8
|
private configuration;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { validateObject } from "../util/commonUtil.js";
|
|
2
|
+
import Language from "../model/language.js";
|
|
3
|
+
export default class AbapProcessor {
|
|
4
|
+
abapRepoManager;
|
|
5
|
+
configuration;
|
|
6
|
+
cacheManager;
|
|
7
|
+
annotationManager;
|
|
6
8
|
constructor(configuration, cacheManager, abapRepoManager, annotationManager) {
|
|
7
9
|
this.configuration = configuration;
|
|
8
10
|
this.abapRepoManager = abapRepoManager;
|
|
@@ -13,10 +15,10 @@ class AbapProcessor {
|
|
|
13
15
|
return this.cacheManager.getFiles(() => this.abapRepoManager.getMetadata(baseAppId), () => this.abapRepoManager.downloadBaseAppFiles());
|
|
14
16
|
}
|
|
15
17
|
validateConfiguration() {
|
|
16
|
-
|
|
18
|
+
validateObject(this.configuration, ["destination", "appName"], "should be specified in ui5.yaml configuration");
|
|
17
19
|
}
|
|
18
20
|
async updateLandscapeSpecificContent(renamedBaseAppManifest, baseAppFiles) {
|
|
19
|
-
const files = await this.annotationManager.process(renamedBaseAppManifest, (
|
|
21
|
+
const files = await this.annotationManager.process(renamedBaseAppManifest, (Language.create(this.configuration.languages)));
|
|
20
22
|
if (baseAppFiles) {
|
|
21
23
|
files.forEach((value, key) => baseAppFiles.set(key, value));
|
|
22
24
|
}
|
|
@@ -32,5 +34,4 @@ class AbapProcessor {
|
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
exports.default = AbapProcessor;
|
|
36
37
|
//# sourceMappingURL=abapProcessor.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager";
|
|
2
|
-
import { IConfiguration } from "../model/types";
|
|
3
|
-
import IProcessor from "./processor";
|
|
1
|
+
import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager.js";
|
|
2
|
+
import { IConfiguration } from "../model/types.js";
|
|
3
|
+
import IProcessor from "./processor.js";
|
|
4
4
|
export default class CFProcessor implements IProcessor {
|
|
5
5
|
private configuration;
|
|
6
6
|
private cacheManager;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import HTML5RepoManager from "../repositories/html5RepoManager.js";
|
|
2
|
+
import { validateObject } from "../util/commonUtil.js";
|
|
3
|
+
export default class CFProcessor {
|
|
4
|
+
configuration;
|
|
5
|
+
cacheManager;
|
|
6
6
|
constructor(configuration, cacheManager) {
|
|
7
7
|
this.configuration = configuration;
|
|
8
8
|
this.cacheManager = cacheManager;
|
|
9
9
|
}
|
|
10
10
|
async getBaseAppFiles() {
|
|
11
|
-
return this.cacheManager.getFiles(() =>
|
|
11
|
+
return this.cacheManager.getFiles(() => HTML5RepoManager.getMetadata(this.configuration), () => HTML5RepoManager.getBaseAppFiles(this.configuration));
|
|
12
12
|
}
|
|
13
13
|
validateConfiguration() {
|
|
14
|
-
|
|
14
|
+
validateObject(this.configuration, ["appHostId", "appName", "appVersion"], "should be specified in ui5.yaml configuration");
|
|
15
15
|
}
|
|
16
16
|
async updateLandscapeSpecificContent(renamedBaseAppManifest) {
|
|
17
17
|
this.updateCloudPlatform(renamedBaseAppManifest);
|
|
@@ -42,5 +42,4 @@ class CFProcessor {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
exports.default = CFProcessor;
|
|
46
45
|
//# sourceMappingURL=cfProcessor.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConfiguration } from "../model/types";
|
|
1
|
+
import { IConfiguration } from "../model/types.js";
|
|
2
2
|
export default interface IProcessor {
|
|
3
3
|
createAppVariantHierarchyItem(appVariantId: string, version: string): void;
|
|
4
4
|
getBaseAppFiles(baseAppId: string): Promise<Map<string, string>>;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const cacheManager = new baseAppFilesCacheManager_1.default(configuration);
|
|
11
|
-
const abapRepoManager = new abapRepoManager_1.default(configuration);
|
|
12
|
-
const annotationManager = new annotationManager_1.default(configuration, abapRepoManager);
|
|
1
|
+
import AbapProcessor from "./abapProcessor.js";
|
|
2
|
+
import AbapRepoManager from "../repositories/abapRepoManager.js";
|
|
3
|
+
import AnnotationManager from "../annotationManager.js";
|
|
4
|
+
import BaseAppFilesCacheManager from "../cache/baseAppFilesCacheManager.js";
|
|
5
|
+
import CFProcessor from "./cfProcessor.js";
|
|
6
|
+
export function determineProcessor(configuration) {
|
|
7
|
+
const cacheManager = new BaseAppFilesCacheManager(configuration);
|
|
8
|
+
const abapRepoManager = new AbapRepoManager(configuration);
|
|
9
|
+
const annotationManager = new AnnotationManager(configuration, abapRepoManager);
|
|
13
10
|
const processors = [
|
|
14
|
-
new
|
|
15
|
-
new
|
|
11
|
+
new CFProcessor(configuration, cacheManager),
|
|
12
|
+
new AbapProcessor(configuration, cacheManager, abapRepoManager, annotationManager)
|
|
16
13
|
];
|
|
17
14
|
let processor = processors.find(processor => processor.getConfigurationType() === configuration.type);
|
|
18
15
|
if (processor) {
|
|
@@ -32,5 +29,4 @@ function determineProcessor(configuration) {
|
|
|
32
29
|
}
|
|
33
30
|
throw new Error("ui5.yaml configuration should correspond either ABAP or SAP BTP landscape");
|
|
34
31
|
}
|
|
35
|
-
exports.determineProcessor = determineProcessor;
|
|
36
32
|
//# sourceMappingURL=processor.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const log = require("@ui5/logger").getLogger("@ui5/task-adaptation::AbapRepoManager");
|
|
1
|
+
import RequestUtil from "../util/requestUtil.js";
|
|
2
|
+
import { getLogger } from "@ui5/logger";
|
|
3
|
+
import { unzipZipEntries } from "../util/zipUtil.js";
|
|
4
|
+
const log = getLogger("@ui5/task-adaptation::AbapRepoManager");
|
|
6
5
|
const REQUEST_OPTIONS_XML = {
|
|
7
6
|
responseType: "text",
|
|
8
7
|
headers: {
|
|
@@ -14,28 +13,30 @@ const REQUEST_OPTIONS_JSON = {
|
|
|
14
13
|
"Accept": "application/json"
|
|
15
14
|
}
|
|
16
15
|
};
|
|
17
|
-
class AbapRepoManager {
|
|
16
|
+
export default class AbapRepoManager {
|
|
17
|
+
auth;
|
|
18
|
+
configuration;
|
|
18
19
|
constructor(configuration) {
|
|
19
20
|
this.configuration = configuration;
|
|
20
21
|
}
|
|
21
22
|
async getAnnotationMetadata(uri) {
|
|
22
|
-
const header = await
|
|
23
|
+
const header = await RequestUtil.retryWithAuth(() => RequestUtil.head(uri), () => RequestUtil.head(uri, this.getAuth()));
|
|
23
24
|
return { changedOn: header.modified };
|
|
24
25
|
}
|
|
25
26
|
async downloadAnnotationFile(uri) {
|
|
26
27
|
const annotationUri = `https://${this.configuration.destination}.dest${uri}`;
|
|
27
|
-
const annotation = await
|
|
28
|
+
const annotation = await RequestUtil.retryWithAuth(() => RequestUtil.get(annotationUri, REQUEST_OPTIONS_XML), () => RequestUtil.get(annotationUri, REQUEST_OPTIONS_XML, this.getAuth()));
|
|
28
29
|
return new Map([["annotation.xml", annotation]]);
|
|
29
30
|
}
|
|
30
31
|
getMetadata(baseAppId) {
|
|
31
|
-
return
|
|
32
|
+
return RequestUtil.retryWithAuth(() => this.getMetadataRequest(baseAppId), () => this.getMetadataRequest(baseAppId, this.getAuth()));
|
|
32
33
|
}
|
|
33
34
|
downloadBaseAppFiles() {
|
|
34
|
-
return
|
|
35
|
+
return RequestUtil.retryWithAuth(() => this.downloadBaseAppFilesRequest(), () => this.downloadBaseAppFilesRequest(this.getAuth()));
|
|
35
36
|
}
|
|
36
37
|
async getMetadataRequest(id, auth) {
|
|
37
38
|
let uri = `https://${this.configuration.destination}.dest/sap/bc/ui2/app_index/ui5_app_info_json?id=${id}`;
|
|
38
|
-
const data = await
|
|
39
|
+
const data = await RequestUtil.get(uri, REQUEST_OPTIONS_JSON, auth);
|
|
39
40
|
if (data && data[id]) {
|
|
40
41
|
return {
|
|
41
42
|
changedOn: data[id].url,
|
|
@@ -48,10 +49,10 @@ class AbapRepoManager {
|
|
|
48
49
|
const { destination, appName } = this.configuration;
|
|
49
50
|
const encodedAppName = encodeURIComponent(appName);
|
|
50
51
|
const uri = `https://${destination}.dest/sap/opu/odata/UI5/ABAP_REPOSITORY_SRV/Repositories('${encodedAppName}')?DownloadFiles=RUNTIME&CodePage=UTF8`;
|
|
51
|
-
const data = await
|
|
52
|
+
const data = await RequestUtil.get(uri, {}, auth);
|
|
52
53
|
if (data?.d?.ZipArchive.length > 0) {
|
|
53
54
|
const buffer = Buffer.from(data.d.ZipArchive, "base64");
|
|
54
|
-
return
|
|
55
|
+
return unzipZipEntries(buffer);
|
|
55
56
|
}
|
|
56
57
|
throw new Error(`App '${appName}' from destination '${destination}' doesn't contain files`);
|
|
57
58
|
}
|
|
@@ -78,5 +79,4 @@ class AbapRepoManager {
|
|
|
78
79
|
return this.auth;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
exports.default = AbapRepoManager;
|
|
82
82
|
//# sourceMappingURL=abapRepoManager.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConfiguration } from "./../model/types";
|
|
1
|
+
import { IConfiguration } from "./../model/types.js";
|
|
2
2
|
export default class HTML5RepoManager {
|
|
3
3
|
static getBaseAppFiles(configuration: IConfiguration): Promise<Map<string, string>>;
|
|
4
4
|
static getMetadata(configuration: IConfiguration): Promise<any>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
class HTML5RepoManager {
|
|
1
|
+
import CFUtil from "./../util/cfUtil.js";
|
|
2
|
+
import RequestUtil from "./../util/requestUtil.js";
|
|
3
|
+
import { getLogger } from "@ui5/logger";
|
|
4
|
+
import { unzipZipEntries } from "./../util/zipUtil.js";
|
|
5
|
+
const log = getLogger("@ui5/task-adaptation::HTML5RepoManager");
|
|
6
|
+
export default class HTML5RepoManager {
|
|
8
7
|
static async getBaseAppFiles(configuration) {
|
|
9
8
|
const { token, baseUri } = await this.getHtml5RepoInfo(configuration);
|
|
10
9
|
return this.getBaseAppZipEntries(configuration, baseUri, token);
|
|
@@ -14,7 +13,7 @@ class HTML5RepoManager {
|
|
|
14
13
|
return this.requestMetadata(configuration, baseUri, token);
|
|
15
14
|
}
|
|
16
15
|
static async getHtml5RepoInfo(configuration) {
|
|
17
|
-
const spaceGuid = await
|
|
16
|
+
const spaceGuid = await CFUtil.getSpaceGuid(configuration?.spaceGuid);
|
|
18
17
|
const credentials = await this.getHTML5Credentials(spaceGuid);
|
|
19
18
|
const token = await this.getToken(credentials);
|
|
20
19
|
return {
|
|
@@ -37,7 +36,7 @@ class HTML5RepoManager {
|
|
|
37
36
|
serviceName: SERVIСE_INSTANCE_NAME,
|
|
38
37
|
tags: ["html5-apps-repo-rt"]
|
|
39
38
|
};
|
|
40
|
-
const serviceKeys = await
|
|
39
|
+
const serviceKeys = await CFUtil.getServiceInstanceKeys(getParams, createParams);
|
|
41
40
|
return serviceKeys.credentials;
|
|
42
41
|
}
|
|
43
42
|
static async getToken({ uaa }) {
|
|
@@ -50,7 +49,7 @@ class HTML5RepoManager {
|
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
const uri = `${uaa.url}/oauth/token?grant_type=client_credentials`;
|
|
53
|
-
return
|
|
52
|
+
return RequestUtil.get(uri, options).then((json) => json["access_token"]);
|
|
54
53
|
}
|
|
55
54
|
static async requestMetadata(options, html5RepoBaseUri, token) {
|
|
56
55
|
const { appHostId, appName, appVersion } = options;
|
|
@@ -62,20 +61,20 @@ class HTML5RepoManager {
|
|
|
62
61
|
"x-app-host-id": appHostId
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
|
-
const metadata = await
|
|
64
|
+
const metadata = await RequestUtil.get(uri, requestOptions);
|
|
66
65
|
return metadata.find((item) => item.appHostId === appHostId && item.applicationName === appName && item.applicationVersion === appVersion);
|
|
67
66
|
}
|
|
68
67
|
static async getBaseAppZipEntries(options, html5RepoBaseUri, token) {
|
|
69
68
|
const { appHostId, appName, appVersion } = options;
|
|
70
69
|
const uri = `${html5RepoBaseUri}/applications/content/${appName}-${appVersion}/`;
|
|
71
70
|
const zip = await this.download(token, appHostId, uri);
|
|
72
|
-
return
|
|
71
|
+
return unzipZipEntries(zip);
|
|
73
72
|
}
|
|
74
73
|
static async download(token, appHostId, uri) {
|
|
75
74
|
if (!token) {
|
|
76
75
|
throw new Error("HTML5 token is undefined");
|
|
77
76
|
}
|
|
78
|
-
return
|
|
77
|
+
return RequestUtil.get(uri, {
|
|
79
78
|
responseType: "arraybuffer",
|
|
80
79
|
headers: {
|
|
81
80
|
"Content-Type": "application/json",
|
|
@@ -85,5 +84,4 @@ class HTML5RepoManager {
|
|
|
85
84
|
});
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
|
-
exports.default = HTML5RepoManager;
|
|
89
87
|
//# sourceMappingURL=html5RepoManager.js.map
|