exodus-framework 2.0.816 → 2.0.817

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 (74) hide show
  1. package/lib/app/classes/broadcast.d.ts +16 -0
  2. package/lib/app/classes/broadcast.d.ts.map +1 -0
  3. package/lib/app/classes/broadcast.js +76 -0
  4. package/lib/app/classes/communication.d.ts +20 -0
  5. package/lib/app/classes/communication.d.ts.map +1 -0
  6. package/lib/app/classes/communication.js +53 -0
  7. package/lib/app/classes/event.d.ts +30 -0
  8. package/lib/app/classes/event.d.ts.map +1 -0
  9. package/lib/app/classes/event.js +88 -0
  10. package/lib/app/classes/managed.d.ts +53 -0
  11. package/lib/app/classes/managed.d.ts.map +1 -0
  12. package/lib/app/classes/managed.js +192 -0
  13. package/lib/app/classes/service.d.ts +23 -0
  14. package/lib/app/classes/service.d.ts.map +1 -0
  15. package/lib/app/classes/service.js +68 -0
  16. package/lib/app/classes/singleton.d.ts +8 -0
  17. package/lib/app/classes/singleton.d.ts.map +1 -0
  18. package/lib/app/{singleton.js → classes/singleton.js} +3 -3
  19. package/lib/app/classes/system.d.ts +6 -0
  20. package/lib/app/classes/system.d.ts.map +1 -0
  21. package/lib/app/classes/system.js +49 -0
  22. package/lib/app/controller.d.ts +6 -5
  23. package/lib/app/controller.d.ts.map +1 -1
  24. package/lib/app/controller.js +8 -7
  25. package/lib/app/core.d.ts +0 -30
  26. package/lib/app/core.d.ts.map +1 -1
  27. package/lib/app/core.js +1 -196
  28. package/lib/app/error.d.ts +3 -3
  29. package/lib/app/error.d.ts.map +1 -1
  30. package/lib/app/error.js +3 -3
  31. package/lib/app/exodus.d.ts +4 -4
  32. package/lib/app/exodus.d.ts.map +1 -1
  33. package/lib/app/exodus.js +23 -9
  34. package/lib/app/index.d.ts +2 -2
  35. package/lib/app/index.d.ts.map +1 -1
  36. package/lib/app/index.js +2 -2
  37. package/lib/app/settings.js +1 -1
  38. package/lib/contracts/singleton.d.ts +3 -4
  39. package/lib/contracts/singleton.d.ts.map +1 -1
  40. package/lib/services/express.d.ts +1 -1
  41. package/lib/services/express.d.ts.map +1 -1
  42. package/lib/services/express.js +1 -1
  43. package/lib/services/file.d.ts +1 -1
  44. package/lib/services/file.d.ts.map +1 -1
  45. package/lib/services/file.js +1 -1
  46. package/lib/services/rabitmq.d.ts +1 -1
  47. package/lib/services/rabitmq.d.ts.map +1 -1
  48. package/lib/services/rabitmq.js +1 -1
  49. package/lib/services/redis.d.ts +1 -1
  50. package/lib/services/redis.d.ts.map +1 -1
  51. package/lib/services/redis.js +1 -1
  52. package/lib/services/sequelize.d.ts +1 -1
  53. package/lib/services/sequelize.d.ts.map +1 -1
  54. package/lib/services/sequelize.js +1 -1
  55. package/lib/services/socket.d.ts +1 -1
  56. package/lib/services/socket.d.ts.map +1 -1
  57. package/lib/services/socket.js +1 -1
  58. package/lib/services/task/queue/QueueTask.d.ts +12 -12
  59. package/lib/services/task/queue/QueueTask.d.ts.map +1 -1
  60. package/lib/services/task/queue/QueueTask.js +49 -29
  61. package/lib/services/task/scheduler/SchedulerTask.d.ts +2 -2
  62. package/lib/services/task/scheduler/SchedulerTask.d.ts.map +1 -1
  63. package/lib/services/task/scheduler/SchedulerTask.js +11 -10
  64. package/lib/services/test.d.ts +4 -5
  65. package/lib/services/test.d.ts.map +1 -1
  66. package/lib/services/test.js +8 -8
  67. package/lib/tasks/schedule/teste.js +4 -4
  68. package/lib/utils/logger.d.ts.map +1 -1
  69. package/package.json +1 -1
  70. package/lib/app/service.d.ts +0 -34
  71. package/lib/app/service.d.ts.map +0 -1
  72. package/lib/app/service.js +0 -106
  73. package/lib/app/singleton.d.ts +0 -8
  74. package/lib/app/singleton.d.ts.map +0 -1
