chyz 2.0.1-rc.36 → 2.0.1-rc.37

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 (231) hide show
  1. package/dist/BaseChyz.d.ts +74 -0
  2. package/dist/BaseChyz.d.ts.map +1 -0
  3. package/dist/BaseChyz.js +586 -0
  4. package/dist/base/ActionFilter.d.ts +32 -0
  5. package/dist/base/ActionFilter.d.ts.map +1 -0
  6. package/dist/base/ActionFilter.js +90 -0
  7. package/dist/base/BadRequestHttpException.d.ts +6 -0
  8. package/dist/base/BadRequestHttpException.d.ts.map +1 -0
  9. package/dist/base/BadRequestHttpException.js +17 -0
  10. package/dist/base/BaseError.d.ts +44 -0
  11. package/dist/base/BaseError.d.ts.map +1 -0
  12. package/{base/BaseError.ts → dist/base/BaseError.js} +18 -26
  13. package/dist/base/Behavior.d.ts +4 -0
  14. package/dist/base/Behavior.d.ts.map +1 -0
  15. package/dist/base/Behavior.js +7 -0
  16. package/dist/base/CBaseObject.d.ts +5 -0
  17. package/dist/base/CBaseObject.d.ts.map +1 -0
  18. package/dist/base/CBaseObject.js +16 -0
  19. package/dist/base/CEvents.d.ts +13 -0
  20. package/dist/base/CEvents.d.ts.map +1 -0
  21. package/dist/base/CEvents.js +24 -0
  22. package/dist/base/CRequest.d.ts +2 -0
  23. package/dist/base/CRequest.d.ts.map +1 -0
  24. package/{base/CRequest.ts → dist/base/CRequest.js} +2 -6
  25. package/dist/base/CWebController.d.ts +44 -0
  26. package/dist/base/CWebController.d.ts.map +1 -0
  27. package/dist/base/CWebController.js +81 -0
  28. package/dist/base/Component.d.ts +21 -0
  29. package/dist/base/Component.d.ts.map +1 -0
  30. package/dist/base/Component.js +57 -0
  31. package/dist/base/Configurable.d.ts +3 -0
  32. package/dist/base/Configurable.d.ts.map +1 -0
  33. package/{requiments/Glob.ts → dist/base/Configurable.js} +2 -3
  34. package/dist/base/DataErrorDbException.d.ts +6 -0
  35. package/dist/base/DataErrorDbException.d.ts.map +1 -0
  36. package/dist/base/DataErrorDbException.js +17 -0
  37. package/dist/base/DbConnection.d.ts +13 -0
  38. package/dist/base/DbConnection.d.ts.map +1 -0
  39. package/dist/base/DbConnection.js +53 -0
  40. package/dist/base/ForbiddenHttpException.d.ts +5 -0
  41. package/dist/base/ForbiddenHttpException.d.ts.map +1 -0
  42. package/dist/base/ForbiddenHttpException.js +16 -0
  43. package/dist/base/InvalidArgumentException.d.ts +6 -0
  44. package/dist/base/InvalidArgumentException.d.ts.map +1 -0
  45. package/dist/base/InvalidArgumentException.js +17 -0
  46. package/dist/base/InvalidConfigException.d.ts +6 -0
  47. package/dist/base/InvalidConfigException.d.ts.map +1 -0
  48. package/dist/base/InvalidConfigException.js +17 -0
  49. package/dist/base/Logs.d.ts +22 -0
  50. package/dist/base/Logs.d.ts.map +1 -0
  51. package/{base/Logs.ts → dist/base/Logs.js} +24 -41
  52. package/dist/base/Model.d.ts +302 -0
  53. package/dist/base/Model.d.ts.map +1 -0
  54. package/{base/Model.ts → dist/base/Model.js} +158 -225
  55. package/dist/base/ModelManager.d.ts +2 -0
  56. package/dist/base/ModelManager.d.ts.map +1 -0
  57. package/{base/ModelManager.ts → dist/base/ModelManager.js} +7 -7
  58. package/dist/base/NotFoundHttpException.d.ts +6 -0
  59. package/dist/base/NotFoundHttpException.d.ts.map +1 -0
  60. package/dist/base/NotFoundHttpException.js +17 -0
  61. package/dist/base/RestClient.d.ts +7 -0
  62. package/dist/base/RestClient.d.ts.map +1 -0
  63. package/dist/base/RestClient.js +25 -0
  64. package/dist/base/UnauthorizedHttpException.d.ts +6 -0
  65. package/dist/base/UnauthorizedHttpException.d.ts.map +1 -0
  66. package/dist/base/UnauthorizedHttpException.js +17 -0
  67. package/dist/base/ValidationHttpException.d.ts +6 -0
  68. package/dist/base/ValidationHttpException.d.ts.map +1 -0
  69. package/dist/base/ValidationHttpException.js +17 -0
  70. package/dist/base/db/Exception.d.ts +7 -0
  71. package/dist/base/db/Exception.d.ts.map +1 -0
  72. package/dist/base/db/Exception.js +15 -0
  73. package/dist/base/index.d.ts +20 -0
  74. package/dist/base/index.d.ts.map +1 -0
  75. package/dist/base/index.js +41 -0
  76. package/dist/decorator/Middleware.d.ts +4 -0
  77. package/dist/decorator/Middleware.d.ts.map +1 -0
  78. package/dist/decorator/Middleware.js +10 -0
  79. package/dist/decorator/controller.d.ts +3 -0
  80. package/dist/decorator/controller.d.ts.map +1 -0
  81. package/{decorator/controller.ts → dist/decorator/controller.js} +9 -7
  82. package/dist/decorator/delete.d.ts +3 -0
  83. package/dist/decorator/delete.d.ts.map +1 -0
  84. package/{decorator/delete.ts → dist/decorator/delete.js} +9 -9
  85. package/dist/decorator/enums/ControllerDecoratorParams.d.ts +6 -0
  86. package/dist/decorator/enums/ControllerDecoratorParams.d.ts.map +1 -0
  87. package/dist/decorator/enums/ControllerDecoratorParams.js +9 -0
  88. package/dist/decorator/get.d.ts +3 -0
  89. package/dist/decorator/get.d.ts.map +1 -0
  90. package/{decorator/get.ts → dist/decorator/get.js} +10 -11
  91. package/dist/decorator/index.d.ts +6 -0
  92. package/dist/decorator/index.d.ts.map +1 -0
  93. package/dist/decorator/index.js +13 -0
  94. package/dist/decorator/post.d.ts +3 -0
  95. package/dist/decorator/post.d.ts.map +1 -0
  96. package/{decorator/post.ts → dist/decorator/post.js} +10 -10
  97. package/dist/decorator/put.d.ts +3 -0
  98. package/dist/decorator/put.d.ts.map +1 -0
  99. package/{decorator/put.ts → dist/decorator/put.js} +9 -9
  100. package/dist/filters/AccessControl.d.ts +12 -0
  101. package/dist/filters/AccessControl.d.ts.map +1 -0
  102. package/dist/filters/AccessControl.js +83 -0
  103. package/dist/filters/AccessRule.d.ts +83 -0
  104. package/dist/filters/AccessRule.d.ts.map +1 -0
  105. package/dist/filters/AccessRule.js +136 -0
  106. package/{filters/auth/AuthInterface.ts → dist/filters/auth/AuthInterface.d.ts} +7 -15
  107. package/dist/filters/auth/AuthInterface.d.ts.map +1 -0
  108. package/dist/filters/auth/AuthInterface.js +2 -0
  109. package/dist/filters/auth/AuthMethod.d.ts +38 -0
  110. package/dist/filters/auth/AuthMethod.d.ts.map +1 -0
  111. package/dist/filters/auth/AuthMethod.js +82 -0
  112. package/dist/filters/auth/HttpBasicAuth.d.ts +24 -0
  113. package/dist/filters/auth/HttpBasicAuth.d.ts.map +1 -0
  114. package/dist/filters/auth/HttpBasicAuth.js +79 -0
  115. package/dist/filters/auth/HttpBearerAuth.d.ts +18 -0
  116. package/dist/filters/auth/HttpBearerAuth.d.ts.map +1 -0
  117. package/dist/filters/auth/HttpBearerAuth.js +33 -0
  118. package/dist/filters/auth/HttpHeaderAuth.d.ts +19 -0
  119. package/dist/filters/auth/HttpHeaderAuth.d.ts.map +1 -0
  120. package/dist/filters/auth/HttpHeaderAuth.js +64 -0
  121. package/dist/filters/auth/JwtHttpBearerAuth.d.ts +21 -0
  122. package/dist/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -0
  123. package/dist/filters/auth/JwtHttpBearerAuth.js +88 -0
  124. package/dist/filters/auth/KeyCloakHttpBearerAuth.d.ts +23 -0
  125. package/dist/filters/auth/KeyCloakHttpBearerAuth.d.ts.map +1 -0
  126. package/dist/filters/auth/KeyCloakHttpBearerAuth.js +116 -0
  127. package/dist/filters/auth/index.d.ts +5 -0
  128. package/dist/filters/auth/index.d.ts.map +1 -0
  129. package/dist/filters/auth/index.js +11 -0
  130. package/dist/filters/index.d.ts +3 -0
  131. package/dist/filters/index.d.ts.map +1 -0
  132. package/dist/filters/index.js +7 -0
  133. package/dist/index.d.ts +26 -0
  134. package/dist/index.d.ts.map +1 -0
  135. package/dist/index.js +73 -0
  136. package/dist/log/log/config/log4js.json +55 -0
  137. package/dist/model/RouteDefinition.d.ts +7 -0
  138. package/dist/model/RouteDefinition.d.ts.map +1 -0
  139. package/{base/Configurable.ts → dist/model/RouteDefinition.js} +2 -4
  140. package/dist/package.json +63 -0
  141. package/dist/rbac/AuthAssignment.d.ts +19 -0
  142. package/dist/rbac/AuthAssignment.d.ts.map +1 -0
  143. package/dist/rbac/AuthAssignment.js +44 -0
  144. package/dist/rbac/AuthItem.d.ts +27 -0
  145. package/dist/rbac/AuthItem.d.ts.map +1 -0
  146. package/{rbac/AuthItem.ts → dist/rbac/AuthItem.js} +16 -22
  147. package/dist/rbac/AuthItemChild.d.ts +19 -0
  148. package/dist/rbac/AuthItemChild.d.ts.map +1 -0
  149. package/{rbac/AuthItemChild.ts → dist/rbac/AuthItemChild.js} +14 -21
  150. package/dist/rbac/AuthManager.d.ts +112 -0
  151. package/dist/rbac/AuthManager.d.ts.map +1 -0
  152. package/dist/rbac/AuthManager.js +356 -0
  153. package/dist/rbac/index.d.ts +5 -0
  154. package/dist/rbac/index.d.ts.map +1 -0
  155. package/dist/rbac/index.js +28 -0
  156. package/dist/requiments/Glob.d.ts +3 -0
  157. package/dist/requiments/Glob.d.ts.map +1 -0
  158. package/dist/requiments/Glob.js +10 -0
  159. package/dist/requiments/ReflectUtil.d.ts +1 -0
  160. package/dist/requiments/ReflectUtil.d.ts.map +1 -0
  161. package/{requiments/ReflectUtil.ts → dist/requiments/ReflectUtil.js} +4 -6
  162. package/dist/requiments/Utils.d.ts +2 -0
  163. package/dist/requiments/Utils.d.ts.map +1 -0
  164. package/{requiments/Utils.ts → dist/requiments/Utils.js} +34 -40
  165. package/dist/validators/BooleanValidator.d.ts +1 -0
  166. package/dist/validators/BooleanValidator.d.ts.map +1 -0
  167. package/dist/validators/BooleanValidator.js +1 -0
  168. package/dist/validators/CompareValidator.d.ts +1 -0
  169. package/dist/validators/CompareValidator.d.ts.map +1 -0
  170. package/dist/validators/CompareValidator.js +1 -0
  171. package/dist/validators/DateValidator.d.ts +1 -0
  172. package/dist/validators/DateValidator.d.ts.map +1 -0
  173. package/dist/validators/DateValidator.js +1 -0
  174. package/dist/validators/EmailValidator.d.ts +1 -0
  175. package/dist/validators/EmailValidator.d.ts.map +1 -0
  176. package/dist/validators/EmailValidator.js +1 -0
  177. package/dist/validators/Validator.d.ts +18 -0
  178. package/dist/validators/Validator.d.ts.map +1 -0
  179. package/dist/validators/Validator.js +27 -0
  180. package/{web/IdentityInterface.ts → dist/web/IdentityInterface.d.ts} +2 -15
  181. package/dist/web/IdentityInterface.d.ts.map +1 -0
  182. package/dist/web/IdentityInterface.js +8 -0
  183. package/dist/web/WebUser.d.ts +72 -0
  184. package/dist/web/WebUser.d.ts.map +1 -0
  185. package/dist/web/WebUser.js +165 -0
  186. package/package.json +16 -56
  187. package/BaseChyz.ts +0 -623
  188. package/base/ActionFilter.ts +0 -88
  189. package/base/BadRequestHttpException.ts +0 -14
  190. package/base/Behavior.ts +0 -6
  191. package/base/CBaseObject.ts +0 -17
  192. package/base/CEvents.ts +0 -24
  193. package/base/CWebController.ts +0 -90
  194. package/base/Component.ts +0 -66
  195. package/base/DataErrorDbException.ts +0 -16
  196. package/base/DbConnection.ts +0 -55
  197. package/base/ForbiddenHttpException.ts +0 -15
  198. package/base/InvalidArgumentException.ts +0 -16
  199. package/base/InvalidConfigException.ts +0 -16
  200. package/base/NotFoundHttpException.ts +0 -14
  201. package/base/RestClient.ts +0 -26
  202. package/base/UnauthorizedHttpException.ts +0 -17
  203. package/base/ValidationHttpException.ts +0 -14
  204. package/base/db/Exception.ts +0 -14
  205. package/base/index.ts +0 -19
  206. package/decorator/Middleware.ts +0 -9
  207. package/decorator/enums/ControllerDecoratorParams.ts +0 -5
  208. package/decorator/index.ts +0 -5
  209. package/filters/AccessControl.ts +0 -74
  210. package/filters/AccessRule.ts +0 -182
  211. package/filters/auth/AuthMethod.ts +0 -100
  212. package/filters/auth/HttpBasicAuth.ts +0 -79
  213. package/filters/auth/HttpBearerAuth.ts +0 -34
  214. package/filters/auth/HttpHeaderAuth.ts +0 -61
  215. package/filters/auth/JwtHttpBearerAuth.ts +0 -83
  216. package/filters/auth/KeyCloakHttpBearerAuth.ts +0 -114
  217. package/filters/auth/index.ts +0 -4
  218. package/filters/index.ts +0 -2
  219. package/index.ts +0 -80
  220. package/model/RouteDefinition.ts +0 -18
  221. package/rbac/AuthAssignment.ts +0 -50
  222. package/rbac/AuthManager.ts +0 -399
  223. package/rbac/index.ts +0 -12
  224. package/validators/BooleanValidator.ts +0 -0
  225. package/validators/CompareValidator.ts +0 -0
  226. package/validators/DateValidator.ts +0 -0
  227. package/validators/EmailValidator.ts +0 -0
  228. package/validators/Validator.ts +0 -27
  229. package/web/WebUser.ts +0 -187
  230. /package/{README.md → dist/README.md} +0 -0
  231. /package/{log → dist/log}/config/log4js.json +0 -0
