Records domain facts raised by one aggregate during its current operation.
The recorder is local state only: application code decides when durable state is saved, whether pending events are dispatched or persisted, and when they are removed. It never publishes to an event bus itself.
record<T>(event: IDomainEvent<T>): void
Appends an event reference to the pending facts in insertion order.
pending(): readonly IDomainEvent[]
Returns an ordered, read-only snapshot of pending facts.
Mutating a returned array cannot change the recorder.
remove(event: IDomainEvent): boolean
Removes the first pending reference that is strictly equal to event.
Event IDs are not collection identity; duplicate references are valid.
clear(): void
Removes all pending facts.