The plugin context

The plugin context is an object containing a set of constructors, accessors and configurations, allowing plugins to interact with Kuzzle.

A plugin context is provided by Kuzzle to plugins when calling their init function.
Each plugin receives its own plugin context instance.

Here is the list of shared objects contained in the provided context:

Attribute pathPurpose
context.accessors.executeAccess to Kuzzle API.
context.accessors.triggerTrigger a custom event.
context.accessors.storageInitiate and configure to the plugin storage. This storage can only be accessed by the plugin and can be used to persist plugin datas.
context.accessors.validationAccess to validation mechanisms, useful to validate documents and add field types.
context.configContains the entire Kuzzle instance configuration (most of it coming from Kuzzle configuration file)
context.constructors.DslConstructor allowing plugins to instantiate their own Kuzzle real-time engine instance
context.constructors.RepositoryConstructor allowing plugins to instantiate their Repositories allowing them to interact with their plugin storage
context.constructors.RequestConstructor for standardized requests sent to Kuzzle
context.constructors.BaseValidationTypeConstructor for the Validation Type base constructor
context.errors.<ErrorConstructor>Kuzzle error constructors, built dynamically from available Kuzzle error objects at runtime
context.log.<level>(message)Provides methods to log messages depending on their priority level