@noy-db/hub 0.6.0-pre.2 → 0.6.0-pre.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/codemods/0.4.0-pre.json +699 -0
  2. package/codemods/0.6.0-pre.json +211 -0
  3. package/dist/api-Z5VHH24A.js +20 -0
  4. package/dist/attestation/index.js +19 -19
  5. package/dist/{backup-YYBE5RPC.js → backup-K62BFMYK.js} +36 -18
  6. package/dist/backup-K62BFMYK.js.map +1 -0
  7. package/dist/blobs/index.js +13 -13
  8. package/dist/broker/index.js +12 -12
  9. package/dist/cargo/index.js +33 -33
  10. package/dist/{chunk-FDX7OWWI.js → chunk-2E2MKBMI.js} +2 -2
  11. package/dist/{chunk-VOQW5LAM.js → chunk-2IK6AC6A.js} +102 -71
  12. package/dist/chunk-2IK6AC6A.js.map +1 -0
  13. package/dist/{chunk-EDXAQ6JI.js → chunk-32O2N2CH.js} +87 -34
  14. package/dist/chunk-32O2N2CH.js.map +1 -0
  15. package/dist/{chunk-W5W6KHN2.js → chunk-3Y4OFWQJ.js} +1 -1
  16. package/dist/chunk-3Y4OFWQJ.js.map +1 -0
  17. package/dist/{chunk-7G6VDWXB.js → chunk-437FDIHO.js} +3 -3
  18. package/dist/chunk-437FDIHO.js.map +1 -0
  19. package/dist/{chunk-3FSX6LDG.js → chunk-47ZFULEZ.js} +8 -3
  20. package/dist/{chunk-3FSX6LDG.js.map → chunk-47ZFULEZ.js.map} +1 -1
  21. package/dist/{chunk-ZJADGNYF.js → chunk-4AOERLTV.js} +1 -1
  22. package/dist/chunk-4AOERLTV.js.map +1 -0
  23. package/dist/{chunk-MWKDOHEF.js → chunk-4HVTRHSA.js} +17 -10
  24. package/dist/chunk-4HVTRHSA.js.map +1 -0
  25. package/dist/{chunk-V5KYPBUR.js → chunk-5BS6IQZZ.js} +11 -14
  26. package/dist/chunk-5BS6IQZZ.js.map +1 -0
  27. package/dist/{chunk-LWSJG3LI.js → chunk-5EJQNA26.js} +7 -3
  28. package/dist/chunk-5EJQNA26.js.map +1 -0
  29. package/dist/{chunk-7F4DBNSP.js → chunk-5J5TTSGW.js} +3 -3
  30. package/dist/{chunk-BTVYJWSN.js → chunk-5JT4Y5UE.js} +10 -10
  31. package/dist/{chunk-C2OOEM57.js → chunk-6S466CMQ.js} +92 -35
  32. package/dist/chunk-6S466CMQ.js.map +1 -0
  33. package/dist/{chunk-PY7CI6L5.js → chunk-6TXUVKPG.js} +516 -263
  34. package/dist/chunk-6TXUVKPG.js.map +1 -0
  35. package/dist/{chunk-7NXHMW6Y.js → chunk-7RCZ436O.js} +2 -2
  36. package/dist/{chunk-DG27IUVI.js → chunk-A3NTKHDB.js} +2 -2
  37. package/dist/{chunk-CCZJJ4I2.js → chunk-A4K5GLE6.js} +4 -4
  38. package/dist/{chunk-CEJWMBXO.js → chunk-APV42WPR.js} +2 -2
  39. package/dist/{chunk-4HDYQL3J.js → chunk-AQF7JSQR.js} +2 -2
  40. package/dist/{chunk-KUDZVJKQ.js → chunk-BP4I7IBK.js} +2 -2
  41. package/dist/{chunk-4UVDI4XE.js → chunk-BTNKPDZM.js} +4 -4
  42. package/dist/{chunk-HVQGCKY4.js → chunk-C7WJNVJG.js} +2 -2
  43. package/dist/{chunk-WYZ5MYUA.js → chunk-CV7WXCZD.js} +44 -42
  44. package/dist/chunk-CV7WXCZD.js.map +1 -0
  45. package/dist/{chunk-KCQX65FU.js → chunk-CVYXIN5B.js} +3 -3
  46. package/dist/{chunk-VN45YLWM.js → chunk-D5UDZANO.js} +255 -132
  47. package/dist/chunk-D5UDZANO.js.map +1 -0
  48. package/dist/{chunk-AR2JDFAE.js → chunk-DJ23QZIN.js} +2 -2
  49. package/dist/{chunk-PJNTR2NV.js → chunk-DKYEVHZH.js} +7 -10
  50. package/dist/chunk-DKYEVHZH.js.map +1 -0
  51. package/dist/{chunk-SZ2K3MHL.js → chunk-DYASJSKI.js} +8 -11
  52. package/dist/{chunk-SZ2K3MHL.js.map → chunk-DYASJSKI.js.map} +1 -1
  53. package/dist/{chunk-G5APARUV.js → chunk-E6VDPBE3.js} +13 -15
  54. package/dist/chunk-E6VDPBE3.js.map +1 -0
  55. package/dist/{chunk-A67356IR.js → chunk-EG6AQBYW.js} +33 -8
  56. package/dist/chunk-EG6AQBYW.js.map +1 -0
  57. package/dist/{chunk-PVU7LW5L.js → chunk-EJIVFOOQ.js} +6 -6
  58. package/dist/{chunk-VRA4Q7DA.js → chunk-F5AJZC3U.js} +35 -47
  59. package/dist/chunk-F5AJZC3U.js.map +1 -0
  60. package/dist/{chunk-VMCCGUQB.js → chunk-GDGTIWB4.js} +2 -2
  61. package/dist/{chunk-FUHKW252.js → chunk-GILI76SU.js} +2 -2
  62. package/dist/{chunk-35EBKWQU.js → chunk-GT72D4FO.js} +4 -4
  63. package/dist/{chunk-PRDRGL73.js → chunk-GYUCRDAU.js} +17 -14
  64. package/dist/chunk-GYUCRDAU.js.map +1 -0
  65. package/dist/{chunk-JRCYZEHU.js → chunk-HGJC7I5F.js} +2 -2
  66. package/dist/{chunk-TOAIYQJR.js → chunk-HJRTFXAA.js} +7 -10
  67. package/dist/chunk-HJRTFXAA.js.map +1 -0
  68. package/dist/chunk-HK67PX4J.js +27 -0
  69. package/dist/chunk-HK67PX4J.js.map +1 -0
  70. package/dist/{chunk-JXIDGFKS.js → chunk-HTHRCGWP.js} +4 -2
  71. package/dist/chunk-HTHRCGWP.js.map +1 -0
  72. package/dist/{chunk-AHLJSVRL.js → chunk-HTMQBBF3.js} +5 -7
  73. package/dist/chunk-HTMQBBF3.js.map +1 -0
  74. package/dist/{chunk-ZNACADFG.js → chunk-ICCRAPWD.js} +4 -4
  75. package/dist/chunk-ICCRAPWD.js.map +1 -0
  76. package/dist/{chunk-66W5OOCX.js → chunk-IOURTXTM.js} +52 -65
  77. package/dist/chunk-IOURTXTM.js.map +1 -0
  78. package/dist/{chunk-MZ5ZFO2D.js → chunk-IPDS2TYW.js} +84 -112
  79. package/dist/chunk-IPDS2TYW.js.map +1 -0
  80. package/dist/{chunk-UIBGXRDD.js → chunk-JHO6FGZX.js} +25 -31
  81. package/dist/chunk-JHO6FGZX.js.map +1 -0
  82. package/dist/{chunk-YAWK6AWF.js → chunk-JIF3IBRK.js} +2 -2
  83. package/dist/{chunk-HNHCQ556.js → chunk-KBOPY6W2.js} +2 -2
  84. package/dist/{chunk-UHXCLPGC.js → chunk-KDX6VEYV.js} +2 -2
  85. package/dist/chunk-KDX6VEYV.js.map +1 -0
  86. package/dist/{chunk-W3TVWF6N.js → chunk-KM6YR5XF.js} +2 -2
  87. package/dist/{chunk-3737A6EA.js → chunk-KUXTWVAR.js} +75 -18
  88. package/dist/chunk-KUXTWVAR.js.map +1 -0
  89. package/dist/chunk-L2XQ776M.js +123 -0
  90. package/dist/chunk-L2XQ776M.js.map +1 -0
  91. package/dist/{chunk-E6427JU2.js → chunk-L6FSZFG7.js} +18 -2
  92. package/dist/chunk-L6FSZFG7.js.map +1 -0
  93. package/dist/{chunk-5PR33AC4.js → chunk-M4IKEOJS.js} +20 -17
  94. package/dist/chunk-M4IKEOJS.js.map +1 -0
  95. package/dist/{chunk-6HFM7EIT.js → chunk-MNMYHZVU.js} +2 -2
  96. package/dist/{chunk-NIVEDYJZ.js → chunk-MNUTPZRQ.js} +31 -49
  97. package/dist/chunk-MNUTPZRQ.js.map +1 -0
  98. package/dist/{chunk-VV4NSB7P.js → chunk-MQXYR65M.js} +15 -24
  99. package/dist/chunk-MQXYR65M.js.map +1 -0
  100. package/dist/{chunk-QD724WDJ.js → chunk-N2HKBESK.js} +4 -4
  101. package/dist/{chunk-Z45YRGFO.js → chunk-N7YAQKAO.js} +2 -2
  102. package/dist/{chunk-DMQCLZ4Z.js → chunk-NH2MST6J.js} +2 -2
  103. package/dist/{chunk-TAGFGKHP.js → chunk-NRNTXBHT.js} +7 -10
  104. package/dist/chunk-NRNTXBHT.js.map +1 -0
  105. package/dist/{chunk-I6SDX7WX.js → chunk-NYSD43OE.js} +16 -22
  106. package/dist/chunk-NYSD43OE.js.map +1 -0
  107. package/dist/{chunk-I4F6PKUK.js → chunk-ODVIFBAQ.js} +16 -17
  108. package/dist/chunk-ODVIFBAQ.js.map +1 -0
  109. package/dist/{chunk-26JMGSSC.js → chunk-OIIAXFKM.js} +4 -4
  110. package/dist/chunk-OIIAXFKM.js.map +1 -0
  111. package/dist/{chunk-HXGUIPQB.js → chunk-OQLYMBJI.js} +3 -3
  112. package/dist/{chunk-RKKORO4M.js → chunk-OWGEHDT2.js} +10 -10
  113. package/dist/chunk-OWGEHDT2.js.map +1 -0
  114. package/dist/{chunk-HNGSV2YC.js → chunk-P7L3OQLL.js} +25 -10
  115. package/dist/chunk-P7L3OQLL.js.map +1 -0
  116. package/dist/{chunk-MSWYQLMQ.js → chunk-PG6PFMDC.js} +2 -2
  117. package/dist/{chunk-E7OBCBXS.js → chunk-PNAIDIP7.js} +13 -16
  118. package/dist/chunk-PNAIDIP7.js.map +1 -0
  119. package/dist/{chunk-GLKDWWNO.js → chunk-PZSS7MUM.js} +16 -14
  120. package/dist/chunk-PZSS7MUM.js.map +1 -0
  121. package/dist/{chunk-WKPJXWKR.js → chunk-QPIUFRUC.js} +3 -3
  122. package/dist/{chunk-JIUVJ4M7.js → chunk-REL4OLWW.js} +2 -2
  123. package/dist/{chunk-ERB6NDDW.js → chunk-RKDH6L53.js} +134 -33
  124. package/dist/chunk-RKDH6L53.js.map +1 -0
  125. package/dist/{chunk-VW6ZZGCG.js → chunk-RNSC2ARR.js} +3 -3
  126. package/dist/{chunk-WLYIROCJ.js → chunk-RORE2GX2.js} +2 -2
  127. package/dist/{chunk-TDJPS3T2.js → chunk-RQY5UWEL.js} +24 -19
  128. package/dist/chunk-RQY5UWEL.js.map +1 -0
  129. package/dist/{chunk-7TSYBD3E.js → chunk-RSFG7XHM.js} +2 -2
  130. package/dist/{chunk-FAXZQ5UF.js → chunk-S55DBWRC.js} +2 -2
  131. package/dist/{chunk-WHJKIZS7.js → chunk-SA77BQ7F.js} +27 -149
  132. package/dist/chunk-SA77BQ7F.js.map +1 -0
  133. package/dist/{chunk-747LRSOO.js → chunk-SFD2LL7G.js} +2 -2
  134. package/dist/{chunk-P7OG2ETF.js → chunk-SG3OQCRG.js} +3 -3
  135. package/dist/{chunk-55LKVALY.js → chunk-T7IR4N2S.js} +1 -3
  136. package/dist/chunk-T7IR4N2S.js.map +1 -0
  137. package/dist/{chunk-EP7VPR7Y.js → chunk-TC6MBEGH.js} +11 -8
  138. package/dist/chunk-TC6MBEGH.js.map +1 -0
  139. package/dist/{chunk-HFQ6LGIO.js → chunk-TENLCGYD.js} +12 -10
  140. package/dist/{chunk-HFQ6LGIO.js.map → chunk-TENLCGYD.js.map} +1 -1
  141. package/dist/{chunk-WQDTCJ6W.js → chunk-VEX2BQVX.js} +3 -3
  142. package/dist/{chunk-7VHY5E3X.js → chunk-VH2W6BOG.js} +7 -7
  143. package/dist/chunk-VHVMJWM6.js +201 -0
  144. package/dist/chunk-VHVMJWM6.js.map +1 -0
  145. package/dist/{chunk-VCETL77O.js → chunk-VJ4B3ZXY.js} +27 -7
  146. package/dist/chunk-VJ4B3ZXY.js.map +1 -0
  147. package/dist/{chunk-OF3L2SD6.js → chunk-W6NFONOV.js} +2 -2
  148. package/dist/{chunk-NJDQ4YSV.js → chunk-WBNXZU42.js} +4 -4
  149. package/dist/{chunk-FNSMZQS4.js → chunk-WKD5ESK4.js} +2 -2
  150. package/dist/{chunk-NKH7GSIH.js → chunk-XGQGWZ6D.js} +4 -4
  151. package/dist/chunk-YOT7D63X.js +190 -0
  152. package/dist/chunk-YOT7D63X.js.map +1 -0
  153. package/dist/{chunk-4MC5JRRX.js → chunk-YVTADFTC.js} +14 -15
  154. package/dist/chunk-YVTADFTC.js.map +1 -0
  155. package/dist/{chunk-GASWQ3XG.js → chunk-ZBDWKPBW.js} +15 -16
  156. package/dist/chunk-ZBDWKPBW.js.map +1 -0
  157. package/dist/{chunk-52QYGZHH.js → chunk-ZPMXYPBR.js} +2 -2
  158. package/dist/chunk-ZPMXYPBR.js.map +1 -0
  159. package/dist/chunk-ZVAFJQZB.js +66 -0
  160. package/dist/chunk-ZVAFJQZB.js.map +1 -0
  161. package/dist/{chunk-VJFMXYKP.js → chunk-ZWKF3CD3.js} +2 -2
  162. package/dist/{chunk-I4ZAO7F7.js → chunk-ZXW3X3DQ.js} +7 -11
  163. package/dist/chunk-ZXW3X3DQ.js.map +1 -0
  164. package/dist/classified/index.js +5 -5
  165. package/dist/{classified-marker-FTOX7Q5L.js → classified-marker-PMDG3O36.js} +3 -3
  166. package/dist/collection-facade-ZJK5EB33.js +45 -0
  167. package/dist/{computed-6G5M3UPH.js → computed-UHCBRILW.js} +3 -3
  168. package/dist/consent/index.js +10 -10
  169. package/dist/cover/index.js +10 -3
  170. package/dist/custody/index.js +11 -11
  171. package/dist/{dead-filter-ENRIOQIE.js → dead-filter-777VWDER.js} +2 -2
  172. package/dist/debug/index.js +1 -1
  173. package/dist/{delegation-SSEPLXXO.js → delegation-4R5DU23X.js} +24 -23
  174. package/dist/delegation-4R5DU23X.js.map +1 -0
  175. package/dist/derivations/index.js +12 -12
  176. package/dist/derive-3WAS2G5T.js +22 -0
  177. package/dist/directory/index.js +10 -10
  178. package/dist/{dispatch-BDVGYC6X.js → dispatch-3EN6YCCS.js} +18 -18
  179. package/dist/{dispatch-RE74SH6L.js → dispatch-ASL257KG.js} +5 -5
  180. package/dist/{enclave-52VUXNRL.js → enclave-ZJS5R5RH.js} +25 -9
  181. package/dist/executor-GPM6DNWV.js +9 -0
  182. package/dist/executor-LJSMZ4IB.js +9 -0
  183. package/dist/executor-SHUVRZUJ.js +29 -0
  184. package/dist/export-accessible-GNY6DC6U.js +23 -0
  185. package/dist/extract-partition-BG3AF4NZ.js +38 -0
  186. package/dist/{fanout-sidecar-DTBIDOWF.js → fanout-sidecar-TFPWDOME.js} +18 -27
  187. package/dist/fanout-sidecar-TFPWDOME.js.map +1 -0
  188. package/dist/find-KX6OKHDP.js +11 -0
  189. package/dist/forget/index.js +9 -9
  190. package/dist/guards/index.js +4 -4
  191. package/dist/history/index.js +23 -20
  192. package/dist/history/index.js.map +1 -1
  193. package/dist/i18n/index.js +14 -14
  194. package/dist/index.d.ts +32 -15
  195. package/dist/index.js +183 -191
  196. package/dist/index.js.map +1 -1
  197. package/dist/indexing/index.js +2 -2
  198. package/dist/introspection/index.js +11 -11
  199. package/dist/issue-PAUM7NCX.js +19 -0
  200. package/dist/kernel/enclave/crypto.d.ts +24 -4
  201. package/dist/kernel/enclave/index.d.ts +8 -2
  202. package/dist/kernel/enclave/record-aad.d.ts +131 -0
  203. package/dist/kernel/enclave/record-envelope.d.ts +76 -0
  204. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  205. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  206. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  207. package/dist/kernel/enclave/record-keys/rekey.d.ts +68 -0
  208. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -2
  209. package/dist/kernel/errors.d.ts +23 -11
  210. package/dist/kernel/merge-authority.d.ts +25 -0
  211. package/dist/kernel/noydb.d.ts +9 -3
  212. package/dist/kernel/query/builder.d.ts +15 -2
  213. package/dist/kernel/query/join.d.ts +27 -0
  214. package/dist/kernel/sync-policy.d.ts +0 -2
  215. package/dist/kernel/tier-visibility.d.ts +15 -0
  216. package/dist/kernel/types.d.ts +125 -6
  217. package/dist/kernel/vault.d.ts +21 -17
  218. package/dist/kernel/via/index.d.ts +11 -2
  219. package/dist/{ledger-4WJL66BW.js → ledger-62CEPRPX.js} +11 -11
  220. package/dist/liberate-I6AOLWXW.js +24 -0
  221. package/dist/{link-set-N4ZPV6E6.js → link-set-ZRYNUHN3.js} +11 -11
  222. package/dist/{managed-secret-OTHS64IF.js → managed-secret-T2WB4O47.js} +11 -3
  223. package/dist/materialized-views/index.js +22 -21
  224. package/dist/money/index.js +12 -8
  225. package/dist/noydb-SS6EN7TK.js +84 -0
  226. package/dist/overlay-views/index.js +4 -4
  227. package/dist/periods/index.js +22 -12
  228. package/dist/pod/index.js +75 -86
  229. package/dist/pod-handle-UPLXOGIK.js +41 -0
  230. package/dist/pod-handle-UPLXOGIK.js.map +1 -0
  231. package/dist/policy/index.js +11 -4
  232. package/dist/port/to/index.d.ts +4 -4
  233. package/dist/port/to/locator.d.ts +54 -8
  234. package/dist/port/with/i18n-strategy.d.ts +4 -1
  235. package/dist/port/with/lookup-strategy.d.ts +4 -1
  236. package/dist/port/with/merge-authority.d.ts +52 -0
  237. package/dist/port/with/service-bus.d.ts +0 -4
  238. package/dist/port/with/strategies.d.ts +2 -0
  239. package/dist/portability/index.js +8 -8
  240. package/dist/{post-register-ZAG2CAIY.js → post-register-J4DEVNXK.js} +6 -6
  241. package/dist/query/index.js +3 -3
  242. package/dist/reduce/index.js +4 -4
  243. package/dist/register-UPD4GKBC.js +32 -0
  244. package/dist/registry-7KX2HWFS.js +18 -0
  245. package/dist/registry-PKYYEHEW.js +9 -0
  246. package/dist/registry-XHCYMD34.js +19 -0
  247. package/dist/registry-XIRTZHPC.js +9 -0
  248. package/dist/request-withdrawal-XZSESWZV.js +31 -0
  249. package/dist/{reveal-CMOJY4VO.js → reveal-525XWQU2.js} +6 -6
  250. package/dist/revoke-QI7YHQ2B.js +24 -0
  251. package/dist/satellites/index.js +1 -1
  252. package/dist/schema-update/index.js +2 -2
  253. package/dist/sealed-record/index.js +20 -13
  254. package/dist/sealed-record/index.js.map +1 -1
  255. package/dist/search/index.js +4 -4
  256. package/dist/{seed-UK4QRIUN.js → seed-SGIF3EN4.js} +19 -22
  257. package/dist/seed-SGIF3EN4.js.map +1 -0
  258. package/dist/sequence/index.js +9 -9
  259. package/dist/session/index.js +10 -10
  260. package/dist/shadow/index.js +2 -2
  261. package/dist/share-link/index.js +1 -1
  262. package/dist/signer-BZWDPGGN.js +25 -0
  263. package/dist/snapshots/index.js +10 -10
  264. package/dist/snapshots/index.js.map +1 -1
  265. package/dist/{stale-ZWXSOWJI.js → stale-PQYPVCER.js} +10 -10
  266. package/dist/storage-MJHKNQRO.js +23 -0
  267. package/dist/{store-coordination-provider-PB6QZ57W.js → store-coordination-provider-TFHZLKHG.js} +18 -12
  268. package/dist/store-coordination-provider-TFHZLKHG.js.map +1 -0
  269. package/dist/sync/index.js +11 -11
  270. package/dist/team/index.js +15 -14
  271. package/dist/tiers/index.js +11 -10
  272. package/dist/to/index.js +17 -9
  273. package/dist/to/index.js.map +1 -1
  274. package/dist/transactions/index.js +4 -4
  275. package/dist/{ulid-PTAIMDG4.js → ulid-VQW6ERQN.js} +2 -2
  276. package/dist/util/index.js +1 -1
  277. package/dist/vault-head/index.js +115 -0
  278. package/dist/vault-head/index.js.map +1 -0
  279. package/dist/{verify-RO5RTZOJ.js → verify-J6DEOXP3.js} +5 -5
  280. package/dist/via/lookup/handle.d.ts +4 -1
  281. package/dist/via/money/exact.d.ts +44 -0
  282. package/dist/via/money/index.d.ts +2 -0
  283. package/dist/via/money/normalize.d.ts +20 -0
  284. package/dist/walk-BX4NSB5L.js +21 -0
  285. package/dist/with-audit/guards/immutable-guard.d.ts +14 -0
  286. package/dist/with-audit/periods/active.d.ts +28 -1
  287. package/dist/with-audit/periods/index.d.ts +4 -2
  288. package/dist/with-audit/periods/periods.d.ts +161 -6
  289. package/dist/with-audit/periods/strategy.d.ts +14 -5
  290. package/dist/with-audit/periods/vault-facade.d.ts +89 -10
  291. package/dist/with-audit/periods/window.d.ts +10 -0
  292. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  293. package/dist/with-audit/tiers/index.d.ts +17 -2
  294. package/dist/with-cargo/adopt-partition.d.ts +1 -1
  295. package/dist/with-cargo/extract-partition.d.ts +1 -1
  296. package/dist/with-cargo/index.d.ts +2 -2
  297. package/dist/with-commit/history/history.d.ts +26 -0
  298. package/dist/with-commit/history/index.d.ts +2 -1
  299. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  300. package/dist/with-commit/history/strategy.d.ts +11 -1
  301. package/dist/with-commit/numbering/index.d.ts +0 -5
  302. package/dist/with-commit/vault-head/active.d.ts +2 -0
  303. package/dist/with-commit/vault-head/head.d.ts +28 -0
  304. package/dist/with-commit/vault-head/index.d.ts +10 -0
  305. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  306. package/dist/with-commit/vault-head/verify.d.ts +90 -0
  307. package/dist/with-formula/materialized-views/types.d.ts +52 -0
  308. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  309. package/dist/with-party/directory/storage.d.ts +0 -11
  310. package/dist/with-party/directory/visibility.d.ts +0 -21
  311. package/dist/with-party/policy/storage.d.ts +0 -10
  312. package/dist/with-party/team/index.d.ts +1 -1
  313. package/dist/with-party/team/keyring.d.ts +17 -3
  314. package/dist/with-party/team/tiers.d.ts +2 -1
  315. package/dist/with-pod/format.d.ts +10 -12
  316. package/dist/with-pod/index.d.ts +10 -10
  317. package/dist/with-pod/open.d.ts +2 -2
  318. package/dist/with-pod/pod-handle.d.ts +19 -0
  319. package/dist/with-pod/pod-store.d.ts +0 -8
  320. package/dist/with-pod/{bundle.d.ts → pod.d.ts} +26 -19
  321. package/dist/with-pod/ulid.d.ts +1 -1
  322. package/dist/with-shape/introspection/index.d.ts +1 -0
  323. package/dist/with-sync/engine.d.ts +54 -5
  324. package/dist/with-sync/strategy.d.ts +3 -0
  325. package/dist/withdraw-accessible-K4CPMH4C.js +28 -0
  326. package/package.json +12 -5
  327. package/dist/api-WVY3H3YH.js +0 -20
  328. package/dist/backup-YYBE5RPC.js.map +0 -1
  329. package/dist/bundle-handle-JEUWU2SJ.js +0 -36
  330. package/dist/bundle-handle-JEUWU2SJ.js.map +0 -1
  331. package/dist/chunk-26JMGSSC.js.map +0 -1
  332. package/dist/chunk-3737A6EA.js.map +0 -1
  333. package/dist/chunk-4MC5JRRX.js.map +0 -1
  334. package/dist/chunk-52QYGZHH.js.map +0 -1
  335. package/dist/chunk-55LKVALY.js.map +0 -1
  336. package/dist/chunk-5PR33AC4.js.map +0 -1
  337. package/dist/chunk-66W5OOCX.js.map +0 -1
  338. package/dist/chunk-7G6VDWXB.js.map +0 -1
  339. package/dist/chunk-A67356IR.js.map +0 -1
  340. package/dist/chunk-AFHQATY4.js +0 -47
  341. package/dist/chunk-AFHQATY4.js.map +0 -1
  342. package/dist/chunk-AHLJSVRL.js.map +0 -1
  343. package/dist/chunk-C2OOEM57.js.map +0 -1
  344. package/dist/chunk-DIMKRG2E.js +0 -131
  345. package/dist/chunk-DIMKRG2E.js.map +0 -1
  346. package/dist/chunk-E6427JU2.js.map +0 -1
  347. package/dist/chunk-E7OBCBXS.js.map +0 -1
  348. package/dist/chunk-EDXAQ6JI.js.map +0 -1
  349. package/dist/chunk-EP7VPR7Y.js.map +0 -1
  350. package/dist/chunk-ERB6NDDW.js.map +0 -1
  351. package/dist/chunk-G5APARUV.js.map +0 -1
  352. package/dist/chunk-GASWQ3XG.js.map +0 -1
  353. package/dist/chunk-GLKDWWNO.js.map +0 -1
  354. package/dist/chunk-HNGSV2YC.js.map +0 -1
  355. package/dist/chunk-I4F6PKUK.js.map +0 -1
  356. package/dist/chunk-I4ZAO7F7.js.map +0 -1
  357. package/dist/chunk-I6SDX7WX.js.map +0 -1
  358. package/dist/chunk-JXIDGFKS.js.map +0 -1
  359. package/dist/chunk-LWSJG3LI.js.map +0 -1
  360. package/dist/chunk-MWKDOHEF.js.map +0 -1
  361. package/dist/chunk-MZ5ZFO2D.js.map +0 -1
  362. package/dist/chunk-NIVEDYJZ.js.map +0 -1
  363. package/dist/chunk-NWCGDAV6.js +0 -45
  364. package/dist/chunk-NWCGDAV6.js.map +0 -1
  365. package/dist/chunk-PJNTR2NV.js.map +0 -1
  366. package/dist/chunk-PRDRGL73.js.map +0 -1
  367. package/dist/chunk-PY7CI6L5.js.map +0 -1
  368. package/dist/chunk-RKKORO4M.js.map +0 -1
  369. package/dist/chunk-TAGFGKHP.js.map +0 -1
  370. package/dist/chunk-TDJPS3T2.js.map +0 -1
  371. package/dist/chunk-TOAIYQJR.js.map +0 -1
  372. package/dist/chunk-UHXCLPGC.js.map +0 -1
  373. package/dist/chunk-UIBGXRDD.js.map +0 -1
  374. package/dist/chunk-V5KYPBUR.js.map +0 -1
  375. package/dist/chunk-VCETL77O.js.map +0 -1
  376. package/dist/chunk-VN45YLWM.js.map +0 -1
  377. package/dist/chunk-VOQW5LAM.js.map +0 -1
  378. package/dist/chunk-VRA4Q7DA.js.map +0 -1
  379. package/dist/chunk-VV4NSB7P.js.map +0 -1
  380. package/dist/chunk-W5W6KHN2.js.map +0 -1
  381. package/dist/chunk-WHJKIZS7.js.map +0 -1
  382. package/dist/chunk-WYZ5MYUA.js.map +0 -1
  383. package/dist/chunk-ZJADGNYF.js.map +0 -1
  384. package/dist/chunk-ZNACADFG.js.map +0 -1
  385. package/dist/collection-facade-QN5ULWYC.js +0 -45
  386. package/dist/delegation-SSEPLXXO.js.map +0 -1
  387. package/dist/derive-6V3PIZF7.js +0 -22
  388. package/dist/executor-CYJQLKKI.js +0 -9
  389. package/dist/executor-FHHLXO4Y.js +0 -28
  390. package/dist/executor-S4QIKEHW.js +0 -9
  391. package/dist/export-accessible-PE5AYKZR.js +0 -23
  392. package/dist/extract-partition-X2L26O6A.js +0 -38
  393. package/dist/fanout-sidecar-DTBIDOWF.js.map +0 -1
  394. package/dist/find-RBBYKXI7.js +0 -11
  395. package/dist/issue-RNU55YOF.js +0 -19
  396. package/dist/liberate-PX4CAT5V.js +0 -24
  397. package/dist/noydb-YPSEGK32.js +0 -83
  398. package/dist/register-TMD6YRCX.js +0 -32
  399. package/dist/registry-CZVINVQH.js +0 -9
  400. package/dist/registry-FVLDWQKT.js +0 -18
  401. package/dist/registry-IKUR2MXD.js +0 -9
  402. package/dist/registry-JET4HBLY.js +0 -19
  403. package/dist/request-withdrawal-RH55LNZL.js +0 -31
  404. package/dist/revoke-R5TBYVA6.js +0 -24
  405. package/dist/seed-UK4QRIUN.js.map +0 -1
  406. package/dist/signer-AGALOXOO.js +0 -25
  407. package/dist/storage-N7LB275C.js +0 -23
  408. package/dist/store-coordination-provider-PB6QZ57W.js.map +0 -1
  409. package/dist/walk-OCUHCYJ6.js +0 -21
  410. package/dist/with-pod/bundle-handle.d.ts +0 -9
  411. package/dist/withdraw-accessible-QQNWM5BO.js +0 -28
  412. /package/dist/{api-WVY3H3YH.js.map → api-Z5VHH24A.js.map} +0 -0
  413. /package/dist/{chunk-FDX7OWWI.js.map → chunk-2E2MKBMI.js.map} +0 -0
  414. /package/dist/{chunk-7F4DBNSP.js.map → chunk-5J5TTSGW.js.map} +0 -0
  415. /package/dist/{chunk-BTVYJWSN.js.map → chunk-5JT4Y5UE.js.map} +0 -0
  416. /package/dist/{chunk-7NXHMW6Y.js.map → chunk-7RCZ436O.js.map} +0 -0
  417. /package/dist/{chunk-DG27IUVI.js.map → chunk-A3NTKHDB.js.map} +0 -0
  418. /package/dist/{chunk-CCZJJ4I2.js.map → chunk-A4K5GLE6.js.map} +0 -0
  419. /package/dist/{chunk-CEJWMBXO.js.map → chunk-APV42WPR.js.map} +0 -0
  420. /package/dist/{chunk-4HDYQL3J.js.map → chunk-AQF7JSQR.js.map} +0 -0
  421. /package/dist/{chunk-KUDZVJKQ.js.map → chunk-BP4I7IBK.js.map} +0 -0
  422. /package/dist/{chunk-4UVDI4XE.js.map → chunk-BTNKPDZM.js.map} +0 -0
  423. /package/dist/{chunk-HVQGCKY4.js.map → chunk-C7WJNVJG.js.map} +0 -0
  424. /package/dist/{chunk-KCQX65FU.js.map → chunk-CVYXIN5B.js.map} +0 -0
  425. /package/dist/{chunk-AR2JDFAE.js.map → chunk-DJ23QZIN.js.map} +0 -0
  426. /package/dist/{chunk-PVU7LW5L.js.map → chunk-EJIVFOOQ.js.map} +0 -0
  427. /package/dist/{chunk-VMCCGUQB.js.map → chunk-GDGTIWB4.js.map} +0 -0
  428. /package/dist/{chunk-FUHKW252.js.map → chunk-GILI76SU.js.map} +0 -0
  429. /package/dist/{chunk-35EBKWQU.js.map → chunk-GT72D4FO.js.map} +0 -0
  430. /package/dist/{chunk-JRCYZEHU.js.map → chunk-HGJC7I5F.js.map} +0 -0
  431. /package/dist/{chunk-YAWK6AWF.js.map → chunk-JIF3IBRK.js.map} +0 -0
  432. /package/dist/{chunk-HNHCQ556.js.map → chunk-KBOPY6W2.js.map} +0 -0
  433. /package/dist/{chunk-W3TVWF6N.js.map → chunk-KM6YR5XF.js.map} +0 -0
  434. /package/dist/{chunk-6HFM7EIT.js.map → chunk-MNMYHZVU.js.map} +0 -0
  435. /package/dist/{chunk-QD724WDJ.js.map → chunk-N2HKBESK.js.map} +0 -0
  436. /package/dist/{chunk-Z45YRGFO.js.map → chunk-N7YAQKAO.js.map} +0 -0
  437. /package/dist/{chunk-DMQCLZ4Z.js.map → chunk-NH2MST6J.js.map} +0 -0
  438. /package/dist/{chunk-HXGUIPQB.js.map → chunk-OQLYMBJI.js.map} +0 -0
  439. /package/dist/{chunk-MSWYQLMQ.js.map → chunk-PG6PFMDC.js.map} +0 -0
  440. /package/dist/{chunk-WKPJXWKR.js.map → chunk-QPIUFRUC.js.map} +0 -0
  441. /package/dist/{chunk-JIUVJ4M7.js.map → chunk-REL4OLWW.js.map} +0 -0
  442. /package/dist/{chunk-VW6ZZGCG.js.map → chunk-RNSC2ARR.js.map} +0 -0
  443. /package/dist/{chunk-WLYIROCJ.js.map → chunk-RORE2GX2.js.map} +0 -0
  444. /package/dist/{chunk-7TSYBD3E.js.map → chunk-RSFG7XHM.js.map} +0 -0
  445. /package/dist/{chunk-FAXZQ5UF.js.map → chunk-S55DBWRC.js.map} +0 -0
  446. /package/dist/{chunk-747LRSOO.js.map → chunk-SFD2LL7G.js.map} +0 -0
  447. /package/dist/{chunk-P7OG2ETF.js.map → chunk-SG3OQCRG.js.map} +0 -0
  448. /package/dist/{chunk-WQDTCJ6W.js.map → chunk-VEX2BQVX.js.map} +0 -0
  449. /package/dist/{chunk-7VHY5E3X.js.map → chunk-VH2W6BOG.js.map} +0 -0
  450. /package/dist/{chunk-OF3L2SD6.js.map → chunk-W6NFONOV.js.map} +0 -0
  451. /package/dist/{chunk-NJDQ4YSV.js.map → chunk-WBNXZU42.js.map} +0 -0
  452. /package/dist/{chunk-FNSMZQS4.js.map → chunk-WKD5ESK4.js.map} +0 -0
  453. /package/dist/{chunk-NKH7GSIH.js.map → chunk-XGQGWZ6D.js.map} +0 -0
  454. /package/dist/{chunk-VJFMXYKP.js.map → chunk-ZWKF3CD3.js.map} +0 -0
  455. /package/dist/{classified-marker-FTOX7Q5L.js.map → classified-marker-PMDG3O36.js.map} +0 -0
  456. /package/dist/{collection-facade-QN5ULWYC.js.map → collection-facade-ZJK5EB33.js.map} +0 -0
  457. /package/dist/{computed-6G5M3UPH.js.map → computed-UHCBRILW.js.map} +0 -0
  458. /package/dist/{dead-filter-ENRIOQIE.js.map → dead-filter-777VWDER.js.map} +0 -0
  459. /package/dist/{derive-6V3PIZF7.js.map → derive-3WAS2G5T.js.map} +0 -0
  460. /package/dist/{dispatch-BDVGYC6X.js.map → dispatch-3EN6YCCS.js.map} +0 -0
  461. /package/dist/{dispatch-RE74SH6L.js.map → dispatch-ASL257KG.js.map} +0 -0
  462. /package/dist/{enclave-52VUXNRL.js.map → enclave-ZJS5R5RH.js.map} +0 -0
  463. /package/dist/{executor-CYJQLKKI.js.map → executor-GPM6DNWV.js.map} +0 -0
  464. /package/dist/{executor-FHHLXO4Y.js.map → executor-LJSMZ4IB.js.map} +0 -0
  465. /package/dist/{executor-S4QIKEHW.js.map → executor-SHUVRZUJ.js.map} +0 -0
  466. /package/dist/{export-accessible-PE5AYKZR.js.map → export-accessible-GNY6DC6U.js.map} +0 -0
  467. /package/dist/{extract-partition-X2L26O6A.js.map → extract-partition-BG3AF4NZ.js.map} +0 -0
  468. /package/dist/{find-RBBYKXI7.js.map → find-KX6OKHDP.js.map} +0 -0
  469. /package/dist/{issue-RNU55YOF.js.map → issue-PAUM7NCX.js.map} +0 -0
  470. /package/dist/{ledger-4WJL66BW.js.map → ledger-62CEPRPX.js.map} +0 -0
  471. /package/dist/{liberate-PX4CAT5V.js.map → liberate-I6AOLWXW.js.map} +0 -0
  472. /package/dist/{link-set-N4ZPV6E6.js.map → link-set-ZRYNUHN3.js.map} +0 -0
  473. /package/dist/{managed-secret-OTHS64IF.js.map → managed-secret-T2WB4O47.js.map} +0 -0
  474. /package/dist/{noydb-YPSEGK32.js.map → noydb-SS6EN7TK.js.map} +0 -0
  475. /package/dist/{post-register-ZAG2CAIY.js.map → post-register-J4DEVNXK.js.map} +0 -0
  476. /package/dist/{register-TMD6YRCX.js.map → register-UPD4GKBC.js.map} +0 -0
  477. /package/dist/{registry-CZVINVQH.js.map → registry-7KX2HWFS.js.map} +0 -0
  478. /package/dist/{registry-FVLDWQKT.js.map → registry-PKYYEHEW.js.map} +0 -0
  479. /package/dist/{registry-IKUR2MXD.js.map → registry-XHCYMD34.js.map} +0 -0
  480. /package/dist/{registry-JET4HBLY.js.map → registry-XIRTZHPC.js.map} +0 -0
  481. /package/dist/{request-withdrawal-RH55LNZL.js.map → request-withdrawal-XZSESWZV.js.map} +0 -0
  482. /package/dist/{reveal-CMOJY4VO.js.map → reveal-525XWQU2.js.map} +0 -0
  483. /package/dist/{revoke-R5TBYVA6.js.map → revoke-QI7YHQ2B.js.map} +0 -0
  484. /package/dist/{signer-AGALOXOO.js.map → signer-BZWDPGGN.js.map} +0 -0
  485. /package/dist/{stale-ZWXSOWJI.js.map → stale-PQYPVCER.js.map} +0 -0
  486. /package/dist/{storage-N7LB275C.js.map → storage-MJHKNQRO.js.map} +0 -0
  487. /package/dist/{ulid-PTAIMDG4.js.map → ulid-VQW6ERQN.js.map} +0 -0
  488. /package/dist/{verify-RO5RTZOJ.js.map → verify-J6DEOXP3.js.map} +0 -0
  489. /package/dist/{walk-OCUHCYJ6.js.map → walk-BX4NSB5L.js.map} +0 -0
  490. /package/dist/{withdraw-accessible-QQNWM5BO.js.map → withdraw-accessible-K4CPMH4C.js.map} +0 -0