@@ -0,0 +1,32 @@
1
+ import { Request, Response } from "../index";
2
+ import { CBaseObject } from "./CBaseObject";
3
+ export declare class ActionFilter extends CBaseObject {
4
+ only: any;
5
+ /**
6
+ * @var array list of action IDs that this filter should not apply to.
7
+ * @see only
8
+ */
9
+ except: never[];
10
+ init(): void;
11
+ /**
12
+ *
13
+ * @param route
14
+ * @param req
15
+ * @param res
16
+ */
17
+ beforeFilter(route: any, req: Request, res: Response): Promise<void>;
18
+ /**
19
+ * This method is invoked right before an action is to be executed (after all possible filters.)
20
+ * You may override this method to do last-minute preparation for the action.
21
+ * @param Action $action the action to be executed.
22
+ * @return bool whether the action should continue to be executed.
23
+ */
24
+ beforeAction(route: any, req: Request, res: Response): Promise<boolean>;
25
+ /**
26
+ *
27
+ * @param action
28
+ * @protected
29
+ */
30
+ protected isActive(action: any): boolean;
31
+ }
32
+ //# 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;AAGzC,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;IAUjE;;;;;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;CA8BjC"}
@@ -0,0 +1,90 @@
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.ActionFilter = void 0;
16
+ const Utils_1 = require("../requiments/Utils");
17
+ const CBaseObject_1 = require("./CBaseObject");
18
+ const BaseChyz_1 = __importDefault(require("../BaseChyz"));
19
+ class ActionFilter extends CBaseObject_1.CBaseObject {
20
+ constructor() {
21
+ super(...arguments);
22
+ /**
23
+ * @var array list of action IDs that this filter should not apply to.
24
+ * @see only
25
+ */
26
+ this.except = [];
27
+ }
28
+ init() {
29
+ }
30
+ /**
31
+ *
32
+ * @param route
33
+ * @param req
34
+ * @param res
35
+ */
36
+ beforeFilter(route, req, res) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ BaseChyz_1.default.debug("Controller->ActionFilter->beforeFilter ", JSON.stringify(route));
39
+ if (!this.isActive(route)) {
40
+ return;
41
+ }
42
+ yield this.beforeAction(route, req, res);
43
+ });
44
+ }
45
+ /**
46
+ * This method is invoked right before an action is to be executed (after all possible filters.)
47
+ * You may override this method to do last-minute preparation for the action.
48
+ * @param Action $action the action to be executed.
49
+ * @return bool whether the action should continue to be executed.
50
+ */
51
+ beforeAction(route, req, res) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ return true;
54
+ });
55
+ }
56
+ /**
57
+ *
58
+ * @param action
59
+ * @protected
60
+ */
61
+ isActive(action) {
62
+ let id = action.id;
63
+ let onlyMatch = false;
64
+ let exceptMatch = false;
65
+ if (Utils_1.Utils.isEmpty(this.only)) {
66
+ onlyMatch = true;
67
+ }
68
+ else {
69
+ onlyMatch = false;
70
+ for (const onlyKey of this.only) {
71
+ if (Utils_1.Utils.matchWildcard(action.id, onlyKey)) {
72
+ onlyMatch = true;
73
+ break;
74
+ }
75
+ }
76
+ }
77
+ for (const exceptKey in this.except) {
78
+ let pattern = this.except[exceptKey];
79
+ let reg = new RegExp(`${pattern}$`, "g");
80
+ let match = id.match(reg);
81
+ // let match = id.startsWith(pattern);
82
+ BaseChyz_1.default.debug("Controller->ActionFilter->isActive ", "id:", id, "patern:", pattern, "match:", match, JSON.stringify(this.except));
83
+ if (match && match.length > 0) {
84
+ exceptMatch = true;
85
+ }
86
+ }
87
+ return !exceptMatch && onlyMatch;
88
+ }
89
+ }
90
+ exports.ActionFilter = ActionFilter;
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class BadRequestHttpException extends BaseError {
3
+ message: string;
4
+ constructor(message: string);
5
+ }
6
+ //# sourceMappingURL=BadRequestHttpException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BadRequestHttpException.d.ts","sourceRoot":"","sources":["../../src/base/BadRequestHttpException.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,uBAAwB,SAAQ,SAAS;IAC7B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
@@ -0,0 +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.BadRequestHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class BadRequestHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 400);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.BadRequestHttpException = BadRequestHttpException;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * 10.4 Client Error 4xx ............................................65
3
+ * 10.4.1 400 Bad Request .........................................65
4
+ * 10.4.2 401 Unauthorized ........................................66
5
+ * 10.4.3 402 Payment Required ....................................66
6
+ * 10.4.4 403 Forbidden ...........................................66
7
+ * 10.4.5 404 Not Found ...........................................66
8
+ * 10.4.6 405 Method Not Allowed ..................................66
9
+ * 10.4.7 406 Not Acceptable ......................................67
10
+ * 10.4.8 407 Proxy Authentication Required .......................67
11
+ * 10.4.9 408 Request Timeout .....................................67
12
+ * 10.4.10 409 Conflict ............................................67
13
+ * 10.4.11 410 Gone ................................................68
14
+ * 10.4.12 411 Length Required .....................................68
15
+ * 10.4.13 412 Precondition Failed .................................68
16
+ * 10.4.14 413 Request Entity Too Large ............................69
17
+ * 10.4.15 414 Request-URI Too Long ................................69
18
+ * 10.4.16 415 Unsupported Media Type ..............................69
19
+ * 10.4.17 416 Requested Range Not Satisfiable .....................69
20
+ * 10.4.18 417 Expectation Failed ..................................70
21
+ */
22
+ export declare class BaseError extends Error {
23
+ statusCode: number;
24
+ orginal: any;
25
+ private readonly success;
26
+ constructor(message: any, statusCode?: number);
27
+ toString(): string;
28
+ toJSON(): {
29
+ success: boolean;
30
+ code: number;
31
+ name: string;
32
+ message: string;
33
+ stack: string | undefined;
34
+ orginal: any;
35
+ } | {
36
+ success: boolean;
37
+ code: number;
38
+ name: string;
39
+ message: string;
40
+ stack?: undefined;
41
+ orginal?: undefined;
42
+ };
43
+ }
44
+ //# sourceMappingURL=BaseError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,OAAO,EAAE,GAAG,EAAE,UAAU,SAAM;IAW1C,QAAQ;IAIR,MAAM;;;;;;;;;;;;;;;CAcT"}
@@ -1,12 +1,13 @@
1
+ "use strict";
1
2
  /*
2
3
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
4
  * Author: Cihan Ozturk
4
5
  * E-mail: cihan@chy.com.tr
5
6
  * Github:https://github.com/cihan53/
6
7
  */
