@os.io/nest-kit 0.0.1-alpha.0 → 0.0.1-alpha.1
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/README.md +30 -30
- package/package.json +41 -5
- package/dist/auth/auth.constants.d.ts +0 -19
- package/dist/auth/auth.constants.d.ts.map +0 -1
- package/dist/auth/auth.constants.js +0 -19
- package/dist/auth/auth.constants.js.map +0 -1
- package/dist/auth/auth.guard.d.ts +0 -20
- package/dist/auth/auth.guard.d.ts.map +0 -1
- package/dist/auth/auth.guard.js +0 -84
- package/dist/auth/auth.guard.js.map +0 -1
- package/dist/auth/auth.module.d.ts +0 -26
- package/dist/auth/auth.module.d.ts.map +0 -1
- package/dist/auth/auth.module.js +0 -344
- package/dist/auth/auth.module.js.map +0 -1
- package/dist/auth/auth.options.d.ts +0 -179
- package/dist/auth/auth.options.d.ts.map +0 -1
- package/dist/auth/auth.options.js +0 -2
- package/dist/auth/auth.options.js.map +0 -1
- package/dist/auth/auth.service.d.ts +0 -57
- package/dist/auth/auth.service.d.ts.map +0 -1
- package/dist/auth/auth.service.js +0 -175
- package/dist/auth/auth.service.js.map +0 -1
- package/dist/auth/authorization/index.d.ts +0 -3
- package/dist/auth/authorization/index.d.ts.map +0 -1
- package/dist/auth/authorization/index.js +0 -3
- package/dist/auth/authorization/index.js.map +0 -1
- package/dist/auth/authorization/pbac/index.d.ts +0 -6
- package/dist/auth/authorization/pbac/index.d.ts.map +0 -1
- package/dist/auth/authorization/pbac/index.js +0 -4
- package/dist/auth/authorization/pbac/index.js.map +0 -1
- package/dist/auth/authorization/pbac/pbac.decorator.d.ts +0 -18
- package/dist/auth/authorization/pbac/pbac.decorator.d.ts.map +0 -1
- package/dist/auth/authorization/pbac/pbac.decorator.js +0 -14
- package/dist/auth/authorization/pbac/pbac.decorator.js.map +0 -1
- package/dist/auth/authorization/pbac/pbac.guard.d.ts +0 -19
- package/dist/auth/authorization/pbac/pbac.guard.d.ts.map +0 -1
- package/dist/auth/authorization/pbac/pbac.guard.js +0 -60
- package/dist/auth/authorization/pbac/pbac.guard.js.map +0 -1
- package/dist/auth/authorization/pbac/pbac.service.d.ts +0 -44
- package/dist/auth/authorization/pbac/pbac.service.d.ts.map +0 -1
- package/dist/auth/authorization/pbac/pbac.service.js +0 -146
- package/dist/auth/authorization/pbac/pbac.service.js.map +0 -1
- package/dist/auth/authorization/pbac/pbac.types.d.ts +0 -47
- package/dist/auth/authorization/pbac/pbac.types.d.ts.map +0 -1
- package/dist/auth/authorization/pbac/pbac.types.js +0 -2
- package/dist/auth/authorization/pbac/pbac.types.js.map +0 -1
- package/dist/auth/authorization/rbac/index.d.ts +0 -4
- package/dist/auth/authorization/rbac/index.d.ts.map +0 -1
- package/dist/auth/authorization/rbac/index.js +0 -4
- package/dist/auth/authorization/rbac/index.js.map +0 -1
- package/dist/auth/authorization/rbac/rbac.decorator.d.ts +0 -18
- package/dist/auth/authorization/rbac/rbac.decorator.d.ts.map +0 -1
- package/dist/auth/authorization/rbac/rbac.decorator.js +0 -25
- package/dist/auth/authorization/rbac/rbac.decorator.js.map +0 -1
- package/dist/auth/authorization/rbac/rbac.guard.d.ts +0 -19
- package/dist/auth/authorization/rbac/rbac.guard.d.ts.map +0 -1
- package/dist/auth/authorization/rbac/rbac.guard.js +0 -50
- package/dist/auth/authorization/rbac/rbac.guard.js.map +0 -1
- package/dist/auth/authorization/rbac/rbac.service.d.ts +0 -43
- package/dist/auth/authorization/rbac/rbac.service.d.ts.map +0 -1
- package/dist/auth/authorization/rbac/rbac.service.js +0 -95
- package/dist/auth/authorization/rbac/rbac.service.js.map +0 -1
- package/dist/auth/decorators/current-user.decorator.d.ts +0 -17
- package/dist/auth/decorators/current-user.decorator.d.ts.map +0 -1
- package/dist/auth/decorators/current-user.decorator.js +0 -23
- package/dist/auth/decorators/current-user.decorator.js.map +0 -1
- package/dist/auth/decorators/index.d.ts +0 -3
- package/dist/auth/decorators/index.d.ts.map +0 -1
- package/dist/auth/decorators/index.js +0 -3
- package/dist/auth/decorators/index.js.map +0 -1
- package/dist/auth/decorators/public.decorator.d.ts +0 -13
- package/dist/auth/decorators/public.decorator.d.ts.map +0 -1
- package/dist/auth/decorators/public.decorator.js +0 -15
- package/dist/auth/decorators/public.decorator.js.map +0 -1
- package/dist/auth/index.d.ts +0 -63
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -65
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/interfaces/auth-request.interface.d.ts +0 -18
- package/dist/auth/interfaces/auth-request.interface.d.ts.map +0 -1
- package/dist/auth/interfaces/auth-request.interface.js +0 -2
- package/dist/auth/interfaces/auth-request.interface.js.map +0 -1
- package/dist/auth/interfaces/auth-result.interface.d.ts +0 -28
- package/dist/auth/interfaces/auth-result.interface.d.ts.map +0 -1
- package/dist/auth/interfaces/auth-result.interface.js +0 -2
- package/dist/auth/interfaces/auth-result.interface.js.map +0 -1
- package/dist/auth/interfaces/auth-strategy.interface.d.ts +0 -37
- package/dist/auth/interfaces/auth-strategy.interface.d.ts.map +0 -1
- package/dist/auth/interfaces/auth-strategy.interface.js +0 -16
- package/dist/auth/interfaces/auth-strategy.interface.js.map +0 -1
- package/dist/auth/interfaces/auth-user.interface.d.ts +0 -25
- package/dist/auth/interfaces/auth-user.interface.d.ts.map +0 -1
- package/dist/auth/interfaces/auth-user.interface.js +0 -2
- package/dist/auth/interfaces/auth-user.interface.js.map +0 -1
- package/dist/auth/interfaces/cache-service.interface.d.ts +0 -30
- package/dist/auth/interfaces/cache-service.interface.d.ts.map +0 -1
- package/dist/auth/interfaces/cache-service.interface.js +0 -2
- package/dist/auth/interfaces/cache-service.interface.js.map +0 -1
- package/dist/auth/interfaces/index.d.ts +0 -8
- package/dist/auth/interfaces/index.d.ts.map +0 -1
- package/dist/auth/interfaces/index.js +0 -2
- package/dist/auth/interfaces/index.js.map +0 -1
- package/dist/auth/interfaces/user-service.interface.d.ts +0 -34
- package/dist/auth/interfaces/user-service.interface.d.ts.map +0 -1
- package/dist/auth/interfaces/user-service.interface.js +0 -2
- package/dist/auth/interfaces/user-service.interface.js.map +0 -1
- package/dist/auth/password/password.service.d.ts +0 -23
- package/dist/auth/password/password.service.d.ts.map +0 -1
- package/dist/auth/password/password.service.js +0 -52
- package/dist/auth/password/password.service.js.map +0 -1
- package/dist/auth/session/device-session.service.d.ts +0 -43
- package/dist/auth/session/device-session.service.d.ts.map +0 -1
- package/dist/auth/session/device-session.service.js +0 -72
- package/dist/auth/session/device-session.service.js.map +0 -1
- package/dist/auth/session/index.d.ts +0 -5
- package/dist/auth/session/index.d.ts.map +0 -1
- package/dist/auth/session/index.js +0 -4
- package/dist/auth/session/index.js.map +0 -1
- package/dist/auth/session/jwt.service.d.ts +0 -37
- package/dist/auth/session/jwt.service.d.ts.map +0 -1
- package/dist/auth/session/jwt.service.js +0 -119
- package/dist/auth/session/jwt.service.js.map +0 -1
- package/dist/auth/session/token-blacklist.service.d.ts +0 -37
- package/dist/auth/session/token-blacklist.service.d.ts.map +0 -1
- package/dist/auth/session/token-blacklist.service.js +0 -70
- package/dist/auth/session/token-blacklist.service.js.map +0 -1
- package/dist/auth/strategies/anonymous/anonymous.strategy.d.ts +0 -19
- package/dist/auth/strategies/anonymous/anonymous.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/anonymous/anonymous.strategy.js +0 -49
- package/dist/auth/strategies/anonymous/anonymous.strategy.js.map +0 -1
- package/dist/auth/strategies/base/base.strategy.d.ts +0 -11
- package/dist/auth/strategies/base/base.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/base/base.strategy.js +0 -6
- package/dist/auth/strategies/base/base.strategy.js.map +0 -1
- package/dist/auth/strategies/credentials/credentials.strategy.d.ts +0 -21
- package/dist/auth/strategies/credentials/credentials.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/credentials/credentials.strategy.js +0 -67
- package/dist/auth/strategies/credentials/credentials.strategy.js.map +0 -1
- package/dist/auth/strategies/index.d.ts +0 -12
- package/dist/auth/strategies/index.d.ts.map +0 -1
- package/dist/auth/strategies/index.js +0 -12
- package/dist/auth/strategies/index.js.map +0 -1
- package/dist/auth/strategies/magic-link/magic-link.strategy.d.ts +0 -31
- package/dist/auth/strategies/magic-link/magic-link.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/magic-link/magic-link.strategy.js +0 -88
- package/dist/auth/strategies/magic-link/magic-link.strategy.js.map +0 -1
- package/dist/auth/strategies/oauth/index.d.ts +0 -3
- package/dist/auth/strategies/oauth/index.d.ts.map +0 -1
- package/dist/auth/strategies/oauth/index.js +0 -3
- package/dist/auth/strategies/oauth/index.js.map +0 -1
- package/dist/auth/strategies/oauth/oauth-provider-registry.d.ts +0 -13
- package/dist/auth/strategies/oauth/oauth-provider-registry.d.ts.map +0 -1
- package/dist/auth/strategies/oauth/oauth-provider-registry.js +0 -20
- package/dist/auth/strategies/oauth/oauth-provider-registry.js.map +0 -1
- package/dist/auth/strategies/oauth/oauth.strategy.d.ts +0 -23
- package/dist/auth/strategies/oauth/oauth.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/oauth/oauth.strategy.js +0 -79
- package/dist/auth/strategies/oauth/oauth.strategy.js.map +0 -1
- package/dist/auth/strategies/onetap/onetap.strategy.d.ts +0 -24
- package/dist/auth/strategies/onetap/onetap.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/onetap/onetap.strategy.js +0 -77
- package/dist/auth/strategies/onetap/onetap.strategy.js.map +0 -1
- package/dist/auth/strategies/otp/otp.strategy.d.ts +0 -31
- package/dist/auth/strategies/otp/otp.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/otp/otp.strategy.js +0 -93
- package/dist/auth/strategies/otp/otp.strategy.js.map +0 -1
- package/dist/auth/strategies/passkey/passkey.strategy.d.ts +0 -32
- package/dist/auth/strategies/passkey/passkey.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/passkey/passkey.strategy.js +0 -102
- package/dist/auth/strategies/passkey/passkey.strategy.js.map +0 -1
- package/dist/auth/strategies/sso/sso.strategy.d.ts +0 -25
- package/dist/auth/strategies/sso/sso.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/sso/sso.strategy.js +0 -80
- package/dist/auth/strategies/sso/sso.strategy.js.map +0 -1
- package/dist/auth/strategies/totp/totp.strategy.d.ts +0 -37
- package/dist/auth/strategies/totp/totp.strategy.d.ts.map +0 -1
- package/dist/auth/strategies/totp/totp.strategy.js +0 -109
- package/dist/auth/strategies/totp/totp.strategy.js.map +0 -1
- package/dist/auth/throttling/index.d.ts +0 -2
- package/dist/auth/throttling/index.d.ts.map +0 -1
- package/dist/auth/throttling/index.js +0 -2
- package/dist/auth/throttling/index.js.map +0 -1
- package/dist/auth/throttling/throttle.service.d.ts +0 -27
- package/dist/auth/throttling/throttle.service.d.ts.map +0 -1
- package/dist/auth/throttling/throttle.service.js +0 -63
- package/dist/auth/throttling/throttle.service.js.map +0 -1
- package/dist/bootstrap/cache/config.d.ts +0 -135
- package/dist/bootstrap/cache/config.d.ts.map +0 -1
- package/dist/bootstrap/cache/config.js +0 -189
- package/dist/bootstrap/cache/config.js.map +0 -1
- package/dist/bootstrap/cache/index.d.ts +0 -11
- package/dist/bootstrap/cache/index.d.ts.map +0 -1
- package/dist/bootstrap/cache/index.js +0 -11
- package/dist/bootstrap/cache/index.js.map +0 -1
- package/dist/bootstrap/index.d.ts +0 -21
- package/dist/bootstrap/index.d.ts.map +0 -1
- package/dist/bootstrap/index.js +0 -21
- package/dist/bootstrap/index.js.map +0 -1
- package/dist/bootstrap/scalar/api-docs.d.ts +0 -39
- package/dist/bootstrap/scalar/api-docs.d.ts.map +0 -1
- package/dist/bootstrap/scalar/api-docs.js +0 -41
- package/dist/bootstrap/scalar/api-docs.js.map +0 -1
- package/dist/bootstrap/scalar/index.d.ts +0 -39
- package/dist/bootstrap/scalar/index.d.ts.map +0 -1
- package/dist/bootstrap/scalar/index.js +0 -41
- package/dist/bootstrap/scalar/index.js.map +0 -1
- package/dist/bootstrap/swagger/api-docs.d.ts +0 -73
- package/dist/bootstrap/swagger/api-docs.d.ts.map +0 -1
- package/dist/bootstrap/swagger/api-docs.js +0 -87
- package/dist/bootstrap/swagger/api-docs.js.map +0 -1
- package/dist/bootstrap/swagger/index.d.ts +0 -37
- package/dist/bootstrap/swagger/index.d.ts.map +0 -1
- package/dist/bootstrap/swagger/index.js +0 -36
- package/dist/bootstrap/swagger/index.js.map +0 -1
- package/dist/bootstrap/typeorm/config/index.d.ts +0 -12
- package/dist/bootstrap/typeorm/config/index.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/config/index.js +0 -62
- package/dist/bootstrap/typeorm/config/index.js.map +0 -1
- package/dist/bootstrap/typeorm/crud/controller.d.ts +0 -13
- package/dist/bootstrap/typeorm/crud/controller.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/crud/controller.js +0 -72
- package/dist/bootstrap/typeorm/crud/controller.js.map +0 -1
- package/dist/bootstrap/typeorm/crud/index.d.ts +0 -4
- package/dist/bootstrap/typeorm/crud/index.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/crud/index.js +0 -3
- package/dist/bootstrap/typeorm/crud/index.js.map +0 -1
- package/dist/bootstrap/typeorm/crud/service.d.ts +0 -10
- package/dist/bootstrap/typeorm/crud/service.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/crud/service.js +0 -21
- package/dist/bootstrap/typeorm/crud/service.js.map +0 -1
- package/dist/bootstrap/typeorm/index.d.ts +0 -18
- package/dist/bootstrap/typeorm/index.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/index.js +0 -18
- package/dist/bootstrap/typeorm/index.js.map +0 -1
- package/dist/bootstrap/typeorm/uow/factory.d.ts +0 -5
- package/dist/bootstrap/typeorm/uow/factory.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/uow/factory.js +0 -27
- package/dist/bootstrap/typeorm/uow/factory.js.map +0 -1
- package/dist/bootstrap/typeorm/uow/index.d.ts +0 -4
- package/dist/bootstrap/typeorm/uow/index.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/uow/index.js +0 -4
- package/dist/bootstrap/typeorm/uow/index.js.map +0 -1
- package/dist/bootstrap/typeorm/uow/transactional.decorator.d.ts +0 -62
- package/dist/bootstrap/typeorm/uow/transactional.decorator.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/uow/transactional.decorator.js +0 -114
- package/dist/bootstrap/typeorm/uow/transactional.decorator.js.map +0 -1
- package/dist/bootstrap/typeorm/uow/unit-of-work.d.ts +0 -11
- package/dist/bootstrap/typeorm/uow/unit-of-work.d.ts.map +0 -1
- package/dist/bootstrap/typeorm/uow/unit-of-work.js +0 -23
- package/dist/bootstrap/typeorm/uow/unit-of-work.js.map +0 -1
- package/dist/core/index.d.ts +0 -11
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -11
- package/dist/core/index.js.map +0 -1
- package/dist/infra/audit-log/index.d.ts +0 -12
- package/dist/infra/audit-log/index.d.ts.map +0 -1
- package/dist/infra/audit-log/index.js +0 -13
- package/dist/infra/audit-log/index.js.map +0 -1
- package/dist/infra/index.d.ts +0 -20
- package/dist/infra/index.d.ts.map +0 -1
- package/dist/infra/index.js +0 -21
- package/dist/infra/index.js.map +0 -1
- package/dist/infra/logger/index.d.ts +0 -12
- package/dist/infra/logger/index.d.ts.map +0 -1
- package/dist/infra/logger/index.js +0 -13
- package/dist/infra/logger/index.js.map +0 -1
- package/dist/infra/metrics/index.d.ts +0 -18
- package/dist/infra/metrics/index.d.ts.map +0 -1
- package/dist/infra/metrics/index.js +0 -19
- package/dist/infra/metrics/index.js.map +0 -1
- package/dist/infra/notification/index.d.ts +0 -12
- package/dist/infra/notification/index.d.ts.map +0 -1
- package/dist/infra/notification/index.js +0 -13
- package/dist/infra/notification/index.js.map +0 -1
- package/dist/infra/storage/index.d.ts +0 -12
- package/dist/infra/storage/index.d.ts.map +0 -1
- package/dist/infra/storage/index.js +0 -13
- package/dist/infra/storage/index.js.map +0 -1
- package/dist/infra/stripe/index.d.ts +0 -12
- package/dist/infra/stripe/index.d.ts.map +0 -1
- package/dist/infra/stripe/index.js +0 -13
- package/dist/infra/stripe/index.js.map +0 -1
- package/dist/saas/index.d.ts +0 -18
- package/dist/saas/index.d.ts.map +0 -1
- package/dist/saas/index.js +0 -19
- package/dist/saas/index.js.map +0 -1
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { Inject, Injectable } from '@nestjs/common';
|
|
14
|
-
import { AuthMethod } from '../../interfaces';
|
|
15
|
-
import { USER_SERVICE } from '../../auth.constants';
|
|
16
|
-
import { JwtService } from '../../session/jwt.service';
|
|
17
|
-
import { BaseStrategy } from '../base/base.strategy';
|
|
18
|
-
/**
|
|
19
|
-
* TOTP-based Two-Factor Authentication.
|
|
20
|
-
*
|
|
21
|
-
* Supports enrollment (generating secret + QR code), verification of codes,
|
|
22
|
-
* and backup-code management.
|
|
23
|
-
*/
|
|
24
|
-
let TotpStrategy = class TotpStrategy extends BaseStrategy {
|
|
25
|
-
userService;
|
|
26
|
-
jwtService;
|
|
27
|
-
type = AuthMethod.TOTP;
|
|
28
|
-
name = 'totp';
|
|
29
|
-
constructor(userService, jwtService) {
|
|
30
|
-
super();
|
|
31
|
-
this.userService = userService;
|
|
32
|
-
this.jwtService = jwtService;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Authenticate using a TOTP code after primary authentication.
|
|
36
|
-
* Expects `userId` and `code` in the payload.
|
|
37
|
-
*/
|
|
38
|
-
async authenticate(payload, _context) {
|
|
39
|
-
const userId = payload.userId;
|
|
40
|
-
const code = payload.code;
|
|
41
|
-
if (!userId || !code) {
|
|
42
|
-
throw new Error('userId and code are required');
|
|
43
|
-
}
|
|
44
|
-
const secret = await this.userService.getTotpSecret(userId);
|
|
45
|
-
if (!secret) {
|
|
46
|
-
throw new Error('TOTP is not configured for this user');
|
|
47
|
-
}
|
|
48
|
-
const valid = await this.verifyCode(secret, code);
|
|
49
|
-
if (!valid) {
|
|
50
|
-
throw new Error('Invalid TOTP code');
|
|
51
|
-
}
|
|
52
|
-
const user = await this.userService.findById(userId);
|
|
53
|
-
if (!user) {
|
|
54
|
-
throw new Error('User not found');
|
|
55
|
-
}
|
|
56
|
-
user.isMfaVerified = true;
|
|
57
|
-
user.roles = await this.userService.getRoles(user.id);
|
|
58
|
-
user.permissions = await this.userService.getPermissions(user.id);
|
|
59
|
-
const tokens = await this.jwtService.signTokens(user);
|
|
60
|
-
return { user, tokens };
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Generate a new TOTP secret for a user (enrollment).
|
|
64
|
-
* Returns the secret and an otpauth URL for QR code generation.
|
|
65
|
-
*/
|
|
66
|
-
async enroll(userId, issuer = 'NestKit') {
|
|
67
|
-
const otpauth = await this.loadOtpauth();
|
|
68
|
-
const secret = new otpauth.Secret({ size: 20 });
|
|
69
|
-
const secretBase32 = secret.base32;
|
|
70
|
-
const totp = new otpauth.TOTP({
|
|
71
|
-
issuer,
|
|
72
|
-
label: userId,
|
|
73
|
-
secret,
|
|
74
|
-
});
|
|
75
|
-
await this.userService.setTotpSecret(userId, secretBase32);
|
|
76
|
-
return { secret: secretBase32, otpauthUrl: totp.toString() };
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Verify a TOTP or backup code.
|
|
80
|
-
*/
|
|
81
|
-
async verifyCode(secret, code) {
|
|
82
|
-
const otpauth = await this.loadOtpauth();
|
|
83
|
-
try {
|
|
84
|
-
const totp = new otpauth.TOTP({
|
|
85
|
-
secret: otpauth.Secret.fromBase32(secret),
|
|
86
|
-
});
|
|
87
|
-
const delta = totp.validate({ token: code });
|
|
88
|
-
return delta !== null;
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async loadOtpauth() {
|
|
95
|
-
try {
|
|
96
|
-
return await import('otpauth');
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
throw new Error('TOTP strategy requires "otpauth". Run: npm install otpauth');
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
TotpStrategy = __decorate([
|
|
104
|
-
Injectable(),
|
|
105
|
-
__param(0, Inject(USER_SERVICE)),
|
|
106
|
-
__metadata("design:paramtypes", [Object, JwtService])
|
|
107
|
-
], TotpStrategy);
|
|
108
|
-
export { TotpStrategy };
|
|
109
|
-
//# sourceMappingURL=totp.strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"totp.strategy.js","sourceRoot":"","sources":["../../../../packages/auth/strategies/totp/totp.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY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AAE,CAAC,CAAC;YAC7C,OAAO,KAAK,KAAK,IAAI,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;CACF,CAAA;AAlGY,YAAY;IADxB,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,YAAY,CAAC,CAAA;6CAEQ,UAAU;GAP9B,YAAY,CAkGxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/auth/throttling/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/auth/throttling/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ICacheService } from '../interfaces';
|
|
2
|
-
/**
|
|
3
|
-
* Rate-limits login attempts per identifier (email, IP, etc.)
|
|
4
|
-
* using the shared cache.
|
|
5
|
-
*/
|
|
6
|
-
export declare class ThrottleService {
|
|
7
|
-
private readonly cache;
|
|
8
|
-
constructor(cache: ICacheService);
|
|
9
|
-
/**
|
|
10
|
-
* Check if the identifier is currently throttled.
|
|
11
|
-
*
|
|
12
|
-
* @param identifier User email, IP, or any unique key
|
|
13
|
-
* @param maxAttempts Max allowed attempts (default 5)
|
|
14
|
-
* @param windowSec Window in seconds (default 900 = 15 min)
|
|
15
|
-
* @throws Error if throttled
|
|
16
|
-
*/
|
|
17
|
-
check(identifier: string, maxAttempts?: number, windowSec?: number): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Record a failed login attempt.
|
|
20
|
-
*/
|
|
21
|
-
recordFailure(identifier: string, windowSec?: number): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Clear the attempt counter on successful login.
|
|
24
|
-
*/
|
|
25
|
-
clear(identifier: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=throttle.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.service.d.ts","sourceRoot":"","sources":["../../../packages/auth/throttling/throttle.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD;;;GAGG;AACH,qBACa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,aAAa;IAGvC;;;;;;;OAOG;IACG,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,SAAI,EAAE,SAAS,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhF;;OAEG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASvE;;OAEG;IACG,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { Inject, Injectable } from '@nestjs/common';
|
|
14
|
-
import { CACHE_SERVICE, LOGIN_ATTEMPT_PREFIX } from '../auth.constants';
|
|
15
|
-
/**
|
|
16
|
-
* Rate-limits login attempts per identifier (email, IP, etc.)
|
|
17
|
-
* using the shared cache.
|
|
18
|
-
*/
|
|
19
|
-
let ThrottleService = class ThrottleService {
|
|
20
|
-
cache;
|
|
21
|
-
constructor(cache) {
|
|
22
|
-
this.cache = cache;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Check if the identifier is currently throttled.
|
|
26
|
-
*
|
|
27
|
-
* @param identifier User email, IP, or any unique key
|
|
28
|
-
* @param maxAttempts Max allowed attempts (default 5)
|
|
29
|
-
* @param windowSec Window in seconds (default 900 = 15 min)
|
|
30
|
-
* @throws Error if throttled
|
|
31
|
-
*/
|
|
32
|
-
async check(identifier, maxAttempts = 5, windowSec = 900) {
|
|
33
|
-
const key = `${LOGIN_ATTEMPT_PREFIX}${identifier}`;
|
|
34
|
-
const attempts = await this.cache.get(key);
|
|
35
|
-
const current = attempts ?? 0;
|
|
36
|
-
if (current >= maxAttempts) {
|
|
37
|
-
throw new Error(`Too many login attempts. Please try again in ${windowSec} seconds.`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Record a failed login attempt.
|
|
42
|
-
*/
|
|
43
|
-
async recordFailure(identifier, windowSec = 900) {
|
|
44
|
-
const key = `${LOGIN_ATTEMPT_PREFIX}${identifier}`;
|
|
45
|
-
const attempts = await this.cache.get(key);
|
|
46
|
-
const next = (attempts ?? 0) + 1;
|
|
47
|
-
// Extend TTL on each failure so the window resets only after inactivity
|
|
48
|
-
await this.cache.set(key, next, windowSec);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Clear the attempt counter on successful login.
|
|
52
|
-
*/
|
|
53
|
-
async clear(identifier) {
|
|
54
|
-
await this.cache.del(`${LOGIN_ATTEMPT_PREFIX}${identifier}`);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
ThrottleService = __decorate([
|
|
58
|
-
Injectable(),
|
|
59
|
-
__param(0, Inject(CACHE_SERVICE)),
|
|
60
|
-
__metadata("design:paramtypes", [Object])
|
|
61
|
-
], ThrottleService);
|
|
62
|
-
export { ThrottleService };
|
|
63
|
-
//# sourceMappingURL=throttle.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.service.js","sourceRoot":"","sources":["../../../packages/auth/throttling/throttle.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAExE;;;GAGG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAGP;IAFnB,YAEmB,KAAoB;QAApB,UAAK,GAAL,KAAK,CAAe;IACpC,CAAC;IAEJ;;;;;;;OAOG;IACH,KAAK,CAAC,KAAK,CAAC,UAAkB,EAAE,WAAW,GAAG,CAAC,EAAE,SAAS,GAAG,GAAG;QAC9D,MAAM,GAAG,GAAG,GAAG,oBAAoB,GAAG,UAAU,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAS,GAAG,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,QAAQ,IAAI,CAAC,CAAC;QAE9B,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,SAAS,WAAW,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,UAAkB,EAAE,SAAS,GAAG,GAAG;QACrD,MAAM,GAAG,GAAG,GAAG,oBAAoB,GAAG,UAAU,EAAE,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAS,GAAG,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAEjC,wEAAwE;QACxE,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,UAAkB;QAC5B,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,oBAAoB,GAAG,UAAU,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF,CAAA;AA1CY,eAAe;IAD3B,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,aAAa,CAAC,CAAA;;GAFb,eAAe,CA0C3B"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
/** Per-store configuration. */
|
|
3
|
-
export interface CacheStoreConfig {
|
|
4
|
-
/** Store type */
|
|
5
|
-
type: 'memory' | 'redis' | 'valkey';
|
|
6
|
-
/**
|
|
7
|
-
* Optional name to distinguish this store.
|
|
8
|
-
*
|
|
9
|
-
* When set, the bootstrapper also reads `CACHE_{NAME}_URL`,
|
|
10
|
-
* `CACHE_{NAME}_KEY_PREFIX`, `CACHE_{NAME}_TTL`, and
|
|
11
|
-
* `CACHE_{NAME}_MAX` environment variables (with `NAME`
|
|
12
|
-
* uppercased). Named env vars take priority over the
|
|
13
|
-
* generic `REDIS_*` / `VALKEY_*` / `CACHE_*` variables.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* stores: [
|
|
18
|
-
* { type: 'redis', name: 'sessions' },
|
|
19
|
-
* { type: 'redis', name: 'data' },
|
|
20
|
-
* ]
|
|
21
|
-
* // Also reads: CACHE_SESSIONS_URL, CACHE_DATA_URL
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
name?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Keyv adapter constructor.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* import { KeyvCacheableMemory } from 'cacheable';
|
|
31
|
-
* import KeyvRedis from '@keyv/redis';
|
|
32
|
-
* import KeyvValkey from '@keyv/valkey';
|
|
33
|
-
*
|
|
34
|
-
* const cfg = configCache({
|
|
35
|
-
* keyv: Keyv,
|
|
36
|
-
* stores: [
|
|
37
|
-
* { type: 'memory', adapter: KeyvCacheableMemory },
|
|
38
|
-
* { type: 'redis', adapter: KeyvRedis },
|
|
39
|
-
* { type: 'valkey', adapter: KeyvValkey },
|
|
40
|
-
* ],
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
adapter?: new (...args: unknown[]) => unknown;
|
|
45
|
-
/** Connection URL (redis / valkey), e.g. `redis://localhost:6379`. */
|
|
46
|
-
url?: string;
|
|
47
|
-
/** Max items (memory store). */
|
|
48
|
-
max?: number;
|
|
49
|
-
/** Key prefix for namespacing. */
|
|
50
|
-
keyPrefix?: string;
|
|
51
|
-
/** Enable RDS (ElastiCache) TLS mode. */
|
|
52
|
-
rdsEnabled?: boolean;
|
|
53
|
-
/** TTL override for this store (seconds). */
|
|
54
|
-
ttl?: number;
|
|
55
|
-
}
|
|
56
|
-
/** Top-level cache configuration. */
|
|
57
|
-
export interface CacheConfigOptions {
|
|
58
|
-
/**
|
|
59
|
-
* Default TTL (seconds).
|
|
60
|
-
* When `keyv` is provided, this value is converted to milliseconds for Keyv.
|
|
61
|
-
*/
|
|
62
|
-
ttl?: number;
|
|
63
|
-
/** Register as `@Global()`. */
|
|
64
|
-
isGlobal?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* One or more cache stores. Pass multiple to enable multi-tier caching.
|
|
67
|
-
* Each store creates a separate `Keyv` instance.
|
|
68
|
-
*/
|
|
69
|
-
stores?: CacheStoreConfig[];
|
|
70
|
-
/**
|
|
71
|
-
* The `Keyv` class from the `keyv` package.
|
|
72
|
-
*
|
|
73
|
-
* Required when any store provides an `adapter` — the config builds Keyv
|
|
74
|
-
* instances so the output is ready for `CacheModule.register()`.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* import Keyv from 'keyv';
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
keyv?: new (options?: Record<string, unknown>) => Record<string, unknown>;
|
|
82
|
-
}
|
|
83
|
-
type StoreRecord = Record<string, unknown>;
|
|
84
|
-
/**
|
|
85
|
-
* Build cache module options from environment variables.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```ts
|
|
89
|
-
* import Keyv from 'keyv';
|
|
90
|
-
* import KeyvRedis from '@keyv/redis';
|
|
91
|
-
* import { KeyvCacheableMemory } from 'cacheable';
|
|
92
|
-
*
|
|
93
|
-
* const cfg = configCache({
|
|
94
|
-
* keyv: Keyv,
|
|
95
|
-
* stores: [
|
|
96
|
-
* { type: 'memory', adapter: KeyvCacheableMemory },
|
|
97
|
-
* { type: 'redis', adapter: KeyvRedis },
|
|
98
|
-
* ],
|
|
99
|
-
* });
|
|
100
|
-
* CacheModule.register(cfg);
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* Environment variables:
|
|
104
|
-
* | Variable | Default | Description |
|
|
105
|
-
* |---------------------------|----------------------------|-------------------------------------------|
|
|
106
|
-
* | `CACHE_STORE` | `memory` | Comma-separated store types |
|
|
107
|
-
* | `CACHE_TTL` | `60` | Default TTL (seconds) |
|
|
108
|
-
* | `CACHE_MAX` | `100` | Max items (memory store) |
|
|
109
|
-
* | `CACHE_IS_GLOBAL` | `false` | Register as global module |
|
|
110
|
-
* | `CACHE_{NAME}_URL` | — | Named-store URL (overrides `REDIS_URL`) |
|
|
111
|
-
* | `CACHE_{NAME}_KEY_PREFIX` | — | Named-store key prefix |
|
|
112
|
-
* | `CACHE_{NAME}_TTL` | — | Named-store TTL (overrides `CACHE_TTL`) |
|
|
113
|
-
* | `CACHE_{NAME}_MAX` | — | Named-store max (overrides `CACHE_MAX`) |
|
|
114
|
-
* | `REDIS_URL` | `redis://localhost:6379/0` | Redis connection URL |
|
|
115
|
-
* | `REDIS_KEY_PREFIX` | — | Redis key prefix |
|
|
116
|
-
* | `VALKEY_URL` | `redis://localhost:6379/0` | Valkey connection URL |
|
|
117
|
-
* | `VALKEY_KEY_PREFIX` | — | Valkey key prefix |
|
|
118
|
-
* | `RDS_CACHE_ENABLED` | `false` | Enable TLS for Redis / Valkey |
|
|
119
|
-
*/
|
|
120
|
-
export declare function configCache(options?: CacheConfigOptions): StoreRecord;
|
|
121
|
-
/**
|
|
122
|
-
* Build cache module options from `ConfigService`.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```ts
|
|
126
|
-
* CacheModule.registerAsync({
|
|
127
|
-
* imports: [ConfigModule],
|
|
128
|
-
* inject: [ConfigService],
|
|
129
|
-
* useFactory: (cs) => configCacheAsync(cs, { keyv: Keyv, stores: [...] }),
|
|
130
|
-
* })
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
export declare function configCacheAsync(configService: ConfigService, options?: CacheConfigOptions): StoreRecord;
|
|
134
|
-
export {};
|
|
135
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../packages/bootstrap/cache/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;A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|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/* ------------------------------------------------------------------ */
|
|
2
|
-
/* Helpers */
|
|
3
|
-
/* ------------------------------------------------------------------ */
|
|
4
|
-
function readStr(get, name, ...suffixes) {
|
|
5
|
-
for (const suffix of suffixes) {
|
|
6
|
-
if (name) {
|
|
7
|
-
const v = get.str(`CACHE_${name.toUpperCase()}_${suffix}`);
|
|
8
|
-
if (v !== undefined)
|
|
9
|
-
return v;
|
|
10
|
-
}
|
|
11
|
-
const v = get.str(suffix);
|
|
12
|
-
if (v !== undefined)
|
|
13
|
-
return v;
|
|
14
|
-
}
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
function readNum(get, name, ...suffixes) {
|
|
18
|
-
for (const suffix of suffixes) {
|
|
19
|
-
if (name) {
|
|
20
|
-
const v = get.num(`CACHE_${name.toUpperCase()}_${suffix}`);
|
|
21
|
-
if (v !== undefined)
|
|
22
|
-
return v;
|
|
23
|
-
}
|
|
24
|
-
const v = get.num(suffix);
|
|
25
|
-
if (v !== undefined)
|
|
26
|
-
return v;
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
function buildAdapterOptions(name, opt, get, prefix) {
|
|
31
|
-
const rds = opt?.rdsEnabled ?? get.bool('RDS_CACHE_ENABLED', false);
|
|
32
|
-
const keyPrefix = opt?.keyPrefix ?? readStr(get, name, 'KEY_PREFIX', `${prefix}_KEY_PREFIX`);
|
|
33
|
-
const url = opt?.url ?? readStr(get, name, 'URL', `${prefix}_URL`) ?? 'redis://localhost:6379/0';
|
|
34
|
-
return { url, keyPrefix, ...(rds ? { socket: { tls: true } } : {}) };
|
|
35
|
-
}
|
|
36
|
-
function parseStores(get, options) {
|
|
37
|
-
const userStores = options?.stores;
|
|
38
|
-
const raw = userStores?.map((s) => s.type).join(',') ?? get.str('CACHE_STORE') ?? 'memory';
|
|
39
|
-
const types = raw.split(',').map((s) => s.trim());
|
|
40
|
-
return types.map((type) => {
|
|
41
|
-
const opt = userStores?.find((s) => s.type === type);
|
|
42
|
-
const storeName = opt?.name;
|
|
43
|
-
const maxVal = opt?.max ?? readNum(get, storeName, 'MAX', 'CACHE_MAX') ?? 100;
|
|
44
|
-
const ttlVal = opt?.ttl ?? options?.ttl ?? readNum(get, storeName, 'TTL', 'CACHE_TTL') ?? 60;
|
|
45
|
-
const base = {
|
|
46
|
-
type,
|
|
47
|
-
name: storeName,
|
|
48
|
-
adapter: opt?.adapter,
|
|
49
|
-
max: maxVal,
|
|
50
|
-
ttl: ttlVal,
|
|
51
|
-
};
|
|
52
|
-
if (type === 'memory')
|
|
53
|
-
return base;
|
|
54
|
-
const prefix = type === 'redis' ? 'REDIS' : 'VALKEY';
|
|
55
|
-
return {
|
|
56
|
-
...base,
|
|
57
|
-
...buildAdapterOptions(storeName, opt, get, prefix),
|
|
58
|
-
rdsEnabled: opt?.rdsEnabled ?? get.bool('RDS_CACHE_ENABLED', false),
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function toMilliseconds(seconds) {
|
|
63
|
-
return seconds * 1000;
|
|
64
|
-
}
|
|
65
|
-
function buildCacheConfig(get, options) {
|
|
66
|
-
const KeyvClass = options?.keyv;
|
|
67
|
-
const stores = parseStores(get, options);
|
|
68
|
-
const base = {
|
|
69
|
-
ttl: options?.ttl ?? get.num('CACHE_TTL') ?? 60,
|
|
70
|
-
isGlobal: options?.isGlobal ?? get.bool('CACHE_IS_GLOBAL', false),
|
|
71
|
-
};
|
|
72
|
-
// When Keyv class is provided, build Keyv instances
|
|
73
|
-
if (KeyvClass) {
|
|
74
|
-
const keyvInstances = stores.map((s) => {
|
|
75
|
-
const ttlMs = toMilliseconds(s.ttl ?? 60);
|
|
76
|
-
if (s.type === 'memory') {
|
|
77
|
-
const adapterOptions = {};
|
|
78
|
-
if (s.max !== undefined)
|
|
79
|
-
adapterOptions.lruSize = s.max;
|
|
80
|
-
const adapter = s.adapter ? new s.adapter(adapterOptions) : undefined;
|
|
81
|
-
// In-memory without adapter → Keyv default (no explicit store)
|
|
82
|
-
if (!adapter) {
|
|
83
|
-
return { keyv: new KeyvClass({ ttl: ttlMs }), name: s.name };
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
keyv: new KeyvClass({ store: adapter, ttl: ttlMs }),
|
|
87
|
-
name: s.name,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// redis / valkey — always need adapter
|
|
91
|
-
if (!s.adapter) {
|
|
92
|
-
throw new Error(`Cache store "${s.type}" requires an adapter. ` +
|
|
93
|
-
`Install the package and pass adapter in config. ` +
|
|
94
|
-
`e.g. { type: "${s.type}", adapter: Keyv${s.type === 'redis' ? 'Redis' : 'Valkey'} }`);
|
|
95
|
-
}
|
|
96
|
-
const adapterOptions = buildAdapterOptions(s.name, s, get, s.type === 'redis' ? 'REDIS' : 'VALKEY');
|
|
97
|
-
const keyvAdapter = new s.adapter(adapterOptions.url, adapterOptions);
|
|
98
|
-
return {
|
|
99
|
-
keyv: new KeyvClass({ store: keyvAdapter, ttl: ttlMs }),
|
|
100
|
-
name: s.name,
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
// Single store — flatten, include name if set
|
|
104
|
-
if (keyvInstances.length === 1) {
|
|
105
|
-
const entry = keyvInstances[0];
|
|
106
|
-
const out = { store: entry.keyv, ...base };
|
|
107
|
-
if (entry.name)
|
|
108
|
-
out.name = entry.name;
|
|
109
|
-
return out;
|
|
110
|
-
}
|
|
111
|
-
return { stores: keyvInstances, ...base };
|
|
112
|
-
}
|
|
113
|
-
// Without Keyv class — return raw config data
|
|
114
|
-
if (stores.length === 1) {
|
|
115
|
-
const out = { ...base, ...stores[0] };
|
|
116
|
-
if (stores[0].name)
|
|
117
|
-
out.name = stores[0].name;
|
|
118
|
-
return out;
|
|
119
|
-
}
|
|
120
|
-
return { ...base, stores };
|
|
121
|
-
}
|
|
122
|
-
/* ------------------------------------------------------------------ */
|
|
123
|
-
/* Public API */
|
|
124
|
-
/* ------------------------------------------------------------------ */
|
|
125
|
-
/**
|
|
126
|
-
* Build cache module options from environment variables.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```ts
|
|
130
|
-
* import Keyv from 'keyv';
|
|
131
|
-
* import KeyvRedis from '@keyv/redis';
|
|
132
|
-
* import { KeyvCacheableMemory } from 'cacheable';
|
|
133
|
-
*
|
|
134
|
-
* const cfg = configCache({
|
|
135
|
-
* keyv: Keyv,
|
|
136
|
-
* stores: [
|
|
137
|
-
* { type: 'memory', adapter: KeyvCacheableMemory },
|
|
138
|
-
* { type: 'redis', adapter: KeyvRedis },
|
|
139
|
-
* ],
|
|
140
|
-
* });
|
|
141
|
-
* CacheModule.register(cfg);
|
|
142
|
-
* ```
|
|
143
|
-
*
|
|
144
|
-
* Environment variables:
|
|
145
|
-
* | Variable | Default | Description |
|
|
146
|
-
* |---------------------------|----------------------------|-------------------------------------------|
|
|
147
|
-
* | `CACHE_STORE` | `memory` | Comma-separated store types |
|
|
148
|
-
* | `CACHE_TTL` | `60` | Default TTL (seconds) |
|
|
149
|
-
* | `CACHE_MAX` | `100` | Max items (memory store) |
|
|
150
|
-
* | `CACHE_IS_GLOBAL` | `false` | Register as global module |
|
|
151
|
-
* | `CACHE_{NAME}_URL` | — | Named-store URL (overrides `REDIS_URL`) |
|
|
152
|
-
* | `CACHE_{NAME}_KEY_PREFIX` | — | Named-store key prefix |
|
|
153
|
-
* | `CACHE_{NAME}_TTL` | — | Named-store TTL (overrides `CACHE_TTL`) |
|
|
154
|
-
* | `CACHE_{NAME}_MAX` | — | Named-store max (overrides `CACHE_MAX`) |
|
|
155
|
-
* | `REDIS_URL` | `redis://localhost:6379/0` | Redis connection URL |
|
|
156
|
-
* | `REDIS_KEY_PREFIX` | — | Redis key prefix |
|
|
157
|
-
* | `VALKEY_URL` | `redis://localhost:6379/0` | Valkey connection URL |
|
|
158
|
-
* | `VALKEY_KEY_PREFIX` | — | Valkey key prefix |
|
|
159
|
-
* | `RDS_CACHE_ENABLED` | `false` | Enable TLS for Redis / Valkey |
|
|
160
|
-
*/
|
|
161
|
-
export function configCache(options) {
|
|
162
|
-
return buildCacheConfig({
|
|
163
|
-
str: (key) => process.env[key],
|
|
164
|
-
num: (key) => (process.env[key] !== undefined ? Number(process.env[key]) : undefined),
|
|
165
|
-
bool: (key, def) => process.env[key] !== undefined
|
|
166
|
-
? process.env[key] === 'true' || process.env[key] === '1'
|
|
167
|
-
: def,
|
|
168
|
-
}, options);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Build cache module options from `ConfigService`.
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```ts
|
|
175
|
-
* CacheModule.registerAsync({
|
|
176
|
-
* imports: [ConfigModule],
|
|
177
|
-
* inject: [ConfigService],
|
|
178
|
-
* useFactory: (cs) => configCacheAsync(cs, { keyv: Keyv, stores: [...] }),
|
|
179
|
-
* })
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
export function configCacheAsync(configService, options) {
|
|
183
|
-
return buildCacheConfig({
|
|
184
|
-
str: (key) => configService.get(key),
|
|
185
|
-
num: (key) => configService.get(key),
|
|
186
|
-
bool: (key, def) => configService.get(key, def) ?? def,
|
|
187
|
-
}, options);
|
|
188
|
-
}
|
|
189
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../packages/bootstrap/cache/config.ts"],"names":[],"mappings":"AAkHA,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,SAAS,OAAO,CACd,GAAc,EACd,IAAwB,EACxB,GAAG,QAAkB;IAErB,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC9B,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,IAAI,MAAM,EA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,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACrF,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CACjB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;YAC5B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG;YACzD,CAAC,CAAC,GAAG;KACV,EACD,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,aAA4B,EAC5B,OAA4B;IAE5B,OAAO,gBAAgB,CACrB;QACE,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAS,GAAG,CAAC;QAC5C,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAS,GAAG,CAAC;QAC5C,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAU,GAAG,EAAE,GAAG,CAAC,IAAI,GAAG;KAChE,EACD,OAAO,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @os.io/nest-kit/bootstrap/cache
|
|
3
|
-
*
|
|
4
|
-
* Cache module configuration bootstrapper for NestJS applications.
|
|
5
|
-
* Supports memory, Redis, Valkey, and multi-tier caching.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
export { configCache, configCacheAsync } from './config';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/bootstrap/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @os.io/nest-kit/bootstrap/cache
|
|
3
|
-
*
|
|
4
|
-
* Cache module configuration bootstrapper for NestJS applications.
|
|
5
|
-
* Supports memory, Redis, Valkey, and multi-tier caching.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
export { configCache, configCacheAsync } from './config';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/bootstrap/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @os.io/nest-kit/bootstrap
|
|
3
|
-
*
|
|
4
|
-
* Helpers and configuration bootstrappers for popular NestJS modules such as
|
|
5
|
-
* Swagger, Scalar, Cache, TypeORM, Mongoose, etc. Designed to be called directly from
|
|
6
|
-
* your application's `main.ts` or `app.module.ts`.
|
|
7
|
-
*
|
|
8
|
-
* ## Sub-modules
|
|
9
|
-
*
|
|
10
|
-
* - `@os.io/nest-kit/bootstrap/swagger` — Swagger UI
|
|
11
|
-
* - `@os.io/nest-kit/bootstrap/scalar` — Scalar API Reference
|
|
12
|
-
* - `@os.io/nest-kit/bootstrap/cache` — CacheModule setup
|
|
13
|
-
* - `@os.io/nest-kit/bootstrap/typeorm` — TypeORM setup, CRUD factories, Unit of Work
|
|
14
|
-
*
|
|
15
|
-
* @module
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
export * from './swagger';
|
|
19
|
-
export * from './scalar';
|
|
20
|
-
export * from './cache';
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/bootstrap/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
package/dist/bootstrap/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @os.io/nest-kit/bootstrap
|
|
3
|
-
*
|
|
4
|
-
* Helpers and configuration bootstrappers for popular NestJS modules such as
|
|
5
|
-
* Swagger, Scalar, Cache, TypeORM, Mongoose, etc. Designed to be called directly from
|
|
6
|
-
* your application's `main.ts` or `app.module.ts`.
|
|
7
|
-
*
|
|
8
|
-
* ## Sub-modules
|
|
9
|
-
*
|
|
10
|
-
* - `@os.io/nest-kit/bootstrap/swagger` — Swagger UI
|
|
11
|
-
* - `@os.io/nest-kit/bootstrap/scalar` — Scalar API Reference
|
|
12
|
-
* - `@os.io/nest-kit/bootstrap/cache` — CacheModule setup
|
|
13
|
-
* - `@os.io/nest-kit/bootstrap/typeorm` — TypeORM setup, CRUD factories, Unit of Work
|
|
14
|
-
*
|
|
15
|
-
* @module
|
|
16
|
-
* @packageDocumentation
|
|
17
|
-
*/
|
|
18
|
-
export * from './swagger';
|
|
19
|
-
export * from './scalar';
|
|
20
|
-
export * from './cache';
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../packages/bootstrap/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|