@sipgate/integration-bridge 1.0.35 → 1.0.36

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,5 @@
1
+ import { IntegrationErrorType, ServerError } from '../../models';
2
+ export declare class DelegateToFrontedError extends ServerError {
3
+ errorType: IntegrationErrorType;
4
+ constructor(errorType: IntegrationErrorType);
5
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DelegateToFrontedError = void 0;
4
+ const models_1 = require("../../models");
5
+ class DelegateToFrontedError extends models_1.ServerError {
6
+ constructor(errorType) {
7
+ super(models_1.DELEGATE_TO_FRONTEND_CODE, errorType);
8
+ this.errorType = errorType;
9
+ this.name = 'DelegateToFrontedError';
10
+ }
11
+ }
12
+ exports.DelegateToFrontedError = DelegateToFrontedError;
13
+ //# sourceMappingURL=delegate-to-frontend.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegate-to-frontend.error.js","sourceRoot":"","sources":["../../../src/util/error/delegate-to-frontend.error.ts"],"names":[],"mappings":";;;AAAA,yCAIsB;AAEtB,MAAa,sBAAuB,SAAQ,oBAAW;IAGrD,YAAY,SAA+B;QACzC,KAAK,CAAC,kCAAyB,EAAE,SAAS,CAAC,CAAC;QAE5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AATD,wDASC"}
@@ -0,0 +1,12 @@
1
+ import { AxiosError } from 'axios';
2
+ import { ServerError } from '../../models';
3
+ import { DelegateToFrontedError } from './delegate-to-frontend.error';
4
+ /**
5
+ * Central error handler for calls from bridge.
6
+ *
7
+ * Logs the error, then maps the HTTP status to a semantic IntegrationErrorType
8
+ * and throws a ServerError with status 452 (DELEGATE_TO_FRONTEND_CODE) so the
9
+ * frontend can show an appropriate message. Unmapped status codes are re-thrown
10
+ * as-is; errors without any status become a generic 500.
11
+ */
12
+ export declare const throwAndDelegateError: (error: AxiosError | DelegateToFrontedError | ServerError | Error, source: string, apiKey: string | undefined, logMessage?: string, data?: object) => never;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throwAndDelegateError = void 0;
4
+ const axios_1 = require("axios");
5
+ const models_1 = require("../../models");
6
+ const logger_util_1 = require("../logger.util");
7
+ const delegate_to_frontend_error_1 = require("./delegate-to-frontend.error");
8
+ /**
9
+ * Maps CRM HTTP status codes to semantic error types that the frontend
10
+ * can act on (e.g. trigger re-auth on 401, show "not found" on 404).
11
+ * Unmapped status codes are passed through as-is.
12
+ */
13
+ const STATUS_TO_ERROR_TYPE = {
14
+ 401: models_1.IntegrationErrorType.INTEGRATION_UNAUTHORIZED_ERROR,
15
+ 403: models_1.IntegrationErrorType.INTEGRATION_ERROR_FORBIDDEN,
16
+ 404: models_1.IntegrationErrorType.ENTITY_NOT_FOUND,
17
+ 409: models_1.IntegrationErrorType.ENTITY_ERROR_CONFLICT,
18
+ 502: models_1.IntegrationErrorType.INTEGRATION_ERROR_UNAVAILABLE,
19
+ 503: models_1.IntegrationErrorType.INTEGRATION_ERROR_UNAVAILABLE,
20
+ 504: models_1.IntegrationErrorType.INTEGRATION_ERROR_UNAVAILABLE,
21
+ };
22
+ /**
23
+ * Extracts an HTTP status code from various error shapes thrown by CRM adapters.
24
+ * Adapters may throw AxiosErrors, ServerErrors, or plain objects with
25
+ * `.status`, `.response.status`, or `.code` — this normalises them all to a number.
26
+ */
27
+ const extractStatus = (error) => {
28
+ var _a, _b, _c;
29
+ if ((0, axios_1.isAxiosError)(error)) {
30
+ return (_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : error.status;
31
+ }
32
+ if (error instanceof models_1.ServerError) {
33
+ return error.status;
34
+ }
35
+ // Fallback for non-standard error objects from CRM SDKs
36
+ const err = error;
37
+ if (err.status != null) {
38
+ return typeof err.status === 'string'
39
+ ? parseInt(err.status, 10)
40
+ : err.status;
41
+ }
42
+ if (((_c = err.response) === null || _c === void 0 ? void 0 : _c.status) != null) {
43
+ return err.response.status;
44
+ }
45
+ if (err.code != null) {
46
+ const parsed = parseInt(err.code, 10);
47
+ return isNaN(parsed) ? undefined : parsed;
48
+ }
49
+ return undefined;
50
+ };
51
+ /** Prefers the CRM's response body (AxiosError) over the generic error message. */
52
+ const formatErrorMessage = (error) => {
53
+ var _a;
54
+ if ((0, axios_1.isAxiosError)(error) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)) {
55
+ return JSON.stringify(error.response.data);
56
+ }
57
+ return error.message;
58
+ };
59
+ /**
60
+ * Central error handler for calls from bridge.
61
+ *
62
+ * Logs the error, then maps the HTTP status to a semantic IntegrationErrorType
63
+ * and throws a ServerError with status 452 (DELEGATE_TO_FRONTEND_CODE) so the
64
+ * frontend can show an appropriate message. Unmapped status codes are re-thrown
65
+ * as-is; errors without any status become a generic 500.
66
+ */
67
+ const throwAndDelegateError = (error, source, apiKey, logMessage, data) => {
68
+ var _a;
69
+ // Already processed by an inner bridge call — re-throw without double-logging
70
+ if (error instanceof delegate_to_frontend_error_1.DelegateToFrontedError) {
71
+ throw error;
72
+ }
73
+ const status = extractStatus(error);
74
+ const errorMessage = formatErrorMessage(error);
75
+ (0, logger_util_1.errorLogger)(source, logMessage !== null && logMessage !== void 0 ? logMessage : errorMessage, apiKey, Object.assign(Object.assign(Object.assign(Object.assign({}, ((0, axios_1.isAxiosError)(error) && { data: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data })), { error, stackTrace: error.stack }), (logMessage && { message: errorMessage })), data));
76
+ // No recognisable status → treat as internal server error
77
+ if (status == null) {
78
+ throw new models_1.ServerError(500, `An internal error occurred: ${logMessage !== null && logMessage !== void 0 ? logMessage : error.message}`);
79
+ }
80
+ // Known status → delegate to frontend with a semantic error type
81
+ const errorType = STATUS_TO_ERROR_TYPE[status];
82
+ if (errorType) {
83
+ (0, logger_util_1.warnLogger)('throwAndDelegateError', `Delegating crm error to frontend with code ${models_1.DELEGATE_TO_FRONTEND_CODE} and type ${errorType}`, apiKey, logMessage);
84
+ throw new models_1.ServerError(models_1.DELEGATE_TO_FRONTEND_CODE, errorType);
85
+ }
86
+ // Unknown status (e.g. 422, 429) → pass through to the caller
87
+ throw new models_1.ServerError(status, `${source} (${errorMessage})`);
88
+ };
89
+ exports.throwAndDelegateError = throwAndDelegateError;
90
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/util/error/error.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,yCAIsB;AACtB,gDAAyD;AACzD,6EAAsE;AAEtE;;;;GAIG;AACH,MAAM,oBAAoB,GAAkD;IAC1E,GAAG,EAAE,6BAAoB,CAAC,8BAA8B;IACxD,GAAG,EAAE,6BAAoB,CAAC,2BAA2B;IACrD,GAAG,EAAE,6BAAoB,CAAC,gBAAgB;IAC1C,GAAG,EAAE,6BAAoB,CAAC,qBAAqB;IAC/C,GAAG,EAAE,6BAAoB,CAAC,6BAA6B;IACvD,GAAG,EAAE,6BAAoB,CAAC,6BAA6B;IACvD,GAAG,EAAE,6BAAoB,CAAC,6BAA6B;CACxD,CAAC;AAEF;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,KAAY,EAAsB,EAAE;;IACzD,IAAI,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE;QACvB,OAAO,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,mCAAI,KAAK,CAAC,MAAM,CAAC;KAC/C;IACD,IAAI,KAAK,YAAY,oBAAW,EAAE;QAChC,OAAO,KAAK,CAAC,MAAM,CAAC;KACrB;IAED,wDAAwD;IACxD,MAAM,GAAG,GAAG,KAA4B,CAAC;IACzC,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE;QACtB,OAAO,OAAO,GAAG,CAAC,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AAE,MAAM,8DACjD,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,EAAE,CAAC,KAC1D,KAAK,EACL,UAAU,EAAE,KAAK,CAAC,KAAK,KACpB,CAAC,UAAU,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,GACzC,IAAI,EACP,CAAC;IAEH,0DAA0D;IAC1D,IAAI,MAAM,IAAI,IAAI,EAAE;QAClB,MAAM,IAAI,oBAAW,CACnB,GAAG,EACH,+BAA+B,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,KAAK,CAAC,OAAO,EAAE,CAC7D,CAAC;KACH;IAED,iEAAiE;IACjE,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAE/C,IAAI,SAAS,EAAE;QACb,IAAA,wBAAU,EACR,uBAAuB,EACvB,8CAA8C,kCAAyB,aAAa,SAAS,EAAE,EAC/F,MAAM,EACN,UAAU,CACX,CAAC;QACF,MAAM,IAAI,oBAAW,CAAC,kCAAyB,EAAE,SAAS,CAAC,CAAC;KAC7D;IAED,8DAA8D;IAC9D,MAAM,IAAI,oBAAW,CAAC,MAAM,EAAE,GAAG,MAAM,KAAK,YAAY,GAAG,CAAC,CAAC;AAC/D,CAAC,CAAC;AA9CW,QAAA,qBAAqB,yBA8ChC"}
@@ -7,7 +7,7 @@ import * as OAuth from './oauth';
7
7
  export * from './anonymize-key';
8
8
  export * from './call-comment';
9
9
  export * from './env';
10
- export * from './error';
10
+ export * from './error/error';
11
11
  export * from './integration-entity';
12
12
  export * from './logger.util';
13
13
  export * from './phone-number-utils';
@@ -20,3 +20,4 @@ export * from './env';
20
20
  export { Http, CallEventHelper, Security, Lang, GDPR, OAuth };
21
21
  export * from './token-util';
22
22
  export * from './contact.util';
23
+ export { DelegateToFrontedError } from './error/delegate-to-frontend.error';
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.OAuth = exports.GDPR = exports.Lang = exports.Security = exports.CallEventHelper = exports.Http = void 0;
29
+ exports.DelegateToFrontedError = exports.OAuth = exports.GDPR = exports.Lang = exports.Security = exports.CallEventHelper = exports.Http = void 0;
30
30
  const Http = __importStar(require("./http"));
31
31
  exports.Http = Http;
32
32
  const CallEventHelper = __importStar(require("./callEventHelper"));
@@ -42,7 +42,7 @@ exports.OAuth = OAuth;
42
42
  __exportStar(require("./anonymize-key"), exports);
43
43
  __exportStar(require("./call-comment"), exports);
44
44
  __exportStar(require("./env"), exports);
45
- __exportStar(require("./error"), exports);
45
+ __exportStar(require("./error/error"), exports);
46
46
  __exportStar(require("./integration-entity"), exports);
47
47
  __exportStar(require("./logger.util"), exports);
48
48
  __exportStar(require("./phone-number-utils"), exports);
@@ -54,4 +54,6 @@ __exportStar(require("./oauth"), exports);
54
54
  __exportStar(require("./env"), exports);
55
55
  __exportStar(require("./token-util"), exports);
56
56
  __exportStar(require("./contact.util"), exports);
57
+ var delegate_to_frontend_error_1 = require("./error/delegate-to-frontend.error");
58
+ Object.defineProperty(exports, "DelegateToFrontedError", { enumerable: true, get: function () { return delegate_to_frontend_error_1.DelegateToFrontedError; } });
57
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAqBtB,oBAAI;AApBb,mEAAqD;AAoBtC,0CAAe;AAnB9B,qDAAuC;AAmBP,4BAAQ;AAlBxC,6CAA+B;AAkBW,oBAAI;AAjB9C,6CAA+B;AAiBiB,oBAAI;AAhBpD,+CAAiC;AAgBqB,sBAAK;AAd3D,kDAAgC;AAChC,iDAA+B;AAC/B,wCAAsB;AACtB,0CAAwB;AACxB,uDAAqC;AACrC,gDAA8B;AAC9B,uDAAqC;AACrC,yCAAuB;AACvB,oDAAkC;AAClC,6CAA2B;AAC3B,yCAAuB;AACvB,0CAAwB;AACxB,wCAAsB;AAGtB,+CAA6B;AAC7B,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAqBtB,oBAAI;AApBb,mEAAqD;AAoBtC,0CAAe;AAnB9B,qDAAuC;AAmBP,4BAAQ;AAlBxC,6CAA+B;AAkBW,oBAAI;AAjB9C,6CAA+B;AAiBiB,oBAAI;AAhBpD,+CAAiC;AAgBqB,sBAAK;AAd3D,kDAAgC;AAChC,iDAA+B;AAC/B,wCAAsB;AACtB,gDAA8B;AAC9B,uDAAqC;AACrC,gDAA8B;AAC9B,uDAAqC;AACrC,yCAAuB;AACvB,oDAAkC;AAClC,6CAA2B;AAC3B,yCAAuB;AACvB,0CAAwB;AACxB,wCAAsB;AAGtB,+CAA6B;AAC7B,iDAA+B;AAC/B,iFAA4E;AAAnE,oIAAA,sBAAsB,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sipgate/integration-bridge",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "sipgate Integration Bridge Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +0,0 @@
1
- import { AxiosError } from 'axios';
2
- import { IntegrationErrorType, ServerError } from '../models';
3
- export declare const throwAndDelegateError: (error: AxiosError | DelegateToFrontedError | ServerError | Error, source: string, apiKey: string | undefined, logMessage?: string) => never;
4
- export declare class DelegateToFrontedError extends ServerError {
5
- errorType: IntegrationErrorType;
6
- constructor(errorType: IntegrationErrorType);
7
- }
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DelegateToFrontedError = exports.throwAndDelegateError = void 0;
4
- const axios_1 = require("axios");
5
- const models_1 = require("../models");
6
- const logger_util_1 = require("./logger.util");
7
- const throwAndDelegateError = (error, source, apiKey, logMessage) => {
8
- var _a, _b, _c, _d;
9
- const errorMessage = (0, axios_1.isAxiosError)(error)
10
- ? ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)
11
- ? JSON.stringify((_b = error.response) === null || _b === void 0 ? void 0 : _b.data)
12
- : error.message
13
- : error.message;
14
- if (logMessage) {
15
- (0, logger_util_1.errorLogger)(source, logMessage, apiKey, {
16
- message: errorMessage,
17
- error,
18
- stackTrace: error.stack,
19
- });
20
- }
21
- else {
22
- (0, logger_util_1.errorLogger)(source, errorMessage, apiKey, {
23
- error,
24
- stackTrace: error.stack,
25
- });
26
- }
27
- const err = error;
28
- let errorType = undefined;
29
- if (error instanceof DelegateToFrontedError) {
30
- const delegateToFrontedError = error;
31
- errorType = delegateToFrontedError.errorType;
32
- }
33
- else {
34
- if (err.code || err.status || ((_c = err.response) === null || _c === void 0 ? void 0 : _c.status)) {
35
- const status = err.status ||
36
- ((_d = err.response) === null || _d === void 0 ? void 0 : _d.status) ||
37
- (err.code ? parseInt(err.code) : 500);
38
- switch (status) {
39
- case 401:
40
- errorType = models_1.IntegrationErrorType.INTEGRATION_REFRESH_ERROR;
41
- break;
42
- case 403:
43
- errorType = models_1.IntegrationErrorType.INTEGRATION_ERROR_FORBIDDEN;
44
- break;
45
- case 404:
46
- errorType = models_1.IntegrationErrorType.ENTITY_NOT_FOUND;
47
- break;
48
- case 409:
49
- errorType = models_1.IntegrationErrorType.ENTITY_ERROR_CONFLICT;
50
- break;
51
- case 502:
52
- case 503:
53
- case 504:
54
- errorType = models_1.IntegrationErrorType.INTEGRATION_ERROR_UNAVAILABLE;
55
- break;
56
- default:
57
- throw new models_1.ServerError(status, `${source} (${errorMessage})`);
58
- }
59
- }
60
- }
61
- if (errorType !== undefined) {
62
- (0, logger_util_1.warnLogger)('throwAndDelegateError', `Delegating crm error to frontend with code ${models_1.DELEGATE_TO_FRONTEND_CODE} and type ${errorType}`, apiKey, logMessage);
63
- throw new models_1.ServerError(models_1.DELEGATE_TO_FRONTEND_CODE, errorType);
64
- }
65
- throw new models_1.ServerError(500, `An internal error occurred: ${JSON.stringify(error)}.`);
66
- };
67
- exports.throwAndDelegateError = throwAndDelegateError;
68
- class DelegateToFrontedError extends models_1.ServerError {
69
- constructor(errorType) {
70
- super(models_1.DELEGATE_TO_FRONTEND_CODE, errorType);
71
- this.errorType = errorType;
72
- this.name = 'DelegateToFrontedError';
73
- }
74
- }
75
- exports.DelegateToFrontedError = DelegateToFrontedError;
76
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/util/error.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AACjD,sCAImB;AACnB,+CAAwD;AAEjD,MAAM,qBAAqB,GAAG,CACnC,KAAgE,EAChE,MAAc,EACd,MAA0B,EAC1B,UAAmB,EACnB,EAAE;;IACF,MAAM,YAAY,GAAG,IAAA,oBAAY,EAAC,KAAK,CAAC;QACtC,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI;YACpB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,CAAC;YACtC,CAAC,CAAC,KAAK,CAAC,OAAO;QACjB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IAElB,IAAI,UAAU,EAAE;QACd,IAAA,yBAAW,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE;YACtC,OAAO,EAAE,YAAY;YACrB,KAAK;YACL,UAAU,EAAE,KAAK,CAAC,KAAK;SACxB,CAAC,CAAC;KACJ;SAAM;QACL,IAAA,yBAAW,EAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE;YACxC,KAAK;YACL,UAAU,EAAE,KAAK,CAAC,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