@sap-ux/inquirer-common 0.5.14 → 0.5.15

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.
@@ -14,6 +14,7 @@ export declare enum ERROR_TYPE {
14
14
  CERT_UKNOWN_OR_INVALID = "CERT_UKNOWN_OR_INVALID",
15
15
  CERT_EXPIRED = "CERT_EXPIRED",
16
16
  CERT_SELF_SIGNED_CERT_IN_CHAIN = "CERT_SELF_SIGNED_CERT_IN_CHAIN",
17
+ INVALID_SSL_CERTIFICATE = "INVALID_SSL_CERTIFICATE",
17
18
  UNKNOWN = "UNKNOWN",
18
19
  INVALID_URL = "INVALID_URL",
19
20
  TIMEOUT = "TIMEOUT",
@@ -24,6 +24,7 @@ var ERROR_TYPE;
24
24
  ERROR_TYPE["CERT_UKNOWN_OR_INVALID"] = "CERT_UKNOWN_OR_INVALID";
25
25
  ERROR_TYPE["CERT_EXPIRED"] = "CERT_EXPIRED";
26
26
  ERROR_TYPE["CERT_SELF_SIGNED_CERT_IN_CHAIN"] = "CERT_SELF_SIGNED_CERT_IN_CHAIN";
27
+ ERROR_TYPE["INVALID_SSL_CERTIFICATE"] = "INVALID_SSL_CERTIFICATE";
27
28
  ERROR_TYPE["UNKNOWN"] = "UNKNOWN";
28
29
  ERROR_TYPE["INVALID_URL"] = "INVALID_URL";
29
30
  ERROR_TYPE["TIMEOUT"] = "TIMEOUT";
@@ -67,6 +68,7 @@ exports.ERROR_MAP = {
67
68
  [ERROR_TYPE.CERT_EXPIRED]: [/CERT_HAS_EXPIRED/],
68
69
  [ERROR_TYPE.CERT_SELF_SIGNED]: [/DEPTH_ZERO_SELF_SIGNED_CERT/],
69
70
  [ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: [/SELF_SIGNED_CERT_IN_CHAIN/],
71
+ [ERROR_TYPE.INVALID_SSL_CERTIFICATE]: [/526/, /Invalid SSL Certificate/], // Cloud Foundry and Cloudflare specific
70
72
  [ERROR_TYPE.UNKNOWN]: [],
71
73
  [ERROR_TYPE.CONNECTION]: [/ENOTFOUND/, /ECONNRESET/, /ECONNREFUSED/, /ConnectionError/],
72
74
  [ERROR_TYPE.SERVICES_UNAVAILABLE]: [],
@@ -164,6 +166,9 @@ class ErrorHandler {
164
166
  [ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: () => (0, i18n_1.t)('errors.urlCertValidationError', {
165
167
  certErrorReason: (0, i18n_1.t)('texts.anUntrustedRootCert')
166
168
  }),
169
+ [ERROR_TYPE.INVALID_SSL_CERTIFICATE]: () => (0, i18n_1.t)('errors.urlCertValidationError', {
170
+ certErrorReason: (0, i18n_1.t)('texts.anUnknownOrInvalidCert')
171
+ }),
167
172
  [ERROR_TYPE.AUTH]: (error) => (0, i18n_1.t)('errors.authenticationFailed', {
168
173
  error: ErrorHandler.getMessageFromError(error)
169
174
  }),
@@ -178,7 +183,7 @@ class ErrorHandler {
178
183
  }),
179
184
  [ERROR_TYPE.SERVICES_UNAVAILABLE]: () => (0, i18n_1.t)('errors.servicesUnavailable'),
180
185
  [ERROR_TYPE.SERVICE_UNAVAILABLE]: (error) => (0, i18n_1.t)('errors.serverReturnedAnError', {
181
- errorMsg: ErrorHandler.getMessageFromError(error)
186
+ errorDesc: ErrorHandler.getMessageFromError(error)
182
187
  }),
183
188
  [ERROR_TYPE.CATALOG_SERVICE_NOT_ACTIVE]: () => (0, i18n_1.t)('errors.catalogServiceNotActive'),
184
189
  [ERROR_TYPE.INTERNAL_SERVER_ERROR]: (error) => {
@@ -240,6 +245,7 @@ class ErrorHandler {
240
245
  [ERROR_TYPE.CERT]: guided_answers_helper_1.HELP_NODES.CERTIFICATE_ERROR,
241
246
  [ERROR_TYPE.CERT_SELF_SIGNED]: guided_answers_helper_1.HELP_NODES.CERTIFICATE_ERROR,
242
247
  [ERROR_TYPE.CERT_UKNOWN_OR_INVALID]: guided_answers_helper_1.HELP_NODES.CERTIFICATE_ERROR,
248
+ [ERROR_TYPE.INVALID_SSL_CERTIFICATE]: guided_answers_helper_1.HELP_NODES.CERTIFICATE_ERROR,
243
249
  [ERROR_TYPE.CERT_SELF_SIGNED_CERT_IN_CHAIN]: guided_answers_helper_1.HELP_NODES.CERTIFICATE_ERROR,
244
250
  [ERROR_TYPE.DESTINATION_MISCONFIGURED]: guided_answers_helper_1.HELP_NODES.DESTINATION_MISCONFIGURED,
245
251
  [ERROR_TYPE.DESTINATION_UNAVAILABLE]: guided_answers_helper_1.HELP_NODES.DESTINATION_UNAVAILABLE,
@@ -501,6 +507,10 @@ class ErrorHandler {
501
507
  // We cannot tell in BAS what this means, so we will just say the connection failed
502
508
  destErrorType = ERROR_TYPE.DESTINATION_CONNECTION_ERROR;
503
509
  }
510
+ else if (errorType === ERROR_TYPE.AUTH && destination.Authentication !== btp_utils_1.Authentication.NO_AUTHENTICATION) {
511
+ // Auth errors for destinations are usually misconfiguration, unless the `Authentication` property is set to `NoAuthentication`
512
+ destErrorMsg = this.getErrorMsgFromType(ERROR_TYPE.AUTH, (0, i18n_1.t)('texts.checkDestinationAuthConfig'));
513
+ }
504
514
  // Always raise a telemetry event for destination related errors
505
515
  (0, telemetry_1.sendTelemetryEvent)(telemBasError, {
506
516
  basErrorType: destErrorType ?? errorType,
@@ -23,7 +23,7 @@ export declare function sendTelemetryEvent(eventName: string, telemetryData: Tel
23
23
  /**
24
24
  * Used only to generate telemetry events in the case of destination errors.
25
25
  *
26
- * @param destination
26
+ * @param destination the destination used to set the telemetry destination type
27
27
  * @returns the telemetry property destination type
28
28
  */
29
29
  export declare function getTelemPropertyDestinationType(destination: Destination): TelemPropertyDestinationType;
@@ -64,7 +64,7 @@ function createTelemetryEvent(eventName, telemetryData) {
64
64
  /**
65
65
  * Used only to generate telemetry events in the case of destination errors.
66
66
  *
67
- * @param destination
67
+ * @param destination the destination used to set the telemetry destination type
68
68
  * @returns the telemetry property destination type
69
69
  */
70
70
  function getTelemPropertyDestinationType(destination) {
@@ -48,6 +48,7 @@
48
48
  "anUnknownOrInvalidCert": "an unknown or invalid",
49
49
  "anUntrustedRootCert": "an untrusted root",
50
50
  "suggestedSystemNameClient": ", client {{client}}",
51
- "seeLogForDetails": "See log for more details."
51
+ "seeLogForDetails": "See log for more details.",
52
+ "checkDestinationAuthConfig": "Please check the SAP BTP destination authentication configuration."
52
53
  }
53
54
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/inquirer-common",
3
3
  "description": "Commonly used shared functionality and types to support inquirer modules.",
4
- "version": "0.5.14",
4
+ "version": "0.5.15",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",