{"version":3,"file":"index.cjs","names":["VALIDATION_RE","VALIDATION_RE","#codec","#blockOnBackwardsClock","#customState","#state"],"sources":["../src/format.ts","../src/codec.ts","../src/random.ts","../src/generator.ts","../src/index.ts"],"sourcesContent":["export const VALIDATION_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;\n\n// Precomputed RFC 9562 fixed bits, hoisted out of the hot path.\nconst VERSION_BITS = 0b0111n << 76n;\nconst VARIANT_BITS = 0b10n << 62n;\n\nexport function isValid(id: string): boolean {\n\treturn VALIDATION_RE.test(id);\n}\n\nexport function parseTimestamp(id: string): number | null {\n\tif (!VALIDATION_RE.test(id)) return null;\n\treturn parseInt(id.slice(0, 8) + id.slice(9, 13), 16);\n}\n\n// Assembles the hyphenated UUIDv7 string from its bit-level parts. One\n// BigInt-to-hex conversion is faster in V8 than four separate Number-to-hex\n// conversions + padStart calls (measured), so we stay on the BigInt path here.\nexport function assemble(timestamp: number, randA: number, randB: bigint): string {\n\tconst uuid = (BigInt(timestamp) << 80n) | VERSION_BITS | (BigInt(randA) << 64n) | VARIANT_BITS | randB;\n\tconst hex = uuid.toString(16).padStart(32, \"0\");\n\treturn (\n\t\thex.slice(0, 8) + \"-\" + hex.slice(8, 12) + \"-\" + hex.slice(12, 16) + \"-\" + hex.slice(16, 20) + \"-\" + hex.slice(20)\n\t);\n}\n","import { VALIDATION_RE } from \"./format\";\n\nexport type Codec = {\n\talphabet: string;\n\tbase: bigint;\n\tmaxEncodedLen: number;\n\t// charCode → (alphabet index + 1). 0 means \"not in alphabet\". Sized to 128\n\t// because the alphabet is required to be ASCII.\n\tlookup: Uint8Array;\n};\n\nexport function createCodec(alphabet: string): Codec {\n\tif (alphabet.length < 16 || alphabet.length > 64) {\n\t\tthrow new Error(\"uuidv7 error: encode alphabet must be between 16 and 64 characters long\");\n\t}\n\tif (new Set(alphabet).size !== alphabet.length) {\n\t\tthrow new Error(\"uuidv7 error: encode alphabet must not contain duplicate characters\");\n\t}\n\n\tconst lookup = new Uint8Array(128);\n\tfor (let i = 0; i < alphabet.length; i++) {\n\t\tconst code = alphabet.charCodeAt(i);\n\t\tif (code >= 128) {\n\t\t\tthrow new Error(\"uuidv7 error: encode alphabet must contain only ASCII characters\");\n\t\t}\n\t\tlookup[code] = i + 1; // offset by 1 so 0 reliably means \"not present\"\n\t}\n\n\treturn {\n\t\talphabet,\n\t\tbase: BigInt(alphabet.length),\n\t\t// ceil(128 / log2(alphabet.length)) — longest possible valid encoding of a\n\t\t// 128-bit value in this base. Guards against pathological inputs causing\n\t\t// O(n²) BigInt math.\n\t\tmaxEncodedLen: Math.ceil(128 / Math.log2(alphabet.length)),\n\t\tlookup,\n\t};\n}\n\nexport function encode(codec: Codec, id: string): string {\n\tif (!VALIDATION_RE.test(id)) {\n\t\tthrow new Error(`uuidv7 encode error: [${id}] is not a valid UUIDv7`);\n\t}\n\n\tlet n = BigInt(\"0x\" + id.replace(/-/g, \"\"));\n\n\tconst base = codec.base;\n\tconst alphabet = codec.alphabet;\n\tlet encoded = \"\";\n\t// V8's rope-string representation makes this prepend-loop fast for short\n\t// outputs (a UUID encodes to ≤26 chars in any 16-64 alphabet).\n\twhile (n > 0n) {\n\t\tencoded = alphabet[Number(n % base)]! + encoded;\n\t\tn /= base;\n\t}\n\treturn encoded;\n}\n\nexport function decodeOrThrow(codec: Codec, encoded: string): string {\n\t// Bound the input. Without this, an attacker-controlled string can drive\n\t// O(n²) BigInt multiplication.\n\tif (encoded.length === 0 || encoded.length > codec.maxEncodedLen) {\n\t\tthrow new Error(`uuidv7 decode error: invalid encoded id length: ${encoded.length}`);\n\t}\n\n\tconst lookup = codec.lookup;\n\tconst base = codec.base;\n\tlet n = 0n;\n\tfor (let i = 0; i < encoded.length; i++) {\n\t\tconst code = encoded.charCodeAt(i);\n\t\t// `v` is 0 for both non-ASCII (code >= 128 reads past length, returns 0)\n\t\t// and ASCII not in the alphabet. Either way: invalid.\n\t\tconst v = code < 128 ? lookup[code]! : 0;\n\t\tif (v === 0) {\n\t\t\tthrow new Error(`uuidv7 decode error: invalid character in id [${encoded}] at index ${i}: \"${encoded[i]}\"`);\n\t\t}\n\t\tn = n * base + BigInt(v - 1);\n\t}\n\n\tconst hex = n.toString(16).padStart(32, \"0\");\n\t// Length guard above bounds n < base^maxEncodedLen, which can still exceed\n\t// 2^128 by a small margin. Reject the overflow explicitly.\n\tif (hex.length > 32) {\n\t\tthrow new Error(`uuidv7 decode error: cannot decode [${encoded}] into a valid UUIDv7`);\n\t}\n\tconst id =\n\t\thex.slice(0, 8) + \"-\" + hex.slice(8, 12) + \"-\" + hex.slice(12, 16) + \"-\" + hex.slice(16, 20) + \"-\" + hex.slice(20);\n\n\tif (!VALIDATION_RE.test(id)) {\n\t\tthrow new Error(`uuidv7 decode error: cannot decode [${encoded}] into a valid UUIDv7`);\n\t}\n\treturn id;\n}\n\nexport function decode(codec: Codec, encoded: string): string | null {\n\ttry {\n\t\treturn decodeOrThrow(codec, encoded);\n\t} catch {\n\t\treturn null;\n\t}\n}\n","export type GenState = {\n\tlastTimestamp: number;\n\trandA: number; // 12 bits\n\trandB: bigint; // 62 bits\n};\n\nexport const RAND_B_MASK = (1n << 62n) - 1n;\n\nconst incBuf = new Uint32Array(1);\n\nexport function createState(): GenState {\n\treturn { lastTimestamp: -1, randA: 0, randB: 0n };\n}\n\n// Fills the state with fresh CSPRNG-backed random parts. Uses crypto.randomUUID\n// rather than crypto.getRandomValues + typed array reads: V8's BigInt parse\n// from a hex string measurably outperforms BigUint64Array element reads for\n// the 64-bit BigInt we need. The string allocations are absorbed by V8's\n// native fast path for randomUUID().\nexport function fillRandomParts(state: GenState): void {\n\tconst v4 = crypto.randomUUID();\n\tstate.randA = parseInt(v4.slice(15, 18), 16);\n\tstate.randB = BigInt(\"0x\" + v4.replace(/-/g, \"\")) & RAND_B_MASK;\n}\n\n// Returns a BigInt counter increment in [1, 2^32].\nexport function randomIncrement(): bigint {\n\tcrypto.getRandomValues(incBuf);\n\treturn BigInt(incBuf[0]! + 1);\n}\n","import { createCodec, decode, decodeOrThrow, encode, type Codec } from \"./codec\";\nimport { assemble, parseTimestamp } from \"./format\";\nimport { createState, fillRandomParts, randomIncrement, type GenState } from \"./random\";\n\nconst DEFAULT_ALPHABET = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\nconst MAX_TIMESTAMP = 0xffffffffffff; // 2^48 - 1\nconst MAX_RAND_A = 0xfff;\nconst MAX_RAND_B = (1n << 62n) - 1n;\n\n// Module-level regex; the inline literal pattern in `static isValid` below\n// avoids any cross-module property access in the hottest validation path.\nconst VALIDATION_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;\n\nexport class UUIDv7 {\n\t#state: GenState = createState();\n\t#customState: GenState = createState();\n\t#codec: Codec;\n\t#blockOnBackwardsClock: boolean;\n\n\t/**\n\t * Generates a new `UUIDv7` instance.\n\t * @param encodeAlphabet Alphabet used for encoding. Defaults to the\n\t * [Base58](https://www.cs.utexas.edu/users/moore/acl2/manuals/current/manual/index-seo.php/BITCOIN_____A2BASE58-CHARACTERS_A2)\n\t * alphabet. ASCII, 16-64 characters, no duplicates.\n\t * @param blockOnBackwardsClock When `true`, `gen()` synchronously busy-waits\n\t * when the system clock goes backwards relative to the last observed\n\t * timestamp, until the clock catches up. Embedded UUID timestamps will\n\t * always reflect the actual wall clock at the cost of blocking the event\n\t * loop for the duration of any backwards skew. When `false` (default), the\n\t * timestamp is pinned to the last observed value and the monotonic counter\n\t * advances — RFC 9562 §6.2 permits both strategies. Has no effect on the\n\t * custom-timestamp path.\n\t */\n\tconstructor(opts?: { encodeAlphabet?: string; blockOnBackwardsClock?: boolean }) {\n\t\tthis.#codec = createCodec(opts?.encodeAlphabet ?? DEFAULT_ALPHABET);\n\t\tthis.#blockOnBackwardsClock = opts?.blockOnBackwardsClock ?? false;\n\t}\n\n\t/**\n\t * Generates a new UUIDv7.\n\t *\n\t * The two branches (custom-timestamp and runtime) share intent but are\n\t * written out separately rather than via a shared helper — V8's call-frame\n\t * overhead measurably regresses throughput on the regen branch.\n\t *\n\t * @param customTimestamp Custom timestamp in milliseconds. If omitted, uses `Date.now()`.\n\t */\n\tgen(customTimestamp?: number): string {\n\t\tif (typeof customTimestamp === \"number\") {\n\t\t\tif (customTimestamp < 0 || customTimestamp > MAX_TIMESTAMP) {\n\t\t\t\tthrow new Error(\"uuidv7 gen error: custom timestamp must be between 0 and 2 ** 48 - 1\");\n\t\t\t}\n\t\t\tconst cs = this.#customState;\n\n\t\t\tif (customTimestamp !== cs.lastTimestamp) {\n\t\t\t\tfillRandomParts(cs);\n\t\t\t\tcs.lastTimestamp = customTimestamp;\n\t\t\t\treturn assemble(customTimestamp, cs.randA, cs.randB);\n\t\t\t}\n\n\t\t\tconst newB = cs.randB + randomIncrement();\n\t\t\tif (newB <= MAX_RAND_B) {\n\t\t\t\tcs.randB = newB;\n\t\t\t\treturn assemble(customTimestamp, cs.randA, newB);\n\t\t\t}\n\n\t\t\t// rand_b overflow — bump rand_a as secondary counter.\n\t\t\tconst ra = cs.randA + 1;\n\t\t\tif (ra <= MAX_RAND_A) {\n\t\t\t\tfillRandomParts(cs);\n\t\t\t\tcs.randA = ra;\n\t\t\t\treturn assemble(customTimestamp, ra, cs.randB);\n\t\t\t}\n\n\t\t\t// Both overflow on custom-ts: last-resort regen. Breaks per-instance\n\t\t\t// monotonicity for custom timestamps (documented).\n\t\t\tfillRandomParts(cs);\n\t\t\treturn assemble(customTimestamp, cs.randA, cs.randB);\n\t\t}\n\n\t\tconst s = this.#state;\n\t\tlet target = Date.now();\n\t\tif (target < s.lastTimestamp) {\n\t\t\tif (this.#blockOnBackwardsClock) {\n\t\t\t\t// Opt-in: busy-wait until the clock catches up. Embedded timestamp\n\t\t\t\t// will match wall-clock at the cost of blocking the event loop.\n\t\t\t\tdo {\n\t\t\t\t\ttarget = Date.now();\n\t\t\t\t} while (target < s.lastTimestamp);\n\t\t\t} else {\n\t\t\t\t// Default: pin to lastTimestamp and let the counter advance.\n\t\t\t\t// RFC 9562 §6.2 permits sub-millisecond drift for monotonicity.\n\t\t\t\ttarget = s.lastTimestamp;\n\t\t\t}\n\t\t}\n\n\t\tif (target !== s.lastTimestamp) {\n\t\t\tfillRandomParts(s);\n\t\t\ts.lastTimestamp = target;\n\t\t\treturn assemble(target, s.randA, s.randB);\n\t\t}\n\n\t\tconst newB = s.randB + randomIncrement();\n\t\tif (newB <= MAX_RAND_B) {\n\t\t\ts.randB = newB;\n\t\t\treturn assemble(target, s.randA, newB);\n\t\t}\n\n\t\tconst ra = s.randA + 1;\n\t\tif (ra <= MAX_RAND_A) {\n\t\t\tfillRandomParts(s);\n\t\t\ts.randA = ra;\n\t\t\treturn assemble(target, ra, s.randB);\n\t\t}\n\n\t\t// Both overflow within one millisecond: advance the timestamp by 1ms.\n\t\t// Sub-millisecond drift is permitted by RFC 9562 §6.2.\n\t\tconst ts = target + 1;\n\t\tfillRandomParts(s);\n\t\ts.lastTimestamp = ts;\n\t\treturn assemble(ts, s.randA, s.randB);\n\t}\n\n\t/**\n\t * Generates an array of new UUIDv7s.\n\t */\n\tgenMany(amount: number, customTimestamp?: number): string[] {\n\t\tif (amount <= 0) {\n\t\t\tthrow new Error(\"uuidv7 genMany error: generation amount must be greater than 0\");\n\t\t}\n\t\tconst out: string[] = [];\n\t\tfor (let i = 0; i < amount; i++) {\n\t\t\tout.push(this.gen(customTimestamp));\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t * Encodes a UUIDv7 with the instance's alphabet.\n\t */\n\tencode(id: string): string {\n\t\treturn encode(this.#codec, id);\n\t}\n\n\t/**\n\t * Decodes an encoded UUIDv7. Returns `null` if invalid.\n\t */\n\tdecode(encodedId: string): string | null {\n\t\treturn decode(this.#codec, encodedId);\n\t}\n\n\t/**\n\t * Decodes an encoded UUIDv7. Throws if invalid.\n\t */\n\tdecodeOrThrow(encodedId: string): string {\n\t\treturn decodeOrThrow(this.#codec, encodedId);\n\t}\n\n\tstatic isValid(id: string): boolean {\n\t\treturn VALIDATION_RE.test(id);\n\t}\n\n\tstatic timestamp(id: string): number | null {\n\t\treturn parseTimestamp(id);\n\t}\n\n\tstatic date(id: string): Date | null {\n\t\tconst ts = parseTimestamp(id);\n\t\treturn ts === null ? null : new Date(ts);\n\t}\n}\n","import { UUIDv7 } from \"./generator\";\n\nexport { UUIDv7 } from \"./generator\";\n\nconst defaultId = new UUIDv7();\n\n/**\n * Generates a new UUIDv7 using the shared default instance.\n */\nexport function uuidv7(customTimestamp?: number): string {\n\treturn defaultId.gen(customTimestamp);\n}\n\n/**\n * Encodes a UUIDv7 with the default Base58 alphabet.\n */\nexport function encodeUUIDv7(id: string): string {\n\treturn defaultId.encode(id);\n}\n\n/**\n * Decodes an encoded UUIDv7. Returns `null` if invalid.\n */\nexport function decodeUUIDv7(encodedId: string): string | null {\n\treturn defaultId.decode(encodedId);\n}\n\n/**\n * Decodes an encoded UUIDv7. Throws if invalid.\n */\nexport function decodeOrThrowUUIDv7(encodedId: string): string {\n\treturn defaultId.decodeOrThrow(encodedId);\n}\n"],"mappings":";;AAAA,MAAaA,kBAAgB;AAG7B,MAAM,eAAe,MAAW;AAChC,MAAM,eAAe,MAAS;AAM9B,SAAgB,eAAe,IAA2B;AACzD,KAAI,CAACA,gBAAc,KAAK,GAAG,CAAE,QAAO;AACpC,QAAO,SAAS,GAAG,MAAM,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,EAAE,GAAG;;AAMtD,SAAgB,SAAS,WAAmB,OAAe,OAAuB;CAEjF,MAAM,OADQ,OAAO,UAAU,IAAI,MAAO,eAAgB,OAAO,MAAM,IAAI,MAAO,eAAe,OAChF,SAAS,GAAG,CAAC,SAAS,IAAI,IAAI;AAC/C,QACC,IAAI,MAAM,GAAG,EAAE,G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