chyz 1.2.5-rc.0 → 2.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/BaseChyz.d.ts +61 -0
  2. package/BaseChyz.d.ts.map +1 -0
  3. package/BaseChyz.js +11 -15
  4. package/base/ActionFilter.d.ts +33 -0
  5. package/base/ActionFilter.d.ts.map +1 -0
  6. package/base/ActionFilter.js +18 -14
  7. package/base/BaseError.d.ts +11 -0
  8. package/base/BaseError.d.ts.map +1 -0
  9. package/base/BaseError.js +0 -1
  10. package/base/Behavior.d.ts +4 -0
  11. package/base/Behavior.d.ts.map +1 -0
  12. package/base/Behavior.js +2 -3
  13. package/base/CBaseObject.d.ts +5 -0
  14. package/base/CBaseObject.d.ts.map +1 -0
  15. package/base/CBaseObject.js +16 -0
  16. package/base/CWebController.d.ts +44 -0
  17. package/base/CWebController.d.ts.map +1 -0
  18. package/base/CWebController.js +0 -1
  19. package/base/Component.d.ts +21 -0
  20. package/base/Component.d.ts.map +1 -0
  21. package/base/Component.js +5 -6
  22. package/base/Configurable.d.ts +3 -0
  23. package/base/Configurable.d.ts.map +1 -0
  24. package/base/Configurable.js +0 -1
  25. package/base/DataErrorDbException.d.ts +6 -0
  26. package/base/DataErrorDbException.d.ts.map +1 -0
  27. package/base/DataErrorDbException.js +0 -1
  28. package/base/DbConnection.d.ts +13 -0
  29. package/base/DbConnection.d.ts.map +1 -0
  30. package/base/DbConnection.js +1 -2
  31. package/base/ForbiddenHttpException.d.ts +5 -0
  32. package/base/ForbiddenHttpException.d.ts.map +1 -0
  33. package/base/ForbiddenHttpException.js +0 -1
  34. package/base/InvalidArgumentException.d.ts +6 -0
  35. package/base/InvalidArgumentException.d.ts.map +1 -0
  36. package/base/InvalidArgumentException.js +0 -1
  37. package/base/InvalidConfigException.d.ts +6 -0
  38. package/base/InvalidConfigException.d.ts.map +1 -0
  39. package/base/InvalidConfigException.js +0 -1
  40. package/base/Logger.d.ts +18 -0
  41. package/base/Logger.d.ts.map +1 -0
  42. package/base/Logger.js +49 -0
  43. package/base/Model.d.ts +299 -0
  44. package/base/Model.d.ts.map +1 -0
  45. package/base/Model.js +0 -1
  46. package/base/ModelManager.d.ts +2 -0
  47. package/base/ModelManager.d.ts.map +1 -0
  48. package/base/ModelManager.js +11 -1
  49. package/base/NotFoundHttpException.d.ts +6 -0
  50. package/base/NotFoundHttpException.d.ts.map +1 -0
  51. package/base/NotFoundHttpException.js +0 -1
  52. package/base/RestClient.d.ts +9 -0
  53. package/base/RestClient.d.ts.map +1 -0
  54. package/base/RestClient.js +0 -1
  55. package/base/UnauthorizedHttpException.d.ts +6 -0
  56. package/base/UnauthorizedHttpException.d.ts.map +1 -0
  57. package/base/UnauthorizedHttpException.js +0 -1
  58. package/base/ValidationHttpException.d.ts +6 -0
  59. package/base/ValidationHttpException.d.ts.map +1 -0
  60. package/base/ValidationHttpException.js +0 -1
  61. package/base/db/Exception.d.ts +7 -0
  62. package/base/db/Exception.d.ts.map +1 -0
  63. package/base/db/Exception.js +0 -1
  64. package/base/index.d.ts +18 -0
  65. package/base/index.d.ts.map +1 -0
  66. package/base/index.js +5 -6
  67. package/decorator/Middleware.d.ts +4 -0
  68. package/decorator/Middleware.d.ts.map +1 -0
  69. package/decorator/Middleware.js +0 -1
  70. package/decorator/controller.d.ts +3 -0
  71. package/decorator/controller.d.ts.map +1 -0
  72. package/decorator/controller.js +0 -1
  73. package/decorator/enums/ControllerDecoratorParams.d.ts +6 -0
  74. package/decorator/enums/ControllerDecoratorParams.d.ts.map +1 -0
  75. package/decorator/enums/ControllerDecoratorParams.js +0 -1
  76. package/decorator/get.d.ts +3 -0
  77. package/decorator/get.d.ts.map +1 -0
  78. package/decorator/get.js +0 -1
  79. package/decorator/index.d.ts +4 -0
  80. package/decorator/index.d.ts.map +1 -0
  81. package/decorator/index.js +0 -1
  82. package/decorator/post.d.ts +3 -0
  83. package/decorator/post.d.ts.map +1 -0
  84. package/decorator/post.js +0 -1
  85. package/filters/AccessControl.d.ts +13 -0
  86. package/filters/AccessControl.d.ts.map +1 -0
  87. package/filters/AccessControl.js +4 -5
  88. package/filters/AccessRule.d.ts +83 -0
  89. package/filters/AccessRule.d.ts.map +1 -0
  90. package/filters/AccessRule.js +2 -2
  91. package/filters/auth/AuthInterface.d.ts +26 -0
  92. package/filters/auth/AuthInterface.d.ts.map +1 -0
  93. package/filters/auth/AuthInterface.js +0 -1
  94. package/filters/auth/AuthMethod.d.ts +38 -0
  95. package/filters/auth/AuthMethod.d.ts.map +1 -0
  96. package/filters/auth/AuthMethod.js +12 -1
  97. package/filters/auth/HttpBasicAuth.d.ts +23 -0
  98. package/filters/auth/HttpBasicAuth.d.ts.map +1 -0
  99. package/filters/auth/HttpBasicAuth.js +0 -1
  100. package/filters/auth/HttpBearerAuth.d.ts +18 -0
  101. package/filters/auth/HttpBearerAuth.d.ts.map +1 -0
  102. package/filters/auth/HttpBearerAuth.js +0 -1
  103. package/filters/auth/HttpHeaderAuth.d.ts +15 -0
  104. package/filters/auth/HttpHeaderAuth.d.ts.map +1 -0
  105. package/filters/auth/HttpHeaderAuth.js +0 -1
  106. package/filters/auth/JwtHttpBearerAuth.d.ts +21 -0
  107. package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -0
  108. package/filters/auth/JwtHttpBearerAuth.js +0 -1
  109. package/filters/auth/KeyCloakHttpBearerAuth.d.ts +23 -0
  110. package/filters/auth/KeyCloakHttpBearerAuth.d.ts.map +1 -0
  111. package/filters/auth/KeyCloakHttpBearerAuth.js +0 -1
  112. package/filters/auth/index.d.ts +5 -0
  113. package/filters/auth/index.d.ts.map +1 -0
  114. package/filters/auth/index.js +0 -1
  115. package/filters/index.d.ts +3 -0
  116. package/filters/index.d.ts.map +1 -0
  117. package/filters/index.js +0 -1
  118. package/index.d.ts +17 -0
  119. package/index.d.ts.map +1 -0
  120. package/index.js +25 -20
  121. package/model/RouteDefinition.d.ts +7 -0
  122. package/model/RouteDefinition.d.ts.map +1 -0
  123. package/model/RouteDefinition.js +0 -1
  124. package/package.json +12 -10
  125. package/rbac/AuthAssignment.d.ts +19 -0
  126. package/rbac/AuthAssignment.d.ts.map +1 -0
  127. package/rbac/AuthAssignment.js +0 -1
  128. package/rbac/AuthItem.d.ts +27 -0
  129. package/rbac/AuthItem.d.ts.map +1 -0
  130. package/rbac/AuthItem.js +0 -1
  131. package/rbac/AuthItemChild.d.ts +19 -0
  132. package/rbac/AuthItemChild.d.ts.map +1 -0
  133. package/rbac/AuthItemChild.js +0 -1
  134. package/rbac/AuthManager.d.ts +112 -0
  135. package/rbac/AuthManager.d.ts.map +1 -0
  136. package/rbac/AuthManager.js +0 -1
  137. package/requiments/Glob.d.ts +3 -0
  138. package/requiments/Glob.d.ts.map +1 -0
  139. package/requiments/Glob.js +0 -1
  140. package/requiments/ReflectUtil.d.ts +1 -0
  141. package/requiments/ReflectUtil.d.ts.map +1 -0
  142. package/requiments/ReflectUtil.js +0 -1
  143. package/requiments/Utils.d.ts +3 -0
  144. package/requiments/Utils.d.ts.map +1 -0
  145. package/requiments/Utils.js +7 -1
  146. package/validators/BooleanValidator.d.ts +1 -0
  147. package/validators/BooleanValidator.d.ts.map +1 -0
  148. package/validators/BooleanValidator.js +0 -1
  149. package/validators/CompareValidator.d.ts +1 -0
  150. package/validators/CompareValidator.d.ts.map +1 -0
  151. package/validators/CompareValidator.js +0 -1
  152. package/validators/DateValidator.d.ts +1 -0
  153. package/validators/DateValidator.d.ts.map +1 -0
  154. package/validators/DateValidator.js +0 -1
  155. package/validators/EmailValidator.d.ts +1 -0
  156. package/validators/EmailValidator.d.ts.map +1 -0
  157. package/validators/EmailValidator.js +0 -1
  158. package/validators/Validator.d.ts +18 -0
  159. package/validators/Validator.d.ts.map +1 -0
  160. package/validators/Validator.js +0 -1
  161. package/web/IdentityInterface.d.ts +55 -0
  162. package/web/IdentityInterface.d.ts.map +1 -0
  163. package/web/IdentityInterface.js +0 -1
  164. package/web/WebUser.d.ts +72 -0
  165. package/web/WebUser.d.ts.map +1 -0
  166. package/web/WebUser.js +0 -1
  167. package/BaseChyz.js.map +0 -1
  168. package/Chyz.js +0 -15
  169. package/Chyz.js.map +0 -1
  170. package/base/ActionFilter.js.map +0 -1
  171. package/base/BaseError.js.map +0 -1
  172. package/base/BaseObject.js +0 -20
  173. package/base/BaseObject.js.map +0 -1
  174. package/base/Behavior.js.map +0 -1
  175. package/base/CWebController.js.map +0 -1
  176. package/base/Component.js.map +0 -1
  177. package/base/Configurable.js.map +0 -1
  178. package/base/DataErrorDbException.js.map +0 -1
  179. package/base/DbConnection.js.map +0 -1
  180. package/base/ForbiddenHttpException.js.map +0 -1
  181. package/base/InvalidArgumentException.js.map +0 -1
  182. package/base/InvalidConfigException.js.map +0 -1
  183. package/base/Model.js.map +0 -1
  184. package/base/ModelManager.js.map +0 -1
  185. package/base/NotFoundHttpException.js.map +0 -1
  186. package/base/RestClient.js.map +0 -1
  187. package/base/UnauthorizedHttpException.js.map +0 -1
  188. package/base/ValidationHttpException.js.map +0 -1
  189. package/base/db/Exception.js.map +0 -1
  190. package/base/index.js.map +0 -1
  191. package/decorator/Middleware.js.map +0 -1
  192. package/decorator/controller.js.map +0 -1
  193. package/decorator/enums/ControllerDecoratorParams.js.map +0 -1
  194. package/decorator/get.js.map +0 -1
  195. package/decorator/index.js.map +0 -1
  196. package/decorator/post.js.map +0 -1
  197. package/filters/AccessControl.js.map +0 -1
  198. package/filters/AccessRule.js.map +0 -1
  199. package/filters/auth/AuthInterface.js.map +0 -1
  200. package/filters/auth/AuthMethod.js.map +0 -1
  201. package/filters/auth/HttpBasicAuth.js.map +0 -1
  202. package/filters/auth/HttpBearerAuth.js.map +0 -1
  203. package/filters/auth/HttpHeaderAuth.js.map +0 -1
  204. package/filters/auth/JwtHttpBearerAuth.js.map +0 -1
  205. package/filters/auth/KeyCloakHttpBearerAuth.js.map +0 -1
  206. package/filters/auth/index.js.map +0 -1
  207. package/filters/index.js.map +0 -1
  208. package/index.js.map +0 -1
  209. package/model/RouteDefinition.js.map +0 -1
  210. package/rbac/AuthAssignment.js.map +0 -1
  211. package/rbac/AuthItem.js.map +0 -1
  212. package/rbac/AuthItemChild.js.map +0 -1
  213. package/rbac/AuthManager.js.map +0 -1
  214. package/requiments/Glob.js.map +0 -1
  215. package/requiments/ReflectUtil.js.map +0 -1
  216. package/requiments/Utils.js.map +0 -1
  217. package/validators/BooleanValidator.js.map +0 -1
  218. package/validators/CompareValidator.js.map +0 -1
  219. package/validators/DateValidator.js.map +0 -1
  220. package/validators/EmailValidator.js.map +0 -1
  221. package/validators/Validator.js.map +0 -1
  222. package/web/IdentityInterface.js.map +0 -1
  223. package/web/WebUser.js.map +0 -1
