Skip to main content

Interface: ConnectionPlugin

Experimental

Plugin to control the configuration of a connection.

Plugins is an experimental feature; APIs may change without notice.

Accessors​

name​

Get Signature​

get name(): string

Experimental

Gets the name of this plugin.

Returns​

string

Methods​

configureConnection()?​

optional configureConnection(options): ConnectionOptions

Experimental

Hook called when creating a connection to allow modification of configuration.

Parameters​

options​

ConnectionOptions

Returns​

ConnectionOptions


connect()?​

optional connect(options, next): Promise<Connection>

Experimental

Hook that wraps Connection.connect, e.g. to asynchronously modify the options before connecting or to use the connection afterward. Must call next to continue the connection process, and return the connection it returns.

Hooks are called in plugin order, after all configureConnection hooks. Not called by Connection.lazy.

Parameters​

options​

ConnectionOptions

next​

(options) => Promise<Connection>

Returns​

Promise<Connection>