Enact.Context (Enact v0.1.0)

Copy Markdown View Source

The per-invocation context threaded through every pipeline step.

  • actor — required, from opts; opaque to Enact (struct, scope, or :anonymous) — only the host app's authorize/1 and fetchers read it
  • subject — filled by the load step: the updated record (patch mode) or the parent anchor (create-under-parent)
  • params — caller params after key stringification (values still raw), kept for presence checks (Enact.provided?/2) and audit
  • repo — the injected repo module
  • mode:create or :patch, from the action's config/0
  • assigns — caller-passed metadata merged with resolver-stashed references (resolver keys win on collision)

Summary

Types

t()

@type t() :: %Enact.Context{
  actor: term(),
  assigns: map(),
  mode: :create | :patch,
  params: map(),
  repo: module(),
  subject: struct() | nil
}