# `AshAuthzed.SyncChange`
[🔗](https://github.com/boxxxie/ash_authzed/blob/v0.2.0/lib/ash_authzed/sync_change.ex#L1)

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 batched `write_tuples/2` call per chunk)

# `build_operations`

```elixir
@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`).

# `operations_for_records`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
