@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
@@ -0,0 +1,76 @@
1
+ import type { EncryptedEnvelope } from '../types.js';
2
+ import type { RecordIdentity } from './record-aad.js';
3
+ /** The body an envelope carries, independent of who is writing it. */
4
+ export interface RecordEnvelopeBody {
5
+ /** AES-GCM IV, base64. Empty string for a plaintext or tombstone envelope. */
6
+ readonly iv: string;
7
+ /** Ciphertext (or plaintext JSON when the collection stores plaintext). */
8
+ readonly data: string;
9
+ /** ISO timestamp. Defaults to now — pass it when the caller has a real one. */
10
+ readonly ts?: string | undefined;
11
+ /** Wrapped per-record CEK, when the record has one. */
12
+ readonly cek?: string | undefined;
13
+ readonly provenance?: {
14
+ readonly source: string;
15
+ readonly sourceTs: string;
16
+ } | undefined;
17
+ /**
18
+ * Slots the envelope may additionally carry.
19
+ *
20
+ * `_tier`, `_by` and `_v` are deliberately NOT here — they come from
21
+ * `identity`, which is the single source for all three. See
22
+ * {@link buildRecordEnvelope}.
23
+ */
24
+ readonly extra?: Partial<Pick<EncryptedEnvelope, '_det' | '_sealed' | '_vdig' | '_bidx'>> | undefined;
25
+ }
26
+ /**
27
+ * Build an envelope for `identity`.
28
+ *
29
+ * ## `identity` is the SINGLE SOURCE for `_by`, `_tier` and `_v`
30
+ *
31
+ * All three are stamped from it, and `RecordEnvelopeBody` deliberately cannot
32
+ * carry them. That is not tidiness — it is what makes the AAD binding safe.
33
+ *
34
+ * The caller encrypts the body under AAD derived from `{collection, id, tier,
35
+ * by, version}`. A reader recomputes that AAD from the address it fetched from
36
+ * plus `_tier`/`_by`/`_v` read back **off the envelope** (`recordAadFor`). So if the
37
+ * identity a writer *declares* could differ from the fields it *stamps*, the
38
+ * AAD would not reproduce and the record would be undecryptable — silently, at
39
+ * write time, discoverable only on the next read, and invisible to every gate
40
+ * because the envelope is perfectly well-formed.
41
+ *
42
+ * An earlier draft took both and asserted they agreed. The assertion fired 230
43
+ * times on the existing tree, which is the argument against it: a rule that can
44
+ * be violated is a rule someone must remember. Taking one source removes the
45
+ * violation instead of reporting it.
46
+ */
47
+ export declare function buildRecordEnvelope(identity: RecordIdentity, body: RecordEnvelopeBody): EncryptedEnvelope;
48
+ /**
49
+ * Build an envelope from an already-sealed body — the output of
50
+ * `writeEnvelopeBody` — **without the caller ever naming `_iv`/`_data`/`_cek`**.
51
+ *
52
+ * This exists because of a guard, and the guard was right. Migrating
53
+ * `writeEnvelopeBody` callers to {@link buildRecordEnvelope} meant rewriting
54
+ * `...body` (a spread, which names nothing) into `iv: body._iv, data:
55
+ * body._data, cek: body._cek` — and `enclave-body-only` failed it: three new
56
+ * protected-body accesses in files that previously had zero.
57
+ *
58
+ * That is the correct outcome rather than an obstacle. #1051 exists to move
59
+ * knowledge of the envelope's shape *inward*; a migration that spreads the
60
+ * protected field names outward to every caller would have defeated its own
61
+ * purpose while looking like progress. The pairing belongs here.
62
+ *
63
+ * ## It takes a SEALER, not a sealed body — and that is load-bearing (#1041)
64
+ *
65
+ * The obvious shape is `(identity, alreadySealedBody, rest)`. That requires the
66
+ * caller to name the identity TWICE — once for `writeEnvelopeBody` and once
67
+ * here — and the two must agree byte for byte or the record is sealed under
68
+ * AAD no reader can reproduce.
69
+ *
70
+ * They did not agree. `with-party/broker/seed.ts` sealed against
71
+ * `{collection, id}` and stamped `{collection, id, by}`, so every broker seed
72
+ * became unreadable the moment AAD switched on. Taking the sealer means the
73
+ * identity is written once and handed to both — divergence stops being
74
+ * possible rather than being something to remember.
75
+ */
76
+ export declare function buildSealedRecordEnvelope(identity: RecordIdentity, seal: (identity: RecordIdentity) => Promise<Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek'>>, body: Omit<RecordEnvelopeBody, 'iv' | 'data' | 'cek'>): Promise<EncryptedEnvelope>;
@@ -13,6 +13,7 @@
13
13
  * per-function doc for its oracle call site) — this file introduces no new
14
14
  * crypto or semantics, only a narrower door onto what already runs.
15
15
  */
16
+ import { type RecordIdentity, type RecordRef } from '../record-aad.js';
16
17
  import { type EnclaveKey } from '../crypto.js';
