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,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.UnauthorizedHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class UnauthorizedHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 401);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.UnauthorizedHttpException = UnauthorizedHttpException;
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class ValidationHttpException extends BaseError {
3
+ message: any;
4
+ constructor(message: any);
5
+ }
6
+ //# sourceMappingURL=ValidationHttpException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationHttpException.d.ts","sourceRoot":"","sources":["../../src/base/ValidationHttpException.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,uBAAwB,SAAQ,SAAS;IAC7B,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.ValidationHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class ValidationHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 400);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.ValidationHttpException = ValidationHttpException;
@@ -0,0 +1,7 @@
1
+ import { BaseError } from "../BaseError";
2
+ export declare class Exception extends BaseError {
3
+ errorInfo: never[];
4
+ protected code: string;
5
+ constructor(message: string, errorInfo?: any, code?: string, previous?: null);
6
+ }
7
+ //# sourceMappingURL=Exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exception.d.ts","sourceRoot":"","sources":["../../../src/base/db/Exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,qBAAa,SAAU,SAAQ,SAAS;IAC7B,SAAS,UAAM;IACtB,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,SAAS,GAAC,GAAQ,EAAE,IAAI,SAAK,EAAE,QAAQ,OAAO;CAO9E"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Exception = void 0;
4
+ const BaseError_1 = require("../BaseError");
5
+ class Exception extends BaseError_1.BaseError {
6
+ constructor(message, errorInfo = [], code = '', previous = null) {
7
+ super(message);
8
+ this.errorInfo = [];
9
+ this.errorInfo = errorInfo;
10
+ this.name = 'Database Exception'; // good practice
11
+ this.code = code; // error code for responding to client
12
+ Error.captureStackTrace(this);
13
+ }
14
+ }
15
+ exports.Exception = Exception;
@@ -0,0 +1,20 @@
1
+ export { Logs } from "./Logs";
2
+ export { BaseError } from "./BaseError";
3
+ export { ActionFilter } from "./ActionFilter";
4
+ export { Behavior } from "./Behavior";
5
+ export { Component } from "./Component";
6
+ export { Configurable } from "./Configurable";
7
+ export { CWebController } from "./CWebController";
8
+ export { DbConnection } from "./DbConnection";
9
+ export { ForbiddenHttpException } from "./ForbiddenHttpException";
10
+ export { InvalidConfigException } from "./InvalidConfigException";
11
+ export { InvalidArgumentException } from "./InvalidArgumentException";
12
+ export { NotFoundHttpException } from "./NotFoundHttpException";
13
+ export { UnauthorizedHttpException } from "./UnauthorizedHttpException";
14
+ export { DataErrorDbException } from "./DataErrorDbException";
15
+ export { ValidationHttpException } from "./ValidationHttpException";
16
+ export { Model, Relation, DataTypes, NOW } from "./Model";
17
+ export { RestClient } from "./RestClient";
18
+ export { ModelManager } from "./ModelManager";
19
+ export { CEvents } from "./CEvents";
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAC,MAAM,SAAS,CAAA;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CEvents = exports.ModelManager = exports.RestClient = exports.NOW = exports.DataTypes = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.ActionFilter = exports.BaseError = exports.Logs = void 0;
4
+ var Logs_1 = require("./Logs");
5
+ Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return Logs_1.Logs; } });
6
+ var BaseError_1 = require("./BaseError");
7
+ Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return BaseError_1.BaseError; } });
8
+ var ActionFilter_1 = require("./ActionFilter");
9
+ Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return ActionFilter_1.ActionFilter; } });
10
+ var Behavior_1 = require("./Behavior");
11
+ Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return Behavior_1.Behavior; } });
12
+ var Component_1 = require("./Component");
13
+ Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return Component_1.Component; } });
14
+ var CWebController_1 = require("./CWebController");
15
+ Object.defineProperty(exports, "CWebController", { enumerable: true, get: function () { return CWebController_1.CWebController; } });
16
+ var DbConnection_1 = require("./DbConnection");
17
+ Object.defineProperty(exports, "DbConnection", { enumerable: true, get: function () { return DbConnection_1.DbConnection; } });
18
+ var ForbiddenHttpException_1 = require("./ForbiddenHttpException");
19
+ Object.defineProperty(exports, "ForbiddenHttpException", { enumerable: true, get: function () { return ForbiddenHttpException_1.ForbiddenHttpException; } });
20
+ var InvalidConfigException_1 = require("./InvalidConfigException");
21
+ Object.defineProperty(exports, "InvalidConfigException", { enumerable: true, get: function () { return InvalidConfigException_1.InvalidConfigException; } });
22
+ var InvalidArgumentException_1 = require("./InvalidArgumentException");
23
+ Object.defineProperty(exports, "InvalidArgumentException", { enumerable: true, get: function () { return InvalidArgumentException_1.InvalidArgumentException; } });
24
+ var NotFoundHttpException_1 = require("./NotFoundHttpException");
25
+ Object.defineProperty(exports, "NotFoundHttpException", { enumerable: true, get: function () { return NotFoundHttpException_1.NotFoundHttpException; } });
26
+ var UnauthorizedHttpException_1 = require("./UnauthorizedHttpException");
27
+ Object.defineProperty(exports, "UnauthorizedHttpException", { enumerable: true, get: function () { return UnauthorizedHttpException_1.UnauthorizedHttpException; } });
28
+ var DataErrorDbException_1 = require("./DataErrorDbException");
29
+ Object.defineProperty(exports, "DataErrorDbException", { enumerable: true, get: function () { return DataErrorDbException_1.DataErrorDbException; } });
30
+ var ValidationHttpException_1 = require("./ValidationHttpException");
31
+ Object.defineProperty(exports, "ValidationHttpException", { enumerable: true, get: function () { return ValidationHttpException_1.ValidationHttpException; } });
32
+ var Model_1 = require("./Model");
33
+ Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return Model_1.Model; } });
34
+ Object.defineProperty(exports, "DataTypes", { enumerable: true, get: function () { return Model_1.DataTypes; } });
35
+ Object.defineProperty(exports, "NOW", { enumerable: true, get: function () { return Model_1.NOW; } });
36
+ var RestClient_1 = require("./RestClient");
37
+ Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return RestClient_1.RestClient; } });
38
+ var ModelManager_1 = require("./ModelManager");
39
+ Object.defineProperty(exports, "ModelManager", { enumerable: true, get: function () { return ModelManager_1.ModelManager; } });
40
+ var CEvents_1 = require("./CEvents");
41
+ Object.defineProperty(exports, "CEvents", { enumerable: true, get: function () { return CEvents_1.CEvents; } });
@@ -0,0 +1,4 @@
1
+ import "reflect-metadata";
2
+ import { RequestHandler } from "express";
3
+ export declare function Middleware(middlewares: RequestHandler[]): Function;
4
+ //# sourceMappingURL=Middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Middleware.d.ts","sourceRoot":"","sources":["../../src/decorator/Middleware.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,UAAU,CAAC,WAAW,EAAE,cAAc,EAAE,GAAG,QAAQ,CAIlE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Middleware = Middleware;
4
+ require("reflect-metadata");
5
+ const ControllerDecoratorParams_1 = require("./enums/ControllerDecoratorParams");
6
+ function Middleware(middlewares) {
7
+ return function (target, propertyKey) {
8
+ Reflect.defineMetadata(ControllerDecoratorParams_1.ControllerDecoratorParams.Middleware, middlewares, target, propertyKey);
9
+ };
10
+ }
@@ -0,0 +1,3 @@
1
+ import "reflect-metadata";
2
+ export declare const controller: (prefix?: string) => ClassDecorator;
3
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/decorator/controller.ts"],"names":[],"mappings":"AAQA,OAAQ,kBAAkB,CAAC;AAC3B,eAAO,MAAM,UAAU,GAAI,SAAQ,MAAW,KAAG,cAYhD,CAAC"}
@@ -1,22 +1,24 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.controller = void 0;
8
10
  // @ts-ignore
