@superbee/core 0.2.0-pre.2 → 0.2.0-pre.20

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 (517) hide show
  1. package/README.md +1000 -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 +19 -1
  7. package/dist/backend.d.ts.map +1 -1
  8. package/dist/backend.js +83 -36
  9. package/dist/backend.js.map +1 -1
  10. package/dist/blob-contract.d.ts +80 -0
  11. package/dist/blob-contract.d.ts.map +1 -0
  12. package/dist/blob-contract.js +131 -0
  13. package/dist/blob-contract.js.map +1 -0
  14. package/dist/blob-journal.d.ts +302 -0
  15. package/dist/blob-journal.d.ts.map +1 -0
  16. package/dist/blob-journal.js +540 -0
  17. package/dist/blob-journal.js.map +1 -0
  18. package/dist/body-replace-guards.d.ts +50 -0
  19. package/dist/body-replace-guards.d.ts.map +1 -0
  20. package/dist/body-replace-guards.js +158 -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 +202 -0
  43. package/dist/bundle-health/report.d.ts.map +1 -0
  44. package/dist/bundle-health/report.js +438 -0
  45. package/dist/bundle-health/report.js.map +1 -0
  46. package/dist/bundle-ops.d.ts +1 -1
  47. package/dist/bundle-ops.d.ts.map +1 -1
  48. package/dist/bundle-ops.js +2 -2
  49. package/dist/bundle-ops.js.map +1 -1
  50. package/dist/bundle.d.ts +2 -1
  51. package/dist/bundle.d.ts.map +1 -1
  52. package/dist/bundle.js +3 -3
  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/connectors.d.ts +230 -0
  59. package/dist/connectors.d.ts.map +1 -0
  60. package/dist/connectors.js +1150 -0
  61. package/dist/connectors.js.map +1 -0
  62. package/dist/cross-bundle.d.ts +135 -0
  63. package/dist/cross-bundle.d.ts.map +1 -0
  64. package/dist/cross-bundle.js +186 -0
  65. package/dist/cross-bundle.js.map +1 -0
  66. package/dist/dependencies.d.ts +94 -0
  67. package/dist/dependencies.d.ts.map +1 -0
  68. package/dist/dependencies.js +180 -0
  69. package/dist/dependencies.js.map +1 -0
  70. package/dist/document-codec.d.ts +6 -1
  71. package/dist/document-codec.d.ts.map +1 -1
  72. package/dist/document-codec.js +8 -4
  73. package/dist/document-codec.js.map +1 -1
  74. package/dist/document-field-actions.d.ts +31 -1
  75. package/dist/document-field-actions.d.ts.map +1 -1
  76. package/dist/document-field-actions.js +137 -34
  77. package/dist/document-field-actions.js.map +1 -1
  78. package/dist/document-mutation.d.ts +22 -10
  79. package/dist/document-mutation.d.ts.map +1 -1
  80. package/dist/document-mutation.js +58 -27
  81. package/dist/document-mutation.js.map +1 -1
  82. package/dist/document-write-policy.d.ts.map +1 -1
  83. package/dist/document-write-policy.js +4 -2
  84. package/dist/document-write-policy.js.map +1 -1
  85. package/dist/engine.d.ts +9 -2
  86. package/dist/engine.d.ts.map +1 -1
  87. package/dist/engine.js +11 -4
  88. package/dist/engine.js.map +1 -1
  89. package/dist/file-journaled-backend-internal.d.ts +21 -0
  90. package/dist/file-journaled-backend-internal.d.ts.map +1 -0
  91. package/dist/file-journaled-backend-internal.js +12 -0
  92. package/dist/file-journaled-backend-internal.js.map +1 -0
  93. package/dist/file-journaled-backend.d.ts +200 -0
  94. package/dist/file-journaled-backend.d.ts.map +1 -0
  95. package/dist/file-journaled-backend.js +1334 -0
  96. package/dist/file-journaled-backend.js.map +1 -0
  97. package/dist/filesystem-host.d.ts +15 -0
  98. package/dist/filesystem-host.d.ts.map +1 -0
  99. package/dist/filesystem-host.js +20 -0
  100. package/dist/filesystem-host.js.map +1 -0
  101. package/dist/filesystem-identity.d.ts +86 -4
  102. package/dist/filesystem-identity.d.ts.map +1 -1
  103. package/dist/filesystem-identity.js +338 -102
  104. package/dist/filesystem-identity.js.map +1 -1
  105. package/dist/filesystem-lock.d.ts +16 -3
  106. package/dist/filesystem-lock.d.ts.map +1 -1
  107. package/dist/filesystem-lock.js +323 -77
  108. package/dist/filesystem-lock.js.map +1 -1
  109. package/dist/filesystem-push-role.d.ts +77 -0
  110. package/dist/filesystem-push-role.d.ts.map +1 -0
  111. package/dist/filesystem-push-role.js +165 -0
  112. package/dist/filesystem-push-role.js.map +1 -0
  113. package/dist/filesystem.d.ts +17 -0
  114. package/dist/filesystem.d.ts.map +1 -0
  115. package/dist/filesystem.js +18 -0
  116. package/dist/filesystem.js.map +1 -0
  117. package/dist/frontmatter.d.ts +8 -0
  118. package/dist/frontmatter.d.ts.map +1 -1
  119. package/dist/frontmatter.js +14 -4
  120. package/dist/frontmatter.js.map +1 -1
  121. package/dist/governed-body-write.d.ts +106 -0
  122. package/dist/governed-body-write.d.ts.map +1 -0
  123. package/dist/governed-body-write.js +251 -0
  124. package/dist/governed-body-write.js.map +1 -0
  125. package/dist/host-policy-snapshot.d.ts +9 -0
  126. package/dist/host-policy-snapshot.d.ts.map +1 -0
  127. package/dist/host-policy-snapshot.js +33 -0
  128. package/dist/host-policy-snapshot.js.map +1 -0
  129. package/dist/host-text.d.ts +31 -0
  130. package/dist/host-text.d.ts.map +1 -0
  131. package/dist/host-text.js +77 -0
  132. package/dist/host-text.js.map +1 -0
  133. package/dist/hosted-client/binding.d.ts +7 -0
  134. package/dist/hosted-client/binding.d.ts.map +1 -0
  135. package/dist/hosted-client/binding.js +10 -0
  136. package/dist/hosted-client/binding.js.map +1 -0
  137. package/dist/hosted-client/blob-delivery.d.ts +67 -0
  138. package/dist/hosted-client/blob-delivery.d.ts.map +1 -0
  139. package/dist/hosted-client/blob-delivery.js +169 -0
  140. package/dist/hosted-client/blob-delivery.js.map +1 -0
  141. package/dist/hosted-client/blob-write.d.ts +386 -0
  142. package/dist/hosted-client/blob-write.d.ts.map +1 -0
  143. package/dist/hosted-client/blob-write.js +770 -0
  144. package/dist/hosted-client/blob-write.js.map +1 -0
  145. package/dist/hosted-client/bundle-listing.d.ts +46 -0
  146. package/dist/hosted-client/bundle-listing.d.ts.map +1 -0
  147. package/dist/hosted-client/bundle-listing.js +36 -0
  148. package/dist/hosted-client/bundle-listing.js.map +1 -0
  149. package/dist/hosted-client/client.d.ts +219 -0
  150. package/dist/hosted-client/client.d.ts.map +1 -0
  151. package/dist/hosted-client/client.js +309 -0
  152. package/dist/hosted-client/client.js.map +1 -0
  153. package/dist/hosted-client/directory.d.ts +46 -0
  154. package/dist/hosted-client/directory.d.ts.map +1 -0
  155. package/dist/hosted-client/directory.js +74 -0
  156. package/dist/hosted-client/directory.js.map +1 -0
  157. package/dist/hosted-client/errors.d.ts +26 -0
  158. package/dist/hosted-client/errors.d.ts.map +1 -0
  159. package/dist/hosted-client/errors.js +35 -0
  160. package/dist/hosted-client/errors.js.map +1 -0
  161. package/dist/hosted-client/inbox.d.ts +320 -0
  162. package/dist/hosted-client/inbox.d.ts.map +1 -0
  163. package/dist/hosted-client/inbox.js +379 -0
  164. package/dist/hosted-client/inbox.js.map +1 -0
  165. package/dist/hosted-client/index.d.ts +30 -0
  166. package/dist/hosted-client/index.d.ts.map +1 -0
  167. package/dist/hosted-client/index.js +32 -0
  168. package/dist/hosted-client/index.js.map +1 -0
  169. package/dist/hosted-client/journal.d.ts +103 -0
  170. package/dist/hosted-client/journal.d.ts.map +1 -0
  171. package/dist/hosted-client/journal.js +464 -0
  172. package/dist/hosted-client/journal.js.map +1 -0
  173. package/dist/hosted-client/node.d.ts +74 -0
  174. package/dist/hosted-client/node.d.ts.map +1 -0
  175. package/dist/hosted-client/node.js +219 -0
  176. package/dist/hosted-client/node.js.map +1 -0
  177. package/dist/hosted-client/reference.d.ts +12 -0
  178. package/dist/hosted-client/reference.d.ts.map +1 -0
  179. package/dist/hosted-client/reference.js +29 -0
  180. package/dist/hosted-client/reference.js.map +1 -0
  181. package/dist/hosted-client/write.d.ts +217 -0
  182. package/dist/hosted-client/write.d.ts.map +1 -0
  183. package/dist/hosted-client/write.js +418 -0
  184. package/dist/hosted-client/write.js.map +1 -0
  185. package/dist/hosted-transport/answer-rows.d.ts +243 -0
  186. package/dist/hosted-transport/answer-rows.d.ts.map +1 -0
  187. package/dist/hosted-transport/answer-rows.js +454 -0
  188. package/dist/hosted-transport/answer-rows.js.map +1 -0
  189. package/dist/hosted-transport/blob-reads.d.ts +35 -0
  190. package/dist/hosted-transport/blob-reads.d.ts.map +1 -0
  191. package/dist/hosted-transport/blob-reads.js +179 -0
  192. package/dist/hosted-transport/blob-reads.js.map +1 -0
  193. package/dist/hosted-transport/blob-write.d.ts +34 -0
  194. package/dist/hosted-transport/blob-write.d.ts.map +1 -0
  195. package/dist/hosted-transport/blob-write.js +115 -0
  196. package/dist/hosted-transport/blob-write.js.map +1 -0
  197. package/dist/hosted-transport/carrier.d.ts +151 -0
  198. package/dist/hosted-transport/carrier.d.ts.map +1 -0
  199. package/dist/hosted-transport/carrier.js +260 -0
  200. package/dist/hosted-transport/carrier.js.map +1 -0
  201. package/dist/hosted-transport/history-pages.d.ts +55 -0
  202. package/dist/hosted-transport/history-pages.d.ts.map +1 -0
  203. package/dist/hosted-transport/history-pages.js +69 -0
  204. package/dist/hosted-transport/history-pages.js.map +1 -0
  205. package/dist/hosted-transport/index.d.ts +18 -0
  206. package/dist/hosted-transport/index.d.ts.map +1 -0
  207. package/dist/hosted-transport/index.js +18 -0
  208. package/dist/hosted-transport/index.js.map +1 -0
  209. package/dist/hosted-transport/operations.d.ts +85 -0
  210. package/dist/hosted-transport/operations.d.ts.map +1 -0
  211. package/dist/hosted-transport/operations.js +128 -0
  212. package/dist/hosted-transport/operations.js.map +1 -0
  213. package/dist/hosted-transport/paged-reads.d.ts +87 -0
  214. package/dist/hosted-transport/paged-reads.d.ts.map +1 -0
  215. package/dist/hosted-transport/paged-reads.js +238 -0
  216. package/dist/hosted-transport/paged-reads.js.map +1 -0
  217. package/dist/hosted-transport/read-adapter.d.ts +256 -0
  218. package/dist/hosted-transport/read-adapter.d.ts.map +1 -0
  219. package/dist/hosted-transport/read-adapter.js +568 -0
  220. package/dist/hosted-transport/read-adapter.js.map +1 -0
  221. package/dist/hosted-transport/root-write.d.ts +114 -0
  222. package/dist/hosted-transport/root-write.d.ts.map +1 -0
  223. package/dist/hosted-transport/root-write.js +171 -0
  224. package/dist/hosted-transport/root-write.js.map +1 -0
  225. package/dist/hosted-transport/whole-document-transport.d.ts +204 -0
  226. package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -0
  227. package/dist/hosted-transport/whole-document-transport.js +447 -0
  228. package/dist/hosted-transport/whole-document-transport.js.map +1 -0
  229. package/dist/index.d.ts +34 -10
  230. package/dist/index.d.ts.map +1 -1
  231. package/dist/index.js +26 -8
  232. package/dist/index.js.map +1 -1
  233. package/dist/indexeddb-backend.d.ts +28 -6
  234. package/dist/indexeddb-backend.d.ts.map +1 -1
  235. package/dist/indexeddb-backend.js +471 -92
  236. package/dist/indexeddb-backend.js.map +1 -1
  237. package/dist/journaled-backend.d.ts +247 -10
  238. package/dist/journaled-backend.d.ts.map +1 -1
  239. package/dist/journaled-backend.js +302 -1
  240. package/dist/journaled-backend.js.map +1 -1
  241. package/dist/kind-authoring.d.ts +170 -0
  242. package/dist/kind-authoring.d.ts.map +1 -0
  243. package/dist/kind-authoring.js +451 -0
  244. package/dist/kind-authoring.js.map +1 -0
  245. package/dist/kind-conformance-error.d.ts +15 -0
  246. package/dist/kind-conformance-error.d.ts.map +1 -0
  247. package/dist/kind-conformance-error.js +20 -0
  248. package/dist/kind-conformance-error.js.map +1 -0
  249. package/dist/kind-coverage.d.ts +99 -0
  250. package/dist/kind-coverage.d.ts.map +1 -0
  251. package/dist/kind-coverage.js +186 -0
  252. package/dist/kind-coverage.js.map +1 -0
  253. package/dist/kind-field-mutation.d.ts +4 -0
  254. package/dist/kind-field-mutation.d.ts.map +1 -1
  255. package/dist/kind-field-mutation.js +28 -3
  256. package/dist/kind-field-mutation.js.map +1 -1
  257. package/dist/kinds-load.js +4 -4
  258. package/dist/kinds-load.js.map +1 -1
  259. package/dist/kinds.d.ts +65 -2
  260. package/dist/kinds.d.ts.map +1 -1
  261. package/dist/kinds.js +341 -21
  262. package/dist/kinds.js.map +1 -1
  263. package/dist/link-types.d.ts +26 -0
  264. package/dist/link-types.d.ts.map +1 -0
  265. package/dist/link-types.js +57 -0
  266. package/dist/link-types.js.map +1 -0
  267. package/dist/links.d.ts +21 -3
  268. package/dist/links.d.ts.map +1 -1
  269. package/dist/links.js +213 -14
  270. package/dist/links.js.map +1 -1
  271. package/dist/managed-document-metadata.d.ts +2 -0
  272. package/dist/managed-document-metadata.d.ts.map +1 -0
  273. package/dist/managed-document-metadata.js +9 -0
  274. package/dist/managed-document-metadata.js.map +1 -0
  275. package/dist/memory-backend.d.ts +2 -2
  276. package/dist/memory-backend.d.ts.map +1 -1
  277. package/dist/memory-backend.js +26 -11
  278. package/dist/memory-backend.js.map +1 -1
  279. package/dist/paths.d.ts +16 -0
  280. package/dist/paths.d.ts.map +1 -1
  281. package/dist/paths.js +25 -0
  282. package/dist/paths.js.map +1 -1
  283. package/dist/platform.d.ts +13 -2
  284. package/dist/platform.d.ts.map +1 -1
  285. package/dist/platform.js +16 -0
  286. package/dist/platform.js.map +1 -1
  287. package/dist/portable-export.d.ts +119 -0
  288. package/dist/portable-export.d.ts.map +1 -0
  289. package/dist/portable-export.js +501 -0
  290. package/dist/portable-export.js.map +1 -0
  291. package/dist/publication-filesystem.d.ts +1 -1
  292. package/dist/publication-filesystem.d.ts.map +1 -1
  293. package/dist/publication-filesystem.js +1 -1
  294. package/dist/publication-filesystem.js.map +1 -1
  295. package/dist/qualified-links.d.ts +67 -0
  296. package/dist/qualified-links.d.ts.map +1 -0
  297. package/dist/qualified-links.js +117 -0
  298. package/dist/qualified-links.js.map +1 -0
  299. package/dist/query-filter.d.ts +16 -2
  300. package/dist/query-filter.d.ts.map +1 -1
  301. package/dist/query-filter.js +40 -1
  302. package/dist/query-filter.js.map +1 -1
  303. package/dist/query-order.d.ts +22 -0
  304. package/dist/query-order.d.ts.map +1 -0
  305. package/dist/query-order.js +42 -0
  306. package/dist/query-order.js.map +1 -0
  307. package/dist/recipe-lifecycle/errors.d.ts +94 -0
  308. package/dist/recipe-lifecycle/errors.d.ts.map +1 -0
  309. package/dist/recipe-lifecycle/errors.js +122 -0
  310. package/dist/recipe-lifecycle/errors.js.map +1 -0
  311. package/dist/recipe-lifecycle/evolution.d.ts +75 -0
  312. package/dist/recipe-lifecycle/evolution.d.ts.map +1 -0
  313. package/dist/recipe-lifecycle/evolution.js +789 -0
  314. package/dist/recipe-lifecycle/evolution.js.map +1 -0
  315. package/dist/recipe-lifecycle/index.d.ts +24 -0
  316. package/dist/recipe-lifecycle/index.d.ts.map +1 -0
  317. package/dist/recipe-lifecycle/index.js +20 -0
  318. package/dist/recipe-lifecycle/index.js.map +1 -0
  319. package/dist/recipe-lifecycle/install.d.ts +126 -0
  320. package/dist/recipe-lifecycle/install.d.ts.map +1 -0
  321. package/dist/recipe-lifecycle/install.js +511 -0
  322. package/dist/recipe-lifecycle/install.js.map +1 -0
  323. package/dist/recipe-lifecycle/legacy-aliases.d.ts +16 -0
  324. package/dist/recipe-lifecycle/legacy-aliases.d.ts.map +1 -0
  325. package/dist/recipe-lifecycle/legacy-aliases.js +51 -0
  326. package/dist/recipe-lifecycle/legacy-aliases.js.map +1 -0
  327. package/dist/recipe-lifecycle/stamp.d.ts +136 -0
  328. package/dist/recipe-lifecycle/stamp.d.ts.map +1 -0
  329. package/dist/recipe-lifecycle/stamp.js +326 -0
  330. package/dist/recipe-lifecycle/stamp.js.map +1 -0
  331. package/dist/recipes.d.ts +29 -1
  332. package/dist/recipes.d.ts.map +1 -1
  333. package/dist/recipes.js +137 -1
  334. package/dist/recipes.js.map +1 -1
  335. package/dist/record-overlay/apply.d.ts +43 -0
  336. package/dist/record-overlay/apply.d.ts.map +1 -0
  337. package/dist/record-overlay/apply.js +527 -0
  338. package/dist/record-overlay/apply.js.map +1 -0
  339. package/dist/record-overlay/canonical.d.ts +22 -0
  340. package/dist/record-overlay/canonical.d.ts.map +1 -0
  341. package/dist/record-overlay/canonical.js +47 -0
  342. package/dist/record-overlay/canonical.js.map +1 -0
  343. package/dist/record-overlay/digest.d.ts +4 -0
  344. package/dist/record-overlay/digest.d.ts.map +1 -0
  345. package/dist/record-overlay/digest.js +11 -0
  346. package/dist/record-overlay/digest.js.map +1 -0
  347. package/dist/record-overlay/errors.d.ts +44 -0
  348. package/dist/record-overlay/errors.d.ts.map +1 -0
  349. package/dist/record-overlay/errors.js +55 -0
  350. package/dist/record-overlay/errors.js.map +1 -0
  351. package/dist/record-overlay/findings.d.ts +5 -0
  352. package/dist/record-overlay/findings.d.ts.map +1 -0
  353. package/dist/record-overlay/findings.js +83 -0
  354. package/dist/record-overlay/findings.js.map +1 -0
  355. package/dist/record-overlay/index.d.ts +23 -0
  356. package/dist/record-overlay/index.d.ts.map +1 -0
  357. package/dist/record-overlay/index.js +21 -0
  358. package/dist/record-overlay/index.js.map +1 -0
  359. package/dist/record-overlay/plan.d.ts +12 -0
  360. package/dist/record-overlay/plan.d.ts.map +1 -0
  361. package/dist/record-overlay/plan.js +285 -0
  362. package/dist/record-overlay/plan.js.map +1 -0
  363. package/dist/record-overlay/policy.d.ts +69 -0
  364. package/dist/record-overlay/policy.d.ts.map +1 -0
  365. package/dist/record-overlay/policy.js +228 -0
  366. package/dist/record-overlay/policy.js.map +1 -0
  367. package/dist/record-overlay/redact.d.ts +3 -0
  368. package/dist/record-overlay/redact.d.ts.map +1 -0
  369. package/dist/record-overlay/redact.js +27 -0
  370. package/dist/record-overlay/redact.js.map +1 -0
  371. package/dist/record-overlay/signal-kind.d.ts +30 -0
  372. package/dist/record-overlay/signal-kind.d.ts.map +1 -0
  373. package/dist/record-overlay/signal-kind.js +38 -0
  374. package/dist/record-overlay/signal-kind.js.map +1 -0
  375. package/dist/record-overlay/signal-text.d.ts +45 -0
  376. package/dist/record-overlay/signal-text.d.ts.map +1 -0
  377. package/dist/record-overlay/signal-text.js +116 -0
  378. package/dist/record-overlay/signal-text.js.map +1 -0
  379. package/dist/record-overlay/source-index.d.ts +19 -0
  380. package/dist/record-overlay/source-index.d.ts.map +1 -0
  381. package/dist/record-overlay/source-index.js +102 -0
  382. package/dist/record-overlay/source-index.js.map +1 -0
  383. package/dist/record-overlay/types.d.ts +291 -0
  384. package/dist/record-overlay/types.d.ts.map +1 -0
  385. package/dist/record-overlay/types.js +2 -0
  386. package/dist/record-overlay/types.js.map +1 -0
  387. package/dist/remote-backend.d.ts +67 -67
  388. package/dist/remote-backend.d.ts.map +1 -1
  389. package/dist/remote-backend.js +169 -201
  390. package/dist/remote-backend.js.map +1 -1
  391. package/dist/remote-document-codec.d.ts +15 -0
  392. package/dist/remote-document-codec.d.ts.map +1 -0
  393. package/dist/remote-document-codec.js +103 -0
  394. package/dist/remote-document-codec.js.map +1 -0
  395. package/dist/remote-error.d.ts +38 -0
  396. package/dist/remote-error.d.ts.map +1 -0
  397. package/dist/remote-error.js +59 -0
  398. package/dist/remote-error.js.map +1 -0
  399. package/dist/remote-operations.d.ts +6 -3
  400. package/dist/remote-operations.d.ts.map +1 -1
  401. package/dist/remote-operations.js +23 -5
  402. package/dist/remote-operations.js.map +1 -1
  403. package/dist/remote-parsers.d.ts +86 -0
  404. package/dist/remote-parsers.d.ts.map +1 -0
  405. package/dist/remote-parsers.js +181 -0
  406. package/dist/remote-parsers.js.map +1 -0
  407. package/dist/remote.d.ts +5 -2
  408. package/dist/remote.d.ts.map +1 -1
  409. package/dist/remote.js +5 -1
  410. package/dist/remote.js.map +1 -1
  411. package/dist/search/backend-source.d.ts +6 -0
  412. package/dist/search/backend-source.d.ts.map +1 -0
  413. package/dist/search/backend-source.js +33 -0
  414. package/dist/search/backend-source.js.map +1 -0
  415. package/dist/search/contract.d.ts +151 -0
  416. package/dist/search/contract.d.ts.map +1 -0
  417. package/dist/search/contract.js +78 -0
  418. package/dist/search/contract.js.map +1 -0
  419. package/dist/search/errors.d.ts +30 -0
  420. package/dist/search/errors.d.ts.map +1 -0
  421. package/dist/search/errors.js +50 -0
  422. package/dist/search/errors.js.map +1 -0
  423. package/dist/search/identity.d.ts +12 -0
  424. package/dist/search/identity.d.ts.map +1 -0
  425. package/dist/search/identity.js +90 -0
  426. package/dist/search/identity.js.map +1 -0
  427. package/dist/search/index.d.ts +16 -0
  428. package/dist/search/index.d.ts.map +1 -0
  429. package/dist/search/index.js +15 -0
  430. package/dist/search/index.js.map +1 -0
  431. package/dist/search/memory-source.d.ts +36 -0
  432. package/dist/search/memory-source.d.ts.map +1 -0
  433. package/dist/search/memory-source.js +235 -0
  434. package/dist/search/memory-source.js.map +1 -0
  435. package/dist/search/rank.d.ts +34 -0
  436. package/dist/search/rank.d.ts.map +1 -0
  437. package/dist/search/rank.js +129 -0
  438. package/dist/search/rank.js.map +1 -0
  439. package/dist/search/row-text.d.ts +38 -0
  440. package/dist/search/row-text.d.ts.map +1 -0
  441. package/dist/search/row-text.js +88 -0
  442. package/dist/search/row-text.js.map +1 -0
  443. package/dist/search/search.d.ts +28 -0
  444. package/dist/search/search.d.ts.map +1 -0
  445. package/dist/search/search.js +257 -0
  446. package/dist/search/search.js.map +1 -0
  447. package/dist/search/source.d.ts +67 -0
  448. package/dist/search/source.d.ts.map +1 -0
  449. package/dist/search/source.js +2 -0
  450. package/dist/search/source.js.map +1 -0
  451. package/dist/search/text.d.ts +47 -0
  452. package/dist/search/text.d.ts.map +1 -0
  453. package/dist/search/text.js +148 -0
  454. package/dist/search/text.js.map +1 -0
  455. package/dist/site-capabilities.d.ts +339 -0
  456. package/dist/site-capabilities.d.ts.map +1 -0
  457. package/dist/site-capabilities.js +717 -0
  458. package/dist/site-capabilities.js.map +1 -0
  459. package/dist/source-engine/guard.d.ts +82 -0
  460. package/dist/source-engine/guard.d.ts.map +1 -0
  461. package/dist/source-engine/guard.js +396 -0
  462. package/dist/source-engine/guard.js.map +1 -0
  463. package/dist/source-engine/index.d.ts +24 -0
  464. package/dist/source-engine/index.d.ts.map +1 -0
  465. package/dist/source-engine/index.js +20 -0
  466. package/dist/source-engine/index.js.map +1 -0
  467. package/dist/source-engine/machine-state.d.ts +74 -0
  468. package/dist/source-engine/machine-state.d.ts.map +1 -0
  469. package/dist/source-engine/machine-state.js +48 -0
  470. package/dist/source-engine/machine-state.js.map +1 -0
  471. package/dist/source-engine/observe.d.ts +18 -0
  472. package/dist/source-engine/observe.d.ts.map +1 -0
  473. package/dist/source-engine/observe.js +598 -0
  474. package/dist/source-engine/observe.js.map +1 -0
  475. package/dist/source-engine/robots.d.ts +53 -0
  476. package/dist/source-engine/robots.d.ts.map +1 -0
  477. package/dist/source-engine/robots.js +158 -0
  478. package/dist/source-engine/robots.js.map +1 -0
  479. package/dist/source-engine/types.d.ts +285 -0
  480. package/dist/source-engine/types.d.ts.map +1 -0
  481. package/dist/source-engine/types.js +2 -0
  482. package/dist/source-engine/types.js.map +1 -0
  483. package/dist/source-harness/conformance.d.ts +16 -0
  484. package/dist/source-harness/conformance.d.ts.map +1 -0
  485. package/dist/source-harness/conformance.js +265 -0
  486. package/dist/source-harness/conformance.js.map +1 -0
  487. package/dist/source-harness/fixture.d.ts +95 -0
  488. package/dist/source-harness/fixture.d.ts.map +1 -0
  489. package/dist/source-harness/fixture.js +261 -0
  490. package/dist/source-harness/fixture.js.map +1 -0
  491. package/dist/source-harness/index.d.ts +22 -0
  492. package/dist/source-harness/index.d.ts.map +1 -0
  493. package/dist/source-harness/index.js +19 -0
  494. package/dist/source-harness/index.js.map +1 -0
  495. package/dist/source-harness/peer.d.ts +74 -0
  496. package/dist/source-harness/peer.d.ts.map +1 -0
  497. package/dist/source-harness/peer.js +106 -0
  498. package/dist/source-harness/peer.js.map +1 -0
  499. package/dist/storage.d.ts +6 -2
  500. package/dist/storage.d.ts.map +1 -1
  501. package/dist/storage.js +4 -1
  502. package/dist/storage.js.map +1 -1
  503. package/dist/types.d.ts +33 -5
  504. package/dist/types.d.ts.map +1 -1
  505. package/dist/uncertain-write.d.ts +156 -19
  506. package/dist/uncertain-write.d.ts.map +1 -1
  507. package/dist/uncertain-write.js +90 -31
  508. package/dist/uncertain-write.js.map +1 -1
  509. package/dist/versioning.d.ts +9 -4
  510. package/dist/versioning.d.ts.map +1 -1
  511. package/dist/versioning.js +9 -4
  512. package/dist/versioning.js.map +1 -1
  513. package/dist/write-identity.d.ts +5 -0
  514. package/dist/write-identity.d.ts.map +1 -0
  515. package/dist/write-identity.js +9 -0
  516. package/dist/write-identity.js.map +1 -0
  517. package/package.json +94 -2
