@veloxts/orm 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 +85 -0
  2. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,90 @@
1
1
  # @veloxts/orm
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
+ - Updated dependencies
40
+ - @veloxts/core@0.6.70
41
+
42
+ ## 0.6.69
43
+
44
+ ### Patch Changes
45
+
46
+ - implement user feedback improvements across packages
47
+
48
+ ## Summary
49
+
50
+ Addresses 9 user feedback items to improve DX, reduce boilerplate, and eliminate template duplications.
51
+
52
+ ### Phase 1: Validation Helpers (`@veloxts/validation`)
53
+
54
+ - Add `prismaDecimal()`, `prismaDecimalNullable()`, `prismaDecimalOptional()` for Prisma Decimal → number conversion
55
+ - Add `dateToIso`, `dateToIsoNullable`, `dateToIsoOptional` aliases for consistency
56
+
57
+ ### Phase 2: Template Deduplication (`@veloxts/auth`)
58
+
59
+ - Export `createEnhancedTokenStore()` with token revocation and refresh token reuse detection
60
+ - Export `parseUserRoles()` and `DEFAULT_ALLOWED_ROLES`
61
+ - Fix memory leak: track pending timeouts for proper cleanup on `destroy()`
62
+ - Update templates to import from `@veloxts/auth` instead of duplicating code
63
+ - Fix jwtManager singleton pattern in templates
64
+
65
+ ### Phase 3: Router Helpers (`@veloxts/router`)
66
+
67
+ - Add `createRouter()` returning `{ collections, router }` for DRY setup
68
+ - Add `toRouter()` for router-only use cases
69
+ - Update all router templates to use `createRouter()`
70
+
71
+ ### Phase 4: Guard Type Narrowing - Experimental (`@veloxts/auth`, `@veloxts/router`)
72
+
73
+ - Add `NarrowingGuard` interface with phantom `_narrows` type
74
+ - Add `authenticatedNarrow` and `hasRoleNarrow()` guards
75
+ - Add `guardNarrow()` method to `ProcedureBuilder` for context narrowing
76
+ - Enables `ctx.user` to be non-null after guard passes
77
+
78
+ ### Phase 5: Documentation (`@veloxts/router`)
79
+
80
+ - Document `.rest()` override patterns
81
+ - Document `createRouter()` helper usage
82
+ - Document `guardNarrow()` experimental API
83
+ - Add schema browser-safety patterns for RSC apps
84
+
85
+ - Updated dependencies
86
+ - @veloxts/core@0.6.69
87
+
3
88
  ## 0.6.68
4
89
 
5
90
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veloxts/orm",
3
- "version": "0.6.68",
3
+ "version": "0.6.70",
4
4
  "description": "Prisma wrapper with enhanced DX for VeloxTS framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "fastify": "5.6.2",
20
20
  "pg": "8.16.0",
21
21
  "pg-format": "1.0.4",
22
- "@veloxts/core": "0.6.68"
22
+ "@veloxts/core": "0.6.70"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/pg": "8.15.4",