@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/errors.js CHANGED
@@ -1,122 +1,152 @@
1
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.
2
+ * The successor error vocabulary. `LogError = DbError | ProtocolError` and
3
+ * nothing else: a core failure crossing the log is the exact core `DbError`,
4
+ * unchanged; `ProtocolError` adds only the log-specific reason roster from
5
+ * `#codes.ts`, generated by the one native speller. Both classes are direct
6
+ * Effect `Schema.TaggedError` values with a tagged reason; any displayed
7
+ * `.code` is derived from the reason tag and there is no second mutable
8
+ * classification authority. Terminal receipts are data in A, never errors.
9
+ * Submit/admin interruption and finalizer defects stay in `Cause`.
10
+ * Resolve the original command/operation identity after cancellation;
11
+ * cancellation cannot establish whether publication happened.
14
12
  */
15
- import * as errors from "@superbuilders/errors";
13
+ import { DbError, dbError } from "@bjornpagen/bumbledb";
14
+ import { Schema } from "effect";
15
+ import { protocolErrorCodes } from "#codes.ts";
16
+ const Contention = Schema.Struct({
17
+ _tag: Schema.Literal("Contention"),
18
+ attempts: Schema.Number
19
+ });
20
+ const NotYetAvailable = Schema.Struct({
21
+ _tag: Schema.Literal("NotYetAvailable"),
22
+ requestedSeq: Schema.BigInt,
23
+ capturedSeq: Schema.BigInt
24
+ });
25
+ const InsufficientLocalDisk = Schema.Struct({
26
+ _tag: Schema.Literal("InsufficientLocalDisk"),
27
+ requiredBytes: Schema.BigInt,
28
+ availableBytes: Schema.BigInt
29
+ });
30
+ /** C08 envelope backpressure: the retained tail exceeded its policy. */
31
+ const MaintenanceRequired = Schema.Struct({
32
+ _tag: Schema.Literal("MaintenanceRequired"),
33
+ count: Schema.BigInt,
34
+ bytes: Schema.BigInt
35
+ });
16
36
  /**
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.
37
+ * The warm local materialization is behind the checkpoint base. Hydration is
38
+ * NATIVE (recovery runs on the next history open / tenant acquire); `detail`
39
+ * carries the native recovery/reopen guidance — this layer surfaces the
40
+ * typed refusal and never repairs the cache itself.
20
41
  */
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");
42
+ const MaterializationStale = Schema.Struct({
43
+ _tag: Schema.Literal("MaterializationStale"),
44
+ detail: Schema.String
45
+ });
46
+ const MigrationDrift = Schema.Struct({
47
+ _tag: Schema.Literal("MigrationDrift"),
48
+ detail: Schema.String
49
+ });
50
+ const MigrationUnsupported = Schema.Struct({
51
+ _tag: Schema.Literal("MigrationUnsupported"),
52
+ detail: Schema.String
53
+ });
54
+ const MigrationRepository = Schema.Struct({
55
+ _tag: Schema.Literal("MigrationRepository"),
56
+ path: Schema.String,
57
+ detail: Schema.String
58
+ });
59
+ const MigrationIntentRequired = Schema.Struct({
60
+ _tag: Schema.Literal("MigrationIntentRequired"),
61
+ requirements: Schema.Array(Schema.Struct({
62
+ code: Schema.Literals([
63
+ "ambiguous",
64
+ "destructive",
65
+ "missing-backfill",
66
+ "type-change",
67
+ "unsupported",
68
+ "stale-intent",
69
+ "conflicting-intent"
70
+ ]),
71
+ relation: Schema.String,
72
+ field: Schema.NullOr(Schema.String),
73
+ detail: Schema.String
74
+ })),
75
+ truncated: Schema.Boolean
76
+ });
77
+ const structured = [
78
+ "Contention",
79
+ "NotYetAvailable",
80
+ "InsufficientLocalDisk",
81
+ "MaintenanceRequired",
82
+ "MaterializationStale",
83
+ "MigrationDrift",
84
+ "MigrationUnsupported",
85
+ "MigrationRepository",
86
+ "MigrationIntentRequired"
87
+ ];
88
+ const PlainReason = Schema.Struct({
89
+ _tag: Schema.Literals(protocolErrorCodes.filter((code) => !structured.includes(code)))
90
+ });
91
+ export const ProtocolReason = Schema.Union([
92
+ Contention,
93
+ NotYetAvailable,
94
+ InsufficientLocalDisk,
95
+ MaintenanceRequired,
96
+ MaterializationStale,
97
+ MigrationDrift,
98
+ MigrationUnsupported,
99
+ MigrationRepository,
100
+ MigrationIntentRequired,
101
+ PlainReason
102
+ ]);
103
+ const ProtocolErrorBase = Schema.TaggedError()("ProtocolError", {
104
+ operation: Schema.String,
105
+ reason: ProtocolReason
106
+ });
107
+ export class ProtocolError extends ProtocolErrorBase {
108
+ get code() {
109
+ return this.reason._tag;
110
+ }
111
+ }
112
+ /** The one wire error frame the native log machine throws across the bridge. */
113
+ const WireError = Schema.Union([
114
+ Schema.Struct({ source: Schema.Literal("protocol"), reason: ProtocolReason }),
115
+ Schema.Struct({ source: Schema.Literal("core"), reason: Schema.Unknown })
116
+ ]);
117
+ const decodeWireError = Schema.decodeUnknownOption(WireError);
34
118
  /**
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.
119
+ * Decode a thrown bridge value into the typed union. Already-typed errors
120
+ * pass through untouched (core errors are never rewrapped); an unrecognized
121
+ * local throw is a core `Internal`, not a fabricated protocol outcome.
38
122
  */
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;
123
+ export function logFailure(operation, cause) {
124
+ if (cause instanceof DbError || cause instanceof ProtocolError) {
125
+ return cause;
126
+ }
127
+ const wire = decodeWireError(cause);
128
+ if (wire._tag === "Some") {
129
+ if (wire.value.source === "protocol") {
130
+ return new ProtocolError({ operation, reason: wire.value.reason });
131
+ }
132
+ return dbError(operation, wire.value.reason);
133
+ }
134
+ return dbError(operation, cause);
135
+ }
136
+ /** A plain-tag protocol failure, spelled once. */
137
+ export function protocolError(operation, code) {
138
+ return new ProtocolError({ operation, reason: { _tag: code } });
139
+ }
140
+ /** The boundary-parser refusal: malformed public input, before any I/O. */
141
+ export function invalidInput(operation) {
142
+ return new DbError({ operation, reason: { _tag: "InvalidArgument" } });
143
+ }
144
+ /** A closed/stale capability supplied dynamically. */
145
+ export function closedHandle(operation) {
146
+ return new DbError({ operation, reason: { _tag: "ClosedHandle" } });
147
+ }
148
+ /** Post-dispatch fiber interrupt: afterDispatch arm, same original identity. */
149
+ export function cancelled(operation) {
150
+ return new DbError({ operation, reason: { _tag: "Cancelled" } });
57
151
  }
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
152
  //# sourceMappingURL=errors.js.map
