@sap-ux/cf-deploy-config-writer 0.3.14 → 0.3.16

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.
@@ -209,9 +209,7 @@ async function appendAppRouter(cfConfig, fs) {
209
209
  if ((cfConfig.addMtaDestination && cfConfig.isCap) || cfConfig.destinationName === constants_1.DefaultMTADestination) {
210
210
  // If the destination instance identifier is passed, create a destination instance
211
211
  cfConfig.destinationName =
212
- cfConfig.destinationName === constants_1.DefaultMTADestination
213
- ? mtaInstance.getFormattedPrefix(constants_1.ResourceMTADestination)
214
- : cfConfig.destinationName;
212
+ cfConfig.destinationName === constants_1.DefaultMTADestination ? constants_1.SRV_API : cfConfig.destinationName;
215
213
  await mtaInstance.addDestinationToAppRouter(cfConfig.destinationName);
216
214
  // This is required where a managed or standalone router hasn't been added yet to mta.yaml
217
215
  if (!mtaInstance.hasManagedXsuaaResource()) {
@@ -10,7 +10,6 @@ export declare const HTML5RepoHost = "html5-apps-repo:app-host";
10
10
  export declare const SRV_API = "srv-api";
11
11
  export declare const DefaultMTADestination = "fiori-default-srv-api";
12
12
  export declare const EmptyDestination = "NONE";
13
- export declare const ResourceMTADestination = "%s-srv-api";
14
13
  export declare const MTADescription = "Generated by Fiori Tools";
15
14
  export declare const RouterModule = "router";
16
15
  export declare const CloudFoundry = "cf";
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.undeployMTAScript = exports.rootDeployMTAScript = exports.appDeployMTAScript = exports.MTABuildScript = exports.UI5DeployBuildScript = exports.UI5DeployBuildScriptForCap = exports.HTMLAppBuildParams = exports.ServiceAPIRequires = exports.DestinationServiceConfig = exports.UI5StandaloneModuleDestination = exports.UI5ResourceDestination = exports.CAPAppfrontDestination = exports.UI5AppfrontDestinationParameter = exports.UI5Destination = exports.MTAAPIDestination = exports.CDSDestinationService = exports.CDSHTML5RepoService = exports.CDSXSUAAService = exports.CDSAddMtaParams = exports.UI5PackageVersion = exports.UI5Package = exports.UI5TaskZipperPackageVersion = exports.UI5TaskZipperPackage = exports.MbtPackageVersion = exports.MbtPackage = exports.Rimraf = exports.RimrafVersion = exports.MTAVersion = exports.MTAPackage = exports.MTAExecutable = exports.CDSPackage = exports.CDSDKPackage = exports.CDSExecutable = exports.enableParallelDeployments = exports.deployMode = exports.CloudFoundry = exports.RouterModule = exports.MTADescription = exports.ResourceMTADestination = exports.EmptyDestination = exports.DefaultMTADestination = exports.SRV_API = exports.HTML5RepoHost = exports.ManagedDestination = exports.ManagedAppFront = exports.ManagedXSUAA = exports.DefaultServiceURL = exports.MTABuildParams = exports.MTABuildResult = exports.WelcomeFile = void 0;
4
- exports.MTABinNotFound = exports.CDSBinNotFound = void 0;
3
+ exports.CDSBinNotFound = exports.undeployMTAScript = exports.rootDeployMTAScript = exports.appDeployMTAScript = exports.MTABuildScript = exports.UI5DeployBuildScript = exports.UI5DeployBuildScriptForCap = exports.HTMLAppBuildParams = exports.ServiceAPIRequires = exports.DestinationServiceConfig = exports.UI5StandaloneModuleDestination = exports.UI5ResourceDestination = exports.CAPAppfrontDestination = exports.UI5AppfrontDestinationParameter = exports.UI5Destination = exports.MTAAPIDestination = exports.CDSDestinationService = exports.CDSHTML5RepoService = exports.CDSXSUAAService = exports.CDSAddMtaParams = exports.UI5PackageVersion = exports.UI5Package = exports.UI5TaskZipperPackageVersion = exports.UI5TaskZipperPackage = exports.MbtPackageVersion = exports.MbtPackage = exports.Rimraf = exports.RimrafVersion = exports.MTAVersion = exports.MTAPackage = exports.MTAExecutable = exports.CDSPackage = exports.CDSDKPackage = exports.CDSExecutable = exports.enableParallelDeployments = exports.deployMode = exports.CloudFoundry = exports.RouterModule = exports.MTADescription = exports.EmptyDestination = exports.DefaultMTADestination = exports.SRV_API = exports.HTML5RepoHost = exports.ManagedDestination = exports.ManagedAppFront = exports.ManagedXSUAA = exports.DefaultServiceURL = exports.MTABuildParams = exports.MTABuildResult = exports.WelcomeFile = void 0;
4
+ exports.MTABinNotFound = void 0;
5
5
  const i18n_1 = require("./i18n");
6
6
  exports.WelcomeFile = 'welcomeFile';
7
7
  exports.MTABuildResult = 'build-result';
@@ -14,7 +14,6 @@ exports.HTML5RepoHost = 'html5-apps-repo:app-host';
14
14
  exports.SRV_API = 'srv-api';
15
15
  exports.DefaultMTADestination = 'fiori-default-srv-api';
16
16
  exports.EmptyDestination = 'NONE';
17
- exports.ResourceMTADestination = '%s-srv-api';
18
17
  exports.MTADescription = 'Generated by Fiori Tools';
19
18
  exports.RouterModule = 'router';
20
19
  exports.CloudFoundry = 'cf';
@@ -39,7 +38,7 @@ exports.CDSXSUAAService = 'xsuaa';
39
38
  exports.CDSHTML5RepoService = 'html5-repo';
40
39
  exports.CDSDestinationService = 'destination';
41
40
  exports.MTAAPIDestination = {
42
- Name: exports.ResourceMTADestination,
41
+ Name: exports.SRV_API,
43
42
  Type: 'HTTP',
44
43
  URL: `~{srv-api/srv-url}`,
45
44
  ProxyType: 'Internet',
@@ -59,7 +58,7 @@ exports.UI5AppfrontDestinationParameter = {
59
58
  url: "https://ui5.sap.com" /* UI5_DEFAULT.SAPUI5_CDN */
60
59
  };
61
60
  exports.CAPAppfrontDestination = {
62
- name: exports.ResourceMTADestination,
61
+ name: exports.SRV_API,
63
62
  url: '~{srv-api/srv-url}',
64
63
  forwardAuthToken: true
65
64
  };
@@ -827,9 +827,7 @@ class MtaConfig {
827
827
  const module = this.modules.get('com.sap.application.content:appfront');
828
828
  if (module) {
829
829
  // If the destination provided is `fiori-default-srv-api` then use the default destination name
830
- const destName = cfDestination === constants_1.DefaultMTADestination
831
- ? this.getFormattedPrefix(constants_1.ResourceMTADestination)
832
- : cfDestination;
830
+ const destName = cfDestination === constants_1.DefaultMTADestination ? constants_1.SRV_API : cfDestination;
833
831
  // Ensure the destination does not exist already!
834
832
  if (!module.parameters?.config?.destinations?.some((destination) => destination.Name === destName)) {
835
833
  const destination = {
@@ -850,6 +848,7 @@ class MtaConfig {
850
848
  async appendInstanceBasedDestination(cfDestination) {
851
849
  // Part 1. Update the destination service with the new instance based destination
852
850
  const destinationResource = this.resources.get('destination');
851
+ const capDestName = cfDestination === constants_1.DefaultMTADestination ? constants_1.SRV_API : cfDestination;
853
852
  if (destinationResource) {
854
853
  if (!destinationResource.requires?.some((ele) => ele.name === constants_1.SRV_API)) {
855
854
  destinationResource.requires = [
@@ -861,16 +860,17 @@ class MtaConfig {
861
860
  ]
862
861
  ];
863
862
  }
864
- // If the destination provided is `fiori-default-srv-api` then use the default destination name
865
- const capDestName = cfDestination === constants_1.DefaultMTADestination
866
- ? this.getFormattedPrefix(constants_1.ResourceMTADestination)
867
- : cfDestination;
868
- // Ensure the destination does not exist already!
869
- if (!destinationResource.parameters?.config?.init_data?.instance?.destinations?.some((destination) => destination.Name === capDestName)) {
870
- destinationResource.parameters?.config?.init_data?.instance?.destinations?.push({
871
- ...constants_1.MTAAPIDestination,
872
- Name: capDestName
873
- });
863
+ // Part 2. Only append the default destination if it does not exist already
864
+ const isSrvApiExisting = cfDestination === constants_1.SRV_API &&
865
+ destinationResource.parameters?.config?.init_data?.instance?.destinations?.some((destination) => destination.Name === constants_1.SRV_API);
866
+ // Part 3. If the destination is not already existing, append it
867
+ if (!isSrvApiExisting) {
868
+ if (!destinationResource.parameters?.config?.init_data?.instance?.destinations?.some((destination) => destination.Name === capDestName)) {
869
+ destinationResource.parameters?.config?.init_data?.instance?.destinations?.push({
870
+ ...constants_1.MTAAPIDestination,
871
+ Name: capDestName
872
+ });
873
+ }
874
874
  }
875
875
  await this.mta.updateResource(destinationResource);
876
876
  this.resources.set('destination', destinationResource);
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.14",
4
+ "version": "0.3.16",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -34,7 +34,7 @@
34
34
  "@sap-ux/btp-utils": "1.1.0",
35
35
  "@sap-ux/logger": "0.7.0",
36
36
  "@sap-ux/ui5-config": "0.29.0",
37
- "@sap-ux/nodejs-utils": "0.2.1"
37
+ "@sap-ux/nodejs-utils": "0.2.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/ejs": "3.1.2",