Skip to content

Releases: AsenaJs/Asena

Release-v0.6.3

17 Nov 22:16
6034e58

Choose a tag to compare

What's Changed

Full Changelog: v0.6.2...v0.6.3

Release-v0.6.2

16 Nov 23:05
e57f21c

Choose a tag to compare

Changes

  • AsenaWebsocket interface updated to latest version of bun ServerWebsocket.
  • Asena test utilities added. access via @asenajs/asena/test

#47 #48

Release v0.6.0

02 Nov 21:52
b387417

Choose a tag to compare

Minor Changes

  • d1fd783: ## Event System

    Added Spring-like event-driven architecture.

    @EventService({ prefix: 'user' })
    export class UserEventService {
      @On('created')
      handleUserCreated(eventName: string, data: any) {
        console.log('User created:', data);
      }
    
      @On('*.error') // Wildcard support
      handleErrors(eventName: string, data: any) {
        console.error('Error:', eventName);
      }
    }

    Features:

    • @EventService and @On decorators
    • Wildcard pattern support (user.*, *.error)
    • Fire-and-forget pattern
    • Async/sync handler support
    • Error isolation
    • Event chaining

    Exports:

    import { EventService, On } from '@asenajs/asena/decorators';
    import { EventEmitter } from '@asenajs/asena/event';

    Breaking Changes (Adapter Developers Only)

    WebSocket Refactoring - Circular Dependency Removal

    AsenaSocket no longer holds a reference to AsenaWebSocketService.

    Changes:

    • AsenaSocket constructor: removed websocketService parameter, added namespace: string
    • Removed cleanup() method
    • Removed manual rooms management (using Bun native pub/sub)
    • Removed getSocketsByRoom() method from AsenaWebSocketService

    Impact:

    • ⚠️ HTTP/WebSocket adapter developers must update their code
    • ✅ End users are not affected

    For adapter developers:

    // Before
    new AsenaSocket(ws, websocketService);
    
    // After
    new AsenaSocket(ws, namespace);

Release v0.5.0

21 Oct 20:47
1b8bcf0

Choose a tag to compare

Release v0.5.0

Summary

Introduces Ulak WebSocket Messaging System - a centralized message broker that eliminates circular dependencies in WebSocket communication.

✨ New Features

Ulak Messaging System

Centralized WebSocket message broker with namespace-based routing.

@Service('UserService')
class UserService {
  @Inject(ulak("/notifications"))
  private notifications: Ulak.NameSpace<"/notifications">;

  async createUser(data: any) {
    const user = await this.saveUser(data);
    await this.notifications.broadcast({ type: 'user_created', user });
  }
}

Benefits:

  • Eliminates circular dependencies between WebSocket services
  • Type-safe messaging with full TypeScript support
  • Bulk operations and pattern matching support
  • Comprehensive error handling

New Export: @asenajs/asena/messaging

Enhanced @Inject Decorator

Supports tuple injection pattern for advanced DI scenarios:

@Inject([Service, (a) => processData(a)])
private processedData: Result;

🐛 Bug Fixes

  • Fixed IocEngine empty dependency error in non-minified codebases

💥 Breaking Changes

AsenaWebSocketServer Constructor

Before:

const wsServer = new AsenaWebSocketServer(server, 'my-topic');

After:

const wsServer = new AsenaWebSocketServer(server);

Removed API:

  • AsenaWebSocketServer.websocketCount getter

Impact:

  • ⚠️ Custom adapter implementations need updates
  • ✅ Official adapters already compatible
  • ✅ Regular users not affected

Migration for Custom Adapters:

// Use single shared instance
public startWebsocket(server: Server<any>): void {
  const sharedServer = new AsenaWebSocketServer(server);
  for (const websocket of this.websockets.values()) {
    websocket.server = sharedServer;
  }
}

🔄 Migration Guide

WebSocket Service Communication:

// Before - Circular dependency risk
@Inject(ChatWebSocketService)
private chatService: ChatWebSocketService;

// After - Use Ulak
@Inject(ulak("/chat"))
private chat: Ulak.NameSpace<"/chat">;

Full Changelog: v0.4.0...v0.5.0

Release v0.4.0

15 Oct 22:51
bce547b

Choose a tag to compare

🎉 Release v0.4.0

Major architectural improvement migrating entire framework to full IoC container pattern with field-based dependency injection.

✨ Features

  • Full IoC Container: All core services now managed by IoC container
  • AsenaServerFactory: New factory pattern for server creation (replaces new AsenaServer())
  • Field-based Injection: All services use @Inject decorator for clean dependency management
  • Circular Dependency Detection: Runtime detection with detailed error messages
  • Symbol-based Metadata: Type-safe metadata keys preventing external manipulation
  • CoreContainer: Framework-level container managing bootstrap sequence

💥 Breaking Changes

  • new AsenaServer() is replaced with AsenaServerFactory.create()
  • Server configuration now uses options object instead of builder pattern

Migration Guide

Before (v0.3.x):

await new AsenaServer(adapter, logger).port(3000).start();

After (v0.4.x):
const server = await AsenaServerFactory.create({
  adapter,
  logger,
  port: 3000
});
await server.start();

🔧 Internal Improvements

- All 5 prepare services migrated to field injection
- IocEngine now receives Container via injection
- Bootstrap process split into 9 deterministic phases
- PrepareService base class removed (field injection pattern)

📊 Test Results

-  252 tests passing
-  90%+ code coverage
-  All type checks passing
-  Bun 1.3.0 compatible

📝 Full Changelog

See https://github.com/AsenaJs/Asena/blob/master/CHANGELOG.md for complete details.

---
Installation:
bun add @asenajs/asena@0.4.0

Hotfix-V0.3.3

30 Sep 20:58

Choose a tag to compare

Fixes

  • Fix topic format inconsistency in subscribe/unsubscribe operations
  • Improve AsenaSocket cleanup to prevent modification during iteration
  • Enhance unsubscribe method with safer socket filtering
  • Add memory leak prevention tests
  • Add topic format consistency tests
  • Resolves potential memory leaks and subscription issues in WebSocket connections.

Hotfix-V0.3.2

29 Sep 22:34

Choose a tag to compare

Fixes

PostConstruct Duplicate Execution

  • Added executedMethods Set to track executed methods
  • Each PostConstruct method now executes only once in inheritance chain
  • Override behavior works correctly with super.method() calls

Async PostConstruct Await

  • Made Container.register() async
  • Added await to all prepareInstance() calls
  • Singleton services now fully initialize before injection

v0.3.1

08 May 22:34

Choose a tag to compare

0.3.1

Patch Changes

  • fc9e310: Config service name undefined bug fixed

v0.3.0

08 May 07:39

Choose a tag to compare

Minor Changes

  • b7aae6c: - Removed Winston dependency to reduce external dependencies. -
  • Implemented a new WebSocket adapter system for enhanced real-time communication capabilities.
  • Introduced a static serve API and configuration for serving static files.
  • Addressed various minor bugs. - Improved and fixed existing tests.
  • Added new tests to increase code coverage and ensure stability.
  • Performed general code cleanup and refactoring.

Inheritance bug fixes

28 Mar 18:34

Choose a tag to compare

inheritance bug fixed and hono adapter removed from project