@sap-ux/adp-tooling 0.19.11 → 1.0.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.
Files changed (147) hide show
  1. package/dist/abap/client.d.ts +1 -1
  2. package/dist/abap/client.js +8 -13
  3. package/dist/abap/config.js +5 -8
  4. package/dist/abap/index.d.ts +3 -3
  5. package/dist/abap/index.js +3 -19
  6. package/dist/abap/provider.js +5 -8
  7. package/dist/base/abap/manifest-service.d.ts +1 -1
  8. package/dist/base/abap/manifest-service.js +9 -18
  9. package/dist/base/cf.js +8 -11
  10. package/dist/base/change-utils.d.ts +1 -1
  11. package/dist/base/change-utils.js +49 -62
  12. package/dist/base/constants/index.js +12 -15
  13. package/dist/base/credentials.d.ts +2 -2
  14. package/dist/base/credentials.js +6 -9
  15. package/dist/base/helper.d.ts +1 -1
  16. package/dist/base/helper.js +40 -57
  17. package/dist/base/project-builder.js +3 -6
  18. package/dist/base/prompt.d.ts +1 -1
  19. package/dist/base/prompt.js +19 -25
  20. package/dist/btp/api.d.ts +1 -1
  21. package/dist/btp/api.js +10 -18
  22. package/dist/btp/index.d.ts +1 -1
  23. package/dist/btp/index.js +1 -17
  24. package/dist/cf/app/discovery.d.ts +1 -1
  25. package/dist/cf/app/discovery.js +11 -18
  26. package/dist/cf/app/html5-repo.d.ts +1 -1
  27. package/dist/cf/app/html5-repo.js +24 -32
  28. package/dist/cf/app/index.d.ts +2 -2
  29. package/dist/cf/app/index.js +2 -18
  30. package/dist/cf/core/auth.d.ts +1 -1
  31. package/dist/cf/core/auth.js +4 -8
  32. package/dist/cf/core/config.d.ts +1 -1
  33. package/dist/cf/core/config.js +9 -15
  34. package/dist/cf/core/index.d.ts +2 -2
  35. package/dist/cf/core/index.js +2 -18
  36. package/dist/cf/deploy.d.ts +1 -1
  37. package/dist/cf/deploy.js +33 -44
  38. package/dist/cf/index.d.ts +6 -6
  39. package/dist/cf/index.js +6 -22
  40. package/dist/cf/project/index.d.ts +3 -3
  41. package/dist/cf/project/index.js +3 -19
  42. package/dist/cf/project/mta.d.ts +1 -1
  43. package/dist/cf/project/mta.js +23 -66
  44. package/dist/cf/project/yaml-loader.d.ts +1 -1
  45. package/dist/cf/project/yaml-loader.js +8 -16
  46. package/dist/cf/project/yaml.d.ts +2 -2
  47. package/dist/cf/project/yaml.js +28 -72
  48. package/dist/cf/services/api.d.ts +1 -1
  49. package/dist/cf/services/api.js +46 -93
  50. package/dist/cf/services/cli.d.ts +1 -1
  51. package/dist/cf/services/cli.js +31 -42
  52. package/dist/cf/services/destinations.js +12 -48
  53. package/dist/cf/services/index.d.ts +5 -5
  54. package/dist/cf/services/index.js +5 -21
  55. package/dist/cf/services/manifest.d.ts +1 -1
  56. package/dist/cf/services/manifest.js +9 -13
  57. package/dist/cf/services/ssh.js +14 -22
  58. package/dist/cf/utils/index.d.ts +1 -1
  59. package/dist/cf/utils/index.js +1 -17
  60. package/dist/cf/utils/validation.d.ts +1 -1
  61. package/dist/cf/utils/validation.js +12 -18
  62. package/dist/common/flp-parameters.d.ts +1 -1
  63. package/dist/common/flp-parameters.js +1 -4
  64. package/dist/common/index.d.ts +1 -1
  65. package/dist/common/index.js +1 -17
  66. package/dist/i18n.js +8 -16
  67. package/dist/index.d.ts +23 -23
  68. package/dist/index.js +23 -46
  69. package/dist/preview/adp-preview.d.ts +1 -1
  70. package/dist/preview/adp-preview.js +41 -39
  71. package/dist/preview/change-handler.d.ts +1 -1
  72. package/dist/preview/change-handler.js +51 -59
  73. package/dist/preview/descriptor-change-handler.d.ts +1 -1
  74. package/dist/preview/descriptor-change-handler.js +18 -21
  75. package/dist/preview/ovp-routes-handler.js +11 -13
  76. package/dist/preview/routes-handler.js +36 -71
  77. package/dist/preview/utils.d.ts +1 -1
  78. package/dist/preview/utils.js +5 -8
  79. package/dist/prompts/add-annotations-to-odata/index.d.ts +1 -1
  80. package/dist/prompts/add-annotations-to-odata/index.js +24 -26
  81. package/dist/prompts/add-component-usages/index.d.ts +1 -1
  82. package/dist/prompts/add-component-usages/index.js +41 -43
  83. package/dist/prompts/add-new-model/index.d.ts +1 -1
  84. package/dist/prompts/add-new-model/index.js +75 -80
  85. package/dist/prompts/change-data-source/index.d.ts +1 -1
  86. package/dist/prompts/change-data-source/index.js +19 -22
  87. package/dist/prompts/change-inbound/index.d.ts +1 -1
  88. package/dist/prompts/change-inbound/index.js +11 -14
  89. package/dist/prompts/index.d.ts +5 -5
  90. package/dist/prompts/index.js +5 -15
  91. package/dist/source/applications.d.ts +2 -2
  92. package/dist/source/applications.js +7 -11
  93. package/dist/source/index.d.ts +3 -3
  94. package/dist/source/index.js +3 -19
  95. package/dist/source/manifest.d.ts +1 -1
  96. package/dist/source/manifest.js +15 -25
  97. package/dist/source/systems.d.ts +1 -1
  98. package/dist/source/systems.js +20 -27
  99. package/dist/types.d.ts +1 -1
  100. package/dist/types.js +64 -17
  101. package/dist/ui5/fetch.d.ts +1 -1
  102. package/dist/ui5/fetch.js +8 -12
  103. package/dist/ui5/format.d.ts +1 -1
  104. package/dist/ui5/format.js +17 -29
  105. package/dist/ui5/index.d.ts +4 -4
  106. package/dist/ui5/index.js +4 -20
  107. package/dist/ui5/network.d.ts +1 -1
  108. package/dist/ui5/network.js +1 -4
  109. package/dist/ui5/validator.js +14 -20
  110. package/dist/ui5/version-info.d.ts +1 -1
  111. package/dist/ui5/version-info.js +25 -36
  112. package/dist/writer/cf.d.ts +1 -1
  113. package/dist/writer/cf.js +35 -43
  114. package/dist/writer/changes/writer-factory.d.ts +2 -2
  115. package/dist/writer/changes/writer-factory.js +10 -13
  116. package/dist/writer/changes/writers/annotations-writer.d.ts +1 -1
  117. package/dist/writer/changes/writers/annotations-writer.js +11 -46
  118. package/dist/writer/changes/writers/component-usages-writer.d.ts +1 -1
  119. package/dist/writer/changes/writers/component-usages-writer.js +9 -12
  120. package/dist/writer/changes/writers/data-source-writer.d.ts +1 -1
  121. package/dist/writer/changes/writers/data-source-writer.js +7 -10
  122. package/dist/writer/changes/writers/inbound-writer.d.ts +1 -1
  123. package/dist/writer/changes/writers/inbound-writer.js +10 -13
  124. package/dist/writer/changes/writers/index.d.ts +5 -5
  125. package/dist/writer/changes/writers/index.js +5 -21
  126. package/dist/writer/changes/writers/new-model-writer.d.ts +1 -1
  127. package/dist/writer/changes/writers/new-model-writer.js +16 -20
  128. package/dist/writer/editors.d.ts +1 -1
  129. package/dist/writer/editors.js +6 -9
  130. package/dist/writer/i18n/index.d.ts +1 -1
  131. package/dist/writer/i18n/index.js +13 -17
  132. package/dist/writer/i18n/key-user-translations.js +9 -14
  133. package/dist/writer/inbound-navigation.d.ts +1 -1
  134. package/dist/writer/inbound-navigation.js +18 -27
  135. package/dist/writer/index.d.ts +1 -1
  136. package/dist/writer/index.js +36 -37
  137. package/dist/writer/manifest/descriptor-content.d.ts +2 -2
  138. package/dist/writer/manifest/descriptor-content.js +9 -15
  139. package/dist/writer/manifest/index.d.ts +1 -1
  140. package/dist/writer/manifest/index.js +1 -17
  141. package/dist/writer/options.d.ts +1 -1
  142. package/dist/writer/options.js +16 -27
  143. package/dist/writer/project-utils.d.ts +1 -1
  144. package/dist/writer/project-utils.js +49 -57
  145. package/dist/writer/writer-config.d.ts +2 -2
  146. package/dist/writer/writer-config.js +25 -30
  147. package/package.json +19 -17
