@noy-db/hub 0.3.0-pre.3 → 0.3.0-pre.4

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 (386) hide show
  1. package/dist/adapter/index.d.ts +2 -2
  2. package/dist/adapter/index.js +1 -1
  3. package/dist/aggregate/index.d.ts +3 -3
  4. package/dist/aggregate/index.js +4 -4
  5. package/dist/api-JOXUNSKP.js +20 -0
  6. package/dist/as/index.d.ts +4 -4
  7. package/dist/as/index.js +12 -9
  8. package/dist/at/index.d.ts +2 -2
  9. package/dist/attestation/index.d.ts +3 -3
  10. package/dist/attestation/index.js +21 -18
  11. package/dist/attestation/index.js.map +1 -1
  12. package/dist/{backup-NGRJ46SH.js → backup-MOB27UUN.js} +12 -9
  13. package/dist/{backup-NGRJ46SH.js.map → backup-MOB27UUN.js.map} +1 -1
  14. package/dist/blobs/index.d.ts +4 -4
  15. package/dist/blobs/index.js +11 -8
  16. package/dist/blobs/index.js.map +1 -1
  17. package/dist/bundle/index.d.ts +5 -5
  18. package/dist/bundle/index.js +21 -18
  19. package/dist/bundle/index.js.map +1 -1
  20. package/dist/{bundle-B-P3_Jvb.d.ts → bundle-Bs13EZtX.d.ts} +1 -1
  21. package/dist/by/index.js +2 -2
  22. package/dist/cargo/index.d.ts +4 -4
  23. package/dist/cargo/index.js +23 -20
  24. package/dist/{chunk-VBYVKOMJ.js → chunk-3QRQOBS7.js} +3 -3
  25. package/dist/{chunk-JFYIHLU3.js → chunk-3Y4QLJ6K.js} +2 -2
  26. package/dist/{chunk-BZIWKN74.js → chunk-43ISXURO.js} +2 -2
  27. package/dist/{chunk-7IP75FP2.js → chunk-4K3MQ5S3.js} +2 -2
  28. package/dist/{chunk-6DP5HBQD.js → chunk-5CY35H55.js} +9 -9
  29. package/dist/chunk-5EWYUR5P.js +37 -0
  30. package/dist/chunk-5EWYUR5P.js.map +1 -0
  31. package/dist/{chunk-2KSPDSWI.js → chunk-5MRE3C4Q.js} +5 -5
  32. package/dist/{chunk-5ZPWVNL3.js → chunk-5W7AOFWA.js} +2 -2
  33. package/dist/{chunk-PUNJAEY6.js → chunk-6HNKCKFZ.js} +7 -7
  34. package/dist/{chunk-PJDK2PPQ.js → chunk-6RXPSMKR.js} +3 -3
  35. package/dist/{chunk-Z44OY24N.js → chunk-7J7JRYXW.js} +9 -5
  36. package/dist/chunk-7J7JRYXW.js.map +1 -0
  37. package/dist/{chunk-MCJAUQGE.js → chunk-A5DYVMDR.js} +3 -3
  38. package/dist/{chunk-MIOLJG2R.js → chunk-AF5ZRTZ4.js} +5 -2
  39. package/dist/chunk-AF5ZRTZ4.js.map +1 -0
  40. package/dist/{chunk-TICO2I2O.js → chunk-BKGIWGCX.js} +2 -2
  41. package/dist/{chunk-O5DNEXQC.js → chunk-BMQOH7MM.js} +2 -2
  42. package/dist/{chunk-U6OM4E67.js → chunk-CPXPHQGX.js} +6 -6
  43. package/dist/{chunk-3UDPDRUC.js → chunk-EWR7HL3K.js} +4 -4
  44. package/dist/{chunk-CVXLJIAV.js → chunk-FH52CDEW.js} +5 -5
  45. package/dist/chunk-G4MGYGSS.js +130 -0
  46. package/dist/chunk-G4MGYGSS.js.map +1 -0
  47. package/dist/{chunk-FELHYKIO.js → chunk-G7RDYYTE.js} +2 -2
  48. package/dist/{chunk-N2FP26NH.js → chunk-GBTUANXF.js} +16 -297
  49. package/dist/chunk-GBTUANXF.js.map +1 -0
  50. package/dist/{chunk-UP6EMMDI.js → chunk-GOUNIHFA.js} +10 -10
  51. package/dist/{chunk-DHIN36UC.js → chunk-GQOT6QJR.js} +8 -8
  52. package/dist/{chunk-DGUR3CC4.js → chunk-GXGK22QU.js} +2 -2
  53. package/dist/{chunk-YTIAXSUE.js → chunk-GZZL5R73.js} +4 -4
  54. package/dist/{chunk-E4YJUNPU.js → chunk-H5XRIJX3.js} +7 -7
  55. package/dist/{chunk-DA34OEZU.js → chunk-H7RYPVMJ.js} +2 -2
  56. package/dist/{chunk-2ZORB5RW.js → chunk-HBKDR7R3.js} +3 -3
  57. package/dist/{chunk-BV7KNFJY.js → chunk-HLUKZ36Q.js} +9 -9
  58. package/dist/{chunk-ZNI3RTFV.js → chunk-HMXLN43G.js} +2 -2
  59. package/dist/{chunk-BYW7EU5L.js → chunk-HY6ZGGEC.js} +2 -2
  60. package/dist/{chunk-OVIVYAQL.js → chunk-K5P46KB3.js} +25 -10
  61. package/dist/chunk-K5P46KB3.js.map +1 -0
  62. package/dist/chunk-KYY7L72M.js +106 -0
  63. package/dist/chunk-KYY7L72M.js.map +1 -0
  64. package/dist/{chunk-5Z3RNFJC.js → chunk-LIP6JWYK.js} +3 -3
  65. package/dist/{chunk-OCDUQUAP.js → chunk-LN22XH4B.js} +1 -1
  66. package/dist/chunk-LN22XH4B.js.map +1 -0
  67. package/dist/chunk-LP7BEXCT.js +32 -0
  68. package/dist/chunk-LP7BEXCT.js.map +1 -0
  69. package/dist/{chunk-IJW6K6UX.js → chunk-LPRPVCNY.js} +5 -5
  70. package/dist/{chunk-6EVZXETK.js → chunk-M66NAZA4.js} +3 -3
  71. package/dist/{chunk-HGQG3VIP.js → chunk-N5YVZHCB.js} +2 -2
  72. package/dist/{chunk-IWVWB7BZ.js → chunk-NB47TXGP.js} +12 -12
  73. package/dist/chunk-NO272T7Q.js +194 -0
  74. package/dist/chunk-NO272T7Q.js.map +1 -0
  75. package/dist/{chunk-6OQ7NKMZ.js → chunk-O2DB4C3M.js} +6 -6
  76. package/dist/{chunk-LHYQE3BP.js → chunk-OFBFAVLI.js} +6 -6
  77. package/dist/{chunk-ZFME46HJ.js → chunk-OPTFANOX.js} +3 -3
  78. package/dist/chunk-OPTFANOX.js.map +1 -0
  79. package/dist/{chunk-5EZAJEES.js → chunk-OVO2RZAE.js} +81 -27
  80. package/dist/chunk-OVO2RZAE.js.map +1 -0
  81. package/dist/{chunk-6I2YPLAG.js → chunk-P27Z66EB.js} +7 -7
  82. package/dist/{chunk-7MHVHGQZ.js → chunk-P2LDXRGP.js} +2 -2
  83. package/dist/chunk-P3NGV5RV.js +41 -0
  84. package/dist/chunk-P3NGV5RV.js.map +1 -0
  85. package/dist/{chunk-YN66UOXT.js → chunk-P3V7JTB6.js} +25 -9
  86. package/dist/{chunk-YN66UOXT.js.map → chunk-P3V7JTB6.js.map} +1 -1
  87. package/dist/{chunk-NPVICKZE.js → chunk-P5WXDYMD.js} +8 -197
  88. package/dist/chunk-P5WXDYMD.js.map +1 -0
  89. package/dist/{chunk-CPAROOKP.js → chunk-PGFY7IRW.js} +12 -41
  90. package/dist/chunk-PGFY7IRW.js.map +1 -0
  91. package/dist/{chunk-6RASM2J4.js → chunk-QKVILR7N.js} +2 -2
  92. package/dist/{chunk-LKBLAUOB.js → chunk-QNTEDPWP.js} +3 -3
  93. package/dist/{chunk-P6UXDALK.js → chunk-RDHAGBEB.js} +3 -3
  94. package/dist/{chunk-XRE4JOEO.js → chunk-RTS23VIJ.js} +2 -2
  95. package/dist/{chunk-PYWW4KLO.js → chunk-SEQ2JI3Y.js} +9 -9
  96. package/dist/{chunk-VHEEU4ZO.js → chunk-SW56GSYC.js} +2 -2
  97. package/dist/{chunk-46YGCU6Z.js → chunk-T2EGAXPM.js} +2 -2
  98. package/dist/{chunk-LES2Z7B4.js → chunk-T45LAT2Y.js} +2 -2
  99. package/dist/{chunk-4NMFWOS2.js → chunk-T65UZXR6.js} +3 -3
  100. package/dist/{chunk-2N4MUSF3.js → chunk-TB5RNNJ4.js} +7 -7
  101. package/dist/chunk-TCIUO62Z.js +29 -0
  102. package/dist/chunk-TCIUO62Z.js.map +1 -0
  103. package/dist/chunk-THNJ3IKU.js +17 -0
  104. package/dist/chunk-THNJ3IKU.js.map +1 -0
  105. package/dist/{chunk-L4IRFTIF.js → chunk-TLJOJBZD.js} +3 -23
  106. package/dist/chunk-TLJOJBZD.js.map +1 -0
  107. package/dist/chunk-TQ3REHVF.js +95 -0
  108. package/dist/chunk-TQ3REHVF.js.map +1 -0
  109. package/dist/{chunk-NIA5VQ7G.js → chunk-TVRQ3RYH.js} +28 -9
  110. package/dist/chunk-TVRQ3RYH.js.map +1 -0
  111. package/dist/{chunk-6CNLU4TO.js → chunk-TYGW5TOR.js} +7 -7
  112. package/dist/{chunk-BLZRNHMG.js → chunk-U23JUUPX.js} +8 -1
  113. package/dist/{chunk-BLZRNHMG.js.map → chunk-U23JUUPX.js.map} +1 -1
  114. package/dist/{chunk-U5DWHU3S.js → chunk-U24XHXNK.js} +2 -2
  115. package/dist/chunk-ULIHDPKL.js +94 -0
  116. package/dist/chunk-ULIHDPKL.js.map +1 -0
  117. package/dist/chunk-UOEWDCUX.js +69 -0
  118. package/dist/chunk-UOEWDCUX.js.map +1 -0
  119. package/dist/{chunk-5A6TC3RQ.js → chunk-VAWY44JW.js} +8 -8
  120. package/dist/{chunk-5A6TC3RQ.js.map → chunk-VAWY44JW.js.map} +1 -1
  121. package/dist/{chunk-NTHKOFVL.js → chunk-VFRNWE5P.js} +52 -8
  122. package/dist/chunk-VFRNWE5P.js.map +1 -0
  123. package/dist/{chunk-4DZGZ7II.js → chunk-VMJ5URU7.js} +8 -8
  124. package/dist/chunk-VMJ5URU7.js.map +1 -0
  125. package/dist/{chunk-YDP2SA5K.js → chunk-VPCMJ5Z4.js} +5 -5
  126. package/dist/{chunk-ZAWD6O46.js → chunk-VRPBEOWU.js} +2 -2
  127. package/dist/{chunk-AY4P6PHN.js → chunk-VWGCJUTV.js} +2 -2
  128. package/dist/{chunk-IIK7W3AN.js → chunk-XJR3COJO.js} +5 -5
  129. package/dist/{chunk-ZD4D7UM6.js → chunk-XYYW64LB.js} +2 -2
  130. package/dist/{chunk-4NZCZUGL.js → chunk-YFF2RP3X.js} +2 -2
  131. package/dist/{chunk-WVIIJPTJ.js → chunk-Z3FZC5GV.js} +7 -7
  132. package/dist/{chunk-55HDKLI3.js → chunk-Z5PIUYNB.js} +8 -8
  133. package/dist/{chunk-ZRDYQZYH.js → chunk-Z7KI4WHR.js} +2 -2
  134. package/dist/chunk-ZKF6HH7V.js +120 -0
  135. package/dist/chunk-ZKF6HH7V.js.map +1 -0
  136. package/dist/{chunk-P6DN5QU7.js → chunk-ZKYMKF2S.js} +8 -8
  137. package/dist/{chunk-ADBMJDBW.js → chunk-ZPHDGUZZ.js} +445 -1077
  138. package/dist/chunk-ZPHDGUZZ.js.map +1 -0
  139. package/dist/{chunk-NMRKAGHE.js → chunk-ZROMNP7Q.js} +2 -2
  140. package/dist/classified/index.d.ts +4 -4
  141. package/dist/classified/index.js +3 -3
  142. package/dist/collection-facade-MKEBZDWW.js +39 -0
  143. package/dist/computed-BMMEFRFJ.js +11 -0
  144. package/dist/config-drift-KGM7ZRW4.js +24 -0
  145. package/dist/config-drift-KGM7ZRW4.js.map +1 -0
  146. package/dist/consent/index.d.ts +3 -3
  147. package/dist/consent/index.js +10 -7
  148. package/dist/consent/index.js.map +1 -1
  149. package/dist/crdt/index.d.ts +3 -3
  150. package/dist/delegation-BQNIEHZE.js +25 -0
  151. package/dist/derivations/index.d.ts +4 -4
  152. package/dist/derivations/index.js +12 -9
  153. package/dist/describe/index.d.ts +1 -1
  154. package/dist/{describe-0tiXAjoO.d.ts → describe-C6iHNlqJ.d.ts} +9 -0
  155. package/dist/{dev-unlock-B_s9DUWa.d.ts → dev-unlock-Cqd5Xv5J.d.ts} +1 -1
  156. package/dist/{enclave-IS7HZSQ7.js → enclave-YN6223OG.js} +21 -8
  157. package/dist/executor-CBTNU5VZ.js +9 -0
  158. package/dist/executor-DJHNSTIR.js +9 -0
  159. package/dist/executor-FGISLQIN.js +21 -0
  160. package/dist/export-accessible-P7SLRLK3.js +23 -0
  161. package/dist/extract-partition-RNVSFHAB.js +36 -0
  162. package/dist/{fanout-sidecar-DDKRG2MX.js → fanout-sidecar-WS22Q5WH.js} +12 -9
  163. package/dist/{fanout-sidecar-DDKRG2MX.js.map → fanout-sidecar-WS22Q5WH.js.map} +1 -1
  164. package/dist/fence-watcher-DHQ775JB.js +69 -0
  165. package/dist/fence-watcher-DHQ775JB.js.map +1 -0
  166. package/dist/find-RNBG7LBY.js +11 -0
  167. package/dist/forget/index.js +10 -7
  168. package/dist/forget/index.js.map +1 -1
  169. package/dist/guards/index.d.ts +4 -4
  170. package/dist/guards/index.js +3 -3
  171. package/dist/{hash-CWxn7sf6.d.ts → hash-D8Q5MJLA.d.ts} +1 -1
  172. package/dist/history/index.d.ts +4 -4
  173. package/dist/history/index.js +12 -9
  174. package/dist/history/index.js.map +1 -1
  175. package/dist/i18n/index.d.ts +3 -3
  176. package/dist/i18n/index.js +14 -11
  177. package/dist/i18n/index.js.map +1 -1
  178. package/dist/in/index.d.ts +2 -2
  179. package/dist/{index-D05bV0_g.d.ts → index-D4GQe1Rx.d.ts} +818 -49
  180. package/dist/{index-DTMUUwwW.d.ts → index-DRxk8q_7.d.ts} +3 -3
  181. package/dist/index.d.ts +46 -17
  182. package/dist/index.js +1021 -122
  183. package/dist/index.js.map +1 -1
  184. package/dist/indexing/index.d.ts +3 -3
  185. package/dist/indexing/index.js +4 -4
  186. package/dist/issue-W5QG53B5.js +19 -0
  187. package/dist/json-schema-I22JCYCG.js +44 -0
  188. package/dist/json-schema-I22JCYCG.js.map +1 -0
  189. package/dist/kernel/index.d.ts +3 -3
  190. package/dist/kernel/index.js +13 -10
  191. package/dist/lazy/index.d.ts +21 -0
  192. package/dist/lazy/index.js +12 -0
  193. package/dist/{ledger-YUAJUNFP.js → ledger-KZWBKAG5.js} +12 -9
  194. package/dist/liberate-GMGCHIND.js +24 -0
  195. package/dist/link-set-UQEIYQAM.js +31 -0
  196. package/dist/materialized-views/index.d.ts +4 -4
  197. package/dist/materialized-views/index.js +16 -13
  198. package/dist/{mime-magic-Qr_4HjP6.d.ts → mime-magic-DmwT7OzZ.d.ts} +1 -1
  199. package/dist/noydb-KS2O2MRI.js +60 -0
  200. package/dist/on/index.d.ts +2 -2
  201. package/dist/on/index.js +10 -7
  202. package/dist/overlay-views/index.d.ts +4 -4
  203. package/dist/overlay-views/index.js +4 -4
  204. package/dist/periods/index.d.ts +3 -3
  205. package/dist/periods/index.js +13 -10
  206. package/dist/pod/index.d.ts +3 -3
  207. package/dist/pod/index.js +12 -9
  208. package/dist/{policy-LRE6HTO5.js → policy-YIKUH4AD.js} +5 -5
  209. package/dist/portability/index.d.ts +3 -3
  210. package/dist/portability/index.js +8 -8
  211. package/dist/{public-envelope-WVRRUVAJ.js → public-envelope-MRN5YYZZ.js} +4 -4
  212. package/dist/query/index.d.ts +2 -2
  213. package/dist/query/index.js +6 -6
  214. package/dist/register-K6DDSIXN.js +21 -0
  215. package/dist/registry-IMNMHWTM.js +17 -0
  216. package/dist/registry-K6VUQXKV.js +19 -0
  217. package/dist/registry-ZVO3T4M5.js +9 -0
  218. package/dist/request-withdrawal-EHALV66Y.js +31 -0
  219. package/dist/request-withdrawal-EHALV66Y.js.map +1 -0
  220. package/dist/{reveal-WSUHXCSS.js → reveal-TBLTFWQ2.js} +6 -5
  221. package/dist/{reveal-WSUHXCSS.js.map → reveal-TBLTFWQ2.js.map} +1 -1
  222. package/dist/revoke-MHAUAESM.js +24 -0
  223. package/dist/revoke-MHAUAESM.js.map +1 -0
  224. package/dist/sealed-record/index.d.ts +3 -3
  225. package/dist/sealed-record/index.js +13 -10
  226. package/dist/sealed-record/index.js.map +1 -1
  227. package/dist/session/index.d.ts +4 -4
  228. package/dist/session/index.js +10 -7
  229. package/dist/session/index.js.map +1 -1
  230. package/dist/shadow/index.d.ts +3 -3
  231. package/dist/shadow/index.js +2 -2
  232. package/dist/signer-PQ74YXRY.js +25 -0
  233. package/dist/signer-PQ74YXRY.js.map +1 -0
  234. package/dist/snapshots/index.d.ts +3 -3
  235. package/dist/snapshots/index.js +11 -8
  236. package/dist/snapshots/index.js.map +1 -1
  237. package/dist/{stale-LX4BR43V.js → stale-7Q62KVI3.js} +2 -2
  238. package/dist/stale-7Q62KVI3.js.map +1 -0
  239. package/dist/storage-5E6YB2JY.js +21 -0
  240. package/dist/storage-5E6YB2JY.js.map +1 -0
  241. package/dist/{store-coordination-provider-KTRIC6PR.js → store-coordination-provider-JJCEMTAE.js} +3 -3
  242. package/dist/sync/index.d.ts +2 -2
  243. package/dist/sync/index.js +10 -7
  244. package/dist/sync/index.js.map +1 -1
  245. package/dist/team/index.d.ts +18 -4
  246. package/dist/team/index.js +24 -14
  247. package/dist/tiers/index.d.ts +2 -2
  248. package/dist/tiers/index.js +11 -8
  249. package/dist/to/index.d.ts +2 -2
  250. package/dist/to/index.js +1 -1
  251. package/dist/{transition-guard-C1Pyz8nH.d.ts → transition-guard-C4hvR-Ac.d.ts} +1 -1
  252. package/dist/tx/index.d.ts +3 -3
  253. package/dist/tx/index.js +3 -3
  254. package/dist/ui/index.d.ts +1 -1
  255. package/dist/util/index.js +1 -1
  256. package/dist/validators-Ctgkj5qd.d.ts +101 -0
  257. package/dist/{vault-diff-Fn0WeY2w.d.ts → vault-diff-B1Ir6EGs.d.ts} +1 -1
  258. package/dist/{verify-SW6J63Q2.js → verify-YB5LQHNA.js} +11 -7
  259. package/dist/{verify-SW6J63Q2.js.map → verify-YB5LQHNA.js.map} +1 -1
  260. package/dist/walk-5C3GPKT2.js +241 -0
  261. package/dist/walk-5C3GPKT2.js.map +1 -0
  262. package/dist/with/index.d.ts +3 -3
  263. package/dist/with/index.js +12 -9
  264. package/dist/{with-materialized-view-NKxs6iK5.d.ts → with-materialized-view-Bp65kKdQ.d.ts} +1 -1
  265. package/dist/{with-overlayed-view-B4fPYHwV.d.ts → with-overlayed-view-BRhdQNrK.d.ts} +1 -1
  266. package/dist/{with-rollup-Bl0sRFEt.d.ts → with-rollup-bQRPc3y1.d.ts} +1 -1
  267. package/dist/withdraw-accessible-JMX2TCPX.js +28 -0
  268. package/dist/withdraw-accessible-JMX2TCPX.js.map +1 -0
  269. package/package.json +7 -3
  270. package/dist/api-LORZ2EZU.js +0 -17
  271. package/dist/chunk-4DZGZ7II.js.map +0 -1
  272. package/dist/chunk-5EZAJEES.js.map +0 -1
  273. package/dist/chunk-ADBMJDBW.js.map +0 -1
  274. package/dist/chunk-CPAROOKP.js.map +0 -1
  275. package/dist/chunk-L4IRFTIF.js.map +0 -1
  276. package/dist/chunk-MIOLJG2R.js.map +0 -1
  277. package/dist/chunk-N2FP26NH.js.map +0 -1
  278. package/dist/chunk-NIA5VQ7G.js.map +0 -1
  279. package/dist/chunk-NPVICKZE.js.map +0 -1
  280. package/dist/chunk-NTHKOFVL.js.map +0 -1
  281. package/dist/chunk-OCDUQUAP.js.map +0 -1
  282. package/dist/chunk-OVIVYAQL.js.map +0 -1
  283. package/dist/chunk-QLQS5A7X.js +0 -524
  284. package/dist/chunk-QLQS5A7X.js.map +0 -1
  285. package/dist/chunk-Z44OY24N.js.map +0 -1
  286. package/dist/chunk-ZFME46HJ.js.map +0 -1
  287. package/dist/collection-facade-XPVRHBGU.js +0 -36
  288. package/dist/delegation-4HUHUE6T.js +0 -22
  289. package/dist/executor-ANFBCOYA.js +0 -9
  290. package/dist/executor-IKT47SH2.js +0 -9
  291. package/dist/executor-OIECZXTV.js +0 -18
  292. package/dist/export-accessible-NZWCFZHL.js +0 -20
  293. package/dist/extract-partition-52LX6RQH.js +0 -33
  294. package/dist/issue-F4SYPJGJ.js +0 -16
  295. package/dist/liberate-6LDETRIW.js +0 -21
  296. package/dist/noydb-WQNBVJIG.js +0 -54
  297. package/dist/registry-6HZ2JSQ7.js +0 -14
  298. package/dist/registry-GPXZQ7DT.js +0 -9
  299. package/dist/registry-USYD2ECC.js +0 -16
  300. package/dist/request-withdrawal-54V4L6CR.js +0 -28
  301. package/dist/revoke-JV26NTQD.js +0 -21
  302. package/dist/signer-AE56T5HE.js +0 -22
  303. package/dist/validators-Dzn7T-3x.d.ts +0 -62
  304. package/dist/withdraw-accessible-DGA4V2TP.js +0 -25
  305. /package/dist/{api-LORZ2EZU.js.map → api-JOXUNSKP.js.map} +0 -0
  306. /package/dist/{chunk-VBYVKOMJ.js.map → chunk-3QRQOBS7.js.map} +0 -0
  307. /package/dist/{chunk-JFYIHLU3.js.map → chunk-3Y4QLJ6K.js.map} +0 -0
  308. /package/dist/{chunk-BZIWKN74.js.map → chunk-43ISXURO.js.map} +0 -0
  309. /package/dist/{chunk-7IP75FP2.js.map → chunk-4K3MQ5S3.js.map} +0 -0
  310. /package/dist/{chunk-6DP5HBQD.js.map → chunk-5CY35H55.js.map} +0 -0
  311. /package/dist/{chunk-2KSPDSWI.js.map → chunk-5MRE3C4Q.js.map} +0 -0
  312. /package/dist/{chunk-5ZPWVNL3.js.map → chunk-5W7AOFWA.js.map} +0 -0
  313. /package/dist/{chunk-PUNJAEY6.js.map → chunk-6HNKCKFZ.js.map} +0 -0
  314. /package/dist/{chunk-PJDK2PPQ.js.map → chunk-6RXPSMKR.js.map} +0 -0
  315. /package/dist/{chunk-MCJAUQGE.js.map → chunk-A5DYVMDR.js.map} +0 -0
  316. /package/dist/{chunk-TICO2I2O.js.map → chunk-BKGIWGCX.js.map} +0 -0
  317. /package/dist/{chunk-O5DNEXQC.js.map → chunk-BMQOH7MM.js.map} +0 -0
  318. /package/dist/{chunk-U6OM4E67.js.map → chunk-CPXPHQGX.js.map} +0 -0
  319. /package/dist/{chunk-3UDPDRUC.js.map → chunk-EWR7HL3K.js.map} +0 -0
  320. /package/dist/{chunk-CVXLJIAV.js.map → chunk-FH52CDEW.js.map} +0 -0
  321. /package/dist/{chunk-FELHYKIO.js.map → chunk-G7RDYYTE.js.map} +0 -0
  322. /package/dist/{chunk-UP6EMMDI.js.map → chunk-GOUNIHFA.js.map} +0 -0
  323. /package/dist/{chunk-DHIN36UC.js.map → chunk-GQOT6QJR.js.map} +0 -0
  324. /package/dist/{chunk-DGUR3CC4.js.map → chunk-GXGK22QU.js.map} +0 -0
  325. /package/dist/{chunk-YTIAXSUE.js.map → chunk-GZZL5R73.js.map} +0 -0
  326. /package/dist/{chunk-E4YJUNPU.js.map → chunk-H5XRIJX3.js.map} +0 -0
  327. /package/dist/{chunk-DA34OEZU.js.map → chunk-H7RYPVMJ.js.map} +0 -0
  328. /package/dist/{chunk-2ZORB5RW.js.map → chunk-HBKDR7R3.js.map} +0 -0
  329. /package/dist/{chunk-BV7KNFJY.js.map → chunk-HLUKZ36Q.js.map} +0 -0
  330. /package/dist/{chunk-ZNI3RTFV.js.map → chunk-HMXLN43G.js.map} +0 -0
  331. /package/dist/{chunk-BYW7EU5L.js.map → chunk-HY6ZGGEC.js.map} +0 -0
  332. /package/dist/{chunk-5Z3RNFJC.js.map → chunk-LIP6JWYK.js.map} +0 -0
  333. /package/dist/{chunk-IJW6K6UX.js.map → chunk-LPRPVCNY.js.map} +0 -0
  334. /package/dist/{chunk-6EVZXETK.js.map → chunk-M66NAZA4.js.map} +0 -0
  335. /package/dist/{chunk-HGQG3VIP.js.map → chunk-N5YVZHCB.js.map} +0 -0
  336. /package/dist/{chunk-IWVWB7BZ.js.map → chunk-NB47TXGP.js.map} +0 -0
  337. /package/dist/{chunk-6OQ7NKMZ.js.map → chunk-O2DB4C3M.js.map} +0 -0
  338. /package/dist/{chunk-LHYQE3BP.js.map → chunk-OFBFAVLI.js.map} +0 -0
  339. /package/dist/{chunk-6I2YPLAG.js.map → chunk-P27Z66EB.js.map} +0 -0
  340. /package/dist/{chunk-7MHVHGQZ.js.map → chunk-P2LDXRGP.js.map} +0 -0
  341. /package/dist/{chunk-6RASM2J4.js.map → chunk-QKVILR7N.js.map} +0 -0
  342. /package/dist/{chunk-LKBLAUOB.js.map → chunk-QNTEDPWP.js.map} +0 -0
  343. /package/dist/{chunk-P6UXDALK.js.map → chunk-RDHAGBEB.js.map} +0 -0
  344. /package/dist/{chunk-XRE4JOEO.js.map → chunk-RTS23VIJ.js.map} +0 -0
  345. /package/dist/{chunk-PYWW4KLO.js.map → chunk-SEQ2JI3Y.js.map} +0 -0
  346. /package/dist/{chunk-VHEEU4ZO.js.map → chunk-SW56GSYC.js.map} +0 -0
  347. /package/dist/{chunk-46YGCU6Z.js.map → chunk-T2EGAXPM.js.map} +0 -0
  348. /package/dist/{chunk-LES2Z7B4.js.map → chunk-T45LAT2Y.js.map} +0 -0
  349. /package/dist/{chunk-4NMFWOS2.js.map → chunk-T65UZXR6.js.map} +0 -0
  350. /package/dist/{chunk-2N4MUSF3.js.map → chunk-TB5RNNJ4.js.map} +0 -0
  351. /package/dist/{chunk-6CNLU4TO.js.map → chunk-TYGW5TOR.js.map} +0 -0
  352. /package/dist/{chunk-U5DWHU3S.js.map → chunk-U24XHXNK.js.map} +0 -0
  353. /package/dist/{chunk-YDP2SA5K.js.map → chunk-VPCMJ5Z4.js.map} +0 -0
  354. /package/dist/{chunk-ZAWD6O46.js.map → chunk-VRPBEOWU.js.map} +0 -0
  355. /package/dist/{chunk-AY4P6PHN.js.map → chunk-VWGCJUTV.js.map} +0 -0
  356. /package/dist/{chunk-IIK7W3AN.js.map → chunk-XJR3COJO.js.map} +0 -0
  357. /package/dist/{chunk-ZD4D7UM6.js.map → chunk-XYYW64LB.js.map} +0 -0
  358. /package/dist/{chunk-4NZCZUGL.js.map → chunk-YFF2RP3X.js.map} +0 -0
  359. /package/dist/{chunk-WVIIJPTJ.js.map → chunk-Z3FZC5GV.js.map} +0 -0
  360. /package/dist/{chunk-55HDKLI3.js.map → chunk-Z5PIUYNB.js.map} +0 -0
  361. /package/dist/{chunk-ZRDYQZYH.js.map → chunk-Z7KI4WHR.js.map} +0 -0
  362. /package/dist/{chunk-P6DN5QU7.js.map → chunk-ZKYMKF2S.js.map} +0 -0
  363. /package/dist/{chunk-NMRKAGHE.js.map → chunk-ZROMNP7Q.js.map} +0 -0
  364. /package/dist/{collection-facade-XPVRHBGU.js.map → collection-facade-MKEBZDWW.js.map} +0 -0
  365. /package/dist/{delegation-4HUHUE6T.js.map → computed-BMMEFRFJ.js.map} +0 -0
  366. /package/dist/{enclave-IS7HZSQ7.js.map → delegation-BQNIEHZE.js.map} +0 -0
  367. /package/dist/{executor-ANFBCOYA.js.map → enclave-YN6223OG.js.map} +0 -0
  368. /package/dist/{executor-IKT47SH2.js.map → executor-CBTNU5VZ.js.map} +0 -0
  369. /package/dist/{executor-OIECZXTV.js.map → executor-DJHNSTIR.js.map} +0 -0
  370. /package/dist/{export-accessible-NZWCFZHL.js.map → executor-FGISLQIN.js.map} +0 -0
  371. /package/dist/{extract-partition-52LX6RQH.js.map → export-accessible-P7SLRLK3.js.map} +0 -0
  372. /package/dist/{issue-F4SYPJGJ.js.map → extract-partition-RNVSFHAB.js.map} +0 -0
  373. /package/dist/{ledger-YUAJUNFP.js.map → find-RNBG7LBY.js.map} +0 -0
  374. /package/dist/{liberate-6LDETRIW.js.map → issue-W5QG53B5.js.map} +0 -0
  375. /package/dist/{noydb-WQNBVJIG.js.map → lazy/index.js.map} +0 -0
  376. /package/dist/{policy-LRE6HTO5.js.map → ledger-KZWBKAG5.js.map} +0 -0
  377. /package/dist/{public-envelope-WVRRUVAJ.js.map → liberate-GMGCHIND.js.map} +0 -0
  378. /package/dist/{registry-6HZ2JSQ7.js.map → link-set-UQEIYQAM.js.map} +0 -0
  379. /package/dist/{registry-GPXZQ7DT.js.map → noydb-KS2O2MRI.js.map} +0 -0
  380. /package/dist/{registry-USYD2ECC.js.map → policy-YIKUH4AD.js.map} +0 -0
  381. /package/dist/{request-withdrawal-54V4L6CR.js.map → public-envelope-MRN5YYZZ.js.map} +0 -0
  382. /package/dist/{revoke-JV26NTQD.js.map → register-K6DDSIXN.js.map} +0 -0
  383. /package/dist/{signer-AE56T5HE.js.map → registry-IMNMHWTM.js.map} +0 -0
  384. /package/dist/{stale-LX4BR43V.js.map → registry-K6VUQXKV.js.map} +0 -0
  385. /package/dist/{withdraw-accessible-DGA4V2TP.js.map → registry-ZVO3T4M5.js.map} +0 -0
  386. /package/dist/{store-coordination-provider-KTRIC6PR.js.map → store-coordination-provider-JJCEMTAE.js.map} +0 -0
