chyz 2.0.0-rc.24 → 2.0.0-rc.26
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 +31 -23
- package/package.json +1 -1
package/BaseChyz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAuGjC,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,MAAM,EAAE,GAAG,CAAC;IACnB,MAAM,CAAC,IAAI,EAAE,IAAI,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiB;IACzC,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,MAAM,CAAC,WAAW,CAA4B;IACtD,OAAc,UAAU,EAAE,GAAG,CAAK;IAClC,OAAc,WAAW,EAAE,GAAG,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAU;IAGtC,MAAM,KAAK,YAAY,IAAI,GAAG,CAE7B;IAED,MAAM,KAAK,YAAY,CAAC,KAAK,EAAE,GAAG,EAEjC;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;IAED;;OAEG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P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
34
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* https server
|
|
40
|
+
*/
|
|
41
|
+
const express_1 = __importDefault(require("express"));
|
|
42
|
+
const bodyParser = require("body-parser");
|
|
43
|
+
const https_1 = require("https");
|
|
44
|
+
const http_1 = require("http");
|
|
38
45
|
const fs = require("fs");
|
|
39
46
|
/**
|
|
40
47
|
* Freamwork
|
|
@@ -45,25 +52,9 @@ const Logs_1 = require("./base/Logs");
|
|
|
45
52
|
const CEvents_1 = require("./base/CEvents");
|
|
46
53
|
const compression = require('compression');
|
|
47
54
|
// const fs = require('fs');
|
|
48
|
-
/**
|
|
49
|
-
* Use
|
|
50
|
-
* selectedBox: {
|
|
51
|
-
* array: {
|
|
52
|
-
* id: {
|
|
53
|
-
* numericality: {
|
|
54
|
-
* onlyInteger: true,
|
|
55
|
-
* greaterThan: 0
|
|
56
|
-
* }
|
|
57
|
-
* }
|
|
58
|
-
* }
|
|
59
|
-
* },
|
|
60
|
-
* @param arrayItems
|
|
61
|
-
* @param itemConstraints
|
|
62
|
-
*/
|
|
63
55
|
const ip = require('ip');
|
|
64
|
-
const bodyParser = require('body-parser');
|
|
65
56
|
const methodOverride = require('method-override');
|
|
66
|
-
const Server =
|
|
57
|
+
const Server = (0, express_1.default)();
|
|
67
58
|
const cors = require('cors');
|
|
68
59
|
const emitter = require('events').EventEmitter;
|
|
69
60
|
const em = new emitter();
|
|
@@ -91,7 +82,24 @@ const utc = require('dayjs/plugin/utc');
|
|
|
91
82
|
const relative = require('dayjs/plugin/relativeTime');
|
|
92
83
|
dayjs.extend(utc);
|
|
93
84
|
dayjs.extend(relative);
|
|
85
|
+
/**
|
|
86
|
+
* Use
|
|
87
|
+
* selectedBox: {
|
|
88
|
+
* array: {
|
|
89
|
+
* id: {
|
|
90
|
+
* numericality: {
|
|
91
|
+
* onlyInteger: true,
|
|
92
|
+
* greaterThan: 0
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* },
|
|
97
|
+
* @param arrayItems
|
|
98
|
+
* @param itemConstraints
|
|
99
|
+
*/
|
|
94
100
|
validate.validators.array = (arrayItems, itemConstraints) => {
|
|
101
|
+
if (!Utils_1.Utils.isArray(arrayItems))
|
|
102
|
+
return { errors: [{ error: 'in not array' }] };
|
|
95
103
|
const arrayItemErrors = arrayItems.reduce((errors, item, index) => {
|
|
96
104
|
const error = validate(item, itemConstraints);
|
|
97
105
|
if (error)
|
|
@@ -409,7 +417,7 @@ class BaseChyz {
|
|
|
409
417
|
// //static file path
|
|
410
418
|
if (this.config.staticFilePath) {
|
|
411
419
|
BaseChyz.info('Static file path', this.config.staticFilePath);
|
|
412
|
-
BaseChyz.propvider.use(
|
|
420
|
+
BaseChyz.propvider.use(express_1.default.static(this.config.staticFilePath));
|
|
413
421
|
}
|
|
414
422
|
//Middlewares
|
|
415
423
|
for (const middleware1 of Object.keys(BaseChyz.middlewares)) {
|
|
@@ -430,7 +438,7 @@ class BaseChyz {
|
|
|
430
438
|
BaseChyz.info("Express Server Starting");
|
|
431
439
|
BaseChyz.EventEmitter.emit(CEvents_1.CEvents.ON_BEFORE_START, this);
|
|
432
440
|
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.ssl) {
|
|
433
|
-
BaseChyz.httpServer =
|
|
441
|
+
BaseChyz.httpServer = (0, https_1.createServer)((_b = this.config) === null || _b === void 0 ? void 0 : _b.ssl, BaseChyz.propvider);
|
|
434
442
|
BaseChyz.httpServer.listen(this._port, () => {
|
|
435
443
|
BaseChyz.info("Express Server Start ");
|
|
436
444
|
BaseChyz.info(`Liten Port ${this._port}`);
|
|
@@ -440,7 +448,7 @@ class BaseChyz {
|
|
|
440
448
|
});
|
|
441
449
|
}
|
|
442
450
|
else {
|
|
443
|
-
BaseChyz.httpServer =
|
|
451
|
+
BaseChyz.httpServer = (0, http_1.createServer)(BaseChyz.propvider);
|
|
444
452
|
BaseChyz.propvider.listen(this._port, () => {
|
|
445
453
|
BaseChyz.info("Express Server Start ");
|
|
446
454
|
BaseChyz.info(`Liten Port ${this._port}`);
|