chyz 2.0.0-rc.4 → 2.0.0-rc.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/BaseChyz.d.ts +62 -60
  2. package/BaseChyz.d.ts.map +1 -1
  3. package/BaseChyz.js +507 -379
  4. package/base/ActionFilter.d.ts +32 -32
  5. package/base/ActionFilter.d.ts.map +1 -1
  6. package/base/ActionFilter.js +82 -85
  7. package/base/BadRequestHttpException.d.ts +6 -0
  8. package/base/BadRequestHttpException.d.ts.map +1 -0
  9. package/base/BadRequestHttpException.js +17 -0
  10. package/base/BaseError.d.ts +33 -10
  11. package/base/BaseError.d.ts.map +1 -1
  12. package/base/BaseError.js +48 -29
  13. package/base/Behavior.d.ts +3 -3
  14. package/base/Behavior.js +7 -7
  15. package/base/CBaseObject.d.ts +4 -4
  16. package/base/CBaseObject.d.ts.map +1 -1
  17. package/base/CBaseObject.js +16 -16
  18. package/base/CEvents.d.ts +13 -0
  19. package/base/CEvents.d.ts.map +1 -0
  20. package/base/CEvents.js +24 -0
  21. package/base/CRequest.d.ts +2 -0
  22. package/base/CRequest.d.ts.map +1 -0
  23. package/base/CRequest.js +10 -0
  24. package/base/CWebController.d.ts +43 -43
  25. package/base/CWebController.d.ts.map +1 -1
  26. package/base/CWebController.js +81 -74
  27. package/base/Component.d.ts +20 -20
  28. package/base/Component.d.ts.map +1 -1
  29. package/base/Component.js +57 -60
  30. package/base/Configurable.d.ts +2 -2
  31. package/base/Configurable.js +8 -8
  32. package/base/DataErrorDbException.d.ts +5 -5
  33. package/base/DataErrorDbException.d.ts.map +1 -1
  34. package/base/DataErrorDbException.js +17 -17
  35. package/base/DbConnection.d.ts +12 -12
  36. package/base/DbConnection.js +53 -53
  37. package/base/ForbiddenHttpException.d.ts +4 -4
  38. package/base/ForbiddenHttpException.d.ts.map +1 -1
  39. package/base/ForbiddenHttpException.js +16 -16
  40. package/base/InvalidArgumentException.d.ts +5 -5
  41. package/base/InvalidArgumentException.d.ts.map +1 -1
  42. package/base/InvalidArgumentException.js +17 -17
  43. package/base/InvalidConfigException.d.ts +5 -5
  44. package/base/InvalidConfigException.d.ts.map +1 -1
  45. package/base/InvalidConfigException.js +17 -17
  46. package/base/Logs.d.ts +22 -0
  47. package/base/Logs.d.ts.map +1 -0
  48. package/base/Logs.js +57 -0
  49. package/base/Model.d.ts +301 -298
  50. package/base/Model.d.ts.map +1 -1
  51. package/base/Model.js +538 -507
  52. package/base/ModelManager.d.ts +1 -1
  53. package/base/ModelManager.js +19 -19
  54. package/base/NotFoundHttpException.d.ts +5 -5
  55. package/base/NotFoundHttpException.d.ts.map +1 -1
  56. package/base/NotFoundHttpException.js +17 -17
  57. package/base/RestClient.d.ts +6 -8
  58. package/base/RestClient.d.ts.map +1 -1
  59. package/base/RestClient.js +25 -26
  60. package/base/UnauthorizedHttpException.d.ts +5 -5
  61. package/base/UnauthorizedHttpException.d.ts.map +1 -1
  62. package/base/UnauthorizedHttpException.js +17 -17
  63. package/base/ValidationHttpException.d.ts +5 -5
  64. package/base/ValidationHttpException.d.ts.map +1 -1
  65. package/base/ValidationHttpException.js +17 -17
  66. package/base/db/Exception.d.ts +6 -6
  67. package/base/db/Exception.js +15 -15
  68. package/base/index.d.ts +19 -17
  69. package/base/index.d.ts.map +1 -1
  70. package/base/index.js +41 -37
  71. package/decorator/Middleware.d.ts +3 -3
  72. package/decorator/Middleware.js +11 -11
  73. package/decorator/controller.d.ts +2 -2
  74. package/decorator/controller.js +24 -24
  75. package/decorator/delete.d.ts +3 -0
  76. package/decorator/delete.d.ts.map +1 -0
  77. package/decorator/delete.js +36 -0
  78. package/decorator/enums/ControllerDecoratorParams.d.ts +5 -5
  79. package/decorator/enums/ControllerDecoratorParams.js +9 -9
  80. package/decorator/get.d.ts +2 -2
  81. package/decorator/get.js +36 -36
  82. package/decorator/index.d.ts +5 -3
  83. package/decorator/index.d.ts.map +1 -1
  84. package/decorator/index.js +13 -9
  85. package/decorator/post.d.ts +2 -2
  86. package/decorator/post.js +36 -36
  87. package/decorator/put.d.ts +3 -0
  88. package/decorator/put.d.ts.map +1 -0
  89. package/decorator/put.js +36 -0
  90. package/filters/AccessControl.d.ts +12 -12
  91. package/filters/AccessControl.d.ts.map +1 -1
  92. package/filters/AccessControl.js +83 -86
  93. package/filters/AccessRule.d.ts +82 -82
  94. package/filters/AccessRule.d.ts.map +1 -1
  95. package/filters/AccessRule.js +136 -140
  96. package/filters/auth/AuthInterface.d.ts +25 -25
  97. package/filters/auth/AuthInterface.js +2 -2
  98. package/filters/auth/AuthMethod.d.ts +37 -37
  99. package/filters/auth/AuthMethod.js +82 -82
  100. package/filters/auth/HttpBasicAuth.d.ts +23 -22
  101. package/filters/auth/HttpBasicAuth.d.ts.map +1 -1
  102. package/filters/auth/HttpBasicAuth.js +78 -72
  103. package/filters/auth/HttpBearerAuth.d.ts +17 -17
  104. package/filters/auth/HttpBearerAuth.js +32 -32
  105. package/filters/auth/HttpHeaderAuth.d.ts +14 -14
  106. package/filters/auth/HttpHeaderAuth.js +57 -60
  107. package/filters/auth/JwtHttpBearerAuth.d.ts +20 -20
  108. package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -1
  109. package/filters/auth/JwtHttpBearerAuth.js +87 -81
  110. package/filters/auth/KeyCloakHttpBearerAuth.d.ts +22 -22
  111. package/filters/auth/KeyCloakHttpBearerAuth.js +116 -116
  112. package/filters/auth/index.d.ts +4 -4
  113. package/filters/auth/index.js +11 -11
  114. package/filters/index.d.ts +2 -2
  115. package/filters/index.js +7 -7
  116. package/index.d.ts +27 -16
  117. package/index.d.ts.map +1 -1
  118. package/index.js +70 -71
  119. package/model/RouteDefinition.d.ts +6 -6
  120. package/model/RouteDefinition.js +8 -8
  121. package/package.json +22 -26
  122. package/rbac/AuthAssignment.d.ts +18 -18
  123. package/rbac/AuthAssignment.js +44 -44
  124. package/rbac/AuthItem.d.ts +26 -26
  125. package/rbac/AuthItem.js +51 -51
  126. package/rbac/AuthItemChild.d.ts +18 -18
  127. package/rbac/AuthItemChild.js +43 -43
  128. package/rbac/AuthManager.d.ts +111 -111
  129. package/rbac/AuthManager.d.ts.map +1 -1
  130. package/rbac/AuthManager.js +357 -358
  131. package/rbac/index.d.ts +5 -0
  132. package/rbac/index.d.ts.map +1 -0
  133. package/rbac/index.js +28 -0
  134. package/requiments/Glob.d.ts +2 -2
  135. package/requiments/Glob.js +10 -10
  136. package/requiments/ReflectUtil.js +24 -24
  137. package/requiments/Utils.d.ts +1 -2
  138. package/requiments/Utils.d.ts.map +1 -1
  139. package/requiments/Utils.js +115 -110
  140. package/validators/BooleanValidator.js +1 -1
  141. package/validators/CompareValidator.js +1 -1
  142. package/validators/DateValidator.js +1 -1
  143. package/validators/EmailValidator.js +1 -1
  144. package/validators/Validator.d.ts +17 -17
  145. package/validators/Validator.js +27 -27
  146. package/web/IdentityInterface.d.ts +55 -54
  147. package/web/IdentityInterface.d.ts.map +1 -1
  148. package/web/IdentityInterface.js +8 -8
  149. package/web/WebUser.d.ts +71 -71
  150. package/web/WebUser.js +165 -165
  151. package/base/Logger.d.ts +0 -18
  152. package/base/Logger.d.ts.map +0 -1
  153. package/base/Logger.js +0 -49
