exodus-framework 2.0.361 → 2.0.591

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 (79) hide show
  1. package/lib/app/app.d.ts +2 -3
  2. package/lib/app/app.d.ts.map +1 -1
  3. package/lib/app/app.js +24 -8
  4. package/lib/app/controller.d.ts +1 -1
  5. package/lib/app/controller.d.ts.map +1 -1
  6. package/lib/app/controller.js +2 -1
  7. package/lib/app/core.d.ts +3 -0
  8. package/lib/app/core.d.ts.map +1 -1
  9. package/lib/app/core.js +5 -0
  10. package/lib/app/index.d.ts +1 -0
  11. package/lib/app/index.d.ts.map +1 -1
  12. package/lib/app/index.js +9 -1
  13. package/lib/app/settings.d.ts +24 -0
  14. package/lib/app/settings.d.ts.map +1 -0
  15. package/lib/app/settings.js +130 -0
  16. package/lib/contracts/index.d.ts +1 -1
  17. package/lib/contracts/index.d.ts.map +1 -1
  18. package/lib/contracts/index.js +11 -11
  19. package/lib/contracts/messaging.d.ts +6 -0
  20. package/lib/contracts/messaging.d.ts.map +1 -1
  21. package/lib/contracts/messaging.js +1 -0
  22. package/lib/contracts/settings.d.ts +62 -0
  23. package/lib/contracts/settings.d.ts.map +1 -0
  24. package/lib/index.d.ts +0 -1
  25. package/lib/index.d.ts.map +1 -1
  26. package/lib/index.js +0 -12
  27. package/lib/middlewares/authentication.d.ts.map +1 -1
  28. package/lib/middlewares/authentication.js +9 -4
  29. package/lib/middlewares/file.js +3 -3
  30. package/lib/services/error.d.ts.map +1 -1
  31. package/lib/services/error.js +3 -10
  32. package/lib/services/express.d.ts.map +1 -1
  33. package/lib/services/express.js +12 -14
  34. package/lib/services/file.d.ts +3 -3
  35. package/lib/services/file.d.ts.map +1 -1
  36. package/lib/services/file.js +6 -6
  37. package/lib/services/rabitmq.d.ts.map +1 -1
  38. package/lib/services/rabitmq.js +2 -2
  39. package/lib/services/redis.js +3 -3
  40. package/lib/services/sequelize.d.ts.map +1 -1
  41. package/lib/services/sequelize.js +5 -5
  42. package/lib/services/task.d.ts +4 -4
  43. package/lib/services/task.d.ts.map +1 -1
  44. package/lib/services/task.js +15 -12
  45. package/lib/utils/database.d.ts.map +1 -1
  46. package/lib/utils/database.js +9 -9
  47. package/lib/utils/logger.d.ts.map +1 -1
  48. package/lib/utils/logger.js +13 -10
  49. package/package.json +3 -1
  50. package/lib/config/app.d.ts +0 -16
  51. package/lib/config/app.d.ts.map +0 -1
  52. package/lib/config/app.js +0 -25
  53. package/lib/config/auth.d.ts +0 -5
  54. package/lib/config/auth.d.ts.map +0 -1
  55. package/lib/config/auth.js +0 -11
  56. package/lib/config/cache.d.ts +0 -7
  57. package/lib/config/cache.d.ts.map +0 -1
  58. package/lib/config/cache.js +0 -12
  59. package/lib/config/db.d.ts +0 -13
  60. package/lib/config/db.d.ts.map +0 -1
  61. package/lib/config/db.js +0 -17
  62. package/lib/config/http.d.ts +0 -5
  63. package/lib/config/http.d.ts.map +0 -1
  64. package/lib/config/http.js +0 -10
  65. package/lib/config/index.d.ts +0 -9
  66. package/lib/config/index.d.ts.map +0 -1
  67. package/lib/config/index.js +0 -92
  68. package/lib/config/logger.d.ts +0 -7
  69. package/lib/config/logger.d.ts.map +0 -1
  70. package/lib/config/logger.js +0 -33
  71. package/lib/config/messaging.d.ts +0 -7
  72. package/lib/config/messaging.d.ts.map +0 -1
  73. package/lib/config/messaging.js +0 -12
  74. package/lib/config/task.d.ts +0 -6
  75. package/lib/config/task.d.ts.map +0 -1
  76. package/lib/config/task.js +0 -13
  77. package/lib/contracts/app.d.ts +0 -5
  78. package/lib/contracts/app.d.ts.map +0 -1
  79. /package/lib/contracts/{app.js → settings.js} +0 -0