@@ -4,6 +4,7 @@ import type { ReduceSpec, Reduction } from '../../with-lookup/reduce/reduction.j
4
4
  import type { GroupedReduction } from '../../with-lookup/reduce/groupby.js';
5
5
  import type { JoinStrategy } from '../../kernel/query/join.js';
6
6
  import type { MoneyDescriptor } from '../../via/money/descriptor.js';
7
+ import type { ExactMath } from '../../via/money/exact.js';
7
8
  import type { I18nTextDescriptor } from '../../via/i18n/core.js';
8
9
  /**
9
10
  * Minimal vault-shaped accessor passed to the MV `query()` callback.
@@ -269,6 +270,57 @@ export interface MaterializedViewSpec<TRow extends Record<string, unknown>> {
269
270
  * UNION-mode only. Ignored if {@link query} is set.
270
271
  */
271
272
  aggregate?: ReduceSpec;
273
+ /**
274
+ * Post-aggregate projection over ONE finished row (#1007).
275
+ *
276
+ * `aggregate` accepts reducers only, so a row can carry every input a
277
+ * derived value needs and still not express it — `max(0, netTotal - paid)`
278
+ * is not a reduction. `derive` closes that gap: it receives the row the
279
+ * grouping/aggregation pipeline just produced and returns a patch merged
280
+ * onto it, immediately before materialisation.
281
+ *
282
+ * ```ts
283
+ * aggregate: { paid: sum('paid'), netTotal: sum('netTotal') },
284
+ * derive: (row) => ({ toPay: Math.max(0, row.netTotal - row.paid) }),
285
+ * ```
286
+ *
287
+ * Deliberately narrow, and the narrowness is what keeps it safe under
288
+ * incremental recompute: **pure, single-row, no cross-row access, no second
289
+ * aggregation pass.** It only ever sees the row the reducer just produced,
290
+ * so a refresh triggered by one source write recomputes it correctly without
291
+ * the engine needing to know anything about the function.
292
+ *
293
+ * Returning `null` / `undefined` leaves the row unchanged. Returned keys
294
+ * that collide with a {@link groupBy} field throw
295
+ * `MaterializedViewConfigError` — a group key is the row's identity and
296
+ * feeds {@link rowKey}, so rewriting it would silently re-home the row.
297
+ *
298
+ * **Money:** money leaves a reducer as an exact decimal string, and
299
+ * `Number(a) - Number(b)` would put it straight back through binary floating
300
+ * point — `10.05 - 0.10` becomes `9.950000000000001`, which the money
301
+ * quantiser then refuses rather than storing drift. So `derive` receives
302
+ * {@link ExactMath} as its second argument; it works in scaled BigInt and
303
+ * cannot introduce a representation error:
304
+ *
305
+ * ```ts
306
+ * moneyFields: { netTotal: THB, paid: THB, toPay: THB },
307
+ * derive: (row, exact) => ({ toPay: exact.max(0, exact.sub(row.netTotal, row.paid)) }),
308
+ * ```
309
+ *
310
+ * Declare the derived field in {@link moneyFields} and the result is
311
+ * quantised through that descriptor before storage, exact at its scale.
312
+ *
313
+ * Note the one place `TRow` under-describes what arrives: a field declared
314
+ * in {@link moneyFields} reaches `derive` DECODED — the decimal string a
315
+ * reader would see, not the scaled integer the reducer left behind — even
316
+ * where `TRow` types it as `number` (which is what the arms' `map` emits).
317
+ * `ExactMath` accepts both, which is why its operations are the right tool
318
+ * here and why no cast is needed.
319
+ *
320
+ * Applies to every MV form (union, projection, and query), always as the
321
+ * last step before rows are materialised.
322
+ */
323
+ derive?: (row: TRow, exact: ExactMath) => Record<string, unknown> | null | undefined;
272
324
  /**
273
325
  * Money descriptors for the UNION-mode aggregate, keyed by the
274
326
  * OUTPUT/intermediate field name as it appears in the mapped row and
@@ -1,11 +1,3 @@
1
- /**
2
- * Persistence helpers for `_meta/public-envelope` — the cover's
3
- * frozen wire location. Mirrors the bypass-AES pattern used by
4
- * `_meta/handle` and `_meta/policy` — the document is plaintext
5
- * JSON, the envelope's `_iv` field is left empty.
6
- *
7
- * @module
8
- */
9
1
  import type { NoydbStore } from '../../../kernel/types.js';