7
-
8
- import {Utils} from "../requiments/Utils";
9
-
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BaseError = void 0;
10
+ const Utils_1 = require("../requiments/Utils");
10
11
  /**
11
12
  * 10.4 Client Error 4xx ............................................65
12
13
  * 10.4.1 400 Bad Request .........................................65
@@ -28,39 +29,30 @@ import {Utils} from "../requiments/Utils";
28
29
  * 10.4.17 416 Requested Range Not Satisfiable .....................69
29
30
  * 10.4.18 417 Expectation Failed ..................................70
30
31
  */
31
- export class BaseError extends Error {
32
- statusCode: number;
33
- orginal: any;
34
- private readonly success: boolean;
35
-
36
- constructor(message: any, statusCode = 500) {
32
+ class BaseError extends Error {
33
+ constructor(message, statusCode = 500) {
37
34
  super(message);
38
-
39
35
  this.success = false;
40
- this.message = Utils.isString(message) ? message : JSON.stringify(message);
41
- this.name = this.constructor.name // good practice
42
- this.statusCode = statusCode // error code for responding to client
36
+ this.message = Utils_1.Utils.isString(message) ? message : JSON.stringify(message);
37
+ this.name = this.constructor.name; // good practice
38
+ this.statusCode = statusCode; // error code for responding to client
43
39
  //Error.captureStackTrace(this)
44
- this.orginal = Utils.isString(message) ? message : message
40
+ this.orginal = Utils_1.Utils.isString(message) ? message : message;
45
41
  }
46
-
47
42
  toString() {
48
- return `${this.name}[${this.statusCode}] ${this.message}`
43
+ return `${this.name}[${this.statusCode}] ${this.message}`;
49
44
  }
50
-
51
45
  toJSON() {
52
46
  if (process.env.NODE_ENV == "development" || process.env.NODE_ENV == "dev") {
53
- return {success: this.success, code: this?.statusCode, name: this.name.toString(),
47
+ return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(),
54
48
  message: this.message.toString(),
55
49
  stack: this.stack,
56
- orginal: this.orginal
57
- }
58
- } else {
59
- return {success: this.success, code: this?.statusCode, name: this.name.toString(),
60
- message: this.message.toString()
61
- }
50
+ orginal: this.orginal };
51
+ }
52
+ else {
53
+ return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(),
54
+ message: this.message.toString() };
62
55
  }
63
-
64
56
  }
65
57
  }
