Repository navigation
Releases
v3.0.0
@cldmv/uuid v3.0.0 Changelog
Release Date: November 2026
Release Type: Major
Branch: release/3.0.0
Overview
v3.0.0 switches the CommonJS entry to the generic index.cjs shim used across the CLDMV libraries. require("@cldmv/uuid") now returns the module object, the same exports import gives, instead of the UUID class with properties attached.
There are two breaking changes. The require() shape changes, which only affects code that treats the result as the UUID class, and the deprecated @cldmv/uuid/main alias is removed (#154). ESM import is unchanged, and so is every UUID method. The release also closes off the issuer registry: its bundled data and its entries are now private, and the registry won't let a ratified entry change (#148). dist/ is now built one file per module instead of as tsup bundles, so the code the subpaths share ships once (#152).
💥 Breaking Changes
require("@cldmv/uuid") returns the module object (#141, fixes #140)
The ESM entry exports two distinct values, the UUID class (also exported as uuid and default) and ISSUER_CATEGORIES, so the shim hands back the module object:
const uuid = require("@cldmv/uuid");
// => { __esModule, default: UUID, UUID, uuid, ISSUER_CATEGORIES }
const { UUID } = require("@cldmv/uuid");
UUID.TB();new (require(x))()becomesnew (require(x).UUID)(), orconst { UUID } = require(x).- Statics called on the result, such as
require(x).v4(),require(x).NILandrequire(x).DNS, move to the class:require(x).UUID.v4(),UUID.NIL,UUID.DNS. require(x).UUID,require(x).uuidand destructuring keep working.require(x).defaultandrequire(x).ISSUER_CATEGORIESare newly available.
src/index.cjs is now the generic shim used by the other CLDMV libraries: the Node version guard, then require("./index.mjs"). With one distinct exported value it returns that value with .default and every export name attached; with several, as here, it returns the module object untouched. The build still copies it unchanged to dist/index.cjs. The CJS test expects the module object and checks that the statics are no longer top-level keys.
The first cut of the shim in #141 returned the single value or the module object without the .default and name aliases for the single-value case. #147 syncs src/index.cjs with the corrected template. Nothing changes for uuid, since its entry has two distinct values and require() still gives the module object, and the CJS test now also asserts that UUID isn't decorated with .default or ISSUER_CATEGORIES.
The deprecated @cldmv/uuid/main alias is removed (#154)
@cldmv/uuid/main has been a deprecated alias of the package root since v1.3.0, with a one-time DeprecationWarning (CLDMV_UUID_MAIN), and was kept until the next major. The ./main export, src/main.mjs and its declaration are gone, so importing @cldmv/uuid/main now fails with ERR_PACKAGE_PATH_NOT_EXPORTED. Import @cldmv/uuid instead; it exports the same objects. With the alias gone nothing in the package has import-time side effects, so package.json sets "sideEffects": false.
🐛 Bug Fixes
The issuer data and registry are private, and ratified entries can't change (#148)
The bundled Category A and B issuer data and the registry's entries could be reached and changed from outside the registry. Now:
- The bundled data is a frozen constant inside
issuer-registry.mjs, no longer a separatesrc/data/issuers.jsonimport, and the registry keeps its entries in a private field. - Everything the registry returns is a frozen copy, or a fresh copy for
export(), soUUID.getIssuerInfo()hands back a read-only object.ISSUER_CATEGORIESis frozen too. - The shared registry instance lives in module scope instead of
UUID._registryInstance, and concurrent first calls toUUID.getRegistry()share one instance. - The reserved IDs (0, 1 and 404) and the bundled Category A and B issuers are ratified: entries carry
ratified: trueand nothing can change, replace or remove them. Entries added at runtime carryratified: false.import()throws if it would alter a ratified entry or mark an entry ratified; an export from before the flag existed still imports when its ratified entries match.
If you were mutating a returned issuer object or reading UUID._registryInstance, that no longer works. Registering and looking up issuers through the public API is unchanged.
The package loads on its stated Node.js floor again (#148)
v2.1.0 loaded the issuer data with import issuers from "../data/issuers.json" with { type: "json" }. The with form of import attributes needs Node.js 18.20, or 20.10 on the 20 line, so on the older versions engines.node (>=16.12.0) still allowed, importing the package failed with a SyntaxError. With the data inlined there is no JSON import left, and the built dist/ loads and runs on Node.js 16.12.0. The engines.node floor of >=16.12.0 is unchanged and now holds.
🔧 Build
dist/ mirrors src/, one minified file per module (#152, fixes #138)
The tsup build made a separate bundle for each export (., ./main, ./rng, ./bytes, ./hash and ./entropy), so the code they share was copied into several files. An app that imported more than one subpath loaded it more than once. scripts/build.mjs now runs esbuild over every src/**/*.mjs file with bundle: false and the node16 target. Each module is minified on its own with names kept and written to the same path under dist/, so UUID and every helper exist once. The @cldmv/uuid/rng, /bytes and /hash imports are left as written, so a browser bundler still picks the browser variants through the exports map. src/index.cjs is still copied verbatim.
The exports map, the entry points and what each subpath exports are unchanged. The tarball now holds one .mjs file per source module, and the .map files are still left out by files.
🔧 CI & tooling
ci.ymladopts the CLDMV/.github v4.46.0 concurrency block, so superseded runs onnext,hotfixesand feature branches are cancelled (#142, fixes #139).
📚 Documentation
- NEW: docs/changelog/v3/v3.0.0.md: this changelog.
- README: the CommonJS requirements note and example show the module object.
- README What's New promoted to v3.0.0.
🔧 Dependencies
- CLDMV dev tools (#145, #150):
@cldmv/vitest-runner1.5.6 → 1.11.5,@cldmv/configs1.4.0 → 1.5.1 and@cldmv/fix-headers2.2.4 → 2.6.2, plusnpm updatefor the rest.fix-headers2.6.1 restamped the file headers, which now write@Filenamewithout a leading slash, anddependabot.ymltakes the npm groups from the CLDMV/.github v4.47.0 template. Development only; nothing changes for consumers. esbuildadded andtsupremoved (#152).
Upgrade notes
require("@cldmv/uuid")no longer returns theUUIDclass. Useconst { UUID } = require("@cldmv/uuid"), and call statics onUUID(UUID.v4(),UUID.NIL,UUID.DNS).require(x).UUID,.uuidand destructuring work as before;.defaultand.ISSUER_CATEGORIESare new.@cldmv/uuid/mainis gone. Import@cldmv/uuidinstead, which exports the same objects.- ESM
importfrom@cldmv/uuidand its other subpaths is unchanged. - On Node.js 16.12 to 18.19 (and 20.0 to 20.9), the package loads again; v2.1.0 failed there.
| Metric | Coverage |
|---|---|
| Statements | 100.0% |
| Branches | 100.0% |
| Functions | 100.0% |
| Lines | 100.0% |
Avg: 100.0% · 3fdb25a · Node lts/*
👥 Contributors
v2.1.0
@cldmv/uuid v2.1.0 Changelog
Release Date: November 2026
Release Type: Minor
Branch: release/2.1.0
Overview
v2.1.0 publishes the entropy helpers as @cldmv/uuid/entropy and adds sha256 to @cldmv/uuid/hash.
EntropySource has been in the repository since the first release but was never reachable from the package. It is now its own subpath, kept out of the main bundle, and runs in browsers as well as Node. Before going public, its bit-balance check was reworked so it scales with input length, and one method name was corrected.
Nothing in the main entry changed: TA, TB, IA and RFC ids, their timestamps and every existing export behave as in v2.0.1.
✨ Features
@cldmv/uuid/entropy (#136, resolves #135)
import { EntropySource } from "@cldmv/uuid/entropy";
EntropySource.calculateRequiredEntropy(1e-9, 1_000_000); // => 69 random bits for a one-in-a-billion collision chance
const bytes = EntropySource.generateSecureBytes(16);
EntropySource.validateEntropyQuality(bytes).passed; // => true for a healthy sourceEntropySource is a set of static helpers:
generateSecureBytes(byteCount)andgenerateEntropy(bits): random bytes from the platform CSPRNG.calculateRequiredEntropy(probability, count): the birthday-bound number of random bits that keeps the collision chance acrosscountids at or belowprobability.validateEntropyQuality(bytes)andgenerateValidatedEntropy(byteCount, [maxAttempts]): sanity checks for a broken or stuck source (all zeros, all ones, bit balance, long runs), and a generator that retries until a draw passes.mixEntropySources(sources): XOR of several byte arrays.createTimestampIndependentEntropy(timestamp, [additionalBytes]): SHA-256 of a timestamp plus fresh random bytes.estimateShannonEntropy(bytes)andanalyzeEntropySource(generator, [sampleCount]): frequency-based entropy estimate, and repeated-output and timing warnings for a generator.
Every method works on Uint8Array and returns Uint8Array (Node Buffers work as inputs). Bytes come from @cldmv/uuid/rng, hex from @cldmv/uuid/bytes and SHA-256 from @cldmv/uuid/hash, so one build serves Node and browsers. Changes made while preparing it for release:
- Bit balance scales with length. The check used a fixed 40-60% window for the share of set bits. That rejected about 2.7% of good 16-byte draws and was far too loose for large inputs. It now allows 4 standard deviations either side of half, so a fair source fails about once in 16,000 checks at any length. The result reports the window as
minandmax. estimateShannnonEntropyisestimateShannonEntropy. The old spelling was never published.
sha256 in @cldmv/uuid/hash (#136)
sha256(bytes) returns the 32-byte digest. The Node build uses node:crypto; the browser build is a synchronous pure-JS implementation, tested against the FIPS 180-4 vectors and node:crypto across block-boundary lengths.
🐛 Bug Fixes
Flaky generateValidatedEntropy test (#134, fixes #133)
The test ran the validator on real random bytes with two attempts, so about one run in 1,400 failed although nothing was wrong. It now uses fixed bytes, and a second test covers the retry path.
🧪 Tests & cleanup
- Unused modules removed (#129):
src/lib/versions/index.mjs,src/lib/versions/issuer/index.mjsandsrc/lib/versions/issuer/v1.mjswere never imported by the library or exported by the package (UUID.IA()builds issuer ids itself), along with the stalescripts/test-version-files.mjsthat used them. - Coverage is 100% on lines, statements, functions and branches (#129): new tests for the RFC
version()helper,gregorianTicks()defaults, dates outside the range aDatecan hold, and pre-1970 sub-millisecond timestamps.
🔧 CI & tooling
- The UUID detail reference deploys to GitHub Pages through the shared
reusable-docs-publishworkflow (#126). ci.ymlsynced with the CLDMV/.github v4.43.0 template (#128).
📚 Documentation
- NEW: docs/changelog/v2/v2.1.0.md: this changelog.
- README: an "Entropy helpers (
@cldmv/uuid/entropy)" section with a method table, and the source layout lists the new subpath. - README What's New promoted to v2.1.0.
🔧 Dependencies
Development only; no runtime dependencies changed.
vitest5.1.0 → 5.1.1 (#130)@vitest/coverage-v85.1.0 → 5.1.1 (#131)@cldmv/vitest-runner1.6.1 → 1.8.0 (#132)
Upgrade notes
- No breaking changes; drop-in for v2.0.1.
@cldmv/uuid/entropyis ESM-only, like the other subpaths (import, notrequire).
| Metric | Coverage |
|---|---|
| Statements | 100.0% |
| Branches | 100.0% |
| Functions | 100.0% |
| Lines | 100.0% |
Avg: 100.0% · c6ffe7d · Node lts/*
👥 Contributors
v2.0.1
@cldmv/uuid v2.0.1 Changelog
Release Date: November 2026
Release Type: Patch
Branch: release/2.0.1
Overview
v2.0.1 fixes how the library describes and generates UUIDs.
UUID.validate()andUUID.validateDetailed()take a UUID string or aUUIDinstance;validateDetailed()threw aTypeErroron a string.getInfo(),validate()andvalidateDetailed()describe every UUID, RFC or custom, with the same fields. They used to read the custom-variant bit positions on RFC ids too, which gave RFC ids made-up subvariants, versions and issuer categories.- RFC version 1, 6 and 7 ids report the timestamp they hold, and
UUID.compare()sorts them by time alongside TA and TB ids. UUID.v1()andUUID.v6()wrote the wrong timestamp into every id. They now match the RFC 9562 test vectors.
Generated TA, TB and IA ids and their timestamps are unchanged. Code that reads the validator report or getInfo() should check the upgrade notes: a few fields were renamed or now return null.
🐛 Bug Fixes
validate() and validateDetailed() accept strings and instances (#120, fixes #119)
Both methods only took the 16 raw bytes. Given a string, validate() threw UUID must be a 16-byte buffer, and validateDetailed() handed the string to the hex encoder and threw TypeError [ERR_INVALID_ARG_TYPE] … at toHex. Both now take a UUID string (with or without dashes, either case), a UUID instance or 16 bytes. A string that isn't 32 hex digits throws Invalid UUID string.
Every UUID gets the same detail fields (fixes #123)
The variant is bits 64-66: RFC 4122/9562 ids are 10x, custom ids are 111. The detail methods read bits 67-68 (subvariant), 75-78 (version) and 79-88 (issuer ID) on every id, but those fields only exist under 111. An RFC v4 id came back with version: 14, issuerID: 276 and issuerCategory: "Category B (Open Source Contributors)".
One decoder now describes every id, and a field the id's variant doesn't define is null:
getInfo()returnsuuid,isUUID,isCLDMV,variant,variantFamily,subvariant,version,fullVersion,variantIdentifier,issuerID,issuerCategory,timestamp,timestampUnit,date,isIssuerVariantandisTimestampVariantfor every id.versionis bits 75-78 on a CLDMV id and the RFC version (bits 48-51) on an RFC id.isCLDMV,variantFamily,fullVersion,timestampUnitanddateare new.isUUID()returnedfalsefor every RFC id: it only checked for variant111. It now means a well-formed UUID (RFC versions 1-8, Nil, Max and CLDMV ids), and the newisCLDMV()tells CLDMV ids apart.variantFamilyis"CLDMV","RFC 4122/9562","Microsoft"or"NCS".getInfo().variantis the family's number: 7 for CLDMV (prefix111), 2 for RFC (prefix10), 6 for Microsoft, 0 for NCS. It used to be the raw bits 64-66, which read 4 or 5 on an RFC id depending on a data bit;getVariant()still returns the raw bits.fullVersionisvariant.subvariant.versionas numbers, 0 for a part the id doesn't have:"7.0.6"for TB,"7.1.1"for IA,"2.0.4"for RFC v4,"2.0.0"for Nil,"6.0.0"for Microsoft.- RFC v1 and v6 (100-ns intervals) and v7 (milliseconds) ids report their timestamp on the Unix epoch.
getTimestamp()andgetTimestampBigInt()cover them, the newgetTimestampUnit()gives the unit, andUUID.compare()puts them in time order with TA and TB ids. - The RFC Nil and Max ids are RFC ids. Max (all ones) used to read as a custom id with reserved subvariant
11. getIssuerID()andgetIssuerCategory()returnnullfor every id that isn't an Issuer Variant.validate()fieldsare thegetInfo()fields plus the raw timestamp bit fields, named after the spec:timestampLayout,timestampSign,timestampSegmentA(bits 1-63),timestampContinuation(bits 69-74) andtimestampMagnitude.validateDetailed()'sbitLayoutandentropysections also have the same keys for every id.- The entropy section counts the real random bits: 49 for TA/TB, 109 for IA, 122 for RFC v4, 74 for RFC v7,
nullwhere there is no random field. It used to report 109 for everything and count timestamp bits as entropy. - Issuer categories have one name everywhere (
"Category A (Well-Recognized Tech Entities)"). Issuer IDs 512-1023 get the future RFC range warning again; the check compared against constants that didn't exist. Issuer 404's report no longer says Category B. - Valid RFC ids no longer get the warning
Not a valid UUID.
UUID.v1() and UUID.v6() write RFC 9562 timestamps (fixes #124)
v1() wrote time_hi from the wrong bits, v6() laid the time field out 4 bits off, and both computed the 60-bit count of 100-ns intervals as a JavaScript number past 2^53, which drops low bits. Every v1 and v6 id the library generated held the wrong time; a 2023 id decoded as the year 4896 in any RFC parser. Both now compute the time as a bigint and produce the RFC 9562 test vectors byte for byte.
🧪 Tests
validate()andvalidateDetailed()on TA, TB and IA ids, timestamp and issuer ids of versions 1-6, an RFC id and malformed input, each as a string, bytes and an instance (#120).- New
tests/uuid-detail-fields.test.vitest.mjs: the RFC 9562 v1, v6 and v7 test vectors, every RFC version, Nil, Max, a Microsoft id and every custom kind throughgetInfo(), the getters,validate()andvalidateDetailed(), the same key set for every id,UUID.compare()across RFC and custom ids, and v6 order across a 2^48 tick boundary.
📚 Documentation
- NEW: UUID detail reference (Markdown version): what every detail method returns for each RFC version, the Nil, Max and Microsoft ids, and each kind of CLDMV id. Both are generated from the library (
npm run docs:buildfor the page, published to GitHub Pages on each release;npm run docs:detailsfor the Markdown), and a test fails when the Markdown falls out of date. - NEW: docs/changelog/v2/v2.0.1.md: this changelog.
- README:
getInfo()field table for custom and RFC ids,getTimestamp()/getTimestampUnit()for RFC ids,UUID.compare()with RFC ids, avalidate()/validateDetailed()section, andisUUID()in place of aisCustomUUID()that never existed. - README What's New promoted to v2.0.1.
Upgrade notes
- Calls that passed bytes to
validate()/validateDetailed()work as before; strings and instances now work too. - Validator fields renamed:
timestampLower63istimestampSegmentA,actualTimestampistimestamp,reservedBit69andcategoryValidationare gone (bit 69 is intimestampContinuation), andissuerCategoryuses the long names. isUUID()istruefor RFC ids. Code that used it to mean "one of the TA, TB or IA ids" should callisCLDMV().getInfo().variantis now 2 for every RFC id, where it was the raw 4 or 5.nullfor fields an id doesn't have:getIssuerID(),getIssuerCategory()andgetInfo()'ssubvariant,issuerIDandissuerCategoryon RFC ids; missing keys in the validator sections are now present asnull.- RFC timestamps:
getTimestamp()returns a value for RFC v1, v6 and v7 ids where it returnednull. Code that used a non-null timestamp to mean "TA or TB" should checkisTimestampVariant()instead.UUID.compare()now sorts those RFC ids by time instead of after all timestamp ids. - v1 and v6 ids generated by earlier versions hold the wrong time and can't be corrected from the id alone. Generate new ones if anything reads their time.
| Metric | Coverage |
|---|---|
| Statements | 98.4% |
| Branches | 98.0% |
| Functions | 97.8% |
| Lines | 98.4% |
Avg: 98.1% · e2b8acd · Node lts/*
👥 Contributors
v2.0.0
@cldmv/uuid v2.0.0 Changelog
Release Date: November 2026
Release Type: Major
Branch: release/2.0.0
Overview
v2.0.0 makes the whole timestamp range of the Timestamp Variant usable. The format has always held a sign bit and a 69-bit magnitude, ±(2^69 - 1): about ±18.7 trillion years for TA() (seconds) and ±18.7 billion years for TB() (milliseconds). Until now the code went through Number and Math.abs, so it couldn't take a value above 2^53 exactly, wrapped silently past 2^69, and lost precision when decoding large values. Every value in the range now goes in, comes back out and sorts exactly.
TA() and TB() mint two new timestamp versions, 5 and 6, which lay the whole magnitude out most significant bit first, so byte order (string order, a database uuid column) follows time across the full range. Versions 3 and 4 kept the top 6 magnitude bits after the variant field and only sorted within ±(2^63 - 1). Ids already minted (versions 1-4) keep decoding exactly as before, UUID.migrate() rewrites them into 5/6, and the new UUID.compare() sorts any mix of versions by time.
It is a major release for two reasons: getTimestamp() returns a bigint past ±(2^53 - 1), which widens its TypeScript type, and new ids are versions 5/6, which don't sort together with stored version 3/4 ids by byte order until those are migrated. See the upgrade notes.
💥 Breaking Changes
TA() / TB() mint versions 5 and 6 (#117, fixes #100)
- Version 5 (seconds) and version 6 (milliseconds) store magnitude bits 68..6 at bits 1-63 and bits 5..0 at bits 69-74. Byte order follows time from -(2^69 - 1) to 2^69 - 1.
uuid.version()still reports"TA"/"TB";getVersion()returns 5 / 6 instead of 3 / 4.- Versions 1-4 still decode, and
UUID.timestamp(ts, version)still mints any of them. - Inside one layout, ids sort by time as before. Across layouts they don't: a version 3/4 id sorts after a version 5/6 id of the same time. Migrate stored ids, or sort with
UUID.compare().
getTimestamp() returns number | bigint | null (#117)
- A
numberwhile the value is a safe integer (±(2^53 - 1), about ±285,000 years in milliseconds), the exactbigintpast that,nullfor non-timestamp ids. Every timestamp a JavaScriptDatecan hold is still anumber, so runtime behavior only changes for values that used to come back rounded. - TypeScript code typed against
number | null(or passing the result straight tonew Date()or arithmetic) needs updating. getInfo().timestampfollows the same rule.
UUID.migrate() targets versions 5 and 6 (#117)
- Versions 1 and 3 become 5, versions 2 and 4 become 6. The sign, the timestamp and the 49 entropy bits are copied, so a version 2 id and its version 4 migration end up at the same version 6 id.
isLegacyTimestampLayout()is true for versions 1-4.
✨ Features
Full-range timestamp inputs (#117)
TA(),TB(),UUID.timestamp()and the version modules take anumber, abigint, a decimal integer string (the exact form that survives JSON) or aDate.- A fractional number is floored toward -Infinity, so
UUID.TA(Date.now() / 1000)stores the second it falls in, and -0.5 sorts before 0. ADateis milliseconds forTB()and floored seconds forTA(). - Values the format can't hold throw instead of encoding a different time: a
RangeErrorfor a magnitude past 2^69 - 1,NaN,Infinity, a malformed string or an invalidDate, aTypeErrorfor any other type.nullandundefinedstill mean now.
uuid.getTimestampBigInt() (#117)
- Always the exact
bigint, ornullfor non-timestamp ids.
UUID.compare(a, b) (#117)
- A comparator for
Array.prototype.sortover UUID instances, strings or 16-byte buffers. Timestamp Variant ids (versions 1-6) come first, ordered by the time they hold, exactly across the whole range; seconds and milliseconds go on one scale. Equal times, and every other UUID (which sorts after all timestamp ids), fall back to byte order. - Use it for a mix of versions,
TA()next toTB(), or version 3/4 ids past ±(2^63 - 1).
🐛 Bug Fixes
TB(2 ** 69)decoded as 0 andTB(-(2 ** 69))as -0. Both now throw aRangeError.TB(10n)threwCannot convert a BigInt value to a number. Bigints are now accepted.TB(NaN)/TB(Infinity)threw a BigInt conversion error. They now throw aRangeErrorsaying the timestamp must be finite.TB(-0.5)decoded as -0 and sorted beforeTB(0). Negative fractions now floor.- Decoding an id with a magnitude above 2^53 was lossy in every version. It is now exact.
- The validator warned "Reserved bit 69 is set to 1" on every pre-1970 id. Bit 69 is a magnitude bit in the Timestamp Variant, so the warning is gone;
fields.reservedBit69is still reported. - The internal timestamp-independent entropy helper (
src/lib/entropy-sources.mjs, not exported) was limited to 64 bits; it takes the same inputs and range asTA()/TB(). - The timestamp encoding was copied five times (the four version modules and
UUID); it now lives in one shared helper,src/lib/timestamp.mjs, which the validator uses as well.
🧪 Tests
- New
tests/timestamp-range.test.vitest.mjs: round-trips for versions 1-6 at 0, ±1, ±(2^53 - 1), ±2^53, ±(2^63 - 1), ±2^63, ±2^68 and ±(2^69 - 1) as bigint, string and number; byte order across the full range for versions 5/6 and within ±2^63 for 3/4;UUID.compare()over mixed layouts and precisions; every input and error case; migration of versions 1-4; the version modules against theUUIDclass (#117). - The order, migrate, ultra-short and validator suites cover versions 5/6, with fixed byte vectors for the new layout (#117).
- The consumer type test checks
number | bigint | null,getTimestampBigInt()andUUID.compareagainst the shipped types (#117).
🔧 CI & tooling
- Added the v4
sync-release-notescompanion workflow, which keeps GitHub Release pages in step with the files indocs/changelog/(#113).
📚 Documentation
- README: a "Timestamp range and inputs" section,
uuid.getTimestampBigInt()andUUID.compare(a, b)sections, versions 5/6 in the bit layouts and version table, and "Migrating stored ids to versions 5 and 6" (#117). uuid-spec.md: Timestamp Versions 5 and 6 (full layout); versions 3 and 4 note their ±(2^63 - 1) ordering limit and point new ids at 5 and 6 (#117).- NEW: docs/changelog/v2/v2.0.0.md: this changelog.
- README What's New promoted to v2.0.0.
🔧 Dependencies
Development only:
vitestand@vitest/coverage-v85.0.5 → 5.1.0 (#107).@cldmv/fix-headers2.2.4 → 2.2.7 (#108, #116).@cldmv/vitest-runner1.5.6 → 1.6.1 (#110).eslint10.14.0 → 10.15.0 (#114).prettier3.9.10 → 3.10.1 (#115).
Upgrade notes
- TypeScript: change
number | nullannotations ongetTimestamp()tonumber | bigint | null, or callgetTimestampBigInt()when you want one type. Where you need aDate,new Date(Number(id.getTimestamp()))works for any time aDatecan hold. - Stored ids: ids from 1.x keep decoding to the same time. If anything orders them by bytes (a primary key, an index,
ORDER BY id), new version 5/6 ids won't interleave correctly with them. Either migrate every stored id withUUID.migrate()(deterministic and idempotent, so migrate primary and foreign keys alike), or sort withUUID.compare()until you do.isLegacyTimestampLayout()finds the rows that need it. - Version checks: code that tests
getVersion() === 3/=== 4for TA/TB ids should accept 5 / 6 too, or useversion()("TA"/"TB") instead. - Inputs: values that used to encode silently wrong (past ±2^69,
NaN,Infinity) now throw. Fractional and pre-1970 inputs keep working. - To keep minting the 1.x layout for now, use
UUID.timestamp(ts, 3)/UUID.timestamp(ts, 4).
| Metric | Coverage |
|---|---|
| Statements | 97.6% |
| Branches | 95.7% |
| Functions | 97.7% |
| Lines | 97.7% |
Avg: 97.1% · ae92ec9 · Node lts/*
👥 Contributors
v1.5.0
@cldmv/uuid v1.5.0 Changelog
Release Date: November 2026
Release Type: Minor
Branch: release/1.5.0
Overview
v1.5.0 adds UUID.entropy(), a helper that builds the entropy argument for UUID.TA() and UUID.TB(). It packs a per-tick counter, a 16-bit fingerprint of an optional seed and random bits into the 49 entropy bits those variants keep (or any other length, with the bits option), so two ids minted by one module instance on the same tick never repeat (at any length of 12 bits or more). TA() and TB() themselves don't change, and ids minted without the helper are exactly as before.
The test suite also runs against the built dist/ now, not only against src/, so a bundling problem fails the build instead of reaching a consumer.
✨ Features
UUID.entropy() (#103, fixes #102)
UUID.entropy({ seed, precision, bits, onOverflow })returns a 16-byteUint8Arraywith bits 79-127 filled by default and atimestampproperty: the tick the counter was taken on. Stamp the id with it:UUID.TB(e.timestamp, e).- Bit layout of the 49 bits: a 12-bit counter (bits 79-90) that starts each tick at a random value in 0-2047 and counts up, so an instance gets at least 2048 ids per tick and ids from one instance in one tick sort in the order they were made; 16 bits of SHA-1 of the seed (bits 91-106), random when there is no seed; and 21 random bits (bits 107-127).
bitssets the length in bits; the default, 49, is the layout above. Any length of 0 or more works (#105): the same fields fill the lastbitsbits in the same order, longer lengths get more random bits, and a short one cuts them where it runs out (under 28 bits the seed fingerprint keeps only its top bits, under 12 the counter keeps only its low bits and repeats inside a tick after 2^bitscalls). The array is 16 bytes, longer past 128 bits.precision: "ms"(default) matchesTB().TA()stores seconds, so useprecision: "s"with it.onOverflow: when the counter runs out inside a tick,"wait"spins until the next tick and"advance"moves to the next tick at once. The default is"wait"for milliseconds and"advance"for seconds, where a wait could block for up to a second.- The tick never moves backwards. After a clock step back the helper stays on its last tick and keeps counting, and a wait gives up after 1,000,000 readings with no change, so a frozen
Date.now()(fake timers in a test suite) can't hang it. - The guarantee is per module instance (per worker or thread). Between instances it rests on chance: at the default length, about 2^-32 for two instances with the same seed minting on the same tick, about 2^-48 with no seed.
- Browser-safe: it uses the package's own
rngandhashmodules, which switch to Web Crypto and a pure-JS SHA-1 under thebrowsercondition. - Typed in
types/src/uuid.d.mtsand covered by the consumer type test.
🧪 Tests
- New
tests/entropy.test.vitest.mjsandtests/entropy-browser.test.vitest.mjs: the bit layout, the seed fingerprint, no repeats inside a tick and across overflow, both overflow modes, clock steps back, the frozen-clock cap, and the browser build (#103); thebitsoption at the default, longer, past-128, short and zero lengths (#105). npm run test:distbuilds and runs the Vitest suites againstdist/(--mode=distleaves theuuid-devcondition off).npm testandci:coverageinclude it, andtests/resolve.test.vitest.mjschecks that@cldmv/uuidresolved to the tree the run is meant to test (#98).
📚 Documentation
- README: a
UUID.entropy([options])section with the options, the bit layout, what a custombitslength holds, the stamping rule, the scope of the guarantee and examples forTBandTA(#103). The test commands listtest:dist(#98). - NEW: docs/changelog/v1/v1.5.0.md: this changelog.
- README What's New promoted to v1.5.0.
🔧 Dependencies
- No dependency changes.
Upgrade notes
- No breaking changes.
UUID.entropy()is new and opt-in; existing calls toTA(),TB()and every other variant behave as in v1.4.0. - When using the helper, always pass its
timestamptoTA()/TB(). Passingundefinedlets them read the clock themselves, which gives up the no-repeat guarantee on counter overflow, with"advance", or after a clock step back.
| Metric | Coverage |
|---|---|
| Statements | 82.8% |
| Branches | 85.2% |
| Functions | 90.3% |
| Lines | 82.4% |
Avg: 85.1% · 72b2436 · Node lts/*
👥 Contributors
v1.4.0
@cldmv/uuid v1.4.0 Changelog
Release Date: November 2026
Release Type: Minor
Branch: release/1.4.0
Overview
v1.4.0 makes the Timestamp Variant sort by byte order. Until now UUID.TA() and UUID.TB() wrote the timestamp magnitude's low 32 bits ahead of its upper 31, so two ids compared as bytes only followed time inside one 2^32 window and reversed at every boundary: every 49.7 days for TB (milliseconds), every 136 years for TA (seconds). Any store that orders rows or cursors by a TB id broke silently at each rollover.
The fix is non-breaking and goes through the version field. Timestamp versions 3 (seconds) and 4 (milliseconds) carry the ordered layout, UUID.TA() and UUID.TB() now mint them by default, and versions 1 and 2 decode exactly as before, so every stored id keeps its timestamp. UUID.migrate() rewrites a stored legacy id to the ordered layout deterministically, and isLegacyTimestampLayout() selects the rows that need it.
✨ Features
Timestamp versions 3 and 4 sort by byte order (#90, fixes #89)
- Versions 3 (seconds) and 4 (milliseconds) lay the magnitude out most significant bit first: the upper 31 bits at bits 1-31 and the low 32 at bits 32-63. The sign bit, the entropy bits and bits 69-74 are unchanged, so the version field is the only thing that tells the layouts apart.
UUID.TA()mints version 3 andUUID.TB()mints version 4. An explicitUUID.timestamp(ts, 1)orUUID.timestamp(ts, 2)still mints the legacy layout for anyone who needs it.- Versions 1 and 2 decode as before:
getTimestamp()on an id minted by 1.3.1 or earlier answers the same value it always did. validators.mjsread segment A as one contiguous value, which was wrong for the legacy layout; it now reads by version.
UUID.migrate() and isLegacyTimestampLayout() (#90)
UUID.migrate(input)rewrites a legacy timestamp id to version 3 or 4 with the same sign, the same timestamp and the same 49 entropy bits, so the result is deterministic. It is idempotent, and an id that is not a Timestamp Variant passes through unchanged.uuid.isLegacyTimestampLayout()is true for a version 1 or 2 timestamp id, which is the test to select stored rows for migration.- Old and new ids interleave in byte order until every row is migrated, because versions 1 and 2 keep the legacy layout. Ordering by byte value is chronological only once every id involved is at version 3 or 4.
Types
- The
.d.mtsdeclarations cover the new timestamp version modules,UUID.migrate()andisLegacyTimestampLayout(), and the consumer type test exercises them.
🔧 CI & tooling
Lint and format scripts from @cldmv/configs (#96)
- The repository had an ESLint config that imported plugins it never installed and a Prettier config no script ran.
.configs/eslint.config.mjsnow spreads the shared@cldmv/configsbase,.configs/prettier.config.mjsre-exports the shared options (without the jsonv plugin, since there are no.jsonvfiles here), and.prettierignorecarries the managed block plustypes/. lint,lint:fix,formatandformat:checkcome fromcldmv-configs init;build:cirunslintandformat:checkunconditionally;prepareinstalls the fleet pre-commit hook from.githooks/, which rejects a commit on a lint or formatting problem.- Formatting drift in two files and thirteen lint errors (unused imports and bindings, a stale disable directive, two fences without a language) are fixed. No behaviour changes.
📚 Documentation
- README: the
TAandTBsections, the version table and the bit layout describe versions 3 and 4, and a new "Migrating stored ids to versions 3 and 4" section walks through the row-by-row rewrite (#90). uuid-spec.md8.2 gains versions 3 and 4 (#90).- NEW: docs/changelog/v1/v1.4.0.md: this changelog.
- README What's New promoted to v1.4.0.
🧪 Tests
- Fixed vectors for versions 3 and 4, the 1.3.1 legacy vectors decoding unchanged, migration vectors, idempotence and pass-through, a 1000-id legacy sample that byte-sorts in timestamp order after migration, and the 2^32 boundaries (#90).
🔧 Dependencies
@cldmv/configs^1.2.4 → ^1.4.0, andeslint^10.14.0 andprettier^3.9.10 added, for the lint and format scripts (#96). Development dependencies only.
Upgrade notes
- No breaking changes; drop-in for v1.3.2. New
TAandTBids are versions 3 and 4; existing ids keep decoding. - If you order rows or cursors by a
TBorTAid, migrate the stored ids once: select the rows wherenew UUID(id).isLegacyTimestampLayout()is true and write backUUID.migrate(id).toString()(or.toBuffer()). Until the rewrite is complete, old and new ids interleave in byte order.
| Metric | Coverage |
|---|---|
| Statements | 81.7% |
| Branches | 83.6% |
| Functions | 89.8% |
| Lines | 81.2% |
Avg: 84.0% · e58338c · Node lts/*
v1.3.2
@cldmv/uuid v1.3.2 Changelog
Release Date: November 2026
Release Type: Patch
Branch: release/1.3.2
Overview
v1.3.2 is a development-tooling release. The test config now resolves the package through the uuid-dev export condition the way it was meant to, and CI type-checks the declarations with types:check instead of skipping the step.
No library code changed. The UUID API, the generated UUIDs and the published files are the same as in v1.3.1, and nothing changes for anyone installing the package.
🔧 CI & tooling
Tests run against src/ through devCondition() (#91)
.configs/vitest.config.mjs set test.nodeOptions to pass --conditions=uuid-dev to the test workers, but vitest has no such option, so the condition never reached them. The config now builds on devCondition() from @cldmv/configs (bumped to ^1.4.0), which sets the resolver conditions and the worker execArgv, so Node's own resolver picks src/ through the uuid-dev export condition too.
CI runs types:check (#93)
- The CI type-check step runs
npm run types:check(tsc --noEmiton.configs/tsconfig.dts.jsonc, which validates the hand-written.d.mtsdeclarations) and is no longer skipped.checkJsstays off, so the JavaScript source itself isn't type-checked. test:types, the consumer-side test of the built types, stays part ofnpm test.- The unused
build:typesscript is gone;types:buildalready replaced it inbuild:ci.
📚 Documentation
- NEW: docs/changelog/v1/v1.3.2.md: this changelog.
- README What's New promoted to v1.3.2.
🔧 Dependencies
@cldmv/configs^1.3.0 → ^1.4.0, fordevCondition()(#91). Development dependency only.
Upgrade notes
- No breaking changes; drop-in for v1.3.1. No library code changed.
- If you call
npm run build:typesin your own scripts, usetypes:build.
| Metric | Coverage |
|---|---|
| Statements | 88.3% |
| Branches | 88.2% |
| Functions | 93.1% |
| Lines | 88.1% |
Avg: 89.4% · 45ae65b · Node lts/*
👥 Contributors
v1.3.1
@cldmv/uuid v1.3.1 Changelog
Release Date: November 2026
Release Type: Patch
Branch: release/1.3.1
Overview
v1.3.1 sets engines.node back to the Node.js version the package needs at runtime, >=16.12.0, instead of the 22.22.0 development toolchain floor that v1.3.0 put there. The 22.22.0 floor moves to npm's devEngines, which only applies when you work on this repository.
The UUID API, the generated UUIDs and the import paths are the same as in v1.3.0. Installs on Node.js 16.12 through 22.21 no longer get an EBADENGINE warning.
🐛 Bug Fixes
engines.node is the runtime floor again (#85)
v1.3.0 raised engines.node from >=16.12.0 to >=22.22.0 because the development toolchain (tsup 9 among others) doesn't run on earlier 22.x releases. The published package doesn't need any of that toolchain, so the floor was stricter than the code. engines.node is >=16.12.0 again, and the bundles are built for node16 (tsup target, was node20).
import works on Node.js 16.12.0 and later. require("@cldmv/uuid") loads the ES module build synchronously, which needs require(esm): Node.js ^20.19.0 or >=22.13.0. On a Node.js without it, the CommonJS entry now says exactly that (require() needs Node.js ^20.19.0 or >=22.13.0, code ERR_REQUIRE_ESM) and points to import(); v1.3.0's message asked for 22.22.0.
📦 Requirements
- Runtime: Node.js 16.12.0 or later for
import(engines.nodeis>=16.12.0, was>=22.22.0).require()needs Node.js ^20.19.0 or >=22.13.0; useimport()on older versions. Browser bundles are unaffected. - Development: working on this repository needs Node.js 22.22.0 or later, declared in
devEngines.runtimewithonFail: "error". This doesn't affect anyone installing the package.
🔧 CI & tooling
- The CI and publish workflows keep
min_node_versionat 22.22.0; its description and a comment now say it's the dev toolchain floor and should matchdevEngines, notengines(#85, #87).
📚 Documentation
- NEW: docs/changelog/v1/v1.3.1.md: this changelog.
- README: the requirements list the
importfloor, therequire()range and the development floor separately, and the CommonJS example names therequire()range (#85). - The v1.3.0 changelog and README entry list its Node.js floor under Requirements instead of Breaking Changes (#84).
- README What's New promoted to v1.3.1.
Upgrade notes
- No breaking changes; drop-in for v1.3.0. Apart from the CommonJS entry's error message and the
node16build target, no library code changed. - If you stayed on v1.2.6 because of v1.3.0's 22.22.0 floor, v1.3.1 installs on Node.js 16.12 and later again.
@cldmv/uuid/mainis still a deprecated alias, as in v1.3.0.
| Metric | Coverage |
|---|---|
| Statements | 88.3% |
| Branches | 88.2% |
| Functions | 93.1% |
| Lines | 88.1% |
Avg: 89.4% · b07ba33 · Node lts/*
👥 Contributors
v1.3.0
@cldmv/uuid v1.3.0 Changelog
Release Date: November 2026
Release Type: Minor
Branch: release/1.3.0
Overview
v1.3.0 moves the package to a built layout: the code lives in src/, tsup bundles it into dist/, and the published package ships dist/, types/ and typings/ instead of root index.mjs / index.cjs files and a raw copy of the source. The UUID API, the generated UUIDs and the import paths consumers use (@cldmv/uuid, @cldmv/uuid/rng, @cldmv/uuid/bytes, @cldmv/uuid/hash) are unchanged. @cldmv/uuid/main still works but is now a deprecated alias of the package root.
The Node.js floor goes up from 16.12.0 to 22.22.0. See Requirements and the upgrade notes before upgrading.
✨ Features
Built from src/ with tsup (#80, closes #78)
- Entry files. The ES module entry is
src/index.mjsand the CommonJS entry is its siblingsrc/index.cjs. tsup bundlessrc/index.mjsinto a minifieddist/index.mjs(function and class names kept) and copiessrc/index.cjsverbatim todist/index.cjs, a few lines thatrequire()the siblingindex.mjs.require("@cldmv/uuid")still returns theUUIDclass withUUID,uuidandISSUER_CATEGORIESon it, and the CommonJS and ES module entries return the same objects. - Subpaths.
./rng,./bytesand./hashare built as their own files indist/lib/, Node and browser variants both, and the main bundle imports them through the package's exports map. A bundler therefore still picks thebrowservariant instead of getting the Node one baked intodist/index.mjs. - Issuer data is bundled. The issuer registry imports
data/issuers.jsonstatically instead of reading it from disk withfsrelative to its own path, so the data is inlined into the bundle. The registry no longer importsfs,pathorurl, and theCould not load issuers.jsonwarning for a missing file is gone because the file can no longer be missing. - Types. Declarations come from
types/src/.@cldmv/uuid/mainnow has the same types as the root. sideEffects. The package is still side-effect free except for the./mainalias, which prints its deprecation warning on import;sideEffectslists that file.
@cldmv/uuid/main is a deprecated alias (#80)
@cldmv/uuid/main used to point at its own copy of the UUID module. It now re-exports the package root, so every value is the same object @cldmv/uuid exports, and it gains the default export the root has. Importing it prints a DeprecationWarning once per process with code CLDMV_UUID_MAIN (console.warn where there is no process). node --no-deprecation silences it. The alias is removed in the next major version; import @cldmv/uuid instead.
uuid-dev export condition on the root (#80)
The uuid-dev condition, which before only covered the subpaths, now sits on . too, for import, require and types. In a checkout the package resolves to the built dist/ by default and to src/ under --conditions=uuid-dev. The test suites run against src/ through it. Installed copies never see the condition.
📦 Requirements
Node.js 22.22.0 or later (#79, #80)
engines.node is >=22.22.0, for import and require() alike. v1.2.6 declared >=16.12.0 for import, and its README said require() needed ^20.19.0 || >=22.12.0. #79 first raised the floor to ^20.19.0 || >=22.13.0, and #80 raised it again to 22.22.0 because the development toolchain (tsup 9 among others) doesn't run on earlier 22.x releases, so they can't be tested. The require() error message on a Node.js without require(esm) and the CI matrix floor say 22.22.0 too.
On Node.js 16 through 22.21, installs now report EBADENGINE (or fail under engine-strict), and those versions are no longer tested.
🐛 Bug Fixes
Development check removed (#79)
The root devcheck.mjs, which the entry tried to load in a source checkout, is gone along with its test. It was never published, so installed copies are unaffected. The uuid-dev condition already chooses src/ or dist/ in a checkout.
🔧 CI & tooling
build:ciruns lint and format checks when present, thentypes:buildand the tsupbuild; the coverage jobs run it before measuring (coverage_build_command) (#80).test:cjsandtest:typesbuild first, and the CommonJS tests cover bothdist/andsrc/entries. A new test covers the./mainalias and its warning (#80).- The bundle-size check measures
dist/**.mjsanddist/**.cjs(#80). - The CI matrix floor is 22.22.0 (was 22.12.0) (#80).
prepackruns the build, so a packed or published tarball always carries a freshdist/.
📚 Documentation
- NEW: docs/changelog/v1/v1.3.0.md: this changelog.
- README: the requirements list the 22.22.0 floor and the deprecated
./mainalias, and a new "Source layout" section coverssrc/,dist/and theuuid-devcondition (#80). - README What's New promoted to v1.3.0.
🔧 Dependencies
The package still has no runtime dependencies. Everything below is development-only (#82, which also covers Dependabot #69 and the redirected PRs #68, #71, #73, #75 and #77).
| Package | Before | Now | Note |
|---|---|---|---|
tsup |
not installed | 9.0.0 | new, builds dist/ (#80) |
typescript |
5.9.3 | 6.0.3 | 7.x held back: the types consumer test runs typescript/bin/tsc, which 7 no longer exports |
@cldmv/configs |
1.2.4 | 1.3.0 | |
@cldmv/fix-headers |
2.2.0 | 2.2.4 | |
@cldmv/vitest-runner |
1.5.3 | 1.5.6 | |
vitest, @vitest/coverage-v8 |
5.0.3 | 5.0.5 | |
@types/node |
26.6.4 | 26.6.6 | |
vite |
8.3.2 | 8.3.5 | via vitest, clears the open vite advisories |
postcss, nanoid |
8.5.28, 3.3.19 | 8.5.32, 3.3.20 | lockfile refresh with npm audit fix |
- New npm overrides:
katex>=0.19.1 <1.0.0andminimatch^11.0.3, for the advisories in the ESLint chain that@cldmv/configs1.3.0 brings in. Both are development-only.
Upgrade notes
- Node.js 22.22.0 or later is required (was 16.12.0 for
import, and^20.19.0 || >=22.12.0forrequire()). Upgrade Node.js first, or stay on v1.2.6. - Replace
@cldmv/uuid/mainwith@cldmv/uuid. It still works in 1.x but prints aDeprecationWarning(codeCLDMV_UUID_MAIN) and goes away in the next major version. - Nothing else changes for consumers: the
UUIDAPI, its output, and the@cldmv/uuid,./rng,./bytesand./hashimport paths are the same. Code that reached into the package's file layout (rootindex.mjs,dist/uuid.mjs,types/dist/) outside the exports map has to move to the exported paths.
| Metric | Coverage |
|---|---|
| Statements | 88.3% |
| Branches | 88.2% |
| Functions | 93.1% |
| Lines | 88.1% |
Avg: 89.4% · 94afcc0 · Node lts/*
👥 Contributors
v1.2.6
@cldmv/uuid v1.2.6 Changelog
Release Date: October 2026
Release Type: Patch
Branch: release/1.2.6
Overview
v1.2.6 updates the test toolchain: vitest 5.0.2 → 5.0.3 and @cldmv/vitest-runner 1.5.1 → 1.5.3. No runtime code changed. The net change against v1.2.5 is the version field in package.json and the lockfile; index.mjs, index.cjs, the type declarations and the published files list are identical, and the package still has no runtime dependencies. The package's own engines.node stays at >=16.12.0.
🔧 CI & tooling
@cldmv/vitest-runner 1.5.3 raises its own Node.js floor (#64)
@cldmv/vitest-runner 1.5.3 declares engines.node >=22.12.0 (it was >=20.19.0 in 1.5.1), and its chalk dependency moves from 5.6.2 to 6.0.1, which requires Node.js 22 or newer. This only affects people who run this repository's test suite: the CI matrix already starts at Node 22.12.0 because vitest 5 requires ^22.12.0 || ^24.0.0 || >=26.0.0, so CI is unaffected, and contributors need Node.js 22.12 or newer to run npm test. Consumers of @cldmv/uuid never install these packages.
vitest 5.0.3 (#61)
vitest and @vitest/coverage-v8 move from 5.0.2 to 5.0.3 together.
🔧 Dependencies
All dev-only; the lockfile packages map was compared at v1.2.5 and at this release, and every changed entry other than the root package version is a development dependency. The package.json ranges are unchanged because the existing caret ranges already cover the new versions.
| Package | Locked before | Locked now | Role |
|---|---|---|---|
vitest |
5.0.2 | 5.0.3 | dev (#61) |
@vitest/coverage-v8, @vitest/mocker, @vitest/spy |
5.0.2 | 5.0.3 | dev, via vitest |
@cldmv/vitest-runner |
1.5.1 | 1.5.3 | dev (#64) |
chalk |
5.6.2 | 6.0.1 | dev, via @cldmv/vitest-runner; engines.node >=22 |
vite |
8.3.1 | 8.3.2 | dev, via vitest |
rolldown and its @rolldown/binding-* packages |
1.2.11 | 1.2.12 | dev, via vite |
@oxc-project/types |
0.151.0 | 0.152.0 | dev, via rolldown |
why-is-node-running |
3.2.2 | 3.2.1 | dev, resolved one patch lower by the new tree |
📚 Documentation
- Added this changelog and promoted v1.2.6 to the README "What's New" section.
Upgrade notes
- No breaking changes and no runtime change. Drop-in for v1.2.5.
- Contributors running the test suite locally need Node.js 22.12 or newer.
| Metric | Coverage |
|---|---|
| Statements | 85.7% |
| Branches | 84.9% |
| Functions | 92.5% |
| Lines | 85.4% |
Avg: 87.1% · 5222af4 · Node lts/*