chyz 2.0.1-rc.3 → 2.0.1-rc.36

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 (229) hide show
  1. package/BaseChyz.ts +623 -0
  2. package/README.md +518 -518
  3. package/base/ActionFilter.ts +88 -0
  4. package/base/BadRequestHttpException.ts +14 -0
  5. package/base/{BaseError.js → BaseError.ts} +26 -18
  6. package/base/Behavior.ts +6 -0
  7. package/base/CBaseObject.ts +17 -0
  8. package/base/CEvents.ts +24 -0
  9. package/base/{CRequest.js → CRequest.ts} +6 -2
  10. package/base/CWebController.ts +90 -0
  11. package/base/Component.ts +66 -0
  12. package/{model/RouteDefinition.js → base/Configurable.ts} +4 -2
  13. package/base/DataErrorDbException.ts +16 -0
  14. package/base/DbConnection.ts +55 -0
  15. package/base/ForbiddenHttpException.ts +15 -0
  16. package/base/InvalidArgumentException.ts +16 -0
  17. package/base/InvalidConfigException.ts +16 -0
  18. package/base/{Logs.js → Logs.ts} +41 -24
  19. package/base/{Model.js → Model.ts} +225 -158
  20. package/base/{ModelManager.js → ModelManager.ts} +7 -7
  21. package/base/NotFoundHttpException.ts +14 -0
  22. package/base/RestClient.ts +26 -0
  23. package/base/UnauthorizedHttpException.ts +17 -0
  24. package/base/ValidationHttpException.ts +14 -0
  25. package/base/db/Exception.ts +14 -0
  26. package/base/index.ts +19 -0
  27. package/decorator/Middleware.ts +9 -0
  28. package/decorator/{controller.js → controller.ts} +7 -9
  29. package/decorator/{delete.js → delete.ts} +9 -9
  30. package/decorator/enums/ControllerDecoratorParams.ts +5 -0
  31. package/decorator/{get.js → get.ts} +11 -10
  32. package/decorator/index.ts +5 -0
  33. package/decorator/{post.js → post.ts} +10 -10
  34. package/decorator/{put.js → put.ts} +9 -9
  35. package/filters/AccessControl.ts +74 -0
  36. package/filters/AccessRule.ts +182 -0
  37. package/filters/auth/{AuthInterface.d.ts → AuthInterface.ts} +15 -7
  38. package/filters/auth/AuthMethod.ts +100 -0
  39. package/filters/auth/HttpBasicAuth.ts +79 -0
  40. package/filters/auth/HttpBearerAuth.ts +34 -0
  41. package/filters/auth/HttpHeaderAuth.ts +61 -0
  42. package/filters/auth/JwtHttpBearerAuth.ts +83 -0
  43. package/filters/auth/KeyCloakHttpBearerAuth.ts +114 -0
  44. package/filters/auth/index.ts +4 -0
  45. package/filters/index.ts +2 -0
  46. package/index.ts +80 -0
  47. package/log/config/log4js.json +55 -55
  48. package/model/RouteDefinition.ts +18 -0
  49. package/package.json +63 -61
  50. package/rbac/AuthAssignment.ts +50 -0
  51. package/rbac/{AuthItem.js → AuthItem.ts} +22 -16
  52. package/rbac/{AuthItemChild.js → AuthItemChild.ts} +21 -14
  53. package/rbac/AuthManager.ts +399 -0
  54. package/rbac/index.ts +12 -0
  55. package/{web/IdentityInterface.js → requiments/Glob.ts} +3 -2
  56. package/requiments/{ReflectUtil.js → ReflectUtil.ts} +6 -4
  57. package/requiments/{Utils.js → Utils.ts} +40 -34
  58. package/validators/BooleanValidator.ts +0 -0
  59. package/validators/CompareValidator.ts +0 -0
  60. package/validators/DateValidator.ts +0 -0
  61. package/validators/EmailValidator.ts +0 -0
  62. package/validators/Validator.ts +27 -0
  63. package/web/{IdentityInterface.d.ts → IdentityInterface.ts} +15 -2
  64. package/web/WebUser.ts +187 -0
  65. package/BaseChyz.d.ts +0 -74
  66. package/BaseChyz.d.ts.map +0 -1
  67. package/BaseChyz.js +0 -569
  68. package/base/ActionFilter.d.ts +0 -33
  69. package/base/ActionFilter.d.ts.map +0 -1
  70. package/base/ActionFilter.js +0 -90
  71. package/base/BadRequestHttpException.d.ts +0 -6
  72. package/base/BadRequestHttpException.d.ts.map +0 -1
  73. package/base/BadRequestHttpException.js +0 -17
  74. package/base/BaseError.d.ts +0 -44
  75. package/base/BaseError.d.ts.map +0 -1
  76. package/base/Behavior.d.ts +0 -4
  77. package/base/Behavior.d.ts.map +0 -1
  78. package/base/Behavior.js +0 -7
  79. package/base/CBaseObject.d.ts +0 -5
  80. package/base/CBaseObject.d.ts.map +0 -1
  81. package/base/CBaseObject.js +0 -16
  82. package/base/CEvents.d.ts +0 -13
  83. package/base/CEvents.d.ts.map +0 -1
  84. package/base/CEvents.js +0 -24
  85. package/base/CRequest.d.ts +0 -2
  86. package/base/CRequest.d.ts.map +0 -1
  87. package/base/CWebController.d.ts +0 -44
  88. package/base/CWebController.d.ts.map +0 -1
  89. package/base/CWebController.js +0 -81
  90. package/base/Component.d.ts +0 -21
  91. package/base/Component.d.ts.map +0 -1
  92. package/base/Component.js +0 -57
  93. package/base/Configurable.d.ts +0 -3
  94. package/base/Configurable.d.ts.map +0 -1
  95. package/base/Configurable.js +0 -8
  96. package/base/DataErrorDbException.d.ts +0 -6
  97. package/base/DataErrorDbException.d.ts.map +0 -1
  98. package/base/DataErrorDbException.js +0 -17
  99. package/base/DbConnection.d.ts +0 -13
  100. package/base/DbConnection.d.ts.map +0 -1
  101. package/base/DbConnection.js +0 -53
  102. package/base/ForbiddenHttpException.d.ts +0 -5
  103. package/base/ForbiddenHttpException.d.ts.map +0 -1
  104. package/base/ForbiddenHttpException.js +0 -16
  105. package/base/InvalidArgumentException.d.ts +0 -6
  106. package/base/InvalidArgumentException.d.ts.map +0 -1
  107. package/base/InvalidArgumentException.js +0 -17
  108. package/base/InvalidConfigException.d.ts +0 -6
  109. package/base/InvalidConfigException.d.ts.map +0 -1
  110. package/base/InvalidConfigException.js +0 -17
  111. package/base/Logs.d.ts +0 -22
  112. package/base/Logs.d.ts.map +0 -1
  113. package/base/Model.d.ts +0 -302
  114. package/base/Model.d.ts.map +0 -1
  115. package/base/ModelManager.d.ts +0 -2
  116. package/base/ModelManager.d.ts.map +0 -1
  117. package/base/NotFoundHttpException.d.ts +0 -6
  118. package/base/NotFoundHttpException.d.ts.map +0 -1
  119. package/base/NotFoundHttpException.js +0 -17
  120. package/base/RestClient.d.ts +0 -7
  121. package/base/RestClient.d.ts.map +0 -1
  122. package/base/RestClient.js +0 -25
  123. package/base/UnauthorizedHttpException.d.ts +0 -6
  124. package/base/UnauthorizedHttpException.d.ts.map +0 -1
  125. package/base/UnauthorizedHttpException.js +0 -17
  126. package/base/ValidationHttpException.d.ts +0 -6
  127. package/base/ValidationHttpException.d.ts.map +0 -1
  128. package/base/ValidationHttpException.js +0 -17
  129. package/base/db/Exception.d.ts +0 -7
  130. package/base/db/Exception.d.ts.map +0 -1
  131. package/base/db/Exception.js +0 -15
  132. package/base/index.d.ts +0 -20
  133. package/base/index.d.ts.map +0 -1
  134. package/base/index.js +0 -41
  135. package/decorator/Middleware.d.ts +0 -4
  136. package/decorator/Middleware.d.ts.map +0 -1
  137. package/decorator/Middleware.js +0 -11
  138. package/decorator/controller.d.ts +0 -3
  139. package/decorator/controller.d.ts.map +0 -1
  140. package/decorator/delete.d.ts +0 -3
  141. package/decorator/delete.d.ts.map +0 -1
  142. package/decorator/enums/ControllerDecoratorParams.d.ts +0 -6
  143. package/decorator/enums/ControllerDecoratorParams.d.ts.map +0 -1
  144. package/decorator/enums/ControllerDecoratorParams.js +0 -9
  145. package/decorator/get.d.ts +0 -3
  146. package/decorator/get.d.ts.map +0 -1
  147. package/decorator/index.d.ts +0 -6
  148. package/decorator/index.d.ts.map +0 -1
  149. package/decorator/index.js +0 -13
  150. package/decorator/post.d.ts +0 -3
  151. package/decorator/post.d.ts.map +0 -1
  152. package/decorator/put.d.ts +0 -3
  153. package/decorator/put.d.ts.map +0 -1
  154. package/filters/AccessControl.d.ts +0 -13
  155. package/filters/AccessControl.d.ts.map +0 -1
  156. package/filters/AccessControl.js +0 -83
  157. package/filters/AccessRule.d.ts +0 -83
  158. package/filters/AccessRule.d.ts.map +0 -1
  159. package/filters/AccessRule.js +0 -136
  160. package/filters/auth/AuthInterface.d.ts.map +0 -1
  161. package/filters/auth/AuthInterface.js +0 -2
  162. package/filters/auth/AuthMethod.d.ts +0 -38
  163. package/filters/auth/AuthMethod.d.ts.map +0 -1
  164. package/filters/auth/AuthMethod.js +0 -82
  165. package/filters/auth/HttpBasicAuth.d.ts +0 -24
  166. package/filters/auth/HttpBasicAuth.d.ts.map +0 -1
  167. package/filters/auth/HttpBasicAuth.js +0 -78
  168. package/filters/auth/HttpBearerAuth.d.ts +0 -18
  169. package/filters/auth/HttpBearerAuth.d.ts.map +0 -1
  170. package/filters/auth/HttpBearerAuth.js +0 -33
  171. package/filters/auth/HttpHeaderAuth.d.ts +0 -19
  172. package/filters/auth/HttpHeaderAuth.d.ts.map +0 -1
  173. package/filters/auth/HttpHeaderAuth.js +0 -64
  174. package/filters/auth/JwtHttpBearerAuth.d.ts +0 -21
  175. package/filters/auth/JwtHttpBearerAuth.d.ts.map +0 -1
  176. package/filters/auth/JwtHttpBearerAuth.js +0 -87
  177. package/filters/auth/KeyCloakHttpBearerAuth.d.ts +0 -23
  178. package/filters/auth/KeyCloakHttpBearerAuth.d.ts.map +0 -1
  179. package/filters/auth/KeyCloakHttpBearerAuth.js +0 -116
  180. package/filters/auth/index.d.ts +0 -5
  181. package/filters/auth/index.d.ts.map +0 -1
  182. package/filters/auth/index.js +0 -11
  183. package/filters/index.d.ts +0 -3
  184. package/filters/index.d.ts.map +0 -1
  185. package/filters/index.js +0 -7
  186. package/index.d.ts +0 -26
  187. package/index.d.ts.map +0 -1
  188. package/index.js +0 -72
  189. package/model/RouteDefinition.d.ts +0 -7
  190. package/model/RouteDefinition.d.ts.map +0 -1
  191. package/rbac/AuthAssignment.d.ts +0 -19
  192. package/rbac/AuthAssignment.d.ts.map +0 -1
  193. package/rbac/AuthAssignment.js +0 -44
  194. package/rbac/AuthItem.d.ts +0 -27
  195. package/rbac/AuthItem.d.ts.map +0 -1
  196. package/rbac/AuthItemChild.d.ts +0 -19
  197. package/rbac/AuthItemChild.d.ts.map +0 -1
  198. package/rbac/AuthManager.d.ts +0 -112
  199. package/rbac/AuthManager.d.ts.map +0 -1
  200. package/rbac/AuthManager.js +0 -356
  201. package/rbac/index.d.ts +0 -5
  202. package/rbac/index.d.ts.map +0 -1
  203. package/rbac/index.js +0 -28
  204. package/requiments/Glob.d.ts +0 -3
  205. package/requiments/Glob.d.ts.map +0 -1
  206. package/requiments/Glob.js +0 -10
  207. package/requiments/ReflectUtil.d.ts +0 -1
  208. package/requiments/ReflectUtil.d.ts.map +0 -1
  209. package/requiments/Utils.d.ts +0 -2
  210. package/requiments/Utils.d.ts.map +0 -1
  211. package/validators/BooleanValidator.d.ts +0 -1
  212. package/validators/BooleanValidator.d.ts.map +0 -1
  213. package/validators/BooleanValidator.js +0 -1
  214. package/validators/CompareValidator.d.ts +0 -1
  215. package/validators/CompareValidator.d.ts.map +0 -1
  216. package/validators/CompareValidator.js +0 -1
  217. package/validators/DateValidator.d.ts +0 -1
  218. package/validators/DateValidator.d.ts.map +0 -1
  219. package/validators/DateValidator.js +0 -1
  220. package/validators/EmailValidator.d.ts +0 -1
  221. package/validators/EmailValidator.d.ts.map +0 -1
  222. package/validators/EmailValidator.js +0 -1
  223. package/validators/Validator.d.ts +0 -18
  224. package/validators/Validator.d.ts.map +0 -1
  225. package/validators/Validator.js +0 -27
  226. package/web/IdentityInterface.d.ts.map +0 -1
  227. package/web/WebUser.d.ts +0 -72
  228. package/web/WebUser.d.ts.map +0 -1
  229. package/web/WebUser.js +0 -165
