App

Type parameters

T: SuperConstructor

T: SuperConstructor

Hierarchy

BaseApp

  • BaseApp

    App

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new App(props?: ModuleProps & object): App

Overrides BaseApp.constructor

Creates an instance of App. Creates an instance of App.

Parameters:

NameTypeDescription
props?ModuleProps & objectProperties for App.

Returns: App

Properties

Optional app

app? : BaseApp

Inherited from Module.app

Overrides void


config

config: AppConfig

Implementation of BaseApp.config

Overrides BaseApp.config


Readonly envFilePath

envFilePath: string


injector

injector: Injector

Implementation of BaseApp.injector

Overrides BaseApp.injector


log

log: Logger

Overrides BaseApp.log


modules

modules: Module[]

Overrides BaseApp.modules


state

state: State

Implementation of BaseApp.state

Inherited from StatefulMixin.state

Overrides void


Static STATES

STATES: typeof STATES

Inherited from Module.STATES

Overrides void

Methods

afterShutdown

afterShutdown(): Promise‹void›

Inherited from BaseApp.afterShutdown

Overrides void

Returns: Promise‹void›


configure

configure(props: ConfigProps): void

Inherited from BaseApp.configure

Overrides void

Parameters:

NameType
propsConfigProps

Returns: void


debug

debug(): void

Inherited from BaseApp.debug

Overrides void

Returns: void


getSelectableStates

getSelectableStates(): Record‹string, State

Implementation of BaseApp

Inherited from StatefulMixin.getSelectableStates

Overrides Task.getSelectableStates

Returns: Record‹string, State


getState

getState(): State

Implementation of BaseApp

Inherited from StatefulMixin.getState

Overrides Task.getState

Returns: State


hasState

hasState(): boolean

Implementation of BaseApp

Inherited from StatefulMixin.hasState

Overrides Task.hasState

Returns: boolean


initialize

initialize(): Promise‹void›

Implementation of BaseApp

Inherited from BaseApp.initialize

Overrides Module.initialize

Returns: Promise‹void›


invokeAction

invokeAction(actionName: string, options?: ActionInvokingOptions): Promise‹void›

Implementation of BaseApp

Inherited from Module.invokeAction

Overrides void

Parameters:

NameType
actionNamestring
options?ActionInvokingOptions

Returns: Promise‹void›


isCommandScheduling

isCommandScheduling(): boolean

Evaluates if application has CommandScheduler enabled.

Returns: boolean

Returns true if command scheduling is enabled on application, else false.


isInDevelopment

isInDevelopment(): boolean

Inherited from Module.isInDevelopment

Overrides void

Returns: boolean


isInOneOfStates

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

Implementation of BaseApp

Inherited from StatefulMixin.isInOneOfStates

Overrides Task.isInOneOfStates

Parameters:

NameType
statesState | State[]

Returns: boolean


isInProduction

isInProduction(): boolean

Overrides Module.isInProduction

Evaluates if app is running on production.

Returns: boolean

Returns true if application is running on production environment, else false.


isInState

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

Implementation of BaseApp

Inherited from StatefulMixin.isInState

Overrides Task.isInState

Parameters:

NameType
stateState | State[]

Returns: boolean


isSnapshotting

isSnapshotting(): boolean

Evaluates if application has Snapshotter enabled.

Returns: boolean

Returns true if snapshotting is enabled on application, else fal`se.


onProcessSignal

onProcessSignal(code: NodeJS.Signals): Promise‹void›

On process signal hook for graceful shutdown.

async

Parameters:

NameTypeDescription
codeNodeJS.SignalsNode's signal process code.

Returns: Promise‹void›


publish

publish(event: Event): Promise‹void›

Publishes event through EventBus.

async

Parameters:

NameTypeDescription
eventEventInstance implementing Event interface.

Returns: Promise‹void›


reset

reset(): Promise‹void›

Implementation of BaseApp

Inherited from Module.reset

Overrides void

Returns: Promise‹void›


send

send(command: Command): Promise‹any›

Sends command through CommandBus.

async

throws {HandlerNotFoundError} Thrown if handler for message type is not found.

Parameters:

NameTypeDescription
commandCommandInstance implementing Command interface.

Returns: Promise‹any›

Result of handling command.


setState

setState(state: State): void

Implementation of BaseApp

Inherited from StatefulMixin.setState

Overrides Task.setState

Parameters:

NameType
stateState

Returns: void


shutdown

shutdown(): Promise‹void›

Implementation of BaseApp

Inherited from BaseApp.shutdown

Overrides Module.shutdown

Returns: Promise‹void›


start

start(): Promise‹void›

Implementation of BaseApp

Inherited from Module.start

Overrides void

Returns: Promise‹void›


stop

stop(): Promise‹void›

Implementation of BaseApp

Inherited from Module.stop

Overrides void

Returns: Promise‹void›


subscribeTo

subscribeTo(eventType: MessageTypeEvent›, handler: Handler): Promise‹void›

Subscribes to event type with handler.

async

Parameters:

NameTypeDescription
eventTypeMessageTypeEvent-
handlerHandlerHandler function that will executed upon published Event.

Returns: Promise‹void›


validateState

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

Implementation of BaseApp

Inherited from StatefulMixin.validateState

Overrides Task.validateState

Parameters:

NameType
stateOrStatesState | State[]
error?Error

Returns: boolean