@nauth-toolkit/database-typeorm-mysql 0.1.3 → 0.1.6
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 +4 -73
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,78 +1,9 @@
|
|
|
1
1
|
# @nauth-toolkit/database-typeorm-mysql
|
|
2
2
|
|
|
3
|
-
MySQL
|
|
3
|
+
MySQL TypeORM adapter for nauth-toolkit
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Preview Release Notice
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
yarn add @nauth-toolkit/core @nauth-toolkit/database-typeorm-mysql typeorm mysql2
|
|
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-mysql';
|
|
18
|
-
|
|
19
|
-
@Module({
|
|
20
|
-
imports: [
|
|
21
|
-
TypeOrmModule.forRoot({
|
|
22
|
-
type: 'mysql',
|
|
23
|
-
host: process.env.DB_HOST,
|
|
24
|
-
port: 3306,
|
|
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
|
-
// ✅ Entities not needed - auto-discovered from DataSource
|
|
33
|
-
jwt: {
|
|
34
|
-
accessToken: { secret: process.env.JWT_SECRET },
|
|
35
|
-
refreshToken: { secret: process.env.JWT_REFRESH_SECRET },
|
|
36
|
-
},
|
|
37
|
-
// ... other config
|
|
38
|
-
}),
|
|
39
|
-
],
|
|
40
|
-
})
|
|
41
|
-
export class AppModule {}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Features
|
|
45
|
-
|
|
46
|
-
- ✅ MySQL-compatible column types
|
|
47
|
-
- ✅ JSON storage for complex types (metadata, arrays)
|
|
48
|
-
- ✅ UUID support via char(36)
|
|
49
|
-
- ✅ All nauth-toolkit entities included
|
|
50
|
-
- ✅ Optimized indexes for performance
|
|
51
|
-
|
|
52
|
-
## Column Type Mappings
|
|
53
|
-
|
|
54
|
-
The MySQL adapter automatically maps PostgreSQL types to MySQL equivalents:
|
|
55
|
-
|
|
56
|
-
| PostgreSQL | MySQL | Notes |
|
|
57
|
-
|------------|-------|-------|
|
|
58
|
-
| `uuid` | `char(36)` | UUID stored as string |
|
|
59
|
-
| `jsonb` | `json` | MySQL uses json, not jsonb |
|
|
60
|
-
| `text[]` | `json` | Arrays stored as JSON |
|
|
61
|
-
| `boolean` | `tinyint(1)` | MySQL boolean is tinyint |
|
|
62
|
-
| `timestamp` | `datetime` | MySQL datetime type |
|
|
63
|
-
| `integer` | `int` | MySQL int type |
|
|
64
|
-
|
|
65
|
-
## Entities
|
|
66
|
-
|
|
67
|
-
- `User` - User accounts and authentication data
|
|
68
|
-
- `Session` - Active user sessions
|
|
69
|
-
- `SocialAccount` - OAuth provider linkages
|
|
70
|
-
- `MFADevice` - Multi-factor authentication devices
|
|
71
|
-
- `VerificationToken` - Email/phone verification tokens
|
|
72
|
-
- `ChallengeSession` - Temporary challenge sessions
|
|
73
|
-
- `LoginAttempt` - Login attempt audit logs
|
|
74
|
-
|
|
75
|
-
## License
|
|
76
|
-
|
|
77
|
-
MIT
|
|
7
|
+
**This is a preview release for internal testing. Do not use in production yet.**
|
|
78
8
|
|
|
9
|
+
This package is part of nauth-toolkit and is currently in early access/preview. Features and APIs may change between releases. For production use, please wait for the stable v1.0 release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nauth-toolkit/database-typeorm-mysql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "MySQL TypeORM adapter for nauth-toolkit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"format:check": "prettier --check \"src/**/*.ts\""
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@nauth-toolkit/core": "^0.1.
|
|
17
|
+
"@nauth-toolkit/core": "^0.1.6",
|
|
18
18
|
"typeorm": "^0.3.20",
|
|
19
19
|
"mysql2": "^2.3.0 || ^3.0.0"
|
|
20
20
|
},
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public",
|
|
33
|
-
"tag": "
|
|
33
|
+
"tag": "latest"
|
|
34
34
|
},
|
|
35
35
|
"license": "UNLICENSED",
|
|
36
36
|
"keywords": [
|