@flusys/nestjs-auth 1.1.0-beta → 2.0.0-rc.0

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.
Files changed (86) hide show
  1. package/README.md +590 -473
  2. package/cjs/config/auth.constants.js +8 -0
  3. package/cjs/controllers/authentication.controller.js +218 -39
  4. package/cjs/controllers/branch.controller.js +44 -1
  5. package/cjs/controllers/company-selection.controller.js +27 -20
  6. package/cjs/controllers/company.controller.js +44 -1
  7. package/cjs/controllers/user-permission.controller.js +82 -154
  8. package/cjs/controllers/user.controller.js +68 -15
  9. package/cjs/docs/auth-swagger.config.js +14 -7
  10. package/cjs/dtos/authentication.dto.js +16 -43
  11. package/cjs/dtos/index.js +0 -1
  12. package/cjs/dtos/user-permission.dto.js +28 -0
  13. package/cjs/dtos/user.dto.js +19 -4
  14. package/cjs/entities/user-company-permission.entity.js +0 -6
  15. package/cjs/interceptors/clear-token.interceptor.js +10 -23
  16. package/cjs/interceptors/set-token.interceptor.js +15 -55
  17. package/cjs/interfaces/auth-email-provider.interface.js +1 -1
  18. package/cjs/modules/auth.module.js +63 -147
  19. package/cjs/services/auth-config.service.js +22 -28
  20. package/cjs/services/auth-datasource.provider.js +9 -21
  21. package/cjs/services/auth-email.service.js +89 -85
  22. package/cjs/services/authentication.service.js +225 -396
  23. package/cjs/services/branch.service.js +9 -4
  24. package/cjs/services/company-selection-session.service.js +1 -1
  25. package/cjs/services/user-permission.service.js +43 -73
  26. package/cjs/services/user.service.js +78 -64
  27. package/cjs/strategies/jwt.strategy.js +44 -44
  28. package/cjs/validators/password.validator.js +45 -0
  29. package/config/auth.constants.d.ts +2 -0
  30. package/controllers/authentication.controller.d.ts +5 -3
  31. package/controllers/company-selection.controller.d.ts +6 -2
  32. package/controllers/user-permission.controller.d.ts +5 -4
  33. package/controllers/user.controller.d.ts +6 -0
  34. package/dtos/authentication.dto.d.ts +0 -4
  35. package/dtos/company-branch.dto.d.ts +0 -1
  36. package/dtos/company.dto.d.ts +0 -1
  37. package/dtos/index.d.ts +0 -1
  38. package/dtos/user-permission.dto.d.ts +4 -0
  39. package/dtos/user.dto.d.ts +1 -3
  40. package/entities/index.d.ts +3 -3
  41. package/entities/user-company-permission.entity.d.ts +0 -2
  42. package/fesm/config/auth.constants.js +6 -13
  43. package/fesm/controllers/authentication.controller.js +221 -42
  44. package/fesm/controllers/branch.controller.js +45 -2
  45. package/fesm/controllers/company-selection.controller.js +28 -21
  46. package/fesm/controllers/company.controller.js +45 -2
  47. package/fesm/controllers/user-permission.controller.js +84 -156
  48. package/fesm/controllers/user.controller.js +71 -18
  49. package/fesm/docs/auth-swagger.config.js +14 -7
  50. package/fesm/dtos/authentication.dto.js +17 -44
  51. package/fesm/dtos/index.js +0 -1
  52. package/fesm/dtos/user-permission.dto.js +28 -0
  53. package/fesm/dtos/user.dto.js +20 -5
  54. package/fesm/entities/user-company-permission.entity.js +0 -6
  55. package/fesm/interceptors/clear-token.interceptor.js +9 -22
  56. package/fesm/interceptors/set-token.interceptor.js +14 -54
  57. package/fesm/interfaces/auth-email-provider.interface.js +1 -1
  58. package/fesm/modules/auth.module.js +64 -148
  59. package/fesm/services/auth-config.service.js +23 -29
  60. package/fesm/services/auth-datasource.provider.js +10 -22
  61. package/fesm/services/auth-email.service.js +90 -86
  62. package/fesm/services/authentication.service.js +225 -396
  63. package/fesm/services/branch.service.js +9 -4
  64. package/fesm/services/company-selection-session.service.js +1 -1
  65. package/fesm/services/user-permission.service.js +44 -74
  66. package/fesm/services/user.service.js +79 -65
  67. package/fesm/strategies/jwt.strategy.js +44 -44
  68. package/fesm/validators/password.validator.js +48 -0
  69. package/interceptors/clear-token.interceptor.d.ts +0 -1
  70. package/interceptors/set-token.interceptor.d.ts +1 -1
  71. package/interfaces/authentication.interface.d.ts +0 -4
  72. package/interfaces/user-enricher.interface.d.ts +1 -4
  73. package/modules/auth.module.d.ts +6 -3
  74. package/package.json +4 -4
  75. package/services/auth-config.service.d.ts +6 -8
  76. package/services/auth-datasource.provider.d.ts +2 -4
  77. package/services/auth-email.service.d.ts +8 -4
  78. package/services/authentication.service.d.ts +15 -16
  79. package/services/company-selection-session.service.d.ts +1 -1
  80. package/services/user-permission.service.d.ts +6 -9
  81. package/services/user.service.d.ts +3 -0
  82. package/strategies/jwt.strategy.d.ts +4 -1
  83. package/validators/password.validator.d.ts +10 -0
  84. package/cjs/dtos/user-company-permission.dto.js +0 -110
  85. package/dtos/user-company-permission.dto.d.ts +0 -10
  86. package/fesm/dtos/user-company-permission.dto.js +0 -98
