chyz 1.2.5-rc.2 → 1.2.5-rc.3
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 +62 -0
- package/BaseChyz.d.ts.map +1 -0
- package/BaseChyz.js +5 -5
- package/base/ActionFilter.d.ts +33 -0
- package/base/ActionFilter.d.ts.map +1 -0
- package/base/ActionFilter.js +18 -14
- package/base/BaseError.d.ts +11 -0
- package/base/BaseError.d.ts.map +1 -0
- package/base/BaseError.js +0 -1
- package/base/Behavior.d.ts +4 -0
- package/base/Behavior.d.ts.map +1 -0
- package/base/Behavior.js +2 -3
- package/base/CBaseObject.d.ts +5 -0
- package/base/CBaseObject.d.ts.map +1 -0
- package/base/CBaseObject.js +16 -0
- package/base/CWebController.d.ts +44 -0
- package/base/CWebController.d.ts.map +1 -0
- package/base/CWebController.js +0 -1
- package/base/Component.d.ts +21 -0
- package/base/Component.d.ts.map +1 -0
- package/base/Component.js +5 -6
- package/base/Configurable.d.ts +3 -0
- package/base/Configurable.d.ts.map +1 -0
- package/base/Configurable.js +0 -1
- package/base/DataErrorDbException.d.ts +6 -0
- package/base/DataErrorDbException.d.ts.map +1 -0
- package/base/DataErrorDbException.js +0 -1
- package/base/DbConnection.d.ts +13 -0
- package/base/DbConnection.d.ts.map +1 -0
- package/base/DbConnection.js +1 -2
- package/base/ForbiddenHttpException.d.ts +5 -0
- package/base/ForbiddenHttpException.d.ts.map +1 -0
- package/base/ForbiddenHttpException.js +0 -1
- package/base/InvalidArgumentException.d.ts +6 -0
- package/base/InvalidArgumentException.d.ts.map +1 -0
- package/base/InvalidArgumentException.js +0 -1
- package/base/InvalidConfigException.d.ts +6 -0
- package/base/InvalidConfigException.d.ts.map +1 -0
- package/base/InvalidConfigException.js +0 -1
- package/base/Logger.d.ts +18 -0
- package/base/Logger.d.ts.map +1 -0
- package/base/Logger.js +49 -0
- package/base/Model.d.ts +299 -0
- package/base/Model.d.ts.map +1 -0
- package/base/Model.js +0 -1
- package/base/ModelManager.d.ts +2 -0
- package/base/ModelManager.d.ts.map +1 -0
- package/base/ModelManager.js +11 -1
- package/base/NotFoundHttpException.d.ts +6 -0
- package/base/NotFoundHttpException.d.ts.map +1 -0
- package/base/NotFoundHttpException.js +0 -1
- package/base/RestClient.d.ts +9 -0
- package/base/RestClient.d.ts.map +1 -0
- package/base/RestClient.js +0 -1
- package/base/UnauthorizedHttpException.d.ts +6 -0
- package/base/UnauthorizedHttpException.d.ts.map +1 -0
- package/base/UnauthorizedHttpException.js +0 -1
- package/base/ValidationHttpException.d.ts +6 -0
- package/base/ValidationHttpException.d.ts.map +1 -0
- package/base/ValidationHttpException.js +0 -1
- package/base/db/Exception.d.ts +7 -0
- package/base/db/Exception.d.ts.map +1 -0
- package/base/db/Exception.js +0 -1
- package/base/index.d.ts +18 -0
- package/base/index.d.ts.map +1 -0
- package/base/index.js +3 -6
- package/decorator/Middleware.d.ts +4 -0
- package/decorator/Middleware.d.ts.map +1 -0
- package/decorator/Middleware.js +0 -1
- package/decorator/controller.d.ts +3 -0
- package/decorator/controller.d.ts.map +1 -0
- package/decorator/controller.js +0 -1
- package/decorator/enums/ControllerDecoratorParams.d.ts +6 -0
- package/decorator/enums/ControllerDecoratorParams.d.ts.map +1 -0
- package/decorator/enums/ControllerDecoratorParams.js +0 -1
- package/decorator/get.d.ts +3 -0
- package/decorator/get.d.ts.map +1 -0
- package/decorator/get.js +0 -1
- package/decorator/index.d.ts +4 -0
- package/decorator/index.d.ts.map +1 -0
- package/decorator/index.js +0 -1
- package/decorator/post.d.ts +3 -0
- package/decorator/post.d.ts.map +1 -0
- package/decorator/post.js +0 -1
- package/filters/AccessControl.d.ts +13 -0
- package/filters/AccessControl.d.ts.map +1 -0
- package/filters/AccessControl.js +4 -5
- package/filters/AccessRule.d.ts +83 -0
- package/filters/AccessRule.d.ts.map +1 -0
- package/filters/AccessRule.js +2 -2
- package/filters/auth/AuthInterface.d.ts +26 -0
- package/filters/auth/AuthInterface.d.ts.map +1 -0
- package/filters/auth/AuthInterface.js +0 -1
- package/filters/auth/AuthMethod.d.ts +38 -0
- package/filters/auth/AuthMethod.d.ts.map +1 -0
- package/filters/auth/AuthMethod.js +12 -1
- package/filters/auth/HttpBasicAuth.d.ts +23 -0
- package/filters/auth/HttpBasicAuth.d.ts.map +1 -0
- package/filters/auth/HttpBasicAuth.js +0 -1
- package/filters/auth/HttpBearerAuth.d.ts +18 -0
- package/filters/auth/HttpBearerAuth.d.ts.map +1 -0
- package/filters/auth/HttpBearerAuth.js +0 -1
- package/filters/auth/HttpHeaderAuth.d.ts +15 -0
- package/filters/auth/HttpHeaderAuth.d.ts.map +1 -0
- package/filters/auth/HttpHeaderAuth.js +0 -1
- package/filters/auth/JwtHttpBearerAuth.d.ts +21 -0
- package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -0
- package/filters/auth/JwtHttpBearerAuth.js +0 -1
- package/filters/auth/KeyCloakHttpBearerAuth.d.ts +23 -0
- package/filters/auth/KeyCloakHttpBearerAuth.d.ts.map +1 -0
- package/filters/auth/KeyCloakHttpBearerAuth.js +0 -1
- package/filters/auth/index.d.ts +5 -0
- package/filters/auth/index.d.ts.map +1 -0
- package/filters/auth/index.js +0 -1
- package/filters/index.d.ts +3 -0
- package/filters/index.d.ts.map +1 -0
- package/filters/index.js +0 -1
- package/index.d.ts +17 -0
- package/index.d.ts.map +1 -0
- package/index.js +21 -17
- package/model/RouteDefinition.d.ts +7 -0
- package/model/RouteDefinition.d.ts.map +1 -0
- package/model/RouteDefinition.js +0 -1
- package/package.json +12 -10
- package/rbac/AuthAssignment.d.ts +19 -0
- package/rbac/AuthAssignment.d.ts.map +1 -0
- package/rbac/AuthAssignment.js +0 -1
- package/rbac/AuthItem.d.ts +27 -0
- package/rbac/AuthItem.d.ts.map +1 -0
- package/rbac/AuthItem.js +0 -1
- package/rbac/AuthItemChild.d.ts +19 -0
- package/rbac/AuthItemChild.d.ts.map +1 -0
- package/rbac/AuthItemChild.js +0 -1
- package/rbac/AuthManager.d.ts +112 -0
- package/rbac/AuthManager.d.ts.map +1 -0
- package/rbac/AuthManager.js +0 -1
- package/requiments/Glob.d.ts +3 -0
- package/requiments/Glob.d.ts.map +1 -0
- package/requiments/Glob.js +0 -1
- package/requiments/ReflectUtil.d.ts +1 -0
- package/requiments/ReflectUtil.d.ts.map +1 -0
- package/requiments/ReflectUtil.js +0 -1
- package/requiments/Utils.d.ts +3 -0
- package/requiments/Utils.d.ts.map +1 -0
- package/requiments/Utils.js +7 -1
- package/validators/BooleanValidator.d.ts +1 -0
- package/validators/BooleanValidator.d.ts.map +1 -0
- package/validators/BooleanValidator.js +0 -1
- package/validators/CompareValidator.d.ts +1 -0
- package/validators/CompareValidator.d.ts.map +1 -0
- package/validators/CompareValidator.js +0 -1
- package/validators/DateValidator.d.ts +1 -0
- package/validators/DateValidator.d.ts.map +1 -0
- package/validators/DateValidator.js +0 -1
- package/validators/EmailValidator.d.ts +1 -0
- package/validators/EmailValidator.d.ts.map +1 -0
- package/validators/EmailValidator.js +0 -1
- package/validators/Validator.d.ts +18 -0
- package/validators/Validator.d.ts.map +1 -0
- package/validators/Validator.js +0 -1
- package/web/IdentityInterface.d.ts +55 -0
- package/web/IdentityInterface.d.ts.map +1 -0
- package/web/IdentityInterface.js +0 -1
- package/web/WebUser.d.ts +72 -0
- package/web/WebUser.d.ts.map +1 -0
- package/web/WebUser.js +0 -1
- package/BaseChyz.js.map +0 -1
- package/Chyz.js +0 -15
- package/Chyz.js.map +0 -1
- package/base/ActionFilter.js.map +0 -1
- package/base/BaseError.js.map +0 -1
- package/base/BaseObject.js +0 -20
- package/base/BaseObject.js.map +0 -1
- package/base/Behavior.js.map +0 -1
- package/base/CWebController.js.map +0 -1
- package/base/Component.js.map +0 -1
- package/base/Configurable.js.map +0 -1
- package/base/DataErrorDbException.js.map +0 -1
- package/base/DbConnection.js.map +0 -1
- package/base/ForbiddenHttpException.js.map +0 -1
- package/base/InvalidArgumentException.js.map +0 -1
- package/base/InvalidConfigException.js.map +0 -1
- package/base/Model.js.map +0 -1
- package/base/ModelManager.js.map +0 -1
- package/base/NotFoundHttpException.js.map +0 -1
- package/base/RestClient.js.map +0 -1
- package/base/UnauthorizedHttpException.js.map +0 -1
- package/base/ValidationHttpException.js.map +0 -1
- package/base/db/Exception.js.map +0 -1
- package/base/index.js.map +0 -1
- package/decorator/Middleware.js.map +0 -1
- package/decorator/controller.js.map +0 -1
- package/decorator/enums/ControllerDecoratorParams.js.map +0 -1
- package/decorator/get.js.map +0 -1
- package/decorator/index.js.map +0 -1
- package/decorator/post.js.map +0 -1
- package/filters/AccessControl.js.map +0 -1
- package/filters/AccessRule.js.map +0 -1
- package/filters/auth/AuthInterface.js.map +0 -1
- package/filters/auth/AuthMethod.js.map +0 -1
- package/filters/auth/HttpBasicAuth.js.map +0 -1
- package/filters/auth/HttpBearerAuth.js.map +0 -1
- package/filters/auth/HttpHeaderAuth.js.map +0 -1
- package/filters/auth/JwtHttpBearerAuth.js.map +0 -1
- package/filters/auth/KeyCloakHttpBearerAuth.js.map +0 -1
- package/filters/auth/index.js.map +0 -1
- package/filters/index.js.map +0 -1
- package/index.js.map +0 -1
- package/model/RouteDefinition.js.map +0 -1
- package/rbac/AuthAssignment.js.map +0 -1
- package/rbac/AuthItem.js.map +0 -1
- package/rbac/AuthItemChild.js.map +0 -1
- package/rbac/AuthManager.js.map +0 -1
- package/requiments/Glob.js.map +0 -1
- package/requiments/ReflectUtil.js.map +0 -1
- package/requiments/Utils.js.map +0 -1
- package/validators/BooleanValidator.js.map +0 -1
- package/validators/CompareValidator.js.map +0 -1
- package/validators/DateValidator.js.map +0 -1
- package/validators/EmailValidator.js.map +0 -1
- package/validators/Validator.js.map +0 -1
- package/web/IdentityInterface.js.map +0 -1
- package/web/WebUser.js.map +0 -1
package/BaseChyz.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export default class BaseChyz {
|
|
3
|
+
private config;
|
|
4
|
+
static app: string;
|
|
5
|
+
static httpServer: any;
|
|
6
|
+
static express: any;
|
|
7
|
+
private _port;
|
|
8
|
+
static db: any;
|
|
9
|
+
static routes: any;
|
|
10
|
+
private static _validate;
|
|
11
|
+
private _logConfig;
|
|
12
|
+
private _controllerpath;
|
|
13
|
+
private static controllers;
|
|
14
|
+
static components: any;
|
|
15
|
+
static middlewares: any;
|
|
16
|
+
get logConfig(): any;
|
|
17
|
+
set logConfig(value: any);
|
|
18
|
+
get controllerpath(): string;
|
|
19
|
+
set controllerpath(value: string);
|
|
20
|
+
init(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Listen port number
|
|
23
|
+
* Server port number get
|
|
24
|
+
*/
|
|
25
|
+
get port(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Listen port number
|
|
28
|
+
* Server port number setting
|
|
29
|
+
* @param value
|
|
30
|
+
*/
|
|
31
|
+
set port(value: number);
|
|
32
|
+
static get validate(): any;
|
|
33
|
+
static set validate(value: any);
|
|
34
|
+
app(config?: any): BaseChyz;
|
|
35
|
+
logProvider(): any;
|
|
36
|
+
getLogger(): any;
|
|
37
|
+
static logs(...args: any[]): any;
|
|
38
|
+
static trace(...args: any[]): void;
|
|
39
|
+
static debug(...args: any[]): void;
|
|
40
|
+
static info(...args: any[]): void;
|
|
41
|
+
static warn(...args: any[]): void;
|
|
42
|
+
static error(...args: any[]): void;
|
|
43
|
+
static fatal(...args: any[]): void;
|
|
44
|
+
static warning(...args: any[]): void;
|
|
45
|
+
static t(text: string): string;
|
|
46
|
+
errorLogger(error: any, req: any, res: any, next: any): void;
|
|
47
|
+
errorResponder(error: any, req: any, res: any, next: any): void;
|
|
48
|
+
errorHandler(err: any, req: any, res: any, next: any): any;
|
|
49
|
+
static getComponent(key: any): any;
|
|
50
|
+
static getMiddlewares(key: any): any;
|
|
51
|
+
/**
|
|
52
|
+
* load model
|
|
53
|
+
*/
|
|
54
|
+
loadModels(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* load contoller
|
|
57
|
+
*/
|
|
58
|
+
loadController(): Promise<void>;
|
|
59
|
+
middleware(): void;
|
|
60
|
+
Start(): this;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=BaseChyz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAwD1B,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAM;IACpB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,OAAO,MAAY;IAC1B,OAAO,CAAC,KAAK,CAAgB;IAC7B,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiB;IACzC,OAAO,CAAC,UAAU,CAAiD;IACnE,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,SAAS,IAAI,GAAG,CAEnB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,GAAG,EAEvB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;IAED,IAAI;IA0DJ;;;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;IA6CxB,WAAW;IAIX,SAAS;IAIhB,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIZ,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;IAsBhB;;OAEG;IACG,cAAc;IAoEb,UAAU;IAwCV,KAAK;CA0Bf"}
|
package/BaseChyz.js
CHANGED
|
@@ -13,8 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
require("reflect-metadata");
|
|
16
|
-
const Utils_1 = __importDefault(require("./requiments/Utils"));
|
|
17
16
|
const base_1 = require("./base");
|
|
17
|
+
const Utils_1 = __importDefault(require("./requiments/Utils"));
|
|
18
18
|
const https = require('https');
|
|
19
19
|
const express = require("express");
|
|
20
20
|
const compression = require('compression');
|
|
@@ -264,9 +264,10 @@ class BaseChyz {
|
|
|
264
264
|
*/
|
|
265
265
|
loadController() {
|
|
266
266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
267
|
-
let articlesEndpoints = [];
|
|
268
|
-
fs.readdirSync(`${this._controllerpath}/`)
|
|
267
|
+
// let articlesEndpoints: string[] = [];
|
|
268
|
+
for (const file of fs.readdirSync(`${this._controllerpath}/`)) {
|
|
269
269
|
let controller = require(`${this._controllerpath}/${file}`);
|
|
270
|
+
// let controller = await import(`${this._controllerpath}/${file}`);
|
|
270
271
|
// This is our instantiated class
|
|
271
272
|
const instance = new controller();
|
|
272
273
|
BaseChyz.controllers.push(instance);
|
|
@@ -317,7 +318,7 @@ class BaseChyz {
|
|
|
317
318
|
}));
|
|
318
319
|
});
|
|
319
320
|
}
|
|
320
|
-
}
|
|
321
|
+
}
|
|
321
322
|
});
|
|
322
323
|
}
|
|
323
324
|
middleware() {
|
|
@@ -380,4 +381,3 @@ BaseChyz._validate = validate;
|
|
|
380
381
|
BaseChyz.controllers = [];
|
|
381
382
|
BaseChyz.components = {};
|
|
382
383
|
BaseChyz.middlewares = {};
|
|
383
|
-
//# sourceMappingURL=BaseChyz.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="express" />
|
|
2
|
+
import { Request, Response } from "../index";
|
|
3
|
+
import { CBaseObject } from "./CBaseObject";
|
|
4
|
+
export declare class ActionFilter extends CBaseObject {
|
|
5
|
+
only: any;
|
|
6
|
+
/**
|
|
7
|
+
* @var array list of action IDs that this filter should not apply to.
|
|
8
|
+
* @see only
|
|
9
|
+
*/
|
|
10
|
+
except: never[];
|
|
11
|
+
init(): void;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param route
|
|
15
|
+
* @param req
|
|
16
|
+
* @param res
|
|
17
|
+
*/
|
|
18
|
+
beforeFilter(route: any, req: Request, res: Response): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
21
|
+
* You may override this method to do last-minute preparation for the action.
|
|
22
|
+
* @param Action $action the action to be executed.
|
|
23
|
+
* @return bool whether the action should continue to be executed.
|
|
24
|
+
*/
|
|
25
|
+
beforeAction(route: any, req: Request, res: Response): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param action
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
protected isActive(action: any): boolean;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ActionFilter.d.ts.map
|
|
@@ -0,0 +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;IAQjE;;;;;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;CA0BjC"}
|
package/base/ActionFilter.js
CHANGED
|
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ActionFilter = void 0;
|
|
16
16
|
const Utils_1 = __importDefault(require("../requiments/Utils"));
|
|
17
|
-
const
|
|
18
|
-
class ActionFilter extends
|
|
17
|
+
const CBaseObject_1 = require("./CBaseObject");
|
|
18
|
+
class ActionFilter extends CBaseObject_1.CBaseObject {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
21
|
/**
|
|
@@ -40,6 +40,22 @@ class ActionFilter extends Behavior_1.Behavior {
|
|
|
40
40
|
yield this.beforeAction(route, req, res);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
45
|
+
* You may override this method to do last-minute preparation for the action.
|
|
46
|
+
* @param Action $action the action to be executed.
|
|
47
|
+
* @return bool whether the action should continue to be executed.
|
|
48
|
+
*/
|
|
49
|
+
beforeAction(route, req, res) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param action
|
|
57
|
+
* @protected
|
|
58
|
+
*/
|
|
43
59
|
isActive(action) {
|
|
44
60
|
let id = action.id;
|
|
45
61
|
let onlyMatch = false;
|
|
@@ -65,17 +81,5 @@ class ActionFilter extends Behavior_1.Behavior {
|
|
|
65
81
|
}
|
|
66
82
|
return !exceptMatch && onlyMatch;
|
|
67
83
|
}
|
|
68
|
-
/**
|
|
69
|
-
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
70
|
-
* You may override this method to do last-minute preparation for the action.
|
|
71
|
-
* @param Action $action the action to be executed.
|
|
72
|
-
* @return bool whether the action should continue to be executed.
|
|
73
|
-
*/
|
|
74
|
-
beforeAction(route, req, res) {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
return true;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
84
|
}
|
|
80
85
|
exports.ActionFilter = ActionFilter;
|
|
81
|
-
//# sourceMappingURL=ActionFilter.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class BaseError extends Error {
|
|
2
|
+
private statusCode;
|
|
3
|
+
constructor(message: string, statusCode?: number);
|
|
4
|
+
toString(): string;
|
|
5
|
+
toJSON(): {
|
|
6
|
+
code: number | undefined;
|
|
7
|
+
name: string;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=BaseError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA,qBAAa,SAAU,SAAQ,KAAK;IAChC,OAAO,CAAC,UAAU,CAAS;gBAEf,OAAO,EAAE,MAAM,EAAC,UAAU,SAAI;IAQ1C,QAAQ;IAGR,MAAM;;;;;CAGT"}
|
package/base/BaseError.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Behavior.d.ts","sourceRoot":"","sources":["../../src/base/Behavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,qBAAa,QAAS,SAAQ,WAAW;CAGxC"}
|
package/base/Behavior.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Behavior = void 0;
|
|
4
|
-
const
|
|
5
|
-
class Behavior extends
|
|
4
|
+
const CBaseObject_1 = require("./CBaseObject");
|
|
5
|
+
class Behavior extends CBaseObject_1.CBaseObject {
|
|
6
6
|
}
|
|
7
7
|
exports.Behavior = Behavior;
|
|
8
|
-
//# sourceMappingURL=Behavior.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CBaseObject.d.ts","sourceRoot":"","sources":["../../src/base/CBaseObject.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,qBAAa,WAAY,YAAW,YAAY;IAErC,IAAI;CAGd"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
+
* Author: Cihan Ozturk
|
|
5
|
+
* E-mail: cihan@chy.com.tr
|
|
6
|
+
* Github:https://github.com/cihan53/
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CBaseObject = void 0;
|
|
10
|
+
const Logger_1 = require("./Logger");
|
|
11
|
+
class CBaseObject {
|
|
12
|
+
init() {
|
|
13
|
+
Logger_1.Logger.debug("BaseObject init.....");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CBaseObject = CBaseObject;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component } from "./Component";
|
|
2
|
+
import { RouteDefinition } from "../model/RouteDefinition";
|
|
3
|
+
import { Request, Response } from "express";
|
|
4
|
+
export declare class CWebController extends Component {
|
|
5
|
+
/**
|
|
6
|
+
* @var string the ID of this controller.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
defaultAction: string;
|
|
10
|
+
constructor(config: any);
|
|
11
|
+
init(): void;
|
|
12
|
+
/**
|
|
13
|
+
* This method is invoked right before an action is executed.
|
|
14
|
+
* @param $action
|
|
15
|
+
*/
|
|
16
|
+
beforeAction(route: RouteDefinition, req: Request, res: Response): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* This method is invoked right after an action is executed.
|
|
19
|
+
* @param action
|
|
20
|
+
*/
|
|
21
|
+
afterAction(action: any, req: Request, res: Response): void;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
|
|
25
|
+
Checks the privilege of the current user.
|
|
26
|
+
|
|
27
|
+
This method should be overridden to check whether the current user has the privilege to run the specified action against the specified data model. If the user does not have access, a yii\web\ForbiddenHttpException should be thrown.
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
checkAccess(action: any, model?: null, params?: any): void;
|
|
31
|
+
/**
|
|
32
|
+
* Send data formatted as JSON.
|
|
33
|
+
|
|
34
|
+
This method is a shortcut for sending data formatted as JSON. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will b
|
|
35
|
+
*/
|
|
36
|
+
asJson(data: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Send data formatted as XML.
|
|
39
|
+
|
|
40
|
+
This method is a shortcut for sending data formatted as XML. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will be:
|
|
41
|
+
*/
|
|
42
|
+
asXml(data: any): void;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=CWebController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CWebController.d.ts","sourceRoot":"","sources":["../../src/base/CWebController.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE1C,qBAAa,cAAe,SAAQ,SAAS;IAGzC;;OAEG;IACI,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,SAAW;gBAEnB,MAAM,EAAE,GAAG;IAKhB,IAAI;IAKX;;;OAGG;IACU,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAW7E;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAI3D;;;;;;;OAOG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,GAAE,GAAQ;IAI9D;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,GAAG;IAIhB;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,GAAG;CAIlB"}
|
package/base/CWebController.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CBaseObject } from "./CBaseObject";
|
|
2
|
+
export declare class Component extends CBaseObject {
|
|
3
|
+
/**
|
|
4
|
+
* @var array the attached event handlers (event name => handlers)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized.
|
|
8
|
+
*/
|
|
9
|
+
private _behaviors;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a list of behaviors that this component should behave as.
|
|
12
|
+
*/
|
|
13
|
+
behaviors(): any;
|
|
14
|
+
get getBehaviors(): any;
|
|
15
|
+
/**
|
|
16
|
+
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component.
|
|
17
|
+
*/
|
|
18
|
+
ensureBehaviors(): void;
|
|
19
|
+
private attachBehaviorInternal;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/base/Component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAI1C,qBAAa,SAAU,SAAQ,WAAW;IAEtC;;OAEG;IAIH;;OAEG;IAEH,OAAO,CAAC,UAAU,CAA2B;IAG7C;;OAEG;IACI,SAAS,IAAI,GAAG;IAKvB,IAAI,YAAY,IAAI,GAAG,CAEtB;IAED;;OAEG;IACI,eAAe;IAetB,OAAO,CAAC,sBAAsB;CASjC"}
|
package/base/Component.js
CHANGED
|
@@ -10,15 +10,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Component = void 0;
|
|
13
|
-
const
|
|
13
|
+
const CBaseObject_1 = require("./CBaseObject");
|
|
14
14
|
const Utils_1 = __importDefault(require("../requiments/Utils"));
|
|
15
|
-
class Component extends
|
|
15
|
+
class Component extends CBaseObject_1.CBaseObject {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
17
|
/**
|
|
19
18
|
* @var array the attached event handlers (event name => handlers)
|
|
20
19
|
*/
|
|
21
|
-
|
|
20
|
+
// private _events = [];
|
|
21
|
+
super(...arguments);
|
|
22
22
|
/**
|
|
23
23
|
* @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized.
|
|
24
24
|
*/
|
|
@@ -40,7 +40,7 @@ class Component extends BaseObject_1.BaseObject {
|
|
|
40
40
|
if (this._behaviors.length == 0) {
|
|
41
41
|
this._behaviors = [];
|
|
42
42
|
if (this.behaviors().length > 0) {
|
|
43
|
-
this.behaviors().forEach(behavior => {
|
|
43
|
+
this.behaviors().forEach((behavior) => {
|
|
44
44
|
Object.keys(behavior).forEach((name) => {
|
|
45
45
|
this.attachBehaviorInternal(name, behavior);
|
|
46
46
|
});
|
|
@@ -58,4 +58,3 @@ class Component extends BaseObject_1.BaseObject {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
exports.Component = Component;
|
|
61
|
-
//# sourceMappingURL=Component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Configurable.d.ts","sourceRoot":"","sources":["../../src/base/Configurable.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;CAE5B"}
|
package/base/Configurable.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataErrorDbException.d.ts","sourceRoot":"","sources":["../../src/base/DataErrorDbException.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,oBAAqB,SAAQ,SAAS;IAC1B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from "./Component";
|
|
2
|
+
export declare class DbConnection extends Component {
|
|
3
|
+
database: string;
|
|
4
|
+
username: string;
|
|
5
|
+
password: string;
|
|
6
|
+
options?: object;
|
|
7
|
+
private _db;
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
get db(): any;
|
|
10
|
+
set db(value: any);
|
|
11
|
+
transaction(): any;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=DbConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DbConnection.d.ts","sourceRoot":"","sources":["../../src/base/DbConnection.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAKtC,qBAAa,YAAa,SAAQ,SAAS;IAEhC,QAAQ,EAAG,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,GAAG,CAAK;IAEV,IAAI;IAmBV,IAAI,EAAE,IAAI,GAAG,CAEZ;IAED,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,EAEhB;IAEM,WAAW;CAIrB"}
|
package/base/DbConnection.js
CHANGED
|
@@ -23,7 +23,7 @@ exports.DbConnection = void 0;
|
|
|
23
23
|
const { Sequelize } = require("sequelize");
|
|
24
24
|
const Component_1 = require("./Component");
|
|
25
25
|
const BaseChyz_1 = __importDefault(require("../BaseChyz"));
|
|
26
|
-
const sequelizeCache = require('sequelize-transparent-cache')
|
|
26
|
+
// const sequelizeCache = require('sequelize-transparent-cache')
|
|
27
27
|
class DbConnection extends Component_1.Component {
|
|
28
28
|
init() {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -51,4 +51,3 @@ class DbConnection extends Component_1.Component {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
exports.DbConnection = DbConnection;
|
|
54
|
-
//# sourceMappingURL=DbConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForbiddenHttpException.d.ts","sourceRoot":"","sources":["../../src/base/ForbiddenHttpException.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,qBAAa,sBAAuB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM;CAGhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidArgumentException.d.ts","sourceRoot":"","sources":["../../src/base/InvalidArgumentException.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,wBAAyB,SAAQ,SAAS;IAC9B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidConfigException.d.ts","sourceRoot":"","sources":["../../src/base/InvalidConfigException.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,sBAAuB,SAAQ,SAAS;IAC5B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
|
package/base/Logger.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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;
|