veloce-ts 0.3.3 → 0.4.1

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