@superbee/core 0.2.0-pre.6 → 0.2.0-pre.60

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 (820) hide show
  1. package/README.md +1425 -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 +50 -2
  7. package/dist/backend.d.ts.map +1 -1
  8. package/dist/backend.js +311 -33
  9. package/dist/backend.js.map +1 -1
  10. package/dist/blob-contract.d.ts +82 -0
  11. package/dist/blob-contract.d.ts.map +1 -0
  12. package/dist/blob-contract.js +134 -0
  13. package/dist/blob-contract.js.map +1 -0
  14. package/dist/blob-journal.d.ts +303 -0
  15. package/dist/blob-journal.d.ts.map +1 -0
  16. package/dist/blob-journal.js +541 -0
  17. package/dist/blob-journal.js.map +1 -0
  18. package/dist/body-pages.d.ts +20 -0
  19. package/dist/body-pages.d.ts.map +1 -0
  20. package/dist/body-pages.js +56 -0
  21. package/dist/body-pages.js.map +1 -0
  22. package/dist/body-replace-guards.d.ts +81 -0
  23. package/dist/body-replace-guards.d.ts.map +1 -0
  24. package/dist/body-replace-guards.js +271 -0
  25. package/dist/body-replace-guards.js.map +1 -0
  26. package/dist/bounded-yaml.d.ts +28 -0
  27. package/dist/bounded-yaml.d.ts.map +1 -0
  28. package/dist/bounded-yaml.js +182 -0
  29. package/dist/bounded-yaml.js.map +1 -0
  30. package/dist/builtin-recipes/content.d.ts +93 -0
  31. package/dist/builtin-recipes/content.d.ts.map +1 -0
  32. package/dist/builtin-recipes/content.js +288 -0
  33. package/dist/builtin-recipes/content.js.map +1 -0
  34. package/dist/builtin-recipes/site.d.ts +5 -0
  35. package/dist/builtin-recipes/site.d.ts.map +1 -0
  36. package/dist/builtin-recipes/site.js +83 -0
  37. package/dist/builtin-recipes/site.js.map +1 -0
  38. package/dist/builtin-recipes.d.ts +13 -0
  39. package/dist/builtin-recipes.d.ts.map +1 -0
  40. package/dist/builtin-recipes.js +123 -0
  41. package/dist/builtin-recipes.js.map +1 -0
  42. package/dist/bundle-health/index.d.ts +14 -0
  43. package/dist/bundle-health/index.d.ts.map +1 -0
  44. package/dist/bundle-health/index.js +12 -0
  45. package/dist/bundle-health/index.js.map +1 -0
  46. package/dist/bundle-health/kind-findings.d.ts +45 -0
  47. package/dist/bundle-health/kind-findings.d.ts.map +1 -0
  48. package/dist/bundle-health/kind-findings.js +67 -0
  49. package/dist/bundle-health/kind-findings.js.map +1 -0
  50. package/dist/bundle-health/legacy-page.d.ts +21 -0
  51. package/dist/bundle-health/legacy-page.d.ts.map +1 -0
  52. package/dist/bundle-health/legacy-page.js +25 -0
  53. package/dist/bundle-health/legacy-page.js.map +1 -0
  54. package/dist/bundle-health/report.d.ts +191 -0
  55. package/dist/bundle-health/report.d.ts.map +1 -0
  56. package/dist/bundle-health/report.js +419 -0
  57. package/dist/bundle-health/report.js.map +1 -0
  58. package/dist/bundle-ops.d.ts +11 -5
  59. package/dist/bundle-ops.d.ts.map +1 -1
  60. package/dist/bundle-ops.js +17 -10
  61. package/dist/bundle-ops.js.map +1 -1
  62. package/dist/bundle.d.ts +2 -4
  63. package/dist/bundle.d.ts.map +1 -1
  64. package/dist/bundle.js +3 -12
  65. package/dist/bundle.js.map +1 -1
  66. package/dist/code-point-order.d.ts +8 -0
  67. package/dist/code-point-order.d.ts.map +1 -0
  68. package/dist/code-point-order.js +20 -0
  69. package/dist/code-point-order.js.map +1 -0
  70. package/dist/code-unit-order.d.ts +15 -0
  71. package/dist/code-unit-order.d.ts.map +1 -0
  72. package/dist/code-unit-order.js +17 -0
  73. package/dist/code-unit-order.js.map +1 -0
  74. package/dist/connector-request.d.ts +112 -0
  75. package/dist/connector-request.d.ts.map +1 -0
  76. package/dist/connector-request.js +495 -0
  77. package/dist/connector-request.js.map +1 -0
  78. package/dist/connectors.d.ts +297 -0
  79. package/dist/connectors.d.ts.map +1 -0
  80. package/dist/connectors.js +1233 -0
  81. package/dist/connectors.js.map +1 -0
  82. package/dist/convention-record.d.ts +9 -0
  83. package/dist/convention-record.d.ts.map +1 -0
  84. package/dist/convention-record.js +13 -0
  85. package/dist/convention-record.js.map +1 -0
  86. package/dist/cross-bundle.d.ts +135 -0
  87. package/dist/cross-bundle.d.ts.map +1 -0
  88. package/dist/cross-bundle.js +191 -0
  89. package/dist/cross-bundle.js.map +1 -0
  90. package/dist/dependencies.d.ts +208 -0
  91. package/dist/dependencies.d.ts.map +1 -0
  92. package/dist/dependencies.js +367 -0
  93. package/dist/dependencies.js.map +1 -0
  94. package/dist/document-codec.d.ts +4 -1
  95. package/dist/document-codec.d.ts.map +1 -1
  96. package/dist/document-codec.js +3 -1
  97. package/dist/document-codec.js.map +1 -1
  98. package/dist/document-field-actions.d.ts +34 -3
  99. package/dist/document-field-actions.d.ts.map +1 -1
  100. package/dist/document-field-actions.js +149 -43
  101. package/dist/document-field-actions.js.map +1 -1
  102. package/dist/document-mutation.d.ts +55 -18
  103. package/dist/document-mutation.d.ts.map +1 -1
  104. package/dist/document-mutation.js +210 -86
  105. package/dist/document-mutation.js.map +1 -1
  106. package/dist/document-persistence.d.ts +12 -0
  107. package/dist/document-persistence.d.ts.map +1 -0
  108. package/dist/document-persistence.js +44 -0
  109. package/dist/document-persistence.js.map +1 -0
  110. package/dist/document-replace-rules.d.ts +44 -0
  111. package/dist/document-replace-rules.d.ts.map +1 -0
  112. package/dist/document-replace-rules.js +41 -0
  113. package/dist/document-replace-rules.js.map +1 -0
  114. package/dist/document-scan.d.ts +26 -0
  115. package/dist/document-scan.d.ts.map +1 -0
  116. package/dist/document-scan.js +70 -0
  117. package/dist/document-scan.js.map +1 -0
  118. package/dist/document-transfer.d.ts +312 -0
  119. package/dist/document-transfer.d.ts.map +1 -0
  120. package/dist/document-transfer.js +1400 -0
  121. package/dist/document-transfer.js.map +1 -0
  122. package/dist/document-write-policy.d.ts +15 -4
  123. package/dist/document-write-policy.d.ts.map +1 -1
  124. package/dist/document-write-policy.js +41 -27
  125. package/dist/document-write-policy.js.map +1 -1
  126. package/dist/domain-model.d.ts +73 -0
  127. package/dist/domain-model.d.ts.map +1 -0
  128. package/dist/domain-model.js +169 -0
  129. package/dist/domain-model.js.map +1 -0
  130. package/dist/edge-harness/corpus.d.ts +9 -0
  131. package/dist/edge-harness/corpus.d.ts.map +1 -0
  132. package/dist/edge-harness/corpus.js +57 -0
  133. package/dist/edge-harness/corpus.js.map +1 -0
  134. package/dist/edge-harness/index.d.ts +21 -0
  135. package/dist/edge-harness/index.d.ts.map +1 -0
  136. package/dist/edge-harness/index.js +537 -0
  137. package/dist/edge-harness/index.js.map +1 -0
  138. package/dist/edges/find.d.ts +14 -0
  139. package/dist/edges/find.d.ts.map +1 -0
  140. package/dist/edges/find.js +46 -0
  141. package/dist/edges/find.js.map +1 -0
  142. package/dist/edges/index.d.ts +13 -0
  143. package/dist/edges/index.d.ts.map +1 -0
  144. package/dist/edges/index.js +5 -0
  145. package/dist/edges/index.js.map +1 -0
  146. package/dist/edges/memory-source.d.ts +8 -0
  147. package/dist/edges/memory-source.d.ts.map +1 -0
  148. package/dist/edges/memory-source.js +164 -0
  149. package/dist/edges/memory-source.js.map +1 -0
  150. package/dist/edges/read-bounds.d.ts +6 -0
  151. package/dist/edges/read-bounds.d.ts.map +1 -0
  152. package/dist/edges/read-bounds.js +13 -0
  153. package/dist/edges/read-bounds.js.map +1 -0
  154. package/dist/edges/source.d.ts +123 -0
  155. package/dist/edges/source.d.ts.map +1 -0
  156. package/dist/edges/source.js +2 -0
  157. package/dist/edges/source.js.map +1 -0
  158. package/dist/edges/walk.d.ts +7 -0
  159. package/dist/edges/walk.d.ts.map +1 -0
  160. package/dist/edges/walk.js +14 -0
  161. package/dist/edges/walk.js.map +1 -0
  162. package/dist/engine.d.ts +55 -19
  163. package/dist/engine.d.ts.map +1 -1
  164. package/dist/engine.js +141 -111
  165. package/dist/engine.js.map +1 -1
  166. package/dist/errors.d.ts +37 -1
  167. package/dist/errors.d.ts.map +1 -1
  168. package/dist/errors.js +75 -3
  169. package/dist/errors.js.map +1 -1
  170. package/dist/file-journaled-backend-internal.d.ts +21 -0
  171. package/dist/file-journaled-backend-internal.d.ts.map +1 -0
  172. package/dist/file-journaled-backend-internal.js +12 -0
  173. package/dist/file-journaled-backend-internal.js.map +1 -0
  174. package/dist/file-journaled-backend.d.ts +160 -0
  175. package/dist/file-journaled-backend.d.ts.map +1 -0
  176. package/dist/file-journaled-backend.js +1345 -0
  177. package/dist/file-journaled-backend.js.map +1 -0
  178. package/dist/filesystem-identity.d.ts +116 -17
  179. package/dist/filesystem-identity.d.ts.map +1 -1
  180. package/dist/filesystem-identity.js +532 -51
  181. package/dist/filesystem-identity.js.map +1 -1
  182. package/dist/filesystem-lock.d.ts +19 -2
  183. package/dist/filesystem-lock.d.ts.map +1 -1
  184. package/dist/filesystem-lock.js +259 -17
  185. package/dist/filesystem-lock.js.map +1 -1
  186. package/dist/filesystem-push-role.d.ts +77 -0
  187. package/dist/filesystem-push-role.d.ts.map +1 -0
  188. package/dist/filesystem-push-role.js +165 -0
  189. package/dist/filesystem-push-role.js.map +1 -0
  190. package/dist/filesystem-temp-name.d.ts +9 -0
  191. package/dist/filesystem-temp-name.d.ts.map +1 -0
  192. package/dist/filesystem-temp-name.js +20 -0
  193. package/dist/filesystem-temp-name.js.map +1 -0
  194. package/dist/filesystem.d.ts +6 -0
  195. package/dist/filesystem.d.ts.map +1 -1
  196. package/dist/filesystem.js +2 -1
  197. package/dist/filesystem.js.map +1 -1
  198. package/dist/freshness.d.ts +16 -1
  199. package/dist/freshness.d.ts.map +1 -1
  200. package/dist/freshness.js +47 -17
  201. package/dist/freshness.js.map +1 -1
  202. package/dist/frontmatter-contract.d.ts +14 -0
  203. package/dist/frontmatter-contract.d.ts.map +1 -1
  204. package/dist/frontmatter-contract.js +22 -0
  205. package/dist/frontmatter-contract.js.map +1 -1
  206. package/dist/frontmatter-splitter.d.ts +6 -0
  207. package/dist/frontmatter-splitter.d.ts.map +1 -1
  208. package/dist/frontmatter-splitter.js +8 -0
  209. package/dist/frontmatter-splitter.js.map +1 -1
  210. package/dist/frontmatter.d.ts +17 -7
  211. package/dist/frontmatter.d.ts.map +1 -1
  212. package/dist/frontmatter.js +52 -11
  213. package/dist/frontmatter.js.map +1 -1
  214. package/dist/governed-body-write.d.ts +8 -1
  215. package/dist/governed-body-write.d.ts.map +1 -1
  216. package/dist/governed-body-write.js +22 -8
  217. package/dist/governed-body-write.js.map +1 -1
  218. package/dist/heads-digest.d.ts.map +1 -1
  219. package/dist/heads-digest.js +2 -1
  220. package/dist/heads-digest.js.map +1 -1
  221. package/dist/host-text.d.ts +31 -0
  222. package/dist/host-text.d.ts.map +1 -0
  223. package/dist/host-text.js +77 -0
  224. package/dist/host-text.js.map +1 -0
  225. package/dist/hosted-client/binding.d.ts +7 -0
  226. package/dist/hosted-client/binding.d.ts.map +1 -0
  227. package/dist/hosted-client/binding.js +10 -0
  228. package/dist/hosted-client/binding.js.map +1 -0
  229. package/dist/hosted-client/blob-delivery.d.ts +68 -0
  230. package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
  231. package/dist/hosted-client/blob-delivery.js +170 -0
  232. package/dist/hosted-client/blob-delivery.js.map +1 -0
  233. package/dist/hosted-client/blob-write.d.ts +387 -0
  234. package/dist/hosted-client/blob-write.d.ts.map +1 -0
  235. package/dist/hosted-client/blob-write.js +770 -0
  236. package/dist/hosted-client/blob-write.js.map +1 -0
  237. package/dist/hosted-client/bundle-listing.d.ts +46 -0
  238. package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
  239. package/dist/hosted-client/bundle-listing.js +36 -0
  240. package/dist/hosted-client/bundle-listing.js.map +1 -0
  241. package/dist/hosted-client/client.d.ts +249 -0
  242. package/dist/hosted-client/client.d.ts.map +1 -0
  243. package/dist/hosted-client/client.js +381 -0
  244. package/dist/hosted-client/client.js.map +1 -0
  245. package/dist/hosted-client/directory.d.ts +46 -0
  246. package/dist/hosted-client/directory.d.ts.map +1 -0
  247. package/dist/hosted-client/directory.js +74 -0
  248. package/dist/hosted-client/directory.js.map +1 -0
  249. package/dist/hosted-client/errors.d.ts +26 -0
  250. package/dist/hosted-client/errors.d.ts.map +1 -0
  251. package/dist/hosted-client/errors.js +35 -0
  252. package/dist/hosted-client/errors.js.map +1 -0
  253. package/dist/hosted-client/inbox.d.ts +320 -0
  254. package/dist/hosted-client/inbox.d.ts.map +1 -0
  255. package/dist/hosted-client/inbox.js +379 -0
  256. package/dist/hosted-client/inbox.js.map +1 -0
  257. package/dist/hosted-client/index.d.ts +31 -0
  258. package/dist/hosted-client/index.d.ts.map +1 -0
  259. package/dist/hosted-client/index.js +33 -0
  260. package/dist/hosted-client/index.js.map +1 -0
  261. package/dist/hosted-client/journal.d.ts +103 -0
  262. package/dist/hosted-client/journal.d.ts.map +1 -0
  263. package/dist/hosted-client/journal.js +464 -0
  264. package/dist/hosted-client/journal.js.map +1 -0
  265. package/dist/hosted-client/node.d.ts +74 -0
  266. package/dist/hosted-client/node.d.ts.map +1 -0
  267. package/dist/hosted-client/node.js +219 -0
  268. package/dist/hosted-client/node.js.map +1 -0
  269. package/dist/hosted-client/reference.d.ts +12 -0
  270. package/dist/hosted-client/reference.d.ts.map +1 -0
  271. package/dist/hosted-client/reference.js +29 -0
  272. package/dist/hosted-client/reference.js.map +1 -0
  273. package/dist/hosted-client/view-content.d.ts +184 -0
  274. package/dist/hosted-client/view-content.d.ts.map +1 -0
  275. package/dist/hosted-client/view-content.js +268 -0
  276. package/dist/hosted-client/view-content.js.map +1 -0
  277. package/dist/hosted-client/write.d.ts +219 -0
  278. package/dist/hosted-client/write.d.ts.map +1 -0
  279. package/dist/hosted-client/write.js +419 -0
  280. package/dist/hosted-client/write.js.map +1 -0
  281. package/dist/hosted-transport/answer-rows.d.ts +344 -0
  282. package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
  283. package/dist/hosted-transport/answer-rows.js +596 -0
  284. package/dist/hosted-transport/answer-rows.js.map +1 -0
  285. package/dist/hosted-transport/attribution.d.ts +32 -0
  286. package/dist/hosted-transport/attribution.d.ts.map +1 -0
  287. package/dist/hosted-transport/attribution.js +38 -0
  288. package/dist/hosted-transport/attribution.js.map +1 -0
  289. package/dist/hosted-transport/blob-reads.d.ts +35 -0
  290. package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
  291. package/dist/hosted-transport/blob-reads.js +179 -0
  292. package/dist/hosted-transport/blob-reads.js.map +1 -0
  293. package/dist/hosted-transport/blob-write.d.ts +34 -0
  294. package/dist/hosted-transport/blob-write.d.ts.map +1 -0
  295. package/dist/hosted-transport/blob-write.js +115 -0
  296. package/dist/hosted-transport/blob-write.js.map +1 -0
  297. package/dist/hosted-transport/carrier.d.ts +166 -0
  298. package/dist/hosted-transport/carrier.d.ts.map +1 -0
  299. package/dist/hosted-transport/carrier.js +285 -0
  300. package/dist/hosted-transport/carrier.js.map +1 -0
  301. package/dist/hosted-transport/document-backend.d.ts +74 -0
  302. package/dist/hosted-transport/document-backend.d.ts.map +1 -0
  303. package/dist/hosted-transport/document-backend.js +160 -0
  304. package/dist/hosted-transport/document-backend.js.map +1 -0
  305. package/dist/hosted-transport/history-pages.d.ts +55 -0
  306. package/dist/hosted-transport/history-pages.d.ts.map +1 -0
  307. package/dist/hosted-transport/history-pages.js +69 -0
  308. package/dist/hosted-transport/history-pages.js.map +1 -0
  309. package/dist/hosted-transport/index.d.ts +21 -0
  310. package/dist/hosted-transport/index.d.ts.map +1 -0
  311. package/dist/hosted-transport/index.js +21 -0
  312. package/dist/hosted-transport/index.js.map +1 -0
  313. package/dist/hosted-transport/operations.d.ts +91 -0
  314. package/dist/hosted-transport/operations.d.ts.map +1 -0
  315. package/dist/hosted-transport/operations.js +129 -0
  316. package/dist/hosted-transport/operations.js.map +1 -0
  317. package/dist/hosted-transport/paged-reads.d.ts +87 -0
  318. package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
  319. package/dist/hosted-transport/paged-reads.js +238 -0
  320. package/dist/hosted-transport/paged-reads.js.map +1 -0
  321. package/dist/hosted-transport/port-run.d.ts +41 -0
  322. package/dist/hosted-transport/port-run.d.ts.map +1 -0
  323. package/dist/hosted-transport/port-run.js +92 -0
  324. package/dist/hosted-transport/port-run.js.map +1 -0
  325. package/dist/hosted-transport/read-adapter.d.ts +266 -0
  326. package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
  327. package/dist/hosted-transport/read-adapter.js +570 -0
  328. package/dist/hosted-transport/read-adapter.js.map +1 -0
  329. package/dist/hosted-transport/root-write.d.ts +114 -0
  330. package/dist/hosted-transport/root-write.d.ts.map +1 -0
  331. package/dist/hosted-transport/root-write.js +174 -0
  332. package/dist/hosted-transport/root-write.js.map +1 -0
  333. package/dist/hosted-transport/whole-document-transport.d.ts +223 -0
  334. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
  335. package/dist/hosted-transport/whole-document-transport.js +500 -0
  336. package/dist/hosted-transport/whole-document-transport.js.map +1 -0
  337. package/dist/identity-fold.d.ts +16 -0
  338. package/dist/identity-fold.d.ts.map +1 -0
  339. package/dist/identity-fold.js +24 -0
  340. package/dist/identity-fold.js.map +1 -0
  341. package/dist/index-projection.d.ts +2 -1
  342. package/dist/index-projection.d.ts.map +1 -1
  343. package/dist/index-projection.js +38 -28
  344. package/dist/index-projection.js.map +1 -1
  345. package/dist/index.d.ts +65 -20
  346. package/dist/index.d.ts.map +1 -1
  347. package/dist/index.js +54 -22
  348. package/dist/index.js.map +1 -1
  349. package/dist/indexeddb-backend.d.ts +6 -32
  350. package/dist/indexeddb-backend.d.ts.map +1 -1
  351. package/dist/indexeddb-backend.js +82 -8
  352. package/dist/indexeddb-backend.js.map +1 -1
  353. package/dist/inventory-guard.d.ts +58 -0
  354. package/dist/inventory-guard.d.ts.map +1 -0
  355. package/dist/inventory-guard.js +169 -0
  356. package/dist/inventory-guard.js.map +1 -0
  357. package/dist/journaled-backend.d.ts +86 -8
  358. package/dist/journaled-backend.d.ts.map +1 -1
  359. package/dist/journaled-backend.js +64 -69
  360. package/dist/journaled-backend.js.map +1 -1
  361. package/dist/json-data.d.ts +3 -0
  362. package/dist/json-data.d.ts.map +1 -0
  363. package/dist/json-data.js +19 -0
  364. package/dist/json-data.js.map +1 -0
  365. package/dist/kind-authoring.d.ts +200 -0
  366. package/dist/kind-authoring.d.ts.map +1 -0
  367. package/dist/kind-authoring.js +539 -0
  368. package/dist/kind-authoring.js.map +1 -0
  369. package/dist/kind-changes.d.ts +45 -0
  370. package/dist/kind-changes.d.ts.map +1 -0
  371. package/dist/kind-changes.js +96 -0
  372. package/dist/kind-changes.js.map +1 -0
  373. package/dist/kind-conformance-error.d.ts +16 -0
  374. package/dist/kind-conformance-error.d.ts.map +1 -0
  375. package/dist/kind-conformance-error.js +20 -0
  376. package/dist/kind-conformance-error.js.map +1 -0
  377. package/dist/kind-coverage.d.ts +100 -0
  378. package/dist/kind-coverage.d.ts.map +1 -0
  379. package/dist/kind-coverage.js +185 -0
  380. package/dist/kind-coverage.js.map +1 -0
  381. package/dist/kind-deprecation.d.ts +32 -0
  382. package/dist/kind-deprecation.d.ts.map +1 -0
  383. package/dist/kind-deprecation.js +141 -0
  384. package/dist/kind-deprecation.js.map +1 -0
  385. package/dist/kind-field-mutation.d.ts +7 -2
  386. package/dist/kind-field-mutation.d.ts.map +1 -1
  387. package/dist/kind-field-mutation.js +28 -3
  388. package/dist/kind-field-mutation.js.map +1 -1
  389. package/dist/kind-undeclared-fields.d.ts +72 -0
  390. package/dist/kind-undeclared-fields.d.ts.map +1 -0
  391. package/dist/kind-undeclared-fields.js +124 -0
  392. package/dist/kind-undeclared-fields.js.map +1 -0
  393. package/dist/kinds-load.d.ts.map +1 -1
  394. package/dist/kinds-load.js +8 -5
  395. package/dist/kinds-load.js.map +1 -1
  396. package/dist/kinds.d.ts +117 -6
  397. package/dist/kinds.d.ts.map +1 -1
  398. package/dist/kinds.js +416 -29
  399. package/dist/kinds.js.map +1 -1
  400. package/dist/link-add.d.ts +81 -0
  401. package/dist/link-add.d.ts.map +1 -0
  402. package/dist/link-add.js +94 -0
  403. package/dist/link-add.js.map +1 -0
  404. package/dist/link-emit.d.ts +29 -0
  405. package/dist/link-emit.d.ts.map +1 -0
  406. package/dist/link-emit.js +39 -0
  407. package/dist/link-emit.js.map +1 -0
  408. package/dist/link-findings.d.ts +132 -0
  409. package/dist/link-findings.d.ts.map +1 -0
  410. package/dist/link-findings.js +263 -0
  411. package/dist/link-findings.js.map +1 -0
  412. package/dist/link-types.d.ts +34 -0
  413. package/dist/link-types.d.ts.map +1 -0
  414. package/dist/link-types.js +79 -0
  415. package/dist/link-types.js.map +1 -0
  416. package/dist/links.d.ts +68 -9
  417. package/dist/links.d.ts.map +1 -1
  418. package/dist/links.js +373 -65
  419. package/dist/links.js.map +1 -1
  420. package/dist/local-search-index.d.ts +86 -0
  421. package/dist/local-search-index.d.ts.map +1 -0
  422. package/dist/local-search-index.js +1055 -0
  423. package/dist/local-search-index.js.map +1 -0
  424. package/dist/managed-document-metadata.d.ts +5 -0
  425. package/dist/managed-document-metadata.d.ts.map +1 -0
  426. package/dist/managed-document-metadata.js +10 -0
  427. package/dist/managed-document-metadata.js.map +1 -0
  428. package/dist/markdown-syntax.d.ts +39 -0
  429. package/dist/markdown-syntax.d.ts.map +1 -0
  430. package/dist/markdown-syntax.js +10170 -0
  431. package/dist/markdown-syntax.js.map +1 -0
  432. package/dist/memory-backend.d.ts +3 -0
  433. package/dist/memory-backend.d.ts.map +1 -1
  434. package/dist/memory-backend.js +40 -2
  435. package/dist/memory-backend.js.map +1 -1
  436. package/dist/mutation-attribution.d.ts +2 -1
  437. package/dist/mutation-attribution.d.ts.map +1 -1
  438. package/dist/mutation-attribution.js.map +1 -1
  439. package/dist/okf-actor.d.ts +14 -3
  440. package/dist/okf-actor.d.ts.map +1 -1
  441. package/dist/okf-actor.js +25 -4
  442. package/dist/okf-actor.js.map +1 -1
  443. package/dist/okf-authored-values.d.ts +2 -0
  444. package/dist/okf-authored-values.d.ts.map +1 -1
  445. package/dist/okf-authored-values.js +4 -0
  446. package/dist/okf-authored-values.js.map +1 -1
  447. package/dist/okf-authoring.d.ts +7 -0
  448. package/dist/okf-authoring.d.ts.map +1 -0
  449. package/dist/okf-authoring.js +30 -0
  450. package/dist/okf-authoring.js.map +1 -0
  451. package/dist/okf-standard-fields.d.ts +4 -0
  452. package/dist/okf-standard-fields.d.ts.map +1 -1
  453. package/dist/okf-standard-fields.js +24 -14
  454. package/dist/okf-standard-fields.js.map +1 -1
  455. package/dist/okf-timestamps.d.ts +2 -2
  456. package/dist/okf-timestamps.d.ts.map +1 -1
  457. package/dist/okf-timestamps.js +25 -15
  458. package/dist/okf-timestamps.js.map +1 -1
  459. package/dist/page.d.ts +3 -7
  460. package/dist/page.d.ts.map +1 -1
  461. package/dist/page.js +3 -7
  462. package/dist/page.js.map +1 -1
  463. package/dist/path-fold.d.ts +67 -0
  464. package/dist/path-fold.d.ts.map +1 -0
  465. package/dist/path-fold.js +107 -0
  466. package/dist/path-fold.js.map +1 -0
  467. package/dist/paths.d.ts +46 -0
  468. package/dist/paths.d.ts.map +1 -1
  469. package/dist/paths.js +114 -1
  470. package/dist/paths.js.map +1 -1
  471. package/dist/platform.d.ts +22 -2
  472. package/dist/platform.d.ts.map +1 -1
  473. package/dist/platform.js +16 -0
  474. package/dist/platform.js.map +1 -1
  475. package/dist/portable-export-contract.d.ts +17 -0
  476. package/dist/portable-export-contract.d.ts.map +1 -0
  477. package/dist/portable-export-contract.js +59 -0
  478. package/dist/portable-export-contract.js.map +1 -0
  479. package/dist/portable-export.d.ts +111 -0
  480. package/dist/portable-export.d.ts.map +1 -0
  481. package/dist/portable-export.js +448 -0
  482. package/dist/portable-export.js.map +1 -0
  483. package/dist/portable-frontmatter.d.ts +17 -0
  484. package/dist/portable-frontmatter.d.ts.map +1 -1
  485. package/dist/portable-frontmatter.js +42 -5
  486. package/dist/portable-frontmatter.js.map +1 -1
  487. package/dist/publication-filesystem.d.ts +1 -1
  488. package/dist/publication-filesystem.d.ts.map +1 -1
  489. package/dist/publication-filesystem.js +1 -1
  490. package/dist/publication-filesystem.js.map +1 -1
  491. package/dist/qualified-links.d.ts +67 -0
  492. package/dist/qualified-links.d.ts.map +1 -0
  493. package/dist/qualified-links.js +121 -0
  494. package/dist/qualified-links.js.map +1 -0
  495. package/dist/query-filter.d.ts +16 -4
  496. package/dist/query-filter.d.ts.map +1 -1
  497. package/dist/query-filter.js +44 -2
  498. package/dist/query-filter.js.map +1 -1
  499. package/dist/query-order.d.ts +22 -0
  500. package/dist/query-order.d.ts.map +1 -0
  501. package/dist/query-order.js +43 -0
  502. package/dist/query-order.js.map +1 -0
  503. package/dist/recipe-lifecycle/errors.d.ts +96 -0
  504. package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
  505. package/dist/recipe-lifecycle/errors.js +122 -0
  506. package/dist/recipe-lifecycle/errors.js.map +1 -0
  507. package/dist/recipe-lifecycle/evolution.d.ts +134 -0
  508. package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
  509. package/dist/recipe-lifecycle/evolution.js +1047 -0
  510. package/dist/recipe-lifecycle/evolution.js.map +1 -0
  511. package/dist/recipe-lifecycle/index.d.ts +38 -0
  512. package/dist/recipe-lifecycle/index.d.ts.map +1 -0
  513. package/dist/recipe-lifecycle/index.js +31 -0
  514. package/dist/recipe-lifecycle/index.js.map +1 -0
  515. package/dist/recipe-lifecycle/install.d.ts +172 -0
  516. package/dist/recipe-lifecycle/install.d.ts.map +1 -0
  517. package/dist/recipe-lifecycle/install.js +652 -0
  518. package/dist/recipe-lifecycle/install.js.map +1 -0
  519. package/dist/recipe-lifecycle/legacy-aliases.d.ts +4 -0
  520. package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
  521. package/dist/recipe-lifecycle/legacy-aliases.js +22 -0
  522. package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
  523. package/dist/recipe-lifecycle/retirement-apply.d.ts +59 -0
  524. package/dist/recipe-lifecycle/retirement-apply.d.ts.map +1 -0
  525. package/dist/recipe-lifecycle/retirement-apply.js +165 -0
  526. package/dist/recipe-lifecycle/retirement-apply.js.map +1 -0
  527. package/dist/recipe-lifecycle/retirement.d.ts +89 -0
  528. package/dist/recipe-lifecycle/retirement.d.ts.map +1 -0
  529. package/dist/recipe-lifecycle/retirement.js +347 -0
  530. package/dist/recipe-lifecycle/retirement.js.map +1 -0
  531. package/dist/recipe-lifecycle/set-commit.d.ts +31 -0
  532. package/dist/recipe-lifecycle/set-commit.d.ts.map +1 -0
  533. package/dist/recipe-lifecycle/set-commit.js +37 -0
  534. package/dist/recipe-lifecycle/set-commit.js.map +1 -0
  535. package/dist/recipe-lifecycle/stamp.d.ts +146 -0
  536. package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
  537. package/dist/recipe-lifecycle/stamp.js +361 -0
  538. package/dist/recipe-lifecycle/stamp.js.map +1 -0
  539. package/dist/recipe-qualify.d.ts +80 -0
  540. package/dist/recipe-qualify.d.ts.map +1 -0
  541. package/dist/recipe-qualify.js +352 -0
  542. package/dist/recipe-qualify.js.map +1 -0
  543. package/dist/recipe-set-preflight.d.ts +139 -0
  544. package/dist/recipe-set-preflight.d.ts.map +1 -0
  545. package/dist/recipe-set-preflight.js +536 -0
  546. package/dist/recipe-set-preflight.js.map +1 -0
  547. package/dist/recipe-sources.d.ts +209 -0
  548. package/dist/recipe-sources.d.ts.map +1 -0
  549. package/dist/recipe-sources.js +607 -0
  550. package/dist/recipe-sources.js.map +1 -0
  551. package/dist/recipes.d.ts +45 -1
  552. package/dist/recipes.d.ts.map +1 -1
  553. package/dist/recipes.js +138 -1
  554. package/dist/recipes.js.map +1 -1
  555. package/dist/record-overlay/apply.d.ts +43 -0
  556. package/dist/record-overlay/apply.d.ts.map +1 -0
  557. package/dist/record-overlay/apply.js +523 -0
  558. package/dist/record-overlay/apply.js.map +1 -0
  559. package/dist/record-overlay/canonical.d.ts +22 -0
  560. package/dist/record-overlay/canonical.d.ts.map +1 -0
  561. package/dist/record-overlay/canonical.js +47 -0
  562. package/dist/record-overlay/canonical.js.map +1 -0
  563. package/dist/record-overlay/digest.d.ts +4 -0
  564. package/dist/record-overlay/digest.d.ts.map +1 -0
  565. package/dist/record-overlay/digest.js +11 -0
  566. package/dist/record-overlay/digest.js.map +1 -0
  567. package/dist/record-overlay/errors.d.ts +44 -0
  568. package/dist/record-overlay/errors.d.ts.map +1 -0
  569. package/dist/record-overlay/errors.js +55 -0
  570. package/dist/record-overlay/errors.js.map +1 -0
  571. package/dist/record-overlay/findings.d.ts +5 -0
  572. package/dist/record-overlay/findings.d.ts.map +1 -0
  573. package/dist/record-overlay/findings.js +86 -0
  574. package/dist/record-overlay/findings.js.map +1 -0
  575. package/dist/record-overlay/index.d.ts +23 -0
  576. package/dist/record-overlay/index.d.ts.map +1 -0
  577. package/dist/record-overlay/index.js +21 -0
  578. package/dist/record-overlay/index.js.map +1 -0
  579. package/dist/record-overlay/plan.d.ts +12 -0
  580. package/dist/record-overlay/plan.d.ts.map +1 -0
  581. package/dist/record-overlay/plan.js +285 -0
  582. package/dist/record-overlay/plan.js.map +1 -0
  583. package/dist/record-overlay/policy.d.ts +74 -0
  584. package/dist/record-overlay/policy.d.ts.map +1 -0
  585. package/dist/record-overlay/policy.js +235 -0
  586. package/dist/record-overlay/policy.js.map +1 -0
  587. package/dist/record-overlay/redact.d.ts +3 -0
  588. package/dist/record-overlay/redact.d.ts.map +1 -0
  589. package/dist/record-overlay/redact.js +27 -0
  590. package/dist/record-overlay/redact.js.map +1 -0
  591. package/dist/record-overlay/signal-kind.d.ts +30 -0
  592. package/dist/record-overlay/signal-kind.d.ts.map +1 -0
  593. package/dist/record-overlay/signal-kind.js +38 -0
  594. package/dist/record-overlay/signal-kind.js.map +1 -0
  595. package/dist/record-overlay/signal-text.d.ts +52 -0
  596. package/dist/record-overlay/signal-text.d.ts.map +1 -0
  597. package/dist/record-overlay/signal-text.js +126 -0
  598. package/dist/record-overlay/signal-text.js.map +1 -0
  599. package/dist/record-overlay/source-index.d.ts +19 -0
  600. package/dist/record-overlay/source-index.d.ts.map +1 -0
  601. package/dist/record-overlay/source-index.js +102 -0
  602. package/dist/record-overlay/source-index.js.map +1 -0
  603. package/dist/record-overlay/types.d.ts +291 -0
  604. package/dist/record-overlay/types.d.ts.map +1 -0
  605. package/dist/record-overlay/types.js +2 -0
  606. package/dist/record-overlay/types.js.map +1 -0
  607. package/dist/relationships.d.ts +71 -0
  608. package/dist/relationships.d.ts.map +1 -0
  609. package/dist/relationships.js +87 -0
  610. package/dist/relationships.js.map +1 -0
  611. package/dist/remote-backend.d.ts +67 -32
  612. package/dist/remote-backend.d.ts.map +1 -1
  613. package/dist/remote-backend.js +171 -39
  614. package/dist/remote-backend.js.map +1 -1
  615. package/dist/remote-document-codec.d.ts +2 -1
  616. package/dist/remote-document-codec.d.ts.map +1 -1
  617. package/dist/remote-document-codec.js +3 -2
  618. package/dist/remote-document-codec.js.map +1 -1
  619. package/dist/remote-error.d.ts +17 -1
  620. package/dist/remote-error.d.ts.map +1 -1
  621. package/dist/remote-error.js +32 -2
  622. package/dist/remote-error.js.map +1 -1
  623. package/dist/remote-operations.d.ts +0 -40
  624. package/dist/remote-operations.d.ts.map +1 -1
  625. package/dist/remote-operations.js +28 -6
  626. package/dist/remote-operations.js.map +1 -1
  627. package/dist/remote-parsers.d.ts +20 -1
  628. package/dist/remote-parsers.d.ts.map +1 -1
  629. package/dist/remote-parsers.js +1 -1
  630. package/dist/remote-parsers.js.map +1 -1
  631. package/dist/remote.d.ts +2 -4
  632. package/dist/remote.d.ts.map +1 -1
  633. package/dist/remote.js +2 -3
  634. package/dist/remote.js.map +1 -1
  635. package/dist/reserved-write.d.ts +9 -0
  636. package/dist/reserved-write.d.ts.map +1 -0
  637. package/dist/reserved-write.js +15 -0
  638. package/dist/reserved-write.js.map +1 -0
  639. package/dist/search/backend-source.d.ts +6 -0
  640. package/dist/search/backend-source.d.ts.map +1 -0
  641. package/dist/search/backend-source.js +57 -0
  642. package/dist/search/backend-source.js.map +1 -0
  643. package/dist/search/contract.d.ts +162 -0
  644. package/dist/search/contract.d.ts.map +1 -0
  645. package/dist/search/contract.js +82 -0
  646. package/dist/search/contract.js.map +1 -0
  647. package/dist/search/errors.d.ts +30 -0
  648. package/dist/search/errors.d.ts.map +1 -0
  649. package/dist/search/errors.js +50 -0
  650. package/dist/search/errors.js.map +1 -0
  651. package/dist/search/identity.d.ts +12 -0
  652. package/dist/search/identity.d.ts.map +1 -0
  653. package/dist/search/identity.js +90 -0
  654. package/dist/search/identity.js.map +1 -0
  655. package/dist/search/index.d.ts +16 -0
  656. package/dist/search/index.d.ts.map +1 -0
  657. package/dist/search/index.js +15 -0
  658. package/dist/search/index.js.map +1 -0
  659. package/dist/search/memory-source.d.ts +36 -0
  660. package/dist/search/memory-source.d.ts.map +1 -0
  661. package/dist/search/memory-source.js +238 -0
  662. package/dist/search/memory-source.js.map +1 -0
  663. package/dist/search/rank.d.ts +29 -0
  664. package/dist/search/rank.d.ts.map +1 -0
  665. package/dist/search/rank.js +132 -0
  666. package/dist/search/rank.js.map +1 -0
  667. package/dist/search/row-text.d.ts +38 -0
  668. package/dist/search/row-text.d.ts.map +1 -0
  669. package/dist/search/row-text.js +88 -0
  670. package/dist/search/row-text.js.map +1 -0
  671. package/dist/search/search.d.ts +28 -0
  672. package/dist/search/search.d.ts.map +1 -0
  673. package/dist/search/search.js +265 -0
  674. package/dist/search/search.js.map +1 -0
  675. package/dist/search/source.d.ts +70 -0
  676. package/dist/search/source.d.ts.map +1 -0
  677. package/dist/search/source.js +2 -0
  678. package/dist/search/source.js.map +1 -0
  679. package/dist/search/text.d.ts +49 -0
  680. package/dist/search/text.d.ts.map +1 -0
  681. package/dist/search/text.js +165 -0
  682. package/dist/search/text.js.map +1 -0
  683. package/dist/search-index.d.ts +9 -0
  684. package/dist/search-index.d.ts.map +1 -0
  685. package/dist/search-index.js +9 -0
  686. package/dist/search-index.js.map +1 -0
  687. package/dist/sha256.d.ts.map +1 -1
  688. package/dist/sha256.js +3 -2
  689. package/dist/sha256.js.map +1 -1
  690. package/dist/site-capabilities.d.ts +345 -0
  691. package/dist/site-capabilities.d.ts.map +1 -0
  692. package/dist/site-capabilities.js +724 -0
  693. package/dist/site-capabilities.js.map +1 -0
  694. package/dist/site-manifest.d.ts +51 -0
  695. package/dist/site-manifest.d.ts.map +1 -0
  696. package/dist/site-manifest.js +115 -0
  697. package/dist/site-manifest.js.map +1 -0
  698. package/dist/skip-reasons.d.ts +12 -0
  699. package/dist/skip-reasons.d.ts.map +1 -0
  700. package/dist/skip-reasons.js +15 -0
  701. package/dist/skip-reasons.js.map +1 -0
  702. package/dist/source-engine/driver.d.ts +40 -0
  703. package/dist/source-engine/driver.d.ts.map +1 -0
  704. package/dist/source-engine/driver.js +513 -0
  705. package/dist/source-engine/driver.js.map +1 -0
  706. package/dist/source-engine/evidence.d.ts +39 -0
  707. package/dist/source-engine/evidence.d.ts.map +1 -0
  708. package/dist/source-engine/evidence.js +54 -0
  709. package/dist/source-engine/evidence.js.map +1 -0
  710. package/dist/source-engine/guard.d.ts +87 -0
  711. package/dist/source-engine/guard.d.ts.map +1 -0
  712. package/dist/source-engine/guard.js +427 -0
  713. package/dist/source-engine/guard.js.map +1 -0
  714. package/dist/source-engine/index.d.ts +35 -0
  715. package/dist/source-engine/index.d.ts.map +1 -0
  716. package/dist/source-engine/index.js +27 -0
  717. package/dist/source-engine/index.js.map +1 -0
  718. package/dist/source-engine/machine-state.d.ts +87 -0
  719. package/dist/source-engine/machine-state.d.ts.map +1 -0
  720. package/dist/source-engine/machine-state.js +94 -0
  721. package/dist/source-engine/machine-state.js.map +1 -0
  722. package/dist/source-engine/observe.d.ts +10 -0
  723. package/dist/source-engine/observe.d.ts.map +1 -0
  724. package/dist/source-engine/observe.js +276 -0
  725. package/dist/source-engine/observe.js.map +1 -0
  726. package/dist/source-engine/overlay.d.ts +50 -0
  727. package/dist/source-engine/overlay.d.ts.map +1 -0
  728. package/dist/source-engine/overlay.js +114 -0
  729. package/dist/source-engine/overlay.js.map +1 -0
  730. package/dist/source-engine/robots.d.ts +53 -0
  731. package/dist/source-engine/robots.d.ts.map +1 -0
  732. package/dist/source-engine/robots.js +158 -0
  733. package/dist/source-engine/robots.js.map +1 -0
  734. package/dist/source-engine/snapshot.d.ts +104 -0
  735. package/dist/source-engine/snapshot.d.ts.map +1 -0
  736. package/dist/source-engine/snapshot.js +240 -0
  737. package/dist/source-engine/snapshot.js.map +1 -0
  738. package/dist/source-engine/target-consumer.d.ts +12 -0
  739. package/dist/source-engine/target-consumer.d.ts.map +1 -0
  740. package/dist/source-engine/target-consumer.js +15 -0
  741. package/dist/source-engine/target-consumer.js.map +1 -0
  742. package/dist/source-engine/target-descriptor.d.ts +3 -0
  743. package/dist/source-engine/target-descriptor.d.ts.map +1 -0
  744. package/dist/source-engine/target-descriptor.js +26 -0
  745. package/dist/source-engine/target-descriptor.js.map +1 -0
  746. package/dist/source-engine/target.d.ts +82 -0
  747. package/dist/source-engine/target.d.ts.map +1 -0
  748. package/dist/source-engine/target.js +213 -0
  749. package/dist/source-engine/target.js.map +1 -0
  750. package/dist/source-engine/types.d.ts +296 -0
  751. package/dist/source-engine/types.d.ts.map +1 -0
  752. package/dist/source-engine/types.js +2 -0
  753. package/dist/source-engine/types.js.map +1 -0
  754. package/dist/source-harness/conformance.d.ts +16 -0
  755. package/dist/source-harness/conformance.d.ts.map +1 -0
  756. package/dist/source-harness/conformance.js +266 -0
  757. package/dist/source-harness/conformance.js.map +1 -0
  758. package/dist/source-harness/fixture.d.ts +97 -0
  759. package/dist/source-harness/fixture.d.ts.map +1 -0
  760. package/dist/source-harness/fixture.js +276 -0
  761. package/dist/source-harness/fixture.js.map +1 -0
  762. package/dist/source-harness/index.d.ts +22 -0
  763. package/dist/source-harness/index.d.ts.map +1 -0
  764. package/dist/source-harness/index.js +19 -0
  765. package/dist/source-harness/index.js.map +1 -0
  766. package/dist/source-harness/peer.d.ts +74 -0
  767. package/dist/source-harness/peer.d.ts.map +1 -0
  768. package/dist/source-harness/peer.js +106 -0
  769. package/dist/source-harness/peer.js.map +1 -0
  770. package/dist/source-profiles/index.d.ts +31 -0
  771. package/dist/source-profiles/index.d.ts.map +1 -0
  772. package/dist/source-profiles/index.js +206 -0
  773. package/dist/source-profiles/index.js.map +1 -0
  774. package/dist/source-profiles/link-header.d.ts +6 -0
  775. package/dist/source-profiles/link-header.d.ts.map +1 -0
  776. package/dist/source-profiles/link-header.js +131 -0
  777. package/dist/source-profiles/link-header.js.map +1 -0
  778. package/dist/storage-harness/contract.d.ts +109 -0
  779. package/dist/storage-harness/contract.d.ts.map +1 -0
  780. package/dist/storage-harness/contract.js +853 -0
  781. package/dist/storage-harness/contract.js.map +1 -0
  782. package/dist/storage-harness/index.d.ts +39 -0
  783. package/dist/storage-harness/index.d.ts.map +1 -0
  784. package/dist/storage-harness/index.js +55 -0
  785. package/dist/storage-harness/index.js.map +1 -0
  786. package/dist/storage.d.ts +10 -2
  787. package/dist/storage.d.ts.map +1 -1
  788. package/dist/storage.js +10 -2
  789. package/dist/storage.js.map +1 -1
  790. package/dist/string-identity-agreement.d.ts +35 -0
  791. package/dist/string-identity-agreement.d.ts.map +1 -0
  792. package/dist/string-identity-agreement.js +78 -0
  793. package/dist/string-identity-agreement.js.map +1 -0
  794. package/dist/system-documents.d.ts +82 -0
  795. package/dist/system-documents.d.ts.map +1 -0
  796. package/dist/system-documents.js +127 -0
  797. package/dist/system-documents.js.map +1 -0
  798. package/dist/types.d.ts +54 -8
  799. package/dist/types.d.ts.map +1 -1
  800. package/dist/types.js +0 -10
  801. package/dist/types.js.map +1 -1
  802. package/dist/uncertain-write.d.ts +164 -17
  803. package/dist/uncertain-write.d.ts.map +1 -1
  804. package/dist/uncertain-write.js +86 -30
  805. package/dist/uncertain-write.js.map +1 -1
  806. package/dist/validation.d.ts +5 -0
  807. package/dist/validation.d.ts.map +1 -1
  808. package/dist/verification.d.ts +22 -10
  809. package/dist/verification.d.ts.map +1 -1
  810. package/dist/verification.js +87 -39
  811. package/dist/verification.js.map +1 -1
  812. package/dist/view-launch-contract.d.ts +14 -0
  813. package/dist/view-launch-contract.d.ts.map +1 -0
  814. package/dist/view-launch-contract.js +23 -0
  815. package/dist/view-launch-contract.js.map +1 -0
  816. package/dist/write-identity.d.ts +5 -0
  817. package/dist/write-identity.d.ts.map +1 -0
  818. package/dist/write-identity.js +9 -0
  819. package/dist/write-identity.js.map +1 -0
  820. package/package.json +202 -8