10
2
  import type { Cover } from './types.js';
11
3
  /**
@@ -1,14 +1,3 @@
1
- /**
2
- * Persistence helpers for the vault-level user-directory toggle
3
- * (`_meta/directory`). Mirrors the bypass-AES pattern used by
4
- * `_meta/policy` — the directory document is plain JSON, the
5
- * envelope's `_iv` field is left empty.
6
- *
7
- * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md → Directory visibility
8
- * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/plaintext-bypass.md — every `_iv: ''` write site
9
- *
10
- * @module
11
- */
12
1
  import type { NoydbStore } from '../../kernel/types.js';
13
2
  import type { DirectoryConfig } from './types.js';
14
3
  /** Reserved collection name for vault-level metadata documents. */
@@ -1,24 +1,3 @@
1
- /**
2
- * Persistence helpers for the per-user visibility flag
3
- * (`_meta/visibility/<keyringId>`). Mirrors the bypass-AES pattern used
4
- * by `_meta/policy` — the visibility document is plain JSON, the
5
- * envelope's `_iv` field is left empty.
6
- *
7
- * Stored alongside the keyring file rather than inside the encrypted
8
- * user envelope (`_users/<keyringId>`) because:
9
- *
10
- * - `UserEnvelope<T>.data` is opaque-to-hub by contract — hub does not
11
- * introspect or reserve any keys inside it. Adding `hidden` there
12
- * would violate that contract.
13
- * - `listUsersWithEnvelopes` filters by the flag, and the filter must
14
- * work even when decryption fails (legacy keyrings predating the
15
- * envelope feature, or a corrupted envelope).
16
- *
17
- * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md → Directory visibility
18
- * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/plaintext-bypass.md — every `_iv: ''` write site
19
- *
20
- * @module
21
- */
22
1
  import type { NoydbStore } from '../../kernel/types.js';
