exodus-framework 2.0.41 → 2.0.361

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/lib/app/app.d.ts CHANGED
@@ -11,7 +11,6 @@ declare class Exodus extends Core {
11
11
  createClusters(): Promise<void>;
12
12
  registerSingletonService(service: IService): void;
13
13
  initServices(): Promise<void>;
14
- getVersion(): string | undefined;
15
14
  }
16
15
  export default Exodus;
17
16
  //# 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;AAW1B,cAAM,MAAO,SAAQ,IAAI;IACvB,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,KAAK,CAA4B;gBAG7B,KAAK,EAAE,yBAAyB;IAKtC,KAAK;IASL,UAAU;IAKV,WAAW;IAIX,cAAc;IAgBpB,wBAAwB,CAAC,OAAO,EAAE,QAAQ;IAGpC,YAAY;IASlB,UAAU,IAAI,MAAM,GAAG,SAAS;CAUjC;AACD,eAAe,MAAM,CAAC"}
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"}
package/lib/app/app.js CHANGED
@@ -7,10 +7,6 @@ exports.default = void 0;
7
7
  var _app = require("../config/app");
8
8
  var _cluster = _interopRequireDefault(require("cluster"));
9
9
  var _core = _interopRequireDefault(require("./core"));
10
- var fs = _interopRequireWildcard(require("fs"));
11
- var _path = _interopRequireDefault(require("path"));
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
- 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
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
11
  /**
16
12
  * Classe da aplicação principal
@@ -40,7 +36,6 @@ class Exodus extends _core.default {
40
36
  //* Cluster Managment
41
37
  async initMaster() {
42
38
  this.log(`✨ Starting ${_app.AppConfig.description} · Clusters: ${_app.AppConfig.clusters}`);
43
- this.log(`✨ Core version ${this.getVersion()}`);
44
39
  this.createClusters();
45
40
  }
46
41
  async initCluster() {
@@ -66,21 +61,7 @@ class Exodus extends _core.default {
66
61
  }
67
62
  async initServices() {
68
63
  for (const service of this.services) {
69
- await service.init().catch(error => {
70
- this.log(`Erro on starting service: ${error.message || 'unknow'}`, 'danger');
71
- });
72
- }
73
- }
74
-
75
- // *System
76
- getVersion() {
77
- try {
78
- const packageJson = fs.readFileSync(_path.default.resolve(__dirname, '../../package.json'), 'utf8');
79
- const packageData = JSON.parse(packageJson);
80
- return packageData.version;
81
- } catch (error) {
82
- console.error('Error reading package.json:', error);
83
- return undefined;
64
+ await service.init();
84
65
  }
85
66
  }
86
67
  }
@@ -32,7 +32,7 @@ class ExpressService extends _service.default {
32
32
  this.server = http.createServer(expss);
33
33
  expss.use('/public', _express.default.static(_path.default.join(__dirname, '../../public')));
34
34
  expss.use(pino);
35
- expss.use(this.responseTypeMiddleware.bind(this));
35
+ expss.use('*', this.responseTypeMiddleware.bind(this));
36
36
  expss.use(_express.default.json());
37
37
  expss.use(_express.default.urlencoded({
38
38
  extended: false
@@ -1,15 +1,14 @@
1
- import type { Job } from 'bullmq';
2
- import { Queue, Worker } from 'bullmq';
3
1
  import Service from '../app/service';
4
2
  import Singleton from '../app/singleton';
3
+ import type { Job } from 'bullmq';
4
+ import { Queue, Worker } from 'bullmq';
5
5
  import { IService } from '../contracts/service';
6
6
  declare abstract class TaskServiceBase extends Service implements IService {
7
- protected jobsPath: string;
8
7
  abstract init(): Promise<void>;
9
8
  abstract registerJob(...args: any[]): Promise<void>;
10
- setTaskPath(path: string): void;
11
9
  }
12
10
  export declare class TaskSchedulingService extends TaskServiceBase {
11
+ private jobsPath;
13
12
  private jobs;
14
13
  init(): Promise<void>;
15
14
  registerJob(job: SchedulingTask): Promise<void>;
@@ -26,6 +25,7 @@ export declare abstract class SchedulingTask extends Singleton {
26
25
  getJobName(): string;
27
26
  }
28
27
  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,KAAK,EAAqB,GAAG,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGvC,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,SAAS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,EAAE,UAAU,EAAE,QAAQ,CAAC,EAEzC,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC;CACvB"}
@@ -4,26 +4,24 @@ 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"));
7
10
  var _bullmq = require("bullmq");
8
11
  var _fs = require("fs");
9
12
  var _nodeSchedule = require("node-schedule");
10
- var _service = _interopRequireDefault(require("../app/service"));
11
- var _singleton = _interopRequireDefault(require("../app/singleton"));
12
13
  var _cache = _interopRequireDefault(require("../config/cache"));
13
14
  var _error = require("./error");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
16
  //* Base
16
- class TaskServiceBase extends _service.default {
17
- jobsPath;
18
- setTaskPath(path) {
19
- this.jobsPath = path;
20
- }
21
- }
17
+ class TaskServiceBase extends _service.default {}
22
18
 
23
19
  //* Scheduler
24
20
  class TaskSchedulingService extends TaskServiceBase {
21
+ jobsPath;
25
22
  jobs;
26
23
  async init() {
24
+ this.jobsPath = _task.default.schedulerPath;
27
25
  this.jobs = [];
28
26
  this.log('Initializing jobs...', 'info');
29
27
  await this.importAllJobs();
@@ -71,9 +69,11 @@ class SchedulingTask extends _singleton.default {
71
69
  //* Queue
72
70
  exports.SchedulingTask = SchedulingTask;
73
71
  class TaskQueueService extends TaskServiceBase {
72
+ jobsPath;
74
73
  jobs;
75
74
  connection;
76
75
  async init() {
76
+ this.jobsPath = _task.default.queuePath;
77
77
  this.jobs = [];
78
78
  this.connection = {
79
79
  host: _cache.default.host,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodus-framework",
3
- "version": "2.0.41",
3
+ "version": "2.0.361",
4
4
  "description": "Exodus Framework",
5
5
  "author": "jhownpaixao",
6
6
  "license": "ISC",