@mdbase-dev/sdk 0.0.0-stage → 0.1.0-beta.149

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 (900) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +844 -2
  3. package/dist/account-key.d.ts +176 -0
  4. package/dist/account-key.js +409 -0
  5. package/dist/account-key.js.map +1 -0
  6. package/dist/account.d.ts +11 -0
  7. package/dist/account.js +9 -0
  8. package/dist/account.js.map +1 -0
  9. package/dist/app-grant/client.d.ts +209 -0
  10. package/dist/app-grant/client.js +930 -0
  11. package/dist/app-grant/client.js.map +1 -0
  12. package/dist/app-grant/grant-store.d.ts +77 -0
  13. package/dist/app-grant/grant-store.js +201 -0
  14. package/dist/app-grant/grant-store.js.map +1 -0
  15. package/dist/app-grant/index.d.ts +11 -0
  16. package/dist/app-grant/index.js +10 -0
  17. package/dist/app-grant/index.js.map +1 -0
  18. package/dist/app-grant/native-completion.d.ts +22 -0
  19. package/dist/app-grant/native-completion.js +63 -0
  20. package/dist/app-grant/native-completion.js.map +1 -0
  21. package/dist/app-grant/people.d.ts +10 -0
  22. package/dist/app-grant/people.js +84 -0
  23. package/dist/app-grant/people.js.map +1 -0
  24. package/dist/app-grant/setup-attempt.d.ts +12 -0
  25. package/dist/app-grant/setup-attempt.js +62 -0
  26. package/dist/app-grant/setup-attempt.js.map +1 -0
  27. package/dist/app-grant/setup-producer.d.ts +31 -0
  28. package/dist/app-grant/setup-producer.js +65 -0
  29. package/dist/app-grant/setup-producer.js.map +1 -0
  30. package/dist/app-grant/setup.d.ts +11 -0
  31. package/dist/app-grant/setup.js +222 -0
  32. package/dist/app-grant/setup.js.map +1 -0
  33. package/dist/app-host/app-environment.d.ts +27 -0
  34. package/dist/app-host/app-environment.js +48 -0
  35. package/dist/app-host/app-environment.js.map +1 -0
  36. package/dist/app-host/app-origin.d.ts +7 -0
  37. package/dist/app-host/app-origin.js +49 -0
  38. package/dist/app-host/app-origin.js.map +1 -0
  39. package/dist/app-host/bases-pages.d.ts +29 -0
  40. package/dist/app-host/bases-pages.js +42 -0
  41. package/dist/app-host/bases-pages.js.map +1 -0
  42. package/dist/app-host/bases-wire.d.ts +159 -0
  43. package/dist/app-host/bases-wire.js +376 -0
  44. package/dist/app-host/bases-wire.js.map +1 -0
  45. package/dist/app-host/browser-direct-access.d.ts +18 -0
  46. package/dist/app-host/browser-direct-access.js +17 -0
  47. package/dist/app-host/browser-direct-access.js.map +1 -0
  48. package/dist/app-host/cloud-copy-bootstrap.d.ts +127 -0
  49. package/dist/app-host/cloud-copy-bootstrap.js +608 -0
  50. package/dist/app-host/cloud-copy-bootstrap.js.map +1 -0
  51. package/dist/app-host/cloud-copy-host.d.ts +248 -0
  52. package/dist/app-host/cloud-copy-host.js +1028 -0
  53. package/dist/app-host/cloud-copy-host.js.map +1 -0
  54. package/dist/app-host/cloud-copy-persistence-idb.d.ts +33 -0
  55. package/dist/app-host/cloud-copy-persistence-idb.js +255 -0
  56. package/dist/app-host/cloud-copy-persistence-idb.js.map +1 -0
  57. package/dist/app-host/cloud-copy-persistence.d.ts +57 -0
  58. package/dist/app-host/cloud-copy-persistence.js +341 -0
  59. package/dist/app-host/cloud-copy-persistence.js.map +1 -0
  60. package/dist/app-host/collection-control.d.ts +111 -0
  61. package/dist/app-host/collection-control.js +604 -0
  62. package/dist/app-host/collection-control.js.map +1 -0
  63. package/dist/app-host/collection-delete.d.ts +7 -0
  64. package/dist/app-host/collection-delete.js +54 -0
  65. package/dist/app-host/collection-delete.js.map +1 -0
  66. package/dist/app-host/collection-display-name.d.ts +2 -0
  67. package/dist/app-host/collection-display-name.js +22 -0
  68. package/dist/app-host/collection-display-name.js.map +1 -0
  69. package/dist/app-host/collection-join-ledger.d.ts +52 -0
  70. package/dist/app-host/collection-join-ledger.js +208 -0
  71. package/dist/app-host/collection-join-ledger.js.map +1 -0
  72. package/dist/app-host/collection-people.d.ts +32 -0
  73. package/dist/app-host/collection-people.js +119 -0
  74. package/dist/app-host/collection-people.js.map +1 -0
  75. package/dist/app-host/collection-readiness.d.ts +119 -0
  76. package/dist/app-host/collection-readiness.js +649 -0
  77. package/dist/app-host/collection-readiness.js.map +1 -0
  78. package/dist/app-host/collection-setup-journal.d.ts +59 -0
  79. package/dist/app-host/collection-setup-journal.js +813 -0
  80. package/dist/app-host/collection-setup-journal.js.map +1 -0
  81. package/dist/app-host/collection-setup-types.d.ts +155 -0
  82. package/dist/app-host/collection-setup-types.js +10 -0
  83. package/dist/app-host/collection-setup-types.js.map +1 -0
  84. package/dist/app-host/cp-authority.d.ts +65 -0
  85. package/dist/app-host/cp-authority.js +243 -0
  86. package/dist/app-host/cp-authority.js.map +1 -0
  87. package/dist/app-host/cp-people.d.ts +23 -0
  88. package/dist/app-host/cp-people.js +145 -0
  89. package/dist/app-host/cp-people.js.map +1 -0
  90. package/dist/app-host/cp-problem.d.ts +34 -0
  91. package/dist/app-host/cp-problem.js +114 -0
  92. package/dist/app-host/cp-problem.js.map +1 -0
  93. package/dist/app-host/device-key-custody.d.ts +51 -0
  94. package/dist/app-host/device-key-custody.js +128 -0
  95. package/dist/app-host/device-key-custody.js.map +1 -0
  96. package/dist/app-host/device-key-idb.d.ts +31 -0
  97. package/dist/app-host/device-key-idb.js +176 -0
  98. package/dist/app-host/device-key-idb.js.map +1 -0
  99. package/dist/app-host/device-key-provider.d.ts +33 -0
  100. package/dist/app-host/device-key-provider.js +181 -0
  101. package/dist/app-host/device-key-provider.js.map +1 -0
  102. package/dist/app-host/device-registration.d.ts +51 -0
  103. package/dist/app-host/device-registration.js +180 -0
  104. package/dist/app-host/device-registration.js.map +1 -0
  105. package/dist/app-host/foreground-wake.d.ts +43 -0
  106. package/dist/app-host/foreground-wake.js +113 -0
  107. package/dist/app-host/foreground-wake.js.map +1 -0
  108. package/dist/app-host/handover.d.ts +27 -0
  109. package/dist/app-host/handover.js +82 -0
  110. package/dist/app-host/handover.js.map +1 -0
  111. package/dist/app-host/http-log.d.ts +96 -0
  112. package/dist/app-host/http-log.js +609 -0
  113. package/dist/app-host/http-log.js.map +1 -0
  114. package/dist/app-host/index.d.ts +63 -0
  115. package/dist/app-host/index.js +33 -0
  116. package/dist/app-host/index.js.map +1 -0
  117. package/dist/app-host/initial-sync.d.ts +22 -0
  118. package/dist/app-host/initial-sync.js +41 -0
  119. package/dist/app-host/initial-sync.js.map +1 -0
  120. package/dist/app-host/installation-sign-in.d.ts +319 -0
  121. package/dist/app-host/installation-sign-in.js +1231 -0
  122. package/dist/app-host/installation-sign-in.js.map +1 -0
  123. package/dist/app-host/installation-store.d.ts +56 -0
  124. package/dist/app-host/installation-store.js +285 -0
  125. package/dist/app-host/installation-store.js.map +1 -0
  126. package/dist/app-host/ledger-rows.d.ts +3 -0
  127. package/dist/app-host/ledger-rows.js +23 -0
  128. package/dist/app-host/ledger-rows.js.map +1 -0
  129. package/dist/app-host/local-facade.d.ts +24 -0
  130. package/dist/app-host/local-facade.js +361 -0
  131. package/dist/app-host/local-facade.js.map +1 -0
  132. package/dist/app-host/log-pump.d.ts +124 -0
  133. package/dist/app-host/log-pump.js +326 -0
  134. package/dist/app-host/log-pump.js.map +1 -0
  135. package/dist/app-host/log-push.d.ts +90 -0
  136. package/dist/app-host/log-push.js +377 -0
  137. package/dist/app-host/log-push.js.map +1 -0
  138. package/dist/app-host/log-token-cache.d.ts +28 -0
  139. package/dist/app-host/log-token-cache.js +104 -0
  140. package/dist/app-host/log-token-cache.js.map +1 -0
  141. package/dist/app-host/native-sign-in.d.ts +27 -0
  142. package/dist/app-host/native-sign-in.js +12 -0
  143. package/dist/app-host/native-sign-in.js.map +1 -0
  144. package/dist/app-host/noise-custody.d.ts +62 -0
  145. package/dist/app-host/noise-custody.js +238 -0
  146. package/dist/app-host/noise-custody.js.map +1 -0
  147. package/dist/app-host/noise-idb.d.ts +33 -0
  148. package/dist/app-host/noise-idb.js +199 -0
  149. package/dist/app-host/noise-idb.js.map +1 -0
  150. package/dist/app-host/open-wait.d.ts +3 -0
  151. package/dist/app-host/open-wait.js +17 -0
  152. package/dist/app-host/open-wait.js.map +1 -0
  153. package/dist/app-host/opening-progress.d.ts +3 -0
  154. package/dist/app-host/opening-progress.js +5 -0
  155. package/dist/app-host/opening-progress.js.map +1 -0
  156. package/dist/app-host/owner.d.ts +103 -0
  157. package/dist/app-host/owner.js +262 -0
  158. package/dist/app-host/owner.js.map +1 -0
  159. package/dist/app-host/private-bootstrap.d.ts +78 -0
  160. package/dist/app-host/private-bootstrap.js +230 -0
  161. package/dist/app-host/private-bootstrap.js.map +1 -0
  162. package/dist/app-host/private-persistence-idb.d.ts +32 -0
  163. package/dist/app-host/private-persistence-idb.js +188 -0
  164. package/dist/app-host/private-persistence-idb.js.map +1 -0
  165. package/dist/app-host/private-persistence.d.ts +55 -0
  166. package/dist/app-host/private-persistence.js +257 -0
  167. package/dist/app-host/private-persistence.js.map +1 -0
  168. package/dist/app-host/scoped-sign-in-session.d.ts +49 -0
  169. package/dist/app-host/scoped-sign-in-session.js +243 -0
  170. package/dist/app-host/scoped-sign-in-session.js.map +1 -0
  171. package/dist/app-host/setup-engine.d.ts +14 -0
  172. package/dist/app-host/setup-engine.js +73 -0
  173. package/dist/app-host/setup-engine.js.map +1 -0
  174. package/dist/app-host/sign-out-erase.d.ts +37 -0
  175. package/dist/app-host/sign-out-erase.js +139 -0
  176. package/dist/app-host/sign-out-erase.js.map +1 -0
  177. package/dist/app-host/status.d.ts +62 -0
  178. package/dist/app-host/status.js +43 -0
  179. package/dist/app-host/status.js.map +1 -0
  180. package/dist/app-host/storage-probe.d.ts +46 -0
  181. package/dist/app-host/storage-probe.js +63 -0
  182. package/dist/app-host/storage-probe.js.map +1 -0
  183. package/dist/app-host/timer-port.d.ts +29 -0
  184. package/dist/app-host/timer-port.js +483 -0
  185. package/dist/app-host/timer-port.js.map +1 -0
  186. package/dist/app-host/wasm-runtime.d.ts +302 -0
  187. package/dist/app-host/wasm-runtime.js +1050 -0
  188. package/dist/app-host/wasm-runtime.js.map +1 -0
  189. package/dist/app-host/web-collection.d.ts +78 -0
  190. package/dist/app-host/web-collection.js +671 -0
  191. package/dist/app-host/web-collection.js.map +1 -0
  192. package/dist/app-host/web-sign-in-problem.d.ts +17 -0
  193. package/dist/app-host/web-sign-in-problem.js +59 -0
  194. package/dist/app-host/web-sign-in-problem.js.map +1 -0
  195. package/dist/app-host/web-sign-in-session.d.ts +367 -0
  196. package/dist/app-host/web-sign-in-session.js +1258 -0
  197. package/dist/app-host/web-sign-in-session.js.map +1 -0
  198. package/dist/app-storage/app-binary-index.d.ts +33 -0
  199. package/dist/app-storage/app-binary-index.js +274 -0
  200. package/dist/app-storage/app-binary-index.js.map +1 -0
  201. package/dist/app-storage/app-sqlite-index.d.ts +40 -0
  202. package/dist/app-storage/app-sqlite-index.js +102 -0
  203. package/dist/app-storage/app-sqlite-index.js.map +1 -0
  204. package/dist/app-storage/collection-sql.d.ts +39 -0
  205. package/dist/app-storage/collection-sql.js +93 -0
  206. package/dist/app-storage/collection-sql.js.map +1 -0
  207. package/dist/app-storage/index.d.ts +10 -0
  208. package/dist/app-storage/index.js +7 -0
  209. package/dist/app-storage/index.js.map +1 -0
  210. package/dist/app-storage/sqlite-index.d.ts +95 -0
  211. package/dist/app-storage/sqlite-index.js +280 -0
  212. package/dist/app-storage/sqlite-index.js.map +1 -0
  213. package/dist/application/asset-loader.d.ts +22 -0
  214. package/dist/application/asset-loader.js +130 -0
  215. package/dist/application/asset-loader.js.map +1 -0
  216. package/dist/application/asset-pins.json +24 -0
  217. package/dist/application/browser-capabilities.d.ts +48 -0
  218. package/dist/application/browser-capabilities.js +87 -0
  219. package/dist/application/browser-capabilities.js.map +1 -0
  220. package/dist/application/browser-selection.d.ts +58 -0
  221. package/dist/application/browser-selection.js +160 -0
  222. package/dist/application/browser-selection.js.map +1 -0
  223. package/dist/application/capabilities.d.ts +20 -0
  224. package/dist/application/capabilities.js +22 -0
  225. package/dist/application/capabilities.js.map +1 -0
  226. package/dist/application/collection-selection.d.ts +147 -0
  227. package/dist/application/collection-selection.js +351 -0
  228. package/dist/application/collection-selection.js.map +1 -0
  229. package/dist/application/configuration.d.ts +52 -0
  230. package/dist/application/configuration.js +568 -0
  231. package/dist/application/configuration.js.map +1 -0
  232. package/dist/application/declaration.d.ts +51 -0
  233. package/dist/application/declaration.js +100 -0
  234. package/dist/application/declaration.js.map +1 -0
  235. package/dist/application/entry.d.ts +343 -0
  236. package/dist/application/entry.js +945 -0
  237. package/dist/application/entry.js.map +1 -0
  238. package/dist/application/file-access.d.ts +55 -0
  239. package/dist/application/file-access.js +93 -0
  240. package/dist/application/file-access.js.map +1 -0
  241. package/dist/application/file-readiness.d.ts +16 -0
  242. package/dist/application/file-readiness.js +53 -0
  243. package/dist/application/file-readiness.js.map +1 -0
  244. package/dist/application/forgotten.d.ts +15 -0
  245. package/dist/application/forgotten.js +70 -0
  246. package/dist/application/forgotten.js.map +1 -0
  247. package/dist/application/front-door.d.ts +68 -0
  248. package/dist/application/front-door.js +66 -0
  249. package/dist/application/front-door.js.map +1 -0
  250. package/dist/application/local-build.d.ts +5 -0
  251. package/dist/application/local-build.js +22 -0
  252. package/dist/application/local-build.js.map +1 -0
  253. package/dist/application/manifest.d.ts +16 -0
  254. package/dist/application/manifest.js +31 -0
  255. package/dist/application/manifest.js.map +1 -0
  256. package/dist/application/native-assets.d.ts +25 -0
  257. package/dist/application/native-assets.js +29 -0
  258. package/dist/application/native-assets.js.map +1 -0
  259. package/dist/application/native-authorization-rpc.d.ts +23 -0
  260. package/dist/application/native-authorization-rpc.js +54 -0
  261. package/dist/application/native-authorization-rpc.js.map +1 -0
  262. package/dist/application/notification-readiness.d.ts +33 -0
  263. package/dist/application/notification-readiness.js +222 -0
  264. package/dist/application/notification-readiness.js.map +1 -0
  265. package/dist/application/packaged-assets.d.ts +5 -0
  266. package/dist/application/packaged-assets.js +55 -0
  267. package/dist/application/packaged-assets.js.map +1 -0
  268. package/dist/application/packaged-trust.d.ts +5 -0
  269. package/dist/application/packaged-trust.js +10 -0
  270. package/dist/application/packaged-trust.js.map +1 -0
  271. package/dist/application/people-readiness.d.ts +23 -0
  272. package/dist/application/people-readiness.js +213 -0
  273. package/dist/application/people-readiness.js.map +1 -0
  274. package/dist/application/phase.d.ts +108 -0
  275. package/dist/application/phase.js +113 -0
  276. package/dist/application/phase.js.map +1 -0
  277. package/dist/application/portal-reservation.d.ts +38 -0
  278. package/dist/application/portal-reservation.js +183 -0
  279. package/dist/application/portal-reservation.js.map +1 -0
  280. package/dist/application/private-collections.d.ts +114 -0
  281. package/dist/application/private-collections.js +415 -0
  282. package/dist/application/private-collections.js.map +1 -0
  283. package/dist/application/readiness.d.ts +59 -0
  284. package/dist/application/readiness.js +223 -0
  285. package/dist/application/readiness.js.map +1 -0
  286. package/dist/application/registration-refusal.d.ts +16 -0
  287. package/dist/application/registration-refusal.js +41 -0
  288. package/dist/application/registration-refusal.js.map +1 -0
  289. package/dist/application/registration.d.ts +26 -0
  290. package/dist/application/registration.js +372 -0
  291. package/dist/application/registration.js.map +1 -0
  292. package/dist/application/return-url.d.ts +1 -0
  293. package/dist/application/return-url.js +41 -0
  294. package/dist/application/return-url.js.map +1 -0
  295. package/dist/application/runtime.d.ts +107 -0
  296. package/dist/application/runtime.js +379 -0
  297. package/dist/application/runtime.js.map +1 -0
  298. package/dist/application/scope.d.ts +34 -0
  299. package/dist/application/scope.js +164 -0
  300. package/dist/application/scope.js.map +1 -0
  301. package/dist/application/session-hint.d.ts +21 -0
  302. package/dist/application/session-hint.js +87 -0
  303. package/dist/application/session-hint.js.map +1 -0
  304. package/dist/application/setup.d.ts +105 -0
  305. package/dist/application/setup.js +137 -0
  306. package/dist/application/setup.js.map +1 -0
  307. package/dist/application/sign-out.d.ts +17 -0
  308. package/dist/application/sign-out.js +28 -0
  309. package/dist/application/sign-out.js.map +1 -0
  310. package/dist/application/storage-scope.d.ts +8 -0
  311. package/dist/application/storage-scope.js +15 -0
  312. package/dist/application/storage-scope.js.map +1 -0
  313. package/dist/application/tabs.d.ts +98 -0
  314. package/dist/application/tabs.js +407 -0
  315. package/dist/application/tabs.js.map +1 -0
  316. package/dist/application/timer-criteria.d.ts +5 -0
  317. package/dist/application/timer-criteria.js +15 -0
  318. package/dist/application/timer-criteria.js.map +1 -0
  319. package/dist/application/ui-connections.d.ts +35 -0
  320. package/dist/application/ui-connections.js +129 -0
  321. package/dist/application/ui-connections.js.map +1 -0
  322. package/dist/application/worker-client.d.ts +59 -0
  323. package/dist/application/worker-client.js +381 -0
  324. package/dist/application/worker-client.js.map +1 -0
  325. package/dist/application/worker-host.d.ts +84 -0
  326. package/dist/application/worker-host.js +547 -0
  327. package/dist/application/worker-host.js.map +1 -0
  328. package/dist/application/worker-protocol.d.ts +40 -0
  329. package/dist/application/worker-protocol.js +83 -0
  330. package/dist/application/worker-protocol.js.map +1 -0
  331. package/dist/application/worker-session.d.ts +45 -0
  332. package/dist/application/worker-session.js +37 -0
  333. package/dist/application/worker-session.js.map +1 -0
  334. package/dist/application/worker.d.ts +1 -0
  335. package/dist/application/worker.js +34826 -0
  336. package/dist/application/worker.js.map +1 -0
  337. package/dist/attachment-wire.d.ts +15 -0
  338. package/dist/attachment-wire.js +47 -0
  339. package/dist/attachment-wire.js.map +1 -0
  340. package/dist/browser/mdbase-sdk.js +49392 -0
  341. package/dist/browser/mdbase-sdk.min.js +130 -0
  342. package/dist/browser.d.ts +4 -0
  343. package/dist/browser.js +5 -0
  344. package/dist/browser.js.map +1 -0
  345. package/dist/cbor.d.ts +52 -0
  346. package/dist/cbor.js +480 -0
  347. package/dist/cbor.js.map +1 -0
  348. package/dist/client.d.ts +656 -0
  349. package/dist/client.js +1962 -0
  350. package/dist/client.js.map +1 -0
  351. package/dist/codec.d.ts +82 -0
  352. package/dist/codec.js +388 -0
  353. package/dist/codec.js.map +1 -0
  354. package/dist/collection-availability.d.ts +34 -0
  355. package/dist/collection-availability.js +63 -0
  356. package/dist/collection-availability.js.map +1 -0
  357. package/dist/contract-query.d.ts +31 -0
  358. package/dist/contract-query.js +13 -0
  359. package/dist/contract-query.js.map +1 -0
  360. package/dist/contract-records.d.ts +51 -0
  361. package/dist/contract-records.js +14 -0
  362. package/dist/contract-records.js.map +1 -0
  363. package/dist/describe-error.d.ts +61 -0
  364. package/dist/describe-error.js +452 -0
  365. package/dist/describe-error.js.map +1 -0
  366. package/dist/errors.d.ts +65 -0
  367. package/dist/errors.js +94 -0
  368. package/dist/errors.js.map +1 -0
  369. package/dist/files.d.ts +147 -0
  370. package/dist/files.js +537 -0
  371. package/dist/files.js.map +1 -0
  372. package/dist/holds.d.ts +74 -0
  373. package/dist/holds.js +118 -0
  374. package/dist/holds.js.map +1 -0
  375. package/dist/index.d.ts +36 -0
  376. package/dist/index.js +22 -0
  377. package/dist/index.js.map +1 -0
  378. package/dist/keys.d.ts +40 -0
  379. package/dist/keys.js +181 -0
  380. package/dist/keys.js.map +1 -0
  381. package/dist/live.d.ts +38 -0
  382. package/dist/live.js +82 -0
  383. package/dist/live.js.map +1 -0
  384. package/dist/local-build.d.ts +9 -0
  385. package/dist/local-build.js +33 -0
  386. package/dist/local-build.js.map +1 -0
  387. package/dist/native/provenance.json +23 -0
  388. package/dist/native/runtime.wasm +0 -0
  389. package/dist/native/sqlite3.d.ts +5 -0
  390. package/dist/native/sqlite3.js +17392 -0
  391. package/dist/native/sqlite3.js.map +1 -0
  392. package/dist/native/sqlite3.wasm +0 -0
  393. package/dist/node.d.ts +63 -0
  394. package/dist/node.js +255 -0
  395. package/dist/node.js.map +1 -0
  396. package/dist/notifications.d.ts +95 -0
  397. package/dist/notifications.js +226 -0
  398. package/dist/notifications.js.map +1 -0
  399. package/dist/offline-shell-build.d.ts +25 -0
  400. package/dist/offline-shell-build.js +78 -0
  401. package/dist/offline-shell-build.js.map +1 -0
  402. package/dist/offline-shell-worker.d.ts +46 -0
  403. package/dist/offline-shell-worker.js +115 -0
  404. package/dist/offline-shell-worker.js.map +1 -0
  405. package/dist/people.d.ts +82 -0
  406. package/dist/people.js +199 -0
  407. package/dist/people.js.map +1 -0
  408. package/dist/presence.d.ts +21 -0
  409. package/dist/presence.js +109 -0
  410. package/dist/presence.js.map +1 -0
  411. package/dist/private-account.d.ts +197 -0
  412. package/dist/private-account.js +510 -0
  413. package/dist/private-account.js.map +1 -0
  414. package/dist/private.d.ts +55 -0
  415. package/dist/private.js +69 -0
  416. package/dist/private.js.map +1 -0
  417. package/dist/read-helpers.d.ts +32 -0
  418. package/dist/read-helpers.js +181 -0
  419. package/dist/read-helpers.js.map +1 -0
  420. package/dist/records/session.d.ts +60 -0
  421. package/dist/records/session.js +534 -0
  422. package/dist/records/session.js.map +1 -0
  423. package/dist/records/types.d.ts +76 -0
  424. package/dist/records/types.js +2 -0
  425. package/dist/records/types.js.map +1 -0
  426. package/dist/records/witness.d.ts +19 -0
  427. package/dist/records/witness.js +64 -0
  428. package/dist/records/witness.js.map +1 -0
  429. package/dist/records.d.ts +23 -0
  430. package/dist/records.js +234 -0
  431. package/dist/records.js.map +1 -0
  432. package/dist/runtime/wasm.d.ts +69 -0
  433. package/dist/runtime/wasm.js +274 -0
  434. package/dist/runtime/wasm.js.map +1 -0
  435. package/dist/runtime-wire.d.ts +71 -0
  436. package/dist/runtime-wire.js +71 -0
  437. package/dist/runtime-wire.js.map +1 -0
  438. package/dist/saved-views.d.ts +29 -0
  439. package/dist/saved-views.js +171 -0
  440. package/dist/saved-views.js.map +1 -0
  441. package/dist/semver.d.ts +22 -0
  442. package/dist/semver.js +63 -0
  443. package/dist/semver.js.map +1 -0
  444. package/dist/session.d.ts +65 -0
  445. package/dist/session.js +332 -0
  446. package/dist/session.js.map +1 -0
  447. package/dist/status.d.ts +46 -0
  448. package/dist/status.js +59 -0
  449. package/dist/status.js.map +1 -0
  450. package/dist/strength.d.ts +12 -0
  451. package/dist/strength.js +194 -0
  452. package/dist/strength.js.map +1 -0
  453. package/dist/testing/application.d.ts +59 -0
  454. package/dist/testing/application.js +230 -0
  455. package/dist/testing/application.js.map +1 -0
  456. package/dist/testing/index.d.ts +10 -0
  457. package/dist/testing/index.js +6 -0
  458. package/dist/testing/index.js.map +1 -0
  459. package/dist/testing/memory-contracts.d.ts +40 -0
  460. package/dist/testing/memory-contracts.js +127 -0
  461. package/dist/testing/memory-contracts.js.map +1 -0
  462. package/dist/testing/memory-replica.d.ts +191 -0
  463. package/dist/testing/memory-replica.js +1465 -0
  464. package/dist/testing/memory-replica.js.map +1 -0
  465. package/dist/testing/noise-server.d.ts +11 -0
  466. package/dist/testing/noise-server.js +65 -0
  467. package/dist/testing/noise-server.js.map +1 -0
  468. package/dist/testing/test-app.d.ts +93 -0
  469. package/dist/testing/test-app.js +140 -0
  470. package/dist/testing/test-app.js.map +1 -0
  471. package/dist/thin-client.d.ts +67 -0
  472. package/dist/thin-client.js +42 -0
  473. package/dist/thin-client.js.map +1 -0
  474. package/dist/timers.d.ts +158 -0
  475. package/dist/timers.js +258 -0
  476. package/dist/timers.js.map +1 -0
  477. package/dist/transport/bases-rpc.d.ts +15 -0
  478. package/dist/transport/bases-rpc.js +61 -0
  479. package/dist/transport/bases-rpc.js.map +1 -0
  480. package/dist/transport/control-route.d.ts +34 -0
  481. package/dist/transport/control-route.js +84 -0
  482. package/dist/transport/control-route.js.map +1 -0
  483. package/dist/transport/inprocess.d.ts +13 -0
  484. package/dist/transport/inprocess.js +37 -0
  485. package/dist/transport/inprocess.js.map +1 -0
  486. package/dist/transport/local-link.d.ts +53 -0
  487. package/dist/transport/local-link.js +66 -0
  488. package/dist/transport/local-link.js.map +1 -0
  489. package/dist/transport/next-relay.d.ts +64 -0
  490. package/dist/transport/next-relay.js +222 -0
  491. package/dist/transport/next-relay.js.map +1 -0
  492. package/dist/transport/noise-session.d.ts +88 -0
  493. package/dist/transport/noise-session.js +264 -0
  494. package/dist/transport/noise-session.js.map +1 -0
  495. package/dist/transport/noise.d.ts +102 -0
  496. package/dist/transport/noise.js +307 -0
  497. package/dist/transport/noise.js.map +1 -0
  498. package/dist/transport/original-session.d.ts +6 -0
  499. package/dist/transport/original-session.js +6 -0
  500. package/dist/transport/original-session.js.map +1 -0
  501. package/dist/transport/port.d.ts +67 -0
  502. package/dist/transport/port.js +184 -0
  503. package/dist/transport/port.js.map +1 -0
  504. package/dist/transport/read-fence-policy.d.ts +3 -0
  505. package/dist/transport/read-fence-policy.js +11 -0
  506. package/dist/transport/read-fence-policy.js.map +1 -0
  507. package/dist/transport/relay-close.d.ts +31 -0
  508. package/dist/transport/relay-close.js +23 -0
  509. package/dist/transport/relay-close.js.map +1 -0
  510. package/dist/transport/relay-pipe.d.ts +15 -0
  511. package/dist/transport/relay-pipe.js +190 -0
  512. package/dist/transport/relay-pipe.js.map +1 -0
  513. package/dist/transport/relay.d.ts +36 -0
  514. package/dist/transport/relay.js +45 -0
  515. package/dist/transport/relay.js.map +1 -0
  516. package/dist/type-packs.d.ts +124 -0
  517. package/dist/type-packs.js +188 -0
  518. package/dist/type-packs.js.map +1 -0
  519. package/dist/validation.d.ts +30 -0
  520. package/dist/validation.js +125 -0
  521. package/dist/validation.js.map +1 -0
  522. package/dist/values.d.ts +37 -0
  523. package/dist/values.js +133 -0
  524. package/dist/values.js.map +1 -0
  525. package/dist/view-sources.d.ts +31 -0
  526. package/dist/view-sources.js +78 -0
  527. package/dist/view-sources.js.map +1 -0
  528. package/dist/wire.d.ts +856 -0
  529. package/dist/wire.js +914 -0
  530. package/dist/wire.js.map +1 -0
  531. package/dist/witness.d.ts +7 -0
  532. package/dist/witness.js +82 -0
  533. package/dist/witness.js.map +1 -0
  534. package/dist/write-ledger.d.ts +41 -0
  535. package/dist/write-ledger.js +184 -0
  536. package/dist/write-ledger.js.map +1 -0
  537. package/node_modules/@mdbase-dev/connect-protocol/dist/application-authorization.d.ts +32 -0
  538. package/node_modules/@mdbase-dev/connect-protocol/dist/application-authorization.js +207 -0
  539. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.d.ts +23 -0
  540. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js +76 -0
  541. package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.d.ts +120 -0
  542. package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.js +1 -0
  543. package/node_modules/@mdbase-dev/connect-protocol/dist/authorization-errors.d.ts +34 -0
  544. package/node_modules/@mdbase-dev/connect-protocol/dist/authorization-errors.js +52 -0
  545. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.d.ts +73 -0
  546. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js +92 -0
  547. package/node_modules/@mdbase-dev/connect-protocol/dist/change-events.generated.d.ts +48 -0
  548. package/node_modules/@mdbase-dev/connect-protocol/dist/change-events.generated.js +18 -0
  549. package/node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.d.ts +93 -0
  550. package/node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js +7 -0
  551. package/node_modules/@mdbase-dev/connect-protocol/dist/compatibility.d.ts +37 -0
  552. package/node_modules/@mdbase-dev/connect-protocol/dist/compatibility.js +65 -0
  553. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.d.ts +1533 -0
  554. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.js +598 -0
  555. package/node_modules/@mdbase-dev/connect-protocol/dist/files.d.ts +288 -0
  556. package/node_modules/@mdbase-dev/connect-protocol/dist/files.js +426 -0
  557. package/node_modules/@mdbase-dev/connect-protocol/dist/index.d.ts +723 -0
  558. package/node_modules/@mdbase-dev/connect-protocol/dist/index.js +104 -0
  559. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.d.ts +13 -0
  560. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js +7940 -0
  561. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.d.ts +72 -0
  562. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.js +643 -0
  563. package/node_modules/@mdbase-dev/connect-protocol/dist/mutation-fingerprint.d.ts +6 -0
  564. package/node_modules/@mdbase-dev/connect-protocol/dist/mutation-fingerprint.js +116 -0
  565. package/node_modules/@mdbase-dev/connect-protocol/dist/next-authorization.d.ts +30 -0
  566. package/node_modules/@mdbase-dev/connect-protocol/dist/next-authorization.js +90 -0
  567. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.d.ts +15 -0
  568. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.js +196 -0
  569. package/node_modules/@mdbase-dev/connect-protocol/dist/people.d.ts +33 -0
  570. package/node_modules/@mdbase-dev/connect-protocol/dist/people.js +26 -0
  571. package/node_modules/@mdbase-dev/connect-protocol/dist/records.d.ts +108 -0
  572. package/node_modules/@mdbase-dev/connect-protocol/dist/records.js +3 -0
  573. package/node_modules/@mdbase-dev/connect-protocol/dist/type-packs.d.ts +154 -0
  574. package/node_modules/@mdbase-dev/connect-protocol/dist/type-packs.js +30 -0
  575. package/node_modules/@mdbase-dev/connect-protocol/package.json +49 -0
  576. package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v1.json +40 -0
  577. package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v2.json +68 -0
  578. package/node_modules/@mdbase-dev/connect-protocol/schemas/catalog.json +17 -0
  579. package/node_modules/@mdbase-dev/connect-protocol/schemas/change-events.v1.json +48 -0
  580. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problem.v1.schema.json +5665 -0
  581. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problems.v1.catalog.json +373 -0
  582. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-protocol.v1.schema.json +901 -0
  583. package/node_modules/@mdbase-dev/connect-protocol/schemas/data-contract.schema.json +163 -0
  584. package/node_modules/@mdbase-dev/connect-protocol/schemas/encrypted-relay.v1.schema.json +63 -0
  585. package/node_modules/@mdbase-dev/connect-protocol/schemas/encrypted-relay.v2.schema.json +63 -0
  586. package/node_modules/@mdbase-dev/connect-protocol/schemas/encrypted-relay.v3.schema.json +64 -0
  587. package/node_modules/@mdbase-dev/connect-protocol/schemas/files.v1.schema.json +551 -0
  588. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-cancellation.schema.json +6 -0
  589. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-invocation.schema.json +6 -0
  590. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-outcome.schema.json +6 -0
  591. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-provider-declaration.schema.json +6 -0
  592. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/action-request.schema.json +6 -0
  593. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/conformance-claim.schema.json +6 -0
  594. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/event-source-declaration.schema.json +6 -0
  595. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/event.schema.json +6 -0
  596. package/node_modules/@mdbase-dev/connect-protocol/schemas/interop/v0.1/profile.schema.json +456 -0
  597. package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.legacy-v1.schema.json +430 -0
  598. package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.schema.json +437 -0
  599. package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-query.v0.3.schema.json +176 -0
  600. package/node_modules/@mdbase-dev/connect-protocol/schemas/next-trust.v1.schema.json +54 -0
  601. package/node_modules/@mdbase-dev/connect-protocol/schemas/notification-webhook.v1.schema.json +56 -0
  602. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-catalog.v1.json +43 -0
  603. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-mutation-classification.v1.json +554 -0
  604. package/node_modules/@mdbase-dev/connect-protocol/schemas/sync.v1.schema.json +483 -0
  605. package/node_modules/@noble/hashes/LICENSE +21 -0
  606. package/node_modules/@noble/hashes/README.md +478 -0
  607. package/node_modules/@noble/hashes/_blake.d.ts +20 -0
  608. package/node_modules/@noble/hashes/_blake.js +59 -0
  609. package/node_modules/@noble/hashes/_md.d.ts +95 -0
  610. package/node_modules/@noble/hashes/_md.js +209 -0
  611. package/node_modules/@noble/hashes/_u64.d.ts +36 -0
  612. package/node_modules/@noble/hashes/_u64.js +77 -0
  613. package/node_modules/@noble/hashes/argon2.d.ts +148 -0
  614. package/node_modules/@noble/hashes/argon2.js +577 -0
  615. package/node_modules/@noble/hashes/blake1.d.ts +162 -0
  616. package/node_modules/@noble/hashes/blake1.js +630 -0
  617. package/node_modules/@noble/hashes/blake2.d.ts +203 -0
  618. package/node_modules/@noble/hashes/blake2.js +573 -0
  619. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  620. package/node_modules/@noble/hashes/blake3.js +310 -0
  621. package/node_modules/@noble/hashes/eskdf.d.ts +91 -0
  622. package/node_modules/@noble/hashes/eskdf.js +225 -0
  623. package/node_modules/@noble/hashes/hkdf.d.ts +70 -0
  624. package/node_modules/@noble/hashes/hkdf.js +152 -0
  625. package/node_modules/@noble/hashes/hmac.d.ts +50 -0
  626. package/node_modules/@noble/hashes/hmac.js +93 -0
  627. package/node_modules/@noble/hashes/index.d.ts +1 -0
  628. package/node_modules/@noble/hashes/index.js +34 -0
  629. package/node_modules/@noble/hashes/legacy.d.ts +107 -0
  630. package/node_modules/@noble/hashes/legacy.js +348 -0
  631. package/node_modules/@noble/hashes/package.json +91 -0
  632. package/node_modules/@noble/hashes/pbkdf2.d.ts +66 -0
  633. package/node_modules/@noble/hashes/pbkdf2.js +176 -0
  634. package/node_modules/@noble/hashes/scrypt.d.ts +98 -0
  635. package/node_modules/@noble/hashes/scrypt.js +304 -0
  636. package/node_modules/@noble/hashes/sha2.d.ts +176 -0
  637. package/node_modules/@noble/hashes/sha2.js +446 -0
  638. package/node_modules/@noble/hashes/sha3-addons.d.ts +533 -0
  639. package/node_modules/@noble/hashes/sha3-addons.js +973 -0
  640. package/node_modules/@noble/hashes/sha3.d.ts +208 -0
  641. package/node_modules/@noble/hashes/sha3.js +475 -0
  642. package/node_modules/@noble/hashes/src/_blake.ts +67 -0
  643. package/node_modules/@noble/hashes/src/_md.ts +227 -0
  644. package/node_modules/@noble/hashes/src/_u64.ts +111 -0
  645. package/node_modules/@noble/hashes/src/argon2.ts +693 -0
  646. package/node_modules/@noble/hashes/src/blake1.ts +677 -0
  647. package/node_modules/@noble/hashes/src/blake2.ts +648 -0
  648. package/node_modules/@noble/hashes/src/blake3.ts +344 -0
  649. package/node_modules/@noble/hashes/src/eskdf.ts +265 -0
  650. package/node_modules/@noble/hashes/src/hkdf.ts +161 -0
  651. package/node_modules/@noble/hashes/src/hmac.ts +130 -0
  652. package/node_modules/@noble/hashes/src/index.ts +33 -0
  653. package/node_modules/@noble/hashes/src/legacy.ts +361 -0
  654. package/node_modules/@noble/hashes/src/pbkdf2.ts +219 -0
  655. package/node_modules/@noble/hashes/src/scrypt.ts +375 -0
  656. package/node_modules/@noble/hashes/src/sha2.ts +486 -0
  657. package/node_modules/@noble/hashes/src/sha3-addons.ts +1157 -0
  658. package/node_modules/@noble/hashes/src/sha3.ts +525 -0
  659. package/node_modules/@noble/hashes/src/utils.ts +978 -0
  660. package/node_modules/@noble/hashes/src/webcrypto.ts +283 -0
  661. package/node_modules/@noble/hashes/utils.d.ts +560 -0
  662. package/node_modules/@noble/hashes/utils.js +687 -0
  663. package/node_modules/@noble/hashes/webcrypto.d.ts +121 -0
  664. package/node_modules/@noble/hashes/webcrypto.js +228 -0
  665. package/node_modules/yaml/LICENSE +13 -0
  666. package/node_modules/yaml/README.md +172 -0
  667. package/node_modules/yaml/bin.mjs +11 -0
  668. package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
  669. package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
  670. package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
  671. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
  672. package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  673. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
  674. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
  675. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
  676. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  677. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
  678. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +226 -0
  679. package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
  680. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  681. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
  682. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  683. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
  684. package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
  685. package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
  686. package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
  687. package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
  688. package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
  689. package/node_modules/yaml/browser/dist/errors.js +57 -0
  690. package/node_modules/yaml/browser/dist/index.js +17 -0
  691. package/node_modules/yaml/browser/dist/log.js +11 -0
  692. package/node_modules/yaml/browser/dist/nodes/Alias.js +118 -0
  693. package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
  694. package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
  695. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  696. package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  697. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
  698. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
  699. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
  700. package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
  701. package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
  702. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
  703. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  704. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  705. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  706. package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
  707. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  708. package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
  709. package/node_modules/yaml/browser/dist/public-api.js +102 -0
  710. package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
  711. package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
  712. package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
  713. package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
  714. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  715. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  716. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  717. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  718. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  719. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  720. package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
  721. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
  722. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  723. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  724. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  725. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
  726. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
  727. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
  728. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
  729. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
  730. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  731. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
  732. package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
  733. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
  734. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
  735. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
  736. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
  737. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
  738. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
  739. package/node_modules/yaml/browser/dist/util.js +11 -0
  740. package/node_modules/yaml/browser/dist/visit.js +233 -0
  741. package/node_modules/yaml/browser/index.js +5 -0
  742. package/node_modules/yaml/browser/package.json +3 -0
  743. package/node_modules/yaml/dist/cli.d.ts +8 -0
  744. package/node_modules/yaml/dist/cli.mjs +201 -0
  745. package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
  746. package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  747. package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
  748. package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
  749. package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
  750. package/node_modules/yaml/dist/compose/compose-node.js +112 -0
  751. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  752. package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
  753. package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
  754. package/node_modules/yaml/dist/compose/composer.js +224 -0
  755. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  756. package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
  757. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
  758. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  759. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
  760. package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
  761. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  762. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  763. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
  764. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
  765. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  766. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +228 -0
  767. package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
  768. package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
  769. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  770. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  771. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  772. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
  773. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  774. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  775. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  776. package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
  777. package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
  778. package/node_modules/yaml/dist/doc/Document.js +337 -0
  779. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  780. package/node_modules/yaml/dist/doc/anchors.js +76 -0
  781. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  782. package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  783. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  784. package/node_modules/yaml/dist/doc/createNode.js +90 -0
  785. package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
  786. package/node_modules/yaml/dist/doc/directives.js +178 -0
  787. package/node_modules/yaml/dist/errors.d.ts +21 -0
  788. package/node_modules/yaml/dist/errors.js +62 -0
  789. package/node_modules/yaml/dist/index.d.ts +25 -0
  790. package/node_modules/yaml/dist/index.js +50 -0
  791. package/node_modules/yaml/dist/log.d.ts +3 -0
  792. package/node_modules/yaml/dist/log.js +19 -0
  793. package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
  794. package/node_modules/yaml/dist/nodes/Alias.js +120 -0
  795. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  796. package/node_modules/yaml/dist/nodes/Collection.js +151 -0
  797. package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
  798. package/node_modules/yaml/dist/nodes/Node.js +40 -0
  799. package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
  800. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  801. package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
  802. package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  803. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
  804. package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  805. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
  806. package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  807. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
  808. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
  809. package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
  810. package/node_modules/yaml/dist/nodes/identity.js +53 -0
  811. package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
  812. package/node_modules/yaml/dist/nodes/toJS.js +39 -0
  813. package/node_modules/yaml/dist/options.d.ts +350 -0
  814. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  815. package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  816. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  817. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  818. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  819. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  820. package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
  821. package/node_modules/yaml/dist/parse/cst.js +112 -0
  822. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  823. package/node_modules/yaml/dist/parse/lexer.js +723 -0
  824. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  825. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  826. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  827. package/node_modules/yaml/dist/parse/parser.js +980 -0
  828. package/node_modules/yaml/dist/public-api.d.ts +44 -0
  829. package/node_modules/yaml/dist/public-api.js +107 -0
  830. package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
  831. package/node_modules/yaml/dist/schema/Schema.js +39 -0
  832. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  833. package/node_modules/yaml/dist/schema/common/map.js +19 -0
  834. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  835. package/node_modules/yaml/dist/schema/common/null.js +17 -0
  836. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  837. package/node_modules/yaml/dist/schema/common/seq.js +19 -0
  838. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  839. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  840. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  841. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  842. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  843. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  844. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  845. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  846. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  847. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  848. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  849. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  850. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  851. package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
  852. package/node_modules/yaml/dist/schema/tags.js +99 -0
  853. package/node_modules/yaml/dist/schema/types.d.ts +92 -0
  854. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  855. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
  856. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  857. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  858. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  859. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  860. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  861. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  862. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
  863. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
  864. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
  865. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  866. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  867. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  868. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  869. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
  870. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
  871. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  872. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  873. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  874. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  875. package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  876. package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
  877. package/node_modules/yaml/dist/stringify/stringify.js +132 -0
  878. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  879. package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
  880. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  881. package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  882. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
  883. package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  884. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  885. package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
  886. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  887. package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  888. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
  889. package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
  890. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  891. package/node_modules/yaml/dist/test-events.js +134 -0
  892. package/node_modules/yaml/dist/util.d.ts +16 -0
  893. package/node_modules/yaml/dist/util.js +28 -0
  894. package/node_modules/yaml/dist/visit.d.ts +102 -0
  895. package/node_modules/yaml/dist/visit.js +236 -0
  896. package/node_modules/yaml/package.json +97 -0
  897. package/node_modules/yaml/util.js +2 -0
  898. package/package.json +108 -4
  899. package/vendor/mdbase-connect-sdk-e6e66bcd172f.json +13 -0
  900. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.145-e6e66bcd172f.tgz +0 -0
