@sap-ux/cf-deploy-config-writer 0.3.62 → 0.3.64

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.
@@ -57,6 +57,14 @@ export declare class MtaConfig {
57
57
  * @param {string} resourceName - resource name
58
58
  */
59
59
  private updateServiceName;
60
+ /**
61
+ * Gets the effective service instance name for a resource.
62
+ * If service-name exists, returns it. Otherwise, returns the resource name.
63
+ *
64
+ * @param {string} resourceName - The resource identifier (e.g., HTML5RepoHost, ManagedXSUAA)
65
+ * @returns {string | undefined} The service instance name to use in destinations
66
+ */
67
+ private getServiceInstanceName;
60
68
  private addAppFrontResource;
61
69
  private addHtml5Host;
62
70
  /**
@@ -198,6 +198,24 @@ class MtaConfig {
198
198
  this.dirty = true;
199
199
  }
200
200
  }
201
+ /**
202
+ * Gets the effective service instance name for a resource.
203
+ * If service-name exists, returns it. Otherwise, returns the resource name.
204
+ *
205
+ * @param {string} resourceName - The resource identifier (e.g., HTML5RepoHost, ManagedXSUAA)
206
+ * @returns {string | undefined} The service instance name to use in destinations
207
+ */
208
+ getServiceInstanceName(resourceName) {
209
+ const resource = this.resources.get(resourceName);
210
+ // Prefer explicit service-name if it exists
211
+ const explicitServiceName = resource?.parameters?.['service-name'];
212
+ if (explicitServiceName) {
213
+ return explicitServiceName;
214
+ }
215
+ // Fallback: Use the resource name (CF will auto-generate using MTA ID + resource name)
216
+ // This matches what Cloud Foundry actually creates when service-name is missing
217
+ return resource?.name;
218
+ }
201
219
  async addAppFrontResource() {
202
220
  const resource = {
203
221
  name: `${this.prefix?.slice(0, 94)}-app-front`,
@@ -949,18 +967,19 @@ class MtaConfig {
949
967
  if (!this.resources.has(constants_1.HTML5RepoHost)) {
950
968
  await this.addHtml5Host();
951
969
  }
952
- // Assume these need to be updated for safety!
953
- await this.updateServiceName('html5', constants_1.HTML5RepoHost);
954
- await this.updateServiceName('xsuaa', constants_1.ManagedXSUAA);
955
970
  // We only want to append a new one, if missing from the existing mta config
956
971
  if (!this.modules.has('com.sap.application.content:destination')) {
957
972
  this.log?.debug((0, i18n_1.t)('debug.addingRouter', { routerType: types_1.RouterModuleType.Managed }));
958
973
  const destinationName = this.resources.get('destination')?.name;
959
974
  const appHostName = this.resources.get(constants_1.HTML5RepoHost)?.name;
960
- const appHostServiceName = this.resources.get(constants_1.HTML5RepoHost)?.parameters?.['service-name'];
961
975
  const managedXSUAAName = this.resources.get(constants_1.ManagedXSUAA)?.name;
962
- const managedXSUAAServiceName = this.resources.get(constants_1.ManagedXSUAA)?.parameters?.['service-name'];
963
- if (destinationName && appHostName && managedXSUAAName && managedXSUAAServiceName) {
976
+ if (destinationName && appHostName && managedXSUAAName) {
977
+ // Align the service-name, not always present
978
+ await this.updateServiceName('html5', constants_1.HTML5RepoHost);
979
+ await this.updateServiceName('xsuaa', constants_1.ManagedXSUAA);
980
+ // Retrieve the service-name
981
+ const appHostServiceName = this.getServiceInstanceName(constants_1.HTML5RepoHost);
982
+ const managedXSUAAServiceName = this.getServiceInstanceName(constants_1.ManagedXSUAA);
964
983
  const router = {
965
984
  name: `${this.prefix?.slice(0, 100)}-destination-content`,
966
985
  type: 'com.sap.application.content',
package/dist/utils.js CHANGED
@@ -268,7 +268,7 @@ async function runCommand(cwd, cmd, args, errorMsg) {
268
268
  await commandRunner.run(cmd, args, { cwd });
269
269
  }
270
270
  catch (e) {
271
- throw new Error(`${errorMsg} ${e.message}`);
271
+ throw new Error(`${errorMsg} ${e.message ?? e}`);
272
272
  }
273
273
  }
274
274
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/cf-deploy-config-writer",
3
3
  "description": "Add or amend Cloud Foundry and ABAP deployment configuration for SAP projects",
4
- "version": "0.3.62",
4
+ "version": "0.3.64",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -29,7 +29,7 @@
29
29
  "mem-fs": "2.1.0",
30
30
  "mem-fs-editor": "9.4.0",
31
31
  "hasbin": "1.2.3",
32
- "@sap-ux/project-access": "1.35.1",
32
+ "@sap-ux/project-access": "1.35.2",
33
33
  "@sap-ux/yaml": "0.17.4",
34
34
  "@sap-ux/btp-utils": "1.1.8",
35
35
  "@sap-ux/logger": "0.8.1",