ProvenPin Install

uuid v7 sortable identifiers: working versions (tested 2026-10-15)

Generate time-ordered UUID v7 values with the uuid package, validating version bits and lexicographic sort order offline.

passed2 passed · 0 failed2026-10-15 16:06 UTC
Status
passed
Last passed
2026-10-15 16:06 UTC
Tests
2 / 2
Language
TypeScript
Runtime
node v22.23.3
pinned versions3
uuid@14.0.3@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false
npm test
test environment
node v22.23.3
linux 6.17.0-1022-azure
x64
runner: github-actions 38764699834

The code

Exactly the files that passed. Your agent can pull them with get_recipe("uuid-v7-sortable-ids") (install), or see them on GitHub.

package.json
{
  "name": "uuid-v7-sortable-ids",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --import tsx --test test/*.test.ts"
  },
  "dependencies": {"uuid":"14.0.3"},
  "devDependencies": {"@types/node":"26.6.5","tsx":"4.23.15"}
}
src/ids.ts
import { v7 as uuidv7, validate, version } from "uuid";

export function newId() {
  return uuidv7();
}

export function isUuidV7(value: string) {
  return validate(value) && version(value) === 7;
}

export function sortedIds(count: number) {
  const ids = Array.from({ length: count }, () => uuidv7());
  return [...ids].sort();
}
test/ids.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { newId, isUuidV7, sortedIds } from "../src/ids.ts";

test("creates valid uuid v7", () => {
  const id = newId();
  assert.equal(isUuidV7(id), true);
  assert.match(id, /^[0-9a-f-]{36}$/);
});

test("ids sort roughly by creation time", async () => {
  const a = newId();
  await new Promise((r) => setTimeout(r, 5));
  const b = newId();
  assert.ok(a < b);
  const sorted = sortedIds(5);
  assert.deepEqual(sorted, [...sorted].sort());
  assert.equal(sorted.every(isUuidV7), true);
});

Connect to ProvenPin

Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.

terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp

Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.