chyz 1.0.13-rc.4 → 1.0.13-rc.5

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 (180) hide show
  1. package/BaseChyz.ts +384 -0
  2. package/Chyz.ts +11 -0
  3. package/Examples/Controllers/ApiController.ts +140 -0
  4. package/Examples/Controllers/KeyCloakController.ts +100 -0
  5. package/Examples/Controllers/PublicController.ts +42 -0
  6. package/Examples/Controllers/SiteController.ts +139 -0
  7. package/Examples/Models/Categories.ts +48 -0
  8. package/Examples/Models/Customer.ts +115 -0
  9. package/Examples/Models/KeycloakUser.ts +66 -0
  10. package/Examples/Models/Order.ts +64 -0
  11. package/Examples/Models/OrderItem.ts +27 -0
  12. package/Examples/Models/ProductModels.ts +49 -0
  13. package/Examples/Models/ProductToCategories.ts +46 -0
  14. package/Examples/Models/Products.ts +50 -0
  15. package/Examples/Models/Stocks.ts +60 -0
  16. package/Examples/Models/User.ts +100 -0
  17. package/Examples/Models/UserPermission.ts +37 -0
  18. package/Examples/Models/index.ts +19 -0
  19. package/Examples/index-keycloack.ts +78 -0
  20. package/Examples/index.ts +40 -0
  21. package/Examples/keycloak.json +7 -0
  22. package/Examples/log/access.log +0 -0
  23. package/Examples/log/app.log +6057 -0
  24. package/Examples/log/errors.log +1526 -0
  25. package/Examples/package.json +46 -0
  26. package/Examples/tsconfig.json +21 -0
  27. package/base/ActionFilter.ts +71 -0
  28. package/base/BaseError.ts +26 -0
  29. package/base/BaseObject.ts +19 -0
  30. package/base/Behavior.ts +6 -0
  31. package/base/Component.ts +66 -0
  32. package/base/Configurable.ts +10 -0
  33. package/base/Controller.ts +84 -0
  34. package/base/DataErrorDbException.ts +16 -0
  35. package/base/DbConnection.ts +51 -0
  36. package/base/ForbiddenHttpException.ts +15 -0
  37. package/base/InvalidConfigException.ts +16 -0
  38. package/base/Model.ts +358 -0
  39. package/base/ModelManager.ts +14 -0
  40. package/base/NotFoundHttpException.ts +14 -0
  41. package/base/RestClient.ts +28 -0
  42. package/base/UnauthorizedHttpException.ts +17 -0
  43. package/base/ValidationHttpException.ts +14 -0
  44. package/base/db/Exception.ts +14 -0
  45. package/base/index.ts +17 -0
  46. package/decorator/Middleware.ts +9 -0
  47. package/decorator/controller.ts +22 -0
  48. package/decorator/enums/ControllerDecoratorParams.ts +5 -0
  49. package/decorator/get.ts +37 -0
  50. package/decorator/index.ts +3 -0
  51. package/decorator/post.ts +36 -0
  52. package/{BaseChyz.js → dist/BaseChyz.js} +29 -4
  53. package/dist/BaseChyz.js.map +1 -0
  54. package/{Chyz.js → dist/Chyz.js} +0 -0
  55. package/{Chyz.js.map → dist/Chyz.js.map} +0 -0
  56. package/{base → dist/base}/ActionFilter.js +0 -0
  57. package/{base → dist/base}/ActionFilter.js.map +0 -0
  58. package/{base → dist/base}/BaseError.js +0 -0
  59. package/{base → dist/base}/BaseError.js.map +0 -0
  60. package/{base → dist/base}/BaseObject.js +0 -0
  61. package/{base → dist/base}/BaseObject.js.map +0 -0
  62. package/{base → dist/base}/Behavior.js +0 -0
  63. package/{base → dist/base}/Behavior.js.map +0 -0
  64. package/{base → dist/base}/Component.js +0 -0
  65. package/{base → dist/base}/Component.js.map +0 -0
  66. package/{base → dist/base}/Configurable.js +0 -0
  67. package/{base → dist/base}/Configurable.js.map +0 -0
  68. package/{base → dist/base}/Controller.js +0 -0
  69. package/{base → dist/base}/Controller.js.map +0 -0
  70. package/{base → dist/base}/DataErrorDbException.js +0 -0
  71. package/{base → dist/base}/DataErrorDbException.js.map +0 -0
  72. package/{base → dist/base}/DbConnection.js +0 -0
  73. package/{base → dist/base}/DbConnection.js.map +0 -0
  74. package/{base → dist/base}/ForbiddenHttpException.js +0 -0
  75. package/{base → dist/base}/ForbiddenHttpException.js.map +0 -0
  76. package/{base → dist/base}/InvalidConfigException.js +0 -0
  77. package/{base → dist/base}/InvalidConfigException.js.map +0 -0
  78. package/{base → dist/base}/Model.js +32 -28
  79. package/dist/base/Model.js.map +1 -0
  80. package/dist/base/ModelManager.js +17 -0
  81. package/dist/base/ModelManager.js.map +1 -0
  82. package/{base → dist/base}/NotFoundHttpException.js +0 -0
  83. package/{base → dist/base}/NotFoundHttpException.js.map +0 -0
  84. package/{base → dist/base}/RestClient.js +0 -0
  85. package/{base → dist/base}/RestClient.js.map +0 -0
  86. package/{base → dist/base}/UnauthorizedHttpException.js +0 -0
  87. package/{base → dist/base}/UnauthorizedHttpException.js.map +0 -0
  88. package/{base → dist/base}/ValidationHttpException.js +0 -0
  89. package/{base → dist/base}/ValidationHttpException.js.map +0 -0
  90. package/{base → dist/base}/db/Exception.js +0 -0
  91. package/{base → dist/base}/db/Exception.js.map +0 -0
  92. package/{base → dist/base}/index.js +1 -0
  93. package/{base → dist/base}/index.js.map +1 -1
  94. package/{decorator → dist/decorator}/Middleware.js +0 -0
  95. package/{decorator → dist/decorator}/Middleware.js.map +0 -0
  96. package/{decorator → dist/decorator}/controller.js +0 -0
  97. package/{decorator → dist/decorator}/controller.js.map +0 -0
  98. package/{decorator → dist/decorator}/enums/ControllerDecoratorParams.js +0 -0
  99. package/{decorator → dist/decorator}/enums/ControllerDecoratorParams.js.map +0 -0
  100. package/{decorator → dist/decorator}/get.js +0 -0
  101. package/{decorator → dist/decorator}/get.js.map +0 -0
  102. package/{decorator → dist/decorator}/index.js +0 -0
  103. package/{decorator → dist/decorator}/index.js.map +0 -0
  104. package/{decorator → dist/decorator}/post.js +0 -0
  105. package/{decorator → dist/decorator}/post.js.map +0 -0
  106. package/{filters → dist/filters}/AccessControl.js +0 -0
  107. package/{filters → dist/filters}/AccessControl.js.map +0 -0
  108. package/{filters → dist/filters}/AccessRule.js +0 -0
  109. package/{filters → dist/filters}/AccessRule.js.map +0 -0
  110. package/{filters → dist/filters}/auth/AuthInterface.js +0 -0
  111. package/{filters → dist/filters}/auth/AuthInterface.js.map +0 -0
  112. package/{filters → dist/filters}/auth/AuthMethod.js +0 -0
  113. package/{filters → dist/filters}/auth/AuthMethod.js.map +0 -0
  114. package/{filters → dist/filters}/auth/HttpBasicAuth.js +0 -0
  115. package/{filters → dist/filters}/auth/HttpBasicAuth.js.map +0 -0
  116. package/{filters → dist/filters}/auth/HttpBearerAuth.js +0 -0
  117. package/{filters → dist/filters}/auth/HttpBearerAuth.js.map +0 -0
  118. package/{filters → dist/filters}/auth/HttpHeaderAuth.js +0 -0
  119. package/{filters → dist/filters}/auth/HttpHeaderAuth.js.map +0 -0
  120. package/{filters → dist/filters}/auth/JwtHttpBearerAuth.js +0 -0
  121. package/{filters → dist/filters}/auth/JwtHttpBearerAuth.js.map +0 -0
  122. package/{filters → dist/filters}/auth/KeyCloakHttpBearerAuth.js +0 -0
  123. package/{filters → dist/filters}/auth/KeyCloakHttpBearerAuth.js.map +0 -0
  124. package/{filters → dist/filters}/auth/index.js +0 -0
  125. package/{filters → dist/filters}/auth/index.js.map +0 -0
  126. package/{filters → dist/filters}/index.js +0 -0
  127. package/{filters → dist/filters}/index.js.map +0 -0
  128. package/{index.js → dist/index.js} +0 -0
  129. package/{index.js.map → dist/index.js.map} +0 -0
  130. package/dist/log/config/log4js.json +55 -0
  131. package/{model → dist/model}/RouteDefinition.js +0 -0
  132. package/{model → dist/model}/RouteDefinition.js.map +0 -0
  133. package/{requiments → dist/requiments}/Glob.js +0 -0
  134. package/{requiments → dist/requiments}/Glob.js.map +0 -0
  135. package/{requiments → dist/requiments}/ReflectUtil.js +0 -0
  136. package/{requiments → dist/requiments}/ReflectUtil.js.map +0 -0
  137. package/{requiments → dist/requiments}/Utils.js +0 -0
  138. package/{requiments → dist/requiments}/Utils.js.map +0 -0
  139. package/{validators → dist/validators}/BooleanValidator.js +0 -0
  140. package/{validators → dist/validators}/BooleanValidator.js.map +0 -0
  141. package/{validators → dist/validators}/CompareValidator.js +0 -0
  142. package/{validators → dist/validators}/CompareValidator.js.map +0 -0
  143. package/{validators → dist/validators}/DateValidator.js +0 -0
  144. package/{validators → dist/validators}/DateValidator.js.map +0 -0
  145. package/{validators → dist/validators}/EmailValidator.js +0 -0
  146. package/{validators → dist/validators}/EmailValidator.js.map +0 -0
  147. package/{validators → dist/validators}/Validator.js +0 -0
  148. package/{validators → dist/validators}/Validator.js.map +0 -0
  149. package/{web → dist/web}/IdentityInterface.js +0 -0
  150. package/{web → dist/web}/IdentityInterface.js.map +0 -0
  151. package/{web → dist/web}/WebUser.js +0 -0
  152. package/{web → dist/web}/WebUser.js.map +0 -0
  153. package/filters/AccessControl.ts +64 -0
  154. package/filters/AccessRule.ts +137 -0
  155. package/filters/auth/AuthInterface.ts +34 -0
  156. package/filters/auth/AuthMethod.ts +88 -0
  157. package/filters/auth/HttpBasicAuth.ts +7 -0
  158. package/filters/auth/HttpBearerAuth.ts +31 -0
  159. package/filters/auth/HttpHeaderAuth.ts +53 -0
  160. package/filters/auth/JwtHttpBearerAuth.ts +80 -0
  161. package/filters/auth/KeyCloakHttpBearerAuth.ts +115 -0
  162. package/filters/auth/index.ts +3 -0
  163. package/filters/index.ts +2 -0
  164. package/index.ts +14 -0
  165. package/model/RouteDefinition.ts +18 -0
  166. package/package-lock.json +5259 -0
  167. package/package.json +3 -3
  168. package/requiments/Glob.ts +9 -0
  169. package/requiments/ReflectUtil.ts +26 -0
  170. package/requiments/Utils.ts +57 -0
  171. package/tsconfig.json +18 -0
  172. package/validators/BooleanValidator.ts +0 -0
  173. package/validators/CompareValidator.ts +0 -0
  174. package/validators/DateValidator.ts +0 -0
  175. package/validators/EmailValidator.ts +0 -0
  176. package/validators/Validator.ts +27 -0
  177. package/web/IdentityInterface.ts +62 -0
  178. package/web/WebUser.ts +100 -0
  179. package/BaseChyz.js.map +0 -1
  180. package/base/Model.js.map +0 -1
