@nauth-toolkit/database-typeorm-postgres 0.2.1 → 0.2.2
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 +43 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,8 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
PostgreSQL database adapter for [nauth-toolkit](https://nauth.dev).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Provides TypeORM entity definitions for all auth tables — users, sessions, MFA devices, social accounts, audit logs, and more. Plug into your existing TypeORM `DataSource` and nauth-toolkit manages the rest.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**[Documentation](https://nauth.dev)** · **[GitHub](https://github.com/noorixorg/nauth)**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
> Part of [nauth-toolkit](https://www.npmjs.com/package/@nauth-toolkit/core). Requires `@nauth-toolkit/core`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @nauth-toolkit/core @nauth-toolkit/database-typeorm-postgres
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { DataSource } from 'typeorm';
|
|
25
|
+
import { getNAuthEntities } from '@nauth-toolkit/database-typeorm-postgres';
|
|
26
|
+
|
|
27
|
+
const dataSource = new DataSource({
|
|
28
|
+
type: 'postgres',
|
|
29
|
+
url: process.env.DATABASE_URL,
|
|
30
|
+
entities: getNAuthEntities(),
|
|
31
|
+
synchronize: true, // dev only
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use `getNAuthEntities()` in your TypeORM config. If using `DatabaseStorageAdapter`, also add `getNAuthTransientStorageEntities()`.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Also available
|
|
40
|
+
|
|
41
|
+
| Package | Purpose |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| [`@nauth-toolkit/database-typeorm-mysql`](https://www.npmjs.com/package/@nauth-toolkit/database-typeorm-mysql) | MySQL / MariaDB — same structure, different driver |
|
|
44
|
+
|
|
45
|
+
See the [full package list](https://www.npmjs.com/package/@nauth-toolkit/core#package-ecosystem) in the core README.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
Free to use. See [license](https://nauth.dev/docs/license).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nauth-toolkit/database-typeorm-postgres",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "PostgreSQL storage adapter for nauth-toolkit via TypeORM",
|
|
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.2.
|
|
17
|
+
"@nauth-toolkit/core": "^0.2.2",
|
|
18
18
|
"typeorm": "^0.3.20",
|
|
19
19
|
"pg": "^8.0.0"
|
|
20
20
|
},
|