@sap-ux/cf-deploy-config-writer 0.3.93 → 0.3.95

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/dist/utils.d.ts CHANGED
@@ -40,20 +40,29 @@ export declare function toPosixPath(dirPath: string): string;
40
40
  * Retrieves destination configuration from SAP BTP when running in Business Application Studio.
41
41
  *
42
42
  * @param destination The destination name to look up in BTP destination service
43
+ * @param cache Mutable object that holds the cached destinations list; pass a new `{}` per generator run
44
+ * @param cache.list
43
45
  * @returns Object containing destination URL format flag and authentication type
44
46
  * @returns {boolean} destinationIsFullUrl - True if destination uses full URL format
45
47
  * @returns {Authentication | undefined} destinationAuthentication - Authentication type configured for the destination
46
48
  */
47
- export declare function getDestinationProperties(destination: string | undefined): Promise<{
49
+ export declare function getDestinationProperties(destination: string | undefined, cache?: {
50
+ list?: Destinations;
51
+ }): Promise<{
48
52
  destinationIsFullUrl: boolean;
49
53
  destinationAuthentication: Authentication | undefined;
50
54
  }>;
51
55
  /**
52
56
  * Retrieve the list of destinations from SAP BTP.
57
+ * Caching is scoped to the provided cache object; pass a new `{}` per generator run.
53
58
  *
59
+ * @param cache Mutable object that holds the cached list across multiple calls within one run
60
+ * @param cache.list
54
61
  * @returns Destinations list
55
62
  */
56
- export declare function getBTPDestinations(): Promise<Destinations>;
63
+ export declare function getBTPDestinations(cache?: {
64
+ list?: Destinations;
65
+ }): Promise<Destinations>;
57
66
  /**
58
67
  * Validates the MTA version passed in the config.
59
68
  *
package/dist/utils.js CHANGED
@@ -24,7 +24,6 @@ const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
24
24
  const btp_utils_1 = require("@sap-ux/btp-utils");
25
25
  const project_access_1 = require("@sap-ux/project-access");
26
26
  const constants_1 = require("./constants");
27
- let cachedDestinationsList = {};
28
27
  /**
29
28
  * Read manifest file for processing.
30
29
  *
@@ -75,15 +74,17 @@ function toPosixPath(dirPath) {
75
74
  * Retrieves destination configuration from SAP BTP when running in Business Application Studio.
76
75
  *
77
76
  * @param destination The destination name to look up in BTP destination service
77
+ * @param cache Mutable object that holds the cached destinations list; pass a new `{}` per generator run
78
+ * @param cache.list
78
79
  * @returns Object containing destination URL format flag and authentication type
79
80
  * @returns {boolean} destinationIsFullUrl - True if destination uses full URL format
80
81
  * @returns {Authentication | undefined} destinationAuthentication - Authentication type configured for the destination
81
82
  */
82
- async function getDestinationProperties(destination) {
83
+ async function getDestinationProperties(destination, cache = {}) {
83
84
  let destinationIsFullUrl = false;
84
85
  let destinationAuthentication;
85
86
  if ((0, btp_utils_1.isAppStudio)() && destination) {
86
- const destinations = await getBTPDestinations();
87
+ const destinations = await getBTPDestinations(cache);
87
88
  if (destinations[destination]) {
88
89
  destinationIsFullUrl = (0, btp_utils_1.isFullUrlDestination)(destinations[destination]);
89
90
  destinationAuthentication = destinations[destination].Authentication;
@@ -93,14 +94,15 @@ async function getDestinationProperties(destination) {
93
94
  }
94
95
  /**
95
96
  * Retrieve the list of destinations from SAP BTP.
97
+ * Caching is scoped to the provided cache object; pass a new `{}` per generator run.
96
98
  *
99
+ * @param cache Mutable object that holds the cached list across multiple calls within one run
100
+ * @param cache.list
97
101
  * @returns Destinations list
98
102
  */
99
- async function getBTPDestinations() {
100
- if (Object.keys(cachedDestinationsList).length === 0) {
101
- cachedDestinationsList = await (0, btp_utils_1.listDestinations)({ stripS4HCApiHosts: true });
102
- }
103
- return cachedDestinationsList;
103
+ async function getBTPDestinations(cache = {}) {
104
+ cache.list ??= await (0, btp_utils_1.listDestinations)({ stripS4HCApiHosts: true });
105
+ return cache.list;
104
106
  }
105
107
  /**
106
108
  * Validates the MTA version passed in the config.
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.93",
4
+ "version": "0.3.95",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -29,12 +29,12 @@
29
29
  "mem-fs": "2.1.0",
30
30
  "mem-fs-editor": "9.4.0",
31
31
  "hasbin": "1.2.3",
32
- "@sap-ux/yaml": "0.17.6",
32
+ "@sap-ux/project-access": "1.35.19",
33
+ "@sap-ux/yaml": "0.17.7",
33
34
  "@sap-ux/btp-utils": "1.1.12",
34
- "@sap-ux/logger": "0.8.4",
35
- "@sap-ux/ui5-config": "0.30.1",
36
- "@sap-ux/nodejs-utils": "0.2.19",
37
- "@sap-ux/project-access": "1.35.18"
35
+ "@sap-ux/logger": "0.8.5",
36
+ "@sap-ux/ui5-config": "0.30.2",
37
+ "@sap-ux/nodejs-utils": "0.2.19"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/ejs": "3.1.5",