package/BaseChyz.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ import 'reflect-metadata';
2
+ import { Logger } from "./base/Logger";
3
+ export default class BaseChyz {
4
+ private config;
5
+ static app: string;
6
+ static httpServer: any;
7
+ static express: any;
8
+ private _port;
9
+ static db: any;
10
+ static routes: any;
11
+ static logger: Logger;
12
+ private static _validate;
13
+ private _controllerpath;
14
+ private static controllers;
15
+ static components: any;
16
+ static middlewares: any;
17
+ get controllerpath(): string;
18
+ set controllerpath(value: string);
19
+ init(): void;
20
+ /**
21
+ * Listen port number
22
+ * Server port number get
23
+ */
24
+ get port(): number;
25
+ /**
26
+ * Listen port number
27
+ * Server port number setting
28
+ * @param value
29
+ */
30
+ set port(value: number);
31
+ static get validate(): any;
32
+ static set validate(value: any);
33
+ app(config?: any): BaseChyz;
34
+ logProvider(): any;
35
+ getLogger(): any;
36
+ static logs(...args: any[]): any;
37
+ static trace(...args: any[]): void;
38
+ static debug(...args: any[]): void;
39
+ static info(...args: any[]): void;
40
+ static warn(...args: any[]): void;
41
+ static error(...args: any[]): void;
42
+ static fatal(...args: any[]): void;
43
+ static warning(...args: any[]): void;
44
+ static t(text: string): string;
45
+ errorLogger(error: any, req: any, res: any, next: any): void;
46
+ errorResponder(error: any, req: any, res: any, next: any): void;
47
+ errorHandler(err: any, req: any, res: any, next: any): any;
48
+ static getComponent(key: any): any;
49
+ static getMiddlewares(key: any): any;
50
+ /**
51
+ * load model
52
+ */
53
+ loadModels(): Promise<void>;
54
+ /**
55
+ * load contoller
56
+ */
57
+ loadController(): Promise<void>;
58
+ middleware(): void;
59
+ Start(): this;
60
+ }
61
+ //# sourceMappingURL=BaseChyz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAoDrC,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAM;IACpB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,OAAO,MAAY;IAC1B,OAAO,CAAC,KAAK,CAAgB;IAC7B,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiB;IACzC,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,MAAM,CAAC,WAAW,CAA4B;IACtD,OAAc,UAAU,EAAE,GAAG,CAAK;IAClC,OAAc,WAAW,EAAE,GAAG,CAAK;IAGnC,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;IAED,IAAI;IA4DJ;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAGD,MAAM,KAAK,QAAQ,IAAI,GAAG,CAEzB;IAED,MAAM,KAAK,QAAQ,CAAC,KAAK,EAAE,GAAG,EAE7B;IAED,GAAG,CAAC,MAAM,GAAE,GAAQ,GAAG,QAAQ;IA6CxB,WAAW;IAIX,SAAS;IAIhB,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIZ,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAItB,CAAC,CAAC,IAAI,EAAE,MAAM;IAKrB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAKrD,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAUxD,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;WAQ7C,YAAY,CAAC,GAAG,EAAE,GAAG;WAKrB,cAAc,CAAC,GAAG,EAAE,GAAG;IAIrC;;OAEG;IACG,UAAU;IAsBhB;;OAEG;IACG,cAAc;IAoEb,UAAU;IAwCV,KAAK;CA0Bf"}
package/BaseChyz.js CHANGED
@@ -13,8 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  require("reflect-metadata");
16
- const Utils_1 = __importDefault(require("./requiments/Utils"));
17
16
  const base_1 = require("./base");
