@peacom/core 0.0.34 → 0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peacom/core",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "moment": "^2.29.4",
@@ -13,7 +13,8 @@
13
13
  "devDependencies": {
14
14
  "@types/mime-types": "^2.1.1",
15
15
  "@types/google-libphonenumber": "^7.4.23",
16
- "@types/uuid": "^9.0.1"
16
+ "@types/uuid": "^9.0.1",
17
+ "isomorphic-fetch": "^3.0.0"
17
18
  },
18
19
  "main": "./src/index.js",
19
20
  "types": "./src/index.d.ts",
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendChannelMessage = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const FormError_1 = require("../error/FormError");
6
5
  const sendChannelMessage = (MICROSERVICE_URL, params, log = null) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
+ var _a;
7
7
  const url = `${MICROSERVICE_URL}/message`;
8
8
  if (log) {
9
9
  log(`SERVICE REQUEST: ${url} - ${JSON.stringify(params)}`);
@@ -20,7 +20,17 @@ const sendChannelMessage = (MICROSERVICE_URL, params, log = null) => tslib_1.__a
20
20
  log(`SERVICE RESPONSE: ${url} - ${bodyStr}`);
21
21
  }
22
22
  if (!rs.ok) {
23
- throw new FormError_1.FormError(JSON.parse(bodyStr));
23
+ let errorMessage = '';
24
+ try {
25
+ const errors = JSON.parse(bodyStr);
26
+ if (errors.length) {
27
+ errorMessage = (_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message;
28
+ }
29
+ }
30
+ catch (e) {
31
+ errorMessage = bodyStr;
32
+ }
33
+ throw new Error(errorMessage);
24
34
  }
25
35
  return JSON.parse(bodyStr);
26
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"micro-service.api.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/api/micro-service.api.ts"],"names":[],"mappings":";;;;AACA,kDAA6C;AAEtC,MAAM,kBAAkB,GAAG,CAAO,gBAAwB,EAAE,MAA+B,EAAE,MAAoB,IAAI,EAAE,EAAE;IAC9H,MAAM,GAAG,GAAG,GAAG,gBAAgB,UAAU,CAAA;IACzC,IAAI,GAAG,EAAE;QACP,GAAG,CAAC,oBAAoB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;KAC3D;IAED,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC1B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,GAAG,EAAE;QACP,GAAG,CAAC,qBAAqB,GAAG,MAAM,OAAO,EAAE,CAAC,CAAA;KAC7C;IAED,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACV,MAAM,IAAI,qBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;KACzC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC5B,CAAC,CAAA,CAAA;AAtBY,QAAA,kBAAkB,sBAsB9B"}
1
+ {"version":3,"file":"micro-service.api.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/api/micro-service.api.ts"],"names":[],"mappings":";;;;AAEO,MAAM,kBAAkB,GAAG,CAAO,gBAAwB,EAAE,MAA+B,EAAE,MAAoB,IAAI,EAAE,EAAE;;IAC9H,MAAM,GAAG,GAAG,GAAG,gBAAgB,UAAU,CAAA;IACzC,IAAI,GAAG,EAAE;QACP,GAAG,CAAC,oBAAoB,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;KAC3D;IAED,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC1B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,GAAG,EAAE;QACP,GAAG,CAAC,qBAAqB,GAAG,MAAM,OAAO,EAAE,CAAC,CAAA;KAC7C;IAED,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACV,IAAI,YAAY,GAAG,EAAE,CAAA;QACrB,IAAI;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAClC,IAAI,MAAM,CAAC,MAAM,EAAE;gBACjB,YAAY,GAAG,MAAA,MAAM,CAAC,CAAC,CAAC,0CAAE,OAAO,CAAA;aAClC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,YAAY,GAAG,OAAO,CAAA;SACvB;QAED,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;KAC9B;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAC5B,CAAC,CAAA,CAAA;AAhCY,QAAA,kBAAkB,sBAgC9B"}
@@ -4,3 +4,4 @@ export * from './Message';
4
4
  export * from './queue';
5
5
  export * from './viber-business';
6
6
  export * from './conversation';
7
+ export * from './Currency';
@@ -7,4 +7,5 @@ tslib_1.__exportStar(require("./Message"), exports);
7
7
  tslib_1.__exportStar(require("./queue"), exports);
8
8
  tslib_1.__exportStar(require("./viber-business"), exports);
9
9
  tslib_1.__exportStar(require("./conversation"), exports);
10
+ tslib_1.__exportStar(require("./Currency"), exports);
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/model/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,oDAAyB;AACzB,oDAAyB;AACzB,kDAAuB;AACvB,2DAAgC;AAChC,yDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/src/lib/model/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,oDAAyB;AACzB,oDAAyB;AACzB,kDAAuB;AACvB,2DAAgC;AAChC,yDAA8B;AAC9B,qDAA0B"}