package/README.md CHANGED
@@ -1,3 +1,845 @@
1
- # Temporary Holding Version
1
+ # @mdbase-dev/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@mdbase-dev/sdk` on npmjs contains production trust only. Staging/LAB use
4
+ separately attested, version-pinned GitHub prerelease assets, not npm packages
5
+ published to a registry. Publication uses the exact production-verified release
6
+ tag and version; see
7
+ [`docs/sdk-publication.md`](../../../docs/sdk-publication.md).
8
+
9
+ The TS SDK for mdbase-next replicas. It implements the client side of
10
+ `docs/contracts/replica-client-api.md` and is what web apps, Obsidian plugins and
11
+ scripts use instead of today's `@mdbase-dev/connect`.
12
+
13
+ The SDK implements transport, session and typed client-API boundaries.
14
+
15
+ ## Layout
16
+
17
+ | Path | What |
18
+ |---|---|
19
+ | `src/index.ts` (`@mdbase-dev/sdk`) | The full entry: everything in the thin client, plus `MdbaseConnect` (which validates the app's declaration), people, timers, notifications, holds, `describeError`, `WasmRuntime` and `inProcessConnector` |
20
+ | `src/thin-client.ts` (`@mdbase-dev/sdk/thin-client`) | The thin client for consumers that bring their own connection (an Obsidian-plugin-style integration): codec, client, records, files, presence, Noise and relay transports, keys, status, availability. Held to 64 KiB gzip and never bundles manifest validation |
21
+ | `src/cbor.ts` | Strict `mdb-cbor/1` codec (00-overview §3.2): the TS twin of `crates/wire/src/cbor.rs` |
22
+ | `src/codec.ts` | Typed struct/union/enum codecs, the TS twin of `crates/wire/src/schema.rs` |
23
+ | `src/wire.ts` | Client API messages and operations, typed (mirrors `crates/wire/src/client.rs`, `intent.rs`) |
24
+ | `src/errors.ts` | The 15 error codes and `MdbaseError` (§9) |
25
+ | `src/transport/noise.ts` | `Noise_IK_25519_ChaChaPoly_SHA256` for local IPC and relay sessions (§12.2, §12.3) |
26
+ | `src/session.ts`, `src/client.ts` | One session (frames, cancel, pushes); `MdbaseClient` (reads, live queries, writes, receipts, status, holds, conflicts, fence, reconnect) |
27
+ | `src/files.ts`, `src/presence.ts` | Files (§10) and presence (§11) |
28
+ | `src/view-sources.ts` | Shared saved-view source create/update helpers over ordinary record intents |
29
+ | `src/records.ts`, `src/records/` | Shared record editor leases, bounded drafts and exact receipt recovery |
30
+ | `src/timers.ts` | Opaque control-plane timers and push channel registration (`connection.timers`) |
31
+ | `src/notifications.ts` (`@mdbase-dev/sdk/notifications`) | The push delivery envelope (`docs/contracts/push-envelope.md`) and service-worker helpers |
32
+ | `src/describe-error.ts` (`@mdbase-dev/sdk/describe`) | `describeError()`: plain-language title, message and suggested action for any SDK error, sign-in/open problem (including `collection_migrating`, `account_suspended`, `update_required`) or readiness facet |
33
+ | `src/collection-availability.ts` | `CollectionAvailability` (`available`, `opening`, `unavailable` + reason): Private collections served by one of the account's computers, and listed cloud copies (`AppInstallationCollection.availability`, absent meaning available) |
34
+ | `src/app-grant/` (`@mdbase-dev/sdk/app-grant`) | `MdbaseAppGrants`: grants for Private collections (OAuth PKCE + an attested client Noise key), listing with availability, bounded waits, relay connector |
35
+ | `src/private.ts` | Device approval and recovery key (private collections) |
36
+ | `src/keys.ts` | Client static keys: non-extractable WebCrypto X25519 in IndexedDB where possible |
37
+ | `src/transport/port.ts` | The transport seam: `FramePort`, `Connector`, `u32be` record framing |
38
+ | `src/transport/inprocess.ts` | In-process connector to a shared runtime (§12.1) |
39
+ | `src/transport/noise-session.ts` | Noise sessions over message carriers (WebSocket, `u16be`-framed streams) |
40
+ | `src/transport/relay.ts` | Relay / hosted replica connector (§12.3) |
41
+ | `src/node.ts` (`@mdbase-dev/sdk/node`) | Local IPC to the daemon (§12.2) |
42
+ | `src/testing/` (`@mdbase-dev/sdk/testing`) | `MemoryReplica` (in-memory replica speaking the protocol) and `serveNoise` |
43
+ | `test/golden.test.ts` | Runs every fixture in `conformance/wire/` from TS |
44
+
45
+ ## Value model
46
+
47
+ What the SDK hands to apps, following §12.1:
48
+
49
+ | CBOR | TS |
50
+ |---|---|
51
+ | integer within ±(2^53−1) | `number` |
52
+ | integer beyond that | `bigint` |
53
+ | float with a fractional part | `number` |
54
+ | integral float (`1.0`, `-0.0`) | `Float64` (so `1` and `1.0` stay distinct) |
55
+ | byte string | `Uint8Array` |
56
+ | data map (text keys, order is data) | `Map<string, …>` |
57
+ | struct map | `Map<number, …>` at the raw level; named-field objects in the typed layer |
58
+
59
+ In the typed layer, UUIDs are canonical lowercase strings, hashes are `sha256:<hex>`
60
+ revision tokens, and enumerations are their snake_case names.
61
+
62
+ ## Usage
63
+
64
+ ```ts
65
+ import { connect, relayConnector, loadOrCreateClientKey } from "@mdbase-dev/sdk";
66
+
67
+ const key = await loadOrCreateClientKey("my-app"); // register key.publicKey with the grant
68
+ const db = await connect({
69
+ app: { name: "my-app", version: "1.0.0" },
70
+ connector: relayConnector({ collection, grant, staticKey: key, resolveRoute }),
71
+ waitForDevice: true, // private collections
72
+ });
73
+
74
+ const tasks = db.live({ types: ["task"], order_by: ["-due"], limit: 200 }); // windowed, no bodies
75
+ tasks.subscribe((s) => render(s.records, { stale: s.stale, complete: s.complete }));
76
+
77
+ const rec = await db.get(id, { body: true });
78
+ const w = await db.update(rec, { patch: { status: "done" }, body: edited }); // base + body edits filled in
79
+ w.records; // optimistic view now
80
+ await w.confirmed; // at a log position, or throws MdbaseError (15 codes)
81
+
82
+ db.onStatus((s) => show(`Synced through ${s.confirmedThrough}` + (s.pending ? `, ${s.pending} waiting` : "")));
83
+ ```
84
+
85
+ `await db.create(input)` returns a `RecordWrite`, the existing tracked `Write`
86
+ with an added `recordId`. It is the submitted UUID, available even when the
87
+ receipt has no optimistic records. Contract creates and retries with the same
88
+ `intent` return that same identity. Confirmation/publication semantics are unchanged.
89
+ Likewise, `files.upload()` returns `FileWrite.fileId`; concurrent uploads on one
90
+ client run in FIFO order through the replica's single upload lane. An upload
91
+ releases the queue after its commit receipt, without waiting for log confirmation.
92
+
93
+ ## Record editor leases
94
+
95
+ ```ts
96
+ const lease = await db.records.open({path: "notes/writing.md"}, {
97
+ autosave: {idleMs: 500}, // omitted/false means explicit flush only
98
+ signal,
99
+ });
100
+ const stop = lease.session.subscribe(() => render(lease.session.getSnapshot()));
101
+ lease.session.setBody(editedBody);
102
+ lease.session.patchFrontmatter({title: "New title"}); // undefined unsets a key
103
+ const result = await lease.session.flush({timeoutMs: 30_000, signal});
104
+ if (!result.ok) showProblem(result.problem);
105
+ stop();
106
+ lease.release();
107
+ ```
108
+
109
+ UUIDs and `{path}` selectors use ordinary native `get`/`update` operations. Full
110
+ native document/body/revision and current protection gates are required; edits
111
+ use the actual source's whole-document CAS, field observations and body base.
112
+ There is no source reconstruction, replacement record UUID or new app database.
113
+ `records.open` throws SDK errors; `flush` returns `{ok, record}` or `{ok, problem}`.
114
+ Snapshots retain exact SDK value maps, native `record`/`remote`, draft `body`,
115
+ `dirty`, `problem`, and the original `recovery` mutation identity/receipt/`Write`.
116
+ Saved requires actual confirmed, unprotected, same-UUID full native readback;
117
+ receipt confirmation alone (or optimistic/pending readback) is insufficient.
118
+
119
+ Submission is serialized per UUID/client. A mutation ID is exposed through the
120
+ snapshot **before** submission. Ambiguous submit/readback failures keep that ID;
121
+ subsequent flush only awaits its actual receipt, never resubmits or substitutes
122
+ another mutation. New edits made during capture remain drafts for a subsequent
123
+ intent only after the first has genuinely settled. A unique pending operation
124
+ from this client's native pending API can recover an editor session; foreign or
125
+ ambiguous pending ownership refuses. Across client lifetime/reload, retain the
126
+ snapshot's `RecordRecoveryRef` (`mutationId`, `recordId`, `baseRevision`) in the
127
+ caller-owned recovery state and pass it as `open(..., {recovery})`, particularly
128
+ when the receipt settled but readback failed. The helper adds no durable journal
129
+ and does not infer ownership from a shared current pending record.
130
+
131
+ Active leases share the UUID's draft/session and must agree on autosave/timeout
132
+ policy. Releasing/aborting one lease unsubscribes it without closing the client
133
+ or evicting another lease. Last release stops autosave/observation and aborts
134
+ late delivery, retaining unsaved/recovering data for reopen on the same client.
135
+ Client close suspends all leases. Retention is bounded to 64 sessions and 8 MiB
136
+ of serialized retained-data accounting; budget refusal never evicts drafts.
137
+ This accounting is not a measured peak-heap claim.
138
+
139
+ For a settled CAS conflict, `resolve({keep: "mine" | "theirs"})` or
140
+ `resolve({body})` explicitly rebases on a genuine confirmed/unprotected remote
141
+ readback. Native held/unresolved records remain refused: the current native
142
+ hold-resolution producer lacks caller-captured mutation identity and cancellation,
143
+ so this helper cannot safely resolve a hold or retry its unknown outcome. It does
144
+ not use a fresh `resolveHold` call as a workaround. Change notifications hydrate
145
+ the same UUID; observer failure is exposed, not treated as a successful refresh.
146
+
147
+ ### Writer lease mapping
148
+
149
+ Writer's editor leases are local references to a shared draft/session, not
150
+ server-issued exclusive editing locks. Its existing lease contract maps to the
151
+ public SDK without a new lease RPC:
152
+
153
+ | Writer use | Public SDK operation |
154
+ | --- | --- |
155
+ | Open/follow a manuscript or embedded record | `records.open(ref, {autosave, timeoutMs, signal})`, session `subscribe` / `getSnapshot` |
156
+ | Edit body or staged frontmatter | Session `setBody` / `patchFrontmatter` |
157
+ | Autosave or explicit bounded save | Session `flush`; actual revision CAS and original mutation/receipt recovery |
158
+ | Show saved/conflict/recovery/deleted state | Genuine session snapshot; confirmed receipt plus full confirmed/unprotected same-UUID readback for saved |
159
+ | Choose a settled CAS conflict result | Session `resolve`; native held/unresolved records remain refused |
160
+ | Recover across client lifetimes (caller retains witness) | Retained `RecordRecoveryRef` passed to `records.open`; never a replacement mutation |
161
+ | Close an editor | Unsubscribe and `lease.release`; local lifetime release, not a remote unlock or save acknowledgment |
162
+
163
+ Sharing is per UUID/client, not across devices or independent clients. Revision
164
+ CAS protects save attempts; it does not exclude another editor. Writer's lease
165
+ flow does not need presence. The current native Replica presence RPCs return
166
+ `not_yet("presence")`, even though its hello can admit the `presence` marker;
167
+ negotiation alone is not a live presence implementation or write authority.
168
+ This mapping does not qualify Writer's native UI/runtime integration.
169
+
170
+ ## Classic-script browser bundle
171
+
172
+ `npm run build` includes `dist/browser/mdbase-sdk.js` and
173
+ `dist/browser/mdbase-sdk.min.js` in the SDK archive. Serve the exact qualified
174
+ archive's asset from your app's origin; no CDN publication is implied.
175
+
176
+ ```html
177
+ <script src="./vendor/mdbase-sdk.min.js"></script>
178
+ <script>
179
+ const { connect, Client, AppHost } = window.MdbaseSDK;
180
+ // Root exports match @mdbase-dev/sdk; Client groups client.ts exports.
181
+ // AppHost matches @mdbase-dev/sdk/app-host.
182
+ </script>
183
+ ```
184
+
185
+ Module consumers can import the same surface from `@mdbase-dev/sdk/browser`.
186
+ There is no `MdbaseConnect` compatibility shim or app-specific adapter. Loading
187
+ this bundle does not create a session, open storage, load a WASM runtime or grant
188
+ access. App-host APIs still require explicit qualified app/environment trust,
189
+ runtime, origin and custody inputs. This package does not supply a complete web
190
+ Worker/session/runtime composition; use the shared SDK composition when available,
191
+ not an app-specific substitute. Packaging tests are not sign-in, CRUD, custody,
192
+ physical durability or release-qualification evidence.
193
+
194
+ ## Application access and step-up
195
+
196
+ `MdbaseConnect` replaces the Connect session's `authorize(target)`:
197
+ `authorize()` (sign in or choose), `reauthorize()` (the open or requested
198
+ collection, `authorize("selected")`), `approve(id)` (`{collectionId}`) and
199
+ `chooseAnother()`. Call them from the user gesture; the SDK reserves the popup,
200
+ and a `signal` replaces `timeoutMs`. There is no per-call capability list
201
+ (`requestCapabilities`, `requestOperations`, `ensure*`): approval always asks for
202
+ the declaration's groups.
203
+
204
+ `effectiveCapabilities(declaration, connection)` compares the declaration's v2
205
+ required and optional groups with the current session's negotiated hello grant,
206
+ for step-up UI only, and returns `{values, requiredAvailable, missing}` (null
207
+ without a v2 contract). It does not refresh permissions or authorize an
208
+ operation; native operation checks remain authoritative. For write access after
209
+ a read-only grant, show `missing` and call `reauthorize()`. Reauthorization still
210
+ requires user approval and may return another restricted grant.
211
+
212
+ ### Optional file actions at the moment of use
213
+
214
+ Declare a file action the app needs only sometimes (adding an image, say) in
215
+ `requirements.files.optional`, and ask for it the first time the person does
216
+ that, from the same click:
217
+
218
+ ```ts
219
+ const result = await app.requestAccess({files: ["add"]}, {reason: "Insert images into your notes"});
220
+ if (result.status === "granted") await connection.files.upload(path, image);
221
+ else if (result.status === "declined") show(describeError("access_declined"));
222
+ // "cancelled": the window was closed, the request expired or `signal` aborted.
223
+ ```
224
+
225
+ `requestAccess` resolves `granted` at once, with no window, when the action is
226
+ already allowed (required, or allowed earlier). Otherwise it opens Connect for
227
+ the open collection with the one-line `reason` (at most 140 characters). The
228
+ connection stays open and the app keeps its state. An action the manifest does
229
+ not declare rejects with `access_undeclared`. Until the person allows it,
230
+ `files.upload` (and `replace`, `move`, `delete` when optional) rejects with a
231
+ `forbidden` error whose reason is `access_required`; its `describeError` copy
232
+ has an "Allow" action that should call `requestAccess`. `files.grant` leaves out
233
+ writes not yet allowed.
234
+
235
+ File-action consent is advisory on an installation device: Connect records the
236
+ person's choice and the SDK enforces it, but the app's own replica is not
237
+ narrowed by it.
238
+
239
+ ## Cloud-copy first-open waits
240
+
241
+ Initial opening keeps the same enrolled device, native host, SQL and keys while
242
+ retrying a parsed CP HTTP 503 `busy` log-token refusal. There are at most three
243
+ log-init attempts; retries must fit a 15-second scheduling window and respect
244
+ Retry-After. Individual challenge/mint requests retain their 15-second deadlines.
245
+ Unknown 401/403/409 responses, malformed responses and generic unavailable errors
246
+ do not authorize a retry. Each failed mint retry obtains a fresh challenge/proof,
247
+ not another enrollment or collection.
248
+
249
+ For a previously synced local replica, the native verified-read gate keeps its
250
+ 15-second deadline, including connect, pump and Query. For a cold replica (the
251
+ SDK join ledger has never recorded a completed first sync), the same 15 seconds
252
+ bounds **lack of progress**, not total catch-up time. The watchdog observes native
253
+ accepted prefix, advancing data/control READ cursors and snapshot-install
254
+ positions even while a multi-RPC pump is pending. Control READ cursors cover
255
+ key scanning whose native `reading` incident does not expose intermediate
256
+ positions. Only native-accepted replies to increasing cursors count; sending
257
+ calls, rejected replies, head growth, heartbeats and repeated cursors do not
258
+ reset it. Active, size/range-capped response bytes can defer a stall for the
259
+ already in-flight calls under their existing per-request deadlines; they do not
260
+ reset native progress or admit READ. Once those calls settle, successive retries
261
+ cannot renew that deferral without accepted native progress. This also covers
262
+ object downloads whose existing per-request budget exceeds 15 seconds.
263
+ Cold catch-up must reach the complete known prefix,
264
+ then pass an actual native Query; metadata never admits a data facade. A stall
265
+ fails typed `AppCloudCopyHostError("sync_stalled")` (the existing public
266
+ `unavailable` problem with a distinct diagnostic code).
267
+
268
+ Both paths retain typed READ-unavailable pacing (250 ms, 500 ms, then at most
269
+ one per second). Explicit server authority outcomes and typed HTTP 403
270
+ `forbidden` are latched against concurrent success. An HTTP status alone is not
271
+ terminal: stale-token 401 can invalidate/refresh through the existing authority,
272
+ and opaque routing/timeouts keep the existing NoResponse path. Native Query
273
+ `unauthenticated`/`forbidden` errors still refuse without retry. Cancellation stops the waits;
274
+ failed keyring recovery and non-retryable native errors still refuse. This remains the existing opening
275
+ state, with explicit retry after a terminal failure: no new migration state,
276
+ write/setup replay, legacy fallback or application retry loop is needed.
277
+
278
+ ## Private collections from web apps
279
+
280
+ `@mdbase-dev/sdk/app-grant` lets a signed-in web app open a Private collection
281
+ through the relay to one of the account's online computers. It is a separate
282
+ entry so apps that only use cloud copies don't load it.
283
+
284
+ - `new MdbaseAppGrants({declaration, redirectUri})`; `authorize({popup})` from the
285
+ user gesture asks for a grant (OAuth PKCE, popup, at most 30 minutes). The
286
+ redirect page calls `deliverAppGrantCallback(location.href)`.
287
+ - `collections()` lists granted Private collections with `availability`;
288
+ `mergeCollectionEntries(cloud, privates)` merges them with cloud copies.
289
+ - `waitForAvailable(id, {timeoutMs})` polls (default 60 s, at most 10 minutes)
290
+ and returns the last availability; it never waits on `sync_required` or
291
+ `access_removed`. `connector(id)` opens; an unavailable collection fails with
292
+ `collectionUnavailableError(reason)`, and `describeError` gives the copy.
293
+
294
+ Storage: the installation signing key and each grant's Noise static key are
295
+ non-extractable WebCrypto keys structured-cloned into IndexedDB. The refresh
296
+ token is stored only as AES-256-GCM ciphertext under a per-grant
297
+ non-extractable key, and access tokens stay in memory. Script can use but not
298
+ read these secrets, so it cannot copy them elsewhere; same-origin script running
299
+ while the app is open can still use them, so apps still need a strict CSP.
300
+ The default store belongs to the app's own manifest family (`bundle:<manifest
301
+ id>` from its declaration), never the id Connect assigns: the database name,
302
+ every record and the refresh ciphertext carry it, and records for another owner
303
+ are refused. Grants stored before this labelling are not adopted; the app asks
304
+ for access again and the old records are left in place.
305
+
306
+ ### Listing and opening Private collections in an app
307
+
308
+ Every launch app follows the same pattern (the Editor's `private-collections.ts`
309
+ and `SdkEditorRoot.tsx` are the reference):
310
+
311
+ 1. **Load it lazily.** Construct one `MdbaseAppGrants` per app, behind
312
+ `import("@mdbase-dev/sdk/app-grant")` on first use, so the relay and grant code
313
+ stay out of the initial bundle. `redirectUri` is the manifest redirect URI on
314
+ the app's own origin.
315
+ 2. **Handle the callback page.** When the app loads with `state` and `code` or
316
+ `error` in its URL, call `deliverAppGrantCallback(location.href)`, then
317
+ `window.close()`. Don't start the application SDK in that window.
318
+ 3. **List.** Once signed in, merge `grants.collections()` into the chooser with
319
+ `mergeCollectionEntries(snapshot.collections, privates)`. `collections()` is
320
+ empty until this browser holds a grant, so always offer **Add a Private
321
+ collection**. It calls `authorize({popup})`; reserve the popup with
322
+ `window.open` inside the click, before any `await`.
323
+ 4. **Show availability.** Every merged entry has one `availability` shape:
324
+ cloud copies take theirs from `snapshot.collections` (absent there means
325
+ available), Private ones from `collections()`.
326
+ `describeError(entry.availability)` gives the title and message for each
327
+ reason. Actions:
328
+
329
+ | Availability | Action |
330
+ |---|---|
331
+ | `available` | Open |
332
+ | `opening`, `device_offline`, `approval_required`, `desktop_update_required`, `old_connector_running`, `no_device_registered` | Open: `waitForAvailable(id, {onAvailability})` (bounded), then open when it reports `available` |
333
+ | `sync_required` | **Give access again**: `authorize({popup, collection: id})` |
334
+ | `access_removed` | No open. For a Private entry, offer `forget(id)` to remove it from this browser |
335
+ | `collection_migrating` | Wait; the collection reopens when the upgrade is done |
336
+ | `collection_deleted` | No open |
337
+
338
+ 5. **Open.** `connect({connector: grants.connector(id), app})` returns an
339
+ `MdbaseClient` that the app owns. Check `client.collection === id`, and close
340
+ the client when the person leaves the collection. A failure carries its
341
+ availability reason, so pass it to `describeError`.
342
+
343
+ 6. **People.** `grants.people(id, client)` returns the same `MdbasePeopleClient`
344
+ as cloud copies (`current()`, `members()`, `directory()`), reading Person
345
+ records over `client` and identity and members from Connect with the grant.
346
+ Until a computer approves the app, identity and members fail with
347
+ availability `approval_required`; members also need the person's people
348
+ approval (`people_permission_declined` otherwise). Needs a Connect server
349
+ that serves people metadata for Private grants; older ones answer
350
+ `people_unsupported` or refuse the token.
351
+
352
+ 7. **Setup.** `grants.setup(client)` gives the same plan and review wording as
353
+ a cloud copy's `setup`. `assess()` answers `ready`, `setup_required` or
354
+ `incompatible`. `plan({adopt?, records?})` returns an `MdbaseSetupPlan`:
355
+ show its `summary`, then each `changes[].message` (for example "Add the
356
+ "task" record type."), and offer `adoptable` conflicts as a choice.
357
+ `apply(plan)` writes everything in one guarded mutation that the person's
358
+ computer checks. If anything changed since the review it refuses
359
+ `setup_changed` and writes nothing, so plan again. The original Native session
360
+ must negotiate `declared-collection-setup-v1`; Native verifies the signed
361
+ declaration and plans the complete batch. This does not require or grant
362
+ arbitrary `definitions.manage`. Starter notes independently need `records.create`.
363
+ Before apply, the SDK durably retains an encrypted original mutation ID under
364
+ existing grant custody. Lost/unknown outcomes reconcile that receipt only;
365
+ they never replay setup or fall back to Hosted. Custom grant stores must
366
+ implement the optional setup-attempt register to support setup.
367
+
368
+ Not covered yet for Private collections:
369
+
370
+ - The `MdbaseApplication` readiness flow (`configure`) doesn't apply; use
371
+ `grants.setup(client)` and `grants.availability(id)`.
372
+ - Merged entries carry `role` (`owner`, `editor`, `viewer` or `null`). Cloud
373
+ copies always have one. A Private entry's is `null` when Connect doesn't
374
+ report it: older servers, or an account whose access needs renewing. Gate
375
+ owner actions on `role === "owner"`; Connect still checks each action.
376
+
377
+ ## Managed application build environments
378
+
379
+ Application declarations support explicit `lab`, `staging` and `production`
380
+ environments. Each SDK artifact must be packaged with the completed authenticated
381
+ trust handoff for that exact environment; changing an app build variable cannot
382
+ retarget a LAB archive. Staging packaging pins Connect to
383
+ `https://connect-staging.mdbase.dev`, production to `https://connect.mdbase.dev`.
384
+ CP/log origins and release trust still come only from the verified build context;
385
+ missing, expired or crossed trust refuses without a fallback. Staging and
386
+ production do not permit HTTP loopback app origins. Isolated `local` builds remain
387
+ separate and refuse all managed environments.
388
+
389
+ The app manifest must declare the installation origin under
390
+ `installation_origins.staging` for staging pairing, just as for other environments.
391
+ Packaging support alone is not an application deployment or acceptance receipt.
392
+
393
+ ## Native shells and browser extensions
394
+
395
+ A Capacitor app declares its native origin (for example
396
+ `capacitor://app.tasknotes.dev`) as `origin`, and lists it in the manifest under
397
+ `installation_origins.<environment>.mobile`. Pairing then uses installation kind
398
+ `mobile`. `capacitor://` origins default to that kind; an Android shell served
399
+ from https sets `installationKind: "mobile"`. A Chrome extension uses its
400
+ `chrome-extension://<id>` origin under `installation_origins.<environment>.app-runtime`.
401
+ Firefox `moz-extension://` origins differ per profile and are not accepted by
402
+ Connect.
403
+
404
+ Where a popup is unavailable, pass a sign-in opener:
405
+
406
+ ```ts
407
+ const connect = new MdbaseConnect(declaration, {
408
+ signIn: {
409
+ open: url => Browser.open({ url }), // or chrome.tabs.create({ url })
410
+ close: () => Browser.close(),
411
+ returnUrl: "dev.tasknotes.app://auth/mdbase/callback", // optional; see below
412
+ },
413
+ followVisibility: true, // re-poll as soon as the app returns to the foreground
414
+ });
415
+ ```
416
+
417
+ `returnUrl` must exactly equal one of the manifest's `redirect_uris`, or the
418
+ constructor throws `application_sign_in_opener`. That is either an https URL on
419
+ the homepage origin or, for a native app, a private-use scheme derived from the
420
+ manifest ID (RFC 8252), such as `dev.tasknotes.app://auth/mdbase/callback` for
421
+ ID `dev.tasknotes.app`. No prefix or wildcard matching. Connect applies the same
422
+ exact match before it returns the user there. The URL carries no credential:
423
+ sign-in still completes by the SDK's pairing poll.
424
+
425
+ The SDK still binds the URL to the environment's Connect origin. The pending
426
+ pairing request is persisted, so a context that closes during sign-in (an
427
+ extension popup) resumes it on the next `start()`. Run extension sign-in from a
428
+ side panel or tab page where possible. Without `followVisibility`, call
429
+ `application().setForeground(active)` from the shell's resume/pause events.
430
+
431
+ ## Multiple vaults on one origin
432
+
433
+ Give each vault a stable, distinct `storage.applicationNamespace` (different
434
+ from the application ID). The SDK scopes tab/Worker grouping, pre-account
435
+ sign-in locks, protected installations and Private grants to that namespace.
436
+ Each vault pairs independently and receives its own installation/device IDs;
437
+ the existing device-key stores and OPFS replica pools then remain separate.
438
+ Signing out erases only that namespace's installations, grants and replica data,
439
+ and evicts log tokens matching its CP/connector/device, including unlisted
440
+ collections. Other vaults stay signed in.
441
+
442
+ ```ts
443
+ const vault = createMdbase({
444
+ ...declaration,
445
+ storage: { applicationNamespace: "obsidian-vault-<stable-vault-id>" },
446
+ });
447
+ ```
448
+
449
+ Omitted join/setup database names derive from the namespace. If you override
450
+ `joinDatabaseName` or `setupDatabaseName`, keep those names distinct per vault
451
+ as well: sign-out deletes those explicitly assigned journals. Namespace changes
452
+ select fresh local storage; they do not migrate or adopt a previous installation
453
+ or grant. Previously used overrides must pair and authorize afresh after this
454
+ change. Keep the same namespace across reloads and builds.
455
+
456
+ The no-override path keeps its existing names, owners, Worker grouping and
457
+ legacy sign-in compatibility locks, including legacy whole-token-cache erasure.
458
+ A default sign-out also clears all other vaults' cached log tokens on the origin;
459
+ they re-mint them on next open.
460
+ Public verified-asset and manifest-registration caches remain shared. Namespaces
461
+ organize storage; they are not a security boundary against other JavaScript on
462
+ the same origin. Consent and grant verification remain authoritative.
463
+
464
+ ## Definition errors
465
+
466
+ An error-level issue on a definition the app does not declare never affects
467
+ readiness. An issue without a path always makes the collection
468
+ `incompatible`. By default, an issue on one of the app's own declared types
469
+ also makes it `incompatible`. To keep the rest of the collection usable, pass
470
+ `readiness: {typeIssues: "degrade"}`. The collection then stays `ready`, and
471
+ each affected type is listed in `readiness.assessment.unavailableTypes`
472
+ (`{name, path, contract, problem}`). Treat that type as unavailable. Show
473
+ `describeError(entry).message` for it. An error on a declared contract's own
474
+ definition always blocks.
475
+
476
+ ## Collection setup
477
+
478
+ `application.setup` sets up the open collection from the app's declaration
479
+ with one review screen. `plan(options)` changes no collection data: native Core plans the
480
+ declared types into the collection's configured definition folders (an
481
+ installed pack stays where it is) and the SDK words the result for a
482
+ first-run user. Show `summary`, then `changes[].message` as a list,
483
+ `conflicts[].message` and `refusal.message` as is. No message contains a code.
484
+
485
+ Before planning, `plan` first settles any earlier setup still in progress
486
+ (for example, records that an interrupted apply was confirmed or finally
487
+ rejected), so it can write the SDK's own local setup journal. It never
488
+ prepares, submits or retries a collection change.
489
+
490
+ ```ts
491
+ let plan = await app.setup.plan({ records: [{ path: "Welcome.md", document: welcome }] });
492
+ if (Object.keys(plan.adoptable).length && userChoseAppVersions) {
493
+ plan = await app.setup.plan({ adopt: plan.adoptable, records: [{ path: "Welcome.md", document: welcome }] });
494
+ }
495
+ if (plan.canApply) await app.setup.apply(plan);
496
+ ```
497
+
498
+ `status` is `current` (nothing to do), `setup` or `conflict`. A conflict that
499
+ `adoptable` lists is an existing definition with different content: if the
500
+ user chooses the app's version, plan again with `adopt` and that definition is
501
+ replaced over exactly the reviewed revision. `staged` holds the definition
502
+ documents setup would write, for a details view.
503
+
504
+ Starter `records` (at most 32, 256 KiB in total) are created once, in the
505
+ same mutation as the setup, and only if setup has something to do. A path
506
+ that is already occupied is listed with action `skip` and left alone.
507
+ Creating them needs `records.create`. After apply, each starter record is
508
+ checked by its identity, path and confirmation, not by its exact bytes: Core
509
+ may canonicalize frontmatter on create, and a later edit to that note does not
510
+ make setup fail.
511
+
512
+ `apply(plan)` takes a plan from `plan` unchanged and writes everything as one
513
+ guarded mutation, all or nothing. If the collection changed since review,
514
+ including a definition or starter path taken in the meantime, it refuses with
515
+ `conflict`/`setup_changed`, nothing is applied, and the next `plan` starts
516
+ afresh. If another Private setup plan only retired Native's review ticket,
517
+ the SDK re-plans once and continues only when the fresh assessment and file
518
+ impact match the original consent. Different changes return `setup_changed`
519
+ (`mdbase.setup.apply` returns `outcome: "changed"`); show a fresh plan and ask
520
+ for consent again. Lost or uncertain mutation outcomes are never retried.
521
+ Refusal codes: `setup_forbidden` (no `definitions.manage`),
522
+ `setup_conflict`, `setup_unresolved`, `installed_newer` (a newer app version
523
+ set it up; `setup_downgrade` is its former name) and `setup_records_forbidden`.
524
+ `setup_unresolved` means the collection still lacks what the app needs but
525
+ setup has nothing it may write: a type the app seeded was edited away from
526
+ every published version, so it can't be upgraded, or was removed. The person
527
+ restores it in the collection; readiness re-checks and the next `plan` reflects it.
528
+
529
+ `configure()` is plan and apply in one step, for collections with nothing to
530
+ review. A conflict leaves the configuration facet `incompatible`; use
531
+ `setup.plan()` to show it.
532
+
533
+ ## Deleting a collection
534
+
535
+ Owners can delete a collection for everyone with `application.deleteCollection(id, {confirmName})`.
536
+ Show it only when the collection's `role` in `snapshot.collections` is `"owner"`, and only after a
537
+ confirmation where the person types the collection's name. `confirmName` must equal the current name after trimming (`New collection` for an unnamed one);
538
+ the control plane checks ownership and the name, and refuses while an account upgrade is in progress.
539
+
540
+ Deletion revokes access on every device and app right away and cannot be undone. On success the
541
+ collection leaves `collections` (and closes if it was open). A refusal rejects with a
542
+ `collection_delete_*` code and changes nothing; pass the error to `describeError()` for the copy.
543
+ `collection_delete_outcome_unknown` means the reply was lost: refresh the collections before retrying.
544
+
545
+ ## Type packs
546
+
547
+ `client.typePacks.plan(pack, options)` asks the replica's Core to plan a type
548
+ pack against the local collection and writes nothing. The plan has `status`
549
+ (`install`, `upgrade`, `downgrade`, `reconfigure`, `current`, `conflict`),
550
+ `canApply`, a `summary` of targets by action for a diff, per-target
551
+ `resources`, `conflicts` with display-ready messages, and `refusal` (`code`,
552
+ `message`) when it cannot be applied. Show `refusal.message` as is.
553
+
554
+ ```ts
555
+ let plan = await client.typePacks.plan(pack, { installedBy: "app.example.notes" });
556
+ if (Object.keys(plan.adoptable).length) {
557
+ // The user reviewed the existing types: let the pack manage them.
558
+ plan = await client.typePacks.plan(pack, { installedBy: "app.example.notes", adopt: plan.adoptable });
559
+ }
560
+ if (plan.canApply) {
561
+ const result = await client.typePacks.apply(plan);
562
+ // "pending" is accepted locally; wait for the original mutation to confirm.
563
+ if (result.outcome === "pending") await result.write!.confirmed;
564
+ }
565
+ ```
566
+
567
+ `apply(plan)` re-plans against the reviewed `digest` and submits every write
568
+ as one mutation, so the collection gets all of it or none. Each write,
569
+ including the lock and every adopted unchanged target, is bound to the
570
+ revision the plan reviewed. If anything changed since review, apply refuses
571
+ with `conflict`/`concurrent_modification`; plan again. A pack that is already
572
+ current returns `{ outcome: "already_current" }` and writes nothing.
573
+ Otherwise the outcome is `applied` (confirmed) or `pending` (accepted; await
574
+ `write.confirmed`, which rejects with the original mutation's problem). A
575
+ mutation the replica rejects or cannot settle throws its problem with the
576
+ original `mutationId` and is never reported as applied. `dryRun` returns
577
+ `preview` and installs nothing. Upgrades
578
+ use the pack's seed baselines. An older version is refused
579
+ (`type_pack_downgrade`) unless `allowDowngrade` is set.
580
+
581
+ Refusal codes: `forbidden` (no `definitions.manage`, reported by `plan`),
582
+ `type_pack_conflict`, `type_pack_downgrade`, `invalid_type_pack`,
583
+ `type_pack_contract_setups_unsupported`, and from apply
584
+ `concurrent_modification`. Older replicas return
585
+ `upgrade_required`/`type_packs_unsupported`.
586
+
587
+ ## Saved-view sources
588
+
589
+ `db.views.createSource({id, path, document, type?}, {mutationId, ...writeOptions})`
590
+ creates the exact caller-supplied source. Capture and retain the record UUID and
591
+ mutation UUID before submitting (the SDK exports `uuidv7`). No renderer, record
592
+ type, filename extension or YAML is inferred or rewritten.
593
+
594
+ `db.views.getSourceRecord(ref, {include?, signal?})` requests a complete native
595
+ record with its document included. `db.views.updateSource(seen, document,
596
+ {mutationId, ...writeOptions})` uses that genuine `RecordView`'s UUID, path, full
597
+ source and revision for whole-document CAS. Pending revisions are valid; held,
598
+ unresolved, metadata-only or inconsistent source witnesses refuse. A new edit
599
+ needs its own captured mutation UUID, not a replacement for an unknown outcome.
600
+
601
+ Both write helpers return the original SDK `Write`, force document-inclusive
602
+ readback, and preserve receipt IDs, confirmation and publication separately.
603
+ Neither performs an implicit refresh or prepares/resubmits on unknown outcomes.
604
+ The ordinary client transport's same-mutation retry policy is unchanged.
605
+
606
+ For **web app-host** saved-view discovery/execution/exact source reads, use
607
+ `listAppBasesViews`, `executeAppBases` and `readAppBasesViewSource`, with the types
608
+ from `@mdbase-dev/sdk/app-host`. Keep native UUID/SHA/original ordinal and actual
609
+ source options. The generic `views.list/execute/readSource` RPC surface is not an
610
+ app-host fallback; unavailable capabilities remain explicit refusals.
611
+
612
+ To read a whole saved view in pages, iterate `executeAppBasesPages(request,
613
+ {firstPageSize?, pageSize?, signal?})` (defaults 200 then 1000 rows; at most
614
+ 65536). Each page is one independent windowed read with `page`, `offset`,
615
+ `loaded` and `complete`. Native reads have no cross-request cursor or snapshot,
616
+ so `changedSinceFirst` marks pages read after the collection revision or matched
617
+ row count changed; rows may then be skipped or repeated, and callers that need a
618
+ coherent set restart. A native refusal is yielded once and ends the iteration.
619
+
620
+ ## Persisted-record validation
621
+
622
+ ```ts
623
+ const seen = await db.get(id, { document: true }, signal);
624
+ const [validation] = await db.validate([seen], signal);
625
+ // validation.id/path/revision identify the actual document validated.
626
+ for (const issue of validation.issues) {
627
+ console.log(issue.severity, issue.code, issue.location, issue.message);
628
+ }
629
+ ```
630
+
631
+ `validate(refs?, originalSignal?)` returns typed `RecordValidation[]` with real
632
+ Core `ValidationIssue`s, including optional location/type name and diagnostic
633
+ tier. UUID/path selections validate current native records; a `RecordView`
634
+ selection also requires the result to match that captured view's revision.
635
+ Changed revisions refuse with `record_validation_stale`; the SDK never refreshes
636
+ a witness or turns missing/refused/malformed/partial results into `[]`.
637
+ Order and duplicate selections are preserved. The original signal fences both
638
+ dispatch and final delivery, including an empty batch. Ordinary SDK read transport
639
+ policy is unchanged; no validation-specific retry or fallback is added.
640
+
641
+ This validates persisted/current local-native documents (including pending
642
+ changes), **not an unsaved draft or permission to submit/CAS a write**. A returned
643
+ revision records the version examined, not a promise that it remains current
644
+ after delivery. No types/contracts are installed implicitly. Older producers
645
+ without this operation remain real refusals, not empty success.
646
+
647
+ Selection count is at most 1000; paths are nonempty and at most 4096 UTF-8 bytes.
648
+ Native validation bounds examined documents/read work and refuses oversized
649
+ results (1 MiB/4096 issues/65536 nodes/depth 32). Omitted refs request a bounded
650
+ whole-collection inventory (at most 1000 records); some cross-record uniqueness
651
+ checks require that inventory even for an explicit record. Over-bound work is
652
+ `too_large`, never partial diagnostics. These are read/serialization bounds, not
653
+ a native peak-heap/CPU, app-intake or UI acceptance certificate.
654
+
655
+ ## Shared read helpers
656
+
657
+ ```ts
658
+ const records = await db.readMany(refs, { effective: true }, signal, {
659
+ concurrency: 8,
660
+ });
661
+ for await (const page of db.queryPages(query, include, signal)) {
662
+ displayPage(page); // retains complete/asOf/diagnostics, not only records
663
+ }
664
+ ```
665
+
666
+ `readMany(refs, include?, signal?, options?)` makes ordinary `get` calls and
667
+ returns genuine `RecordView` values in input order. Duplicate selections retain
668
+ separate calls and output slots. Up to 1000 selections are allowed; concurrency
669
+ is an integer 1..16 (default 8). Path selectors must be nonempty and at most
670
+ 4096 UTF-8 bytes. UUIDs (including a supplied view's UUID), paths, Include and
671
+ concurrency are captured before the first await. A view's old path/revision is
672
+ not asserted current and a partial input is never promoted to a native witness.
673
+
674
+ Missing/refused/error reads fail the entire batch with the first observed error,
675
+ not omitted rows or partial success. Scheduling stops; already-started reads
676
+ settle before that error is delivered. The original signal fences dispatch and
677
+ final delivery, including late backend replies. There is no helper-level retry,
678
+ refresh, fallback, replacement identity or cancellation of the caller's signal;
679
+ the ordinary SDK `get` transport policy is unchanged. Request/in-flight bounds
680
+ are not a peak-heap or returned-byte budget. Use explicit Include and bounded
681
+ selections when hydrating bodies/documents. Multiple gets are **not a single
682
+ native snapshot**; callers still check identity/source-revision witnesses.
683
+
684
+ `queryPages(query, include?, signal?, options?)` delegates **exactly** to `pages`
685
+ and returns the same whole-page iterator. No records are flattened and no reset
686
+ is added. Root exports `readMany(client, ...)`, `queryPages(client, ...)` and
687
+ `ReadManyOptions` are also available.
688
+
689
+ ## Feature negotiation and operation mapping
690
+
691
+ Use the existing `connect({ features: [...] })` / `client.hello.features` surfaces.
692
+ Keep the exact factory-owned request list, not a later-mutated options array:
693
+
694
+ ```ts
695
+ const requestedFeatures = Object.freeze(["presence"]);
696
+ const client = await connect({ connector, app, features: [...requestedFeatures], signal });
697
+ function negotiatedMarker(name: string) {
698
+ // Access the current hello; session errors propagate, never become false.
699
+ const granted = client.hello.features;
700
+ if (!requestedFeatures.includes(name)) return "not_requested";
701
+ return granted.includes(name) ? "negotiated" : "not_negotiated";
702
+ }
703
+ ```
704
+
705
+ While the initial hello is pending, a requested marker is **requested / pending**,
706
+ not unsupported. A successful hello grants only the requested-supported
707
+ intersection, not a complete catalog. An absent *unrequested* marker is not
708
+ negative evidence. Failed negotiation, no current session, connection/refusal
709
+ errors or cancellation stay errors; do not substitute `false` or a stale hello
710
+ from another session. No new probe or feature-discovery RPC is needed.
711
+
712
+ The current native Replica source admits `presence`, bare `attachment-v1` codec
713
+ support, and qualified `attachment-v1.read` / `attachment-v1.materialize`
714
+ directions where that replica supports them. Bare codec support does not grant a
715
+ direction; this producer does not grant `attachment-v1.write`. This is a source
716
+ inventory, not deployed runtime/transport/app acceptance. A testing replica's
717
+ advertised markers are not a native capability certificate.
718
+
719
+ Legacy Connect labels are not native feature names or negotiation aliases:
720
+
721
+ | Legacy probe | Public SDK mapping | What it does **not** prove |
722
+ |---|---|---|
723
+ | `query-metadata-v1` (Reader and Writer discovery) | `query` / `queryPages` with canonical Core `select` and explicit Include; typed `QueryResult` / `RecordView.values`, columns and page metadata | No legacy `output: metadata` mode, metadata-only SQL/performance guarantee or native feature marker |
724
+ | `read-many-documents-v1` (Reader hydration) | `readMany(refs, include, originalSignal)`; ordinary bounded `get` calls | No native bulk opcode, transaction or same-snapshot / shared-`asOf` proof |
725
+ | `query-record-revisions-v1` (legacy performance fixtures, not a Reader/Writer product probe) | Genuine mandatory `RecordView.id`, `.path` and `.revision` | No confirmed save, currentness after delivery, full edit base or draft/CAS authorization |
726
+
727
+ Writer's legacy changed-path `readMany` call has no bulk-feature probe. The next
728
+ Reader/Writer adapters do not require legacy feature probes: use their public
729
+ SDK operations and preserve actual errors. These mappings do not add an
730
+ app-specific engine, legacy protocol fallback, automatic query reset or new
731
+ permissions.
732
+
733
+ For discovery without bodies/documents, use explicit `{ body: false, document:
734
+ false }` Include and the intended canonical query selection. Retain whole pages,
735
+ `complete`, `asOf`, diagnostics and opaque cursors; unsupported semantics or
736
+ insufficient native budgets refuse, not approximate or empty success. Discovery
737
+ and hydration can observe different cuts: recheck actual ID, provider/source and
738
+ revision witnesses rather than treating multiple gets as one snapshot.
739
+
740
+ `client.hello.grant.capabilities` and role are hello-time permission snapshots,
741
+ **not current authorization or feature support**. READ uses `collection.read`;
742
+ ordinary native RPC reauthorization remains authoritative. `describe()` inspects
743
+ catalog/types/contracts, not a feature catalog. Neither a successful grant nor a
744
+ negotiated marker overrides a later native refusal. Keep the original signal and
745
+ problem; do not turn errors into negative capabilities or fabricated diagnostics.
746
+
747
+ ## People and canonical contract inspection
748
+
749
+ ```ts
750
+ import { MdbasePeopleClient } from "@mdbase-dev/sdk";
751
+ // Inside the trusted owned Worker, after collection adoption and CP transport pinning.
752
+ // host is the existing AppWebCloudCopyHost; its session/credential stays private.
753
+ const metadata = host.peopleAuthority();
754
+ const people = new MdbasePeopleClient(db, metadata);
755
+ const directory = await people.directory({ members: "if-approved", signal });
756
+ directory.account; // public exact issuer/subject/name/account UUID
757
+ directory.me; // linked, unlinked, ambiguous, or invalid; never name/email inference
758
+ directory.people; // complete native mdbase.person 2.0.0 inventory
759
+ // host.close() retires metadata before native/SQL shutdown.
760
+ ```
761
+
762
+ The host returns only a frozen read-only metadata view, not a session or bearer
763
+ getter. Send only public directory projections over the Worker channel. Other
764
+ trusted hosts owning a genuine registered-device session can construct
765
+ `AppCpPeopleAuthority` internally; callers must never reconstruct it from receipts.
766
+
767
+ `current()` and `members()` read fixed CP metadata endpoints; `directory()` uses
768
+ Core's canonical resolved mappings, defaults and validation through
769
+ `db.queryContract({ id, version }, { pageSize, cursor, signal })`. It does not
770
+ recreate contract semantics from raw frontmatter. The directory checks CP/native
771
+ collection binding and consumes every native continuation under one session,
772
+ `asOf` and contract digest; stale/incomplete/oversized inventories fail as a whole.
773
+ A full unindexed window refuses with `contract_query_cursor_required`, not a
774
+ fabricated cursor or partial result. A fresh absent registered Person contract
775
+ means unlinked; disappearance after any page is an error. Invalid claiming
776
+ records take precedence over an otherwise linked match. Optional members are
777
+ omitted only for explicit permission decline (or `members: "omit"`), never scope,
778
+ revocation, integrity or network errors. Old producers refuse the additive
779
+ version-one method, without an SDK projection fallback. No record path/payload
780
+ or key is sent to the metadata authority.
781
+
782
+ ## Query cursor resets
783
+
784
+ `pages(query, include?, signal?, options?)` repeats the original query with the
785
+ replica's opaque cursor. By default, typed `invalid_request/fix_request` reasons
786
+ `cursor_expired` and `cursor_stale` are thrown unchanged. There is no offset
787
+ fallback or automatic mixing of already-yielded pages with a fresh query.
788
+
789
+ To opt in to **one restart per iterator**, clear your accumulated/displayed
790
+ paging state in the awaited `onReset` callback:
791
+
792
+ ```ts
793
+ for await (const page of db.pages(query, include, signal, {
794
+ onReset: async ({ reason, pagesYielded, signal }) => {
795
+ await clearDisplayedPages(); // completes BEFORE the fresh first-page RPC
796
+ },
797
+ })) {
798
+ displayPage(page);
799
+ }
800
+ ```
801
+
802
+ Reset clears all earlier pages even if expiry keeps the same `asOf`. The SDK
803
+ strips the cursor and preserves the captured original offset, limit, query and
804
+ include on restart. Callback failure, cancellation, or a second cursor refusal
805
+ stops the iterator. Malformed/foreign/conflicting cursors, READ denial and other
806
+ errors never trigger this callback. Native cursor lifetime/clock/head guarantees
807
+ remain the replica's responsibility; these SDK tests do not qualify that producer.
808
+
809
+ ## Static key custody
810
+
811
+ Browser extensions should explicitly require non-extractable custody **before consent**:
812
+
813
+ ```ts
814
+ const key = await loadOrCreateClientKey("reader", {
815
+ storage: indexedDbKeyStorage("reader-keys"),
816
+ requireNonExtractable: true,
817
+ });
818
+ ```
819
+
820
+ Import `indexedDbKeyStorage` from the SDK. Unsupported X25519 or an existing
821
+ raw/extractable identity fails closed; existing identities are never silently
822
+ replaced. Reauthorization must be explicit. Without this option, the legacy raw
823
+ fallback remains available. Non-extractability does not prevent compromised
824
+ extension code from using DH, and is not hardware-backed custody.
825
+
826
+ Built-in stores return only committed identities and atomically choose one
827
+ first-creation winner. Custom persistent stores shared across contexts must
828
+ implement `KeyStorage.putIfAbsent`; same-store in-process creation is coalesced.
829
+ Keep the key in the extension origin, not a content script or unrestricted DH bridge.
830
+
831
+ `PLAYWRIGHT_MODULE=<module> CHROMIUM_EXECUTABLE=<browser> node scripts/keys-mv3-smoke.mjs`
832
+ runs the actual SDK in a fresh isolated MV3 profile: page/worker races, export
833
+ refusal, real DH, existing-key refusal, late IDB abort, worker wake and browser reopen.
834
+
835
+ ## Checks
836
+
837
+ ```sh
838
+ npm ci && npm run typecheck && npm test && npm run build && npm run size # or: cargo xtask sdk
839
+ ```
840
+
841
+ `npm run size` fails when `@mdbase-dev/sdk/thin-client` exceeds 64 KiB gzip or the
842
+ root entry exceeds its measured ceiling (166 KiB; standalone apps have no product
843
+ size limit, so this ceiling only catches regressions). It also fails when either
844
+ entry bundles the Ajv compiler (manifest validators are precompiled in
845
+ connect-protocol), the thin client bundles yaml, or either bundles `app-grant`.