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,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"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DbConnection = void 0;
16
+ /*
17
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
18
+ * Author: Cihan Ozturk
19
+ * E-mail: cihan@chy.com.tr
20
+ * Github:https://github.com/cihan53/
21
+ */
22
+ // @ts-ignore
23
+ const { Sequelize } = require("sequelize");
24
+ const Component_1 = require("./Component");
25
+ const BaseChyz_1 = __importDefault(require("../BaseChyz"));
26
+ // const sequelizeCache = require('sequelize-transparent-cache')
27
+ class DbConnection extends Component_1.Component {
28
+ init() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const sequelize = new Sequelize(this.database, this.username, this.password, this.options);
31
+ this._db = sequelize;
32
+ sequelize
33
+ .authenticate()
34
+ .then(() => {
35
+ BaseChyz_1.default.info('Connection has been established successfully.');
36
+ })
37
+ .catch((err) => {
38
+ BaseChyz_1.default.error('Unable to connect to the database:', err);
39
+ });
40
+ // await this.connect();
41
+ });
42
+ }
43
+ get db() {
44
+ return this._db;
45
+ }
46
+ set db(value) {
47
+ this._db = value;
48
+ }
49
+ transaction() {
50
+ return this.db.transaction();
51
+ }
52
+ }
53
+ exports.DbConnection = DbConnection;
@@ -0,0 +1,5 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class ForbiddenHttpException extends BaseError {
3
+ constructor(message: any);
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,GAAG;CAG7B"}
@@ -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.ForbiddenHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class ForbiddenHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 403);
14
+ }
15
+ }
16
+ exports.ForbiddenHttpException = ForbiddenHttpException;
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class InvalidArgumentException extends BaseError {
3
+ message: any;
4
+ constructor(message: any);
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,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.InvalidArgumentException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class InvalidArgumentException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 500);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.InvalidArgumentException = InvalidArgumentException;
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class InvalidConfigException extends BaseError {
3
+ message: any;
4
+ constructor(message: any);
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,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.InvalidConfigException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class InvalidConfigException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 500);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.InvalidConfigException = InvalidConfigException;
@@ -0,0 +1,22 @@
1
+ import { Configurable } from "./Configurable";
2
+ export declare class Logs implements Configurable {
3
+ name: string;
4
+ configs: any;
5
+ constructor(name?: string, configs?: any);
6
+ init(): void;
7
+ /**
8
+ *
9
+ * @constructor
10
+ */
11
+ Provider(): any;
12
+ logs(...args: any[]): any;
13
+ debug(...args: any[]): void;
14
+ info(...args: any[]): void;
15
+ warn(...args: any[]): void;
16
+ error(...args: any[]): void;
17
+ fatal(...args: any[]): void;
18
+ warning(...args: any[]): void;
19
+ }
20
+ declare const _default: Logs;
21
+ export default _default;
22
+ //# sourceMappingURL=Logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logs.d.ts","sourceRoot":"","sources":["../../src/base/Logs.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAK5C,qBAAa,IAAK,YAAW,YAAY;IAE9B,IAAI,SAAyB;IAC7B,OAAO,EAAE,GAAG,CAA6C;gBAGpD,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IA6BxC,IAAI;IAIJ;;;OAGG;IACI,QAAQ;IAIR,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIhC;;AAED,wBAA0B"}
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /*
2
3
  *
3
4
  * Copyright (c) 2022.. Chy Bilgisayar Bilisim
@@ -6,26 +7,19 @@
6
7
  * Github:https://github.com/cihan53/
7
8
  *
8
9
  */
9
-
10
- import {Configurable} from "./Configurable";
11
- import {Utils} from "../requiments/Utils";
12
-
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.Logs = void 0;
13
12
  const log4js = require("log4js");