@@ -27,7 +27,8 @@ class ApplicationHttpException extends ExodusErrorBase {
27
27
  this.handle();
28
28
  }
29
29
  handle() {
30
- (0, _logger.default)().warn(this.message, this.statusCode, this.data);
30
+ (0, _logger.default)().warn(this.message, this.statusCode);
31
+ (0, _logger.default)().warn(this.data);
31
32
  }
32
33
  }
33
34
  exports.ApplicationHttpException = ApplicationHttpException;
@@ -42,15 +43,7 @@ class ApplicationException extends ExodusErrorBase {
42
43
  }
43
44
  handle() {
44
45
  this.log(`${this.message}`, 'danger');
45
- (0, _logger.default)().error({
46
- message: this.message,
47
- /* erro: {
48
- name: this.error.name,
49
- message: this.error.message,
50
- stack: this.error.stack
51
- } */
52
- erro: this.error
53
- });
46
+ (0, _logger.default)().error(this.error);
54
47
  }
55
48
  }
56
49
  exports.ApplicationException = ApplicationException;
@@ -1 +1 @@
1
- {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/services/express.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAKrC,OAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,cAAM,cAAe,SAAQ,OAAQ,YAAW,QAAQ;IACtD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,UAAU,CAAS;IAErB,IAAI;IAuBV,aAAa;IAIb,YAAY,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY;IAiC3E,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;IAMtE,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAWzC,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;IAUtF,2BAA2B,QACpB,GAAG,OACH,OAAO,OACP,QAAQ,KAEV,YAAY,mBAoBf;IAEI,YAAY,CAAC,MAAM,EAAE,MAAM;IAyBjC,cAAc,CAAC,MAAM,EAAE,MAAM;CAG9B;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/services/express.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,OAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,cAAM,cAAe,SAAQ,OAAQ,YAAW,QAAQ;IACtD,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,UAAU,CAAS;IAErB,IAAI;IAuBV,aAAa;IAIb,YAAY,CAAC,WAAW,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY;IAiC3E,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;IAMtE,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAWzC,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY;IAUtF,2BAA2B,QACpB,GAAG,OACH,OAAO,OACP,QAAQ,KAEV,YAAY,mBAoBf;IAEI,YAAY,CAAC,MAAM,EAAE,MAAM;IAyBjC,cAAc,CAAC,MAAM,EAAE,MAAM;CAG9B;AAED,eAAe,cAAc,CAAC"}
@@ -5,17 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _service = _interopRequireDefault(require("../app/service"));
8
- var _app = require("../config/app");
9
- var _http = require("../config/http");
10
8
  var _logger = _interopRequireDefault(require("../utils/logger"));
11
9
  var _cors = _interopRequireDefault(require("cors"));
12
10
  var _express = _interopRequireDefault(require("express"));
13
11
  require("express-async-errors");
14
12
  var http = _interopRequireWildcard(require("http"));
15
- var _path = _interopRequireDefault(require("path"));
16
13
  var _pinoHttp = _interopRequireDefault(require("pino-http"));
17
- var _http3 = require("../contracts/http");
14
+ var _http2 = require("../contracts/http");
18
15
  var _error = require("./error");
16
+ var _app = require("../app");
19
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -30,9 +28,9 @@ class ExpressService extends _service.default {
30
28
  logger: (0, _logger.default)()
31
29
  });
32
30
  this.server = http.createServer(expss);
33
- expss.use('/public', _express.default.static(_path.default.join(__dirname, '../../public')));
31
+ expss.use('/public', _express.default.static(_app.Core.settings.getHttp().publicPath));
34
32
  expss.use(pino);
35
- expss.use('*', this.responseTypeMiddleware.bind(this));
33
+ expss.use(this.responseTypeMiddleware.bind(this));
36
34
  expss.use(_express.default.json());
