chyz 2.0.1-rc.2 → 2.0.1-rc.4

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
@@ -51,15 +51,15 @@ const weekOfYear_1 = __importDefault(require("dayjs/plugin/weekOfYear"));
51
51
  const isTomorrow_1 = __importDefault(require("dayjs/plugin/isTomorrow"));
52
52
  const bodyParser = require("body-parser");
53
53
  const fs = require("fs");
54
- const http_request = require('debug')('http:request');
55
- const http_request_body = http_request.extend('body');
56
- const http_request_headers = http_request.extend('headers');
57
- const compression = require('compression');
54
+ // const http_request = require('debug')('http:request')
55
+ // const http_request_body = http_request.extend('body')
56
+ // const http_request_headers = http_request.extend('headers')
57
+ const compression_1 = __importDefault(require("compression"));
58
58
  // const fs = require('fs');
59
- const ip = require('ip');
59
+ const ip_1 = __importDefault(require("ip"));
60
+ const cors_1 = __importDefault(require("cors"));
60
61
  const methodOverride = require('method-override');
61
62
  const Server = (0, express_1.default)();
62
- const cors = require('cors');
63
63
  const emitter = require('events').EventEmitter;
64
64
  const em = new emitter();
65
65
  /**
@@ -350,8 +350,8 @@ class BaseChyz {
350
350
  beforeMiddleware(req, res, next, instance, route) {
351
351
  return __awaiter(this, void 0, void 0, function* () {
352
352
  BaseChyz.debug(`${instance.id}/${route.path}->beforeMiddleware trigger`);
353
- http_request_body("Request body " + JSON.stringify(req.body));
354
- http_request_headers("Request header " + JSON.stringify(req.headers));
353
+ // http_request_body("Request body " + JSON.stringify(req.body))
354
+ // http_request_headers("Request header " + JSON.stringify(req.headers))
355
355
  try {
356
356
  yield instance.beforeAction(route, req, res);
357
357
  next();
@@ -486,7 +486,7 @@ class BaseChyz {
486
486
  BaseChyz.propvider.use(bodyParser.json({ limit: '1mb' }));
487
487
  BaseChyz.propvider.use(bodyParser.urlencoded({ limit: '1mb', extended: true })); // support encoded bodies
488
488
  BaseChyz.propvider.use(methodOverride());
489
- BaseChyz.propvider.use(cors());
489
+ BaseChyz.propvider.use((0, cors_1.default)());
490
490
  //
491
491
  // // CORS
492
492
  // BaseChyz.express.use(function (req: any, res: Response, next: any) {
@@ -507,9 +507,9 @@ class BaseChyz {
507
507
  return false;
508
508
  }
509
509
  // use compression filter function
510
- return compression.filter(req, res);
510
+ return compression_1.default.filter(req, res);
511
511
  };
512
- BaseChyz.propvider.use(compression({ filter: shouldCompress }));
512
+ BaseChyz.propvider.use((0, compression_1.default)({ filter: shouldCompress }));
513
513
  //
514
514
  // //static file path
515
515
  if (this.config.staticFilePath) {
@@ -541,7 +541,7 @@ class BaseChyz {
541
541
  BaseChyz.info("Express Server Start ");
542
542
  BaseChyz.info(`Liten Port ${this._port}`);
543
543
  BaseChyz.info(`https://localhost:${this._port}`);
544
- BaseChyz.info(`https://${ip.address()}:${this._port}`);
544
+ BaseChyz.info(`https://${ip_1.default.address()}:${this._port}`);
545
545
  BaseChyz.EventEmitter.emit(base_1.CEvents.ON_START, this);
546
546
  });
547
547
  }
@@ -551,7 +551,7 @@ class BaseChyz {
551
551
  BaseChyz.info("Express Server Start ");
552
552
  BaseChyz.info(`Liten Port ${this._port}`);
553
553
  BaseChyz.info(`http://localhost:${this._port}`);
554
- BaseChyz.info(`http://${ip.address()}:${this._port}`);
554
+ BaseChyz.info(`http://${ip_1.default.address()}:${this._port}`);
555
555
  BaseChyz.EventEmitter.emit(base_1.CEvents.ON_START, this);
556
556
  });
557
557
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="express" />
2
1
  import { Request, Response } from "../index";
3
2
  import { CBaseObject } from "./CBaseObject";
4
3
  export declare class ActionFilter extends CBaseObject {
@@ -1 +1 @@
1
- {"version":3,"file":"ActionFilter.d.ts","sourceRoot":"","sources":["../../src/base/ActionFilter.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAEzC,qBAAa,YAAa,SAAQ,WAAW;IAElC,IAAI,EAAE,GAAG,CAAC;IAEjB;;;OAGG;IACI,MAAM,UAAM;IAGZ,IAAI;IAIX;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IASjE;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAIjE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG;CA8BjC"}
1
+ {"version":3,"file":"ActionFilter.d.ts","sourceRoot":"","sources":["../../src/base/ActionFilter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAGzC,qBAAa,YAAa,SAAQ,WAAW;IAElC,IAAI,EAAE,GAAG,CAAC;IAEjB;;;OAGG;IACI,MAAM,UAAM;IAGZ,IAAI;IAIX;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAUjE;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAIjE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG;CA8BjC"}
@@ -8,10 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.ActionFilter = void 0;
13
16
  const Utils_1 = require("../requiments/Utils");
14
17
  const CBaseObject_1 = require("./CBaseObject");
18
+ const BaseChyz_1 = __importDefault(require("../BaseChyz"));
15
19
  class ActionFilter extends CBaseObject_1.CBaseObject {
16
20
  constructor() {
17
21
  super(...arguments);
@@ -31,7 +35,7 @@ class ActionFilter extends CBaseObject_1.CBaseObject {
31
35
  */
