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.
Files changed (153) hide show
  1. package/BaseChyz.d.ts +73 -56
  2. package/BaseChyz.d.ts.map +1 -1
  3. package/BaseChyz.js +569 -404
  4. package/README.md +1 -1
  5. package/base/ActionFilter.d.ts +32 -32
  6. package/base/ActionFilter.d.ts.map +1 -1
  7. package/base/ActionFilter.js +82 -82
  8. package/base/BadRequestHttpException.d.ts +6 -0
  9. package/base/BadRequestHttpException.d.ts.map +1 -0
  10. package/base/BadRequestHttpException.js +17 -0
  11. package/base/BaseError.d.ts +43 -10
  12. package/base/BaseError.d.ts.map +1 -1
  13. package/base/BaseError.js +58 -26
  14. package/base/Behavior.d.ts +3 -3
  15. package/base/Behavior.js +7 -7
  16. package/base/CBaseObject.d.ts +4 -4
  17. package/base/CBaseObject.d.ts.map +1 -1
  18. package/base/CBaseObject.js +16 -16
  19. package/base/CEvents.d.ts +13 -0
  20. package/base/CEvents.d.ts.map +1 -0
  21. package/base/CEvents.js +24 -0
  22. package/base/CRequest.d.ts +1 -1
  23. package/base/CRequest.js +10 -10
  24. package/base/CWebController.d.ts +43 -43
  25. package/base/CWebController.d.ts.map +1 -1
  26. package/base/CWebController.js +81 -74
  27. package/base/Component.d.ts +20 -20
  28. package/base/Component.d.ts.map +1 -1
  29. package/base/Component.js +57 -57
  30. package/base/Configurable.d.ts +2 -2
  31. package/base/Configurable.js +8 -8
  32. package/base/DataErrorDbException.d.ts +5 -5
  33. package/base/DataErrorDbException.d.ts.map +1 -1
  34. package/base/DataErrorDbException.js +17 -17
  35. package/base/DbConnection.d.ts +12 -12
  36. package/base/DbConnection.js +53 -53
  37. package/base/ForbiddenHttpException.d.ts +4 -4
  38. package/base/ForbiddenHttpException.d.ts.map +1 -1
  39. package/base/ForbiddenHttpException.js +16 -16
  40. package/base/InvalidArgumentException.d.ts +5 -5
  41. package/base/InvalidArgumentException.d.ts.map +1 -1
  42. package/base/InvalidArgumentException.js +17 -17
  43. package/base/InvalidConfigException.d.ts +5 -5
  44. package/base/InvalidConfigException.d.ts.map +1 -1
  45. package/base/InvalidConfigException.js +17 -17
  46. package/base/Logs.d.ts +21 -21
  47. package/base/Logs.d.ts.map +1 -1
  48. package/base/Logs.js +57 -57
  49. package/base/Model.d.ts +301 -298
  50. package/base/Model.d.ts.map +1 -1
  51. package/base/Model.js +545 -507
  52. package/base/ModelManager.d.ts +1 -1
  53. package/base/ModelManager.js +19 -19
  54. package/base/NotFoundHttpException.d.ts +5 -5
  55. package/base/NotFoundHttpException.d.ts.map +1 -1
  56. package/base/NotFoundHttpException.js +17 -17
  57. package/base/RestClient.d.ts +6 -6
  58. package/base/RestClient.d.ts.map +1 -1
  59. package/base/RestClient.js +25 -25
  60. package/base/UnauthorizedHttpException.d.ts +5 -5
  61. package/base/UnauthorizedHttpException.d.ts.map +1 -1
  62. package/base/UnauthorizedHttpException.js +17 -17
  63. package/base/ValidationHttpException.d.ts +5 -5
  64. package/base/ValidationHttpException.d.ts.map +1 -1
  65. package/base/ValidationHttpException.js +17 -17
  66. package/base/db/Exception.d.ts +6 -6
  67. package/base/db/Exception.js +15 -15
  68. package/base/index.d.ts +19 -18
  69. package/base/index.d.ts.map +1 -1
  70. package/base/index.js +41 -39
  71. package/decorator/Middleware.d.ts +3 -3
  72. package/decorator/Middleware.js +11 -11
  73. package/decorator/controller.d.ts +2 -2
  74. package/decorator/controller.js +24 -24
  75. package/decorator/delete.d.ts +3 -0
  76. package/decorator/delete.d.ts.map +1 -0
  77. package/decorator/delete.js +36 -0
  78. package/decorator/enums/ControllerDecoratorParams.d.ts +5 -5
  79. package/decorator/enums/ControllerDecoratorParams.js +9 -9
  80. package/decorator/get.d.ts +2 -2
  81. package/decorator/get.js +36 -36
  82. package/decorator/index.d.ts +5 -3
  83. package/decorator/index.d.ts.map +1 -1
  84. package/decorator/index.js +13 -9
  85. package/decorator/post.d.ts +2 -2
  86. package/decorator/post.js +36 -36
  87. package/decorator/put.d.ts +3 -0
  88. package/decorator/put.d.ts.map +1 -0
  89. package/decorator/put.js +36 -0
  90. package/filters/AccessControl.d.ts +12 -12
  91. package/filters/AccessControl.d.ts.map +1 -1
  92. package/filters/AccessControl.js +83 -83
  93. package/filters/AccessRule.d.ts +82 -82
  94. package/filters/AccessRule.d.ts.map +1 -1
  95. package/filters/AccessRule.js +136 -137
  96. package/filters/auth/AuthInterface.d.ts +25 -25
  97. package/filters/auth/AuthInterface.js +2 -2
  98. package/filters/auth/AuthMethod.d.ts +37 -37
  99. package/filters/auth/AuthMethod.d.ts.map +1 -1
  100. package/filters/auth/AuthMethod.js +82 -82
  101. package/filters/auth/HttpBasicAuth.d.ts +23 -22
  102. package/filters/auth/HttpBasicAuth.d.ts.map +1 -1
  103. package/filters/auth/HttpBasicAuth.js +78 -72
  104. package/filters/auth/HttpBearerAuth.d.ts +17 -17
  105. package/filters/auth/HttpBearerAuth.d.ts.map +1 -1
  106. package/filters/auth/HttpBearerAuth.js +33 -32
  107. package/filters/auth/HttpHeaderAuth.d.ts +18 -14
  108. package/filters/auth/HttpHeaderAuth.d.ts.map +1 -1
  109. package/filters/auth/HttpHeaderAuth.js +64 -57
  110. package/filters/auth/JwtHttpBearerAuth.d.ts +20 -20
  111. package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -1
  112. package/filters/auth/JwtHttpBearerAuth.js +87 -81
  113. package/filters/auth/KeyCloakHttpBearerAuth.d.ts +22 -22
  114. package/filters/auth/KeyCloakHttpBearerAuth.js +116 -116
  115. package/filters/auth/index.d.ts +4 -4
  116. package/filters/auth/index.js +11 -11
  117. package/filters/index.d.ts +2 -2
  118. package/filters/index.js +7 -7
  119. package/index.d.ts +28 -21
  120. package/index.d.ts.map +1 -1
  121. package/index.js +71 -60
  122. package/model/RouteDefinition.d.ts +6 -6
  123. package/model/RouteDefinition.js +8 -8
  124. package/package.json +22 -24
  125. package/rbac/AuthAssignment.d.ts +18 -18
  126. package/rbac/AuthAssignment.js +44 -44
  127. package/rbac/AuthItem.d.ts +26 -26
  128. package/rbac/AuthItem.js +51 -51
  129. package/rbac/AuthItemChild.d.ts +18 -18
  130. package/rbac/AuthItemChild.js +43 -43
  131. package/rbac/AuthManager.d.ts +111 -111
  132. package/rbac/AuthManager.d.ts.map +1 -1
  133. package/rbac/AuthManager.js +356 -355
  134. package/rbac/index.d.ts +5 -0
  135. package/rbac/index.d.ts.map +1 -0
  136. package/rbac/index.js +28 -0
  137. package/requiments/Glob.d.ts +2 -2
  138. package/requiments/Glob.js +10 -10
  139. package/requiments/ReflectUtil.js +24 -24
  140. package/requiments/Utils.d.ts +1 -8
  141. package/requiments/Utils.d.ts.map +1 -1
  142. package/requiments/Utils.js +115 -112
  143. package/validators/BooleanValidator.js +1 -1
  144. package/validators/CompareValidator.js +1 -1
  145. package/validators/DateValidator.js +1 -1
  146. package/validators/EmailValidator.js +1 -1
  147. package/validators/Validator.d.ts +17 -17
  148. package/validators/Validator.js +27 -27
  149. package/web/IdentityInterface.d.ts +55 -54
  150. package/web/IdentityInterface.d.ts.map +1 -1
  151. package/web/IdentityInterface.js +8 -8
  152. package/web/WebUser.d.ts +71 -71
  153. package/web/WebUser.js +165 -165
