@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/errors.js ADDED
@@ -0,0 +1,122 @@
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 * as errors from "@superbuilders/errors";
16
+ /**
17
+ * Typed refusal of a protocol object before any apply: batch shape,
18
+ * version, fingerprint, manifest shape, checkpoint braid-set drift —
19
+ * one identity, cause data per site.
20
+ */
21
+ const ErrRefused = errors.new("bumbledb-log refused");
22
+ /** `commit` recorded ops in more than one braid; `commitSplit` is the verb. */
23
+ const ErrSpanningCommit = errors.new("bumbledb-log spanningCommit: the recorded ops span braids — commitSplit is the explicit verb");
24
+ /** A rejected replay on a store that passed the wholeness check. */
25
+ const ErrReplayDiverged = errors.new("bumbledb-log replayDiverged: a published batch rejected during steady-state replay");
26
+ /** The chain discipline, one identity with three proved causes. */
27
+ const ErrChainMismatch = errors.new("bumbledb-log chainMismatch: the batch violates the braid's chain discipline");
28
+ /** Bounded live-tip losses exhausted — an operational signal, not an outcome arm. */
29
+ const ErrContention = errors.new("bumbledb-log contention: consecutive live-tip losses exhausted the bound");
30
+ /** A replica (or any read-role handle) found no manifest; only the writer births a store. */
31
+ export const ErrManifestMissing = errors.new("bumbledb-log manifestMissing: the store has no manifest");
32
+ /** A single id draw larger than one lease width; the width is the one block size. */
33
+ const ErrOverWidth = errors.new("bumbledb-log overWidth: the draw exceeds the lease width");
34
+ /**
35
+ * The cached id block is too short for the draw — the writer's signal
36
+ * to lease a fresh block. A refill is not an exhaustion: the id space
37
+ * still has room; only the cache is short.
38
+ */
39
+ const ErrRefillNeeded = errors.new("bumbledb-log refillNeeded: the cached id block cannot cover the draw");
40
+ /** The next lease would leave u64 — the id space is spent. */
41
+ const ErrExhausted = errors.new("bumbledb-log exhausted: the id space is spent");
42
+ /** A put_create at a slot below the published checkpoint vector. */
43
+ const ErrSlotRetired = errors.new("bumbledb-log slotRetired: the slot is retired");
44
+ /** The vendor channel: I/O and store infrastructure failures. */
45
+ const ErrStore = errors.new("bumbledb-log store failure");
46
+ const refusalData = new WeakMap();
47
+ const chainData = new WeakMap();
48
+ const contentionData = new WeakMap();
49
+ const overWidthData = new WeakMap();
50
+ const refillNeededData = new WeakMap();
51
+ const exhaustedData = new WeakMap();
52
+ const slotRetiredData = new WeakMap();
53
+ function refuse(cause, detail) {
54
+ const error = errors.wrap(ErrRefused, detail);
55
+ refusalData.set(error, cause);
56
+ throw error;
57
+ }
58
+ function refuseChain(data, detail) {
59
+ const error = errors.wrap(ErrChainMismatch, detail);
60
+ chainData.set(error, data);
61
+ throw error;
62
+ }
63
+ function throwContention(data, detail) {
64
+ const error = errors.wrap(ErrContention, detail);
65
+ contentionData.set(error, data);
66
+ throw error;
67
+ }
68
+ function refuseManifestMissing(detail) {
69
+ throw errors.wrap(ErrManifestMissing, detail);
70
+ }
71
+ function isManifestMissing(error) {
72
+ return error instanceof Error && errors.is(error, ErrManifestMissing);
73
+ }
74
+ function refuseOverWidth(data, detail) {
75
+ const error = errors.wrap(ErrOverWidth, detail);
76
+ overWidthData.set(error, data);
77
+ throw error;
78
+ }
79
+ function throwRefillNeeded(data, detail) {
80
+ const error = errors.wrap(ErrRefillNeeded, detail);
81
+ refillNeededData.set(error, data);
82
+ throw error;
83
+ }
84
+ function refuseExhausted(data, detail) {
85
+ const error = errors.wrap(ErrExhausted, detail);
86
+ exhaustedData.set(error, data);
87
+ throw error;
88
+ }
89
+ function refuseSlotRetired(data, detail) {
90
+ const error = errors.wrap(ErrSlotRetired, detail);
91
+ slotRetiredData.set(error, data);
92
+ throw error;
93
+ }
94
+ function refusalOf(error) {
95
+ return refusalData.get(error);
96
+ }
97
+ function chainMismatchOf(error) {
98
+ return chainData.get(error);
99
+ }
100
+ function contentionOf(error) {
101
+ return contentionData.get(error);
102
+ }
103
+ function overWidthOf(error) {
104
+ return overWidthData.get(error);
105
+ }
106
+ function refillNeededOf(error) {
107
+ return refillNeededData.get(error);
108
+ }
109
+ function exhaustedOf(error) {
110
+ return exhaustedData.get(error);
111
+ }
112
+ function slotRetiredOf(error) {
113
+ return slotRetiredData.get(error);
114
+ }
115
+ /** Every store failure wraps the exported sentinel itself, so
116
+ * `errors.is(e, ErrStore)` matches by identity; the vendor error's
117
+ * message rides the detail verbatim. */
118
+ function wrapStore(inner, detail) {
119
+ return errors.wrap(ErrStore, `${detail}: ${inner.message}`);
120
+ }
121
+ 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 };
122
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAI/C;;;;GAIG;AACH,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;AAErD,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CACnC,8FAA8F,CAC9F,CAAA;AAED,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CACnC,oFAAoF,CACpF,CAAA;AAED,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,6EAA6E,CAAC,CAAA;AAElH,qFAAqF;AACrF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAA;AAE5G,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAA;AAEvG,qFAAqF;AACrF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAA;AAE3F;;;;GAIG;AACH,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,C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a thin peer of the engine SDK. The protocol grammar has one
4
+ * implementation, `crates/bumbledb-log`, reached through the engine
5
+ * bridge; this package is typed payload construction, the replica and
6
+ * writer machines, the five-verb object store with its tier-1 `fsStore`,
7
+ * in-process `memStore`, and the `s3Store` AWS S3 client, and
8
+ * `openReplica`/`openWriter`/`openTenants` composed from the engine
9
+ * SDK's own verbs — the replica hands out the SDK's `Db`, and no engine
10
+ * surface is duplicated. Engine types (`FactValue`, `IntervalValue`, …)
11
+ * are the peer `@bjornpagen/bumbledb`'s own exports, never re-exported
12
+ * here.
13
+ */
14
+ export type { Braid } from "./braids.js";
15
+ export { braid, braidsOf, serialAtStatementsOf } from "./braids.js";
16
+ export type { BatchHeader, ChainEntry, DecodedBatch, EncodeHeader, Op } from "./codec.js";
17
+ export { decodeBatch, encodeBatch, verifyChain } from "./codec.js";
18
+ export type { Descriptor, SerialStatement, Theory } from "./descriptor.js";
19
+ export { descriptorOf } from "./descriptor.js";
20
+ export type { ChainCause, ChainMismatchData, ContentionCause, ContentionData, RefusalCause } from "./errors.js";
21
+ export { chainMismatchOf, contentionOf, ErrChainMismatch, ErrContention, ErrManifestMissing, ErrRefused, ErrReplayDiverged, ErrSpanningCommit, ErrStore, isManifestMissing, refusalOf } from "./errors.js";
22
+ export type { Generation, StoreKey } from "./keys.js";
23
+ export { generation, storeKey } from "./keys.js";
24
+ export type { OpenReplicaOptions, Replica, Waited } from "./replica.js";
25
+ export { openReplica } from "./replica.js";
26
+ export type { Create, Etag, Fetched, ObjectStore, Poll, S3Config, S3Credentials, Swap } from "./store.js";
27
+ export { etag, fsStore, memStore, s3Store } from "./store.js";
28
+ export type { OpenTenantsOptions, Tenants } from "./tenants.js";
29
+ export { openTenants } from "./tenants.js";
30
+ export type { CheckpointOrder } from "./vector.js";
31
+ export { Overflow, Vector } from "./vector.js";
32
+ export type { Batch, BraidOutcome, Commit, CommitReceipt, CommitSplit, Deposition, Durability, EmptyCommit, Landing, Writer } from "./writer.js";
33
+ export { openWriter } from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AAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5D,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC7C,YAAY,EACX,KAAK,EACL,YAAY,EACZ,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @bjornpagen/bumbledb-log — braided object-store replication for
3
+ * bumbledb, a thin peer of the engine SDK. The protocol grammar has one
4
+ * implementation, `crates/bumbledb-log`, reached through the engine
5
+ * bridge; this package is typed payload construction, the replica and
6
+ * writer machines, the five-verb object store with its tier-1 `fsStore`,
7
+ * in-process `memStore`, and the `s3Store` AWS S3 client, and
8
+ * `openReplica`/`openWriter`/`openTenants` composed from the engine
9
+ * SDK's own verbs — the replica hands out the SDK's `Db`, and no engine
10
+ * surface is duplicated. Engine types (`FactValue`, `IntervalValue`, …)
11
+ * are the peer `@bjornpagen/bumbledb`'s own exports, never re-exported
12
+ * here.
13
+ */
14
+ export { braid, braidsOf, serialAtStatementsOf } from "#braids.ts";
15
+ export { decodeBatch, encodeBatch, verifyChain } from "#codec.ts";
16
+ export { descriptorOf } from "#descriptor.ts";
17
+ export { chainMismatchOf, contentionOf, ErrChainMismatch, ErrContention, ErrManifestMissing, ErrRefused, ErrReplayDiverged, ErrSpanningCommit, ErrStore, isManifestMissing, refusalOf } from "#errors.ts";
18
+ export { generation, storeKey } from "#keys.ts";
19
+ export { openReplica } from "#replica.ts";
20
+ export { etag, fsStore, memStore, s3Store } from "#store.ts";
21
+ export { openTenants } from "#tenants.ts";
22
+ export { Overflow, Vector } from "#vector.ts";
23
+ export { openWriter } from "#writer.ts";
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EACN,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAa7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA"}
package/dist/keys.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The key layout: generation numbers zero-padded lowercase hex, 16
3
+ * chars; a prefix is a store; a tenant is a prefix under `t/`. A
4
+ * StoreKey is parsed here, once — the verbs take the proof and never
5
+ * re-check. An empty prefix joins as the rest alone, so a leading
6
+ * slash is unrepresentable. Temps and leases live under a reserved
7
+ * tilde-family first segment no StoreKey can spell — the generated
8
+ * table under `conformance/v3/keys/` is the set, read at module init
9
+ * — so those namespaces stay disjoint from every honest key. Format
10
+ * characters, line and paragraph separators, and space separators
11
+ * cannot hide a reserved prefix or a `.lock` suffix: a segment
12
+ * containing one is refused outright.
13
+ */
14
+ import type { Digest32 } from "./bytes.js";
15
+ import type { Braid } from "./descriptor.js";
16
+ /** Reserved first-segment names no StoreKey can spell. Temps and leases live here. */
17
+ declare const TEMP_NAMESPACE = "~tmp";
18
+ declare const LEASE_NAMESPACE = "~lease";
19
+ declare const storeKeyBrand: unique symbol;
20
+ type StoreKey = string & {
21
+ readonly [storeKeyBrand]: typeof storeKeyBrand;
22
+ };
23
+ declare const generationBrand: unique symbol;
24
+ type Generation = bigint & {
25
+ readonly [generationBrand]: typeof generationBrand;
26
+ };
27
+ declare function storeKey(raw: string): StoreKey;
28
+ /** Empty, or a StoreKey spelling (the same segment grammar, no leading or trailing slash). */
29
+ declare function parsePrefix(raw: string): string;
30
+ declare function reservedTemp(pid: number, seq: number): string;
31
+ declare function reservedLease(key: string, token: bigint): string;
32
+ /** A slash path whose first segment is `~tmp` or `~lease`. Not a StoreKey. */
33
+ declare function reservedName(raw: string): string;
34
+ /** Known scratch-lease document under `~lease`. One path, no LIST. */
35
+ declare const CKPT_SCRATCH_LEASE = "ckpt-scratch";
36
+ /** The reserved scratch name: `~lease/ckpt-scratch`. */
37
+ declare function scratchCkptName(): string;
38
+ /** The scratch-lease body, spelled by the one grammar (`crates/bumbledb-log`). */
39
+ declare function encodeCkptScratch(digest: Digest32): Uint8Array;
40
+ /** The digest a scratch-lease body names, or null — the one grammar's
41
+ * parse, branded; the refusal is undifferentiated by law. */
42
+ declare function parseCkptScratch(bytes: Uint8Array): Digest32 | null;
43
+ declare function generation(raw: bigint): Generation;
44
+ declare function manifestKey(prefix: string): StoreKey;
45
+ declare function logKey(prefix: string, braid: Braid, g: Generation): StoreKey;
46
+ declare function checkpointMdbKey(prefix: string, digest: Digest32): StoreKey;
47
+ declare function ckptDocKey(prefix: string, digest: Digest32): StoreKey;
48
+ declare function idsKey(prefix: string, relation: number, field: number): StoreKey;
49
+ declare function tenantPrefix(root: string, tenant: string): string;
50
+ export type { Generation, StoreKey };
51
+ export { CKPT_SCRATCH_LEASE, checkpointMdbKey, ckptDocKey, encodeCkptScratch, generation, idsKey, LEASE_NAMESPACE, logKey, manifestKey, parseCkptScratch, parsePrefix, reservedLease, reservedName, reservedTemp, scratchCkptName, storeKey, TEMP_NAMESPACE, tenantPrefix };
52
+ //# sourceMappingURL=keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAM3C,sFAAsF;AACtF,QAAA,MAAM,cAAc,SAAS,CAAA;AAC7B,QAAA,MAAM,eAAe,WAAW,CAAA;AAwChC,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAA;AAC1C,KAAK,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,OAAO,aAAa,CAAA;CAAE,CAAA;AAE3E,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAA;AAC5C,KAAK,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,OAAO,eAAe,CAAA;CAAE,CAAA;AA4BjF,iBAAS,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAMvC;AAED,8FAA8F;AAC9F,iBAAS,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKxC;AAED,iBAAS,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED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AChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,CAAA"}
package/dist/keys.js ADDED
@@ -0,0 +1,166 @@
1
+ /**
2
+ * The key layout: generation numbers zero-padded lowercase hex, 16
3
+ * chars; a prefix is a store; a tenant is a prefix under `t/`. A
4
+ * StoreKey is parsed here, once — the verbs take the proof and never
5
+ * re-check. An empty prefix joins as the rest alone, so a leading
6
+ * slash is unrepresentable. Temps and leases live under a reserved
7
+ * tilde-family first segment no StoreKey can spell — the generated
8
+ * table under `conformance/v3/keys/` is the set, read at module init
9
+ * — so those namespaces stay disjoint from every honest key. Format
10
+ * characters, line and paragraph separators, and space separators
11
+ * cannot hide a reserved prefix or a `.lock` suffix: a segment
12
+ * containing one is refused outright.
13
+ */
14
+ import { internalLogParseCkptScratch, internalLogRenderCkptScratch } from "@bjornpagen/bumbledb";
15
+ import * as errors from "@superbuilders/errors";
16
+ import { regex } from "arkregex";
17
+ import { digest32, hex32, U64_MAX } from "#bytes.ts";
18
+ import tildeTable from "./tilde-family.json" with { type: "json" };
19
+ /** A segment wearing this suffix is not a key. */
20
+ const LOCK_SUFFIX = ".lock";
21
+ /** Reserved first-segment names no StoreKey can spell. Temps and leases live here. */
22
+ const TEMP_NAMESPACE = "~tmp";
23
+ const LEASE_NAMESPACE = "~lease";
24
+ /**
25
+ * The one tilde table both drivers consume: ASCII `~`, its lookalikes, and
26
+ * the NFKC preimage of U+007E. The packaged copy is the census-pinned
27
+ * byte-identical twin of the generator's output at
28
+ * crates/bumbledb-log/conformance/v3/keys/tilde-family.json. A JSON
29
+ * import inlines under bundlers (nitro will not relocate the sidecar)
30
+ * and still resolves beside dist/keys.js when the package stays external.
31
+ */
32
+ const CODE_POINT_SPELLING = regex("^U\\+[0-9A-F]{4,6}$");
33
+ function loadTildeFamily() {
34
+ const table = tildeTable;
35
+ if (typeof table !== "object" || table === null || !("codePoints" in table)) {
36
+ throw errors.new("tilde table is not a codePoints document");
37
+ }
38
+ const { codePoints } = table;
39
+ if (!Array.isArray(codePoints) || codePoints.length === 0) {
40
+ throw errors.new("tilde table codePoints is not a nonempty array");
41
+ }
42
+ const family = new Set();
43
+ for (const spelling of codePoints) {
44
+ if (typeof spelling !== "string" || !CODE_POINT_SPELLING.test(spelling)) {
45
+ throw errors.new(`tilde table entry is not a U+XXXX code point: ${String(spelling)}`);
46
+ }
47
+ family.add(String.fromCodePoint(Number.parseInt(spelling.slice(2), 16)));
48
+ }
49
+ if (!family.has("~")) {
50
+ throw errors.new("tilde table does not reserve ASCII tilde");
51
+ }
52
+ return family;
53
+ }
54
+ /** First-segment code points that spell a reserved name. The table is the set; no local spelling. */
55
+ const TILDE_FAMILY = loadTildeFamily();
56
+ const FORMAT_OR_SEPARATOR = regex("[\\p{Cc}\\p{Cf}\\p{Zl}\\p{Zp}\\p{Zs}]", "u");
57
+ const SLASH_TRIM = regex("^/+|/+$", "g");
58
+ function firstCodePoint(seg) {
59
+ for (const ch of seg) {
60
+ return ch;
61
+ }
62
+ return undefined;
63
+ }
64
+ function tildeFamilyPrefix(seg) {
65
+ const first = firstCodePoint(seg);
66
+ if (first === undefined) {
67
+ return false;
68
+ }
69
+ return TILDE_FAMILY.has(first);
70
+ }
71
+ /** One path segment of a key or a tenant id: the same grammar. */
72
+ function segmentOk(seg) {
73
+ if (seg.length === 0 || seg.includes("/") || seg === "." || seg === "..") {
74
+ return false;
75
+ }
76
+ if (FORMAT_OR_SEPARATOR.test(seg)) {
77
+ return false;
78
+ }
79
+ return !tildeFamilyPrefix(seg) && !seg.endsWith(LOCK_SUFFIX);
80
+ }
81
+ function storeKey(raw) {
82
+ const wellFormed = raw.length > 0 && !raw.startsWith("/") && !raw.endsWith("/") && raw.split("/").every(segmentOk);
83
+ if (!wellFormed) {
84
+ throw errors.new(`store key is not a slash path: ${raw}`);
85
+ }
86
+ return raw;
87
+ }
88
+ /** Empty, or a StoreKey spelling (the same segment grammar, no leading or trailing slash). */
89
+ function parsePrefix(raw) {
90
+ if (raw.length === 0) {
91
+ return "";
92
+ }
93
+ return storeKey(raw.replace(SLASH_TRIM, ""));
94
+ }
95
+ function reservedTemp(pid, seq) {
96
+ return `${TEMP_NAMESPACE}/${String(pid)}.${String(seq)}`;
97
+ }
98
+ function reservedLease(key, token) {
99
+ return `${LEASE_NAMESPACE}/${key}/${String(token)}`;
100
+ }
101
+ /** A slash path whose first segment is `~tmp` or `~lease`. Not a StoreKey. */
102
+ function reservedName(raw) {
103
+ const segs = raw.split("/");
104
+ if (segs.length === 0 || segs.some((seg) => seg.length === 0 || seg === "." || seg === "..")) {
105
+ throw errors.new(`reserved name is not a slash path: ${raw}`);
106
+ }
107
+ const first = segs[0];
108
+ if (first !== TEMP_NAMESPACE && first !== LEASE_NAMESPACE) {
109
+ throw errors.new(`reserved name is not under ${TEMP_NAMESPACE} or ${LEASE_NAMESPACE}: ${raw}`);
110
+ }
111
+ return raw;
112
+ }
113
+ /** Known scratch-lease document under `~lease`. One path, no LIST. */
114
+ const CKPT_SCRATCH_LEASE = "ckpt-scratch";
115
+ /** The reserved scratch name: `~lease/ckpt-scratch`. */
116
+ function scratchCkptName() {
117
+ return reservedName(`${LEASE_NAMESPACE}/${CKPT_SCRATCH_LEASE}`);
118
+ }
119
+ /** The scratch-lease body, spelled by the one grammar (`crates/bumbledb-log`). */
120
+ function encodeCkptScratch(digest) {
121
+ return internalLogRenderCkptScratch(digest);
122
+ }
123
+ /** The digest a scratch-lease body names, or null — the one grammar's
124
+ * parse, branded; the refusal is undifferentiated by law. */
125
+ function parseCkptScratch(bytes) {
126
+ const named = internalLogParseCkptScratch(bytes);
127
+ if (named === null) {
128
+ return null;
129
+ }
130
+ return digest32(named);
131
+ }
132
+ function generation(raw) {
133
+ if (raw < 0n || raw > U64_MAX) {
134
+ throw errors.new(`generation is a u64: ${raw}`);
135
+ }
136
+ return raw;
137
+ }
138
+ function hex16(g) {
139
+ return g.toString(16).padStart(16, "0");
140
+ }
141
+ function assemble(prefix, rest) {
142
+ return storeKey(prefix.length === 0 ? rest : `${prefix}/${rest}`);
143
+ }
144
+ function manifestKey(prefix) {
145
+ return assemble(prefix, "manifest");
146
+ }
147
+ function logKey(prefix, braid, g) {
148
+ return assemble(prefix, `log/${braid}/${hex16(g)}`);
149
+ }
150
+ function checkpointMdbKey(prefix, digest) {
151
+ return assemble(prefix, `ckpt/${hex32(digest)}.mdb`);
152
+ }
153
+ function ckptDocKey(prefix, digest) {
154
+ return assemble(prefix, `ckpt/${hex32(digest)}`);
155
+ }
156
+ function idsKey(prefix, relation, field) {
157
+ return assemble(prefix, `ids/${relation.toString(16).padStart(8, "0")}/${field.toString(16).padStart(4, "0")}`);
158
+ }
159
+ function tenantPrefix(root, tenant) {
160
+ if (!segmentOk(tenant)) {
161
+ throw errors.new(`tenant id is not a single path segment: ${tenant}`);
162
+ }
163
+ return assemble(root, `t/${tenant}`);
164
+ }
165
+ export { CKPT_SCRATCH_LEASE, checkpointMdbKey, ckptDocKey, encodeCkptScratch, generation, idsKey, LEASE_NAMESPACE, logKey, manifestKey, parseCkptScratch, parsePrefix, reservedLease, reservedName, reservedTemp, scratchCkptName, storeKey, TEMP_NAMESPACE, tenantPrefix };
166
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AAChG,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,UAAU,MAAM,qBAAqB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAElE,kDAAkD;AAClD,MAAM,W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AChB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,CAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The protocol's one mutable object and its checkpoint, as typed
3
+ * payloads. The byte grammar has one implementation —
4
+ * `crates/bumbledb-log` behind the napi bridge — so parse and render
5
+ * here are marshal walks: branded `Digest32` and `Braid` values in,
6
+ * bridge-tagged payloads across, never a second reader of the bytes.
7
+ * The vector algebra over checkpoint heads and the seed transition's
8
+ * catalog audit are machine logic and stay here.
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
+ import { Vector } from "./vector.js";
15
+ interface Manifest {
16
+ readonly fingerprint: Digest32;
17
+ readonly checkpoint: Digest32 | null;
18
+ }
19
+ declare function renderManifest(manifest: Manifest): Uint8Array;
20
+ declare function parseManifest(bytes: Uint8Array): Manifest;
21
+ interface CheckpointHead {
22
+ readonly g: Generation;
23
+ readonly hash: Digest32;
24
+ readonly ts: bigint;
25
+ }
26
+ interface CheckpointFacts {
27
+ readonly braids: ReadonlyMap<Braid, CheckpointHead>;
28
+ readonly catalog: Digest32;
29
+ readonly writer: bigint;
30
+ readonly prev: Digest32 | null;
31
+ readonly sum: bigint;
32
+ }
33
+ declare function checkpointVector(facts: CheckpointFacts): Vector;
34
+ declare function renderCheckpoint(codec: LogCodecHandle, facts: CheckpointFacts): Uint8Array;
35
+ declare function parseCheckpoint(codec: LogCodecHandle, bytes: Uint8Array): CheckpointFacts;
36
+ /** The seed transition's catalog claim: a present checkpoint
37
+ * compares the opened store's `catalog_digest` against the document.
38
+ * Genesis (no checkpoint) has no claim. A mismatch names the publisher. */
39
+ declare function auditCatalog(facts: CheckpointFacts | null, computed: Digest32): void;
40
+ export type { CheckpointFacts, CheckpointHead };
41
+ export { auditCatalog, checkpointVector, parseCheckpoint, parseManifest, renderCheckpoint, renderManifest };
42
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAuC,cAAc,EAAmB,MAAM,sBAAsB,CAAA;AAOhH,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;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,UAAU,QAAQ;IACjB,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAA;CACpC;AA8BD,iBAAS,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAMtD;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CASlD;AAED,UAAU,cAAc;IACvB,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACnB;AAED,UAAU,eAAe;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAA;IACnD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACpB;AAUD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAExD;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,GAAG,UAAU,CAanF;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,CAsBlF;AAED;;4EAE4E;AAC5E,iBAAS,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAW7E;AAED,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The protocol's one mutable object and its checkpoint, as typed
3
+ * payloads. The byte grammar has one implementation —
4
+ * `crates/bumbledb-log` behind the napi bridge — so parse and render
5
+ * here are marshal walks: branded `Digest32` and `Braid` values in,
6
+ * bridge-tagged payloads across, never a second reader of the bytes.
7
+ * The vector algebra over checkpoint heads and the seed transition's
8
+ * catalog audit are machine logic and stay here.
9
+ */
10
+ import { internalLogParseCheckpoint, internalLogParseManifest, internalLogRenderCheckpoint, internalLogRenderManifest } from "@bjornpagen/bumbledb";
11
+ import { bytesEqual, digest32, hex32 } from "#bytes.ts";
12
+ import { braidHex } from "#descriptor.ts";
13
+ import { refuse } from "#errors.ts";
14
+ import { generation } from "#keys.ts";
15
+ import { Vector } from "#vector.ts";
16
+ /**
17
+ * Remints a bridge refusal row as the driver's typed refusal. The
18
+ * boundary carries `{ kind, message }` only: the kind is the log
19
+ * core's own identity string, so the cause payload holds the data this
20
+ * side owns — the document's length, its version byte (byte 0 of every
21
+ * v:3 document) — and nothing invented. The raw braid id of an
22
+ * `UnknownBraid` rides the message; the drifted set of a `BraidSet`
23
+ * rides the message the same way.
24
+ */
25
+ function refuseBridged(kind, message, bytes) {
26
+ switch (kind) {
27
+ case "Version":
28
+ return refuse({ kind: "Version", version: bytes[0] ?? 0 }, message);
29
+ case "Overflow":
30
+ return refuse({ kind: "Overflow" }, message);
31
+ case "UnknownBraid":
32
+ return refuse({ kind: "UnknownBraid" }, message);
33
+ case "BraidSet":
34
+ return refuse({ kind: "BraidSet" }, message);
35
+ case "Malformed":
36
+ return refuse({ kind: "Malformed", at: bytes.length }, message);
37
+ }
38
+ }
39
+ function braidIdOf(id) {
40
+ return Number.parseInt(id.slice(1), 16);
41
+ }
42
+ function renderManifest(manifest) {
43
+ return internalLogRenderManifest(manifest.checkpoint === null
44
+ ? { fingerprint: manifest.fingerprint }
45
+ : { fingerprint: manifest.fingerprint, checkpoint: manifest.checkpoint });
46
+ }
47
+ function parseManifest(bytes) {
48
+ const parsed = internalLogParseManifest(bytes);
49
+ if (!parsed.ok) {
50
+ refuseBridged(parsed.kind, parsed.message, bytes);
51
+ }
52
+ return {
53
+ fingerprint: digest32(parsed.value.fingerprint),
54
+ checkpoint: parsed.value.checkpoint === undefined ? null : digest32(parsed.value.checkpoint)
55
+ };
56
+ }
57
+ function vectorOfHeads(braids) {
58
+ const counts = new Map();
59
+ for (const [id, head] of braids) {
60
+ counts.set(id, head.g);
61
+ }
62
+ return Vector.from(counts);
63
+ }
64
+ function checkpointVector(facts) {
65
+ return vectorOfHeads(facts.braids);
66
+ }
67
+ function renderCheckpoint(codec, facts) {
68
+ const braids = [...facts.braids.entries()]
69
+ .sort(function ascending(a, b) {
70
+ return braidIdOf(a[0]) - braidIdOf(b[0]);
71
+ })
72
+ .map(function headOf([id, head]) {
73
+ return { braid: braidIdOf(id), g: head.g, hash: head.hash, ts: head.ts };
74
+ });
75
+ const doc = facts.prev === null
76
+ ? { braids, catalog: facts.catalog, writer: facts.writer }
77
+ : { braids, catalog: facts.catalog, writer: facts.writer, prev: facts.prev };
78
+ return internalLogRenderCheckpoint(codec, doc);
79
+ }
80
+ function parseCheckpoint(codec, bytes) {
81
+ const parsed = internalLogParseCheckpoint(codec, bytes);
82
+ if (!parsed.ok) {
83
+ refuseBridged(parsed.kind, parsed.message, bytes);
84
+ }
85
+ const braids = new Map();
86
+ for (const head of parsed.value.braids) {
87
+ braids.set(braidHex(head.braid), { g: generation(head.g), hash: digest32(head.hash), ts: head.ts });
88
+ }
89
+ /** The core refuses `Overflow` at parse; the narrowing here is the
90
+ * derived sum's own type gate over the same heads. */
91
+ const summed = vectorOfHeads(braids).sum();
92
+ if (typeof summed !== "bigint") {
93
+ refuse({ kind: "Overflow" }, "checkpoint vector sum overflows u64");
94
+ }
95
+ return {
96
+ braids,
97
+ catalog: digest32(parsed.value.catalog),
98
+ writer: parsed.value.writer,
99
+ prev: parsed.value.prev === undefined ? null : digest32(parsed.value.prev),
100
+ sum: summed
101
+ };
102
+ }
103
+ /** The seed transition's catalog claim: a present checkpoint
104
+ * compares the opened store's `catalog_digest` against the document.
105
+ * Genesis (no checkpoint) has no claim. A mismatch names the publisher. */
106
+ function auditCatalog(facts, computed) {
107
+ if (facts === null) {
108
+ return;
109
+ }
110
+ if (bytesEqual(facts.catalog, computed)) {
111
+ return;
112
+ }
113
+ refuse({ kind: "CheckpointDigest", expected: hex32(facts.catalog), computed: hex32(computed) }, `checkpoint catalog ${hex32(facts.catalog)} disagrees with the opened store ${hex32(computed)}; publisher ${facts.writer}`);
114
+ }
115
+ export { auditCatalog, checkpointVector, parseCheckpoint, parseManifest, renderCheckpoint, renderManifest };
116
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,M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