@bjornpagen/bumbledb-log 0.20.0 → 0.20.2

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.
Files changed (76) hide show
  1. package/dist/braids.d.ts +28 -0
  2. package/dist/braids.d.ts.map +1 -0
  3. package/{src/braids.ts → dist/braids.js} +22 -29
  4. package/dist/braids.js.map +1 -0
  5. package/dist/bytes.d.ts +26 -0
  6. package/dist/bytes.d.ts.map +1 -0
  7. package/dist/bytes.js +86 -0
  8. package/dist/bytes.js.map +1 -0
  9. package/dist/chain.d.ts +56 -0
  10. package/dist/chain.d.ts.map +1 -0
  11. package/dist/chain.js +137 -0
  12. package/dist/chain.js.map +1 -0
  13. package/dist/codec.d.ts +71 -0
  14. package/dist/codec.d.ts.map +1 -0
  15. package/dist/codec.js +179 -0
  16. package/dist/codec.js.map +1 -0
  17. package/dist/descriptor.d.ts +61 -0
  18. package/dist/descriptor.d.ts.map +1 -0
  19. package/dist/descriptor.js +160 -0
  20. package/dist/descriptor.js.map +1 -0
  21. package/dist/errors.d.ts +202 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/errors.js +122 -0
  24. package/dist/errors.js.map +1 -0
  25. package/dist/index.d.ts +34 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +24 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/keys.d.ts +52 -0
  30. package/dist/keys.d.ts.map +1 -0
  31. package/dist/keys.js +166 -0
  32. package/dist/keys.js.map +1 -0
  33. package/dist/manifest.d.ts +42 -0
  34. package/dist/manifest.d.ts.map +1 -0
  35. package/dist/manifest.js +116 -0
  36. package/dist/manifest.js.map +1 -0
  37. package/dist/replica.d.ts +154 -0
  38. package/dist/replica.d.ts.map +1 -0
  39. package/dist/replica.js +820 -0
  40. package/dist/replica.js.map +1 -0
  41. package/dist/store-s3.d.ts +31 -0
  42. package/dist/store-s3.d.ts.map +1 -0
  43. package/dist/store-s3.js +299 -0
  44. package/dist/store-s3.js.map +1 -0
  45. package/dist/store.d.ts +129 -0
  46. package/dist/store.d.ts.map +1 -0
  47. package/dist/store.js +577 -0
  48. package/dist/store.js.map +1 -0
  49. package/dist/tenants.d.ts +56 -0
  50. package/dist/tenants.d.ts.map +1 -0
  51. package/dist/tenants.js +333 -0
  52. package/dist/tenants.js.map +1 -0
  53. package/dist/tilde-family.json +21 -0
  54. package/dist/vector.d.ts +31 -0
  55. package/dist/vector.d.ts.map +1 -0
  56. package/dist/vector.js +87 -0
  57. package/dist/vector.js.map +1 -0
  58. package/dist/writer.d.ts +106 -0
  59. package/dist/writer.d.ts.map +1 -0
  60. package/dist/writer.js +677 -0
  61. package/dist/writer.js.map +1 -0
  62. package/package.json +12 -7
  63. package/src/bytes.ts +0 -115
  64. package/src/chain.ts +0 -181
  65. package/src/codec.ts +0 -252
  66. package/src/descriptor.ts +0 -240
  67. package/src/errors.ts +0 -309
  68. package/src/index.ts +0 -57
  69. package/src/keys.ts +0 -218
  70. package/src/manifest.ts +0 -161
  71. package/src/replica.ts +0 -1061
  72. package/src/store-s3.ts +0 -377
  73. package/src/store.ts +0 -727
  74. package/src/tenants.ts +0 -414
  75. package/src/vector.ts +0 -103
  76. package/src/writer.ts +0 -977
