chyz 2.0.0-rc.8 → 2.0.1-rc.1
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 +73 -56
- package/BaseChyz.d.ts.map +1 -1
- package/BaseChyz.js +569 -404
- package/README.md +1 -1
- package/base/ActionFilter.d.ts +32 -32
- package/base/ActionFilter.d.ts.map +1 -1
- package/base/ActionFilter.js +82 -82
- package/base/BadRequestHttpException.d.ts +6 -0
- package/base/BadRequestHttpException.d.ts.map +1 -0
- package/base/BadRequestHttpException.js +17 -0
- package/base/BaseError.d.ts +43 -10
- package/base/BaseError.d.ts.map +1 -1
- package/base/BaseError.js +58 -26
- package/base/Behavior.d.ts +3 -3
- package/base/Behavior.js +7 -7
- package/base/CBaseObject.d.ts +4 -4
- package/base/CBaseObject.d.ts.map +1 -1
- package/base/CBaseObject.js +16 -16
- package/base/CEvents.d.ts +13 -0
- package/base/CEvents.d.ts.map +1 -0
- package/base/CEvents.js +24 -0
- package/base/CRequest.d.ts +1 -1
- package/base/CRequest.js +10 -10
- package/base/CWebController.d.ts +43 -43
- package/base/CWebController.d.ts.map +1 -1
- package/base/CWebController.js +81 -74
- package/base/Component.d.ts +20 -20
- package/base/Component.d.ts.map +1 -1
- package/base/Component.js +57 -57
- package/base/Configurable.d.ts +2 -2
- package/base/Configurable.js +8 -8
- package/base/DataErrorDbException.d.ts +5 -5
- package/base/DataErrorDbException.d.ts.map +1 -1
- package/base/DataErrorDbException.js +17 -17
- package/base/DbConnection.d.ts +12 -12
- package/base/DbConnection.js +53 -53
- package/base/ForbiddenHttpException.d.ts +4 -4
- package/base/ForbiddenHttpException.d.ts.map +1 -1
- package/base/ForbiddenHttpException.js +16 -16
- package/base/InvalidArgumentException.d.ts +5 -5
- package/base/InvalidArgumentException.d.ts.map +1 -1
- package/base/InvalidArgumentException.js +17 -17
- package/base/InvalidConfigException.d.ts +5 -5
- package/base/InvalidConfigException.d.ts.map +1 -1
- package/base/InvalidConfigException.js +17 -17
- package/base/Logs.d.ts +21 -21
- package/base/Logs.d.ts.map +1 -1
- package/base/Logs.js +57 -57
- package/base/Model.d.ts +301 -298
- package/base/Model.d.ts.map +1 -1
- package/base/Model.js +545 -507
- package/base/ModelManager.d.ts +1 -1
- package/base/ModelManager.js +19 -19
- package/base/NotFoundHttpException.d.ts +5 -5
- package/base/NotFoundHttpException.d.ts.map +1 -1
- package/base/NotFoundHttpException.js +17 -17
- package/base/RestClient.d.ts +6 -6
- package/base/RestClient.d.ts.map +1 -1
- package/base/RestClient.js +25 -25
- package/base/UnauthorizedHttpException.d.ts +5 -5
- package/base/UnauthorizedHttpException.d.ts.map +1 -1
- package/base/UnauthorizedHttpException.js +17 -17
- package/base/ValidationHttpException.d.ts +5 -5
- package/base/ValidationHttpException.d.ts.map +1 -1
- package/base/ValidationHttpException.js +17 -17
- package/base/db/Exception.d.ts +6 -6
- package/base/db/Exception.js +15 -15
- package/base/index.d.ts +19 -18
- package/base/index.d.ts.map +1 -1
- package/base/index.js +41 -39
- package/decorator/Middleware.d.ts +3 -3
- package/decorator/Middleware.js +11 -11
- package/decorator/controller.d.ts +2 -2
- package/decorator/controller.js +24 -24
- package/decorator/delete.d.ts +3 -0
- package/decorator/delete.d.ts.map +1 -0
- package/decorator/delete.js +36 -0
- package/decorator/enums/ControllerDecoratorParams.d.ts +5 -5
- package/decorator/enums/ControllerDecoratorParams.js +9 -9
- package/decorator/get.d.ts +2 -2
- package/decorator/get.js +36 -36
- package/decorator/index.d.ts +5 -3
- package/decorator/index.d.ts.map +1 -1
- package/decorator/index.js +13 -9
- package/decorator/post.d.ts +2 -2
- package/decorator/post.js +36 -36
- package/decorator/put.d.ts +3 -0
- package/decorator/put.d.ts.map +1 -0
- package/decorator/put.js +36 -0
- package/filters/AccessControl.d.ts +12 -12
- package/filters/AccessControl.d.ts.map +1 -1
- package/filters/AccessControl.js +83 -83
- package/filters/AccessRule.d.ts +82 -82
- package/filters/AccessRule.d.ts.map +1 -1
- package/filters/AccessRule.js +136 -137
- package/filters/auth/AuthInterface.d.ts +25 -25
- package/filters/auth/AuthInterface.js +2 -2
- package/filters/auth/AuthMethod.d.ts +37 -37
- package/filters/auth/AuthMethod.d.ts.map +1 -1
- package/filters/auth/AuthMethod.js +82 -82
- package/filters/auth/HttpBasicAuth.d.ts +23 -22
- package/filters/auth/HttpBasicAuth.d.ts.map +1 -1
- package/filters/auth/HttpBasicAuth.js +78 -72
- package/filters/auth/HttpBearerAuth.d.ts +17 -17
- package/filters/auth/HttpBearerAuth.d.ts.map +1 -1
- package/filters/auth/HttpBearerAuth.js +33 -32
- package/filters/auth/HttpHeaderAuth.d.ts +18 -14
- package/filters/auth/HttpHeaderAuth.d.ts.map +1 -1
- package/filters/auth/HttpHeaderAuth.js +64 -57
- package/filters/auth/JwtHttpBearerAuth.d.ts +20 -20
- package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -1
- package/filters/auth/JwtHttpBearerAuth.js +87 -81
- package/filters/auth/KeyCloakHttpBearerAuth.d.ts +22 -22
- package/filters/auth/KeyCloakHttpBearerAuth.js +116 -116
- package/filters/auth/index.d.ts +4 -4
- package/filters/auth/index.js +11 -11
- package/filters/index.d.ts +2 -2
- package/filters/index.js +7 -7
- package/index.d.ts +28 -21
- package/index.d.ts.map +1 -1
- package/index.js +71 -60
- package/model/RouteDefinition.d.ts +6 -6
- package/model/RouteDefinition.js +8 -8
- package/package.json +22 -24
- package/rbac/AuthAssignment.d.ts +18 -18
- package/rbac/AuthAssignment.js +44 -44
- package/rbac/AuthItem.d.ts +26 -26
- package/rbac/AuthItem.js +51 -51
- package/rbac/AuthItemChild.d.ts +18 -18
- package/rbac/AuthItemChild.js +43 -43
- package/rbac/AuthManager.d.ts +111 -111
- package/rbac/AuthManager.d.ts.map +1 -1
- package/rbac/AuthManager.js +356 -355
- package/rbac/index.d.ts +5 -0
- package/rbac/index.d.ts.map +1 -0
- package/rbac/index.js +28 -0
- package/requiments/Glob.d.ts +2 -2
- package/requiments/Glob.js +10 -10
- package/requiments/ReflectUtil.js +24 -24
- package/requiments/Utils.d.ts +1 -8
- package/requiments/Utils.d.ts.map +1 -1
- package/requiments/Utils.js +115 -112
- package/validators/BooleanValidator.js +1 -1
- package/validators/CompareValidator.js +1 -1
- package/validators/DateValidator.js +1 -1
- package/validators/EmailValidator.js +1 -1
- package/validators/Validator.d.ts +17 -17
- package/validators/Validator.js +27 -27
- package/web/IdentityInterface.d.ts +55 -54
- package/web/IdentityInterface.d.ts.map +1 -1
- package/web/IdentityInterface.js +8 -8
- package/web/WebUser.d.ts +71 -71
- package/web/WebUser.js +165 -165
package/base/CWebController.d.ts
CHANGED
|
@@ -1,44 +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
|
-
}
|
|
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
44
|
//# sourceMappingURL=CWebController.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAI1C,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;IAc7E;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAK3D;;;;;;;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
|
@@ -1,74 +1,81 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
super
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Send data formatted as
|
|
68
|
-
|
|
69
|
-
This method is a shortcut for sending data formatted as
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.CWebController = void 0;
|
|
22
|
+
const Component_1 = require("./Component");
|
|
23
|
+
const BaseChyz_1 = __importDefault(require("../BaseChyz"));
|
|
24
|
+
const CEvents_1 = require("./CEvents");
|
|
25
|
+
class CWebController extends Component_1.Component {
|
|
26
|
+
constructor(config) {
|
|
27
|
+
super();
|
|
28
|
+
this.defaultAction = 'index';
|
|
29
|
+
this.id = this.constructor.name.replace("Controller", "").toLowerCase();
|
|
30
|
+
}
|
|
31
|
+
init() {
|
|
32
|
+
super.init();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This method is invoked right before an action is executed.
|
|
36
|
+
* @param $action
|
|
37
|
+
*/
|
|
38
|
+
beforeAction(route, req, res) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (route.id == "" || route.id == "/")
|
|
41
|
+
this.id = this.defaultAction;
|
|
42
|
+
this.ensureBehaviors();
|
|
43
|
+
for (const name of Object.keys(this.getBehaviors)) {
|
|
44
|
+
yield this.getBehaviors[name].beforeFilter(route, req, res);
|
|
45
|
+
}
|
|
46
|
+
BaseChyz_1.default.EventEmitter.emit(CEvents_1.CEvents.ON_BEFORE_ACTION, this, req, res);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* This method is invoked right after an action is executed.
|
|
51
|
+
* @param action
|
|
52
|
+
*/
|
|
53
|
+
afterAction(action, req, res) {
|
|
54
|
+
BaseChyz_1.default.EventEmitter.emit(CEvents_1.CEvents.ON_AFTER_ACTION, this, req, res);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
|
|
59
|
+
Checks the privilege of the current user.
|
|
60
|
+
|
|
61
|
+
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.
|
|
62
|
+
|
|
63
|
+
*/
|
|
64
|
+
checkAccess(action, model = null, params = []) {
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Send data formatted as JSON.
|
|
68
|
+
|
|
69
|
+
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
|
|
70
|
+
*/
|
|
71
|
+
asJson(data) {
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Send data formatted as XML.
|
|
75
|
+
|
|
76
|
+
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:
|
|
77
|
+
*/
|
|
78
|
+
asXml(data) {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.CWebController = CWebController;
|
package/base/Component.d.ts
CHANGED
|
@@ -1,21 +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
|
-
}
|
|
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
21
|
//# sourceMappingURL=Component.d.ts.map
|
package/base/Component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/base/Component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/base/Component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAIzC,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
|
@@ -1,57 +1,57 @@
|
|
|
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.Component = void 0;
|
|
10
|
-
const CBaseObject_1 = require("./CBaseObject");
|
|
11
|
-
const Utils_1 = require("../requiments/Utils");
|
|
12
|
-
class Component extends CBaseObject_1.CBaseObject {
|
|
13
|
-
constructor() {
|
|
14
|
-
/**
|
|
15
|
-
* @var array the attached event handlers (event name => handlers)
|
|
16
|
-
*/
|
|
17
|
-
// private _events = [];
|
|
18
|
-
super(...arguments);
|
|
19
|
-
/**
|
|
20
|
-
* @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized.
|
|
21
|
-
*/
|
|
22
|
-
this._behaviors = [];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns a list of behaviors that this component should behave as.
|
|
26
|
-
*/
|
|
27
|
-
behaviors() {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
get getBehaviors() {
|
|
31
|
-
return this._behaviors;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component.
|
|
35
|
-
*/
|
|
36
|
-
ensureBehaviors() {
|
|
37
|
-
if (this._behaviors.length == 0) {
|
|
38
|
-
this._behaviors = [];
|
|
39
|
-
if (this.behaviors().length > 0) {
|
|
40
|
-
this.behaviors().forEach((behavior) => {
|
|
41
|
-
Object.keys(behavior).forEach((name) => {
|
|
42
|
-
this.attachBehaviorInternal(name, behavior);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
attachBehaviorInternal(name, behavior) {
|
|
49
|
-
if (!this._behaviors.hasOwnProperty(name)) {
|
|
50
|
-
let beh = Utils_1.Utils.createObject(new behavior[name].class, behavior[name]);
|
|
51
|
-
beh.init();
|
|
52
|
-
this._behaviors[name] = beh;
|
|
53
|
-
}
|
|
54
|
-
return behavior;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.Component = Component;
|
|
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.Component = void 0;
|
|
10
|
+
const CBaseObject_1 = require("./CBaseObject");
|
|
11
|
+
const Utils_1 = require("../requiments/Utils");
|
|
12
|
+
class Component extends CBaseObject_1.CBaseObject {
|
|
13
|
+
constructor() {
|
|
14
|
+
/**
|
|
15
|
+
* @var array the attached event handlers (event name => handlers)
|
|
16
|
+
*/
|
|
17
|
+
// private _events = [];
|
|
18
|
+
super(...arguments);
|
|
19
|
+
/**
|
|
20
|
+
* @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized.
|
|
21
|
+
*/
|
|
22
|
+
this._behaviors = [];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns a list of behaviors that this component should behave as.
|
|
26
|
+
*/
|
|
27
|
+
behaviors() {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
get getBehaviors() {
|
|
31
|
+
return this._behaviors;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Makes sure that the behaviors declared in [[behaviors()]] are attached to this component.
|
|
35
|
+
*/
|
|
36
|
+
ensureBehaviors() {
|
|
37
|
+
if (this._behaviors.length == 0) {
|
|
38
|
+
this._behaviors = [];
|
|
39
|
+
if (this.behaviors().length > 0) {
|
|
40
|
+
this.behaviors().forEach((behavior) => {
|
|
41
|
+
Object.keys(behavior).forEach((name) => {
|
|
42
|
+
this.attachBehaviorInternal(name, behavior);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
attachBehaviorInternal(name, behavior) {
|
|
49
|
+
if (!this._behaviors.hasOwnProperty(name)) {
|
|
50
|
+
let beh = Utils_1.Utils.createObject(new behavior[name].class, behavior[name]);
|
|
51
|
+
beh.init();
|
|
52
|
+
this._behaviors[name] = beh;
|
|
53
|
+
}
|
|
54
|
+
return behavior;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.Component = Component;
|
package/base/Configurable.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface Configurable {
|
|
2
|
-
}
|
|
1
|
+
export interface Configurable {
|
|
2
|
+
}
|
|
3
3
|
//# sourceMappingURL=Configurable.d.ts.map
|
package/base/Configurable.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 });
|
|
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 });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseError } from "./BaseError";
|
|
2
|
-
export declare class DataErrorDbException extends BaseError {
|
|
3
|
-
message:
|
|
4
|
-
constructor(message:
|
|
5
|
-
}
|
|
1
|
+
import { BaseError } from "./BaseError";
|
|
2
|
+
export declare class DataErrorDbException extends BaseError {
|
|
3
|
+
message: any;
|
|
4
|
+
constructor(message: any);
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=DataErrorDbException.d.ts.map
|
|
@@ -1 +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,
|
|
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,GAAG;gBAAZ,OAAO,EAAE,GAAG;CAGpC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
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.DataErrorDbException = void 0;
|
|
10
|
-
const BaseError_1 = require("./BaseError");
|
|
11
|
-
class DataErrorDbException extends BaseError_1.BaseError {
|
|
12
|
-
constructor(message) {
|
|
13
|
-
super(message, 502);
|
|
14
|
-
this.message = message;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.DataErrorDbException = DataErrorDbException;
|
|
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.DataErrorDbException = void 0;
|
|
10
|
+
const BaseError_1 = require("./BaseError");
|
|
11
|
+
class DataErrorDbException extends BaseError_1.BaseError {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message, 502);
|
|
14
|
+
this.message = message;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DataErrorDbException = DataErrorDbException;
|
package/base/DbConnection.d.ts
CHANGED
|
@@ -1,13 +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
|
-
}
|
|
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
13
|
//# sourceMappingURL=DbConnection.d.ts.map
|
package/base/DbConnection.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.DbConnection = void 0;
|
|
16
|
-
/*
|
|
17
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
18
|
-
* Author: Cihan Ozturk
|
|
19
|
-
* E-mail: cihan@chy.com.tr
|
|
20
|
-
* Github:https://github.com/cihan53/
|
|
21
|
-
*/
|
|
22
|
-
// @ts-ignore
|
|
23
|
-
const { Sequelize } = require("sequelize");
|
|
24
|
-
const Component_1 = require("./Component");
|
|
25
|
-
const BaseChyz_1 = __importDefault(require("../BaseChyz"));
|
|
26
|
-
// const sequelizeCache = require('sequelize-transparent-cache')
|
|
27
|
-
class DbConnection extends Component_1.Component {
|
|
28
|
-
init() {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const sequelize = new Sequelize(this.database, this.username, this.password, this.options);
|
|
31
|
-
this._db = sequelize;
|
|
32
|
-
sequelize
|
|
33
|
-
.authenticate()
|
|
34
|
-
.then(() => {
|
|
35
|
-
BaseChyz_1.default.info('Connection has been established successfully.');
|
|
36
|
-
})
|
|
37
|
-
.catch((err) => {
|
|
38
|
-
BaseChyz_1.default.error('Unable to connect to the database:', err);
|
|
39
|
-
});
|
|
40
|
-
// await this.connect();
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
get db() {
|
|
44
|
-
return this._db;
|
|
45
|
-
}
|
|
46
|
-
set db(value) {
|
|
47
|
-
this._db = value;
|
|
48
|
-
}
|
|
49
|
-
transaction() {
|
|
50
|
-
return this.db.transaction();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.DbConnection = DbConnection;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DbConnection = void 0;
|
|
16
|
+
/*
|
|
17
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
18
|
+
* Author: Cihan Ozturk
|
|
19
|
+
* E-mail: cihan@chy.com.tr
|
|
20
|
+
* Github:https://github.com/cihan53/
|
|
21
|
+
*/
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const { Sequelize } = require("sequelize");
|
|
24
|
+
const Component_1 = require("./Component");
|
|
25
|
+
const BaseChyz_1 = __importDefault(require("../BaseChyz"));
|
|
26
|
+
// const sequelizeCache = require('sequelize-transparent-cache')
|
|
27
|
+
class DbConnection extends Component_1.Component {
|
|
28
|
+
init() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const sequelize = new Sequelize(this.database, this.username, this.password, this.options);
|
|
31
|
+
this._db = sequelize;
|
|
32
|
+
sequelize
|
|
33
|
+
.authenticate()
|
|
34
|
+
.then(() => {
|
|
35
|
+
BaseChyz_1.default.info('Connection has been established successfully.');
|
|
36
|
+
})
|
|
37
|
+
.catch((err) => {
|
|
38
|
+
BaseChyz_1.default.error('Unable to connect to the database:', err);
|
|
39
|
+
});
|
|
40
|
+
// await this.connect();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
get db() {
|
|
44
|
+
return this._db;
|
|
45
|
+
}
|
|
46
|
+
set db(value) {
|
|
47
|
+
this._db = value;
|
|
48
|
+
}
|
|
49
|
+
transaction() {
|
|
50
|
+
return this.db.transaction();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.DbConnection = DbConnection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseError } from "./BaseError";
|
|
2
|
-
export declare class ForbiddenHttpException extends BaseError {
|
|
3
|
-
constructor(message:
|
|
4
|
-
}
|
|
1
|
+
import { BaseError } from "./BaseError";
|
|
2
|
+
export declare class ForbiddenHttpException extends BaseError {
|
|
3
|
+
constructor(message: any);
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=ForbiddenHttpException.d.ts.map
|
|
@@ -1 +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,
|
|
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,GAAG;CAG7B"}
|