|
1 | 1 | # @asenajs/asena |
2 | 2 |
|
| 3 | +## 0.6.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- d1fd783: ## Event System |
| 8 | + |
| 9 | + Added Spring-like event-driven architecture. |
| 10 | + |
| 11 | + ```typescript |
| 12 | + @EventService({ prefix: 'user' }) |
| 13 | + export class UserEventService { |
| 14 | + @On('created') |
| 15 | + handleUserCreated(eventName: string, data: any) { |
| 16 | + console.log('User created:', data); |
| 17 | + } |
| 18 | + |
| 19 | + @On('*.error') // Wildcard support |
| 20 | + handleErrors(eventName: string, data: any) { |
| 21 | + console.error('Error:', eventName); |
| 22 | + } |
| 23 | + } |
| 24 | + ``` |
| 25 | + |
| 26 | + **Features:** |
| 27 | + - `@EventService` and `@On` decorators |
| 28 | + - Wildcard pattern support (`user.*`, `*.error`) |
| 29 | + - Fire-and-forget pattern |
| 30 | + - Async/sync handler support |
| 31 | + - Error isolation |
| 32 | + - Event chaining |
| 33 | + |
| 34 | + **Exports:** |
| 35 | + |
| 36 | + ```typescript |
| 37 | + import { EventService, On } from '@asenajs/asena/decorators'; |
| 38 | + import { EventEmitter } from '@asenajs/asena/event'; |
| 39 | + ``` |
| 40 | + |
| 41 | + ## Breaking Changes (Adapter Developers Only) |
| 42 | + |
| 43 | + **WebSocket Refactoring - Circular Dependency Removal** |
| 44 | + |
| 45 | + `AsenaSocket` no longer holds a reference to `AsenaWebSocketService`. |
| 46 | + |
| 47 | + **Changes:** |
| 48 | + - `AsenaSocket` constructor: removed `websocketService` parameter, added `namespace: string` |
| 49 | + - Removed `cleanup()` method |
| 50 | + - Removed manual `rooms` management (using Bun native pub/sub) |
| 51 | + - Removed `getSocketsByRoom()` method from `AsenaWebSocketService` |
| 52 | + |
| 53 | + **Impact:** |
| 54 | + - ⚠️ HTTP/WebSocket adapter developers must update their code |
| 55 | + - ✅ End users are not affected |
| 56 | + |
| 57 | + **For adapter developers:** |
| 58 | + |
| 59 | + ```typescript |
| 60 | + // Before |
| 61 | + new AsenaSocket(ws, websocketService); |
| 62 | + |
| 63 | + // After |
| 64 | + new AsenaSocket(ws, namespace); |
| 65 | + ``` |
| 66 | + |
| 67 | +### Patch Changes |
| 68 | + |
| 69 | +- ## Windows Path Compatibility Fix |
| 70 | + |
| 71 | + Fixed route path joining issue on Windows by normalizing backslashes to forward slashes. |
| 72 | + |
| 73 | + **Issue:** `path.join()` was using Windows backslashes (`\`) for route paths, causing adapter registration failures on Windows. |
| 74 | + |
| 75 | + **Solution:** Route paths are now normalized using `.replace(/\\/g, '/')` to ensure cross-platform compatibility. |
| 76 | + |
| 77 | + **Impact:** |
| 78 | + - ✅ Routes now work correctly on Windows |
| 79 | + - ✅ No breaking changes for users or adapter developers |
| 80 | + - ✅ Test coverage added for path normalization |
| 81 | + |
| 82 | + **Related:** Fixes #41 |
| 83 | + |
3 | 84 | ## 0.5.0 |
4 | 85 |
|
5 | 86 | ### Minor Changes |
|
0 commit comments