37
35
  expss.use(_express.default.urlencoded({
38
36
  extended: false
@@ -44,9 +42,9 @@ class ExpressService extends _service.default {
44
42
  expss.use(this.handleAuthorizationFailure.bind(this));
45
43
  expss.use(this.handleNotFoud.bind(this));
46
44
  expss.use(this.handleRequestProcessFailure.bind(this));
47
- this.server.listen(_app.AppConfig.port, () => {
48
- (0, _logger.default)().info(`servidor iniciado na porta: ${_app.AppConfig.port}`);
49
- this.log(`🌍 Http Server Listering On: ${_app.AppConfig.port}`, 'success');
45
+ this.server.listen(_app.Core.settings.getAppication().port, () => {
46
+ (0, _logger.default)().info(`servidor iniciado na porta: ${_app.Core.settings.getAppication().port}`);
47
+ this.log(`🌍 Http Server Listering On: ${_app.Core.settings.getAppication().port}`, 'success');
50
48
  });
51
49
  }
52
50
  getHttpServer() {
@@ -54,14 +52,14 @@ class ExpressService extends _service.default {
54
52
  }
55
53
  sendResponse(objResponse, res, next) {
56
54
  objResponse.timestamp = Date.now();
57
- if (!objResponse.code) objResponse.code = _http3.EHttpResponseCode.successfullyProcessedInformation;
55
+ if (!objResponse.code) objResponse.code = _http2.EHttpResponseCode.successfullyProcessedInformation;
58
56
  res.status(objResponse.code);
59
57
  if (objResponse.location) {
60
58
  res.location(objResponse.location);
61
59
  delete objResponse.location;
62
60
  }
63
61
  let FormulatedResponse;
64
- switch (_http.HttpConfig.formulation) {
62
+ switch (_app.Core.settings.getHttp().formulation) {
65
63
  case 'direct':
66
64
  if (objResponse['data']) {
67
65
  FormulatedResponse = objResponse.data;
@@ -94,12 +92,12 @@ class ExpressService extends _service.default {
94
92
  message: 'Endereço não encontrado',
95
93
  type: 'warning',
96
94
  status: false,
97
- code: _http3.EHttpResponseCode.informationNotFound
95
+ code: _http2.EHttpResponseCode.informationNotFound
98
96
  }, res);
99
97
  }
100
98
  handleAuthorizationFailure(err, req, res, next) {
101
99
  if (err.name === 'UnauthorizedError') {
102
- throw new _error.ApplicationHttpException('Falha na autorização', _http3.EHttpResponseCode.informationUnauthorized);
100
+ throw new _error.ApplicationHttpException('Falha na autorização', _http2.EHttpResponseCode.informationUnauthorized);
103
101
  } else {
104
102
  next(err);
105
103
  }
@@ -131,7 +129,7 @@ class ExpressService extends _service.default {
131
129
  need.push(key);
132
130
  }
133
131
  }
134
- if (!pass) throw new _error.ApplicationHttpException('Requisição incompleta', _http3.EHttpResponseCode.incompleteRequest, 'error', {
132
+ if (!pass) throw new _error.ApplicationHttpException('Requisição incompleta', _http2.EHttpResponseCode.incompleteRequest, 'error', {
135
133
  need
136
134
  });
137
135
  }
@@ -1,12 +1,12 @@
1
1
  import Service from '../app/service';
2
- import { AppConfig } from '../config/app';
3
2
  import { IService } from '../contracts/service';
3
+ import { TFilePathSettings } from '../contracts/settings';
4
4
  declare class FileService extends Service implements IService {
5
5
  init(): Promise<void>;
6
6
  private checkPaths;
7
7
  private cleanTemp;
8
- save(filename: string, destiny: keyof typeof AppConfig.filePaths): Promise<string | boolean>;
9
- listFiles(origin: keyof typeof AppConfig.filePaths, cb: (file: string[]) => void): void;
8
+ save(filename: string, destiny: keyof TFilePathSettings): Promise<string | boolean>;
9
+ listFiles(origin: keyof TFilePathSettings, cb: (file: string[]) => void): void;
10
10
  }
11
11
  export default FileService;
12
12
  //# sourceMappingURL=file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,cAAM,WAAY,SAAQ,OAAQ,YAAW,QAAQ;IAC7C,IAAI;YAKI,UAAU;YAKV,SAAS;IASjB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,SAAS,CAAC,SAAS;IAatE,SAAS,CAAC,MAAM,EAAE,MAAM,OAAO,SAAS,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;CAIjF;AACD,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,cAAM,WAAY,SAAQ,OAAQ,YAAW,QAAQ;IAC7C,IAAI;YAKI,UAAU;YAKV,SAAS;IASjB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAa7D,SAAS,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;CAIxE;AACD,eAAe,WAAW,CAAC"}
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _service = _interopRequireDefault(require("../app/service"));
8
- var _app = require("../config/app");
9
8
  var _logger = _interopRequireDefault(require("../utils/logger"));
10
9
  var fs = _interopRequireWildcard(require("fs"));
11
10
  var fsPromisses = _interopRequireWildcard(require("fs/promises"));
11
+ var _app = require("../app");
12
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -18,7 +18,7 @@ class FileService extends _service.default {
18
18
  await this.cleanTemp();
19
19
  }
20
20
  async checkPaths() {
21
- for (const path of Object.values(_app.AppConfig.filePaths)) {
21
+ for (const path of Object.values(_app.Core.settings.getAppication().filePaths)) {
22
22
  !fs.existsSync(path) && fs.mkdirSync(path, {
23
23
  recursive: true
24
24
  });
@@ -27,7 +27,7 @@ class FileService extends _service.default {
27
27
  async cleanTemp() {
28
28
  this.listFiles('temporary', files => {
29
29
  files.forEach(file => {
30
- const p = _app.AppConfig.filePaths.temporary + '/' + file;
30
+ const p = _app.Core.settings.getAppication().filePaths.temporary + '/' + file;
31
31
  fs.rmSync(p, {
32
32
  recursive: true
33
33
  });
@@ -35,8 +35,8 @@ class FileService extends _service.default {
35
35
  });
36
36
  }
37
37
  async save(filename, destiny) {
38
- const p = _app.AppConfig.filePaths.temporary + '/' + filename;
39
- const d = _app.AppConfig.filePaths[destiny] + '/' + filename;
38
+ const p = _app.Core.settings.getAppication().filePaths.temporary + '/' + filename;
39
+ const d = _app.Core.settings.getAppication().filePaths[destiny] + '/' + filename;
40
40
  return await fsPromisses.rename(p, d).then(() => d).catch(e => {
41
41
  (0, _logger.default)().error({
42
42
  filename,
@@ -47,7 +47,7 @@ class FileService extends _service.default {
47
47
  });
48
48
  }
49
49
  listFiles(origin, cb) {
50
- const p = _app.AppConfig.filePaths[origin];
50
+ const p = _app.Core.settings.getAppication().filePaths[origin];
51
51
  fs.readdir(p, (_, file) => cb(file));
52
52
  }
53
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rabitmq.d.ts","sourceRoot":"","sources":["../../src/services/rabitmq.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAEL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,cAAc,CAAC;AACtB,OAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,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CAAC,EACR,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC;IA2BrC,cAAc,CAAC,MAAM,EAAE,wBAAwB;CAGhD;AAED,eAAe,eAAe,CAAC"}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _service = _interopRequireDefault(require("../app/service"));
8
- var _messaging = _interopRequireDefault(require("../config/messaging"));
9
8
  var _amqplib = _interopRequireDefault(require("amqplib"));
10
9
  var _error = require("./error");
10
+ var _app = require("../app");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  /**
13
13
  * Serviço de Mensageria
@@ -39,7 +39,7 @@ class RabbitMQService extends _service.default {
39
39
  if (this.connected && this.channel) return;else this.connected = true;
40
40
  try {
41
41
  this.log(`⌛️ Connecting to Rabbit-MQ Server`);
42
- this.connection = await _amqplib.default.connect(`amqp://${_messaging.default.user}:${_messaging.default.pass}@${_messaging.default.host}:5672`);
42
+ this.connection = await _amqplib.default.connect(`amqp://${_app.Core.settings.getMessaging().user}:${_app.Core.settings.getMessaging().pass}@${_app.Core.settings.getMessaging().host}:5672`);
43
43
  this.log(`✅ Rabbit MQ Connection is ready`);
44
44
  this.channel = await this.connection.createChannel();
45
45
  this.log(`🛸 Created RabbitMQ Channel successfully`);
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  var _service = _interopRequireDefault(require("../app/service"));
8
8
  var _redis = require("redis");
9
9
  var _error = require("./error");
10
- var _cache = _interopRequireDefault(require("../config/cache"));
10
+ var _app = require("../app");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  /**
13
13
  * Serviço de cache
@@ -22,8 +22,8 @@ class RedisService extends _service.default {
22
22
  //* Initialization
23
23
  async init() {
24
24
  this.client = (0, _redis.createClient)({
25
- url: `redis://${_cache.default.host}:${_cache.default.port}`,
26
- password: _cache.default.password
25
+ url: `redis://${_app.Core.settings.getCache().host}:${_app.Core.settings.getCache().port}`,
26
+ password: _app.Core.settings.getCache().password
27
27
  });
28
28
  await this.connect();
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sequelize.d.ts","sourceRoot":"","sources":["../../src/services/sequelize.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAKrC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAUhD,cAAM,gBAAiB,SAAQ,OAAQ,YAAW,QAAQ;IACxD,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;;IAM9B,IAAI;IAMJ,mBAAmB;IA4BzB,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,SAAI;IAerC,mBAAmB;IAGb,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA6C9C,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAwC9C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA8CvC,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE;CAG1C;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"sequelize.d.ts","sourceRoot":"","sources":["../../src/services/sequelize.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAWhD,cAAM,gBAAiB,SAAQ,OAAQ,YAAW,QAAQ;IACxD,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;;IAM9B,IAAI;IAMJ,mBAAmB;IA4BzB,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,SAAI;IAerC,mBAAmB;IAGb,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA6C9C,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAwC9C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKhC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IA8CvC,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE;CAG1C;AAED,eAAe,gBAAgB,CAAC"}
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _service = _interopRequireDefault(require("../app/service"));
8
- var _db = require("../config/db");
9
8
  var _Connection = require("../models/Connection");
10
9
  var _database = require("../utils/database");
11
10
  var _logger = _interopRequireDefault(require("../utils/logger"));
12
11
  var _sequelize = require("sequelize");
13
12
  var _error = require("./error");
13
+ var _app = require("../app");
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  /**
16
16
  * Serviço de gerênciamento do banco de dados
@@ -79,7 +79,7 @@ class SequelizeService extends _service.default {
79
79
  this.log('Connection data not found: ' + connection_uuid);
80
80
  return false;
81
81
  }
82
- const dbQueryName = `${_db.DatabaseConfig.service.database}_${name}`;
82
+ const dbQueryName = `${_app.Core.settings.getDatabase().service.database}_${name}`;
83
83
  const sequelize = new _sequelize.Sequelize({
84
84
  dialect: connData.dialect,
85
85
  username: connData.username,
@@ -113,7 +113,7 @@ class SequelizeService extends _service.default {
113
113
  });
114
114
  }
115
115
  async deleteDB(connection_uuid, name) {
116
- const dbQueryName = `${_db.DatabaseConfig.service.database}_${name}`;
116
+ const dbQueryName = `${_app.Core.settings.getDatabase().service.database}_${name}`;
117
117
  const connData = await _Connection.Connection.findByPk(connection_uuid);
118
118
  if (!connData) {
119
119
  this.log('Connection data not found: ' + connection_uuid);
@@ -146,12 +146,12 @@ class SequelizeService extends _service.default {
146
146
  });
147
147
  }
148
148
  async getDB(uuid, name) {
149
- const dbQueryName = `${_db.DatabaseConfig.service.database}_${name}`;
149
+ const dbQueryName = `${_app.Core.settings.getDatabase().service.database}_${name}`;
150
150
  const queryId = `${uuid}@${dbQueryName}`;
151
151
  return this.connections.get(queryId);
152
152
  }
153
153
  async initDB(uuid, name) {
154
- const dbQueryName = `${_db.DatabaseConfig.service.database}_${name}`;
154
+ const dbQueryName = `${_app.Core.settings.getDatabase().service.database}_${name}`;
155
155
  const queryId = `${uuid}@${dbQueryName}`;
156
156
  if (this.connections.get(queryId)) {
157
157
  return false;
@@ -1,14 +1,15 @@
1
- import Service from '../app/service';
2
- import Singleton from '../app/singleton';
3
1
  import type { Job } from 'bullmq';
4
2
  import { Queue, Worker } from 'bullmq';
3
+ import Service from '../app/service';
4
+ import Singleton from '../app/singleton';
5
5
  import { IService } from '../contracts/service';
6
6
  declare abstract class TaskServiceBase extends Service implements IService {
7
+ protected jobsPath: string;
7
8
  abstract init(): Promise<void>;
8
9
  abstract registerJob(...args: any[]): Promise<void>;
10
+ setTaskPath(path: string): void;
9
11
  }
10
12
  export declare class TaskSchedulingService extends TaskServiceBase {
11
- private jobsPath;
12
13
  private jobs;
13
14
  init(): Promise<void>;
14
15
  registerJob(job: SchedulingTask): Promise<void>;
@@ -25,7 +26,6 @@ export declare abstract class SchedulingTask extends Singleton {
25
26
  getJobName(): string;
26
27
  }
27
28
  export declare class TaskQueueService extends TaskServiceBase {
28
- private jobsPath;
29
29
  private jobs;
30
30
  private connection;
31
31
  init(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/services/task.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC,OAAO,KAAK,EAAqB,GAAG,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKhD,uBAAe,eAAgB,SAAQ,OAAQ,YAAW,QAAQ;IAChE,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CACpD;AAGD,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAmB;IAEzB,IAAI;IAUG,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;YAG9C,aAAa;YAcb,cAAc;CAO7B;AACD,8BAAsB,cAAe,SAAQ,SAAS;IACpD,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE1B,UAAU;IAGV,SAAS;IAGT,UAAU;CAGlB;AAGD,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,UAAU,CAAoB;IA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AC;IAE9B,UAAU;IAoBjB,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAEjB,MAAM,CAAC,IAAI,EAAE,QAAQ;IAI3B,QAAQ;IAGR,QAAQ,CAAC,KAAK,EAAE,KAAK;IAGrB,SAAS;IAGT,SAAS,CAAC,MAAM,EAAE,MAAM;IAGxB,SAAS;IAIT,YAAY,IAAI,MAAM;IAG7B,QAAQ,CAAC,MAAM,CAEb,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,EAEzC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC;CACvB"}
@@ -4,24 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TaskSchedulingService = exports.TaskQueueService = exports.SchedulingTask = exports.QueueTask = void 0;
7
- var _service = _interopRequireDefault(require("../app/service"));
8
- var _singleton = _interopRequireDefault(require("../app/singleton"));
9
- var _task = _interopRequireDefault(require("../config/task"));
10
7
  var _bullmq = require("bullmq");
11
8
  var _fs = require("fs");
12
9
  var _nodeSchedule = require("node-schedule");
13
- var _cache = _interopRequireDefault(require("../config/cache"));
10
+ var _service = _interopRequireDefault(require("../app/service"));
11
+ var _singleton = _interopRequireDefault(require("../app/singleton"));
14
12
  var _error = require("./error");
13
+ var _app = require("../app");
15
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
15
  //* Base
17
- class TaskServiceBase extends _service.default {}
16
+ class TaskServiceBase extends _service.default {
17
+ jobsPath;
18
+ setTaskPath(path) {
19
+ this.jobsPath = path;
20
+ }
21
+ }
18
22
 
19
23
  //* Scheduler
20
24
  class TaskSchedulingService extends TaskServiceBase {
21
- jobsPath;
22
25
  jobs;
23
26
  async init() {
24
- this.jobsPath = _task.default.schedulerPath;
27
+ if (!this.jobsPath) {
28
+ return this.log('Tasks file path not found!', 'danger');
29
+ }
25
30
  this.jobs = [];
26
31
  this.log('Initializing jobs...', 'info');
27
32
  await this.importAllJobs();
@@ -69,16 +74,14 @@ class SchedulingTask extends _singleton.default {
69
74
  //* Queue
70
75
  exports.SchedulingTask = SchedulingTask;
71
76
  class TaskQueueService extends TaskServiceBase {
72
- jobsPath;
73
77
  jobs;
74
78
  connection;
75
79
  async init() {
76
- this.jobsPath = _task.default.queuePath;
77
80
  this.jobs = [];
78
81
  this.connection = {
79
- host: _cache.default.host,
80
- port: Number(_cache.default.port),
81
- password: _cache.default.password
82
+ host: _app.Core.settings.getCache().host,
83
+ port: Number(_app.Core.settings.getCache().port),
84
+ password: _app.Core.settings.getCache().password
82
85
  };
83
86
  this.log('Initializing jobs...', 'info');
84
87
 
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/utils/database.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,eAAO,MAAM,SAAS,WAYpB,CAAC;AAEH,eAAO,MAAM,QAAQ,WAYnB,CAAC"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/utils/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,eAAO,MAAM,SAAS,WAYpB,CAAC;AAEH,eAAO,MAAM,QAAQ,WAYnB,CAAC"}
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.serviceDB = exports.masterDB = void 0;
7
- var _db = require("../config/db");
8
7
  var _sequelize = require("sequelize");
9
8
  var _logger = _interopRequireDefault(require("./logger"));
9
+ var _app = require("../app");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  const serviceDB = exports.serviceDB = new _sequelize.Sequelize({
12
- database: _db.DatabaseConfig.service.database,
13
- dialect: _db.DatabaseConfig.master.dialect,
14
- username: _db.DatabaseConfig.master.username,
15
- password: _db.DatabaseConfig.master.password,
12
+ database: _app.Core.settings.getDatabase().service.database,
13
+ dialect: _app.Core.settings.getDatabase().master.dialect,
14
+ username: _app.Core.settings.getDatabase().master.username,
15
+ password: _app.Core.settings.getDatabase().master.password,
16
16
  define: {
17
17
  timestamps: true
18
18
  },
@@ -22,10 +22,10 @@ const serviceDB = exports.serviceDB = new _sequelize.Sequelize({
22
22
  }
23
23
  });
24
24
  const masterDB = exports.masterDB = new _sequelize.Sequelize({
25
- database: _db.DatabaseConfig.master.database,
26
- dialect: _db.DatabaseConfig.master.dialect,
27
- username: _db.DatabaseConfig.master.username,
28
- password: _db.DatabaseConfig.master.password,
25
+ database: _app.Core.settings.getDatabase().master.database,
26
+ dialect: _app.Core.settings.getDatabase().master.dialect,
27
+ username: _app.Core.settings.getDatabase().master.username,
28
+ password: _app.Core.settings.getDatabase().master.password,
29
29
  define: {
30
30
  timestamps: true
31
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,oCAuCX,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAOA,QAAA,MAAM,MAAM,oCA4CX,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -4,40 +4,43 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _logger = require("../config/logger");
8
7
  var _fs = require("fs");
8
+ var _path = _interopRequireDefault(require("path"));
9
9
  var _pino = _interopRequireDefault(require("pino"));
10
10
  var _pinoMultiStream = require("pino-multi-stream");
11
+ var _app = require("../app");
12
+ var _dateFns = require("date-fns");
11
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
14
  const logger = () => {
13
- (0, _fs.mkdirSync)(_logger.LoggerConfig.path, {
15
+ const basePath = _path.default.resolve(_app.Core.settings.getLogger().path, (0, _dateFns.format)(new Date(), 'dd-MM-yyyy'), (0, _dateFns.format)(new Date(), 'HH_mm'));
16
+ (0, _fs.mkdirSync)(basePath, {
14
17
  recursive: true
15
18
  });
16
19
  const streams = [{
17
20
  level: 'error',
18
- stream: (0, _fs.createWriteStream)(_logger.LoggerConfig.path + '/error' + _logger.LoggerConfig.fileformat)
21
+ stream: (0, _fs.createWriteStream)(basePath + '/error' + _app.Core.settings.getLogger().fileformat)
19
22
  }, {
20
23
  level: 'info',
21
- stream: (0, _fs.createWriteStream)(_logger.LoggerConfig.path + '/info' + _logger.LoggerConfig.fileformat)
24
+ stream: (0, _fs.createWriteStream)(basePath + '/info' + _app.Core.settings.getLogger().fileformat)
22
25
  }, {
23
26
  level: 'fatal',
24
- stream: (0, _fs.createWriteStream)(_logger.LoggerConfig.path + '/fatal' + _logger.LoggerConfig.fileformat)
27
+ stream: (0, _fs.createWriteStream)(basePath + '/fatal' + _app.Core.settings.getLogger().fileformat)
25
28
  }, {
26
29
  level: 'warn',
27
- stream: (0, _fs.createWriteStream)(_logger.LoggerConfig.path + '/warn' + _logger.LoggerConfig.fileformat)
30
+ stream: (0, _fs.createWriteStream)(basePath + '/warn' + _app.Core.settings.getLogger().fileformat)
28
31
  }, {
29
32
  level: 'silent',
30
- stream: (0, _fs.createWriteStream)(_logger.LoggerConfig.path + '/silent' + _logger.LoggerConfig.fileformat)
33
+ stream: (0, _fs.createWriteStream)(basePath + '/silent' + _app.Core.settings.getLogger().fileformat)
31
34
  }, {
32
35
  level: 'trace',
33
- stream: (0, _fs.createWriteStream)(_logger.LoggerConfig.path + '/trace' + _logger.LoggerConfig.fileformat)
36
+ stream: (0, _fs.createWriteStream)(basePath + '/trace' + _app.Core.settings.getLogger().fileformat)
34
37
  }];
35
- _logger.LoggerConfig.console ?? streams.push({
38
+ _app.Core.settings.getLogger().console ?? streams.push({
36
39
  stream: process.stdout
37
40
  });
38
41
  return (0, _pino.default)({
39
42
  name: 'exodus',
40
- level: _logger.LoggerConfig.level,
43
+ level: _app.Core.settings.getLogger().level,
41
44
  // this MUST be set at the lowest level of the
42
45
  timestamp: () => `,"time":"${new Date().toJSON()}"`
43
46
  }, (0, _pinoMultiStream.multistream)(streams));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodus-framework",
3
- "version": "2.0.361",
3
+ "version": "2.0.591",
4
4
  "description": "Exodus Framework",
5
5
  "author": "jhownpaixao",
6
6
  "license": "ISC",
@@ -34,6 +34,7 @@
34
34
  "express-async-errors": "^2.0.0",
35
35
  "express-jwt": "^8.4.1",
36
36
  "fs": "^0.0.1-security",
37
+ "lodash": "^4.17.21",
37
38
  "mariadb": "^3.3.1",
38
39
  "multer": "^1.4.5-lts.1",
39
40
  "mysql2": "^3.11.0",
@@ -56,6 +57,7 @@
56
57
  "@types/amqplib": "^0.10.5",
57
58
  "@types/cors": "^2.8.17",
58
59
  "@types/express": "^4.17.21",
60
+ "@types/lodash": "^4.17.7",
59
61
  "@types/multer": "^1.4.12",
60
62
  "@types/node": "^22.5.0",
61
63
  "@types/node-schedule": "^2.1.7",
@@ -1,16 +0,0 @@
1
- import 'dotenv/config';
2
- export declare const AppConfig: {
3
- appId: string;
4
- port: string;
5
- host: string;
6
- description: string;
7
- clusters: string | number;
8
- filePaths: {
9
- temporary: string;
10
- image: string;
11
- audio: string;
12
- document: string;
13
- video: string;
14
- };
15
- };
16
- //# sourceMappingURL=app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/config/app.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAIvB,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAerB,CAAC"}
package/lib/config/app.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AppConfig = void 0;
7
- require("dotenv/config");
8
- var _os = _interopRequireDefault(require("os"));
9
- var _path = _interopRequireDefault(require("path"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const AppConfig = exports.AppConfig = {
12
- appId: process.env.APP_ID,
13
- port: process.env.APP_PORT,
14
- host: process.env.APP_URL || 'http://localhost',
15
- description: process.env.APP_DESCRIPTION || '',
16
- clusters: process.env.APP_CLUESTERS || _os.default.cpus().length,
17
- /* File */
18
- filePaths: {
19
- temporary: _path.default.resolve(__dirname, '..', '..', 'public', 'tmp'),
20
- image: _path.default.resolve(__dirname, '..', '..', 'public', 'images'),
21
- audio: _path.default.resolve(__dirname, '..', '..', 'public', 'audios'),
22
- document: _path.default.resolve(__dirname, '..', '..', 'public', 'documents'),
23
- video: _path.default.resolve(__dirname, '..', '..', 'public', 'videos')
24
- }
25
- };
@@ -1,5 +0,0 @@
1
- export declare const AuthConfig: {
2
- host: string;
3
- issuer: string;
4
- };
5
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/config/auth.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;CAItB,CAAC"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AuthConfig = void 0;
7
- const AuthConfig = exports.AuthConfig = {
8
- host: process.env.APP_SESSION_URL,
9
- /* APPAuthID:APPAuthPort/SECURITY_JWT_ISSUER */
10
- issuer: `exodus.session.hub:4000/${process.env.SECURITY_JWT_ISSUER}`
11
- };
@@ -1,7 +0,0 @@
1
- declare const CacheConfig: {
2
- host: string;
3
- port: string | number;
4
- password: string;
5
- };
6
- export default CacheConfig;
7
- //# sourceMappingURL=cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/config/cache.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;CAIhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const CacheConfig = {
8
- host: process.env.CACHE_HOST || 'localhost',
9
- port: process.env.CACHE_PORT || 6379,
10
- password: process.env.CACHE_USER || 'eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81'
11
- };
12
- var _default = exports.default = CacheConfig;
@@ -1,13 +0,0 @@
1
- import { Dialect } from 'sequelize';
2
- export declare const DatabaseConfig: {
3
- master: {
4
- database: string;
5
- dialect: Dialect;
6
- username: string;
7
- password: string;
8
- };
9
- service: {
10
- database: string;
11
- };
12
- };
13
- //# sourceMappingURL=db.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/config/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,eAAO,MAAM,cAAc;;;;;;;;;;CAU1B,CAAC"}