Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Aggregate

Hierarchy

  • Aggregate

Index

Constructors

constructor

Properties

Protected Optional commitInFlight

commitInFlight: Commit

eventStore

eventStore: EventStore

Protected internalState

internalState: InternalState

key

Optional snapshotStore

snapshotStore: SnapshotStore

Optional timestamp

timestamp: Timestamp

type

version

version: number = 0

Static chronologicalGroup

chronologicalGroup: string = "default"

Which chronological group to place commits in

Static eventStore

eventStore: EventStore

The store to use for instances of this aggregate class.

Static Optional keySchema

keySchema: KeySchema

For multi-instance aggregates, a schema defining how to construct an aggregate key from props.

Static lazyTransformation

lazyTransformation: boolean = false

Whether to perform in-place store transformation of upcasted commits

Static Protected singletonKeyString

singletonKeyString: AggregateKey = "@"

Static Optional snapshotStore

snapshotStore: SnapshotStore

The SnapshotStore to use for instances of this aggregate class.

Static snapshotsFrequency

snapshotsFrequency: number

Snapshots will be written when aggregate version is a multiple of snapshotsFrequency

Static Optional upcasters

Event upcasters to use for this aggregate

Accessors

state

  • get state(): any

Static snapshotCompatChecksum

  • get snapshotCompatChecksum(): string
  • Calculates and returns checksum based on store upcasters and code compatibility

    Returns string

Methods

commit

Protected convertFromInternalState

  • convertFromInternalState(internalState: any): object

Protected convertToInternalState

  • convertToInternalState(obj: object): any

create

  • create(...args: any[]): Promise<Commit>

executeCommand

  • executeCommand(params: object, ...commandArgs: any[]): Promise<any>
  • Execute command with hydrate+retry on VersionConflictError

    Parameters

    • params: object
      • name: string
      • Optional retryConfig?: Partial<RetryConfig>
    • Rest ...commandArgs: any[]

    Returns Promise<any>

hydrate

processCommit

  • processCommit(commit: Commit): Promise<void>

reset

  • reset(): void

toJSON

  • toJSON(): object
  • Returns object

    • key: string
    • state: any
    • timestamp: undefined | number
    • type: string
    • version: number

writeSnapshot

  • writeSnapshot(): Promise<void>

Static commit

Static Private commitEvents

Static create

  • create<T>(this: AggregateStatic<T>, props?: object): Promise<T>

Static getState

Static load

Static loadOrCreate

  • loadOrCreate<T>(this: AggregateStatic<T>, props: object): Promise<T>

Static scanInstances

  • scanInstances<T>(this: AggregateStatic<T>, options?: object): AsyncIterableIterator<T>
  • Type parameters

    Parameters

    • this: AggregateStatic<T>
    • Default value options: object = {}
      • Optional limit?: undefined | number

    Returns AsyncIterableIterator<T>

Static Protected stateReducer

Static Protected upcastCommits

  • upcastCommits(commits: AsyncIterableIterator<Commit>): AsyncIterableIterator<Commit>

Object literals

Static defaultRetryOptions

defaultRetryOptions: object

backoffExponent

backoffExponent: number = 2

initialDelay

initialDelay: number = 1

maxDelay

maxDelay: number = 250

timeout

timeout: number = 10000

Generated using TypeDoc