@noy-db/hub 0.2.0-pre.1 → 0.2.0-pre.2

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 (237) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.js +2 -2
  3. package/dist/attestation/index.cjs +305 -0
  4. package/dist/attestation/index.cjs.map +1 -0
  5. package/dist/attestation/index.d.cts +52 -0
  6. package/dist/attestation/index.d.ts +52 -0
  7. package/dist/attestation/index.js +36 -0
  8. package/dist/attestation/index.js.map +1 -0
  9. package/dist/blobs/index.cjs.map +1 -1
  10. package/dist/blobs/index.d.cts +4 -3
  11. package/dist/blobs/index.d.ts +4 -3
  12. package/dist/blobs/index.js +9 -7
  13. package/dist/blobs/index.js.map +1 -1
  14. package/dist/bundle/index.cjs +16701 -129
  15. package/dist/bundle/index.cjs.map +1 -1
  16. package/dist/bundle/index.d.cts +172 -3
  17. package/dist/bundle/index.d.ts +172 -3
  18. package/dist/bundle/index.js +533 -5
  19. package/dist/bundle/index.js.map +1 -1
  20. package/dist/{chunk-5SCJ5UEF.js → chunk-243PNUA6.js} +2 -2
  21. package/dist/{chunk-WCA2NROQ.js → chunk-2PAQNPE3.js} +2 -2
  22. package/dist/chunk-3QAKZ37R.js +83 -0
  23. package/dist/chunk-3QAKZ37R.js.map +1 -0
  24. package/dist/chunk-3S4BJX25.js +36 -0
  25. package/dist/chunk-3S4BJX25.js.map +1 -0
  26. package/dist/chunk-3XHOCQK4.js +118 -0
  27. package/dist/chunk-3XHOCQK4.js.map +1 -0
  28. package/dist/{chunk-4TFSM22V.js → chunk-3Y53S2SA.js} +3 -3
  29. package/dist/{chunk-6HPZY4ON.js → chunk-3Z2TPHC4.js} +3 -3
  30. package/dist/chunk-4HIL6AHQ.js +57 -0
  31. package/dist/chunk-4HIL6AHQ.js.map +1 -0
  32. package/dist/{chunk-DYECX3IX.js → chunk-7BRE6EUA.js} +2 -2
  33. package/dist/{chunk-DYBQG5PQ.js → chunk-7BUTTVMR.js} +2 -2
  34. package/dist/{chunk-KESP7GOK.js → chunk-7Q5PLD5C.js} +3 -3
  35. package/dist/{chunk-UA4RI7OT.js → chunk-7Z23ZFLV.js} +4 -4
  36. package/dist/chunk-AHPFONIL.js +59 -0
  37. package/dist/chunk-AHPFONIL.js.map +1 -0
  38. package/dist/{chunk-EGQYGYIU.js → chunk-CXSCDO5T.js} +2 -2
  39. package/dist/chunk-E535SAN4.js +8834 -0
  40. package/dist/chunk-E535SAN4.js.map +1 -0
  41. package/dist/{chunk-CBAHB2BF.js → chunk-EUYOGYGV.js} +6 -69
  42. package/dist/chunk-EUYOGYGV.js.map +1 -0
  43. package/dist/{chunk-OMLIZL2P.js → chunk-FAQVNJD4.js} +2 -2
  44. package/dist/{chunk-I6MX32UC.js → chunk-G6FRSBKK.js} +4 -4
  45. package/dist/{chunk-FCXOFQAJ.js → chunk-GIV6DWBG.js} +2 -2
  46. package/dist/{chunk-34YSDCDP.js → chunk-HXJXPZRE.js} +2 -2
  47. package/dist/{chunk-23TTQXVO.js → chunk-J4KLMEUL.js} +2 -2
  48. package/dist/{chunk-VMIO4IXG.js → chunk-JYQTXEIO.js} +5 -228
  49. package/dist/chunk-JYQTXEIO.js.map +1 -0
  50. package/dist/{chunk-NIOHFJPJ.js → chunk-LRAZDV5X.js} +6 -118
  51. package/dist/chunk-LRAZDV5X.js.map +1 -0
  52. package/dist/{chunk-P7EQ2S5O.js → chunk-MUWOSVEP.js} +2 -2
  53. package/dist/chunk-NWZ3I6R6.js +79 -0
  54. package/dist/chunk-NWZ3I6R6.js.map +1 -0
  55. package/dist/{chunk-HB3Z2GCR.js → chunk-OVZDFEOR.js} +2 -2
  56. package/dist/chunk-PFSNOPBQ.js +233 -0
  57. package/dist/chunk-PFSNOPBQ.js.map +1 -0
  58. package/dist/{chunk-UZXLQCHP.js → chunk-PLI5TV7N.js} +2 -2
  59. package/dist/{chunk-PA6R5ZCI.js → chunk-Q6W2CMEJ.js} +3 -3
  60. package/dist/{chunk-537VFZTR.js → chunk-QPEXPHJR.js} +4 -4
  61. package/dist/{chunk-ZNOEIM6Y.js → chunk-QXQRKXCU.js} +2 -2
  62. package/dist/{chunk-RD5LYKD6.js → chunk-RTZVQAJ7.js} +2 -2
  63. package/dist/{chunk-DPMFBCV6.js → chunk-TBKOGSYR.js} +2 -2
  64. package/dist/{chunk-DPMFBCV6.js.map → chunk-TBKOGSYR.js.map} +1 -1
  65. package/dist/chunk-UND4XIB6.js +251 -0
  66. package/dist/chunk-UND4XIB6.js.map +1 -0
  67. package/dist/{chunk-7H6DOO3E.js → chunk-VCGTOS2A.js} +211 -36
  68. package/dist/chunk-VCGTOS2A.js.map +1 -0
  69. package/dist/{chunk-MKSA2V7A.js → chunk-VE6YVP32.js} +2 -2
  70. package/dist/{chunk-5DWL3JBF.js → chunk-VK5EER6C.js} +2 -2
  71. package/dist/{chunk-MIQHZESA.js → chunk-VPSUZLOJ.js} +4 -4
  72. package/dist/{chunk-MIQHZESA.js.map → chunk-VPSUZLOJ.js.map} +1 -1
  73. package/dist/{chunk-XGSOTWYX.js → chunk-VRBCTEKQ.js} +2 -2
  74. package/dist/{chunk-ADQ5MQ54.js → chunk-W3XXT26A.js} +29 -1
  75. package/dist/{chunk-ADQ5MQ54.js.map → chunk-W3XXT26A.js.map} +1 -1
  76. package/dist/{chunk-2AXFIYHT.js → chunk-XG3PTSCD.js} +1 -1
  77. package/dist/chunk-XG3PTSCD.js.map +1 -0
  78. package/dist/{chunk-SIZWEV2Y.js → chunk-Y2RKOPNC.js} +4 -4
  79. package/dist/{chunk-SIZWEV2Y.js.map → chunk-Y2RKOPNC.js.map} +1 -1
  80. package/dist/{chunk-Z72JH4KG.js → chunk-YTXSFG3C.js} +4 -34
  81. package/dist/chunk-YTXSFG3C.js.map +1 -0
  82. package/dist/consent/index.cjs.map +1 -1
  83. package/dist/consent/index.d.cts +4 -3
  84. package/dist/consent/index.d.ts +4 -3
  85. package/dist/consent/index.js +3 -3
  86. package/dist/{crypto-A7FRXYHC.js → crypto-5ZDIY3NG.js} +3 -3
  87. package/dist/{delegation-YBA4X4JN.js → delegation-QYXZW25W.js} +5 -5
  88. package/dist/derivations/index.cjs.map +1 -1
  89. package/dist/derivations/index.d.cts +5 -4
  90. package/dist/derivations/index.d.ts +5 -4
  91. package/dist/derivations/index.js +4 -4
  92. package/dist/{dev-unlock-DRwVSy2S.d.cts → dev-unlock-DQCNDfFp.d.cts} +1 -1
  93. package/dist/{dev-unlock-D9s-loPr.d.ts → dev-unlock-utkybTKb.d.ts} +1 -1
  94. package/dist/executor-AS2IDHKZ.js +11 -0
  95. package/dist/executor-HLXFXNFM.js +8 -0
  96. package/dist/executor-HN6YBHZ5.js +8 -0
  97. package/dist/guards/index.cjs.map +1 -1
  98. package/dist/guards/index.d.cts +5 -4
  99. package/dist/guards/index.d.ts +5 -4
  100. package/dist/guards/index.js +3 -3
  101. package/dist/{hash-DXXXusyk.d.ts → hash-DcoYWfJ_.d.ts} +1 -1
  102. package/dist/{hash-DtRih9MQ.d.cts → hash-jDowCrK2.d.cts} +1 -1
  103. package/dist/history/index.cjs +1 -1
  104. package/dist/history/index.cjs.map +1 -1
  105. package/dist/history/index.d.cts +5 -4
  106. package/dist/history/index.d.ts +5 -4
  107. package/dist/history/index.js +5 -5
  108. package/dist/i18n/index.cjs.map +1 -1
  109. package/dist/i18n/index.d.cts +4 -3
  110. package/dist/i18n/index.d.ts +4 -3
  111. package/dist/i18n/index.js +13 -11
  112. package/dist/i18n/index.js.map +1 -1
  113. package/dist/{index-CNwA-B6-.d.ts → index-BCKdioeh.d.ts} +29 -1
  114. package/dist/{index-CmVgTkqk.d.cts → index-BMjrzNZr.d.cts} +29 -1
  115. package/dist/index.cjs +507 -37
  116. package/dist/index.cjs.map +1 -1
  117. package/dist/index.d.cts +12 -11
  118. package/dist/index.d.ts +12 -11
  119. package/dist/index.js +106 -8817
  120. package/dist/index.js.map +1 -1
  121. package/dist/indexing/index.cjs.map +1 -1
  122. package/dist/indexing/index.js +2 -2
  123. package/dist/issue-ORP37MVW.js +12 -0
  124. package/dist/{ledger-3TXNP47J.js → ledger-3IU5GMXA.js} +5 -5
  125. package/dist/materialized-views/index.cjs.map +1 -1
  126. package/dist/materialized-views/index.d.cts +6 -5
  127. package/dist/materialized-views/index.d.ts +6 -5
  128. package/dist/materialized-views/index.js +6 -6
  129. package/dist/noydb-5H3C24GG.js +34 -0
  130. package/dist/overlay-views/index.cjs.map +1 -1
  131. package/dist/overlay-views/index.d.cts +5 -4
  132. package/dist/overlay-views/index.d.ts +5 -4
  133. package/dist/overlay-views/index.js +6 -4
  134. package/dist/periods/index.cjs.map +1 -1
  135. package/dist/periods/index.d.cts +4 -3
  136. package/dist/periods/index.d.ts +4 -3
  137. package/dist/periods/index.js +5 -5
  138. package/dist/{public-envelope-PY6NKFLI.js → public-envelope-U3CMEOMV.js} +3 -3
  139. package/dist/query/index.cjs.map +1 -1
  140. package/dist/query/index.d.cts +1 -1
  141. package/dist/query/index.d.ts +1 -1
  142. package/dist/query/index.js +3 -3
  143. package/dist/{registry-3L3N3PTG.js → registry-3ALP62P6.js} +3 -3
  144. package/dist/registry-7HE6VJGC.js +8 -0
  145. package/dist/registry-PSIPG2QR.js +8 -0
  146. package/dist/registry-PSIPG2QR.js.map +1 -0
  147. package/dist/revoke-KY2GB4KP.js +17 -0
  148. package/dist/revoke-KY2GB4KP.js.map +1 -0
  149. package/dist/session/index.cjs.map +1 -1
  150. package/dist/session/index.d.cts +5 -4
  151. package/dist/session/index.d.ts +5 -4
  152. package/dist/session/index.js +3 -3
  153. package/dist/shadow/index.cjs.map +1 -1
  154. package/dist/shadow/index.d.cts +4 -3
  155. package/dist/shadow/index.d.ts +4 -3
  156. package/dist/shadow/index.js +2 -2
  157. package/dist/signer-GRI5TZKH.js +18 -0
  158. package/dist/signer-GRI5TZKH.js.map +1 -0
  159. package/dist/{stale-HSC5YO2O.js → stale-OTOF3FH7.js} +2 -2
  160. package/dist/stale-OTOF3FH7.js.map +1 -0
  161. package/dist/store/index.cjs.map +1 -1
  162. package/dist/store/index.d.cts +4 -3
  163. package/dist/store/index.d.ts +4 -3
  164. package/dist/store/index.js +2 -2
  165. package/dist/sync/index.cjs.map +1 -1
  166. package/dist/sync/index.d.cts +3 -2
  167. package/dist/sync/index.d.ts +3 -2
  168. package/dist/sync/index.js +3 -3
  169. package/dist/team/index.cjs.map +1 -1
  170. package/dist/team/index.d.cts +4 -3
  171. package/dist/team/index.d.ts +4 -3
  172. package/dist/team/index.js +12 -10
  173. package/dist/tx/index.cjs.map +1 -1
  174. package/dist/tx/index.d.cts +4 -3
  175. package/dist/tx/index.d.ts +4 -3
  176. package/dist/tx/index.js +2 -2
  177. package/dist/{types-DW9RGSSs.d.ts → types-BoFFiskX.d.ts} +119 -3
  178. package/dist/{types-C4lwMKKF.d.cts → types-DJG8HG6F.d.cts} +119 -3
  179. package/dist/{index-hdFvZkBP.d.cts → ulid-BmBgooGm.d.ts} +51 -33
  180. package/dist/{index-4agOpzqd.d.ts → ulid-C7ms9oli.d.cts} +51 -33
  181. package/dist/util/index.cjs.map +1 -1
  182. package/dist/util/index.js +1 -1
  183. package/dist/{with-derivation-g-pGoMzL.d.ts → with-derivation-BKXXa8Vt.d.ts} +1 -1
  184. package/dist/{with-derivation-C8LDlV7t.d.cts → with-derivation-BjQ7q4NE.d.cts} +1 -1
  185. package/dist/{with-guard-DWOCK4Ca.d.ts → with-guard-C25yNjzd.d.ts} +1 -1
  186. package/dist/{with-guard-jI1x9Z3k.d.cts → with-guard-DQme5DKE.d.cts} +1 -1
  187. package/dist/{with-materialized-view-DcTx4H3j.d.cts → with-materialized-view-BbEPFIIJ.d.cts} +1 -1
  188. package/dist/{with-materialized-view-DaKR-N6J.d.ts → with-materialized-view-CqnRwI2S.d.ts} +1 -1
  189. package/dist/{with-overlayed-view-N7jYuNOS.d.ts → with-overlayed-view-Ct1fSJt-.d.ts} +1 -1
  190. package/dist/{with-overlayed-view-D-6oWAgM.d.cts → with-overlayed-view-bwlmmFjx.d.cts} +1 -1
  191. package/package.json +15 -3
  192. package/dist/chunk-2AXFIYHT.js.map +0 -1
  193. package/dist/chunk-7H6DOO3E.js.map +0 -1
  194. package/dist/chunk-CBAHB2BF.js.map +0 -1
  195. package/dist/chunk-NIOHFJPJ.js.map +0 -1
  196. package/dist/chunk-VMIO4IXG.js.map +0 -1
  197. package/dist/chunk-Z72JH4KG.js.map +0 -1
  198. package/dist/executor-7E3VFGW7.js +0 -11
  199. package/dist/executor-CEWX2FQI.js +0 -8
  200. package/dist/executor-X4SQ3ZLC.js +0 -8
  201. package/dist/registry-O47PUPSY.js +0 -8
  202. package/dist/registry-WLLMODKN.js +0 -8
  203. /package/dist/{chunk-5SCJ5UEF.js.map → chunk-243PNUA6.js.map} +0 -0
  204. /package/dist/{chunk-WCA2NROQ.js.map → chunk-2PAQNPE3.js.map} +0 -0
  205. /package/dist/{chunk-4TFSM22V.js.map → chunk-3Y53S2SA.js.map} +0 -0
  206. /package/dist/{chunk-6HPZY4ON.js.map → chunk-3Z2TPHC4.js.map} +0 -0
  207. /package/dist/{chunk-DYECX3IX.js.map → chunk-7BRE6EUA.js.map} +0 -0
  208. /package/dist/{chunk-DYBQG5PQ.js.map → chunk-7BUTTVMR.js.map} +0 -0
  209. /package/dist/{chunk-KESP7GOK.js.map → chunk-7Q5PLD5C.js.map} +0 -0
  210. /package/dist/{chunk-UA4RI7OT.js.map → chunk-7Z23ZFLV.js.map} +0 -0
  211. /package/dist/{chunk-EGQYGYIU.js.map → chunk-CXSCDO5T.js.map} +0 -0
  212. /package/dist/{chunk-OMLIZL2P.js.map → chunk-FAQVNJD4.js.map} +0 -0
  213. /package/dist/{chunk-I6MX32UC.js.map → chunk-G6FRSBKK.js.map} +0 -0
  214. /package/dist/{chunk-FCXOFQAJ.js.map → chunk-GIV6DWBG.js.map} +0 -0
  215. /package/dist/{chunk-34YSDCDP.js.map → chunk-HXJXPZRE.js.map} +0 -0
  216. /package/dist/{chunk-23TTQXVO.js.map → chunk-J4KLMEUL.js.map} +0 -0
  217. /package/dist/{chunk-P7EQ2S5O.js.map → chunk-MUWOSVEP.js.map} +0 -0
  218. /package/dist/{chunk-HB3Z2GCR.js.map → chunk-OVZDFEOR.js.map} +0 -0
  219. /package/dist/{chunk-UZXLQCHP.js.map → chunk-PLI5TV7N.js.map} +0 -0
  220. /package/dist/{chunk-PA6R5ZCI.js.map → chunk-Q6W2CMEJ.js.map} +0 -0
  221. /package/dist/{chunk-537VFZTR.js.map → chunk-QPEXPHJR.js.map} +0 -0
  222. /package/dist/{chunk-ZNOEIM6Y.js.map → chunk-QXQRKXCU.js.map} +0 -0
  223. /package/dist/{chunk-RD5LYKD6.js.map → chunk-RTZVQAJ7.js.map} +0 -0
  224. /package/dist/{chunk-MKSA2V7A.js.map → chunk-VE6YVP32.js.map} +0 -0
  225. /package/dist/{chunk-5DWL3JBF.js.map → chunk-VK5EER6C.js.map} +0 -0
  226. /package/dist/{chunk-XGSOTWYX.js.map → chunk-VRBCTEKQ.js.map} +0 -0
  227. /package/dist/{crypto-A7FRXYHC.js.map → crypto-5ZDIY3NG.js.map} +0 -0
  228. /package/dist/{delegation-YBA4X4JN.js.map → delegation-QYXZW25W.js.map} +0 -0
  229. /package/dist/{executor-7E3VFGW7.js.map → executor-AS2IDHKZ.js.map} +0 -0
  230. /package/dist/{executor-CEWX2FQI.js.map → executor-HLXFXNFM.js.map} +0 -0
  231. /package/dist/{executor-X4SQ3ZLC.js.map → executor-HN6YBHZ5.js.map} +0 -0
  232. /package/dist/{ledger-3TXNP47J.js.map → issue-ORP37MVW.js.map} +0 -0
  233. /package/dist/{public-envelope-PY6NKFLI.js.map → ledger-3IU5GMXA.js.map} +0 -0
  234. /package/dist/{registry-3L3N3PTG.js.map → noydb-5H3C24GG.js.map} +0 -0
  235. /package/dist/{registry-O47PUPSY.js.map → public-envelope-U3CMEOMV.js.map} +0 -0
  236. /package/dist/{registry-WLLMODKN.js.map → registry-3ALP62P6.js.map} +0 -0
  237. /package/dist/{stale-HSC5YO2O.js.map → registry-7HE6VJGC.js.map} +0 -0