@@ -1,33 +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
- }
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
33
  //# sourceMappingURL=ActionFilter.d.ts.map
@@ -1 +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"}
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;CA2BjC"}
@@ -1,85 +1,82 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ActionFilter = void 0;
16
- const Utils_1 = __importDefault(require("../requiments/Utils"));
17
- const CBaseObject_1 = require("./CBaseObject");
18
- class ActionFilter extends CBaseObject_1.CBaseObject {
19
- constructor() {
20
- super(...arguments);
21
- /**
22
- * @var array list of action IDs that this filter should not apply to.
23
- * @see only
24
- */
25
- this.except = [];
26
- }
27
- init() {
28
- }
29
- /**
30
- *
31
- * @param route
32
- * @param req
33
- * @param res
34
- */
35
- beforeFilter(route, req, res) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- if (!this.isActive(route)) {
38
- return;
39
- }
40
- yield this.beforeAction(route, req, res);
41
- });
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
- */
59
- isActive(action) {
60
- let id = action.id;
61
- let onlyMatch = false;
62
- let exceptMatch = false;
63
- if (Utils_1.default.isEmpty(this.only)) {
64
- onlyMatch = true;
65
- }
66
- else {
67
- onlyMatch = false;
68
- for (const onlyKey of this.only) {
69
- if (Utils_1.default.matchWildcard(action.id, onlyKey)) {
70
- onlyMatch = true;
71
- break;
72
- }
73
- }
74
- }
75
- for (const exceptKey in this.except) {
76
- let pattern = this.except[exceptKey];
77
- let match = id.match(pattern);
78
- if (match && match.length > 0) {
79
- exceptMatch = true;
80
- }
81
- }
82
- return !exceptMatch && onlyMatch;
83
- }
84
- }
85
- exports.ActionFilter = ActionFilter;
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.ActionFilter = void 0;
13
+ const Utils_1 = require("../requiments/Utils");
14
+ const CBaseObject_1 = require("./CBaseObject");
15
+ class ActionFilter extends CBaseObject_1.CBaseObject {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * @var array list of action IDs that this filter should not apply to.
20
+ * @see only
21
+ */
22
+ this.except = [];
23
+ }
24
+ init() {
25
+ }
26
+ /**
27
+ *
28
+ * @param route
29
+ * @param req
30
+ * @param res
31
+ */
32
+ beforeFilter(route, req, res) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ if (!this.isActive(route)) {
35
+ return;
36
+ }
37
+ yield this.beforeAction(route, req, res);
38
+ });
39
+ }
40
+ /**
41
+ * This method is invoked right before an action is to be executed (after all possible filters.)
42
+ * You may override this method to do last-minute preparation for the action.
43
+ * @param Action $action the action to be executed.
44
+ * @return bool whether the action should continue to be executed.
45
+ */
46
+ beforeAction(route, req, res) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ return true;
49
+ });
50
+ }
51
+ /**
52
+ *
53
+ * @param action
54
+ * @protected
55
+ */
56
+ isActive(action) {
57
+ let id = action.id;
58
+ let onlyMatch = false;
59
+ let exceptMatch = false;
60
+ if (Utils_1.Utils.isEmpty(this.only)) {
61
+ onlyMatch = true;
62
+ }
63
+ else {
64
+ onlyMatch = false;
65
+ for (const onlyKey of this.only) {
66
+ if (Utils_1.Utils.matchWildcard(action.id, onlyKey)) {
67
+ onlyMatch = true;
68
+ break;
69
+ }
70
+ }
71
+ }
72
+ for (const exceptKey in this.except) {
73
+ let pattern = this.except[exceptKey];
74
+ let match = id.match(pattern);
75
+ if (match && match.length > 0) {
76
+ exceptMatch = true;
77
+ }
78
+ }
79
+ return !exceptMatch && onlyMatch;
80
+ }
81
+ }
82
+ exports.ActionFilter = ActionFilter;
@@ -0,0 +1,6 @@
1
+ import { BaseError } from "./BaseError";
2
+ export declare class BadRequestHttpException extends BaseError {
3
+ message: string;
4
+ constructor(message: string);
5
+ }
6
+ //# sourceMappingURL=BadRequestHttpException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BadRequestHttpException.d.ts","sourceRoot":"","sources":["../../src/base/BadRequestHttpException.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,uBAAwB,SAAQ,SAAS;IAC7B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
+ * Author: Cihan Ozturk
5
+ * E-mail: cihan@chy.com.tr
6
+ * Github:https://github.com/cihan53/
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.BadRequestHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class BadRequestHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message, 400);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.BadRequestHttpException = BadRequestHttpException;
@@ -1,11 +1,34 @@
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
- }
1
+ /**
2
+ * 10.4 Client Error 4xx ............................................65
3
+ * 10.4.1 400 Bad Request .........................................65
4
+ * 10.4.2 401 Unauthorized ........................................66
5
+ * 10.4.3 402 Payment Required ....................................66
6
+ * 10.4.4 403 Forbidden ...........................................66
7
+ * 10.4.5 404 Not Found ...........................................66
8
+ * 10.4.6 405 Method Not Allowed ..................................66
9
+ * 10.4.7 406 Not Acceptable ......................................67
10
+ * 10.4.8 407 Proxy Authentication Required .......................67
11
+ * 10.4.9 408 Request Timeout .....................................67
12
+ * 10.4.10 409 Conflict ............................................67
13
+ * 10.4.11 410 Gone ................................................68
14
+ * 10.4.12 411 Length Required .....................................68
15
+ * 10.4.13 412 Precondition Failed .................................68
16
+ * 10.4.14 413 Request Entity Too Large ............................69
17
+ * 10.4.15 414 Request-URI Too Long ................................69
18
+ * 10.4.16 415 Unsupported Media Type ..............................69
19
+ * 10.4.17 416 Requested Range Not Satisfiable .....................69
20
+ * 10.4.18 417 Expectation Failed ..................................70
21
+ */
22
+ export declare class BaseError extends Error {
23
+ statusCode: number;
24
+ private success;
25
+ constructor(message: any, statusCode?: number);
26
+ toString(): string;
27
+ toJSON(): {
28
+ success: boolean;
29
+ code: number;
30
+ name: string;
31
+ message: string;
32
+ };
33
+ }
11
34
  //# sourceMappingURL=BaseError.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,EAAE,GAAG,EAAE,UAAU,SAAM;IAS1C,QAAQ;IAIR,MAAM;;;;;;CAGT"}
