toDomainEventStream
Converts an object to a domain event stream based on a command message.
This extension function creates a DomainEventStream from any object, using information from the upstream command message. The object is flattened into individual events, each converted to a domain event with proper sequencing and metadata.
Receiver
The object containing event data (can be single event, array, or iterable)
Return
A new DomainEventStream containing the converted events
Parameters
The command message that triggered these events
The current version of the aggregate
The owner ID from the current state (default: DEFAULT_OWNER_ID)
The space ID from the current state (default: DEFAULT_SPACE_ID)
The header to propagate to the event stream (default: empty header)
The timestamp for event creation (default: current time)