@@ -1,61 +1,14 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getBusinessServiceInfo = getBusinessServiceInfo;
40
- exports.getFDCRequestArguments = getFDCRequestArguments;
41
- exports.getFDCApps = getFDCApps;
42
- exports.getCfUi5AppInfo = getCfUi5AppInfo;
43
- exports.getCfBaseAppInbounds = getCfBaseAppInbounds;
44
- exports.createServiceInstance = createServiceInstance;
45
- exports.getServiceNameByTags = getServiceNameByTags;
46
- exports.createServices = createServices;
47
- exports.getOrCreateServiceInstanceKeys = getOrCreateServiceInstanceKeys;
48
- exports.getOrCreateServiceKeys = getOrCreateServiceKeys;
49
- exports.getServiceTags = getServiceTags;
50
- exports.getServiceKeyCredentialsWithTags = getServiceKeyCredentialsWithTags;
51
- const fs = __importStar(require("node:fs"));
52
- const axios_1 = __importDefault(require("axios"));
53
- const path = __importStar(require("node:path"));
54
- const cf_tools_1 = require("@sap/cf-tools");
55
- const btp_utils_1 = require("@sap-ux/btp-utils");
56
- const i18n_1 = require("../../i18n");
57
- const project_1 = require("../project");
58
- const cli_1 = require("./cli");
1
+ import * as fs from 'node:fs';
2
+ import axios from 'axios';
3
+ import * as path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { Cli } from '@sap/cf-tools';
6
+ import { dirname } from 'node:path';
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ import { isAppStudio } from '@sap-ux/btp-utils';
9
+ import { t } from '../../i18n.js';
10
+ import { getProjectNameForXsSecurity } from '../project/index.js';
11
+ import { createServiceKey, getServiceKeys, requestCfApi } from './cli.js';
59
12
  const PARAM_MAP = new Map([
60
13
  ['spaceGuids', 'space_guids'],
61
14
  ['planNames', 'service_plan_names'],
@@ -69,7 +22,7 @@ const PARAM_MAP = new Map([
69
22
  * @param {ToolsLogger} logger - The logger.
70
23
  * @returns {Promise<ServiceInfo | null>} The service info.
71
24
  */
72
- async function getBusinessServiceInfo(businessService, config, logger) {
25
+ export async function getBusinessServiceInfo(businessService, config, logger) {
73
26
  const serviceKeys = await getOrCreateServiceInstanceKeys({
74
27
  spaceGuids: [config.space.GUID],
75
28
  names: [businessService]
@@ -83,7 +36,7 @@ async function getBusinessServiceInfo(businessService, config, logger) {
83
36
  * @param {CfConfig} cfConfig - The CF config.
84
37
  * @returns {RequestArguments} The request arguments.
85
38
  */
86
- function getFDCRequestArguments(cfConfig) {
39
+ export function getFDCRequestArguments(cfConfig) {
87
40
  const fdcUrl = 'https://ui5-flexibility-design-and-configuration.';
88
41
  const cfApiEndpoint = `https://api.cf.${cfConfig.url}`;
89
42
  const endpointParts = /https:\/\/api\.cf(?:\.([^-.]*)(-\d+)?(\.hana\.ondemand\.com)|(.*))/.exec(cfApiEndpoint);
@@ -94,7 +47,7 @@ function getFDCRequestArguments(cfConfig) {
94
47
  }
95
48
  };
96
49
  let url;
97
- const isBAS = (0, btp_utils_1.isAppStudio)();
50
+ const isBAS = isAppStudio();
98
51
  if (endpointParts?.[3]) {
99
52
  // Public cloud
100
53
  const region = endpointParts[1];
@@ -131,24 +84,24 @@ function getFDCRequestArguments(cfConfig) {
131
84
  * @param {ToolsLogger} logger - The logger.
132
85
  * @returns {Promise<CFApp[]>} The FDC apps.
133
86
  */
134
- async function getFDCApps(appHostIds, cfConfig, logger) {
87
+ export async function getFDCApps(appHostIds, cfConfig, logger) {
135
88
  const requestArguments = getFDCRequestArguments(cfConfig);
136
89
  logger?.log(`App Hosts: ${JSON.stringify(appHostIds)}, request arguments: ${JSON.stringify(requestArguments)}`);
137
90
  const appHostIdParams = appHostIds.map((id) => `appHostId=${encodeURIComponent(id)}`).join('&');
138
91
  const url = `${requestArguments.url}/api/business-service/discovery?${appHostIdParams}`;
139
92
  try {
140
- const response = await axios_1.default.get(url, requestArguments.options);
93
+ const response = await axios.get(url, requestArguments.options);
141
94
  if (response.status === 200) {
142
95
  logger?.log(`Retrieved FDC apps with request url: ${JSON.stringify(response.data)}`);
143
96
  return response.data.results;
144
97
  }
145
98
  else {
146
- throw new Error((0, i18n_1.t)('error.failedToConnectToFDCService', { status: response.status }));
99
+ throw new Error(t('error.failedToConnectToFDCService', { status: response.status }));
147
100
  }
148
101
  }
149
102
  catch (error) {
150
103
  logger?.error(`Getting FDC apps failed. Request url: ${url}. ${error}`);
151
- throw new Error((0, i18n_1.t)('error.failedToGetFDCApps', { error: error.message }));
104
+ throw new Error(t('error.failedToGetFDCApps', { error: error.message }));
152
105
  }
153
106
  }
154
107
  /**
@@ -160,19 +113,19 @@ async function getFDCApps(appHostIds, cfConfig, logger) {
160
113
  * @param {ToolsLogger} logger - The logger.
161
114
  * @returns {Promise<CfUi5AppInfo>} The ui5AppInfo.json content.
162
115
  */
163
- async function getCfUi5AppInfo(appId, appHostIds, cfConfig, logger) {
116
+ export async function getCfUi5AppInfo(appId, appHostIds, cfConfig, logger) {
164
117
  const requestArguments = getFDCRequestArguments(cfConfig);
165
118
  const appHostIdParams = appHostIds.map((id) => `appHostId=${encodeURIComponent(id)}`).join('&');
166
119
  const url = `${requestArguments.url}/api/business-service/ui5appinfo?appId=${encodeURIComponent(appId)}&${appHostIdParams}`;
167
120
  logger?.log(`Fetching ui5AppInfo.json`);
168
121
  try {
169
- const response = await axios_1.default.get(url, requestArguments.options);
122
+ const response = await axios.get(url, requestArguments.options);
170
123
  if (response.status === 200) {
171
124
  logger?.log('Successfully retrieved ui5AppInfo.json from FDC');
172
125
  return response.data;
173
126
  }
174
127
  else {
175
- throw new Error((0, i18n_1.t)('error.failedToConnectToFDCService', { status: response.status }));
128
+ throw new Error(t('error.failedToConnectToFDCService', { status: response.status }));
176
129
  }
177
130
  }
178
131
  catch (error) {
@@ -190,15 +143,15 @@ async function getCfUi5AppInfo(appId, appHostIds, cfConfig, logger) {
190
143
  * @param {string} lang - The language parameter (defaults to 'en').
191
144
  * @returns {Promise<ManifestNamespace.Inbound | undefined>} The inbounds or undefined if empty.
192
145
  */
193
- async function getCfBaseAppInbounds(appId, appHostId, cfConfig, logger, lang = 'en') {
146
+ export async function getCfBaseAppInbounds(appId, appHostId, cfConfig, logger, lang = 'en') {
194
147
  const requestArguments = getFDCRequestArguments(cfConfig);
195
148
  const params = new URLSearchParams({ appId, appHostId, 'sap-language': lang });
196
149
  const url = `${requestArguments.url}/api/business-service/inbounds?${params}`;
197
150
  logger?.log(`Fetching inbounds from FDC: ${url}`);
198
151
  try {
199
- const response = await axios_1.default.get(url, requestArguments.options);
152
+ const response = await axios.get(url, requestArguments.options);
200
153
  if (response.status !== 200) {
201
- throw new Error((0, i18n_1.t)('error.failedToConnectToFDCService', { status: response.status }));
154
+ throw new Error(t('error.failedToConnectToFDCService', { status: response.status }));
202
155
  }
203
156
  logger?.log('Successfully retrieved inbounds from FDC');
204
157
  const inbounds = response.data.inbounds;
@@ -206,7 +159,7 @@ async function getCfBaseAppInbounds(appId, appHostId, cfConfig, logger, lang = '
206
159
  }
207
160
  catch (e) {
208
161
  logger?.debug(e);
209
- throw new Error((0, i18n_1.t)('error.failedToGetFDCInbounds', { error: e.message }));
162
+ throw new Error(t('error.failedToGetFDCInbounds', { error: e.message }));
210
163
  }
211
164
  }
212
165
  /**
@@ -218,7 +171,7 @@ async function getCfBaseAppInbounds(appId, appHostId, cfConfig, logger, lang = '
218
171
  * @param {CreateServiceOptions} [options] - Additional options.
219
172
  * @returns {Promise<void>} The promise.
220
173
  */
221
- async function createServiceInstance(plan, serviceInstanceName, serviceName, options) {
174
+ export async function createServiceInstance(plan, serviceInstanceName, serviceName, options) {
222
175
  const { xsSecurityProjectName, templatePathOverwrite, logger } = options ?? {};
223
176
  try {
224
177
  logger?.log(`Creating service instance '${serviceInstanceName}' of service '${serviceName}' with '${plan}' plan`);
@@ -235,11 +188,11 @@ async function createServiceInstance(plan, serviceInstanceName, serviceName, opt
235
188
  }
236
189
  catch (err) {
237
190
  logger?.error(`Failed to parse xs-security.json file: ${err}`);
238
- throw new Error((0, i18n_1.t)('error.xsSecurityJsonCouldNotBeParsed'));
191
+ throw new Error(t('error.xsSecurityJsonCouldNotBeParsed'));
239
192
  }
240
193
  commandParameters.push('-c', JSON.stringify(xsSecurity));
241
194
  }
242
- const result = await cf_tools_1.Cli.execute(commandParameters);
195
+ const result = await Cli.execute(commandParameters);
243
196
  if (result && result.exitCode !== 0) {
244
197
  logger?.error(`Service creation failed: ${result.stderr || 'Unknown error'}`);
245
198
  throw new Error(`Service creation failed with code ${result.exitCode}: ${result.stderr || ''}`);
@@ -248,7 +201,7 @@ async function createServiceInstance(plan, serviceInstanceName, serviceName, opt
248
201
  }
249
202
  catch (e) {
250
203
  logger?.error(e);
251
- throw new Error((0, i18n_1.t)('error.failedToCreateServiceInstance', { serviceInstanceName, error: e.message }));
204
+ throw new Error(t('error.failedToCreateServiceInstance', { serviceInstanceName, error: e.message }));
252
205
  }
253
206
  }
254
207
  /**
@@ -258,8 +211,8 @@ async function createServiceInstance(plan, serviceInstanceName, serviceName, opt
258
211
  * @param {string[]} tags - The service tags for discovery.
259
212
  * @returns {Promise<string>} The service name.
260
213
  */
261
- async function getServiceNameByTags(spaceGuid, tags) {
262
- const json = await (0, cli_1.requestCfApi)(`/v3/service_offerings?per_page=1000&space_guids=${spaceGuid}`);
214
+ export async function getServiceNameByTags(spaceGuid, tags) {
215
+ const json = await requestCfApi(`/v3/service_offerings?per_page=1000&space_guids=${spaceGuid}`);
263
216
  const serviceOffering = json?.resources?.find((resource) => resource.tags && tags.every((tag) => resource.tags?.includes(tag)));
264
217
  return serviceOffering?.name ?? '';
265
218
  }
@@ -274,9 +227,9 @@ async function getServiceNameByTags(spaceGuid, tags) {
274
227
  * @param {ToolsLogger} logger - The logger.
275
228
  * @returns {Promise<void>} The promise.
276
229
  */
277
- async function createServices(yamlContent, initialServices, timestamp, spaceGuid, templatePathOverwrite, logger) {
230
+ export async function createServices(yamlContent, initialServices, timestamp, spaceGuid, templatePathOverwrite, logger) {
278
231
  const excludeServices = new Set([...initialServices, 'portal', 'html5-apps-repo']);
279
- const xsSecurityProjectName = (0, project_1.getProjectNameForXsSecurity)(yamlContent, timestamp);
232
+ const xsSecurityProjectName = getProjectNameForXsSecurity(yamlContent, timestamp);
280
233
  for (const resource of yamlContent.resources ?? []) {
281
234
  if (!excludeServices.has(resource?.parameters?.service ?? '')) {
282
235
  if (resource?.parameters?.service === 'xsuaa') {
@@ -306,7 +259,7 @@ async function createServices(yamlContent, initialServices, timestamp, spaceGuid
306
259
  * @param {ToolsLogger} logger - The logger.
307
260
  * @returns {Promise<ServiceInfo | null>} The service instance keys.
308
261
  */
309
- async function getOrCreateServiceInstanceKeys(serviceInstanceQuery, logger) {
262
+ export async function getOrCreateServiceInstanceKeys(serviceInstanceQuery, logger) {
310
263
  try {
311
264
  const serviceInstances = await getServiceInstance(serviceInstanceQuery);
312
265
  if (serviceInstances?.length > 0) {
@@ -320,7 +273,7 @@ async function getOrCreateServiceInstanceKeys(serviceInstanceQuery, logger) {
320
273
  return null;
321
274
  }
322
275
  catch (e) {
323
- const errorMessage = (0, i18n_1.t)('error.failedToGetServiceInstanceKeys', { error: e.message });
276
+ const errorMessage = t('error.failedToGetServiceInstanceKeys', { error: e.message });
324
277
  logger?.error(errorMessage);
325
278
  throw new Error(errorMessage);
326
279
  }
@@ -338,9 +291,9 @@ async function getServiceInstance(params) {
338
291
  const uriParameters = parameters.length > 0 ? `?${parameters.join('&')}` : '';
339
292
  const uri = `/v3/service_instances` + uriParameters;
340
293
  try {
341
- const json = await (0, cli_1.requestCfApi)(uri);
294
+ const json = await requestCfApi(uri);
342
295
  if (!json?.resources || !Array.isArray(json.resources)) {
343
- throw new Error((0, i18n_1.t)('error.noValidJsonForServiceInstance'));
296
+ throw new Error(t('error.noValidJsonForServiceInstance'));
344
297
  }
345
298
  return json.resources.map((service) => ({
346
299
  name: service.name,
@@ -348,7 +301,7 @@ async function getServiceInstance(params) {
348
301
  }));
349
302
  }
350
303
  catch (e) {
351
- throw new Error((0, i18n_1.t)('error.failedToGetServiceInstance', { uriParameters, error: e.message }));
304
+ throw new Error(t('error.failedToGetServiceInstance', { uriParameters, error: e.message }));
352
305
  }
353
306
  }
354
307
  /**
@@ -358,22 +311,22 @@ async function getServiceInstance(params) {
358
311
  * @param {ToolsLogger} logger - The logger.
359
312
  * @returns {Promise<ServiceKeys[]>} The service instance keys.
360
313
  */
361
- async function getOrCreateServiceKeys(serviceInstance, logger) {
314
+ export async function getOrCreateServiceKeys(serviceInstance, logger) {
362
315
  const serviceInstanceName = serviceInstance.name;
363
316
  try {
364
- const credentials = await (0, cli_1.getServiceKeys)(serviceInstance.guid, 'updated_at', logger);
317
+ const credentials = await getServiceKeys(serviceInstance.guid, 'updated_at', logger);
365
318
  if (credentials?.length > 0) {
366
319
  return credentials;
367
320
  }
368
321
  else {
369
322
  const serviceKeyName = serviceInstanceName + '_key';
370
323
  logger?.log(`Creating service key '${serviceKeyName}' for service instance '${serviceInstanceName}'`);
371
- await (0, cli_1.createServiceKey)(serviceInstanceName, serviceKeyName);
372
- return (0, cli_1.getServiceKeys)(serviceInstance.guid, 'updated_at', logger);
324
+ await createServiceKey(serviceInstanceName, serviceKeyName);
325
+ return getServiceKeys(serviceInstance.guid, 'updated_at', logger);
373
326
  }
374
327
  }
375
328
  catch (e) {
376
- throw new Error((0, i18n_1.t)('error.failedToGetOrCreateServiceKeys', { serviceInstanceName, error: e.message }));
329
+ throw new Error(t('error.failedToGetOrCreateServiceKeys', { serviceInstanceName, error: e.message }));
377
330
  }
378
331
  }
379
332
  /**
@@ -383,8 +336,8 @@ async function getOrCreateServiceKeys(serviceInstance, logger) {
383
336
  * @param {string} serviceName - The service name (e.g., 'xsuaa', 'hana').
384
337
  * @returns {Promise<string[]>} The service tags.
385
338
  */
386
- async function getServiceTags(spaceGuid, serviceName) {
387
- const json = await (0, cli_1.requestCfApi)(`/v3/service_offerings?per_page=1000&space_guids=${spaceGuid}&names=${serviceName}`);
339
+ export async function getServiceTags(spaceGuid, serviceName) {
340
+ const json = await requestCfApi(`/v3/service_offerings?per_page=1000&space_guids=${spaceGuid}&names=${serviceName}`);
388
341
  const serviceOffering = json?.resources?.find((resource) => resource.name === serviceName);
389
342
  return serviceOffering?.tags ?? [];
390
343
  }
@@ -398,7 +351,7 @@ async function getServiceTags(spaceGuid, serviceName) {
398
351
  * @param {ToolsLogger} logger - Optional logger.
399
352
  * @returns {Promise<ServiceKeyCredentialsWithTags | null>} Service key credentials with tags returned by the CF API.
400
353
  */
401
- async function getServiceKeyCredentialsWithTags(spaceGuid, serviceName, serviceInstanceName, plan, logger) {
354
+ export async function getServiceKeyCredentialsWithTags(spaceGuid, serviceName, serviceInstanceName, plan, logger) {
402
355
  try {
403
356
  const tags = await getServiceTags(spaceGuid, serviceName);
404
357
  const serviceInstances = await getServiceInstance({
@@ -1,5 +1,5 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { ServiceKeys, ServiceKeySortField } from '../../types';
2
+ import type { ServiceKeys, ServiceKeySortField } from '../../types.js';
3
3
  /**
4
4
  * Checks if Cloud Foundry is installed.
5
5
  *
@@ -1,16 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCfInstalled = isCfInstalled;
4
- exports.getServiceKeys = getServiceKeys;
5
- exports.createServiceKey = createServiceKey;
6
- exports.updateServiceInstance = updateServiceInstance;
7
- exports.requestCfApi = requestCfApi;
8
- exports.checkAppExists = checkAppExists;
9
- exports.pushApp = pushApp;
10
- exports.enableSsh = enableSsh;
11
- exports.restartApp = restartApp;
12
- const cf_tools_1 = require("@sap/cf-tools");
13
- const i18n_1 = require("../../i18n");
1
+ import { Cli, cfGetServiceKeys, eFilters } from '@sap/cf-tools';
2
+ import { t } from '../../i18n.js';
14
3
  const ENV = { env: { 'CF_COLOR': 'false' } };
15
4
  /**
16
5
  * Checks if Cloud Foundry is installed.
@@ -18,16 +7,16 @@ const ENV = { env: { 'CF_COLOR': 'false' } };
18
7
  * @param {ToolsLogger} logger - The logger.
19
8
  * @returns {Promise<boolean>} True if CF is installed, false otherwise.
20
9
  */
21
- async function isCfInstalled(logger) {
10
+ export async function isCfInstalled(logger) {
22
11
  try {
23
- const response = await cf_tools_1.Cli.execute(['version'], ENV);
12
+ const response = await Cli.execute(['version'], ENV);
24
13
  if (response.exitCode !== 0) {
25
14
  throw new Error(response.stderr);
26
15
  }
27
16
  return true;
28
17
  }
29
18
  catch (e) {
30
- logger.error((0, i18n_1.t)('error.cfNotInstalled', { error: e.message }));
19
+ logger.error(t('error.cfNotInstalled', { error: e.message }));
31
20
  return false;
32
21
  }
33
22
  }
@@ -39,13 +28,13 @@ async function isCfInstalled(logger) {
39
28
  * @param logger - Optional logger.
40
29
  * @returns The service instance credentials sorted by the specified field (newest first).
41
30
  */
42
- async function getServiceKeys(serviceInstanceGuid, sortBy = 'updated_at', logger) {
31
+ export async function getServiceKeys(serviceInstanceGuid, sortBy = 'updated_at', logger) {
43
32
  try {
44
- const resources = await (0, cf_tools_1.cfGetServiceKeys)({
33
+ const resources = await cfGetServiceKeys({
45
34
  filters: [
46
35
  {
47
36
  value: serviceInstanceGuid,
48
- key: cf_tools_1.eFilters.service_instance_guids
37
+ key: eFilters.service_instance_guids
49
38
  }
50
39
  ]
51
40
  });
@@ -81,7 +70,7 @@ async function getServiceKeys(serviceInstanceGuid, sortBy = 'updated_at', logger
81
70
  return filtered;
82
71
  }
83
72
  catch (e) {
84
- throw new Error((0, i18n_1.t)('error.cfGetInstanceCredentialsFailed', { serviceInstanceGuid, error: e.message }));
73
+ throw new Error(t('error.cfGetInstanceCredentialsFailed', { serviceInstanceGuid, error: e.message }));
85
74
  }
86
75
  }
87
76
  /**
@@ -90,15 +79,15 @@ async function getServiceKeys(serviceInstanceGuid, sortBy = 'updated_at', logger
90
79
  * @param {string} serviceInstanceName - The service instance name.
91
80
  * @param {string} serviceKeyName - The service key name.
92
81
  */
93
- async function createServiceKey(serviceInstanceName, serviceKeyName) {
82
+ export async function createServiceKey(serviceInstanceName, serviceKeyName) {
94
83
  try {
95
- const cliResult = await cf_tools_1.Cli.execute(['create-service-key', serviceInstanceName, serviceKeyName, '--wait'], ENV);
84
+ const cliResult = await Cli.execute(['create-service-key', serviceInstanceName, serviceKeyName, '--wait'], ENV);
96
85
  if (cliResult.exitCode !== 0) {
97
86
  throw new Error(cliResult.stderr);
98
87
  }
99
88
  }
100
89
  catch (e) {
101
- throw new Error((0, i18n_1.t)('error.createServiceKeyFailed', { serviceInstanceName, error: e.message }));
90
+ throw new Error(t('error.createServiceKeyFailed', { serviceInstanceName, error: e.message }));
102
91
  }
103
92
  }
104
93
  /**
@@ -107,15 +96,15 @@ async function createServiceKey(serviceInstanceName, serviceKeyName) {
107
96
  * @param {string} serviceInstanceName - The service instance name.
108
97
  * @param {object} parameters - The configuration parameters to update.
109
98
  */
110
- async function updateServiceInstance(serviceInstanceName, parameters) {
99
+ export async function updateServiceInstance(serviceInstanceName, parameters) {
111
100
  try {
112
- const cliResult = await cf_tools_1.Cli.execute(['update-service', serviceInstanceName, '-c', JSON.stringify(parameters), '--wait'], ENV);
101
+ const cliResult = await Cli.execute(['update-service', serviceInstanceName, '-c', JSON.stringify(parameters), '--wait'], ENV);
113
102
  if (cliResult.exitCode !== 0) {
114
103
  throw new Error(cliResult.stderr);
115
104
  }
116
105
  }
117
106
  catch (e) {
118
- throw new Error((0, i18n_1.t)('error.failedToUpdateServiceInstance', { serviceInstanceName, error: e.message }));
107
+ throw new Error(t('error.failedToUpdateServiceInstance', { serviceInstanceName, error: e.message }));
119
108
  }
120
109
  }
121
110
  /**
@@ -124,25 +113,25 @@ async function updateServiceInstance(serviceInstanceName, parameters) {
124
113
  * @param {string} url - The URL.
125
114
  * @returns {Promise<T>} The response.
126
115
  */
127
- async function requestCfApi(url) {
116
+ export async function requestCfApi(url) {
128
117
  try {
129
- const response = await cf_tools_1.Cli.execute(['curl', url], ENV);
118
+ const response = await Cli.execute(['curl', url], ENV);
130
119
  if (response.exitCode === 0) {
131
120
  // Check for empty response which typically indicates authentication issues
132
121
  if (!response.stdout || response.stdout.trim() === '') {
133
- throw new Error((0, i18n_1.t)('error.emptyCFAPIResponse'));
122
+ throw new Error(t('error.emptyCFAPIResponse'));
134
123
  }
135
124
  try {
136
125
  return JSON.parse(response.stdout);
137
126
  }
138
127
  catch (e) {
139
- throw new Error((0, i18n_1.t)('error.failedToParseCFAPIResponse', { error: e.message }));
128
+ throw new Error(t('error.failedToParseCFAPIResponse', { error: e.message }));
140
129
  }
141
130
  }
142
131
  throw new Error(response.stderr);
143
132
  }
144
133
  catch (e) {
145
- throw new Error((0, i18n_1.t)('error.failedToRequestCFAPI', { error: e.message }));
134
+ throw new Error(t('error.failedToRequestCFAPI', { error: e.message }));
146
135
  }
147
136
  }
148
137
  /**
@@ -151,8 +140,8 @@ async function requestCfApi(url) {
151
140
  * @param appName - CF app name.
152
141
  * @returns True if the app exists.
153
142
  */
154
- async function checkAppExists(appName) {
155
- const result = await cf_tools_1.Cli.execute(['app', appName], ENV);
143
+ export async function checkAppExists(appName) {
144
+ const result = await Cli.execute(['app', appName], ENV);
156
145
  return result.exitCode === 0;
157
146
  }
158
147
  /**
@@ -162,10 +151,10 @@ async function checkAppExists(appName) {
162
151
  * @param appPath - Local path to push.
163
152
  * @param args - Additional cf push arguments.
164
153
  */
165
- async function pushApp(appName, appPath, args = []) {
166
- const result = await cf_tools_1.Cli.execute(['push', appName, '-p', appPath, ...args], ENV);
154
+ export async function pushApp(appName, appPath, args = []) {
155
+ const result = await Cli.execute(['push', appName, '-p', appPath, ...args], ENV);
167
156
  if (result.exitCode !== 0) {
168
- throw new Error((0, i18n_1.t)('error.cfPushFailed', { appName, error: result.stderr }));
157
+ throw new Error(t('error.cfPushFailed', { appName, error: result.stderr }));
169
158
  }
170
159
  }
171
160
  /**
@@ -173,10 +162,10 @@ async function pushApp(appName, appPath, args = []) {
173
162
  *
174
163
  * @param appName - CF app name.
175
164
  */
176
- async function enableSsh(appName) {
177
- const result = await cf_tools_1.Cli.execute(['enable-ssh', appName], ENV);
165
+ export async function enableSsh(appName) {
166
+ const result = await Cli.execute(['enable-ssh', appName], ENV);
178
167
  if (result.exitCode !== 0) {
179
- throw new Error((0, i18n_1.t)('error.cfEnableSshFailed', { appName, error: result.stderr }));
168
+ throw new Error(t('error.cfEnableSshFailed', { appName, error: result.stderr }));
180
169
  }
181
170
  }
182
171
  /**
@@ -184,10 +173,10 @@ async function enableSsh(appName) {
184
173
  *
185
174
  * @param appName - CF app name.
186
175
  */
187
- async function restartApp(appName) {
188
- const result = await cf_tools_1.Cli.execute(['restart', appName, '--strategy', 'rolling', '--no-wait'], ENV);
176
+ export async function restartApp(appName) {
177
+ const result = await Cli.execute(['restart', appName, '--strategy', 'rolling', '--no-wait'], ENV);
189
178
  if (result.exitCode !== 0) {
190
- throw new Error((0, i18n_1.t)('error.cfRestartFailed', { appName, error: result.stderr }));
179
+ throw new Error(t('error.cfRestartFailed', { appName, error: result.stderr }));
191
180
  }
192
181
  }
193
182
  //# sourceMappingURL=cli.js.map
@@ -1,44 +1,8 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getBtpDestinations = getBtpDestinations;
37
- const path = __importStar(require("node:path"));
38
- const api_1 = require("./api");
39
- const api_2 = require("../../btp/api");
40
- const yaml_loader_1 = require("../project/yaml-loader");
41
- const i18n_1 = require("../../i18n");
1
+ import * as path from 'node:path';
2
+ import { getOrCreateServiceInstanceKeys } from './api.js';
3
+ import { listBtpDestinations } from '../../btp/api.js';
4
+ import { getYamlContent } from '../project/yaml-loader.js';
5
+ import { t } from '../../i18n.js';
42
6
  /**
43
7
  * Finds the name of the destination service instance declared in the MTA project's mta.yaml.
44
8
  *
@@ -48,15 +12,15 @@ const i18n_1 = require("../../i18n");
48
12
  */
49
13
  function getDestinationServiceName(projectPath) {
50
14
  try {
51
- const yamlContent = (0, yaml_loader_1.getYamlContent)(path.join(path.dirname(projectPath), 'mta.yaml'));
15
+ const yamlContent = getYamlContent(path.join(path.dirname(projectPath), 'mta.yaml'));
52
16
  const name = yamlContent?.resources?.find((r) => r.parameters?.service === 'destination')?.name;
53
17
  if (!name) {
54
- throw new Error((0, i18n_1.t)('error.destinationServiceNotFoundInMtaYaml'));
18
+ throw new Error(t('error.destinationServiceNotFoundInMtaYaml'));
55
19
  }
56
20
  return name;
57
21
  }
58
22
  catch (e) {
59
- throw e instanceof Error ? e : new Error((0, i18n_1.t)('error.destinationServiceNotFoundInMtaYaml'));
23
+ throw e instanceof Error ? e : new Error(t('error.destinationServiceNotFoundInMtaYaml'));
60
24
  }
61
25
  }
62
26
  /**
@@ -67,13 +31,13 @@ function getDestinationServiceName(projectPath) {
67
31
  * @param {string} projectPath - The root path of the CF app project.
68
32
  * @returns {Promise<Destinations>} Map of destination name to Destination object.
69
33
  */
70
- async function getBtpDestinations(projectPath) {
34
+ export async function getBtpDestinations(projectPath) {
71
35
  const destinationServiceName = getDestinationServiceName(projectPath);
72
- const serviceInfo = await (0, api_1.getOrCreateServiceInstanceKeys)({ names: [destinationServiceName] });
36
+ const serviceInfo = await getOrCreateServiceInstanceKeys({ names: [destinationServiceName] });
73
37
  if (!serviceInfo?.serviceKeys?.length) {
74
- throw new Error((0, i18n_1.t)('error.noServiceKeysFoundForDestination', { serviceInstanceName: destinationServiceName }));
38
+ throw new Error(t('error.noServiceKeysFoundForDestination', { serviceInstanceName: destinationServiceName }));
75
39
  }
76
40
  const credentials = serviceInfo.serviceKeys[0].credentials;
77
- return (0, api_2.listBtpDestinations)(credentials);
41
+ return listBtpDestinations(credentials);
78
42
  }
79
43
  //# sourceMappingURL=destinations.js.map
@@ -1,6 +1,6 @@
1
- export * from './api';
2
- export * from './ssh';
3
- export * from './cli';
4
- export * from './destinations';
5
- export * from './manifest';
1
+ export * from './api.js';
2
+ export * from './ssh.js';
3
+ export * from './cli.js';
4
+ export * from './destinations.js';
5
+ export * from './manifest.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,22 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./api"), exports);
18
- __exportStar(require("./ssh"), exports);
19
- __exportStar(require("./cli"), exports);
20
- __exportStar(require("./destinations"), exports);
21
- __exportStar(require("./manifest"), exports);
1
+ export * from './api.js';
2
+ export * from './ssh.js';
3
+ export * from './cli.js';
4
+ export * from './destinations.js';
5
+ export * from './manifest.js';
22
6
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
2
  import type { Manifest } from '@sap-ux/project-access';
3
- import type { IManifestService, DataSources } from '../../types';
3
+ import type { IManifestService, DataSources } from '../../types.js';
4
4
  /**
5
5
  * Service class for handling operations related to the manifest of a CF-deployed UI5 application.
6
6
  * Extends the ABAP {@link ManifestService} API, but retrieves the manifest from the local