View Source Ash.Flow.Dsl (ash v2.4.18)

The built in flow DSL.

dsl-documentation

DSL Documentation

index

Index

  • flow
    • argument
  • steps
    • map
      • branch
        • create
        • debug
        • update
        • destroy
        • validate
        • read
        • run_flow
        • custom
      • transaction
        • create
        • debug
        • update
        • destroy
        • validate
        • read
        • run_flow
        • custom
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • transaction
      • branch
        • create
        • debug
        • update
        • destroy
        • validate
        • read
        • run_flow
        • custom
      • map
        • create
        • debug
        • update
        • destroy
        • validate
        • read
        • run_flow
        • custom
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • branch
      • map
        • create
        • debug
        • update
        • destroy
        • validate
        • read
        • run_flow
        • custom
      • transaction
        • create
        • debug
        • update
        • destroy
        • validate
        • read
        • run_flow
        • custom
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • create
    • debug
    • update
    • destroy
    • validate
    • read
    • run_flow
    • custom

docs

Docs

flow

flow

Details about the flow itself, like description and the successful return type.


  • :api - An api to use by default when calling actions

  • :description - A description of the flow

  • :trace_name - The name to use when creating traces. Defaults to the short name.

  • :short_name - A short name to use for the flow. Defaults to the last to parts of the module name, underscored.

  • :returns - The step or step that should constitute the return value.

argument

argument

An argument to be passed into the flow

Examples:

argument :params, :map do
  default %{}
end
argument :retries, :integer do
  allow_nil? false
end
  • :name - Required. The name to use for the argument

  • :type - Required. The type of the argument

  • :default - A default value to use for the argument if not provided

  • :allow_nil? - Whether or not the argument value may be nil The default value is true.

  • :constraints - Constraints to provide to the type when casting the value. See the type's documentation for more information. The default value is [].

steps

steps

The steps to run.

  • map
    • branch
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • transaction
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • create
    • debug
    • update
    • destroy
    • validate
    • read
    • run_flow
    • custom
  • transaction
    • branch
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • map
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • create
    • debug
    • update
    • destroy
    • validate
    • read
    • run_flow
    • custom
  • branch
    • map
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • transaction
      • create
      • debug
      • update
      • destroy
      • validate
      • read
      • run_flow
      • custom
    • create
    • debug
    • update
    • destroy
    • validate
    • read
    • run_flow
    • custom
  • create
  • debug
  • update
  • destroy
  • validate
  • read
  • run_flow
  • custom

Examples:

steps do
  # invokes a create action
  create :create_post, MyApp.Post, :create
end

Imports:


map

map

Runs a set of steps for each item in a provided list.

Examples:

map :create_users, range(1, arg(:count)) do
  output :create_user

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :over - The value to be iterated over. Will be available inside the map step as element(:map_step_name)

  • :output - Which step to use when constructing the output list. Defaults to the last step.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

branch

Runs a set of steps based on a given value.

Examples:

branch :create_users, result(:create_users?) do
  output :create_user

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :condition - A template that must evaluate to true for the branch to be executed.

  • :output - Which step to use as the output. Defaults to the last step.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

transaction

Runs a set of steps in a transaction.

Examples:

transaction :create_users do
  create :create_user, User, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :output - Which step or steps to use when constructing the output. Defaults to the last step.

  • :timeout - A timeout to apply to the transaction.

  • :resource - The Ash resource to use for the transaction.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

transaction

transaction

Runs a set of steps in a transaction.

Examples:

transaction :create_users do
  create :create_user, User, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :output - Which step or steps to use when constructing the output. Defaults to the last step.

  • :timeout - A timeout to apply to the transaction.

  • :resource - The Ash resource to use for the transaction.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

branch

Runs a set of steps based on a given value.

Examples:

branch :create_users, result(:create_users?) do
  output :create_user

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :condition - A template that must evaluate to true for the branch to be executed.

  • :output - Which step to use as the output. Defaults to the last step.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

map

Runs a set of steps for each item in a provided list.

Examples:

map :create_users, range(1, arg(:count)) do
  output :create_user

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :over - The value to be iterated over. Will be available inside the map step as element(:map_step_name)

  • :output - Which step to use when constructing the output list. Defaults to the last step.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

branch

branch

Runs a set of steps based on a given value.

Examples:

branch :create_users, result(:create_users?) do
  output :create_user

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :condition - A template that must evaluate to true for the branch to be executed.

  • :output - Which step to use as the output. Defaults to the last step.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

