Projection

Type parameters

T: SuperConstructor

T: SuperConstructor

Hierarchy

Implements

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

+ new Projection(): Projection

Overrides HandlingMixin.constructor

Creates an instance of Projection. Creates an instance of Projection.

Returns: Projection

Properties

eventBus

eventBus: EventBus

Overrides EventHandlingMixin.eventBus


state

state: State

Implementation of Stateful.state

Inherited from StatefulMixin.state

Overrides void

Methods

ensureHandleability

ensureHandleability(messageType: MessageTypeMessage›, handleableTypes?: MessageTypeMessage› | MessageTypeMessage›[]): boolean

Implementation of Publisher

Inherited from HandlingMixin.ensureHandleability

Overrides CancelingEmployment.ensureHandleability

Parameters:

NameType
messageTypeMessageTypeMessage
handleableTypes?MessageTypeMessage› | MessageTypeMessage›[]

Returns: boolean


enterRebuildMode

enterRebuildMode(): Promise‹void›

Implementation of Projection

Enters to rebuilding mode on projection.

async

throws {ProjectionAlreadyRebuildingError} Thrown if the projection is already in rebuilding mode.

Returns: Promise‹void›


exitRebuildMode

exitRebuildMode(): Promise‹void›

Implementation of Projection

Exits from rebuilding mode on projection.

async

throws {ProjectionNotRebuildingError} Thrown if the projection is not in rebuilding mode.

Returns: Promise‹void›


getHandleableTypes

getHandleableTypes(): MessageTypeMessage›[]

Implementation of Publisher

Inherited from HandlingMixin.getHandleableTypes

Overrides CancelingEmployment.getHandleableTypes

Returns: MessageTypeMessage›[]


getHandled

getHandled(messageType: MessageTypeMessage›): MessageTypeMessage›[]

Implementation of Publisher

Inherited from HandlingMixin.getHandled

Overrides CancelingEmployment.getHandled

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: MessageTypeMessage›[]


getHandledCommands

getHandledCommands(): MessageTypeCommand›[]

Inherited from HandlingMixin.getHandledCommands

Overrides CancelingEmployment.getHandledCommands

Returns: MessageTypeCommand›[]


getHandledEvents

getHandledEvents(): MessageTypeEvent›[]

Inherited from HandlingMixin.getHandledEvents

Overrides CancelingEmployment.getHandledEvents

Returns: MessageTypeEvent›[]


getHandledMessages

getHandledMessages(): MessageTypeMessage›[]

Inherited from HandlingMixin.getHandledMessages

Overrides CancelingEmployment.getHandledMessages

Returns: MessageTypeMessage›[]


getHandledTypes

getHandledTypes(): MessageTypeMessage›[]

Implementation of Publisher

Inherited from HandlingMixin.getHandledTypes

Overrides CancelingEmployment.getHandledTypes

Returns: MessageTypeMessage›[]


getHandledTypesNames

getHandledTypesNames(): TypeName[]

Inherited from HandlingMixin.getHandledTypesNames

Overrides CancelingEmployment.getHandledTypesNames

Returns: TypeName[]


getHandler

getHandler(messageType: MessageTypeMessage›): Handler[] | undefined

Implementation of Publisher

Inherited from OneToManyHandlingMixin.getHandler

Overrides void

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: Handler[] | undefined


getHandlerOrThrow

getHandlerOrThrow(messageType: MessageTypeMessage›): Handler[]

Implementation of Publisher

Inherited from OneToManyHandlingMixin.getHandlerOrThrow

Overrides void

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: Handler[]


getHandlers

getHandlers(): Map‹MessageTypeMessage›, Handler | Handler[]›

Implementation of Publisher

Inherited from HandlingMixin.getHandlers

Overrides CancelingEmployment.getHandlers

Returns: Map‹MessageTypeMessage›, Handler | Handler[]›


getProjectionName

getProjectionName(): string

Implementation of Projection

Returns projection name.

Returns: string

Projection name as a constructor name.


getSelectableStates

getSelectableStates(): Record‹string, State

Implementation of Stateful

Inherited from StatefulMixin.getSelectableStates

Overrides Task.getSelectableStates

Returns: Record‹string, State


getState

getState(): State

Implementation of Stateful

Inherited from StatefulMixin.getState

Overrides Task.getState

Returns: State


getSubscribedEvents

getSubscribedEvents(): MessageTypeEvent›[]

Inherited from EventHandlingMixin.getSubscribedEvents

Overrides void

Returns: MessageTypeEvent›[]


getTypeByHandler

getTypeByHandler(handlerReference: Handler): any | undefined

Inherited from OneToManyHandlingMixin.getTypeByHandler

Overrides void

Parameters:

NameType
handlerReferenceHandler

Returns: any | undefined


handle

handle(message: Message, execution?: Execution): Promise‹void›

Implementation of Publisher

Inherited from OneToManyHandlingMixin.handle

Overrides void

Parameters:

NameType
messageMessage
execution?Execution

Returns: Promise‹void›


handles

handles(): Map‹MessageTypeCommand›, Handler

Implementation of Publisher

Inherited from HandlingMixin.handles

Overrides CancelingEmployment.handles

Returns: Map‹MessageTypeCommand›, Handler


hasHandler

