@sap-ux/adp-tooling 0.14.30 → 0.14.32

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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Checks if the current environment is offline or has network connectivity issues.
3
+ * This function is designed for VS Code's Yeoman UI environment where network
4
+ * errors may differ from browser environments.
5
+ *
6
+ * @param {Error} error - The error object from a failed fetch request.
7
+ * @returns {boolean} True if the error indicates offline/network issues.
8
+ */
9
+ export declare function isOfflineError(error: Error): boolean;
10
+ //# sourceMappingURL=network.d.ts.map
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOfflineError = isOfflineError;
4
+ /**
5
+ * In VS Code extension host, we can't rely on navigator.onLine.
6
+ * Focus on error messages that indicate network connectivity issues
7
+ */
8
+ const networkErrorMessages = [
9
+ 'fetch failed',
10
+ 'Failed to fetch',
11
+ 'NetworkError',
12
+ 'ENOTFOUND', // DNS resolution failed (common in VS Code)
13
+ 'ECONNREFUSED', // Connection refused (can indicate network issues)
14
+ 'ETIMEDOUT', // Connection timeout
15
+ 'ENETUNREACH', // Network unreachable
16
+ 'getaddrinfo ENOTFOUND', // Node.js DNS error
17
+ 'connect ECONNREFUSED', // Node.js connection refused
18
+ 'connect ETIMEDOUT' // Node.js connection timeout
19
+ ];
20
+ /**
21
+ * Checks if the current environment is offline or has network connectivity issues.
22
+ * This function is designed for VS Code's Yeoman UI environment where network
23
+ * errors may differ from browser environments.
24
+ *
25
+ * @param {Error} error - The error object from a failed fetch request.
26
+ * @returns {boolean} True if the error indicates offline/network issues.
27
+ */
28
+ function isOfflineError(error) {
29
+ return networkErrorMessages.some((msg) => error.message?.includes(msg) || error.name?.includes(msg));
30
+ }
31
+ //# sourceMappingURL=network.js.map
@@ -4,6 +4,7 @@ exports.validateUI5VersionExists = validateUI5VersionExists;
4
4
  const project_input_validator_1 = require("@sap-ux/project-input-validator");
5
5
  const i18n_1 = require("../i18n");
6
6
  const format_1 = require("./format");
7
+ const network_1 = require("./network");
7
8
  /**
8
9
  * Validates a specified UI5 version by checking its availability on the SAP CDN.
9
10
  *
@@ -26,9 +27,12 @@ async function validateUI5VersionExists(version) {
26
27
  const message = (0, i18n_1.t)('validators.ui5VersionNotReachableError');
27
28
  return `${message.replace('<URL>', selectedVersionURL)}`;
28
29
  }
29
- if (e.response.status === 400 || e.response.status === 404) {
30
+ if (e.response?.status === 400 || e.response?.status === 404) {
30
31
  return (0, i18n_1.t)('validators.ui5VersionOutdatedError');
31
32
  }
33
+ if ((0, network_1.isOfflineError)(e)) {
34
+ return true;
35
+ }
32
36
  return (0, i18n_1.t)('validators.ui5VersionDoesNotExistGeneric', { error: e.message });
33
37
  }
34
38
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
11
11
  },
12
- "version": "0.14.30",
12
+ "version": "0.14.32",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -35,17 +35,17 @@
35
35
  "uuid": "10.0.0",
36
36
  "@sap-ux/axios-extension": "1.22.3",
37
37
  "@sap-ux/btp-utils": "1.1.0",
38
- "@sap-ux/inquirer-common": "0.7.15",
38
+ "@sap-ux/inquirer-common": "0.7.16",
39
39
  "@sap-ux/logger": "0.7.0",
40
40
  "@sap-ux/project-access": "1.30.3",
41
- "@sap-ux/project-input-validator": "0.6.4",
42
- "@sap-ux/system-access": "0.6.8",
41
+ "@sap-ux/project-input-validator": "0.6.5",
42
+ "@sap-ux/system-access": "0.6.9",
43
43
  "@sap-ux/ui5-config": "0.28.2",
44
- "@sap-ux/ui5-info": "0.12.0",
45
44
  "@sap-ux/odata-service-writer": "0.27.6",
46
45
  "@sap-ux/nodejs-utils": "0.2.1",
46
+ "@sap-ux/ui5-info": "0.12.0",
47
47
  "@sap-ux/i18n": "0.3.1",
48
- "@sap-ux/store": "1.1.0"
48
+ "@sap-ux/store": "1.1.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/adm-zip": "0.5.5",
@@ -63,7 +63,7 @@
63
63
  "rimraf": "5.0.5",
64
64
  "supertest": "6.3.3",
65
65
  "cross-env": "^7.0.3",
66
- "@sap-ux/store": "1.1.0"
66
+ "@sap-ux/store": "1.1.1"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=20.x"