@sap-ux/adp-tooling 0.19.10 → 1.0.0

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
package/dist/ui5/index.js CHANGED
@@ -1,21 +1,5 @@
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("./version-info"), exports);
18
- __exportStar(require("./format"), exports);
19
- __exportStar(require("./fetch"), exports);
20
- __exportStar(require("./validator"), exports);
1
+ export * from './version-info.js';
2
+ export * from './format.js';
3
+ export * from './fetch.js';
4
+ export * from './validator.js';
21
5
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { NetworkError } from '../types';
1
+ import type { NetworkError } from '../types.js';
2
2
  /**
3
3
  * Checks if the current environment is offline or has network connectivity issues.
4
4
  * This function is designed for VS Code's Yeoman UI environment where network
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isOfflineError = isOfflineError;
4
1
  /**
5
2
  * In VS Code extension host, we can't rely on navigator.onLine.
6
3
  * Focus on error messages that indicate network connectivity issues
@@ -28,7 +25,7 @@ const networkErrorMessages = [
28
25
  * @param {string} [error.code] - The error code string.
29
26
  * @returns {boolean} True if the error indicates offline/network issues.
30
27
  */
31
- function isOfflineError(error) {
28
+ export function isOfflineError(error) {
32
29
  return networkErrorMessages.some((msg) => error.message?.includes(msg) || error.name?.includes(msg) || error.code?.includes(msg));
33
30
  }
34
31
  //# sourceMappingURL=network.js.map
@@ -1,43 +1,37 @@
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.validateUI5VersionExists = validateUI5VersionExists;
7
- const project_input_validator_1 = require("@sap-ux/project-input-validator");
8
- const axios_1 = __importDefault(require("axios"));
9
- const i18n_1 = require("../i18n");
10
- const format_1 = require("./format");
11
- const network_1 = require("./network");
1
+ import { validateEmptyString } from '@sap-ux/project-input-validator';
2
+ import axios from 'axios';
3
+ import { t } from '../i18n.js';
4
+ import { getOfficialBaseUI5VersionUrl, getFormattedVersion } from './format.js';
5
+ import { isOfflineError } from './network.js';
12
6
  /**
13
7
  * Validates a specified UI5 version by checking its availability on the SAP CDN.
14
8
  *
15
9
  * @param {string} [version] - The version to validate.
16
10
  * @returns {Promise<string | boolean>} True if the version is valid, a string message if not, or if an error occurs.
17
11
  */
18
- async function validateUI5VersionExists(version) {
19
- const validationResult = (0, project_input_validator_1.validateEmptyString)(version);
12
+ export async function validateUI5VersionExists(version) {
13
+ const validationResult = validateEmptyString(version);
20
14
  if (typeof validationResult === 'string') {
21
15
  return validationResult;
22
16
  }
23
- const selectedVersionURL = (0, format_1.getOfficialBaseUI5VersionUrl)(version);
24
- const resource = version.includes('snapshot') ? 'neo-app.json' : (0, format_1.getFormattedVersion)(version);
17
+ const selectedVersionURL = getOfficialBaseUI5VersionUrl(version);
18
+ const resource = version.includes('snapshot') ? 'neo-app.json' : getFormattedVersion(version);
25
19
  try {
26
- await axios_1.default.get(`${selectedVersionURL}/${resource}`);
20
+ await axios.get(`${selectedVersionURL}/${resource}`);
27
21
  return true;
28
22
  }
29
23
  catch (e) {
30
24
  if (version.includes('snapshot')) {
31
- const message = (0, i18n_1.t)('validators.ui5VersionNotReachableError');
25
+ const message = t('validators.ui5VersionNotReachableError');
32
26
  return `${message.replace('<URL>', selectedVersionURL)}`;
33
27
  }
34
28
  if (e.response?.status === 400 || e.response?.status === 404) {
35
- return (0, i18n_1.t)('validators.ui5VersionOutdatedError');
29
+ return t('validators.ui5VersionOutdatedError');
36
30
  }
37
- if ((0, network_1.isOfflineError)(e)) {
31
+ if (isOfflineError(e)) {
38
32
  return true;
39
33
  }
40
- return (0, i18n_1.t)('validators.ui5VersionDoesNotExistGeneric', { error: e.message });
34
+ return t('validators.ui5VersionDoesNotExistGeneric', { error: e.message });
41
35
  }
42
36
  }
43
37
  //# sourceMappingURL=validator.js.map
@@ -1,4 +1,4 @@
1
- import type { UI5Version } from '../types';
1
+ import type { UI5Version } from '../types.js';
2
2
  export interface VersionLabels {
3
3
  formattedVersion: string;
4
4
  systemSnapshotLabel: string;
@@ -1,24 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLatestVersion = getLatestVersion;
4
- exports.getMinUI5VersionForManifest = getMinUI5VersionForManifest;
5
- exports.shouldSetMinUI5Version = shouldSetMinUI5Version;
6
- exports.getVersionToBeUsed = getVersionToBeUsed;
7
- exports.getVersionLabels = getVersionLabels;
8
- exports.checkSystemVersionPattern = checkSystemVersionPattern;
9
- exports.getInternalVersions = getInternalVersions;
10
- exports.getHigherVersions = getHigherVersions;
11
- exports.getRelevantVersions = getRelevantVersions;
12
- const fetch_1 = require("./fetch");
13
- const format_1 = require("./format");
14
- const constants_1 = require("../base/constants");
1
+ import { fetchInternalVersions } from './fetch.js';
2
+ import { isFeatureSupportedVersion, addSnapshot, buildSystemVersionLabel, formatUi5Version } from './format.js';
3
+ import { CURRENT_SYSTEM_VERSION, LATEST_VERSION, SNAPSHOT_UNTESTED_VERSION, SNAPSHOT_VERSION } from '../base/constants/index.js';
15
4
  /**
16
5
  * Returns the latest version string from the fetched public versions.
17
6
  *
18
7
  * @param {UI5Version} publicVersions - The public UI5 version data fetched from the CDN.
19
8
  * @returns {string} The latest version string.
20
9
  */
21
- function getLatestVersion(publicVersions) {
10
+ export function getLatestVersion(publicVersions) {
22
11
  return publicVersions?.latest?.version;
23
12
  }
24
13
  /**
@@ -31,7 +20,7 @@ function getLatestVersion(publicVersions) {
31
20
  * @returns {string} The SAP UI5 version string to be set in the manifest, which can be either
32
21
  * the current system version or the latest stable version, depending on the presence of 'snapshot'.
33
22
  */
34
- function getMinUI5VersionForManifest(publicVersions, systemVersion) {
23
+ export function getMinUI5VersionForManifest(publicVersions, systemVersion) {
35
24
  if (!systemVersion || systemVersion?.includes('snapshot')) {
36
25
  return getLatestVersion(publicVersions);
37
26
  }
@@ -44,7 +33,7 @@ function getMinUI5VersionForManifest(publicVersions, systemVersion) {
44
33
  * @returns {boolean} True if the minimum UI5 version should be set (i.e., the detected version is
45
34
  * available and the minor version is 90 or higher); otherwise, false.
46
35
  */
47
- function shouldSetMinUI5Version(systemVersion) {
36
+ export function shouldSetMinUI5Version(systemVersion) {
48
37
  if (!systemVersion) {
49
38
  return false;
50
39
  }
@@ -60,7 +49,7 @@ function shouldSetMinUI5Version(systemVersion) {
60
49
  * @param {UI5Version} publicVersions - The public UI5 version data.
61
50
  * @returns {string} The version string to be used.
62
51
  */
63
- function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
52
+ export function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
64
53
  if (!version || (isCustomerBase && version.includes('snapshot'))) {
65
54
  return getLatestVersion(publicVersions);
66
55
  }
@@ -76,15 +65,15 @@ function getVersionToBeUsed(version, isCustomerBase, publicVersions) {
76
65
  * - systemSnapshotLabel: the snapshot label (if applicable),
77
66
  * - systemLatestLabel: a label if the version equals the latest version.
78
67
  */
79
- function getVersionLabels(version, publicVersions) {
68
+ export function getVersionLabels(version, publicVersions) {
80
69
  let formattedVersion = '';
81
70
  let systemSnapshotLabel = '';
82
71
  let systemLatestLabel = '';
83
72
  if (version) {
84
73
  const latestVersion = getLatestVersion(publicVersions);
85
- formattedVersion = (0, format_1.formatUi5Version)(version);
86
- systemSnapshotLabel = (0, format_1.addSnapshot)(version, latestVersion);
87
- systemLatestLabel = formattedVersion === latestVersion ? constants_1.LATEST_VERSION : '';
74
+ formattedVersion = formatUi5Version(version);
75
+ systemSnapshotLabel = addSnapshot(version, latestVersion);
76
+ systemLatestLabel = formattedVersion === latestVersion ? LATEST_VERSION : '';
88
77
  }
89
78
  return { formattedVersion, systemSnapshotLabel, systemLatestLabel };
90
79
  }
@@ -94,12 +83,12 @@ function getVersionLabels(version, publicVersions) {
94
83
  * @param version - The version string to be checked.
95
84
  * @returns The version string if it matches the standard format, or undefined otherwise.
96
85
  */
97
- function checkSystemVersionPattern(version) {
86
+ export function checkSystemVersionPattern(version) {
98
87
  const pattern = /^[1-9]\.\d{1,3}\.\d{1,2}\.*/;
99
88
  if (!version || !pattern.test(version)) {
100
89
  return undefined;
101
90
  }
102
- return (0, format_1.formatUi5Version)(version);
91
+ return formatUi5Version(version);
103
92
  }
104
93
  /**
105
94
  * Retrieves and filters internal UI5 versions.
@@ -110,9 +99,9 @@ function checkSystemVersionPattern(version) {
110
99
  * @param {string} latestVersion - The latest public version string.
111
100
  * @returns {Promise<string[]>} A promise that resolves to an array of internal version strings.
112
101
  */
113
- async function getInternalVersions(latestVersion) {
114
- const releasedVersions = await (0, fetch_1.fetchInternalVersions)(latestVersion);
115
- return releasedVersions.filter((version) => (0, format_1.isFeatureSupportedVersion)('1.71.0', version));
102
+ export async function getInternalVersions(latestVersion) {
103
+ const releasedVersions = await fetchInternalVersions(latestVersion);
104
+ return releasedVersions.filter((version) => isFeatureSupportedVersion('1.71.0', version));
116
105
  }
117
106
  /**
118
107
  * Fetches versions that are higher than the specified version.
@@ -121,7 +110,7 @@ async function getInternalVersions(latestVersion) {
121
110
  * @param {UI5Version} publicVersions - The public UI5 version data.
122
111
  * @returns {Promise<string[]>} A promise that resolves to an array of versions higher than the specified version.
123
112
  */
124
- async function getHigherVersions(version, publicVersions) {
113
+ export async function getHigherVersions(version, publicVersions) {
125
114
  const latestVersion = publicVersions?.latest?.version;
126
115
  const radix = 10;
127
116
  const [_, baselineMinor, baselineMicro] = version.split('.').map((part) => Number.parseInt(part, radix));
@@ -132,7 +121,7 @@ async function getHigherVersions(version, publicVersions) {
132
121
  const [, minor, micro] = ver.split('.').map((part) => Number.parseInt(part, radix));
133
122
  return minor > baselineMinor || (minor === baselineMinor && micro > baselineMicro);
134
123
  });
135
- const result = higherVersions.map((ver) => (ver === latestVersion ? `${ver} ${constants_1.LATEST_VERSION}` : ver)).reverse();
124
+ const result = higherVersions.map((ver) => (ver === latestVersion ? `${ver} ${LATEST_VERSION}` : ver)).reverse();
136
125
  return result;
137
126
  }
138
127
  /**
@@ -148,7 +137,7 @@ async function getHigherVersions(version, publicVersions) {
148
137
  * @param {UI5Version} publicVersions - The public UI5 version data.
149
138
  * @returns {Promise<string[]>} A promise that resolves to an array of relevant version strings.
150
139
  */
151
- async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions) {
140
+ export async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions) {
152
141
  let formattedVersion = '', systemSnapshotLabel = '', systemLatestLabel = '';
153
142
  const latestPublicVersion = publicVersions?.latest?.version;
154
143
  let versions = [];
@@ -159,21 +148,21 @@ async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions
159
148
  versions = await getInternalVersions(latestPublicVersion);
160
149
  if (formattedVersion) {
161
150
  const regex = new RegExp(`${formattedVersion} `, 'g');
162
- versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${constants_1.CURRENT_SYSTEM_VERSION}`));
163
- versions.unshift((0, format_1.buildSystemVersionLabel)(formattedVersion, systemSnapshotLabel, systemLatestLabel));
151
+ versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${CURRENT_SYSTEM_VERSION}`));
152
+ versions.unshift(buildSystemVersionLabel(formattedVersion, systemSnapshotLabel, systemLatestLabel));
164
153
  }
165
- versions.unshift(constants_1.SNAPSHOT_VERSION, constants_1.SNAPSHOT_UNTESTED_VERSION);
154
+ versions.unshift(SNAPSHOT_VERSION, SNAPSHOT_UNTESTED_VERSION);
166
155
  }
167
156
  else if (formattedVersion && systemSnapshotLabel === '') {
168
157
  versions = await getHigherVersions(formattedVersion, publicVersions);
169
158
  if (!versions.length && formattedVersion !== latestPublicVersion) {
170
- versions = [`${formattedVersion} ${constants_1.CURRENT_SYSTEM_VERSION}`, `${latestPublicVersion} ${constants_1.LATEST_VERSION}`];
159
+ versions = [`${formattedVersion} ${CURRENT_SYSTEM_VERSION}`, `${latestPublicVersion} ${LATEST_VERSION}`];
171
160
  return [...new Set(versions)];
172
161
  }
173
- versions.unshift((0, format_1.buildSystemVersionLabel)(formattedVersion, systemSnapshotLabel, systemLatestLabel));
162
+ versions.unshift(buildSystemVersionLabel(formattedVersion, systemSnapshotLabel, systemLatestLabel));
174
163
  }
175
164
  else {
176
- versions = [`${latestPublicVersion} ${constants_1.LATEST_VERSION}`];
165
+ versions = [`${latestPublicVersion} ${LATEST_VERSION}`];
177
166
  }
178
167
  return [...new Set(versions)];
179
168
  }
@@ -1,6 +1,6 @@
1
1
  import { type Editor } from 'mem-fs-editor';
2
2
  import { type ToolsLogger } from '@sap-ux/logger';
3
- import type { CfAdpWriterConfig, CfConfig, CfUi5AppInfo } from '../types';
3
+ import type { CfAdpWriterConfig, CfConfig, CfUi5AppInfo } from '../types.js';
4
4
  /**
5
5
  * Writes the CF adp-project template to the mem-fs-editor instance.
6
6
  *
package/dist/writer/cf.js CHANGED
@@ -1,24 +1,16 @@
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.generateCf = generateCf;
7
- exports.writeUi5AppInfo = writeUi5AppInfo;
8
- exports.setupCfPreview = setupCfPreview;
9
- const node_fs_1 = __importDefault(require("node:fs"));
10
- const node_path_1 = require("node:path");
11
- const mem_fs_1 = require("mem-fs");
12
- const mem_fs_editor_1 = require("mem-fs-editor");
13
- const project_access_1 = require("@sap-ux/project-access");
14
- const cf_1 = require("../cf");
15
- const source_1 = require("../source");
16
- const manifest_1 = require("./manifest");
17
- const project_utils_1 = require("./project-utils");
18
- const i18n_1 = require("./i18n");
19
- const project_builder_1 = require("../base/project-builder");
20
- const helper_1 = require("../base/helper");
21
- const discovery_1 = require("../cf/app/discovery");
1
+ import fs from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { create as createStorage } from 'mem-fs';
4
+ import { create } from 'mem-fs-editor';
5
+ import { readUi5Yaml } from '@sap-ux/project-access';
6
+ import { adjustMtaYaml, getOrCreateServiceInstanceKeys, getCfUi5AppInfo, getProjectNameForXsSecurity } from '../cf/index.js';
7
+ import { getApplicationType } from '../source/index.js';
8
+ import { fillDescriptorContent } from './manifest/index.js';
9
+ import { getCfVariant, writeCfTemplates, writeCfUI5Yaml } from './project-utils.js';
10
+ import { getI18nDescription, getI18nModels, writeI18nModels } from './i18n/index.js';
11
+ import { runBuild } from '../base/project-builder.js';
12
+ import { getBaseAppId } from '../base/helper.js';
13
+ import { getAppHostIds } from '../cf/app/discovery.js';
22
14
  /**
23
15
  * Writes the CF adp-project template to the mem-fs-editor instance.
24
16
  *
@@ -28,14 +20,14 @@ const discovery_1 = require("../cf/app/discovery");
28
20
  * @param {Editor} fs - The memfs editor instance.
29
21
  * @returns {Promise<Editor>} The updated memfs editor instance.
30
22
  */
31
- async function generateCf(basePath, config, logger, fs) {
23
+ export async function generateCf(basePath, config, logger, fs) {
32
24
  if (!fs) {
33
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
25
+ fs = create(createStorage());
34
26
  }
35
27
  const timestamp = Date.now().toString();
36
28
  const fullConfig = setDefaults(config);
37
29
  const { app, cf, ui5, project } = fullConfig;
38
- const yamlContent = await (0, cf_1.adjustMtaYaml)({
30
+ const yamlContent = await adjustMtaYaml({
39
31
  projectPath: basePath,
40
32
  adpProjectName: project.name,
41
33
  appRouterType: cf.approuter,
@@ -45,13 +37,13 @@ async function generateCf(basePath, config, logger, fs) {
45
37
  spaceGuid: cf.space.GUID
46
38
  }, fs, timestamp, config.options?.templatePathOverwrite, logger);
47
39
  if (fullConfig.app.i18nModels) {
48
- (0, i18n_1.writeI18nModels)(basePath, fullConfig.app.i18nModels, fs);
40
+ writeI18nModels(basePath, fullConfig.app.i18nModels, fs);
49
41
  }
50
- const variant = (0, project_utils_1.getCfVariant)(fullConfig);
51
- (0, manifest_1.fillDescriptorContent)(variant.content, app.appType, ui5.version, app.i18nModels);
52
- fullConfig.project.xsSecurityAppName = (0, cf_1.getProjectNameForXsSecurity)(yamlContent, timestamp);
53
- await (0, project_utils_1.writeCfTemplates)(basePath, variant, fullConfig, fs);
54
- await (0, project_utils_1.writeCfUI5Yaml)(fullConfig.project.folder, fullConfig, fs);
42
+ const variant = getCfVariant(fullConfig);
43
+ fillDescriptorContent(variant.content, app.appType, ui5.version, app.i18nModels);
44
+ fullConfig.project.xsSecurityAppName = getProjectNameForXsSecurity(yamlContent, timestamp);
45
+ await writeCfTemplates(basePath, variant, fullConfig, fs);
46
+ await writeCfUI5Yaml(fullConfig.project.folder, fullConfig, fs);
55
47
  return fs;
56
48
  }
57
49
  /**
@@ -65,9 +57,9 @@ function setDefaults(config) {
65
57
  ...config,
66
58
  app: {
67
59
  ...config.app,
68
- appType: config.app.appType ?? (0, source_1.getApplicationType)(config.app.manifest),
69
- i18nModels: config.app.i18nModels ?? (0, i18n_1.getI18nModels)(config.app.manifest, config.app.layer, config.app.id),
70
- i18nDescription: config.app.i18nDescription ?? (0, i18n_1.getI18nDescription)(config.app.layer, config.app.title)
60
+ appType: config.app.appType ?? getApplicationType(config.app.manifest),
61
+ i18nModels: config.app.i18nModels ?? getI18nModels(config.app.manifest, config.app.layer, config.app.id),
62
+ i18nDescription: config.app.i18nDescription ?? getI18nDescription(config.app.layer, config.app.title)
71
63
  },
72
64
  options: {
73
65
  addStandaloneApprouter: false,
@@ -84,10 +76,10 @@ function setDefaults(config) {
84
76
  * @param ui5AppInfo - ui5AppInfo.json content
85
77
  * @param logger - logger instance
86
78
  */
87
- async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
79
+ export async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
88
80
  try {
89
- const ui5AppInfoTargetPath = (0, node_path_1.join)(basePath, 'ui5AppInfo.json');
90
- node_fs_1.default.writeFileSync(ui5AppInfoTargetPath, JSON.stringify(ui5AppInfo, null, 2), 'utf-8');
81
+ const ui5AppInfoTargetPath = join(basePath, 'ui5AppInfo.json');
82
+ fs.writeFileSync(ui5AppInfoTargetPath, JSON.stringify(ui5AppInfo, null, 2), 'utf-8');
91
83
  logger?.info(`Written ui5AppInfo.json to ${basePath}`);
92
84
  }
93
85
  catch (error) {
@@ -104,29 +96,29 @@ async function writeUi5AppInfo(basePath, ui5AppInfo, logger) {
104
96
  * @param cfConfig - CF configuration
105
97
  * @param logger - logger instance
106
98
  */
107
- async function setupCfPreview(basePath, yamlPath, cfConfig, logger) {
108
- const ui5Config = await (0, project_access_1.readUi5Yaml)(basePath, yamlPath);
99
+ export async function setupCfPreview(basePath, yamlPath, cfConfig, logger) {
100
+ const ui5Config = await readUi5Yaml(basePath, yamlPath);
109
101
  const bundlerTask = ui5Config.findCustomTask('app-variant-bundler-build');
110
102
  const serviceInstanceName = bundlerTask?.configuration?.serviceInstanceName;
111
103
  if (!serviceInstanceName) {
112
104
  throw new Error('No serviceInstanceName found in app-variant-bundler-build configuration');
113
105
  }
114
- const serviceInfo = await (0, cf_1.getOrCreateServiceInstanceKeys)({
106
+ const serviceInfo = await getOrCreateServiceInstanceKeys({
115
107
  names: [serviceInstanceName],
116
108
  spaceGuids: [bundlerTask?.configuration?.space ?? '']
117
109
  }, logger);
118
110
  if (!serviceInfo || serviceInfo.serviceKeys.length === 0) {
119
111
  throw new Error(`No service keys found for service instance: ${serviceInstanceName}`);
120
112
  }
121
- const appId = await (0, helper_1.getBaseAppId)(basePath);
122
- const appHostIds = (0, discovery_1.getAppHostIds)(serviceInfo.serviceKeys);
123
- const ui5AppInfo = await (0, cf_1.getCfUi5AppInfo)(appId, appHostIds, cfConfig, logger);
113
+ const appId = await getBaseAppId(basePath);
114
+ const appHostIds = getAppHostIds(serviceInfo.serviceKeys);
115
+ const ui5AppInfo = await getCfUi5AppInfo(appId, appHostIds, cfConfig, logger);
124
116
  if (appHostIds.length === 0) {
125
117
  throw new Error('No app host IDs found in service keys.');
126
118
  }
127
119
  await writeUi5AppInfo(basePath, ui5AppInfo, logger);
128
120
  logger?.log('Starting build');
129
- await (0, project_builder_1.runBuild)(basePath, { ADP_BUILDER_MODE: 'preview' });
121
+ await runBuild(basePath, { ADP_BUILDER_MODE: 'preview' });
130
122
  logger?.log('Build completed');
131
123
  }
132
124
  //# sourceMappingURL=cf.js.map
@@ -1,6 +1,6 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import { ChangeType } from '../../types';
3
- import type { IWriterData } from '../../types';
2
+ import { ChangeType } from '../../types.js';
3
+ import type { IWriterData } from '../../types.js';
4
4
  /**
5
5
  * Handles the creation of a writer instance based on the generator type.
6
6
  */
@@ -1,18 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WriterFactory = void 0;
4
- const writers_1 = require("./writers");
1
+ import { ChangeType } from '../../types.js';
2
+ import { AnnotationsWriter, ComponentUsagesWriter, NewModelWriter, DataSourceWriter, InboundWriter } from './writers/index.js';
5
3
  /**
6
4
  * Handles the creation of a writer instance based on the generator type.
7
5
  */
8
- class WriterFactory {
6
+ export class WriterFactory {
9
7
  static writers = new Map([
10
- ["appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */, writers_1.AnnotationsWriter],
11
- ["appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */, writers_1.ComponentUsagesWriter],
12
- ["appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */, writers_1.ComponentUsagesWriter],
13
- ["appdescr_ui5_addNewModel" /* ChangeType.ADD_NEW_MODEL */, writers_1.NewModelWriter],
14
- ["appdescr_app_changeDataSource" /* ChangeType.CHANGE_DATA_SOURCE */, writers_1.DataSourceWriter],
15
- ["appdescr_app_changeInbound" /* ChangeType.CHANGE_INBOUND */, writers_1.InboundWriter]
8
+ [ChangeType.ADD_ANNOTATIONS_TO_ODATA, AnnotationsWriter],
9
+ [ChangeType.ADD_COMPONENT_USAGES, ComponentUsagesWriter],
10
+ [ChangeType.ADD_LIBRARY_REFERENCE, ComponentUsagesWriter],
11
+ [ChangeType.ADD_NEW_MODEL, NewModelWriter],
12
+ [ChangeType.CHANGE_DATA_SOURCE, DataSourceWriter],
13
+ [ChangeType.CHANGE_INBOUND, InboundWriter]
16
14
  ]);
17
15
  /**
18
16
  * Creates an instance of a writer based on the specified generator type.
@@ -29,11 +27,10 @@ class WriterFactory {
29
27
  if (!WriterClass) {
30
28
  throw new Error(`Unsupported generator type: ${type}`);
31
29
  }
32
- if (type === "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */) {
30
+ if (type === ChangeType.ADD_ANNOTATIONS_TO_ODATA) {
33
31
  return new WriterClass(fs, projectPath, templatesPath);
34
32
  }
35
33
  return new WriterClass(fs, projectPath);
36
34
  }
37
35
  }
38
- exports.WriterFactory = WriterFactory;
39
36
  //# sourceMappingURL=writer-factory.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import { type IWriter, type AnnotationsData } from '../../../types';
2
+ import { type IWriter, type AnnotationsData } from '../../../types.js';
3
3
  /**
4
4
  * Handles the creation and writing of annotations data changes for a project.
5
5
  */
@@ -1,45 +1,11 @@
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.AnnotationsWriter = void 0;
37
- const node_path_1 = __importStar(require("node:path"));
38
- const change_utils_1 = require("../../../base/change-utils");
1
+ import path, { isAbsolute } from 'node:path';
2
+ import { ChangeType } from '../../../types.js';
3
+ import { FlexLayer } from '../../../types.js';
4
+ import { getChange, writeAnnotationChange } from '../../../base/change-utils.js';
39
5
  /**
40
6
  * Handles the creation and writing of annotations data changes for a project.
41
7
  */
42
- class AnnotationsWriter {
8
+ export class AnnotationsWriter {
43
9
  fs;
44
10
  projectPath;
45
11
  templatesPath;
@@ -62,7 +28,7 @@ class AnnotationsWriter {
62
28
  constructContent(data) {
63
29
  const { variant: { layer }, annotation: { dataSource, fileName } } = data;
64
30
  const annotationFileNameWithoutExtension = fileName?.toLocaleLowerCase().replace('.xml', '');
65
- const annotationNameSpace = layer === "CUSTOMER_BASE" /* FlexLayer.CUSTOMER_BASE */
31
+ const annotationNameSpace = layer === FlexLayer.CUSTOMER_BASE
66
32
  ? `customer.annotation.${annotationFileNameWithoutExtension}`
67
33
  : `annotation.${annotationFileNameWithoutExtension}`;
68
34
  return {
@@ -84,7 +50,7 @@ class AnnotationsWriter {
84
50
  * @returns {string | undefined} The determined filename for the annotation file.
85
51
  */
86
52
  getAnnotationFileName({ annotation }) {
87
- return annotation.filePath ? node_path_1.default.basename(annotation.filePath) : `annotation_${Date.now()}.xml`;
53
+ return annotation.filePath ? path.basename(annotation.filePath) : `annotation_${Date.now()}.xml`;
88
54
  }
89
55
  /**
90
56
  * Writes the annotation change to the project based on the provided data.
@@ -96,19 +62,18 @@ class AnnotationsWriter {
96
62
  const { variant, annotation } = data;
97
63
  annotation.fileName = annotation.fileName ?? this.getAnnotationFileName(data);
98
64
  if (annotation.filePath) {
99
- annotation.filePath = (0, node_path_1.isAbsolute)(annotation.filePath)
65
+ annotation.filePath = isAbsolute(annotation.filePath)
100
66
  ? annotation.filePath
101
- : node_path_1.default.join(this.projectPath, annotation.filePath);
67
+ : path.join(this.projectPath, annotation.filePath);
102
68
  }
103
69
  const content = this.constructContent(data);
104
70
  const timestamp = Date.now();
105
71
  let change;
106
72
  // When created via command change need to be created else change is created via RTA.
107
73
  if (data.isCommand) {
108
- change = (0, change_utils_1.getChange)(variant, timestamp, content, "appdescr_app_addAnnotationsToOData" /* ChangeType.ADD_ANNOTATIONS_TO_ODATA */);
74
+ change = getChange(variant, timestamp, content, ChangeType.ADD_ANNOTATIONS_TO_ODATA);
109
75
  }
110
- await (0, change_utils_1.writeAnnotationChange)(this.projectPath, timestamp, data.annotation, change, this.fs, this.templatesPath);
76
+ await writeAnnotationChange(this.projectPath, timestamp, data.annotation, change, this.fs, this.templatesPath);
111
77
  }
112
78
  }
113
- exports.AnnotationsWriter = AnnotationsWriter;
114
79
  //# sourceMappingURL=annotations-writer.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { IWriter, ComponentUsagesData } from '../../../types';
2
+ import type { IWriter, ComponentUsagesData } from '../../../types.js';
3
3
  /**
4
4
  * Handles the creation and writing of component usages data changes for a project.
5
5
  */
@@ -1,11 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentUsagesWriter = void 0;
4
- const change_utils_1 = require("../../../base/change-utils");
1
+ import { ChangeType } from '../../../types.js';
2
+ import { parseStringToObject, getChange, writeChangeToFolder } from '../../../base/change-utils.js';
5
3
  /**
6
4
  * Handles the creation and writing of component usages data changes for a project.
7
5
  */
8
- class ComponentUsagesWriter {
6
+ export class ComponentUsagesWriter {
9
7
  fs;
10
8
  projectPath;
11
9
  /**
@@ -28,8 +26,8 @@ class ComponentUsagesWriter {
28
26
  [usageId]: {
29
27
  name,
30
28
  lazy: isLazy === 'true',
31
- settings: (0, change_utils_1.parseStringToObject)(settings),
32
- componentData: (0, change_utils_1.parseStringToObject)(data)
29
+ settings: parseStringToObject(settings),
30
+ componentData: parseStringToObject(data)
33
31
  }
34
32
  };
35
33
  return {
@@ -61,16 +59,15 @@ class ComponentUsagesWriter {
61
59
  async write(data) {
62
60
  const componentUsagesContent = this.constructContent(data);
63
61
  const timestamp = Date.now();
64
- const compUsagesChange = (0, change_utils_1.getChange)(data.variant, timestamp, componentUsagesContent, "appdescr_ui5_addComponentUsages" /* ChangeType.ADD_COMPONENT_USAGES */);
65
- await (0, change_utils_1.writeChangeToFolder)(this.projectPath, compUsagesChange, this.fs);
62
+ const compUsagesChange = getChange(data.variant, timestamp, componentUsagesContent, ChangeType.ADD_COMPONENT_USAGES);
63
+ await writeChangeToFolder(this.projectPath, compUsagesChange, this.fs);
66
64
  if (!('library' in data)) {
67
65
  return;
68
66
  }
69
67
  const libRefContent = this.constructLibContent(data);
70
68
  const libTimestamp = timestamp + 1;
71
- const refLibChange = (0, change_utils_1.getChange)(data.variant, libTimestamp, libRefContent, "appdescr_ui5_addLibraries" /* ChangeType.ADD_LIBRARY_REFERENCE */);
72
- await (0, change_utils_1.writeChangeToFolder)(this.projectPath, refLibChange, this.fs);
69
+ const refLibChange = getChange(data.variant, libTimestamp, libRefContent, ChangeType.ADD_LIBRARY_REFERENCE);
70
+ await writeChangeToFolder(this.projectPath, refLibChange, this.fs);
73
71
  }
74
72
  }
75
- exports.ComponentUsagesWriter = ComponentUsagesWriter;
76
73
  //# sourceMappingURL=component-usages-writer.js.map
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { IWriter, DataSourceData } from '../../../types';
2
+ import type { IWriter, DataSourceData } from '../../../types.js';
3
3
  /**
4
4
  * Handles the creation and writing of data source data changes for a project.
5
5
  */