badmfck-api-server 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -8,7 +31,7 @@ const express_1 = __importDefault(require("express"));
8
31
  const BaseService_1 = require("./BaseService");
9
32
  const cors_1 = __importDefault(require("cors"));
10
33
  const BaseEndpoint_1 = require("./BaseEndpoint");
11
- const DefaultErrors_1 = __importDefault(require("./structures/DefaultErrors"));
34
+ const DefaultErrors_1 = __importStar(require("./structures/DefaultErrors"));
12
35
  const badmfck_signal_1 = require("badmfck-signal");
13
36
  const LogService_1 = require("./LogService");
14
37
  const Monitor_1 = require("./monitor/Monitor");
@@ -299,6 +322,8 @@ class APIService extends BaseService_1.BaseService {
299
322
  (0, LogService_1.logError)("Postproducer error", e);
300
323
  }
301
324
  }
325
+ if (DefaultErrors_1.ErrorUtils.isError(data))
326
+ data = { error: data, data: null };
302
327
  data.responseTime = (+new Date()) - requestTime;
303
328
  data.core = this.version;
304
329
  data.endpoint = endpoint ?? "no_endpoint";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",