@@ -1,22 +1,35 @@
1
1
  import {
2
- loadVaultPolicy
3
- } from "./chunk-LES2Z7B4.js";
2
+ jsonSchemaToFields
3
+ } from "./chunk-TQ3REHVF.js";
4
4
  import {
5
5
  NO_SEQUENCE,
6
6
  SEQUENCE_COLLECTION,
7
7
  compileSequenceFormat,
8
8
  resolveSequenceKey
9
- } from "./chunk-6I2YPLAG.js";
9
+ } from "./chunk-P27Z66EB.js";
10
+ import {
11
+ loadVaultPolicy
12
+ } from "./chunk-T45LAT2Y.js";
13
+ import {
14
+ LinkIntegrityError,
15
+ isLinkCollectionName,
16
+ linkCollectionName,
17
+ linkRowKey
18
+ } from "./chunk-P3NGV5RV.js";
19
+ import {
20
+ derivePersistedSchema,
21
+ isZod4Schema
22
+ } from "./chunk-ULIHDPKL.js";
10
23
  import {
11
24
  loadFence
12
- } from "./chunk-4NZCZUGL.js";
25
+ } from "./chunk-YFF2RP3X.js";
13
26
  import {
14
27
  InvertedIndex,
15
28
  MemoryIndexStore,
16
29
  NO_SEARCH,
17
30
  VectorSet,
18
31
  buildPersistedIndexCallbacks
19
- } from "./chunk-UP6EMMDI.js";
32
+ } from "./chunk-GOUNIHFA.js";
20
33
  import {
21
34
  ServiceBus,
22
35
  WriteHookRegistry,
@@ -24,63 +37,65 @@ import {
24
37
  assertCanImport,
25
38
  canExport,
26
39
  canImport
27
- } from "./chunk-YN66UOXT.js";
40
+ } from "./chunk-P3V7JTB6.js";
28
41
  import {
29
42
  NO_ATTESTATION
30
- } from "./chunk-ZRDYQZYH.js";
43
+ } from "./chunk-Z7KI4WHR.js";
31
44
  import {
32
45
  NO_CLASSIFIED,
33
46
  enforceClassifiedWrite,
34
47
  resolveClassifiedFields
35
- } from "./chunk-MIOLJG2R.js";
48
+ } from "./chunk-AF5ZRTZ4.js";
36
49
  import {
37
50
  NO_TIERS,
38
51
  classifySealedShred
39
- } from "./chunk-4DZGZ7II.js";
52
+ } from "./chunk-VMJ5URU7.js";
40
53
  import {
41
54
  NO_PORTABILITY
42
- } from "./chunk-HGQG3VIP.js";
55
+ } from "./chunk-N5YVZHCB.js";
43
56
  import {
44
57
  CustodyApi,
45
58
  NO_CARGO,
46
59
  NO_CUSTODY
47
- } from "./chunk-Z44OY24N.js";
60
+ } from "./chunk-7J7JRYXW.js";
48
61
  import {
49
62
  runDrainBarrier
50
- } from "./chunk-JFYIHLU3.js";
63
+ } from "./chunk-3Y4QLJ6K.js";
64
+ import {
65
+ PERIODS_COLLECTION
66
+ } from "./chunk-GZZL5R73.js";
51
67
  import {
52
68
  TxContext,
53
69
  revertExecuted
54
- } from "./chunk-4NMFWOS2.js";
70
+ } from "./chunk-T65UZXR6.js";
55
71
  import {
56
72
  OverlayedCollection
57
- } from "./chunk-NMRKAGHE.js";
73
+ } from "./chunk-ZROMNP7Q.js";
58
74
  import {
59
75
  EXPORT_AUDIT_COLLECTION,
60
76
  createExportBlobsHandle,
61
77
  runCompaction
62
- } from "./chunk-2KSPDSWI.js";
78
+ } from "./chunk-5MRE3C4Q.js";
63
79
  import {
64
80
  LazyQuery,
65
81
  decodeIdxId,
66
82
  encodeIdxId
67
- } from "./chunk-LKBLAUOB.js";
83
+ } from "./chunk-QNTEDPWP.js";
68
84
  import {
69
- loadPersistedSchema,
70
- savePersistedSchema
71
- } from "./chunk-U6OM4E67.js";
85
+ IMPLICIT_LAZY,
86
+ Lru,
87
+ estimateRecordBytes
88
+ } from "./chunk-NO272T7Q.js";
72
89
  import {
73
90
  resolveManagedSecret,
74
91
  saveSealedPassphrase
75
- } from "./chunk-AY4P6PHN.js";
76
- import {
77
- PERIODS_COLLECTION
78
- } from "./chunk-YTIAXSUE.js";
92
+ } from "./chunk-VWGCJUTV.js";
79
93
  import {
80
94
  isDictCollectionName,
81
95
  isStaticDictDescriptor
82
- } from "./chunk-PYWW4KLO.js";
96
+ } from "./chunk-SEQ2JI3Y.js";
83
97
  import {
98
+ NO_TEAM,
84
99
  enrollAuthenticator,
85
100
  findAuthenticator,
86
101
  recoverPassphrase,
@@ -89,7 +104,7 @@ import {
89
104
  rotatePassphrase,
90
105
  updateAuthenticator,
91
106
  writeMagicLinkGrant
92
- } from "./chunk-OVIVYAQL.js";
107
+ } from "./chunk-K5P46KB3.js";
93
108
  import {
94
109
  hasRecoveryEnrolled,
95
110
  hasStrongRecoveryEnrolled,
@@ -99,7 +114,7 @@ import {
99
114
  mintShamirRecoveryEntry,
100
115
  savePaperRecoveryEntries,
101
116
  saveShamirRecoveryEntries
102
- } from "./chunk-IJW6K6UX.js";
117
+ } from "./chunk-LPRPVCNY.js";
103
118
  import {
104
119
  INDEXED_STORE_POLICY
105
120
  } from "./chunk-VQNJ7UZL.js";
