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
package/lib/app/app.d.ts CHANGED
@@ -1,16 +1,15 @@
1
- import { TApplicationCreationProps } from '../contracts/app';
2
1
  import { IService } from '../contracts/service';
3
2
  import Core from './core';
4
3
  declare class Exodus extends Core {
5
4
  private services;
6
- private props;
7
- constructor(props: TApplicationCreationProps);
5
+ constructor();
8
6
  start(): Promise<void>;
9
7
  initMaster(): Promise<void>;
10
8
  initCluster(): Promise<void>;
11
9
  createClusters(): Promise<void>;
12
10
  registerSingletonService(service: IService): void;
13
11
  initServices(): Promise<void>;
12
+ getVersion(): string | undefined;
14
13
  }
15
14
  export default Exodus;
16
15
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,IAAI,MAAM,QAAQ,CAAC;AAS1B,cAAM,MAAO,SAAQ,IAAI;IACvB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,KAAK,CAA4B;gBAG7B,KAAK,EAAE,yBAAyB;IAKtC,KAAK;IASL,UAAU;IAIV,WAAW;IAIX,cAAc;IAgBpB,wBAAwB,CAAC,OAAO,EAAE,QAAQ;IAGpC,YAAY;CAKnB;AACD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,IAAI,MAAM,QAAQ,CAAC;AAQ1B,cAAM,MAAO,SAAQ,IAAI;IACvB,OAAO,CAAC,QAAQ,CAAa;;IAOvB,KAAK;IASL,UAAU;IAOV,WAAW;IAIX,cAAc;IAgBpB,wBAAwB,CAAC,OAAO,EAAE,QAAQ;IAGpC,YAAY;IASlB,UAAU,IAAI,MAAM,GAAG,SAAS;CAUjC;AACD,eAAe,MAAM,CAAC"}
package/lib/app/app.js CHANGED
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _app = require("../config/app");
8
7
  var _cluster = _interopRequireDefault(require("cluster"));
8
+ var fs = _interopRequireWildcard(require("fs"));
9
+ var _path = _interopRequireDefault(require("path"));
9
10
  var _core = _interopRequireDefault(require("./core"));
11
+ 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); }
12
+ 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; }
10
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  /**
12
15
  * Classe da aplicação principal
@@ -17,12 +20,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
20
  */