17
18
  import type { EncryptedEnvelope } from '../../types.js';
18
19
  /**
@@ -27,7 +28,7 @@ import type { EncryptedEnvelope } from '../../types.js';
27
28
  * (the collection DEK), decrypt the body under the unwrapped CEK.
28
29
  * - `env._cek` absent → legacy path, decrypt the body directly under `key`.
29
30
  */
30
- export declare function openEnvelopeJson(env: EncryptedEnvelope, key: EnclaveKey, opts?: {
31
+ export declare function openEnvelopeJson(ref: RecordRef, env: EncryptedEnvelope, key: EnclaveKey, opts?: {
31
32
  encrypted?: boolean;
32
33
  }): Promise<string>;
33
34
  /**
@@ -43,7 +44,7 @@ export declare function openEnvelopeJson(env: EncryptedEnvelope, key: EnclaveKey
43
44
  * generated here rather than supplied by the caller).
44
45
  * - otherwise → legacy path, body encrypted directly under `key`.
45
46
  */
46
- export declare function writeEnvelopeBody(json: string, key: EnclaveKey, opts?: {
47
+ export declare function writeEnvelopeBody(identity: RecordIdentity, json: string, key: EnclaveKey, opts?: {
47
48
  encrypted?: boolean;
48
49
  perRecordKey?: boolean;
49
50
  }): Promise<Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek'>>;
@@ -85,3 +86,34 @@ export declare function hasPerRecordKey(env: EncryptedEnvelope): boolean;
85
86
  * `envelope-body.test.ts`).
86
87
  */
87
88
  export declare function envelopeBodyForHash(env: EncryptedEnvelope): string;
89
+ /**
90
+ * Does `env` carry an AEAD-sealed body at all?
91
+ *
92
+ * The one question callers outside the enclave legitimately need to ask about
93
+ * `_iv` — a tombstone and a plaintext-collection record have none, so there is
94
+ * nothing to authenticate and nothing to re-seal. Both {@link
95
+ * verifyRecordIdentity} (which treats them as vacuously authentic) and the
96
+ * merge authority's `advance` (which stamps them without re-sealing) turn on
97
+ * it, and asking it here keeps `_iv` from leaking back out to the callers —
98
+ * which `enclave-body-only` refused, correctly, when `advance` tested it inline.
99
+ */
100
+ export declare function hasSealedBody(env: Pick<EncryptedEnvelope, '_iv'>): boolean;
101
+ /**
102
+ * Does `env` authenticate at the identity `ref` claims, under `key`? (#1042)
103
+ *
104
+ * The merge's fail-closed check, living here because it is envelope surgery:
105
+ * deciding "is there a sealed body at all" reads `_iv`, which
106
+ * `enclave-body-only` reserves to this folder. An earlier draft did that test
107
+ * in `kernel/noydb.ts` and the guard refused it — correctly, since a caller
108
+ * outside the enclave inspecting protected fields is how envelope knowledge
109
+ * leaks back out.
110
+ *
111
+ * Returns a boolean rather than throwing: `applyRemote` must be able to reject
112
+ * one poisoned record without halting an entire sync, and a hostile store
113
+ * would very much like the opposite.
114
+ *
115
+ * **A record with no sealed body is vacuously authentic** — a tombstone carries
116
+ * none, and a plaintext collection has no AEAD to verify. Those are pass-through
117
+ * by construction, not by omission.
118
+ */
119
+ export declare function verifyRecordIdentity(ref: RecordRef, env: EncryptedEnvelope, key: EnclaveKey): Promise<boolean>;
@@ -21,6 +21,7 @@
21
21
  */
22
22
  import { type EnclaveKey } from '../crypto.js';
23
23
  import type { EncryptedEnvelope } from '../../types.js';
24
+ import { type RecordIdentity } from '../record-aad.js';
24
25
  import type { Lru } from '../../cache/index.js';
25
26
  /** Dependencies {@link resolveStableCek} needs from its collection. */
26
27
  export interface StableCekDeps {
@@ -46,15 +47,31 @@ export interface RewrappedBody {
46
47
  readonly cek: EnclaveKey | null;
47
48
  }
48
49
  /**
49
- * Move a record body from `fromDek` to `toDek`.
50
+ * Move a record body from `fromDek`/`from` to `toDek`/`to`.
50
51
  *
51
52
  * - Per-record-key record (`_cek` present): unwrap the CEK under `fromDek`,
52
53
  * re-encrypt the body under the SAME CEK, re-wrap the CEK under `toDek`. The
53
54
  * body key is unchanged → history-chain identity preserved.
54
55
  * - Legacy record (no `_cek`): decrypt under `fromDek`, re-encrypt under `toDek`
55
- * directly — byte-for-byte the pre-CEK behaviour.
56
+ * directly.
57
+ *
58
+ * ## Why it takes TWO identities (#1041)
59
+ *
60
+ * A rewrap is the one operation where the identity genuinely **changes**. A
61
+ * tier move rewrites `_tier`; a history snapshot lands at a different
62
+ * `(collection, id)` entirely. Since AAD binds both, the body must be opened
63
+ * under the identity it currently has and re-sealed under the one it is moving
64
+ * to. A single identity would be wrong for one end or the other.
65
+ *
66
+ * ⚠️ **This retires an optimisation, deliberately.** Callers used to compute
67
+ * ONE rewrap and reuse the bytes for both a tier move's live write and its
68
+ * `_history` snapshot (#728). Those now have different destination identities,
69
+ * so they need different AAD and therefore different ciphertext — the same
70
+ * bytes cannot satisfy both. Reusing one rewrap for two destinations is now a
71
+ * silent corruption, not a saving: it produces a record that opens at one
72
+ * address and not the other.
56
73
  */
57
- export declare function rewrapBodyToDek(envelope: Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek'>, fromDek: EnclaveKey, toDek: EnclaveKey): Promise<RewrappedBody>;
74
+ export declare function rewrapBodyToDek(from: RecordIdentity, to: RecordIdentity, envelope: Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek' | '_tier' | '_by'>, fromDek: EnclaveKey, toDek: EnclaveKey): Promise<RewrappedBody>;
58
75
  /**
59
76
  * Merge an ALREADY-rewrapped {@link RewrappedBody} into `envelope`, keeping
60
77
  * every field but the re-keyed body (`_iv`/`_data`/`_cek`) unchanged.
@@ -76,7 +93,7 @@ export declare function applyRewrappedBody(envelope: EncryptedEnvelope, body: Re
76
93
  * envelope, generalized to any envelope shape (history callers don't bump
77
94
  * `_v`/`_ts`/`_tier` the way a tier move does).
78
95
  */
79
- export declare function rewrapEnvelope(envelope: EncryptedEnvelope, fromDek: EnclaveKey, toDek: EnclaveKey): Promise<EncryptedEnvelope>;
96
+ export declare function rewrapEnvelope(identity: RecordIdentity, envelope: EncryptedEnvelope, fromDek: EnclaveKey, toDek: EnclaveKey): Promise<EncryptedEnvelope>;
80
97
  /**
81
98
  * Is `envelope` ALREADY wrapped under `dek` (a per-record CEK wrapped under
82
99
  * `dek`, or — legacy, no `_cek` — the body itself decryptable under `dek`)?
@@ -104,4 +121,4 @@ export declare function rewrapEnvelope(envelope: EncryptedEnvelope, fromDek: Enc
104
121
  * those fields themselves, preserving the check-architecture body-access
105
122
  * ratchet.
106
123
  */
107
- export declare function isRewrappedUnder(envelope: Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek'>, dek: EnclaveKey): Promise<boolean>;
124
+ export declare function isRewrappedUnder(identity: RecordIdentity, envelope: Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek'>, dek: EnclaveKey): Promise<boolean>;
@@ -18,6 +18,7 @@
18
18
  */
19
19
  import { type EnclaveKey } from '../crypto.js';
20
20
  import { type EncryptedEnvelope, type CrdtMode, type CrdtStrategy, type VdigFieldPolicy, type SealedHandle } from '../../types.js';
21
+ import { type RecordIdentity, type RecordRef } from '../record-aad.js';
21
22
  import { type StandardSchemaV1 } from '../../schema.js';
22
23
  import type { Lru } from '../../cache/index.js';
23
24
  import type { ViaCryptoCtx } from '../../via/index.js';
@@ -127,11 +128,9 @@ export declare class RecordCodec<T> {
127
128
  * parts. Pure, no crypto. Each call stamps its own `_ts` — provenance carries
128
129
  * a SEPARATE timestamp (computed by the caller), so the two never share one.
129
130
  */
130
- static buildEnvelope(p: {
131
- version: number;
131
+ static buildEnvelope(identity: RecordIdentity, p: {
132
132
  iv: string;
133
133
  data: string;
134
- by?: string;
135
134
  cek?: string;
136
135
  provenance?: {
137
136
  source: string;
@@ -140,10 +139,8 @@ export declare class RecordCodec<T> {
140
139
  extra?: Partial<Pick<EncryptedEnvelope, '_tier' | '_det' | '_sealed'>>;
141
140
  }): EncryptedEnvelope;
142
141
  /** Plaintext (`_iv:''`) body envelope — the `!storeCiphertext` shape. */
143
- static buildPlaintextEnvelope(p: {
144
- version: number;
142
+ static buildPlaintextEnvelope(identity: RecordIdentity, p: {
145
143
  data: string;
146
- by?: string;
147
144
  provenance?: {
148
145
  source: string;
149
146
  sourceTs: string;
@@ -157,7 +154,7 @@ export declare class RecordCodec<T> {
157
154
  * (see {@link encryptRecord}). Rejects `_`-prefixed record fields, which
158
155
  * would collide with the reserved metadata namespace.
159
156
  */
160
- buildDebugEnvelope(record: T, version: number, source?: string, sourceTs?: string): EncryptedEnvelope;
157
+ buildDebugEnvelope(id: string, record: T, version: number, source?: string, sourceTs?: string): EncryptedEnvelope;
161
158
  /**
162
159
  * Encrypt a JSON body into an envelope.
163
160
  *
@@ -167,11 +164,41 @@ export declare class RecordCodec<T> {
167
164
  * path encrypts the body directly under the collection DEK — byte-identical
168
165
  * to pre-CEK behaviour, so non-adopting collections pay nothing.
169
166
  */
170
- encryptJsonString(json: string, version: number, cek?: EnclaveKey, source?: string, sourceTs?: string): Promise<EncryptedEnvelope>;
171
- encryptRecord(record: T, version: number, cek?: EnclaveKey, source?: string, sourceTs?: string, vdig?: {
167
+ /**
168
+ * `ref` is the identity the envelope is sealed against, and it is **the
169
+ * location the bytes are stored at** — not necessarily this codec's own
170
+ * collection (#1051).
171
+ *
172
+ * That distinction was discovered here rather than assumed. Several callers
173
+ * put the result somewhere else entirely: search's vector sidecar lands in
174
+ * `_vec` under `encodeVecId(name, id)`, the lexical index under `_ft/<name>`,
175
+ * indexing's entries under a synthetic `idxId`. A codec that supplied
176
+ * `this.ctx.name` for those would seal them against a collection they are not
177
+ * in, and once AAD binds identity every one of them would fail to verify.
178
+ *
179
+ * ⚠️ **`_history` is the open case, and it is #1041's to settle.** Snapshots
180
+ * are produced with the LIVE record's identity here and then re-homed by
181
+ * `saveHistory` into `_history/<historyId(collection,id,_v)>`. Both readings
182
+ * are defensible — bind where it lives, or bind what it is a copy of — and
183
+ * the choice must be made before AAD is switched on, not inferred from this
184
+ * migration.
185
+ */
186
+ encryptJsonString(ref: RecordRef, json: string, version: number, cek?: EnclaveKey, source?: string, sourceTs?: string): Promise<EncryptedEnvelope>;
187
+ /**
188
+ * `ref` is FIRST and required (#1051). It was previously a trailing optional
189
+ * `id?: string`, which TypeScript cannot promote to required because it sits
190
+ * after other optionals — so the migration would have needed an `id ?? ''`
191
+ * fallback. That is exactly the silent default this issue exists to remove:
192
+ * once identity is bound into the AEAD, every record written with an empty id
193
+ * binds to the SAME identity and becomes interchangeable with the others.
194
+ * An object, not a bare string, so a swap with `version`/`source` cannot
195
+ * compile on the hottest write path. Carries the collection too — see
196
+ * {@link encryptJsonString} for why the codec must not assume its own.
197
+ */
198
+ encryptRecord(ref: RecordRef, record: T, version: number, cek?: EnclaveKey, source?: string, sourceTs?: string, vdig?: {
172
199
  readonly id: string;
173
200
  readonly prev: EncryptedEnvelope | null;
174
- }, id?: string): Promise<EncryptedEnvelope>;
201
+ }): Promise<EncryptedEnvelope>;
175
202
  /**
176
203
  * Resolve the per-record CEK for a stored envelope, or `undefined` for a
177
204
  * legacy (`_cek`-absent) envelope. Unwraps `_cek` under the collection DEK and
@@ -195,7 +222,14 @@ export declare class RecordCodec<T> {
195
222
  * The optional `id` lets reads populate the CEK cache; it is omitted by
196
223
  * callers (history, conflict merge) that have only the envelope.
197
224
  */
198
- decryptJsonString(envelope: EncryptedEnvelope, id?: string): Promise<string | null>;
225
+ /**
226
+ * `ref` must be the SAME identity the writer sealed against — which is the
227
+ * storage address, not necessarily this codec's own collection. Search's
228
+ * vector sidecar lives in `_vec`, its lexical index in `_ft`; passing
229
+ * `this.ctx.name` for those would recompute the wrong AAD and fail to open a
230
+ * perfectly good record (#1041).
231
+ */
232
+ decryptJsonString(ref: RecordRef, envelope: EncryptedEnvelope): Promise<string | null>;
199
233
  /**
200
234
  * Unseal a single `_sealed[field]` slot to its plaintext value: derive the
201
235
  * per-field key off the collection DEK, AES-GCM-decrypt the `iv:data` blob,
@@ -304,7 +338,7 @@ export declare class RecordCodec<T> {
304
338
  * output-recompute path, not the public per-record read surface schema
305
339
  * validation guards.
306
340
  */
307
- decryptRecordAtDek(envelope: EncryptedEnvelope, dek: EnclaveKey, id?: string): Promise<T | null>;
341
+ decryptRecordAtDek(ref: RecordRef, envelope: EncryptedEnvelope, dek: EnclaveKey): Promise<T | null>;
308
342
  /**
309
343
  * Decrypt an envelope into a record of type `T`.
310
344
  *
@@ -320,9 +354,8 @@ export declare class RecordCodec<T> {
320
354
  * that may predate a schema change, so validating it would be a
321
355
  * false positive. Every non-history read leaves this flag `false`.
322
356
  */
323
- decryptRecord(envelope: EncryptedEnvelope, opts?: {
357
+ decryptRecord(ref: RecordRef, envelope: EncryptedEnvelope, opts?: {
324
358
  skipValidation?: boolean;
325
- id?: string;
326
359
  sealedAsHandles?: boolean;
327
360
  }): Promise<T | null>;
328
361
  }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Re-key one envelope from an old collection DEK to a new one (#1074).
3
+ *
4
+ * Lives in the enclave because it is envelope surgery: it reads and writes the
5
+ * protected body slots (`_iv`/`_data`/`_cek`), which `enclave-body-only`
6
+ * reserves to `kernel/enclave/**`. `rotateKeys` previously did this inline in
7
+ * `with-party/team/keyring.ts` and got it wrong in two ways that the guard
8
+ * would have caught had the code lived here.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { type EnclaveKey } from '../crypto.js';
13
+ import type { EncryptedEnvelope } from '../../types.js';
14
+ /**
15
+ * Produce the envelope `envelope` becomes once its collection's DEK rotates
16
+ * from `oldDek` to `newDek`.
17
+ *
18
+ * **Every slot is carried forward except `_bidx`.** The previous inline version
19
+ * built a fresh literal holding only `_noydb/_v/_ts/_iv/_data`, silently
20
+ * discarding `_by`, `_tier`, `_cek`, `_sealed`, `_vdig` and `_source`. Losing
21
+ * `_tier` was the worst of those: tier-0 reads treat elevated as missing, so an
22
+ * elevated record did not error after a rotation — it simply disappeared.
23
+ *
24
+ * `_bidx` is dropped deliberately. It is a DEK-rooted equality tag, so a tag
25
+ * carried across a DEK rotation can never be re-derived to match a query again
26
+ * while still leaking the old equality partition. Index coverage regrows
27
+ * per-record on the next `put()` under the new DEK.
28
+ *
29
+ * Two shapes, and picking the wrong one is why this needed a helper:
30
+ *
31
+ * - **per-record CEK** (`_cek` present) — the body is sealed under the CEK and
32
+ * the CEK is wrapped under the collection DEK, so rotation re-wraps the CEK
33
+ * and leaves the body **untouched**. The old inline code instead ran
34
+ * `decrypt(body, oldDek)` on these, which throws: rotation could not complete
35
+ * on a collection containing any CEK record.
36
+ * - **bare** — body sealed directly under the DEK, so decrypt and re-encrypt.
37
+ *
38
+ * Idempotence is the caller's problem, not this function's: it assumes
39
+ * `envelope` is still under `oldDek`. A resumable rotation must know which side
40
+ * of the migration each record is on before calling.
41
+ */
42
+ export declare function rekeyEnvelopeToDek(ref: {
43
+ readonly collection: string;
44
+ readonly id: string;
45
+ }, envelope: EncryptedEnvelope, oldDek: EnclaveKey, newDek: EnclaveKey): Promise<EncryptedEnvelope>;
46
+ /**
47
+ * Resumable variant: returns the re-keyed envelope, or `null` when `envelope`
48
+ * is **already** under `newDek` and needs no work (#1074 part 2).
49
+ *
50
+ * A rotation interrupted mid-collection leaves records on both sides of the
51
+ * migration. Resuming means re-running the rotation with the *same* new DEK,
52
+ * which requires distinguishing "not yet moved" from "already moved" without
53
+ * the caller touching protected slots.
54
+ *
55
+ * Detection is by trial decryption under `oldDek`. There is no metadata that
56
+ * says which DEK sealed a record — deliberately, since such a marker would be
57
+ * store-writable and therefore a downgrade lever (the same reasoning that
58
+ * keeps the reader from branching on `_noydb`).
59
+ *
60
+ * A record that opens under *neither* key is genuinely damaged and rethrows,
61
+ * rather than being silently skipped: a rotation that quietly walked past
62
+ * unreadable records would convert a loud failure into permanent silent loss,
63
+ * which is the defect this whole issue is about.
64
+ */
65
+ export declare function rekeyEnvelopeIfNeeded(ref: {
66
+ readonly collection: string;
67
+ readonly id: string;
68
+ }, envelope: EncryptedEnvelope, oldDek: EnclaveKey, newDek: EnclaveKey): Promise<EncryptedEnvelope | null>;
@@ -16,6 +16,7 @@
16
16
  * vault; it calls into these.
17
17
  */
18
18
  import { type EncryptedEnvelope } from '../../types.js';
19
+ import type { RecordRef } from '../record-aad.js';
19
20
  /**
20
21
  * Shape-only tombstone recognition for layers that have no per-collection
21
22
  * context (the sync engine, #590): a tombstone carries an empty `_data` and
@@ -45,7 +46,7 @@ export declare function isTombstone(envelope: EncryptedEnvelope, encrypted: bool
45
46
  * Deliberately omits `_iv`/`_data`/`_cek`/`_det` — that omission *is* the
46
47
  * erasure.
47
48
  */
48
- export declare function buildTombstone(version: number, actor: string): EncryptedEnvelope;
49
+ export declare function buildTombstone(ref: RecordRef, version: number, actor: string): EncryptedEnvelope;
49
50
  /** #589: is this envelope an ordinary-delete marker (version-ordered, reads as absent)? */
50
51
  export declare function isDeleteMarker(envelope: EncryptedEnvelope): boolean;
51
52
  /**
@@ -54,4 +55,4 @@ export declare function isDeleteMarker(envelope: EncryptedEnvelope): boolean;
54
55
  * keeps the displaced `_v` — so it wins convergence over the pre-delete copy and a
55
56
  * re-create can still win over it at a higher version.
56
57
  */
57
- export declare function buildDeleteMarker(version: number, actor: string): EncryptedEnvelope;
58
+ export declare function buildDeleteMarker(ref: RecordRef, version: number, actor: string): EncryptedEnvelope;
@@ -52,7 +52,7 @@
52
52
  * │ ├─ BackupLedgerError — hash-chain verification failed
53
53
  * │ └─ BackupCorruptedError — envelope hash mismatch in dump
54
54
  * ├─ Bundle errors
55
- * │ └─ BundleIntegrityError — .noydb body sha256 mismatch
55
+ * │ └─ PodIntegrityError — .noydb body sha256 mismatch
56
56
  * ├─ Session errors
57
57
  * │ ├─ SessionExpiredError
58
58
  * │ ├─ SessionNotFoundError
@@ -143,7 +143,23 @@ export declare class DecryptionError extends NoydbError {
143
143
  * Treat it as a security alert: the stored bytes are not what NOYDB wrote.
144
144
  */
145
145
  export declare class TamperedError extends NoydbError {
146
- constructor(message?: string);
146
+ /**
147
+ * Why the tag check failed, when the enclave could tell (#1103).
148
+ *
149
+ * `'unbound-legacy-format'` — the body opens under an EMPTY AAD, so it was
150
+ * sealed before identity binding (#1041) and this is a format transition, not
151
+ * an attack. Positive evidence, not a guess: producing a body that decrypts
152
+ * under this DEK requires the DEK, which an untrusted store does not hold.
153
+ *
154
+ * Absent — no benign explanation was found. Treat as the security alert this
155
+ * error has always been.
156
+ *
157
+ * The field is additive and the throw is unchanged, so
158
+ * `catch (e) { if (e instanceof TamperedError) … }` keeps working; callers
159
+ * that want to tell a migration from a breach can now read this.
160
+ */
161
+ readonly reason?: 'unbound-legacy-format';
162
+ constructor(message?: string, reason?: 'unbound-legacy-format');
147
163
  }
148
164
  /**
149
165
  * Thrown when key unwrapping fails, typically because the secret is wrong
@@ -277,7 +293,7 @@ export declare class ExportCapabilityError extends NoydbError {
277
293
  * can show a precise "this bundle slot has expired" message instead
278
294
  * of the generic decryption-failure UX.
279
295
  *
280
- * Used predominantly on `BundleRecipient` slots produced by
296
+ * Used predominantly on `PodRecipient` slots produced by
281
297
  * `writePod({ recipients: [...] })` to time-box audit access.
282
298
  */
283
299
  export declare class KeyringExpiredError extends NoydbError {
@@ -759,10 +775,6 @@ export declare class PodVersionConflictError extends NoydbError {
759
775
  readonly remoteVersion: string;
760
776
  constructor(remoteVersion: string, message?: string);
761
777
  }
762
- /** @deprecated Use `PodVersionConflictError`. */
763
- export declare const BundleVersionConflictError: typeof PodVersionConflictError;
764
- /** @deprecated Use `PodVersionConflictError`. */
765
- export type BundleVersionConflictError = PodVersionConflictError;
766
778
  /**
767
779
  * Thrown when a sync operation (push or pull) fails due to a network error.
768
780
  *
@@ -1012,7 +1024,7 @@ export declare class FieldNotQueryableError extends NoydbError {
1012
1024
  * format violations like a missing magic prefix or malformed
1013
1025
  * header JSON) so consumers can pattern-match the corruption case
1014
1026
  * and handle it differently from a producer bug. A
1015
- * `BundleIntegrityError` indicates "the bytes you got are not
1027
+ * `PodIntegrityError` indicates "the bytes you got are not
1016
1028
  * what was written"; a plain `Error` from `parsePrefixAndHeader`
1017
1029
  * indicates "what was written wasn't a valid bundle in the first
1018
1030
  * place."
@@ -1022,7 +1034,7 @@ export declare class FieldNotQueryableError extends NoydbError {
1022
1034
  * written) but it surfaces with the same error class because the
1023
1035
  * end result is "the body cannot be turned back into a dump."
1024
1036
  */
1025
- export declare class BundleIntegrityError extends NoydbError {
1037
+ export declare class PodIntegrityError extends NoydbError {
1026
1038
  constructor(message: string);
1027
1039
  }
1028
1040
  /**
@@ -1046,7 +1058,7 @@ export declare class PodHeaderVerificationError extends NoydbError {
1046
1058
  * surface an actionable prompt:
1047
1059
  *
1048
1060
  * ```
1049
- * BundleSealMismatchError: bundle carries sealed secret for user "alice"
1061
+ * PodSealMismatchError: bundle carries sealed secret for user "alice"
1050
1062
  * under provider "macos-keychain:com.acme.app/alice@acme.example",
1051
1063
  * but no registered provider matches that pid.
1052
1064
  * ```
@@ -1059,7 +1071,7 @@ export declare class PodHeaderVerificationError extends NoydbError {
1059
1071
  * 3. Inspect without unsealing — pass no `sealingProviders` to
1060
1072
  * receive the sealed entries unmodified for offline analysis.
1061
1073
  */
1062
- export declare class BundleSealMismatchError extends NoydbError {
1074
+ export declare class PodSealMismatchError extends NoydbError {
1063
1075
  readonly userId: string;
1064
1076
  readonly pid: string;
1065
1077
  constructor(userId: string, pid: string);
@@ -0,0 +1,25 @@
1
+ import type { MergeAuthority } from '../port/with/merge-authority.js';
2
+ import type { EnclaveKey } from './enclave/index.js';
3
+ /**
4
+ * ⚠️ **A client cannot verify what it cannot decrypt** — and that boundary is
5
+ * stated here rather than hidden.
6
+ *
7
+ * A record at a tier this caller holds no key for is accepted **unverified**.
8
+ * Rejecting it would break replication of data the peer legitimately holds but
9
+ * this client is not cleared to read, converting a confidentiality boundary
10
+ * into a replication failure. The residue is narrow: envelopes whose key the
11
+ * client lacks are pass-through, exactly as every envelope was before #1042.
12
+ *
13
+ * Closing that residue needs the vault head (#1044), which can detect absence
14
+ * and substitution without holding the key.
15
+ */
16
+ export declare function buildMergeAuthority(
17
+ /**
18
+ * Just the DEK map, not the whole keyring. `port-layering` refused a type
19
+ * import of `UnlockedKeyring` from `with-party` — correctly, and the narrower
20
+ * shape is better anyway: this needs to look up keys, not to know what a
21
+ * keyring is.
22
+ */
23
+ keyring: {
24
+ readonly deks: ReadonlyMap<string, EnclaveKey>;
25
+ }): MergeAuthority;
@@ -1,5 +1,5 @@
1
1
  import type { RotateResult } from '../with-party/team/keyring.js';
2
- import type { NoydbOptions, NoydbEventMap, GrantOptions, RevokeOptions, UpdateUserOptions, UserInfo, PushResult, PullResult, PushOptions, PullOptions, SyncStatus, SyncTargetInfo, NoydbStore, AccessibleVault, ListAccessibleVaultsOptions, QueryAcrossOptions, QueryAcrossResult, TranslatorAuditEntry, WriteConflict, UserApiFactory, ActiveTier, FactorProofBundle, GateName, VaultPolicy } from './types.js';
2
+ import type { NoydbOptions, NoydbEventMap, GrantOptions, RevokeOptions, UpdateUserOptions, UserInfo, PushResult, PullResult, PushOptions, PullOptions, SyncStatus, SyncTargetInfo, SyncTargetStatus, NoydbStore, AccessibleVault, ListAccessibleVaultsOptions, QueryAcrossOptions, QueryAcrossResult, TranslatorAuditEntry, WriteConflict, UserApiFactory, ActiveTier, FactorProofBundle, GateName, VaultPolicy } from './types.js';
3
3
  import type { SecretPolicy } from './validation.js';
4
4
  import { type CoordinationProvider } from '../port/by/default-provider.js';
5
5
  import type { Cover } from '../with-party/directory/cover/types.js';
@@ -282,8 +282,8 @@ export declare class Noydb {
282
282
  * collection) pair that was dropped. Re-run `grant()` for those pairs, or
283
283
  * they stay locked out.
284
284
  *
285
- * Unlike `revoke({ rotateKeys: true })`, this call does not REMOVE any
286
- * user from the vault — they keep membership and their other collections.
285
+ * Unlike `revoke()`, this call does not REMOVE any user from the vault —
286
+ * they keep membership and their other collections.
287
287
  * This is the "just rotate" path; "revoke and rotate" lives in `revoke()`.
288
288
  *
289
289
  * Exposed on Noydb (rather than only on the lower-level keyring
@@ -549,6 +549,12 @@ export declare class Noydb {
549
549
  _clearActiveTxContext(ctx: TxContext): void;
550
550
  /** Get sync status for a vault. */
551
551
  syncStatus(vault: string): SyncStatus;
552
+ /**
553
+ * Per-target sync state for `vault` (#1034) — `syncStatus()` reads only the
554
+ * primary engine, so it cannot express "the LAN store is behind, the cloud
555
+ * is current". Registration order, primary first. See {@link SyncTargetStatus}.
556
+ */
557
+ syncTargetStatus(vault: string): SyncTargetStatus[];
552
558
  /**
553
559
  * Enumerate the sync targets wired for `vault` (#948) — the primary engine
554
560
  * (keyed by vault name) plus any additional targets (keyed `vault::label`
@@ -309,6 +309,12 @@ export declare class Query<T, S extends keyof T = never, Q extends keyof T & str
309
309
  toArray(opts?: {
310
310
  locale?: string;
311
311
  }): T[];
312
+ /**
313
+ * Joins need a `JoinContext`. Unreachable in practice — `.join()` throws
314
+ * when one is missing — but belt-and-braces for a plan built through the
315
+ * raw `Query` constructor with joins pre-populated.
316
+ */
317
+ private requireJoinContext;
312
318
  /**
313
319
  * Decode this source's Via-covered fields on read (e.g. money: stored
314
320
  * scaled-int → canonical decimal), so `query().toArray()` agrees with
@@ -330,12 +336,19 @@ export declare class Query<T, S extends keyof T = never, Q extends keyof T & str
330
336
  }): T | null;
331
337
  /**
332
338
  * Return the number of matching records (after where/filter,
333
- * before limit). **Joins are NOT applied** — count() reports the
334
- * left-side cardinality, because joins in are projection-only
339
+ * before limit). **Joins are normally NOT applied** — count() reports the
340
+ * left-side cardinality, because joins are projection-only
335
341
  * (they attach an aliased field; they never filter). Running joins
336
342
  * here just to discard the aliases would be wasteful, and in strict
337
343
  * mode it could throw `DanglingReferenceError` for a call whose
338
344
  * intent is purely to count.
345
+ *
346
+ * The exception (#1030) is a `where` clause addressing a join alias. Then
347
+ * the legs must run, because the predicate is part of what is being
348
+ * counted — skipping them would report the unfiltered left cardinality.
349
+ * A strict-mode `DanglingReferenceError` becomes reachable from `count()`
350
+ * in exactly that case, which is acceptable: the caller asked to filter on
351
+ * the joined side, so they asked for the join.
339
352
  */
340
353
  count(): number;
341
354
  /**
@@ -45,6 +45,7 @@
45
45
  * including joined reads.
46
46
  */
47
47
  import type { RefDescriptor, RefMode } from '../refs.js';
48
+ import type { Clause } from './predicate.js';
48
49
  /** Planner strategy for a single join leg. Auto-selected unless overridden. */
49
50
  export type JoinStrategy = 'hash' | 'nested';
50
51
  /** Default per-side row ceiling before `.join()` throws `JoinTooLargeError`. */
@@ -168,6 +169,32 @@ export interface JoinContext {
168
169
  */
169
170
  resolveDictSource?(field: string): JoinableSource | null;
170
171
  }
172
+ /**
173
+ * Split a plan's clauses into those evaluable before the join legs run and
174
+ * those that need the joined shape (#1030).
175
+ *
176
+ * Join legs attach after `where` so the left set can be narrowed (and
177
+ * index-driven) first. That is the right default, but it silently broke any
178
+ * predicate addressing a joined alias: the field did not exist yet, so
179
+ * `readPath` returned `undefined`, nothing matched, and the query returned an
180
+ * empty result with no error.
181
+ *
182
+ * The split is deliberately narrow. When no clause addresses an alias — every
183
+ * query written against the previous behaviour — `postJoin` is empty and the
184
+ * caller takes its original path unchanged. The reordered pipeline therefore
185
+ * only ever runs for queries that match nothing today.
186
+ *
187
+ * KNOWN RESIDUAL: `.filter(r => r.client?.name === 'Ann')` cannot be
188
+ * classified (the predicate is a closure), so it still runs pre-join and still
189
+ * sees no alias. Prefer `.where()` for anything addressing a joined field.
190
+ *
191
+ * Shared by the eager `Query` and the streaming `ScanBuilder` so the two
192
+ * cannot drift on which side a clause belongs to.
193
+ */
194
+ export declare function splitAroundJoins(clauses: readonly Clause[], joins: readonly JoinLeg[]): {
195
+ readonly preJoin: readonly Clause[];
196
+ readonly postJoin: readonly Clause[];
197
+ };
171
198
  /**
172
199
  * Apply every join leg in the plan against a base set of left-side
173
200
  * rows. Called by the query executor after `where` / `orderBy` /
@@ -119,8 +119,6 @@ export interface SyncPolicy {
119
119
  export declare const INDEXED_STORE_POLICY: SyncPolicy;
120
120
  /** Default for bundle stores (Drive, WebDAV, Git). */
121
121
  export declare const POD_STORE_POLICY: SyncPolicy;
122
- /** @deprecated Use `POD_STORE_POLICY`. */
123
- export declare const BUNDLE_STORE_POLICY: SyncPolicy;
124
122
  /**
125
123
  * Current operational state of the `SyncScheduler`.
126
124
  *