@@ -109,25 +124,22 @@ import {
109
124
  changeSecret,
110
125
  createOwnerKeyring,
111
126
  ensureCollectionDEK,
112
- grant,
113
127
  hasAccess,
114
128
  hasWritePermission,
115
129
  listUsers,
116
130
  loadKeyring,
117
- revoke,
118
- rotateKeys,
119
131
  updateKeyringIdentity
120
- } from "./chunk-5A6TC3RQ.js";
132
+ } from "./chunk-VAWY44JW.js";
121
133
  import {
122
134
  persistDirectoryConfig,
123
135
  readDirectoryConfig
124
- } from "./chunk-2N4MUSF3.js";
136
+ } from "./chunk-TB5RNNJ4.js";
125
137
  import {
126
138
  generateULID
127
139
  } from "./chunk-ZJADGNYF.js";
128
140
  import {
129
- sha256Hex as sha256Hex2
130
- } from "./chunk-6EVZXETK.js";
141
+ sha256Hex
142
+ } from "./chunk-M66NAZA4.js";
131
143
  import {
132
144
  NO_FORGET,
133
145
  addSubjectRef,
@@ -136,10 +148,10 @@ import {
136
148
  readDottedPath,
137
149
  rebuildSubjectIndex,
138
150
  removeSubjectRef
139
- } from "./chunk-6OQ7NKMZ.js";
151
+ } from "./chunk-O2DB4C3M.js";
140
152
  import {
141
153
  NO_SEALED_RECORD
142
- } from "./chunk-FELHYKIO.js";
154
+ } from "./chunk-G7RDYYTE.js";
143
155
  import {
144
156
  RecordCodec,
145
157
  SEALED_CEK_NS,
@@ -149,40 +161,35 @@ import {
149
161
  queryByDet,
150
162
  resolveStableCek,
151
163
  validateSchemaInput
152
- } from "./chunk-5EZAJEES.js";
164
+ } from "./chunk-OVO2RZAE.js";
153
165
  import {
154
166
  buildTombstone,
155
167
  isTombstone
156
- } from "./chunk-6RASM2J4.js";
157
- import {
158
- encrypt,
159
- sha256Hex
160
- } from "./chunk-L4IRFTIF.js";
168
+ } from "./chunk-QKVILR7N.js";
161
169
  import {
162
170
  NOYDB_FORMAT_VERSION
163
- } from "./chunk-OCDUQUAP.js";
171
+ } from "./chunk-LN22XH4B.js";
172
+ import {
173
+ encrypt
174
+ } from "./chunk-TLJOJBZD.js";
164
175
  import {
165
176
  NO_AGGREGATE,
166
177
  Query,
167
- ScanBuilder,
168
- canonicalizeIncomingMoney,
169
- canonicalizeStoredMoney,
170
- decodeMoneyFields,
171
- quantizeMoneyFields,
172
- validateMoneyFieldPaths
173
- } from "./chunk-N2FP26NH.js";
178
+ ScanBuilder
179
+ } from "./chunk-GBTUANXF.js";
174
180
  import {
175
181
  canonicalGroupKey
176
- } from "./chunk-NPVICKZE.js";
182
+ } from "./chunk-P5WXDYMD.js";
177
183
  import {
184
+ moneyRuntime,
178
185
  readPath
179
- } from "./chunk-QLQS5A7X.js";
186
+ } from "./chunk-ZKF6HH7V.js";
180
187
  import {
181
188
  getAtPath,
182
189
  resolvePolicy,
183
190
  setAtPathInPlace,
184
191
  stripI18nFilled
185
- } from "./chunk-7IP75FP2.js";
192
+ } from "./chunk-4K3MQ5S3.js";
186
193
  import {
187
194
  AlreadyElevatedError,
188
195
  AttestationError,
@@ -219,11 +226,11 @@ import {
219
226
  UnknownDictCodeError,
220
227
  UnsupportedIndexOptionError,
221
228
  ValidationError
222
- } from "./chunk-BLZRNHMG.js";
229
+ } from "./chunk-U23JUUPX.js";
223
230
 
224
231
  // src/port/by/default-provider.ts
225
232
  async function createDefaultCoordinationProvider(store) {
226
- const { StoreCoordinationProvider } = await import("./store-coordination-provider-KTRIC6PR.js");
233
+ const { StoreCoordinationProvider } = await import("./store-coordination-provider-JJCEMTAE.js");
227
234
  return new StoreCoordinationProvider(store);
228
235
  }
229
236
 
@@ -237,6 +244,21 @@ function guardClassifiedCompat(collection, byField, ctx) {
237
244
  "digest-only/recoverable classified fields cannot combine with a crdt mode or a conflictPolicy resolver \u2014 merge paths bypass write enforcement (R2)"
238
245
  );
239
246
  }
247
+ for (const [f, spec] of Object.entries(byField)) {
248
+ if (spec.equatable === true && spec.storage !== "digest-only") {
249
+ throw new ClassifiedConfigError(
250
+ collection,
251
+ `field "${f}" declares equatable but storage is '${spec.storage}' \u2014 equatable is a digest-only knob; recoverable equality is _det's job (R7)`
252
+ );
253
+ }
254
+ }
255
+ const hasEquatable = Object.values(byField).some((s) => s.equatable === true);
256
+ if (hasEquatable && ctx.acknowledgeEquatableRisk !== true) {
257
+ throw new ClassifiedConfigError(
258
+ collection,
259
+ `classified equatable fields require \`acknowledgeEquatableRisk: true\` \u2014 equal values produce equal store-visible index tags (a partition leak a DEK holder can offline-dictionary at the PBKDF2 floor); the door is the real control for low-entropy fields (R8)`
260
+ );
261
+ }
240
262
  if (digestOnly.length === 0) return;