18
21
  class Exodus extends _core.default {
19
22
  services;
20
- props;
21
23
 
22
24
  //* Initialization
23
- constructor(props) {
25
+ constructor() {
24
26
  super();
25
- this.props = props;
26
27
  this.services = [];
27
28
  }
28
29
  async start() {
@@ -35,7 +36,8 @@ class Exodus extends _core.default {
35
36
 
36
37
  //* Cluster Managment
37
38
  async initMaster() {
38
- this.log(`✨ Starting ${_app.AppConfig.description} · Clusters: ${_app.AppConfig.clusters}`);
39
+ this.log(`✨ Starting ${_core.default.settings.getAppication().description} · Clusters: ${_core.default.settings.getAppication().clusters}`);
40
+ this.log(`✨ Core version ${this.getVersion()}`);
39
41
  this.createClusters();
40
42
  }
41
43
  async initCluster() {
@@ -43,12 +45,12 @@ class Exodus extends _core.default {
43
45
  this.initServices();
44
46
  }
45
47
  async createClusters() {
46
- for (let i = 0; i < this.props.maxClusters; i++) {
48
+ for (let i = 0; i < _core.default.settings.getAppication().clusters; i++) {
47
49
  _cluster.default.fork();
48
50
  }
49
51
  _cluster.default.on('exit', (worker, _code, _signal) => {
50
52
  this.log(`Cluester ${worker.process.pid} foi encerrado`, 'warning');
51
- if (this.props.clustersRestarts) {
53
+ if (_core.default.settings.getAppication().clustersRestarts) {
52
54
  this.log(`Reiniciando cluster`, 'warning');
53
55
  _cluster.default.fork();
54
56
  }
@@ -61,7 +63,21 @@ class Exodus extends _core.default {
61
63
  }
62
64
  async initServices() {
63
65
  for (const service of this.services) {
64
- await service.init();
66
+ await service.init().catch(error => {
67
+ this.log(`Erro on starting service: ${error.message || 'unknow'}`, 'danger');
68
+ });
69
+ }
70
+ }
71
+
72
+ // *System
73
+ getVersion() {
74
+ try {
75
+ const packageJson = fs.readFileSync(_path.default.resolve(__dirname, '../../package.json'), 'utf8');
76
+ const packageData = JSON.parse(packageJson);
77
+ return packageData.version;
78
+ } catch (error) {
79
+ console.error('Error reading package.json:', error);
80
+ return undefined;
65
81
  }
66
82
  }
67
83
  }
@@ -1,7 +1,7 @@
1
1
  import { NextFunction, Response } from 'express';
2
2
  import { THttpResponse, TSocket, TSocketEventDataMap, TSocketEventHandle } from '../contracts';
3
3
  import Core from './core';
4
- declare abstract class HttpController extends Core {
4
+ export declare abstract class HttpController extends Core {
5
5
  constructor();
6
6
  protected send<D = any>(objResponse: THttpResponse<D>, res: Response, next?: NextFunction): void;
7
7
  protected validate(data: Record<string, any>): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/app/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,IAAI,MAAM,QAAQ,CAAC;AAS1B,uBAAe,cAAe,SAAQ,IAAI;;IAexC,SAAS,CAAC,I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;AAS1B,8BAAsB,cAAe,SAAQ,IAAI;;IAe/C,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,IAAI;IAIhG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG7C;AAUD,8BAAsB,gBAAiB,SAAQ,IAAI;;IAKjD,SAAS,CAAC,gBAAgB,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,SAC1E,aAAa,QAAQ,mBAAmB,CAAC,CAAC,CAAC;IAM1D,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM;CAGpC;AACD,qBAAa,aAAc,SAAQ,IAAI;IACrC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,KAAK,EAAE,MAAM,mBAAmB,CAAC;gBAE/B,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB;IAM7D,IAAI,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAInF,QAAQ;IAGR,SAAS;IAIT,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG;CAGjC;AAED,8BAAsB,mBAAoB,SAAQ,IAAI;;IAKpD,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM;CAGpC;AAED,eAAe,cAAc,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.SocketRequest = exports.SocketController = exports.MessagingController = void 0;
6
+ exports.default = exports.SocketRequest = exports.SocketController = exports.MessagingController = exports.HttpController = void 0;
7
7
  var _express = _interopRequireDefault(require("../services/express"));
8
8
  var _core = _interopRequireDefault(require("./core"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -45,6 +45,7 @@ class HttpController extends _core.default {
45
45
  * @class SocketController
46
46
  * @extends {Core}
47
47
  */
48
+ exports.HttpController = HttpController;
48
49
  class SocketController extends _core.default {
49
50
  constructor() {
50
51
  super();
package/lib/app/core.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { TLoggerLevel } from '../contracts/console';
2
+ import CoreSettings from './settings';
2
3
  declare abstract class Core {
4
+ static settings: CoreSettings;
3
5
  constructor();
4
6
  log(msg: string, level?: TLoggerLevel): void;
7
+ static setSettings(settings: CoreSettings): void;
5
8
  }
6
9
  export default Core;
7
10
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/app/core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAWpD,uBAAe,IAAI;;IAKV,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,YAAuB;CA0CvD;AAED,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/app/core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,YAAY,MAAM,YAAY,CAAC;AAWtC,uBAAe,IAAI;IACjB,MAAM,CAAC,QAAQ,eAAsB;;IAK9B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,YAAuB;IA2CtD,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY;CAG1C;AAED,eAAe,IAAI,CAAC"}
package/lib/app/core.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _cluster = _interopRequireDefault(require("cluster"));
8
8
  var _dateFns = require("date-fns");
9
+ var _settings = _interopRequireDefault(require("./settings"));
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
12
  * Class base responsável pelo gerênciamento RUNTIME da aplicação
@@ -17,6 +18,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
18
  * @class Core
18
19
  */
19
20
  class Core {
21
+ static settings = new _settings.default();
20
22
  constructor() {
21
23
  // #TODO
22
24
  }
@@ -57,5 +59,8 @@ class Core {
57
59
  params.push(msg);
58
60
  console.log(query, ...params);
59
61
  }
62
+ static setSettings(settings) {
63
+ this.settings = settings;
64
+ }
60
65
  }
61
66
  var _default = exports.default = Core;
@@ -3,4 +3,5 @@ export * from './controller';
3
3
  export { default as Core } from './core';
4
4
  export { default as Service } from './service';
5
5
  export { default as Singleton } from './singleton';
6
+ export { default as CoreSettings } from './settings';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC"}
package/lib/app/index.js CHANGED
@@ -7,7 +7,8 @@ var _exportNames = {
7
7
  Exodus: true,
8
8
  Core: true,
9
9
  Service: true,
10
- Singleton: true
10
+ Singleton: true,
11
+ CoreSettings: true
11
12
  };
12
13
  Object.defineProperty(exports, "Core", {
13
14
  enumerable: true,
@@ -15,6 +16,12 @@ Object.defineProperty(exports, "Core", {
15
16
  return _core.default;
16
17
  }
17
18
  });
19
+ Object.defineProperty(exports, "CoreSettings", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _settings.default;
23
+ }
24
+ });
18
25
  Object.defineProperty(exports, "Exodus", {
19
26
  enumerable: true,
20
27
  get: function () {
@@ -49,4 +56,5 @@ Object.keys(_controller).forEach(function (key) {
49
56
  var _core = _interopRequireDefault(require("./core"));
50
57
  var _service = _interopRequireDefault(require("./service"));
51
58
  var _singleton = _interopRequireDefault(require("./singleton"));
59
+ var _settings = _interopRequireDefault(require("./settings"));
52
60
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,24 @@
1
+ import 'dotenv/config';
2
+ import { GeneralSettings, TApplicationSettings, TAuthenticationSettings, TCacheSettings, THttpSettings, TdatabaseSettings, Tlogger, TmessagingSettings } from '../contracts/settings';
3
+ declare class CoreSettings {
4
+ application: Partial<TApplicationSettings>;
5
+ authentication: Partial<TAuthenticationSettings>;
6
+ cache: Partial<TCacheSettings>;
7
+ database: Partial<TdatabaseSettings>;
8
+ http: Partial<THttpSettings>;
9
+ logger: Partial<Tlogger>;
10
+ messaging: Partial<TmessagingSettings>;
11
+ defaults: GeneralSettings;
12
+ settings: GeneralSettings;
13
+ constructor();
14
+ protected mergeSettings(): void;
15
+ getAppication(): TApplicationSettings;
16
+ getAuthentication(): TAuthenticationSettings;
17
+ getCache(): TCacheSettings;
18
+ getDatabase(): TdatabaseSettings;
19
+ getHttp(): THttpSettings;
20
+ getLogger(): Tlogger;
21
+ getMessaging(): TmessagingSettings;
22
+ }
23
+ export default CoreSettings;
24
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/app/settings.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAKvB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,cAAM,YAAY;IAChB,WAAW,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;IAChD,cAAc,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAM;IACtD,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,CAAM;IACpC,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAM;IAC1C,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAM;IAClC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAM;IAC9B,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAM;IAE5C,QAAQ,EAAE,eAAe,CA2EvB;IACF,QAAQ,EAAE,eAAe,CAAC;;IAM1B,SAAS,CAAC,aAAa;IAavB,aAAa;IAGb,iBAAiB;IAGjB,QAAQ;IAGR,WAAW;IAGX,OAAO;IAGP,SAAS;IAGT,YAAY;CAGb;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("dotenv/config");
8
+ var _os = _interopRequireDefault(require("os"));
9
+ var _lodash = _interopRequireDefault(require("lodash"));
10
+ var _path = _interopRequireDefault(require("path"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ class CoreSettings {
13
+ application = {};
14
+ authentication = {};
15
+ cache = {};
16
+ database = {};
17
+ http = {};
18
+ logger = {};
19
+ messaging = {};
20
+ defaults = {
21
+ application: {
22
+ appId: process.env.APP_ID,
23
+ port: Number(process.env.APP_PORT),
24
+ host: process.env.APP_URL || 'http://localhost',
25
+ description: process.env.APP_DESCRIPTION || '',
26
+ clusters: Number(process.env.APP_CLUESTERS) || _os.default.cpus().length,
27
+ clustersRestarts: true,
28
+ /* File */
29
+ filePaths: {
30
+ temporary: _path.default.resolve(__dirname, '..', '..', 'public', 'tmp'),
31
+ image: _path.default.resolve(__dirname, '..', '..', 'public', 'images'),
32
+ audio: _path.default.resolve(__dirname, '..', '..', 'public', 'audios'),
33
+ document: _path.default.resolve(__dirname, '..', '..', 'public', 'documents'),
34
+ video: _path.default.resolve(__dirname, '..', '..', 'public', 'videos')
35
+ }
36
+ },
37
+ authentication: {
38
+ host: process.env.APP_SESSION_URL,
39
+ /* APPAuthID:APPAuthPort/SECURITY_JWT_ISSUER */
40
+ issuer: `exodus.session.hub:4000/${process.env.SECURITY_JWT_ISSUER}`
41
+ },
42
+ cache: {
43
+ host: process.env.CACHE_HOST || 'localhost',
44
+ port: Number(process.env.CACHE_PORT) || 6379,
45
+ password: process.env.CACHE_USER || 'eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81'
46
+ },
47
+ database: {
48
+ master: {
49
+ database: process.env.MASTER_DB_NAME || 'common',
50
+ dialect: process.env.MASTER_DB_DIALECT || 'mariadb',
51
+ username: process.env.MASTER_DB_USER || 'root',
52
+ password: process.env.MASTER_DB_PASS || ''
53
+ },
54
+ service: {
55
+ database: process.env.SERVICE_DB_NAME || 'unknow'
56
+ }
57
+ },
58
+ http: {
59
+ publicPath: '',
60
+ formulation: process.env.RESPONSE_FORMULATION_TYPE || 'standart'
61
+ },
62
+ logger: {
63
+ /**
64
+ * Diretório pardrão de logs
65
+ * @date 24/03/2023 - 20:19:18
66
+ *
67
+ */
68
+ path: '../../logs',
69
+ /**
70
+ * Formato de saída dos arquivos de logs
71
+ * @date 24/03/2023 - 20:19:18
72
+ *
73
+ */
74
+ fileformat: '.json',
75
+ /**
76
+ * Nível do logger
77
+ */
78
+ level: process.env.LOGGER_LEVEL || 'info',
79
+ /**
80
+ * Transportar logs para o console do prompt
81
+ * @date 24/03/2023 - 20:19:18
82
+ *
83
+ */
84
+ console: !!parseInt(process.env.LOGGER_CONSOLE) || false
85
+ },
86
+ messaging: {
87
+ user: process.env.MSG_USER || 'guest',
88
+ pass: process.env.MSG_PASS || 'guest',
89
+ host: process.env.MSG_HOST || 'localhost'
90
+ }
91
+ };
92
+ settings;
93
+ constructor() {
94
+ this.mergeSettings();
95
+ }
96
+ mergeSettings() {
97
+ this.settings = _lodash.default.merge({}, this.defaults, {
98
+ application: this.application,
99
+ authentication: this.authentication,
100
+ cache: this.cache,
101
+ database: this.database,
102
+ http: this.http,
103
+ logger: this.logger,
104
+ messaging: this.messaging
105
+ });
106
+ // console.log(this.settings);
107
+ }
108
+ getAppication() {
109
+ return this.settings.application;
110
+ }
111
+ getAuthentication() {
112
+ return this.settings.authentication;
113
+ }
114
+ getCache() {
115
+ return this.settings.cache;
116
+ }
117
+ getDatabase() {
118
+ return this.settings.database;
119
+ }
120
+ getHttp() {
121
+ return this.settings.http;
122
+ }
123
+ getLogger() {
124
+ return this.settings.logger;
125
+ }
126
+ getMessaging() {
127
+ return this.settings.messaging;
128
+ }
129
+ }
130
+ var _default = exports.default = CoreSettings;
@@ -1,10 +1,10 @@
1
- export * from './app';
2
1
  export * from './console';
3
2
  export * from './entity';
4
3
  export * from './http';
5
4
  export * from './messaging';
6
5
  export * from './service';
7
6
  export * from './session';
7
+ export * from './settings';
8
8
  export * from './singleton';
9
9
  export * from './socket';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAEzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
@@ -3,17 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _app = require("./app");
7
- Object.keys(_app).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _app[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _app[key];
14
- }
15
- });
16
- });
17
6
  var _console = require("./console");
18
7
  Object.keys(_console).forEach(function (key) {
19
8
  if (key === "default" || key === "__esModule") return;
@@ -80,6 +69,17 @@ Object.keys(_session).forEach(function (key) {
80
69
  }
81
70
  });
82
71
  });
72
+ var _settings = require("./settings");
73
+ Object.keys(_settings).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _settings[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _settings[key];
80
+ }
81
+ });
82
+ });
83
83
  var _singleton = require("./singleton");
84
84
  Object.keys(_singleton).forEach(function (key) {
85
85
  if (key === "default" || key === "__esModule") return;
@@ -3,6 +3,7 @@ export declare enum EMessagingQueue {
3
3
  test = "exodus.queue.test",
4
4
  accountCreated = "exodus.account.created",
5
5
  environmentCreated = "exodus.environment.created",
6
+ environmentDeleted = "exodus.environment.deleted",
6
7
  environmentUpdatedToken = "exodus.environment.updated.token"
7
8
  }
8
9
  export type TMessageQueueDataMap = {
@@ -16,6 +17,11 @@ export type TMessageQueueDataMap = {
16
17
  oldToken: string;
17
18
  newToken: string;
18
19
  };
20
+ [EMessagingQueue.environmentDeleted]: {
21
+ uuid: string;
22
+ token: string;
23
+ database: string;
24
+ };
19
25
  };
20
26
  export type TMessagingQueueHandler<K extends keyof TMessageQueueDataMap = any> = (data: TMessageQueueDataMap[K], ack: () => void) => void;
21
27
  export type TMessagingQueueEventList = Partial<Record<keyof TMessageQueueDataMap, TMessagingQueueHandler>>;
@@ -1 +1 @@
1
- {"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/contracts/messaging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElD,oBAAY,eAAe;IACzB,IAAI,sBAAsB;IAG1B,cAAc,2BAA2B;IAGzC,kBAAkB,+BAA+B;IACjD,uBAAuB,qCAAqC;CAC7D;AAGD,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;QACtB,IAAI,EAAE,GAAG,CAAC;KACX,CAAC;IACF,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC3C,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IACnD,CAAC,eAAe,CAAC,uBAAuB,CAAC,EAAE;QACzC,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,oBAAoB,GAAG,GAAG,IAAI,CAC/E,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAC7B,GAAG,EAAE,MAAM,IAAI,KAC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MessagingQueue = exports.EMessagingQueue = /*#__PURE__*/function (EMessagin
8
8
  EMessagingQueue["test"] = "exodus.queue.test";
9
9
  EMessagingQueue["accountCreated"] = "exodus.account.created";
10
10
  EMessagingQueue["environmentCreated"] = "exodus.environment.created";
11
+ EMessagingQueue["environmentDeleted"] = "exodus.environment.deleted";
11
12
  EMessagingQueue["environmentUpdatedToken"] = "exodus.environment.updated.token";
12
13
  return EMessagingQueue;
13
14
  }({}); // Mapeamento de tópicos para tipos
@@ -0,0 +1,62 @@
1
+ import { Dialect } from 'sequelize';
2
+ export type TFilePathSettings = {
3
+ temporary: string;
4
+ image: string;
5
+ audio: string;
6
+ document: string;
7
+ video: string;
8
+ };
9
+ export type TApplicationSettings = {
10
+ appId: string;
11
+ port: number;
12
+ host: string;
13
+ description: string;
14
+ clusters: number;
15
+ clustersRestarts: boolean;
16
+ filePaths: TFilePathSettings;
17
+ };
18
+ export type TAuthenticationSettings = {
19
+ host: string;
20
+ issuer: string;
21
+ };
22
+ export type TCacheSettings = {
23
+ host: string;
24
+ port: number;
25
+ password: string;
26
+ };
27
+ export type TdatabaseSettings = {
28
+ master: {
29
+ database: string;
30
+ dialect: Dialect;
31
+ username: string;
32
+ password: string;
33
+ };
34
+ service: {
35
+ database: string;
36
+ };
37
+ };
38
+ export type THttpSettings = {
39
+ publicPath: string;
40
+ formulation: 'standart' | 'direct';
41
+ };
42
+ export type Tlogger = {
43
+ path: string;
44
+ fileformat: '.json' | '.log';
45
+ level: 'warn' | 'info' | 'error' | 'trace';
46
+ console: boolean;
47
+ };
48
+ export type TmessagingSettings = {
49
+ user: string;
50
+ pass: string;
51
+ host: string;
52
+ };
53
+ export type GeneralSettings = {
54
+ application: TApplicationSettings;
55
+ authentication: TAuthenticationSettings;
56
+ cache: TCacheSettings;
57
+ database: TdatabaseSettings;
58
+ http: THttpSettings;
59
+ logger: Tlogger;
60
+ messaging: TmessagingSettings;
61
+ };
62
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +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MAAM,CAAC;IACb,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC3C,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,oBAAoB,CAAC;IAClC,cAAc,EAAE,uBAAuB,CAAC;IACxC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Exodus } from './app';
2
2
  export * from './contracts';
3
3
  export * from './app';
4
- export * from './config';
5
4
  export * from './controllers';
6
5
  export * from './middlewares';
7
6
  export * from './models';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,eAAe,MAAM,CAAC"}
package/lib/index.js CHANGED
@@ -29,18 +29,6 @@ Object.keys(_contracts).forEach(function (key) {
29
29
  }
30
30
  });
31
31
  });
32
- var _config = require("./config");
33
- Object.keys(_config).forEach(function (key) {
34
- if (key === "default" || key === "__esModule") return;
35
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
36
- if (key in exports && exports[key] === _config[key]) return;
37
- Object.defineProperty(exports, key, {
38
- enumerable: true,
39
- get: function () {
40
- return _config[key];
41
- }
42
- });
43
- });
44
32
  var _controllers = require("./controllers");
45
33
  Object.keys(_controllers).forEach(function (key) {
46
34
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,cAAM,wBAAyB,SAAQ,cAAc;IACnD,YAAY,EAAE,cAAc,CAOzB;CACJ;AAED,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,cAAM,wBAAyB,SAAQ,cAAc;IACnD,YAAY,EAAE,cAAc,CAYzB;CACJ;AAED,eAAe,wBAAwB,CAAC"}
@@ -4,18 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _app = require("../app");
7
8
  var _controller = _interopRequireDefault(require("../app/controller"));
8
- var _auth = require("../config/auth");
9
9
  var _session = require("../utils/session");
10
10
  var _expressJwt = require("express-jwt");
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  class AuthenticationMiddleware extends _controller.default {
13
13
  decryptToken = (0, _expressJwt.expressjwt)({
14
14
  secret: async () => {
15
- const api = new _session.SessionAPI();
16
- return (await api.getCertificate()).data;
15
+ try {
16
+ const api = new _session.SessionAPI();
17
+ return (await api.getCertificate()).data;
18
+ } catch (error) {
19
+ this.log('Não foi possível obter o certificado de segurança.', 'danger');
20
+ return '';
21
+ }
17
22
  },
18
- issuer: _auth.AuthConfig.issuer,
23
+ issuer: _app.Core.settings.getAuthentication().issuer,
19
24
  algorithms: ['RS256']
20
25
  });
21
26
  }
@@ -7,8 +7,8 @@ exports.default = void 0;
7
7
  var _controller = _interopRequireDefault(require("../app/controller"));
8
8
  var _multer = _interopRequireDefault(require("multer"));
9
9
  var fs = _interopRequireWildcard(require("fs"));
10
- var _app = require("../config/app");
11
10
  var _path = _interopRequireDefault(require("path"));
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 }; }
@@ -21,10 +21,10 @@ class FileMiddleware extends _controller.default {
21
21
  initStorage() {
22
22
  this.storage = _multer.default.diskStorage({
23
23
  destination: async (req, file, cb) => {
24
- !fs.existsSync(_app.AppConfig.filePaths.temporary) && fs.mkdirSync(_app.AppConfig.filePaths.temporary, {
24
+ !fs.existsSync(_app.Core.settings.getAppication().filePaths.temporary) && fs.mkdirSync(_app.Core.settings.getAppication().filePaths.temporary, {
25
25
  recursive: true
26
26
  });
27
- cb(null, _app.AppConfig.filePaths.temporary);
27
+ cb(null, _app.Core.settings.getAppication().filePaths.temporary);
28
28
  },
29
29
  filename: (req, file, cb) => {
30
30
  const name = Date.now() + _path.default.extname(file.originalname);
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/services/error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,cAAM,eAAgB,SAAQ,IAAI;;CAIjC;AAED,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,KAAK,EAAE,oBAAoB,CAAC;IACrC,IAAI,EAAE,OAAO,CAAC;gBAGnB,OAAO,EAAE,MAAM,EACf,UAAU,oBAAgC,EAC1C,KAAK,GAAE,oBAA8B,EACrC,IAAI,CAAC,EAAE,OAAO;IAUhB,OAAO,CAAC,MAAM;CAGf;AAED,qBAAa,oBAAqB,SAAQ,eAAe;IACvD,SAAgB,OAAO,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;gBAER,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAOxC,OAAO,CAAC,MAAM;CAaf"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/services/error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,IAAI,MAAM,aAAa,CA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