Official Plugins (Kuzzle v2.x)
Device Manager v0.x
2

Hooks #

Hooks allow to modify the processing of a payload and its propagation into the associated collections.

beforeProcessing #

Lifecycle hook executed before processing the payload but after validation


async beforeProcessing (payload: JSONObject, request: KuzzleRequest): Promise<void>

ArgumentsTypeDescription
payload
JSONObject
Raw payload received in the API action body
request
KuzzleRequest
Original request

beforeRegister #

Lifecycle hook executed before a device is registered


async beforeRegister (device: Device, request: KuzzleRequest): Promise<Device>

ArgumentsTypeDescription
device
Device
Device before being persisted
request
KuzzleRequest
Original request

Returns #

Returns the enriched device document.

beforeUpdate #

Lifecycle hook executed before a device is updated


async beforeUpdate (device: Device, request: KuzzleRequest): Promise<Device>

ArgumentsTypeDescription
device
Device
Device before being updated
request
KuzzleRequest
Original request

Returns #

Returns the enriched device document.

afterRegister #

Hook executed after registering a device. The value returned by this method will be used as the API action result.

By default, the device document content is returned.


async afterRegister (device: Device, request: KuzzleRequest): Promise<Device>

ArgumentsTypeDescription
device
Device
Device after being persisted
request
KuzzleRequest
Original request

Returns #

Result of the corresponding API action.

afterUpdate #

Hook executed after updating a device. The value returned by this method will be used as the API action result.

By default, the device document content is returned.


async afterUpdate (device: Device, request: KuzzleRequest): Promise<Device>

ArgumentsTypeDescription
device
Device
Device after being persisted
request
KuzzleRequest
Original request

Returns #

Result of the corresponding API action.