@@ -0,0 +1,853 @@
1
+ /**
2
+ * The storage adapter contract, published as `@superbee/core/storage-harness`. Base persistence
3
+ * guarantees are mandatory; stronger guarantees are registered explicitly so a backend cannot pass
4
+ * through hidden capability skips. Engine validation, wire mechanics, and adapter internals stay in
5
+ * their dedicated suites. Core's own remote registration is an end-to-end composition (client,
6
+ * reference router and server backend), not adapter-only evidence.
7
+ *
8
+ * One row is deliberately an ENGINE-over-adapter row rather than a seam row:
9
+ * {@link registerClaimPreconditionContract} drives `mutateDocument`'s field precondition, whose
10
+ * field predicate needs no backend participation. Stating it once per adapter is what
11
+ * proves the guard behaves identically across adapters with conforming CAS; a seam-only row
12
+ * could not observe it at all. The server must enforce CAS for remote contenders.
13
+ *
14
+ * Rows register through `node:test` unless the caller passes its own `test` (same call shape:
15
+ * `test(name, fn)`, and `test(name, { skip }, fn)` for a declared-out capability).
16
+ */
17
+ import nodeTest from "node:test";
18
+ import assert from "node:assert/strict";
19
+ import { blobVersion, contentVersion, VersionConflict, versionOfBytes } from "../versioning.js";
20
+ import { normalizeDocumentBodyForStorage } from "../frontmatter.js";
21
+ import { FilesystemIdentityAliasError, FrontmatterRefusedError, InvalidInputError } from "../errors.js";
22
+ import { FRONTMATTER_LIMITS } from "../bounded-yaml.js";
23
+ import { mutateDocument } from "../document-mutation.js";
24
+ import { PreconditionFailed } from "../document-precondition.js";
25
+ import { parseMarkdown, stringifyDoc } from "../frontmatter.js";
26
+ const TIMESTAMP = "2026-07-01T00:00:00.000Z";
27
+ const enc = (value) => new TextEncoder().encode(value);
28
+ const EMPTY_REGISTRY = { kinds: new Map(), warnings: [] };
29
+ // One table owns storage-key grammar across adapters, including runtime (untyped) callers.
30
+ export const INVALID_STORAGE_PATHS = [
31
+ "/absolute", "../outside", "a/../b", "./a", "a/./b", "a//b", "a\\b", "a/",
32
+ "C:/x", "C:\\x", "c:relative",
33
+ ...Array.from({ length: 32 }, (_, code) => `a${String.fromCharCode(code)}b`),
34
+ "a\u007fb",
35
+ ];
36
+ export const INVALID_RESERVED_NAMES = ["other.md", "INDEX.md", "nested/index.md", "", null, 42];
37
+ /** Reused by real adapter fixtures and no-I/O fixtures to prove refusal precedes storage. */
38
+ export async function assertStorageInputRefusals(backend) {
39
+ for (const value of INVALID_STORAGE_PATHS) {
40
+ const operations = [
41
+ () => backend.read(value),
42
+ () => backend.readMany(["valid", value]),
43
+ () => backend.write(value, doc(value, "unchanged")),
44
+ () => backend.delete(value),
45
+ () => backend.exists(value),
46
+ () => backend.versions(value),
47
+ () => backend.readBlob(value),
48
+ () => backend.writeBlob(value, enc("unchanged")),
49
+ () => backend.deleteBlob(value),
50
+ () => backend.existsBlob(value),
51
+ () => backend.readReserved(value, "index.md"),
52
+ () => backend.writeReserved(value, "index.md", "unchanged"),
53
+ ];
54
+ for (const operation of operations)
55
+ await assert.rejects(operation, InvalidInputError, JSON.stringify(value));
56
+ }
57
+ for (const name of INVALID_RESERVED_NAMES) {
58
+ await assert.rejects(() => backend.readReserved("", name), InvalidInputError);
59
+ await assert.rejects(() => backend.writeReserved("", name, "unchanged"), InvalidInputError);
60
+ }
61
+ }
62
+ async function withFixture(create, run) {
63
+ const fixture = await create();
64
+ try {
65
+ await run(fixture.backend);
66
+ }
67
+ finally {
68
+ await fixture.cleanup();
69
+ }
70
+ }
71
+ function doc(id, body) {
72
+ return { id, frontmatter: { type: "ContractFixture", timestamp: TIMESTAMP }, body };
73
+ }
74
+ function assertConflict(error, expected, actual) {
75
+ assert.ok(error instanceof VersionConflict);
76
+ assert.equal(error.expected, expected);
77
+ assert.equal(error.actual, actual);
78
+ return true;
79
+ }
80
+ /** YAML adapters share richer input shapes; the remote wire deliberately admits JSON only. */
81
+ export function registerFrontmatterReadContract(options) {
82
+ const { name, create, localYamlValues } = options;
83
+ const test = options.test ?? nodeTest;
84
+ const instant = "2026-01-02T03:04:05.000Z";
85
+ const expectedDates = { when: instant, nested: { when: instant }, dates: [instant] };
86
+ for (const dates of [false, true]) {
87
+ test(`${name} frontmatter read contract: ${dates ? "Date" : "JSON"} extensions and read-built mutation agree`, async () => {
88
+ await withFixture(create, async (backend) => {
89
+ await backend.writeReserved("", "index.md", "---\nokf_version: '0.1'\n---\n");
90
+ const value = {
91
+ id: "metadata/dates",
92
+ frontmatter: {
93
+ type: "ContractFixture",
94
+ ...(dates ? { when: new Date(instant), nested: { when: new Date(instant) }, dates: [new Date(instant)] } : expectedDates),
95
+ timestamp: TIMESTAMP,
96
+ },
97
+ body: "original\n",
98
+ };
99
+ const version = await backend.write(value.id, value);
100
+ const expected = { type: "ContractFixture", ...expectedDates, timestamp: TIMESTAMP };
101
+ // JSON transport serializes Date before storage; local YAML writes keep their original bytes.
102
+ assert.equal(version, contentVersion({ ...value, frontmatter: localYamlValues ? value.frontmatter : expected }));
103
+ if (dates && localYamlValues)
104
+ assert.notEqual(version, contentVersion({ ...value, frontmatter: expected }));
105
+ for (const read of [await backend.read(value.id), ...(await backend.readMany([value.id, value.id]))]) {
106
+ assert.equal(read.version, version);
107
+ assert.deepEqual(read.doc.frontmatter, expected);
108
+ }
109
+ const result = await mutateDocument({
110
+ bundle: { root: "unused://metadata", backend }, id: value.id, mode: "patch",
111
+ registry: EMPTY_REGISTRY, strict: false, now: () => TIMESTAMP,
112
+ buildCandidate: existing => ({ frontmatter: existing.frontmatter, body: "changed\n" }),
113
+ });
114
+ assert.equal(result.changed, true);
115
+ assert.equal(result.version, contentVersion({ id: value.id, frontmatter: expected, body: "changed\n" }));
116
+ assert.deepEqual((await backend.read(value.id)).doc.frontmatter, expected);
117
+ });
118
+ });
119
+ }
120
+ if (!localYamlValues)
121
+ return;
122
+ // The wire refuses typeless documents before storage, so only local adapters reach this row.
123
+ test(`${name} frontmatter read contract: an empty-metadata body the reader would misread is fenced and survives intact`, async () => {
124
+ await withFixture(create, async (backend) => {
125
+ const bodies = ["---\nvalue: body text\n---\nbody", "\uFEFF---\nvalue: body text\n---\nbody", "---", "---\r", "\uFEFFbody", "---\r\nx: 1\r\n---\r\nrest"];
126
+ for (const [index, body] of bodies.entries()) {
127
+ const value = { id: `metadata/delimiter-body-${index}`, frontmatter: {}, body };
128
+ const version = await backend.write(value.id, value);
129
+ // An empty block keeps the body (and any leading BOM) out of the delimiter and BOM rules.
130
+ assert.equal(version, versionOfBytes(`---\n---\n${normalizeDocumentBodyForStorage(body)}`));
131
+ assert.equal(version, contentVersion(value));
132
+ for (const read of [await backend.read(value.id), ...(await backend.readMany([value.id]))]) {
133
+ assert.equal(read.version, version);
134
+ assert.deepEqual(read.doc.frontmatter, {});
135
+ assert.equal(read.doc.body, normalizeDocumentBodyForStorage(body));
136
+ }
137
+ }
138
+ });
139
+ });
140
+ test(`${name} frontmatter read contract: current edition governs decoding without changing stored version`, async () => {
141
+ await withFixture(create, async (backend) => {
142
+ const value = { id: "metadata/edition", frontmatter: { type: "ContractFixture", timestamp: 0 }, body: "body\n" };
143
+ const version = await backend.write(value.id, value);
144
+ const rows = [
145
+ { marker: undefined, timestamp: "1970-01-01T00:00:00.000Z" },
146
+ { marker: "---\nokf_version: '0.2'\n---\n", timestamp: 0 },
147
+ { marker: "---\nokf_version: '0.1'\n---\n", timestamp: "1970-01-01T00:00:00.000Z" },
148
+ { marker: "---\nokf_version: [\n---\n", timestamp: "1970-01-01T00:00:00.000Z" },
149
+ ];
150
+ for (const row of rows) {
151
+ if (row.marker !== undefined)
152
+ await backend.writeReserved("", "index.md", row.marker);
153
+ for (const read of [await backend.read(value.id), ...(await backend.readMany([value.id]))]) {
154
+ assert.equal(read.version, version);
155
+ assert.equal(read.doc.frontmatter.timestamp, row.timestamp);
156
+ }
157
+ }
158
+ });
159
+ });
160
+ test(`${name} frontmatter read contract: YAML value graph round-trips with caller isolation`, async () => {
161
+ await withFixture(create, async (backend) => {
162
+ await backend.writeReserved("", "index.md", "---\nokf_version: '0.2'\n---\n");
163
+ const shared = { value: "original" };
164
+ const value = {
165
+ id: "metadata/yaml",
166
+ frontmatter: {
167
+ type: "ContractFixture", timestamp: TIMESTAMP,
168
+ nan: NaN, positive: Infinity, negative: -Infinity, binary: Buffer.from([0, 127, 255]),
169
+ first: shared, second: shared,
170
+ },
171
+ body: "body\n",
172
+ };
173
+ const expected = parseMarkdown(stringifyDoc(value.frontmatter, value.body), value.id, { okfVersion: "0.2" });
174
+ const version = await backend.write(value.id, value);
175
+ assert.equal(version, contentVersion(value));
176
+ shared.value = "caller changed input";
177
+ for (const read of [await backend.read(value.id), ...(await backend.readMany([value.id, value.id]))]) {
178
+ assert.equal(read.version, version);
179
+ assert.deepEqual(read.doc.frontmatter, expected.frontmatter);
180
+ assert.equal(read.doc.frontmatter.first, read.doc.frontmatter.second);
181
+ read.doc.frontmatter.first.value = "caller changed read";
182
+ read.doc.frontmatter.binary[0] = 100;
183
+ }
184
+ assert.deepEqual((await backend.read(value.id)).doc.frontmatter, expected.frontmatter);
185
+ });
186
+ });
187
+ test(`${name} frontmatter write contract: frontmatter the reader would refuse is refused and nothing is stored`, async () => {
188
+ await withFixture(create, async (backend) => {
189
+ await backend.writeReserved("", "index.md", "---\nokf_version: '0.2'\n---\n");
190
+ const id = "metadata/oversized";
191
+ const oversized = { id, frontmatter: { type: "ContractFixture", description: "v".repeat(FRONTMATTER_LIMITS.sourceChars) }, body: "" };
192
+ await assert.rejects(backend.write(id, oversized), (error) => error instanceof FrontmatterRefusedError && error.code === "FRONTMATTER_TOO_LARGE");
193
+ await assert.rejects(backend.read(id));
194
+ });
195
+ });
196
+ test(`${name} reserved write contract: refused frontmatter in a reserved markdown file is refused and nothing is stored`, async () => {
197
+ await withFixture(create, async (backend) => {
198
+ const cases = [
199
+ ["FRONTMATTER_CYCLE", "---\nloop: &l [*l]\n---\n# Notes\n"],
200
+ ["FRONTMATTER_TOO_LARGE", `---\ndescription: ${"v".repeat(FRONTMATTER_LIMITS.sourceChars)}\n---\n`],
201
+ ];
202
+ for (const [code, content] of cases) {
203
+ await assert.rejects(backend.writeReserved("notes", "index.md", content), (error) => error instanceof FrontmatterRefusedError && error.code === code, code);
204
+ assert.equal(await backend.readReserved("notes", "index.md"), null, code);
205
+ }
206
+ await backend.writeReserved("notes", "index.md", "---\ntitle: Notes\n---\n# Notes\n");
207
+ assert.equal((await backend.readReserved("notes", "index.md"))?.content, "---\ntitle: Notes\n---\n# Notes\n");
208
+ });
209
+ });
210
+ }
211
+ /** Shared by conforming fixtures and deliberately nonconforming remote-server controls. */
212
+ export async function assertSerializedBodyContract(backend) {
213
+ const submissions = [
214
+ "no trailing newline",
215
+ "already normalized\n",
216
+ "blank tail preserved\n\n\n",
217
+ "",
218
+ "carriage-return ending\r\n",
219
+ "lone carriage return\r",
220
+ ];
221
+ for (const [index, submitted] of submissions.entries()) {
222
+ const id = `concepts/body-shape-${index}`;
223
+ const written = await backend.write(id, doc(id, submitted), { expectedVersion: null });
224
+ const read = await backend.read(id);
225
+ const serializedBody = normalizeDocumentBodyForStorage(submitted);
226
+ assert.equal(read.doc.body, serializedBody, "read must expose the serialized body");
227
+ assert.equal(read.version, written);
228
+ const many = await backend.readMany([id]);
229
+ assert.equal(many[0].doc.body, serializedBody, "readMany must expose the serialized body");
230
+ assert.equal(many[0].version, written);
231
+ const bundle = { root: "mem://body-shape", backend };
232
+ const appended = `${serializedBody}appended`;
233
+ const mutated = await mutateDocument({
234
+ bundle,
235
+ id,
236
+ mode: "patch",
237
+ registry: EMPTY_REGISTRY,
238
+ strict: false,
239
+ buildCandidate: (existing) => ({
240
+ frontmatter: { ...existing.frontmatter, touched: true },
241
+ body: `${existing.body}appended`,
242
+ }),
243
+ });
244
+ assert.equal(mutated.changed, true);
245
+ const reread = await backend.read(id);
246
+ assert.equal(reread.doc.body, normalizeDocumentBodyForStorage(appended));
247
+ assert.equal(reread.version, mutated.version);
248
+ assert.equal(mutated.version, contentVersion({ id, frontmatter: reread.doc.frontmatter, body: reread.doc.body }));
249
+ }
250
+ }
251
+ export function registerStorageBackendBaseContract(options) {
252
+ const { name, create } = options;
253
+ const test = options.test ?? nodeTest;
254
+ test(`${name} contract: shared invalid input rows refuse without changing stored content`, async () => {
255
+ await withFixture(create, async (backend) => {
256
+ await backend.write("valid", doc("valid", "original"));
257
+ await backend.writeBlob("valid.bin", enc("original"));
258
+ await backend.writeReserved("", "index.md", "original");
259
+ const original = await backend.read("valid");
260
+ await assertStorageInputRefusals(backend);
261
+ assert.deepEqual(await backend.read("valid"), original);
262
+ assert.deepEqual(await backend.list(), ["valid"]);
263
+ assert.deepEqual(await backend.listBlobs(), ["valid.bin"]);
264
+ assert.equal((await backend.readReserved("", "index.md"))?.content, "original");
265
+ });
266
+ });
267
+ test(`${name} contract: document reads expose stable content versions`, async () => {
268
+ await withFixture(create, async (backend) => {
269
+ const value = doc("concepts/versioned", "one");
270
+ const written = await backend.write(value.id, value);
271
+ const first = await backend.read(value.id);
272
+ const second = await backend.read(value.id);
273
+ assert.match(written, /^sha256:[0-9a-f]{64}$/);
274
+ assert.equal(written, contentVersion(value));
275
+ assert.equal(first.version, written);
276
+ assert.deepEqual(first, second);
277
+ assert.equal(first.doc.id, value.id);
278
+ assert.deepEqual(first.doc.frontmatter, value.frontmatter);
279
+ assert.equal(first.doc.body.trimEnd(), value.body);
280
+ });
281
+ });
282
+ // A read exposes the CANONICAL body — the exact shape the serializer emits — not the
283
+ // caller's submitted string. Byte-storing adapters get this free by re-parsing what they
284
+ // wrote; the object-storing in-memory adapter must normalize at write or it leaks the
285
+ // submission verbatim. The mutation leg is why the parity matters: `mutateDocument`
286
+ // builds its candidate from the read body, so a one-byte read divergence becomes a
287
+ // one-byte serialized divergence and a different version token on the next write.
288
+ test(`${name} contract: reads return the serialized body and read-built mutations keep one token`, async () => {
289
+ await withFixture(create, async (backend) => {
290
+ await assertSerializedBodyContract(backend);
291
+ });
292
+ });
293
+ test(`${name} contract: concept ids are canonical, exact, and invertible`, async () => {
294
+ await withFixture(create, async (backend) => {
295
+ for (const alias of ["./a/b", "a//b", "a\\b", "a/./b", "a/b/", "a.md/b"]) {
296
+ await assert.rejects(() => backend.write(alias, doc(alias, alias)), (error) => error instanceof InvalidInputError);
297
+ }
298
+ const plain = "concepts/x";
299
+ const markdownSuffixed = "concepts/x.md";
300
+ const plainVersion = await backend.write(plain, doc(plain, "physical x.md"), { expectedVersion: null });
301
+ const suffixedVersion = await backend.write(markdownSuffixed, doc(markdownSuffixed, "physical x.md.md"), { expectedVersion: null });
302
+ assert.notEqual(plainVersion, suffixedVersion);
303
+ assert.deepEqual(await backend.list("concepts/"), [plain, markdownSuffixed]);
304
+ assert.equal((await backend.read(plain)).doc.body.trimEnd(), "physical x.md");
305
+ assert.equal((await backend.read(markdownSuffixed)).doc.body.trimEnd(), "physical x.md.md");
306
+ await assert.rejects(() => backend.write(markdownSuffixed, doc(markdownSuffixed, "duplicate"), { expectedVersion: null }), (error) => assertConflict(error, null, suffixedVersion));
307
+ assert.equal((await backend.read(plain)).version, plainVersion);
308
+ assert.equal((await backend.read(markdownSuffixed)).version, suffixedVersion);
309
+ });
310
+ });
311
+ test(`${name} contract: the write key owns the returned document identity`, async () => {
312
+ await withFixture(create, async (backend) => {
313
+ const id = "concepts/route-id";
314
+ await backend.write(id, doc("concepts/mismatched-body-id", "body"));
315
+ assert.equal((await backend.read(id)).doc.id, id);
316
+ });
317
+ });
318
+ test(`${name} contract: document CAS and expect-absent are fail-closed`, async () => {
319
+ await withFixture(create, async (backend) => {
320
+ const id = "concepts/cas";
321
+ const first = await backend.write(id, doc(id, "one"), { expectedVersion: null });
322
+ await assert.rejects(() => backend.write(id, doc(id, "duplicate-create"), { expectedVersion: null }), (error) => assertConflict(error, null, first));
323
+ assert.equal((await backend.read(id)).version, first);
324
+ const second = await backend.write(id, doc(id, "two"));
325
+ assert.notEqual(second, first);
326
+ await assert.rejects(() => backend.write(id, doc(id, "stale"), { expectedVersion: first }), (error) => assertConflict(error, first, second));
327
+ assert.equal((await backend.read(id)).version, second);
328
+ const third = await backend.write(id, doc(id, "three"), { expectedVersion: second });
329
+ assert.notEqual(third, second);
330
+ assert.equal((await backend.read(id)).version, third);
331
+ await assert.rejects(() => backend.write("concepts/missing", doc("concepts/missing", "x"), { expectedVersion: first }), (error) => assertConflict(error, first, null));
332
+ });
333
+ });
334
+ test(`${name} contract: readMany preserves order and reports a missing member`, async () => {
335
+ await withFixture(create, async (backend) => {
336
+ const versions = new Map();
337
+ for (const id of ["z/last", "a/first", "m/mid"]) {
338
+ versions.set(id, await backend.write(id, doc(id, id)));
339
+ }
340
+ const ids = ["m/mid", "a/first", "z/last"];
341
+ const results = await backend.readMany(ids);
342
+ assert.deepEqual(results.map((result) => result.doc.id), ids);
343
+ for (const result of results) {
344
+ assert.match(result.version, /^sha256:[0-9a-f]{64}$/);
345
+ assert.equal(result.version, versions.get(result.doc.id));
346
+ }
347
+ assert.deepEqual(await backend.readMany([]), []);
348
+ await assert.rejects(() => backend.readMany(["a/first", "does/not-exist"]), (error) => Boolean(error && typeof error === "object" && error.code === "ENOENT"));
349
+ });
350
+ });
351
+ test(`${name} contract: list, prefix, and exists describe the same sorted namespace`, async () => {
352
+ await withFixture(create, async (backend) => {
353
+ for (const id of ["tasks/z", "notes/a", "tasks/a"]) {
354
+ await backend.write(id, doc(id, id));
355
+ }
356
+ assert.deepEqual(await backend.list(), ["notes/a", "tasks/a", "tasks/z"]);
357
+ assert.deepEqual(await backend.list("tasks/"), ["tasks/a", "tasks/z"]);
358
+ assert.equal(await backend.exists("tasks/a"), true);
359
+ assert.equal(await backend.exists("tasks/missing"), false);
360
+ });
361
+ });
362
+ test(`${name} contract: delete is idempotent, CAS-guarded, and purges history`, async () => {
363
+ await withFixture(create, async (backend) => {
364
+ const id = "concepts/delete";
365
+ const first = await backend.write(id, doc(id, "one"));
366
+ const second = await backend.write(id, doc(id, "two"));
367
+ await assert.rejects(() => backend.delete(id, { expectedVersion: first }), (error) => assertConflict(error, first, second));
368
+ assert.equal(await backend.exists(id), true);
369
+ assert.equal((await backend.read(id)).version, second);
370
+ assert.equal(await backend.delete(id, { expectedVersion: second }), true);
371
+ await assert.rejects(() => backend.read(id), (error) => Boolean(error && typeof error === "object" && error.code === "ENOENT"));
372
+ assert.equal(await backend.exists(id), false);
373
+ assert.equal((await backend.list()).includes(id), false);
374
+ assert.deepEqual(await backend.versions(id), []);
375
+ assert.equal(await backend.delete(id, { expectedVersion: first }), false);
376
+ assert.equal(await backend.delete(id, { expectedVersion: second }), false);
377
+ assert.equal(await backend.delete("concepts/never-written"), false);
378
+ });
379
+ });
380
+ test(`${name} contract: reserved reads and writes obey the same version discipline`, async () => {
381
+ await withFixture(create, async (backend) => {
382
+ assert.equal(await backend.readReserved("missing", "index.md"), null);
383
+ const first = await backend.writeReserved("nested", "index.md", "# One\n", {
384
+ expectedVersion: null,
385
+ });
386
+ assert.equal((await backend.readReserved("nested", "index.md"))?.version, first);
387
+ await assert.rejects(() => backend.writeReserved("nested", "index.md", "# Duplicate\n", { expectedVersion: null }), (error) => assertConflict(error, null, first));
388
+ assert.equal((await backend.readReserved("nested", "index.md"))?.version, first);
389
+ await assert.rejects(() => backend.writeReserved("nested", "index.md", "# Stale\n", {
390
+ expectedVersion: `sha256:${"0".repeat(64)}`,
391
+ }), (error) => assertConflict(error, `sha256:${"0".repeat(64)}`, first));
392
+ assert.equal((await backend.readReserved("nested", "index.md"))?.version, first);
393
+ await assert.rejects(() => backend.writeReserved("missing", "index.md", "# Missing\n", {
394
+ expectedVersion: first,
395
+ }), (error) => assertConflict(error, first, null));
396
+ const second = await backend.writeReserved("nested", "index.md", "# Two\n", {
397
+ expectedVersion: first,
398
+ });
399
+ assert.notEqual(second, first);
400
+ assert.equal((await backend.readReserved("nested", "index.md"))?.content, "# Two\n");
401
+ });
402
+ });
403
+ }
404
+ export function registerStorageBackendBlobContract(options) {
405
+ const { name, create } = options;
406
+ const test = options.test ?? nodeTest;
407
+ test(`${name} blob contract: unsafe keys fail at the storage boundary`, async () => {
408
+ await withFixture(create, async (backend) => {
409
+ for (const key of ["../escape.bin", "/absolute.bin", "artifacts/report.MD", ".hidden/blob.bin"]) {
410
+ await assert.rejects(() => backend.readBlob(key), InvalidInputError);
411
+ await assert.rejects(() => backend.writeBlob(key, enc("x")), InvalidInputError);
412
+ await assert.rejects(() => backend.existsBlob(key), InvalidInputError);
413
+ await assert.rejects(() => backend.deleteBlob(key), InvalidInputError);
414
+ }
415
+ });
416
+ });
417
+ test(`${name} blob contract: bytes, versions, absence, and sorted listing round-trip`, async () => {
418
+ await withFixture(create, async (backend) => {
419
+ assert.equal(await backend.readBlob("artifacts/missing.bin"), null);
420
+ assert.equal(await backend.existsBlob("artifacts/missing.bin"), false);
421
+ const binary = Uint8Array.from({ length: 256 }, (_, index) => index);
422
+ const version = await backend.writeBlob("artifacts/binary.dat", binary);
423
+ const read = await backend.readBlob("artifacts/binary.dat");
424
+ assert.ok(read);
425
+ assert.deepEqual([...read.bytes], [...binary]);
426
+ assert.equal(read.version, version);
427
+ assert.equal(version, blobVersion(binary));
428
+ assert.equal(read.contentType, "application/octet-stream");
429
+ await backend.writeBlob("other/c.bin", enc("c"));
430
+ await backend.writeBlob("artifacts/a.bin", enc("a"));
431
+ await backend.writeBlob("artifacts/sub/b.bin", enc("b"));
432
+ await backend.writeBlob("artifacts/page.html", enc("<p>page</p>"));
433
+ assert.equal((await backend.readBlob("artifacts/page.html"))?.contentType, "text/html; charset=utf-8");
434
+ assert.deepEqual(await backend.listBlobs(), [
435
+ "artifacts/a.bin",
436
+ "artifacts/binary.dat",
437
+ "artifacts/page.html",
438
+ "artifacts/sub/b.bin",
439
+ "other/c.bin",
440
+ ]);
441
+ assert.deepEqual(await backend.listBlobs("artifacts/"), [
442
+ "artifacts/a.bin",
443
+ "artifacts/binary.dat",
444
+ "artifacts/page.html",
445
+ "artifacts/sub/b.bin",
446
+ ]);
447
+ assert.deepEqual(await backend.listBlobs("other/"), ["other/c.bin"]);
448
+ });
449
+ });
450
+ test(`${name} blob contract: CAS, expect-absent, and byte-identical no-op`, async () => {
451
+ await withFixture(create, async (backend) => {
452
+ const key = "artifacts/cas.bin";
453
+ const firstBytes = enc("one");
454
+ const first = await backend.writeBlob(key, firstBytes, undefined, { expectedVersion: null });
455
+ await assert.rejects(() => backend.writeBlob(key, enc("duplicate-create"), undefined, { expectedVersion: null }), (error) => assertConflict(error, null, first));
456
+ assert.equal((await backend.readBlob(key))?.version, first);
457
+ const noOp = await backend.writeBlob(key, firstBytes, undefined, { expectedVersion: first });
458
+ assert.equal(noOp, first);
459
+ const second = await backend.writeBlob(key, enc("two"));
460
+ assert.notEqual(second, first);
461
+ await assert.rejects(() => backend.writeBlob(key, enc("stale"), undefined, { expectedVersion: first }), (error) => assertConflict(error, first, second));
462
+ assert.equal((await backend.readBlob(key))?.version, second);
463
+ const third = await backend.writeBlob(key, enc("three"), undefined, { expectedVersion: second });
464
+ assert.notEqual(third, second);
465
+ assert.equal((await backend.readBlob(key))?.version, third);
466
+ await assert.rejects(() => backend.writeBlob("artifacts/missing.bin", enc("x"), undefined, { expectedVersion: first }), (error) => assertConflict(error, first, null));
467
+ });
468
+ });
469
+ test(`${name} blob contract: delete is idempotent and CAS-guarded`, async () => {
470
+ await withFixture(create, async (backend) => {
471
+ const key = "artifacts/delete.bin";
472
+ const first = await backend.writeBlob(key, enc("one"));
473
+ const second = await backend.writeBlob(key, enc("two"));
474
+ await assert.rejects(() => backend.deleteBlob(key, { expectedVersion: first }), (error) => assertConflict(error, first, second));
475
+ assert.equal(await backend.existsBlob(key), true);
476
+ assert.equal((await backend.readBlob(key))?.version, second);
477
+ assert.equal(await backend.deleteBlob(key, { expectedVersion: second }), true);
478
+ assert.equal(await backend.readBlob(key), null);
479
+ assert.equal(await backend.existsBlob(key), false);
480
+ assert.deepEqual(await backend.listBlobs("artifacts/"), []);
481
+ assert.equal(await backend.deleteBlob(key, { expectedVersion: first }), false);
482
+ assert.equal(await backend.deleteBlob("artifacts/never-written.bin"), false);
483
+ });
484
+ });
485
+ // A key nested under an existing FILE entry names a shape no backend can hold. Every observation
486
+ // reports absence (never a raw ENOTDIR): the filesystem adapter classifies the shape mismatch as
487
+ // absence, exactly like the adapters that have no notion of a path segment being a file.
488
+ // Contract record: before the identity protocol the filesystem adapter raised a raw ENOTDIR from
489
+ // read/readBlob/readReserved/versions here. Mutations under a file segment are NOT in this parity
490
+ // row: the filesystem adapter raises its typed shape-mismatch error (where it used to raise raw
491
+ // ENOTDIR), while the in-memory and remote adapters report the key as absent.
492
+ test(`${name} blob contract: a key nested under an existing file entry is absent for every observation`, async () => {
493
+ await withFixture(create, async (backend) => {
494
+ await backend.writeBlob("artifacts/parent.bin", enc("a file, not a directory"));
495
+ const nestedId = "artifacts/parent.bin/nested";
496
+ const isEnoent = (error) => error?.code === "ENOENT";
497
+ await assert.rejects(() => backend.read(nestedId), isEnoent);
498
+ await assert.rejects(() => backend.readMany([nestedId]), isEnoent);
499
+ assert.equal(await backend.exists(nestedId), false);
500
+ assert.deepEqual(await backend.versions(nestedId), []);
501
+ assert.equal(await backend.readReserved("artifacts/parent.bin", "index.md"), null);
502
+ assert.equal(await backend.readBlob("artifacts/parent.bin/nested.bin"), null);
503
+ assert.equal(await backend.existsBlob("artifacts/parent.bin/nested.bin"), false);
504
+ assert.deepEqual(await backend.list("artifacts/"), []);
505
+ assert.deepEqual(await backend.listBlobs("artifacts/"), ["artifacts/parent.bin"]);
506
+ assert.equal(new TextDecoder().decode((await backend.readBlob("artifacts/parent.bin"))?.bytes), "a file, not a directory");
507
+ });
508
+ });
509
+ }
510
+ export function registerStorageBackendHistoryContract(options) {
511
+ const { name, create, retention, retainsClientAgent = false, actor = "write-options" } = options;
512
+ const test = options.test ?? nodeTest;
513
+ test(`${name} history contract: reports ${retention} revisions newest-first`, async () => {
514
+ await withFixture(create, async (backend) => {
515
+ const id = "concepts/history";
516
+ const first = await backend.write(id, doc(id, "one"), { actor: "alpha", agent: "agent-a" });
517
+ const second = await backend.write(id, doc(id, "two"), { actor: "beta", agent: "agent-b" });
518
+ const versions = await backend.versions(id);
519
+ if (retention === "current-only") {
520
+ assert.deepEqual(versions.map((entry) => entry.version), [second]);
521
+ }
522
+ else {
523
+ assert.deepEqual(versions.map((entry) => entry.version), [second, first]);
524
+ const actors = actor === "write-options" ? ["beta", "alpha"] : [actor.principal, actor.principal];
525
+ assert.deepEqual(versions.map((entry) => entry.actor), actors);
526
+ if (retainsClientAgent) {
527
+ assert.deepEqual(versions.map((entry) => entry.agent), ["agent-b", "agent-a"]);
528
+ }
529
+ }
530
+ });
531
+ });
532
+ }
533
+ /** The one-winner assertion must also reject a server that accepts every stale write. */
534
+ export async function assertAtomicCasContract(createPeers) {
535
+ const fixture = await createPeers();
536
+ try {
537
+ assert.ok(fixture.peers.length > 0);
538
+ const id = "concepts/race";
539
+ const initial = await fixture.backend.write(id, doc(id, "initial"));
540
+ const results = await Promise.allSettled(Array.from({ length: 8 }, (_, index) => fixture.peers[index % fixture.peers.length].write(id, doc(id, `writer-${index}`), {
541
+ expectedVersion: initial,
542
+ })));
543
+ const fulfilled = results.filter((result) => result.status === "fulfilled");
544
+ const rejected = results.filter((result) => result.status === "rejected");
545
+ assert.equal(fulfilled.length, 1, "CAS must admit exactly one concurrent writer");
546
+ assert.equal(rejected.length, results.length - 1);
547
+ for (const result of rejected) {
548
+ assert.ok(result.reason instanceof VersionConflict);
549
+ assert.equal(result.reason.expected, initial);
550
+ }
551
+ assert.equal((await fixture.backend.read(id)).version, fulfilled[0].value);
552
+ }
553
+ finally {
554
+ await fixture.cleanup();
555
+ }
556
+ }
557
+ export function registerStorageBackendAtomicCasContract(options) {
558
+ const { name, createPeers } = options;
559
+ const test = options.test ?? nodeTest;
560
+ test(`${name} atomic CAS contract: concurrent writers produce one winner`, async () => {
561
+ await assertAtomicCasContract(createPeers);
562
+ });
563
+ }
564
+ /**
565
+ * One-winner agreement for the claim shape `mutateDocument`'s field precondition exists to serve:
566
+ * N claimants race to set an owner field that each of them asserts is still unset. The precondition
567
+ * is evaluated inside the same decision whose read version the CAS write is conditional on, so the
568
+ * losers are refused terminally rather than retrying into a later win — and because no adapter
569
+ * participates in the check, the row must read the same for every backend registered here.
570
+ */
571
+ export function registerClaimPreconditionContract(options) {
572
+ const { name, createPeers } = options;
573
+ const test = options.test ?? nodeTest;
574
+ const OWNER = "assignee";
575
+ test(`${name} claim precondition contract: concurrent claimants produce one winner and terminal refusals`, async () => {
576
+ const fixture = await createPeers();
577
+ try {
578
+ assert.ok(fixture.peers.length > 0);
579
+ const id = "tasks/contended";
580
+ await fixture.backend.writeReserved("", "index.md", "---\nokf_version: '0.2'\n---\n# Contract\n");
581
+ const unclaimed = await fixture.backend.write(id, doc(id, "claimable"));
582
+ const claimants = Array.from({ length: 8 }, (_, index) => `claimant-${index}`);
583
+ const results = await Promise.allSettled(claimants.map((claimant, index) => {
584
+ const bundle = { root: "unused://claim", backend: fixture.peers[index % fixture.peers.length] };
585
+ return mutateDocument({
586
+ bundle,
587
+ id,
588
+ mode: "patch",
589
+ registry: EMPTY_REGISTRY,
590
+ strict: false,
591
+ preconditions: [{ field: OWNER, expect: "absent" }],
592
+ buildCandidate: (existing) => ({
593
+ frontmatter: { ...existing.frontmatter, [OWNER]: claimant },
594
+ body: existing.body,
595
+ }),
596
+ });
597
+ }));
598
+ const fulfilled = results.filter((result) => result.status === "fulfilled");
599
+ const rejected = results.filter((result) => result.status === "rejected");
600
+ assert.equal(fulfilled.length, 1);
601
+ assert.equal(rejected.length, results.length - 1);
602
+ const winner = fulfilled[0].value;
603
+ const owner = winner.doc.frontmatter[OWNER];
604
+ assert.equal(winner.changed, true);
605
+ assert.equal(claimants.includes(String(owner)), true);
606
+ assert.notEqual(winner.version, unclaimed);
607
+ for (const result of rejected) {
608
+ assert.ok(result.reason instanceof PreconditionFailed, `expected PreconditionFailed, got ${String(result.reason)}`);
609
+ assert.equal(result.reason.id, id);
610
+ assert.equal(result.reason.field, OWNER);
611
+ assert.equal(result.reason.expected, "absent");
612
+ // Every refusal names the ONE winner: a loser is never told about another loser's write,
613
+ // because no losing write ever reaches storage.
614
+ assert.equal(result.reason.actual, owner);
615
+ }
616
+ const final = await fixture.backend.read(id);
617
+ assert.equal(final.doc.frontmatter[OWNER], owner);
618
+ assert.equal(final.version, winner.version);
619
+ }
620
+ finally {
621
+ await fixture.cleanup();
622
+ }
623
+ });
624
+ }
625
+ export function registerStorageBackendQueryHeadsContract(options) {
626
+ const { name, create } = options;
627
+ const test = options.test ?? nodeTest;
628
+ test(`${name} queryHeads contract: an implemented projection does not under-return body-free heads`, async () => {
629
+ await withFixture(create, async (backend) => {
630
+ assert.ok(backend.queryHeads, `${name} must implement queryHeads to register this contract`);
631
+ const fixtures = [
632
+ {
633
+ ...doc("tasks/a", "body-a"),
634
+ frontmatter: { type: "Task", timestamp: TIMESTAMP, status: "done", tags: ["work"] },
635
+ },
636
+ {
637
+ ...doc("tasks/b", "body-b"),
638
+ frontmatter: { type: "Task", timestamp: TIMESTAMP, status: "todo", tags: ["work", "urgent"] },
639
+ },
640
+ doc("notes/c", "body-c"),
641
+ ];
642
+ const versions = new Map();
643
+ for (const value of fixtures) {
644
+ versions.set(value.id, await backend.write(value.id, value));
645
+ }
646
+ const cases = [
647
+ [{}, ["notes/c", "tasks/a", "tasks/b"]],
648
+ [{ type: "Task" }, ["tasks/a", "tasks/b"]],
649
+ [{ prefix: "tasks/" }, ["tasks/a", "tasks/b"]],
650
+ [{ tags: ["urgent"] }, ["tasks/b"]],
651
+ ];
652
+ for (const [filter, ids] of cases) {
653
+ const heads = await backend.queryHeads(filter);
654
+ const returnedIds = heads.map((head) => head.id);
655
+ for (const id of ids) {
656
+ assert.equal(returnedIds.includes(id), true, `queryHeads under-returned ${id}`);
657
+ }
658
+ for (const head of heads) {
659
+ const version = versions.get(head.id);
660
+ assert.ok(version, `queryHeads returned an unknown id: ${head.id}`);
661
+ assert.equal(head.version, version);
662
+ assert.equal("body" in head, false);
663
+ }
664
+ }
665
+ });
666
+ });
667
+ }
668
+ /**
669
+ * Identity rows (I7): one conditional row per operation for a spelling that aliases an existing
670
+ * entry. Each row branches on whether the host aliases THAT KIND of pair (case, normalization),
671
+ * not on the aggregate host class: a case-sensitive but normalization-insensitive volume aliases
672
+ * one and not the other, and an aggregate branch would score correct behavior as a failure there.
673
+ * On a host that aliases the pair, every operation with the alias is refused with the typed alias
674
+ * verdict and the canonical entry is untouched; otherwise the alias is simply a distinct absent
675
+ * identity. A normalizing host (legacy HFS+) is out of scope: its NFC/NFD behavior is pinned by
676
+ * the native suite's AC-17 row instead. `dev`/`ino` are assumed stable per observation on local
677
+ * APFS/ext4; network filesystems are unsupported. First creation of a document is published with a
678
+ * hard link so the host's own equivalence refuses a second spelling the identity fold did not
679
+ * equate; on a local filesystem without hard links (exFAT, FAT32, some FUSE mounts) first creation
680
+ * falls back to rename, and two CONCURRENT first-creation writers of such a host-equated pair are
681
+ * not excluded there (sequential access is still refused). That residual is confined to those hosts.
682
+ *
683
+ * Two further shapes these rows do not exercise, recorded so the contract states them:
684
+ *
685
+ * - Hard-link publication means a crash between `link` and `unlink(tmp)` leaves the document's
686
+ * inode carrying a SECOND name, the dot-prefixed temp. Listings skip dot entries, so the
687
+ * document reads normally, but a later replace or delete of the document leaves the OLD bytes
688
+ * on disk under that invisible name until the residue is swept.
689
+ * - "This filesystem has no hard links" is classified by errno (EPERM/ENOTSUP/EOPNOTSUPP/EXDEV),
690
+ * not by a positive capability check, and is remembered per root for the process. A transient
691
+ * EPERM on a link-capable mount therefore moves that root onto the rename fallback — and onto
692
+ * the fold-gap residual above — for the rest of the process lifetime.
693
+ */
694
+ export function registerStorageBackendIdentityContract(options) {
695
+ const { name, create } = options;
696
+ const test = options.test ?? nodeTest;
697
+ const isAlias = (error) => error instanceof FilesystemIdentityAliasError && error instanceof InvalidInputError;
698
+ const isEnoent = (error) => error?.code === "ENOENT";
699
+ async function withIdentityFixture(run) {
700
+ const fixture = await create();
701
+ try {
702
+ await run(fixture.backend, fixture.host);
703
+ }
704
+ finally {
705
+ await fixture.cleanup();
706
+ }
707
+ }
708
+ test(`${name} contract: locale-equal listing ties have stable code-point order`, async () => {
709
+ await withIdentityFixture(async (backend, host) => {
710
+ // A normalizing filesystem cannot represent both keys; its refusal is covered by
711
+ // the normalization identity row below (and AC-17 for normalizing hosts).
712
+ if (host.normalization)
713
+ return;
714
+ const ids = ["order/caf\u00e9", "order/cafe\u0301"];
715
+ assert.equal(ids[0].localeCompare(ids[1]), 0);
716
+ for (const id of ids) {
717
+ await backend.write(id, doc(id, id));
718
+ await backend.writeBlob(`${id}.bin`, enc(id));
719
+ }
720
+ const expected = [ids[1], ids[0]];
721
+ assert.deepEqual(await backend.list(), expected);
722
+ assert.deepEqual(await backend.list("order/"), expected);
723
+ assert.deepEqual(await backend.listBlobs(), expected.map((id) => `${id}.bin`));
724
+ assert.deepEqual(await backend.listBlobs("order/"), expected.map((id) => `${id}.bin`));
725
+ for (const id of ids) {
726
+ await backend.delete(id);
727
+ await backend.deleteBlob(`${id}.bin`);
728
+ }
729
+ for (const id of [...ids].reverse()) {
730
+ await backend.write(id, doc(id, id));
731
+ await backend.writeBlob(`${id}.bin`, enc(id));
732
+ }
733
+ assert.deepEqual(await backend.list("order/"), expected);
734
+ assert.deepEqual(await backend.listBlobs("order/"), expected.map((id) => `${id}.bin`));
735
+ });
736
+ });
737
+ // The label is the pair KIND and indexes the host's per-kind verdict, so a row can never be
738
+ // scored against a kind of aliasing its own pair does not exercise.
739
+ const documentPairs = [
740
+ ["case", "concepts/exact-name", "concepts/EXACT-NAME"],
741
+ ["normalization", "concepts/caf\u00e9", "concepts/cafe\u0301"],
742
+ ];
743
+ for (const [label, id, alias] of documentPairs) {
744
+ test(`${name} contract: document ${label} alias is refused where the host aliases that pair and distinct otherwise`, async () => {
745
+ await withIdentityFixture(async (backend, host) => {
746
+ if (label === "normalization" && host.hostClass === "normalizing")
747
+ return; // pinned by AC-17 instead
748
+ const aliasing = host[label];
749
+ const version = await backend.write(id, doc(id, "canonical"));
750
+ assert.deepEqual(await backend.list("concepts/"), [id]);
751
+ if (aliasing) {
752
+ await assert.rejects(() => backend.read(alias), isAlias);
753
+ await assert.rejects(() => backend.readMany([id, alias]), isAlias);
754
+ await assert.rejects(() => backend.exists(alias), isAlias);
755
+ await assert.rejects(() => backend.versions(alias), isAlias);
756
+ await assert.rejects(() => backend.write(alias, doc(alias, "alias")), isAlias);
757
+ await assert.rejects(() => backend.write(alias, doc(alias, "alias"), { expectedVersion: null }), isAlias);
758
+ await assert.rejects(() => backend.delete(alias), isAlias);
759
+ await assert.rejects(() => backend.delete(alias, { expectedVersion: version }), isAlias);
760
+ assert.deepEqual(await backend.list("concepts/"), [id]);
761
+ }
762
+ else {
763
+ await assert.rejects(() => backend.read(alias), isEnoent);
764
+ await assert.rejects(() => backend.readMany([id, alias]), isEnoent);
765
+ assert.equal(await backend.exists(alias), false);
766
+ assert.deepEqual(await backend.versions(alias), []);
767
+ assert.equal(await backend.delete(alias), false);
768
+ const aliasVersion = await backend.write(alias, doc(alias, "alias"), { expectedVersion: null });
769
+ assert.notEqual(aliasVersion, version);
770
+ assert.equal((await backend.read(alias)).doc.body.trimEnd(), "alias");
771
+ assert.deepEqual((await backend.list("concepts/")).sort(), [id, alias].sort());
772
+ assert.equal(await backend.delete(alias, { expectedVersion: aliasVersion }), true);
773
+ }
774
+ const canonical = await backend.read(id);
775
+ assert.equal(canonical.version, version);
776
+ assert.equal(canonical.doc.body.trimEnd(), "canonical");
777
+ assert.equal(await backend.exists(id), true);
778
+ });
779
+ });
780
+ }
781
+ test(`${name} contract: reserved-file directory alias is refused where the host aliases case and distinct otherwise`, async () => {
782
+ await withIdentityFixture(async (backend, host) => {
783
+ const aliasing = host.case; // "Docs" vs "docs" is a case pair only
784
+ const version = await backend.writeReserved("Docs", "index.md", "# Docs\n");
785
+ if (aliasing) {
786
+ await assert.rejects(() => backend.readReserved("docs", "index.md"), isAlias);
787
+ await assert.rejects(() => backend.writeReserved("docs", "index.md", "# docs\n"), isAlias);
788
+ await assert.rejects(() => backend.writeReserved("docs", "index.md", "# docs\n", { expectedVersion: null }), isAlias);
789
+ }
790
+ else {
791
+ assert.equal(await backend.readReserved("docs", "index.md"), null);
792
+ const other = await backend.writeReserved("docs", "index.md", "# docs\n", { expectedVersion: null });
793
+ assert.notEqual(other, version);
794
+ assert.equal((await backend.readReserved("docs", "index.md"))?.content, "# docs\n");
795
+ }
796
+ const canonical = await backend.readReserved("Docs", "index.md");
797
+ assert.equal(canonical?.content, "# Docs\n");
798
+ assert.equal(canonical?.version, version);
799
+ });
800
+ });
801
+ test(`${name} contract: blob key alias is refused where the host aliases case and distinct otherwise`, async () => {
802
+ await withIdentityFixture(async (backend, host) => {
803
+ const aliasing = host.case; // "Exact.bin" vs "exact.bin" is a case pair only
804
+ const key = "artifacts/Exact.bin";
805
+ const alias = "artifacts/exact.bin";
806
+ const version = await backend.writeBlob(key, enc("canonical"));
807
+ if (aliasing) {
808
+ await assert.rejects(() => backend.readBlob(alias), isAlias);
809
+ await assert.rejects(() => backend.existsBlob(alias), isAlias);
810
+ await assert.rejects(() => backend.writeBlob(alias, enc("alias")), isAlias);
811
+ await assert.rejects(() => backend.writeBlob(alias, enc("alias"), undefined, { expectedVersion: null }), isAlias);
812
+ await assert.rejects(() => backend.deleteBlob(alias), isAlias);
813
+ assert.deepEqual(await backend.listBlobs("artifacts/"), [key]);
814
+ }
815
+ else {
816
+ assert.equal(await backend.readBlob(alias), null);
817
+ assert.equal(await backend.existsBlob(alias), false);
818
+ assert.equal(await backend.deleteBlob(alias), false);
819
+ const other = await backend.writeBlob(alias, enc("alias"), undefined, { expectedVersion: null });
820
+ assert.notEqual(other, version);
821
+ assert.deepEqual((await backend.listBlobs("artifacts/")).sort(), [key, alias].sort());
822
+ assert.equal(await backend.deleteBlob(alias, { expectedVersion: other }), true);
823
+ }
824
+ const canonical = await backend.readBlob(key);
825
+ assert.equal(canonical?.version, version);
826
+ assert.equal(new TextDecoder().decode(canonical?.bytes), "canonical");
827
+ assert.equal(await backend.existsBlob(key), true);
828
+ });
829
+ });
830
+ }
831
+ /** One authored-OKF decision above every adapter, with raw import compatibility beneath it. */
832
+ export function registerOkfAuthoringContract(options) {
833
+ const test = options.test ?? nodeTest;
834
+ test(`${options.name} contract: authored standard refusals preserve raw imported values and versions`, async () => {
835
+ await withFixture(options.create, async (backend) => {
836
+ await backend.writeReserved("", "index.md", "---\nokf_version: '0.2'\n---\n");
837
+ const bundle = { root: "contract", backend };
838
+ const legacy = { type: "Note", sources: [{ resource: false }], generated: ["legacy"] };
839
+ for (const mode of ["create-only", "overwrite", "patch"]) {
840
+ await assert.rejects(mutateDocument({ bundle, id: "authored/refused", mode, onAbsent: "create", registry: EMPTY_REGISTRY, strict: false, buildCandidate: () => ({ frontmatter: { type: "Note", sources: legacy.sources }, body: "x" }) }), /sources\[0\].resource/);
841
+ await assert.rejects(backend.read("authored/refused"));
842
+ }
843
+ await backend.write("authored/legacy", { id: "authored/legacy", frontmatter: legacy, body: "old\n" });
844
+ const edited = await mutateDocument({ bundle, id: "authored/legacy", mode: "patch", registry: EMPTY_REGISTRY, strict: false, buildCandidate: existing => ({ frontmatter: existing.frontmatter, body: "new\n" }) });
845
+ assert.deepEqual(edited.doc.frontmatter.sources, legacy.sources);
846
+ assert.deepEqual(edited.doc.frontmatter.generated, legacy.generated);
847
+ const before = await backend.read("authored/legacy");
848
+ await assert.rejects(mutateDocument({ bundle, id: "authored/legacy", mode: "overwrite", registry: EMPTY_REGISTRY, strict: false, buildCandidate: existing => ({ frontmatter: { ...existing.frontmatter, sources: [...legacy.sources, ...legacy.sources] }, body: "newer\n" }) }), /sources\[1\].resource/);
849
+ assert.deepEqual(await backend.read("authored/legacy"), before);
850
+ });
851
+ });
852
+ }
853
+ //# sourceMappingURL=contract.js.map