@@ -1 +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,kBA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A;AACjE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * `LocalHistory` and `HostedHistory`: the chapter 30/35 durable envelope
3
+ * around the exact core change/read machinery. `open` of a missing or
4
+ * unreadable configured database never creates a replacement; `create` is
5
+ * the explicit constructor, refuses existing authority, and validates its
6
+ * stable creation identity plus checked initialization artifact instead of
7
+ * fabricating genesis or applied migration history.
8
+ */
9
+ import type { AnySchema, NativeRuntime } from "@bjornpagen/bumbledb";
10
+ import type { Effect, Scope } from "effect";
11
+ import type { LogError } from "./errors.js";
12
+ import type { HostedBinding, HostedCreateOptions, HostedOpenOptions, LocalBinding, LocalCreateOptions, LocalOpenOptions } from "./options.js";
13
+ import type { History } from "./surface.js";
14
+ export declare const LocalHistory: {
15
+ open<S extends AnySchema>(binding: LocalBinding, schema: S, options: LocalOpenOptions): Effect.Effect<History<S>, LogError, NativeRuntime | Scope.Scope>;
16
+ create<S extends AnySchema>(binding: LocalBinding, schema: S, options: LocalCreateOptions): Effect.Effect<History<S>, LogError, NativeRuntime | Scope.Scope>;
17
+ };
18
+ export declare const HostedHistory: {
19
+ open<S extends AnySchema>(binding: HostedBinding, schema: S, options: HostedOpenOptions): Effect.Effect<History<S>, LogError, NativeRuntime | Scope.Scope>;
20
+ create<S extends AnySchema>(binding: HostedBinding, schema: S, options: HostedCreateOptions): Effect.Effect<History<S>, LogError, NativeRuntime | Scope.Scope>;
21
+ };
22
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EACX,aAAa,EACb,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open` of a missing or
4
+ * unreadable configured database never creates a replacement; `create` is
5
+ * the explicit constructor, refuses existing authority, and validates its
6
+ * stable creation identity plus checked initialization artifact instead of
7
+ * fabricating genesis or applied migration history.
8
+ */
9
+ import { log } from "#production.ts";
10
+ export const LocalHistory = log.LocalHistory;
11
+ export const HostedHistory = log.HostedHistory;
12
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../src/history.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAGpC,MAAM,CAAC,MAAM,YAAY,GAWrB,GAAG,CAAC,YAAY,CAAA;AAEpB,MAAM,CAAC,MAAM,aAAa,GAWtB,GAAG,CAAC,aAAa,CAAA"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Log-layer identity values: small owned immutable data, never handles.
3
+ * `DatabaseId`/`IncarnationId`/`RequestId`/`OperationId` are Uuid-backed
4
+ * roles (canonical UUID); digests are full 32-byte roles
5
+ * (64 lowercase hex). The distinct roles are nominal brands: an entity ID is
6
+ * not a request ID, and neither is a history coordinate. Parsers here are
7
+ * the bounded log boundary codecs for HTTP/session tokens — pure, `Result`-
8
+ * returning, no I/O, no mint/generate; `SchemaId` and `Uuid` remain
9
+ * core-owned imports. Retry uses the caller-supplied bytes again.
10
+ */
11
+ import { type DbError, type SchemaId, Uuid } from "@bjornpagen/bumbledb";
12
+ import { Result } from "effect";
13
+ declare const databaseIdBrand: unique symbol;
14
+ export type DatabaseId = Uuid & {
15
+ readonly [databaseIdBrand]: typeof databaseIdBrand;
16
+ };
17
+ declare const incarnationIdBrand: unique symbol;
18
+ export type IncarnationId = Uuid & {
19
+ readonly [incarnationIdBrand]: typeof incarnationIdBrand;
20
+ };
21
+ declare const requestIdBrand: unique symbol;
22
+ export type RequestId = Uuid & {
23
+ readonly [requestIdBrand]: typeof requestIdBrand;
24
+ };
25
+ declare const operationIdBrand: unique symbol;
26
+ export type OperationId = Uuid & {
27
+ readonly [operationIdBrand]: typeof operationIdBrand;
28
+ };
29
+ declare const commandDigestBrand: unique symbol;
30
+ export type CommandDigest = string & {
31
+ readonly [commandDigestBrand]: typeof commandDigestBrand;
32
+ };
33
+ declare const decisionDigestBrand: unique symbol;
34
+ export type DecisionDigest = string & {
35
+ readonly [decisionDigestBrand]: typeof decisionDigestBrand;
36
+ };
37
+ declare const rootIdBrand: unique symbol;
38
+ /** A named restore-point/hold identity (chapter 21 NamedRoot). */
39
+ export type RootId = string & {
40
+ readonly [rootIdBrand]: typeof rootIdBrand;
41
+ };
42
+ declare const planSetDigestBrand: unique symbol;
43
+ /** The exact ordered pending-suffix commitment (chapter 33). */
44
+ export type PlanSetDigest = string & {
45
+ readonly [planSetDigestBrand]: typeof planSetDigestBrand;
46
+ };
47
+ export interface DatabaseIdentity {
48
+ readonly databaseId: DatabaseId;
49
+ readonly incarnationId: IncarnationId;
50
+ readonly schemaId: SchemaId;
51
+ }
52
+ export interface DecisionStamp {
53
+ readonly seq: bigint;
54
+ readonly hash: DecisionDigest;
55
+ }
56
+ export interface StateStamp {
57
+ readonly incarnation: IncarnationId;
58
+ readonly dataRevision: bigint;
59
+ }
60
+ declare const receiptEpochBrand: unique symbol;
61
+ /** Positive command-admission namespace; zero is no epoch and is invalid. */
62
+ export type ReceiptEpoch = bigint & {
63
+ readonly [receiptEpochBrand]: typeof receiptEpochBrand;
64
+ };
65
+ export interface CommandId {
66
+ readonly receiptEpoch: ReceiptEpoch;
67
+ readonly requestId: RequestId;
68
+ }
69
+ /** Sufficient to resolve an uncertain submission without a live handle. */
70
+ export interface CommandRef {
71
+ readonly identity: DatabaseIdentity;
72
+ readonly id: CommandId;
73
+ readonly digest: CommandDigest;
74
+ }
75
+ /** One admin/migration operation's protocol identity, fixed before dispatch. */
76
+ export interface OperationRef {
77
+ readonly identity: DatabaseIdentity;
78
+ readonly operation: OperationId;
79
+ }
80
+ export type Freshness = {
81
+ readonly kind: "cached";
82
+ } | {
83
+ readonly kind: "latest";
84
+ } | {
85
+ readonly kind: "at-least";
86
+ readonly requested: DecisionStamp;
87
+ };
88
+ export type ReadConsistency = {
89
+ readonly kind: "cached";
90
+ } | {
91
+ readonly kind: "at-least";
92
+ readonly at: DecisionStamp;
93
+ } | {
94
+ readonly kind: "latest";
95
+ };
96
+ export declare const DatabaseId: {
97
+ readonly parse: (raw: string) => Result.Result<DatabaseId, DbError>;
98
+ readonly from: (id: Uuid) => Result.Result<DatabaseId, DbError>;
99
+ };
100
+ export declare const IncarnationId: {
101
+ readonly parse: (raw: string) => Result.Result<IncarnationId, DbError>;
102
+ readonly from: (id: Uuid) => Result.Result<IncarnationId, DbError>;
103
+ };
104
+ export declare const RequestId: {
105
+ /** The explicit pure nominal conversion over the core's canonical bytes. */
106
+ readonly from: (id: Uuid) => Result.Result<RequestId, DbError>;
107
+ readonly parse: (raw: string) => Result.Result<RequestId, DbError>;
108
+ };
109
+ export declare const OperationId: {
110
+ readonly from: (id: Uuid) => Result.Result<OperationId, DbError>;
111
+ readonly parse: (raw: string) => Result.Result<OperationId, DbError>;
112
+ };
113
+ export declare const ReceiptEpoch: {
114
+ readonly from: (raw: bigint) => Result.Result<ReceiptEpoch, DbError>;
115
+ };
116
+ export declare const CommandDigest: {
117
+ readonly fromHex: (raw: string) => Result.Result<CommandDigest, DbError>;
118
+ };
119
+ export declare const DecisionDigest: {
120
+ readonly fromHex: (raw: string) => Result.Result<DecisionDigest, DbError>;
121
+ };
122
+ export declare const RootId: {
123
+ readonly fromString: (raw: string) => Result.Result<RootId, DbError>;
124
+ };
125
+ export declare const PlanSetDigest: {
126
+ readonly fromHex: (raw: string) => Result.Result<PlanSetDigest, DbError>;
127
+ };
128
+ /**
129
+ * The schema identity is core-owned; the log validates only the canonical
130
+ * 64-lowercase-hex spelling when a token crosses its own HTTP boundary.
131
+ */
132
+ export declare function parseSchemaId(raw: string): Result.Result<SchemaId, DbError>;
133
+ export declare function renderDecisionStamp(stamp: DecisionStamp): string;
134
+ export declare function parseDecisionStamp(raw: string): Result.Result<DecisionStamp, DbError>;
135
+ export declare function renderStateStamp(stamp: StateStamp): string;
136
+ export declare function parseStateStamp(raw: string): Result.Result<StateStamp, DbError>;
137
+ export declare function renderDatabaseIdentity(identity: DatabaseIdentity): string;
138
+ export declare function parseDatabaseIdentity(raw: string): Result.Result<DatabaseIdentity, DbError>;
139
+ export declare function renderCommandRef(ref: CommandRef): string;
140
+ export declare function parseCommandRef(raw: string): Result.Result<CommandRef, DbError>;
141
+ export declare function sameIdentity(a: DatabaseIdentity, b: DatabaseIdentity): boolean;
142
+ export declare function sameCommandRef(a: CommandRef, b: CommandRef): boolean;
143
+ export {};
144
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,OAAO,eAAe,CAAA;CAAE,CAAA;AACtF,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAA;AAC/C,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,OAAO,kBAAkB,CAAA;CAAE,CAAA;AAC/F,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAA;AAC3C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG;IAAE,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,cAAc,CAAA;CAAE,CA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