chyz 2.0.0-rc.40 → 2.0.0-rc.42

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/BaseChyz.js CHANGED
@@ -267,22 +267,22 @@ class BaseChyz {
267
267
  BaseChyz.logs.fatal(...arguments);
268
268
  }
269
269
  static debug(...args) {
270
- BaseChyz.logs.debug(...arguments);
270
+ BaseChyz.logs.debug(...args);
271
271
  }
272
272
  static info(...args) {
273
- BaseChyz.logs.info(...arguments);
273
+ BaseChyz.logs.info(...args);
274
274
  }
275
275
  static warn(...args) {
276
- BaseChyz.logs.warn(...arguments);
276
+ BaseChyz.logs.warn(...args);
277
277
  }
278
278
  static error(...args) {
279
- BaseChyz.logs.error(...arguments);
279
+ BaseChyz.logs.error(...args);
280
280
  }
281
281
  static fatal(...args) {
282
- BaseChyz.logs.fatal(...arguments);
282
+ BaseChyz.logs.fatal(...args);
283
283
  }
284
284
  static warning(...args) {
285
- BaseChyz.logs.warn(...arguments);
285
+ BaseChyz.logs.warn(...args);
286
286
  }
287
287
  static t(text, params) {
288
288
  if (text == "")
@@ -21,6 +21,7 @@
21
21
  */
22
22
  export declare class BaseError extends Error {
23
23
  statusCode: number;
24
+ orginal: any;
24
25
  private success;
25
26
  constructor(message: any, statusCode?: number);
26
27
  toString(): string;
@@ -29,6 +30,15 @@ export declare class BaseError extends Error {
29
30
  code: number;
30
31
  name: string;
31
32
  message: string;
33
+ stack: string | undefined;
34
+ orginal: any;
35
+ } | {
36
+ success: boolean;
37
+ code: number;
38
+ name: string;
39
+ message: string;
40
+ stack?: undefined;
41
+ orginal?: undefined;
32
42
  };
33
43
  }
34
44
  //# sourceMappingURL=BaseError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,GAAG,EAAE,UAAU,SAAM;IAS1C,QAAQ;IAIR,MAAM;;;;;;CAGT"}
1
+ {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,GAAG,EAAE,UAAU,SAAM;IAW1C,QAAQ;IAIR,MAAM;;;;;;;;;;;;;;;CAcT"}
package/base/BaseError.js CHANGED
@@ -37,12 +37,22 @@ class BaseError extends Error {
37
37
  this.name = this.constructor.name; // good practice
38
38
  this.statusCode = statusCode; // error code for responding to client
39
39
  //Error.captureStackTrace(this)
40
+ this.orginal = Utils_1.Utils.isString(message) ? message : message;
40
41
  }
41
42
  toString() {
42
43
  return `${this.name}[${this.statusCode}] ${this.message}`;
43
44
  }
44
45
  toJSON() {
45
- return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(), message: this.message.toString() };
46
+ if (process.env.NODE_ENV == "development" || process.env.NODE_ENV == "dev") {
47
+ return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(),
48
+ message: this.message.toString(),
49
+ stack: this.stack,
50
+ orginal: this.orginal };
51
+ }
52
+ else {
53
+ return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(),
54
+ message: this.message.toString() };
55
+ }
46
56
  }
47
57
  }
48
58
  exports.BaseError = BaseError;
@@ -1 +1 @@
1
- {"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/base/Model.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAIH,K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AAO,KAAK;IAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmKG;IACU,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,GAA2C;IAMzF;;;OAGG;IACI,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAI7B;;;OAGG;IACI,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAI7B;;;OAGG;IACI,eAAe,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAK9B,QAAQ;IAIf;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAE,GAAU;IAYpC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAE,GAAU;IAYxC,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,UAAO;IAazC,UAAU;IAIjB;;;;;OAKG;IACI,SAAS,IAAI,QAAQ,EAAE;CAKjC"}
package/base/Model.js CHANGED
@@ -109,9 +109,16 @@ class Model extends Component_1.Component {
109
109
  // };
110
110
  this._provider.query = function (sql, options) {
111
111
  return sequelize_1.Sequelize.prototype.query.apply(this, [sql, options]).catch((err) => {
112
- let e = new Error(err.message);
113
- e.message = err.message;
114
- throw new DataErrorDbException_1.DataErrorDbException(e);
112
+ if (process.env.NODE_ENV == "development" || process.env.NODE_ENV == "dev") {
113
+ // e.stack = e.original;
114
+ if (err instanceof sequelize_1.DatabaseError) {
115
+ // @ts-ignore
116
+ delete err.parent;
117
+ // @ts-ignore
118
+ delete err.original;
119
+ }
120
+ }
121
+ throw new DataErrorDbException_1.DataErrorDbException(err);
115
122
  });
116
123
  // try {
117
124
  // let r =
package/index.d.ts CHANGED
@@ -13,6 +13,7 @@ declare module "express-serve-static-core" {
13
13
  /**
14
14
  *
15
15
  */
16
+ export declare const Chyz_Version = "2.0.0-rc.42";
16
17
  declare const Chyz: BaseChyz;
17
18
  export { Request, Response, NextFunction } from "./base/CRequest";
18
19
  export { RouteDefinition } from "./model/RouteDefinition";
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;KAClC;CACJ;AAQD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAElC,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;AAYD;;GAEG;AACH,QAAA,MAAM,IAAI,UAAiB,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAA;AAC7B,OAAO,EACH,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,OAAO,EACV,MAAM,QAAQ,CAAC;AAChB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AAExB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AAEnC,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;KAClC;CACJ;AAQD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAElC,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;AAYD;;GAEG;AACH,eAAQ,MAAM,YAAY,gBAAc,CAAC;AACzC,QAAA,MAAM,IAAI,UAAiB,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAA;AAC7B,OAAO,EACH,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,OAAO,EACV,MAAM,QAAQ,CAAC;AAChB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AAExB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AAEnC,eAAe,IAAI,CAAC"}
package/index.js CHANGED
@@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.CEvents = exports.ModelManager = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.BaseError = exports.ActionFilter = exports.Logs = exports.RestClient = exports.BaseChyz = exports.WebUser = void 0;
28
+ exports.CEvents = exports.ModelManager = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.BaseError = exports.ActionFilter = exports.Logs = exports.RestClient = exports.BaseChyz = exports.WebUser = exports.Chyz_Version = void 0;
29
29
  const BaseChyz_1 = __importDefault(require("./BaseChyz"));
30
30
  exports.BaseChyz = BaseChyz_1.default;
31
31
  const base_1 = require("./base");
@@ -41,6 +41,7 @@ String.prototype.tokenReplace = function (obj) {
41
41
  /**
42
42
  *
43
43
  */
44
+ exports.Chyz_Version = "2.0.0-rc.42";
44
45
  const Chyz = new BaseChyz_1.default();
45
46
  var WebUser_1 = require("./web/WebUser");
46
47
  Object.defineProperty(exports, "WebUser", { enumerable: true, get: function () { return WebUser_1.WebUser; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chyz",
3
- "version": "2.0.0-rc.40",
3
+ "version": "2.0.0-rc.42",
4
4
  "description": "Nodejs Micro service Framework",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",