package/package.json CHANGED
@@ -1,61 +1,63 @@
1
- {
2
- "name": "chyz",
3
- "version": "2.0.1-rc.3",
4
- "description": "Nodejs Micro service Framework",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1",
7
- "postversion": "git push && git push --tags"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/cihan53/Chy-Nodejs-Framework.git"
12
- },
13
- "author": "Cihan Ozturk",
14
- "license": "MIT",
15
- "bugs": {
16
- "url": "https://github.com/cihan53/Chy-Nodejs-Framework/issues"
17
- },
18
- "homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
19
- "dependencies": {
20
- "axios": "^1.3.5",
21
- "babel-plugin-transform-decorators-legacy": "^1.3.5",
22
- "body-parser": "^1.20.2",
23
- "compression": "^1.7.4",
24
- "core-js": "^3.30.1",
25
- "cors": "^2.8.5",
26
- "dayjs": "^1.11.7",
27
- "dotenv-flow": "^3.2.0",
28
- "express": "^4.18.2",
29
- "express-session": "^1.17.3",
30
- "glob": "^10.0.0",
31
- "ip": "^1.1.8",
32
- "jsonwebtoken": "^9.0.0",
33
- "lodash": "^4.17.21",
34
- "log4js": "^6.9.1",
35
- "method-override": "^3.0.0",
36
- "passport": "^0.6.0",
37
- "pg": "^8.10.0",
38
- "pg-hstore": "^2.3.4",
39
- "reflect-metadata": "^0.1.13",
40
- "sequelize": "^6.31.0",
41
- "sequelize-transparent-cache": "^2.3.0",
42
- "tslib": "^2.5.0",
43
- "validate.js": "^0.13.1"
44
- },
45
- "devDependencies": {
46
- "@types/express": "^4.17.17",
47
- "@types/node": "^18.15.11",
48
- "@types/validator": "^13.7.15",
49
- "nodemon": "^2.0.22",
50
- "ts-node": "^10.9.1",
51
- "typescript": "^5.0.4"
52
- } ,
53
- "keywords": [
54
- "Framework",
55
- "RespAPI",
56
- "microservice",
57
- "micro service",
58
- "easy configuration",
59
- "Rbac support"
60
- ]
61
- }
1
+ {
2
+ "name": "chyz",
3
+ "version": "2.0.1-rc.36",
4
+ "description": "Nodejs Micro service Framework",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "postversion": "git push && git push --tags"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/cihan53/Chy-Nodejs-Framework.git"
12
+ },
13
+ "author": "Cihan Ozturk",
14
+ "license": "MIT",
15
+ "bugs": {
16
+ "url": "https://github.com/cihan53/Chy-Nodejs-Framework/issues"
17
+ },
18
+ "homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
19
+ "dependencies": {
20
+ "@types/compression": "^1.7.5",
21
+ "axios": "^1.3.5",
22
+ "babel-plugin-transform-decorators-legacy": "^1.3.5",
23
+ "body-parser": "^1.20.2",
24
+ "compression": "^1.7.4",
25
+ "core-js": "^3.30.1",
26
+ "cors": "^2.8.5",
27
+ "dayjs": "^1.11.7",
28
+ "dotenv-flow": "^3.2.0",
29
+ "express": "^4.18.2",
30
+ "express-session": "^1.17.3",
31
+ "glob": "^10.0.0",
32
+ "ip": "^1.1.8",
33
+ "jsonwebtoken": "^9.0.0",
34
+ "lodash": "^4.17.21",
35
+ "lodash-uuid": "^0.0.3",
36
+ "log4js": "^6.9.1",
37
+ "method-override": "^3.0.0",
38
+ "passport": "^0.6.0",
39
+ "pg": "^8.10.0",
40
+ "pg-hstore": "^2.3.4",
41
+ "reflect-metadata": "^0.1.13",
42
+ "sequelize": "^6.31.0",
43
+ "sequelize-transparent-cache": "^2.3.0",
44
+ "tslib": "^2.5.0",
45
+ "validate.js": "^0.13.1"
46
+ },
47
+ "devDependencies": {
48
+ "@types/express": "^4.17.17",
49
+ "@types/node": "^18.15.11",
50
+ "@types/validator": "^13.7.15",
51
+ "nodemon": "^2.0.22",
52
+ "ts-node": "^10.9.1",
53
+ "typescript": "^5.0.4"
54
+ },
55
+ "keywords": [
56
+ "Framework",
57
+ "RespAPI",
58
+ "microservice",
59
+ "micro service",
60
+ "easy configuration",
61
+ "Rbac support"
62
+ ]
63
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
3
+ * Author: Cihan Ozturk
4
+ * E-mail: cihan@chy.com.tr
5
+ * Github:https://github.com/cihan53/
6
+ */
7
+
8
+ import {DataTypes, Model, ModelManager, Relation} from "../base";
9
+
10
+ export class AuthAssignmentClass extends Model {
11
+ [x: string]: any;
12
+
13
+ tableName() {
14
+ return 'auth_assignment';
15
+ }
16
+ attributes() {
17
+ return {
18
+
19
+ // Model attributes are defined here
20
+ item_name: {
21
+ type: DataTypes.STRING,
22
+ primaryKey:true,
23
+ allowNull: false
24
+ },
25
+ user_id : {
26
+ type: DataTypes.STRING,
27
+ allowNull: false
28
+ }
29
+
30
+ }
31
+ }
32
+
33
+ init(){
34
+ super.init();
35
+ this.model().removeAttribute('id')
36
+ }
37
+
38
+ relations(): Relation[] {
39
+ return [
40
+ {
41
+ type: "hasMany",
42
+ foreignKey: "name",
43
+ sourceKey:'item_name',
44
+ model: ModelManager.AuthItem.model()
45
+ }
46
+ ]
47
+ }
48
+
49
+ }
50
+
@@ -1,51 +1,57 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
3
  * Author: Cihan Ozturk
