Skip to content
← Back to Index

OnAssetValidate

This hook runs immediately after the OnAssetCommands hook and any commands it returned have been applied to the Asset Actor.

It is the place to enforce invariants that can only be checked once all OnAssetCommands rules have settled, and to either reject the asset with a validationError effect or auto-fix it by emitting more assetCommand effects.

Commands returned from this hook are applied to the asset, but do not re-trigger OnAssetCommands or OnAssetValidate. The hook runs once per message.

Type

filtrera
{
  hook: 'OnAssetValidate'
  before: Asset // The asset before the incoming message commands were applied
  asset: Asset // The asset after OnAssetCommands has run
}

Effects

validationError Reverts the asset state and returns the error to the caller.
messageActor Sends a message to another actor. Responses are ignored.
scheduleJob Schedules a job.
sendEmail Queues an email for delivery through the Sendings system.
assetCommand Applies a corrective command to the asset. Commands returned from OnAssetValidate do not re-trigger OnAssetCommands or OnAssetValidate.

© 2024 Hantera AB. All rights reserved.