@sipgate/integration-bridge 0.17.0 → 0.17.2

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.
@@ -4,6 +4,7 @@ export declare enum IntegrationErrorType {
4
4
  INTEGRATION_ERROR_FORBIDDEN = "integration/error/forbidden",
5
5
  INTEGRATION_ERROR_UNAVAILABLE = "integration/error/unavailable",
6
6
  ENTITY_ERROR_CONFLICT = "entity/error/conflict",
7
+ ENTITY_NOT_FOUND = "entity/not-found",
7
8
  CONTACT_CREATE_ERROR_CONFLICT = "contact/create-error/conflict",
8
9
  CONTACT_CREATE_ERROR_EMAIL_CONFLICT = "contact/create-error/email-conflict",
9
10
  CONTACT_ERROR_TOO_MANY_NUMBERS = "contact/error/too-many-numbers",
@@ -9,6 +9,7 @@ var IntegrationErrorType;
9
9
  IntegrationErrorType["INTEGRATION_ERROR_FORBIDDEN"] = "integration/error/forbidden";
10
10
  IntegrationErrorType["INTEGRATION_ERROR_UNAVAILABLE"] = "integration/error/unavailable";
11
11
  IntegrationErrorType["ENTITY_ERROR_CONFLICT"] = "entity/error/conflict";
12
+ IntegrationErrorType["ENTITY_NOT_FOUND"] = "entity/not-found";
12
13
  IntegrationErrorType["CONTACT_CREATE_ERROR_CONFLICT"] = "contact/create-error/conflict";
13
14
  IntegrationErrorType["CONTACT_CREATE_ERROR_EMAIL_CONFLICT"] = "contact/create-error/email-conflict";
14
15
  IntegrationErrorType["CONTACT_ERROR_TOO_MANY_NUMBERS"] = "contact/error/too-many-numbers";
@@ -1 +1 @@
1
- {"version":3,"file":"integration-error.model.js","sourceRoot":"","sources":["../../src/models/integration-error.model.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAcX;AAdD,WAAY,oBAAoB;IAC9B,2EAAmD,CAAA;IAEnD,0EAA0E;IAC1E,+EAAuD,CAAA;IACvD,mFAA2D,CAAA;IAC3D,uFAA+D,CAAA;IAE/D,uEAA+C,CAAA;IAE/C,uFAA+D,CAAA;IAC/D,mGAA2E,CAAA;IAC3E,yFAAiE,CAAA;IACjE,6FAAqE,CAAA;AACvE,CAAC,EAdW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAc/B;AAEY,QAAA,yBAAyB,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"integration-error.model.js","sourceRoot":"","sources":["../../src/models/integration-error.model.ts"],"names":[],"mappings":";;;AAAA,IAAY,oBAeX;AAfD,WAAY,oBAAoB;IAC9B,2EAAmD,CAAA;IAEnD,0EAA0E;IAC1E,+EAAuD,CAAA;IACvD,mFAA2D,CAAA;IAC3D,uFAA+D,CAAA;IAE/D,uEAA+C,CAAA;IAC/C,6DAAqC,CAAA;IAErC,uFAA+D,CAAA;IAC/D,mGAA2E,CAAA;IAC3E,yFAAiE,CAAA;IACjE,6FAAqE,CAAA;AACvE,CAAC,EAfW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAe/B;AAEY,QAAA,yBAAyB,GAAG,GAAG,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { AxiosError } from "axios";
2
- export declare const throwAndDelegateError: (error: AxiosError | Error, source: string, apiKey: string | undefined, logMessage?: string) => never;
2
+ import { ServerError } from "../models";
3
+ export declare const throwAndDelegateError: (error: AxiosError | ServerError | Error, source: string, apiKey: string | undefined, logMessage?: string) => never;
@@ -8,7 +8,7 @@ const axios_1 = __importDefault(require("axios"));
8
8
  const models_1 = require("../models");
9
9
  const logger_util_1 = require("./logger.util");
10
10
  const throwAndDelegateError = (error, source, apiKey, logMessage) => {
11
- var _a, _b, _c;
11
+ var _a, _b, _c, _d;
12
12
  const errorMessage = axios_1.default.isAxiosError(error)
13
13
  ? ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)
14
14
  ? JSON.stringify((_b = error.response) === null || _b === void 0 ? void 0 : _b.data)
@@ -20,8 +20,9 @@ const throwAndDelegateError = (error, source, apiKey, logMessage) => {
20
20
  else {
21
21
  (0, logger_util_1.errorLogger)(source, errorMessage, apiKey);
22
22
  }
23
- if (axios_1.default.isAxiosError(error)) {
24
- const status = ((_c = error.response) === null || _c === void 0 ? void 0 : _c.status) || (error.code ? parseInt(error.code) : 500);
23
+ const err = error;
24
+ if (err.code || ((_c = err.response) === null || _c === void 0 ? void 0 : _c.status)) {
25
+ const status = ((_d = err.response) === null || _d === void 0 ? void 0 : _d.status) || (err.code ? parseInt(err.code) : 500);
25
26
  var errorType;
26
27
  switch (status) {
27
28
  case 401:
@@ -30,6 +31,9 @@ const throwAndDelegateError = (error, source, apiKey, logMessage) => {
30
31
  case 403:
31
32
  errorType = models_1.IntegrationErrorType.INTEGRATION_ERROR_FORBIDDEN;
32
33
  break;
34
+ case 404:
35
+ errorType = models_1.IntegrationErrorType.ENTITY_NOT_FOUND;
36
+ break;
33
37
  case 409:
34
38
  errorType = models_1.IntegrationErrorType.ENTITY_ERROR_CONFLICT;
35
39
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/util/error.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0C;AAC1C,sCAImB;AACnB,+CAA4C;AAErC,MAAM,qBAAqB,GAAG,CACnC,KAAyB,EACzB,MAAc,EACd,MAA0B,EAC1B,UAAmB,EACnB,EAAE;;IACF,MAAM,YAAY,GAAG,eAAK,CAAC,YAAY,CAAC,KAAK,CAAC;QAC5C,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,YAAY,CAAC,CAAC;KACvD;SAAM;QACL,IAAA,yBAAW,EAAC,MAAM,EAAE,YAAY,EAAE,MAAM,C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MAAM,EAAE,GAAG,MAAM,KAAK,YAAY,GAAG,CAAC,CAAC;SAChE;QACD,MAAM,IAAI,oBAAW,CAAC,kCAAyB,EAAE,SAAS,CAAC,CAAC;KAC7D;IACD,MAAM,IAAI,oBAAW,CAAC,GAAG,EAAE,4BAA4B,CAAC,CAAC;AAC3D,CAAC,CAAC;AAhDW,QAAA,qBAAqB,yBAgDhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sipgate/integration-bridge",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "description": "sipgate Integration Bridge Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",