241
263
  if (!ctx.storeCiphertext) {
242
264
  throw new ClassifiedConfigError(
@@ -279,34 +301,6 @@ function guardClassifiedCompat(collection, byField, ctx) {
279
301
  }
280
302
  }
281
303
 
282
- // src/with-formula/computed/index.ts
283
- var ComputedFieldError = class extends NoydbError {
284
- constructor(field, id, cause) {
285
- super(
286
- "COMPUTED_FIELD",
287
- `computed field "${field}" threw for record "${id}": ` + (cause instanceof Error ? cause.message : String(cause))
288
- );
289
- this.field = field;
290
- this.id = id;
291
- this.cause = cause;
292
- this.name = "ComputedFieldError";
293
- }
294
- field;
295
- id;
296
- cause;
297
- };
298
- function evalComputedFields(record, computed, id) {
299
- const out = { ...record };
300
- for (const [field, fn] of Object.entries(computed)) {
301
- try {
302
- out[field] = fn(out);
303
- } catch (cause) {
304
- throw new ComputedFieldError(field, id, cause);
305
- }
306
- }
307
- return out;
308
- }
309
-
310
304
  // src/with-lookup/indexing/collection-facade.ts
311
305
  function readPersistedValue(record, field) {
312
306
  if (!field.includes(".")) return record[field];
@@ -561,89 +555,6 @@ async function purgePersistedIndexes(ctx, id) {
561
555
  return { purged, residue };
562
556
  }
563
557
 
564
- // src/with-shape/persisted-schemas/canonicalize.ts
565
- function canonicalize(value) {
566
- if (value === null || typeof value !== "object") {
567
- return JSON.stringify(value);
568
- }
569
- if (Array.isArray(value)) {
570
- return "[" + value.map(canonicalize).join(",") + "]";
571
- }
572
- const obj = value;
573
- const keys = Object.keys(obj).sort();
574
- const parts = keys.map((k) => JSON.stringify(k) + ":" + canonicalize(obj[k]));
575
- return "{" + parts.join(",") + "}";
576
- }
577
-
578
- // src/with-shape/persisted-schemas/derive.ts
579
- function isZodSchema(value) {
580
- if (value === null || typeof value !== "object") return false;
581
- const std = value["~standard"];
582
- if (std && typeof std === "object" && std.vendor === "zod") return true;
583
- const def = value._def;
584
- if (!def || typeof def !== "object") return false;
585
- return typeof def.typeName === "string" && def.typeName.startsWith("Zod");
586
- }
587
- function detectKind(validator) {
588
- if (isZodSchema(validator)) return "Zod";
589
- return "Unknown";
590
- }
591
- function isZod4Schema(value) {
592
- if (value === null || typeof value !== "object") return false;
593
- return "_zod" in value;
594
- }
595
- async function loadZodToJsonSchemaConverter() {
596
- try {
597
- const mod = await import("zod-to-json-schema");
598
- if (!mod.zodToJsonSchema) {
599
- throw new Error("zod-to-json-schema export missing");
600
- }
601
- return mod.zodToJsonSchema;
602
- } catch (err) {
603
- throw new Error(
604
- `persistJsonSchema requires the optional peer-dep \`zod-to-json-schema\`. Install it: \`pnpm add zod-to-json-schema\` (or npm/yarn equivalent). Original error: ${err instanceof Error ? err.message : String(err)}`
605
- );
606
- }
607
- }
608
- async function loadZodV4Converter() {
609
- try {
610
- const mod = await import("./zod-HAJM7LMS.js");
611
- if (typeof mod.toJSONSchema !== "function") {
612
- throw new Error("zod.toJSONSchema not available (zod v4 required)");
613
- }
614
- return mod.toJSONSchema;
615
- } catch (err) {
616
- throw new Error(
617
- `persistJsonSchema with a Zod v4 schema requires zod@4 with toJSONSchema. Original error: ${err instanceof Error ? err.message : String(err)}`
618
- );
619
- }
620
- }
621
- async function derivePersistedSchema(validator) {
622
- const kind = detectKind(validator);
623
- const derivedAt = (/* @__PURE__ */ new Date()).toISOString();
624
- if (kind === "Zod") {
625
- let jsonSchema;
626
- if (isZod4Schema(validator)) {
627
- const convert = await loadZodV4Converter();
628
- jsonSchema = convert(validator);
629
- } else {
630
- const convert = await loadZodToJsonSchemaConverter();
631
- jsonSchema = convert(validator);
632
- }
633
- const canonical = canonicalize(jsonSchema);
634
- const hash = await sha256Hex(new TextEncoder().encode(canonical));
635
- return { _noydb_schema: 1, kind, jsonSchema, hash, derivedAt };
636
- }
637
- return {
638
- _noydb_schema: 1,
639
- kind,
640
- jsonSchema: null,
641
- hash: null,
642
- reason: `derivation not yet supported for kind=${kind} (v0 supports Zod only)`,
643
- derivedAt
644
- };
645
- }
646
-
647
558
  // src/with-lookup/indexing/strategy.ts
648
559
  var NO_INDEXING = {
649
560
  createState() {
@@ -889,97 +800,6 @@ function resolveFieldMeta(key, inputs) {
889
800
  };
890
801
  }
891
802
 
892
- // src/with-shape/introspection/fields.ts
893
- function jsonSchemaType(node) {
894
- if (Array.isArray(node.type)) {
895
- const non = node.type.filter((t) => t !== "null");
896
- return non[0] ?? "opaque";
897
- }
898
- if (node.enum && Array.isArray(node.enum)) return "enum";
899
- if (node.const !== void 0) return "enum";
900
- if (typeof node.type === "string") return node.type;
901
- return "opaque";
902
- }
903
- function constraintsFor(node) {
904
- const out = {};
905
- if (node.enum) out.values = node.enum;
906
- if (node.const !== void 0) out.values = [node.const];
907
- if (node.minLength !== void 0) out.minLength = node.minLength;
908
- if (node.maxLength !== void 0) out.maxLength = node.maxLength;
909
- if (node.pattern !== void 0) out.pattern = node.pattern;
910
- if (node.format !== void 0) out.format = node.format;
911
- if (node.minimum !== void 0) out.minimum = node.minimum;
912
- if (node.maximum !== void 0) out.maximum = node.maximum;
913
- if (node.exclusiveMinimum !== void 0) out.gt = node.exclusiveMinimum;
914
- if (node.exclusiveMaximum !== void 0) out.lt = node.exclusiveMaximum;
915
- return Object.keys(out).length === 0 ? void 0 : out;
916
- }
917
- function extractObjectFields(obj, source, refs) {
918
- const required = new Set(Array.isArray(obj.required) ? obj.required : []);
919
- const fields = {};
920
- if (!obj.properties || typeof obj.properties !== "object") return { fields, required };
921
- for (const [name, node] of Object.entries(obj.properties)) {
922
- const descriptor = {
923
- type: jsonSchemaType(node),
924
- source,
925
- ...required.has(name) ? {} : { optional: true },
926
- ...refs?.[name] ? { references: `${refs[name].target}.id` } : {}
927
- };
928
- const constraints = constraintsFor(node);
929
- if (constraints) descriptor.constraints = constraints;
930
- fields[name] = descriptor;
931
- }
932
- return { fields, required };
933
- }
934
- function mergeUnionMembers(members, source, refs) {
935
- if (members.length === 0) return {};
936
- const extracted = members.filter((m) => m.properties && typeof m.properties === "object").map((m) => extractObjectFields(m, source, refs));
937
- if (extracted.length === 0) return {};
938
- const allNames = /* @__PURE__ */ new Set();
939
- for (const { fields } of extracted) {
940
- for (const name of Object.keys(fields)) allNames.add(name);
941
- }
942
- const memberCount = extracted.length;
943
- const out = {};
944
- for (const name of allNames) {
945
- const presentIn = extracted.filter(({ fields }) => name in fields);
946
- const requiredInAll = presentIn.length === memberCount && presentIn.every(({ required }) => required.has(name));
947
- const base = presentIn[0].fields[name];
948
- const allValues = [];
949
- for (const { fields } of presentIn) {
950
- const fd = fields[name];
951
- if (fd?.constraints?.values && Array.isArray(fd.constraints.values)) {
952
- for (const v of fd.constraints.values) {
953
- if (!allValues.includes(v)) allValues.push(v);
954
- }
955
- }
956
- }
957
- const mergedConstraints = allValues.length > 0 ? { ...base.constraints ?? {}, values: allValues } : base.constraints;
958
- const descriptor = {
959
- type: base.type,
960
- source,
961
- ...requiredInAll ? {} : { optional: true },
962
- ...base.references ? { references: base.references } : {}
963
- };
964
- if (mergedConstraints) {
965
- descriptor.constraints = mergedConstraints;
966
- }
967
- out[name] = descriptor;
968
- }
969
- return out;
970
- }
971
- function jsonSchemaToFields(jsonSchema, source, refs) {
972
- if (!jsonSchema || typeof jsonSchema !== "object") return {};
973
- const root = jsonSchema;
974
- const unionMembers = root.anyOf ?? root.oneOf;
975
- if (Array.isArray(unionMembers) && unionMembers.length > 0) {
976
- return mergeUnionMembers(unionMembers, source, refs);
977
- }
978
- if (!root.properties || typeof root.properties !== "object") return {};
979
- const { fields } = extractObjectFields(root, source, refs);
980
- return fields;
981
- }
982
-
983
803
  // src/with-shape/introspection/describe.ts
984
804
  var ZOD_META_KEYS = /* @__PURE__ */ new Set([
985
805
  "label",
@@ -1185,7 +1005,8 @@ function buildDescription(input) {
1185
1005
  classified: {
1186
1006
  preset: cls.preset,
1187
1007
  storage: cls.storage,
1188
- list: cls.list.kind === "omit" ? "omit" : cls.list.kind === "mask" ? { mask: cls.list.pattern } : { rider: cls.list.rider }
1008
+ list: cls.list.kind === "omit" ? "omit" : cls.list.kind === "mask" ? { mask: cls.list.pattern } : { rider: cls.list.rider },
1009
+ ...cls.equatable === true ? { equatable: true } : {}
1189
1010
  }
1190
1011
  } : {}
1191
1012
  };
@@ -1202,204 +1023,6 @@ function buildDescription(input) {
1202
1023
  };
1203
1024
  }
1204
1025
 
1205
- // src/with-shape/introspection/json-schema.ts
1206
- function jsonType(t) {
1207
- switch (t) {
1208
- case "number":
1209
- return "number";
1210
- case "boolean":
1211
- return "boolean";
1212
- case "array":
1213
- return "array";
1214
- case "object":
1215
- return "object";
1216
- default:
1217
- return "string";
1218
- }
1219
- }
1220
- function buildJsonSchema(desc, base) {
1221
- const baseProps = base?.["properties"] ?? {};
1222
- const properties = {};
1223
- for (const f of desc.fields) {
1224
- const prop = { ...baseProps[f.key] ?? { type: jsonType(f.type) } };
1225
- prop["x-label"] = f.label;
1226
- if (f.unit !== void 0) prop["x-unit"] = f.unit;
1227
- if (f.semanticType !== void 0) prop["x-semanticType"] = f.semanticType;
1228
- if (f.sensitivity !== void 0) prop["x-sensitivity"] = f.sensitivity;
1229
- if (f.widget !== void 0) prop["x-widget"] = f.widget;
1230
- if (f.editable === false) prop["x-readonly"] = true;
1231
- if (f.money !== void 0) prop["x-money"] = f.money;
1232
- if (f.ref !== void 0) prop["x-ref"] = f.ref.target;
1233
- if (f.dict?.values) {
1234
- const labels = {};
1235
- for (const v of f.dict.values) if (v.label !== void 0) labels[v.value] = v.label;
1236
- if (Object.keys(labels).length) prop["x-enumLabels"] = labels;
1237
- }
1238
- if (f.classified !== void 0) prop["x-classified"] = f.classified;
1239
- properties[f.key] = prop;
1240
- }
1241
- return base != null && typeof base === "object" ? { ...base, properties } : { type: "object", properties };
1242
- }
1243
-
1244
- // src/kernel/cache/lru.ts
1245
- var Lru = class {
1246
- entries = /* @__PURE__ */ new Map();
1247
- maxRecords;
1248
- maxBytes;
1249
- currentBytes = 0;
1250
- hits = 0;
1251
- misses = 0;
1252
- evictions = 0;
1253
- constructor(options) {
1254
- if (options.maxRecords === void 0 && options.maxBytes === void 0) {
1255
- throw new Error("Lru: must specify maxRecords, maxBytes, or both");
1256
- }
1257
- this.maxRecords = options.maxRecords;
1258
- this.maxBytes = options.maxBytes;
1259
- }
1260
- /**
1261
- * Look up a key. Hits promote the entry to most-recently-used; misses
1262
- * return undefined. Both update the running stats counters.
1263
- */
1264
- get(key) {
1265
- const entry = this.entries.get(key);
1266
- if (!entry) {
1267
- this.misses++;
1268
- return void 0;
1269
- }
1270
- this.entries.delete(key);
1271
- this.entries.set(key, entry);
1272
- this.hits++;
1273
- return entry.value;
1274
- }
1275
- /**
1276
- * Insert or update a key. If the key already exists, its size is
1277
- * accounted for and the entry is promoted to MRU. After insertion,
1278
- * eviction runs to maintain both budgets.
1279
- */
1280
- set(key, value, size) {
1281
- const existing = this.entries.get(key);
1282
- if (existing) {
1283
- this.currentBytes -= existing.size;
1284
- this.entries.delete(key);
1285
- }
1286
- this.entries.set(key, { value, size });
1287
- this.currentBytes += size;
1288
- this.evictUntilUnderBudget();
1289
- }
1290
- /**
1291
- * Remove a key without affecting hit/miss stats. Used by `Collection.delete()`.
1292
- * Returns true if the key was present.
1293
- */
1294
- remove(key) {
1295
- const existing = this.entries.get(key);
1296
- if (!existing) return false;
1297
- this.currentBytes -= existing.size;
1298
- this.entries.delete(key);
1299
- return true;
1300
- }
1301
- /** True if the cache currently holds an entry for the given key. */
1302
- has(key) {
1303
- return this.entries.has(key);
1304
- }
1305
- /**
1306
- * Drop every entry. Stats counters survive — call `resetStats()` if you
1307
- * want a clean slate. Used by `Collection.invalidate()` on key rotation.
1308
- */
1309
- clear() {
1310
- this.entries.clear();
1311
- this.currentBytes = 0;
1312
- }
1313
- /** Reset hit/miss/eviction counters to zero. Does NOT touch entries. */
1314
- resetStats() {
1315
- this.hits = 0;
1316
- this.misses = 0;
1317
- this.evictions = 0;
1318
- }
1319
- /** Snapshot of current cache statistics. Cheap — no copying. */
1320
- stats() {
1321
- return {
1322
- hits: this.hits,
1323
- misses: this.misses,
1324
- evictions: this.evictions,
1325
- size: this.entries.size,
1326
- bytes: this.currentBytes
1327
- };
1328
- }
1329
- /**
1330
- * Iterate over all currently-cached values. Order is least-recently-used
1331
- * first. Used by tests and devtools — production callers should use
1332
- * `Collection.scan()` instead.
1333
- */
1334
- *values() {
1335
- for (const entry of this.entries.values()) yield entry.value;
1336
- }
1337
- /**
1338
- * Walk the cache from the LRU end and drop entries until both budgets
1339
- * are satisfied. Called after every `set()`. Single pass — entries are
1340
- * never re-promoted during eviction.
1341
- */
1342
- evictUntilUnderBudget() {
1343
- while (this.overBudget()) {
1344
- const oldest = this.entries.keys().next();
1345
- if (oldest.done) return;
1346
- const key = oldest.value;
1347
- const entry = this.entries.get(key);
1348
- if (entry) this.currentBytes -= entry.size;
1349
- this.entries.delete(key);
1350
- this.evictions++;
1351
- }
1352
- }
1353
- overBudget() {
1354
- if (this.maxRecords !== void 0 && this.entries.size > this.maxRecords) return true;
1355
- if (this.maxBytes !== void 0 && this.currentBytes > this.maxBytes) return true;
1356
- return false;
1357
- }
1358
- };
1359
-
1360
- // src/kernel/cache/policy.ts
1361
- var UNITS = {
1362
- "": 1,
1363
- "B": 1,
1364
- "KB": 1024,
1365
- "MB": 1024 * 1024,
1366
- "GB": 1024 * 1024 * 1024
1367
- // 'TB' deliberately not supported — if you need it, you're not using NOYDB.
1368
- };
1369
- function parseBytes(input) {
1370
- if (typeof input === "number") {
1371
- if (!Number.isFinite(input) || input <= 0) {
1372
- throw new Error(`parseBytes: numeric input must be a positive finite number, got ${String(input)}`);
1373
- }
1374
- return Math.floor(input);
1375
- }
1376
- const trimmed = input.trim();
1377
- if (trimmed === "") {
1378
- throw new Error("parseBytes: empty string is not a valid byte budget");
1379
- }
1380
- const match = /^([0-9]+(?:\.[0-9]+)?)\s*([A-Za-z]*)$/.exec(trimmed);
1381
- if (!match) {
1382
- throw new Error(`parseBytes: invalid byte budget "${input}". Expected format: "1024", "50KB", "50MB", "1GB"`);
1383
- }
1384
- const value = parseFloat(match[1]);
1385
- const unit = (match[2] ?? "").toUpperCase();
1386
- if (!(unit in UNITS)) {
1387
- throw new Error(`parseBytes: unknown unit "${match[2]}" in "${input}". Supported: B, KB, MB, GB`);
1388
- }
1389
- const bytes = Math.floor(value * UNITS[unit]);
1390
- if (bytes <= 0) {
1391
- throw new Error(`parseBytes: byte budget must be > 0, got ${bytes} from "${input}"`);
1392
- }
1393
- return bytes;
1394
- }
1395
- function estimateRecordBytes(record) {
1396
- try {
1397
- return JSON.stringify(record).length;
1398
- } catch {
1399
- return 0;
1400
- }
1401
- }
1402
-
1403
1026
  // src/with-formula/derivations/stale.ts
1404
1027
  var _staleByRegistry = /* @__PURE__ */ new WeakMap();
1405
1028
  var keyFor = (source, sourceId) => `${source}/${sourceId}`;
@@ -1436,7 +1059,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
1436
1059
  }
1437
1060
  const sourceWithId = { ...source, id };
1438
1061
  if (DerivationExecutor === null) {
1439
- ({ DerivationExecutor } = await import("./executor-ANFBCOYA.js"));
1062
+ ({ DerivationExecutor } = await import("./executor-CBTNU5VZ.js"));
1440
1063
  }
1441
1064
  const ctx = { vault: accessor.getReadOnlyFacade() };
1442
1065
  const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
@@ -1593,7 +1216,7 @@ function resolveCollectionConfig(opts) {
1593
1216
  `Collection "${opts.name}": embeddings are not supported on CRDT collections (L2). Use a non-CRDT collection for semantic search.`
1594
1217
  );
1595
1218
  }
1596
- if (opts.moneyFields) validateMoneyFieldPaths(opts.moneyFields);
1219
+ if (opts.moneyFields) moneyRuntime().validateMoneyFieldPaths(opts.moneyFields);
1597
1220
  const resolvedClassified = opts.classifiedFields !== void 0 ? resolveClassifiedFields(opts.name, opts.classifiedFields) : void 0;
1598
1221
  let mergedComputed = opts.computed;
1599
1222
  if (resolvedClassified !== void 0) {
@@ -1636,7 +1259,8 @@ function resolveCollectionConfig(opts) {
1636
1259
  textIndexFields: new Set(opts.textIndexes ?? []),
1637
1260
  vectorSourceFields: new Set(embeddingSources),
1638
1261
  subjectKeyField: opts.subjectKeyField,
1639
- bareSensitiveFields: new Set(opts.sensitive ?? [])
1262
+ bareSensitiveFields: new Set(opts.sensitive ?? []),
1263
+ acknowledgeEquatableRisk: opts.acknowledgeEquatableRisk === true
1640
1264
  };
1641
1265
  if (resolvedClassified !== void 0) {
1642
1266
  guardClassifiedCompat(opts.name, resolvedClassified.byField, classifiedGuardCtx);
@@ -1647,6 +1271,7 @@ function resolveCollectionConfig(opts) {
1647
1271
  const vdigEntries = resolvedClassified === void 0 ? [] : Object.entries(resolvedClassified.byField).filter(([, s]) => s.storage === "digest-only").map(([f, s]) => [f, {
1648
1272
  normalize: s.verifyNormalize ?? "password",
1649
1273
  notLastN: s.notLastN ?? 0,
1274
+ equatable: s.equatable === true,
1650
1275
  ...s.rotateDays !== void 0 ? { rotateDays: s.rotateDays } : {}
1651
1276
  }]);
1652
1277
  const vdigFields = vdigEntries.length > 0 ? new Map(vdigEntries) : null;
@@ -1721,6 +1346,13 @@ function resolveCollectionConfig(opts) {
1721
1346
  };
1722
1347
  }
1723
1348
 
1349
+ // src/with-formula/computed/lazy.ts
1350
+ var fn = null;
1351
+ async function loadEvalComputedFields() {
1352
+ fn ??= (await import("./computed-BMMEFRFJ.js")).evalComputedFields;
1353
+ return fn;
1354
+ }
1355
+
1724
1356
  // src/kernel/collection.ts
1725
1357
  function selfWriteFieldEqual(a, b) {
1726
1358
  if (a === b) return true;
@@ -1967,6 +1599,9 @@ var Collection = class {
1967
1599
  * `_vdig` forward under (C6). `null` when the collection declares none.
1968
1600
  */
1969
1601
  vdigFields;
1602
+ /** C-A/R10 memoization: marker declared-set lookup (undefined=unresolved) + classified-handle persist-once flag. */
1603
+ _markerDigestOnlyCache = void 0;
1604
+ _markerPersisted = false;
1970
1605
  /**
1971
1606
  * Tree-shake seam for `reveal()` — defaults to `NO_CLASSIFIED`, which
1972
1607
  * throws `ClassifiedNotEnabledError`. Set via the `classifiedStrategy`
@@ -2232,7 +1867,8 @@ var Collection = class {
2232
1867
  crdtStrategy: this.crdtStrategy,
2233
1868
  schema: this.schema,
2234
1869
  getDEK: () => this.getDEK(this.name),
2235
- cekCache: this.cekCache
1870
+ cekCache: this.cekCache,
1871
+ classifiedMarkerDigestOnly: () => this._classifiedMarkerDigestOnly()
2236
1872
  });
2237
1873
  if (opts.crdt && opts.onRegisterConflictResolver) {
2238
1874
  const crdtMode = opts.crdt;
@@ -2304,15 +1940,7 @@ var Collection = class {
2304
1940
  }
2305
1941
  this.lazy = opts.prefetch === false;
2306
1942
  if (this.lazy) {
2307
- if (!opts.cache || opts.cache.maxRecords === void 0 && opts.cache.maxBytes === void 0) {
2308
- throw new Error(
2309
- `Collection "${this.name}": lazy mode (prefetch: false) requires a cache option with maxRecords and/or maxBytes. An unbounded lazy cache defeats the purpose.`
2310
- );
2311
- }
2312
- const lruOptions = {};
2313
- if (opts.cache.maxRecords !== void 0) lruOptions.maxRecords = opts.cache.maxRecords;
2314
- if (opts.cache.maxBytes !== void 0) lruOptions.maxBytes = parseBytes(opts.cache.maxBytes);
2315
- this.lru = new Lru(lruOptions);
1943
+ this.lru = (opts.lazyStrategy ?? IMPLICIT_LAZY).createCache(this.name, opts.cache);
2316
1944
  this.hydrated = true;
2317
1945
  } else {
2318
1946
  this.lru = null;
@@ -2443,6 +2071,7 @@ var Collection = class {
2443
2071
  }
2444
2072
  /** JSON Schema for this collection with describe() metadata as x- extensions. */
2445
2073
  async toJSONSchema() {
2074
+ const { buildJsonSchema } = await import("./json-schema-I22JCYCG.js");
2446
2075
  const desc = await this.describe({});
2447
2076
  let base = null;
2448
2077
  if (this.schema !== void 0) {
@@ -2506,6 +2135,140 @@ var Collection = class {
2506
2135
  } } : {}
2507
2136
  };
2508
2137
  }
2138
+ /**
2139
+ * Equatable blind-index lookup: the ids whose classified digest-only
2140
+ * `equatable` field carries a `_bidx` tag matching `candidate` AND whose
2141
+ * `_vdig` payload confirms it. Requires the field to be declared
2142
+ * `classified.password({ equatable: true })` (or `secretAnswer`) and the
2143
+ * collection to have opened its `acknowledgeEquatableRisk` door.
2144
+ *
2145
+ * The algorithm order is load-bearing (spec §3):
2146
+ * 1. Caller-bug refusals thrown at ~0 elapsed, BEFORE any PBKDF2 (R9 /
2147
+ * Oracle #6): the three field mis-declarations share ONE constant,
2148
+ * field-name-free message so the refusal text cannot enumerate which
2149
+ * fields are classified / digest-only / equatable.
2150
+ * 2. Derive the ONE blind-index target UNCONDITIONALLY (I-1 / F1): an empty
2151
+ * collection still pays exactly one 600K PBKDF2, so wall-time can never
2152
+ * distinguish "no records" from "no match". No early return may precede
2153
+ * this line.
2154
+ * 3. Scan `list + one get` per id, string-comparing the stored `_bidx` tag —
2155
+ * decrypting NOTHING — and retain each hit's already-fetched envelope.
2156
+ * 4. Emit the single sweep consent op (`onAccess('find', '*')`) now — after
2157
+ * the scan, before confirm (Oracle #5) — fixing its store-write timestamp
2158
+ * independent of hit count.
2159
+ * 5. Confirm-by-verify against the ALREADY-FETCHED envelope (C-B): run the
2160
+ * enclave `verifyDigestField` on an in-memory `getEnvelope` closure so the
2161
+ * confirm reads ZERO additional envelopes. A tag-hit whose `_vdig` fails
2162
+ * to confirm is dropped silently (a splice is indistinguishable from a
2163
+ * stale tag). Store-shape law: the only store calls are `list + N get`.
2164
+ */
2165
+ async findByDigest(field, candidate) {
2166
+ const spec = this.classified?.byField[field];
2167
+ if (spec === void 0 || spec.storage !== "digest-only" || spec.equatable !== true) {
2168
+ throw new ClassifiedVerifyError(
2169
+ this.name,
2170
+ "*",
2171
+ "not a declared equatable digest-only classified field"
2172
+ );
2173
+ }
2174
+ if (typeof candidate !== "string") {
2175
+ throw new ClassifiedVerifyError(this.name, "*", "candidate must be a string");
2176
+ }
2177
+ const target = await this.classifiedStrategy.computeTarget(this._classifiedVerifyCtx(spec), field, candidate);
2178
+ const ids = await this.adapter.list(this.vault, this.name);
2179
+ const hits = [];
2180
+ const hitMap = /* @__PURE__ */ new Map();
2181
+ for (const id of ids) {
2182
+ const env = await this.adapter.get(this.vault, this.name, id);
2183
+ if (target !== null && env?._bidx?.[field] === target) {
2184
+ hits.push(id);
2185
+ hitMap.set(id, env);
2186
+ }
2187
+ }
2188
+ await this.onAccess?.("find", "*");
2189
+ if (hits.length === 0) return [];
2190
+ const { verifyDigestField } = await import("./verify-YB5LQHNA.js");
2191
+ const policy = {
2192
+ normalize: spec.verifyNormalize ?? "password",
2193
+ notLastN: spec.notLastN ?? 0,
2194
+ equatable: true,
2195
+ ...spec.rotateDays !== void 0 ? { rotateDays: spec.rotateDays } : {}
2196
+ };
2197
+ const confirmCtx = {
2198
+ collection: this.name,
2199
+ getEnvelope: async (rid) => hitMap.get(rid) ?? null,
2200
+ // in-memory: zero extra store.get
2201
+ resolveCek: (env) => this.codec.resolveEnvelopeCek(env),
2202
+ getDEK: () => this.getDEK(this.name),
2203
+ now: () => Date.now()
2204
+ };
2205
+ const confirmed = [];
2206
+ for (const id of hits) {
2207
+ const verdict = await verifyDigestField(confirmCtx, id, field, candidate, policy);
2208
+ if (verdict.ok === true) confirmed.push(id);
2209
+ }
2210
+ return confirmed;
2211
+ }
2212
+ /**
2213
+ * Retire a field's equatable blind-index (`_bidx`) coverage across every
2214
+ * live record — the SOLE lazy-write-independent drop-path for a still-live
2215
+ * record's tag (besides clear / `forget()` / DEK-rotation). For each envelope
2216
+ * carrying `_bidx[field]`, rewrite it WITHOUT that slot (dropping the whole
2217
+ * `_bidx` map when it becomes empty), leaving `_vdig[field]` and everything
2218
+ * else INTACT — the field stays `digest-only`, only the index coverage is
2219
+ * retired. NO crypto, NO re-mint, NO re-encrypt: a targeted envelope rewrite.
2220
+ * Returns the count of records scrubbed.
2221
+ *
2222
+ * This is a maintenance write, not a read-egress: it emits NO `'find'` op and
2223
+ * no consent. The field is validated to a declared equatable digest-only
2224
+ * classified field (only such a field ever carries `_bidx`).
2225
+ *
2226
+ * **Ledger consistency**: dropping `_bidx[field]` changes the envelope's
2227
+ * payload hash (`_bidx` is bound into `envelopeBodyForHash`), so a raw
2228
+ * `adapter.put` of the scrubbed envelope WITHOUT a matching ledger entry would
2229
+ * desync the chain and make a future integrity cross-check flag false
2230
+ * tampering. After each rewrite we therefore append an `op:'migration'` entry
2231
+ * recording the NEW payloadHash at the SAME version — this is index retirement,
2232
+ * not a new record version, so `_v` is NOT bumped; the migration op is
2233
+ * reverse-delta-inert (`ledger.reconstruct` skips non-put/delete ops) yet
2234
+ * keeps the hash chain and the record's latest recorded payloadHash correct.
2235
+ */
2236
+ async scrubEquatableTags(field) {
2237
+ const spec = this.classified?.byField[field];
2238
+ if (spec === void 0 || spec.storage !== "digest-only" || spec.equatable !== true) {
2239
+ throw new ClassifiedVerifyError(
2240
+ this.name,
2241
+ "*",
2242
+ "not a declared equatable digest-only classified field"
2243
+ );
2244
+ }
2245
+ const ids = await this.adapter.list(this.vault, this.name);
2246
+ let count = 0;
2247
+ for (const id of ids) {
2248
+ const env = await this.adapter.get(this.vault, this.name, id);
2249
+ if (env?._bidx?.[field] === void 0) continue;
2250
+ const nextBidx = { ...env._bidx };
2251
+ delete nextBidx[field];
2252
+ const scrubbedRaw = { ...env };
2253
+ delete scrubbedRaw._bidx;
2254
+ if (Object.keys(nextBidx).length > 0) scrubbedRaw._bidx = nextBidx;
2255
+ const scrubbed = scrubbedRaw;
2256
+ await this.adapter.put(this.vault, this.name, id, scrubbed);
2257
+ if (this.ledger) {
2258
+ await this.ledger.append({
2259
+ op: "migration",
2260
+ collection: this.name,
2261
+ id,
2262
+ version: scrubbed._v,
2263
+ actor: this.keyring.userId,
2264
+ payloadHash: await this.historyStrategy.envelopePayloadHash(scrubbed),
2265
+ reason: "classified:scrub-equatable-tags"
2266
+ });
2267
+ }
2268
+ count++;
2269
+ }
2270
+ return count;
2271
+ }
2509
2272
  /**
2510
2273
  * @internal — attach money descriptors post-construction. MV dependency
2511
2274
  * analysis auto-creates a source collection (without options) during
@@ -2514,7 +2277,7 @@ var Collection = class {
2514
2277
  */
2515
2278
  _applyMoneyFields(moneyFields) {
2516
2279
  if (this.moneyFields !== void 0) return;
2517
- validateMoneyFieldPaths(moneyFields);
2280
+ moneyRuntime().validateMoneyFieldPaths(moneyFields);
2518
2281
  this.moneyFields = moneyFields;
2519
2282
  }
2520
2283
  /** @internal — attach computed fields post-construction. See {@link _applyMoneyFields}. */
@@ -2600,7 +2363,7 @@ var Collection = class {
2600
2363
  }
2601
2364
  }
2602
2365
  if (this.materializedViewSource !== void 0) {
2603
- const { resolveStaleMVOnRead } = await import("./stale-LX4BR43V.js");
2366
+ const { resolveStaleMVOnRead } = await import("./stale-7Q62KVI3.js");
2604
2367
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
2605
2368
  }
2606
2369
  let record;
@@ -2832,6 +2595,17 @@ var Collection = class {
2832
2595
  const cached = this.cache.get(id);
2833
2596
  return cached ? { record: cached.record, version: cached.version } : void 0;
2834
2597
  }
2598
+ /** Resolves the prior envelope/record for a gate event; elides the read (#267) when no handler at `point` needs it (`elided: true`, `env`/`record` null). */
2599
+ async resolveGatePrior(point, id) {
2600
+ if (!this.subsystemBus.gateNeedsPrior(point)) return { env: null, record: null, elided: true };
2601
+ const env = await this.adapter.get(this.vault, this.name, id);
2602
+ if (!env) return { env: null, record: null, elided: false };
2603
+ try {
2604
+ return { env, record: await this.codec.decryptRecord(env, { skipValidation: true }), elided: false };
2605
+ } catch {
2606
+ return { env, record: null, elided: false };
2607
+ }
2608
+ }
2835
2609
  /**
2836
2610
  * Wraps {@link RecordCodec.toCacheRecord} with an additional strip for
2837
2611
  * digest-only classified fields: the codec already omits them from `_data`
@@ -2852,24 +2626,16 @@ var Collection = class {
2852
2626
  if (!hasWritePermission(this.keyring, this.name)) {
2853
2627
  throw new ReadOnlyError();
2854
2628
  }
2855
- record = canonicalizeIncomingMoney(record, this.moneyFields);
2629
+ if (this.moneyFields) record = moneyRuntime().canonicalizeIncomingMoney(record, this.moneyFields);
2856
2630
  if (this.subsystemBus?.hasGateHandlers("beforePut")) {
2857
- const existingEnv = await this.adapter.get(this.vault, this.name, id);
2858
- let existingRecord = null;
2859
- if (existingEnv) {
2860
- try {
2861
- existingRecord = await this.codec.decryptRecord(existingEnv, { skipValidation: true });
2862
- } catch {
2863
- existingRecord = null;
2864
- }
2865
- }
2631
+ const { env: existingEnv, record: existingRecord } = await this.resolveGatePrior("beforePut", id);
2866
2632
  const gateEvent = {
2867
2633
  op: existingEnv ? "update" : "create",
2868
2634
  vault: this.vault,
2869
2635
  collection: this.name,
2870
2636
  docId: id,
2871
2637
  incoming: record,
2872
- existing: canonicalizeStoredMoney(existingRecord, this.moneyFields),
2638
+ existing: this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(existingRecord, this.moneyFields) : existingRecord,
2873
2639
  existingVersion: existingEnv?._v ?? 0,
2874
2640
  existingTs: existingEnv?._ts,
2875
2641
  userId: this.keyring.userId,
@@ -2882,13 +2648,13 @@ var Collection = class {
2882
2648
  enforceClassifiedWrite(record, this.classified.byField, this.name);
2883
2649
  }
2884
2650
  if (this.computed !== void 0) {
2885
- record = evalComputedFields(record, this.computed, id);
2651
+ record = (await loadEvalComputedFields())(record, this.computed, id);
2886
2652
  }
2887
2653
  if (this.schema !== void 0) {
2888
2654
  record = await validateSchemaInput(this.schema, record, `put(${id})`);
2889
2655
  }
2890
2656
  if (this.moneyFields) {
2891
- record = quantizeMoneyFields(record, this.moneyFields);
2657
+ record = moneyRuntime().quantizeMoneyFields(record, this.moneyFields);
2892
2658
  }
2893
2659
  if (this.i18nFields) {
2894
2660
  const obj = record;
@@ -3094,6 +2860,7 @@ var Collection = class {
3094
2860
  }
3095
2861
  const envelope = await this.codec.encryptRecord(record, version, cek, options?.source, options?.sourceTs, vdigCtx);
3096
2862
  await this.adapter.put(this.vault, this.name, id, envelope);
2863
+ await this._ensureClassifiedMarker();
3097
2864
  if (this.embeddings) {
3098
2865
  await this.searchStrategy.embedOnWrite(this.searchContext(), id, record, version);
3099
2866
  }
@@ -3159,7 +2926,7 @@ var Collection = class {
3159
2926
  if (mode === "eager") {
3160
2927
  if (executor === null) {
3161
2928
  ;
3162
- ({ MaterializedViewExecutor: executor } = await import("./executor-OIECZXTV.js"));
2929
+ ({ MaterializedViewExecutor: executor } = await import("./executor-FGISLQIN.js"));
3163
2930
  }
3164
2931
  await executor.refresh(reg, {
3165
2932
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -3168,7 +2935,7 @@ var Collection = class {
3168
2935
  });
3169
2936
  } else if (mode === "lazy") {
3170
2937
  if (staleHelpers === null) {
3171
- staleHelpers = await import("./stale-LX4BR43V.js");
2938
+ staleHelpers = await import("./stale-7Q62KVI3.js");
3172
2939
  }
3173
2940
  staleHelpers.markMVStale(registry, reg.spec.name);
3174
2941
  }
@@ -3220,7 +2987,7 @@ var Collection = class {
3220
2987
  raw = (await this.resolvePriorValues(id))?.record ?? null;
3221
2988
  }
3222
2989
  if (raw === null) return null;
3223
- return canonicalizeStoredMoney(raw, this.moneyFields);
2990
+ return this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(raw, this.moneyFields) : raw;
3224
2991
  }
3225
2992
  /**
3226
2993
  * @internal Ids of records whose top-level `field` equals `value`.
@@ -3303,7 +3070,7 @@ var Collection = class {
3303
3070
  }
3304
3071
  async dispatchDerivations(id, record, version) {
3305
3072
  if (this.derivationSource === void 0) return;
3306
- const incoming = canonicalizeStoredMoney(record, this.moneyFields);
3073
+ const incoming = this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(record, this.moneyFields) : record;
3307
3074
  if (incoming && typeof incoming === "object" && "_derivedFrom" in incoming) return;
3308
3075
  const registry = this.derivationSource.registry();
3309
3076
  const strategies = registry.strategiesForSource(this.name);
@@ -3353,7 +3120,7 @@ var Collection = class {
3353
3120
  continue;
3354
3121
  }
3355
3122
  if (DerivationExecutor === null) {
3356
- ({ DerivationExecutor } = await import("./executor-ANFBCOYA.js"));
3123
+ ({ DerivationExecutor } = await import("./executor-CBTNU5VZ.js"));
3357
3124
  }
3358
3125
  for (const run of runs) {
3359
3126
  const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
@@ -3372,7 +3139,7 @@ var Collection = class {
3372
3139
  const outputCollection = this.derivationSource.getCollection(outSpec.collection);
3373
3140
  const txCtx = this.derivationSource.getActiveTxContext();
3374
3141
  if (out.kind === "array") {
3375
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-DDKRG2MX.js");
3142
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-WS22Q5WH.js");
3376
3143
  const prior = await loadFanoutSidecar(this.adapter, this.vault, spec.source, run.runId, key, this.getDEK, this.storeCiphertext);
3377
3144
  const prevKeys = new Set(prior?.keys ?? []);
3378
3145
  const newKeysList = out.entries.map((e) => e.key);
@@ -3580,21 +3347,15 @@ var Collection = class {
3580
3347
  throw new ReadOnlyError();
3581
3348
  }
3582
3349
  if (this.subsystemBus?.hasGateHandlers("beforeDelete")) {
3583
- const existingEnv = await this.adapter.get(this.vault, this.name, id);
3584
- if (existingEnv) {
3585
- let existingRecord = null;
3586
- try {
3587
- existingRecord = await this.codec.decryptRecord(existingEnv, { skipValidation: true });
3588
- } catch {
3589
- existingRecord = null;
3590
- }
3350
+ const { env: existingEnv, record: existingRecord, elided } = await this.resolveGatePrior("beforeDelete", id);
3351
+ if (existingEnv || elided) {
3591
3352
  await this.subsystemBus.dispatchGate("beforeDelete", {
3592
3353
  vault: this.vault,
3593
3354
  collection: this.name,
3594
3355
  docId: id,
3595
- existing: canonicalizeStoredMoney(existingRecord, this.moneyFields),
3596
- existingVersion: existingEnv._v,
3597
- existingTs: existingEnv._ts,
3356
+ existing: this.moneyFields ? moneyRuntime().canonicalizeStoredMoney(existingRecord, this.moneyFields) : existingRecord,
3357
+ existingVersion: existingEnv?._v ?? 0,
3358
+ existingTs: existingEnv?._ts,
3598
3359
  internal,
3599
3360
  userId: this.keyring.userId,
3600
3361
  role: this.keyring.role
@@ -3731,7 +3492,7 @@ var Collection = class {
3731
3492
  for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
3732
3493
  if (outSpec.shape !== "array") continue;
3733
3494
  if (helpers === null) {
3734
- helpers = await import("./fanout-sidecar-DDKRG2MX.js");
3495
+ helpers = await import("./fanout-sidecar-WS22Q5WH.js");
3735
3496
  }
3736
3497
  const sidecar = await helpers.loadFanoutSidecar(this.adapter, this.vault, spec.source, id, outputKey, this.getDEK, this.storeCiphertext);
3737
3498
  if (!sidecar) continue;
@@ -3765,7 +3526,7 @@ var Collection = class {
3765
3526
  if (mode === "eager") {
3766
3527
  if (executor === null) {
3767
3528
  ;
3768
- ({ MaterializedViewExecutor: executor } = await import("./executor-OIECZXTV.js"));
3529
+ ({ MaterializedViewExecutor: executor } = await import("./executor-FGISLQIN.js"));
3769
3530
  }
3770
3531
  await executor.refresh(reg, {
3771
3532
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -3774,7 +3535,7 @@ var Collection = class {
3774
3535
  });
3775
3536
  } else if (mode === "lazy") {
3776
3537
  if (staleHelpers === null) {
3777
- staleHelpers = await import("./stale-LX4BR43V.js");
3538
+ staleHelpers = await import("./stale-7Q62KVI3.js");
3778
3539
  }
3779
3540
  staleHelpers.markMVStale(registry, reg.spec.name);
3780
3541
  }
@@ -3797,7 +3558,7 @@ var Collection = class {
3797
3558
  );
3798
3559
  }
3799
3560
  if (this.materializedViewSource !== void 0) {
3800
- const { resolveStaleMVOnRead } = await import("./stale-LX4BR43V.js");
3561
+ const { resolveStaleMVOnRead } = await import("./stale-7Q62KVI3.js");
3801
3562
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
3802
3563
  }
3803
3564
  await this.ensureHydrated();
@@ -4653,7 +4414,7 @@ var Collection = class {
4653
4414
  const locale = localeOpts?.locale ?? this.defaultLocale;
4654
4415
  let result = record;
4655
4416
  if (hasMoney && this.moneyFields) {
4656
- result = decodeMoneyFields(result, this.moneyFields, typeof locale === "string" ? locale : void 0);
4417
+ result = moneyRuntime().decodeMoneyFields(result, this.moneyFields, typeof locale === "string" ? locale : void 0);
4657
4418
  }
4658
4419
  const hasStaticDisplay = hasDict && this.dictKeyFields !== void 0 && Object.values(this.dictKeyFields).some(
4659
4420
  (d) => isStaticDictDescriptor(d) && d.displayLocale !== void 0
@@ -4939,6 +4700,20 @@ var Collection = class {
4939
4700
  id
4940
4701
  );
4941
4702
  }
4703
+ /** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
4704
+ async _ensureClassifiedMarker() {
4705
+ if (this._markerPersisted || this.vdigFields === null) return;
4706
+ const { persistClassifiedMarkerForFields } = await import("./config-drift-KGM7ZRW4.js");
4707
+ await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
4708
+ this._markerPersisted = true;
4709
+ }
4710
+ /** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
4711
+ async _classifiedMarkerDigestOnly() {
4712
+ if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
4713
+ const { readClassifiedMarkerDigestOnly } = await import("./config-drift-KGM7ZRW4.js");
4714
+ this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
4715
+ return this._markerDigestOnlyCache;
4716
+ }
4942
4717
  /**
4943
4718
  * find the first record whose deterministic field matches
4944
4719
  * the given plaintext. Returns `null` when no match exists.
@@ -5660,141 +5435,6 @@ var RefRegistry = class {
5660
5435
  }
5661
5436
  };
5662
5437
 
5663
- // src/with-shape/links/link-set.ts
5664
- var LINK_COLLECTION_PREFIX = "_links_";
5665
- function linkCollectionName(name) {
5666
- return `${LINK_COLLECTION_PREFIX}${name}`;
5667
- }
5668
- function isLinkCollectionName(name) {
5669
- return name.startsWith(LINK_COLLECTION_PREFIX);
5670
- }
5671
- function linkRowKey(aId, bId) {
5672
- return `${encodeURIComponent(aId)}|${encodeURIComponent(bId)}`;
5673
- }
5674
- var LinkSet = class {
5675
- constructor(adapter, vault, name, spec, encrypted, getDEK, actor, emitter, endpointExists) {
5676
- this.adapter = adapter;
5677
- this.vault = vault;
5678
- this.name = name;
5679
- this.spec = spec;
5680
- this.encrypted = encrypted;
5681
- this.getDEK = getDEK;
5682
- this.actor = actor;
5683
- this.emitter = emitter;
5684
- this.endpointExists = endpointExists;
5685
- this.collName = linkCollectionName(name);
5686
- }
5687
- adapter;
5688
- vault;
5689
- name;
5690
- spec;
5691
- encrypted;
5692
- getDEK;
5693
- actor;
5694
- emitter;
5695
- endpointExists;
5696
- collName;
5697
- dekPromise = null;
5698
- dek() {
5699
- if (!this.dekPromise) this.dekPromise = this.getDEK(this.collName);
5700
- return this.dekPromise;
5701
- }
5702
- async encryptEntry(entry, version) {
5703
- const json = JSON.stringify(entry);
5704
- const base = { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: (/* @__PURE__ */ new Date()).toISOString(), _by: this.actor };
5705
- if (!this.encrypted) return { ...base, _iv: "", _data: json };
5706
- const { iv, data } = await encrypt(json, await this.dek());
5707
- return { ...base, _iv: iv, _data: data };
5708
- }
5709
- async decryptEntry(env) {
5710
- const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data;
5711
- return JSON.parse(json);
5712
- }
5713
- async connect(aId, bId, meta) {
5714
- if (!await this.endpointExists(this.spec.a, aId)) {
5715
- throw new LinkEndpointError(this.name, this.spec.a, aId);
5716
- }
5717
- if (!await this.endpointExists(this.spec.b, bId)) {
5718
- throw new LinkEndpointError(this.name, this.spec.b, bId);
5719
- }
5720
- const key = linkRowKey(aId, bId);
5721
- const entry = meta !== void 0 ? { a: aId, b: bId, meta } : { a: aId, b: bId };
5722
- const existing = await this.adapter.get(this.vault, this.collName, key);
5723
- const env = await this.encryptEntry(entry, (existing?._v ?? 0) + 1);
5724
- await this.adapter.put(this.vault, this.collName, key, env, existing?._v);
5725
- this.emitter.emit("change", { vault: this.vault, collection: this.collName, id: key, action: "put" });
5726
- }
5727
- async disconnect(aId, bId) {
5728
- const key = linkRowKey(aId, bId);
5729
- const existing = await this.adapter.get(this.vault, this.collName, key);
5730
- if (!existing) return;
5731
- await this.adapter.delete(this.vault, this.collName, key);
5732
- this.emitter.emit("change", { vault: this.vault, collection: this.collName, id: key, action: "delete" });
5733
- }
5734
- async has(aId, bId) {
5735
- return await this.adapter.get(this.vault, this.collName, linkRowKey(aId, bId)) !== null;
5736
- }
5737
- async of(id) {
5738
- const rows = await this.list();
5739
- return rows.filter((r) => r.a === id || r.b === id);
5740
- }
5741
- async list() {
5742
- const keys = await this.adapter.list(this.vault, this.collName);
5743
- const out = [];
5744
- for (const key of keys) {
5745
- const env = await this.adapter.get(this.vault, this.collName, key);
5746
- if (!env) continue;
5747
- const e = await this.decryptEntry(env);
5748
- out.push(e.meta !== void 0 ? { a: e.a, b: e.b, meta: e.meta } : { a: e.a, b: e.b });
5749
- }
5750
- return out;
5751
- }
5752
- // ── Vault-internal cascade helpers ──────────────────────────────────
5753
- /** @internal — rows where the deleted endpoint id matches the relevant slot. */
5754
- async _rowsTouchingEndpoint(collection, id) {
5755
- const rows = await this.list();
5756
- return rows.filter(
5757
- (r) => this.spec.a === collection && r.a === id || this.spec.b === collection && r.b === id
5758
- );
5759
- }
5760
- /** @internal — the storage collection name (for tx pre-image capture). */
5761
- get _collectionName() {
5762
- return this.collName;
5763
- }
5764
- };
5765
- var LinkEndpointError = class extends NoydbError {
5766
- link;
5767
- endpoint;
5768
- missingId;
5769
- constructor(link, endpoint, missingId) {
5770
- super(
5771
- "LINK_ENDPOINT",
5772
- `link("${link}").connect: endpoint "${endpoint}" has no record "${missingId}".`
5773
- );
5774
- this.name = "LinkEndpointError";
5775
- this.link = link;
5776
- this.endpoint = endpoint;
5777
- this.missingId = missingId;
5778
- }
5779
- };
5780
- var LinkIntegrityError = class extends NoydbError {
5781
- link;
5782
- endpoint;
5783
- id;
5784
- count;
5785
- constructor(link, endpoint, id, count) {
5786
- super(
5787
- "LINK_INTEGRITY",
5788
- `Cannot delete "${endpoint}"/"${id}": ${count} link(s) in "${link}" still reference it (onDelete: 'strict').`
5789
- );
5790
- this.name = "LinkIntegrityError";
5791
- this.link = link;
5792
- this.endpoint = endpoint;
5793
- this.id = id;
5794
- this.count = count;
5795
- }
5796
- };
5797
-
5798
5438
  // src/with-shape/links/vault-facade.ts
