@superbee/core 0.2.0-pre.4 → 0.2.0-pre.41

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 (628) hide show
  1. package/README.md +1255 -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 +22 -2
  7. package/dist/backend.d.ts.map +1 -1
  8. package/dist/backend.js +153 -38
  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-replace-guards.d.ts +52 -0
  19. package/dist/body-replace-guards.d.ts.map +1 -0
  20. package/dist/body-replace-guards.js +176 -0
  21. package/dist/body-replace-guards.js.map +1 -0
  22. package/dist/builtin-recipes/content.d.ts +93 -0
  23. package/dist/builtin-recipes/content.d.ts.map +1 -0
  24. package/dist/builtin-recipes/content.js +288 -0
  25. package/dist/builtin-recipes/content.js.map +1 -0
  26. package/dist/builtin-recipes.d.ts +10 -0
  27. package/dist/builtin-recipes.d.ts.map +1 -0
  28. package/dist/builtin-recipes.js +97 -0
  29. package/dist/builtin-recipes.js.map +1 -0
  30. package/dist/bundle-health/index.d.ts +14 -0
  31. package/dist/bundle-health/index.d.ts.map +1 -0
  32. package/dist/bundle-health/index.js +12 -0
  33. package/dist/bundle-health/index.js.map +1 -0
  34. package/dist/bundle-health/kind-findings.d.ts +44 -0
  35. package/dist/bundle-health/kind-findings.d.ts.map +1 -0
  36. package/dist/bundle-health/kind-findings.js +68 -0
  37. package/dist/bundle-health/kind-findings.js.map +1 -0
  38. package/dist/bundle-health/legacy-page.d.ts +39 -0
  39. package/dist/bundle-health/legacy-page.d.ts.map +1 -0
  40. package/dist/bundle-health/legacy-page.js +50 -0
  41. package/dist/bundle-health/legacy-page.js.map +1 -0
  42. package/dist/bundle-health/report.d.ts +207 -0
  43. package/dist/bundle-health/report.d.ts.map +1 -0
  44. package/dist/bundle-health/report.js +454 -0
  45. package/dist/bundle-health/report.js.map +1 -0
  46. package/dist/bundle-ops.d.ts +3 -2
  47. package/dist/bundle-ops.d.ts.map +1 -1
  48. package/dist/bundle-ops.js +4 -4
  49. package/dist/bundle-ops.js.map +1 -1
  50. package/dist/bundle.d.ts +3 -4
  51. package/dist/bundle.d.ts.map +1 -1
  52. package/dist/bundle.js +5 -14
  53. package/dist/bundle.js.map +1 -1
  54. package/dist/code-point-order.d.ts +8 -0
  55. package/dist/code-point-order.d.ts.map +1 -0
  56. package/dist/code-point-order.js +20 -0
  57. package/dist/code-point-order.js.map +1 -0
  58. package/dist/code-unit-order.d.ts +15 -0
  59. package/dist/code-unit-order.d.ts.map +1 -0
  60. package/dist/code-unit-order.js +17 -0
  61. package/dist/code-unit-order.js.map +1 -0
  62. package/dist/connector-request.d.ts +112 -0
  63. package/dist/connector-request.d.ts.map +1 -0
  64. package/dist/connector-request.js +495 -0
  65. package/dist/connector-request.js.map +1 -0
  66. package/dist/connectors.d.ts +297 -0
  67. package/dist/connectors.d.ts.map +1 -0
  68. package/dist/connectors.js +1233 -0
  69. package/dist/connectors.js.map +1 -0
  70. package/dist/cross-bundle.d.ts +135 -0
  71. package/dist/cross-bundle.d.ts.map +1 -0
  72. package/dist/cross-bundle.js +191 -0
  73. package/dist/cross-bundle.js.map +1 -0
  74. package/dist/dependencies.d.ts +94 -0
  75. package/dist/dependencies.d.ts.map +1 -0
  76. package/dist/dependencies.js +180 -0
  77. package/dist/dependencies.js.map +1 -0
  78. package/dist/document-codec.d.ts +7 -2
  79. package/dist/document-codec.d.ts.map +1 -1
  80. package/dist/document-codec.js +8 -5
  81. package/dist/document-codec.js.map +1 -1
  82. package/dist/document-field-actions.d.ts +31 -1
  83. package/dist/document-field-actions.d.ts.map +1 -1
  84. package/dist/document-field-actions.js +137 -34
  85. package/dist/document-field-actions.js.map +1 -1
  86. package/dist/document-mutation.d.ts +37 -13
  87. package/dist/document-mutation.d.ts.map +1 -1
  88. package/dist/document-mutation.js +129 -60
  89. package/dist/document-mutation.js.map +1 -1
  90. package/dist/document-transfer.d.ts +208 -0
  91. package/dist/document-transfer.d.ts.map +1 -0
  92. package/dist/document-transfer.js +928 -0
  93. package/dist/document-transfer.js.map +1 -0
  94. package/dist/document-write-policy.d.ts.map +1 -1
  95. package/dist/document-write-policy.js +4 -2
  96. package/dist/document-write-policy.js.map +1 -1
  97. package/dist/domain-model.d.ts +73 -0
  98. package/dist/domain-model.d.ts.map +1 -0
  99. package/dist/domain-model.js +169 -0
  100. package/dist/domain-model.js.map +1 -0
  101. package/dist/engine.d.ts +21 -9
  102. package/dist/engine.d.ts.map +1 -1
  103. package/dist/engine.js +72 -14
  104. package/dist/engine.js.map +1 -1
  105. package/dist/file-journaled-backend-internal.d.ts +21 -0
  106. package/dist/file-journaled-backend-internal.d.ts.map +1 -0
  107. package/dist/file-journaled-backend-internal.js +12 -0
  108. package/dist/file-journaled-backend-internal.js.map +1 -0
  109. package/dist/file-journaled-backend.d.ts +160 -0
  110. package/dist/file-journaled-backend.d.ts.map +1 -0
  111. package/dist/file-journaled-backend.js +1345 -0
  112. package/dist/file-journaled-backend.js.map +1 -0
  113. package/dist/filesystem-host.d.ts +15 -0
  114. package/dist/filesystem-host.d.ts.map +1 -0
  115. package/dist/filesystem-host.js +20 -0
  116. package/dist/filesystem-host.js.map +1 -0
  117. package/dist/filesystem-identity.d.ts +97 -21
  118. package/dist/filesystem-identity.d.ts.map +1 -1
  119. package/dist/filesystem-identity.js +398 -119
  120. package/dist/filesystem-identity.js.map +1 -1
  121. package/dist/filesystem-lock.d.ts +16 -3
  122. package/dist/filesystem-lock.d.ts.map +1 -1
  123. package/dist/filesystem-lock.js +323 -77
  124. package/dist/filesystem-lock.js.map +1 -1
  125. package/dist/filesystem-push-role.d.ts +77 -0
  126. package/dist/filesystem-push-role.d.ts.map +1 -0
  127. package/dist/filesystem-push-role.js +165 -0
  128. package/dist/filesystem-push-role.js.map +1 -0
  129. package/dist/filesystem.d.ts +17 -0
  130. package/dist/filesystem.d.ts.map +1 -0
  131. package/dist/filesystem.js +18 -0
  132. package/dist/filesystem.js.map +1 -0
  133. package/dist/frontmatter.d.ts +8 -6
  134. package/dist/frontmatter.d.ts.map +1 -1
  135. package/dist/frontmatter.js +5 -4
  136. package/dist/frontmatter.js.map +1 -1
  137. package/dist/governed-body-write.d.ts +8 -1
  138. package/dist/governed-body-write.d.ts.map +1 -1
  139. package/dist/governed-body-write.js +9 -2
  140. package/dist/governed-body-write.js.map +1 -1
  141. package/dist/heads-digest.d.ts.map +1 -1
  142. package/dist/heads-digest.js +2 -1
  143. package/dist/heads-digest.js.map +1 -1
  144. package/dist/host-policy-snapshot.d.ts +9 -0
  145. package/dist/host-policy-snapshot.d.ts.map +1 -0
  146. package/dist/host-policy-snapshot.js +33 -0
  147. package/dist/host-policy-snapshot.js.map +1 -0
  148. package/dist/host-text.d.ts +31 -0
  149. package/dist/host-text.d.ts.map +1 -0
  150. package/dist/host-text.js +77 -0
  151. package/dist/host-text.js.map +1 -0
  152. package/dist/hosted-client/binding.d.ts +7 -0
  153. package/dist/hosted-client/binding.d.ts.map +1 -0
  154. package/dist/hosted-client/binding.js +10 -0
  155. package/dist/hosted-client/binding.js.map +1 -0
  156. package/dist/hosted-client/blob-delivery.d.ts +68 -0
  157. package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
  158. package/dist/hosted-client/blob-delivery.js +170 -0
  159. package/dist/hosted-client/blob-delivery.js.map +1 -0
  160. package/dist/hosted-client/blob-write.d.ts +387 -0
  161. package/dist/hosted-client/blob-write.d.ts.map +1 -0
  162. package/dist/hosted-client/blob-write.js +770 -0
  163. package/dist/hosted-client/blob-write.js.map +1 -0
  164. package/dist/hosted-client/bundle-listing.d.ts +46 -0
  165. package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
  166. package/dist/hosted-client/bundle-listing.js +36 -0
  167. package/dist/hosted-client/bundle-listing.js.map +1 -0
  168. package/dist/hosted-client/client.d.ts +219 -0
  169. package/dist/hosted-client/client.d.ts.map +1 -0
  170. package/dist/hosted-client/client.js +309 -0
  171. package/dist/hosted-client/client.js.map +1 -0
  172. package/dist/hosted-client/directory.d.ts +46 -0
  173. package/dist/hosted-client/directory.d.ts.map +1 -0
  174. package/dist/hosted-client/directory.js +74 -0
  175. package/dist/hosted-client/directory.js.map +1 -0
  176. package/dist/hosted-client/errors.d.ts +26 -0
  177. package/dist/hosted-client/errors.d.ts.map +1 -0
  178. package/dist/hosted-client/errors.js +35 -0
  179. package/dist/hosted-client/errors.js.map +1 -0
  180. package/dist/hosted-client/inbox.d.ts +320 -0
  181. package/dist/hosted-client/inbox.d.ts.map +1 -0
  182. package/dist/hosted-client/inbox.js +379 -0
  183. package/dist/hosted-client/inbox.js.map +1 -0
  184. package/dist/hosted-client/index.d.ts +30 -0
  185. package/dist/hosted-client/index.d.ts.map +1 -0
  186. package/dist/hosted-client/index.js +32 -0
  187. package/dist/hosted-client/index.js.map +1 -0
  188. package/dist/hosted-client/journal.d.ts +103 -0
  189. package/dist/hosted-client/journal.d.ts.map +1 -0
  190. package/dist/hosted-client/journal.js +464 -0
  191. package/dist/hosted-client/journal.js.map +1 -0
  192. package/dist/hosted-client/node.d.ts +74 -0
  193. package/dist/hosted-client/node.d.ts.map +1 -0
  194. package/dist/hosted-client/node.js +219 -0
  195. package/dist/hosted-client/node.js.map +1 -0
  196. package/dist/hosted-client/reference.d.ts +12 -0
  197. package/dist/hosted-client/reference.d.ts.map +1 -0
  198. package/dist/hosted-client/reference.js +29 -0
  199. package/dist/hosted-client/reference.js.map +1 -0
  200. package/dist/hosted-client/write.d.ts +217 -0
  201. package/dist/hosted-client/write.d.ts.map +1 -0
  202. package/dist/hosted-client/write.js +418 -0
  203. package/dist/hosted-client/write.js.map +1 -0
  204. package/dist/hosted-transport/answer-rows.d.ts +243 -0
  205. package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
  206. package/dist/hosted-transport/answer-rows.js +457 -0
  207. package/dist/hosted-transport/answer-rows.js.map +1 -0
  208. package/dist/hosted-transport/blob-reads.d.ts +35 -0
  209. package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
  210. package/dist/hosted-transport/blob-reads.js +179 -0
  211. package/dist/hosted-transport/blob-reads.js.map +1 -0
  212. package/dist/hosted-transport/blob-write.d.ts +34 -0
  213. package/dist/hosted-transport/blob-write.d.ts.map +1 -0
  214. package/dist/hosted-transport/blob-write.js +115 -0
  215. package/dist/hosted-transport/blob-write.js.map +1 -0
  216. package/dist/hosted-transport/carrier.d.ts +151 -0
  217. package/dist/hosted-transport/carrier.d.ts.map +1 -0
  218. package/dist/hosted-transport/carrier.js +260 -0
  219. package/dist/hosted-transport/carrier.js.map +1 -0
  220. package/dist/hosted-transport/document-backend.d.ts +74 -0
  221. package/dist/hosted-transport/document-backend.d.ts.map +1 -0
  222. package/dist/hosted-transport/document-backend.js +160 -0
  223. package/dist/hosted-transport/document-backend.js.map +1 -0
  224. package/dist/hosted-transport/history-pages.d.ts +55 -0
  225. package/dist/hosted-transport/history-pages.d.ts.map +1 -0
  226. package/dist/hosted-transport/history-pages.js +69 -0
  227. package/dist/hosted-transport/history-pages.js.map +1 -0
  228. package/dist/hosted-transport/index.d.ts +19 -0
  229. package/dist/hosted-transport/index.d.ts.map +1 -0
  230. package/dist/hosted-transport/index.js +19 -0
  231. package/dist/hosted-transport/index.js.map +1 -0
  232. package/dist/hosted-transport/operations.d.ts +85 -0
  233. package/dist/hosted-transport/operations.d.ts.map +1 -0
  234. package/dist/hosted-transport/operations.js +128 -0
  235. package/dist/hosted-transport/operations.js.map +1 -0
  236. package/dist/hosted-transport/paged-reads.d.ts +87 -0
  237. package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
  238. package/dist/hosted-transport/paged-reads.js +238 -0
  239. package/dist/hosted-transport/paged-reads.js.map +1 -0
  240. package/dist/hosted-transport/read-adapter.d.ts +256 -0
  241. package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
  242. package/dist/hosted-transport/read-adapter.js +568 -0
  243. package/dist/hosted-transport/read-adapter.js.map +1 -0
  244. package/dist/hosted-transport/root-write.d.ts +114 -0
  245. package/dist/hosted-transport/root-write.d.ts.map +1 -0
  246. package/dist/hosted-transport/root-write.js +171 -0
  247. package/dist/hosted-transport/root-write.js.map +1 -0
  248. package/dist/hosted-transport/whole-document-transport.d.ts +204 -0
  249. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
  250. package/dist/hosted-transport/whole-document-transport.js +447 -0
  251. package/dist/hosted-transport/whole-document-transport.js.map +1 -0
  252. package/dist/identity-fold.d.ts +18 -0
  253. package/dist/identity-fold.d.ts.map +1 -0
  254. package/dist/identity-fold.js +22 -0
  255. package/dist/identity-fold.js.map +1 -0
  256. package/dist/index.d.ts +41 -11
  257. package/dist/index.d.ts.map +1 -1
  258. package/dist/index.js +31 -9
  259. package/dist/index.js.map +1 -1
  260. package/dist/indexeddb-backend.d.ts +25 -33
  261. package/dist/indexeddb-backend.d.ts.map +1 -1
  262. package/dist/indexeddb-backend.js +264 -8
  263. package/dist/indexeddb-backend.js.map +1 -1
  264. package/dist/inventory-guard.d.ts +58 -0
  265. package/dist/inventory-guard.d.ts.map +1 -0
  266. package/dist/inventory-guard.js +169 -0
  267. package/dist/inventory-guard.js.map +1 -0
  268. package/dist/journaled-backend.d.ts +149 -9
  269. package/dist/journaled-backend.d.ts.map +1 -1
  270. package/dist/journaled-backend.js +64 -58
  271. package/dist/journaled-backend.js.map +1 -1
  272. package/dist/kind-authoring.d.ts +170 -0
  273. package/dist/kind-authoring.d.ts.map +1 -0
  274. package/dist/kind-authoring.js +452 -0
  275. package/dist/kind-authoring.js.map +1 -0
  276. package/dist/kind-changes.d.ts +45 -0
  277. package/dist/kind-changes.d.ts.map +1 -0
  278. package/dist/kind-changes.js +96 -0
  279. package/dist/kind-changes.js.map +1 -0
  280. package/dist/kind-conformance-error.d.ts +15 -0
  281. package/dist/kind-conformance-error.d.ts.map +1 -0
  282. package/dist/kind-conformance-error.js +20 -0
  283. package/dist/kind-conformance-error.js.map +1 -0
  284. package/dist/kind-coverage.d.ts +99 -0
  285. package/dist/kind-coverage.d.ts.map +1 -0
  286. package/dist/kind-coverage.js +186 -0
  287. package/dist/kind-coverage.js.map +1 -0
  288. package/dist/kind-deprecation.d.ts +32 -0
  289. package/dist/kind-deprecation.d.ts.map +1 -0
  290. package/dist/kind-deprecation.js +141 -0
  291. package/dist/kind-deprecation.js.map +1 -0
  292. package/dist/kind-field-mutation.d.ts +4 -0
  293. package/dist/kind-field-mutation.d.ts.map +1 -1
  294. package/dist/kind-field-mutation.js +28 -3
  295. package/dist/kind-field-mutation.js.map +1 -1
  296. package/dist/kinds-load.js +4 -4
  297. package/dist/kinds-load.js.map +1 -1
  298. package/dist/kinds.d.ts +111 -2
  299. package/dist/kinds.d.ts.map +1 -1
  300. package/dist/kinds.js +386 -20
  301. package/dist/kinds.js.map +1 -1
  302. package/dist/link-emit.d.ts +29 -0
  303. package/dist/link-emit.d.ts.map +1 -0
  304. package/dist/link-emit.js +39 -0
  305. package/dist/link-emit.js.map +1 -0
  306. package/dist/link-types.d.ts +27 -0
  307. package/dist/link-types.d.ts.map +1 -0
  308. package/dist/link-types.js +60 -0
  309. package/dist/link-types.js.map +1 -0
  310. package/dist/links.d.ts +52 -3
  311. package/dist/links.d.ts.map +1 -1
  312. package/dist/links.js +259 -18
  313. package/dist/links.js.map +1 -1
  314. package/dist/managed-document-metadata.d.ts +2 -0
  315. package/dist/managed-document-metadata.d.ts.map +1 -0
  316. package/dist/managed-document-metadata.js +9 -0
  317. package/dist/managed-document-metadata.js.map +1 -0
  318. package/dist/memory-backend.d.ts +3 -0
  319. package/dist/memory-backend.d.ts.map +1 -1
  320. package/dist/memory-backend.js +44 -2
  321. package/dist/memory-backend.js.map +1 -1
  322. package/dist/okf-actor.d.ts +1 -0
  323. package/dist/okf-actor.d.ts.map +1 -1
  324. package/dist/okf-actor.js +1 -0
  325. package/dist/okf-actor.js.map +1 -1
  326. package/dist/okf-authoring.d.ts +4 -0
  327. package/dist/okf-authoring.d.ts.map +1 -0
  328. package/dist/okf-authoring.js +12 -0
  329. package/dist/okf-authoring.js.map +1 -0
  330. package/dist/okf-standard-fields.d.ts +3 -0
  331. package/dist/okf-standard-fields.d.ts.map +1 -1
  332. package/dist/okf-standard-fields.js +3 -0
  333. package/dist/okf-standard-fields.js.map +1 -1
  334. package/dist/path-fold.d.ts +39 -0
  335. package/dist/path-fold.d.ts.map +1 -0
  336. package/dist/path-fold.js +41 -0
  337. package/dist/path-fold.js.map +1 -0
  338. package/dist/paths.d.ts +18 -0
  339. package/dist/paths.d.ts.map +1 -1
  340. package/dist/paths.js +32 -0
  341. package/dist/paths.js.map +1 -1
  342. package/dist/platform.d.ts +13 -2
  343. package/dist/platform.d.ts.map +1 -1
  344. package/dist/platform.js +16 -0
  345. package/dist/platform.js.map +1 -1
  346. package/dist/portable-export.d.ts +119 -0
  347. package/dist/portable-export.d.ts.map +1 -0
  348. package/dist/portable-export.js +501 -0
  349. package/dist/portable-export.js.map +1 -0
  350. package/dist/publication-filesystem.d.ts +1 -1
  351. package/dist/publication-filesystem.d.ts.map +1 -1
  352. package/dist/publication-filesystem.js +1 -1
  353. package/dist/publication-filesystem.js.map +1 -1
  354. package/dist/qualified-links.d.ts +67 -0
  355. package/dist/qualified-links.d.ts.map +1 -0
  356. package/dist/qualified-links.js +117 -0
  357. package/dist/qualified-links.js.map +1 -0
  358. package/dist/query-filter.d.ts +16 -2
  359. package/dist/query-filter.d.ts.map +1 -1
  360. package/dist/query-filter.js +40 -1
  361. package/dist/query-filter.js.map +1 -1
  362. package/dist/query-order.d.ts +22 -0
  363. package/dist/query-order.d.ts.map +1 -0
  364. package/dist/query-order.js +43 -0
  365. package/dist/query-order.js.map +1 -0
  366. package/dist/recipe-lifecycle/errors.d.ts +96 -0
  367. package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
  368. package/dist/recipe-lifecycle/errors.js +122 -0
  369. package/dist/recipe-lifecycle/errors.js.map +1 -0
  370. package/dist/recipe-lifecycle/evolution.d.ts +124 -0
  371. package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
  372. package/dist/recipe-lifecycle/evolution.js +993 -0
  373. package/dist/recipe-lifecycle/evolution.js.map +1 -0
  374. package/dist/recipe-lifecycle/index.d.ts +34 -0
  375. package/dist/recipe-lifecycle/index.d.ts.map +1 -0
  376. package/dist/recipe-lifecycle/index.js +28 -0
  377. package/dist/recipe-lifecycle/index.js.map +1 -0
  378. package/dist/recipe-lifecycle/install.d.ts +155 -0
  379. package/dist/recipe-lifecycle/install.d.ts.map +1 -0
  380. package/dist/recipe-lifecycle/install.js +604 -0
  381. package/dist/recipe-lifecycle/install.js.map +1 -0
  382. package/dist/recipe-lifecycle/legacy-aliases.d.ts +16 -0
  383. package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
  384. package/dist/recipe-lifecycle/legacy-aliases.js +51 -0
  385. package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
  386. package/dist/recipe-lifecycle/retirement-apply.d.ts +59 -0
  387. package/dist/recipe-lifecycle/retirement-apply.d.ts.map +1 -0
  388. package/dist/recipe-lifecycle/retirement-apply.js +165 -0
  389. package/dist/recipe-lifecycle/retirement-apply.js.map +1 -0
  390. package/dist/recipe-lifecycle/retirement.d.ts +89 -0
  391. package/dist/recipe-lifecycle/retirement.d.ts.map +1 -0
  392. package/dist/recipe-lifecycle/retirement.js +347 -0
  393. package/dist/recipe-lifecycle/retirement.js.map +1 -0
  394. package/dist/recipe-lifecycle/stamp.d.ts +151 -0
  395. package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
  396. package/dist/recipe-lifecycle/stamp.js +364 -0
  397. package/dist/recipe-lifecycle/stamp.js.map +1 -0
  398. package/dist/recipe-set-preflight.d.ts +139 -0
  399. package/dist/recipe-set-preflight.d.ts.map +1 -0
  400. package/dist/recipe-set-preflight.js +536 -0
  401. package/dist/recipe-set-preflight.js.map +1 -0
  402. package/dist/recipes.d.ts +29 -1
  403. package/dist/recipes.d.ts.map +1 -1
  404. package/dist/recipes.js +137 -1
  405. package/dist/recipes.js.map +1 -1
  406. package/dist/record-overlay/apply.d.ts +43 -0
  407. package/dist/record-overlay/apply.d.ts.map +1 -0
  408. package/dist/record-overlay/apply.js +527 -0
  409. package/dist/record-overlay/apply.js.map +1 -0
  410. package/dist/record-overlay/canonical.d.ts +22 -0
  411. package/dist/record-overlay/canonical.d.ts.map +1 -0
  412. package/dist/record-overlay/canonical.js +47 -0
  413. package/dist/record-overlay/canonical.js.map +1 -0
  414. package/dist/record-overlay/digest.d.ts +4 -0
  415. package/dist/record-overlay/digest.d.ts.map +1 -0
  416. package/dist/record-overlay/digest.js +11 -0
  417. package/dist/record-overlay/digest.js.map +1 -0
  418. package/dist/record-overlay/errors.d.ts +44 -0
  419. package/dist/record-overlay/errors.d.ts.map +1 -0
  420. package/dist/record-overlay/errors.js +55 -0
  421. package/dist/record-overlay/errors.js.map +1 -0
  422. package/dist/record-overlay/findings.d.ts +5 -0
  423. package/dist/record-overlay/findings.d.ts.map +1 -0
  424. package/dist/record-overlay/findings.js +83 -0
  425. package/dist/record-overlay/findings.js.map +1 -0
  426. package/dist/record-overlay/index.d.ts +23 -0
  427. package/dist/record-overlay/index.d.ts.map +1 -0
  428. package/dist/record-overlay/index.js +21 -0
  429. package/dist/record-overlay/index.js.map +1 -0
  430. package/dist/record-overlay/plan.d.ts +12 -0
  431. package/dist/record-overlay/plan.d.ts.map +1 -0
  432. package/dist/record-overlay/plan.js +285 -0
  433. package/dist/record-overlay/plan.js.map +1 -0
  434. package/dist/record-overlay/policy.d.ts +74 -0
  435. package/dist/record-overlay/policy.d.ts.map +1 -0
  436. package/dist/record-overlay/policy.js +235 -0
  437. package/dist/record-overlay/policy.js.map +1 -0
  438. package/dist/record-overlay/redact.d.ts +3 -0
  439. package/dist/record-overlay/redact.d.ts.map +1 -0
  440. package/dist/record-overlay/redact.js +27 -0
  441. package/dist/record-overlay/redact.js.map +1 -0
  442. package/dist/record-overlay/signal-kind.d.ts +30 -0
  443. package/dist/record-overlay/signal-kind.d.ts.map +1 -0
  444. package/dist/record-overlay/signal-kind.js +38 -0
  445. package/dist/record-overlay/signal-kind.js.map +1 -0
  446. package/dist/record-overlay/signal-text.d.ts +45 -0
  447. package/dist/record-overlay/signal-text.d.ts.map +1 -0
  448. package/dist/record-overlay/signal-text.js +116 -0
  449. package/dist/record-overlay/signal-text.js.map +1 -0
  450. package/dist/record-overlay/source-index.d.ts +19 -0
  451. package/dist/record-overlay/source-index.d.ts.map +1 -0
  452. package/dist/record-overlay/source-index.js +102 -0
  453. package/dist/record-overlay/source-index.js.map +1 -0
  454. package/dist/record-overlay/types.d.ts +291 -0
  455. package/dist/record-overlay/types.d.ts.map +1 -0
  456. package/dist/record-overlay/types.js +2 -0
  457. package/dist/record-overlay/types.js.map +1 -0
  458. package/dist/remote-backend.d.ts +58 -13
  459. package/dist/remote-backend.d.ts.map +1 -1
  460. package/dist/remote-backend.js +156 -36
  461. package/dist/remote-backend.js.map +1 -1
  462. package/dist/remote-document-codec.d.ts +2 -1
  463. package/dist/remote-document-codec.d.ts.map +1 -1
  464. package/dist/remote-document-codec.js +3 -2
  465. package/dist/remote-document-codec.js.map +1 -1
  466. package/dist/remote-error.d.ts +17 -1
  467. package/dist/remote-error.d.ts.map +1 -1
  468. package/dist/remote-error.js +32 -2
  469. package/dist/remote-error.js.map +1 -1
  470. package/dist/remote-operations.d.ts +0 -40
  471. package/dist/remote-operations.d.ts.map +1 -1
  472. package/dist/remote-operations.js +26 -6
  473. package/dist/remote-operations.js.map +1 -1
  474. package/dist/remote-parsers.d.ts +1 -1
  475. package/dist/remote-parsers.js +1 -1
  476. package/dist/search/backend-source.d.ts +6 -0
  477. package/dist/search/backend-source.d.ts.map +1 -0
  478. package/dist/search/backend-source.js +33 -0
  479. package/dist/search/backend-source.js.map +1 -0
  480. package/dist/search/contract.d.ts +151 -0
  481. package/dist/search/contract.d.ts.map +1 -0
  482. package/dist/search/contract.js +78 -0
  483. package/dist/search/contract.js.map +1 -0
  484. package/dist/search/errors.d.ts +30 -0
  485. package/dist/search/errors.d.ts.map +1 -0
  486. package/dist/search/errors.js +50 -0
  487. package/dist/search/errors.js.map +1 -0
  488. package/dist/search/identity.d.ts +12 -0
  489. package/dist/search/identity.d.ts.map +1 -0
  490. package/dist/search/identity.js +90 -0
  491. package/dist/search/identity.js.map +1 -0
  492. package/dist/search/index.d.ts +16 -0
  493. package/dist/search/index.d.ts.map +1 -0
  494. package/dist/search/index.js +15 -0
  495. package/dist/search/index.js.map +1 -0
  496. package/dist/search/memory-source.d.ts +36 -0
  497. package/dist/search/memory-source.d.ts.map +1 -0
  498. package/dist/search/memory-source.js +235 -0
  499. package/dist/search/memory-source.js.map +1 -0
  500. package/dist/search/rank.d.ts +34 -0
  501. package/dist/search/rank.d.ts.map +1 -0
  502. package/dist/search/rank.js +129 -0
  503. package/dist/search/rank.js.map +1 -0
  504. package/dist/search/row-text.d.ts +38 -0
  505. package/dist/search/row-text.d.ts.map +1 -0
  506. package/dist/search/row-text.js +88 -0
  507. package/dist/search/row-text.js.map +1 -0
  508. package/dist/search/search.d.ts +28 -0
  509. package/dist/search/search.d.ts.map +1 -0
  510. package/dist/search/search.js +257 -0
  511. package/dist/search/search.js.map +1 -0
  512. package/dist/search/source.d.ts +67 -0
  513. package/dist/search/source.d.ts.map +1 -0
  514. package/dist/search/source.js +2 -0
  515. package/dist/search/source.js.map +1 -0
  516. package/dist/search/text.d.ts +47 -0
  517. package/dist/search/text.d.ts.map +1 -0
  518. package/dist/search/text.js +150 -0
  519. package/dist/search/text.js.map +1 -0
  520. package/dist/site-capabilities.d.ts +345 -0
  521. package/dist/site-capabilities.d.ts.map +1 -0
  522. package/dist/site-capabilities.js +724 -0
  523. package/dist/site-capabilities.js.map +1 -0
  524. package/dist/source-engine/driver.d.ts +42 -0
  525. package/dist/source-engine/driver.d.ts.map +1 -0
  526. package/dist/source-engine/driver.js +529 -0
  527. package/dist/source-engine/driver.js.map +1 -0
  528. package/dist/source-engine/evidence.d.ts +39 -0
  529. package/dist/source-engine/evidence.d.ts.map +1 -0
  530. package/dist/source-engine/evidence.js +54 -0
  531. package/dist/source-engine/evidence.js.map +1 -0
  532. package/dist/source-engine/guard.d.ts +87 -0
  533. package/dist/source-engine/guard.d.ts.map +1 -0
  534. package/dist/source-engine/guard.js +427 -0
  535. package/dist/source-engine/guard.js.map +1 -0
  536. package/dist/source-engine/index.d.ts +35 -0
  537. package/dist/source-engine/index.d.ts.map +1 -0
  538. package/dist/source-engine/index.js +27 -0
  539. package/dist/source-engine/index.js.map +1 -0
  540. package/dist/source-engine/machine-state.d.ts +87 -0
  541. package/dist/source-engine/machine-state.d.ts.map +1 -0
  542. package/dist/source-engine/machine-state.js +94 -0
  543. package/dist/source-engine/machine-state.js.map +1 -0
  544. package/dist/source-engine/observe.d.ts +10 -0
  545. package/dist/source-engine/observe.d.ts.map +1 -0
  546. package/dist/source-engine/observe.js +276 -0
  547. package/dist/source-engine/observe.js.map +1 -0
  548. package/dist/source-engine/overlay.d.ts +50 -0
  549. package/dist/source-engine/overlay.d.ts.map +1 -0
  550. package/dist/source-engine/overlay.js +114 -0
  551. package/dist/source-engine/overlay.js.map +1 -0
  552. package/dist/source-engine/robots.d.ts +53 -0
  553. package/dist/source-engine/robots.d.ts.map +1 -0
  554. package/dist/source-engine/robots.js +158 -0
  555. package/dist/source-engine/robots.js.map +1 -0
  556. package/dist/source-engine/snapshot.d.ts +104 -0
  557. package/dist/source-engine/snapshot.d.ts.map +1 -0
  558. package/dist/source-engine/snapshot.js +240 -0
  559. package/dist/source-engine/snapshot.js.map +1 -0
  560. package/dist/source-engine/target-consumer.d.ts +12 -0
  561. package/dist/source-engine/target-consumer.d.ts.map +1 -0
  562. package/dist/source-engine/target-consumer.js +15 -0
  563. package/dist/source-engine/target-consumer.js.map +1 -0
  564. package/dist/source-engine/target-descriptor.d.ts +3 -0
  565. package/dist/source-engine/target-descriptor.d.ts.map +1 -0
  566. package/dist/source-engine/target-descriptor.js +26 -0
  567. package/dist/source-engine/target-descriptor.js.map +1 -0
  568. package/dist/source-engine/target.d.ts +82 -0
  569. package/dist/source-engine/target.d.ts.map +1 -0
  570. package/dist/source-engine/target.js +213 -0
  571. package/dist/source-engine/target.js.map +1 -0
  572. package/dist/source-engine/types.d.ts +296 -0
  573. package/dist/source-engine/types.d.ts.map +1 -0
  574. package/dist/source-engine/types.js +2 -0
  575. package/dist/source-engine/types.js.map +1 -0
  576. package/dist/source-harness/conformance.d.ts +16 -0
  577. package/dist/source-harness/conformance.d.ts.map +1 -0
  578. package/dist/source-harness/conformance.js +266 -0
  579. package/dist/source-harness/conformance.js.map +1 -0
  580. package/dist/source-harness/fixture.d.ts +97 -0
  581. package/dist/source-harness/fixture.d.ts.map +1 -0
  582. package/dist/source-harness/fixture.js +276 -0
  583. package/dist/source-harness/fixture.js.map +1 -0
  584. package/dist/source-harness/index.d.ts +22 -0
  585. package/dist/source-harness/index.d.ts.map +1 -0
  586. package/dist/source-harness/index.js +19 -0
  587. package/dist/source-harness/index.js.map +1 -0
  588. package/dist/source-harness/peer.d.ts +74 -0
  589. package/dist/source-harness/peer.d.ts.map +1 -0
  590. package/dist/source-harness/peer.js +106 -0
  591. package/dist/source-harness/peer.js.map +1 -0
  592. package/dist/source-profiles/index.d.ts +31 -0
  593. package/dist/source-profiles/index.d.ts.map +1 -0
  594. package/dist/source-profiles/index.js +206 -0
  595. package/dist/source-profiles/index.js.map +1 -0
  596. package/dist/source-profiles/link-header.d.ts +6 -0
  597. package/dist/source-profiles/link-header.d.ts.map +1 -0
  598. package/dist/source-profiles/link-header.js +131 -0
  599. package/dist/source-profiles/link-header.js.map +1 -0
  600. package/dist/storage.d.ts +9 -2
  601. package/dist/storage.d.ts.map +1 -1
  602. package/dist/storage.js +6 -1
  603. package/dist/storage.js.map +1 -1
  604. package/dist/string-identity-agreement.d.ts +35 -0
  605. package/dist/string-identity-agreement.d.ts.map +1 -0
  606. package/dist/string-identity-agreement.js +72 -0
  607. package/dist/string-identity-agreement.js.map +1 -0
  608. package/dist/types.d.ts +41 -6
  609. package/dist/types.d.ts.map +1 -1
  610. package/dist/types.js +0 -10
  611. package/dist/types.js.map +1 -1
  612. package/dist/uncertain-write.d.ts +157 -17
  613. package/dist/uncertain-write.d.ts.map +1 -1
  614. package/dist/uncertain-write.js +86 -30
  615. package/dist/uncertain-write.js.map +1 -1
  616. package/dist/versioning.d.ts +9 -4
  617. package/dist/versioning.d.ts.map +1 -1
  618. package/dist/versioning.js +9 -4
  619. package/dist/versioning.js.map +1 -1
  620. package/dist/view-launch-contract.d.ts +14 -0
  621. package/dist/view-launch-contract.d.ts.map +1 -0
  622. package/dist/view-launch-contract.js +23 -0
  623. package/dist/view-launch-contract.js.map +1 -0
  624. package/dist/write-identity.d.ts +5 -0
  625. package/dist/write-identity.d.ts.map +1 -0
  626. package/dist/write-identity.js +9 -0
  627. package/dist/write-identity.js.map +1 -0
  628. package/package.json +140 -3
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Following the host's page cursor for heads and snapshot. The host serves both a page at a
3
+ * time: a request without `cursor` is the first page, and each page that is not the last names
4
+ * the `next` cursor. Every page is served under the one bundle revision the first page pinned
5
+ * and states the whole listing's `count` and `digest`; a write between pages makes the next page
6
+ * refuse with `409 concurrent_change` rather than mix two states, and the reader starts again.
7
+ *
8
+ * A bundle that fits in one page gets the answer it got before paging, so these helpers only
9
+ * stitch pages together: the assembled heads go through {@link parseHeadsAnswer} and the
10
+ * stitched snapshot body through {@link readSnapshotStream}, which keep deciding what a working
11
+ * copy may trust (the count, the terminator, the digest).
12
+ */
13
+ import { isHeadsDigest } from "../heads-digest.js";
14
+ import { malformed, RemoteError } from "../remote-error.js";
15
+ import { SNAPSHOT_TRUNCATED } from "../remote-parsers.js";
16
+ /** The refusal a page answers when the bundle moved since the first page pinned it. */
17
+ export const PAGE_RESTART_CODE = "concurrent_change";
18
+ /** How many times a heads listing starts again from the first page before the refusal stands. */
19
+ export const HEADS_PAGE_ATTEMPTS = 3;
20
+ /**
21
+ * The pause before each restart, by restart: about a quarter second, then about a second. A burst
22
+ * of writes (an organizer apply, an agent's batch) usually settles within that, where restarts
23
+ * back to back would spend every attempt inside the same burst.
24
+ */
25
+ export const PAGE_RESTART_DELAYS_MS = Object.freeze([250, 1000]);
26
+ /** The pause before restart `restart` (1-based): half the base plus up to half again, at random. */
27
+ export function pageRestartDelay(restart, random = Math.random) {
28
+ const base = PAGE_RESTART_DELAYS_MS[Math.min(restart, PAGE_RESTART_DELAYS_MS.length) - 1];
29
+ return Math.round(base / 2 + (random() * base) / 2);
30
+ }
31
+ /** Waits `ms`, or rejects with the signal's reason once it aborts. */
32
+ export function pause(ms, signal) {
33
+ return new Promise((resolve, reject) => {
34
+ if (signal.aborted)
35
+ return reject(signal.reason);
36
+ const timer = setTimeout(() => {
37
+ signal.removeEventListener("abort", aborted);
38
+ resolve();
39
+ }, ms);
40
+ const aborted = () => {
41
+ clearTimeout(timer);
42
+ reject(signal.reason);
43
+ };
44
+ signal.addEventListener("abort", aborted, { once: true });
45
+ });
46
+ }
47
+ /** The longest cursor a reader passes back; the host's are far shorter. */
48
+ export const MAXIMUM_CURSOR_LENGTH = 4096;
49
+ /** True when `error` is the host's refusal of a page because the bundle moved since the first. */
50
+ export function isPageRestart(error) {
51
+ return error instanceof RemoteError && error.status === 409 && error.code === PAGE_RESTART_CODE;
52
+ }
53
+ /**
54
+ * True when a snapshot ended as truncation because a later page was refused as a restart: the
55
+ * documents changed while the pages streamed. The snapshot cannot start again by itself, since
56
+ * its header and first documents already reached the consumer; the caller that consumes it
57
+ * (a bootstrap or a checkout) runs again, after {@link pageRestartDelay}, a bounded number of
58
+ * times ({@link SNAPSHOT_RESTART_ATTEMPTS}).
59
+ */
60
+ export function isSnapshotRestart(error) {
61
+ return error instanceof RemoteError && error.code === SNAPSHOT_TRUNCATED && isPageRestart(error.cause);
62
+ }
63
+ /** How many times a snapshot consumer runs before a restart truncation stands. */
64
+ export const SNAPSHOT_RESTART_ATTEMPTS = 3;
65
+ /**
66
+ * Runs `consume` (a bootstrap or a checkout over one snapshot) again when it fails with a
67
+ * snapshot restart, pausing before each run, at most `attempts` times in all. Any other failure,
68
+ * and the last restart, stand.
69
+ */
70
+ export async function retrySnapshotRestarts(consume, options) {
71
+ const attempts = options.attempts ?? SNAPSHOT_RESTART_ATTEMPTS;
72
+ for (let attempt = 1;; attempt += 1) {
73
+ try {
74
+ return await consume();
75
+ }
76
+ catch (error) {
77
+ if (attempt >= attempts || !isSnapshotRestart(error))
78
+ throw error;
79
+ await (options.sleep ?? pause)(pageRestartDelay(attempt), options.signal);
80
+ }
81
+ }
82
+ }
83
+ function isCursor(value) {
84
+ return typeof value === "string" && value.length > 0 && value.length <= MAXIMUM_CURSOR_LENGTH;
85
+ }
86
+ export function decodeHeadsPage(value) {
87
+ const body = value;
88
+ if (typeof body !== "object" || body === null || Array.isArray(body))
89
+ throw malformed("heads page is not a JSON object");
90
+ if (typeof body.count !== "number" || !Number.isSafeInteger(body.count) || body.count < 0)
91
+ throw malformed("heads page carries no listing count");
92
+ if (!isHeadsDigest(body.digest))
93
+ throw malformed("heads page carries no well-formed digest");
94
+ if (!Array.isArray(body.heads))
95
+ throw malformed("heads page carries no heads array");
96
+ const heads = body.heads.map((row) => {
97
+ const head = row;
98
+ if (typeof head !== "object" || head === null || typeof head.id !== "string" || typeof head.version !== "string")
99
+ throw malformed("heads page carries a row that is not { id, version }");
100
+ return { id: head.id, version: head.version };
101
+ });
102
+ if (body.next !== undefined && !isCursor(body.next))
103
+ throw malformed("heads page carries a malformed next cursor");
104
+ return { count: body.count, digest: body.digest, heads, ...(body.next === undefined ? {} : { next: body.next }) };
105
+ }
106
+ /**
107
+ * Collects paged heads into the one listing they page. Every page must state the first page's
108
+ * count and digest, rows must strictly ascend by id across pages (so no row repeats), a page that
109
+ * names a next cursor must carry rows, and the rows may never outnumber the count. The caller
110
+ * hands the assembled `{ count, digest, heads }` to the shared heads parser.
111
+ */
112
+ export class HeadsPages {
113
+ #first;
114
+ #rows = [];
115
+ /** Adds a page; answers the cursor of the next page, or undefined once the listing is whole. */
116
+ add(page) {
117
+ const first = (this.#first ??= page);
118
+ if (page.count !== first.count || page.digest !== first.digest)
119
+ throw malformed("heads pages disagree on the listing they page");
120
+ for (const head of page.heads) {
121
+ const last = this.#rows.at(-1);
122
+ if (last !== undefined && !(last.id < head.id))
123
+ throw malformed("heads pages repeat or reorder a row");
124
+ this.#rows.push(head);
125
+ }
126
+ if (this.#rows.length > first.count)
127
+ throw malformed(`heads pages carry more than the ${first.count} row(s) they announce`);
128
+ if (page.next !== undefined && page.heads.length === 0)
129
+ throw malformed("a heads page names a next page but carries no rows");
130
+ return page.next;
131
+ }
132
+ /** The assembled answer, in the unpaged answer's shape. */
133
+ whole() {
134
+ if (!this.#first)
135
+ throw malformed("no heads page arrived");
136
+ return { count: this.#first.count, digest: this.#first.digest, heads: [...this.#rows] };
137
+ }
138
+ }
139
+ /** Complete lines of one NDJSON body as they arrive; a partial trailing line is not yielded. */
140
+ async function* bodyLines(body) {
141
+ const reader = body.getReader();
142
+ const decoder = new TextDecoder();
143
+ let buffered = "";
144
+ try {
145
+ for (;;) {
146
+ const chunk = await reader.read();
147
+ buffered += decoder.decode(chunk.value, { stream: !chunk.done });
148
+ let start = 0;
149
+ for (let newline = buffered.indexOf("\n"); newline !== -1; newline = buffered.indexOf("\n", start)) {
150
+ yield buffered.slice(start, newline);
151
+ start = newline + 1;
152
+ }
153
+ buffered = buffered.slice(start);
154
+ if (chunk.done)
155
+ return;
156
+ }
157
+ }
158
+ finally {
159
+ await reader.cancel().catch(() => undefined);
160
+ }
161
+ }
162
+ function lineRecord(line) {
163
+ try {
164
+ const record = JSON.parse(line);
165
+ return typeof record === "object" && record !== null && !Array.isArray(record) ? record : undefined;
166
+ }
167
+ catch {
168
+ return undefined;
169
+ }
170
+ }
171
+ /** The prefix every document line the host writes begins with; any other line is parsed here. */
172
+ const DOC_LINE = '{"kind":"doc",';
173
+ /**
174
+ * One snapshot body stitched from its pages, in the unpaged grammar: the first page's header,
175
+ * every page's document lines in order, and the last page's `end` terminator. A later page's
176
+ * header must state the first page's count and digest and is dropped; a `page` terminator must
177
+ * count the document lines its page carried and names the cursor `open` fetches next. Anything
178
+ * else passes through verbatim for the snapshot parser to judge, and a page that fails to open
179
+ * or ends early ends the stitched body without its terminator, which the parser reports as
180
+ * truncation. Cancelling the stitched body cancels the page being read.
181
+ */
182
+ export function stitchSnapshotPages(first, open) {
183
+ async function* lines() {
184
+ let body = first;
185
+ let header;
186
+ for (;;) {
187
+ let index = 0;
188
+ let documents = 0;
189
+ let next;
190
+ for await (const line of bodyLines(body)) {
191
+ if (index++ === 0 && header !== undefined) {
192
+ const record = lineRecord(line);
193
+ if (record?.kind !== "snapshot" || record.count !== header.count || record.digest !== header.digest)
194
+ throw malformed("snapshot pages disagree on the header");
195
+ continue;
196
+ }
197
+ if (line.startsWith(DOC_LINE)) {
198
+ documents += 1;
199
+ yield `${line}\n`;
200
+ continue;
201
+ }
202
+ const record = lineRecord(line);
203
+ if (header === undefined && record?.kind === "snapshot")
204
+ header = { count: record.count, digest: record.digest };
205
+ if (record?.kind === "page") {
206
+ if (record.count !== documents || documents === 0 || !isCursor(record.next))
207
+ throw malformed("snapshot page terminator disagrees with its page");
208
+ next = record.next;
209
+ break;
210
+ }
211
+ yield `${line}\n`;
212
+ }
213
+ if (next === undefined)
214
+ return;
215
+ body = await open(next);
216
+ }
217
+ }
218
+ const produced = lines();
219
+ const encoder = new TextEncoder();
220
+ return new ReadableStream({
221
+ async pull(controller) {
222
+ try {
223
+ const step = await produced.next();
224
+ if (step.done)
225
+ controller.close();
226
+ else
227
+ controller.enqueue(encoder.encode(step.value));
228
+ }
229
+ catch (error) {
230
+ controller.error(error);
231
+ }
232
+ },
233
+ async cancel() {
234
+ await produced.return(undefined);
235
+ },
236
+ });
237
+ }
238
+ //# sourceMappingURL=paged-reads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paged-reads.js","sourceRoot":"","sources":["../../src/hosted-transport/paged-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AACrD,iGAAiG;AACjG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAEpF,oGAAoG;AACpG,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,SAAuB,IAAI,CAAC,MAAM;IAClF,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,sBAAsB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAC;IAC3F,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAmB;IACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EA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KAAK,SAAS;gBAAE,OAAO;YAC/B,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,OAAO,IAAI,cAAc,CAAa;QACpC,KAAK,CAAC,IAAI,CAAC,UAAU;YACnB,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,IAAI,IAAI,CAAC,IAAI;oBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;;oBAC7B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACtD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QACD,KAAK,CAAC,MAAM;YACV,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,256 @@
1
+ /**
2
+ * The working copy's read side over a hosted bundle: a `StorageBackend` that also carries
3
+ * `heads`, `snapshot` and `wireCapabilities`, so the shared bootstrap and pull verbs take their
4
+ * wire path against it. It answers only what those verbs call and refuses the rest before any
5
+ * request leaves; every mutation is refused, because edits leave through the write transport.
6
+ *
7
+ * Refusals follow {@link READ_ANSWER_ROWS}: an authority refusal is a `RemoteError` with the
8
+ * host's status and code, which the shared runtime classifies; a `503` says nothing about the
9
+ * bundle, so it is the carrier's `unavailable` and the runtime reports itself offline. A read
10
+ * the host answers `document_not_found` is an ENOENT-shaped rejection, as every backend answers
11
+ * absence.
12
+ *
13
+ * The capabilities answer (flags, bound, root, retention window) is read once and held. Every
14
+ * heads answer states the root's version; one that differs from the held answer's root drops
15
+ * it, so the root and the edition it declares are as new as the listing. Any authority refusal
16
+ * drops it too.
17
+ *
18
+ * The host serves heads and snapshot a page at a time; a bundle that fits in one page gets one
19
+ * answer, as before paging. The adapter follows the `next` cursor (`paged-reads.ts`) and hands
20
+ * the verbs the same whole listing and the same one snapshot body.
21
+ */
22
+ import { RemoteError } from "../remote-error.js";
23
+ import { type HeadsResult, type RemoteSnapshot } from "../remote-parsers.js";
24
+ import type { HeadsOptions, WireCapabilities } from "../remote-backend.js";
25
+ import type { ConceptId, ReadResult, StorageBackend } from "../types.js";
26
+ import { HostedCarrierError, type HostedCarrier } from "./carrier.js";
27
+ /** What a capabilities answer says about changing the bundle's model (its Kind conventions). */
28
+ export type HostedDefinitionWrites = "allowed" | "refused";
29
+ /** What the capabilities route states about one bundle, beyond the wire booleans. */
30
+ export interface HostedCapabilities {
31
+ readonly heads: boolean;
32
+ readonly snapshot: boolean;
33
+ readonly operations: boolean;
34
+ /** The inventory bound and the per-document byte bound the host serves a working copy within. */
35
+ readonly bound: Readonly<{
36
+ documents: number;
37
+ bytes: number;
38
+ }>;
39
+ /**
40
+ * The inventory bound a host that pages serves a bundle within (each page within
41
+ * `bound.documents`), or `null` for a host from before paging, which serves only
42
+ * `bound.documents` in one answer.
43
+ */
44
+ readonly paged: Readonly<{
45
+ documents: number;
46
+ }> | null;
47
+ /** The bundle root's reserved `index.md` as exact bytes with its version, or `null` without one. */
48
+ readonly root: Readonly<{
49
+ content: string;
50
+ version: string;
51
+ }> | null;
52
+ /** How long the host keeps a request identity, in milliseconds (stated, or the thirty-day default). */
53
+ readonly operationsRetentionMs: number;
54
+ /**
55
+ * Whether the caller may change this bundle's model (its Kind conventions) through the identified
56
+ * writes: `null` when the host does not say (a host or workspace without model changes), else
57
+ * what it says. Any value other than `"allowed"` reads as `"refused"`.
58
+ */
59
+ readonly definitionWrites: HostedDefinitionWrites | null;
60
+ /**
61
+ * Whether the caller may replace the bundle's root `index.md` (`bundles.root.replace.v1`): only
62
+ * an answer that says `"allowed"` does; a host from before the root write says nothing, which
63
+ * reads as `"refused"`, as does any other value.
64
+ */
65
+ readonly rootWrites: "allowed" | "refused";
66
+ /**
67
+ * The host's whole-document write bound (`limits.documentInputBytes`): the largest create,
68
+ * replace or outcome request body it accepts, in bytes of JSON. `null` when the host does not
69
+ * state one; a client then assumes 65,536, the bound of every host before it was stated.
70
+ */
71
+ readonly documentInputBytes: number | null;
72
+ /** Ordinary-file routes are admitted independently of document writes. Absent means refused. */
73
+ readonly blobReads?: "allowed" | "refused";
74
+ readonly blobWrites?: "allowed" | "refused";
75
+ /** Independent advertised byte bounds; absent or malformed statements read as null. */
76
+ readonly blobReadBytes?: number | null;
77
+ readonly blobWriteBytes?: number | null;
78
+ }
79
+ /** The retention window assumed for a host that states none: thirty days. */
80
+ export declare const DEFAULT_OPERATIONS_RETENTION_MS: number;
81
+ /**
82
+ * How long before the window ends an absent outcome stops being trusted: the host expires rows
83
+ * by its own clock and the client measures an intent's age by its own, so the last hour of the
84
+ * window is treated as already expired.
85
+ */
86
+ export declare const OPERATIONS_RETENTION_SKEW_MS: number;
87
+ /** The header every heads answer carries: the root's content version, or {@link ROOT_VERSION_ABSENT}. */
88
+ export declare const ROOT_VERSION_HEADER = "X-Superbee-Root-Version";
89
+ export declare const ROOT_VERSION_ABSENT = "none";
90
+ /** The root version a heads answer states: a version, `null` for the absent marker, `undefined` when malformed. */
91
+ export declare function decodeRootVersion(value: string | null): string | null | undefined;
92
+ export declare const HOSTED_READ_BOUNDS: Readonly<{
93
+ /** A capabilities answer carries the root's exact bytes, bounded like one document read. */
94
+ capabilitiesBytes: number;
95
+ /** A heads listing at the inventory bound is a few hundred KiB; four MiB is a safe superset. */
96
+ headsBytes: number;
97
+ /** One document read's answer, and one snapshot line. */
98
+ documentBytes: number;
99
+ /** One history page's answer: the host bounds `documents.history.v1` at 1 MiB; the slack is the envelope's. */
100
+ historyBytes: number;
101
+ /** The operation listing's answer: at most 200 descriptors, each with its two JSON Schemas. */
102
+ operationsBytes: number;
103
+ /** Any one operation run's answer; the operation's own `maximumOutputBytes` is lower when it says so. */
104
+ runBytes: number;
105
+ /** The most bytes one run's input may take, as a caller serializes it (the CLI's --input, MCP's run_operation). */
106
+ runInputBytes: number;
107
+ /** The most operation descriptors one listing admits; the rest are dropped with a note. */
108
+ operations: 200;
109
+ /** The deepest nesting (objects and arrays, the schema itself level 1) a descriptor's schema may have. */
110
+ operationSchemaDepth: 32;
111
+ /** An operation title's and description's length, in UTF-16 units, once stripped. */
112
+ operationTitleChars: 200;
113
+ operationDescriptionChars: 2048;
114
+ /** The deepest nesting (objects and arrays, the data itself level 1) a run's data may have. */
115
+ runDepth: 256;
116
+ /** Document reads in flight at once, whatever concurrency a caller's batches ask for. */
117
+ readConcurrency: 8;
118
+ }>;
119
+ /** The routes one client family reads; the browser's are the defaults. */
120
+ export interface HostedReadRoutes {
121
+ capabilities: string;
122
+ heads: string;
123
+ snapshot: string;
124
+ read: string;
125
+ }
126
+ export declare const BROWSER_READ_ROUTES: HostedReadRoutes;
127
+ export declare const SYNC_READ_ROUTES: HostedReadRoutes;
128
+ export declare class HostedReadAdapterError extends Error {
129
+ readonly name = "HostedReadAdapterError";
130
+ readonly code: "read_only" | "unsupported";
131
+ constructor(code: "read_only" | "unsupported");
132
+ }
133
+ export interface HostedReadAdapterOptions {
134
+ carrier: HostedCarrier;
135
+ bundleId: string;
136
+ routes?: HostedReadRoutes;
137
+ /** Pinned on every document read, when the family binds reads (the browser's recovery target). */
138
+ binding?: string;
139
+ /** Test seam: how the adapter waits before a heads restart. Default: a timer that the adapter's abort cancels. */
140
+ sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
141
+ }
142
+ export interface HostedReadAdapter extends StorageBackend {
143
+ heads(options?: HeadsOptions): Promise<HeadsResult | null>;
144
+ snapshot(): Promise<RemoteSnapshot>;
145
+ wireCapabilities(): Promise<WireCapabilities>;
146
+ hostedCapabilities(): Promise<HostedCapabilities>;
147
+ operationsRetentionMs(): Promise<number>;
148
+ /** Aborts every request in flight as a carrier failure and refuses every later one. */
149
+ abort(): void;
150
+ readonly signal: AbortSignal;
151
+ }
152
+ /**
153
+ * The grammar of a refusal code a host may name (`bundle_not_found`, `unknown_operation`, ...).
154
+ * A code is host text that reaches messages and details; anything outside it is never echoed.
155
+ */
156
+ export declare const REFUSAL_CODE: RegExp;
157
+ /** A read route's refusal as the runtime must see it (the `refusal` rows of {@link READ_ANSWER_ROWS}). */
158
+ export declare function readRefusal(answer: {
159
+ status: number;
160
+ body: unknown;
161
+ }): RemoteError | HostedCarrierError;
162
+ /**
163
+ * The whole-document write bound a host states in its `limits`, or `null` when it states none.
164
+ * A malformed statement reads as none (the 65,536 every older host accepts), never as a refusal:
165
+ * the bound only narrows what a client sends.
166
+ */
167
+ export declare function statedDocumentInputBytes(limits: unknown): number | null;
168
+ /** The capabilities route's answer, admitted or refused as one; fields the route may gain are ignored. */
169
+ export declare function decodeHostedCapabilities(value: unknown): HostedCapabilities;
170
+ /**
171
+ * A `documents.read.v1` success, decoded against hosted's result schema
172
+ * (`{ ok: true, operationId, data: { document: { id, frontmatter, body }, version } }`, with an
173
+ * optional `viewActionContext` and `readSnapshot` this reader does not use): the document it names
174
+ * must be the one asked for, at a content version.
175
+ */
176
+ export declare function decodeDocumentRead(id: ConceptId, body: unknown, route?: string): ReadResult;
177
+ /** The operation a hosted history read runs (`POST <sync prefix>/history`). */
178
+ export declare const HISTORY_OPERATION_ID = "documents.history.v1";
179
+ /** The most versions one history page lists (hosted's `READ_LIMITS.documents`). */
180
+ export declare const HISTORY_PAGE_LIMIT = 100;
181
+ /** One page of a document's history, as asked: the newest `limit` versions older than `before`. */
182
+ export interface HostedHistoryRequest {
183
+ readonly documentId: ConceptId;
184
+ /** 1..{@link HISTORY_PAGE_LIMIT}. */
185
+ readonly limit: number;
186
+ /** Only versions with a smaller `seq` are listed. Absent for the first page. */
187
+ readonly before?: number;
188
+ /** Ask for each listed version's stored bytes. */
189
+ readonly includeContent?: boolean;
190
+ }
191
+ /** One version of a document's lineage. `seq` counts the lineage's writes from 1. */
192
+ export interface HostedHistoryVersion {
193
+ readonly seq: number;
194
+ readonly version: string;
195
+ /** The principal that made the write. */
196
+ readonly actor: string;
197
+ readonly timestamp: string;
198
+ /** The agent label the write named, when it named one. */
199
+ readonly agent?: string;
200
+ /** The version's stored bytes, verified against `version`; only when asked for. */
201
+ readonly content?: string;
202
+ }
203
+ export interface HostedHistoryPage {
204
+ readonly documentId: ConceptId;
205
+ /** Newest first. */
206
+ readonly versions: readonly HostedHistoryVersion[];
207
+ /** True when older versions exist before the last one listed. */
208
+ readonly more: boolean;
209
+ /** Every version of the lineage: stated on the first page (no `before`) only. */
210
+ readonly total?: number;
211
+ }
212
+ /** The body a history request sends. */
213
+ export declare function historyInput(bundleId: string, request: HostedHistoryRequest): Record<string, unknown>;
214
+ /**
215
+ * A `documents.history.v1` success, decoded against hosted's result schema
216
+ * (`{ ok: true, operationId, data: { documentId, versions: [{ seq, version, actor, timestamp,
217
+ * agent?, content? }], more, total? } }`) and against the page asked for: the document named,
218
+ * at most `limit` rows, `seq` strictly descending and below `before`, content exactly when asked
219
+ * and hashing to its version, a `more` page that is full, and a first page's `total`. Fields the
220
+ * result may gain are ignored.
221
+ */
222
+ export declare function decodeDocumentHistory(request: HostedHistoryRequest, body: unknown, route?: string): HostedHistoryPage;
223
+ /** An operation's refusal (`ok: false`): the kernel's error code, its message and its retry advice. */
224
+ export interface HostedOperationRefusal {
225
+ readonly code: string;
226
+ readonly message: string;
227
+ readonly retryable: boolean;
228
+ }
229
+ /**
230
+ * The refusal a 200 operation answer carries, or `undefined` for an answer that is not one
231
+ * (`ok` is not `false`). A refusal must name `operationId` and an error code in
232
+ * {@link REFUSAL_CODE}; any other `ok: false` envelope is malformed. The message is host text,
233
+ * stripped of control and format characters. One reading for every kernel operation a hosted
234
+ * client runs.
235
+ */
236
+ export declare function operationRefusal(body: unknown, operationId: string, route?: string): HostedOperationRefusal | undefined;
237
+ /**
238
+ * A route family's own refusal body (`{ error: { code, message, retryable } }`, as capabilities,
239
+ * export and the operation listing answer it), or `undefined` when the body is not one or names a
240
+ * code outside {@link REFUSAL_CODE}. The message is host text, stripped.
241
+ */
242
+ export declare function familyRefusal(answer: {
243
+ body: unknown;
244
+ }): HostedOperationRefusal | undefined;
245
+ /** One history page's answer: the page, or the operation's refusal (`document_not_found` and the kernel's other codes). */
246
+ export type HostedHistoryAnswer = {
247
+ ok: true;
248
+ page: HostedHistoryPage;
249
+ } | {
250
+ ok: false;
251
+ refusal: HostedOperationRefusal;
252
+ };
253
+ /** A 200 history answer, decoded against the page asked for. */
254
+ export declare function decodeHistoryAnswer(request: HostedHistoryRequest, body: unknown, route?: string): HostedHistoryAnswer;
255
+ export declare function createHostedReadAdapter(options: HostedReadAdapterOptions): HostedReadAdapter;
256
+ //# sourceMappingURL=read-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-adapter.d.ts","sourceRoot":"","sources":["../../src/hosted-transport/read-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAsB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAwC,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAwC,cAAc,EAAE,MAAM,aAAa,CAAC;AAI/G,OAAO,EAAE,kBAAkB,EAAqB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGzF,gGAAgG;AAChG,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3D,qFAAqF;AACrF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,Q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