@ui5/task-adaptation 1.6.7 → 1.6.8
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 +6 -2
- package/dist/appVariant.d.ts +0 -1
- package/dist/appVariant.js +0 -7
- package/dist/bundle.js +47 -26
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/model/types.d.ts +1 -0
- package/dist/util/cfUtil.d.ts +6 -24
- package/dist/util/cfUtil.js +36 -93
- package/dist/util/resourceUtil.js +6 -2
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
-
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task-adaptation/compare/v1.6.8...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v1.6.8"></a>
|
|
8
|
+
## [v1.6.8] - 2026-08-12
|
|
6
9
|
|
|
7
10
|
<a name="v1.6.7"></a>
|
|
8
|
-
## [v1.6.7] - 2026-07-
|
|
11
|
+
## [v1.6.7] - 2026-07-29
|
|
9
12
|
|
|
10
13
|
<a name="v1.6.6"></a>
|
|
11
14
|
## [v1.6.6] - 2026-06-30
|
|
@@ -164,6 +167,7 @@ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-task
|
|
|
164
167
|
<a name="v1.0.0"></a>
|
|
165
168
|
## v1.0.0 - 2020-12-09
|
|
166
169
|
|
|
170
|
+
[v1.6.8]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.7...v1.6.8
|
|
167
171
|
[v1.6.7]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.6...v1.6.7
|
|
168
172
|
[v1.6.6]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.5...v1.6.6
|
|
169
173
|
[v1.6.5]: https://github.com/SAP/ui5-task-adaptation/compare/v1.6.4...v1.6.5
|
package/dist/appVariant.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export default class AppVariant {
|
|
|
10
10
|
movedFiles: Map<string, string>;
|
|
11
11
|
private renaming;
|
|
12
12
|
static fromWorkspace(workspace: IWorkspace, projectNamespace: string): Promise<AppVariant>;
|
|
13
|
-
static fromProject(): Promise<AppVariant>;
|
|
14
13
|
static fromFiles(files: ReadonlyMap<string, Buffer>): AppVariant;
|
|
15
14
|
private constructor();
|
|
16
15
|
getProcessedFiles(): ReadonlyMap<string, Buffer>;
|
package/dist/appVariant.js
CHANGED
|
@@ -21,13 +21,6 @@ export default class AppVariant {
|
|
|
21
21
|
const files = await ResourceUtil.toFileMap(resources, projectNamespace);
|
|
22
22
|
return new AppVariant(files, resources);
|
|
23
23
|
}
|
|
24
|
-
static async fromProject() {
|
|
25
|
-
// previewManifest only merges manifest changes, that is why we
|
|
26
|
-
// just need the app variant descriptor and *.change files from the workspace.
|
|
27
|
-
const EXTENSIONS_TO_PROCESS = "change,appdescr_variant";
|
|
28
|
-
const files = await ResourceUtil.byGlobInProject(`/**/*.{${EXTENSIONS_TO_PROCESS}}`);
|
|
29
|
-
return new AppVariant(files);
|
|
30
|
-
}
|
|
31
24
|
static fromFiles(files) {
|
|
32
25
|
return new AppVariant(files);
|
|
33
26
|
}
|
package/dist/bundle.js
CHANGED
|
@@ -2183,34 +2183,52 @@ function processTerminologies(oChangeContent, sAppId) {
|
|
|
2183
2183
|
});
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
|
+
function getEnhancementSettings(oChange, oChangeContent, sAppId) {
|
|
2187
|
+
const sI18n = oChange.getTexts()?.i18n;
|
|
2188
|
+
if (sI18n) {
|
|
2189
|
+
return {
|
|
2190
|
+
bundleName: ApplyUtil.formatBundleName(sAppId, sI18n)
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
const oEnhancementSettings = Object.assign({}, oChangeContent);
|
|
2194
|
+
oEnhancementSettings.terminologies &&= Object.keys(oEnhancementSettings.terminologies).reduce((oResult, sTerminology) => {
|
|
2195
|
+
oResult[sTerminology] = Object.assign({}, oEnhancementSettings.terminologies[sTerminology]);
|
|
2196
|
+
return oResult;
|
|
2197
|
+
}, {});
|
|
2198
|
+
if (hasBundleUrlAndNotBundleName(oEnhancementSettings)) {
|
|
2199
|
+
oEnhancementSettings.bundleName = ApplyUtil.formatBundleName(sAppId, oEnhancementSettings.bundleUrl);
|
|
2200
|
+
delete oEnhancementSettings.bundleUrl;
|
|
2201
|
+
}
|
|
2202
|
+
processTerminologies(oEnhancementSettings, sAppId);
|
|
2203
|
+
delete oEnhancementSettings.modelId;
|
|
2204
|
+
delete oEnhancementSettings.createIfMissing;
|
|
2205
|
+
return oEnhancementSettings;
|
|
2206
|
+
}
|
|
2186
2207
|
const AddNewModelEnhanceWith = {
|
|
2187
2208
|
applyChange(oManifest, oChange) {
|
|
2188
2209
|
const oChangeContent = oChange.getContent();
|
|
2189
2210
|
const sModelId = oChangeContent.modelId;
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
if (Object.keys(oChangeContent).length > 0) {
|
|
2212
|
-
oEnhanceWith.push(oChangeContent);
|
|
2213
|
-
}
|
|
2211
|
+
const oModels = oManifest["sap.ui5"].models;
|
|
2212
|
+
const sAppId = oManifest["sap.app"].id;
|
|
2213
|
+
const oEnhancementSettings = getEnhancementSettings(oChange, oChangeContent, sAppId);
|
|
2214
|
+
const oModel = oModels[sModelId];
|
|
2215
|
+
if (!oModel) {
|
|
2216
|
+
if (!oChangeContent.createIfMissing) {
|
|
2217
|
+
throw Error(`Model with ID '${sModelId}' does not exist. Set createIfMissing to true to create it.`);
|
|
2218
|
+
}
|
|
2219
|
+
oModels[sModelId] = {
|
|
2220
|
+
type: "sap.ui.model.resource.ResourceModel",
|
|
2221
|
+
settings: oEnhancementSettings
|
|
2222
|
+
};
|
|
2223
|
+
return oManifest;
|
|
2224
|
+
}
|
|
2225
|
+
if (oModel.type && oModel.type === "sap.ui.model.resource.ResourceModel") {
|
|
2226
|
+
if (!(oModel.settings && oModel.settings.enhanceWith)) {
|
|
2227
|
+
ObjectPath.set("settings.enhanceWith", [], oModel);
|
|
2228
|
+
}
|
|
2229
|
+
const oEnhanceWith = oModel.settings.enhanceWith;
|
|
2230
|
+
if (!fnIsEmptyObject(oEnhancementSettings)) {
|
|
2231
|
+
oEnhanceWith.push(oEnhancementSettings);
|
|
2214
2232
|
}
|
|
2215
2233
|
}
|
|
2216
2234
|
return oManifest;
|
|
@@ -2303,7 +2321,7 @@ function Version(vMajor, iMinor, iPatch, sSuffix) {
|
|
|
2303
2321
|
return sSuffix;
|
|
2304
2322
|
};
|
|
2305
2323
|
this.compareTo = function (vOtherMajor, iOtherMinor, iOtherPatch, sOtherSuffix) {
|
|
2306
|
-
var vOther = Version.apply(
|
|
2324
|
+
var vOther = Version.apply(null, arguments);
|
|
2307
2325
|
return vMajor - vOther.getMajor() || iMinor - vOther.getMinor() || iPatch - vOther.getPatch() || (sSuffix < vOther.getSuffix() ? -1 : sSuffix === vOther.getSuffix() ? 0 : 1);
|
|
2308
2326
|
};
|
|
2309
2327
|
}
|
|
@@ -4598,7 +4616,7 @@ var fnEqual = function (a, b, maxDepth, contains, depth) {
|
|
|
4598
4616
|
if (!contains && Object.keys(a).length !== Object.keys(b).length) {
|
|
4599
4617
|
return false;
|
|
4600
4618
|
}
|
|
4601
|
-
if (a instanceof Node) {
|
|
4619
|
+
if (typeof Node !== "undefined" && a instanceof Node) {
|
|
4602
4620
|
return a.isEqualNode(b);
|
|
4603
4621
|
}
|
|
4604
4622
|
if (a instanceof Date) {
|
|
@@ -6713,6 +6731,9 @@ _Helper = {
|
|
|
6713
6731
|
return oCurrent && (sSegment in oCurrent) ? oCurrent[sSegment] : undefined;
|
|
6714
6732
|
}, oObject);
|
|
6715
6733
|
},
|
|
6734
|
+
dropQuery: function (sResourcePathWithQuery) {
|
|
6735
|
+
return sResourcePathWithQuery.split("?")[0];
|
|
6736
|
+
},
|
|
6716
6737
|
encode: function (sPart, bEncodeEquals) {
|
|
6717
6738
|
var sEncoded = encodeURI(sPart).replace(rAmpersand, "%26").replace(rHash, "%23").replace(rPlus, "%2B");
|
|
6718
6739
|
if (bEncodeEquals) {
|
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export default _default;
|
|
|
12
12
|
* the cache is empty, this throws with a message directing the user to run
|
|
13
13
|
* a full build first.
|
|
14
14
|
*/
|
|
15
|
-
export declare function previewManifest({ options }: ITaskParameters): Promise<any>;
|
|
15
|
+
export declare function previewManifest({ workspace, options }: ITaskParameters): Promise<any>;
|
package/dist/index.js
CHANGED
|
@@ -50,9 +50,9 @@ export default async ({ workspace, options, taskUtil }) => {
|
|
|
50
50
|
* the cache is empty, this throws with a message directing the user to run
|
|
51
51
|
* a full build first.
|
|
52
52
|
*/
|
|
53
|
-
export async function previewManifest({ options }) {
|
|
53
|
+
export async function previewManifest({ workspace, options }) {
|
|
54
54
|
const { repository, adapter } = await initialize(options.configuration, { useCacheRepository: true });
|
|
55
|
-
const adaptationProject = await AppVariant.
|
|
55
|
+
const adaptationProject = await AppVariant.fromWorkspace(workspace, options.projectNamespace);
|
|
56
56
|
const [baseAppResource] = await repository.getAppVariantIdHierarchy(adaptationProject.reference);
|
|
57
57
|
const cachedBaseAppFiles = await repository.fetch(baseAppResource);
|
|
58
58
|
const baseApp = BaseApp.fromFiles(cachedBaseAppFiles);
|
package/dist/model/types.d.ts
CHANGED
package/dist/util/cfUtil.d.ts
CHANGED
|
@@ -10,10 +10,9 @@ export default class CFUtil {
|
|
|
10
10
|
*/
|
|
11
11
|
static getServiceInstanceKeys(getServiceInstanceParams: IGetServiceInstanceParams, createServiceInstanceParams?: ICreateServiceInstanceParams): Promise<IServiceKeys>;
|
|
12
12
|
static createService(params: ICreateServiceInstanceParams): Promise<void>;
|
|
13
|
-
private static
|
|
14
|
-
private static
|
|
13
|
+
private static getOrCreateCredentials;
|
|
14
|
+
private static fetchCredentials;
|
|
15
15
|
private static createServiceKey;
|
|
16
|
-
private static deleteServiceKeyUnsafe;
|
|
17
16
|
private static getServiceInstance;
|
|
18
17
|
static processCfErrors(errors?: ICfError[]): void;
|
|
19
18
|
static requestCfApi(url: string): Promise<IResource[]>;
|
|
@@ -22,14 +21,15 @@ export default class CFUtil {
|
|
|
22
21
|
private static errorsToString;
|
|
23
22
|
private static parseJson;
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
24
|
+
* Return the most recently created service credential binding (key) for the given service instance,
|
|
25
|
+
* or undefined if no keys exist.
|
|
26
26
|
* @private
|
|
27
27
|
* @static
|
|
28
28
|
* @param {string} serviceInstanceGuid the service instance guid
|
|
29
|
-
* @return {Promise<
|
|
29
|
+
* @return {Promise<any | undefined>} the newest binding object ({ name, guid, created_at, … }) or undefined
|
|
30
30
|
* @memberof CFUtil
|
|
31
31
|
*/
|
|
32
|
-
private static
|
|
32
|
+
private static getNewestServiceKey;
|
|
33
33
|
/**
|
|
34
34
|
* Get service keys for a service instance by name. If the existing service key
|
|
35
35
|
* has endpoints as strings instead of objects, a new service key will be created.
|
|
@@ -49,24 +49,6 @@ export default class CFUtil {
|
|
|
49
49
|
* @memberof CFUtil
|
|
50
50
|
*/
|
|
51
51
|
private static hasValidEndpoints;
|
|
52
|
-
/**
|
|
53
|
-
* Get all service key names for a service instance
|
|
54
|
-
* @private
|
|
55
|
-
* @static
|
|
56
|
-
* @param {string} serviceInstanceGuid the service instance guid
|
|
57
|
-
* @return {Promise<string[]>} promise with array of service key names
|
|
58
|
-
* @memberof CFUtil
|
|
59
|
-
*/
|
|
60
|
-
private static getAllServiceKeyNames;
|
|
61
|
-
/**
|
|
62
|
-
* Generate a unique service key name in format serviceInstanceName-key-N
|
|
63
|
-
* @static
|
|
64
|
-
* @param {string} serviceInstanceName the service instance name
|
|
65
|
-
* @param {string} serviceInstanceGuid the service instance guid
|
|
66
|
-
* @return {Promise<string>} promise with unique service key name
|
|
67
|
-
* @memberof CFUtil
|
|
68
|
-
*/
|
|
69
|
-
static generateUniqueServiceKeyName(serviceInstanceName: string, serviceInstanceGuid: string): Promise<string>;
|
|
70
52
|
/**
|
|
71
53
|
* Get space guid from configuration or local CF fodler
|
|
72
54
|
* @static
|
package/dist/util/cfUtil.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { cfCreateService
|
|
1
|
+
import { cfCreateService } from "@sap/cf-tools/out/src/cf-local.js";
|
|
2
2
|
import { getSpaceGuidThrowIfUndefined } from "@sap/cf-tools/out/src/utils.js";
|
|
3
3
|
import { Cli } from "@sap/cf-tools/out/src/cli.js";
|
|
4
|
-
import { eFilters } from "@sap/cf-tools/out/src/types.js";
|
|
5
4
|
import { getLogger } from "@ui5/logger";
|
|
6
5
|
import AuthenticationError from "../model/authenticationError.js";
|
|
7
6
|
const log = getLogger("@ui5/task-adaptation::CFUtil");
|
|
@@ -25,12 +24,12 @@ export default class CFUtil {
|
|
|
25
24
|
}
|
|
26
25
|
// we can use any instance in the list to connect to HTML5 Repo
|
|
27
26
|
log.verbose(`Use '${serviceInstances[0].name}' HTML5 Repo Runtime service instance`);
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
27
|
+
const credentials = await this.getOrCreateCredentials(serviceInstances[0]);
|
|
28
|
+
if (!credentials) {
|
|
30
29
|
throw new Error(`Cannot get service keys for '${getServiceInstanceParams.names?.join(", ")}' service in current space: ${getServiceInstanceParams.spaceGuids?.join(", ")}`);
|
|
31
30
|
}
|
|
32
31
|
return {
|
|
33
|
-
credentials
|
|
32
|
+
credentials,
|
|
34
33
|
serviceInstance: serviceInstances[0]
|
|
35
34
|
};
|
|
36
35
|
}
|
|
@@ -52,27 +51,28 @@ export default class CFUtil {
|
|
|
52
51
|
throw new Error(`Cannot create a service instance '${params.serviceInstanceName}' in space '${params.spaceGuid}': ${error.message}`);
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
static async
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
static async getOrCreateCredentials(serviceInstance) {
|
|
55
|
+
if (serviceInstance.type === "user-provided") {
|
|
56
|
+
log.verbose(`Service instance '${serviceInstance.name}' is user-provided, fetching credentials directly`);
|
|
57
|
+
return this.fetchCredentials(`/v3/service_instances/${serviceInstance.guid}/credentials`);
|
|
58
|
+
}
|
|
59
|
+
let key = await this.getNewestServiceKey(serviceInstance.guid);
|
|
60
|
+
if (key == null) {
|
|
58
61
|
const serviceKeyName = serviceInstance.name + "_key";
|
|
59
62
|
log.info(`Creating service key '${serviceKeyName}' for service instance '${serviceInstance.name}'`);
|
|
60
63
|
await this.createServiceKey(serviceInstance.name, serviceKeyName);
|
|
64
|
+
key = await this.getNewestServiceKey(serviceInstance.guid);
|
|
65
|
+
if (key == null) {
|
|
66
|
+
throw new Error(`Service key was created for '${serviceInstance.name}' but could not be retrieved`);
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
return this.getServiceKeys(serviceInstance.guid);
|
|
69
|
+
log.verbose(`Using service key '${key.name}' for service instance '${serviceInstance.name}'`);
|
|
70
|
+
return this.fetchCredentials(`/v3/service_credential_bindings/${key.guid}/details`);
|
|
66
71
|
}
|
|
67
|
-
static
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
key: eFilters.service_instance_guids
|
|
72
|
-
}]
|
|
73
|
-
}).catch((error) => {
|
|
74
|
-
throw new Error("Failed to get service credentials: " + error.message);
|
|
75
|
-
});
|
|
72
|
+
static async fetchCredentials(url) {
|
|
73
|
+
const parsed = this.parseJson(await this.cfExecute(["curl", url]));
|
|
74
|
+
this.processCfErrors(parsed?.errors);
|
|
75
|
+
return parsed.credentials;
|
|
76
76
|
}
|
|
77
77
|
static async createServiceKey(serviceInstanceName, serviceKeyName) {
|
|
78
78
|
try {
|
|
@@ -82,12 +82,6 @@ export default class CFUtil {
|
|
|
82
82
|
throw new Error(`Couldn't create a service key for instance: ${serviceInstanceName}: ${error}`);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
static deleteServiceKeyUnsafe(serviceInstanceName, serviceKeyName) {
|
|
86
|
-
// Fire and forget - async delete without waiting for result or handling errors
|
|
87
|
-
this.cfExecute(["delete-service-key", serviceInstanceName, serviceKeyName, "-f"]).catch(() => {
|
|
88
|
-
// Ignore any errors - this is intentionally unsafe
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
85
|
static async getServiceInstance(params) {
|
|
92
86
|
const PARAM_MAP = {
|
|
93
87
|
spaceGuids: "space_guids",
|
|
@@ -101,7 +95,8 @@ export default class CFUtil {
|
|
|
101
95
|
const resources = await this.requestCfApi(uri);
|
|
102
96
|
return resources.map((service) => ({
|
|
103
97
|
name: service.name,
|
|
104
|
-
guid: service.guid
|
|
98
|
+
guid: service.guid,
|
|
99
|
+
type: service.type
|
|
105
100
|
}));
|
|
106
101
|
}
|
|
107
102
|
static processCfErrors(errors) {
|
|
@@ -174,18 +169,21 @@ export default class CFUtil {
|
|
|
174
169
|
}
|
|
175
170
|
}
|
|
176
171
|
/**
|
|
177
|
-
*
|
|
172
|
+
* Return the most recently created service credential binding (key) for the given service instance,
|
|
173
|
+
* or undefined if no keys exist.
|
|
178
174
|
* @private
|
|
179
175
|
* @static
|
|
180
176
|
* @param {string} serviceInstanceGuid the service instance guid
|
|
181
|
-
* @return {Promise<
|
|
177
|
+
* @return {Promise<any | undefined>} the newest binding object ({ name, guid, created_at, … }) or undefined
|
|
182
178
|
* @memberof CFUtil
|
|
183
179
|
*/
|
|
184
|
-
static async
|
|
180
|
+
static async getNewestServiceKey(serviceInstanceGuid) {
|
|
185
181
|
try {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
const keyList = await this.requestCfApi(`/v3/service_credential_bindings?type=key&service_instance_guids=${serviceInstanceGuid}`);
|
|
183
|
+
if (!keyList?.length) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
return keyList.toSorted((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())[0];
|
|
189
187
|
}
|
|
190
188
|
catch (error) {
|
|
191
189
|
throw new Error("Failed to get service credentials: " + error.message);
|
|
@@ -212,30 +210,11 @@ export default class CFUtil {
|
|
|
212
210
|
}
|
|
213
211
|
const serviceInstance = serviceInstances[0];
|
|
214
212
|
log.verbose(`Found service instance '${serviceInstance.name}' with guid: ${serviceInstance.guid}`);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// object with url and destination instead of a single url string
|
|
219
|
-
const validKey = await this.getServiceKeyWithValidEndpoints(serviceInstance.guid);
|
|
220
|
-
if (validKey) {
|
|
221
|
-
log.verbose(`Using existing service key with valid endpoints structure`);
|
|
222
|
-
return validKey.credentials;
|
|
223
|
-
}
|
|
224
|
-
const uniqueServiceKeyName = await uniqueServiceKeyNamePromise;
|
|
225
|
-
log.verbose(`No valid service key found with proper endpoints structure. Creating new service key '${uniqueServiceKeyName}' for '${serviceInstance.name}'`);
|
|
226
|
-
await this.createServiceKey(serviceInstance.name, uniqueServiceKeyName);
|
|
227
|
-
// Get the newly created service key and validate its endpoints
|
|
228
|
-
const newValidKey = await this.getServiceKeyWithValidEndpoints(serviceInstance.guid);
|
|
229
|
-
if (newValidKey) {
|
|
230
|
-
log.verbose(`Using newly created service key with valid endpoints structure`);
|
|
231
|
-
return newValidKey.credentials;
|
|
213
|
+
const credentials = await this.getOrCreateCredentials(serviceInstance);
|
|
214
|
+
if (!credentials?.endpoints || !this.hasValidEndpoints(credentials.endpoints)) {
|
|
215
|
+
log.info(`Service key for '${serviceInstance.name}' does not have endpoints with service urls for xs-app.json update`);
|
|
232
216
|
}
|
|
233
|
-
|
|
234
|
-
// endpoints. We don't throw an error here even if no valid endpoints
|
|
235
|
-
// found. We assume that there might be no coincidence between
|
|
236
|
-
// credential endpoints and xs-app.json destinations.
|
|
237
|
-
this.deleteServiceKeyUnsafe(serviceInstance.name, uniqueServiceKeyName);
|
|
238
|
-
log.verbose(`Created service key '${uniqueServiceKeyName}' does not have valid endpoints structure. Triggered deletion of invalid service key '${uniqueServiceKeyName}'`);
|
|
217
|
+
return credentials;
|
|
239
218
|
}
|
|
240
219
|
/**
|
|
241
220
|
* Check if endpoints object has at least one property that is an object
|
|
@@ -252,42 +231,6 @@ export default class CFUtil {
|
|
|
252
231
|
// Check if at least one property of endpoints is an object
|
|
253
232
|
return Object.values(endpoints).some(value => value && typeof value === 'object' && !Array.isArray(value));
|
|
254
233
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Get all service key names for a service instance
|
|
257
|
-
* @private
|
|
258
|
-
* @static
|
|
259
|
-
* @param {string} serviceInstanceGuid the service instance guid
|
|
260
|
-
* @return {Promise<string[]>} promise with array of service key names
|
|
261
|
-
* @memberof CFUtil
|
|
262
|
-
*/
|
|
263
|
-
static async getAllServiceKeyNames(serviceInstanceGuid) {
|
|
264
|
-
try {
|
|
265
|
-
const serviceKeys = await this.requestCfApi(`/v3/service_credential_bindings?type=key&service_instance_guids=${serviceInstanceGuid}`);
|
|
266
|
-
return serviceKeys.map((key) => key.name);
|
|
267
|
-
}
|
|
268
|
-
catch (error) {
|
|
269
|
-
throw new Error(`Failed to get service key names: ${error.message}`);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Generate a unique service key name in format serviceInstanceName-key-N
|
|
274
|
-
* @static
|
|
275
|
-
* @param {string} serviceInstanceName the service instance name
|
|
276
|
-
* @param {string} serviceInstanceGuid the service instance guid
|
|
277
|
-
* @return {Promise<string>} promise with unique service key name
|
|
278
|
-
* @memberof CFUtil
|
|
279
|
-
*/
|
|
280
|
-
static async generateUniqueServiceKeyName(serviceInstanceName, serviceInstanceGuid) {
|
|
281
|
-
const existingKeyNames = await this.getAllServiceKeyNames(serviceInstanceGuid);
|
|
282
|
-
let counter = 0;
|
|
283
|
-
let keyName;
|
|
284
|
-
do {
|
|
285
|
-
keyName = `${serviceInstanceName}-key-${counter}`;
|
|
286
|
-
counter++;
|
|
287
|
-
} while (existingKeyNames.includes(keyName));
|
|
288
|
-
log.verbose(`Generated unique service key name: ${keyName}`);
|
|
289
|
-
return keyName;
|
|
290
|
-
}
|
|
291
234
|
/**
|
|
292
235
|
* Get space guid from configuration or local CF fodler
|
|
293
236
|
* @static
|
|
@@ -126,9 +126,13 @@ export default class ResourceUtil {
|
|
|
126
126
|
}
|
|
127
127
|
static async toFileMap(resources, projectNamespace) {
|
|
128
128
|
const files = new Map();
|
|
129
|
-
const
|
|
129
|
+
const rootFolder = projectNamespace ? ResourceUtil.getRootFolder(projectNamespace) : undefined;
|
|
130
130
|
for (const resource of resources) {
|
|
131
|
-
|
|
131
|
+
const resourcePath = resource.getPath();
|
|
132
|
+
const filename = rootFolder && resourcePath.startsWith(rootFolder)
|
|
133
|
+
? resourcePath.substring(rootFolder.length + 1)
|
|
134
|
+
: resourcePath.substring(1);
|
|
135
|
+
files.set(filename, await resource.getBuffer());
|
|
132
136
|
}
|
|
133
137
|
return files;
|
|
134
138
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/task-adaptation",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
6
12
|
"scripts": {
|
|
7
13
|
"test": "npm run lint && npm run build && npm run coverage",
|
|
8
14
|
"lint": "eslint ./src ./test/lib",
|