ecrs-auth-core 1.0.6 → 1.0.9
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 +4 -0
- package/dist/auth.module.js +37 -1
- package/package.json +1 -1
package/dist/auth.module.d.ts
CHANGED
|
@@ -2,4 +2,8 @@ import { DynamicModule } from '@nestjs/common';
|
|
|
2
2
|
import { AuthCoreOptions } from './interfaces/auth-core-options.interface';
|
|
3
3
|
export declare class AuthCoreModule {
|
|
4
4
|
static register(options: AuthCoreOptions): DynamicModule;
|
|
5
|
+
static registerAsync(options: {
|
|
6
|
+
useFactory: (...args: any[]) => Promise<AuthCoreOptions> | AuthCoreOptions;
|
|
7
|
+
inject?: any[];
|
|
8
|
+
}): DynamicModule;
|
|
5
9
|
}
|
package/dist/auth.module.js
CHANGED
|
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var AuthCoreModule_1;
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.AuthCoreModule = void 0;
|
|
11
|
-
// src/auth.module.ts
|
|
12
11
|
const common_1 = require("@nestjs/common");
|
|
13
12
|
const jwt_1 = require("@nestjs/jwt");
|
|
14
13
|
const auth_service_1 = require("./auth.service");
|
|
@@ -57,6 +56,43 @@ let AuthCoreModule = AuthCoreModule_1 = class AuthCoreModule {
|
|
|
57
56
|
],
|
|
58
57
|
};
|
|
59
58
|
}
|
|
59
|
+
static registerAsync(options) {
|
|
60
|
+
return {
|
|
61
|
+
module: AuthCoreModule_1,
|
|
62
|
+
imports: [
|
|
63
|
+
jwt_1.JwtModule.register({
|
|
64
|
+
secret: process.env.JWT_SECRET || 'your-secret-key',
|
|
65
|
+
signOptions: { expiresIn: '1d' },
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
providers: [
|
|
69
|
+
auth_service_1.AuthService,
|
|
70
|
+
jwt_strategy_1.JwtStrategy,
|
|
71
|
+
jwt_guard_1.JwtAuthGuard,
|
|
72
|
+
module_guard_1.ModuleGuard,
|
|
73
|
+
roles_guard_1.RolesGuard,
|
|
74
|
+
feature_guard_1.FeatureGuard,
|
|
75
|
+
route_guard_1.RouteGuard,
|
|
76
|
+
permission_guard_1.PermissionGuard,
|
|
77
|
+
{
|
|
78
|
+
provide: 'AUTH_CORE_OPTIONS',
|
|
79
|
+
useFactory: options.useFactory,
|
|
80
|
+
inject: options.inject || [],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
controllers: [auth_controller_1.AuthController],
|
|
84
|
+
exports: [
|
|
85
|
+
auth_service_1.AuthService,
|
|
86
|
+
jwt_guard_1.JwtAuthGuard,
|
|
87
|
+
jwt_strategy_1.JwtStrategy,
|
|
88
|
+
module_guard_1.ModuleGuard,
|
|
89
|
+
roles_guard_1.RolesGuard,
|
|
90
|
+
feature_guard_1.FeatureGuard,
|
|
91
|
+
route_guard_1.RouteGuard,
|
|
92
|
+
permission_guard_1.PermissionGuard,
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
60
96
|
};
|
|
61
97
|
exports.AuthCoreModule = AuthCoreModule;
|
|
62
98
|
exports.AuthCoreModule = AuthCoreModule = AuthCoreModule_1 = __decorate([
|