chyz 1.0.12-rc.14

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 (163) hide show
  1. package/BaseChyz.ts +316 -0
  2. package/Chyz.ts +11 -0
  3. package/Examples/Controllers/ApiController.ts +121 -0
  4. package/Examples/Controllers/PublicController.ts +44 -0
  5. package/Examples/Controllers/SiteController.ts +127 -0
  6. package/Examples/Models/Customer.ts +113 -0
  7. package/Examples/Models/Order.ts +48 -0
  8. package/Examples/Models/OrderItem.ts +26 -0
  9. package/Examples/Models/User.ts +80 -0
  10. package/Examples/index.ts +38 -0
  11. package/Examples/log/access.log +0 -0
  12. package/Examples/log/app.log +3264 -0
  13. package/Examples/log/errors.log +534 -0
  14. package/Examples/package.json +45 -0
  15. package/Examples/tsconfig.json +20 -0
  16. package/Examples/yarn.lock +2202 -0
  17. package/README.md +218 -0
  18. package/base/ActionFilter.ts +71 -0
  19. package/base/BaseError.ts +26 -0
  20. package/base/BaseObject.ts +19 -0
  21. package/base/Behavior.ts +6 -0
  22. package/base/Component.ts +66 -0
  23. package/base/Configurable.ts +10 -0
  24. package/base/Controller.ts +84 -0
  25. package/base/DataErrorDbException.ts +16 -0
  26. package/base/DbConnection.ts +51 -0
  27. package/base/ForbiddenHttpException.ts +15 -0
  28. package/base/InvalidConfigException.ts +16 -0
  29. package/base/Model.ts +254 -0
  30. package/base/NotFoundHttpException.ts +14 -0
  31. package/base/RestClient.ts +27 -0
  32. package/base/UnauthorizedHttpException.ts +16 -0
  33. package/base/ValidationHttpException.ts +14 -0
  34. package/base/db/Exception.ts +14 -0
  35. package/base/index.ts +16 -0
  36. package/decorator/Middleware.ts +9 -0
  37. package/decorator/controller.ts +22 -0
  38. package/decorator/enums/ControllerDecoratorParams.ts +5 -0
  39. package/decorator/get.ts +37 -0
  40. package/decorator/index.ts +3 -0
  41. package/decorator/post.ts +36 -0
  42. package/dist/BaseChyz.js +257 -0
  43. package/dist/BaseChyz.js.map +1 -0
  44. package/dist/Chyz.js +15 -0
  45. package/dist/Chyz.js.map +1 -0
  46. package/dist/base/ActionFilter.js +75 -0
  47. package/dist/base/ActionFilter.js.map +1 -0
  48. package/dist/base/BaseError.js +26 -0
  49. package/dist/base/BaseError.js.map +1 -0
  50. package/dist/base/BaseObject.js +20 -0
  51. package/dist/base/BaseObject.js.map +1 -0
  52. package/dist/base/Behavior.js +8 -0
  53. package/dist/base/Behavior.js.map +1 -0
  54. package/dist/base/Component.js +61 -0
  55. package/dist/base/Component.js.map +1 -0
  56. package/dist/base/Configurable.js +9 -0
  57. package/dist/base/Configurable.js.map +1 -0
  58. package/dist/base/Controller.js +75 -0
  59. package/dist/base/Controller.js.map +1 -0
  60. package/dist/base/DataErrorDbException.js +18 -0
  61. package/dist/base/DataErrorDbException.js.map +1 -0
  62. package/dist/base/DbConnection.js +53 -0
  63. package/dist/base/DbConnection.js.map +1 -0
  64. package/dist/base/ForbiddenHttpException.js +17 -0
  65. package/dist/base/ForbiddenHttpException.js.map +1 -0
  66. package/dist/base/InvalidConfigException.js +18 -0
  67. package/dist/base/InvalidConfigException.js.map +1 -0
  68. package/dist/base/Model.js +243 -0
  69. package/dist/base/Model.js.map +1 -0
  70. package/dist/base/NotFoundHttpException.js +18 -0
  71. package/dist/base/NotFoundHttpException.js.map +1 -0
  72. package/dist/base/RestClient.js +26 -0
  73. package/dist/base/RestClient.js.map +1 -0
  74. package/dist/base/UnauthorizedHttpException.js +18 -0
  75. package/dist/base/UnauthorizedHttpException.js.map +1 -0
  76. package/dist/base/ValidationHttpException.js +18 -0
  77. package/dist/base/ValidationHttpException.js.map +1 -0
  78. package/dist/base/db/Exception.js +16 -0
  79. package/dist/base/db/Exception.js.map +1 -0
  80. package/dist/base/index.js +29 -0
  81. package/dist/base/index.js.map +1 -0
  82. package/dist/decorator/Middleware.js +12 -0
  83. package/dist/decorator/Middleware.js.map +1 -0
  84. package/dist/decorator/controller.js +25 -0
  85. package/dist/decorator/controller.js.map +1 -0
  86. package/dist/decorator/enums/ControllerDecoratorParams.js +10 -0
  87. package/dist/decorator/enums/ControllerDecoratorParams.js.map +1 -0
  88. package/dist/decorator/get.js +37 -0
  89. package/dist/decorator/get.js.map +1 -0
  90. package/dist/decorator/index.js +16 -0
  91. package/dist/decorator/index.js.map +1 -0
  92. package/dist/decorator/post.js +37 -0
  93. package/dist/decorator/post.js.map +1 -0
  94. package/dist/filters/AccessControl.js +76 -0
  95. package/dist/filters/AccessControl.js.map +1 -0
  96. package/dist/filters/AccessRule.js +79 -0
  97. package/dist/filters/AccessRule.js.map +1 -0
  98. package/dist/filters/auth/AuthInterface.js +3 -0
  99. package/dist/filters/auth/AuthInterface.js.map +1 -0
  100. package/dist/filters/auth/AuthMethod.js +71 -0
  101. package/dist/filters/auth/AuthMethod.js.map +1 -0
  102. package/dist/filters/auth/HttpBasicAuth.js +8 -0
  103. package/dist/filters/auth/HttpBasicAuth.js.map +1 -0
  104. package/dist/filters/auth/HttpBearerAuth.js +33 -0
  105. package/dist/filters/auth/HttpBearerAuth.js.map +1 -0
  106. package/dist/filters/auth/HttpHeaderAuth.js +61 -0
  107. package/dist/filters/auth/HttpHeaderAuth.js.map +1 -0
  108. package/dist/filters/auth/JwtHttpBearerAuth.js +82 -0
  109. package/dist/filters/auth/JwtHttpBearerAuth.js.map +1 -0
  110. package/dist/filters/auth/index.js +16 -0
  111. package/dist/filters/auth/index.js.map +1 -0
  112. package/dist/filters/index.js +15 -0
  113. package/dist/filters/index.js.map +1 -0
  114. package/dist/index.js +28 -0
  115. package/dist/index.js.map +1 -0
  116. package/dist/log/config/log4js.json +55 -0
  117. package/dist/model/RouteDefinition.js +9 -0
  118. package/dist/model/RouteDefinition.js.map +1 -0
  119. package/dist/requiments/Glob.js +11 -0
  120. package/dist/requiments/Glob.js.map +1 -0
  121. package/dist/requiments/ReflectUtil.js +25 -0
  122. package/dist/requiments/ReflectUtil.js.map +1 -0
  123. package/dist/requiments/Utils.js +40 -0
  124. package/dist/requiments/Utils.js.map +1 -0
  125. package/dist/validators/BooleanValidator.js +2 -0
  126. package/dist/validators/BooleanValidator.js.map +1 -0
  127. package/dist/validators/CompareValidator.js +2 -0
  128. package/dist/validators/CompareValidator.js.map +1 -0
  129. package/dist/validators/DateValidator.js +2 -0
  130. package/dist/validators/DateValidator.js.map +1 -0
  131. package/dist/validators/EmailValidator.js +2 -0
  132. package/dist/validators/EmailValidator.js.map +1 -0
  133. package/dist/validators/Validator.js +28 -0
  134. package/dist/validators/Validator.js.map +1 -0
  135. package/dist/web/IdentityInterface.js +9 -0
  136. package/dist/web/IdentityInterface.js.map +1 -0
  137. package/dist/web/User.js +83 -0
  138. package/dist/web/User.js.map +1 -0
  139. package/filters/AccessControl.ts +64 -0
  140. package/filters/AccessRule.ts +137 -0
  141. package/filters/auth/AuthInterface.ts +34 -0
  142. package/filters/auth/AuthMethod.ts +88 -0
  143. package/filters/auth/HttpBasicAuth.ts +7 -0
  144. package/filters/auth/HttpBearerAuth.ts +31 -0
  145. package/filters/auth/HttpHeaderAuth.ts +53 -0
  146. package/filters/auth/JwtHttpBearerAuth.ts +81 -0
  147. package/filters/auth/index.ts +3 -0
  148. package/filters/index.ts +2 -0
  149. package/index.ts +14 -0
  150. package/log/config/log4js.json +55 -0
  151. package/model/RouteDefinition.ts +18 -0
  152. package/package.json +52 -0
  153. package/requiments/Glob.ts +9 -0
  154. package/requiments/ReflectUtil.ts +26 -0
  155. package/requiments/Utils.ts +57 -0
  156. package/tsconfig.json +18 -0
  157. package/validators/BooleanValidator.ts +0 -0
  158. package/validators/CompareValidator.ts +0 -0
  159. package/validators/DateValidator.ts +0 -0
  160. package/validators/EmailValidator.ts +0 -0
  161. package/validators/Validator.ts +27 -0
  162. package/web/IdentityInterface.ts +62 -0
  163. package/web/User.ts +96 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DbConnection = void 0;