5
4
  * E-mail: cihan@chy.com.tr
6
5
  * Github:https://github.com/cihan53/
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AuthItemClass = void 0;
10
- const base_1 = require("../base");
11
- class AuthItemClass extends base_1.Model {
7
+
8
+ import {DataTypes, Model, ModelManager, Relation} from "../base";
9
+
10
+ export class AuthItemClass extends Model {
11
+ [x: string]: any;
12
+
12
13
  tableName() {
13
14
  return 'auth_item';
14
15
  }
16
+
15
17
  attributes() {
16
18
  return {
17
19
  // Model attributes are defined here
18
20
  name: {
19
- type: base_1.DataTypes.STRING,
20
- primaryKey: true,
21
+ type: DataTypes.STRING,
22
+ primaryKey:true,
21
23
  allowNull: false
22
24
  },
23
25
  type: {
24
- type: base_1.DataTypes.INTEGER,
26
+ type: DataTypes.INTEGER,
25
27
  allowNull: false
26
28
  },
27
29
  description: {
28
- type: base_1.DataTypes.STRING,
30
+ type: DataTypes.STRING,
29
31
  allowNull: false
30
32
  },
31
33
  rule_name: {
32
- type: base_1.DataTypes.STRING,
34
+ type: DataTypes.STRING,
33
35
  allowNull: false
34
36
  }
35
- };
37
+
38
+ }
36
39
  }
40
+
37
41
  init() {
38
42
  super.init();
39
- this.model().removeAttribute('id');
43
+ this.model().removeAttribute('id')
40
44
  }
41
- relations() {
45
+
46
+ relations(): Relation[] {
42
47
  return [
43
48
  {
44
49
  type: "hasOne",
45
50
  foreignKey: "item_name",
46
- model: base_1.ModelManager.AuthAssignment.model()
51
+ model: ModelManager.AuthAssignment.model()
47
52
  }
48
- ];
53
+ ]
49
54
  }
55
+
50
56
  }