66
-
58
+ exports.BaseError = BaseError;
@@ -0,0 +1,4 @@
1
+ import { CBaseObject } from "./CBaseObject";
2
+ export declare class Behavior extends CBaseObject {
3
+ }
4
+ //# sourceMappingURL=Behavior.d.ts.map
@@ -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"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Behavior = void 0;
4
+ const CBaseObject_1 = require("./CBaseObject");
5
+ class Behavior extends CBaseObject_1.CBaseObject {
6
+ }
7
+ exports.Behavior = Behavior;
@@ -0,0 +1,5 @@
1
+ import { Configurable } from "./Configurable";
2
+ export declare class CBaseObject implements Configurable {
3
+ init(): void;
4
+ }
5
+ //# sourceMappingURL=CBaseObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CBaseObject.d.ts","sourceRoot":"","sources":["../../src/base/CBaseObject.ts"],"names":[],"mappings":"AAQA,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 index_1 = require("../index");
11
+ class CBaseObject {
12
+ init() {
13
+ index_1.BaseChyz.debug("BaseObject init.....");
14
+ }
15
+ }
16
+ exports.CBaseObject = CBaseObject;
@@ -0,0 +1,13 @@
1
+ export declare enum CEvents {
2
+ ON_INIT_BEFORE = "oninitbefore",
3
+ ON_INIT_AFTER = "oninitafter",
4
+ ON_MIDDLEWARE = "onmiddleware",
5
+ ON_BEFORE_START = "onbeforestart",
6
+ ON_AFTER_START = "onafterestart",
7
+ ON_START = "onstart",
8
+ ON_BEFORE_ACTION = "onbeferoaction",
9
+ ON_AFTER_ACTION = "onafteraction",
10
+ ON_DB_CONNECTION = "ondbconnection",
11
+ ON_DB_DISCONNECT = "ondbdisconnect"
12
+ }
13
+ //# sourceMappingURL=CEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CEvents.d.ts","sourceRoot":"","sources":["../../src/base/CEvents.ts"],"names":[],"mappings":"AAQA,oBAAY,OAAO;IACf,cAAc,iBAAe;IAC7B,aAAa,gBAAc;IAC3B,aAAa,iBAAe;IAC5B,eAAe,kBAAkB;IACjC,cAAc,kBAAkB;IAChC,QAAQ,YAAY;IAEpB,gBAAgB,mBAAmB;IACnC,eAAe,kBAAkB;IAEjC,gBAAgB,mBAAiB;IACjC,gBAAgB,mBAAiB;CAGpC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CEvents = void 0;
4
+ /*
5
+ *
6
+ * Copyright (c) 2023.. Chy Bilgisayar Bilisim
7
+ * Author: Cihan Ozturk
8
+ * E-mail: cihan@chy.com.tr
9
+ * Github:https://github.com/cihan53/
10
+ *
11
+ */
12
+ var CEvents;
13
+ (function (CEvents) {
14
+ CEvents["ON_INIT_BEFORE"] = "oninitbefore";
15
+ CEvents["ON_INIT_AFTER"] = "oninitafter";
16
+ CEvents["ON_MIDDLEWARE"] = "onmiddleware";
17
+ CEvents["ON_BEFORE_START"] = "onbeforestart";
18
+ CEvents["ON_AFTER_START"] = "onafterestart";
19
+ CEvents["ON_START"] = "onstart";
20
+ CEvents["ON_BEFORE_ACTION"] = "onbeferoaction";
21
+ CEvents["ON_AFTER_ACTION"] = "onafteraction";
22
+ CEvents["ON_DB_CONNECTION"] = "ondbconnection";
23
+ CEvents["ON_DB_DISCONNECT"] = "ondbdisconnect";
24
+ })(CEvents || (exports.CEvents = CEvents = {}));
@@ -0,0 +1,2 @@
1
+ export { Request, Response, NextFunction } from "express";
2
+ //# sourceMappingURL=CRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CRequest.d.ts","sourceRoot":"","sources":["../../src/base/CRequest.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC"}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /*
2
3
  *
