@bjornpagen/bumbledb-log 0.20.2 → 1.0.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.
Files changed (192) hide show
  1. package/README.md +275 -114
  2. package/dist/admin.d.ts +24 -0
  3. package/dist/admin.d.ts.map +1 -0
  4. package/dist/admin.js +12 -0
  5. package/dist/admin.js.map +1 -0
  6. package/dist/bridge.d.ts +30 -0
  7. package/dist/bridge.d.ts.map +1 -0
  8. package/dist/bridge.js +92 -0
  9. package/dist/bridge.js.map +1 -0
  10. package/dist/codes.d.ts +11 -0
  11. package/dist/codes.d.ts.map +1 -0
  12. package/dist/codes.js +53 -0
  13. package/dist/codes.js.map +1 -0
  14. package/dist/command.d.ts +21 -0
  15. package/dist/command.d.ts.map +1 -0
  16. package/dist/command.js +12 -0
  17. package/dist/command.js.map +1 -0
  18. package/dist/errors.d.ts +78 -197
  19. package/dist/errors.d.ts.map +1 -1
  20. package/dist/errors.js +144 -114
  21. package/dist/errors.js.map +1 -1
  22. package/dist/history.d.ts +22 -0
  23. package/dist/history.d.ts.map +1 -0
  24. package/dist/history.js +12 -0
  25. package/dist/history.js.map +1 -0
  26. package/dist/identity.d.ts +144 -0
  27. package/dist/identity.d.ts.map +1 -0
  28. package/dist/identity.js +223 -0
  29. package/dist/identity.js.map +1 -0
  30. package/dist/index.d.ts +24 -31
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +16 -21
  33. package/dist/index.js.map +1 -1
  34. package/dist/machine.d.ts +151 -0
  35. package/dist/machine.d.ts.map +1 -0
  36. package/dist/machine.js +1128 -0
  37. package/dist/machine.js.map +1 -0
  38. package/dist/migration-ops.d.ts +20 -0
  39. package/dist/migration-ops.d.ts.map +1 -0
  40. package/dist/migration-ops.js +7 -0
  41. package/dist/migration-ops.js.map +1 -0
  42. package/dist/migrations/bin.d.ts +3 -0
  43. package/dist/migrations/bin.d.ts.map +1 -0
  44. package/dist/migrations/bin.js +43 -0
  45. package/dist/migrations/bin.js.map +1 -0
  46. package/dist/migrations/canonical.d.ts +40 -0
  47. package/dist/migrations/canonical.d.ts.map +1 -0
  48. package/dist/migrations/canonical.js +156 -0
  49. package/dist/migrations/canonical.js.map +1 -0
  50. package/dist/migrations/cli.d.ts +32 -0
  51. package/dist/migrations/cli.d.ts.map +1 -0
  52. package/dist/migrations/cli.js +147 -0
  53. package/dist/migrations/cli.js.map +1 -0
  54. package/dist/migrations/codec.d.ts +74 -0
  55. package/dist/migrations/codec.d.ts.map +1 -0
  56. package/dist/migrations/codec.js +2 -0
  57. package/dist/migrations/codec.js.map +1 -0
  58. package/dist/migrations/decode.d.ts +16 -0
  59. package/dist/migrations/decode.d.ts.map +1 -0
  60. package/dist/migrations/decode.js +302 -0
  61. package/dist/migrations/decode.js.map +1 -0
  62. package/dist/migrations/diff.d.ts +39 -0
  63. package/dist/migrations/diff.d.ts.map +1 -0
  64. package/dist/migrations/diff.js +385 -0
  65. package/dist/migrations/diff.js.map +1 -0
  66. package/dist/migrations/expr.d.ts +22 -0
  67. package/dist/migrations/expr.d.ts.map +1 -0
  68. package/dist/migrations/expr.js +228 -0
  69. package/dist/migrations/expr.js.map +1 -0
  70. package/dist/migrations/fail.d.ts +34 -0
  71. package/dist/migrations/fail.d.ts.map +1 -0
  72. package/dist/migrations/fail.js +69 -0
  73. package/dist/migrations/fail.js.map +1 -0
  74. package/dist/migrations/fsops.d.ts +37 -0
  75. package/dist/migrations/fsops.d.ts.map +1 -0
  76. package/dist/migrations/fsops.js +222 -0
  77. package/dist/migrations/fsops.js.map +1 -0
  78. package/dist/migrations/generate.d.ts +11 -0
  79. package/dist/migrations/generate.d.ts.map +1 -0
  80. package/dist/migrations/generate.js +479 -0
  81. package/dist/migrations/generate.js.map +1 -0
  82. package/dist/migrations/index.d.ts +25 -0
  83. package/dist/migrations/index.d.ts.map +1 -0
  84. package/dist/migrations/index.js +6 -0
  85. package/dist/migrations/index.js.map +1 -0
  86. package/dist/migrations/intent.d.ts +86 -0
  87. package/dist/migrations/intent.d.ts.map +1 -0
  88. package/dist/migrations/intent.js +97 -0
  89. package/dist/migrations/intent.js.map +1 -0
  90. package/dist/migrations/lock.d.ts +27 -0
  91. package/dist/migrations/lock.d.ts.map +1 -0
  92. package/dist/migrations/lock.js +14 -0
  93. package/dist/migrations/lock.js.map +1 -0
  94. package/dist/migrations/native.d.ts +37 -0
  95. package/dist/migrations/native.d.ts.map +1 -0
  96. package/dist/migrations/native.js +135 -0
  97. package/dist/migrations/native.js.map +1 -0
  98. package/dist/migrations/repo.d.ts +38 -0
  99. package/dist/migrations/repo.d.ts.map +1 -0
  100. package/dist/migrations/repo.js +191 -0
  101. package/dist/migrations/repo.js.map +1 -0
  102. package/dist/migrations/theory.d.ts +21 -0
  103. package/dist/migrations/theory.d.ts.map +1 -0
  104. package/dist/migrations/theory.js +107 -0
  105. package/dist/migrations/theory.js.map +1 -0
  106. package/dist/migrations/types.d.ts +243 -0
  107. package/dist/migrations/types.d.ts.map +1 -0
  108. package/dist/migrations/types.js +2 -0
  109. package/dist/migrations/types.js.map +1 -0
  110. package/dist/migrations/workflow.d.ts +11 -0
  111. package/dist/migrations/workflow.d.ts.map +1 -0
  112. package/dist/migrations/workflow.js +14 -0
  113. package/dist/migrations/workflow.js.map +1 -0
  114. package/dist/native.d.ts +600 -0
  115. package/dist/native.d.ts.map +1 -0
  116. package/dist/native.js +8 -0
  117. package/dist/native.js.map +1 -0
  118. package/dist/options.d.ts +106 -0
  119. package/dist/options.d.ts.map +1 -0
  120. package/dist/options.js +2 -0
  121. package/dist/options.js.map +1 -0
  122. package/dist/outcome.d.ts +291 -0
  123. package/dist/outcome.d.ts.map +1 -0
  124. package/dist/outcome.js +2 -0
  125. package/dist/outcome.js.map +1 -0
  126. package/dist/production.d.ts +12 -0
  127. package/dist/production.d.ts.map +1 -0
  128. package/dist/production.js +29 -0
  129. package/dist/production.js.map +1 -0
  130. package/dist/schema.d.ts +10 -0
  131. package/dist/schema.d.ts.map +1 -0
  132. package/dist/schema.js +9 -0
  133. package/dist/schema.js.map +1 -0
  134. package/dist/surface.d.ts +80 -0
  135. package/dist/surface.d.ts.map +1 -0
  136. package/dist/surface.js +2 -0
  137. package/dist/surface.js.map +1 -0
  138. package/dist/tenants.d.ts +20 -52
  139. package/dist/tenants.d.ts.map +1 -1
  140. package/dist/tenants.js +11 -330
  141. package/dist/tenants.js.map +1 -1
  142. package/pack-provenance.json +7 -0
  143. package/package.json +20 -23
  144. package/dist/braids.d.ts +0 -28
  145. package/dist/braids.d.ts.map +0 -1
  146. package/dist/braids.js +0 -45
  147. package/dist/braids.js.map +0 -1
  148. package/dist/bytes.d.ts +0 -26
  149. package/dist/bytes.d.ts.map +0 -1
  150. package/dist/bytes.js +0 -86
  151. package/dist/bytes.js.map +0 -1
  152. package/dist/chain.d.ts +0 -56
  153. package/dist/chain.d.ts.map +0 -1
  154. package/dist/chain.js +0 -137
  155. package/dist/chain.js.map +0 -1
  156. package/dist/codec.d.ts +0 -71
  157. package/dist/codec.d.ts.map +0 -1
  158. package/dist/codec.js +0 -179
  159. package/dist/codec.js.map +0 -1
  160. package/dist/descriptor.d.ts +0 -61
  161. package/dist/descriptor.d.ts.map +0 -1
  162. package/dist/descriptor.js +0 -160
  163. package/dist/descriptor.js.map +0 -1
  164. package/dist/keys.d.ts +0 -52
  165. package/dist/keys.d.ts.map +0 -1
  166. package/dist/keys.js +0 -166
  167. package/dist/keys.js.map +0 -1
  168. package/dist/manifest.d.ts +0 -42
  169. package/dist/manifest.d.ts.map +0 -1
  170. package/dist/manifest.js +0 -116
  171. package/dist/manifest.js.map +0 -1
  172. package/dist/replica.d.ts +0 -154
  173. package/dist/replica.d.ts.map +0 -1
  174. package/dist/replica.js +0 -820
  175. package/dist/replica.js.map +0 -1
  176. package/dist/store-s3.d.ts +0 -31
  177. package/dist/store-s3.d.ts.map +0 -1
  178. package/dist/store-s3.js +0 -299
  179. package/dist/store-s3.js.map +0 -1
  180. package/dist/store.d.ts +0 -129
  181. package/dist/store.d.ts.map +0 -1
  182. package/dist/store.js +0 -577
  183. package/dist/store.js.map +0 -1
  184. package/dist/tilde-family.json +0 -21
  185. package/dist/vector.d.ts +0 -31
  186. package/dist/vector.d.ts.map +0 -1
  187. package/dist/vector.js +0 -87
  188. package/dist/vector.js.map +0 -1
  189. package/dist/writer.d.ts +0 -106
  190. package/dist/writer.d.ts.map +0 -1
  191. package/dist/writer.js +0 -677
  192. package/dist/writer.js.map +0 -1