@@ -0,0 +1,379 @@
1
+ import { HostedCarrierError } from "../hosted-transport/carrier.js";
2
+ import { isWorkspaceTenantId, isAgentLabelVia } from "../hosted-transport/carrier.js";
3
+ import { REFUSAL_CODE } from "../hosted-transport/read-adapter.js";
4
+ import { MalformedAnswer, RemoteError } from "../remote-error.js";
5
+ import { HostedRouteNotServed } from "./errors.js";
6
+ /** The largest inbox answer read, in bytes: 100 entries with full notes and meta fit well inside. */
7
+ export const INBOX_ANSWER_BYTES = 1024 * 1024;
8
+ /** The most a note may hold after normalization, in characters. */
9
+ export const INBOX_NOTE_MAX_LENGTH = 2000;
10
+ // ---------------------------------------------------------------------------------------------
11
+ // The open contract shapes.
12
+ export const ATTENTION_OPERATION_IDS = Object.freeze({
13
+ request: "attention.request.v1",
14
+ cancel: "attention.cancel.v1",
15
+ list: "inbox.list.v1",
16
+ threads: "inbox.threads.v1",
17
+ summary: "inbox.summary.v1",
18
+ get: "inbox.get.v1",
19
+ open: "inbox.open.v1",
20
+ ack: "inbox.ack.v1",
21
+ directory: "members.directory.v1",
22
+ });
23
+ /** The kinds a person's caller may send. `ready` and `review_requested` need a document target. */
24
+ export const PERSON_ITEM_KINDS = ["ready", "needs_input", "review_requested", "reply"];
25
+ /** The kinds the host refuses without a document target. */
26
+ export const TARGET_REQUIRED_KINDS = Object.freeze(["ready", "review_requested"]);
27
+ export const INBOX_ITEM_STATES = ["unread", "read", "acknowledged", "expired", "withdrawn"];
28
+ export const PROVENANCE_SURFACES = ["browser", "mcp", "mcp_agent", "sync", "workload", "ops", "operator_workflow", "host_job"];
29
+ /** In a fact filter's `principalId`, the caller's own principal. */
30
+ export const SELF_PRINCIPAL = "self";
31
+ /** The most members one directory page lists. */
32
+ export const DIRECTORY_PAGE_MAX = 100;
33
+ /** Hosted's principal id shape (a lowercase namespace, a colon, a local part), as superbee-hosted's
34
+ * `namespacedIdPattern` states it. A directory answer naming anything else is malformed, so no id
35
+ * that could read as a flag or carry shell syntax reaches a printed command. */
36
+ export const HOSTED_PRINCIPAL_ID = /^[a-z][a-z0-9._-]{0,31}:[A-Za-z0-9][A-Za-z0-9._@/-]{0,126}$/;
37
+ /** What a directory answer may name: it starts with a letter or digit and holds only id characters,
38
+ * so no id the CLI prints in a ready command can read as a flag or carry shell syntax. */
39
+ const DIRECTORY_PRINCIPAL_ID = /^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$/;
40
+ // ---------------------------------------------------------------------------------------------
41
+ // Refusals.
42
+ /** The codes an attention refusal carries: the operation catalog's, plus the workspace header's. */
43
+ export const ATTENTION_REFUSAL_CODES = [
44
+ "invalid_input",
45
+ "insufficient_scope",
46
+ "attention_disabled",
47
+ "not_found",
48
+ "target_unavailable",
49
+ "target_unsupported",
50
+ "request_conflict",
51
+ "version_conflict",
52
+ "workspace_unsupported",
53
+ "workspace_not_available",
54
+ "quota_exceeded",
55
+ "ticket_expired",
56
+ "internal_error",
57
+ "backend_unavailable",
58
+ "cancelled",
59
+ "deadline_exceeded",
60
+ ];
61
+ const REFUSAL_WORDS = Object.freeze({
62
+ invalid_input: "the host refused the input",
63
+ insufficient_scope: "this sign-in may not use the inbox",
64
+ attention_disabled: "the inbox is not turned on for this workspace",
65
+ not_found: "not available: no such item, not addressed to you, or the recipient is not an active member of this workspace",
66
+ target_unavailable: "the document is not available to you at that version",
67
+ target_unsupported: "this document predates change tracking; save it once and try again",
68
+ request_conflict: "this ticket was already used with a different input",
69
+ version_conflict: "the item changed since it was read",
70
+ workspace_unsupported: "this connection names no single workspace",
71
+ workspace_not_available: "the workspace is not available to this sign-in",
72
+ quota_exceeded: "the request limit for this workspace was reached",
73
+ ticket_expired: "the ticket is too old or too far ahead; send with a new one",
74
+ internal_error: "the host could not complete the operation",
75
+ backend_unavailable: "the inbox is unavailable right now",
76
+ cancelled: "the host cancelled the operation",
77
+ deadline_exceeded: "the host's deadline passed",
78
+ });
79
+ /**
80
+ * The host refused an attention operation. `code` is the catalog's; the message is this client's
81
+ * own. `serverTime` comes with `ticket_expired` (the host's clock, for a caller whose clock is off).
82
+ */
83
+ export class HostedAttentionRefusal extends RemoteError {
84
+ code;
85
+ operationId;
86
+ retryable;
87
+ serverTime;
88
+ /** What the refusal means, in this client's words, without the operation id. */
89
+ reason;
90
+ constructor(operationId, code, status, retryable, serverTime) {
91
+ super(`${operationId}: ${REFUSAL_WORDS[code]}`, code, status);
92
+ this.name = "HostedAttentionRefusal";
93
+ this.reason = REFUSAL_WORDS[code];
94
+ this.code = code;
95
+ this.operationId = operationId;
96
+ this.retryable = retryable;
97
+ if (serverTime !== undefined)
98
+ this.serverTime = serverTime;
99
+ }
100
+ }
101
+ export function isAttentionRefusal(error) {
102
+ return error instanceof HostedAttentionRefusal;
103
+ }
104
+ /**
105
+ * A send whose outcome is unknown after every retry: it may or may not have created the item.
106
+ * Sending again with `ticket` is safe for 24 hours from when it was minted: the host answers the
107
+ * first send's item, or creates it once.
108
+ */
109
+ export class HostedAttentionOutcomeUnknown extends Error {
110
+ code = "attention_outcome_unknown";
111
+ ticket;
112
+ constructor(ticket, cause) {
113
+ super("the send may have reached the host; send again with the same ticket", { cause });
114
+ this.name = "HostedAttentionOutcomeUnknown";
115
+ this.ticket = ticket;
116
+ }
117
+ }
118
+ export function isAttentionOutcomeUnknown(error) {
119
+ return error instanceof HostedAttentionOutcomeUnknown;
120
+ }
121
+ /** A fresh UUIDv7 (RFC 9562): 48-bit millisecond time, version 7, 74 random bits. */
122
+ export function mintAttentionTicket(now = Date.now()) {
123
+ const bytes = new Uint8Array(16);
124
+ globalThis.crypto.getRandomValues(bytes);
125
+ let time = Math.max(0, Math.floor(now));
126
+ for (let index = 5; index >= 0; index -= 1) {
127
+ bytes[index] = time % 256;
128
+ time = Math.floor(time / 256);
129
+ }
130
+ bytes[6] = (bytes[6] & 0x0f) | 0x70;
131
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
132
+ const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
133
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
134
+ }
135
+ const UUID_V7 = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
136
+ /** Whether `value` is a UUIDv7, the shape tickets and thread ids take. */
137
+ export function isAttentionTicket(value) {
138
+ return typeof value === "string" && UUID_V7.test(value);
139
+ }
140
+ /**
141
+ * The inbox of `client`'s person in one workspace, over the client's carrier, prefix and signal
142
+ * (its credential, deadline and abort). A `within` client serves as well: no attention input
143
+ * names a bundle.
144
+ */
145
+ export function createHostedInbox(client, options) {
146
+ const { tenantId } = options;
147
+ if (!isWorkspaceTenantId(tenantId))
148
+ throw new TypeError("a hosted inbox names its workspace by tenant id");
149
+ if (options.via !== undefined && !isAgentLabelVia(options.via))
150
+ throw new TypeError("a hosted inbox's via is not a token the host admits");
151
+ const attempts = Math.max(1, Math.floor(options.sendAttempts ?? 3));
152
+ const retryDelayMs = Math.max(0, options.retryDelayMs ?? 250);
153
+ const now = options.now ?? Date.now;
154
+ async function call(operationId, input, via) {
155
+ const route = `${client.prefix}/attention/${operationId}`;
156
+ const answer = await client.carrier.json(route, input, client.signal, {
157
+ maximum: INBOX_ANSWER_BYTES,
158
+ workspace: tenantId,
159
+ ...(via === undefined ? {} : { via }),
160
+ });
161
+ const body = answer.body;
162
+ if (answer.status === 200 && body?.ok === true) {
163
+ if (body.operationId !== operationId || !isRecord(body.data))
164
+ throw new MalformedAnswer("not an attention answer", route);
165
+ return body.data;
166
+ }
167
+ throw refusalOf(operationId, route, answer.status, body);
168
+ }
169
+ const read = (operationId, input, decode) => call(operationId, input).then((data) => decode(data, `${client.prefix}/attention/${operationId}`));
170
+ return {
171
+ tenantId,
172
+ list: (input = {}) => read(ATTENTION_OPERATION_IDS.list, input, decodeListPage),
173
+ threads: (input = {}) => read(ATTENTION_OPERATION_IDS.threads, input, decodeThreadsPage),
174
+ summary: (input = {}) => read(ATTENTION_OPERATION_IDS.summary, input, decodeSummary),
175
+ get: (itemId) => read(ATTENTION_OPERATION_IDS.get, { itemId }, entryOf),
176
+ open: (itemId) => read(ATTENTION_OPERATION_IDS.open, { itemId }, entryOf),
177
+ ack: (itemId, input) => read(ATTENTION_OPERATION_IDS.ack, { itemId, expectedRevision: input.expectedRevision, ...(input.shownVersion === undefined ? {} : { shownVersion: input.shownVersion }) }, entryOf),
178
+ cancel: (itemId) => read(ATTENTION_OPERATION_IDS.cancel, { itemId }, (data, route) => {
179
+ if (typeof data.itemId !== "string" || !isState(data.state) || !isCount(data.revision))
180
+ throw new MalformedAnswer("not a cancel answer", route);
181
+ return { itemId: data.itemId, state: data.state, revision: data.revision };
182
+ }),
183
+ directory: (input = {}) => read(ATTENTION_OPERATION_IDS.directory, input, decodeDirectoryPage),
184
+ async request(input) {
185
+ const ticket = input.ticket ?? mintAttentionTicket(now());
186
+ if (!isAttentionTicket(ticket))
187
+ throw new TypeError("a ticket is a UUIDv7");
188
+ const body = { ...input, ticket };
189
+ const route = `${client.prefix}/attention/${ATTENTION_OPERATION_IDS.request}`;
190
+ let unclear;
191
+ for (let attempt = 0; attempt < attempts; attempt += 1) {
192
+ if (attempt > 0)
193
+ await pause(retryDelayMs, client.signal);
194
+ try {
195
+ const data = await call(ATTENTION_OPERATION_IDS.request, body, options.via);
196
+ return { ...decodeReceipt(data, route), ticket };
197
+ }
198
+ catch (error) {
199
+ // Once an attempt may have landed, no later answer settles the send: a retry refused
200
+ // before the host reads its ticket (a session ended, a quota spent, a removed member)
201
+ // says nothing about the first delivery, so the ticket must survive for a resend.
202
+ if (unclear !== undefined && !sendMayHaveLanded(error))
203
+ throw new HostedAttentionOutcomeUnknown(ticket, error);
204
+ // Nothing left: the credential was refused before sending, or the caller aborted.
205
+ if (error instanceof HostedCarrierError && error.code === "denied")
206
+ throw error;
207
+ if (!sendMayHaveLanded(error))
208
+ throw error;
209
+ unclear = error;
210
+ if (client.signal.aborted)
211
+ break;
212
+ }
213
+ }
214
+ throw new HostedAttentionOutcomeUnknown(ticket, unclear);
215
+ },
216
+ };
217
+ }
218
+ /** An answer that leaves a send's outcome unknown: no answer, or a refusal the host marks retryable. */
219
+ function sendMayHaveLanded(error) {
220
+ if (error instanceof HostedCarrierError)
221
+ return error.code === "unavailable";
222
+ if (error instanceof HostedAttentionRefusal)
223
+ return error.retryable || error.code === "internal_error";
224
+ if (error instanceof RemoteError && !(error instanceof MalformedAnswer) && !(error instanceof HostedRouteNotServed))
225
+ return error.status >= 500;
226
+ return false;
227
+ }
228
+ function pause(ms, signal) {
229
+ return new Promise((resolve) => {
230
+ if (signal.aborted || ms === 0)
231
+ return resolve();
232
+ const timer = setTimeout(done, ms);
233
+ function done() {
234
+ clearTimeout(timer);
235
+ signal.removeEventListener("abort", done);
236
+ resolve();
237
+ }
238
+ signal.addEventListener("abort", done, { once: true });
239
+ });
240
+ }
241
+ const STATUS_RETRYABLE = new Set(["backend_unavailable", "deadline_exceeded"]);
242
+ /** Every answer but a success, as the typed error it is. Host words never travel. */
243
+ function refusalOf(operationId, route, status, body) {
244
+ // A gateway from before the attention routes: the family's unknown-route answer.
245
+ if (status === 404 && body !== undefined && Object.keys(body).length === 1 && body.error === "not_found")
246
+ return new HostedRouteNotServed(route);
247
+ // The catalog's refusal.
248
+ if (body?.ok === false && isRecord(body.error) && isRefusalCode(body.error.code)) {
249
+ const error = body.error;
250
+ const code = error.code;
251
+ const retryable = typeof error.retryable === "boolean" ? error.retryable : STATUS_RETRYABLE.has(code);
252
+ const serverTime = code === "ticket_expired" && typeof error.serverTime === "number" && Number.isSafeInteger(error.serverTime) ? error.serverTime : undefined;
253
+ return new HostedAttentionRefusal(operationId, code, status, retryable, serverTime);
254
+ }
255
+ // The workspace header's one refusal, the same for every cause.
256
+ if (status === 403 && body?.ok === false && body.code === "workspace_not_available") {
257
+ return new HostedAttentionRefusal(operationId, "workspace_not_available", status, false);
258
+ }
259
+ // The family's own refusals (unauthenticated, an admission that is off or unavailable).
260
+ const familyCode = isRecord(body?.error) ? body.error.code : undefined;
261
+ if (typeof familyCode === "string" && REFUSAL_CODE.test(familyCode))
262
+ return new RemoteError(`hosted ${route} answered ${status} ${familyCode}`, familyCode, status);
263
+ if (status === 401)
264
+ return new RemoteError(`hosted ${route} answered 401`, "unauthenticated", 401);
265
+ if (status >= 500)
266
+ return new RemoteError(`hosted ${route} answered ${status}`, "RUNTIME", status);
267
+ return new MalformedAnswer(`not an attention answer (${status})`, route);
268
+ }
269
+ const isRefusalCode = (value) => typeof value === "string" && ATTENTION_REFUSAL_CODES.includes(value);
270
+ // ---------------------------------------------------------------------------------------------
271
+ // Decoding: the fields a caller relies on are checked; the rest of each record is passed through.
272
+ function isRecord(value) {
273
+ return typeof value === "object" && value !== null && !Array.isArray(value);
274
+ }
275
+ const isCount = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
276
+ const isState = (value) => typeof value === "string" && INBOX_ITEM_STATES.includes(value);
277
+ const isNullableCount = (value) => value === null || isCount(value);
278
+ function decodeEntry(value, route) {
279
+ if (!isRecord(value) ||
280
+ typeof value.itemId !== "string" ||
281
+ !isCount(value.seq) ||
282
+ typeof value.threadId !== "string" ||
283
+ !isCount(value.revision) ||
284
+ typeof value.kind !== "string" ||
285
+ !isState(value.state) ||
286
+ !isRecord(value.recipient) ||
287
+ typeof value.recipient.principalId !== "string" ||
288
+ !isRecord(value.producer) ||
289
+ !isRecord(value.producerDisplay) ||
290
+ !(value.target === null || isRecord(value.target)) ||
291
+ !(value.note === null || typeof value.note === "string") ||
292
+ !(value.meta === null || isRecord(value.meta)) ||
293
+ !isCount(value.createdAt) ||
294
+ !isCount(value.expiresAt) ||
295
+ !isNullableCount(value.readAt) ||
296
+ !isNullableCount(value.acknowledgedAt)) {
297
+ throw new MalformedAnswer("not an inbox entry", route);
298
+ }
299
+ return value;
300
+ }
301
+ function entryOf(data, route) {
302
+ return decodeEntry(data.entry, route);
303
+ }
304
+ function decodeListPage(data, route) {
305
+ if (!Array.isArray(data.entries) || !isNullableCount(data.nextAfterSeq))
306
+ throw new MalformedAnswer("not an inbox page", route);
307
+ return { entries: data.entries.map((entry) => decodeEntry(entry, route)), nextAfterSeq: data.nextAfterSeq };
308
+ }
309
+ function decodeThreadsPage(data, route) {
310
+ if (!Array.isArray(data.threads) || !(data.nextBefore === null || typeof data.nextBefore === "string"))
311
+ throw new MalformedAnswer("not a threads page", route);
312
+ const threads = data.threads.map((thread) => {
313
+ if (!isRecord(thread) ||
314
+ typeof thread.threadId !== "string" ||
315
+ !isRecord(thread.counterpart) ||
316
+ typeof thread.counterpart.principalId !== "string" ||
317
+ !isCount(thread.lastItemAt) ||
318
+ !isCount(thread.openToYou) ||
319
+ !isCount(thread.unreadToYou) ||
320
+ !isCount(thread.openFromYou) ||
321
+ !(thread.last === null || (isRecord(thread.last) && typeof thread.last.itemId === "string" && isState(thread.last.state)))) {
322
+ throw new MalformedAnswer("not a thread", route);
323
+ }
324
+ return thread;
325
+ });
326
+ return { threads, nextBefore: data.nextBefore };
327
+ }
328
+ function decodeSummary(data, route) {
329
+ const count = (value) => {
330
+ if (!isRecord(value) || !isCount(value.count) || typeof value.capped !== "boolean")
331
+ throw new MalformedAnswer("not an inbox summary", route);
332
+ return { count: value.count, capped: value.capped };
333
+ };
334
+ if (!isCount(data.newestSeq))
335
+ throw new MalformedAnswer("not an inbox summary", route);
336
+ return { waitingThreads: count(data.waitingThreads), unreadUpdates: count(data.unreadUpdates), newestSeq: data.newestSeq };
337
+ }
338
+ function decodeDirectoryPage(data, route) {
339
+ if (!Array.isArray(data.members) || !(data.nextAfter === null || (typeof data.nextAfter === "string" && data.nextAfter !== ""))) {
340
+ throw new MalformedAnswer("not a directory page", route);
341
+ }
342
+ const members = data.members.map((member) => {
343
+ if (!isRecord(member) ||
344
+ typeof member.principalId !== "string" ||
345
+ !DIRECTORY_PRINCIPAL_ID.test(member.principalId) ||
346
+ !(member.displayName === null || typeof member.displayName === "string") ||
347
+ !(member.email === undefined || member.email === null || typeof member.email === "string") ||
348
+ typeof member.self !== "boolean") {
349
+ throw new MalformedAnswer("not a directory member", route);
350
+ }
351
+ return {
352
+ principalId: member.principalId,
353
+ displayName: member.displayName,
354
+ ...(member.email === undefined ? {} : { email: member.email }),
355
+ self: member.self,
356
+ };
357
+ });
358
+ return { members, nextAfter: data.nextAfter };
359
+ }
360
+ function decodeReceipt(data, route) {
361
+ const delivery = data.delivery;
362
+ if (typeof data.itemId !== "string" ||
363
+ typeof data.threadId !== "string" ||
364
+ !isCount(data.itemRevision) ||
365
+ typeof data.replayed !== "boolean" ||
366
+ !isRecord(delivery) ||
367
+ delivery.inApp !== "visible" ||
368
+ (delivery.email !== "pending" && delivery.email !== "off")) {
369
+ throw new MalformedAnswer("not an attention receipt", route);
370
+ }
371
+ return {
372
+ itemId: data.itemId,
373
+ threadId: data.threadId,
374
+ itemRevision: data.itemRevision,
375
+ replayed: data.replayed,
376
+ delivery: { inApp: "visible", email: delivery.email },
377
+ };
378
+ }
379
+ //# sourceMappingURL=inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/hosted-client/inbox.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,qGAAqG;AACrG,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C,gGAAgG;AAChG,4BAA4B;AAE5B,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,OAAO,EAAE,sBAAsB;IAC/B,MAAM,EAAE,qBAAqB;IAC7B,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,kBAAkB;IAC3B,OAAO,EA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ACvB,QAAQ,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE;KACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * `@superbee/core/hosted-client`: the headless client of a hosted Superbee's sync route family
3
+ * (`/sync/v1`), a supported public API under core's normal versioning. It is runtime-neutral
4
+ * (`fetch` and Web streams only), so it runs in Node, a browser or a Worker.
5
+ *
6
+ * The caller supplies the target (origin and sync prefix) and an async credential provider; the
7
+ * client supplies identity, the bundle list, reads, history, workspace qualification, operations
8
+ * by id, the one-call document write and the one-call blob write (`writeBlob`, journaled by
9
+ * `driveJournaledBlob`) over `@superbee/core/hosted-transport`, and throws typed errors only.
10
+ * `createHostedInbox` adds a person's inbox in one workspace over the same client, and
11
+ * `readDirectory` with `matchDirectoryMember` finds a teammate where the host offers the directory.
12
+ *
13
+ * Export download is Node-only (its verification needs Node), so it is the separate
14
+ * `@superbee/core/hosted-client/node`; nothing here imports it.
15
+ */
16
+ export { bearerCredentials, createHostedClient, qualifyingCarrier, syncRoutePrefix, type HostedClient, type HostedClientOptions, type HostedClientTarget, type HostedCredentialProvider, type HostedIdentity, type HostedRunOptions, type HostedWorkspace, } from "./client.js";
17
+ export { BUNDLE_LIST_CAP, readBundleListing, type HostedBundleListing, type HostedBundleRow, type HostedListedBundle, } from "./bundle-listing.js";
18
+ export { hostedBundleReferenceText, isWorkspaceSlug, parseHostedBundleReference, type HostedBundleReference, } from "./reference.js";
19
+ export { checkoutBindingDigest } from "./binding.js";
20
+ export { createMemoryIntentStore, HostedIntentsNotListable, INTENTS_NOT_LISTABLE, type HostedIntentStore, type HostedWriteInput, type HostedWriteIntent, type HostedWriteLookupResult, type HostedWriteOptions, type HostedWriteRefusalCode, type HostedWriteResult, } from "./write.js";
21
+ export { HostedBlobWritesNotServed, HostedRouteNotServed, isRouteNotServed, ROUTE_NOT_SERVED } from "./errors.js";
22
+ export { driveJournaledBlob, forgetJournaledBlob, HostedBlobDeletionsNotAccepted, HostedBlobWriteNotSent, type BlobDrivePremises, type BlobDriveSnapshot, type BlobDriveStep, type BlobPin, type HostedBlobDeleteInput, type HostedBlobForgetResult, type HostedBlobHeldWrite, type HostedBlobLookupResult, type HostedBlobOperation, type HostedBlobRefusalCode, type HostedBlobWriteInput, type HostedBlobWriteOptions, type HostedBlobWriteResult, type JournaledBlobContext, type JournaledBlobForgetResult, type JournaledBlobMode, type JournaledBlobResult, } from "./blob-write.js";
23
+ export { createMemoryBlobJournal, type BlobJournaledBackend, type MemoryBlobJournal } from "../blob-journal.js";
24
+ export type { HostedBlobHead, HostedBlobHeads, HostedBlobRead } from "../hosted-transport/index.js";
25
+ export { ATTENTION_OPERATION_IDS, ATTENTION_REFUSAL_CODES, createHostedInbox, DIRECTORY_PAGE_MAX, HOSTED_PRINCIPAL_ID, HostedAttentionOutcomeUnknown, HostedAttentionRefusal, INBOX_ANSWER_BYTES, INBOX_ITEM_STATES, INBOX_NOTE_MAX_LENGTH, isAttentionOutcomeUnknown, isAttentionRefusal, isAttentionTicket, mintAttentionTicket, PERSON_ITEM_KINDS, PROVENANCE_SURFACES, SELF_PRINCIPAL, TARGET_REQUIRED_KINDS, type AttentionCancelResult, type AttentionOperationId, type AttentionReceipt, type AttentionRefusalCode, type AttentionRequestInput, type DirectoryInput, type DirectoryMember, type DirectoryPage, type HostedInbox, type HostedInboxOptions, type InboxAckInput, type InboxAppMeta, type InboxCount, type InboxEntry, type InboxEntryTarget, type InboxFactMatch, type InboxItemKind, type InboxItemState, type InboxListInput, type InboxListPage, type InboxProducerDisplay, type InboxProducerFacts, type InboxRecipient, type InboxSummary, type InboxSummaryInput, type InboxThread, type InboxThreadsInput, type InboxThreadsPage, type PersonItemKind, type ProvenanceSurface, } from "./inbox.js";
26
+ export { DIRECTORY_PAGES_MAX, directoryNameKey, matchDirectoryMember, readDirectory, type DirectoryListing, type DirectoryMatch, type DirectoryMatchBy, } from "./directory.js";
27
+ export { MALFORMED_ANSWER, MalformedAnswer, RemoteError, isMalformedAnswer } from "../remote-error.js";
28
+ export { HostedAnswerTooLarge, HostedCarrierError, isAnswerTooLarge } from "../hosted-transport/carrier.js";
29
+ export { BLOB_UNRECORDED_REFUSAL_CODES, performHostedBlobDelivery, type HostedBlobDeliveryContext, type HostedBlobDeliveryOptions, type HostedBlobDeliveryOutcome, type HostedBlobDeliveryResult, } from "./blob-delivery.js";
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hosted-client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,0BAA0B,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClH,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,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAC5G,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * `@superbee/core/hosted-client`: the headless client of a hosted Superbee's sync route family
3
+ * (`/sync/v1`), a supported public API under core's normal versioning. It is runtime-neutral
4
+ * (`fetch` and Web streams only), so it runs in Node, a browser or a Worker.
5
+ *
6
+ * The caller supplies the target (origin and sync prefix) and an async credential provider; the
7
+ * client supplies identity, the bundle list, reads, history, workspace qualification, operations
8
+ * by id, the one-call document write and the one-call blob write (`writeBlob`, journaled by
9
+ * `driveJournaledBlob`) over `@superbee/core/hosted-transport`, and throws typed errors only.
10
+ * `createHostedInbox` adds a person's inbox in one workspace over the same client, and
11
+ * `readDirectory` with `matchDirectoryMember` finds a teammate where the host offers the directory.
12
+ *
13
+ * Export download is Node-only (its verification needs Node), so it is the separate
14
+ * `@superbee/core/hosted-client/node`; nothing here imports it.
15
+ */
16
+ export { bearerCredentials, createHostedClient, qualifyingCarrier, syncRoutePrefix, } from "./client.js";
17
+ export { BUNDLE_LIST_CAP, readBundleListing, } from "./bundle-listing.js";
18
+ export { hostedBundleReferenceText, isWorkspaceSlug, parseHostedBundleReference, } from "./reference.js";
19
+ export { checkoutBindingDigest } from "./binding.js";
20
+ export { createMemoryIntentStore, HostedIntentsNotListable, INTENTS_NOT_LISTABLE, } from "./write.js";
21
+ export { HostedBlobWritesNotServed, HostedRouteNotServed, isRouteNotServed, ROUTE_NOT_SERVED } from "./errors.js";
22
+ export { driveJournaledBlob, forgetJournaledBlob, HostedBlobDeletionsNotAccepted, HostedBlobWriteNotSent, } from "./blob-write.js";
23
+ // The browser-safe default blob journal and the head and read shapes, re-exported (same identities).
24
+ export { createMemoryBlobJournal } from "../blob-journal.js";
25
+ export { ATTENTION_OPERATION_IDS, ATTENTION_REFUSAL_CODES, createHostedInbox, DIRECTORY_PAGE_MAX, HOSTED_PRINCIPAL_ID, HostedAttentionOutcomeUnknown, HostedAttentionRefusal, INBOX_ANSWER_BYTES, INBOX_ITEM_STATES, INBOX_NOTE_MAX_LENGTH, isAttentionOutcomeUnknown, isAttentionRefusal, isAttentionTicket, mintAttentionTicket, PERSON_ITEM_KINDS, PROVENANCE_SURFACES, SELF_PRINCIPAL, TARGET_REQUIRED_KINDS, } from "./inbox.js";
26
+ export { DIRECTORY_PAGES_MAX, directoryNameKey, matchDirectoryMember, readDirectory, } from "./directory.js";
27
+ // The other typed failures, re-exported (same identities) so a caller can tell them apart from
28
+ // this one subpath.
29
+ export { MALFORMED_ANSWER, MalformedAnswer, RemoteError, isMalformedAnswer } from "../remote-error.js";
30
+ export { HostedAnswerTooLarge, HostedCarrierError, isAnswerTooLarge } from "../hosted-transport/carrier.js";
31
+ export { BLOB_UNRECORDED_REFUSAL_CODES, performHostedBlobDelivery, } from "./blob-delivery.js";
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hosted-client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAQhB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,iBAAiB,GAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,EACzB,eAAe,EACf,0BAA0B,GAE3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,GAQrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,8BAA8B,EAC9B,sBAAsB,GAkBvB,MAAM,iBAAiB,CAAC;AACzB,qGAAqG;AACrG,OAAO,EAAE,uBAAuB,EAAqD,MAAM,oBAAoB,CAAC;AAEhH,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,EAC7B,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,GA+BtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GAId,MAAM,gBAAgB,CAAC;AACxB,+FAA+F;AAC/F,oBAAoB;AACpB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAC5G,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,GAK1B,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { FileJournaledBackend, type FileJournaledBackendOptions } from "../file-journaled-backend.js";
2
+ import type { HostedIntentStore, HostedWriteIntent } from "./write.js";
3
+ import { type BlobJournaledBackend } from "../blob-journal.js";
4
+ /** The marker row's key. */
5
+ export declare const HOSTED_CLIENT_JOURNAL_MARKER = "hosted-client.journal";
6
+ /** The schema this version of the client writes and reads. */
7
+ export declare const HOSTED_CLIENT_JOURNAL_SCHEMA_VERSION = 1;
8
+ /** The prefix of every held document write's meta row; the request identity follows it. */
9
+ export declare const HOSTED_CLIENT_WRITE_PREFIX = "hosted-client.write.";
10
+ /**
11
+ * The log is compacted into the snapshot once it is larger than the greater of this floor and
12
+ * twice the last snapshot, checked after every mutation. Settled writes leave the live state, so
13
+ * a steady stream of writes keeps the log under about this floor plus one record, and the work
14
+ * stays linear when unsettled writes hold the snapshot large.
15
+ */
16
+ export declare const HOSTED_CLIENT_JOURNAL_COMPACT_FLOOR_BYTES: number;
17
+ export type HostedClientJournalProblem =
18
+ /** The directory is a symbolic link, or (on POSIX) grants its group or others any permission. */
19
+ "JOURNAL_DIRECTORY_NOT_PRIVATE"
20
+ /** The directory holds a store this client did not create: documents, blobs, a checkout's state, or unmarked rows. */
21
+ | "JOURNAL_NOT_HOSTED_CLIENT"
22
+ /** The marker names a schema this version does not read (a newer client wrote it). */
23
+ | "JOURNAL_SCHEMA_UNSUPPORTED";
24
+ /** Open refused the directory; nothing in it was changed. */
25
+ export declare class HostedClientJournalError extends Error {
26
+ readonly name = "HostedClientJournalError";
27
+ readonly code: HostedClientJournalProblem;
28
+ readonly directory: string;
29
+ /** With `JOURNAL_SCHEMA_UNSUPPORTED`: the marker's `schemaVersion`, as found. */
30
+ readonly schemaVersion?: unknown;
31
+ constructor(code: HostedClientJournalProblem, directory: string, message: string, options?: {
32
+ schemaVersion?: unknown;
33
+ });
34
+ }
35
+ /** True when `error` is a {@link HostedClientJournalError}, with `code` when one is named. */
36
+ export declare function isHostedClientJournalError(error: unknown, code?: HostedClientJournalProblem): error is HostedClientJournalError;
37
+ export interface HostedClientJournalOptions {
38
+ /**
39
+ * The journal's directory, on a local file system. Created (mode 0700) when absent; an existing
40
+ * one must be a real directory with no group or other permission bits.
41
+ */
42
+ readonly directory: string;
43
+ /** How long open waits for another process holding the directory (default 5,000 ms), then fails. */
44
+ readonly lock?: {
45
+ readonly waitMs?: number;
46
+ };
47
+ }
48
+ /**
49
+ * A durable {@link HostedIntentStore}: pass it as `createHostedClient({ intentStore })`. It holds
50
+ * the directory's exclusive lock until {@link close}; every call after close rejects.
51
+ *
52
+ * Unlike `createMemoryIntentStore`, whose calls take effect as they are made, each call here
53
+ * takes effect later, in the order its asynchronous steps complete: `delete` reads the row before
54
+ * removing it, so a `put` made after an unawaited `delete` can land first and then be removed.
55
+ * Await each call before the next on the same request identity, as the client does.
56
+ */
57
+ export interface HostedClientJournal extends HostedIntentStore {
58
+ /** The journal's directory, resolved. */
59
+ readonly directory: string;
60
+ put(intent: HostedWriteIntent): Promise<void>;
61
+ get(requestId: string): Promise<HostedWriteIntent | undefined>;
62
+ delete(requestId: string): Promise<void>;
63
+ /** Every held write, oldest first (by `createdAt`, then request identity). */
64
+ list(): AsyncIterable<HostedWriteIntent>;
65
+ /**
66
+ * The journal's blob writes: pass it as `createHostedClient({ blobJournal })`. The backend's own
67
+ * blob intent family and transition rules; metadata it carries may not name this journal's
68
+ * own rows (`hosted-client.*`) or a checkout's blob-sync state.
69
+ */
70
+ readonly blobs: BlobJournaledBackend;
71
+ /** Let pending calls finish, then release the directory. */
72
+ close(): Promise<void>;
73
+ }
74
+ /**
75
+ * Open (or create) the hosted client's durable intent store in `directory`.
76
+ *
77
+ * Refusals change no file in an existing directory:
78
+ * - {@link HostedClientJournalError} — the directory is not private (a symbolic link, another
79
+ * owner, group or other permission bits), holds files but no store, is not this client's
80
+ * store, or names a newer schema;
81
+ * - `FilesystemMutationLockError` — another process holds the directory past `lock.waitMs`;
82
+ * - `FileJournalCorruptError` / `FileJournalFormatError` — the log or snapshot is damaged or in a
83
+ * newer format. Nothing is repaired: moving the directory aside loses the writes it holds.
84
+ *
85
+ * The directory may hold only the backend's store files, each a regular file of its own. The
86
+ * decision is made on a read-only open, which changes nothing, and the directory, its listing,
87
+ * its files and its contents are checked again under the writable open's lock before the marker
88
+ * is written. Another process of the same user modifying the directory while it opens is out of
89
+ * scope: between the read-only decision and the writable lock, such a change can make the
90
+ * writable open truncate a torn or foreign log tail, remove a leftover snapshot temp, or create
91
+ * an empty log, and a foreign log truncated to nothing that way is adopted as an empty journal.
92
+ */
93
+ export declare function openHostedClientJournal(options: HostedClientJournalOptions): Promise<HostedClientJournal>;
94
+ /** @internal What the store's own tests vary: the lock namespace, the backend's opener (its fault seam), and the open's windows. */
95
+ export interface JournalTestSeam {
96
+ readonly lockRoot?: string;
97
+ readonly openBackend?: (options: FileJournaledBackendOptions) => Promise<FileJournaledBackend>;
98
+ /** Runs where another process could act: before an absent directory is created, and before the writable open. */
99
+ readonly window?: (phase: "before-create" | "before-writable-open") => Promise<void>;
100
+ }
101
+ /** @internal {@link openHostedClientJournal} with its test seam. Not in the package's exports. */
102
+ export declare function openHostedClientJournalWith(options: HostedClientJournalOptions, seam?: JournalTestSeam): Promise<HostedClientJournal>;
103
+ //# sourceMappingURL=journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../src/hosted-client/journal.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,oBAAoB,EACpB,KAAK,2BAA2B,EACjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,EAA4B,KAAK,oBAAoB,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