@@ -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;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"}
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"}
@@ -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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CWebController = void 0;
19
- const Component_1 = require("./Component");
20
- class CWebController extends Component_1.Component {
21
- constructor(config) {
22
- super();
23
- this.defaultAction = 'index';
24
- this.id = this.constructor.name.replace("Controller", "").toLowerCase();
25
- }
26
- init() {
27
- super.init();
28
- }
29
- /**
30
- * This method is invoked right before an action is executed.
31
- * @param $action
32
- */
33
- beforeAction(route, req, res) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- if (route.id == "" || route.id == "/")
36
- this.id = this.defaultAction;
37
- this.ensureBehaviors();
38
- for (const name of Object.keys(this.getBehaviors)) {
39
- yield this.getBehaviors[name].beforeFilter(route, req, res);
40
- }
41
- });
42
- }
43
- /**
44
- * This method is invoked right after an action is executed.
45
- * @param action
46
- */
47
- afterAction(action, req, res) {
48
- }
49
- /**
50
- *
51
-
52
- Checks the privilege of the current user.
53
-
54
- 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.
55
-
56
- */
57
- checkAccess(action, model = null, params = []) {
58
- }
59
- /**
60
- * Send data formatted as JSON.
61
-
62
- 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
63
- */
64
- asJson(data) {
65
- }
66
- /**
67
- * Send data formatted as XML.
68
-
69
- 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:
70
- */
71
- asXml(data) {
72
- }
73
- }
74
- exports.CWebController = CWebController;
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;
@@ -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
@@ -1 +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"}
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;
@@ -1,3 +1,3 @@
1
- export interface Configurable {
2
- }
1
+ export interface Configurable {
2
+ }
3
3
  //# sourceMappingURL=Configurable.d.ts.map
@@ -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: string;
4
- constructor(message: string);
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,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
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;
@@ -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
@@ -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: string);
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,MAAM;CAGhC"}
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"}