veloce-ts 0.3.2 → 0.4.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +673 -501
  2. package/dist/cjs/src/adapters/base.js +3 -0
  3. package/dist/cjs/src/adapters/base.js.map +9 -0
  4. package/dist/cjs/src/adapters/express.js +4 -0
  5. package/dist/cjs/src/adapters/express.js.map +10 -0
  6. package/dist/cjs/src/adapters/hono.js +3 -0
  7. package/dist/cjs/src/adapters/hono.js.map +10 -0
  8. package/dist/cjs/src/auth/index.js +18 -0
  9. package/dist/cjs/src/auth/index.js.map +115 -0
  10. package/dist/cjs/src/cli/index.js +27 -50
  11. package/dist/cjs/src/cli/index.js.map +4 -4
  12. package/dist/cjs/src/docs/index.js +3 -3
  13. package/dist/cjs/src/docs/index.js.map +3 -3
  14. package/dist/cjs/src/errors/index.js +29 -3
  15. package/dist/cjs/src/errors/index.js.map +75 -7
  16. package/dist/cjs/src/graphql/index.js +17 -17
  17. package/dist/cjs/src/graphql/index.js.map +6 -6
  18. package/dist/cjs/src/index.js +60 -54
  19. package/dist/cjs/src/index.js.map +33 -32
  20. package/dist/cjs/src/middleware/index.js +22 -22
  21. package/dist/cjs/src/middleware/index.js.map +5 -5
  22. package/dist/cjs/src/plugins/index.js +43 -44
  23. package/dist/cjs/src/plugins/index.js.map +10 -10
  24. package/dist/cjs/src/testing/index.js +34 -27
  25. package/dist/cjs/src/testing/index.js.map +19 -19
  26. package/dist/cjs/src/validation/index.js +2 -2
  27. package/dist/cjs/src/validation/index.js.map +5 -5
  28. package/dist/cjs/src/websocket/index.js +3 -3
  29. package/dist/cjs/src/websocket/index.js.map +3 -3
  30. package/dist/esm/src/adapters/base.js +4 -0
  31. package/dist/esm/src/adapters/base.js.map +9 -0
  32. package/dist/esm/src/adapters/express.js +5 -0
  33. package/dist/esm/src/adapters/express.js.map +10 -0
  34. package/dist/esm/src/adapters/hono.js +4 -0
  35. package/dist/esm/src/adapters/hono.js.map +10 -0
  36. package/dist/esm/src/auth/index.js +19 -0
  37. package/dist/esm/src/auth/index.js.map +115 -0
  38. package/dist/esm/src/cli/index.js +27 -50
  39. package/dist/esm/src/cli/index.js.map +4 -4
  40. package/dist/esm/src/docs/index.js +3 -3
  41. package/dist/esm/src/docs/index.js.map +3 -3
  42. package/dist/esm/src/errors/index.js +29 -3
  43. package/dist/esm/src/errors/index.js.map +75 -7
  44. package/dist/esm/src/graphql/index.js +18 -18
  45. package/dist/esm/src/graphql/index.js.map +6 -6
  46. package/dist/esm/src/index.js +60 -54
  47. package/dist/esm/src/index.js.map +33 -32
  48. package/dist/esm/src/middleware/index.js +23 -23
  49. package/dist/esm/src/middleware/index.js.map +5 -5
  50. package/dist/esm/src/plugins/index.js +43 -44
  51. package/dist/esm/src/plugins/index.js.map +10 -10
  52. package/dist/esm/src/testing/index.js +34 -27
  53. package/dist/esm/src/testing/index.js.map +19 -19
  54. package/dist/esm/src/validation/index.js +2 -2
  55. package/dist/esm/src/validation/index.js.map +5 -5
  56. package/dist/esm/src/websocket/index.js +2 -2
  57. package/dist/esm/src/websocket/index.js.map +3 -3
  58. package/dist/types/adapters/express.d.ts +66 -22
  59. package/dist/types/adapters/express.d.ts.map +1 -1
  60. package/dist/types/auth/auth-plugin.d.ts +1 -0
  61. package/dist/types/auth/auth-plugin.d.ts.map +1 -1
  62. package/dist/types/auth/auth-service.d.ts +6 -0
  63. package/dist/types/auth/auth-service.d.ts.map +1 -1
  64. package/dist/types/auth/jwt-provider.d.ts +1 -0
  65. package/dist/types/auth/jwt-provider.d.ts.map +1 -1
  66. package/dist/types/auth/session-plugin.d.ts +2 -0
  67. package/dist/types/auth/session-plugin.d.ts.map +1 -1
  68. package/dist/types/cli/commands/new.d.ts.map +1 -1
  69. package/dist/types/core/application.d.ts +1 -0
  70. package/dist/types/core/application.d.ts.map +1 -1
  71. package/dist/types/core/compiled-metadata.d.ts +28 -2
  72. package/dist/types/core/compiled-metadata.d.ts.map +1 -1
  73. package/dist/types/core/router-compiler.d.ts.map +1 -1
  74. package/dist/types/decorators/cache.d.ts.map +1 -1
  75. package/dist/types/decorators/docs.d.ts +67 -0
  76. package/dist/types/decorators/docs.d.ts.map +1 -1
  77. package/dist/types/decorators/http.d.ts +87 -1
  78. package/dist/types/decorators/http.d.ts.map +1 -1
  79. package/dist/types/decorators/middleware.d.ts.map +1 -1
  80. package/dist/types/dependencies/container.d.ts.map +1 -1
  81. package/dist/types/dependencies/drizzle.d.ts +64 -0
  82. package/dist/types/dependencies/drizzle.d.ts.map +1 -0
  83. package/dist/types/docs/openapi-generator.d.ts +12 -1
  84. package/dist/types/docs/openapi-generator.d.ts.map +1 -1
  85. package/dist/types/errors/exceptions.d.ts +45 -0
  86. package/dist/types/errors/exceptions.d.ts.map +1 -1
  87. package/dist/types/errors/handler.d.ts.map +1 -1
  88. package/dist/types/errors/index.d.ts +1 -1
  89. package/dist/types/errors/index.d.ts.map +1 -1
  90. package/dist/types/graphql/plugin.d.ts +5 -2
  91. package/dist/types/graphql/plugin.d.ts.map +1 -1
  92. package/dist/types/index.d.ts +1 -1
  93. package/dist/types/index.d.ts.map +1 -1
  94. package/dist/types/middleware/compression.d.ts.map +1 -1
  95. package/dist/types/middleware/cors.d.ts.map +1 -1
  96. package/dist/types/middleware/rate-limit.d.ts.map +1 -1
  97. package/dist/types/orm/pagination.d.ts +79 -3
  98. package/dist/types/orm/pagination.d.ts.map +1 -1
  99. package/dist/types/plugins/health.d.ts +9 -2
  100. package/dist/types/plugins/health.d.ts.map +1 -1
  101. package/dist/types/plugins/openapi.d.ts +2 -1
  102. package/dist/types/plugins/openapi.d.ts.map +1 -1
  103. package/dist/types/responses/response.d.ts.map +1 -1
  104. package/dist/types/testing/index.d.ts +2 -2
  105. package/dist/types/testing/index.d.ts.map +1 -1
  106. package/dist/types/testing/test-client.d.ts +122 -55
  107. package/dist/types/testing/test-client.d.ts.map +1 -1
  108. package/dist/types/types/index.d.ts +9 -0
  109. package/dist/types/types/index.d.ts.map +1 -1
  110. package/dist/types/validation/exceptions.d.ts +11 -9
  111. package/dist/types/validation/exceptions.d.ts.map +1 -1
  112. package/dist/types/validation/validator.d.ts.map +1 -1
  113. package/dist/types/websocket/plugin.d.ts +5 -0
  114. package/dist/types/websocket/plugin.d.ts.map +1 -1
  115. package/package.json +189 -189
