chyz 2.0.0-rc.4 → 2.0.0-rc.7

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.
package/BaseChyz.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import 'reflect-metadata';
2
- import { Logger } from "./base/Logger";
1
+ import { Logs } from "./base/Logs";
3
2
  export default class BaseChyz {
4
3
  private config;
5
4
  static app: string;
@@ -8,7 +7,7 @@ export default class BaseChyz {
8
7
  private _port;
9
8
  static db: any;
10
9
  static routes: any;
11
- static logger: Logger;
10
+ static logs: Logs;
12
11
  private static _validate;
13
12
  private _controllerpath;
14
13
  private static controllers;
@@ -31,9 +30,6 @@ export default class BaseChyz {
31
30
  static get validate(): any;
32
31
  static set validate(value: any);
33
32
  app(config?: any): BaseChyz;
34
- logProvider(): any;
35
- getLogger(): any;
36
- static logs(...args: any[]): any;
37
33
  static trace(...args: any[]): void;
38
34
  static debug(...args: any[]): void;
39
35
  static info(...args: any[]): void;
package/BaseChyz.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAoDrC,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAM;IACpB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,OAAO,MAAY;IAC1B,OAAO,CAAC,KAAK,CAAgB;IAC7B,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiB;IACzC,OAAO,CAAC,eAAe,CAAwB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B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAItB,CAAC,CAAC,IAAI,EAAE,MAAM;IAKrB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAKrD,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAUxD,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;WAQ7C,YAAY,CAAC,GAAG,EAAE,GAAG;WAKrB,cAAc,CAAC,GAAG,EAAE,GAAG;IAIrC;;OAEG;IACG,UAAU;IAyBhB;;OAEG;IACG,cAAc;IAmEb,UAAU;IAqCV,KAAK;CAwBf"}
package/BaseChyz.js CHANGED
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -12,14 +35,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
36
  };
14
37
  Object.defineProperty(exports, "__esModule", { value: true });
15
- require("reflect-metadata");
16
38
  const base_1 = require("./base");
17
39
  const Utils_1 = __importDefault(require("./requiments/Utils"));
18
- const Logger_1 = require("./base/Logger");
40
+ const Logs_1 = require("./base/Logs");
19
41
  const https = require('https');
20
42
  const express = require("express");
21
43
  const compression = require('compression');
22
- const log4js = require("log4js");
23
44
  const fs = require('fs');
24
45
  const validate = require('validate.js');
25
46
  /**
@@ -56,9 +77,28 @@ validate.validators.tokenString = (items, itemConstraints) => {
56
77
  }, {});
57
78
  return Utils_1.default.isEmpty(arrayItemErrors) ? null : { errors: arrayItemErrors };
58
79
  };
59
- var ip = require('ip');
60
- var bodyParser = require('body-parser');
61
- var methodOverride = require('method-override');
80
+ const ip = require('ip');
81
+ const bodyParser = require('body-parser');
82
+ const methodOverride = require('method-override');
83
+ const Server = express();
84
+ /**
85
+ * set request id
86
+ */
87
+ Object.defineProperty(Server.request, 'reqId', {
88
+ configurable: true,
89
+ enumerable: true,
90
+ writable: true
91
+ });
92
+ Object.defineProperty(Server.request, 'user', {
93
+ configurable: true,
94
+ enumerable: true,
95
+ writable: true
96
+ });
97
+ Object.defineProperty(Server.request, 'identity', {
98
+ configurable: true,
99
+ enumerable: true,
100
+ writable: true
101
+ });
62
102
  class BaseChyz {
63
103
  constructor() {
64
104
  this._port = 3001;
@@ -71,26 +111,6 @@ class BaseChyz {
71
111
  this._controllerpath = value;
72
112
  }
73
113
  init() {
74
- if (this.config.logger instanceof Logger_1.Logger)
75
- BaseChyz.logger = this.config.logger;
76
- /**
77
- * set request id
78
- */
79
- Object.defineProperty(BaseChyz.express.request, 'reqId', {
80
- configurable: true,
81
- enumerable: true,
82
- writable: true
83
- });
84
- Object.defineProperty(BaseChyz.express.request, 'user', {
85
- configurable: true,
86
- enumerable: true,
87
- writable: true
88
- });
89
- Object.defineProperty(BaseChyz.express.request, 'identity', {
90
- configurable: true,
91
- enumerable: true,
92
- writable: true
93
- });
94
114
  /**
95
115
  * server port setting
96
116
  */
@@ -142,6 +162,12 @@ class BaseChyz {
142
162
  * Config set
143
163
  */
144
164
  this.config = config;
165
+ /**
166
+ * log setting
167
+ */
168
+ if (this.config.logs instanceof Logs_1.Logs) {
169
+ BaseChyz.logs = this.config.logs;
170
+ }
145
171
  // logger setting
146
172
  // this.logProvider().level = log4js.levels.ALL;
147
173
  // this.logProvider().configure(this._logConfig);
@@ -163,7 +189,7 @@ class BaseChyz {
163
189
  if (middlewares) {
164
190
  for (const middlewareKey in middlewares) {
165
191
  let middleware1 = middlewares[middlewareKey];
166
- BaseChyz.logs().debug("Create middlewares ", middlewareKey);
192
+ BaseChyz.debug("Create middlewares ", middlewareKey);
167
193
  BaseChyz.middlewares[middlewareKey] = middleware1;
168
194
  // BaseChyz.middlewares[middlewareKey] = Utils.createObject(new middleware1.class, middleware1);
169
195
  }
@@ -171,35 +197,26 @@ class BaseChyz {
171
197
  this.init();
172
198
  return this;
173
199
  }
174
- logProvider() {
175
- return log4js;
176
- }
177
- getLogger() {
178
- return this.logProvider().getLogger(this.constructor.name);
179
- }
180
- static logs(...args) {
181
- return log4js.getLogger(this.name);
182
- }
183
200
  static trace(...args) {
184
- BaseChyz.logs().fatal(...arguments);
201
+ BaseChyz.logs.fatal(...arguments);
185
202
  }
186
203
  static debug(...args) {
187
- BaseChyz.logs().debug(...arguments);
204
+ BaseChyz.logs.debug(...arguments);
188
205
  }
189
206
  static info(...args) {
190
- BaseChyz.logs().info(...arguments);
207
+ BaseChyz.logs.info(...arguments);
191
208
  }
192
209
  static warn(...args) {
193
- BaseChyz.logs().warn(...arguments);
210
+ BaseChyz.logs.warn(...arguments);
194
211
  }
195
212
  static error(...args) {
196
- BaseChyz.logs().error(...arguments);
213
+ BaseChyz.logs.error(...arguments);
197
214
  }
198
215
  static fatal(...args) {
199
- BaseChyz.logs().fatal(...arguments);
216
+ BaseChyz.logs.fatal(...arguments);
200
217
  }
201
218
  static warning(...args) {
202
- BaseChyz.logs().warn(...arguments);
219
+ BaseChyz.logs.warn(...arguments);
203
220
  }
204
221
  static t(text) {
205
222
  return text;
@@ -246,6 +263,9 @@ class BaseChyz {
246
263
  models[className.replace("Class", "")] = new model[className];
247
264
  }
248
265
  });
266
+ /**
267
+ *
268
+ */
249
269
  base_1.ModelManager._register(models);
250
270
  for (const key of Object.keys(base_1.ModelManager)) {
251
271
  if (key != "_register") {
@@ -261,8 +281,8 @@ class BaseChyz {
261
281
  return __awaiter(this, void 0, void 0, function* () {
262
282
  // let articlesEndpoints: string[] = [];
263
283
  for (const file of fs.readdirSync(`${this._controllerpath}/`)) {
264
- let controller = require(`${this._controllerpath}/${file}`);
265
- // let controller = await import(`${this._controllerpath}/${file}`);
284
+ // let controller = require(`${this._controllerpath}/${file}`);
285
+ let controller = (yield Promise.resolve().then(() => __importStar(require(`${this._controllerpath}/${file}`))))[file.replace(".ts", "")];
266
286
  // This is our instantiated class
267
287
  const instance = new controller();
268
288
  BaseChyz.controllers.push(instance);
@@ -272,12 +292,12 @@ class BaseChyz {
272
292
  // Our `routes` array containing all our routes for this controller
273
293
  // @ts-ignore
274
294
  const routes = Reflect.getMetadata('routes', controller);
275
- BaseChyz.logs().debug("Controller load ", controller.name, `(${prefix})`);
295
+ BaseChyz.debug("Controller load ", controller.name, `(${prefix})`);
276
296
  if (routes) {
277
297
  routes.forEach(route => {
278
298
  let actionId = route.path == "/" || route.path == "" ? instance.defaultAction : route.path;
279
299
  route.id = actionId;
280
- BaseChyz.logs().debug("Controller route Path", prefix + (route.path.startsWith("/") ? route.path : `/${route.path}`));
300
+ BaseChyz.debug("Controller route Path", prefix + (route.path.startsWith("/") ? route.path : `/${route.path}`));
281
301
  BaseChyz.express[route.requestMethod](prefix + (route.path.startsWith("/") ? route.path : `/${route.path}`), (req, res, next) => __awaiter(this, void 0, void 0, function* () {
282
302
  try {
283
303
  BaseChyz.debug(`Call Request id ${instance.id}`);
@@ -320,7 +340,6 @@ class BaseChyz {
320
340
  BaseChyz.express.use(bodyParser.json({ limit: '1mb' }));
321
341
  BaseChyz.express.use(bodyParser.urlencoded({ limit: '1mb', extended: true })); // support encoded bodies
322
342
  BaseChyz.express.use(methodOverride());
323
- BaseChyz.express.use(methodOverride());
324
343
  // CORS
325
344
  BaseChyz.express.use(function (req, res, next) {
326
345
  // @ts-ignore
@@ -371,8 +390,8 @@ class BaseChyz {
371
390
  }
372
391
  }
373
392
  exports.default = BaseChyz;
374
- BaseChyz.express = express();
375
- BaseChyz.logger = new Logger_1.Logger();
393
+ BaseChyz.express = Server;
394
+ BaseChyz.logs = new Logs_1.Logs();
376
395
  BaseChyz._validate = validate;
377
396
  BaseChyz.controllers = [];
378
397
  BaseChyz.components = {};
@@ -7,10 +7,10 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.CBaseObject = void 0;
10
- const Logger_1 = require("./Logger");
10
+ const index_1 = require("../index");
11
11
  class CBaseObject {
12
12
  init() {
13
- Logger_1.Logger.debug("BaseObject init.....");
13
+ index_1.BaseChyz.debug("BaseObject init.....");
14
14
  }
15
15
  }
16
16
  exports.CBaseObject = CBaseObject;
@@ -0,0 +1,2 @@
1
+ export { Request, Response, NextFunction } from "express";
2
+ //# sourceMappingURL=CRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CRequest.d.ts","sourceRoot":"","sources":["../../src/base/CRequest.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /*
3
+ *
4
+ * Copyright (c) 2022.. Chy Bilgisayar Bilisim
5
+ * Author: Cihan Ozturk
6
+ * E-mail: cihan@chy.com.tr
7
+ * Github:https://github.com/cihan53/
8
+ *
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
package/base/Logs.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { Configurable } from "./Configurable";
2
+ export declare class Logs implements Configurable {
3
+ name: string;
4
+ configs: any;
5
+ constructor(name?: string, configs?: any);
6
+ init(): void;
7
+ /**
8
+ *
9
+ * @constructor
10
+ */
11
+ Provider(): any;
12
+ logs(...args: any[]): any;
13
+ debug(...args: any[]): void;
14
+ info(...args: any[]): void;
15
+ warn(...args: any[]): void;
16
+ error(...args: any[]): void;
17
+ fatal(...args: any[]): void;
18
+ warning(...args: any[]): void;
19
+ }
20
+ declare const _default: Logs;
21
+ export default _default;
22
+ //# sourceMappingURL=Logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logs.d.ts","sourceRoot":"","sources":["../../src/base/Logs.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,qBAAa,IAAK,YAAW,YAAY;IAE9B,IAAI,SAAyB;IAC7B,OAAO,EAAE,GAAG,CAA6C;gBAGpD,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;IASxC,IAAI;IAKJ;;;OAGG;IACI,QAAQ;IAIR,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIhC;;AAED,wBAA0B"}
package/base/Logs.js ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ /*
3
+ *
4
+ * Copyright (c) 2022.. Chy Bilgisayar Bilisim
5
+ * Author: Cihan Ozturk
6
+ * E-mail: cihan@chy.com.tr
7
+ * Github:https://github.com/cihan53/
8
+ *
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.Logs = void 0;
12
+ const log4js = require("log4js");
13
+ class Logs {
14
+ constructor(name, configs) {
15
+ var _a;
16
+ this.name = this.constructor.name;
17
+ this.configs = (_a = require('../log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
18
+ if (name)
19
+ this.name = name;
20
+ if (configs)
21
+ this.configs = configs;
22
+ this.Provider().configure(this.configs);
23
+ }
24
+ init() {
25
+ this.Provider().configure(this.configs);
26
+ }
27
+ /**
28
+ *
29
+ * @constructor
30
+ */
31
+ Provider() {
32
+ return log4js;
33
+ }
34
+ logs(...args) {
35
+ return log4js.getLogger(this.name);
36
+ }
37
+ debug(...args) {
38
+ this.logs().debug(...arguments);
39
+ }
40
+ info(...args) {
41
+ this.logs().info(...arguments);
42
+ }
43
+ warn(...args) {
44
+ this.logs().warn(...arguments);
45
+ }
46
+ error(...args) {
47
+ this.logs().error(...arguments);
48
+ }
49
+ fatal(...args) {
50
+ this.logs().fatal(...arguments);
51
+ }
52
+ warning(...args) {
53
+ this.logs().warn(...arguments);
54
+ }
55
+ }
56
+ exports.Logs = Logs;
57
+ exports.default = new Logs();
@@ -4,6 +4,4 @@ export declare class RestClient extends Component {
4
4
  get(url: string, args: any[], headers?: any): any;
5
5
  Rest(params: any): any;
6
6
  }
7
- declare const _default: RestClient;
8
- export default _default;
9
7
  //# sourceMappingURL=RestClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../src/base/RestClient.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,qBAAa,UAAW,SAAQ,SAAS;IAC9B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI3C,IAAI,CAAC,MAAM,EAAE,GAAG;CAG1B;;AACD,wBAAgC"}
1
+ {"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../src/base/RestClient.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,qBAAa,UAAW,SAAQ,SAAS;IAC9B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,OAAO,GAAC,GAAM;IAI3C,IAAI,CAAC,MAAM,EAAE,GAAG;CAG1B"}
@@ -23,4 +23,3 @@ class RestClient extends Component_1.Component {
23
23
  }
24
24
  }
25
25
  exports.RestClient = RestClient;
26
- exports.default = new RestClient();
package/base/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { Logs } from "./Logs";
1
2
  export { BaseError } from "./BaseError";
2
3
  export { ActionFilter } from "./ActionFilter";
3
4
  export { Behavior } from "./Behavior";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAC,KAAK,EAAC,QAAQ,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,SAAS,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAC,yBAAyB,EAAC,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAC,KAAK,EAAC,QAAQ,EAAC,SAAS,EAAE,GAAG,EAAC,MAAM,SAAS,CAAA;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA"}
package/base/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModelManager = exports.RestClient = exports.NOW = exports.DataTypes = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.ActionFilter = exports.BaseError = void 0;
3
+ exports.ModelManager = exports.RestClient = exports.NOW = exports.DataTypes = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.ActionFilter = exports.BaseError = exports.Logs = void 0;
4
+ var Logs_1 = require("./Logs");
5
+ Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return Logs_1.Logs; } });
4
6
  var BaseError_1 = require("./BaseError");
5
7
  Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return BaseError_1.BaseError; } });
6
8
  var ActionFilter_1 = require("./ActionFilter");
package/index.d.ts CHANGED
@@ -1,14 +1,19 @@
1
- import RestClient from "./base/RestClient";
1
+ declare module "express-serve-static-core" {
2
+ interface Request {
3
+ identity: any;
4
+ }
5
+ }
6
+ import { RestClient } from "./base/RestClient";
2
7
  import BaseChyz from "./BaseChyz";
3
8
  /**
4
9
  *
5
10
  */
6
11
  declare const Chyz: BaseChyz;
7
- export { Request, Response, NextFunction } from "express";
12
+ export { Request, Response, NextFunction } from "./base/CRequest";
8
13
  export { RouteDefinition } from "./model/RouteDefinition";
9
14
  export { WebUser } from "./web/WebUser";
10
15
  export { BaseChyz, RestClient };
11
- export { ActionFilter, BaseError, Behavior, Component, Configurable, CWebController, DbConnection, ForbiddenHttpException, InvalidConfigException, InvalidArgumentException, NotFoundHttpException, UnauthorizedHttpException, DataErrorDbException, ValidationHttpException, Model, ModelManager, } from "./base";
16
+ export { Logs, ActionFilter, BaseError, Behavior, Component, Configurable, CWebController, DbConnection, ForbiddenHttpException, InvalidConfigException, InvalidArgumentException, NotFoundHttpException, UnauthorizedHttpException, DataErrorDbException, ValidationHttpException, Model, ModelManager, } from "./base";
12
17
  export * from "./filters";
13
18
  export * from "./filters/auth";
14
19
  export * from "./decorator";
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC;;GAEG;AACH,QAAA,MAAM,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YAAY,EACZ,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,EACL,YAAY,GACf,MAAM,QAAQ,CAAC;AAChB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,eAAe,IAAI,CAAC"}
package/index.js CHANGED
@@ -37,9 +37,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.utils = exports.ModelManager = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.BaseError = exports.ActionFilter = exports.RestClient = exports.BaseChyz = exports.WebUser = void 0;
41
- const RestClient_1 = __importDefault(require("./base/RestClient"));
42
- exports.RestClient = RestClient_1.default;
40
+ exports.utils = exports.ModelManager = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.BaseError = exports.ActionFilter = exports.Logs = exports.RestClient = exports.BaseChyz = exports.WebUser = void 0;
41
+ const RestClient_1 = require("./base/RestClient");
42
+ Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return RestClient_1.RestClient; } });
43
43
  const BaseChyz_1 = __importDefault(require("./BaseChyz"));
44
44
  exports.BaseChyz = BaseChyz_1.default;
45
45
  /**
@@ -49,6 +49,7 @@ const Chyz = new BaseChyz_1.default();
49
49
  var WebUser_1 = require("./web/WebUser");
50
50
  Object.defineProperty(exports, "WebUser", { enumerable: true, get: function () { return WebUser_1.WebUser; } });
51
51
  var base_1 = require("./base");
52
+ Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return base_1.Logs; } });
52
53
  Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return base_1.ActionFilter; } });
53
54
  Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_1.BaseError; } });
54
55
  Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return base_1.Behavior; } });
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "name": "chyz",
3
- "version": "2.0.0-rc.4",
4
- "main":"./index.js",
5
- "type": "./index.d.ts",
3
+ "version": "2.0.0-rc.7",
6
4
  "description": "Nodejs Micro service Framework",
7
5
  "scripts": {
8
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -50,6 +50,6 @@ export interface IdentityInterface {
50
50
  /**
51
51
  *
52
52
  */
53
- can(permissionName: string, params: any[], allowCaching: boolean): (boolean | null);
53
+ can(permissionName: string, params: any[], allowCaching: boolean): Promise<(boolean | null)>;
54
54
  }
55
55
  //# sourceMappingURL=IdentityInterface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdentityInterface.d.ts","sourceRoot":"","sources":["../../src/web/IdentityInterface.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAA;IAE7B;;;;;;;;OAQG;IACH,yBAAyB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAEzD;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAGnD;;OAEG;IACH,GAAG,CAAC,cAAc,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAI,YAAY,EAAE,OAAO,GAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAE1F"}
1
+ {"version":3,"file":"IdentityInterface.d.ts","sourceRoot":"","sources":["../../src/web/IdentityInterface.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAA;IAE7B;;;;;;;;OAQG;IACH,yBAAyB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAEzD;;;OAGG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAGnD;;OAEG;IACH,GAAG,CAAC,cAAc,EAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAI,YAAY,EAAE,OAAO,GAAI,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAE;CAEnG"}
package/base/Logger.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Configurable } from "./Configurable";
2
- export declare class Logger implements Configurable {
3
- configs: any;
4
- init(): void;
5
- /**
6
- *
7
- * @constructor
8
- */
9
- Provider(): any;
10
- static logs(...args: any[]): any;
11
- static debug(...args: any[]): void;
12
- static info(...args: any[]): void;
13
- static warn(...args: any[]): void;
14
- static error(...args: any[]): void;
15
- static fatal(...args: any[]): void;
16
- static warning(...args: any[]): void;
17
- }
18
- //# sourceMappingURL=Logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/base/Logger.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,qBAAa,MAAO,YAAW,YAAY;IAEhC,OAAO,EAAE,GAAG,CAA6C;IAEhE,IAAI;IAIJ;;;OAGG;IACH,QAAQ;IAIR,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIZ,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAIvC"}
package/base/Logger.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /*
3
- *
4
- * Copyright (c) 2022.. Chy Bilgisayar Bilisim
5
- * Author: Cihan Ozturk
6
- * E-mail: cihan@chy.com.tr
7
- * Github:https://github.com/cihan53/
8
- *
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.Logger = void 0;
12
- const log4js = require("log4js");
13
- class Logger {
14
- constructor() {
15
- var _a;
16
- this.configs = (_a = require('../log/config/log4js.json')) !== null && _a !== void 0 ? _a : {};
17
- }
18
- init() {
19
- }
20
- /**
21
- *
22
- * @constructor
23
- */
24
- Provider() {
25
- return log4js;
26
- }
27
- static logs(...args) {
28
- return log4js.getLogger(this.name);
29
- }
30
- static debug(...args) {
31
- Logger.logs().debug(...arguments);
32
- }
33
- static info(...args) {
34
- Logger.logs().info(...arguments);
35
- }
36
- static warn(...args) {
37
- Logger.logs().warn(...arguments);
38
- }
39
- static error(...args) {
40
- Logger.logs().error(...arguments);
41
- }
42
- static fatal(...args) {
43
- Logger.logs().fatal(...arguments);
44
- }
45
- static warning(...args) {
46
- Logger.logs().warn(...arguments);
47
- }
48
- }
49
- exports.Logger = Logger;