@fluojs/event-bus
Advanced tools
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,YAAY,CAAC;AAIlE,KAAK,yBAAyB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;AACjG,KAAK,mBAAmB,GAAG,yBAAyB,CAAC;AAqBrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,mBAAmB,CAkBjE"} | ||
| {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,YAAY,CAAC;AAIlE,KAAK,yBAAyB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;AACjG,KAAK,mBAAmB,GAAG,yBAAyB,CAAC;AAsBrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,mBAAmB,CAkBjE"} |
@@ -1,5 +0,5 @@ | ||
| import { metadataSymbol } from '@fluojs/core/internal'; | ||
| import { ensureMetadataSymbol } from '@fluojs/core/internal'; | ||
| import { eventBusMetadataSymbol } from './metadata.js'; | ||
| ensureMetadataSymbol(); | ||
| function getStandardMetadataBag(metadata) { | ||
| void metadataSymbol; | ||
| return metadata; | ||
@@ -6,0 +6,0 @@ } |
+23
-0
| import { type MetadataPropertyKey } from '@fluojs/core'; | ||
| import type { EventHandlerMetadata } from './types.js'; | ||
| /** | ||
| * Define event handler metadata. | ||
| * | ||
| * @param target The target. | ||
| * @param propertyKey The property key. | ||
| * @param metadata The metadata. | ||
| */ | ||
| export declare function defineEventHandlerMetadata(target: object, propertyKey: MetadataPropertyKey, metadata: EventHandlerMetadata): void; | ||
| /** | ||
| * Get event handler metadata. | ||
| * | ||
| * @param target The target. | ||
| * @param propertyKey The property key. | ||
| * @returns The get event handler metadata result. | ||
| */ | ||
| export declare function getEventHandlerMetadata(target: object, propertyKey: MetadataPropertyKey): EventHandlerMetadata | undefined; | ||
| /** | ||
| * Get event handler metadata entries. | ||
| * | ||
| * @param target The target. | ||
| * @returns The get event handler metadata entries result. | ||
| */ | ||
| export declare function getEventHandlerMetadataEntries(target: object): Array<{ | ||
@@ -9,3 +29,6 @@ metadata: EventHandlerMetadata; | ||
| }>; | ||
| /** | ||
| * Provides the event bus metadata symbol value. | ||
| */ | ||
| export declare const eventBusMetadataSymbol: symbol; | ||
| //# sourceMappingURL=metadata.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA8BvD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,oBAAoB,GAC7B,IAAI,CAEN;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,GAAG,oBAAoB,GAAG,SAAS,CAS1H;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,GACb,KAAK,CAAC;IAAE,QAAQ,EAAE,oBAAoB,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAW7E;AAED,eAAO,MAAM,sBAAsB,QAAkC,CAAC"} | ||
| {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA8BvD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,oBAAoB,GAC7B,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,GAAG,oBAAoB,GAAG,SAAS,CAS1H;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,GACb,KAAK,CAAC;IAAE,QAAQ,EAAE,oBAAoB,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAW7E;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAkC,CAAC"} |
+27
-0
@@ -21,5 +21,21 @@ import { ensureSymbolMetadataPolyfill, getStandardConstructorMetadataBag } from '@fluojs/core/internal'; | ||
| } | ||
| /** | ||
| * Define event handler metadata. | ||
| * | ||
| * @param target The target. | ||
| * @param propertyKey The property key. | ||
| * @param metadata The metadata. | ||
| */ | ||
| export function defineEventHandlerMetadata(target, propertyKey, metadata) { | ||
| getOrCreateEventHandlerMap(target).set(propertyKey, cloneEventHandlerMetadata(metadata)); | ||
| } | ||
| /** | ||
| * Get event handler metadata. | ||
| * | ||
| * @param target The target. | ||
| * @param propertyKey The property key. | ||
| * @returns The get event handler metadata result. | ||
| */ | ||
| export function getEventHandlerMetadata(target, propertyKey) { | ||
@@ -33,2 +49,9 @@ const stored = eventHandlerMetadataStore.get(target)?.get(propertyKey); | ||
| } | ||
| /** | ||
| * Get event handler metadata entries. | ||
| * | ||
| * @param target The target. | ||
| * @returns The get event handler metadata entries result. | ||
| */ | ||
| export function getEventHandlerMetadataEntries(target) { | ||
@@ -43,2 +66,6 @@ const stored = eventHandlerMetadataStore.get(target) ?? new Map(); | ||
| } | ||
| /** | ||
| * Provides the event bus metadata symbol value. | ||
| */ | ||
| export const eventBusMetadataSymbol = standardEventHandlerMetadataKey; |
+15
-0
| import type { PlatformHealthReport, PlatformReadinessReport, PlatformSnapshot } from '@fluojs/runtime'; | ||
| /** | ||
| * Defines the event bus lifecycle state type. | ||
| */ | ||
| export type EventBusLifecycleState = 'created' | 'discovering' | 'ready' | 'stopping' | 'stopped' | 'failed'; | ||
| /** | ||
| * Describes the event bus status adapter input contract. | ||
| */ | ||
| export interface EventBusStatusAdapterInput { | ||
@@ -13,2 +19,5 @@ handlersDiscovered: number; | ||
| } | ||
| /** | ||
| * Describes the event bus platform status snapshot contract. | ||
| */ | ||
| export interface EventBusPlatformStatusSnapshot { | ||
@@ -20,3 +29,9 @@ readiness: PlatformReadinessReport; | ||
| } | ||
| /** | ||
| * Create event bus platform status snapshot. | ||
| * | ||
| * @param input The input. | ||
| * @returns The create event bus platform status snapshot result. | ||
| */ | ||
| export declare function createEventBusPlatformStatusSnapshot(input: EventBusStatusAdapterInput): EventBusPlatformStatusSnapshot; | ||
| //# sourceMappingURL=status.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvG,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7G,MAAM,WAAW,0BAA0B;IACzC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,sBAAsB,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,wBAAwB,EAAE,MAAM,CAAC;IACjC,0BAA0B,EAAE,MAAM,CAAC;IACnC,sBAAsB,EAAE,OAAO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||
| * Defines the event bus lifecycle state type. | ||
| */ | ||
| /** | ||
| * Describes the event bus status adapter input contract. | ||
| */ | ||
| /** | ||
| * Describes the event bus platform status snapshot contract. | ||
| */ | ||
| function createReadiness(input) { | ||
@@ -75,2 +87,9 @@ if (input.lifecycleState === 'ready' && input.transportSubscribeFailures === 0) { | ||
| } | ||
| /** | ||
| * Create event bus platform status snapshot. | ||
| * | ||
| * @param input The input. | ||
| * @returns The create event bus platform status snapshot result. | ||
| */ | ||
| export function createEventBusPlatformStatusSnapshot(input) { | ||
@@ -77,0 +96,0 @@ return { |
+4
-4
@@ -11,3 +11,3 @@ { | ||
| ], | ||
| "version": "1.0.0-beta.3", | ||
| "version": "1.0.0-beta.4", | ||
| "private": false, | ||
@@ -43,5 +43,5 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@fluojs/core": "^1.0.0-beta.2", | ||
| "@fluojs/di": "^1.0.0-beta.3", | ||
| "@fluojs/runtime": "^1.0.0-beta.3" | ||
| "@fluojs/core": "^1.0.0-beta.4", | ||
| "@fluojs/di": "^1.0.0-beta.6", | ||
| "@fluojs/runtime": "^1.0.0-beta.11" | ||
| }, | ||
@@ -48,0 +48,0 @@ "peerDependencies": { |
+10
-1
@@ -78,2 +78,4 @@ # @fluojs/event-bus | ||
| `publish(event, options?)`는 `signal`, `timeoutMs`, `waitForHandlers`를 지원합니다. `waitForHandlers`의 기본값은 `true`이며, `false`로 설정하면 publish가 즉시 반환되고 timeout bound를 적용하지 않습니다. | ||
| ## 일반적인 패턴 | ||
@@ -106,2 +108,4 @@ | ||
| 핸들러는 imported module의 singleton provider와 controller에서 발견됩니다. 각 핸들러는 격리된 clone payload를 받으며, class inheritance는 `instanceof` 매칭으로 지원됩니다. | ||
| ## 공개 API 개요 | ||
@@ -111,3 +115,3 @@ | ||
| - `EventBusModule.forRoot(...)`: 이벤트 버스 등록을 위한 기본 진입점입니다. | ||
| - `EventBusLifecycleService`: 이벤트를 발행(`publish(event)`)하기 위한 기본 서비스입니다. | ||
| - `EventBusLifecycleService`: 이벤트 발행(`publish(event, options?)`)과 platform status snapshot 생성을 위한 기본 서비스입니다. | ||
| - `@OnEvent(EventClass)`: 특정 메서드를 이벤트 핸들러로 지정하는 데코레이터입니다. | ||
@@ -120,3 +124,6 @@ - `EVENT_BUS`: 발행 facade를 위한 호환성 주입 토큰입니다. | ||
| - `EventBus`, `EventPublishOptions`, `EventBusModuleOptions`, `EventType`: 발행, 기본값, 트랜스포트, 안정적인 이벤트 키를 위한 타입 전용 계약입니다. | ||
| - `EventBusLifecycleState`, `EventBusStatusAdapterInput`, `EventBusPlatformStatusSnapshot`: status snapshot 계약입니다. | ||
| Transport bootstrap은 unique event channel마다 한 번만 subscribe합니다. `eventKey`가 있으면 transport channel 이름을 제어합니다. 잘못된 JSON transport message는 무시됩니다. | ||
| ## 런타임별 및 통합 서브패스 | ||
@@ -139,1 +146,3 @@ | ||
| - `packages/event-bus/src/public-surface.test.ts`: 공개 API 계약 검증 예제. | ||
| - `packages/event-bus/src/status.test.ts`: status snapshot semantic 테스트 예제. | ||
| - `packages/event-bus/src/transports/redis-transport.test.ts`: Redis transport 동작 테스트 예제. |
+10
-1
@@ -78,2 +78,4 @@ # @fluojs/event-bus | ||
| `publish(event, options?)` supports `signal`, `timeoutMs`, and `waitForHandlers`. `waitForHandlers` defaults to `true`; when set to `false`, publishing returns immediately and skips timeout bounds. | ||
| ## Common Patterns | ||
@@ -106,2 +108,4 @@ | ||
| Handlers are discovered from singleton providers and controllers across imported modules. Each handler receives an isolated cloned payload, and class inheritance is supported through `instanceof` matching. | ||
| ## Public API Overview | ||
@@ -111,3 +115,3 @@ | ||
| - `EventBusModule.forRoot(...)`: Main entry point for event bus registration. | ||
| - `EventBusLifecycleService`: Primary service for publishing events (`publish(event)`). | ||
| - `EventBusLifecycleService`: Primary service for publishing events (`publish(event, options?)`) and creating platform status snapshots. | ||
| - `@OnEvent(EventClass)`: Decorator to mark a method as an event handler. | ||
@@ -120,3 +124,6 @@ - `EVENT_BUS`: Compatibility injection token for the publish facade. | ||
| - `EventBus`, `EventPublishOptions`, `EventBusModuleOptions`, `EventType`: Type-only contracts for publishing, defaults, transports, and stable event keys. | ||
| - `EventBusLifecycleState`, `EventBusStatusAdapterInput`, `EventBusPlatformStatusSnapshot`: Status snapshot contracts. | ||
| Transport bootstrap subscribes once per unique event channel. `eventKey` controls the transport channel name when present. Invalid JSON transport messages are ignored. | ||
| ## Runtime-Specific and Integration Subpaths | ||
@@ -139,1 +146,3 @@ | ||
| - `packages/event-bus/src/public-surface.test.ts`: Public API contract verification. | ||
| - `packages/event-bus/src/status.test.ts`: Status snapshot semantics. | ||
| - `packages/event-bus/src/transports/redis-transport.test.ts`: Redis transport behavior. |
67655
5.81%1176
6.91%144
6.67%Updated
Updated