@@ -1,7 +1,176 @@
1
- export { l as COMPRESSION_BROTLI, m as COMPRESSION_GZIP, n as COMPRESSION_NONE, C as CompressionAlgo, F as FLAG_COMPRESSED, o as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, b as NOYDB_BUNDLE_MAGIC, c as NOYDB_BUNDLE_PREFIX_BYTES, d as NoydbBundleHeader, e as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, p as encodeBundleHeader, g as generateULID, i as isULID, r as readNoydbBundle, f as readNoydbBundleHeader, k as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../index-hdFvZkBP.cjs';
2
- export { B as BackupCorruptedError, r as BackupLedgerError, s as BundleIntegrityError, t as BundleSealMismatchError, u as BundleVersionConflictError } from '../index-CmVgTkqk.cjs';
3
- import '../types-C4lwMKKF.cjs';
1
+ import { T as TransferSealPayload } from '../ulid-C7ms9oli.cjs';
2
+ export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-C7ms9oli.cjs';
3
+ import { bf as Vault, aO as NoydbStore, bb as SealingKeyProvider, bg as RecoveryEnrollmentInput, bh as ShamirRecoveryProvider } from '../types-DJG8HG6F.cjs';
4
+ export { n as AdoptionStateError, B as BackupCorruptedError, o as BackupLedgerError, p as BundleIntegrityError, q as BundleSealMismatchError, r as BundleVersionConflictError, P as PartitionExtractionError, s as TransferSealError } from '../index-BMjrzNZr.cjs';
4
5
  import '../lazy-builder-C-rPfWG0.cjs';
5
6
  import '../predicate-Dnu81tsS.cjs';
6
7
  import '../strategy-DSTrsZ8t.cjs';
7
8
  import '../strategy-BSxFXGzb.cjs';
9
+ import '@noy-db/attestation';
10
+
11
+ /**
12
+ * Transitive-closure FK walker (#201). Computes the set of
13
+ * (collection, id) tuples reachable from seed predicates, so a
14
+ * partition extraction ships a referentially-complete subset.
15
+ *
16
+ * Two-phase, plaintext, read-only (runs inside the unlocked vault
17
+ * session — see foundation §13.4 / spec invariant 7):
18
+ * 1. INBOUND expansion: from selected records, pull every record
19
+ * that references them (children travel with parents), to a
20
+ * fixed point.
21
+ * 2. OUTBOUND completion: pull every parent the selected set
22
+ * references (no dangling FKs), transitively, WITHOUT
23
+ * re-expanding inbound from those parents (bounds the closure).
24
+ *
25
+ * The FK graph is auto-derived from the vault's existing RefRegistry
26
+ * (the `ref('target')` declarations on collections) — no hand-written
27
+ * edge list. See the design spec §4.1.
28
+ *
29
+ * @module
30
+ */
31
+
32
+ /** Seed predicate per collection. Records that return true become roots. */
33
+ interface WalkClosureOptions {
34
+ readonly seeds: Record<string, (record: Record<string, unknown>) => boolean | Promise<boolean>>;
35
+ /** Max fixed-point iterations before throwing. Default 16. */
36
+ readonly maxDepth?: number;
37
+ }
38
+ interface ClosureResult {
39
+ /** collection → set of record ids that travel together. */
40
+ readonly closure: Map<string, Set<string>>;
41
+ readonly graph: {
42
+ /** Fixed-point iterations the walk needed to converge. */
43
+ readonly depth: number;
44
+ /** True if an edge pointed back to an already-selected node. */
45
+ readonly cyclesDetected: boolean;
46
+ };
47
+ }
48
+ declare function walkClosure(vault: Vault, opts: WalkClosureOptions): Promise<ClosureResult>;
49
+
50
+ /**
51
+ * Partition-extraction dry-run (#202). Read-only preview of what an
52
+ * `extractPartition` would move: record counts, byte totals, and the
53
+ * timestamp span per collection — computed from raw encrypted
54
+ * envelopes WITHOUT decrypting them. Writes nothing, mutates nothing.
55
+ *
56
+ * @module
57
+ */
58
+
59
+ interface ExtractionPreview {
60
+ readonly totalRecords: number;
61
+ /** Sum of serialized encrypted-envelope sizes (bytes). */
62
+ readonly totalBytes: number;
63
+ readonly byCollection: ReadonlyArray<{
64
+ readonly name: string;
65
+ readonly recordCount: number;
66
+ readonly bytes: number;
67
+ /** Earliest envelope `_ts` in this collection (lexicographic). */
68
+ readonly oldestTs?: string;
69
+ readonly newestTs?: string;
70
+ }>;
71
+ readonly graph: {
72
+ readonly depth: number;
73
+ readonly cyclesDetected: boolean;
74
+ };
75
+ /** Records the walk reached but whose envelope couldn't be read. */
76
+ readonly inaccessible: ReadonlyArray<{
77
+ readonly collection: string;
78
+ readonly id: string;
79
+ }>;
80
+ }
81
+ declare function describeExtraction(vault: Vault, opts: WalkClosureOptions): Promise<ExtractionPreview>;
82
+
83
+ /**
84
+ * Partition extraction (#203 + #206). Walks the FK closure, re-encrypts
85
+ * the selected records under fresh per-collection DEKs, seals those DEKs
86
+ * under a one-time transfer key, and serializes an unowned
87
+ * `extracted-partition` bundle.
88
+ *
89
+ * @module
90
+ */
91
+
92
+ interface ExtractPartitionResult {
93
+ readonly bundleBytes: Uint8Array;
94
+ /** Raw 32-byte transfer key — deliver out-of-band; required to adopt. */
95
+ readonly transferKey: Uint8Array;
96
+ readonly sealId: string;
97
+ }
98
+ /**
99
+ * Extract a re-keyed, transfer-sealed partition (#203 + #206). Owner-only
100
+ * (#198 invariant 5): producing a standalone re-keyed vault is an
101
+ * ownership operation. Non-destructive on the source.
102
+ */
103
+ declare function extractPartition(vault: Vault, opts: WalkClosureOptions & {
104
+ readonly compression?: 'auto' | 'brotli' | 'gzip' | 'none';
105
+ readonly carrySchemas?: boolean;
106
+ readonly carryLedger?: boolean;
107
+ }): Promise<ExtractPartitionResult>;
108
+
109
+ /**
110
+ * Reverse of `sealDeks` (#206). Imports the transfer key, decrypts the
111
+ * sealed `{ collection: base64(rawDEK) }` map (layout iv(12)‖ct‖tag), and
112
+ * re-imports each DEK as an AES-GCM key. Throws `TransferSealError` on a
113
+ * wrong key (AES-GCM auth-tag failure) or malformed payload.
114
+ */
115
+ declare function unsealDeks(seal: TransferSealPayload, transferKey: Uint8Array): Promise<Map<string, CryptoKey>>;
116
+ interface AdoptPartitionOptions {
117
+ readonly transferKey: Uint8Array;
118
+ readonly destinationStore: NoydbStore;
119
+ readonly vaultName: string;
120
+ }
121
+ interface AdoptPartitionResult {
122
+ readonly vaultName: string;
123
+ readonly needsOwner: true;
124
+ readonly sealId: string;
125
+ }
126
+ declare function adoptPartition(bundleBytes: Uint8Array, opts: AdoptPartitionOptions): Promise<AdoptPartitionResult>;
127
+ interface CreateOwnerResult {
128
+ readonly vaultName: string;
129
+ readonly userId: string;
130
+ }
131
+ /** Standard-mode owner: recipient supplies the passphrase. */
132
+ interface CreateOwnerStandardOptions {
133
+ readonly userId: string;
134
+ readonly passphrase: string;
135
+ readonly transferKey: Uint8Array;
136
+ }
137
+ /**
138
+ * Managed-mode owner (#208 follow-up): the passphrase is minted + sealed under
139
+ * a `SealingKeyProvider` (e.g. an `at-*` OS keychain) so the partition
140
+ * auto-unlocks on the recipient's device. Managed mode mandates a strong
141
+ * (Shamir) recovery profile at creation (#195), which needs the
142
+ * `shamirRecovery` provider injected.
143
+ */
144
+ interface CreateOwnerManagedOptions {
145
+ readonly userId: string;
146
+ readonly passphraseMode: 'managed';
147
+ readonly sealingKey: SealingKeyProvider;
148
+ readonly recovery: ReadonlyArray<RecoveryEnrollmentInput>;
149
+ readonly shamirRecovery: ShamirRecoveryProvider;
150
+ readonly transferKey: Uint8Array;
151
+ }
152
+ type CreateOwnerOptions = CreateOwnerStandardOptions | CreateOwnerManagedOptions;
153
+ /**
154
+ * Mint the first owner keyring on an adopted-but-unowned partition (#208),
155
+ * then destroy the transfer seal (#209).
156
+ *
157
+ * Standard mode: the recipient supplies a passphrase. Managed mode: the
158
+ * passphrase is minted + sealed under a `SealingKeyProvider` and a strong
159
+ * (Shamir) recovery profile is enrolled (#195) — orchestrated via the existing
160
+ * `openVaultAndEnrollRecovery` ceremony.
161
+ *
162
+ * Either way, reuses `createOwnerKeyring` to derive the KEK + write the base
163
+ * keyring, then wraps the partition's DEKs (recovered from the seal) under that
164
+ * KEK and re-persists the merged keyring file.
165
+ *
166
+ * Idempotent under retry: the seal is destroyed LAST (Stage D), after the
167
+ * keyring (Stage A), the ledger transition (Stage B), and — in managed mode —
168
+ * strong-recovery enrollment (Stage C). A failure in the fallible enrollment
169
+ * step leaves the seal intact, and re-running with the same `userId` +
170
+ * `transferKey` resumes from the first incomplete stage. (Multi-profile recovery
171
+ * arrays may re-enroll an already-enrolled profile on retry; managed mode's
172
+ * mandated single Shamir profile does not.)
173
+ */
174
+ declare function createOwnerOnAdoptedPartition(store: NoydbStore, vaultName: string, opts: CreateOwnerOptions): Promise<CreateOwnerResult>;
175
+
176
+ export { type AdoptPartitionOptions, type AdoptPartitionResult, type ClosureResult, type CreateOwnerManagedOptions, type CreateOwnerOptions, type CreateOwnerResult, type CreateOwnerStandardOptions, type ExtractPartitionResult, type ExtractionPreview, type WalkClosureOptions, adoptPartition, createOwnerOnAdoptedPartition, describeExtraction, extractPartition, unsealDeks, walkClosure };
@@ -1,7 +1,176 @@
1
- export { l as COMPRESSION_BROTLI, m as COMPRESSION_GZIP, n as COMPRESSION_NONE, C as CompressionAlgo, F as FLAG_COMPRESSED, o as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, b as NOYDB_BUNDLE_MAGIC, c as NOYDB_BUNDLE_PREFIX_BYTES, d as NoydbBundleHeader, e as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, p as encodeBundleHeader, g as generateULID, i as isULID, r as readNoydbBundle, f as readNoydbBundleHeader, k as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../index-4agOpzqd.js';
2
- export { B as BackupCorruptedError, r as BackupLedgerError, s as BundleIntegrityError, t as BundleSealMismatchError, u as BundleVersionConflictError } from '../index-CNwA-B6-.js';
3
- import '../types-DW9RGSSs.js';
1
+ import { T as TransferSealPayload } from '../ulid-BmBgooGm.js';
2
+ export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-BmBgooGm.js';
3
+ import { bf as Vault, aO as NoydbStore, bb as SealingKeyProvider, bg as RecoveryEnrollmentInput, bh as ShamirRecoveryProvider } from '../types-BoFFiskX.js';
4
+ export { n as AdoptionStateError, B as BackupCorruptedError, o as BackupLedgerError, p as BundleIntegrityError, q as BundleSealMismatchError, r as BundleVersionConflictError, P as PartitionExtractionError, s as TransferSealError } from '../index-BCKdioeh.js';
4
5
  import '../lazy-builder-Rpd-V3jP.js';
5
6
  import '../predicate-Dnu81tsS.js';
6
7
  import '../strategy-DSTrsZ8t.js';
7
8
  import '../strategy-BSxFXGzb.js';
9
+ import '@noy-db/attestation';
10
+
11
+ /**
12
+ * Transitive-closure FK walker (#201). Computes the set of
13
+ * (collection, id) tuples reachable from seed predicates, so a
14
+ * partition extraction ships a referentially-complete subset.
15
+ *
16
+ * Two-phase, plaintext, read-only (runs inside the unlocked vault
17
+ * session — see foundation §13.4 / spec invariant 7):
18
+ * 1. INBOUND expansion: from selected records, pull every record
19
+ * that references them (children travel with parents), to a
20
+ * fixed point.
21
+ * 2. OUTBOUND completion: pull every parent the selected set
22
+ * references (no dangling FKs), transitively, WITHOUT
23
+ * re-expanding inbound from those parents (bounds the closure).
24
+ *
25
+ * The FK graph is auto-derived from the vault's existing RefRegistry
26
+ * (the `ref('target')` declarations on collections) — no hand-written
27
+ * edge list. See the design spec §4.1.
28
+ *
29
+ * @module
30
+ */
31
+
32
+ /** Seed predicate per collection. Records that return true become roots. */
33
+ interface WalkClosureOptions {
34
+ readonly seeds: Record<string, (record: Record<string, unknown>) => boolean | Promise<boolean>>;
35
+ /** Max fixed-point iterations before throwing. Default 16. */
36
+ readonly maxDepth?: number;
37
+ }
38
+ interface ClosureResult {
39
+ /** collection → set of record ids that travel together. */
40
+ readonly closure: Map<string, Set<string>>;
41
+ readonly graph: {
42
+ /** Fixed-point iterations the walk needed to converge. */
43
+ readonly depth: number;
44
+ /** True if an edge pointed back to an already-selected node. */
45
+ readonly cyclesDetected: boolean;
46
+ };
47
+ }
48
+ declare function walkClosure(vault: Vault, opts: WalkClosureOptions): Promise<ClosureResult>;
49
+
50
+ /**
51
+ * Partition-extraction dry-run (#202). Read-only preview of what an
52
+ * `extractPartition` would move: record counts, byte totals, and the
53
+ * timestamp span per collection — computed from raw encrypted
54
+ * envelopes WITHOUT decrypting them. Writes nothing, mutates nothing.
55
+ *
56
+ * @module
57
+ */
58
+
59
+ interface ExtractionPreview {
60
+ readonly totalRecords: number;
61
+ /** Sum of serialized encrypted-envelope sizes (bytes). */
62
+ readonly totalBytes: number;
63
+ readonly byCollection: ReadonlyArray<{
64
+ readonly name: string;
65
+ readonly recordCount: number;
66
+ readonly bytes: number;
67
+ /** Earliest envelope `_ts` in this collection (lexicographic). */
68
+ readonly oldestTs?: string;
69
+ readonly newestTs?: string;
70
+ }>;
71
+ readonly graph: {
72
+ readonly depth: number;
73
+ readonly cyclesDetected: boolean;
74
+ };
75
+ /** Records the walk reached but whose envelope couldn't be read. */
76
+ readonly inaccessible: ReadonlyArray<{
77
+ readonly collection: string;
78
+ readonly id: string;
79
+ }>;
80
+ }
81
+ declare function describeExtraction(vault: Vault, opts: WalkClosureOptions): Promise<ExtractionPreview>;
82
+
83
+ /**
84
+ * Partition extraction (#203 + #206). Walks the FK closure, re-encrypts
85
+ * the selected records under fresh per-collection DEKs, seals those DEKs
86
+ * under a one-time transfer key, and serializes an unowned
87
+ * `extracted-partition` bundle.
88
+ *
89
+ * @module
90
+ */
91
+
92
+ interface ExtractPartitionResult {
93
+ readonly bundleBytes: Uint8Array;
94
+ /** Raw 32-byte transfer key — deliver out-of-band; required to adopt. */
95
+ readonly transferKey: Uint8Array;
96
+ readonly sealId: string;
97
+ }
98
+ /**
99
+ * Extract a re-keyed, transfer-sealed partition (#203 + #206). Owner-only
100
+ * (#198 invariant 5): producing a standalone re-keyed vault is an
101
+ * ownership operation. Non-destructive on the source.
102
+ */
103
+ declare function extractPartition(vault: Vault, opts: WalkClosureOptions & {
104
+ readonly compression?: 'auto' | 'brotli' | 'gzip' | 'none';
105
+ readonly carrySchemas?: boolean;
106
+ readonly carryLedger?: boolean;
107
+ }): Promise<ExtractPartitionResult>;
108
+
109
+ /**
110
+ * Reverse of `sealDeks` (#206). Imports the transfer key, decrypts the
111
+ * sealed `{ collection: base64(rawDEK) }` map (layout iv(12)‖ct‖tag), and
112
+ * re-imports each DEK as an AES-GCM key. Throws `TransferSealError` on a
113
+ * wrong key (AES-GCM auth-tag failure) or malformed payload.
114
+ */
115
+ declare function unsealDeks(seal: TransferSealPayload, transferKey: Uint8Array): Promise<Map<string, CryptoKey>>;
116
+ interface AdoptPartitionOptions {
117
+ readonly transferKey: Uint8Array;
118
+ readonly destinationStore: NoydbStore;
119
+ readonly vaultName: string;
120
+ }
121
+ interface AdoptPartitionResult {
122
+ readonly vaultName: string;
123
+ readonly needsOwner: true;
124
+ readonly sealId: string;
125
+ }
126
+ declare function adoptPartition(bundleBytes: Uint8Array, opts: AdoptPartitionOptions): Promise<AdoptPartitionResult>;
127
+ interface CreateOwnerResult {
128
+ readonly vaultName: string;
129
+ readonly userId: string;
130
+ }
131
+ /** Standard-mode owner: recipient supplies the passphrase. */
132
+ interface CreateOwnerStandardOptions {
133
+ readonly userId: string;
134
+ readonly passphrase: string;
135
+ readonly transferKey: Uint8Array;
136
+ }
137
+ /**
138
+ * Managed-mode owner (#208 follow-up): the passphrase is minted + sealed under
139
+ * a `SealingKeyProvider` (e.g. an `at-*` OS keychain) so the partition
140
+ * auto-unlocks on the recipient's device. Managed mode mandates a strong
141
+ * (Shamir) recovery profile at creation (#195), which needs the
142
+ * `shamirRecovery` provider injected.
143
+ */
144
+ interface CreateOwnerManagedOptions {
145
+ readonly userId: string;
146
+ readonly passphraseMode: 'managed';
147
+ readonly sealingKey: SealingKeyProvider;
148
+ readonly recovery: ReadonlyArray<RecoveryEnrollmentInput>;
149
+ readonly shamirRecovery: ShamirRecoveryProvider;
150
+ readonly transferKey: Uint8Array;
151
+ }
152
+ type CreateOwnerOptions = CreateOwnerStandardOptions | CreateOwnerManagedOptions;
153
+ /**
154
+ * Mint the first owner keyring on an adopted-but-unowned partition (#208),
155
+ * then destroy the transfer seal (#209).
156
+ *
157
+ * Standard mode: the recipient supplies a passphrase. Managed mode: the
158
+ * passphrase is minted + sealed under a `SealingKeyProvider` and a strong
159
+ * (Shamir) recovery profile is enrolled (#195) — orchestrated via the existing
160
+ * `openVaultAndEnrollRecovery` ceremony.
161
+ *
162
+ * Either way, reuses `createOwnerKeyring` to derive the KEK + write the base
163
+ * keyring, then wraps the partition's DEKs (recovered from the seal) under that
164
+ * KEK and re-persists the merged keyring file.
165
+ *
166
+ * Idempotent under retry: the seal is destroyed LAST (Stage D), after the
167
+ * keyring (Stage A), the ledger transition (Stage B), and — in managed mode —
168
+ * strong-recovery enrollment (Stage C). A failure in the fallible enrollment
169
+ * step leaves the seal intact, and re-running with the same `userId` +
170
+ * `transferKey` resumes from the first incomplete stage. (Multi-profile recovery
171
+ * arrays may re-enroll an already-enrolled profile on retry; managed mode's
172
+ * mandated single Shamir profile does not.)
173
+ */
174
+ declare function createOwnerOnAdoptedPartition(store: NoydbStore, vaultName: string, opts: CreateOwnerOptions): Promise<CreateOwnerResult>;
175
+
176
+ export { type AdoptPartitionOptions, type AdoptPartitionResult, type ClosureResult, type CreateOwnerManagedOptions, type CreateOwnerOptions, type CreateOwnerResult, type CreateOwnerStandardOptions, type ExtractPartitionResult, type ExtractionPreview, type WalkClosureOptions, adoptPartition, createOwnerOnAdoptedPartition, describeExtraction, extractPartition, unsealDeks, walkClosure };