chyz 1.0.12-rc.9 → 1.0.13-rc.4

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 (167) hide show
  1. package/{dist/BaseChyz.js → BaseChyz.js} +45 -8
  2. package/BaseChyz.js.map +1 -0
  3. package/{dist/Chyz.js → Chyz.js} +0 -0
  4. package/{dist/Chyz.js.map → Chyz.js.map} +0 -0
  5. package/README.md +80 -28
  6. package/{dist/base → base}/ActionFilter.js +2 -2
  7. package/base/ActionFilter.js.map +1 -0
  8. package/{dist/base → base}/BaseError.js +2 -2
  9. package/base/BaseError.js.map +1 -0
  10. package/{dist/base → base}/BaseObject.js +0 -0
  11. package/{dist/base → base}/BaseObject.js.map +0 -0
  12. package/{dist/base → base}/Behavior.js +0 -0
  13. package/{dist/base → base}/Behavior.js.map +0 -0
  14. package/{dist/base → base}/Component.js +0 -0
  15. package/{dist/base → base}/Component.js.map +0 -0
  16. package/{dist/base → base}/Configurable.js +0 -0
  17. package/{dist/base → base}/Configurable.js.map +0 -0
  18. package/{dist/base → base}/Controller.js +0 -0
  19. package/{dist/base → base}/Controller.js.map +0 -0
  20. package/{dist/base → base}/DataErrorDbException.js +1 -1
  21. package/{dist/base → base}/DataErrorDbException.js.map +1 -1
  22. package/{dist/base → base}/DbConnection.js +0 -0
  23. package/{dist/base → base}/DbConnection.js.map +0 -0
  24. package/{dist/base → base}/ForbiddenHttpException.js +1 -1
  25. package/{dist/base → base}/ForbiddenHttpException.js.map +1 -1
  26. package/{dist/base → base}/InvalidConfigException.js +1 -1
  27. package/{dist/base → base}/InvalidConfigException.js.map +1 -1
  28. package/{dist/base → base}/Model.js +121 -3
  29. package/base/Model.js.map +1 -0
  30. package/{dist/base → base}/NotFoundHttpException.js +1 -1
  31. package/{dist/base → base}/NotFoundHttpException.js.map +1 -1
  32. package/base/RestClient.js +27 -0
  33. package/base/RestClient.js.map +1 -0
  34. package/{dist/base → base}/UnauthorizedHttpException.js +1 -1
  35. package/{dist/base → base}/UnauthorizedHttpException.js.map +1 -1
  36. package/{dist/base → base}/ValidationHttpException.js +1 -1
  37. package/{dist/base → base}/ValidationHttpException.js.map +1 -1
  38. package/{dist/base → base}/db/Exception.js +0 -0
  39. package/{dist/base → base}/db/Exception.js.map +0 -0
  40. package/{dist/base → base}/index.js +2 -0
  41. package/{dist/base → base}/index.js.map +1 -1
  42. package/{dist/decorator → decorator}/Middleware.js +0 -0
  43. package/{dist/decorator → decorator}/Middleware.js.map +0 -0
  44. package/{dist/decorator → decorator}/controller.js +0 -0
  45. package/{dist/decorator → decorator}/controller.js.map +0 -0
  46. package/{dist/decorator → decorator}/enums/ControllerDecoratorParams.js +0 -0
  47. package/{dist/decorator → decorator}/enums/ControllerDecoratorParams.js.map +0 -0
  48. package/{dist/decorator → decorator}/get.js +0 -0
  49. package/{dist/decorator → decorator}/get.js.map +0 -0
  50. package/{dist/decorator → decorator}/index.js +0 -0
  51. package/{dist/decorator → decorator}/index.js.map +0 -0
  52. package/{dist/decorator → decorator}/post.js +0 -0
  53. package/{dist/decorator → decorator}/post.js.map +0 -0
  54. package/{dist/filters → filters}/AccessControl.js +2 -2
  55. package/filters/AccessControl.js.map +1 -0
  56. package/{dist/filters → filters}/AccessRule.js +0 -0
  57. package/{dist/filters → filters}/AccessRule.js.map +1 -1
  58. package/{dist/filters → filters}/auth/AuthInterface.js +0 -0
  59. package/{dist/filters → filters}/auth/AuthInterface.js.map +0 -0
  60. package/{dist/filters → filters}/auth/AuthMethod.js +2 -2
  61. package/filters/auth/AuthMethod.js.map +1 -0
  62. package/{dist/filters → filters}/auth/HttpBasicAuth.js +0 -0
  63. package/{dist/filters → filters}/auth/HttpBasicAuth.js.map +0 -0
  64. package/{dist/filters → filters}/auth/HttpBearerAuth.js +0 -0
  65. package/{dist/filters → filters}/auth/HttpBearerAuth.js.map +0 -0
  66. package/{dist/filters → filters}/auth/HttpHeaderAuth.js +0 -0
  67. package/{dist/filters → filters}/auth/HttpHeaderAuth.js.map +1 -1
  68. package/{dist/filters → filters}/auth/JwtHttpBearerAuth.js +1 -0
  69. package/filters/auth/JwtHttpBearerAuth.js.map +1 -0
  70. package/filters/auth/KeyCloakHttpBearerAuth.js +117 -0
  71. package/filters/auth/KeyCloakHttpBearerAuth.js.map +1 -0
  72. package/{dist/filters → filters}/auth/index.js +0 -0
  73. package/{dist/filters → filters}/auth/index.js.map +0 -0
  74. package/{dist/filters → filters}/index.js +0 -0
  75. package/{dist/filters → filters}/index.js.map +0 -0
  76. package/index.js +28 -0
  77. package/index.js.map +1 -0
  78. package/log/config/log4js.json +55 -0
  79. package/{dist/model → model}/RouteDefinition.js +0 -0
  80. package/{dist/model → model}/RouteDefinition.js.map +0 -0
  81. package/package.json +56 -52
  82. package/{dist/requiments → requiments}/Glob.js +0 -0
  83. package/{dist/requiments → requiments}/Glob.js.map +0 -0
  84. package/{dist/requiments → requiments}/ReflectUtil.js +0 -0
  85. package/{dist/requiments → requiments}/ReflectUtil.js.map +0 -0
  86. package/{dist/requiments → requiments}/Utils.js +0 -0
  87. package/{dist/requiments → requiments}/Utils.js.map +0 -0
  88. package/{dist/validators → validators}/BooleanValidator.js +0 -0
  89. package/{dist/validators → validators}/BooleanValidator.js.map +0 -0
  90. package/{dist/validators → validators}/CompareValidator.js +0 -0
  91. package/{dist/validators → validators}/CompareValidator.js.map +0 -0
  92. package/{dist/validators → validators}/DateValidator.js +0 -0
  93. package/{dist/validators → validators}/DateValidator.js.map +0 -0
  94. package/{dist/validators → validators}/EmailValidator.js +0 -0
  95. package/{dist/validators → validators}/EmailValidator.js.map +0 -0
  96. package/{dist/validators → validators}/Validator.js +0 -0
  97. package/{dist/validators → validators}/Validator.js.map +0 -0
  98. package/{dist/web → web}/IdentityInterface.js +0 -0
  99. package/{dist/web → web}/IdentityInterface.js.map +0 -0
  100. package/{dist/web/User.js → web/WebUser.js} +12 -7
  101. package/web/WebUser.js.map +1 -0
  102. package/BaseChyz.ts +0 -313
  103. package/Chyz.ts +0 -11
  104. package/Examples/Controllers/ApiController.ts +0 -121
  105. package/Examples/Controllers/PublicController.ts +0 -44
  106. package/Examples/Controllers/SiteController.ts +0 -127
  107. package/Examples/Models/Customer.ts +0 -113
  108. package/Examples/Models/Order.ts +0 -48
  109. package/Examples/Models/OrderItem.ts +0 -26
  110. package/Examples/Models/User.ts +0 -80
  111. package/Examples/index.ts +0 -38
  112. package/Examples/package.json +0 -45
  113. package/Examples/tsconfig.json +0 -20
  114. package/Examples/yarn.lock +0 -2202
  115. package/base/ActionFilter.ts +0 -71
  116. package/base/BaseError.ts +0 -26
  117. package/base/BaseObject.ts +0 -19
  118. package/base/Behavior.ts +0 -6
  119. package/base/Component.ts +0 -66
  120. package/base/Configurable.ts +0 -10
  121. package/base/Controller.ts +0 -84
  122. package/base/DataErrorDbException.ts +0 -16
  123. package/base/DbConnection.ts +0 -51
  124. package/base/ForbiddenHttpException.ts +0 -15
  125. package/base/InvalidConfigException.ts +0 -16
  126. package/base/Model.ts +0 -209
  127. package/base/NotFoundHttpException.ts +0 -14
  128. package/base/UnauthorizedHttpException.ts +0 -16
  129. package/base/ValidationHttpException.ts +0 -14
  130. package/base/db/Exception.ts +0 -14
  131. package/base/index.ts +0 -14
  132. package/decorator/Middleware.ts +0 -9
  133. package/decorator/controller.ts +0 -22
  134. package/decorator/enums/ControllerDecoratorParams.ts +0 -5
  135. package/decorator/get.ts +0 -37
  136. package/decorator/index.ts +0 -3
  137. package/decorator/post.ts +0 -36
  138. package/dist/BaseChyz.js.map +0 -1
  139. package/dist/base/ActionFilter.js.map +0 -1
  140. package/dist/base/BaseError.js.map +0 -1
  141. package/dist/base/Model.js.map +0 -1
  142. package/dist/filters/AccessControl.js.map +0 -1
  143. package/dist/filters/auth/AuthMethod.js.map +0 -1
  144. package/dist/filters/auth/JwtHttpBearerAuth.js.map +0 -1
  145. package/dist/web/User.js.map +0 -1
  146. package/filters/AccessControl.ts +0 -64
  147. package/filters/AccessRule.ts +0 -137
  148. package/filters/auth/AuthInterface.ts +0 -34
  149. package/filters/auth/AuthMethod.ts +0 -88
  150. package/filters/auth/HttpBasicAuth.ts +0 -7
  151. package/filters/auth/HttpBearerAuth.ts +0 -31
  152. package/filters/auth/HttpHeaderAuth.ts +0 -53
  153. package/filters/auth/JwtHttpBearerAuth.ts +0 -81
  154. package/filters/auth/index.ts +0 -3
  155. package/filters/index.ts +0 -2
  156. package/model/RouteDefinition.ts +0 -18
  157. package/requiments/Glob.ts +0 -9
  158. package/requiments/ReflectUtil.ts +0 -26
  159. package/requiments/Utils.ts +0 -57
  160. package/tsconfig.json +0 -18
  161. package/validators/BooleanValidator.ts +0 -0
  162. package/validators/CompareValidator.ts +0 -0
  163. package/validators/DateValidator.ts +0 -0
  164. package/validators/EmailValidator.ts +0 -0
  165. package/validators/Validator.ts +0 -27
  166. package/web/IdentityInterface.ts +0 -62
  167. package/web/User.ts +0 -96