14
-
15
- export class Logs implements Configurable {
16
-
17
- public name = this.constructor.name;
18
- public configs: any = require('../log/config/log4js.json') ?? {}
19
-
20
-
21
- constructor(name?: string, configs?: any) {
13
+ class Logs {
14
+ constructor(name, configs) {
15
+ var _a;
16
+ this.name = this.constructor.name;
17
+ this.configs = (_a = require('../log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
22
18
  if (name)
23
19
  this.name = name;
24
-
25
20
  if (configs) {
26
21
  this.configs = configs;
27
22
  }
28
-
29
23
  // let _conf = Utils.clone(this.configs);
30
24
  // Object.keys(_conf.appenders).forEach(function (appender: string) {
31
25
  // let _base;
@@ -46,48 +40,37 @@ export class Logs implements Configurable {
46
40
  // });
47
41
  this.Provider().configure(this.configs);
48
42
  }
49
-
50
43
  init() {
51
44
  this.Provider().configure(this.configs);
52
45
  }
53
-
54
46
  /**
55
47
  *
56
48
  * @constructor
57
49
  */
58
- public Provider() {
50
+ Provider() {
59
51
  return log4js;
60
52
  }
61
-
62
- public logs(...args: any[]) {
53
+ logs(...args) {
63
54
  return log4js.getLogger(this.name);
64
55
  }
65
-
66
- public debug(...args: any[]) {
67
- this.logs().debug(...args)
56
+ debug(...args) {
57
+ this.logs().debug(...args);
68
58
  }
69
-
70
- public info(...args: any[]) {
71
- this.logs().info(...args)
59
+ info(...args) {
60
+ this.logs().info(...args);
72
61
  }
73
-
74
- public warn(...args: any[]) {
75
- this.logs().warn(...arguments)
62
+ warn(...args) {
63
+ this.logs().warn(...arguments);
76
64
  }
77
-
78
- public error(...args: any[]) {
79
- this.logs().error(...args)
65
+ error(...args) {
66
+ this.logs().error(...args);
80
67
  }
81
-
82
- public fatal(...args: any[]) {
83
- this.logs().fatal(...args)
68
+ fatal(...args) {
69
+ this.logs().fatal(...args);
84
70
  }
85
-
86
-
87
- public warning(...args: any[]) {
88
- this.logs().warn(...args)
71
+ warning(...args) {
72
+ this.logs().warn(...args);
89
73
  }
90
-
91
74
  }
92
-
93
- export default new Logs();
75
+ exports.Logs = Logs;
76
+ exports.default = new Logs();
@@ -0,0 +1,302 @@
1
+ import { Component } from "./Component";
2
+ import { Model as SModel } from "sequelize";
3
+ export { DataTypes, NOW } from "sequelize";
4
+ export interface Relation {
5
+ [key: string]: any;
6
+ type: "hasOne" | "hasMany" | "belongsToMany" | "belongsTo";
7
+ allowNull?: boolean;
8
+ sourceKey?: string;
9
+ model: SModel;
10
+ foreignKey: string;
11
+ name?: string;
12
+ through?: any;
13
+ as?: string;
14
+ on?: any;
15
+ scope?: any;
16
+ }
17
+ /**
18
+ * ValidateMe.init({
19
+ bar: {
20
+ type: Sequelize.STRING,
21
+ validate: {
22
+ is: ["^[a-z]+$",'i'], // will only allow letters
23
+ is: /^[a-z]+$/i, // same as the previous example using real RegExp
24
+ not: ["[a-z]",'i'], // will not allow letters
25
+ isEmail: true, // checks for email format (foo@bar.com)
26
+ isUrl: true, // checks for url format (http://foo.com)
27
+ isIP: true, // checks for IPv4 (129.89.23.1) or IPv6 format
28
+ isIPv4: true, // checks for IPv4 (129.89.23.1)
29
+ isIPv6: true, // checks for IPv6 format
30
+ isAlpha: true, // will only allow letters
31
+ isAlphanumeric: true, // will only allow alphanumeric characters, so "_abc" will fail
32
+ isNumeric: true, // will only allow numbers
33
+ isInt: true, // checks for valid integers
34
+ isFloat: true, // checks for valid floating point numbers
35
+ isDecimal: true, // checks for any numbers
36
+ isLowercase: true, // checks for lowercase
37
+ isUppercase: true, // checks for uppercase
38
+ notNull: true, // won't allow null
39
+ isNull: true, // only allows null
40
+ notEmpty: true, // don't allow empty strings
41
+ equals: 'specific value', // only allow a specific value
42
+ contains: 'foo', // force specific substrings
43
+ notIn: [['foo', 'bar']], // check the value is not one of these
44
+ isIn: [['foo', 'bar']], // check the value is one of these
45
+ notContains: 'bar', // don't allow specific substrings
46
+ len: [2,10], // only allow values with length between 2 and 10
47
+ isUUID: 4, // only allow uuids
48
+ isDate: true, // only allow date strings
49
+ isAfter: "2011-11-05", // only allow date strings after a specific date
50
+ isBefore: "2011-11-05", // only allow date strings before a specific date
51
+ max: 23, // only allow values <= 23
52
+ min: 23, // only allow values >= 23
53
+ isCreditCard: true, // check for valid credit card numbers
54
+
55
+ // Examples of custom validators:
56
+ isEven(value) {
57
+ if (parseInt(value) % 2 !== 0) {
58
+ throw new Error('Only even values are allowed!');
59
+ }
60
+ }
61
+ isGreaterThanOtherField(value) {
62
+ if (parseInt(value) <= parseInt(this.otherField)) {
63
+ throw new Error('Bar must be greater than otherField.');
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }, { sequelize });
69
+ */
70
+ export declare class Model extends Component {
71
+ _provider: any;
72
+ _register: any;
73
+ private readonly _tableName;
74
+ private _model;
75
+ private _attributes;
76
+ private _errors;
77
+ constructor(sequelize?: IDBDatabase);
78
+ /**
79
+ * Returns the database connection used by this AR class.
80
+ * By default, the "db" application component is used as the database connection.
81
+ * You may override this method if you want to use a different database connection.
82
+ * @return Connection the database connection used by this AR class.
83
+ */
84
+ getDb(): any;
85
+ getDbConnection(): any;
86
+ get provider(): any;
87
+ set provider(value: any);
88
+ /**
89
+ *
90
+ */
91
+ get errors(): any;
92
+ set errors(value: any);
93
+ init(): void;
94
+ alias(): string;
95
+ tableName(): string;
96
+ formName(): string;
97
+ rules(): never[];
98
+ setModel(value: any): void;
99
+ model(): any;
100
+ save(params?: {}, options?: {}): Promise<any>;
101
+ bulkCreate(params?: {}, options?: {}): Promise<any>;
102
+ update(params?: {}, options?: {}): any;
103
+ delete(params?: {}, options?: {}): any;
104
+ /**
105
+ * As there are often use cases in which it is just easier to execute raw / already prepared SQL queries, you can use the sequelize.query method.
106
+ *
107
+ * By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc). Note that since this is a raw query, the metadata are dialect specific. Some dialects return the metadata "within" the results object (as properties on an array). However, two arguments will always be returned, but for MSSQL and MySQL it will be two references to the same object.
108
+ *
109
+ * const [results, metadata] = await sequelize.query("UPDATE users SET y = 42 WHERE x = 12");
110
+ * // Results will be an empty array and metadata will contain the number of affected rows.
111
+ *
112
+ * In cases where you don't need to access the metadata you can pass in a query type to tell sequelize how to format the results. For example, for a simple select query you could do:
113
+ *
114
+ * const { QueryTypes } = require('@sequelize/core');
115
+ * const users = await sequelize.query("SELECT * FROM `users`", { type: QueryTypes.SELECT });
116
+ * // We didn't need to destructure the result here - the results were returned directly
117
+ *
118
+ * Several other query types are available. Peek into the source for details.
119
+ *
120
+ * A second option is the model. If you pass a model the returned data will be instances of that model.
121
+ *
122
+ * // Callee is the model definition. This allows you to easily map a query to a predefined model
123
+ * const projects = await sequelize.query('SELECT * FROM projects', {
124
+ * model: Projects,
125
+ * mapToModel: true // pass true here if you have any mapped fields
126
+ * });
127
+ * // Each element of `projects` is now an instance of Project
128
+ *
129
+ * See more options in the query API reference. Some examples:
130
+ * ``
131
+ * const { QueryTypes } = require('@sequelize/core');
132
+ * await sequelize.query('SELECT 1', {
133
+ * // A function (or false) for logging your queries
134
+ * // Will get called for every SQL query that gets sent
135
+ * // to the server.
136
+ * logging: console.log,
137
+ *
138
+ * // If plain is true, then sequelize will only return the first
139
+ * // record of the result set. In case of false it will return all records.
140
+ * plain: false,
141
+ *
142
+ * // Set this to true if you don't have a model definition for your query.
143
+ * raw: false,
144
+ *
145
+ * // The type of query you are executing. The query type affects how results are formatted before they are passed back.
146
+ * type: QueryTypes.SELECT
147
+ * });
148
+ *``
149
+ * // Note the second argument being null!
150
+ * // Even if we declared a callee here, the raw: true would
151
+ * // supersede and return a raw object.
152
+ * console.log(await sequelize.query('SELECT * FROM projects', { raw: true }));
153
+ *
154
+ * ##"Dotted" attributes and the nest option
155
+ *
156
+ * If an attribute name of the table contains dots, the resulting objects can become nested objects by setting the nest: true option. This is achieved with dottie.js under the hood. See below:
157
+ *
158
+ * Without nest: true:
159
+ * ``
160
+ * const { QueryTypes } = require('@sequelize/core');
161
+ * const records = await sequelize.query('select 1 as `foo.bar.baz`', {
162
+ * type: QueryTypes.SELECT
163
+ * });
164
+ * console.log(JSON.stringify(records[0], null, 2));
165
+ *
166
+ * {
167
+ * "foo.bar.baz": 1
168
+ * }
169
+ *
170
+ * With nest: true:
171
+ *
172
+ * const { QueryTypes } = require('@sequelize/core');
173
+ * const records = await sequelize.query('select 1 as `foo.bar.baz`', {
174
+ * nest: true,
175
+ * type: QueryTypes.SELECT
176
+ * });
177
+ * console.log(JSON.stringify(records[0], null, 2));
178
+ *
179
+ * {
180
+ * "foo": {
181
+ * "bar": {
182
+ * "baz": 1
183
+ * }
184
+ * }
185
+ * }
186
+ * ``
187
+ * ##Replacements
188
+ *
189
+ * Replacements in a query can be done in two different ways, either using named parameters (starting with :), or unnamed, represented by a ?. Replacements are passed in the options object.
190
+ *
191
+ * If an array is passed, ? will be replaced in the order that they appear in the array
192
+ * If an object is passed, :key will be replaced with the keys from that object. If the object contains keys not found in the query or vice versa, an exception will be thrown.
193
+ * ``
194
+ * const { QueryTypes } = require('@sequelize/core');
195
+ *
196
+ * await sequelize.query(
197
+ * 'SELECT * FROM projects WHERE status = ?',
198
+ * {
199
+ * replacements: ['active'],
200
+ * type: QueryTypes.SELECT
201
+ * }
202
+ * );
203
+ *
204
+ * await sequelize.query(
205
+ * 'SELECT * FROM projects WHERE status = :status',
206
+ * {
207
+ * replacements: { status: 'active' },
208
+ * type: QueryTypes.SELECT
209
+ * }
210
+ * );
211
+ * ``
212
+ * Array replacements will automatically be handled, the following query searches for projects where the status matches an array of values.
213
+ * ``
214
+ * const { QueryTypes } = require('@sequelize/core');
215
+ *
216
+ * await sequelize.query(
217
+ * 'SELECT * FROM projects WHERE status IN(:status)',
218
+ * {
219
+ * replacements: { status: ['active', 'inactive'] },
220
+ * type: QueryTypes.SELECT
221
+ * }
222
+ * );
223
+ * ``
224
+ * To use the wildcard operator %, append it to your replacement. The following query matches users with names that start with 'ben'.
225
+ * ``
226
+ * const { QueryTypes } = require('@sequelize/core');
227
+ *
228
+ * await sequelize.query(
229
+ * 'SELECT * FROM users WHERE name LIKE :search_name',
230
+ * {
231
+ * replacements: { search_name: 'ben%' },
232
+ * type: QueryTypes.SELECT
233
+ * }
234
+ * ); ``
235
+ *
236
+ * ##Bind Parameter
237
+ *
238
+ * Bind parameters are like replacements. Except replacements are escaped and inserted into the query by sequelize before the query is sent to the database, while bind parameters are sent to the database outside the SQL query text. A query can have either bind parameters or replacements. Bind parameters are referred to by either $1, $2, ... (numeric) or $key (alpha-numeric). This is independent of the dialect.
239
+ *
240
+ * If an array is passed, $1 is bound to the 1st element in the array (bind[0])
241
+ * If an object is passed, $key is bound to object['key']. Each key must begin with a non-numeric char. $1 is not a valid key, even if object['1'] exists.
242
+ * In either case $$ can be used to escape a literal $ sign.
243
+ *
244
+ * The array or object must contain all bound values or Sequelize will throw an exception. This applies even to cases in which the database may ignore the bound parameter.
245
+ *
246
+ * The database may add further restrictions to this. Bind parameters cannot be SQL keywords, nor table or column names. They are also ignored in quoted text or data. In PostgreSQL it may also be needed to typecast them, if the type cannot be inferred from the context $1::varchar.
247
+ *``
248
+ * const { QueryTypes } = require('@sequelize/core');
249
+ *
250
+ * await sequelize.query(
251
+ * 'SELECT *, "text with literal $$1 and literal $$status" as t FROM projects WHERE status = $1',
252
+ * {
253
+ * bind: ['active'],
254
+ * type: QueryTypes.SELECT
255
+ * }
256
+ * ); ``
257
+ *
258
+ * `` await sequelize.query(
259
+ * 'SELECT *, "text with literal $$1 and literal $$status" as t FROM projects WHERE status = $status',
260
+ * {
261
+ * bind: { status: 'active' },
262
+ * type: QueryTypes.SELECT
263
+ * }
264
+ * );``
265
+ * @param query
266
+ * @param options
267
+ */
268
+ rawQuery(query: string, options?: any): Promise<any>;
269
+ /**
270
+ *
271
+ * @param args
272
+ */
273
+ findOne(...args: any[]): any;
274
+ /**
275
+ *
276
+ * @param args
277
+ */
278
+ findAll(...args: any[]): any;
279
+ /**
280
+ * return {count : number , rows: any}
281
+ * @param args
282
+ */
283
+ findAndCountAll(...args: any[]): any;
284
+ validate(): void;
285
+ /**
286
+ *
287
+ * @param data
288
+ * @param formName
289
+ */
290
+ load(data: any, formName?: any): boolean;
291
+ bulkLoad(data: any, formName?: any): boolean;
292
+ setAttribute(values: any, safeOnly?: boolean): void;
293
+ attributes(): {};
294
+ /**
295
+ * relation return array
296
+ * [
297
+ *
298
+ * ]
299
+ */
300
+ relations(): Relation[];
301
+ }
302
+ //# sourceMappingURL=Model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../src/base/Model.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAIH,KAAK,IAAI,MAAM,EAQlB,MAAM,WAAW,CAAC;AAInB,OAAO,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AAGzC,MAAM,WAAW,QAAQ;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,eAAe,GAAG,WAAW,CAAC;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,GAAG,CAAA;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,qBAAa,KAAM,SAAQ,SAAS;IAChC,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,OAAO,CAAU;gBAGb,SAAS,CAAC,EAAE,WAAW;IAmEnC;;;;;OAKG;IACI,KAAK;IAIL,eAAe;IAItB,IAAI,QAAQ,IAAI,GAAG,CAElB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,EAEtB;IAGD;;OAEG;IACH,IAAI,MAAM,IAAI,GAAG,CAEhB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,EAEpB;IAEM,IAAI;IAqCJ,KAAK;IAIL,SAAS;IAIT,QAAQ;IAIR,KAAK;IAKL,QAAQ,CAAC,KAAK,EAAE,GAAG;IAInB,KAAK;IAKC,IAAI,CAAC,MAAM,KAAK,EAAE,OAAO,KAAK;IAoC9B,UAAU,CAAC,MAAM,KAAK,EAAE,OAAO,KAAK;IAmC1C,MAAM,CAAC,MAAM,KAAK,EAAE,OAAO,KAAK;IAMhC,MAAM,CAAC,MAAM,KAAK,EAAE,OAAO,KAAK;IAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmKG;IACU,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,GAA2C;IAMzF;;;OAGG;IACI,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAI7B;;;OAGG;IACI,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAI7B;;;OAGG;IACI,eAAe,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAK9B,QAAQ;IAIf;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAE,GAAU;IAYpC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAE,GAAU;IAYxC,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,UAAO;IAazC,UAAU;IAIjB;;;;;OAKG;IACI,SAAS,IAAI,QAAQ,EAAE;CAKjC"}