Skip to content
← Back to Index

OnSkuValidate

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

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

Commands returned from this hook are applied to the sku, but do not re-trigger OnSkuCommands or OnSkuValidate. The hook runs once per message.

Type

filtrera
{
  hook: 'OnSkuValidate'
  before: Sku // The sku before the incoming message commands were applied
  sku: Sku // The sku after OnSkuCommands has run
}

Effects

validationError Reverts the sku 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.
skuCommand Applies a corrective command to the sku. Commands returned from OnSkuValidate do not re-trigger OnSkuCommands or OnSkuValidate.

© 2024 Hantera AB. All rights reserved.