@veloxts/auth 0.7.8 → 0.8.0

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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @veloxts/auth
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - feat(router): new simplified procedure builder
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @veloxts/core@0.8.0
13
+ - @veloxts/router@0.8.0
14
+
15
+ ## 0.7.9
16
+
17
+ ### Patch Changes
18
+
19
+ - feat(router): swagger auto-discovery of module collections
20
+ - Updated dependencies
21
+ - @veloxts/core@0.7.9
22
+ - @veloxts/router@0.7.9
23
+
3
24
  ## 0.7.8
4
25
 
5
26
  ### Patch Changes
package/GUIDE.md CHANGED
@@ -92,7 +92,7 @@ Guards work seamlessly with the Resource API for context-dependent outputs:
92
92
 
93
93
  ```typescript
94
94
  import { resource, resourceSchema } from '@veloxts/router';
95
- import { authenticatedNarrow, adminNarrow } from '@veloxts/auth';
95
+ import { authenticated, hasRole } from '@veloxts/auth';
96
96
 
97
97
  const UserSchema = resourceSchema()
98
98
  .public('id', z.string())
@@ -103,25 +103,25 @@ const UserSchema = resourceSchema()
103
103
 
104
104
  // Anonymous - returns { id, name }
105
105
  const getPublicUser = procedure()
106
+ .output(UserSchema.public)
106
107
  .query(async ({ input, ctx }) => {
107
- const user = await ctx.db.user.findUnique({ where: { id: input.id } });
108
- return resource(user, UserSchema.public);
108
+ return ctx.db.user.findUnique({ where: { id: input.id } });
109
109
  });
110
110
 
111
111
  // Authenticated - returns { id, name, email }
112
112
  const getUser = procedure()
113
- .guardNarrow(authenticatedNarrow)
113
+ .guard(authenticated)
114
+ .output(UserSchema.authenticated)
114
115
  .query(async ({ input, ctx }) => {
115
- const user = await ctx.db.user.findUnique({ where: { id: input.id } });
116
- return resource(user, UserSchema).for(ctx); // Auto-detects level
116
+ return ctx.db.user.findUnique({ where: { id: input.id } });
117
117
  });
118
118
 
119
119
  // Admin - returns all fields
120
120
  const getFullUser = procedure()
121
- .guardNarrow(adminNarrow)
121
+ .guard(hasRole('admin'))
122
+ .output(UserSchema.admin)
122
123
  .query(async ({ input, ctx }) => {
123
- const user = await ctx.db.user.findUnique({ where: { id: input.id } });
124
- return resource(user, UserSchema.admin);
124
+ return ctx.db.user.findUnique({ where: { id: input.id } });
125
125
  });
126
126
  ```
127
127
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @veloxts/auth
2
2
 
3
- > **Early Access (v0.7.x)**
3
+ > **Early Access (v0.8.x)**
4
4
 
5
5
  Authentication and authorization for VeloxTS Framework - provides JWT, sessions, guards, CSRF protection, and auth adapters for BetterAuth and other providers. Learn more at [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox).
6
6
 
package/dist/index.d.ts CHANGED
@@ -15,8 +15,6 @@ export type { TokenStore } from './jwt.js';
15
15
  export { createInMemoryTokenStore, generateTokenId, isValidTimespan, JwtManager, jwtManager, parseTimeToSeconds, validateTokenExpiration, } from './jwt.js';
16
16
  export type { EnhancedTokenStore, EnhancedTokenStoreOptions } from './token-store.js';
17
17
  export { createEnhancedTokenStore, DEFAULT_ALLOWED_ROLES, parseUserRoles, } from './token-store.js';
18
- export type { ADMIN, AdminContext, AUTHENTICATED, AuthenticatedContext, InferNarrowedContext, NarrowingGuard, RoleNarrowedContext, TaggedContext, } from './guards-narrowing.js';
19
- export { adminNarrow, authenticatedNarrow, createNarrowingGuard, hasRoleNarrow, } from './guards-narrowing.js';
20
18
  export { DEFAULT_HASH_CONFIG, hashPassword, PasswordHasher, passwordHasher, verifyPassword, } from './hash.js';
21
19
  export type { GuardBuilder } from './guards.js';
22
20
  export { allOf, anyOf, authenticated, defineGuard, emailVerified, executeGuard, executeGuards, guard, hasAnyPermission, hasPermission, hasRole, not, userCan, } from './guards.js';
package/dist/index.js CHANGED
@@ -18,7 +18,6 @@ export { AuthError } from './types.js';
18
18
  export { AUTH_REGISTERED, checkDoubleRegistration, decorateAuth, getRequestAuth, getRequestUser, setRequestAuth, } from './decoration.js';
19
19
  export { createInMemoryTokenStore, generateTokenId, isValidTimespan, JwtManager, jwtManager, parseTimeToSeconds, validateTokenExpiration, } from './jwt.js';
20
20
  export { createEnhancedTokenStore, DEFAULT_ALLOWED_ROLES, parseUserRoles, } from './token-store.js';
21
- export { adminNarrow, authenticatedNarrow, createNarrowingGuard, hasRoleNarrow, } from './guards-narrowing.js';
22
21
  // ============================================================================
23
22
  // Password Hashing
24
23
  // ============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/auth",
3
- "version": "0.7.8",
3
+ "version": "0.8.0",
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.7.4",
64
- "@veloxts/core": "0.7.8",
65
- "@veloxts/router": "0.7.8"
64
+ "@veloxts/core": "0.8.0",
65
+ "@veloxts/router": "0.8.0"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "argon2": ">=0.30.0",
@@ -85,8 +85,8 @@
85
85
  "@vitest/coverage-v8": "4.0.18",
86
86
  "typescript": "5.9.3",
87
87
  "vitest": "4.0.18",
88
- "@veloxts/validation": "0.7.8",
89
- "@veloxts/testing": "0.7.8"
88
+ "@veloxts/testing": "0.8.0",
89
+ "@veloxts/validation": "0.8.0"
90
90
  },
91
91
  "keywords": [
92
92
  "velox",