@sap-ux/adp-tooling 1.0.53 → 1.0.54

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.
@@ -12,7 +12,8 @@ export declare function fetchPublicVersions(logger?: ToolsLogger): Promise<UI5Ve
12
12
  * Fetches internal UI5 versions from the Neo CDN and maps them to formatted version strings.
13
13
  *
14
14
  * @param {string} latestVersion - The latest public UI5 version.
15
+ * @param {ToolsLogger} logger - Optional logger instance.
15
16
  * @returns {Promise<string[]>} A promise that resolves to an array of formatted internal version strings.
16
17
  */
17
- export declare function fetchInternalVersions(latestVersion: string): Promise<string[]>;
18
+ export declare function fetchInternalVersions(latestVersion: string, logger?: ToolsLogger): Promise<string[]>;
18
19
  //# sourceMappingURL=fetch.d.ts.map
package/dist/ui5/fetch.js CHANGED
@@ -1,3 +1,5 @@
1
+ import axios from 'axios';
2
+ import { getProxyAgentConfig, isAxiosError } from '@sap-ux/axios-extension';
1
3
  import { buildFallbackMap } from './format.js';
2
4
  import { UI5_VERSIONS_CDN_URL, UI5_VERSIONS_NEO_CDN_URL, LATEST_VERSION } from '../base/constants/index.js';
3
5
  /**
@@ -9,11 +11,8 @@ import { UI5_VERSIONS_CDN_URL, UI5_VERSIONS_NEO_CDN_URL, LATEST_VERSION } from '
9
11
  */
