@nest-omni/core 1.0.30 → 1.0.31
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.
|
@@ -12,7 +12,7 @@ function getOmniAuthData(request, key) {
|
|
|
12
12
|
let user;
|
|
13
13
|
const configService = new config_1.ConfigService(request);
|
|
14
14
|
if ((0, lodash_1.isEmpty)(headers['x-userid']) || (0, lodash_1.isEmpty)(headers['x-username'])) {
|
|
15
|
-
if (process.env.NODE_ENV === 'dev') {
|
|
15
|
+
if (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'uat') {
|
|
16
16
|
user = {
|
|
17
17
|
uid: configService.get('MOCK_UID'),
|
|
18
18
|
username: configService.get('MOCK_USERNAME'),
|
|
@@ -22,9 +22,6 @@ function getOmniAuthData(request, key) {
|
|
|
22
22
|
role: configService.get('MOCK_ROLE', ''),
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
else {
|
|
26
|
-
throw new Error('User information not found in headers.');
|
|
27
|
-
}
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
27
|
user = {
|
package/package.json
CHANGED
|
@@ -51,6 +51,9 @@ class ContextProvider {
|
|
|
51
51
|
static getAuthUserField(field) {
|
|
52
52
|
var _a;
|
|
53
53
|
const auth = (_a = ContextProvider.get(ContextProvider.authUserKey)) !== null && _a !== void 0 ? _a : {};
|
|
54
|
+
if (!auth) {
|
|
55
|
+
throw new Error('User information not found.');
|
|
56
|
+
}
|
|
54
57
|
return auth[field];
|
|
55
58
|
}
|
|
56
59
|
static getAuthUser() {
|
package/setup/bootstrap.setup.js
CHANGED
|
@@ -22,7 +22,6 @@ const common_1 = require("@nestjs/common");
|
|
|
22
22
|
const nestjs_sentry_1 = require("@ntegral/nestjs-sentry");
|
|
23
23
|
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
24
24
|
const crud_1 = require("@dataui/crud");
|
|
25
|
-
const auth_user_interceptor_1 = require("../interceptors/auth-user.interceptor");
|
|
26
25
|
const nestjs_cls_1 = require("nestjs-cls");
|
|
27
26
|
crud_1.CrudConfigService.load({
|
|
28
27
|
auth: {
|
|
@@ -69,7 +68,7 @@ function bootstrapSetup(AppModule, SetupSwagger) {
|
|
|
69
68
|
limit: '50mb',
|
|
70
69
|
}), new nestjs_cls_1.ClsMiddleware({}).use, (0, __1.RequestIdMiddleware)(), (0, __1.PowerByMiddleware)(), (0, __1.OmniAuthMiddleware)());
|
|
71
70
|
app.useStaticAssets('public', { prefix: '/' });
|
|
72
|
-
app.useGlobalInterceptors(new __1.LanguageInterceptor(), new
|
|
71
|
+
app.useGlobalInterceptors(new __1.LanguageInterceptor(), new __1.TranslationInterceptor(), new nestjs_pino_1.LoggerErrorInterceptor(), new nestjs_sentry_1.SentryInterceptor({
|
|
73
72
|
filters: [
|
|
74
73
|
{
|
|
75
74
|
type: common_1.HttpException,
|