@ui5/task-adaptation 1.6.0 → 1.6.1
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 +28 -9
- package/dist/adapters/abapAdapter.d.ts +14 -0
- package/dist/adapters/abapAdapter.js +45 -0
- package/dist/adapters/adapter.d.ts +8 -0
- package/dist/adapters/adapter.js +2 -0
- package/dist/adapters/cfAdapter.d.ts +12 -0
- package/dist/adapters/cfAdapter.js +46 -0
- package/dist/adapters/commands/addAppVariantIdHierarchyCommand.d.ts +7 -0
- package/dist/adapters/commands/addAppVariantIdHierarchyCommand.js +17 -0
- package/dist/adapters/commands/applyDescriptorChangesCommand.d.ts +10 -0
- package/dist/adapters/commands/applyDescriptorChangesCommand.js +43 -0
- package/dist/adapters/commands/command.d.ts +84 -0
- package/dist/adapters/commands/command.js +108 -0
- package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +12 -0
- package/dist/adapters/commands/downloadAnnotationsCommand.js +26 -0
- package/dist/{util/i18nMerger.d.ts → adapters/commands/i18nPropertiesMergeCommand.d.ts} +13 -10
- package/dist/{util/i18nMerger.js → adapters/commands/i18nPropertiesMergeCommand.js} +30 -27
- package/dist/adapters/commands/setAppVariantIdCommand.d.ts +7 -0
- package/dist/adapters/commands/setAppVariantIdCommand.js +15 -0
- package/dist/adapters/commands/updateCloudDevAdaptationCommand.d.ts +4 -0
- package/dist/adapters/commands/updateCloudDevAdaptationCommand.js +11 -0
- package/dist/adapters/commands/updateCloudPlatformCommand.d.ts +6 -0
- package/dist/adapters/commands/updateCloudPlatformCommand.js +23 -0
- package/dist/adapters/commands/updateComponentNameCommand.d.ts +6 -0
- package/dist/adapters/commands/updateComponentNameCommand.js +13 -0
- package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.d.ts +7 -0
- package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.js +36 -0
- package/dist/adapters/commands/xsAppJsonMergeCommand.d.ts +5 -0
- package/dist/adapters/commands/xsAppJsonMergeCommand.js +17 -0
- package/dist/adapters/previewAdapter.d.ts +6 -0
- package/dist/adapters/previewAdapter.js +8 -0
- package/dist/appVariantManager.js +3 -0
- package/dist/baseAppManager.d.ts +0 -8
- package/dist/baseAppManager.js +3 -69
- package/dist/bundle.js +37 -35
- package/dist/cache/cacheHolder.js +9 -4
- package/dist/index.js +7 -3
- package/dist/model/appVariantIdHierarchyItem.d.ts +6 -1
- package/dist/model/types.d.ts +6 -0
- package/dist/previewManager.js +16 -23
- package/dist/processors/abapProcessor.d.ts +3 -7
- package/dist/processors/abapProcessor.js +4 -15
- package/dist/processors/cfProcessor.d.ts +5 -11
- package/dist/processors/cfProcessor.js +4 -90
- package/dist/processors/previewProcessor.d.ts +8 -0
- package/dist/processors/previewProcessor.js +11 -0
- package/dist/processors/processor.d.ts +3 -3
- package/dist/processors/processor.js +9 -0
- package/dist/repositories/abapRepoManager.d.ts +1 -1
- package/dist/repositories/html5RepoManager.js +6 -0
- package/dist/util/cf/xsAppJsonUtil.d.ts +13 -0
- package/dist/util/cf/xsAppJsonUtil.js +81 -0
- package/dist/util/cfUtil.d.ts +3 -3
- package/dist/util/cfUtil.js +1 -1
- package/dist/util/filesUtil.d.ts +3 -2
- package/dist/util/filesUtil.js +20 -4
- package/dist/util/fsUtil.d.ts +9 -0
- package/dist/util/fsUtil.js +40 -0
- package/dist/util/movingHandler/changeFileMoveHandler.js +2 -3
- package/dist/util/objectPath.d.ts +19 -0
- package/dist/util/objectPath.js +62 -0
- package/dist/util/renamingHandlers/jsonRenamingHandler.d.ts +12 -0
- package/dist/util/renamingHandlers/jsonRenamingHandler.js +34 -0
- package/dist/util/renamingHandlers/manifestRenamingHandler.d.ts +4 -5
- package/dist/util/renamingHandlers/manifestRenamingHandler.js +7 -18
- package/dist/util/requestUtil.d.ts +1 -1
- package/dist/util/requestUtil.js +5 -2
- package/dist/util/resourceUtil.d.ts +0 -7
- package/dist/util/resourceUtil.js +0 -36
- package/package.json +3 -2
- package/dist/util/movingHandler/fileMoveHandler.d.ts +0 -8
- package/dist/util/movingHandler/fileMoveHandler.js +0 -77
- package/scripts/publish.ts +0 -256
- package/scripts/test-integration-prep.sh +0 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { set } from "../../util/objectPath.js";
|
|
2
|
+
import { ManifestUpdateCommand } from "./command.js";
|
|
3
|
+
const MANIFEST_FILE = "manifest.json";
|
|
4
|
+
export default class SetAppVariantIdCommand extends ManifestUpdateCommand {
|
|
5
|
+
appVariantId;
|
|
6
|
+
constructor(appVariantId) {
|
|
7
|
+
super();
|
|
8
|
+
this.appVariantId = appVariantId;
|
|
9
|
+
}
|
|
10
|
+
accept = (filename) => filename === MANIFEST_FILE;
|
|
11
|
+
async execute(manifest) {
|
|
12
|
+
set(manifest, ["sap.app", "id"], this.appVariantId);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=setAppVariantIdCommand.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { set } from "../../util/objectPath.js";
|
|
2
|
+
import { ManifestUpdateCommand } from "./command.js";
|
|
3
|
+
export default class UpdateCloudDevAdaptationCommand extends ManifestUpdateCommand {
|
|
4
|
+
async execute(manifest) {
|
|
5
|
+
if (manifest["sap.fiori"]?.cloudDevAdaptationStatus) {
|
|
6
|
+
delete manifest["sap.fiori"].cloudDevAdaptationStatus;
|
|
7
|
+
}
|
|
8
|
+
set(manifest, ["sap.ui5", "isCloudDevAdaptation"], true);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=updateCloudDevAdaptationCommand.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { set } from "../../util/objectPath.js";
|
|
2
|
+
import { ManifestUpdateCommand } from "./command.js";
|
|
3
|
+
export default class UpdateCloudPlatformCommand extends ManifestUpdateCommand {
|
|
4
|
+
sapCloudService;
|
|
5
|
+
constructor(sapCloudService) {
|
|
6
|
+
super();
|
|
7
|
+
this.sapCloudService = sapCloudService;
|
|
8
|
+
}
|
|
9
|
+
async execute(manifest) {
|
|
10
|
+
const sapCloudService = manifest["sap.cloud"]?.service;
|
|
11
|
+
const sapPlatformCf = manifest["sap.platform.cf"];
|
|
12
|
+
if (sapPlatformCf?.oAuthScopes && sapCloudService) {
|
|
13
|
+
sapPlatformCf.oAuthScopes = sapPlatformCf.oAuthScopes.map((scope) => scope.replace(`$XSAPPNAME.`, `$XSAPPNAME('${sapCloudService}').`));
|
|
14
|
+
}
|
|
15
|
+
if (this.sapCloudService) {
|
|
16
|
+
set(manifest, ["sap.cloud", "service"], this.sapCloudService);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
delete manifest["sap.cloud"];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=updateCloudPlatformCommand.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ManifestUpdateCommand } from "./command.js";
|
|
2
|
+
import { set } from "../../util/objectPath.js";
|
|
3
|
+
export default class UpdateComponentNameCommand extends ManifestUpdateCommand {
|
|
4
|
+
baseAppId;
|
|
5
|
+
constructor(baseAppId) {
|
|
6
|
+
super();
|
|
7
|
+
this.baseAppId = baseAppId;
|
|
8
|
+
}
|
|
9
|
+
async execute(manifest) {
|
|
10
|
+
set(manifest, ["sap.ui5", "componentName"], this.baseAppId);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=updateComponentNameCommand.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IConfiguration } from "../../model/types.js";
|
|
2
|
+
import { PostCommand } from "./command.js";
|
|
3
|
+
export default class XsAppJsonEnhanceRoutesCommand extends PostCommand {
|
|
4
|
+
private configuration;
|
|
5
|
+
constructor(configuration: IConfiguration);
|
|
6
|
+
execute(files: Map<string, string>): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { enhanceRoutesWithEndpointAndService } from "../../util/cf/xsAppJsonUtil.js";
|
|
2
|
+
import CFUtil from "../../util/cfUtil.js";
|
|
3
|
+
import { getLogger } from "@ui5/logger";
|
|
4
|
+
import { PostCommand } from "./command.js";
|
|
5
|
+
const log = getLogger("@ui5/task-adaptation::CFProcessor");
|
|
6
|
+
export default class XsAppJsonEnhanceRoutesCommand extends PostCommand {
|
|
7
|
+
configuration;
|
|
8
|
+
constructor(configuration) {
|
|
9
|
+
super();
|
|
10
|
+
this.configuration = configuration;
|
|
11
|
+
}
|
|
12
|
+
async execute(files) {
|
|
13
|
+
const { serviceInstanceName, space } = this.configuration;
|
|
14
|
+
if (!serviceInstanceName) {
|
|
15
|
+
throw new Error(`Service instance name must be specified in ui5.yaml configuration for app '${this.configuration.appName}'`);
|
|
16
|
+
}
|
|
17
|
+
let serviceCredentials;
|
|
18
|
+
try {
|
|
19
|
+
// Get valid service keys with proper endpoints structure
|
|
20
|
+
serviceCredentials = await CFUtil.getOrCreateServiceKeyWithEndpoints(serviceInstanceName, space);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Failed to get valid service keys for app '${this.configuration.appName}': ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
if (serviceCredentials) {
|
|
26
|
+
const xsAppJson = files.get("xs-app.json");
|
|
27
|
+
if (xsAppJson) {
|
|
28
|
+
files.set("xs-app.json", enhanceRoutesWithEndpointAndService(xsAppJson, serviceCredentials));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
log.info(`No endpoints found for app '${this.configuration.appName}'. xs-app.json will not be updated.`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=xsAppJsonEnhanceRoutesCommand.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MergeCommand } from "./command.js";
|
|
2
|
+
export default class XsAppJsonMergeCommand extends MergeCommand {
|
|
3
|
+
accept: (filename: string) => filename is "xs-app.json";
|
|
4
|
+
execute(files: Map<string, string>, filename: string, appVariantContent: string): Promise<void>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { merge } from "../../util/cf/xsAppJsonUtil.js";
|
|
2
|
+
import { MergeCommand } from "./command.js";
|
|
3
|
+
export default class XsAppJsonMergeCommand extends MergeCommand {
|
|
4
|
+
accept = (filename) => filename === "xs-app.json";
|
|
5
|
+
async execute(files, filename, appVariantContent) {
|
|
6
|
+
const baseContent = files.get(filename);
|
|
7
|
+
const xsAppJsonFiles = [
|
|
8
|
+
appVariantContent,
|
|
9
|
+
baseContent // base app xs-app.json comes last
|
|
10
|
+
].filter(file => file !== undefined);
|
|
11
|
+
const result = merge(xsAppJsonFiles);
|
|
12
|
+
if (result) {
|
|
13
|
+
files.set(filename, result);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=xsAppJsonMergeCommand.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IAdapter } from "./adapter.js";
|
|
2
|
+
import { PostCommandChain } from "./commands/command.js";
|
|
3
|
+
import CFAdapter from "./cfAdapter.js";
|
|
4
|
+
export default class PreviewAdapter extends CFAdapter implements IAdapter {
|
|
5
|
+
createPostCommandChain(): PostCommandChain;
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PostCommandChain } from "./commands/command.js";
|
|
2
|
+
import CFAdapter from "./cfAdapter.js";
|
|
3
|
+
export default class PreviewAdapter extends CFAdapter {
|
|
4
|
+
createPostCommandChain() {
|
|
5
|
+
return new PostCommandChain([]);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=previewAdapter.js.map
|
|
@@ -24,6 +24,9 @@ export default class AppVariant {
|
|
|
24
24
|
return new AppVariant(files);
|
|
25
25
|
}
|
|
26
26
|
constructor(files, resources) {
|
|
27
|
+
if (files.size === 0) {
|
|
28
|
+
throw new Error("Application variant sources are empty");
|
|
29
|
+
}
|
|
27
30
|
this.files = files;
|
|
28
31
|
this.resources = resources;
|
|
29
32
|
const manifestString = files.get("manifest.appdescr_variant");
|
package/dist/baseAppManager.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import AppVariant from "./appVariantManager.js";
|
|
2
|
-
import IProcessor from "./processors/processor.js";
|
|
3
1
|
export interface IBaseAppResources {
|
|
4
2
|
resources: any[];
|
|
5
3
|
manifestInfo: IManifestInfo;
|
|
@@ -25,13 +23,7 @@ export default class BaseApp {
|
|
|
25
23
|
readonly files: ReadonlyMap<string, string>;
|
|
26
24
|
static fromFiles(files: ReadonlyMap<string, string>): BaseApp;
|
|
27
25
|
private constructor();
|
|
28
|
-
adapt(appVariant: AppVariant, processor: IProcessor): Promise<ReadonlyMap<string, string>>;
|
|
29
|
-
private updateComponentName;
|
|
30
|
-
private updateAdaptationProperties;
|
|
31
26
|
private extractI18nPathFromManifest;
|
|
32
27
|
private VALIDATION_RULES;
|
|
33
28
|
private validateProperty;
|
|
34
|
-
private applyDescriptorChanges;
|
|
35
|
-
private fillAppVariantIdHierarchy;
|
|
36
|
-
private adjustAddNewModelEnhanceWith;
|
|
37
29
|
}
|
package/dist/baseAppManager.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { AppDescriptorChange, RawApplier, RegistrationBuild } from "../dist/bundle.js";
|
|
2
1
|
import { trimExtension } from "./util/commonUtil.js";
|
|
3
|
-
import BuildStrategy from "./buildStrategy.js";
|
|
4
|
-
import { getLogger } from "@ui5/logger";
|
|
5
|
-
const log = getLogger("@ui5/task-adaptation::BaseAppManager");
|
|
6
2
|
const IGNORE_FILES = [
|
|
7
3
|
"manifest-bundle.zip",
|
|
8
4
|
"Component-preload.js",
|
|
@@ -47,6 +43,9 @@ export default class BaseApp {
|
|
|
47
43
|
return new BaseApp(files);
|
|
48
44
|
}
|
|
49
45
|
constructor(files) {
|
|
46
|
+
if (files.size === 0) {
|
|
47
|
+
throw new Error("Original application sources are empty");
|
|
48
|
+
}
|
|
50
49
|
this.files = preProcessFiles(files);
|
|
51
50
|
const manifestString = files.get("manifest.json");
|
|
52
51
|
if (!manifestString) {
|
|
@@ -59,35 +58,6 @@ export default class BaseApp {
|
|
|
59
58
|
this.validateProperty(this.version, "sap.app/applicationVersion/version");
|
|
60
59
|
this.i18nPath = this.extractI18nPathFromManifest(this.id, manifest["sap.app"]?.i18n);
|
|
61
60
|
}
|
|
62
|
-
async adapt(appVariant, processor) {
|
|
63
|
-
const files = new Map(this.files);
|
|
64
|
-
const manifest = JSON.parse(files.get("manifest.json"));
|
|
65
|
-
manifest["sap.app"].id = appVariant.id;
|
|
66
|
-
await processor.updateLandscapeSpecificContent(manifest, files, appVariant.id, appVariant.prefix);
|
|
67
|
-
this.updateComponentName(manifest, this.id);
|
|
68
|
-
this.fillAppVariantIdHierarchy(processor, appVariant.reference, this.version, manifest);
|
|
69
|
-
this.updateAdaptationProperties(manifest);
|
|
70
|
-
await this.applyDescriptorChanges(manifest, appVariant);
|
|
71
|
-
files.set("manifest.json", JSON.stringify(manifest));
|
|
72
|
-
return files;
|
|
73
|
-
}
|
|
74
|
-
updateComponentName(manifest, id) {
|
|
75
|
-
if (manifest["sap.ui5"] == null) {
|
|
76
|
-
manifest["sap.ui5"] = {};
|
|
77
|
-
}
|
|
78
|
-
if (manifest["sap.ui5"].componentName == null) {
|
|
79
|
-
manifest["sap.ui5"].componentName = id;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
updateAdaptationProperties(content) {
|
|
83
|
-
if (content["sap.fiori"]?.cloudDevAdaptationStatus) {
|
|
84
|
-
delete content["sap.fiori"].cloudDevAdaptationStatus;
|
|
85
|
-
}
|
|
86
|
-
if (content["sap.ui5"] == null) {
|
|
87
|
-
content["sap.ui5"] = {};
|
|
88
|
-
}
|
|
89
|
-
content["sap.ui5"].isCloudDevAdaptation = true;
|
|
90
|
-
}
|
|
91
61
|
extractI18nPathFromManifest(sapAppId, i18nNode) {
|
|
92
62
|
if (i18nNode) {
|
|
93
63
|
if (i18nNode["bundleUrl"]) {
|
|
@@ -119,41 +89,5 @@ export default class BaseApp {
|
|
|
119
89
|
validatationRule(value);
|
|
120
90
|
}
|
|
121
91
|
}
|
|
122
|
-
async applyDescriptorChanges(baseAppManifest, appVariant) {
|
|
123
|
-
log.verbose("Applying appVariant changes");
|
|
124
|
-
const changesContent = new Array();
|
|
125
|
-
const i18nBundleName = appVariant.prefix;
|
|
126
|
-
for (const change of appVariant.getProcessedManifestChanges()) {
|
|
127
|
-
changesContent.push(new AppDescriptorChange(change));
|
|
128
|
-
this.adjustAddNewModelEnhanceWith(change, i18nBundleName);
|
|
129
|
-
}
|
|
130
|
-
if (changesContent.length > 0) {
|
|
131
|
-
const changeHandlers = await Promise.all(changesContent.map(change => RegistrationBuild[change.getChangeType()]()));
|
|
132
|
-
await RawApplier.applyChanges(changeHandlers, baseAppManifest, changesContent, new BuildStrategy());
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
fillAppVariantIdHierarchy(processor, id, version, baseAppManifest) {
|
|
136
|
-
log.verbose("Filling up app variant hierarchy in manifest.json");
|
|
137
|
-
if (baseAppManifest["sap.ui5"] == null) {
|
|
138
|
-
baseAppManifest["sap.ui5"] = {};
|
|
139
|
-
}
|
|
140
|
-
if (baseAppManifest["sap.ui5"].appVariantIdHierarchy == null) {
|
|
141
|
-
baseAppManifest["sap.ui5"].appVariantIdHierarchy = [];
|
|
142
|
-
}
|
|
143
|
-
const appVariantIdHierarchyItem = processor.createAppVariantHierarchyItem(id, version);
|
|
144
|
-
baseAppManifest["sap.ui5"].appVariantIdHierarchy.unshift(appVariantIdHierarchyItem);
|
|
145
|
-
}
|
|
146
|
-
adjustAddNewModelEnhanceWith(change, i18nBundleName) {
|
|
147
|
-
if (change.changeType === "appdescr_ui5_addNewModelEnhanceWith") {
|
|
148
|
-
if (change.texts == null) {
|
|
149
|
-
// We need to add texts properties to changes because not all
|
|
150
|
-
// have texts property. Changes without texts property can
|
|
151
|
-
// causes issues in bundle.js This is needed for now, and will
|
|
152
|
-
// be removed as soon as change merger in openUI5 is updated
|
|
153
|
-
change.texts = { i18n: change.content?.bundleUrl || "i18n/i18n.properties" };
|
|
154
|
-
}
|
|
155
|
-
change.texts.i18n = i18nBundleName + "/" + change.texts.i18n;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
92
|
}
|
|
159
93
|
//# sourceMappingURL=baseAppManager.js.map
|
package/dist/bundle.js
CHANGED
|
@@ -116,14 +116,10 @@ function changePropertyValueByPath (vChanges, oRootPath) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
var Layer = {
|
|
119
|
-
USER: "USER",
|
|
120
|
-
PUBLIC: "PUBLIC",
|
|
121
119
|
CUSTOMER: "CUSTOMER",
|
|
122
120
|
CUSTOMER_BASE: "CUSTOMER_BASE",
|
|
123
121
|
PARTNER: "PARTNER",
|
|
124
|
-
VENDOR: "VENDOR"
|
|
125
|
-
BASE: "BASE"
|
|
126
|
-
};
|
|
122
|
+
VENDOR: "VENDOR"};
|
|
127
123
|
|
|
128
124
|
function checkObjectProperties(oChangeObject, oPropertyBag) {
|
|
129
125
|
const aObjects = oPropertyBag.aObjects || [];
|
|
@@ -2765,10 +2761,10 @@ const PROPERTIES_PATTERNS = {
|
|
|
2765
2761
|
customType: "^false$"
|
|
2766
2762
|
};
|
|
2767
2763
|
const SUPPORTED_TYPES = {
|
|
2768
|
-
uri:
|
|
2769
|
-
type:
|
|
2764
|
+
uri: "string",
|
|
2765
|
+
type: "string",
|
|
2770
2766
|
settings: typeof ({}),
|
|
2771
|
-
dataSourceCustom:
|
|
2767
|
+
dataSourceCustom: "boolean",
|
|
2772
2768
|
annotations: typeof []
|
|
2773
2769
|
};
|
|
2774
2770
|
function isDataSourceIdExistingInManifest(oManifestDataSources, sDataSourceId) {
|
|
@@ -2956,13 +2952,7 @@ var AddLibrary = {
|
|
|
2956
2952
|
};
|
|
2957
2953
|
|
|
2958
2954
|
var CondenserClassification = {
|
|
2959
|
-
LastOneWins: "lastOneWins"
|
|
2960
|
-
Reverse: "reverse",
|
|
2961
|
-
Move: "move",
|
|
2962
|
-
Create: "create",
|
|
2963
|
-
Destroy: "destroy",
|
|
2964
|
-
Update: "update"
|
|
2965
|
-
};
|
|
2955
|
+
LastOneWins: "lastOneWins"};
|
|
2966
2956
|
|
|
2967
2957
|
var SetTitle = {
|
|
2968
2958
|
applyChange(oManifest) {
|
|
@@ -4046,7 +4036,7 @@ const RegistrationBuild = {
|
|
|
4046
4036
|
appdescr_fiori_setAbstract: () => Promise.resolve(SetAbstract),
|
|
4047
4037
|
appdescr_fiori_setCloudDevAdaptationStatus: () => Promise.resolve(SetCloudDevAdaptationStatus)
|
|
4048
4038
|
};
|
|
4049
|
-
var
|
|
4039
|
+
var RegistrationBuild_default = {
|
|
4050
4040
|
...Registration,
|
|
4051
4041
|
...RegistrationBuild
|
|
4052
4042
|
};
|
|
@@ -5852,9 +5842,7 @@ var Type = {
|
|
|
5852
5842
|
Reference: "Reference",
|
|
5853
5843
|
Literal: "Literal",
|
|
5854
5844
|
Variable: "Variable",
|
|
5855
|
-
Call: "Call"
|
|
5856
|
-
Custom: "Custom"
|
|
5857
|
-
};
|
|
5845
|
+
Call: "Call"};
|
|
5858
5846
|
var Op = {
|
|
5859
5847
|
Equal: "==",
|
|
5860
5848
|
NotEqual: "!=",
|
|
@@ -6391,10 +6379,12 @@ _Helper = {
|
|
|
6391
6379
|
convert(mQueryOptions, "");
|
|
6392
6380
|
return aPaths;
|
|
6393
6381
|
},
|
|
6394
|
-
copyPrivateAnnotation: function (oSource, sAnnotation, oTarget) {
|
|
6382
|
+
copyPrivateAnnotation: function (oSource, sAnnotation, oTarget, bAllowSame) {
|
|
6395
6383
|
if (_Helper.hasPrivateAnnotation(oSource, sAnnotation)) {
|
|
6396
6384
|
if (_Helper.hasPrivateAnnotation(oTarget, sAnnotation)) {
|
|
6397
|
-
|
|
6385
|
+
if (!bAllowSame || _Helper.getPrivateAnnotation(oSource, sAnnotation) !== _Helper.getPrivateAnnotation(oTarget, sAnnotation)) {
|
|
6386
|
+
throw new Error("Must not overwrite: " + sAnnotation);
|
|
6387
|
+
}
|
|
6398
6388
|
}
|
|
6399
6389
|
_Helper.setPrivateAnnotation(oTarget, sAnnotation, _Helper.getPrivateAnnotation(oSource, sAnnotation));
|
|
6400
6390
|
}
|
|
@@ -6658,8 +6648,8 @@ _Helper = {
|
|
|
6658
6648
|
},
|
|
6659
6649
|
fireChange: function (mChangeListeners, sPropertyPath, vValue, bForceUpdate, bInArray) {
|
|
6660
6650
|
function inform(aChangeListeners, vValue0) {
|
|
6661
|
-
for (
|
|
6662
|
-
|
|
6651
|
+
for (const oChangeListener of aChangeListeners) {
|
|
6652
|
+
oChangeListener.onChange(vValue0, bForceUpdate);
|
|
6663
6653
|
}
|
|
6664
6654
|
}
|
|
6665
6655
|
if (!mChangeListeners) {
|
|
@@ -6901,13 +6891,13 @@ _Helper = {
|
|
|
6901
6891
|
return sPath;
|
|
6902
6892
|
},
|
|
6903
6893
|
getUrlParameters: function (sQuery) {
|
|
6904
|
-
const
|
|
6905
|
-
const
|
|
6906
|
-
for (const sKey of
|
|
6907
|
-
const aValues =
|
|
6908
|
-
|
|
6894
|
+
const mURLParameters = {};
|
|
6895
|
+
const oURLSearchParams = new URLSearchParams(sQuery);
|
|
6896
|
+
for (const sKey of oURLSearchParams.keys()) {
|
|
6897
|
+
const aValues = oURLSearchParams.getAll(sKey);
|
|
6898
|
+
mURLParameters[sKey] = aValues.length > 1 ? aValues : aValues[0];
|
|
6909
6899
|
}
|
|
6910
|
-
return
|
|
6900
|
+
return mURLParameters;
|
|
6911
6901
|
},
|
|
6912
6902
|
hasPathPrefix: function (sPath, sBasePath) {
|
|
6913
6903
|
return _Helper.getRelativePath(sPath, sBasePath) !== undefined;
|
|
@@ -7076,11 +7066,20 @@ _Helper = {
|
|
|
7076
7066
|
});
|
|
7077
7067
|
},
|
|
7078
7068
|
makeAbsolute: function (sUrl, sBase, bServiceUrl) {
|
|
7079
|
-
const
|
|
7069
|
+
const oURL = new URL(sUrl, new URL(sBase, document.baseURI));
|
|
7080
7070
|
if (bServiceUrl) {
|
|
7081
|
-
|
|
7071
|
+
oURL.pathname = oURL.pathname.slice(0, oURL.pathname.lastIndexOf("/") + 1);
|
|
7072
|
+
}
|
|
7073
|
+
return oURL.origin === new URL(document.baseURI).origin ? oURL.toString().slice(oURL.origin.length) : oURL.toString();
|
|
7074
|
+
},
|
|
7075
|
+
makeAbsoluteLongtextUrl: function (oMessage, sBase) {
|
|
7076
|
+
if (oMessage.longtextUrl) {
|
|
7077
|
+
const sAbsoluteLongtextURL = _Helper.makeAbsolute(oMessage.longtextUrl, sBase);
|
|
7078
|
+
if (oMessage.longtextUrl !== sAbsoluteLongtextURL) {
|
|
7079
|
+
oMessage["@$ui5.originalMessage"] ??= _Helper.clone(oMessage);
|
|
7080
|
+
oMessage.longtextUrl = sAbsoluteLongtextURL;
|
|
7081
|
+
}
|
|
7082
7082
|
}
|
|
7083
|
-
return oUrl.origin === new URL(document.baseURI).origin ? oUrl.toString().slice(oUrl.origin.length) : oUrl.toString();
|
|
7084
7083
|
},
|
|
7085
7084
|
makeRelativePath: function (sPath, sBase) {
|
|
7086
7085
|
return new _URL(sPath).relativeTo(new _URL(sBase));
|
|
@@ -7307,7 +7306,7 @@ _Helper = {
|
|
|
7307
7306
|
Object.keys(oSource).forEach(function (sProperty) {
|
|
7308
7307
|
var sPropertyPath = _Helper.buildPath(sPath, sProperty), vSourceProperty = oSource[sProperty], vTargetProperty = oTarget[sProperty];
|
|
7309
7308
|
if (sProperty === "@$ui5._") {
|
|
7310
|
-
_Helper.
|
|
7309
|
+
_Helper.copyPrivateAnnotation(oSource, "predicate", oTarget, true);
|
|
7311
7310
|
} else if (Array.isArray(vSourceProperty)) {
|
|
7312
7311
|
oTarget[sProperty] = vSourceProperty;
|
|
7313
7312
|
_Helper.fireChange(mChangeListeners, sPropertyPath, vSourceProperty, false, true);
|
|
@@ -7343,7 +7342,7 @@ _Helper = {
|
|
|
7343
7342
|
oOldObject[sProperty] = vNewProperty;
|
|
7344
7343
|
_Helper.fireChanges(mChangeListeners, sPropertyPath, vNewProperty, false);
|
|
7345
7344
|
}
|
|
7346
|
-
} else if (vOldProperty !== vNewProperty) {
|
|
7345
|
+
} else if (vOldProperty !== vNewProperty && !oOldObject[sProperty + "@$ui5.updating"]) {
|
|
7347
7346
|
oOldObject[sProperty] = vNewProperty;
|
|
7348
7347
|
if (vOldProperty && typeof vOldProperty === "object") {
|
|
7349
7348
|
_Helper.fireChanges(mChangeListeners, sPropertyPath, vOldProperty, true);
|
|
@@ -7446,6 +7445,9 @@ _Helper = {
|
|
|
7446
7445
|
}
|
|
7447
7446
|
if (sProperty === "@$ui5._") {
|
|
7448
7447
|
sSourcePredicate = _Helper.getPrivateAnnotation(oSource, "predicate");
|
|
7448
|
+
if (!sSourcePredicate) {
|
|
7449
|
+
return;
|
|
7450
|
+
}
|
|
7449
7451
|
if (fnCheckKeyPredicate && fnCheckKeyPredicate(sPath)) {
|
|
7450
7452
|
sTargetPredicate = _Helper.getPrivateAnnotation(oTarget, "predicate");
|
|
7451
7453
|
if (sSourcePredicate !== sTargetPredicate) {
|
|
@@ -9515,4 +9517,4 @@ _V4MetadataConverter.prototype.resolveTargetPath = function (sPath) {
|
|
|
9515
9517
|
};
|
|
9516
9518
|
})(_V4MetadataConverter.prototype);
|
|
9517
9519
|
|
|
9518
|
-
export { AppDescriptorChange, RawApplier,
|
|
9520
|
+
export { AppDescriptorChange, RawApplier, RegistrationBuild_default as RegistrationBuild, URI, _V2MetadataConverter as V2MetadataConverter, _V4MetadataConverter as V4MetadataConverter };
|
|
@@ -68,12 +68,17 @@ export function cached() {
|
|
|
68
68
|
return function (_target, _propertyKey, descriptor) {
|
|
69
69
|
const originalValue = descriptor.value;
|
|
70
70
|
descriptor.value = async function (...args) {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const repoName = args[0];
|
|
72
|
+
const cachebusterToken = args[1];
|
|
73
|
+
let files = await CacheHolder.read(repoName, cachebusterToken);
|
|
74
|
+
CacheHolder.clearOutdatedExcept(repoName);
|
|
73
75
|
if (files.size === 0) {
|
|
74
|
-
log.verbose(`
|
|
76
|
+
log.verbose(`No cache for repo '${repoName}' with token '${cachebusterToken}'. Fetching from HTML5 Repository.`);
|
|
75
77
|
files = await originalValue.apply(this, args);
|
|
76
|
-
await CacheHolder.write(
|
|
78
|
+
await CacheHolder.write(repoName, cachebusterToken, files);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
log.verbose(`Using cached files for repo '${repoName}' with token '${cachebusterToken}'.`);
|
|
77
82
|
}
|
|
78
83
|
return files;
|
|
79
84
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import * as dotenv from "dotenv";
|
|
|
2
2
|
import { logBuilderVersion } from "./util/commonUtil.js";
|
|
3
3
|
import AppVariant from "./appVariantManager.js";
|
|
4
4
|
import BaseApp from "./baseAppManager.js";
|
|
5
|
-
import I18nMerger from "./util/i18nMerger.js";
|
|
6
5
|
import ResourceUtil from "./util/resourceUtil.js";
|
|
7
6
|
import { determineProcessor } from "./processors/processor.js";
|
|
8
7
|
import FilesUtil from "./util/filesUtil.js";
|
|
@@ -15,6 +14,7 @@ export default ({ workspace, options, taskUtil }) => {
|
|
|
15
14
|
async function process(workspace, taskUtil) {
|
|
16
15
|
logBuilderVersion();
|
|
17
16
|
const processor = determineProcessor(options.configuration);
|
|
17
|
+
const adapter = processor.getAdapter();
|
|
18
18
|
const adaptationProject = await AppVariant.fromWorkspace(workspace, options.projectNamespace);
|
|
19
19
|
const previewManagerPromise = PreviewManager.createFromRoot(adaptationProject.reference, processor);
|
|
20
20
|
const appVariantIdHierarchy = await processor.getAppVariantIdHierarchy(adaptationProject.reference);
|
|
@@ -37,10 +37,14 @@ export default ({ workspace, options, taskUtil }) => {
|
|
|
37
37
|
appVariant = adaptationProject;
|
|
38
38
|
}
|
|
39
39
|
appVariants.push(appVariant);
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const adaptCommandChain = adapter.createAdaptCommandChain(baseApp, appVariant);
|
|
41
|
+
const mergeCommandChain = adapter.createMergeCommandChain(baseApp, appVariant);
|
|
42
|
+
const adaptedFiles = await adaptCommandChain.execute();
|
|
43
|
+
const mergedFiles = await mergeCommandChain.execute(adaptedFiles, appVariant.getProcessedFiles());
|
|
44
|
+
return mergedFiles;
|
|
42
45
|
};
|
|
43
46
|
let files = await fetchFilesPromises.reduce(async (previousFiles, currentFiles) => adapt(await previousFiles, await currentFiles), fetchFilesPromises.shift());
|
|
47
|
+
files = await adapter.createPostCommandChain().execute(files);
|
|
44
48
|
const references = getReferences(appVariants, adaptationProject.id);
|
|
45
49
|
files = FilesUtil.filter(files);
|
|
46
50
|
files = FilesUtil.rename(files, references);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface IAppVariantIdHierarchyItem {
|
|
2
2
|
appVariantId: string;
|
|
3
3
|
repoName: string;
|
|
4
4
|
cachebusterToken: string;
|
|
5
5
|
}
|
|
6
|
+
export interface IAppVariantIdHierarchyManifestItem {
|
|
7
|
+
appVariantId: string;
|
|
8
|
+
version: string;
|
|
9
|
+
layer?: "VENDOR";
|
|
10
|
+
}
|
package/dist/model/types.d.ts
CHANGED
|
@@ -116,4 +116,10 @@ export interface IJsonPromisePerLanguage {
|
|
|
116
116
|
language: Language;
|
|
117
117
|
json: Promise<any>;
|
|
118
118
|
}
|
|
119
|
+
export type ServiceCredentials = {
|
|
120
|
+
endpoints: Record<string, {
|
|
121
|
+
destination: string;
|
|
122
|
+
} | string>;
|
|
123
|
+
"sap.cloud.service"?: string;
|
|
124
|
+
};
|
|
119
125
|
export { IConfiguration };
|
package/dist/previewManager.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getLogger } from "@ui5/logger";
|
|
2
2
|
import ResourceUtil from "./util/resourceUtil.js";
|
|
3
3
|
import path from "path";
|
|
4
|
+
import { merge } from "./util/cf/xsAppJsonUtil.js";
|
|
5
|
+
import FsUtil from "./util/fsUtil.js";
|
|
4
6
|
const log = getLogger("@ui5/task-adaptation::PreviewManager");
|
|
5
7
|
const REUSE_DIR = ".adp/reuse";
|
|
6
8
|
const APP_INFO_FILE = "ui5AppInfo.json";
|
|
@@ -11,13 +13,15 @@ export default class PreviewManager {
|
|
|
11
13
|
let ui5AppInfo = "";
|
|
12
14
|
if (PreviewManager.isPreviewRequested()) {
|
|
13
15
|
try {
|
|
14
|
-
ui5AppInfo = await
|
|
16
|
+
ui5AppInfo = await FsUtil.readInProject(APP_INFO_FILE);
|
|
15
17
|
}
|
|
16
|
-
catch (
|
|
17
|
-
|
|
18
|
-
throw new Error(`ui5AppInfo.json is missing in project root, cannot process preview resources.`);
|
|
18
|
+
catch (error) {
|
|
19
|
+
throw new Error(`ui5AppInfo.json is missing in project root, cannot process preview resources: ${error instanceof Error ? error.message : String(error)}`);
|
|
19
20
|
}
|
|
20
21
|
}
|
|
22
|
+
else {
|
|
23
|
+
log.verbose("Preview mode not requested (env variable ADP_BUILDER_MODE=preview is not set), skipping preview resources processing.");
|
|
24
|
+
}
|
|
21
25
|
return new PreviewManager(appId, ui5AppInfo, processor);
|
|
22
26
|
}
|
|
23
27
|
static isPreviewRequested() {
|
|
@@ -26,6 +30,7 @@ export default class PreviewManager {
|
|
|
26
30
|
constructor(appId, ui5AppInfo, processor) {
|
|
27
31
|
// If no ui5AppInfo is provided, no preview processing is needed
|
|
28
32
|
if (!ui5AppInfo) {
|
|
33
|
+
log.verbose("No ui5AppInfo provided, skipping preview resources processing.");
|
|
29
34
|
return;
|
|
30
35
|
}
|
|
31
36
|
const appInfo = JSON.parse(ui5AppInfo)[appId];
|
|
@@ -49,7 +54,7 @@ export default class PreviewManager {
|
|
|
49
54
|
}
|
|
50
55
|
async processPreviewResources(baseAppFiles) {
|
|
51
56
|
log.verbose(`Downloading reuse libraries to reuse folder`);
|
|
52
|
-
const xsAppFiles = new
|
|
57
|
+
const xsAppFiles = new Array();
|
|
53
58
|
if (this.fetchLibsPromises.size === 0) {
|
|
54
59
|
log.verbose("No reuse libraries defined in ui5AppInfo.json for preview");
|
|
55
60
|
return;
|
|
@@ -64,7 +69,7 @@ export default class PreviewManager {
|
|
|
64
69
|
for (const [filename, content] of libFiles) {
|
|
65
70
|
mergedFiles.set(filename, content);
|
|
66
71
|
if (filename.includes(XS_APP_JSON_FILE)) {
|
|
67
|
-
xsAppFiles.
|
|
72
|
+
xsAppFiles.push(content);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -86,29 +91,17 @@ export default class PreviewManager {
|
|
|
86
91
|
searchBaseAppXsAppJsonFile(xsAppFiles, baseAppFiles) {
|
|
87
92
|
const xsAppJsonContent = baseAppFiles.get(XS_APP_JSON_FILE);
|
|
88
93
|
if (xsAppJsonContent) {
|
|
89
|
-
xsAppFiles.
|
|
94
|
+
xsAppFiles.push(xsAppJsonContent);
|
|
90
95
|
}
|
|
91
96
|
else {
|
|
92
97
|
log.warn("xs-app.json is missing in the downloaded base app files for preview");
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
mergeXsAppJsonFiles(xsAppFiles, files) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
routes: []
|
|
101
|
-
};
|
|
102
|
-
xsAppFiles.forEach((xsAppInfoContent) => {
|
|
103
|
-
const xsAppInfo = JSON.parse(xsAppInfoContent);
|
|
104
|
-
if (mergedXsAppJson.authenticationMethod === "none" && xsAppInfo.authenticationMethod) {
|
|
105
|
-
mergedXsAppJson.authenticationMethod = xsAppInfo.authenticationMethod;
|
|
106
|
-
}
|
|
107
|
-
if (Array.isArray(xsAppInfo.routes)) {
|
|
108
|
-
mergedXsAppJson.routes = mergedXsAppJson.routes.concat(xsAppInfo.routes);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
files.set(XS_APP_JSON_FILE, JSON.stringify(mergedXsAppJson, null, 2));
|
|
101
|
+
const mergedXsAppJson = merge(xsAppFiles);
|
|
102
|
+
if (mergedXsAppJson) {
|
|
103
|
+
files.set(XS_APP_JSON_FILE, mergedXsAppJson);
|
|
104
|
+
}
|
|
112
105
|
}
|
|
113
106
|
static moveLibraryFiles(inputFiles, libraryName, libId) {
|
|
114
107
|
const files = new Map();
|