Skip to main content

Class: DataPlugin

A plugin for integrating Data persistence into the application.

Extends​

Constructors​

Constructor​

new DataPlugin(logger, injector): DataPlugin

Parameters​

logger​

Logger

injector​

Injector

Returns​

DataPlugin

Overrides​

Plugin.constructor

Properties​

options​

protected options: DataPluginOptions

Overrides​

Plugin.options


state​

protected state: PluginLifecycle

Inherited from​

Plugin.state


stateError?​

protected optional stateError?: Error

Inherited from​

Plugin.stateError


dependencies?​

readonly static optional dependencies?: (PluginType<Plugin> | { optional: boolean; plugin: PluginType; })[]

Inherited from​

Plugin.dependencies

Methods​

getState()​

getState(): PluginLifecycle

Retrieves the current lifecycle state of the plugin.

Returns​

PluginLifecycle

The current lifecycle state of the plugin.

Inherited from​

Plugin.getState


getStateError()​

getStateError(): Error | undefined

Retrieves the error state of the plugin, if any.

Returns​

Error | undefined

The error that caused the plugin to enter the error state, or undefined if no error occurred.

Inherited from​

Plugin.getStateError


onRegister()​

onRegister(context, options?): Promise<void>

Initializes data sources and registers each decorated repository with the application container.

Parameters​

context​

AxiSparkContext

Application context whose container receives the data sources and repositories.

options?​

DataPluginOptions

Data plugin configuration with one or more named TypeORM sources.

Returns​

Promise<void>

Overrides​

Plugin.onRegister


onStart()​

onStart(): Promise<void>

Logs that the Data plugin has started.

Returns​

Promise<void>

Overrides​

Plugin.onStart


onStop()​

onStop(): Promise<void>

Closes every TypeORM data source created by this plugin.

Returns​

Promise<void>

Overrides​

Plugin.onStop


setState()​

setState(state): void

Sets the lifecycle state of the plugin.

Parameters​

state​

PluginLifecycle

The new lifecycle state of the plugin.

Returns​

void

Inherited from​

Plugin.setState


setStateError()​

setStateError(error): void

Sets the error state of the plugin.

Parameters​

error​

Error

The error that caused the plugin to enter the error state.

Returns​

void

Inherited from​

Plugin.setStateError