package/dist/bytes.d.ts DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * Byte primitives beside the one grammar: the hex spelling every
3
- * document digest walks (32 bytes, 64 lowercase hex characters), the
4
- * `Digest32` brand, byte equality, and the u64 arithmetic the vector
5
- * and lease algebras share. The wire's own cursors live in
6
- * `crates/bumbledb-log`; nothing here reads or writes protocol bytes.
7
- */
8
- declare const U64_MAX = 18446744073709551615n;
9
- declare const utf8Encoder: import("node:util").TextEncoder;
10
- /** Fatal UTF-8. ignoreBOM is true: a leading U+FEFF is a character, not a stripped BOM. */
11
- declare const utf8StrictDecoder: import("node:util").TextDecoder;
12
- declare const digest32Brand: unique symbol;
13
- type Digest32 = Uint8Array & {
14
- readonly [digest32Brand]: typeof digest32Brand;
15
- };
16
- declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
17
- declare function toHex(bytes: Uint8Array): string;
18
- declare function fromHex(hex: string): Uint8Array;
19
- declare function digest32(bytes: Uint8Array): Digest32;
20
- declare function digest32FromHex(hex: string): Digest32;
21
- declare function hex32(bytes: Digest32): string;
22
- declare function saturatingAddU64(a: bigint, b: bigint): bigint;
23
- declare function checkedAddU64(a: bigint, b: bigint): bigint | undefined;
24
- export type { Digest32 };
25
- export { bytesEqual, checkedAddU64, digest32, digest32FromHex, fromHex, hex32, saturatingAddU64, toHex, U64_MAX, utf8Encoder, utf8StrictDecoder };
26
- //# sourceMappingURL=bytes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../src/bytes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,QAAA,MAAM,OAAO,wBAAsB,CAAA;AAEnC,QAAA,MAAM,WAAW,iCAAoB,CAAA;AACrC,2FAA2F;AAC3F,QAAA,MAAM,iBAAiB,iCAA6D,CAAA;AAEpF,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAA;AAC1C,KAAK,QAAQ,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,OAAO,aAAa,CAAA;CAAE,CAAA;AAE/E,iBAAS,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAUzD;AAcD,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAOxC;AAED,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAoBxC;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAO7C;AAED,iBAAS,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAE9C;AAED,iBAAS,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAEtC;AAED,iBAAS,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,iBAAS,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG/D;AAED,YAAY,EAAE,QAAQ,EAAE,CAAA;AACxB,OAAO,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EACR,eAAe,EACf,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,CAAA"}
package/dist/bytes.js DELETED
@@ -1,86 +0,0 @@
1
- /**
2
- * Byte primitives beside the one grammar: the hex spelling every
3
- * document digest walks (32 bytes, 64 lowercase hex characters), the
4
- * `Digest32` brand, byte equality, and the u64 arithmetic the vector
5
- * and lease algebras share. The wire's own cursors live in
6
- * `crates/bumbledb-log`; nothing here reads or writes protocol bytes.
7
- */
8
- import * as errors from "@superbuilders/errors";
9
- const U64_MAX = 0xffffffffffffffffn;
10
- const utf8Encoder = new TextEncoder();
11
- /** Fatal UTF-8. ignoreBOM is true: a leading U+FEFF is a character, not a stripped BOM. */
12
- const utf8StrictDecoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
13
- function bytesEqual(a, b) {
14
- if (a.length !== b.length) {
15
- return false;
16
- }
17
- for (let i = 0; i < a.length; i++) {
18
- if (a[i] !== b[i]) {
19
- return false;
20
- }
21
- }
22
- return true;
23
- }
24
- const HEX_DIGITS = "0123456789abcdef";
25
- function hexNibble(byte) {
26
- if (byte >= 0x30 && byte <= 0x39) {
27
- return byte - 0x30;
28
- }
29
- if (byte >= 0x61 && byte <= 0x66) {
30
- return byte - 0x61 + 10;
31
- }
32
- return undefined;
33
- }
34
- function toHex(bytes) {
35
- let out = "";
36
- for (const byte of bytes) {
37
- out += HEX_DIGITS[byte >>> 4];
38
- out += HEX_DIGITS[byte & 0xf];
39
- }
40
- return out;
41
- }
42
- function fromHex(hex) {
43
- const raw = utf8Encoder.encode(hex);
44
- if (raw.length % 2 !== 0) {
45
- throw errors.new(`not lowercase hex: ${hex}`);
46
- }
47
- const out = new Uint8Array(raw.length / 2);
48
- for (let i = 0, j = 0; i < raw.length; i += 2, j++) {
49
- const hiByte = raw[i];
50
- const loByte = raw[i + 1];
51
- if (hiByte === undefined || loByte === undefined) {
52
- throw errors.new(`not lowercase hex: ${hex}`);
53
- }
54
- const hi = hexNibble(hiByte);
55
- const lo = hexNibble(loByte);
56
- if (hi === undefined || lo === undefined) {
57
- throw errors.new(`not lowercase hex: ${hex}`);
58
- }
59
- out[j] = (hi << 4) | lo;
60
- }
61
- return out;
62
- }
63
- function digest32(bytes) {
64
- if (bytes.length !== 32) {
65
- throw errors.new(`digest is not 32 bytes: ${bytes.length}`);
66
- }
67
- const out = new Uint8Array(32);
68
- out.set(bytes);
69
- return out;
70
- }
71
- function digest32FromHex(hex) {
72
- return digest32(fromHex(hex));
73
- }
74
- function hex32(bytes) {
75
- return toHex(bytes);
76
- }
77
- function saturatingAddU64(a, b) {
78
- const sum = a + b;
79
- return sum > U64_MAX ? U64_MAX : sum;
80
- }
81
- function checkedAddU64(a, b) {
82
- const sum = a + b;
83
- return sum > U64_MAX ? undefined : sum;
84
- }
85
- export { bytesEqual, checkedAddU64, digest32, digest32FromHex, fromHex, hex32, saturatingAddU64, toHex, U64_MAX, utf8Encoder, utf8StrictDecoder };
86
- //# sourceMappingURL=bytes.js.map
package/dist/bytes.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bytes.js","sourceRoot":"","sources":["../src/bytes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,MAAM,OAAO,GAAG,mBAAmB,CAAA;AAEnC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;AACrC,2FAA2F;AAC3F,MAAM,iBAAiB,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;AAKpF,SAAS,UAAU,CAAC,CAAa,EAAE,CAAa;IAC/C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAA;IACb,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,CAAA;QACb,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAA;AACZ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CAAC;AAED,SAAS,aAAa,CAAC,CAAS,EAAE,CAAS;IAC1C,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAAA;IACjB,OAAO,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAA;AACvC,CAAC;AAGD,OAAO,EACN,UAAU,EACV,aAAa,EACb,QAAQ,EACR,eAAe,EACf,OAAO,EACP,KAAK,EACL,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,CAAA"}
package/dist/chain.d.ts DELETED
@@ -1,56 +0,0 @@
1
- /**
2
- * The chain sidecar in `dir/chain`: a floor cache of chain position,
3
- * written atomically (temp + rename, fsync). The chain is Settled or
4
- * Pending — generation is the vector sum, plus one exactly when the
5
- * value is Pending. The byte grammar has one implementation —
6
- * `crates/bumbledb-log` behind the napi bridge — so parse and render
7
- * are marshal walks over the sealed codec handle; the file IO half
8
- * lives here. The content address is blake3 of the rendered bytes.
9
- */
10
- import type { LogCodecHandle } from "@bjornpagen/bumbledb";
11
- import type { Digest32 } from "./bytes.js";
12
- import type { Braid } from "./descriptor.js";
13
- import type { Generation } from "./keys.js";
14
- /** The sidecar's file name inside a replica directory. */
15
- declare const CHAIN_FILE = "chain";
16
- /** One braid's chain coordinate: the applied count, the applied
17
- * batch's content address, its timestamp. */
18
- interface ChainEntry {
19
- readonly g: Generation;
20
- readonly prev: Digest32;
21
- readonly ts: bigint;
22
- }
23
- interface Pending {
24
- readonly braid: Braid;
25
- readonly slot: Generation;
26
- readonly bytes: Uint8Array;
27
- }
28
- type Chain = {
29
- readonly tag: "settled";
30
- readonly entries: ReadonlyMap<Braid, ChainEntry>;
31
- } | {
32
- readonly tag: "pending";
33
- readonly entries: ReadonlyMap<Braid, ChainEntry>;
34
- readonly batch: Pending;
35
- };
36
- type SidecarRead = {
37
- readonly tag: "absent";
38
- } | {
39
- readonly tag: "fault";
40
- readonly io: Error;
41
- } | {
42
- readonly tag: "corrupt";
43
- readonly parse: Error;
44
- } | {
45
- readonly tag: "read";
46
- readonly chain: Chain;
47
- };
48
- declare function chainSum(chain: Chain): bigint;
49
- declare function chainGeneration(chain: Chain): bigint;
50
- declare function renderSidecar(codec: LogCodecHandle, chain: Chain): Uint8Array;
51
- declare function parseSidecar(codec: LogCodecHandle, bytes: Uint8Array): Chain;
52
- declare function readSidecar(codec: LogCodecHandle, file: string): Promise<SidecarRead>;
53
- declare function writeSidecar(codec: LogCodecHandle, file: string, chain: Chain): Promise<void>;
54
- export type { Chain, ChainEntry, Pending };
55
- export { CHAIN_FILE, chainGeneration, chainSum, parseSidecar, readSidecar, renderSidecar, writeSidecar };
56
- //# sourceMappingURL=chain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAY,cAAc,EAAkB,MAAM,sBAAsB,CAAA;AAGpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAI1C,0DAA0D;AAC1D,QAAA,MAAM,UAAU,UAAU,CAAA;AAE1B;8CAC8C;AAC9C,UAAU,UAAU;IACnB,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,OAAO;IAChB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAC1B;AAED,KAAK,KAAK,GACP;IAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IAAC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,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
package/dist/chain.js DELETED
@@ -1,137 +0,0 @@
1
- /**
2
- * The chain sidecar in `dir/chain`: a floor cache of chain position,
3
- * written atomically (temp + rename, fsync). The chain is Settled or
4
- * Pending — generation is the vector sum, plus one exactly when the
5
- * value is Pending. The byte grammar has one implementation —
6
- * `crates/bumbledb-log` behind the napi bridge — so parse and render
7
- * are marshal walks over the sealed codec handle; the file IO half
8
- * lives here. The content address is blake3 of the rendered bytes.
9
- */
10
- import * as crypto from "node:crypto";
11
- import * as fs from "node:fs/promises";
12
- import * as path from "node:path";
13
- import { internalLogParseSidecar, internalLogRenderSidecar } from "@bjornpagen/bumbledb";
14
- import * as errors from "@superbuilders/errors";
15
- import { digest32, saturatingAddU64, U64_MAX } from "#bytes.ts";
16
- import { braidHex } from "#descriptor.ts";
17
- import { refuse } from "#errors.ts";
18
- import { generation } from "#keys.ts";
19
- import { Vector } from "#vector.ts";
20
- /** The sidecar's file name inside a replica directory. */
21
- const CHAIN_FILE = "chain";
22
- function codeOf(error) {
23
- return error.code;
24
- }
25
- function braidIdOf(id) {
26
- return Number.parseInt(id.slice(1), 16);
27
- }
28
- function vectorOf(entries) {
29
- const counts = new Map();
30
- for (const [braid, entry] of entries) {
31
- counts.set(braid, entry.g);
32
- }
33
- return Vector.from(counts);
34
- }
35
- function chainSum(chain) {
36
- const sum = vectorOf(chain.entries).sum();
37
- return typeof sum === "bigint" ? sum : U64_MAX;
38
- }
39
- function chainGeneration(chain) {
40
- const sum = chainSum(chain);
41
- return chain.tag === "settled" ? sum : saturatingAddU64(sum, 1n);
42
- }
43
- /**
44
- * Remints a bridge refusal row as the driver's typed refusal. The
45
- * boundary carries `{ kind, message }` only: the kind is the log
46
- * core's own identity string, so the cause payload holds the data this
47
- * side owns — the document's length, its version byte (byte 0 of every
48
- * v:3 document). The raw braid id of an `UnknownBraid` rides the
49
- * message.
50
- */
51
- function refuseBridged(kind, message, bytes) {
52
- switch (kind) {
53
- case "Version":
54
- return refuse({ kind: "Version", version: bytes[0] ?? 0 }, message);
55
- case "Overflow":
56
- return refuse({ kind: "Overflow" }, message);
57
- case "UnknownBraid":
58
- return refuse({ kind: "UnknownBraid" }, message);
59
- case "Malformed":
60
- return refuse({ kind: "Malformed", at: bytes.length }, message);
61
- }
62
- }
63
- function renderSidecar(codec, chain) {
64
- const entries = [...chain.entries.entries()]
65
- .sort(function ascending(a, b) {
66
- return braidIdOf(a[0]) - braidIdOf(b[0]);
67
- })
68
- .map(function entryOf([id, entry]) {
69
- return { braid: braidIdOf(id), g: entry.g, prev: entry.prev, ts: entry.ts };
70
- });
71
- const doc = chain.tag === "settled"
72
- ? { entries }
73
- : {
74
- entries,
75
- pending: { braid: braidIdOf(chain.batch.braid), slot: chain.batch.slot, bytes: chain.batch.bytes }
76
- };
77
- return internalLogRenderSidecar(codec, doc);
78
- }
79
- function parseSidecar(codec, bytes) {
80
- const parsed = internalLogParseSidecar(codec, bytes);
81
- if (!parsed.ok) {
82
- refuseBridged(parsed.kind, parsed.message, bytes);
83
- }
84
- const entries = new Map();
85
- for (const entry of parsed.value.entries) {
86
- entries.set(braidHex(entry.braid), { g: generation(entry.g), prev: digest32(entry.prev), ts: entry.ts });
87
- }
88
- const pending = parsed.value.pending;
89
- if (pending === undefined) {
90
- return { tag: "settled", entries };
91
- }
92
- return {
93
- tag: "pending",
94
- entries,
95
- batch: { braid: braidHex(pending.braid), slot: generation(pending.slot), bytes: pending.bytes }
96
- };
97
- }
98
- async function readSidecar(codec, file) {
99
- const read = await errors.try(fs.readFile(file));
100
- if (read.error) {
101
- if (codeOf(read.error) === "ENOENT") {
102
- return { tag: "absent" };
103
- }
104
- return { tag: "fault", io: read.error };
105
- }
106
- const parsed = errors.trySync(function parse() {
107
- return parseSidecar(codec, read.data);
108
- });
109
- if (parsed.error) {
110
- return { tag: "corrupt", parse: parsed.error };
111
- }
112
- return { tag: "read", chain: parsed.data };
113
- }
114
- async function writeSidecar(codec, file, chain) {
115
- const dir = path.dirname(file);
116
- await fs.mkdir(dir, { recursive: true });
117
- const temp = path.join(dir, `.chain-${process.pid}-${crypto.randomBytes(4).toString("hex")}`);
118
- const handle = await fs.open(temp, "wx");
119
- const written = await errors.try((async function writeAll() {
120
- await handle.writeFile(renderSidecar(codec, chain));
121
- await handle.sync();
122
- })());
123
- await handle.close();
124
- if (written.error) {
125
- await fs.rm(temp, { force: true });
126
- throw errors.wrap(written.error, `write sidecar ${file}`);
127
- }
128
- await fs.rename(temp, file);
129
- const dirHandle = await fs.open(dir, "r");
130
- const synced = await errors.try(dirHandle.sync());
131
- await dirHandle.close();
132
- if (synced.error) {
133
- throw errors.wrap(synced.error, `fsync sidecar directory ${dir}`);
134
- }
135
- }
136
- export { CHAIN_FILE, chainGeneration, chainSum, parseSidecar, readSidecar, renderSidecar, writeSidecar };
137
- //# sourceMappingURL=chain.js.map
package/dist/chain.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"chain.js","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACxF,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,MAAM,EAA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AA;IACxC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,GAAG,CAC/B,CAAC,KAAK,UAAU,QAAQ;QACvB,MAAM,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;QACnD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC,CAAC,EAAE,CACJ,CAAA;IACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IACpB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAClC,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,iBAAiB,IAAI,EAAE,CAAC,CAAA;IAC1D,CAAC;IACD,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC3B,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACzC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;IACjD,MAAM,SAAS,CAAC,KAAK,EAAE,CAAA;IACvB,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,EAAE,CAAC,CAAA;IAClE,CAAC;AACF,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
package/dist/codec.d.ts DELETED
@@ -1,71 +0,0 @@
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 type { FactValue } from "@bjornpagen/bumbledb";
14
- import type { Digest32 } from "./bytes.js";
15
- import type { ChainEntry } from "./chain.js";
16
- import type { Braid, Theory } from "./descriptor.js";
17
- import type { Generation } from "./keys.js";
18
- interface Op {
19
- readonly op: "insert" | "delete";
20
- readonly relation: string;
21
- readonly rows: ReadonlyArray<readonly FactValue[]>;
22
- }
23
- interface BatchHeader {
24
- readonly fingerprint: Digest32;
25
- readonly braid: Braid;
26
- readonly braidGen: Generation;
27
- readonly prev: Digest32;
28
- readonly writer: bigint;
29
- readonly timestamp: bigint;
30
- }
31
- /**
32
- * Encode input. The handle is the fingerprint authority, so no
33
- * fingerprint field exists here — encode fills the wire's from the
34
- * sealed codec. `prev` is raw bytes so a short digest reaches the named
35
- * `DigestWidth` refuse at this gate instead of dying at `Digest32`
36
- * construction. Decode still produces a branded `BatchHeader`.
37
- */
38
- interface EncodeHeader {
39
- readonly braid: Braid;
40
- readonly braidGen: Generation;
41
- readonly prev: Uint8Array;
42
- readonly writer: bigint;
43
- readonly timestamp: bigint;
44
- }
45
- interface DecodedBatch {
46
- readonly header: BatchHeader;
47
- readonly ops: readonly Op[];
48
- }
49
- /**
50
- * Encodes one batch through the sealed codec. The handle is the
51
- * fingerprint authority: encode fills the wire's fingerprint from the
52
- * sealed codec, so none rides the bridge (a short `prev` is
53
- * `DigestWidth` at this gate). Braid membership, closedness, arity, and
54
- * value validity are the core's refusals, crossing with their identity
55
- * kinds.
56
- */
57
- declare function encodeBatch(theory: Theory, header: EncodeHeader, ops: readonly Op[]): Uint8Array;
58
- /** Full parse of a batch object by the one grammar; refusals cross typed, never partial reads. */
59
- declare function decodeBatch(theory: Theory, bytes: Uint8Array): DecodedBatch;
60
- /**
61
- * The chain discipline (20 apply, step 1): one identity, three proved
62
- * causes — the header's slot identity (braid and generation, both
63
- * halves of the key the object was fetched from), its `prev` vs the
64
- * chain head, its timestamp vs the head's. Corruption-class; the header
65
- * names the misbehaving writer, and the refusal data names the fetched
66
- * braid.
67
- */
68
- declare function verifyChain(header: BatchHeader, braid: Braid, slot: Generation, chain: ChainEntry): void;
69
- export type { BatchHeader, ChainEntry, DecodedBatch, EncodeHeader, Op };
70
- export { decodeBatch, encodeBatch, verifyChain };
71
- //# sourceMappingURL=codec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACX,SAAS,EAMT,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAG/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,UAAU,EAAE;IACX,QAAQ,CAAC,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,SAAS,EAAE,CAAC,CAAA;CAClD;AAED,UAAU,WAAW;IACpB,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAA;IAC9B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,UAAU,YAAY;IACrB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC1B;AAED,UAAU,YAAY;IACrB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,CAAA;CAC3B;AAkGD;;;;;;;GAOG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,UAAU,CAkBzF;AAED,kGAAkG;AAClG,iBAAS,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,YAAY,CA2BpE;AAED;;;;;;;GAOG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAmBjG;AAED,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,CAAA"}
package/dist/codec.js DELETED
@@ -1,179 +0,0 @@
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
package/dist/codec.js.map DELETED
@@ -1 +0,0 @@
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,EAA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