interface Command
Defines a command handler in Eventicle’s CQRS architecture.
Commands encapsulate business operations that change system state and emit domain events. They provide the "C" in CQRS, handling write operations while maintaining strong consistency and business rule enforcement.
I - Input data type for the command O - Output/response type from the command
Key Features: - *\*Business Logic\**: Encapsulates domain operations and invariants - \**Event Generation\**: Produces events representing state changes - \**Type Safety\**: Strongly-typed input/output contracts - \**Transactional\**: Atomic execution with event emission - \**Scalable\*\*: Can be distributed across multiple instances
Properties
execute
The command handler function. The data will be received from the CommandIntent
This may be called concurrently.
This should attempt to modify the system and then emit events to represent the change.
execute: (data: I) => Promise<CommandReturn<O>>;