@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
package/dist/util/cfUtil.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICreateServiceInstanceParams, IGetServiceInstanceParams, IResource, IServiceKeys } from "../model/types";
|
|
1
|
+
import { ICreateServiceInstanceParams, IGetServiceInstanceParams, IResource, IServiceKeys } from "../model/types.js";
|
|
2
2
|
export default class CFUtil {
|
|
3
3
|
/**
|
|
4
4
|
* Get or create service keys for service instance found by query
|
package/dist/util/cfUtil.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
class CFUtil {
|
|
1
|
+
import { cfCreateService, cfGetInstanceCredentials, cfGetTarget } from "@sap/cf-tools/out/src/cf-local.js";
|
|
2
|
+
import { Cli } from "@sap/cf-tools/out/src/cli.js";
|
|
3
|
+
import { eFilters } from "@sap/cf-tools/out/src/types.js";
|
|
4
|
+
import { getLogger } from "@ui5/logger";
|
|
5
|
+
const log = getLogger("@ui5/task-adaptation::CFUtil");
|
|
6
|
+
export default class CFUtil {
|
|
8
7
|
/**
|
|
9
8
|
* Get or create service keys for service instance found by query
|
|
10
9
|
* @static
|
|
@@ -41,7 +40,7 @@ class CFUtil {
|
|
|
41
40
|
throw new Error(`Cannot find a public plan by name '${params.serviceName}' in space '${params.spaceGuid}'`);
|
|
42
41
|
}
|
|
43
42
|
try {
|
|
44
|
-
await
|
|
43
|
+
await cfCreateService(publicPlan.guid, params.serviceName, params.parameters, params.tags);
|
|
45
44
|
}
|
|
46
45
|
catch (error) {
|
|
47
46
|
throw new Error(`Cannot create a service instance '${params.serviceName}' in space '${params.spaceGuid}': ${error.message}`);
|
|
@@ -60,10 +59,10 @@ class CFUtil {
|
|
|
60
59
|
return this.getServiceKeys(serviceInstance.guid);
|
|
61
60
|
}
|
|
62
61
|
static getServiceKeys(serviceInstanceGuid) {
|
|
63
|
-
return
|
|
62
|
+
return cfGetInstanceCredentials({
|
|
64
63
|
filters: [{
|
|
65
64
|
value: serviceInstanceGuid,
|
|
66
|
-
key:
|
|
65
|
+
key: eFilters.service_instance_guids
|
|
67
66
|
}]
|
|
68
67
|
}).catch((error) => {
|
|
69
68
|
throw new Error("Failed to get service credentials: " + error.message);
|
|
@@ -84,7 +83,7 @@ class CFUtil {
|
|
|
84
83
|
names: "names"
|
|
85
84
|
};
|
|
86
85
|
const parameters = Object.entries(params)
|
|
87
|
-
.filter(([
|
|
86
|
+
.filter(([, value]) => value?.length && value?.length > 0)
|
|
88
87
|
.map(([key, value]) => `${PARAM_MAP[key]}=${value?.join(",")}`);
|
|
89
88
|
const uri = `/v3/service_instances` + (parameters.length > 0 ? `?${parameters.join("&")}` : "");
|
|
90
89
|
const resources = await this.requestCfApi(uri);
|
|
@@ -116,7 +115,7 @@ class CFUtil {
|
|
|
116
115
|
const errors = new Set();
|
|
117
116
|
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
118
117
|
try {
|
|
119
|
-
const response = await
|
|
118
|
+
const response = await Cli.execute(params, { env: { "CF_COLOR": "false" } });
|
|
120
119
|
if (response.exitCode === 0) {
|
|
121
120
|
const errorValues = [...errors.values()];
|
|
122
121
|
if (errorValues?.length > 0) {
|
|
@@ -154,7 +153,7 @@ class CFUtil {
|
|
|
154
153
|
*/
|
|
155
154
|
static async getSpaceGuid(spaceGuid) {
|
|
156
155
|
if (spaceGuid == null) {
|
|
157
|
-
const spaceName = (await
|
|
156
|
+
const spaceName = (await cfGetTarget())?.space;
|
|
158
157
|
if (spaceName) {
|
|
159
158
|
const resources = await this.requestCfApi(`/v3/spaces?names=${spaceName}`);
|
|
160
159
|
for (const resource of resources) {
|
|
@@ -169,5 +168,4 @@ class CFUtil {
|
|
|
169
168
|
return spaceGuid;
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
|
-
exports.default = CFUtil;
|
|
173
171
|
//# sourceMappingURL=cfUtil.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IConfiguration } from "../model/types";
|
|
2
|
-
import Language from "../model/language";
|
|
1
|
+
import { IConfiguration } from "../model/types.js";
|
|
2
|
+
import Language from "../model/language.js";
|
|
3
3
|
export declare function dotToUnderscore(value: string): string;
|
|
4
4
|
export declare function validateObject<T extends Object>(options: T, properties: Array<keyof T>, message: string): void;
|
|
5
5
|
export declare function escapeRegex(update: string): string;
|
package/dist/util/commonUtil.js
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const log = require("@ui5/logger").getLogger("rollup-plugin-ui5-resolve-task-adaptation");
|
|
7
|
-
function dotToUnderscore(value) {
|
|
1
|
+
import * as Log from "@ui5/logger";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import { posix as path } from "path";
|
|
4
|
+
const log = Log.getLogger("rollup-plugin-ui5-resolve-task-adaptation");
|
|
5
|
+
export function dotToUnderscore(value) {
|
|
8
6
|
return value.replace(/\./g, "_");
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
function validateObject(options, properties, message) {
|
|
8
|
+
export function validateObject(options, properties, message) {
|
|
12
9
|
for (const property of properties) {
|
|
13
10
|
if (!options[property]) {
|
|
14
11
|
throw new Error(`'${String(property)}' ${message}`);
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
function escapeRegex(update) {
|
|
15
|
+
export function escapeRegex(update) {
|
|
20
16
|
return update.replaceAll(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
function renameResources(files, search, replacement) {
|
|
18
|
+
export function renameResources(files, search, replacement) {
|
|
24
19
|
// The current regex works if the old Id is contained in the new Id, given
|
|
25
20
|
// that they do not have the same beginning.
|
|
26
21
|
// more complete alternative: /((?<!newIdStart)|(?!newIdEnd))oldId/g
|
|
27
22
|
let escapedSearch;
|
|
28
23
|
if (replacement.includes(search)) {
|
|
29
|
-
const [before
|
|
24
|
+
const [before] = replacement.split(search);
|
|
30
25
|
// Matches a position in the string that is not immediately preceded by
|
|
31
26
|
// the string "before". Since we won't replace anyway, we should also
|
|
32
27
|
// ignore one with the slashes.
|
|
@@ -52,13 +47,11 @@ function renameResources(files, search, replacement) {
|
|
|
52
47
|
});
|
|
53
48
|
return files;
|
|
54
49
|
}
|
|
55
|
-
|
|
56
|
-
function insertInArray(array, index, insert) {
|
|
50
|
+
export function insertInArray(array, index, insert) {
|
|
57
51
|
array.splice(index, 0, insert);
|
|
58
52
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const TEMP_DIST_FOLDER = path_1.posix.join(process.cwd(), "dist-debug", name);
|
|
53
|
+
export function writeTempAnnotations({ writeTempFiles }, name, language, content) {
|
|
54
|
+
const TEMP_DIST_FOLDER = path.join(process.cwd(), "dist-debug", name);
|
|
62
55
|
if (writeTempFiles) {
|
|
63
56
|
if (!fs.existsSync(TEMP_DIST_FOLDER)) {
|
|
64
57
|
fs.mkdirSync(TEMP_DIST_FOLDER, { recursive: true });
|
|
@@ -66,16 +59,14 @@ function writeTempAnnotations({ writeTempFiles }, name, language, content) {
|
|
|
66
59
|
if (language) {
|
|
67
60
|
name += "-" + language.i18n;
|
|
68
61
|
}
|
|
69
|
-
fs.writeFileSync(
|
|
62
|
+
fs.writeFileSync(path.join(TEMP_DIST_FOLDER, name + ".xml"), content);
|
|
70
63
|
}
|
|
71
64
|
}
|
|
72
|
-
|
|
73
|
-
function removePropertiesExtension(filePath) {
|
|
65
|
+
export function removePropertiesExtension(filePath) {
|
|
74
66
|
const lastIndexOf = filePath.lastIndexOf(".properties");
|
|
75
67
|
return filePath.substring(0, lastIndexOf);
|
|
76
68
|
}
|
|
77
|
-
|
|
78
|
-
function traverse(json, paths, callback) {
|
|
69
|
+
export function traverse(json, paths, callback) {
|
|
79
70
|
for (const key of Object.keys(json)) {
|
|
80
71
|
const internPaths = [...paths];
|
|
81
72
|
internPaths.push(key);
|
|
@@ -100,23 +91,20 @@ function traverse(json, paths, callback) {
|
|
|
100
91
|
}
|
|
101
92
|
}
|
|
102
93
|
}
|
|
103
|
-
|
|
104
|
-
async function logBuilderVersion() {
|
|
94
|
+
export async function logBuilderVersion() {
|
|
105
95
|
try {
|
|
106
96
|
// @ts-ignore
|
|
107
|
-
const packageJSON = await
|
|
97
|
+
const packageJSON = await import("../../package.json");
|
|
108
98
|
log.info(`Running app-variant-bundler-build with version ${packageJSON.version}`);
|
|
109
99
|
}
|
|
110
100
|
catch (e) {
|
|
111
101
|
// do nothing
|
|
112
102
|
}
|
|
113
103
|
}
|
|
114
|
-
|
|
115
|
-
async function logBetaUsage() {
|
|
104
|
+
export async function logBetaUsage() {
|
|
116
105
|
log.info("Beta features enabled");
|
|
117
106
|
}
|
|
118
|
-
|
|
119
|
-
function getUniqueName(existingNames, template) {
|
|
107
|
+
export function getUniqueName(existingNames, template) {
|
|
120
108
|
let suffix = -1;
|
|
121
109
|
let suffixString;
|
|
122
110
|
do {
|
|
@@ -125,5 +113,4 @@ function getUniqueName(existingNames, template) {
|
|
|
125
113
|
} while (existingNames.includes(template + suffixString));
|
|
126
114
|
return template + suffixString;
|
|
127
115
|
}
|
|
128
|
-
exports.getUniqueName = getUniqueName;
|
|
129
116
|
//# sourceMappingURL=commonUtil.js.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference path="../../types/ui5.d.ts" />
|
|
2
|
+
import * as Resource from "@ui5/fs/Resource";
|
|
3
|
+
import { IAppVariantInfo } from "../model/types.js";
|
|
4
|
+
type Resource = typeof Resource;
|
|
2
5
|
export default class I18NMerger {
|
|
3
6
|
static analyzeAppVariantManifestChanges(rootFolder: string, tranlsationRegexPattern: string, { changes }: IAppVariantInfo): {
|
|
4
7
|
mergePathsRegex: RegExp[];
|
|
5
8
|
copyPathsRegex: RegExp[];
|
|
6
9
|
};
|
|
7
|
-
static mergeI18NFiles(baseAppResources: any[], appVariantResources: any[], projectNamespace: string, baseAppManifestI18NPath: string, appVariantInfo: IAppVariantInfo, taskUtil: any): Promise<
|
|
10
|
+
static mergeI18NFiles(baseAppResources: any[], appVariantResources: any[], projectNamespace: string, baseAppManifestI18NPath: string, appVariantInfo: IAppVariantInfo, taskUtil: any): Promise<(typeof Resource)[]>;
|
|
8
11
|
/**
|
|
9
12
|
* Merge/Append base property file with property file from app variant
|
|
10
13
|
* FIXME Currently merge could duplicate keys which causes undefined
|
|
@@ -26,3 +29,4 @@ export default class I18NMerger {
|
|
|
26
29
|
private static createFile;
|
|
27
30
|
private static mergeFiles;
|
|
28
31
|
}
|
|
32
|
+
export {};
|
package/dist/util/i18nMerger.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const Resource = require("@ui5/fs/lib/Resource");
|
|
7
|
-
class I18NMerger {
|
|
1
|
+
import { dotToUnderscore, escapeRegex, removePropertiesExtension } from "./commonUtil.js";
|
|
2
|
+
import ResourceUtil from "./resourceUtil.js";
|
|
3
|
+
import { posix as path } from "path";
|
|
4
|
+
export default class I18NMerger {
|
|
8
5
|
static analyzeAppVariantManifestChanges(rootFolder, tranlsationRegexPattern, { changes }) {
|
|
9
6
|
// check which files need to be copied and which files need to be merged and copied
|
|
10
7
|
// this is necessary because lrep does not support multiple enhanceWith with multiple locations
|
|
@@ -14,9 +11,9 @@ class I18NMerger {
|
|
|
14
11
|
const i18nPathWithExtension = change.content?.bundleUrl || change.texts?.i18n;
|
|
15
12
|
if (i18nPathWithExtension) {
|
|
16
13
|
// build regex to match specific + language related files
|
|
17
|
-
const i18nPath =
|
|
18
|
-
const resourcePath =
|
|
19
|
-
const regex = new RegExp(
|
|
14
|
+
const i18nPath = removePropertiesExtension(i18nPathWithExtension);
|
|
15
|
+
const resourcePath = path.join(rootFolder, i18nPath);
|
|
16
|
+
const regex = new RegExp(escapeRegex(resourcePath) + tranlsationRegexPattern);
|
|
20
17
|
if (change.changeType.includes("addNewModelEnhanceWith")) {
|
|
21
18
|
copyPaths.add(regex);
|
|
22
19
|
}
|
|
@@ -29,8 +26,8 @@ class I18NMerger {
|
|
|
29
26
|
}
|
|
30
27
|
static async mergeI18NFiles(baseAppResources, appVariantResources, projectNamespace, baseAppManifestI18NPath, appVariantInfo, taskUtil) {
|
|
31
28
|
const aggregatedResourceFilesMap = new Map(baseAppResources.map(baseAppResource => [baseAppResource.getPath(), baseAppResource]));
|
|
32
|
-
const i18nTargetFolder =
|
|
33
|
-
const rootFolder =
|
|
29
|
+
const i18nTargetFolder = dotToUnderscore(appVariantInfo.id);
|
|
30
|
+
const rootFolder = ResourceUtil.getRootFolder(projectNamespace);
|
|
34
31
|
const tranlsationRegexPattern = "((_[a-z]{2,3})?(_[a-zA-Z]{2,3}(_[a-zA-Z]{2,20})?)?)\.properties$";
|
|
35
32
|
const { copyPathsRegex: copyPathsValues, mergePathsRegex: mergePathsValues } = this.analyzeAppVariantManifestChanges(rootFolder, tranlsationRegexPattern, appVariantInfo);
|
|
36
33
|
for (const appVariantResource of appVariantResources) {
|
|
@@ -81,7 +78,7 @@ class I18NMerger {
|
|
|
81
78
|
*/
|
|
82
79
|
static moveToAppVarSubfolder(variantResource, rootFolder, i18nBundleName) {
|
|
83
80
|
const relativeFilePath = variantResource.getPath().substring(rootFolder.length);
|
|
84
|
-
const newResourcePath =
|
|
81
|
+
const newResourcePath = path.join(rootFolder, i18nBundleName, relativeFilePath);
|
|
85
82
|
variantResource.setPath(newResourcePath);
|
|
86
83
|
}
|
|
87
84
|
/**
|
|
@@ -99,5 +96,4 @@ class I18NMerger {
|
|
|
99
96
|
baseFile.setString(`${mergedFileContent}\n\n#App variant specific text file\n\n${variantFileContent}`);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
|
-
exports.default = I18NMerger;
|
|
103
99
|
//# sourceMappingURL=i18nMerger.js.map
|
package/dist/util/requestUtil.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const serverError_1 = require("../model/serverError");
|
|
6
|
-
class RequestUtil {
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import NoAuthorizationProvidedError from "../model/noAuthorizationProvidedError.js";
|
|
3
|
+
import ServerError from "../model/serverError.js";
|
|
4
|
+
export default class RequestUtil {
|
|
7
5
|
static async head(url, auth) {
|
|
8
|
-
return this.request(url,
|
|
6
|
+
return this.request(url, axios.head, auth);
|
|
9
7
|
}
|
|
10
8
|
static async get(url, options, auth) {
|
|
11
|
-
return this.request(url,
|
|
9
|
+
return this.request(url, axios.get, auth, options);
|
|
12
10
|
}
|
|
13
11
|
static async request(url, method, auth, options) {
|
|
14
12
|
try {
|
|
@@ -23,10 +21,10 @@ class RequestUtil {
|
|
|
23
21
|
if (error.response) {
|
|
24
22
|
// HTTP Status Code > 2xx
|
|
25
23
|
if (error.response.status === 401) {
|
|
26
|
-
throw new
|
|
24
|
+
throw new NoAuthorizationProvidedError(uri);
|
|
27
25
|
}
|
|
28
26
|
else if (error.response.status >= 500) {
|
|
29
|
-
throw new
|
|
27
|
+
throw new ServerError(uri, error);
|
|
30
28
|
}
|
|
31
29
|
else {
|
|
32
30
|
throw new Error(`Unexpected response received from '${uri}': ${error.response.status} ${error.response.data ?? ""}`);
|
|
@@ -44,7 +42,7 @@ class RequestUtil {
|
|
|
44
42
|
return await requestWithoutAuth();
|
|
45
43
|
}
|
|
46
44
|
catch (error) {
|
|
47
|
-
if (error instanceof
|
|
45
|
+
if (error instanceof NoAuthorizationProvidedError) {
|
|
48
46
|
return await requestWithAuth();
|
|
49
47
|
}
|
|
50
48
|
else {
|
|
@@ -53,5 +51,4 @@ class RequestUtil {
|
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
exports.default = RequestUtil;
|
|
57
54
|
//# sourceMappingURL=requestUtil.js.map
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const resourceFactory = require("@ui5/fs/lib/resourceFactory");
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as resourceFactory from "@ui5/fs/resourceFactory";
|
|
3
|
+
import { posix as path } from "path";
|
|
6
4
|
const UTF8 = "utf8";
|
|
7
|
-
class ResourceUtil {
|
|
5
|
+
export default class ResourceUtil {
|
|
8
6
|
static getRootFolder(projectNamespace) {
|
|
9
7
|
const newPath = ["/resources"];
|
|
10
8
|
if (projectNamespace) {
|
|
11
9
|
newPath.push(projectNamespace);
|
|
12
10
|
}
|
|
13
|
-
return
|
|
11
|
+
return path.join(...newPath);
|
|
14
12
|
}
|
|
15
13
|
static relativeToRoot(resourcePath, projectNamespace) {
|
|
16
14
|
const rootFolder = ResourceUtil.getRootFolder(projectNamespace);
|
|
17
|
-
return
|
|
15
|
+
return path.relative(rootFolder, resourcePath);
|
|
18
16
|
}
|
|
19
17
|
static getResourcePath(projectNamespace, ...paths) {
|
|
20
|
-
return
|
|
18
|
+
return path.join(this.getRootFolder(projectNamespace), ...paths);
|
|
21
19
|
}
|
|
22
20
|
static write(dir, files) {
|
|
23
21
|
const fsTarget = resourceFactory.createAdapter({
|
|
@@ -34,7 +32,7 @@ class ResourceUtil {
|
|
|
34
32
|
static read(rootFolder, folder, files, exclude = []) {
|
|
35
33
|
const entries = fs.readdirSync(folder);
|
|
36
34
|
for (let entry of entries) {
|
|
37
|
-
const entryPath =
|
|
35
|
+
const entryPath = path.join(folder, entry);
|
|
38
36
|
const stats = fs.lstatSync(entryPath);
|
|
39
37
|
if (stats.isFile() && !exclude.some(filepath => entryPath.endsWith(filepath))) {
|
|
40
38
|
const normalized = entryPath.substring(rootFolder.length + 1);
|
|
@@ -61,5 +59,4 @@ class ResourceUtil {
|
|
|
61
59
|
});
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
|
-
exports.default = ResourceUtil;
|
|
65
62
|
//# sourceMappingURL=resourceUtil.js.map
|
package/dist/util/urlUtil.d.ts
CHANGED
package/dist/util/urlUtil.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { URI } = require("../../dist/bundle-odata");
|
|
4
|
-
class UrlUtil {
|
|
1
|
+
import { URI } from "../../dist/bundle.js";
|
|
2
|
+
export default class UrlUtil {
|
|
5
3
|
static join(relativeUrl, parentUrl) {
|
|
6
4
|
// Remove trailing slash, otherwise url join can be incorrect Remove
|
|
7
5
|
// trailing slash, otherwise url join can be incorrect Annotation URLs
|
|
@@ -14,8 +12,7 @@ class UrlUtil {
|
|
|
14
12
|
}
|
|
15
13
|
static getResourcePath(url) {
|
|
16
14
|
// Trim urls domain/host.
|
|
17
|
-
return
|
|
15
|
+
return URI.parse(url).path;
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
|
-
exports.default = UrlUtil;
|
|
21
18
|
//# sourceMappingURL=urlUtil.js.map
|
package/dist/util/xmlUtil.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const convert = require("xml-js");
|
|
1
|
+
import * as convert from "xml-js";
|
|
4
2
|
const XML_OPTIONS = { compact: true, spaces: 4 };
|
|
5
|
-
class XmlUtil {
|
|
3
|
+
export default class XmlUtil {
|
|
6
4
|
static jsonToXml(json) {
|
|
7
5
|
return convert.json2xml(json, {
|
|
8
6
|
...XML_OPTIONS, attributeValueFn: (val) => val
|
|
@@ -20,5 +18,4 @@ class XmlUtil {
|
|
|
20
18
|
}));
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
|
-
exports.default = XmlUtil;
|
|
24
21
|
//# sourceMappingURL=xmlUtil.js.map
|
package/dist/util/zipUtil.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.unzipZipEntries = void 0;
|
|
4
|
-
const AdmZip = require("adm-zip");
|
|
5
|
-
async function unzipZipEntries(zip) {
|
|
1
|
+
import AdmZip from "adm-zip";
|
|
2
|
+
export async function unzipZipEntries(zip) {
|
|
6
3
|
let admZip;
|
|
7
4
|
try {
|
|
8
5
|
admZip = new AdmZip(zip);
|
|
@@ -13,7 +10,6 @@ async function unzipZipEntries(zip) {
|
|
|
13
10
|
throw new Error("Failed to parse zip content from HTML5 Repository: " + error.message);
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.unzipZipEntries = unzipZipEntries;
|
|
17
13
|
function mapEntries(entries) {
|
|
18
14
|
return new Map(entries.filter(entry => !entry.isDirectory).map(entry => [entry.entryName, entry.getData().toString("utf8")]));
|
|
19
15
|
}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import * as eslintimport from "eslint-plugin-import";
|
|
4
|
+
|
|
5
|
+
import eslint from "@eslint/js";
|
|
6
|
+
import tseslint from "typescript-eslint";
|
|
7
|
+
|
|
8
|
+
export default tseslint.config(
|
|
9
|
+
eslint.configs.recommended,
|
|
10
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
11
|
+
{
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parserOptions: {
|
|
14
|
+
project: true,
|
|
15
|
+
tsconfigRootDir: import.meta.dirname,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
plugins: {
|
|
19
|
+
import: eslintimport
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
23
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
24
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
25
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
26
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
27
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
28
|
+
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
29
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
30
|
+
"@typescript-eslint/no-base-to-string": "off",
|
|
31
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
32
|
+
"@typescript-eslint/unbound-method": "off",
|
|
33
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
34
|
+
"@typescript-eslint/require-await": "off",
|
|
35
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
36
|
+
"@typescript-eslint/ban-types": "off",
|
|
37
|
+
"@typescript-eslint/await-thenable": "off",
|
|
38
|
+
"no-constant-condition": "off",
|
|
39
|
+
"no-useless-escape": "off",
|
|
40
|
+
"no-unsafe-optional-chaining": "off",
|
|
41
|
+
"no-extra-semi": "off",
|
|
42
|
+
"prefer-const": "off",
|
|
43
|
+
"import/extensions": [
|
|
44
|
+
"error",
|
|
45
|
+
"ignorePackages",
|
|
46
|
+
{
|
|
47
|
+
"js": "always"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
);
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/task-adaptation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "npm run build && npm run coverage",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"coverage
|
|
7
|
+
"test": "npm run lint && npm run build && npm run coverage",
|
|
8
|
+
"lint": "npx eslint ./src",
|
|
9
|
+
"dev": "UI5_LOG_LVL=error mocha --no-timeouts --no-warnings --experimental-loader=tsx --loader=esmock 'test/**/*.spec.ts'",
|
|
10
|
+
"perf": "UI5_LOG_LVL=error mocha --no-timeouts --no-warnings --experimental-loader=tsx --loader=esmock 'test/**/*.perf.ts'",
|
|
11
|
+
"coverage": "npx c8 npm run dev",
|
|
12
12
|
"preversion": "npm test",
|
|
13
13
|
"version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
|
|
14
14
|
"prepublishOnly": "git push --follow-tags",
|
|
15
15
|
"release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
|
|
16
|
-
"rollup": "
|
|
17
|
-
"build": "npm run rollup &&
|
|
18
|
-
"download-metadata": "
|
|
16
|
+
"rollup": "tsx scripts/rollup.ts",
|
|
17
|
+
"build": "npm run rollup && tsc -p ./",
|
|
18
|
+
"download-metadata": "tsx scripts/metadataDownloadHelper.ts"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -33,29 +33,21 @@
|
|
|
33
33
|
"author": "SAP SE",
|
|
34
34
|
"license": "Apache-2.0",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@ui5/fs": "^2.0.6",
|
|
40
|
-
"@ui5/logger": "^2.0.1",
|
|
41
|
-
"@ui5/project": "^2.6.0",
|
|
36
|
+
"@sap/cf-tools": "^3.2.0",
|
|
37
|
+
"@ui5/fs": "^3.0.5",
|
|
38
|
+
"@ui5/logger": "^3.0.0",
|
|
42
39
|
"adm-zip": "^0.5.5",
|
|
43
|
-
"amdextract": "^3.0.0",
|
|
44
40
|
"axios": "^1.6.2",
|
|
45
|
-
"builtin-modules": "^3.2.0",
|
|
46
41
|
"crc": "^4.3.2",
|
|
47
42
|
"dotenv": "^16.0.3",
|
|
48
|
-
"glob": "^10.3.10",
|
|
49
|
-
"js-yaml": "^4.1.0",
|
|
50
43
|
"jsdom": "^23.0.1",
|
|
51
|
-
"rimraf": "^5.0.5",
|
|
52
|
-
"rollup": "^2.56.3",
|
|
53
|
-
"semver": "^7.3.5",
|
|
54
44
|
"temp-dir": "^2.0.0",
|
|
55
45
|
"xml-js": "^1.6.11"
|
|
56
46
|
},
|
|
57
47
|
"devDependencies": {
|
|
48
|
+
"@buxlabs/amd-to-es6": "^0.16.1",
|
|
58
49
|
"@istanbuljs/nyc-config-typescript": "^1.0.1",
|
|
50
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
59
51
|
"@types/adm-zip": "^0.4.34",
|
|
60
52
|
"@types/chai": "^4.2.21",
|
|
61
53
|
"@types/chai-as-promised": "^7.1.4",
|
|
@@ -63,22 +55,36 @@
|
|
|
63
55
|
"@types/jsdom": "^21.1.6",
|
|
64
56
|
"@types/lodash": "^4.14.196",
|
|
65
57
|
"@types/mocha": "^9.1.0",
|
|
66
|
-
"@types/rimraf": "^4.0.5",
|
|
67
58
|
"@types/semver": "^7.3.8",
|
|
68
59
|
"@types/sinon": "^10.0.16",
|
|
60
|
+
"@ui5/project": "^3.9.0",
|
|
61
|
+
"amdextract": "^3.0.0",
|
|
62
|
+
"builtin-modules": "^3.2.0",
|
|
63
|
+
"c8": "^9.1.0",
|
|
69
64
|
"chai": "^4.3.4",
|
|
70
65
|
"chai-as-promised": "^7.1.1",
|
|
71
66
|
"chalk": "^4.1.2",
|
|
67
|
+
"eslint": "^8.57.0",
|
|
68
|
+
"eslint-plugin-import": "^2.29.1",
|
|
69
|
+
"esmock": "^2.6.3",
|
|
70
|
+
"glob": "^10.3.10",
|
|
71
|
+
"js-yaml": "^4.1.0",
|
|
72
|
+
"lodash": "^4.17.21",
|
|
72
73
|
"minimatch": "^9.0.3",
|
|
73
|
-
"mocha": "^
|
|
74
|
+
"mocha": "^10.2.0",
|
|
74
75
|
"mock-require": "^3.0.3",
|
|
75
76
|
"nyc": "^15.1.0",
|
|
76
|
-
"
|
|
77
|
+
"rollup": "^4.9.6",
|
|
78
|
+
"semver": "^7.3.5",
|
|
79
|
+
"sinon": "^17.0.1",
|
|
77
80
|
"source-map-support": "^0.5.19",
|
|
78
|
-
"
|
|
79
|
-
"typescript": "^4.
|
|
81
|
+
"tsx": "^4.7.1",
|
|
82
|
+
"typescript": "^5.4.2",
|
|
83
|
+
"typescript-eslint": "^7.2.0"
|
|
80
84
|
},
|
|
81
|
-
"
|
|
85
|
+
"c8": {
|
|
86
|
+
"src": "./src",
|
|
87
|
+
"all": true,
|
|
82
88
|
"reporter": [
|
|
83
89
|
"lcov",
|
|
84
90
|
"text",
|
|
@@ -95,33 +101,20 @@
|
|
|
95
101
|
"src/model/types.ts",
|
|
96
102
|
"src/util/requestUtil.ts",
|
|
97
103
|
"scripts/**/*.js",
|
|
98
|
-
"scripts/git/octokitUtil.ts"
|
|
104
|
+
"scripts/git/octokitUtil.ts",
|
|
105
|
+
"*/**/*.d.ts",
|
|
106
|
+
"src/annotations/comparator/diffCase.ts",
|
|
107
|
+
"src/annotations/transformers/transformer.ts"
|
|
99
108
|
],
|
|
100
109
|
"check-coverage": true,
|
|
101
110
|
"statements": 85,
|
|
102
111
|
"branches": 70,
|
|
103
112
|
"functions": 90,
|
|
104
|
-
"lines": 85
|
|
105
|
-
"watermarks": {
|
|
106
|
-
"statements": [
|
|
107
|
-
70,
|
|
108
|
-
90
|
|
109
|
-
],
|
|
110
|
-
"branches": [
|
|
111
|
-
70,
|
|
112
|
-
90
|
|
113
|
-
],
|
|
114
|
-
"functions": [
|
|
115
|
-
70,
|
|
116
|
-
90
|
|
117
|
-
],
|
|
118
|
-
"lines": [
|
|
119
|
-
70,
|
|
120
|
-
90
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
|
-
"cache": true,
|
|
124
|
-
"all": true
|
|
113
|
+
"lines": 85
|
|
125
114
|
},
|
|
126
|
-
"types": "dist/index.d.ts"
|
|
115
|
+
"types": "dist/index.d.ts",
|
|
116
|
+
"type": "module",
|
|
117
|
+
"engines": {
|
|
118
|
+
"node": "18.14.2"
|
|
119
|
+
}
|
|
127
120
|
}
|