23
2
  import type { UserVisibility } from './types.js';
24
3
  /** Prefix for per-user visibility records inside `_meta`. */
@@ -1,13 +1,3 @@
1
- /**
2
- * Persistence helpers for the vault-level policy document
3
- * (`_meta/policy`). Mirrors the bypass-AES pattern used by
4
- * `_meta/handle` — the policy document is plain JSON, the envelope's
5
- * `_iv` field is left empty.
6
- *
7
- * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md → Storage location
8
- *
9
- * @module
10
- */
11
1
  import type { NoydbStore, VaultPolicy } from '../../kernel/types.js';
12
2
  /** Reserved collection name for vault-level metadata documents. */
13
3
  export declare const META_COLLECTION = "_meta";
@@ -17,7 +17,7 @@ export { NO_TEAM, type TeamStrategy } from './strategy.js';
17
17
  export { TeamNotEnabledError } from '../../kernel/errors.js';
18
18
  export type { UnlockedKeyring } from './keyring.js';
19
19
  export { loadKeyring, createOwnerKeyring, grant, revoke, changeSecret, listUsers, listUsersWithEnvelopes, ensureCollectionDEK, persistKeyring, updateKeyringIdentity, buildRecipientKeyringFile, } from './keyring.js';
20
- export type { BundleRecipient, ListUsersOptions } from './keyring.js';
20
+ export type { PodRecipient, ListUsersOptions } from './keyring.js';
21
21
  export type { LoadKeyringOptions, CreateOwnerKeyringOptions, RotateKeysOptions, ChangeSecretOptions, } from './keyring.js';
