The event catalog read surface: the outbound DSL's declared metadata —
each event type's description, payload schema, and version — read back
for event pickers, doc generation, and payload-version negotiation.
webhooks do
outbound :order_paid do
description "An order reached the paid state."
payload_schema MyApp.Schemas.OrderPaid
version 2
# endpoints pinning 1 receive this builder's bytes instead:
payload_versions %{1 => {MyApp.Payloads, :order_paid_v1}}
end
endentries/1 lists a resource's declared catalog; entry/2 reads one.
payload/3 resolves the bytes a dispatch sends to one endpoint — its
pinned variant when it pinned a declared version, the dispatch payload
otherwise.
A pin on a version the declaration does not carry fails that endpoint
closed ({:error, :unknown_pinned_version}) BEFORE any delivery row is
written, as does a variant builder that fails or returns a non-binary
({:error, :variant_failed} — a crash is contained the same way).
Summary
Functions
The resource's declared outbound catalog, in declaration order — the event picker's source. Compose across your emitting resources yourself; each entry carries everything a doc generator needs.
One declared outbound entry, or :error when the resource declares no
such event type.
Resolves the payload bytes a dispatch delivers to one endpoint: the pinned variant's when the endpoint pinned a DECLARED version, the event's own bytes otherwise. The dispatch payload is returned verbatim for endpoints that never pinned, pinned the current version, or whose resource carries no pinning column at all.
Types
@type entry() :: %{ name: atom(), description: String.t() | nil, payload_schema: term() | nil, example: String.t() | nil, version: pos_integer(), payload_versions: %{optional(pos_integer()) => {module(), atom()}} | nil }
One catalog entry: the declared metadata for an outbound event type.
Functions
The resource's declared outbound catalog, in declaration order — the event picker's source. Compose across your emitting resources yourself; each entry carries everything a doc generator needs.
One declared outbound entry, or :error when the resource declares no
such event type.
@spec payload(AshHooks.Event.t(), AshHooks.Outbound.t(), struct()) :: {:ok, binary()} | {:error, :unknown_pinned_version | :variant_failed}
Resolves the payload bytes a dispatch delivers to one endpoint: the pinned variant's when the endpoint pinned a DECLARED version, the event's own bytes otherwise. The dispatch payload is returned verbatim for endpoints that never pinned, pinned the current version, or whose resource carries no pinning column at all.