Core
Framework v2.x
2

PluginContextConstructors #

The PluginContextConstructors instance is available through the PluginContext.constructors property.

It contains various classes thats allows to interact with Kuzzle.

BaseValidationType #

Abstract class that allows to define a new custom type for the Data Validation module.

StorageClient #

This constructor instantiates an embedded Elasticsearch client with the same configuration as the one provided in Kuzzle configuration.

This client can be used to send raw Elasticsearch request.

See Elasticsearch official documentation for more information.

Arguments #

This class constructor takes no argument.

Usage #

Copied to clipboard!
const esRequest =  {
  body: {
    name: 'Aschen',
    age: 27
  },
  index: '&nyc-open-data.yellow-taxi',
  op_type: 'create'
}

// Instantiate and use a new client
const storageClient = new app.storage.Client()
await storageClient.index(esRequest)

Koncorde #

Deprecated since 2.8.0

Instantiates a new Koncorde engine.

The Koncorde class should be imported from the kuzzle package.

Copied to clipboard!
import { Koncorde } from 'kuzzle';

Repository #

Instantiates a new Repository.

KuzzleRequest #

Modified KuzzleRequest constructor that allows to instantiate a new KuzzleRequest with the context (user, jwt, connection) of another one.

Arguments #

Copied to clipboard!
KuzzleRequest(originalRequest: KuzzleRequest, requestPayload: RequestPayload, options: JSONObject): KuzzleRequest

Arguments Type Description
originalRequest
KuzzleRequest
Original request of which we will use the context
requestPayload
RequestPayload
New request payload
options
JSONObject
Additional options passed to the RequestContext constructor

Usage #

Copied to clipboard!
const req = new context.constructors.KuzzleRequest(request, {
  controller: 'auth',
  action: 'getCurrentUser'
})

const user = await context.accessors.execute(req) 

StorageClient #

Constructor for Elasticsearch SDK Client.

Usage #

Copied to clipboard!
const esRequest =  {
  body: {
    name: 'Aschen',
    age: 27
  },
  index: '&nyc-open-data.yellow-taxi',
  op_type: 'create'
}

// Instantiate and use a new client
const storageClient = new app.storage.Client()
await storageClient.index(esRequest)