@nauth-toolkit/database-typeorm-mysql 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.
Files changed (71) hide show
  1. package/LICENSE +90 -0
  2. package/README.md +78 -0
  3. package/dist/entities/auth-audit.entity.d.ts +32 -0
  4. package/dist/entities/auth-audit.entity.d.ts.map +1 -0
  5. package/dist/entities/auth-audit.entity.js +141 -0
  6. package/dist/entities/auth-audit.entity.js.map +1 -0
  7. package/dist/entities/challenge-session.entity.d.ts +20 -0
  8. package/dist/entities/challenge-session.entity.d.ts.map +1 -0
  9. package/dist/entities/challenge-session.entity.js +88 -0
  10. package/dist/entities/challenge-session.entity.js.map +1 -0
  11. package/dist/entities/index.d.ts +14 -0
  12. package/dist/entities/index.d.ts.map +1 -0
  13. package/dist/entities/index.js +57 -0
  14. package/dist/entities/index.js.map +1 -0
  15. package/dist/entities/login-attempt.entity.d.ts +16 -0
  16. package/dist/entities/login-attempt.entity.d.ts.map +1 -0
  17. package/dist/entities/login-attempt.entity.js +70 -0
  18. package/dist/entities/login-attempt.entity.js.map +1 -0
  19. package/dist/entities/mfa-device.entity.d.ts +23 -0
  20. package/dist/entities/mfa-device.entity.d.ts.map +1 -0
  21. package/dist/entities/mfa-device.entity.js +105 -0
  22. package/dist/entities/mfa-device.entity.js.map +1 -0
  23. package/dist/entities/rate-limit.entity.d.ts +10 -0
  24. package/dist/entities/rate-limit.entity.d.ts.map +1 -0
  25. package/dist/entities/rate-limit.entity.js +53 -0
  26. package/dist/entities/rate-limit.entity.js.map +1 -0
  27. package/dist/entities/session.entity.d.ts +35 -0
  28. package/dist/entities/session.entity.d.ts.map +1 -0
  29. package/dist/entities/session.entity.js +158 -0
  30. package/dist/entities/session.entity.js.map +1 -0
  31. package/dist/entities/social-account.entity.d.ts +16 -0
  32. package/dist/entities/social-account.entity.d.ts.map +1 -0
  33. package/dist/entities/social-account.entity.js +76 -0
  34. package/dist/entities/social-account.entity.js.map +1 -0
  35. package/dist/entities/storage-lock.entity.d.ts +9 -0
  36. package/dist/entities/storage-lock.entity.d.ts.map +1 -0
  37. package/dist/entities/storage-lock.entity.js +43 -0
  38. package/dist/entities/storage-lock.entity.js.map +1 -0
  39. package/dist/entities/trusted-device.entity.d.ts +20 -0
  40. package/dist/entities/trusted-device.entity.d.ts.map +1 -0
  41. package/dist/entities/trusted-device.entity.js +94 -0
  42. package/dist/entities/trusted-device.entity.js.map +1 -0
  43. package/dist/entities/user.entity.d.ts +43 -0
  44. package/dist/entities/user.entity.d.ts.map +1 -0
  45. package/dist/entities/user.entity.js +229 -0
  46. package/dist/entities/user.entity.js.map +1 -0
  47. package/dist/entities/verification-token.entity.d.ts +21 -0
  48. package/dist/entities/verification-token.entity.d.ts.map +1 -0
  49. package/dist/entities/verification-token.entity.js +90 -0
  50. package/dist/entities/verification-token.entity.js.map +1 -0
  51. package/dist/index.d.ts +5 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +26 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/migrations/1734600000000-Initial.d.ts +7 -0
  56. package/dist/migrations/1734600000000-Initial.d.ts.map +1 -0
  57. package/dist/migrations/1734600000000-Initial.js +107 -0
  58. package/dist/migrations/1734600000000-Initial.js.map +1 -0
  59. package/dist/migrations/index.d.ts +6 -0
  60. package/dist/migrations/index.d.ts.map +1 -0
  61. package/dist/migrations/index.js +6 -0
  62. package/dist/migrations/index.js.map +1 -0
  63. package/dist/typeorm-cli.datasource.d.ts +5 -0
  64. package/dist/typeorm-cli.datasource.d.ts.map +1 -0
  65. package/dist/typeorm-cli.datasource.js +20 -0
  66. package/dist/typeorm-cli.datasource.js.map +1 -0
  67. package/dist/utils/run-migrations.d.ts +4 -0
  68. package/dist/utils/run-migrations.d.ts.map +1 -0
  69. package/dist/utils/run-migrations.js +28 -0
  70. package/dist/utils/run-migrations.js.map +1 -0
  71. package/package.json +48 -0
