ecrs-auth-core 1.0.26 → 1.0.28

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.
@@ -20,6 +20,64 @@ const feature_guard_1 = require("./guards/feature.guard");
20
20
  const route_guard_1 = require("./guards/route.guard");
21
21
  const permission_guard_1 = require("./guards/permission.guard");
22
22
  exports.AUTH_CORE_OPTIONS = 'AUTH_CORE_OPTIONS';
23
+ // @Global()
24
+ // @Module({})
25
+ // export class AuthCoreModule {
26
+ // static registerAsync(options: {
27
+ // inject: any[];
28
+ // useFactory: (...args: any[]) => Promise<AuthCoreOptions>;
29
+ // }): DynamicModule {
30
+ // const asyncProvider = {
31
+ // provide: AUTH_CORE_OPTIONS,
32
+ // inject: options.inject,
33
+ // useFactory: options.useFactory,
34
+ // };
35
+ // return {
36
+ // module: AuthCoreModule,
37
+ // imports: [JwtModule.register({})],
38
+ // providers: [
39
+ // asyncProvider,
40
+ // {
41
+ // provide: 'ASYNC_JWT_OPTIONS',
42
+ // useFactory: async (options: AuthCoreOptions) => ({
43
+ // secret: options.jwtSecret,
44
+ // signOptions: { expiresIn: options.jwtExpiresIn },
45
+ // }),
46
+ // inject: [AUTH_CORE_OPTIONS],
47
+ // },
48
+ // {
49
+ // provide: JwtModule,
50
+ // useFactory: async (jwtOptions: any) => JwtModule.register(jwtOptions),
51
+ // inject: ['ASYNC_JWT_OPTIONS'],
52
+ // },
53
+ // {
54
+ // provide: 'MODULE_CONFIG',
55
+ // useFactory: (options: AuthCoreOptions) => options.moduleConfig || {},
56
+ // inject: [AUTH_CORE_OPTIONS],
57
+ // },
58
+ // AuthService,
59
+ // JwtStrategy,
60
+ // JwtAuthGuard,
61
+ // ModuleGuard,
62
+ // RolesGuard,
63
+ // FeatureGuard,
64
+ // RouteGuard,
65
+ // PermissionGuard,
66
+ // ],
67
+ // controllers: [AuthController],
68
+ // exports: [
69
+ // AuthService,
70
+ // JwtStrategy,
71
+ // JwtAuthGuard,
72
+ // ModuleGuard,
73
+ // RolesGuard,
74
+ // FeatureGuard,
75
+ // RouteGuard,
76
+ // PermissionGuard,
77
+ // ],
78
+ // };
79
+ // }
80
+ // }
23
81
  let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
24
82
  static registerAsync(options) {
25
83
  const asyncProvider = {
@@ -27,24 +85,18 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
27
85
  inject: options.inject,
28
86
  useFactory: options.useFactory,
29
87
  };
88
+ const jwtModule = jwt_1.JwtModule.registerAsync({
89
+ inject: [exports.AUTH_CORE_OPTIONS],
90
+ useFactory: async (options) => ({
91
+ secret: options.jwtSecret,
92
+ signOptions: { expiresIn: options.jwtExpiresIn },
93
+ }),
94
+ });
30
95
  return {
31
96
  module: AuthCoreModule_1,
32
- imports: [jwt_1.JwtModule.register({})],
97
+ imports: [jwtModule],
33
98
  providers: [
34
99
  asyncProvider,
35
- {
36
- provide: 'ASYNC_JWT_OPTIONS',
37
- useFactory: async (options) => ({
38
- secret: options.jwtSecret,
39
- signOptions: { expiresIn: options.jwtExpiresIn },
40
- }),
41
- inject: [exports.AUTH_CORE_OPTIONS],
42
- },
43
- {
44
- provide: jwt_1.JwtModule,
45
- useFactory: async (jwtOptions) => jwt_1.JwtModule.register(jwtOptions),
46
- inject: ['ASYNC_JWT_OPTIONS'],
47
- },
48
100
  {
49
101
  provide: 'MODULE_CONFIG',
50
102
  useFactory: (options) => options.moduleConfig || {},
@@ -61,6 +113,7 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
61
113
  ],
62
114
  controllers: [auth_controller_1.AuthController],
63
115
  exports: [
116
+ jwt_1.JwtModule, // ✅ Export the configured JwtModule
64
117
  auth_service_1.AuthService,
65
118
  jwt_strategy_1.JwtStrategy,
66
119
  jwt_guard_1.JwtAuthGuard,
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.JwtStrategy = void 0;
13
- // src/jwt/jwt.strategy.ts
14
13
  const common_1 = require("@nestjs/common");
15
14
  const passport_1 = require("@nestjs/passport");
16
15
  const passport_jwt_1 = require("passport-jwt");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecrs-auth-core",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "Centralized authentication and authorization module for ECRS apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",