@kipicore/dbcore 1.1.709 → 1.1.710

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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildSchema = void 0;
7
7
  const joi_1 = __importDefault(require("joi"));
8
8
  const httpStatusCode_1 = require("../constants/httpStatusCode");
9
- const apiError_1 = __importDefault(require("../helpers/apiError"));
9
+ const helpers_1 = require("../helpers");
10
10
  // GENERIC BUILDER
11
11
  const buildSchema = (base, rules = {}) => {
12
12
  let schema = base;
@@ -50,7 +50,7 @@ class BaseValidator {
50
50
  const { error, value } = schema.validate({ ...req.body, ...req.query, ...req.params }, { ...defaultOptions, ...options });
51
51
  if (error) {
52
52
  const errorMessage = error.details.map(d => d.message).join(', ');
53
- throw new apiError_1.default(httpStatusCode_1.HTTP_STATUS_CODE.BAD_REQUEST, errorMessage);
53
+ throw new helpers_1.ApiError(httpStatusCode_1.HTTP_STATUS_CODE.BAD_REQUEST, errorMessage);
54
54
  }
55
55
  req.body = value;
56
56
  }
@@ -1,5 +1,12 @@
1
- export default class ApiError extends Error {
2
- statusCode: number;
3
- isOperational: boolean;
4
- constructor(statusCode: number, message: string | undefined, isOperational?: boolean, stack?: string);
5
- }
1
+ export declare const ApiError: {
2
+ new (statusCode: number, message: string | undefined, isOperational?: boolean, stack?: string): {
3
+ statusCode: number;
4
+ isOperational: boolean;
5
+ name: string;
6
+ message: string;
7
+ stack?: string;
8
+ };
9
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
10
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
11
+ stackTraceLimit: number;
12
+ };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class ApiError extends Error {
3
+ exports.ApiError = void 0;
4
+ const ApiError = class extends Error {
4
5
  constructor(statusCode, message, isOperational = true, stack = '') {
5
6
  super(message);
6
7
  this.statusCode = statusCode;
@@ -11,5 +12,5 @@ class ApiError extends Error {
11
12
  else
12
13
  Error.captureStackTrace(this, this.constructor);
13
14
  }
14
- }
15
- exports.default = ApiError;
15
+ };
16
+ exports.ApiError = ApiError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.709",
3
+ "version": "1.1.710",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",