# `AshReplicant.Resource.Info`
[🔗](https://github.com/baselabs/ash_replicant/blob/v0.3.0/lib/ash_replicant/resource/info.ex#L1)

Introspection for the `AshReplicant.Resource` extension.

Generates the `replicant_<option>/1` (`{:ok, value} | :error`) and
`replicant_<option>!/1` accessors for every option, plus the hand-written
helpers `source_table/1` and `source_schema/1` (reflection fallbacks) and
`history_scd2?/1` (the SCD2-strategy predicate).

# `history_scd2?`

```elixir
@spec history_scd2?(module() | map()) :: boolean()
```

True when the resource opts into SCD2 history (`history_strategy :scd2`).

# `replicant_history_business_key`

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

SCD2 only: the source natural key (composite supported). Should be the source primary key; a non-PK business key requires `REPLICA IDENTITY FULL` on the source table.

# `replicant_history_business_key!`

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

SCD2 only: the source natural key (composite supported). Should be the source primary key; a non-PK business key requires `REPLICA IDENTITY FULL` on the source table.

# `replicant_history_close_action`

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

SCD2 only: the host `:update` action that sets the window columns to close a version.

# `replicant_history_close_action!`

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

SCD2 only: the host `:update` action that sets the window columns to close a version.

# `replicant_history_current_attribute`

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

SCD2 only (optional): boolean attribute maintained `true` on the open version and `false` on close.

# `replicant_history_current_attribute!`

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

SCD2 only (optional): boolean attribute maintained `true` on the open version and `false` on close.

# `replicant_history_strategy`

```elixir
@spec replicant_history_strategy(dsl_or_extended :: module() | map()) ::
  {:ok, :scd2 | :scd1} | :error
```

History strategy: `:scd1` (current-state upsert/destroy mirror, default) or `:scd2` (validity-windowed close-current + insert-version against a host version table).

# `replicant_history_strategy!`

```elixir
@spec replicant_history_strategy!(dsl_or_extended :: module() | map()) ::
  (:scd2 | :scd1) | no_return()
```

History strategy: `:scd1` (current-state upsert/destroy mirror, default) or `:scd2` (validity-windowed close-current + insert-version against a host version table).

# `replicant_history_valid_from_lsn_attribute`

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

SCD2 only: bigint attribute stamped with the change's `commit_lsn` when a version opens.

# `replicant_history_valid_from_lsn_attribute!`

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

SCD2 only: bigint attribute stamped with the change's `commit_lsn` when a version opens.

# `replicant_history_valid_from_timestamp_attribute`

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

SCD2 only (optional): nullable datetime attribute stamped with the source `commit_timestamp` when a version opens. Omit to store LSN windows only.

# `replicant_history_valid_from_timestamp_attribute!`

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

SCD2 only (optional): nullable datetime attribute stamped with the source `commit_timestamp` when a version opens. Omit to store LSN windows only.

# `replicant_history_valid_to_lsn_attribute`

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

SCD2 only: nullable bigint attribute stamped with the closing change's `commit_lsn`.

# `replicant_history_valid_to_lsn_attribute!`

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

SCD2 only: nullable bigint attribute stamped with the closing change's `commit_lsn`.

# `replicant_history_valid_to_timestamp_attribute`

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

SCD2 only (optional): nullable datetime attribute stamped with the closing `commit_timestamp`.

# `replicant_history_valid_to_timestamp_attribute!`

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

SCD2 only (optional): nullable datetime attribute stamped with the closing `commit_timestamp`.

# `replicant_on_schema_change`

```elixir
@spec replicant_on_schema_change(dsl_or_extended :: module() | map()) ::
  {:ok, :ignore | :halt_destructive} | :error
```

Policy for an upstream schema change: `:halt_destructive` (halt on destructive DDL) or `:ignore`.

# `replicant_on_schema_change!`

```elixir
@spec replicant_on_schema_change!(dsl_or_extended :: module() | map()) ::
  (:ignore | :halt_destructive) | no_return()
```

Policy for an upstream schema change: `:halt_destructive` (halt on destructive DDL) or `:ignore`.

# `replicant_on_truncate`

```elixir
@spec replicant_on_truncate(dsl_or_extended :: module() | map()) ::
  {:ok, :close | :mirror | :halt} | :error
```

Policy for an upstream TRUNCATE: `:halt` (fail-closed), `:mirror` (raw-delete the mirror rows in-txn), or `:close` (SCD2 only — close every open version tenant-blind, retiring the whole window).

# `replicant_on_truncate!`

```elixir
@spec replicant_on_truncate!(dsl_or_extended :: module() | map()) ::
  (:close | :mirror | :halt) | no_return()
```

Policy for an upstream TRUNCATE: `:halt` (fail-closed), `:mirror` (raw-delete the mirror rows in-txn), or `:close` (SCD2 only — close every open version tenant-blind, retiring the whole window).

# `replicant_options`

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

replicant DSL options

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

# `replicant_sensitive`

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

Source columns classified as sensitive. Verifier-enforced to map to an AshCloak-encrypted / binary-storage attribute, or to be listed in `skip`.

# `replicant_sensitive!`

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

Source columns classified as sensitive. Verifier-enforced to map to an AshCloak-encrypted / binary-storage attribute, or to be listed in `skip`.

# `replicant_skip`

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

Source columns excluded from the mirror write.

# `replicant_skip!`

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

Source columns excluded from the mirror write.

# `replicant_source_schema`

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

Source schema name. Defaults to the resource's own AshPostgres schema, else "public".

# `replicant_source_schema!`

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

Source schema name. Defaults to the resource's own AshPostgres schema, else "public".

# `replicant_source_table`

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

Source table name. Defaults to the resource's own AshPostgres table via reflection.

# `replicant_source_table!`

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

Source table name. Defaults to the resource's own AshPostgres table via reflection.

# `replicant_tenant_attribute`

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

Source column carrying the tenant. Resolved per row and passed as `tenant:` to the mirror action. The source table must be `REPLICA IDENTITY FULL` so a delete's / PK-changing update's `old_record` carries the tenant column (key-only under the default identity → fail-closed `:tenant_required`).

# `replicant_tenant_attribute!`

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

Source column carrying the tenant. Resolved per row and passed as `tenant:` to the mirror action. The source table must be `REPLICA IDENTITY FULL` so a delete's / PK-changing update's `old_record` carries the tenant column (key-only under the default identity → fail-closed `:tenant_required`).

# `replicant_tenant_mfa`

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

`{m, f, a}` where `a` is a list of extra args, applied as `apply(m, f, [record | a])` yielding the tenant for a row.

# `replicant_tenant_mfa!`

```elixir
@spec replicant_tenant_mfa!(dsl_or_extended :: module() | map()) ::
  {atom(), atom(), [any()]} | no_return()
```

`{m, f, a}` where `a` is a list of extra args, applied as `apply(m, f, [record | a])` yielding the tenant for a row.

# `replicant_upsert_identity`

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

Identity name used for the upsert-by-PK mirror write.

# `replicant_upsert_identity!`

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

Identity name used for the upsert-by-PK mirror write.

# `source_schema`

```elixir
@spec source_schema(module() | map()) :: String.t()
```

The source schema for the resource: the explicit `source_schema`, else the
resource's own AshPostgres schema via reflection, else `"public"`.

# `source_table`

```elixir
@spec source_table(module() | map()) :: String.t() | nil
```

The source table for the resource: the explicit `source_table`, else the
resource's own AshPostgres table via reflection.

---

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