@superbee/core 0.1.6 → 0.2.0-pre.10

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 (248) hide show
  1. package/README.md +127 -0
  2. package/dist/artifact-contract.d.ts +90 -0
  3. package/dist/artifact-contract.d.ts.map +1 -0
  4. package/dist/artifact-contract.js +205 -0
  5. package/dist/artifact-contract.js.map +1 -0
  6. package/dist/backend.d.ts +16 -1
  7. package/dist/backend.d.ts.map +1 -1
  8. package/dist/backend.js +112 -47
  9. package/dist/backend.js.map +1 -1
  10. package/dist/bundle-ops.d.ts +42 -0
  11. package/dist/bundle-ops.d.ts.map +1 -0
  12. package/dist/bundle-ops.js +88 -0
  13. package/dist/bundle-ops.js.map +1 -0
  14. package/dist/bundle.d.ts +10 -28
  15. package/dist/bundle.d.ts.map +1 -1
  16. package/dist/bundle.js +12 -69
  17. package/dist/bundle.js.map +1 -1
  18. package/dist/document-codec.d.ts +6 -1
  19. package/dist/document-codec.d.ts.map +1 -1
  20. package/dist/document-codec.js +8 -4
  21. package/dist/document-codec.js.map +1 -1
  22. package/dist/document-field-actions.d.ts +107 -0
  23. package/dist/document-field-actions.d.ts.map +1 -0
  24. package/dist/document-field-actions.js +302 -0
  25. package/dist/document-field-actions.js.map +1 -0
  26. package/dist/document-mutation.d.ts +61 -3
  27. package/dist/document-mutation.d.ts.map +1 -1
  28. package/dist/document-mutation.js +116 -25
  29. package/dist/document-mutation.js.map +1 -1
  30. package/dist/document-write-policy.d.ts +0 -1
  31. package/dist/document-write-policy.d.ts.map +1 -1
  32. package/dist/document-write-policy.js +7 -4
  33. package/dist/document-write-policy.js.map +1 -1
  34. package/dist/engine.d.ts +3 -1
  35. package/dist/engine.d.ts.map +1 -1
  36. package/dist/engine.js +6 -4
  37. package/dist/engine.js.map +1 -1
  38. package/dist/file-journaled-backend-internal.d.ts +19 -0
  39. package/dist/file-journaled-backend-internal.d.ts.map +1 -0
  40. package/dist/file-journaled-backend-internal.js +10 -0
  41. package/dist/file-journaled-backend-internal.js.map +1 -0
  42. package/dist/file-journaled-backend.d.ts +162 -0
  43. package/dist/file-journaled-backend.d.ts.map +1 -0
  44. package/dist/file-journaled-backend.js +1113 -0
  45. package/dist/file-journaled-backend.js.map +1 -0
  46. package/dist/filesystem-host.d.ts +15 -0
  47. package/dist/filesystem-host.d.ts.map +1 -0
  48. package/dist/filesystem-host.js +20 -0
  49. package/dist/filesystem-host.js.map +1 -0
  50. package/dist/filesystem-identity.d.ts +86 -4
  51. package/dist/filesystem-identity.d.ts.map +1 -1
  52. package/dist/filesystem-identity.js +338 -102
  53. package/dist/filesystem-identity.js.map +1 -1
  54. package/dist/filesystem-lock.d.ts +16 -3
  55. package/dist/filesystem-lock.d.ts.map +1 -1
  56. package/dist/filesystem-lock.js +323 -77
  57. package/dist/filesystem-lock.js.map +1 -1
  58. package/dist/filesystem-push-role.d.ts +77 -0
  59. package/dist/filesystem-push-role.d.ts.map +1 -0
  60. package/dist/filesystem-push-role.js +165 -0
  61. package/dist/filesystem-push-role.js.map +1 -0
  62. package/dist/filesystem.d.ts +17 -0
  63. package/dist/filesystem.d.ts.map +1 -0
  64. package/dist/filesystem.js +18 -0
  65. package/dist/filesystem.js.map +1 -0
  66. package/dist/freshness.d.ts +10 -7
  67. package/dist/freshness.d.ts.map +1 -1
  68. package/dist/freshness.js +14 -11
  69. package/dist/freshness.js.map +1 -1
  70. package/dist/frontmatter-contract.d.ts +2 -2
  71. package/dist/frontmatter-contract.js +2 -2
  72. package/dist/frontmatter.d.ts +11 -1
  73. package/dist/frontmatter.d.ts.map +1 -1
  74. package/dist/frontmatter.js +20 -7
  75. package/dist/frontmatter.js.map +1 -1
  76. package/dist/governed-body-write.d.ts +106 -0
  77. package/dist/governed-body-write.d.ts.map +1 -0
  78. package/dist/governed-body-write.js +251 -0
  79. package/dist/governed-body-write.js.map +1 -0
  80. package/dist/heads-digest.d.ts +32 -0
  81. package/dist/heads-digest.d.ts.map +1 -0
  82. package/dist/heads-digest.js +37 -0
  83. package/dist/heads-digest.js.map +1 -0
  84. package/dist/host-policy-snapshot.d.ts +9 -0
  85. package/dist/host-policy-snapshot.d.ts.map +1 -0
  86. package/dist/host-policy-snapshot.js +33 -0
  87. package/dist/host-policy-snapshot.js.map +1 -0
  88. package/dist/host-text.d.ts +31 -0
  89. package/dist/host-text.d.ts.map +1 -0
  90. package/dist/host-text.js +77 -0
  91. package/dist/host-text.js.map +1 -0
  92. package/dist/hosted-transport/answer-rows.d.ts +216 -0
  93. package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
  94. package/dist/hosted-transport/answer-rows.js +396 -0
  95. package/dist/hosted-transport/answer-rows.js.map +1 -0
  96. package/dist/hosted-transport/carrier.d.ts +142 -0
  97. package/dist/hosted-transport/carrier.d.ts.map +1 -0
  98. package/dist/hosted-transport/carrier.js +241 -0
  99. package/dist/hosted-transport/carrier.js.map +1 -0
  100. package/dist/hosted-transport/history-pages.d.ts +55 -0
  101. package/dist/hosted-transport/history-pages.d.ts.map +1 -0
  102. package/dist/hosted-transport/history-pages.js +69 -0
  103. package/dist/hosted-transport/history-pages.js.map +1 -0
  104. package/dist/hosted-transport/index.d.ts +18 -0
  105. package/dist/hosted-transport/index.d.ts.map +1 -0
  106. package/dist/hosted-transport/index.js +18 -0
  107. package/dist/hosted-transport/index.js.map +1 -0
  108. package/dist/hosted-transport/operations.d.ts +85 -0
  109. package/dist/hosted-transport/operations.d.ts.map +1 -0
  110. package/dist/hosted-transport/operations.js +128 -0
  111. package/dist/hosted-transport/operations.js.map +1 -0
  112. package/dist/hosted-transport/paged-reads.d.ts +87 -0
  113. package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
  114. package/dist/hosted-transport/paged-reads.js +238 -0
  115. package/dist/hosted-transport/paged-reads.js.map +1 -0
  116. package/dist/hosted-transport/read-adapter.d.ts +250 -0
  117. package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
  118. package/dist/hosted-transport/read-adapter.js +557 -0
  119. package/dist/hosted-transport/read-adapter.js.map +1 -0
  120. package/dist/hosted-transport/root-write.d.ts +114 -0
  121. package/dist/hosted-transport/root-write.d.ts.map +1 -0
  122. package/dist/hosted-transport/root-write.js +171 -0
  123. package/dist/hosted-transport/root-write.js.map +1 -0
  124. package/dist/hosted-transport/whole-document-transport.d.ts +174 -0
  125. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
  126. package/dist/hosted-transport/whole-document-transport.js +411 -0
  127. package/dist/hosted-transport/whole-document-transport.js.map +1 -0
  128. package/dist/index.d.ts +29 -8
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +26 -6
  131. package/dist/index.js.map +1 -1
  132. package/dist/indexeddb-backend.d.ts +197 -0
  133. package/dist/indexeddb-backend.d.ts.map +1 -0
  134. package/dist/indexeddb-backend.js +1183 -0
  135. package/dist/indexeddb-backend.js.map +1 -0
  136. package/dist/journaled-backend.d.ts +467 -0
  137. package/dist/journaled-backend.d.ts.map +1 -0
  138. package/dist/journaled-backend.js +389 -0
  139. package/dist/journaled-backend.js.map +1 -0
  140. package/dist/kind-coverage.d.ts +99 -0
  141. package/dist/kind-coverage.d.ts.map +1 -0
  142. package/dist/kind-coverage.js +186 -0
  143. package/dist/kind-coverage.js.map +1 -0
  144. package/dist/kind-field-mutation.d.ts +15 -0
  145. package/dist/kind-field-mutation.d.ts.map +1 -0
  146. package/dist/kind-field-mutation.js +160 -0
  147. package/dist/kind-field-mutation.js.map +1 -0
  148. package/dist/kinds.d.ts +31 -1
  149. package/dist/kinds.d.ts.map +1 -1
  150. package/dist/kinds.js +86 -17
  151. package/dist/kinds.js.map +1 -1
  152. package/dist/links.d.ts +1 -1
  153. package/dist/links.d.ts.map +1 -1
  154. package/dist/links.js +5 -10
  155. package/dist/links.js.map +1 -1
  156. package/dist/managed-document-metadata.d.ts +2 -0
  157. package/dist/managed-document-metadata.d.ts.map +1 -0
  158. package/dist/managed-document-metadata.js +9 -0
  159. package/dist/managed-document-metadata.js.map +1 -0
  160. package/dist/meaningful-change-time.d.ts +6 -6
  161. package/dist/meaningful-change-time.d.ts.map +1 -1
  162. package/dist/meaningful-change-time.js +12 -13
  163. package/dist/meaningful-change-time.js.map +1 -1
  164. package/dist/memory-backend.d.ts +2 -2
  165. package/dist/memory-backend.d.ts.map +1 -1
  166. package/dist/memory-backend.js +32 -16
  167. package/dist/memory-backend.js.map +1 -1
  168. package/dist/mutation.d.ts.map +1 -1
  169. package/dist/mutation.js +2 -2
  170. package/dist/mutation.js.map +1 -1
  171. package/dist/page.d.ts.map +1 -1
  172. package/dist/page.js +2 -1
  173. package/dist/page.js.map +1 -1
  174. package/dist/paths.d.ts +6 -2
  175. package/dist/paths.d.ts.map +1 -1
  176. package/dist/paths.js +35 -33
  177. package/dist/paths.js.map +1 -1
  178. package/dist/platform.d.ts +239 -0
  179. package/dist/platform.d.ts.map +1 -0
  180. package/dist/platform.js +82 -0
  181. package/dist/platform.js.map +1 -0
  182. package/dist/portable-export.d.ts +119 -0
  183. package/dist/portable-export.d.ts.map +1 -0
  184. package/dist/portable-export.js +501 -0
  185. package/dist/portable-export.js.map +1 -0
  186. package/dist/publication-filesystem.d.ts +1 -1
  187. package/dist/publication-filesystem.d.ts.map +1 -1
  188. package/dist/publication-filesystem.js +1 -1
  189. package/dist/publication-filesystem.js.map +1 -1
  190. package/dist/query-filter.d.ts +7 -2
  191. package/dist/query-filter.d.ts.map +1 -1
  192. package/dist/query-filter.js +24 -1
  193. package/dist/query-filter.js.map +1 -1
  194. package/dist/query-order.d.ts +22 -0
  195. package/dist/query-order.d.ts.map +1 -0
  196. package/dist/query-order.js +42 -0
  197. package/dist/query-order.js.map +1 -0
  198. package/dist/recipes.d.ts +3 -1
  199. package/dist/recipes.d.ts.map +1 -1
  200. package/dist/recipes.js +4 -4
  201. package/dist/recipes.js.map +1 -1
  202. package/dist/remote-backend.d.ts +114 -22
  203. package/dist/remote-backend.d.ts.map +1 -1
  204. package/dist/remote-backend.js +285 -44
  205. package/dist/remote-backend.js.map +1 -1
  206. package/dist/remote-document-codec.d.ts +15 -0
  207. package/dist/remote-document-codec.d.ts.map +1 -0
  208. package/dist/remote-document-codec.js +103 -0
  209. package/dist/remote-document-codec.js.map +1 -0
  210. package/dist/remote-error.d.ts +38 -0
  211. package/dist/remote-error.d.ts.map +1 -0
  212. package/dist/remote-error.js +59 -0
  213. package/dist/remote-error.js.map +1 -0
  214. package/dist/remote-operations.d.ts +63 -0
  215. package/dist/remote-operations.d.ts.map +1 -0
  216. package/dist/remote-operations.js +125 -0
  217. package/dist/remote-operations.js.map +1 -0
  218. package/dist/remote-parsers.d.ts +86 -0
  219. package/dist/remote-parsers.d.ts.map +1 -0
  220. package/dist/remote-parsers.js +181 -0
  221. package/dist/remote-parsers.js.map +1 -0
  222. package/dist/remote.d.ts +7 -2
  223. package/dist/remote.d.ts.map +1 -1
  224. package/dist/remote.js +6 -1
  225. package/dist/remote.js.map +1 -1
  226. package/dist/sha256.d.ts +21 -0
  227. package/dist/sha256.d.ts.map +1 -0
  228. package/dist/sha256.js +114 -0
  229. package/dist/sha256.js.map +1 -0
  230. package/dist/storage.d.ts +8 -2
  231. package/dist/storage.d.ts.map +1 -1
  232. package/dist/storage.js +11 -2
  233. package/dist/storage.js.map +1 -1
  234. package/dist/types.d.ts +40 -5
  235. package/dist/types.d.ts.map +1 -1
  236. package/dist/uncertain-write.d.ts +178 -0
  237. package/dist/uncertain-write.d.ts.map +1 -0
  238. package/dist/uncertain-write.js +198 -0
  239. package/dist/uncertain-write.js.map +1 -0
  240. package/dist/version-transport.d.ts +7 -0
  241. package/dist/version-transport.d.ts.map +1 -1
  242. package/dist/version-transport.js +9 -0
  243. package/dist/version-transport.js.map +1 -1
  244. package/dist/versioning.d.ts +18 -7
  245. package/dist/versioning.d.ts.map +1 -1
  246. package/dist/versioning.js +23 -14
  247. package/dist/versioning.js.map +1 -1
  248. package/package.json +75 -4