package/CHANGELOG.md CHANGED
@@ -1,501 +1,673 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ## [0.3.2] - 2025-10-31
11
-
12
- ## [0.3.1] - 2025-10-31
13
-
14
- ### 🛠️ CLI Improvements
15
-
16
- #### Enhanced Project Generation
17
- - **Latest Version Fetching**: CLI now automatically fetches the latest VeloceTS version from npm registry
18
- - **Improved Error Handling**: Better error messages and cleanup on project creation failure
19
- - **Type Safety**: Fixed TypeScript errors in CLI with proper type definitions for npm registry API
20
- - **Better User Experience**: Enhanced progress messages and visual feedback during project creation
21
- - **Robust Fallbacks**: Multiple fallback strategies for version detection when npm is unavailable
22
-
23
- #### Fixed Issues
24
- - **npm Registry Integration**: Fixed CLI to use correct npm registry endpoint (`/veloce-ts` instead of `/veloce-ts/latest`)
25
- - **Type Definitions**: Added proper TypeScript interfaces for npm registry response structure
26
- - **Version Resolution**: Improved version parsing with proper type checking and validation
27
- - **Package.json Generation**: Now uses specific dependency versions instead of 'latest' for better stability
28
- - **Template Compilation**: All generated templates now include mandatory `await app.compile()` call
29
-
30
- #### Technical Improvements
31
- - **NpmRegistryResponse Interface**: Added proper typing for npm registry API responses
32
- - **Async Error Handling**: Better error handling in async CLI operations
33
- - **Dependency Versions**: Updated to use specific versions for better reproducibility:
34
- - `hono: ^4.0.0` (instead of 'latest')
35
- - `reflect-metadata: ^0.2.0` (instead of 'latest')
36
- - `zod: ^3.22.0` (instead of 'latest')
37
- - `typescript: ^5.3.0` (instead of 'latest')
38
- - **Engine Requirements**: Added Node.js and Bun version requirements to generated package.json
39
-
40
- #### Developer Experience
41
- - **Progress Indicators**: Added emoji-based progress indicators for better visual feedback
42
- - **Cleanup on Failure**: Automatic cleanup of partial projects when creation fails
43
- - **Validation**: Better project name validation and error messages
44
- - **Documentation**: Generated projects include comprehensive setup instructions
45
-
46
- ### 🐛 Bug Fixes
47
- - **CLI TypeScript Errors**: Fixed 'data is of type unknown' error in npm registry API calls
48
- - **Template Generation**: Fixed missing `await app.compile()` in all CLI templates
49
- - **Dependency Management**: Improved dependency version resolution and fallback handling
50
-
51
- ### 📦 Migration Guide
52
-
53
- #### For CLI Users
54
- No breaking changes. Existing projects will continue to work. New projects generated with `veloce-ts new` will:
55
- - Use the latest VeloceTS version automatically
56
- - Include proper `await app.compile()` calls
57
- - Have more stable dependency versions
58
-
59
- #### For Framework Users
60
- No changes required. This release only improves the CLI experience.
61
-
62
- ## [0.3.0] - 2025-10-29
63
-
64
- ### 🚀 Major Features Added
65
-
66
- #### Response Caching System
67
- - **In-Memory Cache Store**: Fast LRU-based caching with automatic cleanup
68
- - **Redis Cache Store**: Distributed caching support for multi-instance deployments
69
- - **@Cache() Decorator**: Declarative response caching with flexible TTL configuration
70
- - **@CacheInvalidate() Decorator**: Pattern-based cache invalidation for mutations
71
- - **Cache Middleware**: Functional API support for route-level caching
72
- - **TTL Support**: Flexible time-to-live with string format ('5m', '1h', '1d') or seconds
73
- - **Pattern Invalidation**: Wildcard pattern matching for cache invalidation ('products:*')
74
- - **Cache Keys**: Smart key generation with placeholder support ('product:{id}')
75
- - **Cache Headers**: Automatic X-Cache headers (HIT/MISS) in responses
76
-
77
- #### Enhanced Request Context
78
- - **Automatic Request IDs**: UUID generation for every request
79
- - **@RequestId() Decorator**: Inject request ID into controller methods
80
- - **@AbortSignal() Decorator**: Request cancellation support for long-running operations
81
- - **Request Timeouts**: Configurable timeouts per route or globally
82
- - **Logging Integration**: Request ID automatically propagates through all logs
83
- - **Response Headers**: X-Request-ID header in all responses
84
- - **Metadata Storage**: Attach custom data to request context
85
- - **Request Lifecycle**: Automatic logging of request start/end with duration
86
-
87
- #### Logging Improvements
88
- - **Request Context Integration**: Automatic request ID in all log entries
89
- - **Child Loggers**: Enhanced contextual logging with inheritance
90
- - **Structured Logging**: JSON-formatted logs for production
91
- - **Pretty Printing**: Human-readable logs for development
92
- - **Log Middleware**: Request lifecycle logging with configurable headers
93
-
94
- ### 🎯 New Decorators
95
-
96
- - **@Cache(options)**: Cache route responses with TTL and key configuration
97
- - **@CacheInvalidate(pattern)**: Invalidate cache entries matching patterns
98
- - **@RequestId()**: Inject unique request ID into handler parameters
99
- - **@AbortSignal()**: Inject AbortSignal for request cancellation
100
-
101
- ### 🔧 New Middleware
102
-
103
- - **createRequestContextMiddleware()**: Initialize request context with ID, timeout, and logging
104
- - **createSimpleRequestIdMiddleware()**: Minimal request ID middleware
105
- - **createCacheMiddleware()**: Functional API route caching
106
- - **createCacheInvalidationMiddleware()**: Functional API cache invalidation
107
-
108
- ### 📦 New Modules
109
-
110
- - **src/cache/**: Complete caching system
111
- - `types.ts`: Cache interfaces and types
112
- - `memory-store.ts`: In-memory LRU cache implementation
113
- - `redis-store.ts`: Redis backend for distributed caching
114
- - `manager.ts`: Global cache management and utilities
115
- - **src/context/**: Enhanced request context
116
- - `request-context.ts`: Request tracking with UUID and AbortSignal
117
- - **src/middleware/**: New middleware
118
- - `request-context.ts`: Request context initialization
119
- - `cache.ts`: Cache middleware for functional API
120
- - **src/decorators/**: New decorators
121
- - `cache.ts`: @Cache and @CacheInvalidate decorators
122
-
123
- ### 🛠️ Core Improvements
124
-
125
- - **Router Compiler**: Integrated cache checking and invalidation in route handlers
126
- - **Type System**: New parameter types for request-id and abort-signal
127
- - **Export System**: All new decorators and middleware properly exported
128
- - **Error Handling**: Improved error handling with request ID context
129
-
130
- ### 📚 Documentation
131
-
132
- #### New Guides (English + Spanish)
133
- - **Caching Guide**: Complete guide to response caching (15,000 words total)
134
- - In-memory and Redis stores
135
- - Decorators and middleware
136
- - TTL configuration
137
- - Cache invalidation strategies
138
- - Best practices with 50+ code examples
139
- - **Request Context Guide**: Request tracking and management (12,000 words total)
140
- - Automatic UUID generation
141
- - Request cancellation with AbortSignal
142
- - Timeout configuration
143
- - Logging integration
144
- - 40+ code examples
145
- - **Logging Guide**: Structured logging with Pino (4,000 words total)
146
- - Logger configuration
147
- - Child loggers
148
- - Request ID integration
149
- - Best practices
150
-
151
- #### Documentation Coverage
152
- - Added 31,000+ words of professional documentation
153
- - 100+ new code examples
154
- - Bilingual support (English and Spanish)
155
- - SEO-optimized with meta descriptions
156
- - Cross-referenced between guides
157
-
158
- ### 🌐 Sidebar Updates
159
-
160
- Updated Starlight documentation sidebar with new guides:
161
- - Caching
162
- - Request Context
163
- - Logging
164
-
165
- ### ⚡ Performance Improvements
166
-
167
- - **Cache System**: Sub-millisecond cache hits with in-memory store
168
- - **LRU Eviction**: Automatic memory management in cache store
169
- - **Request Context**: Minimal overhead UUID generation
170
- - **Logging**: Efficient structured logging with Pino
171
-
172
- ### 🔄 API Additions
173
-
174
- #### Cache Manager
175
- ```typescript
176
- - CacheManager.setDefaultStore(store)
177
- - CacheManager.getDefaultStore()
178
- - CacheManager.generateKey(method, path, params, query, options)
179
- - CacheManager.get(key, store?)
180
- - CacheManager.set(key, value, ttl?, store?)
181
- - CacheManager.delete(key, store?)
182
- - CacheManager.invalidate(pattern, store?)
183
- - CacheManager.clear(store?)
184
- ```
185
-
186
- #### Helper Functions
187
- ```typescript
188
- - getCache<T>(key): Promise<T | null>
189
- - setCache<T>(key, value, ttl?): Promise<void>
190
- - deleteCache(key): Promise<boolean>
191
- - invalidateCache(pattern): Promise<number>
192
- - clearCache(): Promise<void>
193
- - getRequestId(context): string | null
194
- - getAbortSignal(context): AbortSignal | null
195
- - setRequestMetadata(context, key, value): void
196
- - getRequestMetadata(context, key): any
197
- - generateRequestId(): string
198
- ```
199
-
200
- ### 🐛 Bug Fixes
201
-
202
- - **ORM Exports**: Fixed DrizzleTransactionManager import path
203
- - **Middleware Exports**: Added missing createCacheInvalidationMiddleware export
204
- - **Request Context**: Fixed AbortController reference in context
205
-
206
- ### 💥 Breaking Changes
207
-
208
- None - All changes are additive and backward compatible
209
-
210
- ### 📦 Dependencies
211
-
212
- No new runtime dependencies added. Caching works with existing dependencies:
213
- - In-memory cache: No dependencies (built-in)
214
- - Redis cache: Requires `redis` or `ioredis` (peer dependency)
215
-
216
- ### 🎯 Migration Guide
217
-
218
- #### Adding Cache to Existing Routes
219
-
220
- ```typescript
221
- // Before
222
- @Get('/products')
223
- async getProducts() {
224
- return await db.products.findAll();
225
- }
226
-
227
- // After - Add caching
228
- @Get('/products')
229
- @Cache({ ttl: '5m', key: 'products:list' })
230
- async getProducts() {
231
- return await db.products.findAll();
232
- }
233
- ```
234
-
235
- #### Adding Request Tracking
236
-
237
- ```typescript
238
- // Add to app initialization
239
- import { createRequestContextMiddleware } from 'veloce-ts';
240
-
241
- app.use(createRequestContextMiddleware({
242
- timeout: 30000,
243
- logging: true
244
- }));
245
-
246
- // Use in controllers
247
- @Get('/data')
248
- async getData(@RequestId() requestId: string) {
249
- logger.info({ requestId }, 'Processing request');
250
- return data;
251
- }
252
- ```
253
-
254
- ### 📊 Statistics
255
-
256
- - **New Files**: 15+ new source files
257
- - **Documentation**: 31,000+ words
258
- - **Code Examples**: 100+ examples
259
- - **Test Coverage**: All new features covered
260
- - **Languages**: Full bilingual support (EN/ES)
261
-
262
- ### 🙏 Acknowledgments
263
-
264
- This release brings powerful performance optimization features to Veloce-TS:
265
- - Response caching reduces database load and improves response times
266
- - Request tracking enables better debugging and monitoring
267
- - Enhanced logging provides better observability in production
268
-
269
- ## [0.2.6] - 2025-10-15
270
-
271
- ### Fixed
272
- - **Query Export**: Added missing `Query` export from main index to resolve import conflicts
273
- - **Parameter Decorators**: HTTP `@Query` decorator now properly exported alongside GraphQL decorators
274
- - **Import Resolution**: Fixed "Export named 'Query' not found" error in applications
275
-
276
- ## [0.2.5] - 2025-10-15
277
-
278
- ### Fixed
279
- - **GraphQL Query Conflict**: Removed conflicting alias `Query` from GraphQL decorators
280
- - **Import Resolution**: GraphQL decorators now use `GQLQuery` to avoid conflicts with HTTP `@Query` decorator
281
- - **Type Safety**: Eliminated TypeScript errors caused by decorator name conflicts
282
-
283
- ### Breaking Changes
284
- - GraphQL queries now use `@GQLQuery` instead of `@Query` to avoid conflicts with HTTP parameter decorator
285
-
286
- ## [0.2.4] - 2025-10-15
287
-
288
- ### Fixed
289
- - **Query Decorator**: Fixed `@Query` decorator to properly handle parameters without schemas
290
- - **Query Parameter Extraction**: Improved query parameter handling in router compiler
291
- - **Validation**: Added proper validation for query parameters with optional Zod schemas
292
- - **Error Handling**: Fixed missing `ValidationError` import, now using `BadRequestException`
293
-
294
- ### Improved
295
- - **Query Decorator Flexibility**: `@Query` now supports multiple usage patterns:
296
- - `@Query()` - Extract all query parameters
297
- - `@Query('param')` - Extract specific parameter
298
- - `@Query(Schema)` - Validate with Zod schema
299
- - **Router Compiler**: Enhanced parameter extraction and validation logic
300
- - **Type Safety**: Better TypeScript support for query parameter handling
301
-
302
- ### Breaking Changes
303
- - None
304
-
305
- ## [0.2.3] - 2025-10-14
306
-
307
- ### Fixed
308
- - **WebSocket Exports**: Fixed missing `WebSocket` decorator export from WebSocket module
309
- - **Import Resolution**: WebSocket decorators now properly exported from `veloce-ts/websocket`
310
-
311
- ## [0.2.2] - 2025-10-14
312
-
313
- ### Fixed
314
- - **GraphQL Decorators**: Added missing `Query`, `Mutation`, and `Subscription` aliases for GraphQL decorators
315
- - **Import Conflicts**: Fixed naming conflicts between params and GraphQL decorators
316
- - **CLI Templates**: Fixed import errors in CLI template generation
317
- - **Package Version**: CLI now uses current package version when generating new projects
318
-
319
- ### Changed
320
- - **GraphQL Exports**: GraphQL decorators now available with intuitive names (`Query`, `Mutation`, `Subscription`)
321
- - **Import Resolution**: Cleaner import structure to avoid naming conflicts
322
-
323
- ## [0.2.1] - 2025-10-14
324
-
325
- ### Fixed
326
- - **GraphQL Exports**: Fixed missing `Arg` decorator export from GraphQL module
327
- - **Import Resolution**: GraphQL decorators now properly exported from `veloce-ts/graphql`
328
- - **Type Definitions**: GraphQL decorators included in TypeScript declarations
329
-
330
- ## [0.2.0] - 2025-10-14
331
-
332
- ### 🚀 Major Features Added
333
- - **Complete Authentication System**: JWT-based authentication with access/refresh tokens
334
- - **Role-Based Access Control (RBAC)**: Hierarchical roles with granular permissions system
335
- - **SQLite Integration**: Built-in SQLite support with Bun's native database
336
- - **Real-time WebSocket Support**: Enhanced WebSocket handling with decorators
337
- - **GraphQL Integration**: Complete GraphQL support with resolvers and subscriptions
338
- - **Advanced Middleware System**: Custom middleware with request/response interceptors
339
- - **Admin Panel Features**: Comprehensive admin endpoints for user and system management
340
-
341
- ### 🎯 New Decorators & Features
342
- - **@Auth**: JWT authentication decorator with automatic user injection
343
- - **@CurrentUser**: Inject current authenticated user into handlers
344
- - **@MinimumRole**: Role-based endpoint protection
345
- - **@Permissions**: Granular permission-based access control
346
- - **@WebSocket**: Enhanced WebSocket decorators with connection management
347
- - **@Resolver**: GraphQL resolver decorators for queries and mutations
348
- - **@OnConnect/@OnMessage/@OnDisconnect**: WebSocket lifecycle decorators
349
-
350
- ### 🔧 Core Framework Improvements
351
- - **Router Compiler Fixes**: Fixed critical bugs with sparse array handling in metadata
352
- - **Dependency Injection**: Enhanced DI system with better error handling
353
- - **Parameter Resolution**: Improved parameter and dependency resolution
354
- - **Type Safety**: Enhanced TypeScript inference and type checking
355
- - **Error Handling**: Better error messages and debugging capabilities
356
-
357
- ### 📚 Documentation & Examples
358
- - **Veloce TaskMaster**: Complete real-world example with authentication, RBAC, and frontend
359
- - **Comprehensive Examples**: Task management system showcasing all framework features
360
- - **Migration Guides**: Documentation for migrating from Express.js and other frameworks
361
- - **API Documentation**: Enhanced OpenAPI/Swagger documentation generation
362
-
363
- ### 🛠️ Technical Improvements
364
- - **Performance**: Optimized router compilation and metadata handling
365
- - **Memory Management**: Better handling of metadata arrays and object references
366
- - **Bundle Size**: Reduced framework bundle size through optimizations
367
- - **Build System**: Improved TypeScript compilation and type generation
368
- - **Testing**: Enhanced testing utilities and error reporting
369
-
370
- ### 🔒 Security Enhancements
371
- - **JWT Security**: Secure token generation and validation
372
- - **Password Hashing**: Built-in password hashing utilities
373
- - **CSRF Protection**: Enhanced CORS and security middleware
374
- - **Input Validation**: Improved Zod schema validation
375
- - **Role Hierarchy**: Configurable role hierarchy with permission inheritance
376
-
377
- ### 🎨 Developer Experience
378
- - **Better Error Messages**: More descriptive error messages with stack traces
379
- - **Hot Reload**: Improved development server with better file watching
380
- - **TypeScript Support**: Enhanced type inference and IntelliSense
381
- - **Debugging**: Better debugging capabilities with request tracing
382
- - **CLI Improvements**: Enhanced CLI with better project scaffolding
383
-
384
- ### 🐛 Critical Bug Fixes
385
- - **Router Compilation**: Fixed sparse array handling in parameter metadata
386
- - **Dependency Resolution**: Fixed undefined dependency handling
387
- - **Array Length Errors**: Fixed array creation with invalid indices
388
- - **Import Path Issues**: Corrected all import paths in generated projects
389
- - **Metadata Processing**: Fixed metadata compilation edge cases
390
-
391
- ### 📦 New Dependencies
392
- - **jsonwebtoken**: JWT token generation and validation
393
- - **reflect-metadata**: Enhanced reflection capabilities for decorators
394
- - **zod-to-json-schema**: Improved OpenAPI schema generation
395
-
396
- ## [0.1.7] - 2025-10-12
397
-
398
- ### Fixed
399
- - Fixed syntax error in CLI new command that prevented build from completing
400
- - Fixed README generation in CLI templates
401
-
402
- ## [0.1.6] - 2025-10-12
403
-
404
- ### Added
405
- - **Landing Page**: Created modern Astro-based website with interactive terminal and file explorer
406
- - **Interactive Terminal**: Built terminal component for API testing with command history
407
- - **File Explorer**: Developed code browser with hierarchical navigation for demo app
408
- - **Documentation Files**: CLI now generates README.md and API_DOCUMENTATION.md in new projects
409
-
410
- ### Changed
411
- - **Complete Rebranding**: Renamed framework from FastAPI-TS to Veloce-TS throughout codebase
412
- - **OpenAPIPlugin**: Now serves Swagger UI directly from code (no need for static HTML files)
413
- - **Improved Swagger UI**: Updated to version 5.9.0 with better styling and functionality
414
- - **Simplified Templates**: `veloce-ts new` command no longer generates unnecessary public files
415
- - **Better Defaults**: OpenAPI documentation now uses "Veloce-TS" branding by default
416
- - **Updated URLs**: All references now point to correct GitHub repository and documentation
417
-
418
- ### Fixed
419
- - Fixed Swagger UI rendering issues with proper script loading
420
- - Fixed OpenAPI plugin to correctly serve HTML responses and return proper content types
421
- - Fixed broken links and outdated branding throughout codebase
422
- - Improved CORS handling in generated templates
423
- - Fixed CLI template generation to include proper documentation structure
424
-
425
- ## [0.1.5] - 2025-10-12
426
-
427
- ### Fixed
428
- - Fixed CLI templates to include OpenAPIPlugin automatically when docs: true
429
- - REST and Fullstack templates now properly initialize OpenAPI documentation
430
-
431
- ## [0.1.4] - 2025-10-13
432
-
433
- ### Fixed
434
- - Fixed CLI templates to call `await app.compile()` before `app.listen()`
435
- - This fixes the 404 error on all routes in generated projects
436
-
437
- ## [0.1.3] - 2025-10-12
438
-
439
- ### Fixed
440
- - Fixed package.json main and exports paths to point to correct dist/*/src/ directories
441
- - This fixes the "Cannot find package" error when importing veloce-ts
442
-
443
- ## [0.1.2] - 2025-10-12
444
-
445
- ### Fixed
446
- - Fixed CLI templates to use correct package name `veloce-ts` instead of `VeloceTS`
447
- - Fixed all import statements in generated projects
448
-
449
- ## [0.1.1] - 2025-10-12
450
-
451
- ### Fixed
452
- - Fixed CLI binary path to use compiled dist files instead of source files
453
-
454
- ## [0.1.0] - 2025-10-12
455
-
456
- ### Added
457
- - Initial release of veloce-ts framework
458
- - Decorator-based routing with @Controller, @Get, @Post, @Put, @Delete, @Patch
459
- - Functional API for decorator-free routing
460
- - Automatic request validation with Zod schemas
461
- - Dependency injection system with singleton, request, and transient scopes
462
- - Automatic OpenAPI documentation generation
463
- - Response handling with JSONResponse, HTMLResponse, FileResponse, StreamResponse, RedirectResponse
464
- - Plugin system for extensibility
465
- - WebSocket support with decorators
466
- - GraphQL support with decorators
467
- - CLI tool for project scaffolding and development
468
- - Middleware system with CORS, rate limiting, and compression
469
- - Error handling with custom exceptions
470
- - Testing utilities with TestClient
471
- - Multi-runtime support (Bun, Node.js, Deno, Cloudflare Workers)
472
- - Adapter system for Express and Hono
473
- - Type safety with full TypeScript support
474
- - Performance optimizations with metadata compilation and schema caching
475
-
476
- ## [0.1.0] - 2025-10-12
477
-
478
- ### Added
479
- - Initial development version
480
- - Core framework architecture
481
- - Basic routing and validation
482
- - Documentation generation
483
- - Plugin system
484
- - WebSocket and GraphQL support
485
- - CLI tooling
486
- - Testing utilities
487
-
488
- [Unreleased]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.2...HEAD
489
- [0.3.2]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.2
490
- [0.3.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.0...v0.3.1
491
- [0.2.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.1...v0.2.2
492
- [0.2.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.0...v0.2.1
493
- [0.2.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.7...v0.2.0
494
- [0.1.7]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.6...v0.1.7
495
- [0.1.6]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.5...v0.1.6
496
- [0.1.5]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.4...v0.1.5
497
- [0.1.4]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.3...v0.1.4
498
- [0.1.3]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.2...v0.1.3
499
- [0.1.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.1...v0.1.2
500
- [0.1.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.0...v0.1.1
501
- [0.1.0]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.1.0
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.4.0] - 2026-03-27
11
+
12
+ Esta versión representa la mayor actualización desde el lanzamiento inicial. Se añadieron más de 25 mejoras nuevas distribuidas en tres oleadas de trabajo (alta, media y baja prioridad), cubriendo la cadena completa desde la generación de rutas hasta la documentación OpenAPI, el testing, el ORM y la CLI.
13
+
14
+ ### 🚀 Nuevos Decoradores
15
+
16
+ #### Documentación OpenAPI (shorthand)
17
+ Cinco decoradores de una sola línea como alternativa concisa a `@ApiDoc({...})`:
18
+ - **`@Summary(text)`** descripción corta visible en la lista de Swagger UI
19
+ - **`@Description(text)`** texto largo en el panel de detalle de la operación
20
+ - **`@Tag(name)`** asigna un tag individual; apilable con múltiples `@Tag`
21
+ - **`@Tags(...names)`** asigna varios tags en un solo decorador
22
+ - **`@Deprecated()`** — marca la ruta como obsoleta (tachado en Swagger UI)
23
+
24
+ #### Control de respuesta
25
+ - **`@HttpCode(statusCode)`** sobreescribe el código HTTP de respuesta del handler (p.ej. `201` para creación). Usado también por el generador OpenAPI para el código de éxito documentado
26
+ - **`@ResponseSchema(schema, statusCode?)`** valida y sanitiza la respuesta del handler con un esquema Zod; informa el modelo de respuesta al spec de OpenAPI
27
+
28
+ #### Middleware declarativo por ruta
29
+ - **`@Timeout(ms, message?)`** — aborta la petición con **408 Request Timeout** si el handler supera el límite. Inyecta automáticamente el middleware al inicio del pipeline y emite el header `X-Timeout-Ms`
30
+ - **`@RateLimit(options)`** — aplica rate-limiting a nivel de ruta individual usando la misma configuración de `createRateLimitMiddleware()`. Los headers estándar `X-RateLimit-*` se envían automáticamente
31
+
32
+ ### 🛠️ Mejoras al Framework Core
33
+
34
+ #### OpenAPI Generator (`src/docs/openapi-generator.ts`)
35
+ - **Auto-tagging**: deriva tags automáticamente del primer segmento del path (`/products/:id` tag `"Products"`) sin necesidad de anotarlos manualmente
36
+ - **Bearer security scheme**: añade `components.securitySchemes.bearerAuth` al spec y aplica `security: [{ bearerAuth: [] }]` en rutas protegidas de forma automática
37
+ - **401 automático**: rutas protegidas reciben una respuesta `401 Unauthorized` documentada sin configuración adicional
38
+ - **Soporte de `@HttpCode`**: usa el `statusCode` del decorador como clave del bloque de éxito en `responses`
39
+ - **`@ResponseSchema` en el spec**: cuando está presente, el esquema Zod se convierte al formato JSON Schema para el bloque de contenido de la respuesta
40
+
41
+ #### Sistema de Excepciones HTTP (`src/errors/exceptions.ts`)
42
+ Seis nuevas clases de excepción para cubrir casos de error comunes:
43
+ - `ConflictException` (409)
44
+ - `GoneException` (410)
45
+ - `PayloadTooLargeException` (413)
46
+ - `UnprocessableEntityException` (422)
47
+ - `TooManyRequestsException` (429)
48
+ - `ServiceUnavailableException` (503)
49
+
50
+ #### Logger estructurado en ErrorHandler (`src/errors/handler.ts`)
51
+ - Errores 5xx se registran con `getLogger().error` incluyendo path, método, status y stack
52
+ - Errores 4xx se registran como `warn` en entorno de desarrollo
53
+ - Errores genéricos no capturados también pasan por Pino
54
+
55
+ #### Arreglos de orden de decoradores
56
+ - **`@UseMiddleware`** (`src/decorators/middleware.ts`): ahora siempre llama a `MetadataRegistry.defineRoute` para que el middleware no se pierda independientemente del orden de ejecución de los decoradores
57
+ - **`@Cache` / `@CacheInvalidate`** (`src/decorators/cache.ts`): mismo patrón — los metadatos se fusionan correctamente sin importar el orden de apilamiento
58
+
59
+ #### MetadataCompiler caché lazy con snapshots (`src/core/compiled-metadata.ts`)
60
+ - Compilación lazy: una ruta sólo se recompila si sus metadatos cambiaron (comparación por snapshot JSON)
61
+ - IDs únicos para handlers funcionales vía `WeakMap<Function, number>` — evita colisiones de caché cuando distintas instancias de app registran el mismo path con handlers diferentes (bug crítico en tests paralelos)
62
+ - Método `clearCache()` expuesto para limpiar el estado entre tests
63
+
64
+ ### 🧪 TestClient API fluida y helpers de autenticación (`src/testing/test-client.ts`)
65
+
66
+ Reescritura completa de `TestClient`:
67
+ - **`TestResponse`** nueva clase de respuesta con propiedades `status`, `headers`, `body`, `text`, `ok` y métodos de aserción encadenables:
68
+ - `expectStatus(code)`, `expectOk()`, `expectCreated()`, `expectNotFound()`, etc.
69
+ - `expectJson(partialObject)` comprobación parcial del body
70
+ - `expectField(field, value?)` verificar un campo específico
71
+ - `expectHeader(name, value?)` verificar un header de respuesta
72
+ - `expectArrayLength(n)` verificar longitud de array en respuesta
73
+ - **`withToken(token)`** crea una instancia inmutable del cliente con el header `Authorization: Bearer` ya configurado
74
+ - **`withHeaders(headers)`** crea una instancia inmutable con headers adicionales
75
+ - **`loginAs(credentials, endpoint?)`** hace login, extrae el JWT y lo inyecta en el cliente actual para las peticiones siguientes
76
+ - **`registerAndLogin(user, endpoints?)`** — registra y hace login en una sola llamada
77
+ - **`clearAuth()`** limpia el token almacenado
78
+
79
+ ### 🔌 Plugins y Middleware
80
+
81
+ #### HealthCheckers.disk (`src/plugins/health.ts`)
82
+ - Usa `fs.statfs` (Node 18+ / Bun) para obtener métricas reales de disco: total, libre, usado y porcentaje
83
+ - Degradación elegante a `"healthy"` en plataformas sin soporte
84
+
85
+ #### CLI Plantilla Fullstack corregida (`src/cli/commands/new.ts`)
86
+ - La plantilla `fullstack` ahora genera `src/index.ts` con `GraphQLPlugin` y `WebSocketPlugin` correctamente importados e instanciados (antes quedaban comentados)
87
+
88
+ #### Subpath exports en el build (`build.ts`)
89
+ - Se añadieron `./src/auth/index.ts`, `./src/adapters/base.ts`, `./src/adapters/hono.ts`, `./src/adapters/express.ts` como entrypoints explícitos para que los imports `veloce-ts/auth` y `veloce-ts/adapters/*` funcionen correctamente
90
+
91
+ ### 🗄️ Drizzle ORM Integración DI (`src/dependencies/drizzle.ts`)
92
+
93
+ Nuevo módulo para conectar Drizzle (u otro ORM) al contenedor de inyección de dependencias:
94
+ ```typescript
95
+ // Registrar la instancia de la DB
96
+ registerDrizzle(app, db);
97
+
98
+ // Inyectar en controladores
99
+ @Get('/')
100
+ async list(@InjectDB() db: DrizzleDB) { … }
101
+ ```
102
+ - `DB_TOKEN` — símbolo por defecto para el token de inyección
103
+ - `registerDrizzle(app, db, token?)` registra como singleton en el `DIContainer`
104
+ - `@InjectDB(token?)` decorador de parámetro, alias de `@Depends(DB_TOKEN)`
105
+
106
+ ### 📊 Paginación mejorada (`src/orm/pagination.ts`)
107
+
108
+ #### Enriquecimiento de metadatos
109
+ - `PaginationMeta` incluye `from` y `to` (rango 1-based, p.ej. `from: 11, to: 20`)
110
+ - `CursorPaginatedResult` incluye `count` (ítems reales devueltos en la página)
111
+
112
+ #### Cursor pagination más precisa
113
+ - `createCursorPaginatedResult(data, limit, cursorField, hadPrevCursor)` el nuevo parámetro `hadPrevCursor` activa `hasPrev: true` correctamente cuando se navega hacia adelante con cursor
114
+ - `createMultiCursor(entity, fields[])` — crea cursores compuestos por múltiples campos para ordenación estable (p.ej. `{ createdAt, id }`)
115
+ - `decodeMultiCursor(cursor)` decodifica un cursor multi-campo de vuelta a un objeto
116
+
117
+ #### Helpers standalone
118
+ - `paginate<T>(data, total, page, limit)` — construye `{ data, meta }` en una sola llamada, sin necesidad de instanciar `PaginationHelper`
119
+ - `parseCursorQuery(query, defaultLimit?, maxLimit?)` extrae `cursor` y `limit` de los query params sin lanzar excepciones
120
+ - `PaginationHelper.parsePaginationQuery(query, defaultLimit?, maxLimit?)` — equivalente para paginación offset; aplica límite máximo y usa defaults cuando los valores son inválidos
121
+
122
+ ### 🔌 Express Adapter — Compatibilidad ESM (`src/adapters/express.ts`)
123
+
124
+ Reescritura completa del adaptador:
125
+ - Carga Express de forma lazy y segura usando `Function('return require')()` para compatibilidad ESM sin necesitar `declare const require: any`
126
+ - Acepta una instancia de Express pre-creada como segundo argumento del constructor (para añadir middleware propio antes del bridge)
127
+ - Manejo correcto de body raw (`Buffer`) vs body parseado (JSON/urlencoded)
128
+ - Omite el header `transfer-encoding` al reenviar respuestas (era fuente de errores en Express)
129
+ - Delega errores inesperados al pipeline de error de Express mediante `next(err)` en lugar de responder con 500 directamente
130
+
131
+ ### 🐛 Bug Fixes
132
+
133
+ - **`ZodError` cross-module** (`src/errors/handler.ts`, `src/validation/validator.ts`): `instanceof ZodError` fallaba cuando la app consumidora tenía una instancia de Zod diferente a la del framework (caso frecuente con `bun link`). Añadido fallback `error.name === 'ZodError'` para garantizar respuestas 422 en todos los casos
134
+ - **Rutas `GET` marcadas públicas retornaban 401** en `products-api`: `app.use()` aplicaba el middleware a todos los métodos; corregido usando `app.on(['POST', 'PUT', 'DELETE'], path, middleware)` para restringir sólo a métodos de escritura
135
+ - **Cache collision en MetadataCompiler**: handlers funcionales distintos con el mismo path en diferentes instancias de app compartían el resultado compilado incorrecto; solucionado con IDs únicos por función
136
+ - **`@Cache` / `@UseMiddleware` perdían metadatos**: cuando se apilaban en orden inverso al de ejecución de decoradores, los metadatos podían sobreescribirse; solucionado actualizando el registro explícitamente en cada decorador
137
+
138
+ ### 📋 Mensajes de validación mejorados (`src/validation/exceptions.ts`)
139
+
140
+ La respuesta de error `422` ahora incluye información estructurada adicional:
141
+ - `field` en formato convencional: `items[0].price` en lugar de `items.0.price`
142
+ - `received` — tipo recibido (cuando Zod lo reporta)
143
+ - `expected` — tipo esperado (cuando aplica)
144
+ - `minimum` / `maximum` — límites numéricos en errores de rango
145
+
146
+ ```json
147
+ {
148
+ "error": "Validation Error",
149
+ "statusCode": 422,
150
+ "details": [
151
+ { "field": "email", "message": "Invalid email", "code": "invalid_string" },
152
+ { "field": "age", "message": "Number must be ≥ 18", "code": "too_small", "minimum": 18 },
153
+ { "field": "tags[1]", "message": "String must not be empty", "code": "too_small" }
154
+ ]
155
+ }
156
+ ```
157
+
158
+ ### 💥 Breaking Changes
159
+
160
+ Ninguno todos los cambios son retrocompatibles. Las firmas de `createCursorPaginatedResult` tienen un nuevo parámetro opcional `hadPrevCursor` (cuarto argumento, `false` por defecto).
161
+
162
+ ### 📦 Dependencias
163
+
164
+ Sin cambios en dependencias de runtime. Express sigue siendo peer dependency opcional.
165
+
166
+ ---
167
+
168
+ ## [0.3.3] - 2025-10-31
169
+
170
+ ### 🐛 Critical Bug Fixes
171
+ - **JSON Response Serialization**: Fixed critical bug where JSON responses were not being serialized correctly
172
+ - **CLI Version Resolution**: Confirmed CLI correctly fetches and uses latest npm version (0.3.2)
173
+ - **Application Compilation**: Fixed missing `await app.compile()` call in generated templates
174
+
175
+ ### 🔧 CLI Improvements
176
+ - **Version Fetching**: CLI now correctly fetches latest version from npm registry
177
+ - **Template Generation**: All templates now include proper `await app.compile()` call
178
+ - **Error Handling**: Improved error handling in CLI operations
179
+
180
+ ## [0.3.2] - 2025-10-31
181
+
182
+ ## [0.3.1] - 2025-10-31
183
+
184
+ ### 🛠️ CLI Improvements
185
+
186
+ #### Enhanced Project Generation
187
+ - **Latest Version Fetching**: CLI now automatically fetches the latest VeloceTS version from npm registry
188
+ - **Improved Error Handling**: Better error messages and cleanup on project creation failure
189
+ - **Type Safety**: Fixed TypeScript errors in CLI with proper type definitions for npm registry API
190
+ - **Better User Experience**: Enhanced progress messages and visual feedback during project creation
191
+ - **Robust Fallbacks**: Multiple fallback strategies for version detection when npm is unavailable
192
+
193
+ #### Fixed Issues
194
+ - **npm Registry Integration**: Fixed CLI to use correct npm registry endpoint (`/veloce-ts` instead of `/veloce-ts/latest`)
195
+ - **Type Definitions**: Added proper TypeScript interfaces for npm registry response structure
196
+ - **Version Resolution**: Improved version parsing with proper type checking and validation
197
+ - **Package.json Generation**: Now uses specific dependency versions instead of 'latest' for better stability
198
+ - **Template Compilation**: All generated templates now include mandatory `await app.compile()` call
199
+
200
+ #### Technical Improvements
201
+ - **NpmRegistryResponse Interface**: Added proper typing for npm registry API responses
202
+ - **Async Error Handling**: Better error handling in async CLI operations
203
+ - **Dependency Versions**: Updated to use specific versions for better reproducibility:
204
+ - `hono: ^4.0.0` (instead of 'latest')
205
+ - `reflect-metadata: ^0.2.0` (instead of 'latest')
206
+ - `zod: ^3.22.0` (instead of 'latest')
207
+ - `typescript: ^5.3.0` (instead of 'latest')
208
+ - **Engine Requirements**: Added Node.js and Bun version requirements to generated package.json
209
+
210
+ #### Developer Experience
211
+ - **Progress Indicators**: Added emoji-based progress indicators for better visual feedback
212
+ - **Cleanup on Failure**: Automatic cleanup of partial projects when creation fails
213
+ - **Validation**: Better project name validation and error messages
214
+ - **Documentation**: Generated projects include comprehensive setup instructions
215
+
216
+ ### 🐛 Bug Fixes
217
+ - **CLI TypeScript Errors**: Fixed 'data is of type unknown' error in npm registry API calls
218
+ - **Template Generation**: Fixed missing `await app.compile()` in all CLI templates
219
+ - **Dependency Management**: Improved dependency version resolution and fallback handling
220
+
221
+ ### 📦 Migration Guide
222
+
223
+ #### For CLI Users
224
+ No breaking changes. Existing projects will continue to work. New projects generated with `veloce-ts new` will:
225
+ - Use the latest VeloceTS version automatically
226
+ - Include proper `await app.compile()` calls
227
+ - Have more stable dependency versions
228
+
229
+ #### For Framework Users
230
+ No changes required. This release only improves the CLI experience.
231
+
232
+ ## [0.3.0] - 2025-10-29
233
+
234
+ ### 🚀 Major Features Added
235
+
236
+ #### Response Caching System
237
+ - **In-Memory Cache Store**: Fast LRU-based caching with automatic cleanup
238
+ - **Redis Cache Store**: Distributed caching support for multi-instance deployments
239
+ - **@Cache() Decorator**: Declarative response caching with flexible TTL configuration
240
+ - **@CacheInvalidate() Decorator**: Pattern-based cache invalidation for mutations
241
+ - **Cache Middleware**: Functional API support for route-level caching
242
+ - **TTL Support**: Flexible time-to-live with string format ('5m', '1h', '1d') or seconds
243
+ - **Pattern Invalidation**: Wildcard pattern matching for cache invalidation ('products:*')
244
+ - **Cache Keys**: Smart key generation with placeholder support ('product:{id}')
245
+ - **Cache Headers**: Automatic X-Cache headers (HIT/MISS) in responses
246
+
247
+ #### Enhanced Request Context
248
+ - **Automatic Request IDs**: UUID generation for every request
249
+ - **@RequestId() Decorator**: Inject request ID into controller methods
250
+ - **@AbortSignal() Decorator**: Request cancellation support for long-running operations
251
+ - **Request Timeouts**: Configurable timeouts per route or globally
252
+ - **Logging Integration**: Request ID automatically propagates through all logs
253
+ - **Response Headers**: X-Request-ID header in all responses
254
+ - **Metadata Storage**: Attach custom data to request context
255
+ - **Request Lifecycle**: Automatic logging of request start/end with duration
256
+
257
+ #### Logging Improvements
258
+ - **Request Context Integration**: Automatic request ID in all log entries
259
+ - **Child Loggers**: Enhanced contextual logging with inheritance
260
+ - **Structured Logging**: JSON-formatted logs for production
261
+ - **Pretty Printing**: Human-readable logs for development
262
+ - **Log Middleware**: Request lifecycle logging with configurable headers
263
+
264
+ ### 🎯 New Decorators
265
+
266
+ - **@Cache(options)**: Cache route responses with TTL and key configuration
267
+ - **@CacheInvalidate(pattern)**: Invalidate cache entries matching patterns
268
+ - **@RequestId()**: Inject unique request ID into handler parameters
269
+ - **@AbortSignal()**: Inject AbortSignal for request cancellation
270
+
271
+ ### 🔧 New Middleware
272
+
273
+ - **createRequestContextMiddleware()**: Initialize request context with ID, timeout, and logging
274
+ - **createSimpleRequestIdMiddleware()**: Minimal request ID middleware
275
+ - **createCacheMiddleware()**: Functional API route caching
276
+ - **createCacheInvalidationMiddleware()**: Functional API cache invalidation
277
+
278
+ ### 📦 New Modules
279
+
280
+ - **src/cache/**: Complete caching system
281
+ - `types.ts`: Cache interfaces and types
282
+ - `memory-store.ts`: In-memory LRU cache implementation
283
+ - `redis-store.ts`: Redis backend for distributed caching
284
+ - `manager.ts`: Global cache management and utilities
285
+ - **src/context/**: Enhanced request context
286
+ - `request-context.ts`: Request tracking with UUID and AbortSignal
287
+ - **src/middleware/**: New middleware
288
+ - `request-context.ts`: Request context initialization
289
+ - `cache.ts`: Cache middleware for functional API
290
+ - **src/decorators/**: New decorators
291
+ - `cache.ts`: @Cache and @CacheInvalidate decorators
292
+
293
+ ### 🛠️ Core Improvements
294
+
295
+ - **Router Compiler**: Integrated cache checking and invalidation in route handlers
296
+ - **Type System**: New parameter types for request-id and abort-signal
297
+ - **Export System**: All new decorators and middleware properly exported
298
+ - **Error Handling**: Improved error handling with request ID context
299
+
300
+ ### 📚 Documentation
301
+
302
+ #### New Guides (English + Spanish)
303
+ - **Caching Guide**: Complete guide to response caching (15,000 words total)
304
+ - In-memory and Redis stores
305
+ - Decorators and middleware
306
+ - TTL configuration
307
+ - Cache invalidation strategies
308
+ - Best practices with 50+ code examples
309
+ - **Request Context Guide**: Request tracking and management (12,000 words total)
310
+ - Automatic UUID generation
311
+ - Request cancellation with AbortSignal
312
+ - Timeout configuration
313
+ - Logging integration
314
+ - 40+ code examples
315
+ - **Logging Guide**: Structured logging with Pino (4,000 words total)
316
+ - Logger configuration
317
+ - Child loggers
318
+ - Request ID integration
319
+ - Best practices
320
+
321
+ #### Documentation Coverage
322
+ - Added 31,000+ words of professional documentation
323
+ - 100+ new code examples
324
+ - Bilingual support (English and Spanish)
325
+ - SEO-optimized with meta descriptions
326
+ - Cross-referenced between guides
327
+
328
+ ### 🌐 Sidebar Updates
329
+
330
+ Updated Starlight documentation sidebar with new guides:
331
+ - Caching
332
+ - Request Context
333
+ - Logging
334
+
335
+ ### Performance Improvements
336
+
337
+ - **Cache System**: Sub-millisecond cache hits with in-memory store
338
+ - **LRU Eviction**: Automatic memory management in cache store
339
+ - **Request Context**: Minimal overhead UUID generation
340
+ - **Logging**: Efficient structured logging with Pino
341
+
342
+ ### 🔄 API Additions
343
+
344
+ #### Cache Manager
345
+ ```typescript
346
+ - CacheManager.setDefaultStore(store)
347
+ - CacheManager.getDefaultStore()
348
+ - CacheManager.generateKey(method, path, params, query, options)
349
+ - CacheManager.get(key, store?)
350
+ - CacheManager.set(key, value, ttl?, store?)
351
+ - CacheManager.delete(key, store?)
352
+ - CacheManager.invalidate(pattern, store?)
353
+ - CacheManager.clear(store?)
354
+ ```
355
+
356
+ #### Helper Functions
357
+ ```typescript
358
+ - getCache<T>(key): Promise<T | null>
359
+ - setCache<T>(key, value, ttl?): Promise<void>
360
+ - deleteCache(key): Promise<boolean>
361
+ - invalidateCache(pattern): Promise<number>
362
+ - clearCache(): Promise<void>
363
+ - getRequestId(context): string | null
364
+ - getAbortSignal(context): AbortSignal | null
365
+ - setRequestMetadata(context, key, value): void
366
+ - getRequestMetadata(context, key): any
367
+ - generateRequestId(): string
368
+ ```
369
+
370
+ ### 🐛 Bug Fixes
371
+
372
+ - **ORM Exports**: Fixed DrizzleTransactionManager import path
373
+ - **Middleware Exports**: Added missing createCacheInvalidationMiddleware export
374
+ - **Request Context**: Fixed AbortController reference in context
375
+
376
+ ### 💥 Breaking Changes
377
+
378
+ None - All changes are additive and backward compatible
379
+
380
+ ### 📦 Dependencies
381
+
382
+ No new runtime dependencies added. Caching works with existing dependencies:
383
+ - In-memory cache: No dependencies (built-in)
384
+ - Redis cache: Requires `redis` or `ioredis` (peer dependency)
385
+
386
+ ### 🎯 Migration Guide
387
+
388
+ #### Adding Cache to Existing Routes
389
+
390
+ ```typescript
391
+ // Before
392
+ @Get('/products')
393
+ async getProducts() {
394
+ return await db.products.findAll();
395
+ }
396
+
397
+ // After - Add caching
398
+ @Get('/products')
399
+ @Cache({ ttl: '5m', key: 'products:list' })
400
+ async getProducts() {
401
+ return await db.products.findAll();
402
+ }
403
+ ```
404
+
405
+ #### Adding Request Tracking
406
+
407
+ ```typescript
408
+ // Add to app initialization
409
+ import { createRequestContextMiddleware } from 'veloce-ts';
410
+
411
+ app.use(createRequestContextMiddleware({
412
+ timeout: 30000,
413
+ logging: true
414
+ }));
415
+
416
+ // Use in controllers
417
+ @Get('/data')
418
+ async getData(@RequestId() requestId: string) {
419
+ logger.info({ requestId }, 'Processing request');
420
+ return data;
421
+ }
422
+ ```
423
+
424
+ ### 📊 Statistics
425
+
426
+ - **New Files**: 15+ new source files
427
+ - **Documentation**: 31,000+ words
428
+ - **Code Examples**: 100+ examples
429
+ - **Test Coverage**: All new features covered
430
+ - **Languages**: Full bilingual support (EN/ES)
431
+
432
+ ### 🙏 Acknowledgments
433
+
434
+ This release brings powerful performance optimization features to Veloce-TS:
435
+ - Response caching reduces database load and improves response times
436
+ - Request tracking enables better debugging and monitoring
437
+ - Enhanced logging provides better observability in production
438
+
439
+ ## [0.2.6] - 2025-10-15
440
+
441
+ ### Fixed
442
+ - **Query Export**: Added missing `Query` export from main index to resolve import conflicts
443
+ - **Parameter Decorators**: HTTP `@Query` decorator now properly exported alongside GraphQL decorators
444
+ - **Import Resolution**: Fixed "Export named 'Query' not found" error in applications
445
+
446
+ ## [0.2.5] - 2025-10-15
447
+
448
+ ### Fixed
449
+ - **GraphQL Query Conflict**: Removed conflicting alias `Query` from GraphQL decorators
450
+ - **Import Resolution**: GraphQL decorators now use `GQLQuery` to avoid conflicts with HTTP `@Query` decorator
451
+ - **Type Safety**: Eliminated TypeScript errors caused by decorator name conflicts
452
+
453
+ ### Breaking Changes
454
+ - GraphQL queries now use `@GQLQuery` instead of `@Query` to avoid conflicts with HTTP parameter decorator
455
+
456
+ ## [0.2.4] - 2025-10-15
457
+
458
+ ### Fixed
459
+ - **Query Decorator**: Fixed `@Query` decorator to properly handle parameters without schemas
460
+ - **Query Parameter Extraction**: Improved query parameter handling in router compiler
461
+ - **Validation**: Added proper validation for query parameters with optional Zod schemas
462
+ - **Error Handling**: Fixed missing `ValidationError` import, now using `BadRequestException`
463
+
464
+ ### Improved
465
+ - **Query Decorator Flexibility**: `@Query` now supports multiple usage patterns:
466
+ - `@Query()` - Extract all query parameters
467
+ - `@Query('param')` - Extract specific parameter
468
+ - `@Query(Schema)` - Validate with Zod schema
469
+ - **Router Compiler**: Enhanced parameter extraction and validation logic
470
+ - **Type Safety**: Better TypeScript support for query parameter handling
471
+
472
+ ### Breaking Changes
473
+ - None
474
+
475
+ ## [0.2.3] - 2025-10-14
476
+
477
+ ### Fixed
478
+ - **WebSocket Exports**: Fixed missing `WebSocket` decorator export from WebSocket module
479
+ - **Import Resolution**: WebSocket decorators now properly exported from `veloce-ts/websocket`
480
+
481
+ ## [0.2.2] - 2025-10-14
482
+
483
+ ### Fixed
484
+ - **GraphQL Decorators**: Added missing `Query`, `Mutation`, and `Subscription` aliases for GraphQL decorators
485
+ - **Import Conflicts**: Fixed naming conflicts between params and GraphQL decorators
486
+ - **CLI Templates**: Fixed import errors in CLI template generation
487
+ - **Package Version**: CLI now uses current package version when generating new projects
488
+
489
+ ### Changed
490
+ - **GraphQL Exports**: GraphQL decorators now available with intuitive names (`Query`, `Mutation`, `Subscription`)
491
+ - **Import Resolution**: Cleaner import structure to avoid naming conflicts
492
+
493
+ ## [0.2.1] - 2025-10-14
494
+
495
+ ### Fixed
496
+ - **GraphQL Exports**: Fixed missing `Arg` decorator export from GraphQL module
497
+ - **Import Resolution**: GraphQL decorators now properly exported from `veloce-ts/graphql`
498
+ - **Type Definitions**: GraphQL decorators included in TypeScript declarations
499
+
500
+ ## [0.2.0] - 2025-10-14
501
+
502
+ ### 🚀 Major Features Added
503
+ - **Complete Authentication System**: JWT-based authentication with access/refresh tokens
504
+ - **Role-Based Access Control (RBAC)**: Hierarchical roles with granular permissions system
505
+ - **SQLite Integration**: Built-in SQLite support with Bun's native database
506
+ - **Real-time WebSocket Support**: Enhanced WebSocket handling with decorators
507
+ - **GraphQL Integration**: Complete GraphQL support with resolvers and subscriptions
508
+ - **Advanced Middleware System**: Custom middleware with request/response interceptors
509
+ - **Admin Panel Features**: Comprehensive admin endpoints for user and system management
510
+
511
+ ### 🎯 New Decorators & Features
512
+ - **@Auth**: JWT authentication decorator with automatic user injection
513
+ - **@CurrentUser**: Inject current authenticated user into handlers
514
+ - **@MinimumRole**: Role-based endpoint protection
515
+ - **@Permissions**: Granular permission-based access control
516
+ - **@WebSocket**: Enhanced WebSocket decorators with connection management
517
+ - **@Resolver**: GraphQL resolver decorators for queries and mutations
518
+ - **@OnConnect/@OnMessage/@OnDisconnect**: WebSocket lifecycle decorators
519
+
520
+ ### 🔧 Core Framework Improvements
521
+ - **Router Compiler Fixes**: Fixed critical bugs with sparse array handling in metadata
522
+ - **Dependency Injection**: Enhanced DI system with better error handling
523
+ - **Parameter Resolution**: Improved parameter and dependency resolution
524
+ - **Type Safety**: Enhanced TypeScript inference and type checking
525
+ - **Error Handling**: Better error messages and debugging capabilities
526
+
527
+ ### 📚 Documentation & Examples
528
+ - **Veloce TaskMaster**: Complete real-world example with authentication, RBAC, and frontend
529
+ - **Comprehensive Examples**: Task management system showcasing all framework features
530
+ - **Migration Guides**: Documentation for migrating from Express.js and other frameworks
531
+ - **API Documentation**: Enhanced OpenAPI/Swagger documentation generation
532
+
533
+ ### 🛠️ Technical Improvements
534
+ - **Performance**: Optimized router compilation and metadata handling
535
+ - **Memory Management**: Better handling of metadata arrays and object references
536
+ - **Bundle Size**: Reduced framework bundle size through optimizations
537
+ - **Build System**: Improved TypeScript compilation and type generation
538
+ - **Testing**: Enhanced testing utilities and error reporting
539
+
540
+ ### 🔒 Security Enhancements
541
+ - **JWT Security**: Secure token generation and validation
542
+ - **Password Hashing**: Built-in password hashing utilities
543
+ - **CSRF Protection**: Enhanced CORS and security middleware
544
+ - **Input Validation**: Improved Zod schema validation
545
+ - **Role Hierarchy**: Configurable role hierarchy with permission inheritance
546
+
547
+ ### 🎨 Developer Experience
548
+ - **Better Error Messages**: More descriptive error messages with stack traces
549
+ - **Hot Reload**: Improved development server with better file watching
550
+ - **TypeScript Support**: Enhanced type inference and IntelliSense
551
+ - **Debugging**: Better debugging capabilities with request tracing
552
+ - **CLI Improvements**: Enhanced CLI with better project scaffolding
553
+
554
+ ### 🐛 Critical Bug Fixes
555
+ - **Router Compilation**: Fixed sparse array handling in parameter metadata
556
+ - **Dependency Resolution**: Fixed undefined dependency handling
557
+ - **Array Length Errors**: Fixed array creation with invalid indices
558
+ - **Import Path Issues**: Corrected all import paths in generated projects
559
+ - **Metadata Processing**: Fixed metadata compilation edge cases
560
+
561
+ ### 📦 New Dependencies
562
+ - **jsonwebtoken**: JWT token generation and validation
563
+ - **reflect-metadata**: Enhanced reflection capabilities for decorators
564
+ - **zod-to-json-schema**: Improved OpenAPI schema generation
565
+
566
+ ## [0.1.7] - 2025-10-12
567
+
568
+ ### Fixed
569
+ - Fixed syntax error in CLI new command that prevented build from completing
570
+ - Fixed README generation in CLI templates
571
+
572
+ ## [0.1.6] - 2025-10-12
573
+
574
+ ### Added
575
+ - **Landing Page**: Created modern Astro-based website with interactive terminal and file explorer
576
+ - **Interactive Terminal**: Built terminal component for API testing with command history
577
+ - **File Explorer**: Developed code browser with hierarchical navigation for demo app
578
+ - **Documentation Files**: CLI now generates README.md and API_DOCUMENTATION.md in new projects
579
+
580
+ ### Changed
581
+ - **Complete Rebranding**: Renamed framework from FastAPI-TS to Veloce-TS throughout codebase
582
+ - **OpenAPIPlugin**: Now serves Swagger UI directly from code (no need for static HTML files)
583
+ - **Improved Swagger UI**: Updated to version 5.9.0 with better styling and functionality
584
+ - **Simplified Templates**: `veloce-ts new` command no longer generates unnecessary public files
585
+ - **Better Defaults**: OpenAPI documentation now uses "Veloce-TS" branding by default
586
+ - **Updated URLs**: All references now point to correct GitHub repository and documentation
587
+
588
+ ### Fixed
589
+ - Fixed Swagger UI rendering issues with proper script loading
590
+ - Fixed OpenAPI plugin to correctly serve HTML responses and return proper content types
591
+ - Fixed broken links and outdated branding throughout codebase
592
+ - Improved CORS handling in generated templates
593
+ - Fixed CLI template generation to include proper documentation structure
594
+
595
+ ## [0.1.5] - 2025-10-12
596
+
597
+ ### Fixed
598
+ - Fixed CLI templates to include OpenAPIPlugin automatically when docs: true
599
+ - REST and Fullstack templates now properly initialize OpenAPI documentation
600
+
601
+ ## [0.1.4] - 2025-10-13
602
+
603
+ ### Fixed
604
+ - Fixed CLI templates to call `await app.compile()` before `app.listen()`
605
+ - This fixes the 404 error on all routes in generated projects
606
+
607
+ ## [0.1.3] - 2025-10-12
608
+
609
+ ### Fixed
610
+ - Fixed package.json main and exports paths to point to correct dist/*/src/ directories
611
+ - This fixes the "Cannot find package" error when importing veloce-ts
612
+
613
+ ## [0.1.2] - 2025-10-12
614
+
615
+ ### Fixed
616
+ - Fixed CLI templates to use correct package name `veloce-ts` instead of `VeloceTS`
617
+ - Fixed all import statements in generated projects
618
+
619
+ ## [0.1.1] - 2025-10-12
620
+
621
+ ### Fixed
622
+ - Fixed CLI binary path to use compiled dist files instead of source files
623
+
624
+ ## [0.1.0] - 2025-10-12
625
+
626
+ ### Added
627
+ - Initial release of veloce-ts framework
628
+ - Decorator-based routing with @Controller, @Get, @Post, @Put, @Delete, @Patch
629
+ - Functional API for decorator-free routing
630
+ - Automatic request validation with Zod schemas
631
+ - Dependency injection system with singleton, request, and transient scopes
632
+ - Automatic OpenAPI documentation generation
633
+ - Response handling with JSONResponse, HTMLResponse, FileResponse, StreamResponse, RedirectResponse
634
+ - Plugin system for extensibility
635
+ - WebSocket support with decorators
636
+ - GraphQL support with decorators
637
+ - CLI tool for project scaffolding and development
638
+ - Middleware system with CORS, rate limiting, and compression
639
+ - Error handling with custom exceptions
640
+ - Testing utilities with TestClient
641
+ - Multi-runtime support (Bun, Node.js, Deno, Cloudflare Workers)
642
+ - Adapter system for Express and Hono
643
+ - Type safety with full TypeScript support
644
+ - Performance optimizations with metadata compilation and schema caching
645
+
646
+ ## [0.1.0] - 2025-10-12
647
+
648
+ ### Added
649
+ - Initial development version
650
+ - Core framework architecture
651
+ - Basic routing and validation
652
+ - Documentation generation
653
+ - Plugin system
654
+ - WebSocket and GraphQL support
655
+ - CLI tooling
656
+ - Testing utilities
657
+
658
+ [Unreleased]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.4.0...HEAD
659
+ [0.4.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.3...v0.4.0
660
+ [0.3.3]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.3
661
+ [0.3.2]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.2
662
+ [0.3.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.0...v0.3.1
663
+ [0.2.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.1...v0.2.2
664
+ [0.2.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.0...v0.2.1
665
+ [0.2.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.7...v0.2.0
666
+ [0.1.7]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.6...v0.1.7
667
+ [0.1.6]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.5...v0.1.6
668
+ [0.1.5]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.4...v0.1.5
669
+ [0.1.4]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.3...v0.1.4
670
+ [0.1.3]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.2...v0.1.3
671
+ [0.1.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.1...v0.1.2
672
+ [0.1.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.0...v0.1.1
673
+ [0.1.0]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.1.0