ecrs-auth-core 1.0.34 → 1.0.35

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 (2) hide show
  1. package/dist/auth.module.js +80 -18
  2. package/package.json +1 -1
@@ -20,6 +20,71 @@ 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
+ // console.log(
44
+ // "🔐 JWT Secret from AUTH_CORE_OPTIONS:",
45
+ // options.jwtSecret
46
+ // );
47
+ // console.log("⏳ JWT Expiry:", options.jwtExpiresIn);
48
+ // return {
49
+ // secret: options.jwtSecret,
50
+ // signOptions: { expiresIn: options.jwtExpiresIn },
51
+ // };
52
+ // },
53
+ // inject: [AUTH_CORE_OPTIONS],
54
+ // },
55
+ // {
56
+ // provide: JwtModule,
57
+ // useFactory: async (jwtOptions: any) => JwtModule.register(jwtOptions),
58
+ // inject: ["ASYNC_JWT_OPTIONS"],
59
+ // },
60
+ // {
61
+ // provide: "MODULE_CONFIG",
62
+ // useFactory: (options: AuthCoreOptions) => options.moduleConfig || {},
63
+ // inject: [AUTH_CORE_OPTIONS],
64
+ // },
65
+ // AuthService,
66
+ // JwtStrategy,
67
+ // JwtAuthGuard,
68
+ // ModuleGuard,
69
+ // RolesGuard,
70
+ // FeatureGuard,
71
+ // RouteGuard,
72
+ // PermissionGuard,
73
+ // ],
74
+ // controllers: [AuthController],
75
+ // exports: [
76
+ // AuthService,
77
+ // JwtStrategy,
78
+ // JwtAuthGuard,
79
+ // ModuleGuard,
80
+ // RolesGuard,
81
+ // FeatureGuard,
82
+ // RouteGuard,
83
+ // PermissionGuard,
84
+ // ],
85
+ // };
86
+ // }
87
+ // }
23
88
  let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
24
89
  static registerAsync(options) {
25
90
  const asyncProvider = {
@@ -29,28 +94,24 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
29
94
  };
30
95
  return {
31
96
  module: AuthCoreModule_1,
32
- imports: [jwt_1.JwtModule.register({})],
33
- providers: [
34
- asyncProvider,
35
- {
36
- provide: "ASYNC_JWT_OPTIONS",
37
- useFactory: async (options) => {
38
- console.log("🔐 JWT Secret from AUTH_CORE_OPTIONS:", options.jwtSecret);
39
- console.log("⏳ JWT Expiry:", options.jwtExpiresIn);
97
+ imports: [
98
+ jwt_1.JwtModule.registerAsync({
99
+ inject: options.inject,
100
+ useFactory: async (...args) => {
101
+ const config = await options.useFactory(...args);
102
+ console.log("🔐 JWT Secret from AUTH_CORE_OPTIONS:", config.jwtSecret);
103
+ console.log(" JWT Expiry:", config.jwtExpiresIn);
40
104
  return {
41
- secret: options.jwtSecret,
42
- signOptions: { expiresIn: options.jwtExpiresIn },
105
+ secret: config.jwtSecret,
106
+ signOptions: { expiresIn: config.jwtExpiresIn },
43
107
  };
44
108
  },
45
- inject: [exports.AUTH_CORE_OPTIONS],
46
- },
47
- {
48
- provide: jwt_1.JwtModule,
49
- useFactory: async (jwtOptions) => jwt_1.JwtModule.register(jwtOptions),
50
- inject: ["ASYNC_JWT_OPTIONS"],
51
- },
109
+ }),
110
+ ],
111
+ providers: [
112
+ asyncProvider,
52
113
  {
53
- provide: "MODULE_CONFIG",
114
+ provide: 'MODULE_CONFIG',
54
115
  useFactory: (options) => options.moduleConfig || {},
55
116
  inject: [exports.AUTH_CORE_OPTIONS],
56
117
  },
@@ -73,6 +134,7 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
73
134
  feature_guard_1.FeatureGuard,
74
135
  route_guard_1.RouteGuard,
75
136
  permission_guard_1.PermissionGuard,
137
+ jwt_1.JwtModule, // ✅ Re-export so JwtService works in consuming modules
76
138
  ],
77
139
  };
78
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecrs-auth-core",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "Centralized authentication and authorization module for ECRS apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",