17
+ const Utils_1 = __importDefault(require("./requiments/Utils"));
18
+ const Logger_1 = require("./base/Logger");
18
19
  const https = require('https');
19
20
  const express = require("express");
20
21
  const compression = require('compression');
@@ -60,17 +61,9 @@ var bodyParser = require('body-parser');
60
61
  var methodOverride = require('method-override');
61
62
  class BaseChyz {
62
63
  constructor() {
63
- var _a;
64
64
  this._port = 3001;
65
- this._logConfig = (_a = require('./log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
66
65
  this._controllerpath = "Controllers";
67
66
  }
68
- get logConfig() {
69
- return this._logConfig;
70
- }
71
- set logConfig(value) {
72
- this._logConfig = value;
73
- }
74
67
  get controllerpath() {
75
68
  return this._controllerpath;
76
69
  }
@@ -78,6 +71,8 @@ class BaseChyz {
78
71
  this._controllerpath = value;
79
72
  }
80
73
  init() {
74
+ if (this.config.logger instanceof Logger_1.Logger)
75
+ BaseChyz.logger = this.config.logger;
81
76
  /**
82
77
  * set request id
83
78
  */
@@ -148,8 +143,8 @@ class BaseChyz {
148
143
  */
149
144
  this.config = config;
150
145
  // logger setting
151
- this.logProvider().level = log4js.levels.ALL;
152
- this.logProvider().configure(this._logConfig);
146
+ // this.logProvider().level = log4js.levels.ALL;
147
+ // this.logProvider().configure(this._logConfig);
153
148
  let components = Utils_1.default.findKeyValue(config, "components");
154
149
  if (components) {
155
150
  for (const componentsKey in components) {
@@ -264,9 +259,10 @@ class BaseChyz {
264
259
  */
265
260
  loadController() {
266
261
  return __awaiter(this, void 0, void 0, function* () {
267
- let articlesEndpoints = [];
268
- fs.readdirSync(`${this._controllerpath}/`).forEach((file) => {
262
+ // let articlesEndpoints: string[] = [];
263
+ for (const file of fs.readdirSync(`${this._controllerpath}/`)) {
269
264
  let controller = require(`${this._controllerpath}/${file}`);
265
+ // let controller = await import(`${this._controllerpath}/${file}`);
270
266
  // This is our instantiated class
271
267
  const instance = new controller();
272
268
  BaseChyz.controllers.push(instance);
@@ -317,7 +313,7 @@ class BaseChyz {
317
313
  }));
318
314
  });
319
315
  }
320
- });
316
+ }
321
317
  });
322
318
  }
323
319
  middleware() {
@@ -376,8 +372,8 @@ class BaseChyz {
376
372
  }
377
373
  exports.default = BaseChyz;
378
374
  BaseChyz.express = express();
375
+ BaseChyz.logger = new Logger_1.Logger();
379
376
  BaseChyz._validate = validate;
380
377
  BaseChyz.controllers = [];
381
378
  BaseChyz.components = {};
382
379
  BaseChyz.middlewares = {};
383
- //# sourceMappingURL=BaseChyz.js.map
@@ -0,0 +1,33 @@
1
+ /// <reference types="express" />
2
+ import { Request, Response } from "../index";
3
+ import { CBaseObject } from "./CBaseObject";
4
+ export declare class ActionFilter extends CBaseObject {
5
+ only: any;
6
+ /**
7
+ * @var array list of action IDs that this filter should not apply to.
8
+ * @see only
9
+ */
10
+ except: never[];
11
+ init(): void;
12
+ /**
13
+ *
14
+ * @param route
15
+ * @param req
16
+ * @param res
17
+ */
18
+ beforeFilter(route: any, req: Request, res: Response): Promise<void>;
19
+ /**
20
+ * This method is invoked right before an action is to be executed (after all possible filters.)
21
+ * You may override this method to do last-minute preparation for the action.
22
+ * @param Action $action the action to be executed.
23
+ * @return bool whether the action should continue to be executed.
24
+ */
25
+ beforeAction(route: any, req: Request, res: Response): Promise<boolean>;
26
+ /**
27
+ *
28
+ * @param action
29
+ * @protected
30
+ */
31
+ protected isActive(action: any): boolean;
32
+ }
33
+ //# sourceMappingURL=ActionFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionFilter.d.ts","sourceRoot":"","sources":["../../src/base/ActionFilter.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAEzC,qBAAa,YAAa,SAAQ,WAAW;IAElC,IAAI,EAAE,GAAG,CAAC;IAEjB;;;OAGG;IACI,MAAM,UAAM;IAGZ,IAAI;IAIX;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAQjE;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAIjE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG;CA0BjC"}
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ActionFilter = void 0;
16
16
  const Utils_1 = __importDefault(require("../requiments/Utils"));
17
- const Behavior_1 = require("./Behavior");
18
- class ActionFilter extends Behavior_1.Behavior {
17
+ const CBaseObject_1 = require("./CBaseObject");
18
+ class ActionFilter extends CBaseObject_1.CBaseObject {
19
19
  constructor() {
20
20
  super(...arguments);
21
21
  /**
@@ -40,6 +40,22 @@ class ActionFilter extends Behavior_1.Behavior {
40
40
  yield this.beforeAction(route, req, res);
41
41
  });
42
42
  }
43
+ /**
44
+ * This method is invoked right before an action is to be executed (after all possible filters.)
45
+ * You may override this method to do last-minute preparation for the action.
46
+ * @param Action $action the action to be executed.
47
+ * @return bool whether the action should continue to be executed.
48
+ */
49
+ beforeAction(route, req, res) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ return true;
52
+ });
53
+ }
54
+ /**
55
+ *
56
+ * @param action
57
+ * @protected
58
+ */
43
59
  isActive(action) {
44
60
  let id = action.id;
45
61
  let onlyMatch = false;
@@ -65,17 +81,5 @@ class ActionFilter extends Behavior_1.Behavior {
65
81
  }
66
82
  return !exceptMatch && onlyMatch;
67
83
  }
68
- /**
69
- * This method is invoked right before an action is to be executed (after all possible filters.)
70
- * You may override this method to do last-minute preparation for the action.
71
- * @param Action $action the action to be executed.
72
- * @return bool whether the action should continue to be executed.
73
- */
74
- beforeAction(route, req, res) {
75
- return __awaiter(this, void 0, void 0, function* () {
76
- return true;
77
- });
78
- }
79
84
  }
80
85
  exports.ActionFilter = ActionFilter;
81
- //# sourceMappingURL=ActionFilter.js.map
@@ -0,0 +1,11 @@
1
+ export declare class BaseError extends Error {
2
+ private statusCode;
3
+ constructor(message: string, statusCode?: number);
4
+ toString(): string;
5
+ toJSON(): {
6
+ code: number | undefined;
7
+ name: string;
8
+ message: string;
9
+ };
10
+ }
11
+ //# sourceMappingURL=BaseError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA,qBAAa,SAAU,SAAQ,KAAK;IAChC,OAAO,CAAC,UAAU,CAAS;gBAEf,OAAO,EAAE,MAAM,EAAC,UAAU,SAAI;IAQ1C,QAAQ;IAGR,MAAM;;;;;CAGT"}
package/base/BaseError.js CHANGED
@@ -27,4 +27,3 @@ class BaseError extends Error {
27
27
  }
28
28
  }
29
29
  exports.BaseError = BaseError;
30
- //# sourceMappingURL=BaseError.js.map
@@ -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"}
package/base/Behavior.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Behavior = void 0;
4
- const BaseObject_1 = require("./BaseObject");
5
- class Behavior extends BaseObject_1.BaseObject {
4
+ const CBaseObject_1 = require("./CBaseObject");
5
+ class Behavior extends CBaseObject_1.CBaseObject {
6
6
  }
7
7
  exports.Behavior = Behavior;
8
- //# sourceMappingURL=Behavior.js.map
@@ -0,0 +1,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":"AAOA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,qBAAa,WAAY,YAAW,YAAY;IAErC,IAAI;CAGd"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
+ * Author: Cihan Ozturk
5
+ * E-mail: cihan@chy.com.tr
6
+ * Github:https://github.com/cihan53/
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CBaseObject = void 0;
10
+ const Logger_1 = require("./Logger");
11
+ class CBaseObject {
12
+ init() {
13
+ Logger_1.Logger.debug("BaseObject init.....");
14
+ }
15
+ }
16
+ exports.CBaseObject = CBaseObject;
@@ -0,0 +1,44 @@
1
+ import { Component } from "./Component";
2
+ import { RouteDefinition } from "../model/RouteDefinition";
3
+ import { Request, Response } from "express";
4
+ export declare class CWebController extends Component {
5
+ /**
6
+ * @var string the ID of this controller.
7
+ */
8
+ id: string;
9
+ defaultAction: string;
10
+ constructor(config: any);
11
+ init(): void;
12
+ /**
13
+ * This method is invoked right before an action is executed.
14
+ * @param $action
15
+ */
16
+ beforeAction(route: RouteDefinition, req: Request, res: Response): Promise<void>;
17
+ /**
18
+ * This method is invoked right after an action is executed.
19
+ * @param action
20
+ */
21
+ afterAction(action: any, req: Request, res: Response): void;
22
+ /**
23
+ *
24
+
25
+ Checks the privilege of the current user.
26
+
27
+ This method should be overridden to check whether the current user has the privilege to run the specified action against the specified data model. If the user does not have access, a yii\web\ForbiddenHttpException should be thrown.
28
+
29
+ */
30
+ checkAccess(action: any, model?: null, params?: any): void;
31
+ /**
32
+ * Send data formatted as JSON.
33
+
34
+ This method is a shortcut for sending data formatted as JSON. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will b
35
+ */
36
+ asJson(data: any): void;
37
+ /**
38
+ * Send data formatted as XML.
39
+
40
+ This method is a shortcut for sending data formatted as XML. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will be:
41
+ */
42
+ asXml(data: any): void;
43
+ }
44
+ //# sourceMappingURL=CWebController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CWebController.d.ts","sourceRoot":"","sources":["../../src/base/CWebController.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE1C,qBAAa,cAAe,SAAQ,SAAS;IAGzC;;OAEG;IACI,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,SAAW;gBAEnB,MAAM,EAAE,GAAG;IAKhB,IAAI;IAKX;;;OAGG;IACU,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAW7E;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAI3D;;;;;;;OAOG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,GAAE,GAAQ;IAI9D;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,GAAG;IAIhB;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,GAAG;CAIlB"}
@@ -72,4 +72,3 @@ class CWebController extends Component_1.Component {
72
72
  }
73
73
  }
74
74
  exports.CWebController = CWebController;
75
- //# sourceMappingURL=CWebController.js.map
@@ -0,0 +1,21 @@
1
+ import { CBaseObject } from "./CBaseObject";
2
+ export declare class Component extends CBaseObject {
3
+ /**
4
+ * @var array the attached event handlers (event name => handlers)
5
+ */
6
+ /**
7
+ * @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized.
8
+ */
9
+ private _behaviors;
10
+ /**
11
+ * Returns a list of behaviors that this component should behave as.
12
+ */
13
+ behaviors(): any;
14
+ get getBehaviors(): any;
15
+ /**
16
+ * Makes sure that the behaviors declared in [[behaviors()]] are attached to this component.
17
+ */
18
+ ensureBehaviors(): void;
19
+ private attachBehaviorInternal;
20
+ }
21
+ //# sourceMappingURL=Component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/base/Component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAI1C,qBAAa,SAAU,SAAQ,WAAW;IAEtC;;OAEG;IAIH;;OAEG;IAEH,OAAO,CAAC,UAAU,CAA2B;IAG7C;;OAEG;IACI,SAAS,IAAI,GAAG;IAKvB,IAAI,YAAY,IAAI,GAAG,CAEtB;IAED;;OAEG;IACI,eAAe;IAetB,OAAO,CAAC,sBAAsB;CASjC"}
package/base/Component.js CHANGED
@@ -10,15 +10,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Component = void 0;
13
- const BaseObject_1 = require("./BaseObject");
13
+ const CBaseObject_1 = require("./CBaseObject");
14
14
  const Utils_1 = __importDefault(require("../requiments/Utils"));
15
- class Component extends BaseObject_1.BaseObject {
15
+ class Component extends CBaseObject_1.CBaseObject {
16
16
  constructor() {
17
- super(...arguments);
18
17
  /**
19
18
  * @var array the attached event handlers (event name => handlers)
20
19
  */
21
- this._events = [];
20
+ // private _events = [];
21
+ super(...arguments);
22
22
  /**
23
23
  * @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized.
24
24
  */
@@ -40,7 +40,7 @@ class Component extends BaseObject_1.BaseObject {
40
40
  if (this._behaviors.length == 0) {
41
41
  this._behaviors = [];
42
42
  if (this.behaviors().length > 0) {
43
- this.behaviors().forEach(behavior => {
43
+ this.behaviors().forEach((behavior) => {
44
44
  Object.keys(behavior).forEach((name) => {
45
45
  this.attachBehaviorInternal(name, behavior);
46
46
  });
@@ -58,4 +58,3 @@ class Component extends BaseObject_1.BaseObject {
58
58
  }
59
59
  }
60
60
  exports.Component = Component;
61
- //# sourceMappingURL=Component.js.map
@@ -0,0 +1,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"}
@@ -6,4 +6,3 @@
6
6
  * Github:https://github.com/cihan53/
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- //# sourceMappingURL=Configurable.js.map
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class DataErrorDbException extends BaseError {
3
+ message: string;
4
+ constructor(message: string);
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,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
@@ -15,4 +15,3 @@ class DataErrorDbException extends BaseError_1.BaseError {
15
15
  }
16
16
  }
17
17
  exports.DataErrorDbException = DataErrorDbException;
18
- //# sourceMappingURL=DataErrorDbException.js.map
@@ -0,0 +1,13 @@
1
+ import { Component } from "./Component";
2
+ export declare class DbConnection extends Component {
3
+ database: string;
4
+ username: string;
5
+ password: string;
6
+ options?: object;
7
+ private _db;
8
+ init(): Promise<void>;
9
+ get db(): any;
10
+ set db(value: any);
11
+ transaction(): any;
12
+ }
13
+ //# sourceMappingURL=DbConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbConnection.d.ts","sourceRoot":"","sources":["../../src/base/DbConnection.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAKtC,qBAAa,YAAa,SAAQ,SAAS;IAEhC,QAAQ,EAAG,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;IAClB,QAAQ,EAAG,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,GAAG,CAAK;IAEV,IAAI;IAmBV,IAAI,EAAE,IAAI,GAAG,CAEZ;IAED,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,EAEhB;IAEM,WAAW;CAIrB"}
@@ -23,7 +23,7 @@ exports.DbConnection = void 0;
23
23
  const { Sequelize } = require("sequelize");
24
24
  const Component_1 = require("./Component");
25
25
  const BaseChyz_1 = __importDefault(require("../BaseChyz"));
26
- const sequelizeCache = require('sequelize-transparent-cache');
26
+ // const sequelizeCache = require('sequelize-transparent-cache')
27
27
  class DbConnection extends Component_1.Component {
28
28
  init() {
29
29
  return __awaiter(this, void 0, void 0, function* () {
@@ -51,4 +51,3 @@ class DbConnection extends Component_1.Component {
51
51
  }
52
52
  }
53
53
  exports.DbConnection = DbConnection;
54
- //# sourceMappingURL=DbConnection.js.map
@@ -0,0 +1,5 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class ForbiddenHttpException extends BaseError {
3
+ constructor(message: string);
4
+ }
5
+ //# sourceMappingURL=ForbiddenHttpException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForbiddenHttpException.d.ts","sourceRoot":"","sources":["../../src/base/ForbiddenHttpException.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,qBAAa,sBAAuB,SAAQ,SAAS;gBACnC,OAAO,EAAE,MAAM;CAGhC"}
@@ -14,4 +14,3 @@ class ForbiddenHttpException extends BaseError_1.BaseError {
14
14
  }
15
15
  }
16
16
  exports.ForbiddenHttpException = ForbiddenHttpException;
17
- //# sourceMappingURL=ForbiddenHttpException.js.map
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class InvalidArgumentException extends BaseError {
3
+ message: string;
4
+ constructor(message: string);
5
+ }
6
+ //# sourceMappingURL=InvalidArgumentException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvalidArgumentException.d.ts","sourceRoot":"","sources":["../../src/base/InvalidArgumentException.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,wBAAyB,SAAQ,SAAS;IAC9B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
@@ -15,4 +15,3 @@ class InvalidArgumentException extends BaseError_1.BaseError {
15
15
  }
16
16
  }
17
17
  exports.InvalidArgumentException = InvalidArgumentException;
18
- //# sourceMappingURL=InvalidArgumentException.js.map
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class InvalidConfigException extends BaseError {
3
+ message: string;
4
+ constructor(message: string);
5
+ }
6
+ //# sourceMappingURL=InvalidConfigException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvalidConfigException.d.ts","sourceRoot":"","sources":["../../src/base/InvalidConfigException.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,sBAAuB,SAAQ,SAAS;IAC5B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
@@ -15,4 +15,3 @@ class InvalidConfigException extends BaseError_1.BaseError {
15
15
  }
16
16
  }
17
17
  exports.InvalidConfigException = InvalidConfigException;
18
- //# sourceMappingURL=InvalidConfigException.js.map
@@ -0,0 +1,18 @@
1
+ import { Configurable } from "./Configurable";
2
+ export declare class Logger implements Configurable {
3
+ configs: any;
4
+ init(): void;
5
+ /**
6
+ *
7
+ * @constructor
8
+ */
9
+ Provider(): any;
10
+ static logs(...args: any[]): any;
11
+ static debug(...args: any[]): void;
12
+ static info(...args: any[]): void;
13
+ static warn(...args: any[]): void;
14
+ static error(...args: any[]): void;
15
+ static fatal(...args: any[]): void;
16
+ static warning(...args: any[]): void;
17
+ }
18
+ //# sourceMappingURL=Logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/base/Logger.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,qBAAa,MAAO,YAAW,YAAY;IAEhC,OAAO,EAAE,GAAG,CAA4C;IAE/D,IAAI;IAIJ;;;OAGG;IACH,QAAQ;IAIR,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIZ,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIvC"}
package/base/Logger.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /*
3
+ *
4
+ * Copyright (c) 2022.. Chy Bilgisayar Bilisim
5
+ * Author: Cihan Ozturk
6
+ * E-mail: cihan@chy.com.tr
7
+ * Github:https://github.com/cihan53/
8
+ *
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.Logger = void 0;
12
+ const log4js = require("log4js");
13
+ class Logger {
14
+ constructor() {
15
+ var _a;
16
+ this.configs = (_a = require('./log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
17
+ }
18
+ init() {
19
+ }
20
+ /**
21
+ *
22
+ * @constructor
23
+ */
24
+ Provider() {
25
+ return log4js;
26
+ }
27
+ static logs(...args) {
28
+ return log4js.getLogger(this.name);
29
+ }
30
+ static debug(...args) {
31
+ Logger.logs().debug(...arguments);
32
+ }
33
+ static info(...args) {
34
+ Logger.logs().info(...arguments);
35
+ }
36
+ static warn(...args) {
37
+ Logger.logs().warn(...arguments);
38
+ }
39
+ static error(...args) {
40
+ Logger.logs().error(...arguments);
41
+ }
42
+ static fatal(...args) {
43
+ Logger.logs().fatal(...arguments);
44
+ }
45
+ static warning(...args) {
46
+ Logger.logs().warn(...arguments);
47
+ }
48
+ }
49
+ exports.Logger = Logger;