exodus-framework 2.0.3 → 2.0.6
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/{build → lib}/app/app.d.ts +3 -4
- package/lib/app/app.d.ts.map +1 -0
- package/lib/app/app.js +84 -0
- package/{build → lib}/app/controller.d.ts +2 -2
- package/lib/app/controller.d.ts.map +1 -0
- package/{build → lib}/app/controller.js +2 -1
- package/lib/app/core.d.ts +10 -0
- package/lib/app/core.d.ts.map +1 -0
- package/{build → lib}/app/core.js +5 -0
- package/{build → lib}/app/index.d.ts +1 -0
- package/lib/app/index.d.ts.map +1 -0
- package/{build → lib}/app/index.js +9 -1
- package/lib/app/settings.d.ts +24 -0
- package/lib/app/settings.d.ts.map +1 -0
- package/lib/app/settings.js +130 -0
- package/{build → lib}/app/singleton.d.ts +1 -1
- package/{build → lib}/app/singleton.d.ts.map +1 -1
- package/lib/contracts/console.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/entity.d.ts +2 -1
- package/lib/contracts/entity.d.ts.map +1 -0
- package/lib/contracts/http.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/index.d.ts +1 -1
- package/lib/contracts/index.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/index.js +11 -11
- package/{build/@types → lib/contracts}/messaging.d.ts +6 -0
- package/lib/contracts/messaging.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/messaging.js +1 -0
- package/lib/contracts/service.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/session.d.ts +0 -1
- package/lib/contracts/session.d.ts.map +1 -0
- package/lib/contracts/settings.d.ts +62 -0
- package/lib/contracts/settings.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/singleton.d.ts +1 -1
- package/lib/contracts/singleton.d.ts.map +1 -0
- package/{build/@types → lib/contracts}/socket.d.ts +1 -1
- package/lib/contracts/socket.d.ts.map +1 -0
- package/{build → lib}/controllers/api/file.d.ts +1 -1
- package/{build → lib}/controllers/api/file.d.ts.map +1 -1
- package/{build → lib}/controllers/api/file.js +1 -1
- package/{build → lib}/controllers/api/index.d.ts.map +1 -1
- package/{build → lib}/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -0
- package/{build → lib}/index.js +4 -16
- package/{build → lib}/middlewares/access.d.ts +2 -2
- package/lib/middlewares/access.d.ts.map +1 -0
- package/{build → lib}/middlewares/access.js +1 -1
- package/{build → lib}/middlewares/authentication.d.ts +1 -1
- package/{build → lib}/middlewares/authentication.d.ts.map +1 -1
- package/{build → lib}/middlewares/authentication.js +9 -4
- package/{build → lib}/middlewares/file.d.ts +1 -1
- package/{build → lib}/middlewares/file.d.ts.map +1 -1
- package/{build → lib}/middlewares/file.js +3 -3
- package/lib/middlewares/index.d.ts.map +1 -0
- package/{build → lib}/services/error.d.ts +1 -1
- package/{build → lib}/services/error.d.ts.map +1 -1
- package/{build → lib}/services/error.js +4 -10
- package/{build → lib}/services/express.d.ts +3 -3
- package/lib/services/express.d.ts.map +1 -0
- package/{build → lib}/services/express.js +12 -14
- package/lib/services/file.d.ts +13 -0
- package/lib/services/file.d.ts.map +1 -0
- package/{build → lib}/services/file.js +17 -6
- package/lib/services/index.d.ts.map +1 -0
- package/{build → lib}/services/rabitmq.d.ts +3 -3
- package/lib/services/rabitmq.d.ts.map +1 -0
- package/{build → lib}/services/rabitmq.js +2 -2
- package/{build → lib}/services/redis.d.ts +2 -2
- package/lib/services/redis.d.ts.map +1 -0
- package/{build → lib}/services/redis.js +3 -3
- package/{build → lib}/services/sequelize.d.ts +2 -2
- package/lib/services/sequelize.d.ts.map +1 -0
- package/{build → lib}/services/sequelize.js +6 -6
- package/{build → lib}/services/socket.d.ts +3 -3
- package/lib/services/socket.d.ts.map +1 -0
- package/{build → lib}/services/task.d.ts +5 -5
- package/lib/services/task.d.ts.map +1 -0
- package/{build → lib}/services/task.js +15 -12
- package/{build → lib}/utils/api.d.ts +2 -2
- package/{build → lib}/utils/api.d.ts.map +1 -1
- package/lib/utils/database.d.ts.map +1 -0
- package/{build → lib}/utils/database.js +9 -9
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/utils/logger.js +48 -0
- package/package.json +7 -6
- package/build/@types/app.d.ts +0 -5
- package/build/@types/app.d.ts.map +0 -1
- package/build/@types/console.d.ts.map +0 -1
- package/build/@types/entity.d.ts.map +0 -1
- package/build/@types/http.d.ts.map +0 -1
- package/build/@types/index.d.ts.map +0 -1
- package/build/@types/messaging.d.ts.map +0 -1
- package/build/@types/service.d.ts.map +0 -1
- package/build/@types/session.d.ts.map +0 -1
- package/build/@types/singleton.d.ts.map +0 -1
- package/build/@types/socket.d.ts.map +0 -1
- package/build/app/app.d.ts.map +0 -1
- package/build/app/app.js +0 -68
- package/build/app/controller.d.ts.map +0 -1
- package/build/app/core.d.ts +0 -7
- package/build/app/core.d.ts.map +0 -1
- package/build/app/index.d.ts.map +0 -1
- package/build/config/app.d.ts +0 -16
- package/build/config/app.d.ts.map +0 -1
- package/build/config/app.js +0 -25
- package/build/config/auth.d.ts +0 -5
- package/build/config/auth.d.ts.map +0 -1
- package/build/config/auth.js +0 -11
- package/build/config/cache.d.ts +0 -7
- package/build/config/cache.d.ts.map +0 -1
- package/build/config/cache.js +0 -12
- package/build/config/db.d.ts +0 -13
- package/build/config/db.d.ts.map +0 -1
- package/build/config/db.js +0 -17
- package/build/config/http.d.ts +0 -5
- package/build/config/http.d.ts.map +0 -1
- package/build/config/http.js +0 -10
- package/build/config/index.d.ts +0 -9
- package/build/config/index.d.ts.map +0 -1
- package/build/config/index.js +0 -92
- package/build/config/logger.d.ts +0 -7
- package/build/config/logger.d.ts.map +0 -1
- package/build/config/logger.js +0 -33
- package/build/config/messaging.d.ts +0 -7
- package/build/config/messaging.d.ts.map +0 -1
- package/build/config/messaging.js +0 -12
- package/build/config/task.d.ts +0 -6
- package/build/config/task.d.ts.map +0 -1
- package/build/config/task.js +0 -13
- package/build/index.d.ts.map +0 -1
- package/build/middlewares/access.d.ts.map +0 -1
- package/build/middlewares/index.d.ts.map +0 -1
- package/build/services/express.d.ts.map +0 -1
- package/build/services/file.d.ts +0 -12
- package/build/services/file.d.ts.map +0 -1
- package/build/services/index.d.ts.map +0 -1
- package/build/services/rabitmq.d.ts.map +0 -1
- package/build/services/redis.d.ts.map +0 -1
- package/build/services/sequelize.d.ts.map +0 -1
- package/build/services/socket.d.ts.map +0 -1
- package/build/services/task.d.ts.map +0 -1
- package/build/utils/database.d.ts.map +0 -1
- package/build/utils/index.d.ts.map +0 -1
- package/build/utils/logger.d.ts.map +0 -1
- package/build/utils/logger.js +0 -45
- /package/{build → lib}/app/service.d.ts +0 -0
- /package/{build → lib}/app/service.d.ts.map +0 -0
- /package/{build → lib}/app/service.js +0 -0
- /package/{build → lib}/app/singleton.js +0 -0
- /package/{build/@types → lib/contracts}/console.d.ts +0 -0
- /package/{build/@types → lib/contracts}/console.js +0 -0
- /package/{build/@types → lib/contracts}/entity.js +0 -0
- /package/{build/@types → lib/contracts}/http.d.ts +0 -0
- /package/{build/@types → lib/contracts}/http.js +0 -0
- /package/{build/@types → lib/contracts}/service.d.ts +0 -0
- /package/{build/@types → lib/contracts}/service.js +0 -0
- /package/{build/@types → lib/contracts}/session.js +0 -0
- /package/{build/@types/app.js → lib/contracts/settings.js} +0 -0
- /package/{build/@types → lib/contracts}/singleton.js +0 -0
- /package/{build/@types → lib/contracts}/socket.js +0 -0
- /package/{build → lib}/controllers/api/index.d.ts +0 -0
- /package/{build → lib}/controllers/api/index.js +0 -0
- /package/{build → lib}/controllers/index.d.ts +0 -0
- /package/{build → lib}/controllers/index.d.ts.map +0 -0
- /package/{build → lib}/controllers/index.js +0 -0
- /package/{build/@types → lib}/express.d.js +0 -0
- /package/{build → lib}/middlewares/index.d.ts +0 -0
- /package/{build → lib}/middlewares/index.js +0 -0
- /package/{build → lib}/models/Connection.d.ts +0 -0
- /package/{build → lib}/models/Connection.d.ts.map +0 -0
- /package/{build → lib}/models/Connection.js +0 -0
- /package/{build → lib}/models/index.d.ts +0 -0
- /package/{build → lib}/models/index.d.ts.map +0 -0
- /package/{build → lib}/models/index.js +0 -0
- /package/{build → lib}/services/index.d.ts +0 -0
- /package/{build → lib}/services/index.js +0 -0
- /package/{build → lib}/services/socket.js +0 -0
- /package/{build → lib}/utils/api.js +0 -0
- /package/{build → lib}/utils/database.d.ts +0 -0
- /package/{build → lib}/utils/date.d.ts +0 -0
- /package/{build → lib}/utils/date.d.ts.map +0 -0
- /package/{build → lib}/utils/date.js +0 -0
- /package/{build → lib}/utils/index.d.ts +0 -0
- /package/{build → lib}/utils/index.js +0 -0
- /package/{build → lib}/utils/logger.d.ts +0 -0
- /package/{build → lib}/utils/session.d.ts +0 -0
- /package/{build → lib}/utils/session.d.ts.map +0 -0
- /package/{build → lib}/utils/session.js +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,QAAQ,CAAC"}
|
package/{build → lib}/index.d.ts
RENAMED
@@ -0,0 +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,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,eAAe,MAAM,CAAC"}
|
package/{build → lib}/index.js
RENAMED
@@ -17,27 +17,15 @@ Object.keys(_app).forEach(function (key) {
|
|
17
17
|
}
|
18
18
|
});
|
19
19
|
});
|
20
|
-
var
|
21
|
-
Object.keys(
|
20
|
+
var _contracts = require("./contracts");
|
21
|
+
Object.keys(_contracts).forEach(function (key) {
|
22
22
|
if (key === "default" || key === "__esModule") return;
|
23
23
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
24
|
-
if (key in exports && exports[key] ===
|
24
|
+
if (key in exports && exports[key] === _contracts[key]) return;
|
25
25
|
Object.defineProperty(exports, key, {
|
26
26
|
enumerable: true,
|
27
27
|
get: function () {
|
28
|
-
return
|
29
|
-
}
|
30
|
-
});
|
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];
|
28
|
+
return _contracts[key];
|
41
29
|
}
|
42
30
|
});
|
43
31
|
});
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import HttpController from '@app/controller';
|
2
1
|
import { RequestHandler } from 'express';
|
3
|
-
import
|
2
|
+
import HttpController from '../app/controller';
|
3
|
+
import { TAccountType } from '../contracts';
|
4
4
|
declare class AccessMiddleware extends HttpController {
|
5
5
|
accessLevel: (level: TAccountType[]) => RequestHandler;
|
6
6
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/middlewares/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,WAAW,UAAW,YAAY,EAAE,KAAG,cAAc,CAWnD;CACH;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
var _controller = _interopRequireDefault(require("../app/controller"));
|
8
|
+
var _http = require("../contracts/http");
|
8
9
|
var _error = require("../services/error");
|
9
|
-
var _http = require("../@types/http");
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
11
|
class AccessMiddleware extends _controller.default {
|
12
12
|
accessLevel = level => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middlewares/authentication.ts"],"names":[],"mappings":"
|
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
|
-
|
16
|
-
|
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:
|
23
|
+
issuer: _app.Core.settings.getAuthentication().issuer,
|
19
24
|
algorithms: ['RS256']
|
20
25
|
});
|
21
26
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/middlewares/file.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/middlewares/file.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAe,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAK/C,cAAM,cAAe,SAAQ,cAAc;IACzC,OAAO,EAAE,aAAa,CAAC;;IAOvB,OAAO,CAAC,WAAW;IAanB,MAAM,UAAW,MAAM,kJAErB;CACH;AAED,eAAe,cAAc,CAAC"}
|
@@ -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.
|
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.
|
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);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,QAAQ,CAAC"}
|
@@ -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,
|
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;CAIf;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;CAKf"}
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.ApplicationHttpException = exports.ApplicationException = void 0;
|
7
7
|
var _logger = _interopRequireDefault(require("../utils/logger"));
|
8
|
-
var _http = require("
|
8
|
+
var _http = require("../contracts/http");
|
9
9
|
var _core = _interopRequireDefault(require("../app/core"));
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
11
|
class ExodusErrorBase extends _core.default {
|
@@ -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
|
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,14 +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
|
-
});
|
46
|
+
(0, _logger.default)().error(this.error);
|
53
47
|
}
|
54
48
|
}
|
55
49
|
exports.ApplicationException = ApplicationException;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import Service from '
|
1
|
+
import Service from '../app/service';
|
2
2
|
import { NextFunction, Response, Router } from 'express';
|
3
3
|
import 'express-async-errors';
|
4
4
|
import * as http from 'http';
|
5
|
-
import { THttpResponse } from '
|
6
|
-
import { IService } from '
|
5
|
+
import { THttpResponse } from '../contracts/http';
|
6
|
+
import { IService } from '../contracts/service';
|
7
7
|
declare class ExpressService extends Service implements IService {
|
8
8
|
private server;
|
9
9
|
private mainRouter;
|
@@ -0,0 +1 @@
|
|
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
|
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(
|
31
|
+
expss.use('/public', _express.default.static(_app.Core.settings.getHttp().publicPath));
|
34
32
|
expss.use(pino);
|
35
|
-
expss.use(
|
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.
|
48
|
-
(0, _logger.default)().info(`servidor iniciado na porta: ${_app.
|
49
|
-
this.log(`🌍 Http Server Listering On: ${_app.
|
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 =
|
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 (
|
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:
|
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',
|
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',
|
132
|
+
if (!pass) throw new _error.ApplicationHttpException('Requisição incompleta', _http2.EHttpResponseCode.incompleteRequest, 'error', {
|
135
133
|
need
|
136
134
|
});
|
137
135
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import Service from '../app/service';
|
2
|
+
import { IService } from '../contracts/service';
|
3
|
+
import { TFilePathSettings } from '../contracts/settings';
|
4
|
+
declare class FileService extends Service implements IService {
|
5
|
+
init(): Promise<void>;
|
6
|
+
private checkPaths;
|
7
|
+
private cleanTemp;
|
8
|
+
save(filename: string, destiny: keyof TFilePathSettings): Promise<string | boolean>;
|
9
|
+
delete(filename: string, destiny: keyof TFilePathSettings): Promise<boolean>;
|
10
|
+
listFiles(origin: keyof TFilePathSettings, cb: (file: string[]) => void): void;
|
11
|
+
}
|
12
|
+
export default FileService;
|
13
|
+
//# sourceMappingURL=file.d.ts.map
|
@@ -0,0 +1 @@
|
|
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;IAavD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAW/D,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.
|
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.
|
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.
|
39
|
-
const d = _app.
|
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,
|
@@ -46,8 +46,19 @@ class FileService extends _service.default {
|
|
46
46
|
return false;
|
47
47
|
});
|
48
48
|
}
|
49
|
+
async delete(filename, destiny) {
|
50
|
+
const d = _app.Core.settings.getAppication().filePaths[destiny] + '/' + filename;
|
51
|
+
return await fsPromisses.unlink(d).then(() => true).catch(e => {
|
52
|
+
(0, _logger.default)().error({
|
53
|
+
filename,
|
54
|
+
destiny,
|
55
|
+
erro: e
|
56
|
+
}, 'Não foi possível deletar o arquivo');
|
57
|
+
return false;
|
58
|
+
});
|
59
|
+
}
|
49
60
|
listFiles(origin, cb) {
|
50
|
-
const p = _app.
|
61
|
+
const p = _app.Core.settings.getAppication().filePaths[origin];
|
51
62
|
fs.readdir(p, (_, file) => cb(file));
|
52
63
|
}
|
53
64
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACtD,cAAc,QAAQ,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import Service from '
|
2
|
-
import { TMessageQueueDataMap, TMessagingQueueEventList, TMessagingQueueHandler } from '
|
1
|
+
import Service from '../app/service';
|
2
|
+
import { TMessageQueueDataMap, TMessagingQueueEventList, TMessagingQueueHandler } from '../contracts';
|
3
3
|
import { Channel, Connection } from 'amqplib';
|
4
|
-
import { IService } from '
|
4
|
+
import { IService } from '../contracts/service';
|
5
5
|
declare class RabbitMQService extends Service implements IService {
|
6
6
|
connection: Connection;
|
7
7
|
channel: Channel;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rabitmq.d.ts","sourceRoot":"","sources":["../../src/services/rabitmq.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,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,MAAM,sBAAsB,CAAC;AAWhD,cAAM,eAAgB,SAAQ,OAAQ,YAAW,QAAQ;IACvD,UAAU,EAAG,UAAU,CAAC;IACxB,OAAO,EAAG,OAAO,CAAC;IAClB,OAAO,CAAC,SAAS,CAAW;IAC5B,OAAO,CAAC,UAAU,CAA2B;;IAMvC,IAAI;IAIV,eAAe;IAKT,OAAO;IAmBP,WAAW,CAAC,CAAC,SAAS,MAAM,oBAAoB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAWzF,gBAAgB,CAAC,CAAC,SAAS,MAAM,oBAAoB,EACzD,KAAK,EAAE,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://${
|
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`);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import Service from '
|
2
|
-
import { IService } from '
|
1
|
+
import Service from '../app/service';
|
2
|
+
import { IService } from '../contracts/service';
|
3
3
|
declare class RedisService extends Service implements IService {
|
4
4
|
private client;
|
5
5
|
init(): Promise<void>;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/services/redis.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAYhD,cAAM,YAAa,SAAQ,OAAQ,YAAW,QAAQ;IACpD,OAAO,CAAC,MAAM,CAAkB;IAG1B,IAAI;IAOV,OAAO,CAAC,OAAO;IAUT,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAGnD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI7C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7C,OAAO,CAAC,aAAa;CAGtB;AAED,eAAe,YAAY,CAAC"}
|
@@ -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
|
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://${
|
26
|
-
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,6 +1,6 @@
|
|
1
|
-
import Service from '
|
1
|
+
import Service from '../app/service';
|
2
2
|
import { ModelStatic, Sequelize } from 'sequelize';
|
3
|
-
import { IService } from '
|
3
|
+
import { IService } from '../contracts/service';
|
4
4
|
declare class SequelizeService extends Service implements IService {
|
5
5
|
serviceDB: Sequelize;
|
6
6
|
masterDB: Sequelize;
|
@@ -0,0 +1 @@
|
|
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
|
9
|
-
var _Connection = require("@models/Connection");
|
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 = `${
|
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 = `${
|
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 = `${
|
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 = `${
|
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,9 +1,9 @@
|
|
1
|
-
import Service from '
|
2
|
-
import { TSocketEventList } from '
|
1
|
+
import Service from '../app/service';
|
2
|
+
import { TSocketEventList } from '../contracts';
|
3
3
|
import { CorsOptions, CorsOptionsDelegate } from 'cors';
|
4
4
|
import { Server as HttpServer } from 'http';
|
5
5
|
import { Server } from 'socket.io';
|
6
|
-
import { IService } from '
|
6
|
+
import { IService } from '../contracts/service';
|
7
7
|
declare class SocketIOService extends Service implements IService {
|
8
8
|
server: Server;
|
9
9
|
private mainRouter;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/services/socket.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAgC,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAWhD,cAAM,eAAgB,SAAQ,OAAQ,YAAW,QAAQ;IAChD,MAAM,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,UAAU,CAAmB;;IAK/B,IAAI;IAQV,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,UAAU;IAQlB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,GAAE,WAAW,GAAG,mBAAqC;IAIvF,cAAc,CAAC,MAAM,EAAE,gBAAgB;CAGxC;AAED,eAAe,eAAe,CAAC"}
|
@@ -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';
|
5
|
-
import
|
3
|
+
import Service from '../app/service';
|
4
|
+
import Singleton from '../app/singleton';
|
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>;
|
@@ -0,0 +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,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKhD,uBAAe,eAAgB,SAAQ,OAAQ,YAAW,QAAQ;IAChE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnD,WAAW,CAAC,IAAI,EAAE,MAAM;CAGzB;AAGD,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,OAAO,CAAC,IAAI,CAAmB;IAEzB,IAAI;IAYG,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,IAAI,CAAmB;IAC/B,OAAO,CAAC,UAAU,CAAoB;IAEhC,IAAI;IAeG,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAI9C,aAAa;YAUb,cAAc;CAmB7B;AACD,8BAAsB,SAAS,CAC7B,QAAQ,EACR,UAAU,GAAG,GAAG,EAChB,QAAQ,SAAS,MAAM,GAAG,MAAM,CAChC,SAAQ,SAAS;IACjB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACnC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;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"}
|