32
36
  beforeFilter(route, req, res) {
33
37
  return __awaiter(this, void 0, void 0, function* () {
34
- console.log("route ", route);
38
+ BaseChyz_1.default.debug("Controller->beforeFilter ", route);
35
39
  if (!this.isActive(route)) {
36
40
  return;
37
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Logs.d.ts","sourceRoot":"","sources":["../../src/base/Logs.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,qBAAa,IAAK,YAAW,YAAY;IAE9B,IAAI,SAAyB;IAC7B,OAAO,EAAE,GAAG,CAA6C;gBAGpD,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IASxC,IAAI;IAIJ;;;OAGG;IACI,QAAQ;IAIR,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIhC;;AAED,wBAA0B"}
1
+ {"version":3,"file":"Logs.d.ts","sourceRoot":"","sources":["../../src/base/Logs.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAK5C,qBAAa,IAAK,YAAW,YAAY;IAE9B,IAAI,SAAyB;IAC7B,OAAO,EAAE,GAAG,CAA6C;gBAGpD,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IA6BxC,IAAI;IAIJ;;;OAGG;IACI,QAAQ;IAIR,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIhC;;AAED,wBAA0B"}
package/base/Logs.js CHANGED
@@ -17,8 +17,27 @@ class Logs {
17
17
  this.configs = (_a = require('../log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
18
18
  if (name)
19
19
  this.name = name;
20
- if (configs)
20
+ if (configs) {
21
21
  this.configs = configs;
22
+ }
23
+ // let _conf = Utils.clone(this.configs);
24
+ // Object.keys(_conf.appenders).forEach(function (appender: string) {
25
+ // let _base;
26
+ // if (_conf.appenders[appender].layout) {
27
+ // if ((_base = _conf.appenders[appender].layout).tokens == null) {
28
+ // _base.tokens = {};
29
+ // }
30
+ // //
31
+ // _conf.appenders[appender].layout.tokens = Utils.extend(_conf.appenders[appender].layout.tokens, {
32
+ // singleLine: function (logEvent: any) {
33
+ // console.log("singglleeee")
34
+ // // logEvent.data is an array that contains the arguments to the log.info() call
35
+ // return logEvent.data[0] + ', ' + logEvent.data[1].toString();
36
+ // }
37
+ // });
38
+ //
39
+ // }
40
+ // });
22
41
  this.Provider().configure(this.configs);
23
42
  }
24
43
  init() {
@@ -1,4 +1,3 @@
1
- /// <reference types="express" />
2
1
  import { Request, Response } from "../index";
3
2
  import { ActionFilter } from "../base";
4
3
  import { WebUser } from "../web/WebUser";
@@ -1 +1 @@
1
- {"version":3,"file":"AccessControl.d.ts","sourceRoot":"","sources":["../../src/filters/AccessControl.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAU,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAIvC,qBAAa,aAAc,SAAQ,YAAY;IAEpC,IAAI,EAAE,GAAG,CAAQ;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,GAAG,CAAQ;IAEzB,IAAI;IAgBE,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,EAAC,QAAQ;IAiC7D,UAAU,CAAC,IAAI,EAAE,OAAO;CAMlC"}
1
+ {"version":3,"file":"AccessControl.d.ts","sourceRoot":"","sources":["../../src/filters/AccessControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAU,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAIvC,qBAAa,aAAc,SAAQ,YAAY;IAEpC,IAAI,EAAE,GAAG,CAAQ;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,GAAG,CAAQ;IAEzB,IAAI;IAgBE,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,EAAC,QAAQ;IAiC7D,UAAU,CAAC,IAAI,EAAE,OAAO;CAMlC"}
package/index.d.ts CHANGED
@@ -10,10 +10,7 @@ declare module "express-serve-static-core" {
10
10
  identity: any;
11
11
  }
12
12
  }
13
- /**
14
- *
15
- */
16
- export declare const Chyz_Version = "2.0.1-rc.2";
13
+ export declare const Chyz_Version: any;
17
14
  declare const Chyz: BaseChyz;
18
15
  export { Request, Response, NextFunction } from "./base/CRequest";
19
16
  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,eAAQ,MAAM,YAAY,eAAa,CAAC;AACxC,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;AAGlC,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;AAgBD,eAAO,MAAM,YAAY,KAAgB,CAAC;AAC1C,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
@@ -41,7 +41,8 @@ String.prototype.tokenReplace = function (obj) {
41
41
  /**
42
42
  *
43
43
  */
44
- exports.Chyz_Version = "2.0.1-rc.2";
44
+ const pjson = require('./package.json');
45
+ exports.Chyz_Version = pjson.version;
45
46
  const Chyz = new BaseChyz_1.default();
46
47
  var WebUser_1 = require("./web/WebUser");
47
48
  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.1-rc.2",
3
+ "version": "2.0.1-rc.4",
4
4
  "description": "Nodejs Micro service Framework",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
19
19
  "dependencies": {
20
+ "@types/compression": "^1.7.5",
20
21
  "axios": "^1.3.5",
21
22
  "babel-plugin-transform-decorators-legacy": "^1.3.5",
22
23
  "body-parser": "^1.20.2",
@@ -49,7 +50,7 @@
49
50
  "nodemon": "^2.0.22",
50
51
  "ts-node": "^10.9.1",
51
52
  "typescript": "^5.0.4"
52
- } ,
53
+ },
53
54
  "keywords": [
54
55
  "Framework",
55
56
  "RespAPI",