51
- exports.AuthItemClass = AuthItemClass;
57
+
@@ -1,43 +1,50 @@
1
- "use strict";
2
1
  /*
3
2
  * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
3
  * Author: Cihan Ozturk
5
4
  * E-mail: cihan@chy.com.tr
6
5
  * Github:https://github.com/cihan53/
7
6
  */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AuthItemChildClass = void 0;
10
- const base_1 = require("../base");
11
- class AuthItemChildClass extends base_1.Model {
7
+
8
+
9
+
10
+ import {DataTypes, Model, ModelManager, Relation} from "../base";
11
+
12
+ export class AuthItemChildClass extends Model {
13
+ [x: string]: any;
14
+
12
15
  tableName() {
13
16
  return 'auth_item_child';
14
17
  }
18
+
15
19
  attributes() {
16
20
  return {
17
21
  // Model attributes are defined here
18
22
  parent: {
19
- type: base_1.DataTypes.STRING,
20
- primaryKey: true,
23
+ type: DataTypes.STRING,
24
+ primaryKey:true,
21
25
  allowNull: false
22
26
  },
23
27
  child: {
24
- type: base_1.DataTypes.STRING,
28
+ type: DataTypes.STRING,
25
29
  allowNull: false
26
30
  }
27
- };
31
+ }
28
32
  }
33
+
29
34
  init() {
30
35
  super.init();
31
- this.model().removeAttribute('id');
36
+ this.model().removeAttribute('id')
32
37
  }
33
- relations() {
38
+
39
+ relations(): Relation[] {
34
40
  return [
35
41
  {
36
42
  type: "hasOne",
37
43
  foreignKey: "item_name",
38
- model: base_1.ModelManager.AuthAssignment.model()
44
+ model: ModelManager.AuthAssignment.model()
39
45
  }
40
- ];
46
+ ]
41
47
  }
48
+
42
49
  }
43
- exports.AuthItemChildClass = AuthItemChildClass;
50
+