Parent
Part of #739
Context
Events currently use class-based metadata:
interface EventMetadata {
readonly class: Class<EventInterface>
}
Events need to be migrated to the data-oriented pattern established by commands.
Proposed Changes
- Create
event() DSL function in packages/core/src/dsl/event.ts
- Update
EventMetadata to use name + entityID function instead of class reference
- Update event dispatching/handling to use new metadata
- Reimplement
@Event decorator as thin wrapper around DSL
- Update reducers that reference events
Design Considerations
- Events are simpler than commands (no authorization, no hooks)
- Events have an
entityID() method that links them to entities — this needs a clean DSL representation
- Reducers reference events by name — ensure compatibility
- Event handlers receive event instances — consider how DSL events work with handlers
Acceptance Criteria
Parent
Part of #739
Context
Events currently use class-based metadata:
Events need to be migrated to the data-oriented pattern established by commands.
Proposed Changes
event()DSL function inpackages/core/src/dsl/event.tsEventMetadatato use name + entityID function instead of class reference@Eventdecorator as thin wrapper around DSLDesign Considerations
entityID()method that links them to entities — this needs a clean DSL representationAcceptance Criteria
event()DSL function created@Eventdecorator reimplemented as wrapper