package/base/Model.ts ADDED
@@ -0,0 +1,358 @@
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 BaseChyz from "../BaseChyz";
9
+ import Utils from "../requiments/Utils";
10
+ import {Component} from "./Component";
11
+ import {InvalidConfigException} from "./InvalidConfigException";
12
+ import {DatabaseError, DataTypes, ExclusionConstraintError, ForeignKeyConstraintError, Model as SModel, TimeoutError, UniqueConstraintError, ValidationError,} from "sequelize";
13
+ import {Exception} from "./db/Exception";
14
+
15
+ export {DataTypes, NOW} from "sequelize";
16
+
17
+ export interface Relation{
18
+ type: "hasOne" | "hasMany" | "belongsToMany" | "belongsTo",
19
+ allowNull?:boolean,
20
+ sourceKey:string,
21
+ model:SModel,
22
+ foreignKey:string,
23
+ name?:string,
24
+ through?:any,
25
+ as?:string
26
+ }
27
+
28
+ /**
29
+ * ValidateMe.init({
30
+ bar: {
31
+ type: Sequelize.STRING,
32
+ validate: {
33
+ is: ["^[a-z]+$",'i'], // will only allow letters
34
+ is: /^[a-z]+$/i, // same as the previous example using real RegExp
35
+ not: ["[a-z]",'i'], // will not allow letters
36
+ isEmail: true, // checks for email format (foo@bar.com)
37
+ isUrl: true, // checks for url format (http://foo.com)
38
+ isIP: true, // checks for IPv4 (129.89.23.1) or IPv6 format
39
+ isIPv4: true, // checks for IPv4 (129.89.23.1)
40
+ isIPv6: true, // checks for IPv6 format
41
+ isAlpha: true, // will only allow letters
42
+ isAlphanumeric: true, // will only allow alphanumeric characters, so "_abc" will fail
43
+ isNumeric: true, // will only allow numbers
44
+ isInt: true, // checks for valid integers
45
+ isFloat: true, // checks for valid floating point numbers
46
+ isDecimal: true, // checks for any numbers
47
+ isLowercase: true, // checks for lowercase
48
+ isUppercase: true, // checks for uppercase
49
+ notNull: true, // won't allow null
50
+ isNull: true, // only allows null
51
+ notEmpty: true, // don't allow empty strings
52
+ equals: 'specific value', // only allow a specific value
53
+ contains: 'foo', // force specific substrings
54
+ notIn: [['foo', 'bar']], // check the value is not one of these
55
+ isIn: [['foo', 'bar']], // check the value is one of these
56
+ notContains: 'bar', // don't allow specific substrings
57
+ len: [2,10], // only allow values with length between 2 and 10
58
+ isUUID: 4, // only allow uuids
59
+ isDate: true, // only allow date strings
60
+ isAfter: "2011-11-05", // only allow date strings after a specific date
61
+ isBefore: "2011-11-05", // only allow date strings before a specific date
62
+ max: 23, // only allow values <= 23
63
+ min: 23, // only allow values >= 23
64
+ isCreditCard: true, // check for valid credit card numbers
65
+
66
+ // Examples of custom validators:
67
+ isEven(value) {
68
+ if (parseInt(value) % 2 !== 0) {
69
+ throw new Error('Only even values are allowed!');
70
+ }
71
+ }
72
+ isGreaterThanOtherField(value) {
73
+ if (parseInt(value) <= parseInt(this.otherField)) {
74
+ throw new Error('Bar must be greater than otherField.');
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }, { sequelize });
80
+ */
81
+
82
+ export class Model extends Component {
83
+ _sequelize: any ;
84
+ private _tableName: string;
85
+ private _model: any;
86
+ private _attributes: any = {};
87
+ private _errors: any = {}
88
+
89
+
90
+ constructor(sequelize?: IDBDatabase) {
91
+ super();
92
+ this._tableName = this.constructor.name;
93
+ // this._sequelize = BaseChyz.getComponent("db").db;
94
+ if (sequelize != null)
95
+ this._sequelize = sequelize;
96
+ else
97
+ this._sequelize = BaseChyz.getComponent("db").db;
98
+
99
+ if (!Utils.isEmpty(this.attributes())) {
100
+ this._model = this._sequelize.define(this.constructor.name, this.attributes(), {
101
+ tableName: this.tableName(),
102
+ timestamps: false,
103
+ createdAt: false,
104
+ updateAt:false
105
+ });
106
+
107
+
108
+
109
+
110
+
111
+ } else {
112
+ throw new InvalidConfigException(BaseChyz.t("Invalid model configuration, is not emty attributes"))
113
+ }
114
+
115
+ // this.init();
116
+
117
+ }
118
+
119
+
120
+ /**
121
+ * Returns the database connection used by this AR class.
122
+ * By default, the "db" application component is used as the database connection.
123
+ * You may override this method if you want to use a different database connection.
124
+ * @return Connection the database connection used by this AR class.
125
+ */
126
+ public static getDb()
127
+ {
128
+ return BaseChyz.getComponent("db").db
129
+ }
130
+
131
+ get sequelize(): any {
132
+ return this._sequelize;
133
+ }
134
+
135
+ set sequelize(value: any) {
136
+ this._sequelize = value;
137
+ }
138
+
139
+
140
+ /**
141
+ *
142
+ */
143
+ get errors(): any {
144
+ return this._errors;
145
+ }
146
+
147
+ set errors(value: any) {
148
+ this._errors = value;
149
+ }
150
+
151
+ public init() {
152
+ BaseChyz.debug("Model init....", this.constructor.name)
153
+ /**
154
+ * init buraya
155
+ */
156
+ BaseChyz.debug("Relation init....", this.constructor.name)
157
+ for (const relation of this.relations()) {
158
+ let m = relation.model;
159
+
160
+ if(relation.type=="hasOne" ){
161
+ // @ts-ignore
162
+ delete relation.model
163
+ this.model().hasOne(m, relation );
164
+ }
165
+ //
166
+ if(relation.type=="hasMany" ){
167
+ // @ts-ignore
168
+ delete relation.model;
169
+ this.model().hasMany(m, relation );
170
+ }
171
+
172
+ if(relation.type=="belongsTo" ){
173
+ // @ts-ignore
174
+ delete relation.model;
175
+ this.model().belongsTo(m, relation );
176
+ }
177
+
178
+ if(relation.type=="belongsToMany" ){
179
+ // @ts-ignore
180
+ delete relation.model;
181
+ this.model().belongsToMany(m, relation );
182
+ }
183
+ }
184
+
185
+ }
186
+
187
+
188
+ public tableName() {
189
+ return this._tableName;
190
+ }
191
+
192
+ public formName() {
193
+ return this.constructor.name;
194
+ }
195
+
196
+ public rules() {
197
+ return []
198
+ }
199
+
200
+ public model() {
201
+ return this._model;
202
+ }
203
+
204
+ public async save(params = {}, options = {}) {
205
+ // now instantiate an object
206
+ let p = Object.assign(params, this._attributes)
207
+ let result: any;
208
+ try {
209
+ result = await this.model().create(p, options)
210
+ } catch (e) {
211
+ BaseChyz.debug(`Model[${this.constructor.name}].create`, e)
212
+ if (e instanceof ValidationError) {
213
+ let validationErrorItems = e.errors;
214
+ validationErrorItems.forEach(({message, path}) => {
215
+ // @ts-ignore
216
+ this._errors[path] = message
217
+ })
218
+
219
+ return false;
220
+ } else if (e instanceof DatabaseError) {
221
+
222
+ } else if (e instanceof TimeoutError) {
223
+
224
+ } else if (e instanceof UniqueConstraintError) {
225
+
226
+ } else if (e instanceof ForeignKeyConstraintError) {
227
+
228
+ } else if (e instanceof ExclusionConstraintError) {
229
+
230
+ }
231
+ throw new Exception(e.message, this.errors, e.code);
232
+ }
233
+
234
+ return result;
235
+
236
+ }
237
+
238
+ public async bulkCreate(params = {}, options = {}) {
239
+ // now instantiate an object
240
+ let p = Object.assign(params, this._attributes)
241
+ let result: any;
242
+ try {
243
+ result = await this.model().bulkCreate(p, options)
244
+ } catch (e) {
245
+ BaseChyz.debug(`Model[${this.constructor.name}].bulkCreate`, e)
246
+ if (e instanceof ValidationError) {
247
+ let validationErrorItems = e.errors;
248
+ validationErrorItems.forEach(({message, path}) => {
249
+ // @ts-ignore
250
+ this._errors[path] = message
251
+ })
252
+
253
+ return false;
254
+ } else if (e instanceof DatabaseError) {
255
+
256
+ } else if (e instanceof TimeoutError) {
257
+
258
+ } else if (e instanceof UniqueConstraintError) {
259
+
260
+ } else if (e instanceof ForeignKeyConstraintError) {
261
+
262
+ } else if (e instanceof ExclusionConstraintError) {
263
+
264
+ }
265
+ throw new Exception(e.message, this.errors, e.code);
266
+ }
267
+
268
+ return result;
269
+
270
+ }
271
+
272
+ public update(params = {}, options = {}) {
273
+ let p = Object.assign(params, this._attributes)
274
+ return this.model().update(p, options)
275
+ }
276
+
277
+ public delete(params = {}, options = {}) {
278
+ let p = Object.assign(params, this._attributes)
279
+ return this.model().delete(p, options)
280
+ }
281
+
282
+ /**
283
+ *
284
+ * @param args
285
+ */
286
+ public findOne(...args: any[]) {
287
+ return this._model.findOne(...arguments)
288
+ }
289
+
290
+ /**
291
+ *
292
+ * @param args
293
+ */
294
+ public findAll(...args: any[]) {
295
+ return this._model.findAll(...arguments)
296
+ }
297
+
298
+
299
+ public validate() {
300
+
301
+ }
302
+
303
+ /**
304
+ *
305
+ * @param data
306
+ * @param formName
307
+ */
308
+ public load(data: any, formName: any = null) {
309
+ let scope = formName === null ? this.formName() : formName;
310
+ if (scope === '' && !Utils.isEmpty(data)) {
311
+ this.setAttribute(data);
312
+ return true;
313
+ } else if (data[scope]) {
314
+ this.setAttribute(data[scope]);
315
+ return true;
316
+ }
317
+ return false;
318
+ }
319
+
320
+ public bulkLoad(data: any, formName: any = null) {
321
+ let scope = formName === null ? this.formName() : formName;
322
+ if (scope === '' && !Utils.isEmpty(data)) {
323
+ this.setAttribute(data);
324
+ return true;
325
+ } else if (data[scope]) {
326
+ this.setAttribute(data[scope]);
327
+ return true;
328
+ }
329
+ return false;
330
+ }
331
+
332
+ public setAttribute(values: any, safeOnly = true) {
333
+ if (values instanceof Object) {
334
+ let attributes = this.attributes();
335
+ for (const valueKey in values) {
336
+ if (Object.keys(attributes).indexOf(valueKey) != -1) {
337
+ // @ts-ignore
338
+ BaseChyz.debug("Model[" + this.formName() + "] attributes value set ", valueKey, values[valueKey])
339
+ this._attributes[valueKey] = values[valueKey];
340
+ }
341
+ }
342
+ }
343
+ }
344
+
345
+ public attributes() {
346
+ return {}
347
+ }
348
+
349
+ /**
350
+ * relation return array
351
+ * [
352
+ *
353
+ * ]
354
+ */
355
+ public relations():Relation[]{
356
+ return []
357
+ }
358
+ }
@@ -0,0 +1,14 @@
1
+ /*
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
+ */
9
+
10
+ export const ModelManager: any = {
11
+ _register(map: any) {
12
+ Object.assign(this, map)
13
+ }
14
+ }
@@ -0,0 +1,14 @@
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 {BaseError} from "./BaseError";
9
+
10
+ export class NotFoundHttpException extends BaseError {
11
+ constructor ( public message: string) {
12
+ super(message,404);
13
+ }
14
+ }
@@ -0,0 +1,28 @@
1
+ /*
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
+ */
9
+
10
+
11
+ import {Component} from "./Component";
12
+
13
+ const axios = require('axios')
14
+
15
+ export class RestClient extends Component {
16
+ public post(url: string, args: any[]) {
17
+ return axios.post(url, args)
18
+ }
19
+
20
+ public get(url: string, args: any[]) {
21
+ return axios.post(url, args)
22
+ }
23
+
24
+ public Rest(params: any) {
25
+ return axios(params)
26
+ }
27
+ }
28
+ export default new RestClient();
@@ -0,0 +1,17 @@
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 {BaseError} from "./BaseError";
9
+
10
+ export class UnauthorizedHttpException extends BaseError {
11
+ constructor ( public message: string) {
12
+ super(message,401);
13
+ }
14
+
15
+ }
16
+
17
+
@@ -0,0 +1,14 @@
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 {BaseError} from "./BaseError";
9
+
10
+ export class ValidationHttpException extends BaseError {
11
+ constructor ( public message: string) {
12
+ super(message,401);
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ import {BaseError} from "../BaseError";
2
+
3
+ export class Exception extends BaseError {
4
+ public errorInfo = [];
5
+ private code: string;
6
+
7
+ constructor(message: string, errorInfo:any = [], code = '', previous = null) {
8
+ super(message);
9
+ this.errorInfo = errorInfo;
10
+ this.name = 'Database Exception' // good practice
11
+ this.code = code // error code for responding to client
12
+ Error.captureStackTrace(this)
13
+ }
14
+ }
package/base/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from "./ActionFilter"
2
+ export * from "./BaseObject"
3
+ export * from "./BaseError"
4
+ export * from "./Behavior"
5
+ export * from "./Component"
6
+ export * from "./Configurable"
7
+ export * from "./Controller"
8
+ export * from "./DbConnection"
9
+ export * from "./ForbiddenHttpException"
10
+ export * from "./InvalidConfigException"
11
+ export * from "./NotFoundHttpException"
12
+ export * from "./UnauthorizedHttpException"
13
+ export * from "./DataErrorDbException"
14
+ export * from "./ValidationHttpException"
15
+ export * from "./Model"
16
+ export * from "./RestClient"
17
+ export * from "./ModelManager"
@@ -0,0 +1,9 @@
1
+ import "reflect-metadata";
2
+ import { ControllerDecoratorParams } from "./enums/ControllerDecoratorParams";
3
+ import { RequestHandler } from "express";
4
+
5
+ export function Middleware(middlewares: RequestHandler[]): Function {
6
+ return function(target: any, propertyKey: string): void {
7
+ Reflect.defineMetadata(ControllerDecoratorParams.Middleware, middlewares, target, propertyKey);
8
+ }
9
+ }
@@ -0,0 +1,22 @@
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
+ // @ts-ignore
9
+ import "reflect-metadata";
10
+ export const controller = (prefix: string = ''): ClassDecorator => {
11
+ return (target: any) => {
12
+ // @ts-ignore
13
+ Reflect.defineMetadata('prefix', prefix, target);
14
+
15
+ // Since routes are set by our methods this should almost never be true (except the controller has no methods)
16
+ // @ts-ignore
17
+ if (! Reflect.hasMetadata('routes', target)) {
18
+ // @ts-ignore
19
+ Reflect.defineMetadata('routes', [], target);
20
+ }
21
+ };
22
+ };
@@ -0,0 +1,5 @@
1
+ export enum ControllerDecoratorParams {
2
+ Path = 'path',
3
+ Method = 'method',
4
+ Middleware = 'middleware'
5
+ }
@@ -0,0 +1,37 @@
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
+ // @ts-ignore
8
+ import "reflect-metadata";
9
+ import {RouteDefinition} from '../model/RouteDefinition';
10
+
11
+ export const get = (path: string): MethodDecorator => {
12
+ // `target` equals our class, `propertyKey` equals our decorated method name
13
+ // @ts-ignore
14
+ return (target, propertyKey: string): void => {
15
+ // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
16
+ // To prevent any further validation simply set it to an empty array here.
17
+ // @ts-ignore
18
+ if (!Reflect.hasMetadata('routes', target.constructor)) {
19
+ // @ts-ignore
20
+ Reflect.defineMetadata('routes', [], target.constructor);
21
+ }
22
+
23
+ // Get the routes stored so far, extend it by the new route and re-set the metadata.
24
+ // @ts-ignore
25
+ const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
26
+
27
+ routes.push({
28
+ id:"",
29
+ requestMethod: 'get',
30
+ path,
31
+ methodName: propertyKey
32
+ });
33
+
34
+ // @ts-ignore
35
+ Reflect.defineMetadata('routes', routes, target.constructor);
36
+ };
37
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./controller"
2
+ export * from "./get"
3
+ export * from "./post"
@@ -0,0 +1,36 @@
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
+ // @ts-ignore
8
+ import "reflect-metadata";
9
+ import {RouteDefinition} from '../model/RouteDefinition';
10
+
11
+ export const post = (path: string): MethodDecorator => {
12
+ // `target` equals our class, `propertyKey` equals our decorated method name
13
+ // @ts-ignore
14
+ return (target, propertyKey: string): void => {
15
+ // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
16
+ // To prevent any further validation simply set it to an empty array here.
17
+ // @ts-ignore
18
+ if (!Reflect.hasMetadata('routes', target.constructor)) {
19
+ // @ts-ignore
20
+ Reflect.defineMetadata('routes', [], target.constructor);
21
+ }
22
+
23
+ // Get the routes stored so far, extend it by the new route and re-set the metadata.
24
+ // @ts-ignore
25
+ const routes = Reflect.getMetadata('routes', target.constructor) as Array<RouteDefinition>;
26
+
27
+ routes.push({
28
+ id:"",
29
+ requestMethod: 'post',
30
+ path,
31
+ methodName: propertyKey
32
+ });
33
+ // @ts-ignore
34
+ Reflect.defineMetadata('routes', routes, target.constructor);
35
+ };
36
+ };
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  require("reflect-metadata");
16
16
  const Utils_1 = __importDefault(require("./requiments/Utils"));
17
+ const base_1 = require("./base");
17
18
  const express = require("express");
18
19
  const log4js = require("log4js");
19
20
  const fs = require('fs');
@@ -71,6 +72,10 @@ class BaseChyz {
71
72
  if (this.config.controllerpath) {
72
73
  this.controllerpath = this.config.controllerpath;
73
74
  }
75
+ /**
76
+ * Model Register
77
+ */
78
+ this.loadModels();
74
79
  /**
75
80
  * Express Server
76
81
  */
@@ -182,6 +187,30 @@ class BaseChyz {
182
187
  var _a;
183
188
  return (_a = BaseChyz.middlewares[key]) !== null && _a !== void 0 ? _a : null;
184
189
  }
190
+ /**
191
+ * load model
192
+ */
193
+ loadModels() {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ let models = {};
196
+ let path = `${this._controllerpath}/../Models`;
197
+ fs.readdirSync(path).forEach((file) => {
198
+ if (file !== "index.ts") {
199
+ let model = require(`${path}/${file}`);
200
+ // @ts-ignore
201
+ let className = file.split(".")[0] + "Class";
202
+ if (model[className])
203
+ models[className.replace("Class", "")] = new model[className];
204
+ }
205
+ });
206
+ base_1.ModelManager._register(models);
207
+ for (const key of Object.keys(base_1.ModelManager)) {
208
+ if (key != "_register") {
209
+ base_1.ModelManager[key].init();
210
+ }
211
+ }
212
+ });
213
+ }
185
214
  /**
186
215
  * load contoller
187
216
  */
@@ -288,8 +317,4 @@ BaseChyz.express = express();
288
317
  BaseChyz.controllers = [];
289
318
  BaseChyz.components = {};
290
319
  BaseChyz.middlewares = {};
291
- process.on('uncaughtException', err => {
292
- BaseChyz.error('There was an uncaught error', err);
293
- process.exit(1); //mandatory (as per the Node.js docs)
294
- });
295
320
  //# sourceMappingURL=BaseChyz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseChyz.js","sourceRoot":"","sources":["../BaseChyz.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4BAA0B;AAI1B,+DAAuC;AACvC,iCAAoC;AAGpC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACvB,IAAI,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AACvC,IAAI,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAG/C,MAAqB,QAAQ;IAA7B;;QAIY,UAAK,GAAW,IAAI,CAAC;QAGrB,eAAU,GAAQ,MAAA,OAAO,CAAC,0BAA0B,CAAC,mCAAI,EAAE,CAAA;QAC3D,oBAAe,GAAW,aAAa,CAAA;IAsWnD,CAAC;IAhWG,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,CAAC,KAAU;QACpB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAI,cAAc,CAAC,KAAa;QAC5B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,IAAI;QACA,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;QAC7C,IAAI,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE9C;;WAEG;QACH,MAAM,CAAC,cAA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