chyz 1.2.5-rc.3 → 2.0.0-rc.11
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 +5 -7
- package/BaseChyz.d.ts.map +1 -1
- package/BaseChyz.js +118 -79
- package/base/ActionFilter.js +3 -6
- package/base/BaseError.js +2 -5
- package/base/CBaseObject.js +2 -2
- package/base/CRequest.d.ts +2 -0
- package/base/CRequest.d.ts.map +1 -0
- package/base/CRequest.js +10 -0
- package/base/Component.js +2 -5
- package/base/Logs.d.ts +22 -0
- package/base/Logs.d.ts.map +1 -0
- package/base/Logs.js +57 -0
- package/base/Model.js +4 -4
- package/base/RestClient.d.ts +0 -2
- package/base/RestClient.d.ts.map +1 -1
- package/base/RestClient.js +0 -1
- package/base/index.d.ts +1 -0
- package/base/index.d.ts.map +1 -1
- package/base/index.js +3 -1
- package/filters/AccessControl.js +3 -6
- package/filters/AccessRule.js +7 -10
- package/filters/auth/HttpHeaderAuth.js +2 -5
- package/index.d.ts +9 -4
- package/index.d.ts.map +1 -1
- package/index.js +5 -16
- package/package.json +1 -3
- package/rbac/AuthManager.js +9 -12
- package/requiments/Utils.d.ts +8 -2
- package/requiments/Utils.d.ts.map +1 -1
- package/requiments/Utils.js +4 -2
- package/web/IdentityInterface.d.ts +1 -1
- package/web/IdentityInterface.d.ts.map +1 -1
- package/web/WebUser.js +2 -2
- package/base/Logger.d.ts +0 -18
- package/base/Logger.d.ts.map +0 -1
- package/base/Logger.js +0 -49
package/BaseChyz.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Logs } from "./base/Logs";
|
|
2
2
|
export default class BaseChyz {
|
|
3
3
|
private config;
|
|
4
4
|
static app: string;
|
|
@@ -7,16 +7,17 @@ export default class BaseChyz {
|
|
|
7
7
|
private _port;
|
|
8
8
|
static db: any;
|
|
9
9
|
static routes: any;
|
|
10
|
+
static logs: Logs;
|
|
10
11
|
private static _validate;
|
|
11
|
-
private _logConfig;
|
|
12
12
|
private _controllerpath;
|
|
13
13
|
private static controllers;
|
|
14
14
|
static components: any;
|
|
15
15
|
static middlewares: any;
|
|
16
|
-
get logConfig(): any;
|
|
17
|
-
set logConfig(value: any);
|
|
18
16
|
get controllerpath(): string;
|
|
19
17
|
set controllerpath(value: string);
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
20
21
|
init(): void;
|
|
21
22
|
/**
|
|
22
23
|
* Listen port number
|
|
@@ -32,9 +33,6 @@ export default class BaseChyz {
|
|
|
32
33
|
static get validate(): any;
|
|
33
34
|
static set validate(value: any);
|
|
34
35
|
app(config?: any): BaseChyz;
|
|
35
|
-
logProvider(): any;
|
|
36
|
-
getLogger(): any;
|
|
37
|
-
static logs(...args: any[]): any;
|
|
38
36
|
static trace(...args: any[]): void;
|
|
39
37
|
static debug(...args: any[]): void;
|
|
40
38
|
static info(...args: any[]): void;
|
package/BaseChyz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AA8EjC,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAuB;IACrC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,OAAO,MAAS;IACvB,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;IAGnC,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;IAED;;OAEG;IACH,IAAI;IAmCJ;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAGD,MAAM,KAAK,QAAQ,IAAI,GAAG,CAEzB;IAED,MAAM,KAAK,QAAQ,CAAC,KAAK,EAAE,GAAG,EAE7B;IAED,GAAG,CAAC,MAAM,GAAE,GAAQ,GAAG,QAAQ;WAiDjB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAItB,CAAC,CAAC,IAAI,EAAE,MAAM;IAKrB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,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;IACG,UAAU;IAyBhB;;OAEG;IACG,cAAc;IA4Eb,UAAU;IAwDV,KAAK;CAwBf"}
|
package/BaseChyz.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,17 +31,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
require("reflect-metadata");
|
|
16
35
|
const base_1 = require("./base");
|
|
17
|
-
const Utils_1 =
|
|
36
|
+
const Utils_1 = __importStar(require("./requiments/Utils"));
|
|
37
|
+
const Logs_1 = require("./base/Logs");
|
|
18
38
|
const https = require('https');
|
|
19
39
|
const express = require("express");
|
|
20
40
|
const compression = require('compression');
|
|
21
|
-
const log4js = require("log4js");
|
|
22
41
|
const fs = require('fs');
|
|
23
42
|
const validate = require('validate.js');
|
|
24
43
|
/**
|
|
@@ -43,7 +62,7 @@ validate.validators.array = (arrayItems, itemConstraints) => {
|
|
|
43
62
|
errors[index] = { error: error };
|
|
44
63
|
return errors;
|
|
45
64
|
}, {});
|
|
46
|
-
return Utils_1.
|
|
65
|
+
return Utils_1.Utils.isEmpty(arrayItemErrors) ? null : { errors: arrayItemErrors };
|
|
47
66
|
};
|
|
48
67
|
validate.validators.tokenString = (items, itemConstraints) => {
|
|
49
68
|
let arrayItems = items.split(",");
|
|
@@ -53,49 +72,46 @@ validate.validators.tokenString = (items, itemConstraints) => {
|
|
|
53
72
|
errors[index] = { error: error };
|
|
54
73
|
return errors;
|
|
55
74
|
}, {});
|
|
56
|
-
return Utils_1.
|
|
75
|
+
return Utils_1.Utils.isEmpty(arrayItemErrors) ? null : { errors: arrayItemErrors };
|
|
57
76
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
const ip = require('ip');
|
|
78
|
+
const bodyParser = require('body-parser');
|
|
79
|
+
const methodOverride = require('method-override');
|
|
80
|
+
const Server = express();
|
|
81
|
+
const cors = require('cors');
|
|
82
|
+
/**
|
|
83
|
+
* set request id
|
|
84
|
+
*/
|
|
85
|
+
Object.defineProperty(Server.request, 'reqId', {
|
|
86
|
+
configurable: true,
|
|
87
|
+
enumerable: true,
|
|
88
|
+
writable: true
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(Server.request, 'user', {
|
|
91
|
+
configurable: true,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
writable: true
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(Server.request, 'identity', {
|
|
96
|
+
configurable: true,
|
|
97
|
+
enumerable: true,
|
|
98
|
+
writable: true
|
|
99
|
+
});
|
|
61
100
|
class BaseChyz {
|
|
62
101
|
constructor() {
|
|
63
|
-
var _a;
|
|
64
102
|
this._port = 3001;
|
|
65
|
-
this._logConfig = (_a = require('./log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
|
|
66
103
|
this._controllerpath = "Controllers";
|
|
67
104
|
}
|
|
68
|
-
get logConfig() {
|
|
69
|
-
return this._logConfig;
|
|
70
|
-
}
|
|
71
|
-
set logConfig(value) {
|
|
72
|
-
this._logConfig = value;
|
|
73
|
-
}
|
|
74
105
|
get controllerpath() {
|
|
75
106
|
return this._controllerpath;
|
|
76
107
|
}
|
|
77
108
|
set controllerpath(value) {
|
|
78
109
|
this._controllerpath = value;
|
|
79
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
*/
|
|
80
114
|
init() {
|
|
81
|
-
/**
|
|
82
|
-
* set request id
|
|
83
|
-
*/
|
|
84
|
-
Object.defineProperty(BaseChyz.express.request, 'reqId', {
|
|
85
|
-
configurable: true,
|
|
86
|
-
enumerable: true,
|
|
87
|
-
writable: true
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(BaseChyz.express.request, 'user', {
|
|
90
|
-
configurable: true,
|
|
91
|
-
enumerable: true,
|
|
92
|
-
writable: true
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(BaseChyz.express.request, 'identity', {
|
|
95
|
-
configurable: true,
|
|
96
|
-
enumerable: true,
|
|
97
|
-
writable: true
|
|
98
|
-
});
|
|
99
115
|
/**
|
|
100
116
|
* server port setting
|
|
101
117
|
*/
|
|
@@ -147,16 +163,19 @@ class BaseChyz {
|
|
|
147
163
|
* Config set
|
|
148
164
|
*/
|
|
149
165
|
this.config = config;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
166
|
+
/**
|
|
167
|
+
* log setting
|
|
168
|
+
*/
|
|
169
|
+
if (this.config.logs instanceof Logs_1.Logs) {
|
|
170
|
+
BaseChyz.logs = this.config.logs;
|
|
171
|
+
}
|
|
172
|
+
let components = Utils_1.Utils.findKeyValue(config, "components");
|
|
154
173
|
if (components) {
|
|
155
174
|
for (const componentsKey in components) {
|
|
156
175
|
let comp = components[componentsKey];
|
|
157
176
|
BaseChyz.debug("Create Component ", componentsKey);
|
|
158
177
|
try {
|
|
159
|
-
BaseChyz.components[componentsKey] = Utils_1.
|
|
178
|
+
BaseChyz.components[componentsKey] = Utils_1.Utils.createObject(new comp.class, comp);
|
|
160
179
|
(_a = BaseChyz.components[componentsKey]) === null || _a === void 0 ? void 0 : _a.init();
|
|
161
180
|
}
|
|
162
181
|
catch (e) {
|
|
@@ -164,11 +183,11 @@ class BaseChyz {
|
|
|
164
183
|
}
|
|
165
184
|
}
|
|
166
185
|
}
|
|
167
|
-
let middlewares = Utils_1.
|
|
186
|
+
let middlewares = Utils_1.Utils.findKeyValue(config, "middlewares");
|
|
168
187
|
if (middlewares) {
|
|
169
188
|
for (const middlewareKey in middlewares) {
|
|
170
189
|
let middleware1 = middlewares[middlewareKey];
|
|
171
|
-
BaseChyz.
|
|
190
|
+
BaseChyz.debug("Create middlewares ", middlewareKey);
|
|
172
191
|
BaseChyz.middlewares[middlewareKey] = middleware1;
|
|
173
192
|
// BaseChyz.middlewares[middlewareKey] = Utils.createObject(new middleware1.class, middleware1);
|
|
174
193
|
}
|
|
@@ -176,35 +195,26 @@ class BaseChyz {
|
|
|
176
195
|
this.init();
|
|
177
196
|
return this;
|
|
178
197
|
}
|
|
179
|
-
logProvider() {
|
|
180
|
-
return log4js;
|
|
181
|
-
}
|
|
182
|
-
getLogger() {
|
|
183
|
-
return this.logProvider().getLogger(this.constructor.name);
|
|
184
|
-
}
|
|
185
|
-
static logs(...args) {
|
|
186
|
-
return log4js.getLogger(this.name);
|
|
187
|
-
}
|
|
188
198
|
static trace(...args) {
|
|
189
|
-
BaseChyz.logs
|
|
199
|
+
BaseChyz.logs.fatal(...arguments);
|
|
190
200
|
}
|
|
191
201
|
static debug(...args) {
|
|
192
|
-
BaseChyz.logs
|
|
202
|
+
BaseChyz.logs.debug(...arguments);
|
|
193
203
|
}
|
|
194
204
|
static info(...args) {
|
|
195
|
-
BaseChyz.logs
|
|
205
|
+
BaseChyz.logs.info(...arguments);
|
|
196
206
|
}
|
|
197
207
|
static warn(...args) {
|
|
198
|
-
BaseChyz.logs
|
|
208
|
+
BaseChyz.logs.warn(...arguments);
|
|
199
209
|
}
|
|
200
210
|
static error(...args) {
|
|
201
|
-
BaseChyz.logs
|
|
211
|
+
BaseChyz.logs.error(...arguments);
|
|
202
212
|
}
|
|
203
213
|
static fatal(...args) {
|
|
204
|
-
BaseChyz.logs
|
|
214
|
+
BaseChyz.logs.fatal(...arguments);
|
|
205
215
|
}
|
|
206
216
|
static warning(...args) {
|
|
207
|
-
BaseChyz.logs
|
|
217
|
+
BaseChyz.logs.warn(...arguments);
|
|
208
218
|
}
|
|
209
219
|
static t(text) {
|
|
210
220
|
return text;
|
|
@@ -251,6 +261,9 @@ class BaseChyz {
|
|
|
251
261
|
models[className.replace("Class", "")] = new model[className];
|
|
252
262
|
}
|
|
253
263
|
});
|
|
264
|
+
/**
|
|
265
|
+
*
|
|
266
|
+
*/
|
|
254
267
|
base_1.ModelManager._register(models);
|
|
255
268
|
for (const key of Object.keys(base_1.ModelManager)) {
|
|
256
269
|
if (key != "_register") {
|
|
@@ -266,8 +279,17 @@ class BaseChyz {
|
|
|
266
279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
267
280
|
// let articlesEndpoints: string[] = [];
|
|
268
281
|
for (const file of fs.readdirSync(`${this._controllerpath}/`)) {
|
|
269
|
-
let controller = require(`${this._controllerpath}/${file}`);
|
|
270
|
-
|
|
282
|
+
// let controller = require(`${this._controllerpath}/${file}`);
|
|
283
|
+
let controller = (yield Promise.resolve().then(() => __importStar(require(`${this._controllerpath}/${file}`))));
|
|
284
|
+
if (controller[file.replace(".ts", "")]) {
|
|
285
|
+
controller = controller[file.replace(".ts", "")];
|
|
286
|
+
}
|
|
287
|
+
else if (controller.default) {
|
|
288
|
+
controller = controller.default;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
throw new base_1.InvalidConfigException((0, Utils_1.default)("Invalid Controller"));
|
|
292
|
+
}
|
|
271
293
|
// This is our instantiated class
|
|
272
294
|
const instance = new controller();
|
|
273
295
|
BaseChyz.controllers.push(instance);
|
|
@@ -277,12 +299,12 @@ class BaseChyz {
|
|
|
277
299
|
// Our `routes` array containing all our routes for this controller
|
|
278
300
|
// @ts-ignore
|
|
279
301
|
const routes = Reflect.getMetadata('routes', controller);
|
|
280
|
-
BaseChyz.
|
|
302
|
+
BaseChyz.debug("Controller load ", controller.name, `(${prefix})`);
|
|
281
303
|
if (routes) {
|
|
282
304
|
routes.forEach(route => {
|
|
283
305
|
let actionId = route.path == "/" || route.path == "" ? instance.defaultAction : route.path;
|
|
284
306
|
route.id = actionId;
|
|
285
|
-
BaseChyz.
|
|
307
|
+
BaseChyz.debug("Controller route Path", prefix + (route.path.startsWith("/") ? route.path : `/${route.path}`));
|
|
286
308
|
BaseChyz.express[route.requestMethod](prefix + (route.path.startsWith("/") ? route.path : `/${route.path}`), (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
287
309
|
try {
|
|
288
310
|
BaseChyz.debug(`Call Request id ${instance.id}`);
|
|
@@ -325,23 +347,39 @@ class BaseChyz {
|
|
|
325
347
|
BaseChyz.express.use(bodyParser.json({ limit: '1mb' }));
|
|
326
348
|
BaseChyz.express.use(bodyParser.urlencoded({ limit: '1mb', extended: true })); // support encoded bodies
|
|
327
349
|
BaseChyz.express.use(methodOverride());
|
|
328
|
-
BaseChyz.express.use(
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
350
|
+
BaseChyz.express.use(cors());
|
|
351
|
+
//
|
|
352
|
+
// // CORS
|
|
353
|
+
// BaseChyz.express.use(function (req: any, res: Response, next: any) {
|
|
354
|
+
// // @ts-ignore
|
|
355
|
+
// req.reqId = Utils.uniqueId("chyzzzz_")
|
|
356
|
+
// res.setHeader('Content-Type', 'application/json');
|
|
357
|
+
// res.setHeader("Access-Control-Allow-Origin", "*");
|
|
358
|
+
// res.setHeader("Access-Control-Allow-Credentials", "true");
|
|
359
|
+
// res.setHeader("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
|
|
360
|
+
// res.setHeader("Access-Control-Allow-Headers", "Access-Control-Allow-Origin,Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers,Authorization");
|
|
361
|
+
// next();
|
|
362
|
+
// });
|
|
363
|
+
//
|
|
340
364
|
// compress all responses
|
|
341
|
-
|
|
365
|
+
const shouldCompress = (req, res) => {
|
|
366
|
+
// don't compress responses explicitly asking not
|
|
367
|
+
if (req.headers["x-no-compression"] || res.getHeader('Content-Type') === 'text/event-stream') {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
// use compression filter function
|
|
371
|
+
return compression.filter(req, res);
|
|
372
|
+
};
|
|
373
|
+
BaseChyz.express.use(compression({ filter: shouldCompress }));
|
|
374
|
+
//
|
|
375
|
+
// //static file path
|
|
376
|
+
if (this.config.staticFilePath) {
|
|
377
|
+
BaseChyz.info('Static file path', this.config.staticFilePath);
|
|
378
|
+
BaseChyz.express.use(express.static(this.config.staticFilePath));
|
|
379
|
+
}
|
|
342
380
|
//Middlewares
|
|
343
381
|
for (const middleware1 of Object.keys(BaseChyz.middlewares)) {
|
|
344
|
-
if (!Utils_1.
|
|
382
|
+
if (!Utils_1.Utils.isFunction(middleware1)) {
|
|
345
383
|
let keycloak = BaseChyz.middlewares[middleware1].keycloak;
|
|
346
384
|
BaseChyz.express.use(keycloak.middleware(BaseChyz.middlewares[middleware1].config));
|
|
347
385
|
}
|
|
@@ -376,7 +414,8 @@ class BaseChyz {
|
|
|
376
414
|
}
|
|
377
415
|
}
|
|
378
416
|
exports.default = BaseChyz;
|
|
379
|
-
BaseChyz.express =
|
|
417
|
+
BaseChyz.express = Server;
|
|
418
|
+
BaseChyz.logs = new Logs_1.Logs();
|
|
380
419
|
BaseChyz._validate = validate;
|
|
381
420
|
BaseChyz.controllers = [];
|
|
382
421
|
BaseChyz.components = {};
|
package/base/ActionFilter.js
CHANGED
|
@@ -8,12 +8,9 @@ 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
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.ActionFilter = void 0;
|
|
16
|
-
const Utils_1 =
|
|
13
|
+
const Utils_1 = require("../requiments/Utils");
|
|
17
14
|
const CBaseObject_1 = require("./CBaseObject");
|
|
18
15
|
class ActionFilter extends CBaseObject_1.CBaseObject {
|
|
19
16
|
constructor() {
|
|
@@ -60,13 +57,13 @@ class ActionFilter extends CBaseObject_1.CBaseObject {
|
|
|
60
57
|
let id = action.id;
|
|
61
58
|
let onlyMatch = false;
|
|
62
59
|
let exceptMatch = false;
|
|
63
|
-
if (Utils_1.
|
|
60
|
+
if (Utils_1.Utils.isEmpty(this.only)) {
|
|
64
61
|
onlyMatch = true;
|
|
65
62
|
}
|
|
66
63
|
else {
|
|
67
64
|
onlyMatch = false;
|
|
68
65
|
for (const onlyKey of this.only) {
|
|
69
|
-
if (Utils_1.
|
|
66
|
+
if (Utils_1.Utils.matchWildcard(action.id, onlyKey)) {
|
|
70
67
|
onlyMatch = true;
|
|
71
68
|
break;
|
|
72
69
|
}
|
package/base/BaseError.js
CHANGED
|
@@ -5,16 +5,13 @@
|
|
|
5
5
|
* E-mail: cihan@chy.com.tr
|
|
6
6
|
* Github:https://github.com/cihan53/
|
|
7
7
|
*/
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
9
|
exports.BaseError = void 0;
|
|
13
|
-
const Utils_1 =
|
|
10
|
+
const Utils_1 = require("../requiments/Utils");
|
|
14
11
|
class BaseError extends Error {
|
|
15
12
|
constructor(message, statusCode = 500) {
|
|
16
13
|
super(message);
|
|
17
|
-
this.message = Utils_1.
|
|
14
|
+
this.message = Utils_1.Utils.isString(message) ? message : JSON.stringify(message);
|
|
18
15
|
this.name = this.constructor.name; // good practice
|
|
19
16
|
this.statusCode = statusCode; // error code for responding to client
|
|
20
17
|
//Error.captureStackTrace(this)
|
package/base/CBaseObject.js
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.CBaseObject = void 0;
|
|
10
|
-
const
|
|
10
|
+
const index_1 = require("../index");
|
|
11
11
|
class CBaseObject {
|
|
12
12
|
init() {
|
|
13
|
-
|
|
13
|
+
index_1.BaseChyz.debug("BaseObject init.....");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.CBaseObject = CBaseObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CRequest.d.ts","sourceRoot":"","sources":["../../src/base/CRequest.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC"}
|
package/base/CRequest.js
ADDED
package/base/Component.js
CHANGED
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
* E-mail: cihan@chy.com.tr
|
|
6
6
|
* Github:https://github.com/cihan53/
|
|
7
7
|
*/
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
9
|
exports.Component = void 0;
|
|
13
10
|
const CBaseObject_1 = require("./CBaseObject");
|
|
14
|
-
const Utils_1 =
|
|
11
|
+
const Utils_1 = require("../requiments/Utils");
|
|
15
12
|
class Component extends CBaseObject_1.CBaseObject {
|
|
16
13
|
constructor() {
|
|
17
14
|
/**
|
|
@@ -50,7 +47,7 @@ class Component extends CBaseObject_1.CBaseObject {
|
|
|
50
47
|
}
|
|
51
48
|
attachBehaviorInternal(name, behavior) {
|
|
52
49
|
if (!this._behaviors.hasOwnProperty(name)) {
|
|
53
|
-
let beh = Utils_1.
|
|
50
|
+
let beh = Utils_1.Utils.createObject(new behavior[name].class, behavior[name]);
|
|
54
51
|
beh.init();
|
|
55
52
|
this._behaviors[name] = beh;
|
|
56
53
|
}
|
package/base/Logs.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Configurable } from "./Configurable";
|
|
2
|
+
export declare class Logs implements Configurable {
|
|
3
|
+
name: string;
|
|
4
|
+
configs: any;
|
|
5
|
+
constructor(name?: string, configs?: any);
|
|
6
|
+
init(): void;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
Provider(): any;
|
|
12
|
+
logs(...args: any[]): any;
|
|
13
|
+
debug(...args: any[]): void;
|
|
14
|
+
info(...args: any[]): void;
|
|
15
|
+
warn(...args: any[]): void;
|
|
16
|
+
error(...args: any[]): void;
|
|
17
|
+
fatal(...args: any[]): void;
|
|
18
|
+
warning(...args: any[]): void;
|
|
19
|
+
}
|
|
20
|
+
declare const _default: Logs;
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=Logs.d.ts.map
|
|
@@ -0,0 +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;IAKJ;;;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
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022.. Chy Bilgisayar Bilisim
|
|
5
|
+
* Author: Cihan Ozturk
|
|
6
|
+
* E-mail: cihan@chy.com.tr
|
|
7
|
+
* Github:https://github.com/cihan53/
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.Logs = void 0;
|
|
12
|
+
const log4js = require("log4js");
|
|
13
|
+
class Logs {
|
|
14
|
+
constructor(name, configs) {
|
|
15
|
+
var _a;
|
|
16
|
+
this.name = this.constructor.name;
|
|
17
|
+
this.configs = (_a = require('../log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
|
|
18
|
+
if (name)
|
|
19
|
+
this.name = name;
|
|
20
|
+
if (configs)
|
|
21
|
+
this.configs = configs;
|
|
22
|
+
this.Provider().configure(this.configs);
|
|
23
|
+
}
|
|
24
|
+
init() {
|
|
25
|
+
this.Provider().configure(this.configs);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @constructor
|
|
30
|
+
*/
|
|
31
|
+
Provider() {
|
|
32
|
+
return log4js;
|
|
33
|
+
}
|
|
34
|
+
logs(...args) {
|
|
35
|
+
return log4js.getLogger(this.name);
|
|
36
|
+
}
|
|
37
|
+
debug(...args) {
|
|
38
|
+
this.logs().debug(...arguments);
|
|
39
|
+
}
|
|
40
|
+
info(...args) {
|
|
41
|
+
this.logs().info(...arguments);
|
|
42
|
+
}
|
|
43
|
+
warn(...args) {
|
|
44
|
+
this.logs().warn(...arguments);
|
|
45
|
+
}
|
|
46
|
+
error(...args) {
|
|
47
|
+
this.logs().error(...arguments);
|
|
48
|
+
}
|
|
49
|
+
fatal(...args) {
|
|
50
|
+
this.logs().fatal(...arguments);
|
|
51
|
+
}
|
|
52
|
+
warning(...args) {
|
|
53
|
+
this.logs().warn(...arguments);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Logs = Logs;
|
|
57
|
+
exports.default = new Logs();
|
package/base/Model.js
CHANGED
|
@@ -20,7 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.Model = exports.NOW = exports.DataTypes = void 0;
|
|
22
22
|
const BaseChyz_1 = __importDefault(require("../BaseChyz"));
|
|
23
|
-
const Utils_1 =
|
|
23
|
+
const Utils_1 = require("../requiments/Utils");
|
|
24
24
|
const Component_1 = require("./Component");
|
|
25
25
|
const InvalidConfigException_1 = require("./InvalidConfigException");
|
|
26
26
|
const sequelize_1 = require("sequelize");
|
|
@@ -93,7 +93,7 @@ class Model extends Component_1.Component {
|
|
|
93
93
|
this._sequelize = sequelize;
|
|
94
94
|
else
|
|
95
95
|
this._sequelize = this.getDb();
|
|
96
|
-
if (!Utils_1.
|
|
96
|
+
if (!Utils_1.Utils.isEmpty(this.attributes())) {
|
|
97
97
|
this._model = this._sequelize.define(this._tableName, this.attributes(), {
|
|
98
98
|
tableName: this.tableName(),
|
|
99
99
|
timestamps: false,
|
|
@@ -457,7 +457,7 @@ class Model extends Component_1.Component {
|
|
|
457
457
|
*/
|
|
458
458
|
load(data, formName = null) {
|
|
459
459
|
let scope = formName === null ? this.formName() : formName;
|
|
460
|
-
if (scope === '' && !Utils_1.
|
|
460
|
+
if (scope === '' && !Utils_1.Utils.isEmpty(data)) {
|
|
461
461
|
this.setAttribute(data);
|
|
462
462
|
return true;
|
|
463
463
|
}
|
|
@@ -469,7 +469,7 @@ class Model extends Component_1.Component {
|
|
|
469
469
|
}
|
|
470
470
|
bulkLoad(data, formName = null) {
|
|
471
471
|
let scope = formName === null ? this.formName() : formName;
|
|
472
|
-
if (scope === '' && !Utils_1.
|
|
472
|
+
if (scope === '' && !Utils_1.Utils.isEmpty(data)) {
|
|
473
473
|
this.setAttribute(data);
|
|
474
474
|
return true;
|
|
475
475
|
}
|
package/base/RestClient.d.ts
CHANGED
package/base/RestClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../src/base/RestClient.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,qBAAa,UAAW,SAAQ,SAAS;IAC9B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI3C,IAAI,CAAC,MAAM,EAAE,GAAG;CAG1B
|
|
1
|
+
{"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../src/base/RestClient.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,qBAAa,UAAW,SAAQ,SAAS;IAC9B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI3C,IAAI,CAAC,MAAM,EAAE,GAAG;CAG1B"}
|
package/base/RestClient.js
CHANGED
package/base/index.d.ts
CHANGED
package/base/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAC,KAAK,EAAC,QAAQ,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,SAAS,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAC,KAAK,EAAC,QAAQ,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,SAAS,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA"}
|
package/base/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModelManager = exports.RestClient = exports.NOW = exports.DataTypes = 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.ActionFilter = exports.BaseError = void 0;
|
|
3
|
+
exports.ModelManager = exports.RestClient = exports.NOW = exports.DataTypes = 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.ActionFilter = exports.BaseError = exports.Logs = void 0;
|
|
4
|
+
var Logs_1 = require("./Logs");
|
|
5
|
+
Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return Logs_1.Logs; } });
|
|
4
6
|
var BaseError_1 = require("./BaseError");
|
|
5
7
|
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return BaseError_1.BaseError; } });
|
|
6
8
|
var ActionFilter_1 = require("./ActionFilter");
|
package/filters/AccessControl.js
CHANGED
|
@@ -8,9 +8,6 @@ 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
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.AccessControl = void 0;
|
|
16
13
|
/*
|
|
@@ -24,7 +21,7 @@ const ForbiddenHttpException_1 = require("../base/ForbiddenHttpException");
|
|
|
24
21
|
const ActionFilter_1 = require("../base/ActionFilter");
|
|
25
22
|
const AccessRule_1 = require("./AccessRule");
|
|
26
23
|
const WebUser_1 = require("../web/WebUser");
|
|
27
|
-
const Utils_1 =
|
|
24
|
+
const Utils_1 = require("../requiments/Utils");
|
|
28
25
|
class AccessControl extends ActionFilter_1.ActionFilter {
|
|
29
26
|
constructor() {
|
|
30
27
|
super(...arguments);
|
|
@@ -35,11 +32,11 @@ class AccessControl extends ActionFilter_1.ActionFilter {
|
|
|
35
32
|
var _a;
|
|
36
33
|
super.init();
|
|
37
34
|
if (this.user == undefined) {
|
|
38
|
-
this.user = (_a = Utils_1.
|
|
35
|
+
this.user = (_a = Utils_1.Utils.cloneDeep(index_1.BaseChyz.getComponent("user"))) !== null && _a !== void 0 ? _a : new WebUser_1.WebUser();
|
|
39
36
|
}
|
|
40
37
|
this.rules.forEach((rule, index) => {
|
|
41
38
|
if (rule === Object(rule)) {
|
|
42
|
-
this.rules[index] = Utils_1.
|
|
39
|
+
this.rules[index] = Utils_1.Utils.createObject(new AccessRule_1.AccessRule(), rule);
|
|
43
40
|
}
|
|
44
41
|
});
|
|
45
42
|
}
|
package/filters/AccessRule.js
CHANGED
|
@@ -8,14 +8,11 @@ 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
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.AccessRule = void 0;
|
|
16
13
|
const Component_1 = require("../base/Component");
|
|
17
14
|
const InvalidConfigException_1 = require("../base/InvalidConfigException");
|
|
18
|
-
const Utils_1 =
|
|
15
|
+
const Utils_1 = require("../requiments/Utils");
|
|
19
16
|
var _ = require('lodash');
|
|
20
17
|
class AccessRule extends Component_1.Component {
|
|
21
18
|
constructor() {
|
|
@@ -99,11 +96,11 @@ class AccessRule extends Component_1.Component {
|
|
|
99
96
|
}
|
|
100
97
|
matchRole(user) {
|
|
101
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
let items = Utils_1.
|
|
103
|
-
if (!Utils_1.
|
|
104
|
-
items = Utils_1.
|
|
99
|
+
let items = Utils_1.Utils.isEmpty(this.roles) ? [] : this.roles;
|
|
100
|
+
if (!Utils_1.Utils.isEmpty(this.permissions)) {
|
|
101
|
+
items = Utils_1.Utils.merge(items, this.permissions);
|
|
105
102
|
}
|
|
106
|
-
if (Utils_1.
|
|
103
|
+
if (Utils_1.Utils.isEmpty(items)) {
|
|
107
104
|
return true;
|
|
108
105
|
}
|
|
109
106
|
if (!user) {
|
|
@@ -125,8 +122,8 @@ class AccessRule extends Component_1.Component {
|
|
|
125
122
|
}
|
|
126
123
|
else {
|
|
127
124
|
//roleparams
|
|
128
|
-
if (!Utils_1.
|
|
129
|
-
roleParams = !Utils_1.
|
|
125
|
+
if (!Utils_1.Utils.isEmpty(this.roleParams)) {
|
|
126
|
+
roleParams = !Utils_1.Utils.isArray(this.roleParams) ? this.roleParams.apply(this) : this.roleParams;
|
|
130
127
|
}
|
|
131
128
|
if (yield user.can(item, this.roleParams)) {
|
|
132
129
|
return true;
|
|
@@ -14,13 +14,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
18
|
exports.HttpHeaderAuth = void 0;
|
|
22
19
|
const AuthMethod_1 = require("./AuthMethod");
|
|
23
|
-
const Utils_1 =
|
|
20
|
+
const Utils_1 = require("../../requiments/Utils");
|
|
24
21
|
class HttpHeaderAuth extends AuthMethod_1.AuthMethod {
|
|
25
22
|
constructor() {
|
|
26
23
|
super(...arguments);
|
|
@@ -34,7 +31,7 @@ class HttpHeaderAuth extends AuthMethod_1.AuthMethod {
|
|
|
34
31
|
let key = Object.keys(request.headers).find(key => key.toLowerCase() === this.header.toLowerCase());
|
|
35
32
|
if (key) {
|
|
36
33
|
let authHeader = request.headers[key];
|
|
37
|
-
if (!Utils_1.
|
|
34
|
+
if (!Utils_1.Utils.isEmpty(authHeader)) {
|
|
38
35
|
if (this.pattern) {
|
|
39
36
|
//preg_match
|
|
40
37
|
let matches = authHeader.match(this.pattern);
|
package/index.d.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
declare module "express-serve-static-core" {
|
|
2
|
+
interface Request {
|
|
3
|
+
identity: any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
import { RestClient } from "./base/RestClient";
|
|
2
7
|
import BaseChyz from "./BaseChyz";
|
|
3
8
|
/**
|
|
4
9
|
*
|
|
5
10
|
*/
|
|
6
11
|
declare const Chyz: BaseChyz;
|
|
7
|
-
export { Request, Response, NextFunction } from "
|
|
12
|
+
export { Request, Response, NextFunction } from "./base/CRequest";
|
|
8
13
|
export { RouteDefinition } from "./model/RouteDefinition";
|
|
9
14
|
export { WebUser } from "./web/WebUser";
|
|
10
15
|
export { BaseChyz, RestClient };
|
|
11
|
-
export { ActionFilter, BaseError, Behavior, Component, Configurable, CWebController, DbConnection, ForbiddenHttpException, InvalidConfigException, InvalidArgumentException, NotFoundHttpException, UnauthorizedHttpException, DataErrorDbException, ValidationHttpException, Model, ModelManager, } from "./base";
|
|
16
|
+
export { Logs, ActionFilter, BaseError, Behavior, Component, Configurable, CWebController, DbConnection, ForbiddenHttpException, InvalidConfigException, InvalidArgumentException, NotFoundHttpException, UnauthorizedHttpException, DataErrorDbException, ValidationHttpException, Model, ModelManager, } from "./base";
|
|
12
17
|
export * from "./filters";
|
|
13
18
|
export * from "./filters/auth";
|
|
14
19
|
export * from "./decorator";
|
|
15
|
-
export *
|
|
20
|
+
export * from "./requiments/Utils";
|
|
16
21
|
export default Chyz;
|
|
17
22
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;AAGD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC;;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,GACf,MAAM,QAAQ,CAAC;AAChB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,eAAe,IAAI,CAAC"}
|
package/index.js
CHANGED
|
@@ -18,28 +18,16 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
19
|
o[k2] = m[k];
|
|
20
20
|
}));
|
|
21
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
-
}) : function(o, v) {
|
|
24
|
-
o["default"] = v;
|
|
25
|
-
});
|
|
26
21
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
23
|
};
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
26
|
};
|
|
39
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.
|
|
41
|
-
const RestClient_1 =
|
|
42
|
-
exports
|
|
28
|
+
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;
|
|
29
|
+
const RestClient_1 = require("./base/RestClient");
|
|
30
|
+
Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return RestClient_1.RestClient; } });
|
|
43
31
|
const BaseChyz_1 = __importDefault(require("./BaseChyz"));
|
|
44
32
|
exports.BaseChyz = BaseChyz_1.default;
|
|
45
33
|
/**
|
|
@@ -49,6 +37,7 @@ const Chyz = new BaseChyz_1.default();
|
|
|
49
37
|
var WebUser_1 = require("./web/WebUser");
|
|
50
38
|
Object.defineProperty(exports, "WebUser", { enumerable: true, get: function () { return WebUser_1.WebUser; } });
|
|
51
39
|
var base_1 = require("./base");
|
|
40
|
+
Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return base_1.Logs; } });
|
|
52
41
|
Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return base_1.ActionFilter; } });
|
|
53
42
|
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_1.BaseError; } });
|
|
54
43
|
Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return base_1.Behavior; } });
|
|
@@ -67,5 +56,5 @@ Object.defineProperty(exports, "ModelManager", { enumerable: true, get: function
|
|
|
67
56
|
__exportStar(require("./filters"), exports);
|
|
68
57
|
__exportStar(require("./filters/auth"), exports);
|
|
69
58
|
__exportStar(require("./decorator"), exports);
|
|
70
|
-
|
|
59
|
+
__exportStar(require("./requiments/Utils"), exports);
|
|
71
60
|
exports.default = Chyz;
|
package/package.json
CHANGED
package/rbac/AuthManager.js
CHANGED
|
@@ -8,14 +8,11 @@ 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
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.AuthManager = void 0;
|
|
16
13
|
const base_1 = require("../base");
|
|
17
14
|
const index_1 = require("../index");
|
|
18
|
-
const Utils_1 =
|
|
15
|
+
const Utils_1 = require("../requiments/Utils");
|
|
19
16
|
class AuthManager extends base_1.Component {
|
|
20
17
|
constructor() {
|
|
21
18
|
super(...arguments);
|
|
@@ -58,7 +55,7 @@ class AuthManager extends base_1.Component {
|
|
|
58
55
|
* @todo
|
|
59
56
|
* Rule test edilmeli
|
|
60
57
|
*/
|
|
61
|
-
if (assignments[itemname] || Utils_1.
|
|
58
|
+
if (assignments[itemname] || Utils_1.Utils.find(this.defaultRoles, itemname)) {
|
|
62
59
|
return true;
|
|
63
60
|
}
|
|
64
61
|
/**
|
|
@@ -134,11 +131,11 @@ class AuthManager extends base_1.Component {
|
|
|
134
131
|
roles[roleName] = role;
|
|
135
132
|
let _roles = yield this.getRoles();
|
|
136
133
|
let _r = {};
|
|
137
|
-
Utils_1.
|
|
134
|
+
Utils_1.Utils.forEach(_roles, (item) => {
|
|
138
135
|
if (result.result[item.name])
|
|
139
136
|
_r[item.name] = item;
|
|
140
137
|
});
|
|
141
|
-
return Utils_1.
|
|
138
|
+
return Utils_1.Utils.merge(roles, _r);
|
|
142
139
|
});
|
|
143
140
|
}
|
|
144
141
|
/**
|
|
@@ -151,7 +148,7 @@ class AuthManager extends base_1.Component {
|
|
|
151
148
|
const result = { result: {} };
|
|
152
149
|
let permissions = {};
|
|
153
150
|
yield this.getChildrenRecursive(roleName, childrenList, result);
|
|
154
|
-
if (Utils_1.
|
|
151
|
+
if (Utils_1.Utils.isEmpty(result.result)) {
|
|
155
152
|
return {};
|
|
156
153
|
}
|
|
157
154
|
let itemResult = yield base_1.ModelManager.AuthItem.findAll({
|
|
@@ -177,7 +174,7 @@ class AuthManager extends base_1.Component {
|
|
|
177
174
|
}
|
|
178
175
|
let directPermission = yield this.getDirectPermissionsByUser(userId);
|
|
179
176
|
let inheritedPermission = yield this.getInheritedPermissionsByUser(userId);
|
|
180
|
-
return Utils_1.
|
|
177
|
+
return Utils_1.Utils.merge(directPermission, inheritedPermission);
|
|
181
178
|
});
|
|
182
179
|
}
|
|
183
180
|
/**
|
|
@@ -214,7 +211,7 @@ class AuthManager extends base_1.Component {
|
|
|
214
211
|
for (const userAssignmentElement of userAssignment) {
|
|
215
212
|
this.getChildrenRecursive(userAssignmentElement.item_name, childrenList, result);
|
|
216
213
|
}
|
|
217
|
-
if (Utils_1.
|
|
214
|
+
if (Utils_1.Utils.isEmpty(result.result)) {
|
|
218
215
|
return {};
|
|
219
216
|
}
|
|
220
217
|
let itemResult = yield base_1.ModelManager.AuthItem.findAll({
|
|
@@ -328,7 +325,7 @@ class AuthManager extends base_1.Component {
|
|
|
328
325
|
let items = yield base_1.ModelManager.AuthItemChild.findAll();
|
|
329
326
|
let parents = {};
|
|
330
327
|
for (const item of items) {
|
|
331
|
-
parents[item["parent"]] = Utils_1.
|
|
328
|
+
parents[item["parent"]] = Utils_1.Utils.concat(parents[item["parent"]] || [], [item["child"]]);
|
|
332
329
|
}
|
|
333
330
|
return parents;
|
|
334
331
|
});
|
|
@@ -350,7 +347,7 @@ class AuthManager extends base_1.Component {
|
|
|
350
347
|
* @since 2.0.11
|
|
351
348
|
*/
|
|
352
349
|
hasNoAssignments(assignments) {
|
|
353
|
-
return Utils_1.
|
|
350
|
+
return Utils_1.Utils.isEmpty(assignments) && Utils_1.Utils.isEmpty(this.defaultRoles);
|
|
354
351
|
}
|
|
355
352
|
}
|
|
356
353
|
exports.AuthManager = AuthManager;
|
package/requiments/Utils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/requiments/Utils.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/requiments/Utils.ts"],"names":[],"mappings":"AAkGA;;;GAGG;AACH,QAAA,MAAM,CAAC,SAAmB,MAAM,WAE/B,CAAA;AAED,eAAO,MAAM,KAAK,KAOjB,CAAA;AACD,OAAO,EAAC,CAAC,EAAC,CAAA;AACV,eAAe,CAAC,CAAC"}
|
package/requiments/Utils.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
// import _ from "lodash";
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.t = exports.Utils = void 0;
|
|
10
11
|
const _ = require('lodash');
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
@@ -102,9 +103,10 @@ const matchWildcard = (pattern, string, options = {}) => {
|
|
|
102
103
|
const t = function (text) {
|
|
103
104
|
return text;
|
|
104
105
|
};
|
|
105
|
-
exports.
|
|
106
|
+
exports.t = t;
|
|
107
|
+
exports.Utils = Object.assign({ findKeyValue,
|
|
106
108
|
createObject,
|
|
107
|
-
findKeyValue,
|
|
108
109
|
sleep,
|
|
109
110
|
matchWildcard,
|
|
110
111
|
toQuery }, _);
|
|
112
|
+
exports.default = t;
|
|
@@ -50,6 +50,6 @@ export interface IdentityInterface {
|
|
|
50
50
|
/**
|
|
51
51
|
*
|
|
52
52
|
*/
|
|
53
|
-
can(permissionName: string, params: any[], allowCaching: boolean): (boolean | null)
|
|
53
|
+
can(permissionName: string, params: any[], allowCaching: boolean): Promise<(boolean | null)>;
|
|
54
54
|
}
|
|
55
55
|
//# sourceMappingURL=IdentityInterface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentityInterface.d.ts","sourceRoot":"","sources":["../../src/web/IdentityInterface.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAA;IAE7B;;;;;;;;OAQG;IACH,yBAAyB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAEzD;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAGnD;;OAEG;IACH,GAAG,CAAC,cAAc,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAI,YAAY,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"IdentityInterface.d.ts","sourceRoot":"","sources":["../../src/web/IdentityInterface.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAA;IAE7B;;;;;;;;OAQG;IACH,yBAAyB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAEzD;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAGnD;;OAEG;IACH,GAAG,CAAC,cAAc,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAI,YAAY,EAAE,OAAO,GAAI,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAE;CAEnG"}
|
package/web/WebUser.js
CHANGED
|
@@ -23,7 +23,7 @@ const BaseChyz_1 = __importDefault(require("../BaseChyz"));
|
|
|
23
23
|
const Component_1 = require("../base/Component");
|
|
24
24
|
const ForbiddenHttpException_1 = require("../base/ForbiddenHttpException");
|
|
25
25
|
const InvalidConfigException_1 = require("../base/InvalidConfigException");
|
|
26
|
-
const Utils_1 =
|
|
26
|
+
const Utils_1 = require("../requiments/Utils");
|
|
27
27
|
class WebUser extends Component_1.Component {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
@@ -137,7 +137,7 @@ class WebUser extends Component_1.Component {
|
|
|
137
137
|
if ((accessChecker = this.getAccessChecker()) == null)
|
|
138
138
|
return false;
|
|
139
139
|
access = yield accessChecker.checkAccess(this.getId(), permissionName, params);
|
|
140
|
-
if (allowCaching && Utils_1.
|
|
140
|
+
if (allowCaching && Utils_1.Utils.isEmpty(params)) {
|
|
141
141
|
// this._access[$permissionName] = $access;
|
|
142
142
|
}
|
|
143
143
|
return access;
|
package/base/Logger.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Configurable } from "./Configurable";
|
|
2
|
-
export declare class Logger implements Configurable {
|
|
3
|
-
configs: any;
|
|
4
|
-
init(): void;
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @constructor
|
|
8
|
-
*/
|
|
9
|
-
Provider(): any;
|
|
10
|
-
static logs(...args: any[]): any;
|
|
11
|
-
static debug(...args: any[]): void;
|
|
12
|
-
static info(...args: any[]): void;
|
|
13
|
-
static warn(...args: any[]): void;
|
|
14
|
-
static error(...args: any[]): void;
|
|
15
|
-
static fatal(...args: any[]): void;
|
|
16
|
-
static warning(...args: any[]): void;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=Logger.d.ts.map
|
package/base/Logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/base/Logger.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,qBAAa,MAAO,YAAW,YAAY;IAEhC,OAAO,EAAE,GAAG,CAA4C;IAE/D,IAAI;IAIJ;;;OAGG;IACH,QAAQ;IAIR,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIZ,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIvC"}
|
package/base/Logger.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2022.. Chy Bilgisayar Bilisim
|
|
5
|
-
* Author: Cihan Ozturk
|
|
6
|
-
* E-mail: cihan@chy.com.tr
|
|
7
|
-
* Github:https://github.com/cihan53/
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.Logger = void 0;
|
|
12
|
-
const log4js = require("log4js");
|
|
13
|
-
class Logger {
|
|
14
|
-
constructor() {
|
|
15
|
-
var _a;
|
|
16
|
-
this.configs = (_a = require('./log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
|
|
17
|
-
}
|
|
18
|
-
init() {
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @constructor
|
|
23
|
-
*/
|
|
24
|
-
Provider() {
|
|
25
|
-
return log4js;
|
|
26
|
-
}
|
|
27
|
-
static logs(...args) {
|
|
28
|
-
return log4js.getLogger(this.name);
|
|
29
|
-
}
|
|
30
|
-
static debug(...args) {
|
|
31
|
-
Logger.logs().debug(...arguments);
|
|
32
|
-
}
|
|
33
|
-
static info(...args) {
|
|
34
|
-
Logger.logs().info(...arguments);
|
|
35
|
-
}
|
|
36
|
-
static warn(...args) {
|
|
37
|
-
Logger.logs().warn(...arguments);
|
|
38
|
-
}
|
|
39
|
-
static error(...args) {
|
|
40
|
-
Logger.logs().error(...arguments);
|
|
41
|
-
}
|
|
42
|
-
static fatal(...args) {
|
|
43
|
-
Logger.logs().fatal(...arguments);
|
|
44
|
-
}
|
|
45
|
-
static warning(...args) {
|
|
46
|
-
Logger.logs().warn(...arguments);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.Logger = Logger;
|