exodus-framework 2.0.67 → 2.0.68
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.
@@ -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;
|
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,SAAS,EAAE,cAAc,CAiBvB;CACH;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
7
7
|
var _controller = _interopRequireDefault(require("../app/controller"));
|
8
8
|
var _http = require("../contracts/http");
|
9
9
|
var _error = require("../services/error");
|
10
|
+
var _app = require("../app");
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
11
12
|
class AccessMiddleware extends _controller.default {
|
12
13
|
accessLevel = level => {
|
@@ -24,8 +25,10 @@ class AccessMiddleware extends _controller.default {
|
|
24
25
|
if (!tenantId) {
|
25
26
|
throw new _error.ApplicationHttpException('Informações do ambiente incompletas', _http.EHttpResponseCode.incompleteRequest);
|
26
27
|
}
|
27
|
-
req.tenant.id = tenantId;
|
28
28
|
}
|
29
|
+
req.tenant = {
|
30
|
+
id: tenantId || `root@${_app.Core.settings.getDatabase().service}`
|
31
|
+
};
|
29
32
|
next();
|
30
33
|
};
|
31
34
|
}
|
@@ -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,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;;IAMjD,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,QAAQ,EAAE,MAAM;
|
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,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;;IAMjD,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,QAAQ,EAAE,MAAM;IAYtB,MAAM,CAAC,QAAQ,EAAE,MAAM;IA+C7B,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE;IAInC,QAAQ,CAAC,CAAC,SAAS,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EAC7C,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG;QAAE,UAAU,EAAE,CAAC,UAAU,EAAE,SAAS,KAAK,CAAC,CAAA;KAAE,EAC5E,QAAQ,EAAE,MAAM;IAmBlB,uBAAuB,CAAC,MAAM,EAAE,MAAM;;;;CAMvC;AAED,eAAe,gBAAgB,CAAC"}
|
@@ -151,6 +151,11 @@ class SequelizeService extends _service.default {
|
|
151
151
|
con_uuid,
|
152
152
|
envToken
|
153
153
|
} = this.parseDataInfoByTenantId(tenantId);
|
154
|
+
if (con_uuid == _app.Core.settings.getDatabase().service.database) {
|
155
|
+
return _database.serviceDB;
|
156
|
+
} else if (con_uuid == _app.Core.settings.getDatabase().master.database) {
|
157
|
+
return _database.masterDB;
|
158
|
+
}
|
154
159
|
const dbQueryName = `${_app.Core.settings.getDatabase().service.database}_${envToken}`;
|
155
160
|
const queryId = `${con_uuid}@${dbQueryName}`;
|
156
161
|
return this.connections.get(queryId);
|
@@ -205,12 +210,12 @@ class SequelizeService extends _service.default {
|
|
205
210
|
con_uuid,
|
206
211
|
envToken
|
207
212
|
} = this.parseDataInfoByTenantId(tenantId);
|
208
|
-
const connection = await this.getDB(tenantId);
|
209
213
|
const query = `${envToken}@${con_uuid}`;
|
210
214
|
const cache = this.initializedModels.get(query);
|
211
215
|
if (cache) {
|
212
216
|
return cache;
|
213
217
|
}
|
218
|
+
const connection = await this.getDB(tenantId);
|
214
219
|
if (connection) {
|
215
220
|
const m = model.initialize(connection);
|
216
221
|
this.initializedModels.set(query, m);
|