Triggers

Triggers can be setup to run before and/or after creation, update, and deletion of object instances, as well as before and after session authentications (to allow for custom authentication mechanisms).

class Triggered {

  @trigger('create.before', 'create.after',  {
    name: 'c_object_with_prop',
    active: true,
    principal: 'c_ok',
    environment: 'production',
    weight: 0.7
  })
  check({ memo, context, old, new, dryRun, inline, event, runtime }) {
    console.log('checking')
  }

  @trigger('axon__task.completed.before')
  beforeAxonTaskCompleted( { context } ) {

    return context.read('c_require_this_field_to_be_true') === true

  }

  static bakeMeACake() {

      return true

  }

}

Last updated