veloce-ts 0.3.3 → 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 -514
  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,514 +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.3] - 2025-10-31
11
-
12
- ### 🐛 Critical Bug Fixes
13
- - **JSON Response Serialization**: Fixed critical bug where JSON responses were not being serialized correctly
14
- - **CLI Version Resolution**: Confirmed CLI correctly fetches and uses latest npm version (0.3.2)
15
- - **Application Compilation**: Fixed missing `await app.compile()` call in generated templates
16
-
17
- ### 🔧 CLI Improvements
18
- - **Version Fetching**: CLI now correctly fetches latest version from npm registry
19
- - **Template Generation**: All templates now include proper `await app.compile()` call
20
- - **Error Handling**: Improved error handling in CLI operations
21
-
22
- ## [0.3.2] - 2025-10-31
23
-
24
- ## [0.3.1] - 2025-10-31
25
-
26
- ### 🛠️ CLI Improvements
27
-
28
- #### Enhanced Project Generation
29
- - **Latest Version Fetching**: CLI now automatically fetches the latest VeloceTS version from npm registry
30
- - **Improved Error Handling**: Better error messages and cleanup on project creation failure
31
- - **Type Safety**: Fixed TypeScript errors in CLI with proper type definitions for npm registry API
32
- - **Better User Experience**: Enhanced progress messages and visual feedback during project creation
33
- - **Robust Fallbacks**: Multiple fallback strategies for version detection when npm is unavailable
34
-
35
- #### Fixed Issues
36
- - **npm Registry Integration**: Fixed CLI to use correct npm registry endpoint (`/veloce-ts` instead of `/veloce-ts/latest`)
37
- - **Type Definitions**: Added proper TypeScript interfaces for npm registry response structure
38
- - **Version Resolution**: Improved version parsing with proper type checking and validation
39
- - **Package.json Generation**: Now uses specific dependency versions instead of 'latest' for better stability
40
- - **Template Compilation**: All generated templates now include mandatory `await app.compile()` call
41
-
42
- #### Technical Improvements
43
- - **NpmRegistryResponse Interface**: Added proper typing for npm registry API responses
44
- - **Async Error Handling**: Better error handling in async CLI operations
45
- - **Dependency Versions**: Updated to use specific versions for better reproducibility:
46
- - `hono: ^4.0.0` (instead of 'latest')
47
- - `reflect-metadata: ^0.2.0` (instead of 'latest')
48
- - `zod: ^3.22.0` (instead of 'latest')
49
- - `typescript: ^5.3.0` (instead of 'latest')
50
- - **Engine Requirements**: Added Node.js and Bun version requirements to generated package.json
51
-
52
- #### Developer Experience
53
- - **Progress Indicators**: Added emoji-based progress indicators for better visual feedback
54
- - **Cleanup on Failure**: Automatic cleanup of partial projects when creation fails
55
- - **Validation**: Better project name validation and error messages
56
- - **Documentation**: Generated projects include comprehensive setup instructions
57
-
58
- ### 🐛 Bug Fixes
59
- - **CLI TypeScript Errors**: Fixed 'data is of type unknown' error in npm registry API calls
60
- - **Template Generation**: Fixed missing `await app.compile()` in all CLI templates
61
- - **Dependency Management**: Improved dependency version resolution and fallback handling
62
-
63
- ### 📦 Migration Guide
64
-
65
- #### For CLI Users
66
- No breaking changes. Existing projects will continue to work. New projects generated with `veloce-ts new` will:
67
- - Use the latest VeloceTS version automatically
68
- - Include proper `await app.compile()` calls
69
- - Have more stable dependency versions
70
-
71
- #### For Framework Users
72
- No changes required. This release only improves the CLI experience.
73
-
74
- ## [0.3.0] - 2025-10-29
75
-
76
- ### 🚀 Major Features Added
77
-
78
- #### Response Caching System
79
- - **In-Memory Cache Store**: Fast LRU-based caching with automatic cleanup
80
- - **Redis Cache Store**: Distributed caching support for multi-instance deployments
81
- - **@Cache() Decorator**: Declarative response caching with flexible TTL configuration
82
- - **@CacheInvalidate() Decorator**: Pattern-based cache invalidation for mutations
83
- - **Cache Middleware**: Functional API support for route-level caching
84
- - **TTL Support**: Flexible time-to-live with string format ('5m', '1h', '1d') or seconds
85
- - **Pattern Invalidation**: Wildcard pattern matching for cache invalidation ('products:*')
86
- - **Cache Keys**: Smart key generation with placeholder support ('product:{id}')
87
- - **Cache Headers**: Automatic X-Cache headers (HIT/MISS) in responses
88
-
89
- #### Enhanced Request Context
90
- - **Automatic Request IDs**: UUID generation for every request
91
- - **@RequestId() Decorator**: Inject request ID into controller methods
92
- - **@AbortSignal() Decorator**: Request cancellation support for long-running operations
93
- - **Request Timeouts**: Configurable timeouts per route or globally
94
- - **Logging Integration**: Request ID automatically propagates through all logs
95
- - **Response Headers**: X-Request-ID header in all responses
96
- - **Metadata Storage**: Attach custom data to request context
97
- - **Request Lifecycle**: Automatic logging of request start/end with duration
98
-
99
- #### Logging Improvements
100
- - **Request Context Integration**: Automatic request ID in all log entries
101
- - **Child Loggers**: Enhanced contextual logging with inheritance
102
- - **Structured Logging**: JSON-formatted logs for production
103
- - **Pretty Printing**: Human-readable logs for development
104
- - **Log Middleware**: Request lifecycle logging with configurable headers
105
-
106
- ### 🎯 New Decorators
107
-
108
- - **@Cache(options)**: Cache route responses with TTL and key configuration
109
- - **@CacheInvalidate(pattern)**: Invalidate cache entries matching patterns
110
- - **@RequestId()**: Inject unique request ID into handler parameters
111
- - **@AbortSignal()**: Inject AbortSignal for request cancellation
112
-
113
- ### 🔧 New Middleware
114
-
115
- - **createRequestContextMiddleware()**: Initialize request context with ID, timeout, and logging
116
- - **createSimpleRequestIdMiddleware()**: Minimal request ID middleware
117
- - **createCacheMiddleware()**: Functional API route caching
118
- - **createCacheInvalidationMiddleware()**: Functional API cache invalidation
119
-
120
- ### 📦 New Modules
121
-
122
- - **src/cache/**: Complete caching system
123
- - `types.ts`: Cache interfaces and types
124
- - `memory-store.ts`: In-memory LRU cache implementation
125
- - `redis-store.ts`: Redis backend for distributed caching
126
- - `manager.ts`: Global cache management and utilities
127
- - **src/context/**: Enhanced request context
128
- - `request-context.ts`: Request tracking with UUID and AbortSignal
129
- - **src/middleware/**: New middleware
130
- - `request-context.ts`: Request context initialization
131
- - `cache.ts`: Cache middleware for functional API
132
- - **src/decorators/**: New decorators
133
- - `cache.ts`: @Cache and @CacheInvalidate decorators
134
-
135
- ### 🛠️ Core Improvements
136
-
137
- - **Router Compiler**: Integrated cache checking and invalidation in route handlers
138
- - **Type System**: New parameter types for request-id and abort-signal
139
- - **Export System**: All new decorators and middleware properly exported
140
- - **Error Handling**: Improved error handling with request ID context
141
-
142
- ### 📚 Documentation
143
-
144
- #### New Guides (English + Spanish)
145
- - **Caching Guide**: Complete guide to response caching (15,000 words total)
146
- - In-memory and Redis stores
147
- - Decorators and middleware
148
- - TTL configuration
149
- - Cache invalidation strategies
150
- - Best practices with 50+ code examples
151
- - **Request Context Guide**: Request tracking and management (12,000 words total)
152
- - Automatic UUID generation
153
- - Request cancellation with AbortSignal
154
- - Timeout configuration
155
- - Logging integration
156
- - 40+ code examples
157
- - **Logging Guide**: Structured logging with Pino (4,000 words total)
158
- - Logger configuration
159
- - Child loggers
160
- - Request ID integration
161
- - Best practices
162
-
163
- #### Documentation Coverage
164
- - Added 31,000+ words of professional documentation
165
- - 100+ new code examples
166
- - Bilingual support (English and Spanish)
167
- - SEO-optimized with meta descriptions
168
- - Cross-referenced between guides
169
-
170
- ### 🌐 Sidebar Updates
171
-
172
- Updated Starlight documentation sidebar with new guides:
173
- - Caching
174
- - Request Context
175
- - Logging
176
-
177
- ### Performance Improvements
178
-
179
- - **Cache System**: Sub-millisecond cache hits with in-memory store
180
- - **LRU Eviction**: Automatic memory management in cache store
181
- - **Request Context**: Minimal overhead UUID generation
182
- - **Logging**: Efficient structured logging with Pino
183
-
184
- ### 🔄 API Additions
185
-
186
- #### Cache Manager
187
- ```typescript
188
- - CacheManager.setDefaultStore(store)
189
- - CacheManager.getDefaultStore()
190
- - CacheManager.generateKey(method, path, params, query, options)
191
- - CacheManager.get(key, store?)
192
- - CacheManager.set(key, value, ttl?, store?)
193
- - CacheManager.delete(key, store?)
194
- - CacheManager.invalidate(pattern, store?)
195
- - CacheManager.clear(store?)
196
- ```
197
-
198
- #### Helper Functions
199
- ```typescript
200
- - getCache<T>(key): Promise<T | null>
201
- - setCache<T>(key, value, ttl?): Promise<void>
202
- - deleteCache(key): Promise<boolean>
203
- - invalidateCache(pattern): Promise<number>
204
- - clearCache(): Promise<void>
205
- - getRequestId(context): string | null
206
- - getAbortSignal(context): AbortSignal | null
207
- - setRequestMetadata(context, key, value): void
208
- - getRequestMetadata(context, key): any
209
- - generateRequestId(): string
210
- ```
211
-
212
- ### 🐛 Bug Fixes
213
-
214
- - **ORM Exports**: Fixed DrizzleTransactionManager import path
215
- - **Middleware Exports**: Added missing createCacheInvalidationMiddleware export
216
- - **Request Context**: Fixed AbortController reference in context
217
-
218
- ### 💥 Breaking Changes
219
-
220
- None - All changes are additive and backward compatible
221
-
222
- ### 📦 Dependencies
223
-
224
- No new runtime dependencies added. Caching works with existing dependencies:
225
- - In-memory cache: No dependencies (built-in)
226
- - Redis cache: Requires `redis` or `ioredis` (peer dependency)
227
-
228
- ### 🎯 Migration Guide
229
-
230
- #### Adding Cache to Existing Routes
231
-
232
- ```typescript
233
- // Before
234
- @Get('/products')
235
- async getProducts() {
236
- return await db.products.findAll();
237
- }
238
-
239
- // After - Add caching
240
- @Get('/products')
241
- @Cache({ ttl: '5m', key: 'products:list' })
242
- async getProducts() {
243
- return await db.products.findAll();
244
- }
245
- ```
246
-
247
- #### Adding Request Tracking
248
-
249
- ```typescript
250
- // Add to app initialization
251
- import { createRequestContextMiddleware } from 'veloce-ts';
252
-
253
- app.use(createRequestContextMiddleware({
254
- timeout: 30000,
255
- logging: true
256
- }));
257
-
258
- // Use in controllers
259
- @Get('/data')
260
- async getData(@RequestId() requestId: string) {
261
- logger.info({ requestId }, 'Processing request');
262
- return data;
263
- }
264
- ```
265
-
266
- ### 📊 Statistics
267
-
268
- - **New Files**: 15+ new source files
269
- - **Documentation**: 31,000+ words
270
- - **Code Examples**: 100+ examples
271
- - **Test Coverage**: All new features covered
272
- - **Languages**: Full bilingual support (EN/ES)
273
-
274
- ### 🙏 Acknowledgments
275
-
276
- This release brings powerful performance optimization features to Veloce-TS:
277
- - Response caching reduces database load and improves response times
278
- - Request tracking enables better debugging and monitoring
279
- - Enhanced logging provides better observability in production
280
-
281
- ## [0.2.6] - 2025-10-15
282
-
283
- ### Fixed
284
- - **Query Export**: Added missing `Query` export from main index to resolve import conflicts
285
- - **Parameter Decorators**: HTTP `@Query` decorator now properly exported alongside GraphQL decorators
286
- - **Import Resolution**: Fixed "Export named 'Query' not found" error in applications
287
-
288
- ## [0.2.5] - 2025-10-15
289
-
290
- ### Fixed
291
- - **GraphQL Query Conflict**: Removed conflicting alias `Query` from GraphQL decorators
292
- - **Import Resolution**: GraphQL decorators now use `GQLQuery` to avoid conflicts with HTTP `@Query` decorator
293
- - **Type Safety**: Eliminated TypeScript errors caused by decorator name conflicts
294
-
295
- ### Breaking Changes
296
- - GraphQL queries now use `@GQLQuery` instead of `@Query` to avoid conflicts with HTTP parameter decorator
297
-
298
- ## [0.2.4] - 2025-10-15
299
-
300
- ### Fixed
301
- - **Query Decorator**: Fixed `@Query` decorator to properly handle parameters without schemas
302
- - **Query Parameter Extraction**: Improved query parameter handling in router compiler
303
- - **Validation**: Added proper validation for query parameters with optional Zod schemas
304
- - **Error Handling**: Fixed missing `ValidationError` import, now using `BadRequestException`
305
-
306
- ### Improved
307
- - **Query Decorator Flexibility**: `@Query` now supports multiple usage patterns:
308
- - `@Query()` - Extract all query parameters
309
- - `@Query('param')` - Extract specific parameter
310
- - `@Query(Schema)` - Validate with Zod schema
311
- - **Router Compiler**: Enhanced parameter extraction and validation logic
312
- - **Type Safety**: Better TypeScript support for query parameter handling
313
-
314
- ### Breaking Changes
315
- - None
316
-
317
- ## [0.2.3] - 2025-10-14
318
-
319
- ### Fixed
320
- - **WebSocket Exports**: Fixed missing `WebSocket` decorator export from WebSocket module
321
- - **Import Resolution**: WebSocket decorators now properly exported from `veloce-ts/websocket`
322
-
323
- ## [0.2.2] - 2025-10-14
324
-
325
- ### Fixed
326
- - **GraphQL Decorators**: Added missing `Query`, `Mutation`, and `Subscription` aliases for GraphQL decorators
327
- - **Import Conflicts**: Fixed naming conflicts between params and GraphQL decorators
328
- - **CLI Templates**: Fixed import errors in CLI template generation
329
- - **Package Version**: CLI now uses current package version when generating new projects
330
-
331
- ### Changed
332
- - **GraphQL Exports**: GraphQL decorators now available with intuitive names (`Query`, `Mutation`, `Subscription`)
333
- - **Import Resolution**: Cleaner import structure to avoid naming conflicts
334
-
335
- ## [0.2.1] - 2025-10-14
336
-
337
- ### Fixed
338
- - **GraphQL Exports**: Fixed missing `Arg` decorator export from GraphQL module
339
- - **Import Resolution**: GraphQL decorators now properly exported from `veloce-ts/graphql`
340
- - **Type Definitions**: GraphQL decorators included in TypeScript declarations
341
-
342
- ## [0.2.0] - 2025-10-14
343
-
344
- ### 🚀 Major Features Added
345
- - **Complete Authentication System**: JWT-based authentication with access/refresh tokens
346
- - **Role-Based Access Control (RBAC)**: Hierarchical roles with granular permissions system
347
- - **SQLite Integration**: Built-in SQLite support with Bun's native database
348
- - **Real-time WebSocket Support**: Enhanced WebSocket handling with decorators
349
- - **GraphQL Integration**: Complete GraphQL support with resolvers and subscriptions
350
- - **Advanced Middleware System**: Custom middleware with request/response interceptors
351
- - **Admin Panel Features**: Comprehensive admin endpoints for user and system management
352
-
353
- ### 🎯 New Decorators & Features
354
- - **@Auth**: JWT authentication decorator with automatic user injection
355
- - **@CurrentUser**: Inject current authenticated user into handlers
356
- - **@MinimumRole**: Role-based endpoint protection
357
- - **@Permissions**: Granular permission-based access control
358
- - **@WebSocket**: Enhanced WebSocket decorators with connection management
359
- - **@Resolver**: GraphQL resolver decorators for queries and mutations
360
- - **@OnConnect/@OnMessage/@OnDisconnect**: WebSocket lifecycle decorators
361
-
362
- ### 🔧 Core Framework Improvements
363
- - **Router Compiler Fixes**: Fixed critical bugs with sparse array handling in metadata
364
- - **Dependency Injection**: Enhanced DI system with better error handling
365
- - **Parameter Resolution**: Improved parameter and dependency resolution
366
- - **Type Safety**: Enhanced TypeScript inference and type checking
367
- - **Error Handling**: Better error messages and debugging capabilities
368
-
369
- ### 📚 Documentation & Examples
370
- - **Veloce TaskMaster**: Complete real-world example with authentication, RBAC, and frontend
371
- - **Comprehensive Examples**: Task management system showcasing all framework features
372
- - **Migration Guides**: Documentation for migrating from Express.js and other frameworks
373
- - **API Documentation**: Enhanced OpenAPI/Swagger documentation generation
374
-
375
- ### 🛠️ Technical Improvements
376
- - **Performance**: Optimized router compilation and metadata handling
377
- - **Memory Management**: Better handling of metadata arrays and object references
378
- - **Bundle Size**: Reduced framework bundle size through optimizations
379
- - **Build System**: Improved TypeScript compilation and type generation
380
- - **Testing**: Enhanced testing utilities and error reporting
381
-
382
- ### 🔒 Security Enhancements
383
- - **JWT Security**: Secure token generation and validation
384
- - **Password Hashing**: Built-in password hashing utilities
385
- - **CSRF Protection**: Enhanced CORS and security middleware
386
- - **Input Validation**: Improved Zod schema validation
387
- - **Role Hierarchy**: Configurable role hierarchy with permission inheritance
388
-
389
- ### 🎨 Developer Experience
390
- - **Better Error Messages**: More descriptive error messages with stack traces
391
- - **Hot Reload**: Improved development server with better file watching
392
- - **TypeScript Support**: Enhanced type inference and IntelliSense
393
- - **Debugging**: Better debugging capabilities with request tracing
394
- - **CLI Improvements**: Enhanced CLI with better project scaffolding
395
-
396
- ### 🐛 Critical Bug Fixes
397
- - **Router Compilation**: Fixed sparse array handling in parameter metadata
398
- - **Dependency Resolution**: Fixed undefined dependency handling
399
- - **Array Length Errors**: Fixed array creation with invalid indices
400
- - **Import Path Issues**: Corrected all import paths in generated projects
401
- - **Metadata Processing**: Fixed metadata compilation edge cases
402
-
403
- ### 📦 New Dependencies
404
- - **jsonwebtoken**: JWT token generation and validation
405
- - **reflect-metadata**: Enhanced reflection capabilities for decorators
406
- - **zod-to-json-schema**: Improved OpenAPI schema generation
407
-
408
- ## [0.1.7] - 2025-10-12
409
-
410
- ### Fixed
411
- - Fixed syntax error in CLI new command that prevented build from completing
412
- - Fixed README generation in CLI templates
413
-
414
- ## [0.1.6] - 2025-10-12
415
-
416
- ### Added
417
- - **Landing Page**: Created modern Astro-based website with interactive terminal and file explorer
418
- - **Interactive Terminal**: Built terminal component for API testing with command history
419
- - **File Explorer**: Developed code browser with hierarchical navigation for demo app
420
- - **Documentation Files**: CLI now generates README.md and API_DOCUMENTATION.md in new projects
421
-
422
- ### Changed
423
- - **Complete Rebranding**: Renamed framework from FastAPI-TS to Veloce-TS throughout codebase
424
- - **OpenAPIPlugin**: Now serves Swagger UI directly from code (no need for static HTML files)
425
- - **Improved Swagger UI**: Updated to version 5.9.0 with better styling and functionality
426
- - **Simplified Templates**: `veloce-ts new` command no longer generates unnecessary public files
427
- - **Better Defaults**: OpenAPI documentation now uses "Veloce-TS" branding by default
428
- - **Updated URLs**: All references now point to correct GitHub repository and documentation
429
-
430
- ### Fixed
431
- - Fixed Swagger UI rendering issues with proper script loading
432
- - Fixed OpenAPI plugin to correctly serve HTML responses and return proper content types
433
- - Fixed broken links and outdated branding throughout codebase
434
- - Improved CORS handling in generated templates
435
- - Fixed CLI template generation to include proper documentation structure
436
-
437
- ## [0.1.5] - 2025-10-12
438
-
439
- ### Fixed
440
- - Fixed CLI templates to include OpenAPIPlugin automatically when docs: true
441
- - REST and Fullstack templates now properly initialize OpenAPI documentation
442
-
443
- ## [0.1.4] - 2025-10-13
444
-
445
- ### Fixed
446
- - Fixed CLI templates to call `await app.compile()` before `app.listen()`
447
- - This fixes the 404 error on all routes in generated projects
448
-
449
- ## [0.1.3] - 2025-10-12
450
-
451
- ### Fixed
452
- - Fixed package.json main and exports paths to point to correct dist/*/src/ directories
453
- - This fixes the "Cannot find package" error when importing veloce-ts
454
-
455
- ## [0.1.2] - 2025-10-12
456
-
457
- ### Fixed
458
- - Fixed CLI templates to use correct package name `veloce-ts` instead of `VeloceTS`
459
- - Fixed all import statements in generated projects
460
-
461
- ## [0.1.1] - 2025-10-12
462
-
463
- ### Fixed
464
- - Fixed CLI binary path to use compiled dist files instead of source files
465
-
466
- ## [0.1.0] - 2025-10-12
467
-
468
- ### Added
469
- - Initial release of veloce-ts framework
470
- - Decorator-based routing with @Controller, @Get, @Post, @Put, @Delete, @Patch
471
- - Functional API for decorator-free routing
472
- - Automatic request validation with Zod schemas
473
- - Dependency injection system with singleton, request, and transient scopes
474
- - Automatic OpenAPI documentation generation
475
- - Response handling with JSONResponse, HTMLResponse, FileResponse, StreamResponse, RedirectResponse
476
- - Plugin system for extensibility
477
- - WebSocket support with decorators
478
- - GraphQL support with decorators
479
- - CLI tool for project scaffolding and development
480
- - Middleware system with CORS, rate limiting, and compression
481
- - Error handling with custom exceptions
482
- - Testing utilities with TestClient
483
- - Multi-runtime support (Bun, Node.js, Deno, Cloudflare Workers)
484
- - Adapter system for Express and Hono
485
- - Type safety with full TypeScript support
486
- - Performance optimizations with metadata compilation and schema caching
487
-
488
- ## [0.1.0] - 2025-10-12
489
-
490
- ### Added
491
- - Initial development version
492
- - Core framework architecture
493
- - Basic routing and validation
494
- - Documentation generation
495
- - Plugin system
496
- - WebSocket and GraphQL support
497
- - CLI tooling
498
- - Testing utilities
499
-
500
- [Unreleased]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.3...HEAD
501
- [0.3.3]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.3
502
- [0.3.2]: https://github.com/AlfredoMejia3001/veloce-ts/releases/tag/v0.3.2
503
- [0.3.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.3.0...v0.3.1
504
- [0.2.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.1...v0.2.2
505
- [0.2.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.2.0...v0.2.1
506
- [0.2.0]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.7...v0.2.0
507
- [0.1.7]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.6...v0.1.7
508
- [0.1.6]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.5...v0.1.6
509
- [0.1.5]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.4...v0.1.5
510
- [0.1.4]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.3...v0.1.4
511
- [0.1.3]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.2...v0.1.3
512
- [0.1.2]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.1...v0.1.2
513
- [0.1.1]: https://github.com/AlfredoMejia3001/veloce-ts/compare/v0.1.0...v0.1.1
514
- [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