@@ -1,113 +0,0 @@
1
- // @ts-ignore
2
- import {DataTypes, Model} from "../../base";
3
-
4
- export class Customer extends Model {
5
- [x: string]: any;
6
-
7
- public tableName() {
8
- return 'customer';
9
- }
10
-
11
- public attributes() {
12
- return {
13
- name: {
14
- type: DataTypes.STRING,
15
- allowNull: false,
16
- validate: {
17
- notEmpty: true,
18
- is: ["^[a-z0-9A-Z]+$",'i'],
19
- len: [4, 255],
20
- }
21
- },
22
- firstname: {
23
- type: DataTypes.STRING,
24
- validate: {
25
- is: ["^[a-z0-9A-Z]+$",'i'],
26
- len: [4, 255],
27
- }
28
- },
29
- lastname: {
30
- type: DataTypes.STRING,
31
- validate: {
32
- is: ["^[a-z0-9A-Z]+$",'i'],
33
- len: [4, 255],
34
- }
35
- },
36
- companyName: {
37
- type: DataTypes.STRING,
38
- allowNull: true,
39
- validate: {
40
- is: /^[0-9A-Za-z =().:;+-şŞçÇöÖğĞıİüÜ]+$/i,
41
- len: [4, 255],
42
- }
43
- },
44
- email: {
45
- type: DataTypes.STRING,
46
- validate: {
47
- isEmail: true
48
- }
49
- },
50
- gsm_phone: {
51
- type: DataTypes.STRING,
52
- validate: {
53
- is: ["^[0-9 +]+$",'i'],
54
- }
55
- },
56
- country: {
57
- type: DataTypes.STRING,
58
- validate: {
59
- isAlpha: true,
60
- }
61
- },
62
- address: {
63
- type: DataTypes.STRING,
64
- validate: {
65
- is: ["^[\\w'\\-,.[0-9_\\/\\\\+=\"()<>;:\\[\\] şŞçÇöÖğĞıİüÜ ]{2,}$","i"],
66
- }
67
- },
68
- taxoffice: {
69
- type: DataTypes.STRING,
70
- validate: {
71
- is: ["^[\\w'\\-,.[0-9_\\/\\\\+=\"()<>;:\\[\\] şŞçÇöÖğĞıİüÜ ]{2,}$","i"],
72
- }
73
- },
74
- taxnumber: {
75
- unique: true,
76
- type: DataTypes.STRING,
77
- validate: {
78
- is:["^[0-9]+$",'i'],
79
- }
80
- },
81
- username: {
82
- unique: true,
83
- type: DataTypes.STRING,
84
- validate: {
85
- isEmail: true
86
- }
87
- },
88
- password: {
89
- type: DataTypes.STRING,
90
- validate: {
91
- is: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?\.#&])[A-Za-z\d$@$!%*\.?&]{8,12}/
92
- }
93
- },
94
- "2fa": {
95
- type: DataTypes.BOOLEAN,
96
- validate: {
97
- isBoolean: true
98
- }
99
- },
100
- status: {
101
- type: DataTypes.BOOLEAN,
102
- validate: {
103
- isBoolean: true
104
- }
105
- }
106
- }
107
- }
108
-
109
- }
110
-
111
-
112
-
113
-
@@ -1,48 +0,0 @@
1
- import {DataTypes, Model} from "../../base";
2
-
3
- export class Order extends Model {
4
- [x: string]: any;
5
-
6
- public tableName() {
7
- return 'order';
8
- }
9
-
10
- public attributes() {
11
-
12
- return {
13
- customer_id:{
14
- allowNull:false,
15
- type:DataTypes.INTEGER,
16
- },
17
-
18
- crm_order_id:{
19
- allowNull:false,
20
- type:DataTypes.INTEGER,
21
- },
22
-
23
- total:{
24
- allowNull:false,
25
- type:DataTypes.FLOAT,
26
- },
27
-
28
- created_date:{
29
- allowNull:false,
30
- type:DataTypes.DATE,
31
- // @ts-ignore
32
- defaultValue: Model.NOW
33
- },
34
- status: {
35
- type: DataTypes.BOOLEAN,
36
- allowNull:false,
37
- validate: {
38
- isBoolean: true
39
- }
40
- }
41
- }
42
- }
43
-
44
- }
45
-
46
-
47
-
48
-
@@ -1,26 +0,0 @@
1
- import {DataTypes, Model} from "../../Chy-Nodejs-Framework/dist/base";
2
-
3
- export class OrderItem extends Model {
4
- [x: string]: any;
5
-
6
- public tableName() {
7
- return 'order_items';
8
- }
9
-
10
- public attributes() {
11
- return {
12
-
13
- status: {
14
- type: DataTypes.BOOLEAN,
15
- validate: {
16
- isBoolean: true
17
- }
18
- }
19
- }
20
- }
21
-
22
- }
23
-
24
-
25
-
26
-
@@ -1,80 +0,0 @@
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 {IdentityInterface} from "../../web/IdentityInterface";
9
- import {DataTypes, Model} from "../../base";
10
- import BaseChyz from "../../BaseChyz";
11
- const JsonWebToken = require("jsonwebtoken");
12
- export class User extends Model implements IdentityInterface {
13
-
14
- [x: string]: any;
15
-
16
- public tableName() {
17
- return 'users';
18
- }
19
-
20
- findIdentity(id: number) {
21
- throw new Error("Method not implemented.");
22
- }
23
-
24
- getId(): number {
25
- throw new Error("Method not implemented.");
26
- }
27
-
28
- getAuthKey(): string {
29
- throw new Error("Method not implemented.");
30
- }
31
-
32
- validateAuthKey(authKey: string): boolean {
33
- throw new Error("Method not implemented.");
34
- }
35
-
36
- public attributes() {
37
- return {
38
- // Model attributes are defined here
39
- username: {
40
- type: DataTypes.STRING,
41
- allowNull: false
42
- },
43
- password: {
44
- type: DataTypes.STRING,
45
- allowNull: false
46
- },
47
- user_role: {
48
- type: DataTypes.STRING,
49
- allowNull: false
50
- },
51
- salt_text: {
52
- type: DataTypes.STRING
53
- // allowNull defaults to true
54
- }
55
- }
56
- }
57
-
58
- async findIdentityByAccessToken(token, type) {
59
- let decoded = JsonWebToken.decode(token, {complete: true})
60
- let identity = await this.findOne({where: {id: parseInt(decoded.payload.user)}});
61
- if (identity) {
62
- BaseChyz.debug("Find Identity By AccessToken: User Found", decoded.payload)
63
- try {
64
- JsonWebToken.verify(token, identity.salt_text);
65
- BaseChyz.debug("Find Identity By AccessToken: User Verify Success")
66
- return identity;
67
- } catch (err) {
68
- if (err.name == "TokenExpiredError")
69
- BaseChyz.debug("Find Identity By AccessToken: Token Expired")
70
- else
71
- BaseChyz.debug("Find Identity By AccessToken: User Verify Failed")
72
- return null;
73
- }
74
- }
75
- BaseChyz.debug("Find Identity By AccessToken: User Verify Failed")
76
- return null;
77
- }
78
- }
79
-
80
-
package/Examples/index.ts DELETED
@@ -1,38 +0,0 @@
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
- require('dotenv-flow').config();
9
- import Chyz from "../Chyz";
10
- import {User} from "../web/User";
11
- import {User as Identity } from "./Models/User";
12
- // @ts-ignore
13
- import {DbConnection} from "../base/DbConnection";
14
-
15
-
16
- let config = {
17
- port: 3000,
18
- controllerpath:"C:\\PROJELER\\github\\Chy-Nodejs-Framework\\Examples\\Controllers",
19
- components: {
20
- db:{
21
- class:DbConnection,
22
- database: process.env.DBDATABASE,
23
- username:process.env.DBUSER,
24
- password:process.env.DBPASS,
25
- options:{
26
- host: process.env.DBHOST,
27
- dialect: 'postgres', /* one of 'mysql' | 'mariadb' | 'postgres' | 'mssql' */
28
- // disable logging; default: console.log
29
- logging: false
30
- }
31
- },
32
- user: {
33
- 'class': User,
34
- 'identityClass':Identity
35
- }
36
- }
37
- }
38
- Chyz.app(config).Start();
@@ -1,45 +0,0 @@
1
- {
2
- "name": "edis-manager-node",
3
- "version": "1.0.0",
4
- "description": "Entranet ve Erken Deprem Bildirim Sistemi (EDİS) entegrasyonu",
5
- "main": "index.js",
6
- "scripts": {
7
- "dev": "nodemon index.ts",
8
- "debug": "ts-node index.ts",
9
- "test": "echo \"Error: no test specified\" && exit 1"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/cihan53/edis-manager-node.git"
14
- },
15
- "author": "",
16
- "license": "MIT",
17
- "bugs": {
18
- "url": "https://github.com/cihan53/edis-manager-node/issues"
19
- },
20
- "homepage": "https://github.com/cihan53/edis-manager-node#readme",
21
- "dependencies": {
22
- "babel-plugin-transform-decorators-legacy": "^1.3.5",
23
- "bcrypt": "^5.0.1",
24
- "body-parser": "^1.19.0",
25
- "dotenv-flow": "^3.2.0",
26
- "express": "^4.17.1",
27
- "glob": "^7.1.7",
28
- "jsonwebtoken": "^8.5.1",
29
- "lodash": "^4.17.21",
30
- "log4js": "^6.3.0",
31
- "method-override": "^3.0.0",
32
- "passport": "^0.4.1",
33
- "pg": "^8.7.1",
34
- "pg-hstore": "^2.3.4",
35
- "reflect-metadata": "^0.1.13",
36
- "sequelize": "^6.6.5"
37
- },
38
- "devDependencies": {
39
- "@types/express": "^4.17.13",
40
- "@types/node": "^16.4.13",
41
- "nodemon": "^2.0.12",
42
- "ts-node": "^10.2.0",
43
- "typescript": "^4.3.5"
44
- }
45
- }
@@ -1,20 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES6",
4
- "experimentalDecorators": true,
5
- "emitDecoratorMetadata": true,
6
- "removeComments": true,
7
- "esModuleInterop": true,
8
- "allowSyntheticDefaultImports": true,
9
- "moduleResolution": "node"
10
- },
11
- "exclude": [
12
- "node_modules"
13
- ],
14
- "include": [
15
- "__tests__/**/*.ts",
16
- "Controllers/**/*.ts",
17
- "Models/**/*.ts",
18
- "environment.d.ts",
19
- ]
20
- }