5799
5439
  var VaultLinks = class {
5800
5440
  constructor(deps) {
@@ -6114,74 +5754,21 @@ var VaultLinks = class {
6114
5754
  }
6115
5755
  };
6116
5756
 
6117
- // src/with-shape/schema-update/delta.ts
6118
- function computeSchemaDelta(stored, fresh, collection) {
6119
- const a = stored;
6120
- const b = fresh;
6121
- const aProps = a.properties ?? {};
6122
- const bProps = b.properties ?? {};
6123
- const aReq = new Set(a.required ?? []);
6124
- const bReq = new Set(b.required ?? []);
6125
- const aKeys = Object.keys(aProps);
6126
- const bKeys = Object.keys(bProps);
6127
- const added = bKeys.filter((k) => !(k in aProps));
6128
- const removed = aKeys.filter((k) => !(k in bProps));
6129
- const changed = [];
6130
- for (const k of bKeys) {
6131
- if (!(k in aProps)) continue;
6132
- const shapeChanged = canonicalize(aProps[k]) !== canonicalize(bProps[k]);
6133
- const requiredChanged = aReq.has(k) !== bReq.has(k);
6134
- if (shapeChanged || requiredChanged) {
6135
- changed.push({ field: k, requiredChanged, shapeChanged });
6136
- }
6137
- }
6138
- let kind;
6139
- if (added.length === 0 && removed.length === 0 && changed.length === 0) {
6140
- kind = "none";
6141
- } else if (removed.length === 0 && changed.length === 0 && added.every((k) => !bReq.has(k))) {
6142
- kind = "additive";
6143
- } else {
6144
- kind = "non-additive";
6145
- }
6146
- return { collection, kind, added, removed, changed };
6147
- }
6148
-
6149
- // src/with-shape/schema-update/dispatch.ts
6150
- async function evaluateStrategies(delta, strategies, ctx) {
6151
- for (const strategy of strategies) {
6152
- const decision = await strategy.onSchemaDelta(delta, ctx);
6153
- if (decision.action !== "allow") return decision;
6154
- }
6155
- return { action: "allow" };
6156
- }
6157
-
6158
- // src/with-shape/persisted-schemas/register.ts
6159
- async function persistSchemaIfNeeded(opts) {
6160
- const fresh = await derivePersistedSchema(opts.validator);
6161
- const stored = await loadPersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek);
6162
- if (stored && isEquivalent(stored, fresh)) {
6163
- return { written: false, skipped: true, envelope: stored, decision: { action: "allow" } };
6164
- }
6165
- let decision = { action: "allow" };
6166
- const strategies = opts.strategies ?? [];
6167
- if (stored && strategies.length > 0 && stored.kind === fresh.kind && isPlainObject(stored.jsonSchema) && isPlainObject(fresh.jsonSchema)) {
6168
- const delta = computeSchemaDelta(stored.jsonSchema, fresh.jsonSchema, opts.collectionName);
6169
- decision = await evaluateStrategies(delta, strategies, { collection: opts.collectionName });
6170
- }
6171
- if (decision.action !== "allow") {
6172
- return { written: false, skipped: false, envelope: stored ?? fresh, decision };
6173
- }
6174
- await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, fresh);
6175
- return { written: true, skipped: false, envelope: fresh, decision };
6176
- }
6177
- function isPlainObject(v) {
6178
- return typeof v === "object" && v !== null && !Array.isArray(v);
6179
- }
6180
- function isEquivalent(a, b) {
6181
- if (a.kind !== b.kind) return false;
6182
- if (a.hash && b.hash) return a.hash === b.hash;
6183
- if (a.hash === null && b.hash === null) return true;
6184
- return false;
5757
+ // src/with-shape/links/lazy-handle.ts
5758
+ function makeLazyLinkSetHandle(d) {
5759
+ let engine = null;
5760
+ const load = () => engine ??= import("./link-set-UQEIYQAM.js").then(
5761
+ ({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
5762
+ );
5763
+ return {
5764
+ _collectionName: linkCollectionName(d.name),
5765
+ connect: async (aId, bId, meta) => (await load()).connect(aId, bId, meta),
5766
+ disconnect: async (aId, bId) => (await load()).disconnect(aId, bId),
5767
+ has: async (aId, bId) => (await load()).has(aId, bId),
5768
+ of: async (id) => (await load()).of(id),
5769
+ list: async () => (await load()).list(),
5770
+ _rowsTouchingEndpoint: async (collection, id) => (await load())._rowsTouchingEndpoint(collection, id)
5771
+ };
6185
5772
  }
6186
5773
 
6187
5774
  // src/with-shape/schema-update/gate.ts
@@ -6297,70 +5884,6 @@ var SchemaFenceController = class {
6297
5884
  }
6298
5885
  };
6299
5886
 
6300
- // src/with-shape/schema-update/fence-watcher.ts
6301
- var FenceWatcher = class {
6302
- #coordination;
6303
- #vault;
6304
- #writerId;
6305
- #sessionId;
6306
- #onFlush;
6307
- #now;
6308
- #emit;
6309
- #lastState = null;
6310
- #quiescedAtVersion = null;
6311
- #timer;
6312
- constructor(opts) {
6313
- this.#coordination = opts.coordination;
6314
- this.#vault = opts.vault;
6315
- this.#writerId = opts.clientId;
6316
- this.#sessionId = opts.sessionId ?? opts.clientId;
6317
- this.#onFlush = opts.onFlush;
6318
- this.#now = opts.now ?? (() => Date.now());
6319
- this.#emit = opts.emit ?? (() => {
6320
- });
6321
- }
6322
- /** Publish liveness (and the current ack) without changing quiesce state. */
6323
- async beat() {
6324
- await this.#coordination.reportPresence(this.#vault, {
6325
- writerId: this.#writerId,
6326
- sessionId: this.#sessionId,
6327
- lastSeen: this.#now(),
6328
- quiescedAtVersion: this.#quiescedAtVersion
6329
- });
6330
- }
6331
- /** Poll the fence; quiesce on draining; emit on transitions. */
6332
- async check() {
6333
- const fence = await this.#coordination.readFence(this.#vault);
6334
- if (fence.fenceState !== this.#lastState) {
6335
- this.#lastState = fence.fenceState;
6336
- this.#emit({ currentSchemaVersion: fence.currentSchemaVersion, fenceState: fence.fenceState });
6337
- }
6338
- if (fence.fenceState === "draining" && this.#quiescedAtVersion !== fence.currentSchemaVersion) {
6339
- await this.#onFlush();
6340
- this.#quiescedAtVersion = fence.currentSchemaVersion;
6341
- await this.beat();
6342
- }
6343
- if (fence.fenceState === "normal") {
6344
- this.#quiescedAtVersion = null;
6345
- }
6346
- }
6347
- start(intervalMs) {
6348
- if (this.#timer) return;
6349
- this.#timer = setInterval(() => {
6350
- void this.beat();
6351
- void this.check();
6352
- }, intervalMs);
6353
- const timer = this.#timer;
6354
- if (typeof timer.unref === "function") timer.unref();
6355
- }
6356
- stop() {
6357
- if (this.#timer) {
6358
- clearInterval(this.#timer);
6359
- this.#timer = void 0;
6360
- }
6361
- }
6362
- };
6363
-
6364
5887
  // src/with-audit/attestation/vault-facade.ts
