interface CommandReturn
Standard return type for all command executions in Eventicle.
CommandReturn provides a consistent interface for command results, separating the response data (returned to caller) from domain events (published to streams). This enables clean separation between synchronous API responses and asynchronous event-driven side effects.
T - Type of the response data returned to the caller
Properties
events
Domain events generated during command execution.
These events are automatically published to the command’s configured stream and become part of the permanent event history. Events represent facts about what happened and drive all downstream processing.
events: EventicleEvent[];
response
Optional response data returned to the command caller.
Typically contains generated IDs, confirmation data, or other information needed by the synchronous caller. This data is NOT published as events.
response?: T;
webError
Optional error to throw after event emission.
Allows commands to emit failure events while still signaling errors to callers. The events are published first, then this error is thrown to the caller, enabling both event-driven error handling and traditional exception handling.
webError?: Error;