@@ -1,106 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.EventCommunicationModule = void 0;
7
- var _stream = require("stream");
8
- var _singleton = _interopRequireDefault(require("./singleton"));
9
- var _service = require("../contracts/service");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- /**
12
- * Classe base de Serviços
13
- * Responsável por gerênciar métodos e funções utilizadas por todas
14
- * as classes de serviço desta aplicação
15
- *
16
- * @abstract
17
- * @class Service
18
- * @extends {Singleton}
19
- * @template S
20
- */
21
- class Service extends _singleton.default {
22
- eventCommunication;
23
- constructor() {
24
- super();
25
- this.eventCommunication = new EventCommunicationModule(this.constructor.name);
26
- }
27
- async serviceInit() {
28
- this.eventCommunication.on(_service.eEventCommunication.RECEIVED_CLUSTER_MESSAGE, this.onServiceMasterReceived.bind(this));
29
- this.eventCommunication.on(_service.eEventCommunication.RECEIVED_MASTER_MESSAGE, this.onClusterReceiveMessage.bind(this));
30
- await this.onServiceInit();
31
- if (this.isMaster()) {
32
- await this.onServiceMasterInit();
33
- }
34
- if (this.isCluster()) {
35
- await this.onServiceClusterInit();
36
- }
37
- }
38
- async onServiceInit() {
39
- return;
40
- }
41
- async onServiceMasterInit() {
42
- return;
43
- }
44
- async onServiceClusterInit() {
45
- return;
46
- }
47
- sendToServiceCluster(clusterId, event, data) {
48
- this.eventCommunication.sendMessageToCluster(clusterId, event, data);
49
- }
50
- sendToServiceMaster(event, data) {
51
- this.eventCommunication.sendMessageToMaster(event, data);
52
- }
53
- onServiceMasterReceived(_worker, _eventKey, _data) {
54
- return;
55
- }
56
- onServiceClusterReceived(_eventKey, _data) {
57
- return;
58
- }
59
- static getService() {
60
- return this.singleton();
61
- }
62
- }
63
- var _default = exports.default = Service;
64
- class EventCommunicationModule extends _singleton.default {
65
- emitter;
66
- constructor(serviceName) {
67
- super();
68
- this.serviceName = serviceName;
69
- this.emitter = new _stream.EventEmitter();
70
- }
71
- sendToServiceCluster(clusterId, event, data) {
72
- const key = `${this.serviceName}_${event}`;
73
- this.sendMessageToCluster(clusterId, key, data);
74
- }
75
- sendToServiceMaster(event, data) {
76
- const key = `${this.serviceName}_${event}`;
77
- this.sendMessageToMaster(key, data);
78
- }
79
-
80
- //#Non Muted
81
- onMasterReceiveMessage(worker, message) {
82
- if (!message.eventKey.includes(this.serviceName)) return;
83
- const key = message.eventKey.replace(this.serviceName + '_', '');
84
- this.onServiceMasterReceived(worker, key, message.data);
85
- }
86
- onClusterReceiveMessage(message) {
87
- if (!message.eventKey.includes(this.serviceName)) return;
88
- const key = message.eventKey.replace(this.serviceName + '_', '');
89
- this.onServiceClusterReceived(key, message.data);
90
- }
91
-
92
- //# Muted
93
- onServiceMasterReceived(worker, eventKey, data) {
94
- this.emitter.emit(_service.eEventCommunication.RECEIVED_CLUSTER_MESSAGE, worker, eventKey, data);
95
- }
96
- onServiceClusterReceived(eventKey, data) {
97
- this.emitter.emit(_service.eEventCommunication.RECEIVED_MASTER_MESSAGE, eventKey, data);
98
- }
99
- on(key, handle) {
100
- this.emitter.on(key, handle);
101
- }
102
- off(key, handle) {
103
- this.emitter.off(key, handle);
104
- }
105
- }
106
- exports.EventCommunicationModule = EventCommunicationModule;
@@ -1,8 +0,0 @@
1
- import { StaticSingleton } from '../contracts/singleton';
2
- import Core from './core';
3
- declare abstract class Singleton extends Core {
4
- static instance: Singleton;
5
- static singleton<S extends Singleton>(this: StaticSingleton<S>): S;
6
- }
7
- export default Singleton;
8
- //# sourceMappingURL=singleton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../src/app/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,IAAI,MAAM,QAAQ,CAAC;AAW1B,uBAAe,SAAU,SAAQ,IAAI;IAEnC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;WAEb,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,GAE3C,CAAC;CAE5B;AAED,eAAe,SAAS,CAAC"}