@@ -0,0 +1,389 @@
1
+ /**
2
+ * The journaled-backend seam: what a storage adapter must add to {@link StorageBackend} to host
3
+ * a browser-local working copy whose synchronization is a durable intent journal. The engine
4
+ * reads and writes through `StorageBackend`; the sync runtime reads and writes through this
5
+ * seam. Any adapter that implements it and passes the journal rows of the contract kit can hold
6
+ * the working copy, whatever it persists to.
7
+ *
8
+ * The contract a second adapter must meet:
9
+ *
10
+ * - {@link JournaledBackend.writeJournaled} is ONE transaction over documents, intents, and
11
+ * meta: the document compare-and-swap of `write`, plus (optionally) deleting a superseded
12
+ * intent, recording a new intent for the written bytes, and putting meta rows. Every step is
13
+ * conditional on every other: a failed document CAS records no intent, and a superseded
14
+ * intent whose state or attempts moved fails the whole write with {@link IntentStateConflict}
15
+ * so the caller composes against fresh state. With `requireSettled`, an unsettled intent on
16
+ * the target fails it with {@link IntentHoldConflict} before the document is touched; the
17
+ * check runs inside the write's own transaction, so an intent committed while the caller was
18
+ * awaiting the network still holds the target. A recorded intent starts `pending` with zero
19
+ * attempts, carries the written bytes as `content` and their version as `local`, and takes
20
+ * the next value of a monotonic per-store sequence. The sequence advances only for a write
21
+ * that commits.
22
+ * - {@link JournaledBackend.deleteJournaled} is the deletion counterpart: ONE transaction that
23
+ * removes the document record under the same compare-and-swap, puts and removes meta rows
24
+ * with it, optionally supersedes an intent and records a deletion intent
25
+ * ({@link DOCUMENT_DELETE_KIND}) exactly as `writeJournaled` does for a write, and honours
26
+ * `requireSettled` the same way, so a document the authority deleted
27
+ * leaves the working copy together with its shared base and never while a local edit holds
28
+ * it. An absent target is not a conflict: the meta changes still apply and the result says
29
+ * `absent`, as the plain `delete` answers absence with `false`. With `onHeld`, a hold is not a
30
+ * rejection but the third outcome: the deletion and its own meta changes do not apply, the
31
+ * `onHeld` meta rows apply instead, in the same transaction as the hold check, and the result
32
+ * says `held` and names the holder. A caller that must rewrite a held document's shared base
33
+ * (a pull reconciling a remote deletion) does it there, so no other realm can settle the
34
+ * holding intent between the refusal and the rewrite.
35
+ * - `resolveIntents` on either journaled mutation requires document CAS and the exact complete
36
+ * unsettled target journal. It retires those records atomically with the document, meta, and
37
+ * optional replacement intent, leaving acknowledged history untouched. Recovery may retire a
38
+ * chain whose head is a recorded conflict or refusal, with conflicted, refused, and
39
+ * never-attempted pending successors behind it, never uncertain delivery. The caller
40
+ * preserves recovery evidence in meta; retirement does not assert remote acceptance.
41
+ * - {@link JournaledBackend.retireAcknowledged}, when an adapter offers it, is ONE transaction
42
+ * that removes named acknowledged intents of one target, and named meta rows, under the full
43
+ * guard of that target. Every named intent must be acknowledged in the guard, and the guard is
44
+ * compared in the same transaction, so an intent another realm moved since the caller's read is
45
+ * never removed. Unsettled work is never retired this way. What a retained successor may
46
+ * still need from a retired row is the caller's rule; the adapter only enforces the premise.
47
+ * - {@link JournaledBackend.readWithJournal} is ONE snapshot: the document, every intent
48
+ * targeting it, and the named meta rows, read in one readonly transaction, so a write in
49
+ * another realm between separate reads can never show a caller a document of one moment
50
+ * beside a journal of another. Intents come back in local commit order (by `sequence`).
51
+ * - {@link JournaledBackend.readHeads} is that snapshot over every document at once: each
52
+ * record's head (id, version, writer, time), its leading frontmatter parsed as `read` parses
53
+ * it, its exact bytes, every intent targeting it, and the meta rows the caller names for it,
54
+ * all from ONE readonly transaction, so every row describes the same moment. Bodies are
55
+ * never parsed. A record whose leading block does not parse is a row with `frontmatter`
56
+ * null and the parser's error, never a dropped row and never a failed listing. A caller that
57
+ * keeps less than the row (a version and a provenance, say) passes `project`, which maps
58
+ * each row as it is read so the listing over a large store never holds every document's
59
+ * stored bytes at once; the journal is read whole before the walk, so intents and the
60
+ * content they carry are held for its duration, as a single read holds them. Keys every row
61
+ * needs go in `shared`, read once. Rows come back in the order `list` orders ids.
62
+ * - {@link JournaledBackend.updateIntent} is a compare-and-swap on the intent's `state`: the
63
+ * patch applies only while the record is in `expectedState`, together with any meta rows, in
64
+ * one transaction. A different state or a missing record rejects with
65
+ * {@link IntentStateConflict} and writes nothing, so two realms (a stale tab, a worker) cannot
66
+ * both settle or both replace one intent.
67
+ * - {@link JournaledBackend.listIntents} returns intents in local commit order (ascending
68
+ * `sequence`), optionally restricted to one or more states.
69
+ * - {@link JournaledBackend.readMeta} and {@link JournaledBackend.writeMeta} are an opaque
70
+ * key-value store; what the rows mean belongs to the sync component that writes them.
71
+ *
72
+ * This module imports no Node builtin so it bundles for the browser. The IndexedDB adapter is
73
+ * the shipping implementation; a test-only in-memory adapter proves the seam is not a
74
+ * description of that one class.
75
+ */
76
+ import { assertSafeConceptId } from "./paths.js";
77
+ import { versionOfBytes } from "./versioning.js";
78
+ /**
79
+ * The intent kind of a journaled local deletion: the document leaves at exactly the intent's
80
+ * base. A deletion carries no bytes, so its `content` is {@link DELETION_CONTENT} and its `local`
81
+ * is {@link DELETION_VERSION}, the version of empty bytes, which no document can have (every
82
+ * document has frontmatter). A conflict can therefore never name a deletion's own `local` and
83
+ * read as its commit.
84
+ */
85
+ export const DOCUMENT_DELETE_KIND = "document.delete";
86
+ export const DELETION_CONTENT = "";
87
+ export const DELETION_VERSION = versionOfBytes(DELETION_CONTENT);
88
+ /** A full snapshot or metadata admission premise changed; nothing was written. */
89
+ export class JournalGuardConflict extends Error {
90
+ name = "JournalGuardConflict";
91
+ target;
92
+ constructor(target) {
93
+ super(`journal guard for '${target}' does not match or is invalid`);
94
+ this.target = target;
95
+ }
96
+ }
97
+ /**
98
+ * Guard values are acyclic plain records, arrays, and primitive values (including undefined).
99
+ * Symbols, accessors, functions, and objects with other prototypes are refused. This restriction
100
+ * applies only to guarded operations; the unguarded metadata store remains opaque.
101
+ */
102
+ export function captureJournalValue(value) {
103
+ const ancestors = new Set();
104
+ const check = (entry) => {
105
+ if (typeof entry === "function" || typeof entry === "symbol")
106
+ throw new JournalGuardConflict("value");
107
+ if (entry === null || typeof entry !== "object")
108
+ return;
109
+ if (ancestors.has(entry) || (!Array.isArray(entry) && Object.getPrototypeOf(entry) !== Object.prototype && Object.getPrototypeOf(entry) !== null))
110
+ throw new JournalGuardConflict("value");
111
+ ancestors.add(entry);
112
+ for (const key of Reflect.ownKeys(entry)) {
113
+ if (typeof key !== "string")
114
+ throw new JournalGuardConflict("value");
115
+ const descriptor = Object.getOwnPropertyDescriptor(entry, key);
116
+ if (!("value" in descriptor) || (!descriptor.enumerable && !(Array.isArray(entry) && key === "length")))
117
+ throw new JournalGuardConflict("value");
118
+ check(descriptor.value);
119
+ }
120
+ ancestors.delete(entry);
121
+ };
122
+ check(value);
123
+ return structuredClone(value);
124
+ }
125
+ function equalJournalValue(a, b) {
126
+ if (Object.is(a, b))
127
+ return true;
128
+ if (!a || !b || typeof a !== "object" || typeof b !== "object" || Array.isArray(a) !== Array.isArray(b))
129
+ return false;
130
+ if (Array.isArray(a) && a.length !== b.length)
131
+ return false;
132
+ const keys = Object.keys(a);
133
+ return keys.length === Object.keys(b).length && keys.every(key => Object.hasOwn(b, key) && equalJournalValue(a[key], b[key]));
134
+ }
135
+ function assertMetaExpectation(value) {
136
+ if (!value || typeof value !== "object" || typeof value.present !== "boolean" ||
137
+ !equalJournalValue(Object.keys(value).sort(), (value.present ? ["present", "value"] : ["present"]).sort()))
138
+ throw new JournalGuardConflict("meta");
139
+ }
140
+ export function captureJournalGuard(value, target) {
141
+ if (!value || typeof value !== "object" || Array.isArray(value))
142
+ throw new JournalGuardConflict(target ?? "guard");
143
+ const guard = captureJournalValue(value);
144
+ if (typeof guard.target !== "string")
145
+ throw new JournalGuardConflict(target ?? "guard");
146
+ target ??= guard.target;
147
+ assertSafeConceptId(guard.target);
148
+ if (guard.target !== target || !Array.isArray(guard.intents) || !Array.isArray(guard.meta) ||
149
+ (guard.document !== null && (!guard.document || typeof guard.document.version !== "string" || typeof guard.document.raw !== "string")))
150
+ throw new JournalGuardConflict(target);
151
+ const requests = new Set(), sequences = new Set(), keys = new Set();
152
+ for (const row of guard.intents) {
153
+ if (!row || row.target !== target || typeof row.requestId !== "string" || requests.has(row.requestId) || !Number.isSafeInteger(row.sequence) || sequences.has(row.sequence))
154
+ throw new JournalGuardConflict(target);
155
+ requests.add(row.requestId);
156
+ sequences.add(row.sequence);
157
+ }
158
+ for (const row of guard.meta) {
159
+ if (!row || typeof row.key !== "string" || keys.has(row.key))
160
+ throw new JournalGuardConflict(target);
161
+ keys.add(row.key);
162
+ assertMetaExpectation(row.expected);
163
+ }
164
+ return guard;
165
+ }
166
+ /** Only omission or undefined selects the unguarded compatibility path. */
167
+ export function captureJournalGuardOption(options, target) {
168
+ const descriptor = Object.getOwnPropertyDescriptor(options, "guard");
169
+ if (!descriptor) {
170
+ if ("guard" in options)
171
+ throw new JournalGuardConflict(target ?? "guard");
172
+ return undefined;
173
+ }
174
+ if (!("value" in descriptor))
175
+ throw new JournalGuardConflict(target ?? "guard");
176
+ return descriptor.value === undefined ? undefined : captureJournalGuard(descriptor.value, target);
177
+ }
178
+ /** Compare all target records, including acknowledged history, and exact named row presence. */
179
+ export function assertJournalGuard(expected, current) {
180
+ const a = captureJournalGuard(expected), b = captureJournalGuard(current, a.target);
181
+ a.intents.sort((x, y) => x.sequence - y.sequence);
182
+ b.intents.sort((x, y) => x.sequence - y.sequence);
183
+ a.meta.sort((x, y) => x.key.localeCompare(y.key));
184
+ b.meta.sort((x, y) => x.key.localeCompare(y.key));
185
+ if (!equalJournalValue(a, b))
186
+ throw new JournalGuardConflict(a.target);
187
+ }
188
+ /** Capture guarded updates before any asynchronous adapter work and protect original history. */
189
+ export function captureIntentUpdate(patch, options) {
190
+ const guard = captureJournalGuardOption(options);
191
+ if (guard !== undefined)
192
+ captureJournalValue({ patch, options });
193
+ if (options.document && guard === undefined)
194
+ throw new JournalGuardConflict(options.document.id);
195
+ const captured = structuredClone({ patch, options });
196
+ if (guard !== undefined) {
197
+ captured.options.guard = guard;
198
+ const mutable = new Set(["state", "attempts", "acknowledgedVersion", "remote", "refusal", "finding", "updatedAt"]);
199
+ if (Object.keys(patch).some(key => !mutable.has(key)) || (captured.options.document && captured.options.document.id !== captured.options.guard.target))
200
+ throw new JournalGuardConflict(captured.options.guard.target);
201
+ assertJournalMetaChanges(captured.options.guard, captured.options.meta ?? [], undefined);
202
+ }
203
+ return captured;
204
+ }
205
+ export function captureMetaWrite(options) {
206
+ const result = captureJournalValue(options);
207
+ if (Object.hasOwn(result, "expected"))
208
+ assertMetaExpectation(result.expected);
209
+ if (result.requireEmptyJournal !== undefined && typeof result.requireEmptyJournal !== "boolean")
210
+ throw new JournalGuardConflict("meta");
211
+ return result;
212
+ }
213
+ export function assertMetaWrite(key, options, actual, intents) {
214
+ if (options.expected !== undefined && !equalJournalValue(captureJournalValue(options.expected), captureJournalValue(actual)))
215
+ throw new JournalGuardConflict(key);
216
+ if (options.requireEmptyJournal && intents.length !== 0)
217
+ throw new JournalGuardConflict(key);
218
+ }
219
+ /** Metadata removal is admitted only with an explicit full-snapshot premise. */
220
+ export function assertJournalMetaChanges(guard, puts, removals) {
221
+ if (guard) {
222
+ captureJournalValue(puts);
223
+ if (puts.some(row => !guard.meta.some(expected => expected.key === row.key)))
224
+ throw new JournalGuardConflict(guard.target);
225
+ }
226
+ if (removals === undefined)
227
+ return;
228
+ if (!guard || !Array.isArray(removals) || removals.some(key => typeof key !== "string") || new Set(removals).size !== removals.length ||
229
+ removals.some(key => puts.some(row => row.key === key) || !guard.meta.some(expected => expected.key === key)))
230
+ throw new JournalGuardConflict(guard?.target ?? "meta");
231
+ }
232
+ /** A guarded write owns one target and creates a globally fresh journal identity. */
233
+ export function assertJournalIntentChanges(guard, existingIdentity, superseded) {
234
+ if (guard && (existingIdentity !== undefined || (superseded !== undefined && superseded.target !== guard.target)))
235
+ throw new JournalGuardConflict(guard.target);
236
+ }
237
+ /**
238
+ * Capture a retirement before any adapter work: the guard is required and complete, every
239
+ * named intent is in it and acknowledged, and every removed meta row is one the guard names.
240
+ */
241
+ export function captureRetireAcknowledged(target, options) {
242
+ if (!options || typeof options !== "object" || Array.isArray(options))
243
+ throw new JournalGuardConflict(target);
244
+ const guard = captureJournalGuardOption(options, target);
245
+ if (guard === undefined)
246
+ throw new JournalGuardConflict(target);
247
+ const captured = captureJournalValue({ requestIds: options.requestIds, removeMeta: options.removeMeta });
248
+ const ids = captured.requestIds;
249
+ if (!Array.isArray(ids) || ids.length === 0 || ids.some(id => typeof id !== "string") || new Set(ids).size !== ids.length ||
250
+ Object.keys(options).some(key => !["guard", "requestIds", "removeMeta"].includes(key)) ||
251
+ ids.some(id => guard.intents.find(row => row.requestId === id)?.state !== "acknowledged"))
252
+ throw new JournalGuardConflict(target);
253
+ assertJournalMetaChanges(guard, [], captured.removeMeta);
254
+ return { guard, requestIds: ids, ...(captured.removeMeta === undefined ? {} : { removeMeta: captured.removeMeta }) };
255
+ }
256
+ /** Capture write options while retaining the existing synchronous metadata producer. */
257
+ export function captureJournalWriteOptions(options) {
258
+ const descriptors = Object.getOwnPropertyDescriptors(options);
259
+ const data = {};
260
+ let producer;
261
+ for (const key of Reflect.ownKeys(options)) {
262
+ if (typeof key !== "string")
263
+ throw new JournalGuardConflict("options");
264
+ const descriptor = descriptors[key];
265
+ if (!("value" in descriptor) || !descriptor.enumerable)
266
+ throw new JournalGuardConflict("options");
267
+ if (key === "meta" && typeof descriptor.value === "function")
268
+ producer = descriptor.value;
269
+ else
270
+ data[key] = descriptor.value;
271
+ }
272
+ const captured = captureJournalValue(data);
273
+ if (producer)
274
+ captured.meta = producer;
275
+ return captured;
276
+ }
277
+ /** Capture every guarded deletion branch before evaluating held or absent state. */
278
+ export function captureJournalDeleteOptions(target, options) {
279
+ const guard = captureJournalGuardOption(options, target);
280
+ if (guard === undefined)
281
+ return options;
282
+ const captured = captureJournalValue(options);
283
+ captured.guard = guard;
284
+ assertJournalMetaChanges(guard, captured.meta ?? [], captured.removeMeta);
285
+ if (captured.onHeld !== undefined) {
286
+ if (!captured.onHeld || !Array.isArray(captured.onHeld.meta))
287
+ throw new JournalGuardConflict(target);
288
+ assertJournalMetaChanges(guard, captured.onHeld.meta, undefined);
289
+ }
290
+ return captured;
291
+ }
292
+ /**
293
+ * An intent's journal state was not the one the caller expected, or the intent is gone. Settling
294
+ * and superseding are compare-and-swap operations on the intent's own record so two realms (a
295
+ * stale tab, a worker) cannot both settle or both replace one intent.
296
+ */
297
+ export class IntentStateConflict extends Error {
298
+ name = "IntentStateConflict";
299
+ requestId;
300
+ expected;
301
+ actual;
302
+ constructor(requestId, expected, actual) {
303
+ super(actual === null
304
+ ? `intent '${requestId}' does not exist (expected state '${expected}')`
305
+ : `intent '${requestId}' is '${actual}', not '${expected}'`);
306
+ this.requestId = requestId;
307
+ this.expected = expected;
308
+ this.actual = actual;
309
+ }
310
+ }
311
+ /**
312
+ * A journaled write required that no unsettled intent hold its target, and one does. The local
313
+ * edit that intent describes would otherwise be replaced while the authority has not accepted
314
+ * it. The check runs inside the write's own transaction, so an intent committed while the caller
315
+ * was awaiting the network still holds the target.
316
+ */
317
+ export class IntentHoldConflict extends Error {
318
+ name = "IntentHoldConflict";
319
+ target;
320
+ requestId;
321
+ state;
322
+ constructor(target, requestId, state) {
323
+ super(`'${target}' is held by intent '${requestId}' in state '${state}'`);
324
+ this.target = target;
325
+ this.requestId = requestId;
326
+ this.state = state;
327
+ }
328
+ }
329
+ /** Recovery was composed against a different or unsafe unsettled journal snapshot. */
330
+ export class JournalSnapshotConflict extends Error {
331
+ name = "JournalSnapshotConflict";
332
+ target;
333
+ constructor(target) {
334
+ super(`journal snapshot for '${target}' changed or cannot be resolved`);
335
+ this.target = target;
336
+ }
337
+ }
338
+ /**
339
+ * The deletion intent a journaled deletion records, refused before any adapter work when it is
340
+ * not one: another kind, another target, or combined with a guard (a guarded deletion journals
341
+ * nothing). The adapter fills content, local version, sequence and state.
342
+ */
343
+ export function assertDeletionIntent(target, options) {
344
+ if (options.intent === undefined && options.supersede === undefined)
345
+ return;
346
+ if (options.guard !== undefined || (options.intent !== undefined && (options.intent.kind !== DOCUMENT_DELETE_KIND || options.intent.target !== target))) {
347
+ throw new JournalSnapshotConflict(target);
348
+ }
349
+ }
350
+ /** The record a journaled deletion adds for `intent`. */
351
+ export function deletionIntentRecord(intent, sequence, now) {
352
+ return { ...intent, local: DELETION_VERSION, content: DELETION_CONTENT, sequence, attempts: 0, state: "pending", updatedAt: now };
353
+ }
354
+ export function assertJournalResolutionOptions(target, options) {
355
+ if (!options.resolveIntents)
356
+ return;
357
+ if (options.expectedVersion === undefined || options.requireSettled !== undefined ||
358
+ ("intent" in options && options.intent !== undefined && options.intent.target !== target) ||
359
+ ("supersede" in options && options.supersede !== undefined) || ("onHeld" in options && options.onHeld !== undefined)) {
360
+ throw new JournalSnapshotConflict(target);
361
+ }
362
+ }
363
+ /**
364
+ * Compare full records, not only state: a changed outcome or retry is new recovery evidence.
365
+ * The head of the set (its lowest sequence) must hold a recorded terminal answer, `conflict` or
366
+ * `refused`; every later row must be `conflict`, `refused` or never-attempted `pending`. An
367
+ * `unknown`, `in_flight` or attempted `pending` head is uncertain delivery and stays refused.
368
+ */
369
+ export function assertJournalSnapshot(target, expected, current, freshRequestId) {
370
+ const equal = (a, b) => {
371
+ if (Object.is(a, b))
372
+ return true;
373
+ if (!a || !b || typeof a !== "object" || typeof b !== "object" || Array.isArray(a) !== Array.isArray(b))
374
+ return false;
375
+ const keys = Object.keys(a);
376
+ return keys.length === Object.keys(b).length && keys.every(key => Object.prototype.hasOwnProperty.call(b, key) &&
377
+ equal(a[key], b[key]));
378
+ };
379
+ const actual = current.filter(row => row.target === target && row.state !== "acknowledged");
380
+ const ids = new Set(expected.map(row => row.requestId));
381
+ const head = expected.reduce((lowest, row) => lowest === undefined || row.sequence < lowest.sequence ? row : lowest, undefined);
382
+ if ((freshRequestId !== undefined && current.some(row => row.requestId === freshRequestId)) ||
383
+ ids.size !== expected.length || actual.length !== expected.length || head === undefined || !(head.state === "conflict" || head.state === "refused") ||
384
+ expected.some(row => row.target !== target || !(row.state === "conflict" || row.state === "refused" || (row.state === "pending" && row.attempts === 0))) ||
385
+ expected.some(row => !equal(row, actual.find(candidate => candidate.requestId === row.requestId)))) {
386
+ throw new JournalSnapshotConflict(target);
387
+ }
388
+ }
389
+ //# sourceMappingURL=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AI,CAAC,KAAK,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;QACnJ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,UAAU,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC;QACxJ,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,KAAK,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QACvG,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { type KindRegistry } from "./kinds.js";
2
+ import type { OkfDocument } from "./types.js";
3
+ /** All records are grouped by actual type; path prefixes never infer a Kind or hide nested records. */
4
+ export declare function kindCoverage(registry: KindRegistry, documents: readonly OkfDocument[], options: {
5
+ now: Date;
6
+ okfVersion?: string;
7
+ kind?: string;
8
+ }): {
9
+ now: string;
10
+ documents: number;
11
+ undeclared_kinds: string[];
12
+ kinds: {
13
+ governs: string;
14
+ records: number;
15
+ coverage: {
16
+ fields: {
17
+ present: number;
18
+ filled: number;
19
+ sentinel: number;
20
+ empty: number;
21
+ rate: number | null;
22
+ field: string;
23
+ required: boolean;
24
+ }[];
25
+ body_prose: {
26
+ filled: number;
27
+ rate: number | null;
28
+ };
29
+ };
30
+ drift: {
31
+ undeclared: {
32
+ key: string;
33
+ records: number;
34
+ rate: number | null;
35
+ examples: string[];
36
+ examples_total: number;
37
+ }[];
38
+ declared_unused: string[];
39
+ envelope: {
40
+ key: string;
41
+ records: number;
42
+ }[];
43
+ };
44
+ links: {
45
+ with_links: number;
46
+ typed: {
47
+ relation: string;
48
+ target_kind: string | null;
49
+ target_matches: boolean | null;
50
+ records: number;
51
+ links: number;
52
+ rate: number | null;
53
+ }[];
54
+ untyped_citations: number;
55
+ declared_never_used: string[];
56
+ dangling: number;
57
+ dangling_examples: string[];
58
+ no_inbound: number;
59
+ };
60
+ freshness: {
61
+ clock: string;
62
+ horizon: string | null;
63
+ horizon_ms: number | null;
64
+ missing: number;
65
+ invalid: number;
66
+ buckets: {
67
+ future: number;
68
+ "0-7d": number;
69
+ "8-30d": number;
70
+ "31-90d": number;
71
+ "91-180d": number;
72
+ "181-365d": number;
73
+ ">365d": number;
74
+ };
75
+ older_than_horizon: number | null;
76
+ };
77
+ sources: {
78
+ zero: number;
79
+ total: number;
80
+ invalid_entries: number;
81
+ non_url_resources: number;
82
+ per_record: {
83
+ "0": number;
84
+ "1": number;
85
+ "2": number;
86
+ "3": number;
87
+ "4": number;
88
+ "5+": number;
89
+ };
90
+ distinct_domains: number;
91
+ domains_shown: number;
92
+ top_domains: {
93
+ domain: string;
94
+ sources: number;
95
+ }[];
96
+ };
97
+ }[];
98
+ };
99
+ //# sourceMappingURL=kind-coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind-coverage.d.ts","sourceRoot":"","sources":["../src/kind-coverage.ts"],"names":[],"mappings":"AAEA,OAAO,EAA+G,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5J,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA4F9C,uGAAuG;AACvG,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,WAAW,EAAE,EAAE,OAAO,EAAE;IAAE,GAAG,EAAE,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CjJ"}