Complete, metadata-derived primary-key handling for AshHooks ledgers.
Ledger ownership always uses every primary-key component declared by the
consumer resource. A writable attribute named :id has no special meaning
unless it is itself part of that primary key. Encoded keys use the declared
attribute names as strings for job and audit payloads; decoding accepts only
that exact known set and casts values through the resource's Ash types
without creating atoms from input.
Summary
Functions
Decodes an encoded primary key against the resource's exact key metadata.
Encodes a record or key map as a JSON-safe string-key map.
Returns the complete primary-key filter for an Ash record.
Returns every declared primary-key component from an Ash record.
Returns the sole declared primary-key value from an Ash record.
Types
Functions
@spec decode(module(), map()) :: {:ok, key_map()} | {:error, :primary_key_mismatch | :invalid_primary_key}
Decodes an encoded primary key against the resource's exact key metadata.
Unknown input names never become atoms. Values are cast and constrained by their declared Ash attribute type. Error reasons are fixed atoms so attacker input cannot escape through worker or telemetry diagnostics.
Encodes a record or key map as a JSON-safe string-key map.
Returns the complete primary-key filter for an Ash record.
Returns every declared primary-key component from an Ash record.
Returns the sole declared primary-key value from an Ash record.