16
+ /*
17
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
18
+ * Author: Cihan Ozturk
19
+ * E-mail: cihan@chy.com.tr
20
+ * Github:https://github.com/cihan53/
21
+ */
22
+ // @ts-ignore
23
+ const { Sequelize } = require("sequelize");
24
+ const Component_1 = require("./Component");
25
+ const BaseChyz_1 = __importDefault(require("../BaseChyz"));
26
+ class DbConnection extends Component_1.Component {
27
+ init() {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const sequelize = new Sequelize(this.database, this.username, this.password, this.options);
30
+ this._db = sequelize;
31
+ sequelize
32
+ .authenticate()
33
+ .then(() => {
34
+ BaseChyz_1.default.info('Connection has been established successfully.');
35
+ })
36
+ .catch((err) => {
37
+ BaseChyz_1.default.error('Unable to connect to the database:', err);
38
+ });
39
+ // await this.connect();
40
+ });
41
+ }
42
+ get db() {
43
+ return this._db;
44
+ }
45
+ set db(value) {
46
+ this._db = value;
47
+ }
48
+ transaction() {
49
+ return this.db.transaction();
50
+ }
51
+ }
52
+ exports.DbConnection = DbConnection;
53
+ //# sourceMappingURL=DbConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbConnection.js","sourceRoot":"","sources":["../../base/DbConnection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,aAAa;AACb,MAAM,EAAC,SAAS,EAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACzC,2CAAsC;AACtC,2DAAmC;AAEnC,MAAa,YAAa,SAAQ,qBAAS;IAUjC,IAAI;;YACN,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3F,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC;YACrB,SAAS;iBACJ,YAAY,EAAE;iBACd,IAAI,CAAC,GAAG,EAAE;gBACP,kBAAQ,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;YACnE,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,GAAQ,EAAE,EAAE;gBAChB,kBAAQ,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;YAE9D,CAAC,CAAC,CAAC;YAEP,wBAAwB;QAC5B,CAAC;KAAA;IAGD,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,IAAI,EAAE,CAAC,KAAU;QACb,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC;IACrB,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;CAEJ;AAvCD,oCAuCC"}
@@ -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.ForbiddenHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class ForbiddenHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message);
14
+ }
15
+ }
16
+ exports.ForbiddenHttpException = ForbiddenHttpException;
17
+ //# sourceMappingURL=ForbiddenHttpException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForbiddenHttpException.js","sourceRoot":"","sources":["../../base/ForbiddenHttpException.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAsC;AACtC,MAAa,sBAAuB,SAAQ,qBAAS;IACjD,YAAc,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CACJ;AAJD,wDAIC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
4
+ * Author: Cihan Ozturk
5
+ * E-mail: cihan@chy.com.tr
6
+ * Github:https://github.com/cihan53/
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.InvalidConfigException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class InvalidConfigException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.InvalidConfigException = InvalidConfigException;
18
+ //# sourceMappingURL=InvalidConfigException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvalidConfigException.js","sourceRoot":"","sources":["../../base/InvalidConfigException.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,2CAAsC;AAEtC,MAAa,sBAAuB,SAAQ,qBAAS;IACjD,YAAqB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;IAEpC,CAAC;CACJ;AAJD,wDAIC"}
@@ -0,0 +1,243 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.Model = exports.NOW = exports.DataTypes = void 0;
22
+ const BaseChyz_1 = __importDefault(require("../BaseChyz"));
23
+ const Utils_1 = __importDefault(require("../requiments/Utils"));
24
+ const Component_1 = require("./Component");
25
+ const InvalidConfigException_1 = require("./InvalidConfigException");
26
+ const sequelize_1 = require("sequelize");
27
+ const Exception_1 = require("./db/Exception");
28
+ var sequelize_2 = require("sequelize");
29
+ Object.defineProperty(exports, "DataTypes", { enumerable: true, get: function () { return sequelize_2.DataTypes; } });
30
+ Object.defineProperty(exports, "NOW", { enumerable: true, get: function () { return sequelize_2.NOW; } });
31
+ /**
32
+ * ValidateMe.init({
33
+ bar: {
34
+ type: Sequelize.STRING,
35
+ validate: {
36
+ is: ["^[a-z]+$",'i'], // will only allow letters
37
+ is: /^[a-z]+$/i, // same as the previous example using real RegExp
38
+ not: ["[a-z]",'i'], // will not allow letters
39
+ isEmail: true, // checks for email format (foo@bar.com)
40
+ isUrl: true, // checks for url format (http://foo.com)
41
+ isIP: true, // checks for IPv4 (129.89.23.1) or IPv6 format
42
+ isIPv4: true, // checks for IPv4 (129.89.23.1)
43
+ isIPv6: true, // checks for IPv6 format
44
+ isAlpha: true, // will only allow letters
45
+ isAlphanumeric: true, // will only allow alphanumeric characters, so "_abc" will fail
46
+ isNumeric: true, // will only allow numbers
47
+ isInt: true, // checks for valid integers
48
+ isFloat: true, // checks for valid floating point numbers
49
+ isDecimal: true, // checks for any numbers
50
+ isLowercase: true, // checks for lowercase
51
+ isUppercase: true, // checks for uppercase
52
+ notNull: true, // won't allow null
53
+ isNull: true, // only allows null
54
+ notEmpty: true, // don't allow empty strings
55
+ equals: 'specific value', // only allow a specific value
56
+ contains: 'foo', // force specific substrings
57
+ notIn: [['foo', 'bar']], // check the value is not one of these
58
+ isIn: [['foo', 'bar']], // check the value is one of these
59
+ notContains: 'bar', // don't allow specific substrings
60
+ len: [2,10], // only allow values with length between 2 and 10
61
+ isUUID: 4, // only allow uuids
62
+ isDate: true, // only allow date strings
63
+ isAfter: "2011-11-05", // only allow date strings after a specific date
64
+ isBefore: "2011-11-05", // only allow date strings before a specific date
65
+ max: 23, // only allow values <= 23
66
+ min: 23, // only allow values >= 23
67
+ isCreditCard: true, // check for valid credit card numbers
68
+
69
+ // Examples of custom validators:
70
+ isEven(value) {
71
+ if (parseInt(value) % 2 !== 0) {
72
+ throw new Error('Only even values are allowed!');
73
+ }
74
+ }
75
+ isGreaterThanOtherField(value) {
76
+ if (parseInt(value) <= parseInt(this.otherField)) {
77
+ throw new Error('Bar must be greater than otherField.');
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }, { sequelize });
83
+ */
84
+ class Model extends Component_1.Component {
85
+ constructor() {
86
+ super();
87
+ this._attributes = {};
88
+ this._errors = {};
89
+ this._tableName = this.constructor.name;
90
+ this.sequelize = BaseChyz_1.default.getComponent("db").db;
91
+ if (!Utils_1.default.isEmpty(this.attributes())) {
92
+ this._model = this.sequelize.define(this.constructor.name, this.attributes(), {
93
+ tableName: this.tableName(),
94
+ timestamps: false
95
+ });
96
+ }
97
+ else {
98
+ throw new InvalidConfigException_1.InvalidConfigException(BaseChyz_1.default.t("Invalid model configuration, is not emty attributes"));
99
+ }
100
+ this.init();
101
+ }
102
+ get errors() {
103
+ return this._errors;
104
+ }
105
+ set errors(value) {
106
+ this._errors = value;
107
+ }
108
+ init() {
109
+ BaseChyz_1.default.debug("Model init....", this.constructor.name);
110
+ }
111
+ tableName() {
112
+ return this._tableName;
113
+ }
114
+ formName() {
115
+ return this.constructor.name;
116
+ }
117
+ rules() {
118
+ return [];
119
+ }
120
+ model() {
121
+ return this._model;
122
+ }
123
+ save(params = {}, options = {}) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ // now instantiate an object
126
+ let p = Object.assign(params, this._attributes);
127
+ let result;
128
+ try {
129
+ result = yield this.model().create(p, options);
130
+ }
131
+ catch (e) {
132
+ BaseChyz_1.default.debug(`Model[${this.constructor.name}].create`, e);
133
+ if (e instanceof sequelize_1.ValidationError) {
134
+ let validationErrorItems = e.errors;
135
+ validationErrorItems.forEach(({ message, path }) => {
136
+ // @ts-ignore
137
+ this._errors[path] = message;
138
+ });
139
+ return false;
140
+ }
141
+ else if (e instanceof sequelize_1.DatabaseError) {
142
+ }
143
+ else if (e instanceof sequelize_1.TimeoutError) {
144
+ }
145
+ else if (e instanceof sequelize_1.UniqueConstraintError) {
146
+ }
147
+ else if (e instanceof sequelize_1.ForeignKeyConstraintError) {
148
+ }
149
+ else if (e instanceof sequelize_1.ExclusionConstraintError) {
150
+ }
151
+ throw new Exception_1.Exception(e.message, this.errors, e.code);
152
+ }
153
+ return result;
154
+ });
155
+ }
156
+ bulkCreate(params = {}, options = {}) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ // now instantiate an object
159
+ let p = Object.assign(params, this._attributes);
160
+ let result;
161
+ try {
162
+ result = yield this.model().bulkCreate(p, options);
163
+ }
164
+ catch (e) {
165
+ BaseChyz_1.default.debug(`Model[${this.constructor.name}].bulkCreate`, e);
166
+ if (e instanceof sequelize_1.ValidationError) {
167
+ let validationErrorItems = e.errors;
168
+ validationErrorItems.forEach(({ message, path }) => {
169
+ // @ts-ignore
170
+ this._errors[path] = message;
171
+ });
172
+ return false;
173
+ }
174
+ else if (e instanceof sequelize_1.DatabaseError) {
175
+ }
176
+ else if (e instanceof sequelize_1.TimeoutError) {
177
+ }
178
+ else if (e instanceof sequelize_1.UniqueConstraintError) {
179
+ }
180
+ else if (e instanceof sequelize_1.ForeignKeyConstraintError) {
181
+ }
182
+ else if (e instanceof sequelize_1.ExclusionConstraintError) {
183
+ }
184
+ throw new Exception_1.Exception(e.message, this.errors, e.code);
185
+ }
186
+ return result;
187
+ });
188
+ }
189
+ update(params = {}, options = {}) {
190
+ let p = Object.assign(params, this._attributes);
191
+ return this.model().update(p, options);
192
+ }
193
+ delete(params = {}, options = {}) {
194
+ let p = Object.assign(params, this._attributes);
195
+ return this.model().delete(p, options);
196
+ }
197
+ findOne(...args) {
198
+ return this._model.findOne(...arguments);
199
+ }
200
+ validate() {
201
+ }
202
+ load(data, formName = null) {
203
+ let scope = formName === null ? this.formName() : formName;
204
+ if (scope === '' && !Utils_1.default.isEmpty(data)) {
205
+ this.setAttribute(data);
206
+ return true;
207
+ }
208
+ else if (data[scope]) {
209
+ this.setAttribute(data[scope]);
210
+ return true;
211
+ }
212
+ return false;
213
+ }
214
+ bulkLoad(data, formName = null) {
215
+ let scope = formName === null ? this.formName() : formName;
216
+ if (scope === '' && !Utils_1.default.isEmpty(data)) {
217
+ this.setAttribute(data);
218
+ return true;
219
+ }
220
+ else if (data[scope]) {
221
+ this.setAttribute(data[scope]);
222
+ return true;
223
+ }
224
+ return false;
225
+ }
226
+ setAttribute(values, safeOnly = true) {
227
+ if (values instanceof Object) {
228
+ let attributes = this.attributes();
229
+ for (const valueKey in values) {
230
+ if (Object.keys(attributes).indexOf(valueKey) != -1) {
231
+ // @ts-ignore
232
+ BaseChyz_1.default.debug("Model[" + this.formName() + "] attributes value set ", valueKey, values[valueKey]);
233
+ this._attributes[valueKey] = values[valueKey];
234
+ }
235
+ }
236
+ }
237
+ }
238
+ attributes() {
239
+ return {};
240
+ }
241
+ }
242
+ exports.Model = Model;
243
+ //# sourceMappingURL=Model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Model.js","sourceRoot":"","sources":["../../base/Model.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;AAEH,2D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value: true });
9
+ exports.NotFoundHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class NotFoundHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.NotFoundHttpException = NotFoundHttpException;
18
+ //# sourceMappingURL=NotFoundHttpException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotFoundHttpException.js","sourceRoot":"","sources":["../../base/NotFoundHttpException.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAsC;AAEtC,MAAa,qBAAsB,SAAQ,qBAAS;IAChD,YAAqB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;IAEpC,CAAC;CACJ;AAJD,sDAIC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*
3
+ *
4
+ * Copyright (c) 2021.. 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 });
11
+ exports.RestClient = void 0;
12
+ const Component_1 = require("./Component");
13
+ const axios = require('axios');
14
+ class RestClient extends Component_1.Component {
15
+ post(url, args) {
16
+ return axios.post(url, args);
17
+ }
18
+ get(url, args) {
19
+ return axios.post(url, args);
20
+ }
21
+ Rest(params) {
22
+ return axios(params);
23
+ }
24
+ }
25
+ exports.RestClient = RestClient;
26
+ //# sourceMappingURL=RestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestClient.js","sourceRoot":"","sources":["../../base/RestClient.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAGH,2CAAsC;AAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAE9B,MAAa,UAAW,SAAQ,qBAAS;IAC9B,IAAI,CAAC,GAAW,EAAE,IAAW;QAChC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAChC,CAAC;IAEM,GAAG,CAAC,GAAW,EAAE,IAAW;QAC/B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAChC,CAAC;IAEM,IAAI,CAAC,MAAW;QACnB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAA;IACxB,CAAC;CACJ;AAZD,gCAYC"}
@@ -0,0 +1,18 @@
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.UnauthorizedHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class UnauthorizedHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.UnauthorizedHttpException = UnauthorizedHttpException;
18
+ //# sourceMappingURL=UnauthorizedHttpException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnauthorizedHttpException.js","sourceRoot":"","sources":["../../base/UnauthorizedHttpException.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAsC;AAEtC,MAAa,yBAA0B,SAAQ,qBAAS;IACpD,YAAqB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;IAEpC,CAAC;CACJ;AAJD,8DAIC"}
@@ -0,0 +1,18 @@
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.ValidationHttpException = void 0;
10
+ const BaseError_1 = require("./BaseError");
11
+ class ValidationHttpException extends BaseError_1.BaseError {
12
+ constructor(message) {
13
+ super(message);
14
+ this.message = message;
15
+ }
16
+ }
17
+ exports.ValidationHttpException = ValidationHttpException;
18
+ //# sourceMappingURL=ValidationHttpException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationHttpException.js","sourceRoot":"","sources":["../../base/ValidationHttpException.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,2CAAsC;AAEtC,MAAa,uBAAwB,SAAQ,qBAAS;IAClD,YAAqB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAQ;IAEpC,CAAC;CACJ;AAJD,0DAIC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Exception = void 0;
4
+ const BaseError_1 = require("../BaseError");
5
+ class Exception extends BaseError_1.BaseError {
6
+ constructor(message, errorInfo = [], code = '', previous = null) {
7
+ super(message);
8
+ this.errorInfo = [];
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
+ }
15
+ exports.Exception = Exception;
16
+ //# sourceMappingURL=Exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../base/db/Exception.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AAEvC,MAAa,SAAU,SAAQ,qBAAS;IAIpC,YAAY,OAAe,EAAE,YAAgB,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,GAAG,IAAI;QACvE,KAAK,CAAC,OAAO,CAAC,CAAC;QAJZ,cAAS,GAAG,EAAE,CAAC;QAKlB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA,CAAC,gBAAgB;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,CAAC,sCAAsC;QACvD,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;CACJ;AAXD,8BAWC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ActionFilter"), exports);
14
+ __exportStar(require("./BaseObject"), exports);
15
+ __exportStar(require("./BaseError"), exports);
16
+ __exportStar(require("./Behavior"), exports);
17
+ __exportStar(require("./Component"), exports);
18
+ __exportStar(require("./Configurable"), exports);
19
+ __exportStar(require("./Controller"), exports);
20
+ __exportStar(require("./DbConnection"), exports);
21
+ __exportStar(require("./ForbiddenHttpException"), exports);
22
+ __exportStar(require("./InvalidConfigException"), exports);
23
+ __exportStar(require("./NotFoundHttpException"), exports);
24
+ __exportStar(require("./UnauthorizedHttpException"), exports);
25
+ __exportStar(require("./DataErrorDbException"), exports);
26
+ __exportStar(require("./ValidationHttpException"), exports);
27
+ __exportStar(require("./Model"), exports);
28
+ __exportStar(require("./RestClient"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B;AAC9B,+CAA4B;AAC5B,8CAA2B;AAC3B,6CAA0B;AAC1B,8CAA2B;AAC3B,iDAA8B;AAC9B,+CAA4B;AAC5B,iDAA8B;AAC9B,2DAAwC;AACxC,2DAAwC;AACxC,0DAAuC;AACvC,8DAA2C;AAC3C,yDAAsC;AACtC,4DAAyC;AACzC,0CAAuB;AACvB,+CAA4B"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Middleware = void 0;
4
+ require("reflect-metadata");
5
+ const ControllerDecoratorParams_1 = require("./enums/ControllerDecoratorParams");
6
+ function Middleware(middlewares) {
7
+ return function (target, propertyKey) {
8
+ Reflect.defineMetadata(ControllerDecoratorParams_1.ControllerDecoratorParams.Middleware, middlewares, target, propertyKey);
9
+ };
10
+ }
11
+ exports.Middleware = Middleware;
12
+ //# sourceMappingURL=Middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Middleware.js","sourceRoot":"","sources":["../../decorator/Middleware.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,iFAA8E;AAG9E,SAAgB,UAAU,CAAC,WAA6B;IACpD,OAAO,UAAS,MAAW,EAAE,WAAmB;QAC5C,OAAO,CAAC,cAAc,CAAC,qDAAyB,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACnG,CAAC,CAAA;AACL,CAAC;AAJD,gCAIC"}
@@ -0,0 +1,25 @@
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.controller = void 0;
10
+ // @ts-ignore
11
+ require("reflect-metadata");
12
+ const controller = (prefix = '') => {
13
+ return (target) => {
14
+ // @ts-ignore
15
+ Reflect.defineMetadata('prefix', prefix, target);
16
+ // Since routes are set by our methods this should almost never be true (except the controller has no methods)
17
+ // @ts-ignore
18
+ if (!Reflect.hasMetadata('routes', target)) {
19
+ // @ts-ignore
20
+ Reflect.defineMetadata('routes', [], target);
21
+ }
22
+ };
23
+ };
24
+ exports.controller = controller;
25
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../decorator/controller.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,aAAa;AACb,4BAA2B;AACpB,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAkB,EAAE;IAC9D,OAAO,CAAC,MAAW,EAAE,EAAE;QACnB,aAAa;QACb,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjD,8GAA8G;QAC9G,aAAa;QACb,IAAI,CAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;YACzC,aAAa;YACb,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;SAChD;IACL,CAAC,CAAC;AACN,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ControllerDecoratorParams = void 0;
4
+ var ControllerDecoratorParams;
5
+ (function (ControllerDecoratorParams) {
6
+ ControllerDecoratorParams["Path"] = "path";
7
+ ControllerDecoratorParams["Method"] = "method";
8
+ ControllerDecoratorParams["Middleware"] = "middleware";
9
+ })(ControllerDecoratorParams = exports.ControllerDecoratorParams || (exports.ControllerDecoratorParams = {}));
10
+ //# sourceMappingURL=ControllerDecoratorParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControllerDecoratorParams.js","sourceRoot":"","sources":["../../../decorator/enums/ControllerDecoratorParams.ts"],"names":[],"mappings":";;;AAAA,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,0CAAa,CAAA;IACb,8CAAiB,CAAA;IACjB,sDAAyB,CAAA;AAC7B,CAAC,EAJW,yBAAyB,GAAzB,iCAAyB,KAAzB,iCAAyB,QAIpC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.get = void 0;
4
+ /*
5
+ * Copyright (c) 2021. Chy Bilgisayar Bilisim
6
+ * Author: Cihan Ozturk
7
+ * E-mail: cihan@chy.com.tr
8
+ * Github:https://github.com/cihan53/
9
+ */
10
+ // @ts-ignore
11
+ require("reflect-metadata");
12
+ const get = (path) => {
13
+ // `target` equals our class, `propertyKey` equals our decorated method name
14
+ // @ts-ignore
15
+ return (target, propertyKey) => {
16
+ // In case this is the first route to be registered the `routes` metadata is likely to be undefined at this point.
17
+ // To prevent any further validation simply set it to an empty array here.
18
+ // @ts-ignore
19
+ if (!Reflect.hasMetadata('routes', target.constructor)) {
20
+ // @ts-ignore
21
+ Reflect.defineMetadata('routes', [], target.constructor);
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);
26
+ routes.push({
27
+ id: "",
28
+ requestMethod: 'get',
29
+ path,
30
+ methodName: propertyKey
31
+ });
32
+ // @ts-ignore
33
+ Reflect.defineMetadata('routes', routes, target.constructor);
34
+ };
35
+ };
36
+ exports.get = get;
37
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../decorator/get.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,aAAa;AACb,4BAA0B;AAGnB,MAAM,GAAG,GAAG,CAAC,IAAY,EAAmB,EAAE;IACjD,4EAA4E;IAC5E,aAAa;IACb,OAAO,CAAC,MAAM,EAAE,WAAmB,EAAQ,EAAE;QACzC,kHAAkH;QAClH,0EAA0E;QAC1E,aAAa;QACb,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE;YACpD,aAAa;YACb,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;SAC5D;QAED,oFAAoF;QACpF,aAAa;QACb,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAA2B,CAAC;QAE3F,MAAM,CAAC,IAAI,CAAC;YACR,EAAE,EAAC,EAAE;YACL,aAAa,EAAE,KAAK;YACpB,IAAI;YACJ,UAAU,EAAE,WAAW;SAC1B,CAAC,CAAC;QAEH,aAAa;QACb,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACjE,CAAC,CAAC;AACN,CAAC,CAAC;AA1BW,QAAA,GAAG,OA0Bd"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./controller"), exports);
14
+ __exportStar(require("./get"), exports);
15
+ __exportStar(require("./post"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../decorator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA4B;AAC5B,wCAAqB;AACrB,yCAAsB"}