chyz 2.0.1-rc.3 → 2.0.1-rc.5
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.d.ts.map +1 -1
- package/BaseChyz.js +34 -29
- package/base/ActionFilter.d.ts +0 -1
- package/base/ActionFilter.d.ts.map +1 -1
- package/filters/AccessControl.d.ts +0 -1
- package/filters/AccessControl.d.ts.map +1 -1
- package/package.json +3 -2
package/BaseChyz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAgB,EAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAIjE;;GAEG;AACH,OAAO,EAAqB,cAAc,EAA0B,IAAI,EAAe,MAAM,QAAQ,CAAC;AAKtG,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAgB,EAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAIjE;;GAEG;AACH,OAAO,EAAqB,cAAc,EAA0B,IAAI,EAAe,MAAM,QAAQ,CAAC;AAKtG,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAgHxD,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAuB;IACrC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,SAAS,EAAE,GAAG,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,IAAI,EAAE,GAAG,CAAS;IACzB,MAAM,CAAC,MAAM,E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,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAKrD,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAUxD,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;WAQ7C,YAAY,CAAC,GAAG,EAAE,GAAG;WAKrB,cAAc,CAAC,GAAG,EAAE,GAAG;IAIrC;;OAEG;IACH,UAAU;IA8BJ,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe;IAoBlH,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe;IAkBjH,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe;IAgBvH;;OAEG;IACG,cAAc;IA8Eb,UAAU;IAyDV,KAAK;CA2Bf"}
|
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
|
|
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
|
|
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
|
/**
|
|
@@ -328,30 +328,35 @@ class BaseChyz {
|
|
|
328
328
|
loadModels() {
|
|
329
329
|
let models = {};
|
|
330
330
|
let path = `${this._controllerpath}/../Models`;
|
|
331
|
-
fs.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
331
|
+
if (fs.existsSync(path)) {
|
|
332
|
+
fs.readdirSync(path).forEach((file) => {
|
|
333
|
+
if (file !== "index.ts") {
|
|
334
|
+
let model = require(`${path}/${file}`);
|
|
335
|
+
// @ts-ignore
|
|
336
|
+
let className = file.split(".")[0] + "Class";
|
|
337
|
+
if (model[className])
|
|
338
|
+
models[className.replace("Class", "")] = new model[className];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
/**
|
|
342
|
+
*
|
|
343
|
+
*/
|
|
344
|
+
base_1.ModelManager._register(models);
|
|
345
|
+
for (const key of Object.keys(base_1.ModelManager)) {
|
|
346
|
+
if (key != "_register") {
|
|
347
|
+
base_1.ModelManager[key].init();
|
|
348
|
+
}
|
|
347
349
|
}
|
|
348
350
|
}
|
|
351
|
+
else {
|
|
352
|
+
BaseChyz.error("Model folder not found");
|
|
353
|
+
}
|
|
349
354
|
}
|
|
350
355
|
beforeMiddleware(req, res, next, instance, route) {
|
|
351
356
|
return __awaiter(this, void 0, void 0, function* () {
|
|
352
357
|
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))
|
|
358
|
+
// http_request_body("Request body " + JSON.stringify(req.body))
|
|
359
|
+
// http_request_headers("Request header " + JSON.stringify(req.headers))
|
|
355
360
|
try {
|
|
356
361
|
yield instance.beforeAction(route, req, res);
|
|
357
362
|
next();
|
|
@@ -486,7 +491,7 @@ class BaseChyz {
|
|
|
486
491
|
BaseChyz.propvider.use(bodyParser.json({ limit: '1mb' }));
|
|
487
492
|
BaseChyz.propvider.use(bodyParser.urlencoded({ limit: '1mb', extended: true })); // support encoded bodies
|
|
488
493
|
BaseChyz.propvider.use(methodOverride());
|
|
489
|
-
BaseChyz.propvider.use(
|
|
494
|
+
BaseChyz.propvider.use((0, cors_1.default)());
|
|
490
495
|
//
|
|
491
496
|
// // CORS
|
|
492
497
|
// BaseChyz.express.use(function (req: any, res: Response, next: any) {
|
|
@@ -507,9 +512,9 @@ class BaseChyz {
|
|
|
507
512
|
return false;
|
|
508
513
|
}
|
|
509
514
|
// use compression filter function
|
|
510
|
-
return
|
|
515
|
+
return compression_1.default.filter(req, res);
|
|
511
516
|
};
|
|
512
|
-
BaseChyz.propvider.use(
|
|
517
|
+
BaseChyz.propvider.use((0, compression_1.default)({ filter: shouldCompress }));
|
|
513
518
|
//
|
|
514
519
|
// //static file path
|
|
515
520
|
if (this.config.staticFilePath) {
|
|
@@ -541,7 +546,7 @@ class BaseChyz {
|
|
|
541
546
|
BaseChyz.info("Express Server Start ");
|
|
542
547
|
BaseChyz.info(`Liten Port ${this._port}`);
|
|
543
548
|
BaseChyz.info(`https://localhost:${this._port}`);
|
|
544
|
-
BaseChyz.info(`https://${
|
|
549
|
+
BaseChyz.info(`https://${ip_1.default.address()}:${this._port}`);
|
|
545
550
|
BaseChyz.EventEmitter.emit(base_1.CEvents.ON_START, this);
|
|
546
551
|
});
|
|
547
552
|
}
|
|
@@ -551,7 +556,7 @@ class BaseChyz {
|
|
|
551
556
|
BaseChyz.info("Express Server Start ");
|
|
552
557
|
BaseChyz.info(`Liten Port ${this._port}`);
|
|
553
558
|
BaseChyz.info(`http://localhost:${this._port}`);
|
|
554
|
-
BaseChyz.info(`http://${
|
|
559
|
+
BaseChyz.info(`http://${ip_1.default.address()}:${this._port}`);
|
|
555
560
|
BaseChyz.EventEmitter.emit(base_1.CEvents.ON_START, this);
|
|
556
561
|
});
|
|
557
562
|
}
|
package/base/ActionFilter.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionFilter.d.ts","sourceRoot":"","sources":["../../src/base/ActionFilter.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessControl.d.ts","sourceRoot":"","sources":["../../src/filters/AccessControl.ts"],"names":[],"mappings":"
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chyz",
|
|
3
|
-
"version": "2.0.1-rc.
|
|
3
|
+
"version": "2.0.1-rc.5",
|
|
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",
|