ecrs-auth-core 1.0.19 → 1.0.21

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.
@@ -29,12 +29,9 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
29
29
  return {
30
30
  module: AuthCoreModule_1,
31
31
  imports: [
32
- jwt_1.JwtModule.registerAsync({
33
- useFactory: (options) => ({
34
- secret: options.jwtSecret,
35
- signOptions: { expiresIn: options.jwtExpiresIn },
36
- }),
37
- inject: [exports.AUTH_CORE_OPTIONS],
32
+ jwt_1.JwtModule.register({
33
+ secret: options.jwtSecret,
34
+ signOptions: { expiresIn: options.jwtExpiresIn },
38
35
  }),
39
36
  ],
40
37
  controllers: [auth_controller_1.AuthController],
@@ -70,14 +67,17 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
70
67
  return {
71
68
  module: AuthCoreModule_1,
72
69
  imports: [
73
- jwt_1.JwtModule.register({
74
- secret: process.env.JWT_SECRET || "secret",
75
- signOptions: { expiresIn: "1d" },
70
+ jwt_1.JwtModule.registerAsync({
71
+ useFactory: (authOptions) => ({
72
+ secret: authOptions.jwtSecret,
73
+ signOptions: { expiresIn: authOptions.jwtExpiresIn },
74
+ }),
75
+ inject: [exports.AUTH_CORE_OPTIONS],
76
76
  }),
77
77
  ],
78
78
  controllers: [auth_controller_1.AuthController],
79
79
  providers: [
80
- asyncProvider,
80
+ asyncProvider, // ✅ Register the option provider before JwtModule uses it
81
81
  auth_service_1.AuthService,
82
82
  jwt_strategy_1.JwtStrategy,
83
83
  jwt_guard_1.JwtAuthGuard,
@@ -54,15 +54,15 @@ let AuthService = class AuthService {
54
54
  constructor(jwtService, options) {
55
55
  this.jwtService = jwtService;
56
56
  this.options = options;
57
- const { userRepo, roleRepo, moduleRepo, featureRepo, routeRepo, featureAccessRepo, moduleAccessRepo, screenPermissionRepo, } = options.repositories;
58
- this.userRepo = userRepo;
59
- this.roleRepo = roleRepo;
60
- this.moduleRepo = moduleRepo;
61
- this.featureRepo = featureRepo;
62
- this.routeRepo = routeRepo;
63
- this.featureAccessRepo = featureAccessRepo;
64
- this.moduleAccessRepo = moduleAccessRepo;
65
- this.screenPermissionRepo = screenPermissionRepo;
57
+ const { repositories } = options;
58
+ this.userRepo = repositories.userRepo;
59
+ this.roleRepo = repositories.roleRepo;
60
+ this.moduleRepo = repositories.moduleRepo;
61
+ this.featureRepo = repositories.featureRepo;
62
+ this.routeRepo = repositories.routeRepo;
63
+ this.featureAccessRepo = repositories.featureAccessRepo;
64
+ this.moduleAccessRepo = repositories.moduleAccessRepo;
65
+ this.screenPermissionRepo = repositories.screenPermissionRepo;
66
66
  }
67
67
  async validateUser(email, password) {
68
68
  const user = await this.userRepo.findOne({ where: { email } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecrs-auth-core",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "Centralized authentication and authorization module for ECRS apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",