ecrs-auth-core 1.0.35 → 1.0.36
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.
- package/dist/auth.module.d.ts +2 -2
- package/dist/auth.module.js +24 -26
- package/package.json +1 -1
package/dist/auth.module.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DynamicModule } from
|
|
2
|
-
import { AuthCoreOptions } from
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { AuthCoreOptions } from './interfaces/auth-core-options.interface';
|
|
3
3
|
export declare const AUTH_CORE_OPTIONS = "AUTH_CORE_OPTIONS";
|
|
4
4
|
export declare class AuthCoreModule {
|
|
5
5
|
static registerAsync(options: {
|
package/dist/auth.module.js
CHANGED
|
@@ -19,7 +19,7 @@ const roles_guard_1 = require("./guards/roles.guard");
|
|
|
19
19
|
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
|
-
exports.AUTH_CORE_OPTIONS =
|
|
22
|
+
exports.AUTH_CORE_OPTIONS = 'AUTH_CORE_OPTIONS';
|
|
23
23
|
// @Global()
|
|
24
24
|
// @Module({})
|
|
25
25
|
// export class AuthCoreModule {
|
|
@@ -34,31 +34,24 @@ exports.AUTH_CORE_OPTIONS = "AUTH_CORE_OPTIONS";
|
|
|
34
34
|
// };
|
|
35
35
|
// return {
|
|
36
36
|
// module: AuthCoreModule,
|
|
37
|
-
// imports: [
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
// console.log(
|
|
44
|
-
// "🔐 JWT Secret from AUTH_CORE_OPTIONS:",
|
|
45
|
-
// options.jwtSecret
|
|
46
|
-
// );
|
|
47
|
-
// console.log("⏳ JWT Expiry:", options.jwtExpiresIn);
|
|
37
|
+
// imports: [
|
|
38
|
+
// JwtModule.registerAsync({
|
|
39
|
+
// inject: options.inject,
|
|
40
|
+
// useFactory: async (...args: any[]) => {
|
|
41
|
+
// const config = await options.useFactory(...args);
|
|
42
|
+
// console.log("🔐 JWT Secret from AUTH_CORE_OPTIONS:", config.jwtSecret);
|
|
43
|
+
// console.log("⏳ JWT Expiry:", config.jwtExpiresIn);
|
|
48
44
|
// return {
|
|
49
|
-
// secret:
|
|
50
|
-
// signOptions: { expiresIn:
|
|
45
|
+
// secret: config.jwtSecret,
|
|
46
|
+
// signOptions: { expiresIn: config.jwtExpiresIn },
|
|
51
47
|
// };
|
|
52
48
|
// },
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
// useFactory: async (jwtOptions: any) => JwtModule.register(jwtOptions),
|
|
58
|
-
// inject: ["ASYNC_JWT_OPTIONS"],
|
|
59
|
-
// },
|
|
49
|
+
// }),
|
|
50
|
+
// ],
|
|
51
|
+
// providers: [
|
|
52
|
+
// asyncProvider,
|
|
60
53
|
// {
|
|
61
|
-
// provide:
|
|
54
|
+
// provide: 'MODULE_CONFIG',
|
|
62
55
|
// useFactory: (options: AuthCoreOptions) => options.moduleConfig || {},
|
|
63
56
|
// inject: [AUTH_CORE_OPTIONS],
|
|
64
57
|
// },
|
|
@@ -81,6 +74,7 @@ exports.AUTH_CORE_OPTIONS = "AUTH_CORE_OPTIONS";
|
|
|
81
74
|
// FeatureGuard,
|
|
82
75
|
// RouteGuard,
|
|
83
76
|
// PermissionGuard,
|
|
77
|
+
// JwtModule,
|
|
84
78
|
// ],
|
|
85
79
|
// };
|
|
86
80
|
// }
|
|
@@ -99,8 +93,8 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
99
93
|
inject: options.inject,
|
|
100
94
|
useFactory: async (...args) => {
|
|
101
95
|
const config = await options.useFactory(...args);
|
|
102
|
-
console.log(
|
|
103
|
-
console.log(
|
|
96
|
+
console.log('🔐 JWT Secret from AUTH_CORE_OPTIONS:', config.jwtSecret);
|
|
97
|
+
console.log('⏳ JWT Expiry:', config.jwtExpiresIn);
|
|
104
98
|
return {
|
|
105
99
|
secret: config.jwtSecret,
|
|
106
100
|
signOptions: { expiresIn: config.jwtExpiresIn },
|
|
@@ -112,7 +106,7 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
112
106
|
asyncProvider,
|
|
113
107
|
{
|
|
114
108
|
provide: 'MODULE_CONFIG',
|
|
115
|
-
useFactory: (
|
|
109
|
+
useFactory: (opts) => opts.moduleConfig || {},
|
|
116
110
|
inject: [exports.AUTH_CORE_OPTIONS],
|
|
117
111
|
},
|
|
118
112
|
auth_service_1.AuthService,
|
|
@@ -126,6 +120,11 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
126
120
|
],
|
|
127
121
|
controllers: [auth_controller_1.AuthController],
|
|
128
122
|
exports: [
|
|
123
|
+
// ⬇️ export these so Superadmin can resolve guard deps
|
|
124
|
+
exports.AUTH_CORE_OPTIONS,
|
|
125
|
+
'MODULE_CONFIG',
|
|
126
|
+
// optional but handy:
|
|
127
|
+
jwt_1.JwtModule,
|
|
129
128
|
auth_service_1.AuthService,
|
|
130
129
|
jwt_strategy_1.JwtStrategy,
|
|
131
130
|
jwt_guard_1.JwtAuthGuard,
|
|
@@ -134,7 +133,6 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
134
133
|
feature_guard_1.FeatureGuard,
|
|
135
134
|
route_guard_1.RouteGuard,
|
|
136
135
|
permission_guard_1.PermissionGuard,
|
|
137
|
-
jwt_1.JwtModule, // ✅ Re-export so JwtService works in consuming modules
|
|
138
136
|
],
|
|
139
137
|
};
|
|
140
138
|
}
|