@nauth-toolkit/storage-database 0.2.1 → 0.2.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/README.md +48 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,52 @@
|
|
|
1
1
|
# @nauth-toolkit/storage-database
|
|
2
2
|
|
|
3
|
-
Database-backed
|
|
3
|
+
Database-backed storage adapter for [nauth-toolkit](https://nauth.dev).
|
|
4
4
|
|
|
5
|
-
Stores
|
|
5
|
+
Stores rate limit counters, account lockout state, and distributed locks in your existing database via TypeORM. No additional infrastructure required — simpler than Redis for single-server deployments.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**[Documentation](https://nauth.dev)** · **[GitHub](https://github.com/noorixorg/nauth)**
|
|
8
|
+
|
|
9
|
+
> Part of [nauth-toolkit](https://www.npmjs.com/package/@nauth-toolkit/core). Requires `@nauth-toolkit/core` and a database package.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @nauth-toolkit/storage-database
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Pass the adapter in your nauth config:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { DatabaseStorageAdapter } from '@nauth-toolkit/storage-database';
|
|
27
|
+
|
|
28
|
+
const nauth = await NAuth.create({
|
|
29
|
+
config: {
|
|
30
|
+
...authConfig,
|
|
31
|
+
storageAdapter: new DatabaseStorageAdapter(),
|
|
32
|
+
},
|
|
33
|
+
dataSource,
|
|
34
|
+
adapter: new ExpressAdapter(),
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Add `getNAuthTransientStorageEntities()` to your TypeORM entities for the storage tables.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Also available
|
|
43
|
+
|
|
44
|
+
| Package | Purpose |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| [`@nauth-toolkit/storage-redis`](https://www.npmjs.com/package/@nauth-toolkit/storage-redis) | Redis — recommended for production and multi-instance deployments |
|
|
47
|
+
|
|
48
|
+
See the [full package list](https://www.npmjs.com/package/@nauth-toolkit/core#package-ecosystem) in the core README.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
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/storage-database",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Database-backed session storage 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.2.
|
|
17
|
+
"@nauth-toolkit/core": "^0.2.3",
|
|
18
18
|
"typeorm": "^0.3.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|