@@ -12,16 +12,15 @@ const _modules = require("@flusys/nestjs-shared/modules");
12
12
  const _common = require("@nestjs/common");
13
13
  const _jwt = require("@nestjs/jwt");
14
14
  const _passport = require("@nestjs/passport");
15
- const _typeorm = require("@nestjs/typeorm");
16
- const _authconfigservice = require("../services/auth-config.service");
17
- const _authdatasourceprovider = require("../services/auth-datasource.provider");
15
+ const _guards = require("@flusys/nestjs-shared/guards");
18
16
  const _authconstants = require("../config/auth.constants");
19
17
  const _controllers = require("../controllers");
20
18
  const _entities = require("../entities");
21
- const _guards = require("@flusys/nestjs-shared/guards");
22
19
  const _cleartokeninterceptor = require("../interceptors/clear-token.interceptor");
23
20
  const _settokeninterceptor = require("../interceptors/set-token.interceptor");
24
21
  const _services = require("../services");
22
+ const _authconfigservice = require("../services/auth-config.service");
23
+ const _authdatasourceprovider = require("../services/auth-datasource.provider");
25
24
  const _jwtstrategy = require("../strategies/jwt.strategy");
26
25
  function _ts_decorate(decorators, target, key, desc) {
27
26
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -31,82 +30,42 @@ function _ts_decorate(decorators, target, key, desc) {
31
30
  }
32
31
  let AuthModule = class AuthModule {
33
32
  static forRoot(options) {
34
- return this.buildDynamicModule(options);
33
+ const optionsProvider = {
34
+ provide: _authconstants.AUTH_MODULE_OPTIONS,
35
+ useValue: options
36
+ };
37
+ return this.buildModule(options, [
38
+ optionsProvider,
39
+ ...options.providers ?? []
40
+ ]);
35
41
  }
36
- static forRootAsync(asyncOptions) {
37
- const { global = false, includeController = true, bootstrapAppConfig: { enableCompanyFeature } = {}, imports: externalImports = [], providers: additionalProviders = [] } = asyncOptions;
38
- const asyncProviders = this.createAsyncProviders(asyncOptions);
39
- // Build imports
40
- const imports = [
41
- ...externalImports,
42
- _passport.PassportModule.register({
43
- defaultStrategy: 'jwt'
44
- }),
45
- _jwt.JwtModule.register({}),
46
- _modules.CacheModule,
47
- _modules.UtilsModule
48
- ];
49
- // Build controllers based on configuration
50
- const controllers = [];
51
- if (includeController) {
52
- // Core authentication controller (always included)
53
- controllers.push(_controllers.AuthenticationController);
54
- // User controller (always included)
55
- controllers.push(_controllers.UserController);
56
- // Company feature controllers (conditional)
57
- if (enableCompanyFeature) {
58
- controllers.push(_controllers.CompanySelectionController, _controllers.CompanyController, _controllers.BranchController, _controllers.UserPermissionController);
59
- }
60
- }
61
- // Build providers
62
- const providers = [
42
+ static forRootAsync(options) {
43
+ const asyncProviders = this.createAsyncProviders(options);
44
+ return this.buildModule(options, [
63
45
  ...asyncProviders,
64
- ...additionalProviders,
65
- // Config & Infrastructure
66
- _authconfigservice.AuthConfigService,
67
- _authdatasourceprovider.AuthDataSourceProvider,
68
- // Auth core
69
- _jwtstrategy.JwtStrategy,
70
- _guards.JwtAuthGuard,
71
- _services.AuthenticationService,
72
- _services.AuthEmailService,
73
- // Interceptors
74
- _settokeninterceptor.SetToken,
75
- _cleartokeninterceptor.ClearToken,
76
- // Core services (always included)
77
- _services.UserService
78
- ];
79
- // Company feature services (conditional)
80
- if (enableCompanyFeature) {
81
- providers.push(_services.CompanySelectionSessionService, _services.CompanyService, _services.BranchService, _services.UserPermissionService);
82
- }
83
- // Build exports
84
- const exports1 = [
85
- _passport.PassportModule,
86
- _authconstants.AUTH_MODULE_OPTIONS,
87
- _authconfigservice.AuthConfigService,
88
- _authdatasourceprovider.AuthDataSourceProvider,
89
- _jwtstrategy.JwtStrategy,
90
- _guards.JwtAuthGuard,
91
- _services.AuthenticationService,
92
- _services.AuthEmailService,
93
- _services.UserService
94
- ];
95
- if (enableCompanyFeature) {
96
- exports1.push(_services.CompanySelectionSessionService, _services.CompanyService, _services.BranchService, _services.UserPermissionService);
97
- }
46
+ ...options.providers ?? []
47
+ ], options.imports);
48
+ }
49
+ /** Build the dynamic module with shared logic */ static buildModule(options, providers, externalImports = []) {
50
+ const { global = false, includeController = true, bootstrapAppConfig } = options;
51
+ const enableCompanyFeature = bootstrapAppConfig?.enableCompanyFeature ?? false;
98
52
  return {
99
53
  module: AuthModule,
100
54
  global,
101
- imports,
102
- controllers,
103
- providers,
104
- exports: exports1
55
+ imports: [
56
+ ...externalImports,
57
+ ...this.buildImports()
58
+ ],
59
+ controllers: this.buildControllers(includeController, enableCompanyFeature),
60
+ providers: [
61
+ ...providers,
62
+ ...this.buildProviders(enableCompanyFeature)
63
+ ],
64
+ exports: this.buildExports(enableCompanyFeature)
105
65
  };
106
66
  }
107
- static buildDynamicModule(options) {
108
- const { bootstrapAppConfig: { enableCompanyFeature } = {}, includeController = true, global = false, providers: additionalProviders = [] } = options;
109
- const imports = [
67
+ /** Common module imports */ static buildImports() {
68
+ return [
110
69
  _passport.PassportModule.register({
111
70
  defaultStrategy: 'jwt'
112
71
  }),
@@ -114,42 +73,36 @@ let AuthModule = class AuthModule {
114
73
  _modules.CacheModule,
115
74
  _modules.UtilsModule
116
75
  ];
117
- // Build controllers based on configuration
118
- const controllers = [];
119
- if (includeController) {
120
- // Core authentication controller (always included)
121
- controllers.push(_controllers.AuthenticationController);
122
- // User controller (always included)
123
- controllers.push(_controllers.UserController);
124
- // Company feature controllers (conditional)
125
- if (enableCompanyFeature) {
126
- controllers.push(_controllers.CompanySelectionController, _controllers.CompanyController, _controllers.BranchController, _controllers.UserPermissionController);
127
- }
76
+ }
77
+ /** Build controllers based on feature flags */ static buildControllers(includeController, enableCompanyFeature) {
78
+ if (!includeController) return [];
79
+ const controllers = [
80
+ _controllers.AuthenticationController,
81
+ _controllers.UserController
82
+ ];
83
+ if (enableCompanyFeature) {
84
+ controllers.push(_controllers.CompanySelectionController, _controllers.CompanyController, _controllers.BranchController, _controllers.UserPermissionController);
128
85
  }
86
+ return controllers;
87
+ }
88
+ /** Core providers (without AUTH_MODULE_OPTIONS - that's added separately) */ static buildProviders(enableCompanyFeature) {
129
89
  const providers = [
130
- {
131
- provide: _authconstants.AUTH_MODULE_OPTIONS,
132
- useValue: options
133
- },
134
- ...additionalProviders,
135
- // Config & Infrastructure
136
90
  _authconfigservice.AuthConfigService,
137
91
  _authdatasourceprovider.AuthDataSourceProvider,
138
- // Auth core
139
92
  _jwtstrategy.JwtStrategy,
140
93
  _guards.JwtAuthGuard,
141
94
  _services.AuthenticationService,
142
95
  _services.AuthEmailService,
143
- // Interceptors
144
96
  _settokeninterceptor.SetToken,
145
97
  _cleartokeninterceptor.ClearToken,
146
- // Core services (always included)
147
98
  _services.UserService
148
99
  ];
149
- // Company feature services (conditional)
150
100
  if (enableCompanyFeature) {
151
101
  providers.push(_services.CompanySelectionSessionService, _services.CompanyService, _services.BranchService, _services.UserPermissionService);
152
102
  }
103
+ return providers;
104
+ }
105
+ /** Build module exports */ static buildExports(enableCompanyFeature) {
153
106
  const exports1 = [
154
107
  _passport.PassportModule,
155
108
  _authconstants.AUTH_MODULE_OPTIONS,
@@ -164,16 +117,9 @@ let AuthModule = class AuthModule {
164
117
  if (enableCompanyFeature) {
165
118
  exports1.push(_services.CompanySelectionSessionService, _services.CompanyService, _services.BranchService, _services.UserPermissionService);
166
119
  }
167
- return {
168
- module: AuthModule,
169
- global,
170
- imports,
171
- controllers,
172
- providers,
173
- exports: exports1
174
- };
120
+ return exports1;
175
121
  }
176
- static createAsyncProviders(options) {
122
+ /** Create async providers for forRootAsync */ static createAsyncProviders(options) {
177
123
  const staticOptions = {
178
124
  global: options.global,
179
125
  includeController: options.includeController,
@@ -183,13 +129,10 @@ let AuthModule = class AuthModule {
183
129
  return [
184
130
  {
185
131
  provide: _authconstants.AUTH_MODULE_OPTIONS,
186
- useFactory: async (...args)=>{
187
- const config = await options.useFactory(...args);
188
- return {
132
+ useFactory: async (...args)=>({
189
133
  ...staticOptions,
190
- config
191
- };
192
- },
134
+ config: await options.useFactory(...args)
135
+ }),
193
136
  inject: options.inject || []
194
137
  }
195
138
  ];
@@ -202,13 +145,10 @@ let AuthModule = class AuthModule {
202
145
  },
203
146
  {
204
147
  provide: _authconstants.AUTH_MODULE_OPTIONS,
205
- useFactory: async (factory)=>{
206
- const config = await factory.createAuthOptions();
207
- return {
148
+ useFactory: async (factory)=>({
208
149
  ...staticOptions,
209
- config
210
- };
211
- },
150
+ config: await factory.createAuthOptions()
151
+ }),
212
152
  inject: [
213
153
  options.useClass
214
154
  ]
@@ -219,13 +159,10 @@ let AuthModule = class AuthModule {
219
159
  return [
220
160
  {
221
161
  provide: _authconstants.AUTH_MODULE_OPTIONS,
222
- useFactory: async (factory)=>{
223
- const config = await factory.createAuthOptions();
224
- return {
162
+ useFactory: async (factory)=>({
225
163
  ...staticOptions,
226
- config
227
- };
228
- },
164
+ config: await factory.createAuthOptions()
165
+ }),
229
166
  inject: [
230
167
  options.useExisting
231
168
  ]
@@ -239,35 +176,14 @@ let AuthModule = class AuthModule {
239
176
  }
240
177
  ];
241
178
  }
242
- /**
243
- * Create repository providers that use AuthDataSourceProvider
244
- * This replaces TypeOrmModule.forFeature() functionality
245
- * Note: Must be REQUEST-scoped since AuthDataSourceProvider is REQUEST-scoped
246
- */ static getRepositoryProviders(enableCompanyFeature) {
247
- const entities = this.getEntities(enableCompanyFeature);
248
- return entities.map((entity)=>({
249
- provide: (0, _typeorm.getRepositoryToken)(entity),
250
- scope: _common.Scope.REQUEST,
251
- useFactory: async (dataSourceProvider)=>{
252
- return await dataSourceProvider.getRepository(entity);
253
- },
254
- inject: [
255
- _authdatasourceprovider.AuthDataSourceProvider
256
- ]
257
- }));
258
- }
259
- static getEntities(enableCompanyFeature = false) {
260
- const coreEntities = [
261
- _entities.User
262
- ];
263
- const companyEntities = enableCompanyFeature ? [
179
+ /** Get auth entities based on feature flags */ static getEntities(enableCompanyFeature = false) {
180
+ return enableCompanyFeature ? [
181
+ _entities.User,
264
182
  _entities.Company,
265
183
  _entities.CompanyBranch,
266
184
  _entities.UserCompanyPermission
267
- ] : [];
268
- return [
269
- ...coreEntities,
270
- ...companyEntities
185
+ ] : [
186
+ _entities.User
271
187
  ];
272
188
  }
273
189
  };
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "AuthConfigService", {
9
9
  }
10
10
  });
11
11
  const _common = require("@nestjs/common");
12
- const _authmoduleoptionsinterface = require("../interfaces/auth-module-options.interface");
13
12
  const _authconstants = require("../config/auth.constants");
13
+ const _authmoduleoptionsinterface = require("../interfaces/auth-module-options.interface");
14
14
  function _define_property(obj, key, value) {
15
15
  if (key in obj) {
16
16
  Object.defineProperty(obj, key, {
@@ -39,26 +39,39 @@ function _ts_param(paramIndex, decorator) {
39
39
  };
40
40
  }
41
41
  let AuthConfigService = class AuthConfigService {
42
- // Database Mode
43
- /** Get database mode (single or multi-tenant) */ getDatabaseMode() {
42
+ // Database Mode (required by IModuleConfigService)
43
+ getDatabaseMode() {
44
44
  return this.options.bootstrapAppConfig?.databaseMode ?? 'single';
45
45
  }
46
- /** Check if running in multi-tenant mode */ isMultiTenant() {
46
+ isMultiTenant() {
47
47
  return this.getDatabaseMode() === 'multi-tenant';
48
48
  }
49
49
  // Feature Flags
50
- /** Check if company feature is enabled */ isCompanyFeatureEnabled() {
50
+ isCompanyFeatureEnabled() {
51
51
  return this.options.bootstrapAppConfig?.enableCompanyFeature ?? false;
52
52
  }
53
53
  // JWT Configuration
54
54
  /** Get JWT secret key */ getJwtSecret() {
55
- return this.config.jwtSecret ?? 'default-secret-change-in-production';
55
+ if (!this.config.jwtSecret) {
56
+ throw new _common.InternalServerErrorException('[AuthModule] JWT_SECRET is required - set via environment or module config');
57
+ }
58
+ return this.config.jwtSecret;
56
59
  }
57
60
  /** Get JWT expiration time */ getJwtExpiration() {
58
61
  return this.config.jwtExpiration ?? '1h';
59
62
  }
60
63
  /** Get refresh token secret key */ getRefreshTokenSecret() {
61
- return this.config.refreshTokenSecret ?? this.getJwtSecret();
64
+ if (this.config.refreshTokenSecret) {
65
+ return this.config.refreshTokenSecret;
66
+ }
67
+ if (process.env.NODE_ENV === 'production') {
68
+ throw new _common.InternalServerErrorException('[AuthModule] REFRESH_TOKEN_SECRET is required in production - ' + 'using the same secret for access and refresh tokens is a security risk');
69
+ }
70
+ if (!this.refreshTokenSecretWarned) {
71
+ this.refreshTokenSecretWarned = true;
72
+ this.logger.warn('REFRESH_TOKEN_SECRET not configured - using JWT_SECRET as fallback. ' + 'For better security, configure a separate refresh token secret.');
73
+ }
74
+ return this.getJwtSecret();
62
75
  }
63
76
  /** Get refresh token expiration time */ getRefreshTokenExpiration() {
64
77
  return this.config.refreshTokenExpiration ?? '7d';
@@ -70,30 +83,11 @@ let AuthConfigService = class AuthConfigService {
70
83
  /** Get frontend URL for email links */ getFrontendUrl() {
71
84
  return this.config.frontendUrl;
72
85
  }
73
- // Database Configuration
74
- /** Get default database config */ getDefaultDatabaseConfig() {
75
- return this.config.defaultDatabaseConfig ?? this.config.tenantDefaultDatabaseConfig;
76
- }
77
- /** Get tenant default database config (for multi-tenant) */ getTenantDefaultDatabaseConfig() {
78
- return this.config.tenantDefaultDatabaseConfig;
79
- }
80
- /** Get registered tenants */ getTenants() {
81
- return this.config.tenants ?? [];
82
- }
83
- // Raw Options
84
- /** Get full module options */ getOptions() {
85
- return {
86
- ...this.options
87
- };
88
- }
89
- /** Get runtime config */ getConfig() {
90
- return {
91
- ...this.config
92
- };
93
- }
94
86
  constructor(injectedOptions){
87
+ _define_property(this, "logger", new _common.Logger(AuthConfigService.name));
95
88
  _define_property(this, "options", void 0);
96
89
  _define_property(this, "config", void 0);
90
+ _define_property(this, "refreshTokenSecretWarned", false);
97
91
  this.options = injectedOptions ?? {
98
92
  global: false,
99
93
  includeController: true
@@ -92,7 +92,7 @@ let AuthDataSourceProvider = class AuthDataSourceProvider extends _modules.Multi
92
92
  const lockPromise = (async ()=>{
93
93
  const config = this.getDefaultDatabaseConfig();
94
94
  if (!config) {
95
- throw new Error('Default database config is not available');
95
+ throw new _common.InternalServerErrorException('Default database config is not available');
96
96
  }
97
97
  const ds = await this.createDataSourceFromConfig(config);
98
98
  AuthDataSourceProvider.singleDataSource = ds;
@@ -141,40 +141,28 @@ let AuthDataSourceProvider = class AuthDataSourceProvider extends _modules.Multi
141
141
  };
142
142
  }
143
143
  // Feature Flags
144
- /** Get global enable company feature flag */ getEnableCompanyFeature() {
145
- return this.authOptions.bootstrapAppConfig?.enableCompanyFeature ?? false;
146
- }
147
- /** Get enable company feature for specific tenant. Falls back to global setting. */ getEnableCompanyFeatureForTenant(tenant) {
148
- return tenant?.enableCompanyFeature ?? this.getEnableCompanyFeature();
149
- }
150
- /** Get enable company feature for current request context */ getEnableCompanyFeatureForCurrentTenant() {
151
- return this.getEnableCompanyFeatureForTenant(this.getCurrentTenant() ?? undefined);
144
+ /** Check if company feature is enabled (tenant-specific or global fallback) */ isCompanyFeatureEnabled(tenant) {
145
+ const effectiveTenant = tenant ?? this.getCurrentTenant();
146
+ return effectiveTenant?.enableCompanyFeature ?? this.authOptions.bootstrapAppConfig?.enableCompanyFeature ?? false;
152
147
  }
153
148
  // Entity Management
154
- /** Get auth entities based on company feature flag */ async getAuthEntities(enableCompanyFeature) {
155
- const enable = enableCompanyFeature ?? this.getEnableCompanyFeature();
149
+ /** Get auth entities based on company feature flag */ async getAuthEntities() {
156
150
  const { Company, CompanyBranch, User, UserCompanyPermission, UserToken, PendingRegistration } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../entities")));
157
151
  const coreEntities = [
158
152
  User,
159
153
  UserToken,
160
154
  PendingRegistration
161
155
  ];
162
- const companyEntities = enable ? [
156
+ return this.isCompanyFeatureEnabled() ? [
157
+ ...coreEntities,
163
158
  Company,
164
159
  CompanyBranch,
165
160
  UserCompanyPermission
166
- ] : [];
167
- return [
168
- ...coreEntities,
169
- ...companyEntities
170
- ];
161
+ ] : coreEntities;
171
162
  }
172
163
  // Overrides
173
164
  /** Override to dynamically set entities based on tenant config */ async createDataSourceFromConfig(config) {
174
- const currentTenant = this.getCurrentTenant();
175
- const enableCompanyFeature = this.getEnableCompanyFeatureForTenant(currentTenant ?? undefined);
176
- const entities = await this.getAuthEntities(enableCompanyFeature);
177
- return super.createDataSourceFromConfig(config, entities);
165
+ return super.createDataSourceFromConfig(config, await this.getAuthEntities());
178
166
  }
179
167
  constructor(authOptions, request){
180
168
  super(AuthDataSourceProvider.buildParentOptions(authOptions), request), _define_property(this, "authOptions", void 0), _define_property(this, "logger", void 0), this.authOptions = authOptions, this.logger = new _common.Logger(AuthDataSourceProvider.name);