Skip to contents

zuid 0.1.0

  • Initial CRAN submission.
  • A README and two articles, “Reading what an identifier knows” and “A UUID in every alphabet”.
  • A generator call given both time and random is a pure function of its arguments: the same arguments give the same identifiers, and the session’s monotonic state is left alone.
  • snowflake() takes rollback = "reset", and keeps one sequence per layout shared by every worker, so alternating workers never repeat a value. scru64() keeps one state per node.
  • Version 7 UUIDs, TypeIDs, SCRU128 and SCRU64 raise zuid_overflow_error at the end of their time range instead of wrapping or emitting a reserved timestamp.
  • id_valid() checks a zuid vector under its own alphabet, min_length and layout, and id_encode() requires an ASCII sep.
  • id_detect() names each element’s format, or NA with its candidates when the evidence does not settle it; only structured formats are tried without a hint. id_parse(format = NULL) detects one format for the whole vector, or raises zuid_ambiguous_error or zuid_mixed_error.
  • NanoID, Cuid2, Sqids and CID parse and validate, and nanoid() and sqids() generate. id_parse() and id_valid() take alphabet and min_length for NanoID and Sqids, and the parameters travel with the vector. id_fields() reads a Sqid’s numbers and a CID’s version, codec, hash function and digest, and id_bytes() gives a CID’s binary form. A Sqid of no numbers is "" and parses back, as the specification says; a NanoID has at least one symbol. A sqids() element that is partly NA is an error.
  • id_bytes() and id_from_bytes() keep names, as column names or list names. For a CID, id_bytes() returns a list of raw vectors.
  • XID, ObjectId and Snowflake: parsing, fields and xid(), objectid() and snowflake(). id_layout() gives the Twitter, Discord, Instagram, Sonyflake and SCRU64 layouts and builds custom ones, whose sequence has at most 31 bits so it reads as an integer; a Snowflake is read and generated only under a layout, which travels with the vector. id_convert() moves between xid and objectid.
  • SCRU128, SCRU64 and KSUID parse, validate and read their fields, and scru128(), scru64() and ksuid() generate them. The SCRU generators follow their references: monotonic, with counter overflow moving the timestamp forward, and a clock rollback beyond the tolerance a zuid_clock_error unless rollback = "reset".
  • ULID, TypeID and UPID: id_parse(), id_valid(), id_fields() and the rest read them, and ulid(), typeid() and upid() generate them. ULIDs from one session strictly increase, by the specification’s rule, with zuid_overflow_error when the random component would overflow.
  • id_convert() moves values between uuid, ulid, typeid and upid, keeping the bytes; other pairs are a zuid_convert_error.
  • id_encode() and id_decode() write and read bytes of any length in hex, Crockford base32, RFC 4648 base32 and base32hex, base36, base58, base62, base64url, the sortable base62 and base64 of the IETF draft, a caller’s alphabet (ShortUUID’s by default), Proquint and Niceware words. Each form writes what the mainstream Go and Python libraries write. Every encoding is also a UUID form in id_format() and id_parse().
  • uuid() generates UUID versions 1, 4, 6, 7 (the default) and 8 from the operating system’s entropy source, never R’s random number generator. Version 7 values from one session strictly increase, and random and time give reproducible output. zuid_info() reports the entropy source and the generator state.
  • id_parse() and id_valid() read UUIDs in every RFC 9562 text form (canonical, compact, URN, braced, uppercase) and validate them at three levels: syntax, structure and strict.
  • id_fields(), id_time() and id_version() read the version, variant, time, clock sequence, node and random bits of every UUID version.
  • id_format(), id_bytes() and id_from_bytes() move between text forms and bytes; id_from_bytes() has no default format.
  • uuid_nil(), uuid_max() and id_formats().
  • zuid vectors keep their class through subsetting, assignment, c(), rep(), unique() and data frames, compare by value, sort by bytes, and combine with vctrs when it is loaded.
  • zuid_info() reports the package version and the generated tables compiled into it, the Niceware word list and the Sqids blocklist, with their pinned upstream sources.