EventStore
API reference for EventStore
Interface: EventStore<StreamVersion>
Section titled “Interface: EventStore<StreamVersion>”Unified EventStore interface combining the best patterns from all packages
This is the canonical interface for all event store implementations
Type Parameters
Section titled “Type Parameters”StreamVersion
Section titled “StreamVersion”StreamVersion
= StreamPosition
Methods
Section titled “Methods”aggregateStream()
Section titled “aggregateStream()”aggregateStream<
State
,EventType
>(streamId
,options
):Promise
<AggregateStreamResult
<State
,StreamVersion
>>
Aggregate events from a stream to rebuild state
Type Parameters
Section titled “Type Parameters”State
EventType
Section titled “EventType”EventType
extends Readonly
<{ data
: EventData
; metadata?
: PlatformEventMetadata
; type
: string
; }>
Parameters
Section titled “Parameters”streamId
Section titled “streamId”string
options
Section titled “options”AggregateStreamOptions
<State
, EventType
, StreamVersion
>
Returns
Section titled “Returns”Promise
<AggregateStreamResult
<State
, StreamVersion
>>
appendToStream()
Section titled “appendToStream()”appendToStream<
EventType
>(streamId
,events
,options?
):Promise
<AppendToStreamResult
<StreamVersion
>>
Append events to a stream with optimistic concurrency control
Type Parameters
Section titled “Type Parameters”EventType
Section titled “EventType”EventType
extends Readonly
<{ data
: EventData
; metadata?
: PlatformEventMetadata
; type
: string
; }>
Parameters
Section titled “Parameters”streamId
Section titled “streamId”string
events
Section titled “events”EventType
[]
options?
Section titled “options?”AppendToStreamOptions
<StreamVersion
>
Returns
Section titled “Returns”Promise
<AppendToStreamResult
<StreamVersion
>>
queryEvents()
Section titled “queryEvents()”queryEvents<
EventType
>(options?
):Promise
<QueryEventsResult
<EventType
>>
Query events across streams with flexible filtering options
Type Parameters
Section titled “Type Parameters”EventType
Section titled “EventType”EventType
extends Readonly
<{ data
: EventData
; metadata?
: PlatformEventMetadata
; type
: string
; }>
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise
<QueryEventsResult
<EventType
>>
readStream()
Section titled “readStream()”readStream<
EventType
>(streamId
,options?
):Promise
<ReadStreamResult
<EventType
,StreamVersion
>>
Read events from a stream with filtering and pagination
Type Parameters
Section titled “Type Parameters”EventType
Section titled “EventType”EventType
extends Readonly
<{ data
: EventData
; metadata?
: PlatformEventMetadata
; type
: string
; }>
Parameters
Section titled “Parameters”streamId
Section titled “streamId”string
options?
Section titled “options?”ReadStreamOptions
<StreamVersion
>
Returns
Section titled “Returns”Promise
<ReadStreamResult
<EventType
, StreamVersion
>>