CommitStore

Hierarchy

  • CommitStore

Implements

Index

Methods

Methods

createCommit

createCommit(eventSourceable: EventSourceable): Promise‹Commit

Implementation of CommitStore

Create Commit from event sourceable instance.

async

Parameters:

NameTypeDescription
eventSourceableEventSourceableInstance implementing EventSourceable interface.

Returns: Promise‹Commit

Instance implementing Commit interface.


findById

findById(commitId: string): Promise‹Commit | undefined›

Implementation of CommitStore

Returns commit by commit id.

Parameters:

NameTypeDescription
commitIdstringIdentifier of Commit.

Returns: Promise‹Commit | undefined›

Instance implementing Commit interface, else undefined.


generateId

generateId(): Promise‹string›

Implementation of CommitStore

Generates identifier compatible with commit storage.

async

Returns: Promise‹string›

Identifier for commit compatible with storage implementation.


getAllEvents

getAllEvents(): Promise‹Event[]›

Implementation of CommitStore

Returns events from all existing commits on storage.

async

Returns: Promise‹Event[]›

List of all published Events.


getEvents

getEvents(eventSourceableId: string | Guid, versionOffset?: number): Promise‹Event[]›

Implementation of CommitStore

Returns all events associated with commits that exceeds or are equal to provided version offset.

async

Parameters:

NameTypeDescription
eventSourceableIdstring | GuidIdentifier as string or Guid instance.
versionOffset?numberVersion number from which version events should be returned.

Returns: Promise‹Event[]›

List of all Events associated with resolved commits for version offset.


hasBySourceId

hasBySourceId(eventSourceableId: string | Guid): Promise‹boolean›

Implementation of CommitStore

Evaluates whether event sourceable with id already exists.

async

Parameters:

NameTypeDescription
eventSourceableIdstring | GuidIdentifier as string or Guid instance.

Returns: Promise‹boolean›

Returns true if event sourceable exists, else false.


save

save(commit: Commit): Promise‹string›

Implementation of CommitStore

Adds commit to storage and publishes changes.

async

Parameters:

NameTypeDescription
commitCommitInstance implementing Commit interface.

Returns: Promise‹string›

Identifier of commit on commit storage.