hasHandler(messageType: MessageTypeMessage›): boolean

Implementation of Publisher

Inherited from HandlingMixin.hasHandler

Overrides CancelingEmployment.hasHandler

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: boolean


hasState

hasState(): boolean

Implementation of Stateful

Inherited from StatefulMixin.hasState

Overrides Task.hasState

Returns: boolean


initialize

initialize(): void

Implementation of Publisher

Overrides EventHandlingMixin.initialize

Initializes Projection.

Returns: void


invokeAction

invokeAction(actionName: string): Promise‹void›

Implementation of Projection

Runs action on projection if developer-action is defined. For ProjectionRebuilder define methods on projection: beforeRebuild() - On before rebuild hook used for saving state in case rebuilding cant be completed(rollback). commit() - Commits to current state of projection. rollback() - Rollbacks to previous(before rebuilding) state of projection.

async

Parameters:

NameTypeDescription
actionNamestringName of action(function) to run.

Returns: Promise‹void›


isHandleabe

isHandleabe(messageType: MessageTypeMessage›, handleableTypes?: MessageTypeMessage› | MessageTypeMessage›[]): boolean

Inherited from HandlingMixin.isHandleabe

Overrides CancelingEmployment.isHandleabe

Parameters:

NameType
messageTypeMessageTypeMessage
handleableTypes?MessageTypeMessage› | MessageTypeMessage›[]

Returns: boolean


isInOneOfStates

isInOneOfStates(states: State | State[]): boolean

Implementation of Stateful

Inherited from StatefulMixin.isInOneOfStates

Overrides Task.isInOneOfStates

Parameters:

NameType
statesState | State[]

Returns: boolean


isInState

isInState(state: State | State[]): boolean

Implementation of Stateful

Inherited from StatefulMixin.isInState

Overrides Task.isInState

Parameters:

NameType
stateState | State[]

Returns: boolean


on

on(event: Event, isRebuildEvent?: boolean): Promise‹void›

Implementation of Projection

Overrides EventHandlingMixin.on

Handles instance of an event.

async

Parameters:

NameTypeDescription
eventEventInstance implementing Event interface.
isRebuildEvent?booleanFlag indicating that event is published for rebuilding projection.

Returns: Promise‹void›


overrideHandler

overrideHandler(messageType: MessageTypeMessage›, handler: Handler): void

Implementation of Publisher

Inherited from HandlingMixin.overrideHandler

Overrides CancelingEmployment.overrideHandler

Parameters:

NameType
messageTypeMessageTypeMessage
handlerHandler

Returns: void


publish

publish(event: Event): Promise‹void›

Implementation of Publisher

Inherited from EventHandlingMixin.publish

Overrides void

Parameters:

NameType
eventEvent

Returns: Promise‹void›


registerEventHandler

registerEventHandler(eventType: MessageTypeEvent›, handler: Handler, shouldOverride?: boolean): void

Inherited from EventHandlingMixin.registerEventHandler

Overrides void

Parameters:

NameType
eventTypeMessageTypeEvent
handlerHandler
shouldOverride?boolean

Returns: void


registerHandler

registerHandler(messageType: MessageTypeMessage›, handler: Handler, shouldOverride?: boolean): void

Implementation of Publisher

Inherited from OneToManyHandlingMixin.registerHandler

Overrides HandlingMixin.registerHandler

Parameters:

NameType
messageTypeMessageTypeMessage
handlerHandler
shouldOverride?boolean

Returns: void


removeHandler

removeHandler(messageType: MessageTypeMessage›): void

Implementation of Publisher

Inherited from HandlingMixin.removeHandler

Overrides CancelingEmployment.removeHandler

Parameters:

NameType
messageTypeMessageTypeMessage

Returns: void


setHandleableTypes

setHandleableTypes(handleableTypes: MessageTypeMessage› | MessageTypeMessage›[]): void

Implementation of Publisher

Inherited from HandlingMixin.setHandleableTypes

Overrides CancelingEmployment.setHandleableTypes

Parameters:

NameType
handleableTypesMessageTypeMessage› | MessageTypeMessage›[]

Returns: void


setState

setState(state: State): void

Implementation of Stateful

Inherited from StatefulMixin.setState

Overrides Task.setState

Parameters:

NameType
stateState

Returns: void


subscribeTo

subscribeTo(eventType: MessageTypeEvent›, handler: Handler, shouldOverride?: boolean): void

Inherited from EventHandlingMixin.subscribeTo

Overrides void

Parameters:

NameType
eventTypeMessageTypeEvent
handlerHandler
shouldOverride?boolean

Returns: void


subscribes

subscribes(): Map‹MessageTypeEvent›, Handler

Implementation of Publisher

Inherited from HandlingMixin.subscribes

Overrides CancelingEmployment.subscribes

Returns: Map‹MessageTypeEvent›, Handler


validateState

validateState(stateOrStates: State | State[], error?: Error): boolean

Implementation of Stateful

Inherited from StatefulMixin.validateState

Overrides Task.validateState

Parameters:

NameType
stateOrStatesState | State[]
error?Error

Returns: boolean

Object literals

Static STATES

STATES: object

projecting

projecting: string = "projecting"

rebuilding

rebuilding: string = "rebuilding"