map

Runs a set of steps for each item in a provided list.

Examples:

map :create_users, range(1, arg(:count)) do
  output :create_user

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :over - The value to be iterated over. Will be available inside the map step as element(:map_step_name)

  • :output - Which step to use when constructing the output list. Defaults to the last step.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

transaction

Runs a set of steps in a transaction.

Examples:

transaction :create_users do
  create :create_user, User, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end

  create :create_user, Org, :create do
    input %{
      first_name: {Faker.Person, :first_name, []},
      last_name: {Faker.Person, :last_name, []}
    }
  end
end
  • :output - Which step or steps to use when constructing the output. Defaults to the last step.

  • :timeout - A timeout to apply to the transaction.

  • :resource - The Ash resource to use for the transaction.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

create

create

Declares a step that will call a create action on a resource.

Examples:

create :create_post, MyApp.Post, :create
  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

debug

debug

Declares a step that will inspect its input and provide additional debug information.

Examples:

debug :show_some_information do
  input %{post: result(:create_post)}
end
  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

update

update

Declares a step that will call a update action on a resource.

Examples:

update :update_post, MyApp.Post, :update do
  record result(:get_post)
end
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

destroy

destroy

Declares a step that will call a destroy action on a resource.

Examples:

destroy :destroy_post, MyApp.Post, :destroy
  • :record - Required. The record to be updated, can use template helpers, e.g result(:step_name).
    If the value is nil, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

validate

validate

Validates some input against an action.

Examples:

validate :update_post, MyApp.Post, :update do
  record result(:get_post)
  only_keys [:name]
end
  • :record - The record to be created/updated/destroyed, if relevant. can use template helpers, e.g result(:step_name).
    If the value is nil and would be required by the action type, the step is skipped and nil is the result of the step. Any other value is used as an input record.

  • :only_keys - If the keys are set, the step will succeed as long as there are no errors for those specific fields. Additionally, only errors for those keys will be returned. Use a list for the key if you want to check for an error at a path, and use :_ to allow anything at that path

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

read

read

Declares a step that will call a read action on a resource.

Examples:

read :destroy_post, MyApp.Post, :destroy
  • :get? - Whether or not read action is expected to return a single result or nil. If the action is configured with get? true then this is automatically set to true. The default value is false.

  • :not_found_error? - Whether or not finding no record should result in a not found error The default value is true.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

  • :resource - Required. The resource to call the action on.

  • :action - Required. The action to call on the resource.

  • :api - The api to use when calling the action. Defaults to the api set in the flow section.

  • :tenant - A tenant to use for the operation. May be a template or a literal value.

  • :input - A template for the input.

run_flow

run_flow

Runs another flow as part of the current flow. The return value of the step is the return value of the flow.

Examples:

run_flow :get_org, GetOrgByName do
  input %{
    name: arg(:org_name)
  }
  • :flow - Required. The flow to run.

  • :input - A template for the input.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.

custom

custom

Runs a custom step module.

See Ash.Flow.Step for the necessary callbacks and more information.

Examples:

custom :do_custom_thing, MyApp.DoCustomThing do
  input %{...}
end
custom :do_custom_thing, {MyApp.DoCustomThing, opt1: :foo, opt2: :bar} do
  input %{...}
end
  • :input - A template for the input.

  • :custom - The module that implements the step behaviour. Also accepts a 2 argument function that takes the input and the context.

  • :async? - Whether or not this step can be run outside of the current process. Defaults to true. The default value is false.

  • :name - Required. The name of the step. Will be used when expressing dependencies, and step inputs.

  • :short_name - Set a short name for the step. Will be used when building things like mermaid charts.

  • :wait_for - Ensures that the step happens after the configured step or steps.
    This value is just a template that isn't used, except to determine dependencies, so you can use it like this wait_for [result(:step_one), result(:step_two)] or wait_for result(:step).

  • :touches_resources - A list of resources touched by any custom logic in this step. This is used in the case that this step is run in a transaction. This is primarily only needed for custom steps.

  • :halt_if - Halts the step by emitting an error (with an Ash.Error.Flow.Halted). Can use template variables.
    To attach a specific reason, use a halt_reason.
    If you need more complex halting logic, then you'd want to use a custom step, and return {:error, Ash.Error.Flow.Halted.exception(...)}

  • :halt_reason - Configures the reason for the halt_if clause. The default value is :halted.

  • :description - A description for the step.