@@ -0,0 +1,94 @@
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.TrustedDevice = 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 TrustedDevice = class TrustedDevice extends core_1.BaseTrustedDevice {
17
+ user;
18
+ };
19
+ exports.TrustedDevice = TrustedDevice;
20
+ __decorate([
21
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
22
+ __metadata("design:type", Number)
23
+ ], TrustedDevice.prototype, "id", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'int' }),
26
+ __metadata("design:type", Number)
27
+ ], TrustedDevice.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
+ ], TrustedDevice.prototype, "user", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
35
+ __metadata("design:type", String)
36
+ ], TrustedDevice.prototype, "deviceTokenHash", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
39
+ __metadata("design:type", Object)
40
+ ], TrustedDevice.prototype, "deviceId", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
43
+ __metadata("design:type", Object)
44
+ ], TrustedDevice.prototype, "deviceName", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
47
+ __metadata("design:type", Object)
48
+ ], TrustedDevice.prototype, "deviceType", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
51
+ __metadata("design:type", Object)
52
+ ], TrustedDevice.prototype, "ipAddress", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
55
+ __metadata("design:type", Object)
56
+ ], TrustedDevice.prototype, "userAgent", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
59
+ __metadata("design:type", Object)
60
+ ], TrustedDevice.prototype, "platform", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
63
+ __metadata("design:type", Object)
64
+ ], TrustedDevice.prototype, "browser", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6 }),
67
+ __metadata("design:type", Date)
68
+ ], TrustedDevice.prototype, "trustedUntil", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
71
+ __metadata("design:type", Object)
72
+ ], TrustedDevice.prototype, "lastUsedAt", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamp', precision: 6, default: () => 'CURRENT_TIMESTAMP(6)' }),
75
+ __metadata("design:type", Date)
76
+ ], TrustedDevice.prototype, "createdAt", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.UpdateDateColumn)({
79
+ type: 'timestamp',
80
+ precision: 6,
81
+ default: () => 'CURRENT_TIMESTAMP(6)',
82
+ onUpdate: 'CURRENT_TIMESTAMP(6)',
83
+ }),
84
+ __metadata("design:type", Date)
85
+ ], TrustedDevice.prototype, "updatedAt", void 0);
86
+ exports.TrustedDevice = TrustedDevice = __decorate([
87
+ (0, typeorm_1.Entity)('nauth_trusted_devices'),
88
+ (0, typeorm_1.Index)(['userId']),
89
+ (0, typeorm_1.Index)(['deviceTokenHash']),
90
+ (0, typeorm_1.Index)(['deviceId']),
91
+ (0, typeorm_1.Index)(['trustedUntil']),
92
+ (0, typeorm_1.Index)(['userId', 'deviceTokenHash'], { unique: true })
93
+ ], TrustedDevice);
94
+ //# sourceMappingURL=trusted-device.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trusted-device.entity.js","sourceRoot":"","sources":["../../src/entities/trusted-device.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCASiB;AACjB,8CAAwD;AACxD,+CAAqC;AAc9B,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,wBAAiB;IASlD,IAAI,CAAQ;CA0Cb,CAAA;AAnDY,sCAAa;AAEhB;IADP,IAAA,gCAAsB,GAAE;;yCACN;AAGX;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CACD;AAIvB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC9C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8BACxB,kBAAI;2CAAC;AAGJ;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;sDACT;AAGxB;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACxB;AAGzB;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,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AAa;IANzB,IAAA,gBAAM,EAAC,uBAAuB,CAAC;IAC/B,IAAA,eAAK,EAAC,CAAC,QAAQ,CAAC,CAAC;IACjB,IAAA,eAAK,EAAC,CAAC,iBAAiB,CAAC,CAAC;IAC1B,IAAA,eAAK,EAAC,CAAC,UAAU,CAAC,CAAC;IACnB,IAAA,eAAK,EAAC,CAAC,cAAc,CAAC,CAAC;IACvB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GAC1C,aAAa,CAmDzB"}
@@ -0,0 +1,43 @@
1
+ import { BaseUser } from '@nauth-toolkit/core';
2
+ export declare class User extends BaseUser {
3
+ id: number;
4
+ sub: string;
5
+ username?: string | null;
6
+ firstName?: string | null;
7
+ lastName?: string | null;
8
+ email: string;
9
+ phone?: string | null;
10
+ passwordHash?: string | null;
11
+ passwordChangedAt?: Date | null;
12
+ passwordHistory?: string[] | null;
13
+ mustChangePassword: boolean;
14
+ isEmailVerified: boolean;
15
+ isPhoneVerified: boolean;
16
+ isActive: boolean;
17
+ isLocked: boolean;
18
+ lockReason?: string | null;
19
+ lockedAt?: Date | null;
20
+ lockedUntil?: Date | null;
21
+ failedLoginAttempts: number;
22
+ lastFailedLoginAt?: Date | null;
23
+ lastLoginAt?: Date | null;
24
+ lastLoginIp?: string | null;
25
+ mfaEnabled: boolean;
26
+ mfaMethods?: string[] | null;
27
+ mfaEnforcedAt?: Date | null;
28
+ totpSecret?: string | null;
29
+ backupCodes?: string[] | null;
30
+ preferredMfaMethod?: string | null;
31
+ mfaExempt?: boolean;
32
+ mfaExemptReason?: string | null;
33
+ mfaExemptGrantedAt?: Date | null;
34
+ mfaExemptGrantedBy?: string | null;
35
+ hasSocialAuth: boolean;
36
+ socialProviders?: string[] | null;
37
+ metadata?: Record<string, unknown> | null;
38
+ createdAt: Date;
39
+ updatedAt: Date;
40
+ deletedAt?: Date | null;
41
+ generateSub(): void;
42
+ }
43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I,CAAC;IAG7B,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAG5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG3B,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAG9B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnC,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGhC,kBAAkB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGjC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGnC,aAAa,EAAE,OAAO,CAAC;IAGvB,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAGlC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAG1C,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAMhC,WAAW,IAAI,IAAI;CAKpB"}
@@ -0,0 +1,229 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.User = void 0;
46
+ const typeorm_1 = require("typeorm");
47
+ const core_1 = require("@nauth-toolkit/core");
48
+ const crypto = __importStar(require("crypto"));
49
+ let User = class User extends core_1.BaseUser {
50
+ generateSub() {
51
+ if (!this.sub) {
52
+ this.sub = crypto.randomUUID();
53
+ }
54
+ }
55
+ };
56
+ exports.User = User;
57
+ __decorate([
58
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
59
+ __metadata("design:type", Number)
60
+ ], User.prototype, "id", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ type: 'char', length: 36 }),
63
+ __metadata("design:type", String)
64
+ ], User.prototype, "sub", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
67
+ __metadata("design:type", Object)
68
+ ], User.prototype, "username", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
71
+ __metadata("design:type", Object)
72
+ ], User.prototype, "firstName", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
75
+ __metadata("design:type", Object)
76
+ ], User.prototype, "lastName", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
79
+ __metadata("design:type", String)
80
+ ], User.prototype, "email", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20, nullable: true }),
83
+ __metadata("design:type", Object)
84
+ ], User.prototype, "phone", void 0);
85
+ __decorate([
86
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
87
+ __metadata("design:type", Object)
88
+ ], User.prototype, "passwordHash", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
91
+ __metadata("design:type", Object)
92
+ ], User.prototype, "passwordChangedAt", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
95
+ __metadata("design:type", Object)
96
+ ], User.prototype, "passwordHistory", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
99
+ __metadata("design:type", Boolean)
100
+ ], User.prototype, "mustChangePassword", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
103
+ __metadata("design:type", Boolean)
104
+ ], User.prototype, "isEmailVerified", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
107
+ __metadata("design:type", Boolean)
108
+ ], User.prototype, "isPhoneVerified", void 0);
109
+ __decorate([
110
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 1 }),
111
+ __metadata("design:type", Boolean)
112
+ ], User.prototype, "isActive", void 0);
113
+ __decorate([
114
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
115
+ __metadata("design:type", Boolean)
116
+ ], User.prototype, "isLocked", void 0);
117
+ __decorate([
118
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
119
+ __metadata("design:type", Object)
120
+ ], User.prototype, "lockReason", void 0);
121
+ __decorate([
122
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
123
+ __metadata("design:type", Object)
124
+ ], User.prototype, "lockedAt", void 0);
125
+ __decorate([
126
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
127
+ __metadata("design:type", Object)
128
+ ], User.prototype, "lockedUntil", void 0);
129
+ __decorate([
130
+ (0, typeorm_1.Column)({ type: 'int', default: 0 }),
131
+ __metadata("design:type", Number)
132
+ ], User.prototype, "failedLoginAttempts", void 0);
133
+ __decorate([
134
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
135
+ __metadata("design:type", Object)
136
+ ], User.prototype, "lastFailedLoginAt", void 0);
137
+ __decorate([
138
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
139
+ __metadata("design:type", Object)
140
+ ], User.prototype, "lastLoginAt", void 0);
141
+ __decorate([
142
+ (0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
143
+ __metadata("design:type", Object)
144
+ ], User.prototype, "lastLoginIp", void 0);
145
+ __decorate([
146
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
147
+ __metadata("design:type", Boolean)
148
+ ], User.prototype, "mfaEnabled", void 0);
149
+ __decorate([
150
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
151
+ __metadata("design:type", Object)
152
+ ], User.prototype, "mfaMethods", void 0);
153
+ __decorate([
154
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
155
+ __metadata("design:type", Object)
156
+ ], User.prototype, "mfaEnforcedAt", void 0);
157
+ __decorate([
158
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
159
+ __metadata("design:type", Object)
160
+ ], User.prototype, "totpSecret", void 0);
161
+ __decorate([
162
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
163
+ __metadata("design:type", Object)
164
+ ], User.prototype, "backupCodes", void 0);
165
+ __decorate([
166
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20, nullable: true }),
167
+ __metadata("design:type", Object)
168
+ ], User.prototype, "preferredMfaMethod", void 0);
169
+ __decorate([
170
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
171
+ __metadata("design:type", Boolean)
172
+ ], User.prototype, "mfaExempt", void 0);
173
+ __decorate([
174
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
175
+ __metadata("design:type", Object)
176
+ ], User.prototype, "mfaExemptReason", void 0);
177
+ __decorate([
178
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
179
+ __metadata("design:type", Object)
180
+ ], User.prototype, "mfaExemptGrantedAt", void 0);
181
+ __decorate([
182
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
183
+ __metadata("design:type", Object)
184
+ ], User.prototype, "mfaExemptGrantedBy", void 0);
185
+ __decorate([
186
+ (0, typeorm_1.Column)({ type: 'tinyint', width: 1, default: 0 }),
187
+ __metadata("design:type", Boolean)
188
+ ], User.prototype, "hasSocialAuth", void 0);
189
+ __decorate([
190
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
191
+ __metadata("design:type", Object)
192
+ ], User.prototype, "socialProviders", void 0);
193
+ __decorate([
194
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
195
+ __metadata("design:type", Object)
196
+ ], User.prototype, "metadata", void 0);
197
+ __decorate([
198
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamp', precision: 6, default: () => 'CURRENT_TIMESTAMP(6)' }),
199
+ __metadata("design:type", Date)
200
+ ], User.prototype, "createdAt", void 0);
201
+ __decorate([
202
+ (0, typeorm_1.UpdateDateColumn)({
203
+ type: 'timestamp',
204
+ precision: 6,
205
+ default: () => 'CURRENT_TIMESTAMP(6)',
206
+ onUpdate: 'CURRENT_TIMESTAMP(6)',
207
+ }),
208
+ __metadata("design:type", Date)
209
+ ], User.prototype, "updatedAt", void 0);
210
+ __decorate([
211
+ (0, typeorm_1.DeleteDateColumn)({ type: 'timestamp', precision: 6, nullable: true }),
212
+ __metadata("design:type", Object)
213
+ ], User.prototype, "deletedAt", void 0);
214
+ __decorate([
215
+ (0, typeorm_1.BeforeInsert)(),
216
+ __metadata("design:type", Function),
217
+ __metadata("design:paramtypes", []),
218
+ __metadata("design:returntype", void 0)
219
+ ], User.prototype, "generateSub", null);
220
+ exports.User = User = __decorate([
221
+ (0, typeorm_1.Entity)('nauth_users'),
222
+ (0, typeorm_1.Index)(['sub'], { unique: true }),
223
+ (0, typeorm_1.Index)(['email'], { unique: true }),
224
+ (0, typeorm_1.Index)(['username'], { unique: true }),
225
+ (0, typeorm_1.Index)(['phone']),
226
+ (0, typeorm_1.Index)(['isActive']),
227
+ (0, typeorm_1.Index)(['hasSocialAuth'])
228
+ ], User);
229
+ //# sourceMappingURL=user.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCASiB;AACjB,8CAA+C;AAC/C,+CAAiC;AAkC1B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,eAAQ;IA4HhC,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;CACF,CAAA;AAjIY,oBAAI;AAEP;IAD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,EAAC,CAAC,UAAU,CAAC,CAAC;IACnB,IAAA,eAAK,EAAC,CAAC,eAAe,CAAC,CAAC;GACZ,IAAI,CAiIhB"}
@@ -0,0 +1,21 @@
1
+ import { BaseVerificationToken } from '@nauth-toolkit/core';
2
+ import { User } from './user.entity';
3
+ import { ChallengeSession } from './challenge-session.entity';
4
+ export declare class VerificationToken extends BaseVerificationToken {
5
+ id: number;
6
+ userId: number;
7
+ user: User;
8
+ challengeSessionId?: number | null;
9
+ challengeSession?: ChallengeSession | null;
10
+ type: 'email' | 'phone' | 'password_reset';
11
+ token: string;
12
+ code?: string | null;
13
+ expiresAt: Date;
14
+ attempts: number;
15
+ usedAt?: Date | null;
16
+ ipAddress?: string | null;
17
+ userAgent?: string | null;
18
+ metadata?: Record<string, unknown> | null;
19
+ createdAt: Date;
20
+ }
21
+ //# sourceMappingURL=verification-token.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification-token.entity.d.ts","sourceRoot":"","sources":["../../src/entities/verification-token.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAQ9D,qBAIa,iBAAkB,SAAQ,qBAAqB;IAElD,EAAE,EAAE,MAAM,CAAC;IAGX,MAAM,EAAE,MAAM,CAAC;IAIvB,IAAI,EAAG,IAAI,CAAC;IAGJ,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAI3C,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAGnC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,gBAAgB,CAAC;IAG3C,KAAK,EAAE,MAAM,CAAC;IAGd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGrB,SAAS,EAAE,IAAI,CAAC;IAGhB,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAG1C,SAAS,EAAE,IAAI,CAAC;CACzB"}
@@ -0,0 +1,90 @@
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.VerificationToken = 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
+ const challenge_session_entity_1 = require("./challenge-session.entity");
17
+ let VerificationToken = class VerificationToken extends core_1.BaseVerificationToken {
18
+ user;
19
+ challengeSession;
20
+ };
21
+ exports.VerificationToken = VerificationToken;
22
+ __decorate([
23
+ (0, typeorm_1.PrimaryGeneratedColumn)(),
24
+ __metadata("design:type", Number)
25
+ ], VerificationToken.prototype, "id", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ type: 'int' }),
28
+ __metadata("design:type", Number)
29
+ ], VerificationToken.prototype, "userId", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: 'CASCADE' }),
32
+ (0, typeorm_1.JoinColumn)({ name: 'userId' }),
33
+ __metadata("design:type", user_entity_1.User)
34
+ ], VerificationToken.prototype, "user", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
37
+ __metadata("design:type", Object)
38
+ ], VerificationToken.prototype, "challengeSessionId", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.ManyToOne)(() => challenge_session_entity_1.ChallengeSession, { nullable: true, onDelete: 'CASCADE' }),
41
+ (0, typeorm_1.JoinColumn)({ name: 'challengeSessionId' }),
42
+ __metadata("design:type", Object)
43
+ ], VerificationToken.prototype, "challengeSession", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20 }),
46
+ __metadata("design:type", String)
47
+ ], VerificationToken.prototype, "type", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
50
+ __metadata("design:type", String)
51
+ ], VerificationToken.prototype, "token", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'varchar', length: 10, nullable: true }),
54
+ __metadata("design:type", Object)
55
+ ], VerificationToken.prototype, "code", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6 }),
58
+ __metadata("design:type", Date)
59
+ ], VerificationToken.prototype, "expiresAt", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)({ type: 'int', default: 0 }),
62
+ __metadata("design:type", Number)
63
+ ], VerificationToken.prototype, "attempts", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)({ type: 'timestamp', precision: 6, nullable: true }),
66
+ __metadata("design:type", Object)
67
+ ], VerificationToken.prototype, "usedAt", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
70
+ __metadata("design:type", Object)
71
+ ], VerificationToken.prototype, "ipAddress", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
74
+ __metadata("design:type", Object)
75
+ ], VerificationToken.prototype, "userAgent", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.Column)({ type: 'json', nullable: true }),
78
+ __metadata("design:type", Object)
79
+ ], VerificationToken.prototype, "metadata", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamp', precision: 6, default: () => 'CURRENT_TIMESTAMP(6)' }),
82
+ __metadata("design:type", Date)
83
+ ], VerificationToken.prototype, "createdAt", void 0);
84
+ exports.VerificationToken = VerificationToken = __decorate([
85
+ (0, typeorm_1.Entity)('nauth_verification_tokens'),
86
+ (0, typeorm_1.Index)(['userId', 'type']),
87
+ (0, typeorm_1.Index)(['token']),
88
+ (0, typeorm_1.Index)(['expiresAt'])
89
+ ], VerificationToken);
90
+ //# sourceMappingURL=verification-token.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification-token.entity.js","sourceRoot":"","sources":["../../src/entities/verification-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiH;AACjH,8CAA4D;AAC5D,+CAAqC;AACrC,yEAA8D;AAYvD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,4BAAqB;IAS1D,IAAI,CAAQ;IAOZ,gBAAgB,CAA2B;CA+B5C,CAAA;AA/CY,8CAAiB;AAEpB;IADP,IAAA,gCAAsB,GAAE;;6CACN;AAGX;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;iDACD;AAIvB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC9C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8BACxB,kBAAI;+CAAC;AAGJ;IADP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IA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B,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC;8BAC1E,IAAI;oDAAC;4BA9Cb,iBAAiB;IAJ7B,IAAA,gBAAM,EAAC,2BAA2B,CAAC;IACnC,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzB,IAAA,eAAK,EAAC,CAAC,OAAO,CAAC,CAAC;IAChB,IAAA,eAAK,EAAC,CAAC,WAAW,CAAC,CAAC;GACR,iBAAiB,CA+C7B"}
@@ -0,0 +1,5 @@
1
+ export { getNAuthEntities, getNAuthTransientStorageEntities } from './entities';
2
+ export { getNAuthTransientStorageEntities as getNAuthStorageEntities } from './entities';
3
+ export * from './entities';
4
+ export { runNAuthMigrations } from './utils/run-migrations';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAGhF,OAAO,EAAE,gCAAgC,IAAI,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAGzF,cAAc,YAAY,CAAC;AAa3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
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.runNAuthMigrations = exports.getNAuthStorageEntities = exports.getNAuthTransientStorageEntities = exports.getNAuthEntities = void 0;
18
+ var entities_1 = require("./entities");
19
+ Object.defineProperty(exports, "getNAuthEntities", { enumerable: true, get: function () { return entities_1.getNAuthEntities; } });
20
+ Object.defineProperty(exports, "getNAuthTransientStorageEntities", { enumerable: true, get: function () { return entities_1.getNAuthTransientStorageEntities; } });
21
+ var entities_2 = require("./entities");
22
+ Object.defineProperty(exports, "getNAuthStorageEntities", { enumerable: true, get: function () { return entities_2.getNAuthTransientStorageEntities; } });
23
+ __exportStar(require("./entities"), exports);
24
+ var run_migrations_1 = require("./utils/run-migrations");
25
+ Object.defineProperty(exports, "runNAuthMigrations", { enumerable: true, get: function () { return run_migrations_1.runNAuthMigrations; } });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,uCAAgF;AAAvE,4GAAA,gBAAgB,OAAA;AAAE,4HAAA,gCAAgC,OAAA;AAG3D,uCAAyF;AAAhF,mHAAA,gCAAgC,OAA2B;AAGpE,6CAA2B;AAa3B,yDAA4D;AAAnD,oHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,7 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+ export declare class Initial1734600000000 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=1734600000000-Initial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1734600000000-Initial.d.ts","sourceRoot":"","sources":["../../src/migrations/1734600000000-Initial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,oBAAqB,YAAW,kBAAkB;IAC7D,IAAI,SAA0B;IAEjB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA+D3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA6E3D"}