Changelog
View Source0.2.0
Fixed
- Casting/decoding a malformed prefixed ID whose slug contains characters
outside the base58 alphabet (
0,O,I,l, punctuation, …) no longer crashes withArithmeticError/ArgumentErrorfrom erl_base58 — every malformed input now returns{:error, :invalid_prefixed_id}(or raisesArgumentErrorfrom the bang variants). This is the exact class a public URL parameter delivers to a cast path.
Added
to_uuid/1andto_uuid_string/1— non-bang variants returning{:ok, value} | {:error, :invalid_prefixed_id}, for validating external input (HTTP params, etc.) at system boundaries.to_prefixed_id/2now also accepts a resource module as the second argument, resolving the prefix from the resource'sprefixed_idDSL (avoids hard-coding the prefix string).
Changed (breaking)
- Removed
decode_object_id/1. It was a redundantly-named twin of the newto_uuid_string/1; useto_uuid_string/1(tagged tuple) orto_uuid_string!/1(raising) instead. to_uuid_string!/1now raisesArgumentErrorfor invalid input (previously could leak aMatchError).- Conversion failures now use tagged
{:error, :invalid_prefixed_id}tuples instead of a bare:error.
0.1.1
Changed
PostgresExtension: dropLEAKPROOFfromtimestamp_from_uuid_v7/1. LEAKPROOF only matters when a function appears in a query crossing a PostgreSQL security barrier (RLS,security_barrierviews), which Ash does not enable by default. Marking a function leakproof requires superuser, which blocks every managed Postgres provider (RDS, Cloud SQL, Heroku, Supabase, Neon, …). Defaulting to portable migrations is worth the lost optimizer hint. Users who actually need it can runALTER FUNCTION timestamp_from_uuid_v7(uuid) LEAKPROOF;themselves as superuser.
0.1.0
Forked from ash_object_ids and renamed to AshPrefixedId.
Added
AnyPrefixedIdtype — a universal:uuidreplacement that accepts any prefixed ID or raw UUIDto_uuid!/1andto_uuid_string!/1for converting prefixed IDs to raw UUID formatsto_prefixed_id/2for converting UUIDs back to prefixed formfind_resource_for_prefix/2andfind_resource_for_id/2for resource lookup by prefixfind_duplicate_prefixes/1andmap_prefixes_to_resources/1for prefix managementPostgresExtensionwithuuid_generate_v7()for server-side UUIDv7 generationmigration_default?option for automatic PostgreSQL migration defaults- Automatic
belongs_toforeign key type inference viaBelongsToAttributetransformer
Changed
- Renamed
AshObjectIds→AshPrefixedIdthroughout - Moved FK type updates from transformer to persister for reliability
- Improved handling of self-referential foreign keys
- Fixed 16-byte binary handling in
cast_stored - Fixed binary-to-string UUID conversion in
cast_input