# `AshVersioned.Resource.Info`

Introspection helpers for the `AshVersioned.Resource` extension.

# `versioning`

```elixir
@spec versioning(dsl_or_extended :: module() | map()) :: [struct()]
```

versioning DSL entities

# `versioning_all_excluded_read_actions!`

Returns the list of all read actions that should be exempted from read filtering
entirely (explicitly configured actions and the history action).

# `versioning_archivable?`

Returns `true` if this resource declares an `archive` entity.

# `versioning_archive`

The `AshVersioned.Resource.Archive` entity for this resource, or `nil` if none is
declared.

# `versioning_archive_excluded_read_actions!`

Returns the list of read actions that should skip only archived record filtering but
keep latest record filtering. Returns `[]` if the resource isn't archivable.

# `versioning_archived_attribute!`

The name of the archived attribute. Raises if the resource isn't archivable — check
`versioning_archivable?/1` first.

# `versioning_create_timestamp_attribute`

```elixir
@spec versioning_create_timestamp_attribute(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

The name of the timestamp attribute used when inserting a new version. This
reflects when this version became active. The attribute must already be defined in
`attributes`.

# `versioning_create_timestamp_attribute!`

```elixir
@spec versioning_create_timestamp_attribute!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

The name of the timestamp attribute used when inserting a new version. This
reflects when this version became active. The attribute must already be defined in
`attributes`.

# `versioning_entities`

Filters `AshVersioned.Resource` entries on the provided entity module or list of entity
modules.

# `versioning_entity`

Finds the first `AshVersioned.Resource` entry for the provided entity module or returns
`nil` if not found.

# `versioning_exclude_read_actions`

```elixir
@spec versioning_exclude_read_actions(dsl_or_extended :: module() | map()) ::
  {:ok, [atom()]} | :error
```

Read actions that should skip the default latest (and archived) scoping applied to
every other read action. This could include hand-declared audit or admin-facing
actions that need to see stale and archived versions.

# `versioning_exclude_read_actions!`

```elixir
@spec versioning_exclude_read_actions!(dsl_or_extended :: module() | map()) ::
  [atom()] | no_return()
```

Read actions that should skip the default latest (and archived) scoping applied to
every other read action. This could include hand-declared audit or admin-facing
actions that need to see stale and archived versions.

# `versioning_exclude_update_actions`

```elixir
@spec versioning_exclude_update_actions(dsl_or_extended :: module() | map()) ::
  {:ok, [atom()]} | :error
```

Update actions intentionally left as ordinary in-place updates instead of
appending a new version. Every other update action on the resource is wired to
append automatically.

WARNING: This should _only_ be used in exceptional circumstances, because it
breaks the core promise of SCD (type 2) versioning: inactive versions don't
change.

# `versioning_exclude_update_actions!`

```elixir
@spec versioning_exclude_update_actions!(dsl_or_extended :: module() | map()) ::
  [atom()] | no_return()
```

Update actions intentionally left as ordinary in-place updates instead of
appending a new version. Every other update action on the resource is wired to
append automatically.

WARNING: This should _only_ be used in exceptional circumstances, because it
breaks the core promise of SCD (type 2) versioning: inactive versions don't
change.

# `versioning_history_action`

```elixir
@spec versioning_history_action(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

The name of the generated read action that returns every version, ignoring the
default latest/archived scoping.

# `versioning_history_action!`

```elixir
@spec versioning_history_action!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

The name of the generated read action that returns every version, ignoring the
default latest/archived scoping.

# `versioning_identity`

The `AshVersioned.Resource.Identity` entity for this resource.

# `versioning_identity_attribute`

The name of the identity attribute.

# `versioning_latest`

The `AshVersioned.Resource.Latest` entity for this resource.

# `versioning_latest_attribute`

The name of the latest attribute.

# `versioning_options`

```elixir
@spec versioning_options(dsl_or_extended :: module() | map()) :: %{
  required(atom()) =&gt; any()
}
```

versioning DSL options

Returns a map containing the and any configured or default values.

# `versioning_source_prefix`

```elixir
@spec versioning_source_prefix(dsl_or_extended :: module() | map()) ::
  {:ok, String.t()} | :error
```

If specified, this prefix is applied to the underlying `source` of the generated
AshVersioned fields. Fields adopting defined fields (`define_attribute? false`) or
that declare `source` ignore this setting.

```elixir
versioning do
  archive()
  source_prefix "vo_"
end
```

This is equivalent to:

```elixir
versioning do
  archive :archived, source: :vo_archived
  identity :resource_id, source: :vo_resource_id
  latest :latest_version, source: :vo_latest_version
  version :version_number, source: :vo_version_number
end
```

The prefix is applied in front of _any_ name given, so `identity :mo_id` would
become `identity :mo_id, source: :vo_mo_id`.

# `versioning_source_prefix!`

```elixir
@spec versioning_source_prefix!(dsl_or_extended :: module() | map()) ::
  String.t() | no_return()
```

If specified, this prefix is applied to the underlying `source` of the generated
AshVersioned fields. Fields adopting defined fields (`define_attribute? false`) or
that declare `source` ignore this setting.

```elixir
versioning do
  archive()
  source_prefix "vo_"
end
```

This is equivalent to:

```elixir
versioning do
  archive :archived, source: :vo_archived
  identity :resource_id, source: :vo_resource_id
  latest :latest_version, source: :vo_latest_version
  version :version_number, source: :vo_version_number
end
```

The prefix is applied in front of _any_ name given, so `identity :mo_id` would
become `identity :mo_id, source: :vo_mo_id`.

# `versioning_update_timestamp_attribute`

```elixir
@spec versioning_update_timestamp_attribute(dsl_or_extended :: module() | map()) ::
  {:ok, atom()} | :error
```

The name of the timestamp attribute updated when a version is marked stale. This
reflects when this version became inactive. The attribute must already be defined
in `attributes`.

# `versioning_update_timestamp_attribute!`

```elixir
@spec versioning_update_timestamp_attribute!(dsl_or_extended :: module() | map()) ::
  atom() | no_return()
```

The name of the timestamp attribute updated when a version is marked stale. This
reflects when this version became inactive. The attribute must already be defined
in `attributes`.

# `versioning_version`

The `AshVersioned.Resource.Version` entity for this resource.

# `versioning_version_attribute`

The name of the version attribute.

---

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