6365
5888
  var VaultAttestation = class {
6366
5889
  constructor(deps, strategy) {
@@ -6433,224 +5956,6 @@ var VaultAttestation = class {
6433
5956
  }
6434
5957
  };
6435
5958
 
6436
- // src/with-shape/introspection/walk.ts
6437
- var INTERNAL_PREFIX = "_";
6438
- var KNOWN_INTERNAL_NAMES = ["_keyring", "_ledger", "_meta", "_schemas", "_deltas"];
6439
- async function dumpVaultSchema(vault, opts) {
6440
- const state = vault._introspectState();
6441
- const sampleSize = opts.sampleSize ?? 50;
6442
- const withStats = opts.withStats === true;
6443
- const cacheNames = [...state.collectionCache.keys()];
6444
- const storageNames = (await safeListAllCollections(state.adapter, state.name)).filter((n) => !n.startsWith(INTERNAL_PREFIX));
6445
- const allNames = Array.from(/* @__PURE__ */ new Set([...cacheNames, ...storageNames])).sort();
6446
- const collections = {};
6447
- for (const name of allNames) {
6448
- collections[name] = await describeCollection(state, name, sampleSize, withStats);
6449
- }
6450
- const materializedViews = describeMVs(state.mvRegistry);
6451
- const overlayViews = describeOverlays(state.overlayRegistry);
6452
- const derivations = describeDerivations(state.derivationRegistry);
6453
- let internal;
6454
- if (withStats) {
6455
- internal = {};
6456
- for (const name of KNOWN_INTERNAL_NAMES) {
6457
- const stats = await statsForCollection(state.adapter, state.name, name);
6458
- if (stats.records > 0) {
6459
- internal[name] = { records: stats.records, bytes: stats.bytes };
6460
- }
6461
- }
6462
- }
6463
- const snap = {
6464
- _noydb_snapshot: 1,
6465
- vault: state.name,
6466
- emittedAt: (/* @__PURE__ */ new Date()).toISOString(),
6467
- subsystems: state.subsystems,
6468
- ...state.vaultMeta !== void 0 ? { meta: state.vaultMeta } : {},
6469
- collections,
6470
- materializedViews,
6471
- overlayViews,
6472
- derivations,
6473
- ...internal !== void 0 ? { internal } : {}
6474
- };
6475
- return snap;
6476
- }
6477
- async function safeListAllCollections(adapter, vault) {
6478
- try {
6479
- const snap = await adapter.loadAll(vault);
6480
- return Object.keys(snap);
6481
- } catch {
6482
- return [];
6483
- }
6484
- }
6485
- async function describeCollection(state, collectionName, sampleSize, withStats) {
6486
- let fields = {};
6487
- let validator;
6488
- const refsRaw = state.refRegistry.getOutbound(collectionName);
6489
- const refs = {};
6490
- for (const [name, desc] of Object.entries(refsRaw)) {
6491
- refs[name] = { target: desc.target, mode: desc.mode };
6492
- }
6493
- try {
6494
- const dek = await state.getDEK(collectionName);
6495
- const persisted = await loadPersistedSchema(state.adapter, state.name, collectionName, dek);
6496
- if (persisted) {
6497
- validator = { kind: persisted.kind, source: "persisted" };
6498
- if (persisted.jsonSchema) {
6499
- fields = jsonSchemaToFields(persisted.jsonSchema, "persisted", refsRaw);
6500
- }
6501
- }
6502
- } catch {
6503
- }
6504
- const liveColl = state.collectionCache.get(collectionName);
6505
- if (!validator) {
6506
- const schema = liveColl?.getSchema();
6507
- if (schema) {
6508
- try {
6509
- const derived = await derivePersistedSchema(schema);
6510
- validator = { kind: derived.kind, source: "live-validator" };
6511
- if (derived.jsonSchema) {
6512
- fields = jsonSchemaToFields(derived.jsonSchema, "live-validator", refsRaw);
6513
- }
6514
- } catch {
6515
- }
6516
- }
6517
- }
6518
- if (Object.keys(fields).length === 0 && sampleSize > 0) {
6519
- }
6520
- const collMeta = liveColl?.getMeta();
6521
- const collConfig = liveColl?.getConfig();
6522
- const archivePresent = state.hasCollectionArchive?.(collectionName) === true;
6523
- const schemaUpdateNames = state.getCollectionSchemaUpdateNames?.(collectionName);
6524
- const hasSchemaUpdate = schemaUpdateNames !== void 0 && schemaUpdateNames.length > 0;
6525
- let mergedConfig;
6526
- if (collConfig !== void 0 || archivePresent || hasSchemaUpdate) {
6527
- mergedConfig = {
6528
- ...collConfig ?? {},
6529
- ...archivePresent ? { archive: true } : {},
6530
- ...hasSchemaUpdate ? { schemaUpdate: schemaUpdateNames } : {}
6531
- };
6532
- }
6533
- const descriptor = {
6534
- fields,
6535
- indexes: [],
6536
- refs,
6537
- ...validator ? { validator } : {},
6538
- ...collMeta !== void 0 ? { meta: collMeta } : {},
6539
- ...mergedConfig !== void 0 ? { config: mergedConfig } : {}
6540
- };
6541
- if (withStats) {
6542
- const stats = await statsForCollection(state.adapter, state.name, collectionName);
6543
- descriptor.stats = stats;
6544
- }
6545
- return descriptor;
6546
- }
6547
- async function statsForCollection(adapter, vault, collection) {
6548
- const ids = await adapter.list(vault, collection);
6549
- if (ids.length === 0) {
6550
- return { records: 0, bytes: 0, bytesAvg: 0, bytesMin: 0, bytesMax: 0, oldest: "", newest: "" };
6551
- }
6552
- let total = 0;
6553
- let min = Number.POSITIVE_INFINITY;
6554
- let max = 0;
6555
- let oldest = "\uFFFF";
6556
- let newest = "";
6557
- for (const id of ids) {
6558
- const env = await adapter.get(vault, collection, id);
6559
- if (!env) continue;
6560
- const size = env._data.length;
6561
- total += size;
6562
- if (size < min) min = size;
6563
- if (size > max) max = size;
6564
- if (env._ts < oldest) oldest = env._ts;
6565
- if (env._ts > newest) newest = env._ts;
6566
- }
6567
- return {
6568
- records: ids.length,
6569
- bytes: total,
6570
- bytesAvg: Math.round(total / ids.length),
6571
- bytesMin: min === Number.POSITIVE_INFINITY ? 0 : min,
6572
- bytesMax: max,
6573
- oldest: oldest === "\uFFFF" ? "" : oldest,
6574
- newest
6575
- };
6576
- }
6577
- function describeMVs(registry) {
6578
- if (!registry || typeof registry !== "object") return {};
6579
- const items = listFromRegistry(registry);
6580
- const out = {};
6581
- for (const item of items) {
6582
- const reg = item;
6583
- const spec = reg.spec;
6584
- if (!spec?.name) continue;
6585
- const sources = spec.unionSources ? spec.unionSources.map((u) => u.collection) : reg.dependencies ? [...reg.dependencies].sort() : [];
6586
- const groupBy = spec.groupBy ? Array.isArray(spec.groupBy) ? [...spec.groupBy] : [spec.groupBy] : void 0;
6587
- const aggregate = spec.aggregate ? Object.fromEntries(
6588
- Object.entries(spec.aggregate).map(([k, v]) => [k, summariseAggregateOp(v)])
6589
- ) : void 0;
6590
- out[spec.name] = {
6591
- sources,
6592
- ...groupBy ? { groupBy } : {},
6593
- ...aggregate ? { aggregate } : {},
6594
- refresh: spec.refresh ?? "eager"
6595
- };
6596
- }
6597
- return out;
6598
- }
6599
- function describeOverlays(registry) {
6600
- if (!registry || typeof registry !== "object") return {};
6601
- const specs = listFromRegistry(registry);
6602
- const out = {};
6603
- for (const spec of specs) {
6604
- const s = spec;
6605
- if (!s.name || !s.base || !s.overlay) continue;
6606
- out[s.name] = { base: s.base, overlay: s.overlay };
6607
- }
6608
- return out;
6609
- }
6610
- function describeDerivations(registry) {
6611
- if (!registry || typeof registry !== "object") return {};
6612
- const items = listFromRegistry(registry);
6613
- const out = {};
6614
- for (const item of items) {
6615
- const reg = item;
6616
- const s = reg.spec ?? reg;
6617
- if (!s.source) continue;
6618
- const outputCollections = s.outputs ? Object.values(s.outputs).map((o) => o.collection) : [];
6619
- const key = outputCollections.length > 0 ? [...outputCollections].sort().join("+") : s.source;
6620
- out[key] = {
6621
- source: s.source,
6622
- outputs: outputCollections
6623
- };
6624
- }
6625
- return out;
6626
- }
6627
- function listFromRegistry(reg) {
6628
- for (const method of ["all", "list", "specs", "values"]) {
6629
- const fn = reg[method];
6630
- if (typeof fn === "function") {
6631
- try {
6632
- const out = fn.call(reg);
6633
- if (Array.isArray(out)) return out;
6634
- if (out && typeof out.values === "function") {
6635
- return [...out.values()];
6636
- }
6637
- } catch {
6638
- continue;
6639
- }
6640
- }
6641
- }
6642
- return [];
6643
- }
6644
- function summariseAggregateOp(value) {
6645
- if (value && typeof value === "object") {
6646
- const op = value.op ?? value.kind;
6647
- const field = value.field;
6648
- if (op && field) return `${op}(${field})`;
6649
- if (op) return op;
6650
- }
6651
- return String(value);
6652
- }
6653
-
6654
5959
  // src/kernel/vault.ts
6655
5960
  function resolveLabelFromMap(labels, locale, fallback) {
6656
5961
  if (labels[locale] !== void 0) return labels[locale];
@@ -6703,6 +6008,7 @@ var Vault = class {
6703
6008
  /** Per-collection record archival policies. Indexed by collection name. */
6704
6009
  archiveRegistry = /* @__PURE__ */ new Map();
6705
6010
  indexStrategy;
6011
+ lazyStrategy;
6706
6012
  aggregateStrategy;
6707
6013
  crdtStrategy;
6708
6014
  tiersStrategy;
@@ -6922,7 +6228,7 @@ var Vault = class {
6922
6228
  dictionaryCache = /* @__PURE__ */ new Map();
6923
6229
  /** Registered link specs, keyed by link name; set by `vault.link()`. */
6924
6230
  linkRegistry = /* @__PURE__ */ new Map();
6925
- /** Cache of LinkSet handles, one per link name. */
6231
+ /** Cache of link-set handles, one per link name (lazy -- see links()). */
6926
6232
  linkSetCache = /* @__PURE__ */ new Map();
6927
6233
  /** — subscribers for cross-tier access events. */
6928
6234
  crossTierSubs = /* @__PURE__ */ new Set();
@@ -6956,6 +6262,7 @@ var Vault = class {
6956
6262
  this.objectStore = opts.objectStore;
6957
6263
  this.archiveStrategy = opts.archiveStrategy;
6958
6264
  this.indexStrategy = opts.indexStrategy;
6265
+ this.lazyStrategy = opts.lazyStrategy;
6959
6266
  this.aggregateStrategy = opts.aggregateStrategy;
6960
6267
  this.crdtStrategy = opts.crdtStrategy;
6961
6268
  this.tiersStrategy = opts.tiersStrategy;
@@ -7150,6 +6457,7 @@ var Vault = class {
7150
6457
  const strategies = options.schemaUpdate ?? [];
7151
6458
  const work = (async () => {
7152
6459
  const dek = await this.getDEK(collectionName);
6460
+ const { persistSchemaIfNeeded } = await import("./register-K6DDSIXN.js");
7153
6461
  const result = await persistSchemaIfNeeded({
7154
6462
  store: this.adapter,
7155
6463
  vault: this.name,
@@ -7161,7 +6469,7 @@ var Vault = class {
7161
6469
  const decision = result.decision ?? { action: "allow" };
7162
6470
  if (decision.action === "cutover") {
7163
6471
  this.schemaFence.registerPendingCutover(collectionName, decision.transform);
7164
- this._ensureFenceCoordination();
6472
+ await this._ensureFenceCoordination();
7165
6473
  }
7166
6474
  return decision;
7167
6475
  })();
@@ -7195,6 +6503,7 @@ var Vault = class {
7195
6503
  ...this.objectStore !== void 0 ? { objectStore: this.objectStore } : {},
7196
6504
  ...options?.blobFields !== void 0 ? { blobFields: options.blobFields } : {},
7197
6505
  ...this.indexStrategy !== void 0 ? { indexStrategy: this.indexStrategy } : {},
6506
+ ...this.lazyStrategy !== void 0 ? { lazyStrategy: this.lazyStrategy } : {},
7198
6507
  ...this.aggregateStrategy !== void 0 ? { aggregateStrategy: this.aggregateStrategy } : {},
7199
6508
  ...this.crdtStrategy !== void 0 ? { crdtStrategy: this.crdtStrategy } : {},
7200
6509
  ...this.tiersStrategy !== void 0 ? { tiersStrategy: this.tiersStrategy } : {},
@@ -7252,6 +6561,9 @@ var Vault = class {
7252
6561
  if (options?.acknowledgeDeterministicRisk !== void 0) {
7253
6562
  collOpts.acknowledgeDeterministicRisk = options.acknowledgeDeterministicRisk;
7254
6563
  }
6564
+ if (options?.acknowledgeEquatableRisk !== void 0) {
6565
+ collOpts.acknowledgeEquatableRisk = options.acknowledgeEquatableRisk;
6566
+ }
7255
6567
  if (options?.sensitive !== void 0) {
7256
6568
  collOpts.sensitive = options.sensitive;
7257
6569
  }
@@ -7324,7 +6636,7 @@ var Vault = class {
7324
6636
  const work = (async () => {
7325
6637
  try {
7326
6638
  const dek = await this.getDEK(collectionName);
7327
- await persistSchemaIfNeeded({
6639
+ await (await import("./register-K6DDSIXN.js")).persistSchemaIfNeeded({
7328
6640
  store: this.adapter,
7329
6641
  vault: this.name,
7330
6642
  collectionName,
@@ -7408,10 +6720,12 @@ var Vault = class {
7408
6720
  async schemaFenceState() {
7409
6721
  return loadFence(this.adapter, this.name);
7410
6722
  }
7411
- /** @internal Start the per-client heartbeat + fence watcher once a cutover is registered. */
7412
- _ensureFenceCoordination() {
6723
+ /** @internal Start heartbeat + fence watcher once a cutover is registered. Async since #553: FenceWatcher dynamic-imports on demand. */
6724
+ async _ensureFenceCoordination() {
7413
6725
  if (this.#fenceCoordinationStarted) return;
7414
6726
  this.#fenceCoordinationStarted = true;
6727
+ const { FenceWatcher } = await import("./fence-watcher-DHQ775JB.js");
6728
+ if (!this.#fenceCoordinationStarted) return;
7415
6729
  this.#fenceWatcher = new FenceWatcher({
7416
6730
  coordination: this.noydb.coordination,
7417
6731
  vault: this.name,
@@ -7440,7 +6754,7 @@ var Vault = class {
7440
6754
  }
7441
6755
  /** @internal Drive one heartbeat + watch cycle deterministically (tests). */
7442
6756
  async _fenceTick() {
7443
- this._ensureFenceCoordination();
6757
+ await this._ensureFenceCoordination();
7444
6758
  await this.#fenceWatcher.beat();
7445
6759
  await this.#fenceWatcher.check();
7446
6760
  }
@@ -7652,17 +6966,17 @@ var Vault = class {
7652
6966
  if (!spec) {
7653
6967
  throw new ValidationError(`vault.links("${name}"): not declared. Call vault.link("${name}", { a, b }) first.`);
7654
6968
  }
7655
- handle = new LinkSet(
7656
- this.adapter,
7657
- this.name,
6969
+ handle = makeLazyLinkSetHandle({
6970
+ adapter: this.adapter,
6971
+ vault: this.name,
7658
6972
  name,
7659
6973
  spec,
7660
- this.encrypted,
7661
- this.getDEK,
7662
- this.keyring.userId,
7663
- this.emitter,
7664
- async (collection, id) => await this.collection(collection).get(id) !== null
7665
- );
6974
+ encrypted: this.encrypted,
6975
+ getDEK: this.getDEK,
6976
+ actor: this.keyring.userId,
6977
+ emitter: this.emitter,
6978
+ endpointExists: async (collection, id) => await this.collection(collection).get(id) !== null
6979
+ });
7666
6980
  this.linkSetCache.set(name, handle);
7667
6981
  }
7668
6982
  return handle;
@@ -8171,8 +7485,14 @@ var Vault = class {
8171
7485
  if (live?._sealed !== void 0) {
8172
7486
  try {
8173
7487
  const cls = await coll._classifySealedShred(live);
8174
- sealedFieldsShredded += cls.shreddable.length;
8175
- for (const field of cls.dekResidue) sealedResidue.push(`${ref2.collection}:${ref2.id}:${field}`);
7488
+ for (const slot of cls.slots) {
7489
+ if (slot.class === "shreddable" || slot.class === "live-shreddable+dekResidue-in-backups") {
7490
+ sealedFieldsShredded += 1;
7491
+ }
7492
+ if (slot.class === "dekResidue" || slot.class === "live-shreddable+dekResidue-in-backups") {
7493
+ sealedResidue.push(`${ref2.collection}:${ref2.id}:${slot.field}`);
7494
+ }
7495
+ }
8176
7496
  } catch {
8177
7497
  for (const field of Object.keys(live._sealed)) sealedResidue.push(`${ref2.collection}:${ref2.id}:${field}`);
8178
7498
  }
@@ -8231,7 +7551,7 @@ var Vault = class {
8231
7551
  indexResidue.push(`${collName}:_ftindex`);
8232
7552
  }
8233
7553
  }
8234
- const subjectHash = await sha256Hex2(subjectId);
7554
+ const subjectHash = await sha256Hex(subjectId);
8235
7555
  const ledger = this.getLedgerOrNull();
8236
7556
  if (!ledger) {
8237
7557
  throw new Error(
@@ -8399,7 +7719,7 @@ var Vault = class {
8399
7719
  async _initDerivations(handles) {
8400
7720
  if (handles.length === 0) return;
8401
7721
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
8402
- import("./registry-6HZ2JSQ7.js"),
7722
+ import("./registry-IMNMHWTM.js"),
8403
7723
  import("./read-only-facade-5ADRJVTM.js")
8404
7724
  ]);
8405
7725
  const registry = new DerivationRegistry();
@@ -8430,7 +7750,7 @@ var Vault = class {
8430
7750
  */
8431
7751
  async _initMaterializedViews(handles) {
8432
7752
  if (handles.length === 0) return;
8433
- const { MaterializedViewRegistry } = await import("./registry-USYD2ECC.js");
7753
+ const { MaterializedViewRegistry } = await import("./registry-K6VUQXKV.js");
8434
7754
  const registry = new MaterializedViewRegistry();
8435
7755
  this.materializedViewRegistry = registry;
8436
7756
  const db = this;
@@ -8454,7 +7774,7 @@ var Vault = class {
8454
7774
  */
8455
7775
  async _initOverlayedViews(handles) {
8456
7776
  if (handles.length === 0) return;
8457
- const { OverlayedViewRegistry } = await import("./registry-GPXZQ7DT.js");
7777
+ const { OverlayedViewRegistry } = await import("./registry-ZVO3T4M5.js");
8458
7778
  const registry = new OverlayedViewRegistry();
8459
7779
  const mvRegistry = this.materializedViewRegistry;
8460
7780
  const overlayNames = /* @__PURE__ */ new Set();
@@ -8501,13 +7821,13 @@ var Vault = class {
8501
7821
  if (!reg) {
8502
7822
  throw new Error(`refreshView: no MV registered with name "${name}"`);
8503
7823
  }
8504
- const { MaterializedViewExecutor } = await import("./executor-OIECZXTV.js");
7824
+ const { MaterializedViewExecutor } = await import("./executor-FGISLQIN.js");
8505
7825
  const result = await MaterializedViewExecutor.refresh(reg, {
8506
7826
  getCollection: (n) => this.collection(n),
8507
7827
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
8508
7828
  getQueryContext: () => this
8509
7829
  });
8510
- const { clearMVStale } = await import("./stale-LX4BR43V.js");
7830
+ const { clearMVStale } = await import("./stale-7Q62KVI3.js");
8511
7831
  clearMVStale(registry, name);
8512
7832
  return result;
8513
7833
  }
@@ -8523,7 +7843,7 @@ var Vault = class {
8523
7843
  if (registry === null) return { derived: 0, failed: 0 };
8524
7844
  const strategies = registry.strategiesForSource(sourceCollection);
8525
7845
  if (strategies.length === 0) return { derived: 0, failed: 0 };
8526
- const { DerivationExecutor } = await import("./executor-ANFBCOYA.js");
7846
+ const { DerivationExecutor } = await import("./executor-CBTNU5VZ.js");
8527
7847
  const sourceColl = this.collection(sourceCollection);
8528
7848
  const records = await sourceColl.list();
8529
7849
  const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-5ADRJVTM.js")).ReadOnlyVaultFacade(this, "derivation") };
@@ -8548,7 +7868,7 @@ var Vault = class {
8548
7868
  if (!outSpec) continue;
8549
7869
  const outputColl = this.collection(outSpec.collection);
8550
7870
  if (out.kind === "array") {
8551
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-DDKRG2MX.js");
7871
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-WS22Q5WH.js");
8552
7872
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
8553
7873
  const prevKeys = new Set(prior?.keys ?? []);
8554
7874
  const newKeysList = out.entries.map((e) => e.key);
@@ -8698,11 +8018,11 @@ var Vault = class {
8698
8018
  *
8699
8019
  *.
8700
8020
  */
8701
- async withConsent(ctx, fn) {
8021
+ async withConsent(ctx, fn2) {
8702
8022
  const prior = this.consentContext;
8703
8023
  this.consentContext = ctx;
8704
8024
  try {
8705
- return await fn();
8025
+ return await fn2();
8706
8026
  } finally {
8707
8027
  this.consentContext = prior;
8708
8028
  }
@@ -8770,7 +8090,7 @@ var Vault = class {
8770
8090
  * collection.
8771
8091
  */
8772
8092
  async delegate(opts) {
8773
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4HUHUE6T.js");
8093
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-BQNIEHZE.js");
8774
8094
  if (!this.keyring.kek) {
8775
8095
  throw new ValidationError(
8776
8096
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
@@ -8792,7 +8112,7 @@ var Vault = class {
8792
8112
  * if the id does not exist.
8793
8113
  */
8794
8114
  async revokeDelegation(id) {
8795
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4HUHUE6T.js");
8115
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-BQNIEHZE.js");
8796
8116
  await revokeDelegation(this.adapter, this.name, id);
8797
8117
  void DELEGATIONS_COLLECTION;
8798
8118
  }
@@ -9008,6 +8328,7 @@ var Vault = class {
9008
8328
  * @see docs/superpowers/specs/2026-05-22-schema-dump-design.md
9009
8329
  */
9010
8330
  async dumpSchema(opts = {}) {
8331
+ const { dumpVaultSchema } = await import("./walk-5C3GPKT2.js");
9011
8332
  return dumpVaultSchema(this, opts);
9012
8333
  }
9013
8334
  /**
@@ -9142,7 +8463,7 @@ var Vault = class {
9142
8463
  * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md
9143
8464
  */
9144
8465
  async getPublicEnvelope(opts = {}) {
9145
- const { readPublicEnvelope } = await import("./public-envelope-WVRRUVAJ.js");
8466
+ const { readPublicEnvelope } = await import("./public-envelope-MRN5YYZZ.js");
9146
8467
  return readPublicEnvelope(this.adapter, this.name, opts);
9147
8468
  }
9148
8469
  /**
@@ -9157,7 +8478,7 @@ var Vault = class {
9157
8478
  * both modes round-trip cleanly.
9158
8479
  */
9159
8480
  async dump() {
9160
- const { dumpVault } = await import("./backup-NGRJ46SH.js");
8481
+ const { dumpVault } = await import("./backup-MOB27UUN.js");
9161
8482
  return dumpVault(this.backupContext());
9162
8483
  }
9163
8484
  /**
@@ -9209,7 +8530,7 @@ var Vault = class {
9209
8530
  * — there's no chain to verify against.
9210
8531
  */
9211
8532
  async load(backupJson) {
9212
- const { loadVault } = await import("./backup-NGRJ46SH.js");
8533
+ const { loadVault } = await import("./backup-MOB27UUN.js");
9213
8534
  return loadVault(this.backupContext(), backupJson);
9214
8535
  }
9215
8536
  /**
@@ -9241,7 +8562,7 @@ var Vault = class {
9241
8562
  * way to detect tampering of an in-place vault.
9242
8563
  */
9243
8564
  async verifyBackupIntegrity() {
9244
- const { verifyBackupIntegrity } = await import("./backup-NGRJ46SH.js");
8565
+ const { verifyBackupIntegrity } = await import("./backup-MOB27UUN.js");
9245
8566
  return verifyBackupIntegrity(this.backupContext());
9246
8567
  }
9247
8568
  /**
@@ -9459,7 +8780,7 @@ var Vault = class {
9459
8780
  * is the live validator object, not a serialization of it).
9460
8781
  */
9461
8782
  async exportJSON(opts = {}) {
9462
- const { exportVaultJSON } = await import("./backup-NGRJ46SH.js");
8783
+ const { exportVaultJSON } = await import("./backup-MOB27UUN.js");
9463
8784
  return exportVaultJSON(this.backupContext(), opts);
9464
8785
  }
9465
8786
  };
@@ -9536,10 +8857,10 @@ var WriteQueueTracker = class {
9536
8857
  * (success or failure). The fn's resolved value is returned; a thrown
9537
8858
  * error is re-thrown after the queue is decremented.
9538
8859
  */
9539
- async track(fn) {
8860
+ async track(fn2) {
9540
8861
  this.begin();
9541
8862
  try {
9542
- const value = await fn();
8863
+ const value = await fn2();
9543
8864
  this.settle();
9544
8865
  return value;
9545
8866
  } catch (error) {
@@ -9624,13 +8945,13 @@ var TabCoordinator = class {
9624
8945
  const out = [self, ...[...this.#peers.values()].filter((p) => p.lastSeen >= cutoff)];
9625
8946
  return out.sort((a, b) => a.tabId.localeCompare(b.tabId));
9626
8947
  }
9627
- onTabRoleChange(fn) {
9628
- this.#roleHandlers.add(fn);
9629
- return () => this.#roleHandlers.delete(fn);
8948
+ onTabRoleChange(fn2) {
8949
+ this.#roleHandlers.add(fn2);
8950
+ return () => this.#roleHandlers.delete(fn2);
9630
8951
  }
9631
- onActiveTabsChange(fn) {
9632
- this.#tabsHandlers.add(fn);
9633
- return () => this.#tabsHandlers.delete(fn);
8952
+ onActiveTabsChange(fn2) {
8953
+ this.#tabsHandlers.add(fn2);
8954
+ return () => this.#tabsHandlers.delete(fn2);
9634
8955
  }
9635
8956
  dispose() {
9636
8957
  if (this.#disposed) return;
@@ -10327,6 +9648,35 @@ var TeamFacade = class {
10327
9648
  }
10328
9649
  return p;
10329
9650
  }
9651
+ // ─── Multi-user grant / revoke / rotate runners (#267 team split) ──
9652
+ //
9653
+ // The kernel's `db.grant` / `db.revoke` / `db.rotate` route through the
9654
+ // TeamStrategy seam, which calls back here with the keyring ENGINE as an
9655
+ // argument (statically linked in `active.ts`, i.e. only in the
9656
+ // `@noy-db/hub/team` subpath bundle). These runners own the policy-gate +
9657
+ // keyring plumbing so the kernel keeps single-line delegators and the
9658
+ // engines stay off the single-user floor.
9659
+ /** Gate + run a `grant` engine. See `Noydb.grant` for the public contract. */
9660
+ async runGrant(engine, vault, options, factors) {
9661
+ this.deps.checkPolicyOperation(vault, "grant");
9662
+ await this.deps.checkGate(vault, "enroll-user", factors);
9663
+ const keyring = await this.deps.getKeyringInternal(vault);
9664
+ await engine(this.deps.options.store, vault, keyring, options);
9665
+ }
9666
+ /** Gate + run a `revoke` engine. See `Noydb.revoke` for the public contract. */
9667
+ async runRevoke(engine, vault, options, factors) {
9668
+ this.deps.checkPolicyOperation(vault, "revoke");
9669
+ await this.deps.checkGate(vault, "revoke-user", factors);
9670
+ const keyring = await this.deps.getKeyringInternal(vault);
9671
+ await engine(this.deps.options.store, vault, keyring, options);
9672
+ }
9673
+ /** Gate + run a `rotateKeys` engine. See `Noydb.rotate` for the public contract. */
9674
+ async runRotate(engine, vault, collections) {
9675
+ this.deps.checkPolicyOperation(vault, "rotate");
9676
+ const keyring = await this.deps.getKeyringInternal(vault);
9677
+ await engine(this.deps.options.store, vault, keyring, collections);
9678
+ this.deps.keyringCache.set(vault, keyring);
9679
+ }
10330
9680
  // ─── Tier-2 enroll / remove ─────────────────────────────────────
10331
9681
  /**
10332
9682
  * Add a tier-2 authenticator slot to the calling user's keyring.
@@ -11072,6 +10422,15 @@ var Noydb = class {
11072
10422
  /** Pre-resolved `vault.user` API factory (mirrors `coordinationProvider` above). Public so `Vault` can call it. */
11073
10423
  userApiFactory;
11074
10424
  vaultCache = /* @__PURE__ */ new Map();
10425
+ /**
10426
+ * In-flight `openVault` promise per name — concurrent opens of the same
10427
+ * vault must converge on ONE Vault instance. Without this, two callers
10428
+ * racing past the `vaultCache` miss each construct a Vault (and later two
10429
+ * Collections with independent DEKs for the same store slice), so a record
10430
+ * written through one fails decryption through the other with a spurious
10431
+ * `TamperedError` (#564).
10432
+ */
10433
+ vaultOpening = /* @__PURE__ */ new Map();
11075
10434
  keyringCache = /* @__PURE__ */ new Map();
11076
10435
  syncEngines = /* @__PURE__ */ new Map();
11077
10436
  /**
@@ -11111,6 +10470,11 @@ var Noydb = class {
11111
10470
  * through it; grant/revoke route through it from this class. @internal
11112
10471
  */
11113
10472
  custodyStrategy;
10473
+ /**
10474
+ * Opt-in multi-user team strategy (#267 keyring-grant → team split) —
10475
+ * `NO_TEAM` (throwing) unless `withTeam()` was passed; the keyring
10476
+ * engines are linked only by the active strategy, not by this file. */
10477
+ teamStrategy;
11114
10478
  sessionStrategy;
11115
10479
  syncStrategy;
11116
10480
  snapshots;
@@ -11161,6 +10525,7 @@ var Noydb = class {
11161
10525
  this.txStrategy = options.txStrategy ?? NO_TX;
11162
10526
  this.forgetStrategy = options.forgetStrategy ?? NO_FORGET;
11163
10527
  this.custodyStrategy = options.custodyStrategy ?? NO_CUSTODY;
10528
+ this.teamStrategy = options.teamStrategy ?? NO_TEAM;
11164
10529
  this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
11165
10530
  this.syncStrategy = options.syncStrategy ?? NO_SYNC;
11166
10531
  this.snapshots = new NoydbSnapshots({
@@ -11192,6 +10557,7 @@ var Noydb = class {
11192
10557
  quickUnlock: this.quickUnlock,
11193
10558
  policyCache: this.policyCache,
11194
10559
  checkGate: (vault, gate, factors) => this.checkGate(vault, gate, factors),
10560
+ checkPolicyOperation: (vault, op) => this.checkPolicyOperation(vault, op),
11195
10561
  getKeyringInternal: (vault, opts) => this._getKeyringInternal(vault, opts),
11196
10562
  assertRecoveryEnrolled: (vault, policy, opts) => this.assertRecoveryEnrolled(vault, policy, opts),
11197
10563
  openVault: (vault, opts) => this.openVault(vault, opts),
@@ -11286,7 +10652,7 @@ var Noydb = class {
11286
10652
  if (!facade) return;
11287
10653
  const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
11288
10654
  await registry.runChecks(e.collection, incoming, ctx);
11289
- const { GuardExecutor } = await import("./executor-IKT47SH2.js");
10655
+ const { GuardExecutor } = await import("./executor-DJHNSTIR.js");
11290
10656
  for (const g of guards) {
11291
10657
  await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
11292
10658
  }
@@ -11381,12 +10747,26 @@ var Noydb = class {
11381
10747
  if (this.closed) throw new ValidationError("Instance is closed");
11382
10748
  this.touchPolicy(name);
11383
10749
  let comp = this.vaultCache.get(name);
10750
+ if (!comp) {
10751
+ const pending = this.vaultOpening.get(name);
10752
+ if (pending) comp = await pending;
10753
+ }
11384
10754
  if (comp) {
11385
10755
  if (opts?.locale !== void 0) {
11386
10756
  comp.setLocale(opts.locale);
11387
10757
  }
11388
10758
  return comp;
11389
10759
  }
10760
+ const opening = this.#openVaultFresh(name, opts);
10761
+ this.vaultOpening.set(name, opening);
10762
+ try {
10763
+ return await opening;
10764
+ } finally {
10765
+ this.vaultOpening.delete(name);
10766
+ }
10767
+ }
10768
+ /** Uncached single-flight body of {@link openVault} — see `vaultOpening`. */
10769
+ async #openVaultFresh(name, opts) {
11390
10770
  const keyring = await this._getKeyringInternal(name, { create: opts?.create !== false });
11391
10771
  if (!this.activeTier.has(name)) {
11392
10772
  this.activeTier.set(name, 1);
@@ -11427,7 +10807,7 @@ var Noydb = class {
11427
10807
  this.syncEngines.set(key, engine);
11428
10808
  }
11429
10809
  }
11430
- comp = new Vault({
10810
+ const comp = new Vault({
11431
10811
  adapter: this.options.store,
11432
10812
  name,
11433
10813
  noydb: this,
@@ -11448,6 +10828,7 @@ var Noydb = class {
11448
10828
  ...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
11449
10829
  ...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
11450
10830
  ...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
10831
+ ...this.options.lazyStrategy !== void 0 ? { lazyStrategy: this.options.lazyStrategy } : {},
11451
10832
  ...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
11452
10833
  ...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
11453
10834
  ...this.options.tiersStrategy !== void 0 ? { tiersStrategy: this.options.tiersStrategy } : {},
@@ -11514,6 +10895,7 @@ var Noydb = class {
11514
10895
  ...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
11515
10896
  ...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
11516
10897
  ...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
10898
+ ...this.options.lazyStrategy !== void 0 ? { lazyStrategy: this.options.lazyStrategy } : {},
11517
10899
  ...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
11518
10900
  ...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
11519
10901
  ...this.options.tiersStrategy !== void 0 ? { tiersStrategy: this.options.tiersStrategy } : {},
@@ -11554,6 +10936,7 @@ var Noydb = class {
11554
10936
  ...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
11555
10937
  ...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
11556
10938
  ...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
10939
+ ...this.options.lazyStrategy !== void 0 ? { lazyStrategy: this.options.lazyStrategy } : {},
11557
10940
  ...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
11558
10941
  ...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
11559
10942
  ...this.options.tiersStrategy !== void 0 ? { tiersStrategy: this.options.tiersStrategy } : {},
@@ -11581,12 +10964,10 @@ var Noydb = class {
11581
10964
  *
11582
10965
  * The legacy `requireReAuthFor: ['grant']` session-policy check still
11583
10966
  * fires on top — both are independent opt-ins.
10967
+ * Opt-in (#267): throws {@link TeamNotEnabledError} without `withTeam()`.
11584
10968
  */
11585
10969
  async grant(vault, options, factors) {
11586
- this.checkPolicyOperation(vault, "grant");
11587
- await this.checkGate(vault, "enroll-user", factors);
11588
- const keyring = await this._getKeyringInternal(vault);
11589
- await grant(this.options.store, vault, keyring, options);
10970
+ return this.teamStrategy.grant(this.team, vault, options, factors);
11590
10971
  }
11591
10972
  /**
11592
10973
  * Revoke a user's access to a vault.
@@ -11596,12 +10977,10 @@ var Noydb = class {
11596
10977
  *
11597
10978
  * The legacy `requireReAuthFor: ['revoke']` session-policy check still
11598
10979
  * fires on top — both are independent opt-ins.
10980
+ * Opt-in (#267): throws {@link TeamNotEnabledError} without `withTeam()`.
11599
10981
  */
11600
10982
  async revoke(vault, options, factors) {
11601
- this.checkPolicyOperation(vault, "revoke");
11602
- await this.checkGate(vault, "revoke-user", factors);
11603
- const keyring = await this._getKeyringInternal(vault);
11604
- await revoke(this.options.store, vault, keyring, options);
10983
+ return this.teamStrategy.revoke(this.team, vault, options, factors);
11605
10984
  }
11606
10985
  /**
11607
10986
  * Grant the FR-6 `custodian` role to a user (owner-only custody API).
@@ -11616,13 +10995,14 @@ var Noydb = class {
11616
10995
  async grantCustodian(vault, options, factors) {
11617
10996
  return this.custodyStrategy.grantCustodian(this, vault, options, factors);
11618
10997
  }
11619
- /** @internal — the grant-custodian engine, reached only when withCustody() is opted in. */
11620
- async _grantCustodianImpl(vault, options, factors) {
10998
+ /** @internal — grant-custodian engine, reached only via withCustody(); the
10999
+ * keyring engine arrives as an argument so the floor never carries it (#267). */
11000
+ async _grantCustodianImpl(engine, vault, options, factors) {
11621
11001
  this.checkPolicyOperation(vault, "grant");
11622
11002
  await this.checkGate(vault, "grant-custodian", factors);
11623
11003
  const keyring = await this._getKeyringInternal(vault);
11624
11004
  if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can grant a custodian");
11625
- await grant(this.options.store, vault, keyring, { ...options, role: "custodian" });
11005
+ await engine(this.options.store, vault, keyring, { ...options, role: "custodian" });
11626
11006
  }
11627
11007
  /**
11628
11008
  * Revoke a custodian (owner-only custody API).
@@ -11634,13 +11014,14 @@ var Noydb = class {
11634
11014
  async revokeCustodian(vault, options, factors) {
11635
11015
  return this.custodyStrategy.revokeCustodian(this, vault, options, factors);
11636
11016
  }
11637
- /** @internal — the revoke-custodian engine, reached only when withCustody() is opted in. */
11638
- async _revokeCustodianImpl(vault, options, factors) {
11017
+ /** @internal — revoke-custodian engine, reached only via withCustody().
11018
+ * Mirrors `_grantCustodianImpl` (#267: engine passed in). */
11019
+ async _revokeCustodianImpl(engine, vault, options, factors) {
11639
11020
  this.checkPolicyOperation(vault, "revoke");
11640
11021
  await this.checkGate(vault, "revoke-user", factors);
11641
11022
  const keyring = await this._getKeyringInternal(vault);
11642
11023
  if (keyring.role !== "owner") throw new PermissionDeniedError("only the Deed owner can revoke a custodian");
11643
- await revoke(this.options.store, vault, keyring, options);
11024
+ await engine(this.options.store, vault, keyring, options);
11644
11025
  }
11645
11026
  /**
11646
11027
  * Mutate post-grant identity fields on an existing keyring — `role`,
@@ -11707,12 +11088,10 @@ var Noydb = class {
11707
11088
  * Exposed on Noydb (rather than only on the lower-level keyring
11708
11089
  * module) so CLI and admin tooling can trigger rotation without
11709
11090
  * reaching into internals. See `noy-db rotate` for the CLI wrapper.
11091
+ * Opt-in (#267): throws {@link TeamNotEnabledError} without `withTeam()`.
11710
11092
  */
11711
11093
  async rotate(vault, collections) {
11712
- this.checkPolicyOperation(vault, "rotate");
11713
- const keyring = await this._getKeyringInternal(vault);
11714
- await rotateKeys(this.options.store, vault, keyring, collections);
11715
- this.keyringCache.set(vault, keyring);
11094
+ return this.teamStrategy.rotate(this.team, vault, collections);
11716
11095
  }
11717
11096
  /** List all users with access to a vault. */
11718
11097
  async listUsers(vault) {
@@ -11872,7 +11251,7 @@ var Noydb = class {
11872
11251
  * })
11873
11252
  * ```
11874
11253
  */
11875
- async queryAcross(vaultIds, fn, options = {}) {
11254
+ async queryAcross(vaultIds, fn2, options = {}) {
11876
11255
  if (this.closed) throw new ValidationError("Instance is closed");
11877
11256
  this.resetSessionTimer();
11878
11257
  const concurrency = Math.max(1, options.concurrency ?? 1);
@@ -11886,7 +11265,7 @@ var Noydb = class {
11886
11265
  const task = (async () => {
11887
11266
  try {
11888
11267
  const comp = await this.openVault(vaultId, { create: options.create !== false });
11889
- const result = await fn(comp);
11268
+ const result = await fn2(comp);
11890
11269
  results[idx] = { vault: vaultId, result };
11891
11270
  } catch (err) {
11892
11271
  results[idx] = {
@@ -12146,9 +11525,9 @@ var Noydb = class {
12146
11525
  return this.writeHooks.onAfterWrite(handler);
12147
11526
  }
12148
11527
  /** Subscribe to cross-tab write conflicts. Returns an unsubscribe. */
12149
- onWriteConflict(fn) {
12150
- this.on("write:conflict", fn);
12151
- return () => this.off("write:conflict", fn);
11528
+ onWriteConflict(fn2) {
11529
+ this.on("write:conflict", fn2);
11530
+ return () => this.off("write:conflict", fn2);
12152
11531
  }
12153
11532
  /**
12154
11533
  * Enable same-device multi-tab coordination: primary/secondary
@@ -12222,12 +11601,12 @@ var Noydb = class {
12222
11601
  activeTabs() {
12223
11602
  return this.tabCoordinator?.activeTabs() ?? [];
12224
11603
  }
12225
- onTabRoleChange(fn) {
12226
- return this.tabCoordinator?.onTabRoleChange(fn) ?? (() => {
11604
+ onTabRoleChange(fn2) {
11605
+ return this.tabCoordinator?.onTabRoleChange(fn2) ?? (() => {
12227
11606
  });
12228
11607
  }
12229
- onActiveTabsChange(fn) {
12230
- return this.tabCoordinator?.onActiveTabsChange(fn) ?? (() => {
11608
+ onActiveTabsChange(fn2) {
11609
+ return this.tabCoordinator?.onActiveTabsChange(fn2) ?? (() => {
12231
11610
  });
12232
11611
  }
12233
11612
  /** @internal The write-hook registry, threaded into each Collection. */
@@ -12526,7 +11905,7 @@ var Noydb = class {
12526
11905
  "setPublicEnvelope: the public-envelope feature is not enabled. Pass `publicEnvelope: true` (or a schema object) to `createNoydb`."
12527
11906
  );
12528
11907
  }
12529
- const { loadPublicEnvelope, savePublicEnvelope, resolveSchema, validatePublicEnvelopeInput } = await import("./public-envelope-WVRRUVAJ.js");
11908
+ const { loadPublicEnvelope, savePublicEnvelope, resolveSchema, validatePublicEnvelopeInput } = await import("./public-envelope-MRN5YYZZ.js");
12530
11909
  const schema = resolveSchema(this.options.publicEnvelope);
12531
11910
  validatePublicEnvelopeInput(input, schema);
12532
11911
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -12555,7 +11934,7 @@ var Noydb = class {
12555
11934
  * regardless).
12556
11935
  */
12557
11936
  async getPublicEnvelope(vault, opts = {}) {
12558
- const { readPublicEnvelope } = await import("./public-envelope-WVRRUVAJ.js");
11937
+ const { readPublicEnvelope } = await import("./public-envelope-MRN5YYZZ.js");
12559
11938
  return readPublicEnvelope(this.options.store, vault, opts);
12560
11939
  }
12561
11940
  // ─── Auth introspection ─────────────────────────────────────────
@@ -12746,9 +12125,9 @@ async function createNoydb(options) {
12746
12125
  throw new ValidationError("A secret (passphrase) or getKeyring callback is required when encryption is enabled");
12747
12126
  }
12748
12127
  if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
12749
- if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-LORZ2EZU.js")).createUserApi };
12128
+ if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-JOXUNSKP.js")).createUserApi };
12750
12129
  if (!options.policyFactory) {
12751
- const policyModule = await import("./policy-LRE6HTO5.js");
12130
+ const policyModule = await import("./policy-YIKUH4AD.js");
12752
12131
  options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
12753
12132
  }
12754
12133
  return new Noydb(options);
@@ -12765,13 +12144,6 @@ function normalizeSyncTargets(sync) {
12765
12144
  export {
12766
12145
  memoryStore,
12767
12146
  withArchive,
12768
- ComputedFieldError,
12769
- evalComputedFields,
12770
- isZodSchema,
12771
- derivePersistedSchema,
12772
- Lru,
12773
- parseBytes,
12774
- estimateRecordBytes,
12775
12147
  Collection,
12776
12148
  ELEVATION_AUDIT_COLLECTION,
12777
12149
  ElevatedHandle,
@@ -12781,10 +12153,6 @@ export {
12781
12153
  ref,
12782
12154
  refArray,
12783
12155
  RefRegistry,
12784
- isLinkCollectionName,
12785
- LinkEndpointError,
12786
- LinkIntegrityError,
12787
- persistSchemaIfNeeded,
12788
12156
  Vault,
12789
12157
  QuickUnlockStore,
12790
12158
  describeAuthConfig,
@@ -12794,4 +12162,4 @@ export {
12794
12162
  Noydb,
12795
12163
  createNoydb
12796
12164
  };
12797
- //# sourceMappingURL=chunk-ADBMJDBW.js.map
12165
+ //# sourceMappingURL=chunk-ZPHDGUZZ.js.map