AshVersioned. Resource. Info
(ash_versioned v0.1.0)
Copy Markdown
Introspection helpers for the AshVersioned.Resource extension.
Summary
Functions
versioning DSL entities
Returns the list of all read actions that should be exempted from read filtering entirely (explicitly configured actions and the history action).
Returns true if this resource declares an archive entity.
The AshVersioned.Resource.Archive entity for this resource, or nil if none is
declared.
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.
The name of the archived attribute. Raises if the resource isn't archivable — check
versioning_archivable?/1 first.
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.
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.
Filters AshVersioned.Resource entries on the provided entity module or list of entity
modules.
Finds the first AshVersioned.Resource entry for the provided entity module or returns
nil if not found.
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.
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.
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.
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.
The name of the generated read action that returns every version, ignoring the default latest/archived scoping.
The name of the generated read action that returns every version, ignoring the default latest/archived scoping.
The AshVersioned.Resource.Identity entity for this resource.
The name of the identity attribute.
The AshVersioned.Resource.Latest entity for this resource.
The name of the latest attribute.
versioning DSL options
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.
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.
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.
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.
The AshVersioned.Resource.Version entity for this resource.
The name of the version attribute.
Functions
versioning DSL entities
Returns the list of all read actions that should be exempted from read filtering entirely (explicitly configured actions and the history action).
Returns true if this resource declares an archive entity.
The AshVersioned.Resource.Archive entity for this resource, or nil if none is
declared.
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.
The name of the archived attribute. Raises if the resource isn't archivable — check
versioning_archivable?/1 first.
@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.
@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.
Filters AshVersioned.Resource entries on the provided entity module or list of entity
modules.
Finds the first AshVersioned.Resource entry for the provided entity module or returns
nil if not found.
@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.
@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.
@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.
@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.
The name of the generated read action that returns every version, ignoring the default latest/archived scoping.
The name of the generated read action that returns every version, ignoring the default latest/archived scoping.
The AshVersioned.Resource.Identity entity for this resource.
The name of the identity attribute.
The AshVersioned.Resource.Latest entity for this resource.
The name of the latest attribute.
versioning DSL options
Returns a map containing the and any configured or default values.
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.
versioning do
archive()
source_prefix "vo_"
endThis is equivalent to:
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
endThe prefix is applied in front of any name given, so identity :mo_id would
become identity :mo_id, source: :vo_mo_id.
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.
versioning do
archive()
source_prefix "vo_"
endThis is equivalent to:
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
endThe prefix is applied in front of any name given, so identity :mo_id would
become identity :mo_id, source: :vo_mo_id.
@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.
@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.
The AshVersioned.Resource.Version entity for this resource.
The name of the version attribute.