AshPaperPlane.VersionMixin (ash_paper_plane v0.1.0)

Copy Markdown View Source

Mixin for AshPaperTrail version resources, added through the paper_trail block's mixin option.

paper_trail do
  mixin {AshPaperPlane.VersionMixin, :extend,
         [[metadata: true, worker: MyApp.Worker]]}
end

It does two independent things, and a resource asks for either or both. metadata: true adds the attribute and the change that fills it from the action's shared context. A worker adds the change that enqueues a job when the version is created. Neither implies the other.

Options

  • :metadata: true to add the metadata attribute and its change.
  • :metadata_attribute: the attribute's name, defaulting to :metadata.
  • :metadata_public?: whether the attribute is public, defaulting to false.
  • :metadata_keys: the shared context keys to carry, defaulting to [:origin, :causation_id, :correlation_id].
  • :worker: the Oban worker to enqueue when a version is created.
  • :worker_arguments: the version attributes to pass to the worker, defaulting to [:id].