9
- import "reflect-metadata";
10
- export const controller = (prefix: string = ''): ClassDecorator => {
11
- return (target: any) => {
11
+ require("reflect-metadata");
12
+ const controller = (prefix = '') => {
13
+ return (target) => {
12
14
  // @ts-ignore
13
15
  Reflect.defineMetadata('prefix', prefix, target);
14
-
15
16
  // Since routes are set by our methods this should almost never be true (except the controller has no methods)
16
17
  // @ts-ignore
17
- if (! Reflect.hasMetadata('routes', target)) {
18
+ if (!Reflect.hasMetadata('routes', target)) {
18
19
  // @ts-ignore
19
20
  Reflect.defineMetadata('routes', [], target);
20
21
  }
21
22
  };
22
- };
23
+ };
24
+ exports.controller = controller;
@@ -0,0 +1,3 @@
1
+ import "reflect-metadata";
2
+ export declare const del: (path: string) => MethodDecorator;
3
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/decorator/delete.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,eAyBlC,CAAC"}
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.del = void 0;
1
4
  /*
2
5
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
6
  * Author: Cihan Ozturk
@@ -5,13 +8,11 @@
5
8
  * Github:https://github.com/cihan53/
6
9
  */
7
10
  // @ts-ignore
8
- import "reflect-metadata";
9
- import {RouteDefinition} from '../model/RouteDefinition';
10
-
11
- export const del = (path: string): MethodDecorator => {
11
+ require("reflect-metadata");
12
+ const del = (path) => {
12
13
  // `target` equals our class, `propertyKey` equals our decorated method name
13
14
  // @ts-ignore
14
- return (target, propertyKey: string): void => {
15
+ return (target, propertyKey) => {
15
16
  // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
16
17
  // To prevent any further validation simply set it to an empty array here.
17
18
  // @ts-ignore
@@ -19,13 +20,11 @@ export const del = (path: string): MethodDecorator => {
19
20
  // @ts-ignore
20
21
  Reflect.defineMetadata('routes', [], target.constructor);
21
22
  }
22
-
23
23
  // Get the routes stored so far, extend it by the new route and re-set the metadata.
24
24
  // @ts-ignore
25
- const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
26
-
25
+ const routes = Reflect.getMetadata('routes', target.constructor);
27
26
  routes.push({
28
- id:"",
27
+ id: "",
29
28
  requestMethod: 'delete',
30
29
  path,
31
30
  methodName: propertyKey
@@ -34,3 +33,4 @@ export const del = (path: string): MethodDecorator => {
34
33
  Reflect.defineMetadata('routes', routes, target.constructor);
35
34
  };
36
35
  };
36
+ exports.del = del;
@@ -0,0 +1,6 @@
1
+ export declare enum ControllerDecoratorParams {
2
+ Path = "path",
3
+ Method = "method",
4
+ Middleware = "middleware"
5
+ }
6
+ //# sourceMappingURL=ControllerDecoratorParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControllerDecoratorParams.d.ts","sourceRoot":"","sources":["../../../src/decorator/enums/ControllerDecoratorParams.ts"],"names":[],"mappings":"AAAA,oBAAY,yBAAyB;IACjC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,UAAU,eAAe;CAC5B"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ControllerDecoratorParams = void 0;
4
+ var ControllerDecoratorParams;
5
+ (function (ControllerDecoratorParams) {
6
+ ControllerDecoratorParams["Path"] = "path";
7
+ ControllerDecoratorParams["Method"] = "method";
8
+ ControllerDecoratorParams["Middleware"] = "middleware";
9
+ })(ControllerDecoratorParams || (exports.ControllerDecoratorParams = ControllerDecoratorParams = {}));
@@ -0,0 +1,3 @@
1
+ import "reflect-metadata";
2
+ export declare const get: (path: string) => MethodDecorator;
3
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/decorator/get.ts"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;AAG1B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,eA0BlC,CAAC"}
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.get = void 0;
1
4
  /*
2
5
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
6
  * Author: Cihan Ozturk
@@ -5,13 +8,11 @@
5
8
  * Github:https://github.com/cihan53/
6
9
  */
7
10
  // @ts-ignore
8
- import "reflect-metadata";
9
- import {RouteDefinition} from '../model/RouteDefinition';
10
-
11
- export const get = (path: string): MethodDecorator => {
11
+ require("reflect-metadata");
12
+ const get = (path) => {
12
13
  // `target` equals our class, `propertyKey` equals our decorated method name
13
14
  // @ts-ignore
14
- return (target, propertyKey: string): void => {
15
+ return (target, propertyKey) => {
15
16
  // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
16
17
  // To prevent any further validation simply set it to an empty array here.
17
18
  // @ts-ignore
@@ -19,19 +20,17 @@ export const get = (path: string): MethodDecorator => {
19
20
  // @ts-ignore
20
21
  Reflect.defineMetadata('routes', [], target.constructor);
21
22
  }
22
-
23
23
  // Get the routes stored so far, extend it by the new route and re-set the metadata.
24
24
  // @ts-ignore
25
- const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
26
-
25
+ const routes = Reflect.getMetadata('routes', target.constructor);
27
26
  routes.push({
28
- id:"",
27
+ id: "",
29
28
  requestMethod: 'get',
30
29
  path,
31
30
  methodName: propertyKey
32
31
  });
33
-
34
32
  // @ts-ignore
35
33
  Reflect.defineMetadata('routes', routes, target.constructor);
36
34
  };
37
- };
35
+ };
36
+ exports.get = get;
@@ -0,0 +1,6 @@
1
+ export { controller } from "./controller";
2
+ export { get } from "./get";
3
+ export { post } from "./post";
4
+ export { put } from "./put";
5
+ export { del } from "./delete";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAA;AACzB,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAA"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.del = exports.put = exports.post = exports.get = exports.controller = void 0;
4
+ var controller_1 = require("./controller");
5
+ Object.defineProperty(exports, "controller", { enumerable: true, get: function () { return controller_1.controller; } });
6
+ var get_1 = require("./get");
7
+ Object.defineProperty(exports, "get", { enumerable: true, get: function () { return get_1.get; } });
8
+ var post_1 = require("./post");
9
+ Object.defineProperty(exports, "post", { enumerable: true, get: function () { return post_1.post; } });
10
+ var put_1 = require("./put");
11
+ Object.defineProperty(exports, "put", { enumerable: true, get: function () { return put_1.put; } });
12
+ var delete_1 = require("./delete");
13
+ Object.defineProperty(exports, "del", { enumerable: true, get: function () { return delete_1.del; } });
@@ -0,0 +1,3 @@
1
+ import "reflect-metadata";
2
+ export declare const post: (path: string) => MethodDecorator;
3
+ //# sourceMappingURL=post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/decorator/post.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,eAyBnC,CAAC"}
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.post = void 0;
1
4
  /*
2
5
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
6
  * Author: Cihan Ozturk
@@ -5,13 +8,11 @@
5
8
  * Github:https://github.com/cihan53/
6
9
  */
7
10
  // @ts-ignore
8
- import "reflect-metadata";
9
- import {RouteDefinition} from '../model/RouteDefinition';
10
-
11
- export const post = (path: string): MethodDecorator => {
11
+ require("reflect-metadata");
12
+ const post = (path) => {
12
13
  // `target` equals our class, `propertyKey` equals our decorated method name
13
14
  // @ts-ignore
14
- return (target, propertyKey: string): void => {
15
+ return (target, propertyKey) => {
15
16
  // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
16
17
  // To prevent any further validation simply set it to an empty array here.
17
18
  // @ts-ignore
@@ -19,13 +20,11 @@ export const post = (path: string): MethodDecorator => {
19
20
  // @ts-ignore
20
21
  Reflect.defineMetadata('routes', [], target.constructor);
21
22
  }
22
-
23
23
  // Get the routes stored so far, extend it by the new route and re-set the metadata.
24
24
  // @ts-ignore
25
- const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
26
-
25
+ const routes = Reflect.getMetadata('routes', target.constructor);
27
26
  routes.push({
28
- id:"",
27
+ id: "",
29
28
  requestMethod: 'post',
30
29
  path,
31
30
  methodName: propertyKey
@@ -33,4 +32,5 @@ export const post = (path: string): MethodDecorator => {
33
32
  // @ts-ignore
34
33
  Reflect.defineMetadata('routes', routes, target.constructor);
35
34
  };
36
- };
35
+ };
36
+ exports.post = post;
@@ -0,0 +1,3 @@
1
+ import "reflect-metadata";
2
+ export declare const put: (path: string) => MethodDecorator;
3
+ //# sourceMappingURL=put.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put.d.ts","sourceRoot":"","sources":["../../src/decorator/put.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,eAyBlC,CAAC"}
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.put = void 0;
1
4
  /*
2
5
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
6
  * Author: Cihan Ozturk
@@ -5,13 +8,11 @@
5
8
  * Github:https://github.com/cihan53/
6
9
  */
7
10
  // @ts-ignore
8
- import "reflect-metadata";
9
- import {RouteDefinition} from '../model/RouteDefinition';
10
-
11
- export const put = (path: string): MethodDecorator => {
11
+ require("reflect-metadata");
12
+ const put = (path) => {
12
13
  // `target` equals our class, `propertyKey` equals our decorated method name
13
14
  // @ts-ignore
14
- return (target, propertyKey: string): void => {
15
+ return (target, propertyKey) => {
15
16
  // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
16
17
  // To prevent any further validation simply set it to an empty array here.
17
18
  // @ts-ignore
@@ -19,13 +20,11 @@ export const put = (path: string): MethodDecorator => {
19
20
  // @ts-ignore
20
21
  Reflect.defineMetadata('routes', [], target.constructor);
21
22
  }
22
-
23
23
  // Get the routes stored so far, extend it by the new route and re-set the metadata.
24
24
  // @ts-ignore
25
- const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
26
-
25
+ const routes = Reflect.getMetadata('routes', target.constructor);
27
26
  routes.push({
28
- id:"",
27
+ id: "",
29
28
  requestMethod: 'put',
30
29
  path,
31
30
  methodName: propertyKey
@@ -34,3 +33,4 @@ export const put = (path: string): MethodDecorator => {
34
33
  Reflect.defineMetadata('routes', routes, target.constructor);
35
34
  };
36
35
  };
36
+ exports.put = put;
@@ -0,0 +1,12 @@
1
+ import { Request, Response } from "../index";
2
+ import { ActionFilter } from "../base";
3
+ import { WebUser } from "../web/WebUser";
4
+ export declare class AccessControl extends ActionFilter {
5
+ user: any;
6
+ rules: any;
7
+ denyCallback: any;
8
+ init(): void;
9
+ beforeAction(action: any, request: Request, res: Response): Promise<boolean>;
10
+ denyAccess(user: WebUser): void;
11
+ }
12
+ //# sourceMappingURL=AccessControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessControl.d.ts","sourceRoot":"","sources":["../../src/filters/AccessControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAU,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AAErC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAIvC,qBAAa,aAAc,SAAQ,YAAY;IAEpC,IAAI,EAAE,GAAG,CAAQ;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,GAAG,CAAQ;IAEzB,IAAI;IAgBE,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,EAAC,QAAQ;IA+B7D,UAAU,CAAC,IAAI,EAAE,OAAO;CAMlC"}
@@ -0,0 +1,83 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AccessControl = void 0;
13
+ /*
14
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
15
+ * Author: Cihan Ozturk
16
+ * E-mail: cihan@chy.com.tr
17
+ * Github:https://github.com/cihan53/
18
+ */
19
+ const index_1 = require("../index");
20
+ const base_1 = require("../base");
21
+ const base_2 = require("../base");
22
+ const AccessRule_1 = require("./AccessRule");
23
+ const WebUser_1 = require("../web/WebUser");
24
+ const Utils_1 = require("../requiments/Utils");
25
+ class AccessControl extends base_2.ActionFilter {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.user = null;
29
+ this.denyCallback = null;
30
+ }
31
+ init() {
32
+ var _a;
33
+ super.init();
34
+ if (this.user == undefined) {
35
+ this.user = (_a = Utils_1.Utils.cloneDeep(index_1.BaseChyz.getComponent("user"))) !== null && _a !== void 0 ? _a : new WebUser_1.WebUser();
36
+ }
37
+ this.rules.forEach((rule, index) => {
38
+ if (rule === Object(rule)) {
39
+ this.rules[index] = Utils_1.Utils.createObject(new AccessRule_1.AccessRule(), rule);
40
+ }
41
+ });
42
+ }
43
+ beforeAction(action, request, res) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ var _a, _b;
46
+ let allow;
47
+ // @ts-ignore
48
+ let user = (_a = request.user) !== null && _a !== void 0 ? _a : this.user;
49
+ // @ts-ignore
50
+ user.identity = (_b = request.identity) !== null && _b !== void 0 ? _b : null;
51
+ for (const rulesKey in this.rules) {
52
+ let rule = this.rules[rulesKey];
53
+ if ((allow = yield rule.allows(action, user, request))) {
54
+ return true;
55
+ }
56
+ else if (allow === false) {
57
+ if (this.denyCallback != null) {
58
+ rule.denyCallback.apply(rule, action);
59
+ }
60
+ else {
61
+ this.denyAccess(user);
62
+ }
63
+ return false;
64
+ }
65
+ }
66
+ if (this.denyCallback != null) {
67
+ this.denyCallback.apply(null, action);
68
+ }
69
+ else {
70
+ this.denyAccess(user);
71
+ }
72
+ return false;
73
+ });
74
+ }
75
+ denyAccess(user) {
76
+ if (user != undefined && user.getIsGuest()) {
77
+ user.loginRequired();
78
+ }
79
+ else
80
+ throw new base_1.ForbiddenHttpException(index_1.BaseChyz.t('You are not allowed to perform this action.'));
81
+ }
82
+ }
83
+ exports.AccessControl = AccessControl;