@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,16 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadZip = downloadZip;
7
- exports.getHtml5RepoCredentials = getHtml5RepoCredentials;
8
- exports.downloadAppContent = downloadAppContent;
9
- const axios_1 = __importDefault(require("axios"));
10
- const adm_zip_1 = __importDefault(require("adm-zip"));
11
- const i18n_1 = require("../../i18n");
12
- const api_1 = require("../../btp/api");
13
- const api_2 = require("../services/api");
1
+ import axios from 'axios';
2
+ import AdmZip from 'adm-zip';
3
+ import { t } from '../../i18n.js';
4
+ import { getToken } from '../../btp/api.js';
5
+ import { getServiceNameByTags, getOrCreateServiceInstanceKeys, createServiceInstance } from '../services/api.js';
14
6
  const HTML5_APPS_REPO_RUNTIME = 'html5-apps-repo-runtime';
15
7
  /**
16
8
  * Download zip from HTML5 repository.
@@ -20,9 +12,9 @@ const HTML5_APPS_REPO_RUNTIME = 'html5-apps-repo-runtime';
20
12
  * @param {string} uri - URL with parameters.
21
13
  * @returns {Promise<Buffer>} File buffer content.
22
14
  */
23
- async function downloadZip(token, appHostId, uri) {
15
+ export async function downloadZip(token, appHostId, uri) {
24
16
  try {
25
- const response = await axios_1.default.get(uri, {
17
+ const response = await axios.get(uri, {
26
18
  responseType: 'arraybuffer',
27
19
  headers: {
28
20
  'Content-Type': 'application/json',
@@ -33,7 +25,7 @@ async function downloadZip(token, appHostId, uri) {
33
25
  return response.data;
34
26
  }
35
27
  catch (e) {
36
- throw new Error((0, i18n_1.t)('error.failedToDownloadZipFromHtml5Repo', { error: e.message }));
28
+ throw new Error(t('error.failedToDownloadZipFromHtml5Repo', { error: e.message }));
37
29
  }
38
30
  }
39
31
  /**
@@ -43,28 +35,28 @@ async function downloadZip(token, appHostId, uri) {
43
35
  * @param {ToolsLogger} logger logger to log messages
44
36
  * @returns {Promise<ServiceInfo>} credentials json object
45
37
  */
46
- async function getHtml5RepoCredentials(spaceGuid, logger) {
38
+ export async function getHtml5RepoCredentials(spaceGuid, logger) {
47
39
  try {
48
- let serviceInfo = await (0, api_2.getOrCreateServiceInstanceKeys)({
40
+ let serviceInfo = await getOrCreateServiceInstanceKeys({
49
41
  spaceGuids: [spaceGuid],
50
42
  planNames: ['app-runtime'],
51
43
  names: [HTML5_APPS_REPO_RUNTIME]
52
44
  }, logger);
53
45
  if (!serviceInfo?.serviceKeys?.length) {
54
- const serviceName = await (0, api_2.getServiceNameByTags)(spaceGuid, ['html5-apps-repo-rt']);
55
- await (0, api_2.createServiceInstance)('app-runtime', HTML5_APPS_REPO_RUNTIME, serviceName, {
46
+ const serviceName = await getServiceNameByTags(spaceGuid, ['html5-apps-repo-rt']);
47
+ await createServiceInstance('app-runtime', HTML5_APPS_REPO_RUNTIME, serviceName, {
56
48
  logger
57
49
  });
58
- serviceInfo = await (0, api_2.getOrCreateServiceInstanceKeys)({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
50
+ serviceInfo = await getOrCreateServiceInstanceKeys({ names: [HTML5_APPS_REPO_RUNTIME] }, logger);
59
51
  if (!serviceInfo?.serviceKeys?.length) {
60
- logger.debug((0, i18n_1.t)('error.noUaaCredentialsFoundForHtml5Repo'));
61
- throw new Error((0, i18n_1.t)('error.cannotFindHtml5RepoRuntime'));
52
+ logger.debug(t('error.noUaaCredentialsFoundForHtml5Repo'));
53
+ throw new Error(t('error.cannotFindHtml5RepoRuntime'));
62
54
  }
63
55
  }
64
56
  return serviceInfo;
65
57
  }
66
58
  catch (e) {
67
- throw new Error((0, i18n_1.t)('error.failedToGetCredentialsFromHtml5Repo', { error: e.message }));
59
+ throw new Error(t('error.failedToGetCredentialsFromHtml5Repo', { error: e.message }));
68
60
  }
69
61
  }
70
62
  /**
@@ -75,27 +67,27 @@ async function getHtml5RepoCredentials(spaceGuid, logger) {
75
67
  * @param {ToolsLogger} logger logger to log messages
76
68
  * @returns {Promise<AdmZip.IZipEntry[]>} manifest.json and xs-app.json
77
69
  */
78
- async function downloadAppContent(spaceGuid, parameters, logger) {
70
+ export async function downloadAppContent(spaceGuid, parameters, logger) {
79
71
  const { appHostId, appName, appVersion } = parameters;
80
72
  const appNameVersion = `${appName}-${appVersion}`;
81
73
  try {
82
74
  const { serviceKeys, serviceInstance } = await getHtml5RepoCredentials(spaceGuid, logger);
83
- const token = await (0, api_1.getToken)(serviceKeys[0]?.credentials.uaa, logger);
75
+ const token = await getToken(serviceKeys[0]?.credentials.uaa, logger);
84
76
  const uri = `${serviceKeys[0]?.credentials.uri}/applications/content/${appNameVersion}?pathSuffixFilter=manifest.json,xs-app.json`;
85
77
  const zip = await downloadZip(token, appHostId, uri);
86
78
  let admZip;
87
79
  try {
88
- admZip = new adm_zip_1.default(zip);
80
+ admZip = new AdmZip(zip);
89
81
  }
90
82
  catch (e) {
91
- throw new Error((0, i18n_1.t)('error.failedToParseZipContent', { error: e.message }));
83
+ throw new Error(t('error.failedToParseZipContent', { error: e.message }));
92
84
  }
93
85
  if (!admZip?.getEntries?.().length) {
94
- throw new Error((0, i18n_1.t)('error.noZipContentParsed'));
86
+ throw new Error(t('error.noZipContentParsed'));
95
87
  }
96
88
  const zipEntry = admZip.getEntries().find((zipEntry) => zipEntry.entryName === 'manifest.json');
97
89
  if (!zipEntry) {
98
- throw new Error((0, i18n_1.t)('error.failedToFindManifestJsonInHtml5Repo'));
90
+ throw new Error(t('error.failedToFindManifestJsonInHtml5Repo'));
99
91
  }
100
92
  try {
101
93
  const manifest = JSON.parse(zipEntry.getData().toString('utf8'));
@@ -106,12 +98,12 @@ async function downloadAppContent(spaceGuid, parameters, logger) {
106
98
  };
107
99
  }
108
100
  catch (e) {
109
- throw new Error((0, i18n_1.t)('error.failedToParseManifestJson', { error: e.message }));
101
+ throw new Error(t('error.failedToParseManifestJson', { error: e.message }));
110
102
  }
111
103
  }
112
104
  catch (e) {
113
105
  logger.error(e);
114
- throw new Error((0, i18n_1.t)('error.failedToDownloadAppContent', { spaceGuid, appName, appHostId, error: e.message }));
106
+ throw new Error(t('error.failedToDownloadAppContent', { spaceGuid, appName, appHostId, error: e.message }));
115
107
  }
116
108
  }
117
109
  //# sourceMappingURL=html5-repo.js.map
@@ -1,3 +1,3 @@
1
- export * from './discovery';
2
- export * from './html5-repo';
1
+ export * from './discovery.js';
2
+ export * from './html5-repo.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,3 @@
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("./discovery"), exports);
18
- __exportStar(require("./html5-repo"), exports);
1
+ export * from './discovery.js';
2
+ export * from './html5-repo.js';
19
3
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { CfConfig } from '../../types';
2
+ import type { CfConfig } from '../../types.js';
3
3
  /**
4
4
  * Check if the external login is enabled.
5
5
  *
@@ -1,15 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isExternalLoginEnabled = isExternalLoginEnabled;
4
- exports.isLoggedInCf = isLoggedInCf;
5
- const cf_tools_1 = require("@sap/cf-tools");
1
+ import { cfGetAuthToken } from '@sap/cf-tools';
6
2
  /**
7
3
  * Check if the external login is enabled.
8
4
  *
9
5
  * @param {any} vscode - The vscode instance.
10
6
  * @returns {Promise<boolean>} Whether the external login is enabled.
11
7
  */
12
- async function isExternalLoginEnabled(vscode) {
8
+ export async function isExternalLoginEnabled(vscode) {
13
9
  const commands = await vscode.commands.getCommands();
14
10
  return commands?.includes('cf.login');
15
11
  }
@@ -20,13 +16,13 @@ async function isExternalLoginEnabled(vscode) {
20
16
  * @param {ToolsLogger} logger - The logger.
21
17
  * @returns {Promise<boolean>} Whether the user is logged in.
22
18
  */
23
- async function isLoggedInCf(cfConfig, logger) {
19
+ export async function isLoggedInCf(cfConfig, logger) {
24
20
  if (!cfConfig) {
25
21
  logger?.error('CF config is not provided');
26
22
  return false;
27
23
  }
28
24
  try {
29
- await (0, cf_tools_1.cfGetAuthToken)();
25
+ await cfGetAuthToken();
30
26
  return true;
31
27
  }
32
28
  catch (e) {
@@ -1,5 +1,5 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { CfConfig } from '../../types';
2
+ import type { CfConfig } from '../../types.js';
3
3
  /**
4
4
  * Load the CF configuration.
5
5
  *
@@ -1,23 +1,17 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.loadCfConfig = loadCfConfig;
7
- const node_os_1 = __importDefault(require("node:os"));
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const node_path_1 = __importDefault(require("node:path"));
1
+ import os from 'node:os';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
10
4
  /**
11
5
  * Get the home directory.
12
6
  *
13
7
  * @returns {string} The home directory.
14
8
  */
15
9
  function getHomedir() {
16
- let homedir = node_os_1.default.homedir();
10
+ let homedir = os.homedir();
17
11
  const homeDrive = process.env?.['HOMEDRIVE'];
18
12
  const homePath = process.env?.['HOMEPATH'];
19
13
  if (process.platform === 'win32' && typeof homeDrive === 'string' && typeof homePath === 'string') {
20
- homedir = node_path_1.default.join(homeDrive, homePath);
14
+ homedir = path.join(homeDrive, homePath);
21
15
  }
22
16
  return homedir;
23
17
  }
@@ -27,15 +21,15 @@ function getHomedir() {
27
21
  * @param {ToolsLogger} logger - The logger.
28
22
  * @returns {CfConfig} The CF configuration.
29
23
  */
30
- function loadCfConfig(logger) {
24
+ export function loadCfConfig(logger) {
31
25
  let cfHome = process.env['CF_HOME'];
32
26
  if (!cfHome) {
33
- cfHome = node_path_1.default.join(getHomedir(), '.cf');
27
+ cfHome = path.join(getHomedir(), '.cf');
34
28
  }
35
- const configFileLocation = node_path_1.default.join(cfHome, 'config.json');
29
+ const configFileLocation = path.join(cfHome, 'config.json');
36
30
  let config = {};
37
31
  try {
38
- const configAsString = node_fs_1.default.readFileSync(configFileLocation, 'utf-8');
32
+ const configAsString = fs.readFileSync(configFileLocation, 'utf-8');
39
33
  config = JSON.parse(configAsString);
40
34
  }
41
35
  catch (e) {
@@ -1,3 +1,3 @@
1
- export * from './auth';
2
- export * from './config';
1
+ export * from './auth.js';
2
+ export * from './config.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,19 +1,3 @@
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("./auth"), exports);
18
- __exportStar(require("./config"), exports);
1
+ export * from './auth.js';
2
+ export * from './config.js';
19
3
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { CfConfig, CfDeploymentInfo, DeployCfOptions } from '../types';
1
+ import type { CfConfig, CfDeploymentInfo, DeployCfOptions } from '../types.js';
2
2
  import type { ToolsLogger } from '@sap-ux/logger';
3
3
  /**
4
4
  * Gathers MTA project and CF environment information needed for deployment.
package/dist/cf/deploy.js CHANGED
@@ -1,22 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getCfDeploymentInfo = getCfDeploymentInfo;
7
- exports.formatDeploymentSummary = formatDeploymentSummary;
8
- exports.findMtaRoot = findMtaRoot;
9
- exports.buildMtaArchive = buildMtaArchive;
10
- exports.deployMtaArchive = deployMtaArchive;
11
- exports.deployCf = deployCf;
12
- const node_path_1 = __importDefault(require("node:path"));
13
- const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
14
- const project_access_1 = require("@sap-ux/project-access");
15
- const cli_1 = require("./services/cli");
16
- const auth_1 = require("./core/auth");
17
- const config_1 = require("./core/config");
18
- const yaml_loader_1 = require("./project/yaml-loader");
19
- const i18n_1 = require("../i18n");
1
+ import path from 'node:path';
2
+ import { CommandRunner } from '@sap-ux/nodejs-utils';
3
+ import { getMtaPath } from '@sap-ux/project-access';
4
+ import { isCfInstalled } from './services/cli.js';
5
+ import { isLoggedInCf } from './core/auth.js';
6
+ import { loadCfConfig } from './core/config.js';
7
+ import { getYamlContent } from './project/yaml-loader.js';
8
+ import { t } from '../i18n.js';
20
9
  const SEPARATOR = '------------------------------------';
21
10
  /**
22
11
  * Gathers MTA project and CF environment information needed for deployment.
@@ -25,9 +14,9 @@ const SEPARATOR = '------------------------------------';
25
14
  * @param {CfConfig} cfConfig - The CF configuration.
26
15
  * @returns {CfDeploymentInfo} Deployment information for the MTA project.
27
16
  */
28
- function getCfDeploymentInfo(projectPath, cfConfig) {
29
- const mtaYamlPath = node_path_1.default.join(projectPath, 'mta.yaml');
30
- const mtaYaml = (0, yaml_loader_1.getYamlContent)(mtaYamlPath);
17
+ export function getCfDeploymentInfo(projectPath, cfConfig) {
18
+ const mtaYamlPath = path.join(projectPath, 'mta.yaml');
19
+ const mtaYaml = getYamlContent(mtaYamlPath);
31
20
  return {
32
21
  mtaProjectName: mtaYaml.ID ?? '',
33
22
  mtaVersion: mtaYaml.version ?? '',
@@ -48,7 +37,7 @@ function getCfDeploymentInfo(projectPath, cfConfig) {
48
37
  * @param {CfDeploymentInfo} info - The deployment information to format.
49
38
  * @returns {string} Formatted summary string ready for display.
50
39
  */
51
- function formatDeploymentSummary(info) {
40
+ export function formatDeploymentSummary(info) {
52
41
  const lines = [];
53
42
  lines.push(`mta-project-name: ${info.mtaProjectName}`, `mta-version: ${info.mtaVersion}`, `space: ${info.space}`, `org: ${info.org}`, `api-url: ${info.apiUrl}`);
54
43
  for (const mod of info.modules) {
@@ -57,7 +46,7 @@ function formatDeploymentSummary(info) {
57
46
  lines.push(`path: ${mod.path}`);
58
47
  }
59
48
  }
60
- lines.push('', (0, i18n_1.t)('deploy.confirmPrompt'));
49
+ lines.push('', t('deploy.confirmPrompt'));
61
50
  return lines.join('\n');
62
51
  }
63
52
  /**
@@ -66,9 +55,9 @@ function formatDeploymentSummary(info) {
66
55
  * @param {string} projectPath - The starting project path.
67
56
  * @returns {Promise<string | undefined>} The MTA root path, or undefined if not found.
68
57
  */
69
- async function findMtaRoot(projectPath) {
70
- const result = await (0, project_access_1.getMtaPath)(projectPath);
71
- return result ? node_path_1.default.dirname(result.mtaPath) : undefined;
58
+ export async function findMtaRoot(projectPath) {
59
+ const result = await getMtaPath(projectPath);
60
+ return result ? path.dirname(result.mtaPath) : undefined;
72
61
  }
73
62
  /**
74
63
  * Validates the CF environment: checks CF CLI is installed, user is logged in, and locates the MTA root.
@@ -78,18 +67,18 @@ async function findMtaRoot(projectPath) {
78
67
  * @returns {Promise<{ cfConfig: CfConfig; mtaRoot: string }>} The validated CF config and MTA root path.
79
68
  */
80
69
  async function validateCfEnvironment(projectPath, logger) {
81
- const cfInstalled = await (0, cli_1.isCfInstalled)(logger);
70
+ const cfInstalled = await isCfInstalled(logger);
82
71
  if (!cfInstalled) {
83
- throw new Error((0, i18n_1.t)('deploy.cfNotInstalled'));
72
+ throw new Error(t('deploy.cfNotInstalled'));
84
73
  }
85
- const cfConfig = (0, config_1.loadCfConfig)(logger);
86
- const loggedIn = await (0, auth_1.isLoggedInCf)(cfConfig, logger);
74
+ const cfConfig = loadCfConfig(logger);
75
+ const loggedIn = await isLoggedInCf(cfConfig, logger);
87
76
  if (!loggedIn) {
88
- throw new Error((0, i18n_1.t)('deploy.notLoggedIn'));
77
+ throw new Error(t('deploy.notLoggedIn'));
89
78
  }
90
79
  const mtaRoot = await findMtaRoot(projectPath);
91
80
  if (!mtaRoot) {
92
- throw new Error((0, i18n_1.t)('deploy.mtaNotFound', { projectPath }));
81
+ throw new Error(t('deploy.mtaNotFound', { projectPath }));
93
82
  }
94
83
  return { cfConfig, mtaRoot };
95
84
  }
@@ -99,13 +88,13 @@ async function validateCfEnvironment(projectPath, logger) {
99
88
  * @param {string} projectPath - Path to the ADP project root.
100
89
  * @param {ToolsLogger} logger - Logger instance.
101
90
  */
102
- async function buildMtaArchive(projectPath, logger) {
103
- const commandRunner = new nodejs_utils_1.CommandRunner();
91
+ export async function buildMtaArchive(projectPath, logger) {
92
+ const commandRunner = new CommandRunner();
104
93
  try {
105
94
  await commandRunner.run('npm', ['run', 'build-mta'], { cwd: projectPath }, logger);
106
95
  }
107
96
  catch (e) {
108
- throw new Error((0, i18n_1.t)('deploy.buildFailed', { error: String(e) }));
97
+ throw new Error(t('deploy.buildFailed', { error: String(e) }));
109
98
  }
110
99
  }
111
100
  /**
@@ -114,13 +103,13 @@ async function buildMtaArchive(projectPath, logger) {
114
103
  * @param {string} projectPath - Path to the ADP project root.
115
104
  * @param {ToolsLogger} logger - Logger instance.
116
105
  */
117
- async function deployMtaArchive(projectPath, logger) {
118
- const commandRunner = new nodejs_utils_1.CommandRunner();
106
+ export async function deployMtaArchive(projectPath, logger) {
107
+ const commandRunner = new CommandRunner();
119
108
  try {
120
109
  await commandRunner.run('npm', ['run', 'deploy'], { cwd: projectPath }, logger);
121
110
  }
122
111
  catch (e) {
123
- throw new Error((0, i18n_1.t)('deploy.deployFailed', { error: String(e) }));
112
+ throw new Error(t('deploy.deployFailed', { error: String(e) }));
124
113
  }
125
114
  }
126
115
  /**
@@ -131,7 +120,7 @@ async function deployMtaArchive(projectPath, logger) {
131
120
  * @param {DeployCfOptions} [options] - Deployment options (confirmation callback, output callback).
132
121
  * @returns {Promise<void>} Resolves when deployment completes.
133
122
  */
134
- async function deployCf(projectPath, logger, options = {}) {
123
+ export async function deployCf(projectPath, logger, options = {}) {
135
124
  const { cfConfig, mtaRoot } = await validateCfEnvironment(projectPath, logger);
136
125
  const info = getCfDeploymentInfo(mtaRoot, cfConfig);
137
126
  const summary = formatDeploymentSummary(info);
@@ -140,14 +129,14 @@ async function deployCf(projectPath, logger, options = {}) {
140
129
  if (options.confirmDeployment) {
141
130
  const confirmed = await options.confirmDeployment(summary);
142
131
  if (!confirmed) {
143
- logger.info((0, i18n_1.t)('deploy.cancelled'));
132
+ logger.info(t('deploy.cancelled'));
144
133
  return;
145
134
  }
146
135
  }
147
- logger.info((0, i18n_1.t)('deploy.buildStarted'));
136
+ logger.info(t('deploy.buildStarted'));
148
137
  await buildMtaArchive(projectPath, logger);
149
- logger.info((0, i18n_1.t)('deploy.deployStarted'));
138
+ logger.info(t('deploy.deployStarted'));
150
139
  await deployMtaArchive(projectPath, logger);
151
- logger.info((0, i18n_1.t)('deploy.success'));
140
+ logger.info(t('deploy.success'));
152
141
  }
153
142
  //# sourceMappingURL=deploy.js.map
@@ -1,7 +1,7 @@
1
- export * from './deploy';
2
- export * from './project';
3
- export * from './app';
4
- export * from './core';
5
- export * from './services';
6
- export * from './utils';
1
+ export * from './deploy.js';
2
+ export * from './project/index.js';
3
+ export * from './app/index.js';
4
+ export * from './core/index.js';
5
+ export * from './services/index.js';
6
+ export * from './utils/index.js';
7
7
  //# sourceMappingURL=index.d.ts.map
package/dist/cf/index.js CHANGED
@@ -1,23 +1,7 @@
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("./deploy"), exports);
18
- __exportStar(require("./project"), exports);
19
- __exportStar(require("./app"), exports);
20
- __exportStar(require("./core"), exports);
21
- __exportStar(require("./services"), exports);
22
- __exportStar(require("./utils"), exports);
1
+ export * from './deploy.js';
2
+ export * from './project/index.js';
3
+ export * from './app/index.js';
4
+ export * from './core/index.js';
5
+ export * from './services/index.js';
6
+ export * from './utils/index.js';
23
7
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- export * from './mta';
2
- export * from './yaml';
3
- export * from './yaml-loader';
1
+ export * from './mta.js';
2
+ export * from './yaml.js';
3
+ export * from './yaml-loader.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,20 +1,4 @@
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("./mta"), exports);
18
- __exportStar(require("./yaml"), exports);
19
- __exportStar(require("./yaml-loader"), exports);
1
+ export * from './mta.js';
2
+ export * from './yaml.js';
3
+ export * from './yaml-loader.js';
20
4
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type { ToolsLogger } from '@sap-ux/logger';
2
- import type { BusinessServiceResource, AppRouterType, MtaYaml } from '../../types';
2
+ import type { BusinessServiceResource, AppRouterType, MtaYaml } from '../../types.js';
3
3
  /**
4
4
  * Builds VCAP_SERVICES by resolving MTA resources to service key credentials.
5
5
  *