@veloxts/core 0.6.68 → 0.6.70

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.
Files changed (2) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # @veloxts/core
2
2
 
3
+ ## 0.6.70
4
+
5
+ ### Patch Changes
6
+
7
+ - ### feat(auth): Unified Adapter-Only Architecture
8
+
9
+ **New Features:**
10
+
11
+ - Add `JwtAdapter` implementing the `AuthAdapter` interface for unified JWT authentication
12
+ - Add `jwtAuth()` convenience function for direct adapter usage with optional built-in routes (`/api/auth/refresh`, `/api/auth/logout`)
13
+ - Add `AuthContext` discriminated union (`NativeAuthContext | AdapterAuthContext`) for type-safe auth mode handling
14
+ - Add double-registration protection to prevent conflicting auth system setups
15
+ - Add shared decoration utilities (`decorateAuth`, `setRequestAuth`, `checkDoubleRegistration`)
16
+
17
+ **Architecture Changes:**
18
+
19
+ - `authPlugin` now uses `JwtAdapter` internally - all authentication flows through the adapter pattern
20
+ - Single code path for authentication (no more dual native/adapter modes)
21
+ - `authContext.authMode` is now always `'adapter'` with `providerId='jwt'` when using `authPlugin`
22
+
23
+ **Breaking Changes:**
24
+
25
+ - Remove deprecated `LegacySessionConfig` interface (use `sessionMiddleware` instead)
26
+ - Remove deprecated `session` field from `AuthConfig`
27
+ - `User` interface no longer has index signature (extend via declaration merging)
28
+
29
+ **Type Safety Improvements:**
30
+
31
+ - `AuthContext` discriminated union enables exhaustive type narrowing based on `authMode`
32
+ - Export `NativeAuthContext` and `AdapterAuthContext` types for explicit typing
33
+
34
+ **Migration:**
35
+
36
+ - Existing `authPlugin` usage remains backward-compatible
37
+ - If checking `authContext.token`, use `authContext.session` instead (token stored in session for adapter mode)
38
+
39
+ ## 0.6.69
40
+
41
+ ### Patch Changes
42
+
43
+ - implement user feedback improvements across packages
44
+
45
+ ## Summary
46
+
47
+ Addresses 9 user feedback items to improve DX, reduce boilerplate, and eliminate template duplications.
48
+
49
+ ### Phase 1: Validation Helpers (`@veloxts/validation`)
50
+
51
+ - Add `prismaDecimal()`, `prismaDecimalNullable()`, `prismaDecimalOptional()` for Prisma Decimal → number conversion
52
+ - Add `dateToIso`, `dateToIsoNullable`, `dateToIsoOptional` aliases for consistency
53
+
54
+ ### Phase 2: Template Deduplication (`@veloxts/auth`)
55
+
56
+ - Export `createEnhancedTokenStore()` with token revocation and refresh token reuse detection
57
+ - Export `parseUserRoles()` and `DEFAULT_ALLOWED_ROLES`
58
+ - Fix memory leak: track pending timeouts for proper cleanup on `destroy()`
59
+ - Update templates to import from `@veloxts/auth` instead of duplicating code
60
+ - Fix jwtManager singleton pattern in templates
61
+
62
+ ### Phase 3: Router Helpers (`@veloxts/router`)
63
+
64
+ - Add `createRouter()` returning `{ collections, router }` for DRY setup
65
+ - Add `toRouter()` for router-only use cases
66
+ - Update all router templates to use `createRouter()`
67
+
68
+ ### Phase 4: Guard Type Narrowing - Experimental (`@veloxts/auth`, `@veloxts/router`)
69
+
70
+ - Add `NarrowingGuard` interface with phantom `_narrows` type
71
+ - Add `authenticatedNarrow` and `hasRoleNarrow()` guards
72
+ - Add `guardNarrow()` method to `ProcedureBuilder` for context narrowing
73
+ - Enables `ctx.user` to be non-null after guard passes
74
+
75
+ ### Phase 5: Documentation (`@veloxts/router`)
76
+
77
+ - Document `.rest()` override patterns
78
+ - Document `createRouter()` helper usage
79
+ - Document `guardNarrow()` experimental API
80
+ - Add schema browser-safety patterns for RSC apps
81
+
3
82
  ## 0.6.68
4
83
 
5
84
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/core",
3
- "version": "0.6.68",
3
+ "version": "0.6.70",
4
4
  "description": "Fastify wrapper, DI container, and plugin system for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",