AshWorkflow.Transformers.AddCodeInterface (AshWorkflow v0.6.0)

Copy Markdown View Source

Generates code interface definitions for workflow actions.

Adds define entries for each manual step transition — e.g., define :approve, define :reject.

These generate convenience functions on the resource module so callers can use CandidatePipeline.approve(record) instead of Ash.update directly.

Skips definitions that the user has already declared.

When the workflow declares an undo block, also adds define :undo and injects undoable?/2 and undo_target/2 onto the resource module.

Also injects state_at/3 and history/2 directly onto the resource module (via Spark.Dsl.Transformer.eval/3, not the code_interface DSL) when a transition_log is configured. They are plain functions rather than code-interface definitions because state_at/2 resolves in Elixir by walking the log — that has to run the same way on ETS and Postgres, so it can't be expressed as a single generated Ash action.

Summary

Functions

after?(_)

Callback implementation for Spark.Dsl.Transformer.after?/1.

after_compile?()

Callback implementation for Spark.Dsl.Transformer.after_compile?/0.

before?(_)

Callback implementation for Spark.Dsl.Transformer.before?/1.

transform(dsl)

Callback implementation for Spark.Dsl.Transformer.transform/1.