Projection
Type parameters
▪ T: SuperConstructor
▪ T: SuperConstructor
Hierarchy
SuperPrototypeSelector‹StatefulMixin | EventHandlingMixin, this› & StatefulMixin‹this› & EventHandlingMixin‹this›
SuperPrototypeSelector‹StatefulMixin | EventHandlingMixin, this› & StatefulMixin‹this› & EventHandlingMixin‹this›
↳ Projection
Implements
- Stateful
- Controller
- Publisher
- Projection
- Stateful
- Controller
- Publisher
- Projection
Index
Constructors
Properties
Methods
- ensureHandleability
- enterRebuildMode
- exitRebuildMode
- getHandleableTypes
- getHandled
- getHandledCommands
- getHandledEvents
- getHandledMessages
- getHandledTypes
- getHandledTypesNames
- getHandler
- getHandlerOrThrow
- getHandlers
- getProjectionName
- getSelectableStates
- getState
- getSubscribedEvents
- getTypeByHandler
- handle
- handles
- hasHandler
- hasState
- initialize
- invokeAction
- isHandleabe
- isInOneOfStates
- isInState
- on
- overrideHandler
- publish
- registerEventHandler
- registerHandler
- removeHandler
- setHandleableTypes
- setState
- subscribeTo
- subscribes
- validateState
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
: MessageType‹Message›, handleableTypes?
: MessageType‹Message› | MessageType‹Message›[]): boolean
Implementation of Publisher
Inherited from HandlingMixin.ensureHandleability
Overrides CancelingEmployment.ensureHandleability
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handleableTypes? | MessageType‹Message› | MessageType‹Message›[] |
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(): MessageType‹Message›[]
Implementation of Publisher
Inherited from HandlingMixin.getHandleableTypes
Overrides CancelingEmployment.getHandleableTypes
Returns: MessageType‹Message›[]
getHandled
▸ getHandled(messageType
: MessageType‹Message›): MessageType‹Message›[]
Implementation of Publisher
Inherited from HandlingMixin.getHandled
Overrides CancelingEmployment.getHandled
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: MessageType‹Message›[]
getHandledCommands
▸ getHandledCommands(): MessageType‹Command›[]
Inherited from HandlingMixin.getHandledCommands
Overrides CancelingEmployment.getHandledCommands
Returns: MessageType‹Command›[]
getHandledEvents
▸ getHandledEvents(): MessageType‹Event›[]
Inherited from HandlingMixin.getHandledEvents
Overrides CancelingEmployment.getHandledEvents
Returns: MessageType‹Event›[]
getHandledMessages
▸ getHandledMessages(): MessageType‹Message›[]
Inherited from HandlingMixin.getHandledMessages
Overrides CancelingEmployment.getHandledMessages
Returns: MessageType‹Message›[]
getHandledTypes
▸ getHandledTypes(): MessageType‹Message›[]
Implementation of Publisher
Inherited from HandlingMixin.getHandledTypes
Overrides CancelingEmployment.getHandledTypes
Returns: MessageType‹Message›[]
getHandledTypesNames
▸ getHandledTypesNames(): TypeName[]
Inherited from HandlingMixin.getHandledTypesNames
Overrides CancelingEmployment.getHandledTypesNames
Returns: TypeName[]
getHandler
▸ getHandler(messageType
: MessageType‹Message›): Handler[] | undefined
Implementation of Publisher
Inherited from OneToManyHandlingMixin.getHandler
Overrides void
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: Handler[] | undefined
getHandlerOrThrow
▸ getHandlerOrThrow(messageType
: MessageType‹Message›): Handler[]
Implementation of Publisher
Inherited from OneToManyHandlingMixin.getHandlerOrThrow
Overrides void
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: Handler[]
getHandlers
▸ getHandlers(): Map‹MessageType‹Message›, Handler | Handler[]›
Implementation of Publisher
Inherited from HandlingMixin.getHandlers
Overrides CancelingEmployment.getHandlers
Returns: Map‹MessageType‹Message›, 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
Returns: State
getSubscribedEvents
▸ getSubscribedEvents(): MessageType‹Event›[]
Inherited from EventHandlingMixin.getSubscribedEvents
Overrides void
Returns: MessageType‹Event›[]
getTypeByHandler
▸ getTypeByHandler(handlerReference
: Handler): any | undefined
Inherited from OneToManyHandlingMixin.getTypeByHandler
Overrides void
Parameters:
Name | Type |
---|---|
handlerReference | Handler |
Returns: any | undefined
handle
▸ handle(message
: Message, execution?
: Execution): Promise‹void›
Implementation of Publisher
Inherited from OneToManyHandlingMixin.handle
Overrides void
Parameters:
Name | Type |
---|---|
message | Message |
execution? | Execution |
Returns: Promise‹void›
handles
▸ handles(): Map‹MessageType‹Command›, Handler›
Implementation of Publisher
Inherited from HandlingMixin.handles
Overrides CancelingEmployment.handles
Returns: Map‹MessageType‹Command›, Handler›
hasHandler
▸ hasHandler(messageType
: MessageType‹Message›): boolean
Implementation of Publisher
Inherited from HandlingMixin.hasHandler
Overrides CancelingEmployment.hasHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: boolean
hasState
▸ hasState(): boolean
Implementation of Stateful
Inherited from StatefulMixin.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:
Name | Type | Description |
---|---|---|
actionName | string | Name of action(function) to run. |
Returns: Promise‹void›
isHandleabe
▸ isHandleabe(messageType
: MessageType‹Message›, handleableTypes?
: MessageType‹Message› | MessageType‹Message›[]): boolean
Inherited from HandlingMixin.isHandleabe
Overrides CancelingEmployment.isHandleabe
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handleableTypes? | MessageType‹Message› | MessageType‹Message›[] |
Returns: boolean
isInOneOfStates
▸ isInOneOfStates(states
: State | State[]): boolean
Implementation of Stateful
Inherited from StatefulMixin.isInOneOfStates
Overrides Task.isInOneOfStates
Parameters:
Name | Type |
---|---|
states | State | State[] |
Returns: boolean
isInState
▸ isInState(state
: State | State[]): boolean
Implementation of Stateful
Inherited from StatefulMixin.isInState
Parameters:
Name | Type |
---|---|
state | State | State[] |
Returns: boolean
on
▸ on(event
: Event, isRebuildEvent?
: boolean): Promise‹void›
Implementation of Projection
Overrides EventHandlingMixin.on
Handles instance of an event.
async
Parameters:
Name | Type | Description |
---|---|---|
event | Event | Instance implementing Event interface. |
isRebuildEvent? | boolean | Flag indicating that event is published for rebuilding projection. |
Returns: Promise‹void›
overrideHandler
▸ overrideHandler(messageType
: MessageType‹Message›, handler
: Handler): void
Implementation of Publisher
Inherited from HandlingMixin.overrideHandler
Overrides CancelingEmployment.overrideHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handler | Handler |
Returns: void
publish
▸ publish(event
: Event): Promise‹void›
Implementation of Publisher
Inherited from EventHandlingMixin.publish
Overrides void
Parameters:
Name | Type |
---|---|
event | Event |
Returns: Promise‹void›
registerEventHandler
▸ registerEventHandler(eventType
: MessageType‹Event›, handler
: Handler, shouldOverride?
: boolean): void
Inherited from EventHandlingMixin.registerEventHandler
Overrides void
Parameters:
Name | Type |
---|---|
eventType | MessageType‹Event› |
handler | Handler |
shouldOverride? | boolean |
Returns: void
registerHandler
▸ registerHandler(messageType
: MessageType‹Message›, handler
: Handler, shouldOverride?
: boolean): void
Implementation of Publisher
Inherited from OneToManyHandlingMixin.registerHandler
Overrides HandlingMixin.registerHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
handler | Handler |
shouldOverride? | boolean |
Returns: void
removeHandler
▸ removeHandler(messageType
: MessageType‹Message›): void
Implementation of Publisher
Inherited from HandlingMixin.removeHandler
Overrides CancelingEmployment.removeHandler
Parameters:
Name | Type |
---|---|
messageType | MessageType‹Message› |
Returns: void
setHandleableTypes
▸ setHandleableTypes(handleableTypes
: MessageType‹Message› | MessageType‹Message›[]): void
Implementation of Publisher
Inherited from HandlingMixin.setHandleableTypes
Overrides CancelingEmployment.setHandleableTypes
Parameters:
Name | Type |
---|---|
handleableTypes | MessageType‹Message› | MessageType‹Message›[] |
Returns: void
setState
▸ setState(state
: State): void
Implementation of Stateful
Inherited from StatefulMixin.setState
Parameters:
Name | Type |
---|---|
state | State |
Returns: void
subscribeTo
▸ subscribeTo(eventType
: MessageType‹Event›, handler
: Handler, shouldOverride?
: boolean): void
Inherited from EventHandlingMixin.subscribeTo
Overrides void
Parameters:
Name | Type |
---|---|
eventType | MessageType‹Event› |
handler | Handler |
shouldOverride? | boolean |
Returns: void
subscribes
▸ subscribes(): Map‹MessageType‹Event›, Handler›
Implementation of Publisher
Inherited from HandlingMixin.subscribes
Overrides CancelingEmployment.subscribes
Returns: Map‹MessageType‹Event›, Handler›
validateState
▸ validateState(stateOrStates
: State | State[], error?
: Error): boolean
Implementation of Stateful
Inherited from StatefulMixin.validateState
Overrides Task.validateState
Parameters:
Name | Type |
---|---|
stateOrStates | State | State[] |
error? | Error |
Returns: boolean
Object literals
Static
STATES
▪ STATES: object
projecting
• projecting: string = "projecting"
rebuilding
• rebuilding: string = "rebuilding"