Synchronizes Ash resource lifecycle changes to Zanzibar/ReBAC relationship tuples.
Supports:
- Single-record actions via
change/3(after_action/2) - Atomic single updates via
atomic/3 - Bulk creates, updates, and destroys via
batch_change/3+after_batch/3(executes a single batchedwrite_tuples/2call per chunk)
Summary
Functions
Computes the list of {:create | :delete, tuple_string} operations for a transition
from old_record to new_record on resource for action_type (:create, :update, :destroy).
Generates deduplicated tuple operations for a list of Ash resource structs.
Functions
@spec build_operations(Ash.Resource.t(), atom(), map() | nil, map()) :: [ AshAuthzed.Adapter.operation() ]
Computes the list of {:create | :delete, tuple_string} operations for a transition
from old_record to new_record on resource for action_type (:create, :update, :destroy).
@spec operations_for_records([struct()], keyword()) :: [ AshAuthzed.Adapter.operation() ]
Generates deduplicated tuple operations for a list of Ash resource structs.
If reconcile?: true is passed (default), it treats records as an atomic update
with %Ash.Changeset.OriginalDataNotAvailable{} so any stale external_role tuples
are idempotently deleted alongside creating current tuples.