Artefact.UUID (Artefact v0.3.0)

Copy Markdown View Source

UUIDv7 generation and validation for Artefact node identity.

The key public function for consumers is from_name/1 — derive a stable, deterministic UUID from any string identifier. Use it when importing from external sources (Mermaid, Cypher, JSON) to ensure the same node always gets the same UUID across repeated imports.

Summary

Functions

Deterministic UUIDv7-shaped identifier derived from a name string.

Generate a UUIDv7 string. Time-ordered; lower value = earlier creation.

Compare two UUIDv7 strings. Returns the lower (earlier) of the two.

Returns true when value is a valid UUIDv7 string (lowercase hex).

Functions

from_name(name)

Deterministic UUIDv7-shaped identifier derived from a name string.

Uses SHA-256 of the name in place of random bytes, with version and variant bits forced identically to generate_v7/0. The timestamp field is filled from the hash rather than the clock, so the result is not time-ordered, but it is stable: the same name always produces the same UUID. Passes valid?/1.

generate_v7()

Generate a UUIDv7 string. Time-ordered; lower value = earlier creation.

harmonise(uuid_a, uuid_b)

Compare two UUIDv7 strings. Returns the lower (earlier) of the two.

valid?(value)

Returns true when value is a valid UUIDv7 string (lowercase hex).