10
12
  export async function fetchPublicVersions(logger) {
11
13
  try {
12
- const response = await fetch(UI5_VERSIONS_CDN_URL);
13
- if (!response.ok) {
14
- throw new Error(`Failed to fetch public UI5 versions. Status: ${response.status}`);
15
- }
16
- return (await response.json());
14
+ const { data } = await axios.get(UI5_VERSIONS_CDN_URL, getProxyAgentConfig(UI5_VERSIONS_CDN_URL));
15
+ return data;
17
16
  }
18
17
  catch (e) {
19
18
  logger?.warn('[ui5-info] Falling back to built-in UI5 version list: ' + (e instanceof Error ? e.message : String(e)));
@@ -24,15 +23,25 @@ export async function fetchPublicVersions(logger) {
24
23
  * Fetches internal UI5 versions from the Neo CDN and maps them to formatted version strings.
25
24
  *
26
25
  * @param {string} latestVersion - The latest public UI5 version.
26
+ * @param {ToolsLogger} logger - Optional logger instance.
27
27
  * @returns {Promise<string[]>} A promise that resolves to an array of formatted internal version strings.
28
28
  */
29
- export async function fetchInternalVersions(latestVersion) {
30
- const response = await fetch(UI5_VERSIONS_NEO_CDN_URL);
31
- const data = await response.json();
32
- return data?.routes?.map((route) => {
29
+ export async function fetchInternalVersions(latestVersion, logger) {
30
+ let data;
31
+ try {
32
+ ({ data } = await axios.get(UI5_VERSIONS_NEO_CDN_URL, getProxyAgentConfig(UI5_VERSIONS_NEO_CDN_URL)));
33
+ }
34
+ catch (e) {
35
+ if (isAxiosError(e) && e.response) {
36
+ logger?.warn('[ui5-info] Could not fetch internal UI5 versions: ' + (e instanceof Error ? e.message : String(e)));
37
+ return [];
38
+ }
39
+ throw e;
40
+ }
41
+ return (data?.routes?.map((route) => {
33
42
  return route.target.version === latestVersion
34
43
  ? `${route.target.version} ${LATEST_VERSION}`
35
44
  : route.target.version;
36
- });
45
+ }) ?? []);
37
46
  }
38
47
  //# sourceMappingURL=fetch.js.map
@@ -1,5 +1,6 @@
1
1
  import { validateEmptyString } from '@sap-ux/project-input-validator';
2
2
  import axios from 'axios';
3
+ import { getProxyAgentConfig } from '@sap-ux/axios-extension';
3
4
  import { t } from '../i18n.js';
4
5
  import { getOfficialBaseUI5VersionUrl, getFormattedVersion } from './format.js';
5
6
  import { isOfflineError } from './network.js';
@@ -17,7 +18,8 @@ export async function validateUI5VersionExists(version) {
17
18
  const selectedVersionURL = getOfficialBaseUI5VersionUrl(version);
18
19
  const resource = version.includes('snapshot') ? 'neo-app.json' : getFormattedVersion(version);
19
20
  try {
20
- await axios.get(`${selectedVersionURL}/${resource}`);
21
+ const url = `${selectedVersionURL}/${resource}`;
22
+ await axios.get(url, getProxyAgentConfig(url));
21
23
  return true;
22
24
  }
23
25
  catch (e) {
@@ -1,3 +1,4 @@
1
+ import type { ToolsLogger } from '@sap-ux/logger';
1
2
  import type { UI5Version } from '../types.js';
2
3
  export interface VersionLabels {
3
4
  formattedVersion: string;
@@ -64,9 +65,10 @@ export declare function checkSystemVersionPattern(version: string | undefined):
64
65
  * and then filters them based on a minimum supported version (in this case '1.71.0').
65
66
  *
66
67
  * @param {string} latestVersion - The latest public version string.
68
+ * @param {ToolsLogger} logger - Optional logger instance.
67
69
  * @returns {Promise<string[]>} A promise that resolves to an array of internal version strings.
68
70
  */
69
- export declare function getInternalVersions(latestVersion: string): Promise<string[]>;
71
+ export declare function getInternalVersions(latestVersion: string, logger?: ToolsLogger): Promise<string[]>;
70
72
  /**
71
73
  * Fetches versions that are higher than the specified version.
72
74
  *
@@ -86,7 +88,8 @@ export declare function getHigherVersions(version: string, publicVersions: UI5Ve
86
88
  * @param {string | undefined} systemVersion - The current system version (can be undefined).
87
89
  * @param {boolean} isCustomerBase - Indicates if the project is customer based.
88
90
  * @param {UI5Version} publicVersions - The public UI5 version data.
91
+ * @param {ToolsLogger} logger - Optional logger instance.
89
92
  * @returns {Promise<string[]>} A promise that resolves to an array of relevant version strings.
90
93
  */
91
- export declare function getRelevantVersions(systemVersion: string | undefined, isCustomerBase: boolean, publicVersions: UI5Version): Promise<string[]>;
94
+ export declare function getRelevantVersions(systemVersion: string | undefined, isCustomerBase: boolean, publicVersions: UI5Version, logger?: ToolsLogger): Promise<string[]>;
92
95
  //# sourceMappingURL=version-info.d.ts.map
@@ -97,10 +97,11 @@ export function checkSystemVersionPattern(version) {
97
97
  * and then filters them based on a minimum supported version (in this case '1.71.0').
98
98
  *
99
99
  * @param {string} latestVersion - The latest public version string.
100
+ * @param {ToolsLogger} logger - Optional logger instance.
100
101
  * @returns {Promise<string[]>} A promise that resolves to an array of internal version strings.
101
102
  */
102
- export async function getInternalVersions(latestVersion) {
103
- const releasedVersions = await fetchInternalVersions(latestVersion);
103
+ export async function getInternalVersions(latestVersion, logger) {
104
+ const releasedVersions = await fetchInternalVersions(latestVersion, logger);
104
105
  return releasedVersions.filter((version) => isFeatureSupportedVersion('1.71.0', version));
105
106
  }
106
107
  /**
@@ -135,9 +136,10 @@ export async function getHigherVersions(version, publicVersions) {
135
136
  * @param {string | undefined} systemVersion - The current system version (can be undefined).
136
137
  * @param {boolean} isCustomerBase - Indicates if the project is customer based.
137
138
  * @param {UI5Version} publicVersions - The public UI5 version data.
139
+ * @param {ToolsLogger} logger - Optional logger instance.
138
140
  * @returns {Promise<string[]>} A promise that resolves to an array of relevant version strings.
139
141
  */
140
- export async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions) {
142
+ export async function getRelevantVersions(systemVersion, isCustomerBase, publicVersions, logger) {
141
143
  let formattedVersion = '', systemSnapshotLabel = '', systemLatestLabel = '';
142
144
  const latestPublicVersion = publicVersions?.latest?.version;
143
145
  let versions = [];
@@ -145,7 +147,7 @@ export async function getRelevantVersions(systemVersion, isCustomerBase, publicV
145
147
  ({ formattedVersion, systemSnapshotLabel, systemLatestLabel } = getVersionLabels(systemVersion, publicVersions));
146
148
  }
147
149
  if (!isCustomerBase) {
148
- versions = await getInternalVersions(latestPublicVersion);
150
+ versions = await getInternalVersions(latestPublicVersion, logger);
149
151
  if (formattedVersion) {
150
152
  const regex = new RegExp(`${formattedVersion} `, 'g');
151
153
  versions = versions.map((v) => v.replace(regex, `${formattedVersion}${systemSnapshotLabel} ${CURRENT_SYSTEM_VERSION}`));
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
12
12
  },
13
- "version": "1.0.53",
13
+ "version": "1.0.54",
14
14
  "license": "Apache-2.0",
15
15
  "author": "@SAP/ux-tools-team",
16
16
  "main": "dist/index.js",
@@ -37,17 +37,17 @@
37
37
  "prompts": "2.4.2",
38
38
  "sanitize-filename": "1.6.4",
39
39
  "uuid": "11.1.1",
40
- "@sap-ux/axios-extension": "2.0.10",
40
+ "@sap-ux/axios-extension": "2.1.0",
41
41
  "@sap-ux/btp-utils": "2.0.6",
42
42
  "@sap-ux/i18n": "1.0.3",
43
- "@sap-ux/inquirer-common": "1.0.40",
43
+ "@sap-ux/inquirer-common": "1.0.41",
44
44
  "@sap-ux/logger": "1.0.3",
45
45
  "@sap-ux/nodejs-utils": "1.0.10",
46
46
  "@sap-ux/odata-service-writer": "1.0.22",
47
47
  "@sap-ux/project-access": "2.2.0",
48
48
  "@sap-ux/project-input-validator": "1.0.19",
49
49
  "@sap-ux/store": "2.0.7",
50
- "@sap-ux/system-access": "1.0.13",
50
+ "@sap-ux/system-access": "1.0.14",
51
51
  "@sap-ux/ui5-config": "1.0.9",
52
52
  "@sap-ux/ui5-info": "1.0.6"
53
53
  },