@ingram-tech/nk-db 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/id.d.ts +63 -0
- package/dist/id.d.ts.map +1 -0
- package/dist/id.js +138 -0
- package/dist/id.js.map +1 -0
- package/package.json +5 -1
package/dist/id.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Ingram id codec — a UUIDv7 and its base58 skin. It lives here in nk-db
|
|
3
|
+
* (the lowest package in the graph) behind the `@ingram-tech/nk-db/id` subpath,
|
|
4
|
+
* so it stays `node:crypto`-only — no `pg` / `drizzle` — and any site can mint
|
|
5
|
+
* ids without pulling a heavier slice.
|
|
6
|
+
*
|
|
7
|
+
* The Python twin lives in cloud.ingram.tech's `v1/core.py` (`new_id`); the
|
|
8
|
+
* byte → string vectors in `id.test.ts` and that repo's `tests/test_ids.py` are
|
|
9
|
+
* kept identical, so a stored UUIDv7 and an `agt_` / `smt_` id from the API are
|
|
10
|
+
* the same encoding of the same 16 bytes. That cross-impl contract is the most
|
|
11
|
+
* important property of this file — keep the vectors in lockstep.
|
|
12
|
+
*
|
|
13
|
+
* Store the hyphenated UUIDv7 at rest (uuid columns stay native and time-ordered
|
|
14
|
+
* for index locality) and use {@link toPrefixedId} to skin it as a prefixed
|
|
15
|
+
* base58 id for the wire / display, {@link fromPrefixedId} to recover it.
|
|
16
|
+
* {@link base58Id} mints a fresh one directly; {@link createIdRegistry} builds a
|
|
17
|
+
* typed, prefix-validated set of helpers for a project's entities.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Mint a **UUIDv7** (RFC 9562): a 48-bit Unix-ms timestamp prefix + random tail,
|
|
21
|
+
* version `7`, variant `10`. UUID-shaped (drops straight into a `uuid` column)
|
|
22
|
+
* while staying time-ordered for index locality. Used as Better Auth's
|
|
23
|
+
* `advanced.database.generateId`. Node/Bun's `randomUUID` is v4-only, so we lay
|
|
24
|
+
* the bytes out by hand.
|
|
25
|
+
*/
|
|
26
|
+
export declare const uuidGenerateId: () => string;
|
|
27
|
+
/** Skin a stored hyphenated UUIDv7 as a prefixed base58 id, e.g. `team_…`. */
|
|
28
|
+
export declare function toPrefixedId(uuid: string, prefix: string): string;
|
|
29
|
+
/** Inverse of {@link toPrefixedId}: recover the hyphenated UUIDv7. */
|
|
30
|
+
export declare function fromPrefixedId(id: string): string;
|
|
31
|
+
/** Mint a fresh prefixed base58 id (UUIDv7 core), for text-id sites / API parity. */
|
|
32
|
+
export declare function base58Id(prefix: string): string;
|
|
33
|
+
/** Typed helpers for one entity's prefixed ids — built by {@link createIdRegistry}. */
|
|
34
|
+
export interface IdHelper {
|
|
35
|
+
/** This entity's prefix, e.g. `"agt"` (no trailing underscore). */
|
|
36
|
+
readonly prefix: string;
|
|
37
|
+
/** Mint a fresh prefixed id (new UUIDv7 core). */
|
|
38
|
+
mint(): string;
|
|
39
|
+
/** Skin a stored hyphenated UUIDv7 as this entity's prefixed id. */
|
|
40
|
+
encode(uuid: string): string;
|
|
41
|
+
/** Recover the hyphenated UUIDv7; throws if the prefix / shape doesn't match. */
|
|
42
|
+
decode(id: string): string;
|
|
43
|
+
/** Whether `id` is a well-formed prefixed id for this entity. */
|
|
44
|
+
is(id: string): boolean;
|
|
45
|
+
}
|
|
46
|
+
/** The map returned by {@link createIdRegistry}: one {@link IdHelper} per key. */
|
|
47
|
+
export type IdRegistry<K extends string> = Record<K, IdHelper>;
|
|
48
|
+
/**
|
|
49
|
+
* Build a typed, prefix-validated id registry for a project's entities — one
|
|
50
|
+
* place to declare every prefix instead of hand-rolling encode/decode wrappers:
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* const ids = createIdRegistry({ org: "org", agent: "agt", session: "cs" });
|
|
54
|
+
* ids.org.mint(); // "org_3k9…"
|
|
55
|
+
* ids.org.encode(uuid); // "org_…"
|
|
56
|
+
* ids.org.decode("org_…"); // uuid — throws on a wrong / missing prefix
|
|
57
|
+
* ids.agent.is(someId); // boolean
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function createIdRegistry<const T extends Record<string, string>>(prefixes: T): {
|
|
61
|
+
[K in keyof T]: IdHelper;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=id.d.ts.map
|
package/dist/id.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,QAAO,MAYjC,CAAC;AAuDF,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,uFAAuF;AACvF,MAAM,WAAW,QAAQ;IACxB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,IAAI,IAAI,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,iFAAiF;IACjF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,iEAAiE;IACjE,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,kFAAkF;AAClF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAiB/D;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtE,QAAQ,EAAE,CAAC,GACT;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ;CAAE,CAM9B"}
|
package/dist/id.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
/**
|
|
3
|
+
* The Ingram id codec — a UUIDv7 and its base58 skin. It lives here in nk-db
|
|
4
|
+
* (the lowest package in the graph) behind the `@ingram-tech/nk-db/id` subpath,
|
|
5
|
+
* so it stays `node:crypto`-only — no `pg` / `drizzle` — and any site can mint
|
|
6
|
+
* ids without pulling a heavier slice.
|
|
7
|
+
*
|
|
8
|
+
* The Python twin lives in cloud.ingram.tech's `v1/core.py` (`new_id`); the
|
|
9
|
+
* byte → string vectors in `id.test.ts` and that repo's `tests/test_ids.py` are
|
|
10
|
+
* kept identical, so a stored UUIDv7 and an `agt_` / `smt_` id from the API are
|
|
11
|
+
* the same encoding of the same 16 bytes. That cross-impl contract is the most
|
|
12
|
+
* important property of this file — keep the vectors in lockstep.
|
|
13
|
+
*
|
|
14
|
+
* Store the hyphenated UUIDv7 at rest (uuid columns stay native and time-ordered
|
|
15
|
+
* for index locality) and use {@link toPrefixedId} to skin it as a prefixed
|
|
16
|
+
* base58 id for the wire / display, {@link fromPrefixedId} to recover it.
|
|
17
|
+
* {@link base58Id} mints a fresh one directly; {@link createIdRegistry} builds a
|
|
18
|
+
* typed, prefix-validated set of helpers for a project's entities.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Mint a **UUIDv7** (RFC 9562): a 48-bit Unix-ms timestamp prefix + random tail,
|
|
22
|
+
* version `7`, variant `10`. UUID-shaped (drops straight into a `uuid` column)
|
|
23
|
+
* while staying time-ordered for index locality. Used as Better Auth's
|
|
24
|
+
* `advanced.database.generateId`. Node/Bun's `randomUUID` is v4-only, so we lay
|
|
25
|
+
* the bytes out by hand.
|
|
26
|
+
*/
|
|
27
|
+
export const uuidGenerateId = () => {
|
|
28
|
+
const bytes = randomBytes(16);
|
|
29
|
+
const ts = Date.now();
|
|
30
|
+
bytes[0] = Math.floor(ts / 2 ** 40) & 0xff;
|
|
31
|
+
bytes[1] = Math.floor(ts / 2 ** 32) & 0xff;
|
|
32
|
+
bytes[2] = Math.floor(ts / 2 ** 24) & 0xff;
|
|
33
|
+
bytes[3] = Math.floor(ts / 2 ** 16) & 0xff;
|
|
34
|
+
bytes[4] = Math.floor(ts / 2 ** 8) & 0xff;
|
|
35
|
+
bytes[5] = ts & 0xff;
|
|
36
|
+
bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x70; // version 7
|
|
37
|
+
bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80; // variant 10
|
|
38
|
+
return bytesToUuid(bytes);
|
|
39
|
+
};
|
|
40
|
+
const B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
41
|
+
// ceil(128 / log2(58)): a 16-byte value never needs more than 22 digits. We
|
|
42
|
+
// left-pad to it so every body is uniform width and sorts lexically ==
|
|
43
|
+
// chronologically (UUIDv7's ms-timestamp prefix lives in the high bytes).
|
|
44
|
+
const WIDTH = 22;
|
|
45
|
+
// A bare base58 body: 22 chars, Bitcoin alphabet (no 0 / I / O / l).
|
|
46
|
+
const BODY = "[1-9A-HJ-NP-Za-km-z]{22}";
|
|
47
|
+
/** Big-endian base58 (Bitcoin alphabet) of 16 bytes, left-padded to `WIDTH`. */
|
|
48
|
+
function encode58(bytes) {
|
|
49
|
+
let n = 0n;
|
|
50
|
+
for (const b of bytes)
|
|
51
|
+
n = (n << 8n) | BigInt(b);
|
|
52
|
+
let out = "";
|
|
53
|
+
while (n > 0n) {
|
|
54
|
+
out = B58.charAt(Number(n % 58n)) + out;
|
|
55
|
+
n /= 58n;
|
|
56
|
+
}
|
|
57
|
+
return out.padStart(WIDTH, B58.charAt(0));
|
|
58
|
+
}
|
|
59
|
+
/** Inverse of {@link encode58}: a base58 body back to 16 bytes. */
|
|
60
|
+
function decode58(body) {
|
|
61
|
+
let n = 0n;
|
|
62
|
+
for (const ch of body) {
|
|
63
|
+
const v = B58.indexOf(ch);
|
|
64
|
+
if (v < 0)
|
|
65
|
+
throw new Error(`invalid base58 char: ${ch}`);
|
|
66
|
+
n = n * 58n + BigInt(v);
|
|
67
|
+
}
|
|
68
|
+
const bytes = new Uint8Array(16);
|
|
69
|
+
for (let i = 15; i >= 0; i--) {
|
|
70
|
+
bytes[i] = Number(n & 0xffn);
|
|
71
|
+
n >>= 8n;
|
|
72
|
+
}
|
|
73
|
+
return bytes;
|
|
74
|
+
}
|
|
75
|
+
/** A hyphenated UUID string → its 16 raw bytes. */
|
|
76
|
+
function uuidToBytes(uuid) {
|
|
77
|
+
const hex = uuid.replace(/-/g, "");
|
|
78
|
+
if (!/^[0-9a-fA-F]{32}$/.test(hex))
|
|
79
|
+
throw new Error(`not a uuid: ${uuid}`);
|
|
80
|
+
const bytes = new Uint8Array(16);
|
|
81
|
+
for (let i = 0; i < 16; i++) {
|
|
82
|
+
bytes[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
83
|
+
}
|
|
84
|
+
return bytes;
|
|
85
|
+
}
|
|
86
|
+
/** 16 raw bytes → a canonical hyphenated UUID string. */
|
|
87
|
+
function bytesToUuid(bytes) {
|
|
88
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
89
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
90
|
+
}
|
|
91
|
+
/** Skin a stored hyphenated UUIDv7 as a prefixed base58 id, e.g. `team_…`. */
|
|
92
|
+
export function toPrefixedId(uuid, prefix) {
|
|
93
|
+
return `${prefix}_${encode58(uuidToBytes(uuid))}`;
|
|
94
|
+
}
|
|
95
|
+
/** Inverse of {@link toPrefixedId}: recover the hyphenated UUIDv7. */
|
|
96
|
+
export function fromPrefixedId(id) {
|
|
97
|
+
const body = id.slice(id.indexOf("_") + 1);
|
|
98
|
+
return bytesToUuid(decode58(body));
|
|
99
|
+
}
|
|
100
|
+
/** Mint a fresh prefixed base58 id (UUIDv7 core), for text-id sites / API parity. */
|
|
101
|
+
export function base58Id(prefix) {
|
|
102
|
+
return toPrefixedId(uuidGenerateId(), prefix);
|
|
103
|
+
}
|
|
104
|
+
function makeHelper(prefix) {
|
|
105
|
+
// Prefixes are developer-controlled identifier constants, never user input.
|
|
106
|
+
const matcher = new RegExp(`^${prefix}_${BODY}$`);
|
|
107
|
+
return {
|
|
108
|
+
prefix,
|
|
109
|
+
mint: () => base58Id(prefix),
|
|
110
|
+
encode: (uuid) => toPrefixedId(uuid, prefix),
|
|
111
|
+
decode: (id) => {
|
|
112
|
+
if (!matcher.test(id))
|
|
113
|
+
throw new Error(`not a ${prefix}_ id: ${id}`);
|
|
114
|
+
return fromPrefixedId(id);
|
|
115
|
+
},
|
|
116
|
+
is: (id) => matcher.test(id),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Build a typed, prefix-validated id registry for a project's entities — one
|
|
121
|
+
* place to declare every prefix instead of hand-rolling encode/decode wrappers:
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* const ids = createIdRegistry({ org: "org", agent: "agt", session: "cs" });
|
|
125
|
+
* ids.org.mint(); // "org_3k9…"
|
|
126
|
+
* ids.org.encode(uuid); // "org_…"
|
|
127
|
+
* ids.org.decode("org_…"); // uuid — throws on a wrong / missing prefix
|
|
128
|
+
* ids.agent.is(someId); // boolean
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export function createIdRegistry(prefixes) {
|
|
132
|
+
const reg = {};
|
|
133
|
+
for (const [key, prefix] of Object.entries(prefixes)) {
|
|
134
|
+
reg[key] = makeHelper(prefix);
|
|
135
|
+
}
|
|
136
|
+
return reg;
|
|
137
|
+
}
|
|
138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E,CAAC,CAAC;QAC3B,CAAC;QACD,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;KAC5B,CAAC;AACH,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAAW;IAEX,MAAM,GAAG,GAA6B,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAmC,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingram-tech/nk-db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The Ingram Postgres data layer: one TLS-aware pg pool, raw-SQL helpers, Drizzle wiring, and a PGlite (no-Docker) dev/test harness for Next.js sites.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"import": "./dist/index.js"
|
|
25
25
|
},
|
|
26
|
+
"./id": {
|
|
27
|
+
"types": "./dist/id.d.ts",
|
|
28
|
+
"import": "./dist/id.js"
|
|
29
|
+
},
|
|
26
30
|
"./pglite": {
|
|
27
31
|
"types": "./dist/pglite/index.d.ts",
|
|
28
32
|
"import": "./dist/pglite/index.js"
|