exodus-framework 2.0.66 → 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.
package/lib/app/app.d.ts CHANGED
@@ -9,7 +9,7 @@ declare class Exodus extends Core {
9
9
  createClusters(): Promise<void>;
10
10
  registerSingletonService(service: IService): void;
11
11
  initServices(): Promise<void>;
12
- static getVersion(): string | undefined;
12
+ getVersion(): string | undefined;
13
13
  }
14
14
  export default Exodus;
15
15
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
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,MAAM,CAAC,UAAU,IAAI,MAAM,GAAG,SAAS;CAUxC;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
@@ -37,7 +37,7 @@ class Exodus extends _core.default {
37
37
  //* Cluster Managment
38
38
  async initMaster() {
39
39
  this.log(`✨ Starting ${_core.default.settings.getAppication().description} · Clusters: ${_core.default.settings.getAppication().clusters}`);
40
- this.log(`✨ Core version ${Exodus.getVersion()}`);
40
+ this.log(`✨ Core version ${this.getVersion()}`);
41
41
  this.createClusters();
42
42
  }
43
43
  async initCluster() {
@@ -70,7 +70,7 @@ class Exodus extends _core.default {
70
70
  }
71
71
 
72
72
  // *System
73
- static getVersion() {
73
+ getVersion() {
74
74
  try {
75
75
  const packageJson = fs.readFileSync(_path.default.resolve(__dirname, '../../package.json'), 'utf8');
76
76
  const packageData = JSON.parse(packageJson);
@@ -3,7 +3,6 @@ import HttpController from '../app/controller';
3
3
  import { TAccountType } from '../contracts';
4
4
  declare class AccessMiddleware extends HttpController {
5
5
  accessLevel: (level: TAccountType[]) => RequestHandler;
6
- getConnection: RequestHandler;
7
6
  }
8
7
  export default AccessMiddleware;
9
8
  //# sourceMappingURL=access.d.ts.map
@@ -1 +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;AAK5C,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,WAAW,UAAW,YAAY,EAAE,KAAG,cAAc,CAWnD;IAEF,aAAa,EAAE,cAAc,CAqB3B;CACH;AAED,eAAe,gBAAgB,CAAC"}
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"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _controller = _interopRequireDefault(require("../app/controller"));
8
8
  var _http = require("../contracts/http");
9
- var _services = require("../services");
10
9
  var _error = require("../services/error");
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  class AccessMiddleware extends _controller.default {
@@ -18,21 +17,5 @@ class AccessMiddleware extends _controller.default {
18
17
  next();
19
18
  };
20
19
  };
21
- getConnection = async (req, res, next) => {
22
- const account = req.auth?.account;
23
- const envToken = req.header('X-Exodus-Environment-Token');
24
- const connUuid = req.header('X-Exodus-Connection');
25
- if (account && account.type != 'ADMINISTRATOR') {
26
- if (!envToken || !connUuid) {
27
- throw new _error.ApplicationHttpException('Informações do ambiente incompletas', _http.EHttpResponseCode.incompleteRequest);
28
- }
29
- const connection = await _services.SequelizeService.singleton().getDB(connUuid, envToken);
30
- if (!connection) {
31
- throw new _error.ApplicationHttpException('Não foi possível obter a conexão deste ambiente');
32
- }
33
- req.auth.connection = connection;
34
- }
35
- next();
36
- };
37
20
  }
38
21
  var _default = exports.default = AccessMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../src/models/Connection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,uBAAuB,EACvB,KAAK,EACN,MAAM,WAAW,CAAC;AAGnB,qBAAa,UAAW,SAAQ,KAAK,CACnC,eAAe,CAAC,UAAU,CAAC,EAC3B,uBAAuB,CAAC,UAAU,CAAC,CACpC;IACS,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACvD"}
1
+ {"version":3,"file":"Connection.d.ts","sourceRoot":"","sources":["../../src/models/Connection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAEhB,OAAO,EACP,eAAe,EACf,uBAAuB,EACvB,KAAK,EACN,MAAM,WAAW,CAAC;AAEnB,qBAAa,UAAW,SAAQ,KAAK,CACnC,eAAe,CAAC,UAAU,CAAC,EAC3B,uBAAuB,CAAC,UAAU,CAAC,CACpC;IACS,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACvD"}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Connection = void 0;
7
- var _sequelize = require("sequelize");
8
7
  var _database = require("../utils/database");
8
+ var _sequelize = require("sequelize");
9
9
  class Connection extends _sequelize.Model {}
10
10
  exports.Connection = Connection;
11
11
  Connection.init({
@@ -6,7 +6,6 @@ declare class FileService extends Service implements IService {
6
6
  private checkPaths;
7
7
  private cleanTemp;
8
8
  save(filename: string, destiny: keyof TFilePathSettings): Promise<string | boolean>;
9
- delete(filename: string, destiny: keyof TFilePathSettings): Promise<boolean>;
10
9
  listFiles(origin: keyof TFilePathSettings, cb: (file: string[]) => void): void;
11
10
  }
12
11
  export default FileService;
@@ -1 +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"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,cAAM,WAAY,SAAQ,OAAQ,YAAW,QAAQ;IAC7C,IAAI;YAKI,UAAU;YAKV,SAAS;IASjB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAa7D,SAAS,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;CAIxE;AACD,eAAe,WAAW,CAAC"}
@@ -46,17 +46,6 @@ 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
- }
60
49
  listFiles(origin, cb) {
61
50
  const p = _app.Core.settings.getAppication().filePaths[origin];
62
51
  fs.readdir(p, (_, file) => cb(file));
@@ -1,12 +1,11 @@
1
- import { Model, ModelStatic, Sequelize } from 'sequelize';
2
1
  import Service from '../app/service';
2
+ import { ModelStatic, Sequelize } from 'sequelize';
3
3
  import { IService } from '../contracts/service';
4
4
  declare class SequelizeService extends Service implements IService {
5
5
  serviceDB: Sequelize;
6
6
  masterDB: Sequelize;
7
7
  models: ModelStatic<any>[];
8
8
  connections: Map<string, Sequelize>;
9
- initializedModels: Map<string, typeof Model<any, any>>;
10
9
  constructor();
11
10
  init(): Promise<void>;
12
11
  connectMainDatabase(): Promise<unknown>;
@@ -17,9 +16,6 @@ declare class SequelizeService extends Service implements IService {
17
16
  getDB(uuid: string, name: string): Promise<Sequelize>;
18
17
  initDB(uuid: string, name: string): Promise<unknown>;
19
18
  registerModels(models: ModelStatic<any>[]): void;
20
- getModel<M extends typeof Model<any, any>>(model: typeof Model<any, any> & {
21
- initialize: (connection: Sequelize) => M;
22
- }, conn_uuid: string, envToken: string): Promise<M>;
23
19
  }
24
20
  export default SequelizeService;
25
21
  //# sourceMappingURL=sequelize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequelize.d.ts","sourceRoot":"","sources":["../../src/services/sequelize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAahD,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;IACpC,i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E,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"}
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _sequelize = require("sequelize");
8
- var _app = require("../app");
9
7
  var _service = _interopRequireDefault(require("../app/service"));
10
8
  var _Connection = require("../models/Connection");
11
9
  var _database = require("../utils/database");
12
10
  var _logger = _interopRequireDefault(require("../utils/logger"));
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
@@ -24,7 +24,6 @@ class SequelizeService extends _service.default {
24
24
  masterDB;
25
25
  models;
26
26
  connections;
27
- initializedModels;
28
27
 
29
28
  //# Initialization
30
29
  constructor() {
@@ -192,19 +191,5 @@ class SequelizeService extends _service.default {
192
191
  registerModels(models) {
193
192
  this.models = models;
194
193
  }
195
- async getModel(model, conn_uuid, envToken) {
196
- const connection = await this.getDB(conn_uuid, envToken);
197
- const query = `${envToken}@${conn_uuid}`;
198
- const cache = this.initializedModels.get(query);
199
- if (cache) {
200
- return cache;
201
- }
202
- if (connection) {
203
- const m = model.initialize(connection);
204
- this.initializedModels.set(query, m);
205
- return m;
206
- }
207
- return null;
208
- }
209
194
  }
210
195
  var _default = exports.default = SequelizeService;
@@ -2,8 +2,7 @@ import Api from './api';
2
2
  export declare class SessionAPI extends Api {
3
3
  host: string;
4
4
  headers: {
5
- 'X-Exodus-App-Sec': string;
6
- 'X-Exodus-Core-Version': string;
5
+ 'x-ev-logical': string;
7
6
  };
8
7
  validateStatus(status: number): boolean;
9
8
  getCertificate(): Promise<import("..").IApiResponse<string>>;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,qBAAa,UAAW,SAAQ,GAAG;IACjC,IAAI,SAA+B;IACnC,OAAO;;;MAGL;IAEF,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIjC,cAAc;CAGrB"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,qBAAa,UAAW,SAAQ,GAAG;IACjC,IAAI,SAA+B;IACnC,OAAO;;MAEL;IAEF,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIjC,cAAc;CAGrB"}
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SessionAPI = void 0;
7
- var _app = require("../app");
8
7
  var _api = _interopRequireDefault(require("./api"));
9
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
9
  class SessionAPI extends _api.default {
11
10
  host = process.env.APP_SESSION_URL;
12
11
  headers = {
13
- 'X-Exodus-App-Sec': this.getLogicalSecurityId(),
14
- 'X-Exodus-Core-Version': _app.Exodus.getVersion()
12
+ 'x-ev-logical': this.getLogicalSecurityId()
15
13
  };
16
14
  validateStatus(status) {
17
15
  return status < 400;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exodus-framework",
3
- "version": "2.0.66",
3
+ "version": "2.0.591",
4
4
  "description": "Exodus Framework",
5
5
  "author": "jhownpaixao",
6
6
  "license": "ISC",