@nauth-toolkit/database-typeorm-postgres 0.1.3
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/LICENSE +90 -0
- package/README.md +63 -0
- package/dist/entities/auth-audit.entity.d.ts +32 -0
- package/dist/entities/auth-audit.entity.d.ts.map +1 -0
- package/dist/entities/auth-audit.entity.js +141 -0
- package/dist/entities/auth-audit.entity.js.map +1 -0
- package/dist/entities/challenge-session.entity.d.ts +20 -0
- package/dist/entities/challenge-session.entity.d.ts.map +1 -0
- package/dist/entities/challenge-session.entity.js +88 -0
- package/dist/entities/challenge-session.entity.js.map +1 -0
- package/dist/entities/index.d.ts +14 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +57 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/login-attempt.entity.d.ts +16 -0
- package/dist/entities/login-attempt.entity.d.ts.map +1 -0
- package/dist/entities/login-attempt.entity.js +70 -0
- package/dist/entities/login-attempt.entity.js.map +1 -0
- package/dist/entities/mfa-device.entity.d.ts +23 -0
- package/dist/entities/mfa-device.entity.d.ts.map +1 -0
- package/dist/entities/mfa-device.entity.js +100 -0
- package/dist/entities/mfa-device.entity.js.map +1 -0
- package/dist/entities/rate-limit.entity.d.ts +10 -0
- package/dist/entities/rate-limit.entity.d.ts.map +1 -0
- package/dist/entities/rate-limit.entity.js +47 -0
- package/dist/entities/rate-limit.entity.js.map +1 -0
- package/dist/entities/session.entity.d.ts +35 -0
- package/dist/entities/session.entity.d.ts.map +1 -0
- package/dist/entities/session.entity.js +158 -0
- package/dist/entities/session.entity.js.map +1 -0
- package/dist/entities/social-account.entity.d.ts +16 -0
- package/dist/entities/social-account.entity.d.ts.map +1 -0
- package/dist/entities/social-account.entity.js +71 -0
- package/dist/entities/social-account.entity.js.map +1 -0
- package/dist/entities/storage-lock.entity.d.ts +9 -0
- package/dist/entities/storage-lock.entity.d.ts.map +1 -0
- package/dist/entities/storage-lock.entity.js +43 -0
- package/dist/entities/storage-lock.entity.js.map +1 -0
- package/dist/entities/trusted-device.entity.d.ts +20 -0
- package/dist/entities/trusted-device.entity.d.ts.map +1 -0
- package/dist/entities/trusted-device.entity.js +89 -0
- package/dist/entities/trusted-device.entity.js.map +1 -0
- package/dist/entities/user.entity.d.ts +42 -0
- package/dist/entities/user.entity.d.ts.map +1 -0
- package/dist/entities/user.entity.js +180 -0
- package/dist/entities/user.entity.js.map +1 -0
- package/dist/entities/verification-token.entity.d.ts +21 -0
- package/dist/entities/verification-token.entity.d.ts.map +1 -0
- package/dist/entities/verification-token.entity.js +90 -0
- package/dist/entities/verification-token.entity.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/1734600000000-Initial.d.ts +7 -0
- package/dist/migrations/1734600000000-Initial.d.ts.map +1 -0
- package/dist/migrations/1734600000000-Initial.js +157 -0
- package/dist/migrations/1734600000000-Initial.js.map +1 -0
- package/dist/migrations/index.d.ts +6 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +6 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/typeorm-cli.datasource.d.ts +5 -0
- package/dist/typeorm-cli.datasource.d.ts.map +1 -0
- package/dist/typeorm-cli.datasource.js +19 -0
- package/dist/typeorm-cli.datasource.js.map +1 -0
- package/dist/utils/run-migrations.d.ts +4 -0
- package/dist/utils/run-migrations.d.ts.map +1 -0
- package/dist/utils/run-migrations.js +28 -0
- package/dist/utils/run-migrations.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
NAUTH TOOLKIT EARLY ACCESS LICENSE
|
|
2
|
+
Version 1.0 (December 2025)
|
|
3
|
+
|
|
4
|
+
================================================================================
|
|
5
|
+
FUTURE OPEN SOURCE NOTICE
|
|
6
|
+
================================================================================
|
|
7
|
+
NAuth Toolkit will transition to an open-source license (MIT or Apache 2.0) for
|
|
8
|
+
core authentication features once the project reaches production readiness.
|
|
9
|
+
|
|
10
|
+
This Early Access License is temporary and designed to:
|
|
11
|
+
• Allow developers to build with nauth-toolkit during preview/beta
|
|
12
|
+
• Provide clear expectations during the pre-release phase
|
|
13
|
+
• Enable feedback and real-world testing before GA
|
|
14
|
+
|
|
15
|
+
We're committed to keeping core auth free and open source. Premium features
|
|
16
|
+
(enterprise SSO, advanced compliance, hosted options) will be offered separately
|
|
17
|
+
under fair commercial terms.
|
|
18
|
+
|
|
19
|
+
================================================================================
|
|
20
|
+
EARLY ACCESS LICENSE TERMS
|
|
21
|
+
================================================================================
|
|
22
|
+
|
|
23
|
+
1. Grant of Use
|
|
24
|
+
You are granted a free, non-exclusive, non-transferable license to:
|
|
25
|
+
- Install and use nauth-toolkit packages in development, testing, staging,
|
|
26
|
+
and production environments
|
|
27
|
+
- Modify the code for your own internal use
|
|
28
|
+
- Deploy applications using nauth-toolkit to serve your users
|
|
29
|
+
|
|
30
|
+
You may NOT:
|
|
31
|
+
- Redistribute NAuth Toolkit as a standalone product or service
|
|
32
|
+
- Sell, sublicense, or offer NAuth Toolkit as part of a competing auth
|
|
33
|
+
platform or toolkit
|
|
34
|
+
- Remove or alter copyright notices
|
|
35
|
+
|
|
36
|
+
2. No Fees During Early Access
|
|
37
|
+
There are no license fees, subscription costs, or usage charges during the
|
|
38
|
+
Early Access period. You may use nauth-toolkit freely for commercial and
|
|
39
|
+
non-commercial purposes within the terms of this license.
|
|
40
|
+
|
|
41
|
+
3. Production Use
|
|
42
|
+
Production use is permitted but comes with standard early-access caveats:
|
|
43
|
+
- Features and APIs may change between preview releases
|
|
44
|
+
- Support is community-based (GitHub issues/discussions)
|
|
45
|
+
- No SLA or guaranteed uptime (you run it on your infrastructure)
|
|
46
|
+
|
|
47
|
+
We recommend thorough testing and having rollback plans for critical systems.
|
|
48
|
+
|
|
49
|
+
4. Future Transition
|
|
50
|
+
When nauth-toolkit releases v1.0 GA:
|
|
51
|
+
- Core packages will adopt an open-source license (MIT or Apache 2.0)
|
|
52
|
+
- Your existing deployments will continue to work
|
|
53
|
+
- Premium features (if any) will be clearly documented with separate licensing
|
|
54
|
+
- No forced upgrades or surprise fees
|
|
55
|
+
|
|
56
|
+
5. Ownership
|
|
57
|
+
NAuth Toolkit is developed and maintained by Noorix Digital Solutions.
|
|
58
|
+
You retain full ownership of your applications and data.
|
|
59
|
+
|
|
60
|
+
6. Data and Privacy
|
|
61
|
+
NAuth Toolkit runs in YOUR infrastructure and database. You control all data.
|
|
62
|
+
You are responsible for compliance with applicable data protection laws.
|
|
63
|
+
|
|
64
|
+
7. Disclaimer of Warranty
|
|
65
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
66
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
67
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
68
|
+
|
|
69
|
+
8. Limitation of Liability
|
|
70
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
71
|
+
SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS
|
|
72
|
+
OF PROFITS, REVENUE, DATA, OR USE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
73
|
+
DAMAGES.
|
|
74
|
+
|
|
75
|
+
9. Termination
|
|
76
|
+
This license remains in effect until:
|
|
77
|
+
- You stop using nauth-toolkit, or
|
|
78
|
+
- The project transitions to open source (at which point the new license applies)
|
|
79
|
+
|
|
80
|
+
If you breach these terms, your license terminates and you must stop using the
|
|
81
|
+
software.
|
|
82
|
+
|
|
83
|
+
10. Contact and Support
|
|
84
|
+
- Documentation: https://nauth.dev
|
|
85
|
+
- Issues/Discussions: GitHub (when public repository launches)
|
|
86
|
+
- Commercial inquiries: Contact admin@noorix.com
|
|
87
|
+
|
|
88
|
+
================================================================================
|
|
89
|
+
Thank you for being an early adopter. Your feedback shapes the future of NAuth.
|
|
90
|
+
================================================================================
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @nauth-toolkit/database-typeorm-postgres
|
|
2
|
+
|
|
3
|
+
PostgreSQL database adapter for nauth-toolkit using TypeORM.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add @nauth-toolkit/core @nauth-toolkit/database-typeorm-postgres typeorm pg
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Module } from '@nestjs/common';
|
|
15
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
16
|
+
import { AuthModule } from '@nauth-toolkit/core';
|
|
17
|
+
import { getNAuthEntities } from '@nauth-toolkit/database-typeorm-postgres';
|
|
18
|
+
|
|
19
|
+
@Module({
|
|
20
|
+
imports: [
|
|
21
|
+
TypeOrmModule.forRoot({
|
|
22
|
+
type: 'postgres',
|
|
23
|
+
host: process.env.DB_HOST,
|
|
24
|
+
port: 5432,
|
|
25
|
+
username: process.env.DB_USER,
|
|
26
|
+
password: process.env.DB_PASSWORD,
|
|
27
|
+
database: process.env.DB_NAME,
|
|
28
|
+
entities: getNAuthEntities(), // ✅ Register entities here
|
|
29
|
+
synchronize: false, // Use migrations in production!
|
|
30
|
+
}),
|
|
31
|
+
AuthModule.forRoot({
|
|
32
|
+
jwt: {
|
|
33
|
+
accessToken: { secret: process.env.JWT_SECRET },
|
|
34
|
+
refreshToken: { secret: process.env.JWT_REFRESH_SECRET },
|
|
35
|
+
},
|
|
36
|
+
// ... other config
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
})
|
|
40
|
+
export class AppModule {}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- ✅ Native UUID support
|
|
46
|
+
- ✅ JSONB for metadata storage
|
|
47
|
+
- ✅ Native array types
|
|
48
|
+
- ✅ All nauth-toolkit entities included
|
|
49
|
+
- ✅ Optimized indexes for performance
|
|
50
|
+
|
|
51
|
+
## Entities
|
|
52
|
+
|
|
53
|
+
- `User` - User accounts and authentication data
|
|
54
|
+
- `Session` - Active user sessions
|
|
55
|
+
- `SocialAccount` - OAuth provider linkages
|
|
56
|
+
- `MFADevice` - Multi-factor authentication devices
|
|
57
|
+
- `VerificationToken` - Email/phone verification tokens
|
|
58
|
+
- `ChallengeSession` - Temporary challenge sessions
|
|
59
|
+
- `LoginAttempt` - Login attempt audit logs
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseAuthAudit, AuthAuditEventType, type AuthAuditEventStatus } from '@nauth-toolkit/core';
|
|
2
|
+
import { User } from './user.entity';
|
|
3
|
+
export declare class AuthAudit extends BaseAuthAudit {
|
|
4
|
+
id: number;
|
|
5
|
+
userId: number;
|
|
6
|
+
user: User;
|
|
7
|
+
eventType: AuthAuditEventType;
|
|
8
|
+
eventStatus: AuthAuditEventStatus;
|
|
9
|
+
riskFactor?: number | null;
|
|
10
|
+
riskFactors?: string[] | null;
|
|
11
|
+
adaptiveMfaTriggered?: boolean | null;
|
|
12
|
+
ipAddress?: string | null;
|
|
13
|
+
ipCountry?: string | null;
|
|
14
|
+
ipCity?: string | null;
|
|
15
|
+
ipLatitude?: number | null;
|
|
16
|
+
ipLongitude?: number | null;
|
|
17
|
+
userAgent?: string | null;
|
|
18
|
+
platform?: string | null;
|
|
19
|
+
browser?: string | null;
|
|
20
|
+
deviceId?: string | null;
|
|
21
|
+
deviceName?: string | null;
|
|
22
|
+
deviceType?: string | null;
|
|
23
|
+
sessionId?: number | null;
|
|
24
|
+
challengeSessionId?: number | null;
|
|
25
|
+
authMethod?: string | null;
|
|
26
|
+
performedBy?: string | null;
|
|
27
|
+
reason?: string | null;
|
|
28
|
+
description?: string | null;
|
|
29
|
+
metadata?: Record<string, unknown> | null;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=auth-audit.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-audit.entity.d.ts","sourceRoot":"","sources":["../../src/entities/auth-audit.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAmBrC,qBAWa,SAAU,SAAQ,aAAa;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAIvB,IAAI,EAAG,IAAI,CAAC;IAGJ,SAAS,EAAE,kBAAkB,CAAC;IAG9B,WAAW,EAAE,oBAAoB,CAAC;IAGlC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAG9B,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAGtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAG1C,SAAS,EAAE,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuthAudit = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const core_1 = require("@nauth-toolkit/core");
|
|
15
|
+
const user_entity_1 = require("./user.entity");
|
|
16
|
+
let AuthAudit = class AuthAudit extends core_1.BaseAuthAudit {
|
|
17
|
+
user;
|
|
18
|
+
};
|
|
19
|
+
exports.AuthAudit = AuthAudit;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], AuthAudit.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ type: 'int' }),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], AuthAudit.prototype, "userId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: 'CASCADE' }),
|
|
30
|
+
(0, typeorm_1.JoinColumn)({ name: 'userId' }),
|
|
31
|
+
__metadata("design:type", user_entity_1.User)
|
|
32
|
+
], AuthAudit.prototype, "user", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AuthAudit.prototype, "eventType", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 20 }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], AuthAudit.prototype, "eventStatus", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], AuthAudit.prototype, "riskFactor", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'text', array: true, nullable: true }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], AuthAudit.prototype, "riskFactors", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], AuthAudit.prototype, "adaptiveMfaTriggered", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], AuthAudit.prototype, "ipAddress", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], AuthAudit.prototype, "ipCountry", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], AuthAudit.prototype, "ipCity", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 6, nullable: true }),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], AuthAudit.prototype, "ipLatitude", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 6, nullable: true }),
|
|
71
|
+
__metadata("design:type", Object)
|
|
72
|
+
], AuthAudit.prototype, "ipLongitude", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], AuthAudit.prototype, "userAgent", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], AuthAudit.prototype, "platform", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], AuthAudit.prototype, "browser", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], AuthAudit.prototype, "deviceId", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], AuthAudit.prototype, "deviceName", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], AuthAudit.prototype, "deviceType", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
99
|
+
__metadata("design:type", Object)
|
|
100
|
+
], AuthAudit.prototype, "sessionId", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
103
|
+
__metadata("design:type", Object)
|
|
104
|
+
], AuthAudit.prototype, "challengeSessionId", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
|
|
107
|
+
__metadata("design:type", Object)
|
|
108
|
+
], AuthAudit.prototype, "authMethod", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
111
|
+
__metadata("design:type", Object)
|
|
112
|
+
], AuthAudit.prototype, "performedBy", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
|
|
115
|
+
__metadata("design:type", Object)
|
|
116
|
+
], AuthAudit.prototype, "reason", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], AuthAudit.prototype, "description", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
123
|
+
__metadata("design:type", Object)
|
|
124
|
+
], AuthAudit.prototype, "metadata", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
|
|
127
|
+
__metadata("design:type", Date)
|
|
128
|
+
], AuthAudit.prototype, "createdAt", void 0);
|
|
129
|
+
exports.AuthAudit = AuthAudit = __decorate([
|
|
130
|
+
(0, typeorm_1.Entity)('nauth_auth_audit'),
|
|
131
|
+
(0, typeorm_1.Index)(['userId', 'createdAt']),
|
|
132
|
+
(0, typeorm_1.Index)(['eventType', 'createdAt']),
|
|
133
|
+
(0, typeorm_1.Index)(['eventStatus', 'createdAt']),
|
|
134
|
+
(0, typeorm_1.Index)(['createdAt']),
|
|
135
|
+
(0, typeorm_1.Index)(['riskFactor', 'createdAt']),
|
|
136
|
+
(0, typeorm_1.Index)(['adaptiveMfaTriggered', 'createdAt']),
|
|
137
|
+
(0, typeorm_1.Index)(['authMethod', 'createdAt']),
|
|
138
|
+
(0, typeorm_1.Index)(['userId', 'eventType', 'createdAt']),
|
|
139
|
+
(0, typeorm_1.Index)(['userId', 'ipAddress'])
|
|
140
|
+
], AuthAudit);
|
|
141
|
+
//# sourceMappingURL=auth-audit.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-audit.entity.js","sourceRoot":"","sources":["../../src/entities/auth-audit.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiH;AACjH,8CAAmG;AACnG,+CAAqC;AA8B9B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,oBAAa;IAS1C,IAAI,CAAQ;CAyEb,CAAA;AAlFY,8BAAS;AAEZ;IADP,IAAA,gCAAsB,GAAE;;qCACN;AAGX;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;yCACD;AAIvB;IAFC,IAAA,mBAAS,EA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eSession extends BaseChallengeSession {
|
|
4
|
+
id: number;
|
|
5
|
+
user: User;
|
|
6
|
+
userId: number;
|
|
7
|
+
challengeName: string;
|
|
8
|
+
sessionToken: string;
|
|
9
|
+
expiresAt: Date;
|
|
10
|
+
isCompleted: boolean;
|
|
11
|
+
completedAt?: Date;
|
|
12
|
+
attempts: number;
|
|
13
|
+
maxAttempts: number;
|
|
14
|
+
challengeParameters?: Record<string, unknown>;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
ipAddress?: string;
|
|
17
|
+
userAgent?: string;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=challenge-session.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"challenge-session.entity.d.ts","sourceRoot":"","sources":["../../src/entities/challenge-session.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAQrC,qBAKa,gBAAiB,SAAQ,oBAAoB;IAEhD,EAAE,EAAE,MAAM,CAAC;IAInB,IAAI,EAAG,IAAI,CAAC;IAGJ,MAAM,EAAE,MAAM,CAAC;IAGf,aAAa,EAAE,MAAM,CAAC;IAGtB,YAAY,EAAE,MAAM,CAAC;IAGrB,SAAS,EAAE,IAAI,CAAC;IAGhB,WAAW,EAAE,OAAO,CAAC;IAGrB,WAAW,CAAC,EAAE,IAAI,CAAC;IAGnB,QAAQ,EAAE,MAAM,CAAC;IAGjB,WAAW,EAAE,MAAM,CAAC;IAGpB,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI9C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGnC,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,SAAS,EAAE,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChallengeSession = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const core_1 = require("@nauth-toolkit/core");
|
|
15
|
+
const user_entity_1 = require("./user.entity");
|
|
16
|
+
let ChallengeSession = class ChallengeSession extends core_1.BaseChallengeSession {
|
|
17
|
+
user;
|
|
18
|
+
};
|
|
19
|
+
exports.ChallengeSession = ChallengeSession;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], ChallengeSession.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: 'CASCADE' }),
|
|
26
|
+
(0, typeorm_1.JoinColumn)({ name: 'userId' }),
|
|
27
|
+
__metadata("design:type", user_entity_1.User)
|
|
28
|
+
], ChallengeSession.prototype, "user", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)(),
|
|
31
|
+
__metadata("design:type", Number)
|
|
32
|
+
], ChallengeSession.prototype, "userId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ length: 50 }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], ChallengeSession.prototype, "challengeName", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ unique: true, length: 255 }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], ChallengeSession.prototype, "sessionToken", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'timestamptz' }),
|
|
43
|
+
__metadata("design:type", Date)
|
|
44
|
+
], ChallengeSession.prototype, "expiresAt", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
47
|
+
__metadata("design:type", Boolean)
|
|
48
|
+
], ChallengeSession.prototype, "isCompleted", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
51
|
+
__metadata("design:type", Date)
|
|
52
|
+
], ChallengeSession.prototype, "completedAt", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ default: 0 }),
|
|
55
|
+
__metadata("design:type", Number)
|
|
56
|
+
], ChallengeSession.prototype, "attempts", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ default: 3 }),
|
|
59
|
+
__metadata("design:type", Number)
|
|
60
|
+
], ChallengeSession.prototype, "maxAttempts", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], ChallengeSession.prototype, "challengeParameters", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], ChallengeSession.prototype, "metadata", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.Column)({ length: 45, nullable: true }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], ChallengeSession.prototype, "ipAddress", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], ChallengeSession.prototype, "userAgent", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
|
|
79
|
+
__metadata("design:type", Date)
|
|
80
|
+
], ChallengeSession.prototype, "createdAt", void 0);
|
|
81
|
+
exports.ChallengeSession = ChallengeSession = __decorate([
|
|
82
|
+
(0, typeorm_1.Entity)('nauth_challenge_sessions'),
|
|
83
|
+
(0, typeorm_1.Index)(['userId']),
|
|
84
|
+
(0, typeorm_1.Index)(['expiresAt']),
|
|
85
|
+
(0, typeorm_1.Index)(['challengeName']),
|
|
86
|
+
(0, typeorm_1.Index)(['userId', 'isCompleted'])
|
|
87
|
+
], ChallengeSession);
|
|
88
|
+
//# sourceMappingURL=challenge-session.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"challenge-session.entity.js","sourceRoot":"","sources":["../../src/entities/challenge-session.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiH;AACjH,8CAA2D;AAC3D,+CAAqC;AAa9B,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAoB;IAMxD,IAAI,CAAQ;CAyCb,CAAA;AA/CY,4CAAgB;AAEnB;IADP,IAAA,gCAAsB,GAAE;;4CACN;AAInB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC9C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QA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A,eAAK,EAAC,CAAC,QAAQ,CAAC,CAAC;IACjB,IAAA,eAAK,EAAC,CAAC,WAAW,CAAC,CAAC;IACpB,IAAA,eAAK,EAAC,CAAC,eAAe,CAAC,CAAC;IACxB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;GACpB,gBAAgB,CA+C5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './user.entity';
|
|
2
|
+
export * from './session.entity';
|
|
3
|
+
export * from './login-attempt.entity';
|
|
4
|
+
export * from './verification-token.entity';
|
|
5
|
+
export * from './social-account.entity';
|
|
6
|
+
export * from './challenge-session.entity';
|
|
7
|
+
export * from './mfa-device.entity';
|
|
8
|
+
export * from './auth-audit.entity';
|
|
9
|
+
export * from './trusted-device.entity';
|
|
10
|
+
export * from './rate-limit.entity';
|
|
11
|
+
export * from './storage-lock.entity';
|
|
12
|
+
export declare function getNAuthEntities(): Function[];
|
|
13
|
+
export declare function getNAuthTransientStorageEntities(): Function[];
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AAsCtC,wBAAgB,gBAAgB,IAAI,QAAQ,EAAE,CAY7C;AAwBD,wBAAgB,gCAAgC,IAAI,QAAQ,EAAE,CAE7D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getNAuthEntities = getNAuthEntities;
|
|
18
|
+
exports.getNAuthTransientStorageEntities = getNAuthTransientStorageEntities;
|
|
19
|
+
__exportStar(require("./user.entity"), exports);
|
|
20
|
+
__exportStar(require("./session.entity"), exports);
|
|
21
|
+
__exportStar(require("./login-attempt.entity"), exports);
|
|
22
|
+
__exportStar(require("./verification-token.entity"), exports);
|
|
23
|
+
__exportStar(require("./social-account.entity"), exports);
|
|
24
|
+
__exportStar(require("./challenge-session.entity"), exports);
|
|
25
|
+
__exportStar(require("./mfa-device.entity"), exports);
|
|
26
|
+
__exportStar(require("./auth-audit.entity"), exports);
|
|
27
|
+
__exportStar(require("./trusted-device.entity"), exports);
|
|
28
|
+
__exportStar(require("./rate-limit.entity"), exports);
|
|
29
|
+
__exportStar(require("./storage-lock.entity"), exports);
|
|
30
|
+
const user_entity_1 = require("./user.entity");
|
|
31
|
+
const session_entity_1 = require("./session.entity");
|
|
32
|
+
const login_attempt_entity_1 = require("./login-attempt.entity");
|
|
33
|
+
const verification_token_entity_1 = require("./verification-token.entity");
|
|
34
|
+
const social_account_entity_1 = require("./social-account.entity");
|
|
35
|
+
const challenge_session_entity_1 = require("./challenge-session.entity");
|
|
36
|
+
const mfa_device_entity_1 = require("./mfa-device.entity");
|
|
37
|
+
const auth_audit_entity_1 = require("./auth-audit.entity");
|
|
38
|
+
const trusted_device_entity_1 = require("./trusted-device.entity");
|
|
39
|
+
const rate_limit_entity_1 = require("./rate-limit.entity");
|
|
40
|
+
const storage_lock_entity_1 = require("./storage-lock.entity");
|
|
41
|
+
function getNAuthEntities() {
|
|
42
|
+
return [
|
|
43
|
+
user_entity_1.User,
|
|
44
|
+
session_entity_1.Session,
|
|
45
|
+
login_attempt_entity_1.LoginAttempt,
|
|
46
|
+
verification_token_entity_1.VerificationToken,
|
|
47
|
+
social_account_entity_1.SocialAccount,
|
|
48
|
+
challenge_session_entity_1.ChallengeSession,
|
|
49
|
+
mfa_device_entity_1.MFADevice,
|
|
50
|
+
auth_audit_entity_1.AuthAudit,
|
|
51
|
+
trusted_device_entity_1.TrustedDevice,
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function getNAuthTransientStorageEntities() {
|
|
55
|
+
return [rate_limit_entity_1.RateLimit, storage_lock_entity_1.StorageLock];
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgDA,4CAYC;AAwBD,4EAEC;AAtFD,gDAA8B;AAC9B,mDAAiC;AACjC,yDAAuC;AACvC,8DAA4C;AAC5C,0DAAwC;AACxC,6DAA2C;AAC3C,sDAAoC;AACpC,sDAAoC;AACpC,0DAAwC;AACxC,sDAAoC;AACpC,wDAAsC;AAGtC,+CAAqC;AACrC,qDAA2C;AAC3C,iEAAsD;AACtD,2EAAgE;AAChE,mEAAwD;AACxD,yEAA8D;AAC9D,2DAAgD;AAChD,2DAAgD;AAChD,mEAAwD;AACxD,2DAAgD;AAChD,+DAAoD;AAyBpD,SAAgB,gBAAgB;IAC9B,OAAO;QACL,kBAAI;QACJ,wBAAO;QACP,mCAAY;QACZ,6CAAiB;QACjB,qCAAa;QACb,2CAAgB;QAChB,6BAAS;QACT,6BAAS;QACT,qCAAa;KACd,CAAC;AACJ,CAAC;AAwBD,SAAgB,gCAAgC;IAC9C,OAAO,CAAC,6BAAS,EAAE,iCAAW,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseLoginAttempt } from '@nauth-toolkit/core';
|
|
2
|
+
import { User } from './user.entity';
|
|
3
|
+
export declare class LoginAttempt extends BaseLoginAttempt {
|
|
4
|
+
id: number;
|
|
5
|
+
email?: string | null;
|
|
6
|
+
userId?: number | null;
|
|
7
|
+
user?: User | null;
|
|
8
|
+
ipAddress?: string | null;
|
|
9
|
+
userAgent?: string | null;
|
|
10
|
+
success: boolean;
|
|
11
|
+
failureReason?: string | null;
|
|
12
|
+
mfaRequired: boolean;
|
|
13
|
+
metadata?: Record<string, unknown> | null;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=login-attempt.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-attempt.entity.d.ts","sourceRoot":"","sources":["../../src/entities/login-attempt.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAYrC,qBAGa,YAAa,SAAQ,gBAAgB;IAExC,EAAE,EAAE,MAAM,CAAC;IAGX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI/B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGX,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,OAAO,EAAE,OAAO,CAAC;IAGjB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,WAAW,EAAE,OAAO,CAAC;IAGrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAG1C,SAAS,EAAE,IAAI,CAAC;CACzB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LoginAttempt = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const core_1 = require("@nauth-toolkit/core");
|
|
15
|
+
const user_entity_1 = require("./user.entity");
|
|
16
|
+
let LoginAttempt = class LoginAttempt extends core_1.BaseLoginAttempt {
|
|
17
|
+
user;
|
|
18
|
+
};
|
|
19
|
+
exports.LoginAttempt = LoginAttempt;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], LoginAttempt.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
26
|
+
__metadata("design:type", Object)
|
|
27
|
+
], LoginAttempt.prototype, "email", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
30
|
+
__metadata("design:type", Object)
|
|
31
|
+
], LoginAttempt.prototype, "userId", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.User, { nullable: true, onDelete: 'SET NULL' }),
|
|
34
|
+
(0, typeorm_1.JoinColumn)({ name: 'userId' }),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], LoginAttempt.prototype, "user", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], LoginAttempt.prototype, "ipAddress", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], LoginAttempt.prototype, "userAgent", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'boolean' }),
|
|
47
|
+
__metadata("design:type", Boolean)
|
|
48
|
+
], LoginAttempt.prototype, "success", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], LoginAttempt.prototype, "failureReason", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: 'boolean', default: false }),
|
|
55
|
+
__metadata("design:type", Boolean)
|
|
56
|
+
], LoginAttempt.prototype, "mfaRequired", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], LoginAttempt.prototype, "metadata", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
|
|
63
|
+
__metadata("design:type", Date)
|
|
64
|
+
], LoginAttempt.prototype, "createdAt", void 0);
|
|
65
|
+
exports.LoginAttempt = LoginAttempt = __decorate([
|
|
66
|
+
(0, typeorm_1.Entity)('nauth_login_attempts'),
|
|
67
|
+
(0, typeorm_1.Index)(['email', 'createdAt']),
|
|
68
|
+
(0, typeorm_1.Index)(['ipAddress', 'createdAt'])
|
|
69
|
+
], LoginAttempt);
|
|
70
|
+
//# sourceMappingURL=login-attempt.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-attempt.entity.js","sourceRoot":"","sources":["../../src/entities/login-attempt.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiH;AACjH,8CAAuD;AACvD,+CAAqC;AAe9B,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,uBAAgB;IAYhD,IAAI,CAAe;CAsBpB,CAAA;AAlCY,oCAAY;AAEf;IADP,IAAA,gCAAsB,GAAE;;wCACN;AAGX;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC3B;AAGtB;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACT;AAI/B;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC/D,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;0CACZ;AAGX;IADP,IAAA,gBAAM,EAAC,E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