@veloxts/auth 0.6.85 → 0.6.86
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/CHANGELOG.md +9 -0
- package/GUIDE.md +16 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/GUIDE.md
CHANGED
|
@@ -54,14 +54,27 @@ const getProfile = procedure()
|
|
|
54
54
|
## Guards
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
|
-
import { hasRole, hasPermission } from '@veloxts/auth';
|
|
57
|
+
import { authenticated, hasRole, hasPermission } from '@veloxts/auth';
|
|
58
58
|
|
|
59
|
+
// Require authentication
|
|
60
|
+
const getProfile = procedure()
|
|
61
|
+
.guard(authenticated)
|
|
62
|
+
.query(({ ctx }) => ctx.user);
|
|
63
|
+
|
|
64
|
+
// Require admin role
|
|
59
65
|
const adminOnly = procedure()
|
|
60
|
-
.
|
|
66
|
+
.guard(hasRole('admin'))
|
|
61
67
|
.mutation(handler);
|
|
62
68
|
|
|
69
|
+
// Require specific permission
|
|
63
70
|
const canEdit = procedure()
|
|
64
|
-
.
|
|
71
|
+
.guard(hasPermission('posts.write'))
|
|
72
|
+
.mutation(handler);
|
|
73
|
+
|
|
74
|
+
// Chain multiple guards (all must pass)
|
|
75
|
+
const adminWithPermission = procedure()
|
|
76
|
+
.guard(authenticated)
|
|
77
|
+
.guard(hasRole('admin'))
|
|
65
78
|
.mutation(handler);
|
|
66
79
|
```
|
|
67
80
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/auth",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.86",
|
|
4
4
|
"description": "Authentication and authorization system for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@fastify/cookie": "11.0.2",
|
|
63
63
|
"fastify": "5.6.2",
|
|
64
|
-
"@veloxts/core": "0.6.
|
|
65
|
-
"@veloxts/router": "0.6.
|
|
64
|
+
"@veloxts/core": "0.6.86",
|
|
65
|
+
"@veloxts/router": "0.6.86"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"argon2": ">=0.30.0",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"fastify-plugin": "5.1.0",
|
|
87
87
|
"typescript": "5.9.3",
|
|
88
88
|
"vitest": "4.0.16",
|
|
89
|
-
"@veloxts/
|
|
90
|
-
"@veloxts/
|
|
89
|
+
"@veloxts/testing": "0.6.86",
|
|
90
|
+
"@veloxts/validation": "0.6.86"
|
|
91
91
|
},
|
|
92
92
|
"keywords": [
|
|
93
93
|
"velox",
|