package/dist/codec.js ADDED
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The command codec seat (20): one implementation reads and writes the
3
+ * batch wire — `crates/bumbledb-log`, reached through the sealed
4
+ * per-theory `LogCodec` handle the descriptor parse mints
5
+ * (`descriptor.codec`). This module is typed payload construction only:
6
+ * raw rows tag by the descriptor's layout on the way in, decoded rows
7
+ * cross exactly as the engine's `ValueOut` walk, and every grammar
8
+ * refusal carries the log core's own identity kind, minted through the
9
+ * bridge's `log-identities.json` table. The chain discipline
10
+ * (`verifyChain`) is pure slot algebra over decoded headers and stays
11
+ * host-side; no byte grammar lives here.
12
+ */
13
+ import { internalLogDecodeBatch, internalLogEncodeBatch } from "@bjornpagen/bumbledb";
14
+ import * as errors from "@superbuilders/errors";
15
+ import { bytesEqual, digest32 } from "#bytes.ts";
16
+ import { braidHex, descriptorOf } from "#descriptor.ts";
17
+ import { refuse, refuseChain } from "#errors.ts";
18
+ import { generation } from "#keys.ts";
19
+ function braidIdOf(id) {
20
+ return Number.parseInt(id.slice(1), 16);
21
+ }
22
+ function asDigest(bytes, at) {
23
+ if (bytes.length !== 32) {
24
+ refuse({ kind: "DigestWidth" }, `${at} is not 32 bytes`);
25
+ }
26
+ return digest32(bytes);
27
+ }
28
+ /** A bridge refusal row surfaces as `ErrRefused` carrying the core's identity kind. */
29
+ function refuseBridge(kind, message) {
30
+ refuse({ kind }, message);
31
+ }
32
+ /**
33
+ * Tags one raw cell by the field's declared layout — the bridge's
34
+ * inbound spelling. Only the JS shape is judged here (the tag must be
35
+ * constructible); range, width, and interval emptiness are the core's
36
+ * own `Value` refusal.
37
+ */
38
+ function taggedCell(where, type, value) {
39
+ switch (type.kind) {
40
+ case "bool": {
41
+ if (typeof value !== "boolean") {
42
+ throw errors.new(`${where}: expected boolean`);
43
+ }
44
+ return { kind: "bool", value };
45
+ }
46
+ case "u64": {
47
+ if (typeof value !== "bigint") {
48
+ throw errors.new(`${where}: expected u64 bigint`);
49
+ }
50
+ return { kind: "u64", value };
51
+ }
52
+ case "i64": {
53
+ if (typeof value !== "bigint") {
54
+ throw errors.new(`${where}: expected i64 bigint`);
55
+ }
56
+ return { kind: "i64", value };
57
+ }
58
+ case "string": {
59
+ if (typeof value !== "string") {
60
+ throw errors.new(`${where}: expected well-formed string`);
61
+ }
62
+ if (!value.isWellFormed()) {
63
+ throw errors.new(`${where}: string cell is not well-formed UTF-8`);
64
+ }
65
+ return { kind: "string", value };
66
+ }
67
+ case "fixedBytes": {
68
+ if (!(value instanceof Uint8Array)) {
69
+ throw errors.new(`${where}: expected ${type.len}-byte Uint8Array`);
70
+ }
71
+ return { kind: "fixedBytes", value };
72
+ }
73
+ case "interval": {
74
+ if (typeof value !== "object" || value instanceof Uint8Array) {
75
+ throw errors.new(`${where}: expected interval value`);
76
+ }
77
+ return type.element === "u64"
78
+ ? { kind: "intervalU64", start: value.start, end: value.end }
79
+ : { kind: "intervalI64", start: value.start, end: value.end };
80
+ }
81
+ }
82
+ }
83
+ /**
84
+ * Ops to the bridge's spelling: relation names resolve through the
85
+ * descriptor's vocabulary (the core never sees a name), cells tag by
86
+ * the layout. A cell past the layout's width has no type to tag by and
87
+ * refuses `Arity` here; every other judgment is the core's.
88
+ */
89
+ function opsIn(descriptor, ops) {
90
+ return ops.map(function opIn(op, opIndex) {
91
+ const relation = descriptor.relationByName.get(op.relation);
92
+ if (relation === undefined) {
93
+ throw errors.new(`op cites unknown relation ${op.relation}`);
94
+ }
95
+ const rows = op.rows.map(function rowIn(row, rowIndex) {
96
+ return row.map(function cellIn(value, ordinal) {
97
+ const field = relation.fields[ordinal];
98
+ if (field === undefined) {
99
+ refuse({ kind: "Arity", op: opIndex, relation: relation.name, row: rowIndex }, `op ${opIndex} relation ${relation.name} row ${rowIndex} cell ${ordinal} is outside the ${relation.fields.length}-field layout`);
100
+ }
101
+ return taggedCell(`relation ${relation.name} field ${field.name}`, field.type, value);
102
+ });
103
+ });
104
+ return { kind: op.op, relation: relation.id, rows };
105
+ });
106
+ }
107
+ /**
108
+ * Encodes one batch through the sealed codec. The handle is the
109
+ * fingerprint authority: encode fills the wire's fingerprint from the
110
+ * sealed codec, so none rides the bridge (a short `prev` is
111
+ * `DigestWidth` at this gate). Braid membership, closedness, arity, and
112
+ * value validity are the core's refusals, crossing with their identity
113
+ * kinds.
114
+ */
115
+ function encodeBatch(theory, header, ops) {
116
+ const descriptor = descriptorOf(theory);
117
+ const prev = asDigest(header.prev, "prev");
118
+ const outcome = internalLogEncodeBatch(descriptor.codec, {
119
+ braid: braidIdOf(header.braid),
120
+ braidGen: header.braidGen,
121
+ prev,
122
+ writer: header.writer,
123
+ timestamp: header.timestamp
124
+ }, opsIn(descriptor, ops));
125
+ if (!outcome.ok) {
126
+ refuseBridge(outcome.kind, outcome.message);
127
+ }
128
+ return outcome.value;
129
+ }
130
+ /** Full parse of a batch object by the one grammar; refusals cross typed, never partial reads. */
131
+ function decodeBatch(theory, bytes) {
132
+ const descriptor = descriptorOf(theory);
133
+ const outcome = internalLogDecodeBatch(descriptor.codec, bytes);
134
+ if (!outcome.ok) {
135
+ refuseBridge(outcome.kind, outcome.message);
136
+ }
137
+ const batch = outcome.value;
138
+ const ops = batch.ops.map(function opOut(op) {
139
+ const relation = descriptor.relations[op.relation];
140
+ if (relation === undefined) {
141
+ throw errors.new(`decoded op cites relation ${op.relation} outside the descriptor`);
142
+ }
143
+ return { op: op.kind, relation: relation.name, rows: op.rows };
144
+ });
145
+ return {
146
+ header: {
147
+ // Decode already refused any batch whose fingerprint is not
148
+ // the handle's own, so the descriptor's is the batch's.
149
+ fingerprint: digest32(descriptor.fingerprintBytes),
150
+ braid: braidHex(batch.header.braid),
151
+ braidGen: generation(batch.header.braidGen),
152
+ prev: digest32(batch.header.prev),
153
+ writer: batch.header.writer,
154
+ timestamp: batch.header.timestamp
155
+ },
156
+ ops
157
+ };
158
+ }
159
+ /**
160
+ * The chain discipline (20 apply, step 1): one identity, three proved
161
+ * causes — the header's slot identity (braid and generation, both
162
+ * halves of the key the object was fetched from), its `prev` vs the
163
+ * chain head, its timestamp vs the head's. Corruption-class; the header
164
+ * names the misbehaving writer, and the refusal data names the fetched
165
+ * braid.
166
+ */
167
+ function verifyChain(header, braid, slot, chain) {
168
+ if (header.braid !== braid || header.braidGen !== slot) {
169
+ refuseChain({ cause: "slot", braid, slot, writer: header.writer }, `braid ${braid}: header slot identity ${header.braid}/${header.braidGen} ≠ the fetched key's ${braid}/${slot}`);
170
+ }
171
+ if (!bytesEqual(header.prev, chain.prev)) {
172
+ refuseChain({ cause: "prev", braid, slot, writer: header.writer }, `braid ${braid} slot ${slot}: prev does not cite the predecessor`);
173
+ }
174
+ if (header.timestamp < chain.ts) {
175
+ refuseChain({ cause: "timestamp", braid, slot, writer: header.writer }, `braid ${braid} slot ${slot}: timestamp regresses below the predecessor`);
176
+ }
177
+ }
178
+ export { decodeBatch, encodeBatch, verifyChain };
179
+ //# sourceMappingURL=codec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGhD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAqCrC,SAAS,SAAS,CAAC,EAAS;IAC3B,OAAO,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACxC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAiB,EAAE,EAAU;IAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACzB,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAA;IACzD,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;AACvB,CAAC;AAED,uFAAuF;AACvF,SAAS,YAAY,CAAC,IAA6C,EAAE,OAAe;IACnF,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAA;AAC1B,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU,CAAC,KAAa,EAAE,IAAmB,EAAE,KAAgB;IACvE,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,MAAM,EAAE,CAAC;YACb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AAC,MAAM,CAAC,MAAM;YAC3B,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS;SACjC;QACD,GAAG;KACH,CAAA;AACF,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,MAAmB,EAAE,KAAY,EAAE,IAAgB,EAAE,KAAiB;IAC1F,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QACxD,WAAW,CACV,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EACrD,SAAS,KAAK,0BAA0B,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,wBAAwB,KAAK,IAAI,IAAI,EAAE,CAC9G,CAAA;IACF,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,WAAW,CACV,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EACrD,SAAS,KAAK,SAAS,IAAI,sCAAsC,CACjE,CAAA;IACF,CAAC;IACD,IAAI,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC;QACjC,WAAW,CACV,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAC1D,SAAS,KAAK,SAAS,IAAI,6CAA6C,CACxE,CAAA;IACF,CAAC;AACF,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * The parsed protocol descriptor: one thin parse of the engine's sealed
3
+ * truth — relation ids, sealed field order, resolved closed rows,
4
+ * materialized statements, and the real fingerprint — plus the braid
5
+ * map and serial-at roster read off the log core's braids seat
6
+ * (`internalLogBraidsOf`): one derivation of the braid partition,
7
+ * projected here into the driver's branded shapes. Cached per theory
8
+ * value.
9
+ */
10
+ import type { AnySchema, FactValue, LogCodecHandle, SchemaSpec, SealedStatement, ValueTypeSpec } from "@bjornpagen/bumbledb";
11
+ interface FieldInfo {
12
+ readonly name: string;
13
+ readonly type: ValueTypeSpec;
14
+ readonly fresh: boolean;
15
+ /** Set when the field's newtype names a closed relation's id class. */
16
+ readonly closedRef: string | undefined;
17
+ }
18
+ interface RelationInfo {
19
+ readonly id: number;
20
+ readonly name: string;
21
+ readonly closed: boolean;
22
+ readonly handles: readonly string[];
23
+ /** Sealed order: a closed relation's synthetic u64 `id` at ordinal 0. */
24
+ readonly fields: readonly FieldInfo[];
25
+ /** Closed ground axioms in sealed order (id first), resolved values. */
26
+ readonly rows: ReadonlyArray<readonly FactValue[]>;
27
+ }
28
+ declare const braidBrand: unique symbol;
29
+ type Braid = string & {
30
+ readonly [braidBrand]: typeof braidBrand;
31
+ };
32
+ declare function braid(raw: string): Braid;
33
+ interface SerialStatement {
34
+ readonly statement: number;
35
+ readonly braid: Braid;
36
+ }
37
+ /** The braids seat names serial-at statements by id; the braid tag is a
38
+ * projection join through the statement's own relation. */
39
+ declare function serialAtFrom(ids: readonly number[], statements: readonly SealedStatement[], braidOfRelation: ReadonlyMap<number, Braid>): SerialStatement[];
40
+ interface Descriptor {
41
+ readonly relations: readonly RelationInfo[];
42
+ readonly relationByName: ReadonlyMap<string, RelationInfo>;
43
+ readonly statements: readonly SealedStatement[];
44
+ /** Ordinary relation id → braid id (`c{smallest:08x}`). */
45
+ readonly braidOfRelation: ReadonlyMap<number, Braid>;
46
+ /** Braid id → member relation ids, ascending. */
47
+ readonly braidMembers: ReadonlyMap<Braid, readonly number[]>;
48
+ readonly serialAtStatements: readonly SerialStatement[];
49
+ /** The sealed per-theory codec handle — the grammar's one reader,
50
+ * minted once and cached with the parse. */
51
+ readonly codec: LogCodecHandle;
52
+ readonly fingerprint: string;
53
+ readonly fingerprintBytes: Uint8Array;
54
+ }
55
+ /** The pure trio's input: the theory value, its lowered spec, or an already-parsed descriptor. */
56
+ type Theory = AnySchema | SchemaSpec | Descriptor;
57
+ declare function descriptorOf(theory: Theory): Descriptor;
58
+ declare function braidHex(relationId: number): Braid;
59
+ export type { Braid, Descriptor, FieldInfo, RelationInfo, SerialStatement, Theory };
60
+ export { braid, braidHex, descriptorOf, serialAtFrom };
61
+ //# sourceMappingURL=descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACd,UAAU,EAEV,eAAe,EACf,aAAa,EACb,MAAM,sBAAsB,CAAA;AAM7B,UAAU,SAAS;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC;AAED,UAAU,YAAY;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAA;IACrC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,SAAS,EAAE,CAAC,CAAA;CAClD;AAED,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAA;AACvC,KAAK,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,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oGD,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA;AACnF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * The parsed protocol descriptor: one thin parse of the engine's sealed
3
+ * truth — relation ids, sealed field order, resolved closed rows,
4
+ * materialized statements, and the real fingerprint — plus the braid
5
+ * map and serial-at roster read off the log core's braids seat
6
+ * (`internalLogBraidsOf`): one derivation of the braid partition,
7
+ * projected here into the driver's branded shapes. Cached per theory
8
+ * value.
9
+ */
10
+ import { internalDescriptor, internalLogBraidsOf, internalLogCodec, lower } from "@bjornpagen/bumbledb";
11
+ import * as errors from "@superbuilders/errors";
12
+ import { regex } from "arkregex";
13
+ import { fromHex } from "#bytes.ts";
14
+ const BRAID_ID = regex("^c[0-9a-f]{8}$");
15
+ function braid(raw) {
16
+ if (!BRAID_ID.test(raw)) {
17
+ throw errors.new(`not a braid id: ${raw}`);
18
+ }
19
+ return raw;
20
+ }
21
+ function refuseShape(why) {
22
+ throw errors.new(`theory: ${why}`);
23
+ }
24
+ /** The braids seat names serial-at statements by id; the braid tag is a
25
+ * projection join through the statement's own relation. */
26
+ function serialAtFrom(ids, statements, braidOfRelation) {
27
+ const statementById = new Map();
28
+ for (const statement of statements) {
29
+ statementById.set(statement.id, statement);
30
+ }
31
+ return ids.map(function joinBraid(id) {
32
+ const statement = statementById.get(id);
33
+ if (statement === undefined) {
34
+ refuseShape(`serial-at statement ${id} is not in the sealed statements`);
35
+ }
36
+ if (statement.kind === "containment") {
37
+ refuseShape(`serial-at statement ${id} is a containment`);
38
+ }
39
+ const relation = statement.kind === "functionality" ? statement.relation : statement.target.relation;
40
+ const braid = braidOfRelation.get(relation);
41
+ if (braid === undefined) {
42
+ refuseShape(`serial-at statement ${id} relation ${relation} is in no braid`);
43
+ }
44
+ return { statement: id, braid };
45
+ });
46
+ }
47
+ function isDescriptor(theory) {
48
+ return "braidMembers" in theory;
49
+ }
50
+ function isSpec(theory) {
51
+ return Array.isArray(theory.relations);
52
+ }
53
+ const cache = new WeakMap();
54
+ function descriptorOf(theory) {
55
+ if (isDescriptor(theory)) {
56
+ return theory;
57
+ }
58
+ const hit = cache.get(theory);
59
+ if (hit !== undefined) {
60
+ return hit;
61
+ }
62
+ const spec = isSpec(theory) ? theory : lower(theory);
63
+ const parsed = spec === theory ? fromSealed(spec) : (cache.get(spec) ?? fromSealed(spec));
64
+ cache.set(theory, parsed);
65
+ cache.set(spec, parsed);
66
+ return parsed;
67
+ }
68
+ function braidHex(relationId) {
69
+ return braid(`c${relationId.toString(16).padStart(8, "0")}`);
70
+ }
71
+ function fromSealed(spec) {
72
+ const sealed = internalDescriptor(spec);
73
+ /** Handle newtype (`{name}.id`, off each closed relation's sealed id slot) → roster name. */
74
+ const ownerOfIdClass = new Map();
75
+ for (const relation of sealed.relations) {
76
+ if (relation.extension === undefined) {
77
+ continue;
78
+ }
79
+ const idSlot = relation.fields.find(function idOf(field) {
80
+ return field.name === "id";
81
+ });
82
+ const handleClass = idSlot?.newtype;
83
+ if (handleClass === undefined) {
84
+ refuseShape(`closed relation ${relation.name} has no handle class on its sealed id slot`);
85
+ }
86
+ ownerOfIdClass.set(handleClass, relation.name);
87
+ }
88
+ const relations = sealed.relations.map(function relationOf(relation) {
89
+ const fields = relation.fields.map(function fieldOf(field) {
90
+ return {
91
+ name: field.name,
92
+ type: field.valueType,
93
+ fresh: field.fresh,
94
+ closedRef: field.newtype === undefined ? undefined : ownerOfIdClass.get(field.newtype)
95
+ };
96
+ });
97
+ const extension = relation.extension ?? [];
98
+ const named = new Map(relation.fields.map(function indexOf(field) {
99
+ return [field.name, field];
100
+ }));
101
+ const rows = extension.map(function rowOf(row) {
102
+ const cells = new Map(row.values.map(function cellOf(cell) {
103
+ return [cell.name, cell.value];
104
+ }));
105
+ return relation.fields.map(function cellValue(field) {
106
+ const hit = cells.get(field.name);
107
+ if (hit !== undefined) {
108
+ return hit;
109
+ }
110
+ if (field.name === "id" && named.has("id")) {
111
+ return row.id;
112
+ }
113
+ return refuseShape(`closed relation ${relation.name}: sealed row ${row.handle} missing field ${field.name}`);
114
+ });
115
+ });
116
+ return {
117
+ id: relation.id,
118
+ name: relation.name,
119
+ closed: relation.extension !== undefined,
120
+ handles: extension.map(function handleOf(row) {
121
+ return row.handle;
122
+ }),
123
+ fields,
124
+ rows
125
+ };
126
+ });
127
+ const byName = new Map();
128
+ for (const relation of relations) {
129
+ if (byName.has(relation.name)) {
130
+ refuseShape(`duplicate relation ${relation.name}`);
131
+ }
132
+ byName.set(relation.name, relation);
133
+ }
134
+ const statements = sealed.statements;
135
+ const braids = internalLogBraidsOf(sealed);
136
+ const braidOfRelation = new Map();
137
+ const braidMembers = new Map();
138
+ for (const component of braids.components) {
139
+ const id = braidHex(component.braid);
140
+ braidMembers.set(id, component.relations);
141
+ for (const member of component.relations) {
142
+ braidOfRelation.set(member, id);
143
+ }
144
+ }
145
+ const serialAtStatements = serialAtFrom(braids.serialAt, statements, braidOfRelation);
146
+ const fingerprint = sealed.fingerprint;
147
+ return {
148
+ relations,
149
+ relationByName: byName,
150
+ statements,
151
+ braidOfRelation,
152
+ braidMembers,
153
+ serialAtStatements,
154
+ codec: internalLogCodec(sealed),
155
+ fingerprint,
156
+ fingerprintBytes: fromHex(fingerprint)
157
+ };
158
+ }
159
+ export { braid, braidHex, descriptorOf, serialAtFrom };
160
+ //# sourceMappingURL=descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.js","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACvG,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAA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AAC,CAAA;IAErF,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAA;IACtC,OAAO;QACN,SAAS;QACT,cAAc,EAAE,MAAM;QACtB,UAAU;QACV,eAAe;QACf,YAAY;QACZ,kBAAkB;QAClB,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC;QAC/B,WAAW;QACX,gBAAgB,EAAE,OAAO,CAAC,WAAW,CAAC;KACtC,CAAA;AACF,CAAC;AAGD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,202 @@
1
+ /**
2
+ * The driver's error identities, on the SDK's `@superbuilders/errors`
3
+ * idiom: exported sentinel values checked with `errors.is`, structured
4
+ * causes carried as data properties read back with the `*Of` accessors —
5
+ * never by message-string matching. There is deliberately no
6
+ * `ErrAlreadyApplied`: the state it would name is absorbed by idempotent
7
+ * replay (L10) and never surfaces. ManifestMissing, OverWidth,
8
+ * RefillNeeded, Exhausted, and SlotRetired are named sums of their own: a
9
+ * replica without a manifest, a draw past the lease width, a cached id
10
+ * block too short for the draw, the u64 ceiling, and a below-floor
11
+ * create. Exhaustion means the id space is spent — a refill is never an
12
+ * exhaustion. An unproved conditional write is the store verbs' own
13
+ * `ambiguous` outcome arm, never an error identity.
14
+ */
15
+ import type { Braid } from "./descriptor.js";
16
+ import type { Generation, StoreKey } from "./keys.js";
17
+ /**
18
+ * Typed refusal of a protocol object before any apply: batch shape,
19
+ * version, fingerprint, manifest shape, checkpoint braid-set drift —
20
+ * one identity, cause data per site.
21
+ */
22
+ declare const ErrRefused: Error;
23
+ /** `commit` recorded ops in more than one braid; `commitSplit` is the verb. */
24
+ declare const ErrSpanningCommit: Error;
25
+ /** A rejected replay on a store that passed the wholeness check. */
26
+ declare const ErrReplayDiverged: Error;
27
+ /** The chain discipline, one identity with three proved causes. */
28
+ declare const ErrChainMismatch: Error;
29
+ /** Bounded live-tip losses exhausted — an operational signal, not an outcome arm. */
30
+ declare const ErrContention: Error;
31
+ /** A replica (or any read-role handle) found no manifest; only the writer births a store. */
32
+ export declare const ErrManifestMissing: Error;
33
+ /** A single id draw larger than one lease width; the width is the one block size. */
34
+ declare const ErrOverWidth: Error;
35
+ /**
36
+ * The cached id block is too short for the draw — the writer's signal
37
+ * to lease a fresh block. A refill is not an exhaustion: the id space
38
+ * still has room; only the cache is short.
39
+ */
40
+ declare const ErrRefillNeeded: Error;
41
+ /** The next lease would leave u64 — the id space is spent. */
42
+ declare const ErrExhausted: Error;
43
+ /** A put_create at a slot below the published checkpoint vector. */
44
+ declare const ErrSlotRetired: Error;
45
+ /** The vendor channel: I/O and store infrastructure failures. */
46
+ declare const ErrStore: Error;
47
+ /**
48
+ * The typed causes behind `ErrRefused`, one arm per identity. Every
49
+ * `kind` is either a row of the generated identity table
50
+ * (`crates/bumbledb-log/conformance/v3/identities.json`, spelled by the
51
+ * core's one speller per family) or one of the three host-side kinds at
52
+ * the tail, which cross no bridge. The boundary carries
53
+ * `{ kind, message }` only, so a bridge-minted cause is the bare kind —
54
+ * the detail rides the message — and a payload field exists only where
55
+ * the minting seat owns the datum: a held document's version byte
56
+ * (`version`, byte 0 of every v:3 document) and length (`at`), the
57
+ * codec seat's own arity coordinates, the manifest audit's
58
+ * fingerprints, the counter object's key. The raw id of an
59
+ * `UnknownBraid` rides the message.
60
+ */
61
+ type RefusalCause = {
62
+ readonly kind: "Truncated";
63
+ } | {
64
+ readonly kind: "BadMagic";
65
+ } | {
66
+ readonly kind: "Version";
67
+ readonly version?: number;
68
+ } | {
69
+ readonly kind: "Flags";
70
+ } | {
71
+ readonly kind: "FingerprintMismatch";
72
+ readonly carried?: string;
73
+ readonly expected?: string;
74
+ } | {
75
+ readonly kind: "UnknownBraid";
76
+ } | {
77
+ readonly kind: "UnknownOpKind";
78
+ } | {
79
+ readonly kind: "UnknownRelation";
80
+ } | {
81
+ readonly kind: "ClosedRelation";
82
+ } | {
83
+ readonly kind: "OpRelationOutsideBraid";
84
+ } | {
85
+ readonly kind: "TagMismatch";
86
+ } | {
87
+ readonly kind: "BoolByte";
88
+ } | {
89
+ readonly kind: "InvalidUtf8";
90
+ } | {
91
+ readonly kind: "EmptyInterval";
92
+ } | {
93
+ readonly kind: "IntervalOverflow";
94
+ } | {
95
+ readonly kind: "TrailingBytes";
96
+ } | {
97
+ readonly kind: "Arity";
98
+ readonly op?: number;
99
+ readonly relation?: string;
100
+ readonly row?: number;
101
+ } | {
102
+ readonly kind: "Value";
103
+ } | {
104
+ readonly kind: "TooManyOps";
105
+ } | {
106
+ readonly kind: "TooManyRows";
107
+ } | {
108
+ readonly kind: "Malformed";
109
+ readonly at: number;
110
+ } | {
111
+ readonly kind: "Overflow";
112
+ } | {
113
+ readonly kind: "BraidSet";
114
+ } | {
115
+ readonly kind: "Counter";
116
+ readonly key: StoreKey;
117
+ } | {
118
+ readonly kind: "DigestWidth";
119
+ } | {
120
+ readonly kind: "CheckpointDigest";
121
+ readonly expected: string;
122
+ readonly computed: string;
123
+ } | {
124
+ readonly kind: "NoOpSlot";
125
+ readonly braid: Braid;
126
+ readonly slot: Generation;
127
+ readonly writer: bigint;
128
+ };
129
+ type ChainCause = "prev" | "slot" | "timestamp";
130
+ interface ChainMismatchData {
131
+ readonly cause: ChainCause;
132
+ readonly braid: Braid;
133
+ readonly slot: Generation;
134
+ readonly writer: bigint;
135
+ }
136
+ type ContentionCause = {
137
+ readonly kind: "hot-key";
138
+ readonly statement: string;
139
+ readonly determinants: ReadonlyArray<Readonly<Record<string, unknown>>>;
140
+ } | {
141
+ readonly kind: "slot-race";
142
+ readonly tip: Generation;
143
+ };
144
+ interface ContentionData {
145
+ readonly braid: Braid;
146
+ readonly cause: ContentionCause;
147
+ }
148
+ interface OverWidthData {
149
+ readonly requested: bigint;
150
+ }
151
+ interface RefillNeededData {
152
+ readonly relation: number;
153
+ readonly field: number;
154
+ readonly requested: bigint;
155
+ }
156
+ interface ExhaustedData {
157
+ readonly relation: number;
158
+ readonly field: number;
159
+ }
160
+ interface SlotRetiredData {
161
+ readonly braid: Braid;
162
+ readonly slot: Generation;
163
+ }
164
+ /** The id-lease algebra's refusal sum — the identity table's `counter`
165
+ * family, arm for arm: Counter | Exhausted | OverWidth. `Counter`
166
+ * carries the counter object's key, the datum this driver's parse gate
167
+ * owns (the core's twin carries relation and field). A cache refill is
168
+ * no arm: the shared algebra has none. */
169
+ type LeaseRefusal = {
170
+ readonly kind: "Counter";
171
+ readonly key: StoreKey;
172
+ } | {
173
+ readonly kind: "Exhausted";
174
+ readonly relation: number;
175
+ readonly field: number;
176
+ } | {
177
+ readonly kind: "OverWidth";
178
+ readonly requested: bigint;
179
+ };
180
+ declare function refuse(cause: RefusalCause, detail: string): never;
181
+ declare function refuseChain(data: ChainMismatchData, detail: string): never;
182
+ declare function throwContention(data: ContentionData, detail: string): never;
183
+ declare function refuseManifestMissing(detail: string): never;
184
+ declare function isManifestMissing(error: unknown): boolean;
185
+ declare function refuseOverWidth(data: OverWidthData, detail: string): never;
186
+ declare function throwRefillNeeded(data: RefillNeededData, detail: string): never;
187
+ declare function refuseExhausted(data: ExhaustedData, detail: string): never;
188
+ declare function refuseSlotRetired(data: SlotRetiredData, detail: string): never;
189
+ declare function refusalOf(error: Error): RefusalCause | undefined;
190
+ declare function chainMismatchOf(error: Error): ChainMismatchData | undefined;
191
+ declare function contentionOf(error: Error): ContentionData | undefined;
192
+ declare function overWidthOf(error: Error): OverWidthData | undefined;
193
+ declare function refillNeededOf(error: Error): RefillNeededData | undefined;
194
+ declare function exhaustedOf(error: Error): ExhaustedData | undefined;
195
+ declare function slotRetiredOf(error: Error): SlotRetiredData | undefined;
196
+ /** Every store failure wraps the exported sentinel itself, so
197
+ * `errors.is(e, ErrStore)` matches by identity; the vendor error's
198
+ * message rides the detail verbatim. */
199
+ declare function wrapStore(inner: Error, detail: string): Error;
200
+ export type { ChainCause, ChainMismatchData, ContentionCause, ContentionData, ExhaustedData, LeaseRefusal, OverWidthData, RefillNeededData, RefusalCause, SlotRetiredData };
201
+ export { chainMismatchOf, contentionOf, ErrChainMismatch, ErrContention, ErrExhausted, ErrOverWidth, ErrRefillNeeded, ErrRefused, ErrReplayDiverged, ErrSlotRetired, ErrSpanningCommit, ErrStore, exhaustedOf, isManifestMissing, overWidthOf, refillNeededOf, refusalOf, refuse, refuseChain, refuseExhausted, refuseManifestMissing, refuseOverWidth, refuseSlotRetired, slotRetiredOf, throwContention, throwRefillNeeded, wrapStore };
202
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAEpD;;;;GAIG;AACH,QAAA,MAAM,UAAU,OAAqC,CAAA;AAErD,+EAA+E;AAC/E,QAAA,MAAM,iBAAiB,OAEtB,CAAA;AAED,oEAAoE;AACpE,QAAA,MAAM,iBAAiB,OAEtB,CAAA;AAED,mEAAmE;AACnE,QAAA,MAAM,gBAAgB,OAA4F,CAAA;AAElH,qFAAqF;AACrF,QAAA,MAAM,aAAa,OAAyF,CAAA;AAE5G,6FAA6F;AAC7F,eAAO,MAAM,kBAAkB,OAAwE,CAAA;AAEvG,qFAAqF;AACrF,QAAA,MAAM,YAAY,OAAyE,CAAA;AAE3F;;;;GAIG;AACH,QAAA,MAAM,eAAe,OAAqF,CAAA;AAE1G,8DAA8D;AAC9D,QAAA,MAAM,YAAY,OAA8D,CAAA;AAEhF,oEAAoE;AACpE,QAAA,MAAM,cAAc,OAA8D,CAAA;AAElF,iEAAiE;AACjE,QAAA,MAAM,QAAQ,OAA2C,CAAA;AAEzD;;;;;;;;;;;;;GAaG;AACH,KAAK,YAAY,GAMd;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GA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