Kuzzle
Documentation
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


Copied to clipboard!
async beforeProcessing (payload: JSONObject, request: KuzzleRequest): Promise<void>

Arguments Type Description
payload
JSONObject
Raw payload received in the API action body
request
KuzzleRequest
Original request

beforeRegister #

Lifecycle hook executed before a device is registered


Copied to clipboard!
async beforeRegister (device: Device, request: KuzzleRequest): Promise<Device>

Arguments Type Description
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


Copied to clipboard!
async beforeUpdate (device: Device, request: KuzzleRequest): Promise<Device>

Arguments Type Description
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.


Copied to clipboard!
async afterRegister (device: Device, request: KuzzleRequest): Promise<Device>

Arguments Type Description
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.


Copied to clipboard!
async afterUpdate (device: Device, request: KuzzleRequest): Promise<Device>

Arguments Type Description
device
Device
Device after being persisted
request
KuzzleRequest
Original request

Returns #

Result of the corresponding API action.