IAggregateRoot
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:28
The event-buffering contract of an aggregate root, matching NestJS CQRS 12’s
IAggregateRoot, so an aggregate built on either class satisfies it.
A dispatcher context is any value the publisher understands, such as
{ transaction }; undefined lets the publisher choose its default.
Type Parameters
Section titled “Type Parameters”EventBase
Section titled “EventBase”EventBase extends IEvent = IEvent
Properties
Section titled “Properties”autoCommit
Section titled “autoCommit”autoCommit:
boolean
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:30
When true, apply() publishes each event at once instead of buffering it.
Methods
Section titled “Methods”apply()
Section titled “apply()”Call Signature
Section titled “Call Signature”apply<
T>(event,isFromHistory?):void
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:49
Type Parameters
Section titled “Type Parameters”T extends IEvent = EventBase
Parameters
Section titled “Parameters”T
isFromHistory?
Section titled “isFromHistory?”boolean
Returns
Section titled “Returns”void
Call Signature
Section titled “Call Signature”apply<
T>(event,options?):void
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:53
Type Parameters
Section titled “Type Parameters”T extends IEvent = EventBase
Parameters
Section titled “Parameters”T
options?
Section titled “options?”Returns
Section titled “Returns”void
commit()
Section titled “commit()”commit(
dispatcherContext?):unknown
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:45
Hands the buffered events to publishAll() and clears the buffer once it
returns, before an asynchronous publisher settles; returns its result.
Parameters
Section titled “Parameters”dispatcherContext?
Section titled “dispatcherContext?”unknown
Returns
Section titled “Returns”unknown
getUncommittedEvents()
Section titled “getUncommittedEvents()”getUncommittedEvents():
EventBase[]
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:47
Returns
Section titled “Returns”EventBase[]
loadFromHistory()
Section titled “loadFromHistory()”loadFromHistory(
history):void
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:48
Parameters
Section titled “Parameters”history
Section titled “history”EventBase[]
Returns
Section titled “Returns”void
publish()
Section titled “publish()”publish<
T>(event,dispatcherContext?):unknown
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:32
Returns what the connected publisher returns, or undefined when none is.
Type Parameters
Section titled “Type Parameters”T extends IEvent = EventBase
Parameters
Section titled “Parameters”T
dispatcherContext?
Section titled “dispatcherContext?”unknown
Returns
Section titled “Returns”unknown
publishAll()
Section titled “publishAll()”publishAll<
T>(events,dispatcherContext?):unknown
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:37
Returns what the connected publisher returns, or undefined when none is.
Type Parameters
Section titled “Type Parameters”T extends IEvent = EventBase
Parameters
Section titled “Parameters”events
Section titled “events”T[]
dispatcherContext?
Section titled “dispatcherContext?”unknown
Returns
Section titled “Returns”unknown
uncommit()
Section titled “uncommit()”uncommit():
void
Defined in: packages/ddd-core/domain/interfaces/aggregate-root.interface.ts:46
Returns
Section titled “Returns”void