package/base/BaseError.js CHANGED
@@ -1,29 +1,48 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
- * Author: Cihan Ozturk
5
- * E-mail: cihan@chy.com.tr
6
- * Github:https://github.com/cihan53/
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.BaseError = void 0;
13
- const Utils_1 = __importDefault(require("../requiments/Utils"));
14
- class BaseError extends Error {
15
- constructor(message, statusCode = 500) {
16
- super(message);
17
- this.message = Utils_1.default.isString(message) ? message : JSON.stringify(message);
18
- this.name = this.constructor.name; // good practice
19
- this.statusCode = statusCode; // error code for responding to client
20
- //Error.captureStackTrace(this)
21
- }
22
- toString() {
23
- return `${this.name}[${this.statusCode}] ${this.message}`;
24
- }
25
- toJSON() {
26
- return { code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name, message: this.message };
27
- }
28
- }
29
- exports.BaseError = BaseError;
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.BaseError = void 0;
10
+ const Utils_1 = require("../requiments/Utils");
11
+ /**
12
+ * 10.4 Client Error 4xx ............................................65
13
+ * 10.4.1 400 Bad Request .........................................65
14
+ * 10.4.2 401 Unauthorized ........................................66
15
+ * 10.4.3 402 Payment Required ....................................66
16
+ * 10.4.4 403 Forbidden ...........................................66
17
+ * 10.4.5 404 Not Found ...........................................66
18
+ * 10.4.6 405 Method Not Allowed ..................................66
19
+ * 10.4.7 406 Not Acceptable ......................................67
20
+ * 10.4.8 407 Proxy Authentication Required .......................67
21
+ * 10.4.9 408 Request Timeout .....................................67
22
+ * 10.4.10 409 Conflict ............................................67
23
+ * 10.4.11 410 Gone ................................................68
24
+ * 10.4.12 411 Length Required .....................................68
25
+ * 10.4.13 412 Precondition Failed .................................68
26
+ * 10.4.14 413 Request Entity Too Large ............................69
27
+ * 10.4.15 414 Request-URI Too Long ................................69
28
+ * 10.4.16 415 Unsupported Media Type ..............................69
29
+ * 10.4.17 416 Requested Range Not Satisfiable .....................69
30
+ * 10.4.18 417 Expectation Failed ..................................70
31
+ */
32
+ class BaseError extends Error {
33
+ constructor(message, statusCode = 500) {
34
+ super(message);
35
+ this.success = false;
36
+ this.message = Utils_1.Utils.isString(message) ? message : JSON.stringify(message);
37
+ this.name = this.constructor.name; // good practice
38
+ this.statusCode = statusCode; // error code for responding to client
39
+ //Error.captureStackTrace(this)
40
+ }
41
+ toString() {
42
+ return `${this.name}[${this.statusCode}] ${this.message}`;
43
+ }
44
+ toJSON() {
45
+ return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(), message: this.message.toString() };
46
+ }
47
+ }
48
+ exports.BaseError = BaseError;
@@ -1,4 +1,4 @@
1
- import { CBaseObject } from "./CBaseObject";
2
- export declare class Behavior extends CBaseObject {
3
- }
1
+ import { CBaseObject } from "./CBaseObject";
2
+ export declare class Behavior extends CBaseObject {
3
+ }
4
4
  //# sourceMappingURL=Behavior.d.ts.map