3
4
  * Copyright (c) 2022.. Chy Bilgisayar Bilisim
@@ -6,9 +7,4 @@
6
7
  * Github:https://github.com/cihan53/
7
8
  *
8
9
  */
9
-
10
- export {Request ,Response, NextFunction} from "express";
11
-
12
-
13
-
14
-
10
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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;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"}
@@ -0,0 +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
+ 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;
@@ -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,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"}
@@ -0,0 +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;
@@ -0,0 +1,3 @@
1
+ export interface Configurable {
2
+ }
3
+ //# sourceMappingURL=Configurable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Configurable.d.ts","sourceRoot":"","sources":["../../src/base/Configurable.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;CAE5B"}
@@ -1,9 +1,8 @@
1
+ "use strict";
1
2
  /*
2
3
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
4
  * Author: Cihan Ozturk
4
5
  * E-mail: cihan@chy.com.tr
5
6
  * Github:https://github.com/cihan53/
6
7
  */
7
-
8
- const Glob = require("glob");
9
- export default Glob;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class DataErrorDbException extends BaseError {
3
+ message: any;
4
+ constructor(message: any);
5
+ }
6
+ //# sourceMappingURL=DataErrorDbException.d.ts.map
@@ -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,GAAG;gBAAZ,OAAO,EAAE,GAAG;CAGpC"}
@@ -0,0 +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;