AshWorkflow.Calculations.TransitionTargets (AshWorkflow v0.8.0)

Copy Markdown View Source

Ash calculation that maps each transition of a record's current step to the step it would move the record to, as AshWorkflow.Info.transition_target/3 resolves it.

The keys are the transitions the current step declares, the same list as :available_actions without an actor. The map is not filtered by authorization; load :available_actions with an actor for that.

A transition resolves to nil when no route matches or a route fails to evaluate. A record in an automatic or terminal step gets an empty map.

The calculation loads every field the route conditions reference, including fields on related resources. The transition action does not: it reads the record it is called on, where an unloaded relationship is nil. Call the action on a record with those fields loaded, or the two can disagree.

Routes that read accepted input see none here, since a preview has no input.

Summary

Functions

describe(opts)

Callback implementation for Ash.Resource.Calculation.describe/1.

has_calculate?()

has_expression?()

Callback implementation for Ash.Resource.Calculation.has_expression?/0.

init(opts)

Callback implementation for Ash.Resource.Calculation.init/1.

strict_loads?()

Callback implementation for Ash.Resource.Calculation.strict_loads?/0.