package/base/Behavior.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Behavior = void 0;
4
- const CBaseObject_1 = require("./CBaseObject");
5
- class Behavior extends CBaseObject_1.CBaseObject {
6
- }
7
- exports.Behavior = Behavior;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Behavior = void 0;
4
+ const CBaseObject_1 = require("./CBaseObject");
5
+ class Behavior extends CBaseObject_1.CBaseObject {
6
+ }
7
+ exports.Behavior = Behavior;
@@ -1,5 +1,5 @@
1
- import { Configurable } from "./Configurable";
2
- export declare class CBaseObject implements Configurable {
3
- init(): void;
4
- }
1
+ import { Configurable } from "./Configurable";
2
+ export declare class CBaseObject implements Configurable {
3
+ init(): void;
4
+ }
5
5
  //# sourceMappingURL=CBaseObject.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"CBaseObject.d.ts","sourceRoot":"","sources":["../../src/base/CBaseObject.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,qBAAa,WAAY,YAAW,YAAY;IAErC,IAAI;CAGd"}
@@ -1,16 +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;
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
+ * Author: Cihan Ozturk
5
+ * E-mail: cihan@chy.com.tr
6
+ * Github:https://github.com/cihan53/
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CBaseObject = void 0;
10
+ const index_1 = require("../index");
11
+ class CBaseObject {
12
+ init() {
13
+ index_1.BaseChyz.debug("BaseObject init.....");
14
+ }
15
+ }
16
+ exports.CBaseObject = CBaseObject;
@@ -0,0 +1,13 @@
1
+ export declare enum CEvents {
2
+ ON_INIT_BEFORE = "oninitbefore",
3
+ ON_INIT_AFTER = "oninitafter",
4
+ ON_MIDDLEWARE = "onmiddleware",
5
+ ON_BEFORE_START = "onbeforestart",
6
+ ON_AFTER_START = "onafterestart",
7
+ ON_START = "onstart",
8
+ ON_BEFORE_ACTION = "onbeferoaction",
9
+ ON_AFTER_ACTION = "onafteraction",
10
+ ON_DB_CONNECTION = "ondbconnection",
11
+ ON_DB_DISCONNECT = "ondbdisconnect"
12
+ }
13
+ //# sourceMappingURL=CEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CEvents.d.ts","sourceRoot":"","sources":["../../src/base/CEvents.ts"],"names":[],"mappings":"AAQA,oBAAY,OAAO;IACf,cAAc,iBAAe;IAC7B,aAAa,gBAAc;IAC3B,aAAa,iBAAe;IAC5B,eAAe,kBAAkB;IACjC,cAAc,kBAAkB;IAChC,QAAQ,YAAY;IAEpB,gBAAgB,mBAAmB;IACnC,eAAe,kBAAkB;IAEjC,gBAAgB,mBAAiB;IACjC,gBAAgB,mBAAiB;CAGpC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CEvents = void 0;
4
+ /*
5
+ *
6
+ * Copyright (c) 2023.. Chy Bilgisayar Bilisim
7
+ * Author: Cihan Ozturk
8
+ * E-mail: cihan@chy.com.tr
9
+ * Github:https://github.com/cihan53/
10
+ *
11
+ */
12
+ var CEvents;
13
+ (function (CEvents) {
14
+ CEvents["ON_INIT_BEFORE"] = "oninitbefore";
15
+ CEvents["ON_INIT_AFTER"] = "oninitafter";
16
+ CEvents["ON_MIDDLEWARE"] = "onmiddleware";
17
+ CEvents["ON_BEFORE_START"] = "onbeforestart";
18
+ CEvents["ON_AFTER_START"] = "onafterestart";
19
+ CEvents["ON_START"] = "onstart";
20
+ CEvents["ON_BEFORE_ACTION"] = "onbeferoaction";
21
+ CEvents["ON_AFTER_ACTION"] = "onafteraction";
22
+ CEvents["ON_DB_CONNECTION"] = "ondbconnection";
23
+ CEvents["ON_DB_DISCONNECT"] = "ondbdisconnect";
24
+ })(CEvents = exports.CEvents || (exports.CEvents = {}));
@@ -0,0 +1,2 @@
1
+ export { Request, Response, NextFunction } from "express";
2
+ //# sourceMappingURL=CRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CRequest.d.ts","sourceRoot":"","sources":["../../src/base/CRequest.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC"}
@@ -0,0 +1,10 @@
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 });
@@ -1,44 +1,44 @@
1
- import { Component } from "./Component";
2
- import { RouteDefinition } from "../model/RouteDefinition";
3
- import { Request, Response } from "express";
4
- export declare class CWebController extends Component {
5
- /**
6
- * @var string the ID of this controller.
7
- */
8
- id: string;
9
- defaultAction: string;
10
- constructor(config: any);
11
- init(): void;
12
- /**
13
- * This method is invoked right before an action is executed.
14
- * @param $action
15
- */
16
- beforeAction(route: RouteDefinition, req: Request, res: Response): Promise<void>;
17
- /**
18
- * This method is invoked right after an action is executed.
19
- * @param action
20
- */
21
- afterAction(action: any, req: Request, res: Response): void;
22
- /**
23
- *
24
-
25
- Checks the privilege of the current user.
26
-
27
- This method should be overridden to check whether the current user has the privilege to run the specified action against the specified data model. If the user does not have access, a yii\web\ForbiddenHttpException should be thrown.
28
-
29
- */
30
- checkAccess(action: any, model?: null, params?: any): void;
31
- /**
32
- * Send data formatted as JSON.
33
-
34
- This method is a shortcut for sending data formatted as JSON. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will b
35
- */
36
- asJson(data: any): void;
37
- /**
38
- * Send data formatted as XML.
39
-
40
- This method is a shortcut for sending data formatted as XML. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will be:
41
- */
42
- asXml(data: any): void;
43
- }
1
+ import { Component } from "./Component";
2
+ import { RouteDefinition } from "../model/RouteDefinition";
3
+ import { Request, Response } from "express";
4
+ export declare class CWebController extends Component {
5
+ /**
6
+ * @var string the ID of this controller.
7
+ */
8
+ id: string;
9
+ defaultAction: string;
10
+ constructor(config: any);
11
+ init(): void;
12
+ /**
13
+ * This method is invoked right before an action is executed.
14
+ * @param $action
15
+ */
16
+ beforeAction(route: RouteDefinition, req: Request, res: Response): Promise<void>;
17
+ /**
18
+ * This method is invoked right after an action is executed.
19
+ * @param action
20
+ */
21
+ afterAction(action: any, req: Request, res: Response): void;
22
+ /**
23
+ *
24
+
25
+ Checks the privilege of the current user.
26
+
27
+ This method should be overridden to check whether the current user has the privilege to run the specified action against the specified data model. If the user does not have access, a yii\web\ForbiddenHttpException should be thrown.
28
+
29
+ */
30
+ checkAccess(action: any, model?: null, params?: any): void;
31
+ /**
32
+ * Send data formatted as JSON.
33
+
34
+ This method is a shortcut for sending data formatted as JSON. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will b
35
+ */
36
+ asJson(data: any): void;
37
+ /**
38
+ * Send data formatted as XML.
39
+
40
+ This method is a shortcut for sending data formatted as XML. It will return the response application component after configuring the format and setting the data that should be formatted. A common usage will be:
41
+ */
42
+ asXml(data: any): void;
43
+ }
44
44
  //# sourceMappingURL=CWebController.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CWebController.d.ts","sourceRoot":"","sources":["../../src/base/CWebController.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE1C,qBAAa,cAAe,SAAQ,SAAS;IAGzC;;OAEG;IACI,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,SAAW;gBAEnB,MAAM,EAAE,GAAG;IAKhB,IAAI;IAKX;;;OAGG;IACU,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAW7E;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAI3D;;;;;;;OAOG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,GAAE,GAAQ;IAI9D;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,GAAG;IAIhB;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,GAAG;CAIlB"}
1
+ {"version":3,"file":"CWebController.d.ts","sourceRoot":"","sources":["../../src/base/CWebController.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAI1C,qBAAa,cAAe,SAAQ,SAAS;IAGzC;;OAEG;IACI,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,SAAW;gBAEnB,MAAM,EAAE,GAAG;IAKhB,IAAI;IAKX;;;OAGG;IACU,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAa7E;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAK3D;;;;;;;OAOG;IACI,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,GAAE,GAAQ;IAI9D;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,GAAG;IAIhB;;;;OAIG;IACH,KAAK,CAAC,IAAI,EAAE,GAAG;CAIlB"}