22
22
  export { enrollAuthenticator, removeAuthenticator, updateAuthenticator, findAuthenticator, } from './authenticators.js';
23
23
  export type { EnrollAuthenticatorOptions, EnrollAuthenticatorWrappingKEKOptions, EnrollAuthenticatorWrappingDEKsOptions, UpdateAuthenticatorOptions, } from './authenticators.js';
@@ -9,6 +9,11 @@ export interface UnlockedKeyring {
9
9
  readonly role: Role;
10
10
  readonly permissions: Permissions;
11
11
  readonly deks: Map<string, EnclaveKey>;
12
+ /**
13
+ * Unwrapped counterpart of {@link KeyringFile.pending_deks} — an
14
+ * uncommitted rotation (#1074). Empty in the normal state.
15
+ */
16
+ readonly pendingDeks?: Map<string, EnclaveKey> | undefined;
12
17
  /**
13
18
  * The KEK, when this keyring was unlocked via tier 1 (secret) or
14
19
  * a wrap-KEK tier-2 method (WebAuthn / OIDC). `null` when the
@@ -261,7 +266,7 @@ export interface EchoRecipientSecret extends EchoSecretParts {
261
266
  *
262
267
  * @public
263
268
  */
264
- export interface BundleRecipient {
269
+ export interface PodRecipient {
265
270
  /** User id stamped onto the keyring file in the bundle. */
266
271
  readonly id: string;
267
272
  /** Optional display name. Defaults to `id`. */
@@ -312,7 +317,7 @@ export interface BundleRecipient {
312
317
  *
313
318
  * @internal
314
319
  */
315
- export declare function buildRecipientKeyringFile(callerKeyring: UnlockedKeyring, recipient: BundleRecipient): Promise<KeyringFile>;
320
+ export declare function buildRecipientKeyringFile(callerKeyring: UnlockedKeyring, recipient: PodRecipient): Promise<KeyringFile>;
316
321
  /** List all users with access to a vault. */
317
322
  export declare function listUsers(store: NoydbStore, vault: string): Promise<UserInfo[]>;
318
323
  /**
@@ -368,8 +373,17 @@ export declare function listUsersWithEnvelopes<T = unknown>(store: NoydbStore, v
368
373
  user: UserInfo;
369
374
  envelope: UserEnvelope<T> | null;
370
375
  }>>;
371
- /** Ensure a DEK exists for a collection. Generates one if new. */
372
376
  export declare function ensureCollectionDEK(store: NoydbStore, vault: string, keyring: UnlockedKeyring): Promise<(collectionName: string) => Promise<EnclaveKey>>;
377
+ /**
378
+ * The `Permissions` catch-all key (#1010). `Permissions` has always documented
379
+ * `'*'` as "the wildcard collection matching all collections in the vault", but
380
+ * nothing expanded it — a grantee handed the documented catch-all got no keys
381
+ * at all. It is honoured in three places, and they must agree: the DEK wrapping
382
+ * in `grant()`, and both permission checks below.
383
+ */
384
+ export declare const PERMISSION_WILDCARD = "*";
385
+ /** Does this permission map hand over the whole vault? */
386
+ export declare function permissionsAreWildcard(permissions: Permissions | undefined): boolean;
373
387
  /** Check if a user has write permission for a collection. */
374
388
  export declare function hasWritePermission(keyring: UnlockedKeyring, collectionName: string): boolean;
375
389
  /** Check if a user has any access to a collection. */
@@ -18,7 +18,8 @@
18
18
  */
19
19
  import type { UnlockedKeyring } from './keyring.js';
20
20
  /** Canonical DEK key for a given collection + tier. Tier 0 → bare name. */
21
- export declare function dekKey(collection: string, tier: number): string;
21
+ import { dekKey } from '../../kernel/tier-visibility.js';
22
+ export { dekKey };
22
23
  /**
23
24
  * Returns the user's effective clearance for a given collection: the
24
25
  * maximum tier for which their keyring holds a DEK. Falls back to 0
@@ -47,14 +47,14 @@
47
47
  */
48
48
  import type { Cover } from '../with-party/directory/cover/types.js';
49
49
  import type { Redirect } from './redirect.js';
50
- /** Magic bytes 'NDB1' (ASCII), identifying a NOYDB bundle. */
51
- export declare const NOYDB_BUNDLE_MAGIC: Uint8Array<ArrayBuffer>;
50
+ /** Magic bytes 'NDB1' (ASCII) — `NoyDB 1` — identifying a NOYDB pod (`.noydb` container). */
51
+ export declare const NOYDB_POD_MAGIC: Uint8Array<ArrayBuffer>;
52
52
  /** Total fixed prefix before the header JSON: 4+1+1+4 bytes. */
53
- export declare const NOYDB_BUNDLE_PREFIX_BYTES = 10;
53
+ export declare const NOYDB_POD_PREFIX_BYTES = 10;
54
54
  /** Current bundle format version. Bumped on layout changes. Default for unsigned pods. */
55
- export declare const NOYDB_BUNDLE_FORMAT_VERSION = 1;
55
+ export declare const NOYDB_POD_FORMAT_VERSION = 1;
56
56
  /** Format version for pods carrying a header signature (`sig`/`keyId`/`sigAlg`). */
57
- export declare const NOYDB_BUNDLE_FORMAT_VERSION_SIGNED = 2;
57
+ export declare const NOYDB_POD_FORMAT_VERSION_SIGNED = 2;
58
58
  /**
59
59
  * Bitfield interpretation of the flags byte.
60
60
  *
@@ -85,7 +85,7 @@ export type CompressionAlgo = 0 | 1 | 2;
85
85
  *
86
86
  * **Minimum-disclosure rules:** these are the ONLY allowed keys.
87
87
  * Any other key in a parsed header causes
88
- * `validateBundleHeader` to throw. The set is kept short to
88
+ * `validatePodHeaderFields` to throw. The set is kept short to
89
89
  * minimize attack surface from cloud-storage metadata indexing —
90
90
  * see the file-level doc comment for the rationale.
91
91
  *
@@ -249,8 +249,6 @@ export interface NoydbPodHeader {
249
249
  * family (see `unlockMethods` doc comment on `NoydbPodHeader`).
250
250
  */
251
251
  export type UnlockMethod = 'password' | 'webauthn' | 'oidc' | 'totp' | 'email-otp' | 'magic-link' | 'pin' | 'recovery' | 'shamir';
252
- /** @deprecated Use `NoydbPodHeader`. */
253
- export type NoydbBundleHeader = NoydbPodHeader;
254
252
  /**
255
253
  * Validate a parsed bundle header. Throws on any deviation from
256
254
  * the minimum-disclosure schema:
@@ -266,18 +264,18 @@ export type NoydbBundleHeader = NoydbPodHeader;
266
264
  * The error messages name the offending field so consumers can
267
265
  * fix the producer rather than the reader.
268
266
  */
269
- export declare function validateBundleHeader(parsed: unknown): asserts parsed is NoydbPodHeader;
267
+ export declare function validatePodHeaderFields(parsed: unknown): asserts parsed is NoydbPodHeader;
270
268
  /**
271
269
  * Encode a header object to UTF-8 JSON bytes after validating
272
270
  * minimum disclosure. Used by the writer to serialize the header
273
271
  * region of the container.
274
272
  */
275
- export declare function encodeBundleHeader(header: NoydbPodHeader): Uint8Array;
273
+ export declare function encodePodHeader(header: NoydbPodHeader): Uint8Array;
276
274
  /**
277
275
  * Parse a bundle header from its UTF-8 JSON bytes. Throws on
278
276
  * invalid JSON or any minimum-disclosure violation.
279
277
  */
280
- export declare function decodeBundleHeader(bytes: Uint8Array): NoydbPodHeader;
278
+ export declare function decodePodHeader(bytes: Uint8Array): NoydbPodHeader;
281
279
  /**
282
280
  * Read a uint32 from `bytes` at `offset` in big-endian byte order.
283
281
  * No bounds check — callers must guarantee `offset + 4 <= bytes.length`.
@@ -295,4 +293,4 @@ export declare function writeUint32BE(bytes: Uint8Array, offset: number, value:
295
293
  * 4 bytes match `NDB1`. Used by readers as a fast file-type check
296
294
  * before any further parsing.
297
295
  */
298
- export declare function hasNoydbBundleMagic(bytes: Uint8Array): boolean;
296
+ export declare function hasNoydbPodMagic(bytes: Uint8Array): boolean;
@@ -11,19 +11,19 @@
11
11
  * omit this subpath and save ~805 LOC of format code + Brotli/gzip
12
12
  * wiring.
13
13
  */
14
- export { writePod, readPod, readPodHeader, readPodCover, writeNoydbBundle, readNoydbBundle, readNoydbBundleHeader, resetBrotliSupportCache, } from './bundle.js';
14
+ export { writePod, readPod, readPodHeader, readPodCover, resetBrotliSupportCache, } from './pod.js';
15
15
  export type { Cover } from '../with-party/directory/cover/types.js';
16
- export type { WritePodOptions, WriteNoydbBundleOptions, ReadNoydbBundleOptions, NoydbBundleReadResult, } from './bundle.js';
17
- export { verifyPodHeader } from './bundle.js';
18
- export type { PodVerifyResult } from './bundle.js';
16
+ export type { WritePodOptions, ReadPodOptions, PodReadResult, } from './pod.js';
17
+ export { verifyPodHeader } from './pod.js';
18
+ export type { PodVerifyResult } from './pod.js';
19
19
  export { signRecord, verifyRecord, signedBytes, POD_SIG_ALG } from './signature.js';
20
- export { NOYDB_BUNDLE_MAGIC, NOYDB_BUNDLE_PREFIX_BYTES, NOYDB_BUNDLE_FORMAT_VERSION, FLAG_COMPRESSED, FLAG_HAS_INTEGRITY_HASH, COMPRESSION_NONE, COMPRESSION_GZIP, COMPRESSION_BROTLI, validateBundleHeader, encodeBundleHeader, hasNoydbBundleMagic, } from './format.js';
21
- export type { CompressionAlgo, NoydbPodHeader, NoydbBundleHeader, UnlockMethod, } from './format.js';
20
+ export { NOYDB_POD_MAGIC, NOYDB_POD_PREFIX_BYTES, NOYDB_POD_FORMAT_VERSION, FLAG_COMPRESSED, FLAG_HAS_INTEGRITY_HASH, COMPRESSION_NONE, COMPRESSION_GZIP, COMPRESSION_BROTLI, validatePodHeaderFields, encodePodHeader, hasNoydbPodMagic, } from './format.js';
21
+ export type { CompressionAlgo, NoydbPodHeader, UnlockMethod, } from './format.js';
22
22
  export { generateULID, isULID } from './ulid.js';
23
- export { wrapPodStore, createPodStore, wrapBundleStore, createBundleStore } from './pod-store.js';
24
- export type { WrappedPodNoydbStore, WrapPodStoreOptions, WrappedBundleNoydbStore, WrapBundleStoreOptions, } from './pod-store.js';
25
- export { BundleIntegrityError, BundleSealMismatchError, PodVersionConflictError, BundleVersionConflictError, BackupLedgerError, BackupCorruptedError, } from '../kernel/errors.js';
26
- export { readPodRedirect } from './bundle.js';
23
+ export { wrapPodStore, createPodStore } from './pod-store.js';
24
+ export type { WrappedPodNoydbStore, WrapPodStoreOptions, } from './pod-store.js';
25
+ export { PodIntegrityError, PodSealMismatchError, PodVersionConflictError, BackupLedgerError, BackupCorruptedError, } from '../kernel/errors.js';
26
+ export { readPodRedirect } from './pod.js';
27
27
  export { signRedirect, verifyRedirect, followRedirects } from './redirect.js';
28
28
  export type { Redirect, RedirectHop, FollowRedirectsResult } from './redirect.js';
29
29
  export type { DocSigner } from '../with-audit/attestation/signer.js';
@@ -6,7 +6,7 @@
6
6
  * reachable through published seams). Composes, in order:
7
7
  *
8
8
  * 1. `readPod` — parse + integrity-check the container (throws
9
- * `BundleIntegrityError` on a corrupted/truncated pod).
9
+ * `PodIntegrityError` on a corrupted/truncated pod).
10
10
  * 2. `verifyPodHeader` — only when `opts.trustedKeys` is supplied.
11
11
  * `'unsigned'` is benign (legacy pod, or `writePod({ sign: false })`)
12
12
  * and open() proceeds; `'untrusted'` / `'tampered'` are fail-closed —
@@ -63,7 +63,7 @@
63
63
  * @module
64
64
  */
65
65
  import type { NoydbPodHeader } from './format.js';
66
- import type { PodVerifyResult } from './bundle.js';
66
+ import type { PodVerifyResult } from './pod.js';
67
67
  import type { Noydb } from '../kernel/noydb.js';
68
68
  import type { Vault } from '../kernel/vault.js';
69
69
  import type { NoydbOptions, NoydbStore, EchoSecretParts } from '../kernel/types.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Vault bundle handle — the stable opaque ULID identifying a vault
3
+ * across `.noydb` exports.
4
+ *
5
+ * Behaviour is byte-identical to the inline `Vault.getPodHandle`
6
+ * method this function replaced. `Vault` keeps the public method as
7
+ * a thin delegator.
8
+ *
9
+ * Internal — reached through `vault.getPodHandle()`.
10
+ */
11
+ import type { NoydbStore } from '../kernel/types.js';
12
+ /**
13
+ * Return the stable opaque bundle handle for the given vault adapter,
14
+ * generating and persisting a fresh ULID on first call.
15
+ *
16
+ * See {@link import('../kernel/vault.js').Vault.getPodHandle} for
17
+ * the full rationale and storage-path documentation.
18
+ */
19
+ export declare function buildPodHandle(adapter: NoydbStore, name: string): Promise<string>;
@@ -44,11 +44,3 @@ export declare function wrapPodStore(bundle: NoydbPodStore, options?: WrapPodSto
44
44
  * analogous to `createStore` for KV stores.
45
45
  */
46
46
  export declare function createPodStore<TOptions>(factory: (options: TOptions) => NoydbPodStore): (options: TOptions) => NoydbPodStore;
47
- /** @deprecated Use wrapPodStore. */
48
- export declare const wrapBundleStore: typeof wrapPodStore;
49
- /** @deprecated Use createPodStore. */
50
- export declare const createBundleStore: typeof createPodStore;
51
- /** @deprecated Use WrappedPodNoydbStore. */
52
- export type WrappedBundleNoydbStore = WrappedPodNoydbStore;
53
- /** @deprecated Use WrapPodStoreOptions. */
54
- export type WrapBundleStoreOptions = WrapPodStoreOptions;
@@ -36,7 +36,7 @@ import { type NoydbPodHeader, type UnlockMethod } from './format.js';
36
36
  import type { Redirect } from './redirect.js';
37
37
  import type { DocSigner } from '../with-audit/attestation/signer.js';
38
38
  import type { Vault } from '../kernel/vault.js';
39
- import type { BundleRecipient } from '../with-party/team/keyring.js';
39
+ import type { PodRecipient } from '../with-party/team/keyring.js';
40
40
  import type { Cover } from '../with-party/directory/cover/types.js';
41
41
  import type { SealingKeyProvider, RecipientSealer, RecipientHint } from '../with-party/team/managed-secret.js';
42
42
  /**
@@ -128,7 +128,7 @@ export interface WritePodOptions {
128
128
  * the bundle inherits the source keyring as-is (today's behaviour,
129
129
  * suited to personal backup-and-restore).
130
130
  */
131
- readonly recipients?: readonly BundleRecipient[];
131
+ readonly recipients?: readonly PodRecipient[];
132
132
  /**
133
133
  * Auto-unlock — unsealed per-user credentials.
134
134
  *
@@ -266,15 +266,28 @@ export interface WritePodOptions {
266
266
  */
267
267
  readonly redirect?: Redirect;
268
268
  }
269
- /** @deprecated Use `WritePodOptions`. */
270
- export type WriteNoydbBundleOptions = WritePodOptions;
269
+ /**
270
+ * Every key `writePod` reads, in declaration order (#991).
271
+ *
272
+ * A pod is a wire artifact, so an option this list doesn't name is refused
273
+ * rather than ignored: a dropped write option produces a structurally valid
274
+ * bundle that is missing something, and the defect surfaces later — in
275
+ * whoever imports it — with nothing left to trace it back to.
276
+ *
277
+ * `bundle-option-keys.test.ts` parses `WritePodOptions` out of this file and
278
+ * fails if the two ever drift, so adding an option is enough; you do not have
279
+ * to remember to update this list, only to keep the interface shape parseable.
280
+ *
281
+ * @internal
282
+ */
283
+ export declare const WRITE_POD_OPTION_KEYS: readonly ["compression", "collections", "since", "where", "tierAtMost", "exportSecret", "recipients", "autoCredentials", "sealedCredentials", "autoSecrets", "sealedSecrets", "sign", "engineRange", "unlockMethods", "hasApp", "species", "pointerMode", "redirect"];
271
284
  /**
272
285
  * Result returned by `readPod`. The caller is expected to
273
286
  * pass `dumpJson` into `vault.load(json, secret)` to
274
287
  * actually restore a vault. Splitting the layers keeps the
275
288
  * bundle module free of crypto concerns — see file-level docs.
276
289
  */
277
- export interface NoydbBundleReadResult {
290
+ export interface PodReadResult {
278
291
  readonly header: NoydbPodHeader;
279
292
  readonly dumpJson: string;
280
293
  /**
@@ -302,7 +315,7 @@ export interface NoydbBundleReadResult {
302
315
  * auto-unlock paths. Without these the reader behaves exactly as before
303
316
  * (header parsed; body returned as `dumpJson`).
304
317
  */
305
- export interface ReadNoydbBundleOptions {
318
+ export interface ReadPodOptions {
306
319
  /**
307
320
  * Recipient-side sealing providers used to unseal entries from
308
321
  * `sealedSecrets`. The reader picks the one whose `.id`
@@ -358,7 +371,7 @@ export declare function resetBrotliSupportCache(): void;
358
371
  *
359
372
  * Pipeline:
360
373
  * 1. Resolve or create the compartment's stable bundle handle
361
- * via `vault.getBundleHandle()` — same handle on
374
+ * via `vault.getPodHandle()` — same handle on
362
375
  * every export from the same vault instance, so cloud
363
376
  * adapters can use it as a primary key.
364
377
  * 2. `vault.dump()` → JSON string with encrypted records
@@ -383,7 +396,7 @@ export declare function resetBrotliSupportCache(): void;
383
396
  *
384
397
  * @internal
385
398
  */
386
- export declare function assembleBundleContainer(opts: {
399
+ export declare function assemblePodContainer(opts: {
387
400
  handle: string;
388
401
  bodyJsonStr: string;
389
402
  compression: WritePodOptions['compression'];
@@ -398,8 +411,6 @@ export declare function assembleBundleContainer(opts: {
398
411
  signer?: DocSigner;
399
412
  }): Promise<Uint8Array>;
400
413
  export declare function writePod(vault: Vault, opts?: WritePodOptions): Promise<Uint8Array>;
401
- /** @deprecated Use `writePod`. */
402
- export declare const writeNoydbBundle: typeof writePod;
403
414
  /**
404
415
  * Read just the bundle header — no body decompression, no
405
416
  * integrity verification. Intended for cloud-listing UIs that want
@@ -415,8 +426,6 @@ export declare const writeNoydbBundle: typeof writePod;
415
426
  * range requests against bundles that may carry icons.
416
427
  */
417
428
  export declare function readPodHeader(bytes: Uint8Array): NoydbPodHeader;
418
- /** @deprecated Use `readPodHeader`. */
419
- export declare const readNoydbBundleHeader: typeof readPodHeader;
420
429
  /**
421
430
  * Outcome of {@link verifyPodHeader}.
422
431
  *
@@ -442,7 +451,7 @@ export interface PodVerifyResult {
442
451
  * (`keyId → publicKeyB64` the caller already trusts), it reports whether the
443
452
  * header was signed by a trusted document signer.
444
453
  *
445
- * Pairs with the signing half in `assembleBundleContainer`/`writePod`: the
454
+ * Pairs with the signing half in `assemblePodContainer`/`writePod`: the
446
455
  * signed payload is the final wire header with `sig` removed, so verification
447
456
  * reconstructs it by stripping EXACTLY the `sig` field — `keyId`, `sigAlg`,
448
457
  * and every other header field stay in the verified payload.
@@ -454,7 +463,7 @@ export interface PodVerifyResult {
454
463
  * header (which includes the *claimed* `bodySha256`) is signed by a trusted
455
464
  * key; it does NOT prove the body matches that hash. To trust the pod's
456
465
  * BODY you MUST also confirm the body hashes to `header.bodySha256` — call
457
- * `readPod`, which throws `BundleIntegrityError` on mismatch. A `verified`
466
+ * `readPod`, which throws `PodIntegrityError` on mismatch. A `verified`
458
467
  * header paired with a swapped body is caught only by that integrity check.
459
468
  * This function stays body-free by design so a static page can authenticate a
460
469
  * header without decompressing the body; composing the two checks is the
@@ -483,7 +492,7 @@ export declare function readPodCover(bytes: Uint8Array, opts?: {
483
492
  * the header's `redirect` field or `undefined` if the bundle was written
484
493
  * without one.
485
494
  *
486
- * The record is returned UNVERIFIED: `validateBundleHeader` only checks
495
+ * The record is returned UNVERIFIED: `validatePodHeaderFields` only checks
487
496
  * its shape at parse time (a parser has no `trustedKeys`). Callers that
488
497
  * intend to follow the redirect MUST separately call `verifyRedirect`
489
498
  * (`redirect.js`) before trusting `target`.
@@ -495,7 +504,7 @@ export declare function readPodRedirect(bytes: Uint8Array): Redirect | undefined
495
504
  * original `vault.dump()` JSON string ready to pass to
496
505
  * `vault.load()`.
497
506
  *
498
- * Throws `BundleIntegrityError` if the body's actual SHA-256 does
507
+ * Throws `PodIntegrityError` if the body's actual SHA-256 does
499
508
  * not match the value declared in the header. Distinct from a
500
509
  * format error so consumers can pattern-match in catch blocks
501
510
  * (corrupted-in-transit vs malformed-by-producer).
@@ -507,6 +516,4 @@ export declare function readPodRedirect(bytes: Uint8Array): Redirect | undefined
507
516
  * free of crypto concerns and lets the same code feed format
508
517
  * inspectors that never decrypt anything.
509
518
  */
510
- export declare function readPod(bytes: Uint8Array, opts?: ReadNoydbBundleOptions): Promise<NoydbBundleReadResult>;
511
- /** @deprecated Use `readPod`. */
512
- export declare const readNoydbBundle: typeof readPod;
519
+ export declare function readPod(bytes: Uint8Array, opts?: ReadPodOptions): Promise<PodReadResult>;
@@ -39,7 +39,7 @@
39
39
  *
40
40
  * If a future use case needs timestamp-free handles, a v2 of the
41
41
  * format could specify "use the random portion only" without a
42
- * format break — `validateBundleHeader` only checks the regex
42
+ * format break — `validatePodHeaderFields` only checks the regex
43
43
  * shape, not the encoded timestamp.
44
44
  */
45
45
  /**
@@ -14,6 +14,7 @@ export { jsonSchemaToFields } from './fields.js';
14
14
  export type { SchemaIntrospection } from './types.js';
15
15
  export type { FieldMeta, SemanticType } from './field-meta.js';
16
16
  export type { CollectionDescription, DescribedField, DescribeOptions } from './describe.js';
17
+ export type { StandardSchemaV1Issue } from '../../kernel/schema.js';
17
18
  export { applyListProjection } from './projection.js';
18
19
  export type { ListProjectionOptions } from './projection.js';
19
20
  export type { BehaviorSummary, GuardBehaviorEntry, DerivationBehaviorEntry, DerivationOutputEntry, MaterializedViewBehaviorEntry, OverlayBehaviorEntry, SatelliteBehaviorEntry, } from './behaviors.js';
@@ -1,4 +1,5 @@
1
1
  import type { NoydbStore, DirtyEntry, ConflictStrategy, CollectionConflictResolver, PushOptions, PullOptions, PushResult, PullResult, SyncStatus, SyncTargetRole } from '../kernel/types.js';
2
+ import type { MergeAuthority } from '../port/with/merge-authority.js';
2
3
  import { type PeriodPullSource } from './period-scope.js';
3
4
  import type { NoydbEventEmitter } from '../kernel/events.js';
4
5
  import type { SyncPolicy } from '../kernel/sync-policy.js';
@@ -12,6 +13,7 @@ export interface ReservedLookupSource {
12
13
  }
13
14
  /** Sync engine: dirty tracking, push, pull, conflict resolution, scheduling. */
14
15
  export declare class SyncEngine {
16
+ private readonly mergeAuthority;
15
17
  private readonly local;
16
18
  private readonly remote;
17
19
  private readonly strategy;
@@ -24,8 +26,17 @@ export declare class SyncEngine {
24
26
  * into the scheduler below. */
25
27
  readonly policy: SyncPolicy | undefined;
26
28
  private dirty;
29
+ /** #1036 — last SUCCESSFUL push/pull. Never advanced by a failed attempt. */
27
30
  private lastPush;
28
31
  private lastPull;
32
+ /**
33
+ * #1036 — the failure that ended the most recent attempt, cleared by the next
34
+ * success. Live state only: deliberately NOT persisted in `_sync/meta`, since a
35
+ * reload cannot know whether the target is still failing. It exists so a poller
36
+ * can separate "never synced" (both null) from "synced a while ago, failing
37
+ * since" (`lastPush` set, `lastError` set).
38
+ */
39
+ private lastError;
29
40
  private loaded;
30
41
  private autoSyncInterval;
31
42
  private isOnline;
@@ -92,6 +103,15 @@ export declare class SyncEngine {
92
103
  syncPolicy?: SyncPolicy;
93
104
  role?: SyncTargetRole;
94
105
  label?: string;
106
+ /**
107
+ * #1042 — the merge's verify/re-stamp capability. Optional so an engine
108
+ * built without one behaves exactly as before; the Vault supplies it.
109
+ *
110
+ * A closure, not an import: `with-sync` is DEK-free and
111
+ * `check:architecture` enforces that, so the capability arrives already
112
+ * bound to the keys rather than the engine reaching for them.
113
+ */
114
+ mergeAuthority?: MergeAuthority;
95
115
  });
96
116
  /** Start the sync scheduler. Called after vault is fully opened. */
97
117
  startScheduler(): void;
@@ -148,6 +168,18 @@ export declare class SyncEngine {
148
168
  * are removed from the dirty log on success.
149
169
  */
150
170
  pushFiltered(predicate: (entry: DirtyEntry) => boolean): Promise<PushResult>;
171
+ /**
172
+ * #1036 — close out a push/pull. `push()` and `pull()` collect per-record
173
+ * failures into their result's `errors` rather than throwing, and the clock used
174
+ * to be stamped regardless — so an unreachable store still reported a fresh
175
+ * `lastPush`, and a UI rendered "Last synced: just now" over a sync that moved
176
+ * nothing. An attempt only advances the clock when it had no errors.
177
+ *
178
+ * An empty dirty log is a success, not a failure: nothing to send is not the
179
+ * same as failing to send, and treating it otherwise would leave a quiet vault
180
+ * looking permanently unsynced.
181
+ */
182
+ private recordOutcome;
151
183
  /** Get current sync status. */
152
184
  status(): SyncStatus;
153
185
  /** Start auto-sync: listen for online/offline events, optional periodic sync. */
@@ -168,11 +200,28 @@ export declare class SyncEngine {
168
200
  * the remote's (the same-`_v` push tie), re-stamp it at `remote._v + 1`.
169
201
  * Without this the loser's next pull sees no delta (`_v`-based
170
202
  * detection) and the peers stay silently diverged at the same version.
171
- * `_v` is envelope metadata — AEAD-unbound, and `_vdig` is deliberately
172
- * `_v`-independent — so the engine may restamp ciphertext. Callers must
173
- * mirror the advanced envelope locally (`applyRemote`) so both sides
174
- * agree. The 'merged' branch needs none of this: resolver output is
175
- * already stamped `max(local, remote) + 1`.
203
+ * ## Why this is async, and why it goes through `MergeAuthority` (#1093)
204
+ *
205
+ * It used to be `{ ...winner, _v: remote._v + 1 }` — a metadata restamp on
206
+ * ciphertext the engine cannot decrypt. That spread was the SOLE reason `_v`
207
+ * could not be bound into the AAD: a version rewritten onto a body sealed at
208
+ * a different one produces a record no reader can open.
209
+ *
210
+ * `with-sync` is DEK-free by design and `check:architecture` enforces it, so
211
+ * the re-seal cannot happen here. It happens in the injected authority, which
212
+ * holds the keys. The engine still decides WHICH version to advance to; it
213
+ * simply no longer pretends it can rewrite a sealed body.
214
+ *
215
+ * The authority is ALWAYS present in the product — `kernel/noydb.ts` builds
216
+ * one from the keyring and passes it at both engine-construction sites, and
217
+ * `with-sync/active.ts` is the only place an engine is constructed. The
218
+ * fallback below is reachable only by constructing `SyncEngine` directly,
219
+ * which tests do. It restamps, as before — and would produce an unreadable
220
+ * record if such a test ever held AEAD-sealed envelopes. None do; the
221
+ * fixtures that reach it build their own plaintext ones.
222
+ *
223
+ * The 'merged' branch needs none of this: resolver output is already stamped
224
+ * `max(local, remote) + 1` by whoever built it.
176
225
  */
177
226
  private advancePastRemote;
178
227
  private applyRemote;
@@ -25,6 +25,7 @@
25
25
  * @internal
26
26
  */
27
27
  import type { NoydbStore, ConflictStrategy, SyncTargetRole } from '../kernel/types.js';
28
+ import type { MergeAuthority } from '../port/with/merge-authority.js';
28
29
  import type { NoydbEventEmitter } from '../kernel/events.js';
29
30
  import type { SyncPolicy } from '../kernel/sync-policy.js';
30
31
  import type { SyncEngine } from './engine.js';
@@ -47,6 +48,8 @@ export interface BuildSyncEngineOptions {
47
48
  syncPolicy?: SyncPolicy;
48
49
  role?: SyncTargetRole;
49
50
  label?: string;
51
+ /** #1042 — the merge's verify/re-stamp capability, bound to the keys by the caller. */
52
+ mergeAuthority?: MergeAuthority;
50
53
  }
51
54
  /**
52
55
  * @internal