@noy-db/hub 0.7.0-pre.8 → 0.7.0

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 (447) hide show
  1. package/CHANGELOG.md +1379 -0
  2. package/README.md +7 -6
  3. package/dist/api-TXFOVOXX.js +19 -0
  4. package/dist/as/index.js +14 -14
  5. package/dist/at/index.js +9 -10
  6. package/dist/attestation/index.js +18 -19
  7. package/dist/attestation/index.js.map +1 -1
  8. package/dist/{backup-SZBDQQSL.js → backup-IJTB4S4M.js} +14 -15
  9. package/dist/{backup-SZBDQQSL.js.map → backup-IJTB4S4M.js.map} +1 -1
  10. package/dist/blobs/index.js +13 -14
  11. package/dist/blobs/index.js.map +1 -1
  12. package/dist/broker/index.js +12 -13
  13. package/dist/broker/index.js.map +1 -1
  14. package/dist/by/index.js +2 -3
  15. package/dist/cargo/index.js +33 -34
  16. package/dist/{chunk-X6TBQKHW.js → chunk-2577DKXB.js} +2 -2
  17. package/dist/chunk-2C3AQB46.js +1652 -0
  18. package/dist/chunk-2C3AQB46.js.map +1 -0
  19. package/dist/{chunk-L3FHEWA3.js → chunk-2N4GY74U.js} +6 -6
  20. package/dist/{chunk-626TSARM.js → chunk-2Y4IMKA6.js} +4 -4
  21. package/dist/{chunk-7CWII4BL.js → chunk-3RCJJBNR.js} +10 -10
  22. package/dist/{chunk-M7UC2QPT.js → chunk-453F654R.js} +2 -2
  23. package/dist/{chunk-2QNKXGUS.js → chunk-4GVM6QZA.js} +2 -2
  24. package/dist/{chunk-AB5P32RE.js → chunk-4OZNXTO4.js} +2 -2
  25. package/dist/{chunk-L3HDEHGM.js → chunk-5VCRVKOZ.js} +4 -4
  26. package/dist/{chunk-6AQIFBSP.js → chunk-5WDXHNSW.js} +5 -5
  27. package/dist/chunk-66TQOPFM.js +37 -0
  28. package/dist/chunk-66TQOPFM.js.map +1 -0
  29. package/dist/{chunk-BOFRKAUS.js → chunk-6GMZ7HEE.js} +6 -6
  30. package/dist/{chunk-PRHCMEUK.js → chunk-6GOE5PGN.js} +168 -1328
  31. package/dist/chunk-6GOE5PGN.js.map +1 -0
  32. package/dist/{chunk-XBFEKTIY.js → chunk-6I2RQCET.js} +4 -4
  33. package/dist/{chunk-PUJTKLPL.js → chunk-6X6SEMEE.js} +6 -4
  34. package/dist/{chunk-PUJTKLPL.js.map → chunk-6X6SEMEE.js.map} +1 -1
  35. package/dist/{chunk-UCUALOSM.js → chunk-6YXCPL4T.js} +2 -2
  36. package/dist/{chunk-BYBB4ABD.js → chunk-77K4PG6P.js} +8 -8
  37. package/dist/{chunk-S2VG3ABP.js → chunk-7MG2LHO5.js} +3 -3
  38. package/dist/{chunk-GU3LQYW2.js → chunk-7MG7SJT7.js} +1 -1
  39. package/dist/chunk-7MG7SJT7.js.map +1 -0
  40. package/dist/{chunk-JBIV4FLR.js → chunk-7O3Y4PPD.js} +5 -1
  41. package/dist/chunk-7O3Y4PPD.js.map +1 -0
  42. package/dist/{chunk-EO2KGKEJ.js → chunk-7V4TP3AF.js} +4 -4
  43. package/dist/{chunk-LFDMKZIP.js → chunk-ANATMFIO.js} +5 -5
  44. package/dist/{chunk-T3PHCEN4.js → chunk-ANSIZYEG.js} +3 -3
  45. package/dist/{chunk-ZKRRBRSZ.js → chunk-AO42KJO6.js} +7 -7
  46. package/dist/{chunk-VFIWDPXZ.js → chunk-BLN54W3L.js} +3 -3
  47. package/dist/{chunk-ZQ2UUHSL.js → chunk-BM5TWITZ.js} +7 -7
  48. package/dist/{chunk-WLFABTZ6.js → chunk-BOET4NA4.js} +3 -3
  49. package/dist/{chunk-FOG7YEJP.js → chunk-BOWNCWZT.js} +3 -3
  50. package/dist/{chunk-7XODKGTW.js → chunk-BSFNRLK2.js} +5 -5
  51. package/dist/{chunk-YPSOHDNC.js → chunk-BUE2D7PX.js} +26 -3
  52. package/dist/chunk-BUE2D7PX.js.map +1 -0
  53. package/dist/{chunk-J4MN6XIU.js → chunk-BZ3534YM.js} +2 -2
  54. package/dist/chunk-CARABLSQ.js +176 -0
  55. package/dist/chunk-CARABLSQ.js.map +1 -0
  56. package/dist/{chunk-4MZEZ37W.js → chunk-CHJBLCOG.js} +10 -8
  57. package/dist/{chunk-4MZEZ37W.js.map → chunk-CHJBLCOG.js.map} +1 -1
  58. package/dist/{chunk-IF56DYJK.js → chunk-CPWQB3N5.js} +7 -7
  59. package/dist/{chunk-SHILAQH5.js → chunk-DGOZ4UZD.js} +2 -2
  60. package/dist/{chunk-BWWUXE3L.js → chunk-ELNXJMGB.js} +6 -6
  61. package/dist/{chunk-44C2URL7.js → chunk-EQEYOJBM.js} +3 -3
  62. package/dist/{chunk-Y3XWRDAM.js → chunk-EYBQEIUY.js} +3 -3
  63. package/dist/{chunk-Z7ZXZL6Y.js → chunk-FAHMLERK.js} +2 -2
  64. package/dist/chunk-FFWI7UH7.js +53 -0
  65. package/dist/chunk-FFWI7UH7.js.map +1 -0
  66. package/dist/{chunk-EXDIHWFO.js → chunk-FMZY5Q6L.js} +3 -3
  67. package/dist/{chunk-H6WXKZL7.js → chunk-FXBIP2WD.js} +6 -6
  68. package/dist/{chunk-ZTYG36DH.js → chunk-G56KBWFY.js} +67 -22
  69. package/dist/chunk-G56KBWFY.js.map +1 -0
  70. package/dist/{chunk-672U6STZ.js → chunk-GPEQUXHL.js} +4 -4
  71. package/dist/{chunk-Z2PWOSCJ.js → chunk-GY4WYNNG.js} +2 -2
  72. package/dist/{chunk-RDHUZ674.js → chunk-HDOU6I2Y.js} +80 -8
  73. package/dist/chunk-HDOU6I2Y.js.map +1 -0
  74. package/dist/{chunk-OMHHGOG4.js → chunk-J6FXAEUG.js} +15 -13
  75. package/dist/chunk-J6FXAEUG.js.map +1 -0
  76. package/dist/{chunk-4A4TYISP.js → chunk-JBDFMYKQ.js} +2 -2
  77. package/dist/{chunk-POS53FG6.js → chunk-JMGDHKQF.js} +2 -2
  78. package/dist/{chunk-Q7GEDVHC.js → chunk-K6LHRFBL.js} +7 -7
  79. package/dist/{chunk-4JDIRUTT.js → chunk-K7NTTA6P.js} +2 -2
  80. package/dist/{chunk-26W5VETY.js → chunk-KG7TZKZG.js} +5 -5
  81. package/dist/{chunk-RJ7RIIX6.js → chunk-KJIMGIWO.js} +8 -8
  82. package/dist/{chunk-F7ZFRPGQ.js → chunk-KTFRCC5C.js} +2 -2
  83. package/dist/{chunk-HSGEIMJS.js → chunk-KUJDV5QH.js} +5 -5
  84. package/dist/{chunk-XWNLKG6R.js → chunk-KUX3OB6D.js} +7 -5
  85. package/dist/{chunk-XWNLKG6R.js.map → chunk-KUX3OB6D.js.map} +1 -1
  86. package/dist/{chunk-UPJMBMCR.js → chunk-L742JPKZ.js} +6 -6
  87. package/dist/{chunk-4TZUFNXL.js → chunk-L7CIOOBW.js} +2 -2
  88. package/dist/{chunk-7LYUJNU3.js → chunk-LWBCUYZW.js} +2 -2
  89. package/dist/{chunk-JHLJQUXU.js → chunk-MUM7IANK.js} +3 -3
  90. package/dist/{chunk-2GXEQUEX.js → chunk-MVMXZYXT.js} +2 -2
  91. package/dist/{chunk-XLPXGN66.js → chunk-NA2NIJZI.js} +8 -8
  92. package/dist/{chunk-S6YB5ZRP.js → chunk-NKHRDYOR.js} +4 -4
  93. package/dist/{chunk-XJ3FEKEY.js → chunk-NQKIUNW5.js} +2 -2
  94. package/dist/{chunk-6NRVFD55.js → chunk-PT43Y56J.js} +6 -6
  95. package/dist/{chunk-5ACAVJUI.js → chunk-Q2PU57HC.js} +2 -2
  96. package/dist/{chunk-E6YA6UAP.js → chunk-Q7HZX3IF.js} +2 -2
  97. package/dist/{chunk-4ZPE6SKS.js → chunk-QIBVIOXO.js} +3 -3
  98. package/dist/{chunk-WLLUM35R.js → chunk-QIZPZMUI.js} +2 -2
  99. package/dist/{chunk-P6ASQOZR.js → chunk-REDOOY2Q.js} +3 -3
  100. package/dist/chunk-REDOOY2Q.js.map +1 -0
  101. package/dist/{chunk-LKFKXS5K.js → chunk-RMF67KCG.js} +2 -2
  102. package/dist/{chunk-YCSM3GZU.js → chunk-RMS3NEA3.js} +2 -2
  103. package/dist/{chunk-4FPEWQKF.js → chunk-RRNRNANG.js} +27 -17
  104. package/dist/chunk-RRNRNANG.js.map +1 -0
  105. package/dist/chunk-RTBJ5IOO.js +87 -0
  106. package/dist/chunk-RTBJ5IOO.js.map +1 -0
  107. package/dist/chunk-RXLYKVTF.js +17 -0
  108. package/dist/chunk-RXLYKVTF.js.map +1 -0
  109. package/dist/{chunk-OPXR4PB2.js → chunk-SFAWCTEM.js} +2 -2
  110. package/dist/{chunk-3QARDAYW.js → chunk-SKGMN35F.js} +2 -2
  111. package/dist/{chunk-W5LHQXZU.js → chunk-SL3JAAKN.js} +2 -2
  112. package/dist/chunk-SMH6SRX7.js +87 -0
  113. package/dist/chunk-SMH6SRX7.js.map +1 -0
  114. package/dist/{chunk-JJZIIJSA.js → chunk-SPXXX5E4.js} +12 -82
  115. package/dist/chunk-SPXXX5E4.js.map +1 -0
  116. package/dist/{chunk-UALOYGCP.js → chunk-SPYWXKJN.js} +3 -3
  117. package/dist/{chunk-QU3YUP2X.js → chunk-SZJ3DLZA.js} +2 -2
  118. package/dist/chunk-TFMM5DBB.js +20 -0
  119. package/dist/chunk-TFMM5DBB.js.map +1 -0
  120. package/dist/{chunk-225O5CXQ.js → chunk-TFR7DSOV.js} +2 -2
  121. package/dist/{chunk-X67FCULK.js → chunk-TRGTKX5E.js} +3 -3
  122. package/dist/{chunk-JVLSU7S2.js → chunk-TUFM4UZP.js} +2 -2
  123. package/dist/{chunk-VVAVTSTR.js → chunk-U4FOQDY4.js} +5 -172
  124. package/dist/chunk-U4FOQDY4.js.map +1 -0
  125. package/dist/{chunk-HTGRQZFB.js → chunk-UGTBXF5U.js} +3 -3
  126. package/dist/{chunk-THNJ3IKU.js → chunk-ULUMAZ5S.js} +2 -2
  127. package/dist/{chunk-XDVVBETV.js → chunk-UXVWEX5L.js} +2 -2
  128. package/dist/{chunk-FKFIEEY6.js → chunk-UXWB3FPF.js} +10 -10
  129. package/dist/{chunk-NO272T7Q.js → chunk-V4PXLYWM.js} +2 -31
  130. package/dist/chunk-V4PXLYWM.js.map +1 -0
  131. package/dist/{chunk-CBRS2NEK.js → chunk-VTFVLCUH.js} +2 -2
  132. package/dist/{chunk-TOV6VMHF.js → chunk-VXANTWBJ.js} +3 -3
  133. package/dist/{chunk-VSLUSXVK.js → chunk-VXGSWL6L.js} +6 -6
  134. package/dist/{chunk-KHKKD62N.js → chunk-VYYM3MEN.js} +2 -16
  135. package/dist/chunk-VYYM3MEN.js.map +1 -0
  136. package/dist/{chunk-HQINBNHM.js → chunk-WEQEYLCS.js} +7 -7
  137. package/dist/{chunk-U6GCYG2T.js → chunk-X2DLENDQ.js} +3 -3
  138. package/dist/{chunk-XVU7J43V.js → chunk-XLMEZIAJ.js} +2 -2
  139. package/dist/{chunk-ILSR22WM.js → chunk-XTXOCYOJ.js} +5 -5
  140. package/dist/{chunk-KDJGJR7F.js → chunk-YSRUYAVU.js} +2 -2
  141. package/dist/{chunk-NLKLXXTO.js → chunk-YYP7WSEB.js} +2 -2
  142. package/dist/{chunk-4G25SDQL.js → chunk-ZN4FD4PE.js} +4 -4
  143. package/dist/{chunk-XSN63FUS.js → chunk-ZORTV6NH.js} +2 -2
  144. package/dist/{chunk-S3I7VKID.js → chunk-ZVO4QVPD.js} +5 -5
  145. package/dist/classified/index.js +5 -6
  146. package/dist/{classified-marker-KL4YXUXD.js → classified-marker-LI2SF2E4.js} +3 -5
  147. package/dist/{classified-marker-KL4YXUXD.js.map → classified-marker-LI2SF2E4.js.map} +1 -1
  148. package/dist/collection-facade-4GRREZ6C.js +45 -0
  149. package/dist/computed-VPOKQK4N.js +10 -0
  150. package/dist/consent/index.js +9 -10
  151. package/dist/consent/index.js.map +1 -1
  152. package/dist/cover/index.js +9 -10
  153. package/dist/crdt/index.js +0 -1
  154. package/dist/crdt/index.js.map +1 -1
  155. package/dist/custody/index.js +12 -13
  156. package/dist/{dead-filter-ZGRFZKYE.js → dead-filter-TSWZQRR5.js} +2 -3
  157. package/dist/{dead-filter-ZGRFZKYE.js.map → dead-filter-TSWZQRR5.js.map} +1 -1
  158. package/dist/debug/index.js +1 -2
  159. package/dist/debug/index.js.map +1 -1
  160. package/dist/{delegation-2DO3VI5E.js → delegation-OVIFFPG4.js} +11 -12
  161. package/dist/{delegation-2DO3VI5E.js.map → delegation-OVIFFPG4.js.map} +1 -1
  162. package/dist/derivations/index.js +30 -16
  163. package/dist/derive-6O5SWQKN.js +21 -0
  164. package/dist/directory/index.js +10 -11
  165. package/dist/dispatch-S73TK3IY.js +302 -0
  166. package/dist/dispatch-S73TK3IY.js.map +1 -0
  167. package/dist/{dispatch-M62IAL2S.js → dispatch-WC6X2M6C.js} +5 -7
  168. package/dist/{dispatch-M62IAL2S.js.map → dispatch-WC6X2M6C.js.map} +1 -1
  169. package/dist/{enclave-4P4KH5ZW.js → enclave-KJOTOH7X.js} +9 -10
  170. package/dist/executor-5NIMLSKZ.js +8 -0
  171. package/dist/executor-AQVXV5GZ.js +8 -0
  172. package/dist/executor-PUAO6AKJ.js +29 -0
  173. package/dist/export-accessible-72EQNBMR.js +22 -0
  174. package/dist/extract-partition-PUYNU3UF.js +37 -0
  175. package/dist/{fanout-sidecar-BRQHWTZQ.js → fanout-sidecar-WUFXNYP4.js} +9 -10
  176. package/dist/{fanout-sidecar-BRQHWTZQ.js.map → fanout-sidecar-WUFXNYP4.js.map} +1 -1
  177. package/dist/{fence-watcher-ZVSMLKQD.js → fence-watcher-U2PW6JU5.js} +1 -3
  178. package/dist/{fence-watcher-ZVSMLKQD.js.map → fence-watcher-U2PW6JU5.js.map} +1 -1
  179. package/dist/find-2ABFCZX4.js +10 -0
  180. package/dist/forget/index.js +9 -10
  181. package/dist/forget/index.js.map +1 -1
  182. package/dist/guards/index.js +4 -5
  183. package/dist/history/index.js +13 -14
  184. package/dist/history/index.js.map +1 -1
  185. package/dist/i18n/index.js +14 -15
  186. package/dist/i18n/index.js.map +1 -1
  187. package/dist/index.d.ts +20 -4
  188. package/dist/index.js +122 -115
  189. package/dist/index.js.map +1 -1
  190. package/dist/indexing/index.js +2 -3
  191. package/dist/indexing/index.js.map +1 -1
  192. package/dist/introspection/index.js +13 -13
  193. package/dist/issue-SIDORTSZ.js +18 -0
  194. package/dist/{json-schema-I22JCYCG.js → json-schema-V3M5MUCM.js} +1 -3
  195. package/dist/{json-schema-I22JCYCG.js.map → json-schema-V3M5MUCM.js.map} +1 -1
  196. package/dist/kernel/collection-config.d.ts +34 -0
  197. package/dist/kernel/collection.d.ts +11 -6
  198. package/dist/kernel/errors.d.ts +45 -0
  199. package/dist/kernel/match-pairs.d.ts +30 -0
  200. package/dist/kernel/types.d.ts +66 -0
  201. package/dist/lazy/index.js +3 -3
  202. package/dist/{ledger-4X5ZH43X.js → ledger-F33ZVMTK.js} +11 -12
  203. package/dist/liberate-LCDPNAG2.js +24 -0
  204. package/dist/link-set-FKNWAYKS.js +30 -0
  205. package/dist/{managed-secret-CXALLEUB.js → managed-secret-PQYKSR6T.js} +10 -11
  206. package/dist/materialized-views/index.js +21 -21
  207. package/dist/{migrate-cek-LBRKYUZZ.js → migrate-cek-5ENH64AA.js} +2 -3
  208. package/dist/{migrate-cek-LBRKYUZZ.js.map → migrate-cek-5ENH64AA.js.map} +1 -1
  209. package/dist/money/index.js +4 -5
  210. package/dist/noydb-DUXZPKSN.js +90 -0
  211. package/dist/overlay-views/index.js +4 -5
  212. package/dist/periods/index.js +12 -13
  213. package/dist/pod/index.js +64 -60
  214. package/dist/{pod-handle-DHEYBTJ2.js → pod-handle-Q736KYON.js} +10 -11
  215. package/dist/{pod-handle-DHEYBTJ2.js.map → pod-handle-Q736KYON.js.map} +1 -1
  216. package/dist/policy/index.js +10 -11
  217. package/dist/port/to/index.d.ts +40 -0
  218. package/dist/portability/index.js +8 -9
  219. package/dist/portability/index.js.map +1 -1
  220. package/dist/{post-register-4DXRYGTU.js → post-register-LNE2FE2A.js} +6 -7
  221. package/dist/{post-register-4DXRYGTU.js.map → post-register-LNE2FE2A.js.map} +1 -1
  222. package/dist/{purge-scope-FGNNLWHD.js → purge-scope-4HEFPDOW.js} +1 -3
  223. package/dist/{purge-scope-FGNNLWHD.js.map → purge-scope-4HEFPDOW.js.map} +1 -1
  224. package/dist/query/index.js +3 -4
  225. package/dist/{read-only-facade-CHCKSEPD.js → read-only-facade-BIGO37U3.js} +1 -2
  226. package/dist/reduce/index.js +4 -5
  227. package/dist/reduce/index.js.map +1 -1
  228. package/dist/register-I2DZXGAR.js +31 -0
  229. package/dist/registry-23WF3TGH.js +8 -0
  230. package/dist/registry-4AYVUNXK.js +8 -0
  231. package/dist/registry-VSSQPIGF.js +18 -0
  232. package/dist/registry-YLEWMGAC.js +32 -0
  233. package/dist/request-withdrawal-KFQHEZ25.js +30 -0
  234. package/dist/{reveal-X2QMWOVX.js → reveal-67RDQRIN.js} +6 -7
  235. package/dist/{reveal-X2QMWOVX.js.map → reveal-67RDQRIN.js.map} +1 -1
  236. package/dist/revoke-DQDZAZZM.js +23 -0
  237. package/dist/satellites/index.js +1 -2
  238. package/dist/schema-update/index.js +2 -3
  239. package/dist/sealed-record/index.js +12 -13
  240. package/dist/sealed-record/index.js.map +1 -1
  241. package/dist/search/index.js +4 -5
  242. package/dist/{seed-IX5NFSH5.js → seed-G42JYN56.js} +12 -13
  243. package/dist/{seed-IX5NFSH5.js.map → seed-G42JYN56.js.map} +1 -1
  244. package/dist/sequence/index.js +9 -10
  245. package/dist/session/index.js +9 -10
  246. package/dist/session/index.js.map +1 -1
  247. package/dist/shadow/index.js +2 -3
  248. package/dist/shadow/index.js.map +1 -1
  249. package/dist/share-link/index.js +0 -1
  250. package/dist/share-link/index.js.map +1 -1
  251. package/dist/signer-WAMDZHEN.js +24 -0
  252. package/dist/snapshots/index.js +10 -11
  253. package/dist/snapshots/index.js.map +1 -1
  254. package/dist/{stale-5I36LPVK.js → stale-DDL7WQEZ.js} +10 -11
  255. package/dist/storage-FLR73HHF.js +22 -0
  256. package/dist/store/index.js +0 -1
  257. package/dist/{store-coordination-provider-OLPNRMFO.js → store-coordination-provider-MEQ2MJQG.js} +10 -11
  258. package/dist/{store-coordination-provider-OLPNRMFO.js.map → store-coordination-provider-MEQ2MJQG.js.map} +1 -1
  259. package/dist/sync/index.js +10 -11
  260. package/dist/sync/index.js.map +1 -1
  261. package/dist/team/index.js +15 -16
  262. package/dist/tiers/index.js +11 -12
  263. package/dist/to/index.js +2 -3
  264. package/dist/to/index.js.map +1 -1
  265. package/dist/transactions/index.js +3 -4
  266. package/dist/transactions/index.js.map +1 -1
  267. package/dist/{ulid-VQW6ERQN.js → ulid-4MKXG325.js} +1 -2
  268. package/dist/util/index.js +1 -2
  269. package/dist/util/index.js.map +1 -1
  270. package/dist/{vault-diff-FE5J35NJ.js → vault-diff-C6WUJFNP.js} +1 -2
  271. package/dist/vault-head/index.js +8 -9
  272. package/dist/vault-head/index.js.map +1 -1
  273. package/dist/{verify-WYOFLSNA.js → verify-KOV2G5D6.js} +5 -6
  274. package/dist/{verify-WYOFLSNA.js.map → verify-KOV2G5D6.js.map} +1 -1
  275. package/dist/walk-3UQBRMDV.js +21 -0
  276. package/dist/with-formula/derivations/dispatch.d.ts +16 -1
  277. package/dist/with-formula/derivations/registry.d.ts +20 -0
  278. package/dist/with-formula/derivations/trigger-match.d.ts +104 -0
  279. package/dist/with-formula/derivations/types.d.ts +61 -0
  280. package/dist/with-party/team/roster-epoch.d.ts +71 -0
  281. package/dist/with-party/team/roster-tag.d.ts +1 -1
  282. package/dist/with-shape/introspection/behaviors.d.ts +7 -0
  283. package/dist/with-shape/introspection/describe.d.ts +10 -1
  284. package/dist/with-shape/introspection/field-meta.d.ts +86 -0
  285. package/dist/withdraw-accessible-EL5GXZBS.js +27 -0
  286. package/package.json +8 -3
  287. package/dist/api-OAZLPNVV.js +0 -20
  288. package/dist/chunk-4FPEWQKF.js.map +0 -1
  289. package/dist/chunk-5263OEM3.js +0 -344
  290. package/dist/chunk-5263OEM3.js.map +0 -1
  291. package/dist/chunk-GU3LQYW2.js.map +0 -1
  292. package/dist/chunk-JBIV4FLR.js.map +0 -1
  293. package/dist/chunk-JJZIIJSA.js.map +0 -1
  294. package/dist/chunk-KHKKD62N.js.map +0 -1
  295. package/dist/chunk-NO272T7Q.js.map +0 -1
  296. package/dist/chunk-OMHHGOG4.js.map +0 -1
  297. package/dist/chunk-P6ASQOZR.js.map +0 -1
  298. package/dist/chunk-PRHCMEUK.js.map +0 -1
  299. package/dist/chunk-PZ5AY32C.js +0 -10
  300. package/dist/chunk-RDHUZ674.js.map +0 -1
  301. package/dist/chunk-VAG47QHV.js +0 -81
  302. package/dist/chunk-VAG47QHV.js.map +0 -1
  303. package/dist/chunk-VVAVTSTR.js.map +0 -1
  304. package/dist/chunk-YPSOHDNC.js.map +0 -1
  305. package/dist/chunk-ZTYG36DH.js.map +0 -1
  306. package/dist/collection-facade-6IY2LW6W.js +0 -45
  307. package/dist/computed-ASBNTLOK.js +0 -11
  308. package/dist/derive-TCTS7ULE.js +0 -22
  309. package/dist/dispatch-FNCCONFK.js +0 -194
  310. package/dist/dispatch-FNCCONFK.js.map +0 -1
  311. package/dist/executor-AFHQYRAU.js +0 -9
  312. package/dist/executor-CDIMJVE2.js +0 -29
  313. package/dist/executor-YYDW6XQI.js +0 -9
  314. package/dist/export-accessible-WADNWX35.js +0 -23
  315. package/dist/extract-partition-SHQYQSWE.js +0 -38
  316. package/dist/find-SZBL2HPB.js +0 -11
  317. package/dist/issue-2DGG7NKE.js +0 -19
  318. package/dist/liberate-7NEPRE52.js +0 -25
  319. package/dist/link-set-WHTYVTOV.js +0 -31
  320. package/dist/noydb-BQ3ZTN2Z.js +0 -86
  321. package/dist/register-GLCOH73C.js +0 -32
  322. package/dist/registry-GWGHZWGP.js +0 -19
  323. package/dist/registry-IWFMXCHX.js +0 -9
  324. package/dist/registry-Q3FG3OAX.js +0 -9
  325. package/dist/registry-T346IZCF.js +0 -18
  326. package/dist/request-withdrawal-2RERJECX.js +0 -31
  327. package/dist/revoke-4NRSCPNW.js +0 -24
  328. package/dist/signer-HJHTGX7X.js +0 -25
  329. package/dist/storage-ZYYAB3J3.js +0 -23
  330. package/dist/walk-LTV7LOCN.js +0 -21
  331. package/dist/withdraw-accessible-V4XCPH7U.js +0 -28
  332. package/dist/withdraw-accessible-V4XCPH7U.js.map +0 -1
  333. package/dist/zod-HAJM7LMS.js +0 -14763
  334. package/dist/zod-HAJM7LMS.js.map +0 -1
  335. /package/dist/{api-OAZLPNVV.js.map → api-TXFOVOXX.js.map} +0 -0
  336. /package/dist/{chunk-X6TBQKHW.js.map → chunk-2577DKXB.js.map} +0 -0
  337. /package/dist/{chunk-L3FHEWA3.js.map → chunk-2N4GY74U.js.map} +0 -0
  338. /package/dist/{chunk-626TSARM.js.map → chunk-2Y4IMKA6.js.map} +0 -0
  339. /package/dist/{chunk-7CWII4BL.js.map → chunk-3RCJJBNR.js.map} +0 -0
  340. /package/dist/{chunk-M7UC2QPT.js.map → chunk-453F654R.js.map} +0 -0
  341. /package/dist/{chunk-2QNKXGUS.js.map → chunk-4GVM6QZA.js.map} +0 -0
  342. /package/dist/{chunk-AB5P32RE.js.map → chunk-4OZNXTO4.js.map} +0 -0
  343. /package/dist/{chunk-L3HDEHGM.js.map → chunk-5VCRVKOZ.js.map} +0 -0
  344. /package/dist/{chunk-6AQIFBSP.js.map → chunk-5WDXHNSW.js.map} +0 -0
  345. /package/dist/{chunk-BOFRKAUS.js.map → chunk-6GMZ7HEE.js.map} +0 -0
  346. /package/dist/{chunk-XBFEKTIY.js.map → chunk-6I2RQCET.js.map} +0 -0
  347. /package/dist/{chunk-UCUALOSM.js.map → chunk-6YXCPL4T.js.map} +0 -0
  348. /package/dist/{chunk-BYBB4ABD.js.map → chunk-77K4PG6P.js.map} +0 -0
  349. /package/dist/{chunk-S2VG3ABP.js.map → chunk-7MG2LHO5.js.map} +0 -0
  350. /package/dist/{chunk-EO2KGKEJ.js.map → chunk-7V4TP3AF.js.map} +0 -0
  351. /package/dist/{chunk-LFDMKZIP.js.map → chunk-ANATMFIO.js.map} +0 -0
  352. /package/dist/{chunk-T3PHCEN4.js.map → chunk-ANSIZYEG.js.map} +0 -0
  353. /package/dist/{chunk-ZKRRBRSZ.js.map → chunk-AO42KJO6.js.map} +0 -0
  354. /package/dist/{chunk-VFIWDPXZ.js.map → chunk-BLN54W3L.js.map} +0 -0
  355. /package/dist/{chunk-ZQ2UUHSL.js.map → chunk-BM5TWITZ.js.map} +0 -0
  356. /package/dist/{chunk-WLFABTZ6.js.map → chunk-BOET4NA4.js.map} +0 -0
  357. /package/dist/{chunk-FOG7YEJP.js.map → chunk-BOWNCWZT.js.map} +0 -0
  358. /package/dist/{chunk-7XODKGTW.js.map → chunk-BSFNRLK2.js.map} +0 -0
  359. /package/dist/{chunk-J4MN6XIU.js.map → chunk-BZ3534YM.js.map} +0 -0
  360. /package/dist/{chunk-IF56DYJK.js.map → chunk-CPWQB3N5.js.map} +0 -0
  361. /package/dist/{chunk-SHILAQH5.js.map → chunk-DGOZ4UZD.js.map} +0 -0
  362. /package/dist/{chunk-BWWUXE3L.js.map → chunk-ELNXJMGB.js.map} +0 -0
  363. /package/dist/{chunk-44C2URL7.js.map → chunk-EQEYOJBM.js.map} +0 -0
  364. /package/dist/{chunk-Y3XWRDAM.js.map → chunk-EYBQEIUY.js.map} +0 -0
  365. /package/dist/{chunk-Z7ZXZL6Y.js.map → chunk-FAHMLERK.js.map} +0 -0
  366. /package/dist/{chunk-EXDIHWFO.js.map → chunk-FMZY5Q6L.js.map} +0 -0
  367. /package/dist/{chunk-H6WXKZL7.js.map → chunk-FXBIP2WD.js.map} +0 -0
  368. /package/dist/{chunk-672U6STZ.js.map → chunk-GPEQUXHL.js.map} +0 -0
  369. /package/dist/{chunk-Z2PWOSCJ.js.map → chunk-GY4WYNNG.js.map} +0 -0
  370. /package/dist/{chunk-4A4TYISP.js.map → chunk-JBDFMYKQ.js.map} +0 -0
  371. /package/dist/{chunk-POS53FG6.js.map → chunk-JMGDHKQF.js.map} +0 -0
  372. /package/dist/{chunk-Q7GEDVHC.js.map → chunk-K6LHRFBL.js.map} +0 -0
  373. /package/dist/{chunk-4JDIRUTT.js.map → chunk-K7NTTA6P.js.map} +0 -0
  374. /package/dist/{chunk-26W5VETY.js.map → chunk-KG7TZKZG.js.map} +0 -0
  375. /package/dist/{chunk-RJ7RIIX6.js.map → chunk-KJIMGIWO.js.map} +0 -0
  376. /package/dist/{chunk-F7ZFRPGQ.js.map → chunk-KTFRCC5C.js.map} +0 -0
  377. /package/dist/{chunk-HSGEIMJS.js.map → chunk-KUJDV5QH.js.map} +0 -0
  378. /package/dist/{chunk-UPJMBMCR.js.map → chunk-L742JPKZ.js.map} +0 -0
  379. /package/dist/{chunk-4TZUFNXL.js.map → chunk-L7CIOOBW.js.map} +0 -0
  380. /package/dist/{chunk-7LYUJNU3.js.map → chunk-LWBCUYZW.js.map} +0 -0
  381. /package/dist/{chunk-JHLJQUXU.js.map → chunk-MUM7IANK.js.map} +0 -0
  382. /package/dist/{chunk-2GXEQUEX.js.map → chunk-MVMXZYXT.js.map} +0 -0
  383. /package/dist/{chunk-XLPXGN66.js.map → chunk-NA2NIJZI.js.map} +0 -0
  384. /package/dist/{chunk-S6YB5ZRP.js.map → chunk-NKHRDYOR.js.map} +0 -0
  385. /package/dist/{chunk-XJ3FEKEY.js.map → chunk-NQKIUNW5.js.map} +0 -0
  386. /package/dist/{chunk-6NRVFD55.js.map → chunk-PT43Y56J.js.map} +0 -0
  387. /package/dist/{chunk-5ACAVJUI.js.map → chunk-Q2PU57HC.js.map} +0 -0
  388. /package/dist/{chunk-E6YA6UAP.js.map → chunk-Q7HZX3IF.js.map} +0 -0
  389. /package/dist/{chunk-4ZPE6SKS.js.map → chunk-QIBVIOXO.js.map} +0 -0
  390. /package/dist/{chunk-WLLUM35R.js.map → chunk-QIZPZMUI.js.map} +0 -0
  391. /package/dist/{chunk-LKFKXS5K.js.map → chunk-RMF67KCG.js.map} +0 -0
  392. /package/dist/{chunk-YCSM3GZU.js.map → chunk-RMS3NEA3.js.map} +0 -0
  393. /package/dist/{chunk-OPXR4PB2.js.map → chunk-SFAWCTEM.js.map} +0 -0
  394. /package/dist/{chunk-3QARDAYW.js.map → chunk-SKGMN35F.js.map} +0 -0
  395. /package/dist/{chunk-W5LHQXZU.js.map → chunk-SL3JAAKN.js.map} +0 -0
  396. /package/dist/{chunk-UALOYGCP.js.map → chunk-SPYWXKJN.js.map} +0 -0
  397. /package/dist/{chunk-QU3YUP2X.js.map → chunk-SZJ3DLZA.js.map} +0 -0
  398. /package/dist/{chunk-225O5CXQ.js.map → chunk-TFR7DSOV.js.map} +0 -0
  399. /package/dist/{chunk-X67FCULK.js.map → chunk-TRGTKX5E.js.map} +0 -0
  400. /package/dist/{chunk-JVLSU7S2.js.map → chunk-TUFM4UZP.js.map} +0 -0
  401. /package/dist/{chunk-HTGRQZFB.js.map → chunk-UGTBXF5U.js.map} +0 -0
  402. /package/dist/{chunk-THNJ3IKU.js.map → chunk-ULUMAZ5S.js.map} +0 -0
  403. /package/dist/{chunk-XDVVBETV.js.map → chunk-UXVWEX5L.js.map} +0 -0
  404. /package/dist/{chunk-FKFIEEY6.js.map → chunk-UXWB3FPF.js.map} +0 -0
  405. /package/dist/{chunk-CBRS2NEK.js.map → chunk-VTFVLCUH.js.map} +0 -0
  406. /package/dist/{chunk-TOV6VMHF.js.map → chunk-VXANTWBJ.js.map} +0 -0
  407. /package/dist/{chunk-VSLUSXVK.js.map → chunk-VXGSWL6L.js.map} +0 -0
  408. /package/dist/{chunk-HQINBNHM.js.map → chunk-WEQEYLCS.js.map} +0 -0
  409. /package/dist/{chunk-U6GCYG2T.js.map → chunk-X2DLENDQ.js.map} +0 -0
  410. /package/dist/{chunk-XVU7J43V.js.map → chunk-XLMEZIAJ.js.map} +0 -0
  411. /package/dist/{chunk-ILSR22WM.js.map → chunk-XTXOCYOJ.js.map} +0 -0
  412. /package/dist/{chunk-KDJGJR7F.js.map → chunk-YSRUYAVU.js.map} +0 -0
  413. /package/dist/{chunk-NLKLXXTO.js.map → chunk-YYP7WSEB.js.map} +0 -0
  414. /package/dist/{chunk-4G25SDQL.js.map → chunk-ZN4FD4PE.js.map} +0 -0
  415. /package/dist/{chunk-XSN63FUS.js.map → chunk-ZORTV6NH.js.map} +0 -0
  416. /package/dist/{chunk-S3I7VKID.js.map → chunk-ZVO4QVPD.js.map} +0 -0
  417. /package/dist/{chunk-PZ5AY32C.js.map → collection-facade-4GRREZ6C.js.map} +0 -0
  418. /package/dist/{collection-facade-6IY2LW6W.js.map → computed-VPOKQK4N.js.map} +0 -0
  419. /package/dist/{computed-ASBNTLOK.js.map → derive-6O5SWQKN.js.map} +0 -0
  420. /package/dist/{derive-TCTS7ULE.js.map → enclave-KJOTOH7X.js.map} +0 -0
  421. /package/dist/{enclave-4P4KH5ZW.js.map → executor-5NIMLSKZ.js.map} +0 -0
  422. /package/dist/{executor-AFHQYRAU.js.map → executor-AQVXV5GZ.js.map} +0 -0
  423. /package/dist/{executor-CDIMJVE2.js.map → executor-PUAO6AKJ.js.map} +0 -0
  424. /package/dist/{executor-YYDW6XQI.js.map → export-accessible-72EQNBMR.js.map} +0 -0
  425. /package/dist/{export-accessible-WADNWX35.js.map → extract-partition-PUYNU3UF.js.map} +0 -0
  426. /package/dist/{extract-partition-SHQYQSWE.js.map → find-2ABFCZX4.js.map} +0 -0
  427. /package/dist/{find-SZBL2HPB.js.map → issue-SIDORTSZ.js.map} +0 -0
  428. /package/dist/{issue-2DGG7NKE.js.map → ledger-F33ZVMTK.js.map} +0 -0
  429. /package/dist/{ledger-4X5ZH43X.js.map → liberate-LCDPNAG2.js.map} +0 -0
  430. /package/dist/{liberate-7NEPRE52.js.map → link-set-FKNWAYKS.js.map} +0 -0
  431. /package/dist/{link-set-WHTYVTOV.js.map → managed-secret-PQYKSR6T.js.map} +0 -0
  432. /package/dist/{managed-secret-CXALLEUB.js.map → noydb-DUXZPKSN.js.map} +0 -0
  433. /package/dist/{noydb-BQ3ZTN2Z.js.map → read-only-facade-BIGO37U3.js.map} +0 -0
  434. /package/dist/{read-only-facade-CHCKSEPD.js.map → register-I2DZXGAR.js.map} +0 -0
  435. /package/dist/{register-GLCOH73C.js.map → registry-23WF3TGH.js.map} +0 -0
  436. /package/dist/{registry-GWGHZWGP.js.map → registry-4AYVUNXK.js.map} +0 -0
  437. /package/dist/{registry-IWFMXCHX.js.map → registry-VSSQPIGF.js.map} +0 -0
  438. /package/dist/{registry-Q3FG3OAX.js.map → registry-YLEWMGAC.js.map} +0 -0
  439. /package/dist/{registry-T346IZCF.js.map → request-withdrawal-KFQHEZ25.js.map} +0 -0
  440. /package/dist/{request-withdrawal-2RERJECX.js.map → revoke-DQDZAZZM.js.map} +0 -0
  441. /package/dist/{revoke-4NRSCPNW.js.map → signer-WAMDZHEN.js.map} +0 -0
  442. /package/dist/{signer-HJHTGX7X.js.map → stale-DDL7WQEZ.js.map} +0 -0
  443. /package/dist/{stale-5I36LPVK.js.map → storage-FLR73HHF.js.map} +0 -0
  444. /package/dist/{storage-ZYYAB3J3.js.map → ulid-4MKXG325.js.map} +0 -0
  445. /package/dist/{ulid-VQW6ERQN.js.map → vault-diff-C6WUJFNP.js.map} +0 -0
  446. /package/dist/{vault-diff-FE5J35NJ.js.map → walk-3UQBRMDV.js.map} +0 -0
  447. /package/dist/{walk-LTV7LOCN.js.map → withdraw-accessible-EL5GXZBS.js.map} +0 -0
@@ -1,13 +1,20 @@
1
1
  import {
2
- ViaGraph
3
- } from "./chunk-5263OEM3.js";
2
+ hopCollections,
3
+ normalizeTriggerBy
4
+ } from "./chunk-FFWI7UH7.js";
5
+ import {
6
+ ViaGraph,
7
+ matchTargetFieldNames,
8
+ schemaFieldKeys
9
+ } from "./chunk-2C3AQB46.js";
4
10
  import {
5
11
  sha256Hex
6
- } from "./chunk-W5LHQXZU.js";
12
+ } from "./chunk-SL3JAAKN.js";
7
13
  import {
8
14
  DerivationCycleError,
9
- DuplicateBehaviorNameError
10
- } from "./chunk-JBIV4FLR.js";
15
+ DuplicateBehaviorNameError,
16
+ ValidationError
17
+ } from "./chunk-7O3Y4PPD.js";
11
18
 
12
19
  // src/with-formula/derivations/strategy-hash.ts
13
20
  async function computeStrategyHash(source, outputKeys, derive, sources) {
@@ -46,7 +53,8 @@ var DerivationRegistry = class {
46
53
  }
47
54
  const outputKeys = Object.keys(spec.outputs);
48
55
  const strategyHash = await computeStrategyHash(spec.source, outputKeys, spec.derive, spec.sources);
49
- const reg = { spec, strategyHash };
56
+ const triggers = normalizeTriggerBy(spec.triggerBy);
57
+ const reg = { spec, strategyHash, triggers };
50
58
  if (spec.name !== void 0) this._byName.set(spec.name, reg);
51
59
  const fromSource = this._bySource.get(spec.source);
52
60
  if (fromSource) fromSource.push(reg);
@@ -56,7 +64,15 @@ var DerivationRegistry = class {
56
64
  if (fromExtra) fromExtra.push(reg);
57
65
  else this._bySource.set(extra, [reg]);
58
66
  }
59
- for (const t of spec.triggerBy ?? []) {
67
+ for (const t of triggers) {
68
+ for (const hop of hopCollections(t.match)) {
69
+ const fromHop = this._bySource.get(hop);
70
+ if (fromHop) {
71
+ if (!fromHop.includes(reg)) fromHop.push(reg);
72
+ } else this._bySource.set(hop, [reg]);
73
+ }
74
+ }
75
+ for (const t of triggers) {
60
76
  const fromTrigger = this._bySource.get(t.collection);
61
77
  if (fromTrigger) fromTrigger.push(reg);
62
78
  else this._bySource.set(t.collection, [reg]);
@@ -81,6 +97,62 @@ var DerivationRegistry = class {
81
97
  strategiesProducingOutput(collection) {
82
98
  return this._byOutput.get(collection) ?? [];
83
99
  }
100
+ /**
101
+ * The #1253-pattern typo guard for match fields (#1249): a misspelt
102
+ * `to`/`from` silently matches nothing forever, so validate against the
103
+ * collection's enumerable field set at the earliest point it exists.
104
+ * `schemaFieldKeys(schema) === undefined` (TS-generic collection,
105
+ * unreadable validator) is DELIBERATELY silent — those fields are real
106
+ * and unenumerable. `configKeys` folds in the collection's other
107
+ * non-schema field declarations (fieldMeta/moneyFields/dictKeyFields/
108
+ * refs/computed); `denormExempt` is derived here from this registry's
109
+ * own strategies rather than taken as a parameter — a field this
110
+ * collection's own derivations write via `denorm` is never a typo.
111
+ */
112
+ validateFieldsFor(collectionName, schema, configKeys, viaSources = void 0) {
113
+ const targets = matchTargetFieldNames(viaSources ?? {});
114
+ const virtual = new Set(targets.virtual);
115
+ const shapeKeys = schemaFieldKeys(schema);
116
+ if (shapeKeys === void 0 && virtual.size === 0) return;
117
+ const keys = shapeKeys === void 0 ? void 0 : /* @__PURE__ */ new Set([...shapeKeys, ...configKeys, ...targets.declared]);
118
+ const denormExempt = /* @__PURE__ */ new Set();
119
+ const regs = new Set([...this._bySource.values()].flat());
120
+ for (const reg of regs) {
121
+ if (reg.spec.source !== collectionName) continue;
122
+ for (const out of Object.values(reg.spec.outputs)) {
123
+ if (out.collection === collectionName) for (const d of out.denorm ?? []) denormExempt.add(d);
124
+ }
125
+ }
126
+ const unknown = (f) => keys !== void 0 && !keys.has(f) && !denormExempt.has(f);
127
+ for (const reg of regs) {
128
+ const name = reg.spec.name ?? reg.spec.source;
129
+ for (const t of reg.triggers) {
130
+ for (const p of t.match) {
131
+ if (reg.spec.source === collectionName) {
132
+ if (virtual.has(p.to)) throw new ValidationError(this._virtualMatchMessage(name, collectionName, p.to, "to"));
133
+ if (unknown(p.to)) {
134
+ throw new ValidationError(
135
+ `derivation "${name}": triggerBy match names source field "${p.to}", which "${collectionName}" does not declare \u2014 a typo here silently matches nothing forever`
136
+ );
137
+ }
138
+ }
139
+ if (t.collection === collectionName && p.from !== "id") {
140
+ if (virtual.has(p.from)) throw new ValidationError(this._virtualMatchMessage(name, collectionName, p.from, "from"));
141
+ if (unknown(p.from)) {
142
+ throw new ValidationError(
143
+ `derivation "${name}": triggerBy match reads "${p.from}" from written "${collectionName}" records, which that collection does not declare \u2014 a typo here silently matches nothing forever`
144
+ );
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ /** #1266 — one message shape for both match sides; see {@link matchTargetFieldNames}. */
152
+ _virtualMatchMessage(name, collectionName, field, side) {
153
+ const where = side === "to" ? `names source field "${field}", which "${collectionName}"` : `reads "${field}" from written "${collectionName}" records, which that collection`;
154
+ return `derivation "${name}": triggerBy match ${where} declares as a VIRTUAL computed field \u2014 virtual fields are evaluated on read and never stored, so the matcher would read every candidate record and match nothing, forever. Declare it as \`mode: 'materialized'\` (stored, indexable) or match on a stored field.`;
155
+ }
84
156
  /**
85
157
  * All registered strategies as a flat, deduplicated array.
86
158
  * Each strategy is indexed once per source (not once per output key),
@@ -172,4 +244,4 @@ var DerivationRegistry = class {
172
244
  export {
173
245
  DerivationRegistry
174
246
  };
175
- //# sourceMappingURL=chunk-RDHUZ674.js.map
247
+ //# sourceMappingURL=chunk-HDOU6I2Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-formula/derivations/strategy-hash.ts","../src/with-formula/derivations/registry.ts"],"sourcesContent":["/**\n * Deterministic hash of a derivation strategy's \"shape\": source\n * collection, declared sibling sources, output keys, derive function\n * source. Used to detect\n * strategy drift: a record whose `_derivedFrom.strategyHash` doesn't\n * match the current strategy is considered stale.\n *\n * Web Crypto SHA-256 — no extra deps.\n */\nimport { sha256Hex } from '../../kernel/enclave/index.js'\n\nexport async function computeStrategyHash(\n source: string,\n outputKeys: readonly string[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n derive: (...args: any[]) => any,\n sources?: ReadonlyArray<string>,\n): Promise<string> {\n const canonical = JSON.stringify({\n source,\n outputs: [...outputKeys].sort(),\n derive: derive.toString(),\n // Declared sibling sources — adding/removing a trigger\n // collection invalidates cached derived records. Omitted when empty\n // so strategies without siblings keep their existing hash.\n ...(sources?.length ? { sources: [...sources].sort() } : {}),\n })\n const bytes = new TextEncoder().encode(canonical)\n return sha256Hex(bytes)\n}\n","import { matchTargetFieldNames } from '../../kernel/collection-config.js'\nimport { DerivationCycleError, DuplicateBehaviorNameError, ValidationError } from '../../kernel/errors.js'\nimport { ViaGraph, type FieldRef, type EdgeKind, type Grain } from '../../kernel/via/graph.js'\nimport { schemaFieldKeys } from '../../with-shape/introspection/describe.js'\nimport { computeStrategyHash } from './strategy-hash.js'\nimport { hopCollections, normalizeTriggerBy, type NormalizedTrigger } from './trigger-match.js'\nimport type { DerivationSpec } from './types.js'\n\n/**\n * Whole-record artifact-grain field marker (#638 Task 2). A derivation's\n * `derive()`/a rollup's `compute()` reads the WHOLE source record — there is\n * no single declared field to point at — so a trigger/output collection is\n * modelled as one artifact node per collection (`kernel/via/graph.ts`'s\n * \"Artifact-grain targets... modelled as a field node whose field is the\n * artifact key\" convention). MUST match `materialized-views/registry.ts`'s\n * and `vault.ts`'s overlay-edge marker so cross-registry edges (a derivation\n * feeding into / out of an MV or overlay collection) resolve to the SAME\n * graph node.\n */\nconst WHOLE_RECORD = '*'\n\n/** Strip this registry's `.${WHOLE_RECORD}` artifact suffix off a graph cycle\n * path entry, recovering the bare collection name — preserves the exact\n * pre-#638 `DerivationCycleError` message shape (behavior lock) for a pure\n * record-shape derivation cycle. A rollup's real-field target (not suffixed\n * `.${WHOLE_RECORD}`) is left untouched. */\nfunction stripArtifactSuffix(displayId: string): string {\n const suffix = `.${WHOLE_RECORD}`\n return displayId.endsWith(suffix) ? displayId.slice(0, -suffix.length) : displayId\n}\n\ninterface RegisteredStrategy {\n // Type-erased to allow the registry to hold heterogeneous strategies.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spec: DerivationSpec<any, any>\n strategyHash: string\n readonly triggers: ReadonlyArray<NormalizedTrigger>\n}\n\n/**\n * Vault-internal registry of derivation strategies. Owned by `Vault`;\n * not exported.\n *\n * @internal\n */\nexport class DerivationRegistry {\n private readonly _bySource = new Map<string, RegisteredStrategy[]>()\n private readonly _byOutput = new Map<string, RegisteredStrategy[]>()\n private readonly _byName = new Map<string, RegisteredStrategy>()\n\n /**\n * Register a derivation strategy. If `spec.name` is given and already\n * registered by another derivation in this vault, throws\n * {@link DuplicateBehaviorNameError} before indexing.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async register(spec: DerivationSpec<any, any>): Promise<void> {\n if (spec.name !== undefined && this._byName.has(spec.name)) {\n throw new DuplicateBehaviorNameError(spec.name, 'derivation')\n }\n\n const outputKeys = Object.keys(spec.outputs)\n const strategyHash = await computeStrategyHash(spec.source, outputKeys, spec.derive, spec.sources)\n const triggers = normalizeTriggerBy(spec.triggerBy)\n const reg: RegisteredStrategy = { spec, strategyHash, triggers }\n\n if (spec.name !== undefined) this._byName.set(spec.name, reg)\n\n const fromSource = this._bySource.get(spec.source)\n if (fromSource) fromSource.push(reg)\n else this._bySource.set(spec.source, [reg])\n\n // Declared sibling sources index the SAME `reg` under each\n // extra collection so `strategiesForSource(extra)` returns it and a\n // sibling write re-fires the derivation. Sibling keys also enter\n // `_bySource`, so `validate()`'s cycle DFS walks them automatically.\n for (const extra of spec.sources ?? []) {\n const fromExtra = this._bySource.get(extra)\n if (fromExtra) fromExtra.push(reg)\n else this._bySource.set(extra, [reg])\n }\n\n // FK triggers index the SAME `reg` under each parent collection so\n // a parent write re-fires the derivation (fanned out to matching source\n // records in `dispatchDerivations`). Like sources[], these keys enter\n // `_bySource` so the cycle DFS walks the trigger→output edge.\n // #1277 — the INTERMEDIATE of a declared hop is indexed too, so a write\n // that re-points it re-fires the derivation. Without this the hop's whole\n // correctness argument fails: nothing is written to the trigger or source\n // collection when an intermediate moves, so no other path can notice, and\n // every source it used to address is stranded silently. Entering `_bySource`\n // also puts the hop edge into `validate()`'s cycle DFS, which would\n // otherwise be blind to it.\n for (const t of triggers) {\n for (const hop of hopCollections(t.match)) {\n const fromHop = this._bySource.get(hop)\n if (fromHop) { if (!fromHop.includes(reg)) fromHop.push(reg) }\n else this._bySource.set(hop, [reg])\n }\n }\n for (const t of triggers) {\n const fromTrigger = this._bySource.get(t.collection)\n if (fromTrigger) fromTrigger.push(reg)\n else this._bySource.set(t.collection, [reg])\n }\n\n // Rollup: a write to the child `from` collection recomputes\n // the parent (= spec.source = into) at id child[key]. Index under `from`\n // so a child write fires it; spec.source (into) is already indexed above,\n // so a parent write also recomputes its own aggregate (covers the\n // parent-created-after-children case). The from→into edge enters the cycle\n // DFS automatically.\n if (spec.rollup) {\n const fromRollup = this._bySource.get(spec.rollup.from)\n if (fromRollup) fromRollup.push(reg)\n else this._bySource.set(spec.rollup.from, [reg])\n }\n\n for (const key of outputKeys) {\n const output = spec.outputs[key]\n if (!output) continue\n const outputCollection = output.collection\n const arr = this._byOutput.get(outputCollection)\n if (arr) arr.push(reg)\n else this._byOutput.set(outputCollection, [reg])\n }\n }\n\n strategiesForSource(source: string): ReadonlyArray<RegisteredStrategy> {\n return this._bySource.get(source) ?? []\n }\n\n strategiesProducingOutput(collection: string): ReadonlyArray<RegisteredStrategy> {\n return this._byOutput.get(collection) ?? []\n }\n\n /**\n * The #1253-pattern typo guard for match fields (#1249): a misspelt\n * `to`/`from` silently matches nothing forever, so validate against the\n * collection's enumerable field set at the earliest point it exists.\n * `schemaFieldKeys(schema) === undefined` (TS-generic collection,\n * unreadable validator) is DELIBERATELY silent — those fields are real\n * and unenumerable. `configKeys` folds in the collection's other\n * non-schema field declarations (fieldMeta/moneyFields/dictKeyFields/\n * refs/computed); `denormExempt` is derived here from this registry's\n * own strategies rather than taken as a parameter — a field this\n * collection's own derivations write via `denorm` is never a typo.\n */\n validateFieldsFor(\n collectionName: string,\n schema: unknown,\n configKeys: ReadonlyArray<string>,\n viaSources: {\n readonly computed?: Readonly<Record<string, unknown>> | undefined\n readonly viaFields?: Readonly<Record<string, unknown>> | undefined\n } | undefined = undefined,\n ): void {\n const targets = matchTargetFieldNames(viaSources ?? {})\n const virtual = new Set(targets.virtual)\n const shapeKeys = schemaFieldKeys(schema)\n // The two checks have DIFFERENT preconditions, which is why one loop runs\n // both rather than an early return covering both. The typo check needs a\n // readable field list and must stay silent without one — a false \"unknown\n // field\" on a TS-generic collection would be worse than no check. The\n // virtual check needs nothing but the declaration in hand: \"declared, and\n // never stored\" is provable from the declaration alone (#1266).\n if (shapeKeys === undefined && virtual.size === 0) return\n const keys = shapeKeys === undefined ? undefined\n : new Set([...shapeKeys, ...configKeys, ...targets.declared])\n const denormExempt = new Set<string>()\n const regs = new Set([...this._bySource.values()].flat())\n for (const reg of regs) {\n if (reg.spec.source !== collectionName) continue\n for (const out of Object.values(reg.spec.outputs) as Array<{ collection?: string; denorm?: readonly string[] }>) {\n if (out.collection === collectionName) for (const d of out.denorm ?? []) denormExempt.add(d)\n }\n }\n const unknown = (f: string): boolean =>\n keys !== undefined && !keys.has(f) && !denormExempt.has(f)\n for (const reg of regs) {\n const name = reg.spec.name ?? reg.spec.source\n for (const t of reg.triggers) {\n for (const p of t.match) {\n // `to` reads the SOURCE record; `from` reads the WRITTEN record.\n // Both are the stored shape, so both refuse a virtual target.\n if (reg.spec.source === collectionName) {\n if (virtual.has(p.to)) throw new ValidationError(this._virtualMatchMessage(name, collectionName, p.to, 'to'))\n if (unknown(p.to)) {\n throw new ValidationError(\n `derivation \"${name}\": triggerBy match names source field \"${p.to}\", which \"${collectionName}\" does not declare — a typo here silently matches nothing forever`)\n }\n }\n if (t.collection === collectionName && p.from !== 'id') {\n if (virtual.has(p.from)) throw new ValidationError(this._virtualMatchMessage(name, collectionName, p.from, 'from'))\n if (unknown(p.from)) {\n throw new ValidationError(\n `derivation \"${name}\": triggerBy match reads \"${p.from}\" from written \"${collectionName}\" records, which that collection does not declare — a typo here silently matches nothing forever`)\n }\n }\n }\n }\n }\n }\n\n /** #1266 — one message shape for both match sides; see {@link matchTargetFieldNames}. */\n private _virtualMatchMessage(name: string, collectionName: string, field: string, side: 'to' | 'from'): string {\n const where = side === 'to'\n ? `names source field \"${field}\", which \"${collectionName}\"`\n : `reads \"${field}\" from written \"${collectionName}\" records, which that collection`\n return `derivation \"${name}\": triggerBy match ${where} declares as a VIRTUAL computed field — virtual fields are evaluated on read and never stored, so the matcher would read every candidate record and match nothing, forever. Declare it as \\`mode: 'materialized'\\` (stored, indexable) or match on a stored field.`\n }\n\n /**\n * All registered strategies as a flat, deduplicated array.\n * Each strategy is indexed once per source (not once per output key),\n * so iterating `_bySource.values()` naturally yields each strategy\n * exactly once per source — deduplication is handled by flattening\n * the per-source arrays and collecting into a Set by identity.\n *\n * Used by `dumpSchema()` / `describeDerivations()` in the introspection\n * walker to populate the derivations map.\n */\n all(): ReadonlyArray<RegisteredStrategy> {\n const seen = new Set<RegisteredStrategy>()\n for (const strategies of this._bySource.values()) {\n for (const s of strategies) seen.add(s)\n }\n return [...seen]\n }\n\n /**\n * Graph edges for #638 Task 2: one `'derivation'`/`'record'` edge per\n * (non-self-write) output key — target = the output collection (a\n * `WHOLE_RECORD` artifact node), sources = every collection that can\n * trigger this strategy (`source`, `sources[]`, `triggerBy[].collection`,\n * and — for a rollup — `rollup.from`), mirroring EXACTLY the trigger keys\n * `register()` indexes under `_bySource`. The self-write reverse-denorm\n * output (`output.collection === source` with `denorm` declared) is\n * skipped — the SAME condition the old local DFS used; it is not a cycle\n * (see the comment `validate()` used to carry, now on this skip).\n * Rollups ADDITIONALLY get a dedicated `'rollup'`/`'aggregate'` edge\n * targeting the real `rollup.field` on the parent (`source`) — the\n * self-write output above only covers the cycle-DFS skip, not\n * dispatch/taint (Tasks 3/4/6), which need the real field.\n */\n edges(): ReadonlyArray<{ readonly target: FieldRef; readonly sources: readonly FieldRef[]; readonly kind: EdgeKind; readonly grain: Grain }> {\n const out: Array<{ target: FieldRef; sources: FieldRef[]; kind: EdgeKind; grain: Grain }> = []\n for (const reg of this.all()) {\n const spec = reg.spec\n const triggerCollections = [\n spec.source,\n ...(spec.sources ?? []),\n ...(spec.triggerBy ?? []).map((t) => t.collection),\n ...(spec.rollup ? [spec.rollup.from] : []),\n ]\n const sources: FieldRef[] = triggerCollections.map((c) => ({ collection: c, field: WHOLE_RECORD }))\n for (const key of Object.keys(spec.outputs)) {\n const output = spec.outputs[key]\n if (!output) continue\n if (output.shape === 'record' && output.collection === spec.source && output.denorm !== undefined) continue\n out.push({ target: { collection: output.collection, field: WHOLE_RECORD }, sources, kind: 'derivation', grain: 'record' })\n }\n if (spec.rollup) {\n out.push({\n target: { collection: spec.source, field: spec.rollup.field },\n sources: [{ collection: spec.rollup.from, field: WHOLE_RECORD }],\n kind: 'rollup',\n grain: 'aggregate',\n })\n }\n }\n return out\n }\n\n /**\n * Cycle detection, delegated to `ViaGraph.assertAcyclic()` (#638 Task 2 —\n * retires the local DFS). Call after all `register()` calls complete (i.e.\n * at vault open). Throws `DerivationCycleError` on the first cycle found —\n * SAME class/timing as before; the message/path is byte-identical to the\n * pre-#638 shape for a pure record-shape derivation cycle (the\n * `WHOLE_RECORD` artifact suffix is stripped back to a bare collection\n * name before re-throwing).\n *\n * `graph` is the caller's shared per-vault graph, ALREADY carrying this\n * registry's `edges()` (the caller registers them — see `Vault._initDerivations`)\n * — omit it (e.g. this registry's own unit tests) to validate this\n * registry's edges in isolation against a throwaway graph.\n */\n validate(graph?: ViaGraph): void {\n const g = graph ?? new ViaGraph()\n if (!graph) {\n for (const edge of this.edges()) g.registerDerived(edge.target, edge.sources, edge.kind, edge.grain)\n }\n try {\n g.assertAcyclic()\n } catch (e) {\n if (e instanceof DerivationCycleError) throw new DerivationCycleError(e.path.map(stripArtifactSuffix))\n throw e\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,eAAsB,oBACpB,QACA,YAEA,QACA,SACiB;AACjB,QAAM,YAAY,KAAK,UAAU;AAAA,IAC/B;AAAA,IACA,SAAS,CAAC,GAAG,UAAU,EAAE,KAAK;AAAA,IAC9B,QAAQ,OAAO,SAAS;AAAA;AAAA;AAAA;AAAA,IAIxB,GAAI,SAAS,SAAS,EAAE,SAAS,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;AAAA,EAC5D,CAAC;AACD,QAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,SAAS;AAChD,SAAO,UAAU,KAAK;AACxB;;;ACVA,IAAM,eAAe;AA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AAU,OAAO,WAAW,OAAW;AACnG,YAAI,KAAK,EAAE,QAAQ,EAAE,YAAY,OAAO,YAAY,OAAO,aAAa,GAAG,SAAS,MAAM,cAAc,OAAO,SAAS,CAAC;AAAA,MAC3H;AACA,UAAI,KAAK,QAAQ;AACf,YAAI,KAAK;AAAA,UACP,QAAQ,EAAE,YAAY,KAAK,QAAQ,OAAO,KAAK,OAAO,MAAM;AAAA,UAC5D,SAAS,CAAC,EAAE,YAAY,KAAK,OAAO,MAAM,OAAO,aAAa,CAAC;AAAA,UAC/D,MAAM;AAAA,UACN,OAAO;AAAA,QACT,CAAC;AAAA,MACH;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,SAAS,OAAwB;AAC/B,UAAM,IAAI,SAAS,IAAI,SAAS;AAChC,QAAI,CAAC,OAAO;AACV,iBAAW,QAAQ,KAAK,MAAM,EAAG,GAAE,gBAAgB,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,KAAK,KAAK;AAAA,IACrG;AACA,QAAI;AACF,QAAE,cAAc;AAAA,IAClB,SAAS,GAAG;AACV,UAAI,aAAa,qBAAsB,OAAM,IAAI,qBAAqB,EAAE,KAAK,IAAI,mBAAmB,CAAC;AACrG,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
@@ -1,46 +1,47 @@
1
1
  import {
2
2
  walkClosure
3
- } from "./chunk-7CWII4BL.js";
3
+ } from "./chunk-3RCJJBNR.js";
4
4
  import {
5
5
  resolveManagedSecret
6
- } from "./chunk-2QNKXGUS.js";
6
+ } from "./chunk-4GVM6QZA.js";
7
7
  import {
8
8
  parseExtractedPartitionBody,
9
9
  readPod,
10
10
  readPodHeader
11
- } from "./chunk-6AQIFBSP.js";
11
+ } from "./chunk-5WDXHNSW.js";
12
12
  import {
13
13
  createOwnerKeyring,
14
14
  mintRosterTag,
15
+ nextRosterEpoch,
15
16
  requireRosterKey
16
- } from "./chunk-ZTYG36DH.js";
17
+ } from "./chunk-G56KBWFY.js";
17
18
  import {
18
19
  LedgerStore
19
- } from "./chunk-UPJMBMCR.js";
20
+ } from "./chunk-L742JPKZ.js";
20
21
  import {
21
22
  LEDGER_COLLECTION
22
23
  } from "./chunk-I7FD46FF.js";
23
24
  import {
24
25
  openEnvelopeJson
25
- } from "./chunk-BYBB4ABD.js";
26
+ } from "./chunk-77K4PG6P.js";
26
27
  import {
27
28
  buildRecordEnvelope
28
- } from "./chunk-QU3YUP2X.js";
29
+ } from "./chunk-SZJ3DLZA.js";
29
30
  import {
30
31
  base64ToBuffer,
31
32
  wrapKey
32
- } from "./chunk-W5LHQXZU.js";
33
+ } from "./chunk-SL3JAAKN.js";
33
34
  import {
34
35
  AdoptionStateError,
35
36
  TransferSealError,
36
37
  ValidationError
37
- } from "./chunk-JBIV4FLR.js";
38
+ } from "./chunk-7O3Y4PPD.js";
38
39
 
39
40
  // src/with-cargo/active.ts
40
41
  function withCargo() {
41
42
  return {
42
43
  async extractPartition(vault, opts) {
43
- const { extractPartitionCore } = await import("./extract-partition-SHQYQSWE.js");
44
+ const { extractPartitionCore } = await import("./extract-partition-PUYNU3UF.js");
44
45
  return extractPartitionCore(vault, opts);
45
46
  }
46
47
  };
@@ -226,8 +227,9 @@ async function createOwnerOnAdoptedPartition(store, vaultName, opts) {
226
227
  mergedDeks[collection] = await wrapKey(dek, kek);
227
228
  }
228
229
  const merged = { ...keyringFile, deks: mergedDeks };
230
+ const withEpoch = { ...merged, roster_epoch: nextRosterEpoch(keyringFile.roster_epoch) };
229
231
  const rosterKey = requireRosterKey(unlocked, "adoptPartition");
230
- const mergedFile = { ...merged, roster_tag: await mintRosterTag(merged, rosterKey) };
232
+ const mergedFile = { ...withEpoch, roster_tag: await mintRosterTag(withEpoch, rosterKey) };
231
233
  await store.put(vaultName, "_keyring", userId, { ...env, _data: JSON.stringify(mergedFile) });
232
234
  }
233
235
  const ledgerDek = partitionDeks.get(LEDGER_COLLECTION);
@@ -250,7 +252,7 @@ async function createOwnerOnAdoptedPartition(store, vaultName, opts) {
250
252
  }
251
253
  }
252
254
  if (isManaged(opts)) {
253
- const { createNoydb } = await import("./noydb-BQ3ZTN2Z.js");
255
+ const { createNoydb } = await import("./noydb-DUXZPKSN.js");
254
256
  const db = await createNoydb({
255
257
  store,
256
258
  user: userId,
@@ -305,4 +307,4 @@ export {
305
307
  withCargo,
306
308
  describeExtraction
307
309
  };
308
- //# sourceMappingURL=chunk-OMHHGOG4.js.map
310
+ //# sourceMappingURL=chunk-J6FXAEUG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-cargo/active.ts","../src/with-cargo/describe-extraction.ts","../src/with-cargo/adopt-partition.ts","../src/with-cargo/decrypt-partition.ts"],"sourcesContent":["/**\n * Enable the cargo (partition extraction) capability.\n * Pass to `createNoydb({ cargoStrategy: withCargo() })` to make the source-side\n * `extractPartition(vault, ...)` free function live. The extraction crypto\n * engine is dynamically imported here, so it stays out of the floor bundle\n * until opted in. The recipient-side `adoptPartition` /\n * `decryptExtractedPartition` free functions — and `diffVault` (shared\n * import/merge infra) — are ungated and unaffected.\n */\nimport type { CargoStrategy } from './strategy.js'\n\nexport function withCargo(): CargoStrategy {\n return {\n async extractPartition(vault, opts) {\n const { extractPartitionCore } = await import('./extract-partition.js')\n return extractPartitionCore(vault, opts)\n },\n }\n}\n","/**\n * Partition-extraction dry-run. Read-only preview of what an\n * `extractPartition` would move: record counts, byte totals, and the\n * timestamp span per collection — computed from raw encrypted\n * envelopes WITHOUT decrypting them. Writes nothing, mutates nothing.\n *\n * @module\n */\nimport type { Vault } from '../kernel/vault.js'\nimport { walkClosure, type WalkClosureOptions, type DanglingRefNotice } from './walk-closure.js'\n\nexport interface ExtractionPreview {\n readonly totalRecords: number\n /** Sum of serialized encrypted-envelope sizes (bytes). */\n readonly totalBytes: number\n readonly byCollection: ReadonlyArray<{\n readonly name: string\n readonly recordCount: number\n readonly bytes: number\n /** Earliest envelope `_ts` in this collection (lexicographic). */\n readonly oldestTs?: string\n readonly newestTs?: string\n }>\n readonly graph: { readonly depth: number; readonly cyclesDetected: boolean }\n /** Records the walk reached but whose envelope couldn't be read. */\n readonly inaccessible: ReadonlyArray<{ readonly collection: string; readonly id: string }>\n /**\n * #772: outbound FK edges whose referenced parent was excluded from the\n * closure (missing, or tier-elevated and therefore invisible) — mirrors\n * `ExtractPartitionResult.danglingRefs` (#759) so a preview/extract pair\n * gives the SAME signal. A parent excluded this way never appears in\n * `byCollection` at all; this is the only preview-time indicator.\n */\n readonly danglingRefs: ReadonlyArray<DanglingRefNotice>\n}\n\nexport async function describeExtraction(\n vault: Vault,\n opts: WalkClosureOptions,\n): Promise<ExtractionPreview> {\n const { closure, graph, danglingRefs } = await walkClosure(vault, opts)\n\n const { name: vaultName, adapter } = vault._introspectState()\n const encoder = new TextEncoder()\n\n const byCollection: Array<{\n name: string; recordCount: number; bytes: number; oldestTs?: string; newestTs?: string\n }> = []\n const inaccessible: Array<{ collection: string; id: string }> = []\n let totalBytes = 0\n let totalRecords = 0\n\n for (const [collectionName, ids] of closure) {\n let bytes = 0\n let oldestTs: string | undefined\n let newestTs: string | undefined\n let recordCount = 0\n\n for (const id of ids) {\n const env = await adapter.get(vaultName, collectionName, id)\n if (!env) {\n // Walk reached it (via decrypted list) but the raw store read\n // returned nothing — surface rather than miscount.\n inaccessible.push({ collection: collectionName, id })\n continue\n }\n recordCount++\n bytes += encoder.encode(JSON.stringify(env)).length\n const ts = env._ts\n if (oldestTs === undefined || ts < oldestTs) oldestTs = ts\n if (newestTs === undefined || ts > newestTs) newestTs = ts\n }\n\n byCollection.push({\n name: collectionName,\n recordCount,\n bytes,\n // Spread conditionally — exactOptionalPropertyTypes forbids an\n // explicit `undefined` on an optional property.\n ...(oldestTs !== undefined ? { oldestTs } : {}),\n ...(newestTs !== undefined ? { newestTs } : {}),\n })\n totalBytes += bytes\n totalRecords += recordCount\n }\n\n byCollection.sort((a, b) => a.name.localeCompare(b.name))\n\n return Object.freeze({\n totalRecords,\n totalBytes,\n byCollection,\n graph,\n inaccessible,\n danglingRefs,\n })\n}\n","/**\n * Partition adoption. Recipient side: verify an extracted bundle,\n * validate the transfer key, import the re-keyed collections into a\n * destination store, and record an `_meta/adoption` marker. The bundle\n * stays UNOWNED after adoption — `createOwnerOnAdoptedPartition`\n * mints the owner; the transfer seal is then destroyed.\n *\n * @module\n */\nimport { base64ToBuffer, wrapKey, type EnclaveKey } from '../kernel/enclave/index.js'\nimport { TransferSealError, AdoptionStateError, ValidationError } from '../kernel/errors.js'\nimport type { NoydbStore, VaultSnapshot, KeyringFile } from '../kernel/types.js'\nimport { createOwnerKeyring, requireRosterKey } from '../with-party/team/keyring.js'\nimport { mintRosterTag } from '../with-party/team/roster-tag.js' // #1115\nimport { nextRosterEpoch } from '../with-party/team/roster-epoch.js' // #1097\nimport { resolveManagedSecret } from '../with-party/team/managed-secret.js'\nimport type { NoydbSealer } from '../with-party/team/managed-secret.js'\nimport type { NoydbShamir } from '../with-party/team/noydb-shamir.js'\nimport type { RecoveryEnrollmentInput } from '../with-party/team/rotate-recover.js'\nimport { LedgerStore } from '../with-commit/history/ledger/store.js'\nimport { LEDGER_COLLECTION } from '../with-commit/history/ledger/constants.js'\nimport type { TransferSealPayload } from '../with-pod/pod.js'\nimport { readPodHeader, readPod, parseExtractedPartitionBody } from '../with-pod/pod.js'\nimport { buildRecordEnvelope } from '../kernel/enclave/index.js'\n\n/**\n * Reverse of `sealDeks`. Imports the transfer key, decrypts the\n * sealed `{ collection: base64(rawDEK) }` map (layout iv(12)‖ct‖tag), and\n * re-imports each DEK as an AES-GCM key. Throws `TransferSealError` on a\n * wrong key (AES-GCM auth-tag failure) or malformed payload.\n */\nexport async function unsealDeks(\n seal: TransferSealPayload,\n transferKey: Uint8Array,\n): Promise<Map<string, EnclaveKey>> {\n if (transferKey.byteLength !== 32) {\n throw new TransferSealError(\n `transfer key must be 32 bytes, got ${transferKey.byteLength}.`,\n )\n }\n const key = await crypto.subtle.importKey('raw', transferKey as BufferSource, 'AES-GCM', false, ['decrypt'])\n const raw = base64ToBuffer(seal.payload)\n let plaintext: ArrayBuffer\n try {\n plaintext = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: raw.slice(0, 12) as BufferSource },\n key,\n raw.slice(12) as BufferSource,\n )\n } catch {\n throw new TransferSealError(\n 'transfer seal could not be opened — wrong transfer key (AES-GCM authentication failed).',\n )\n }\n let dekMap: Record<string, string>\n try {\n dekMap = JSON.parse(new TextDecoder().decode(plaintext)) as Record<string, string>\n } catch {\n throw new TransferSealError('transfer seal payload is not valid JSON after decryption.')\n }\n const deks = new Map<string, EnclaveKey>()\n for (const [collection, b64] of Object.entries(dekMap)) {\n // Extractable: the recipient must be able to re-wrap these under their\n // own KEK (AES-KW) at owner-creation. Matches generateDEK.\n const dek = await crypto.subtle.importKey('raw', base64ToBuffer(b64) as BufferSource, 'AES-GCM', true, ['encrypt', 'decrypt'])\n deks.set(collection, dek)\n }\n return deks\n}\n\nexport interface AdoptPartitionOptions {\n readonly transferKey: Uint8Array\n readonly destinationStore: NoydbStore\n readonly vaultName: string\n}\n\nexport interface AdoptPartitionResult {\n readonly vaultName: string\n readonly needsOwner: true\n readonly sealId: string\n}\n\nexport async function adoptPartition(\n bundleBytes: Uint8Array,\n opts: AdoptPartitionOptions,\n): Promise<AdoptPartitionResult> {\n const { transferKey, destinationStore, vaultName } = opts\n\n const header = readPodHeader(bundleBytes)\n if (header.bundleKind !== 'extracted-partition' || header.transferSeal === undefined) {\n throw new ValidationError(\n 'adoptPartition requires an extracted-partition bundle with a transfer seal. '\n + 'For ordinary backups use readPod + vault.load.',\n )\n }\n\n const { dumpJson } = await readPod(bundleBytes)\n const { dump, seal } = parseExtractedPartitionBody(dumpJson)\n\n // Validate the transfer key by unsealing in memory; throws\n // TransferSealError on mismatch. DEKs are discarded here — they stay\n // sealed at rest (in _meta/adoption) until owner-creation wraps them under the\n // recipient's KEK.\n await unsealDeks(seal, transferKey)\n\n // Single-occupancy per vaultName: an `_meta/adoption` marker already present\n // means this slot holds a partition (adopted-and-unowned, or already owned).\n // saveAll below would overwrite its data and replace the marker, stranding the\n // prior adoption's transfer seal. Refuse regardless of sealId — re-adopting the\n // SAME bundle is a redundant call, and adopting a DIFFERENT bundle here would\n // clobber the existing partition. Either way, pick a fresh vaultName.\n const existing = await destinationStore.get(vaultName, '_meta', 'adoption')\n if (existing) {\n const prior = JSON.parse(existing._data) as { sealId?: string }\n if (prior.sealId === seal.sealId) {\n throw new AdoptionStateError(\n `partition (sealId ${seal.sealId}) is already adopted into vault \"${vaultName}\".`,\n )\n }\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already holds an adopted partition (sealId ${prior.sealId}); `\n + `adopting a different partition (sealId ${seal.sealId}) here would overwrite it. `\n + `Adopt into a fresh vaultName instead.`,\n )\n }\n\n // The marker-only check above misses a worse case: a vaultName already in use\n // by an ORDINARY vault (createNoydb + openVault) carries no `_meta/adoption`,\n // yet `saveAll` below is destructive on SQL adapters (`DELETE FROM ... WHERE\n // vault = ?` followed by upsert) and would wipe the legitimate keyring +\n // data. Refuse adoption into ANY occupied slot — a fresh vaultName is the\n // documented precondition.\n const existingKeyring = await destinationStore.list(vaultName, '_keyring')\n if (existingKeyring.length > 0) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already holds a keyring (an unrelated owner exists at this slot); `\n + `adoptPartition requires a fresh vaultName to avoid destructive saveAll on SQL adapters.`,\n )\n }\n\n const backup = JSON.parse(dump) as { collections: VaultSnapshot; _internal?: VaultSnapshot }\n await destinationStore.saveAll(vaultName, backup.collections)\n\n // Import carried internal collections (e.g. _schemas from carrySchemas).\n // saveAll only writes data collections; _internal is written per-record.\n if (backup._internal) {\n for (const [collection, records] of Object.entries(backup._internal)) {\n for (const [id, envelope] of Object.entries(records)) {\n await destinationStore.put(vaultName, collection, id, envelope)\n }\n }\n }\n\n const adoptedAt = new Date().toISOString()\n const adoption = { sealId: seal.sealId, adoptedAt, needsOwner: true as const, transferSeal: seal }\n await destinationStore.put(vaultName, '_meta', 'adoption',\n buildRecordEnvelope({ collection: '_meta', id: 'adoption', version: 1 },\n { ts: adoptedAt, iv: '', data: JSON.stringify(adoption) }))\n\n return { vaultName, needsOwner: true, sealId: seal.sealId }\n}\n\nexport interface CreateOwnerResult {\n readonly vaultName: string\n readonly userId: string\n}\n\n/** Standard-mode owner: recipient supplies the secret. */\nexport interface CreateOwnerStandardOptions {\n readonly userId: string\n readonly secret: string\n readonly transferKey: Uint8Array\n}\n\n/**\n * Managed-mode owner: the secret is minted + sealed under\n * a `NoydbSealer` (e.g. an `at-*` OS keychain) so the partition\n * auto-unlocks on the recipient's device. Managed mode mandates a strong\n * (Shamir) recovery profile at creation, which needs the\n * `shamirRecovery` provider injected.\n */\nexport interface CreateOwnerManagedOptions {\n readonly userId: string\n readonly secretMode: 'managed'\n readonly sealingKey: NoydbSealer\n readonly recovery: ReadonlyArray<RecoveryEnrollmentInput>\n readonly shamirRecovery: NoydbShamir\n readonly transferKey: Uint8Array\n}\n\nexport type CreateOwnerOptions = CreateOwnerStandardOptions | CreateOwnerManagedOptions\n\nfunction isManaged(o: CreateOwnerOptions): o is CreateOwnerManagedOptions {\n return 'secretMode' in o && o.secretMode === 'managed'\n}\n\n/**\n * Mint the first owner keyring on an adopted-but-unowned partition,\n * then destroy the transfer seal.\n *\n * Standard mode: the recipient supplies a secret. Managed mode: the\n * secret is minted + sealed under a `NoydbSealer` and a strong\n * (Shamir) recovery profile is enrolled — orchestrated via the existing\n * `openVaultAndEnrollRecovery` ceremony.\n *\n * Either way, reuses `createOwnerKeyring` to derive the KEK + write the base\n * keyring, then wraps the partition's DEKs (recovered from the seal) under that\n * KEK and re-persists the merged keyring file.\n *\n * Idempotent under retry: the seal is destroyed LAST (Stage D), after the\n * keyring (Stage A), the ledger transition (Stage B), and — in managed mode —\n * strong-recovery enrollment (Stage C). A failure in the fallible enrollment\n * step leaves the seal intact, and re-running with the same `userId` +\n * `transferKey` resumes from the first incomplete stage. (Multi-profile recovery\n * arrays may re-enroll an already-enrolled profile on retry; managed mode's\n * mandated single Shamir profile does not.)\n */\nexport async function createOwnerOnAdoptedPartition(\n store: NoydbStore,\n vaultName: string,\n opts: CreateOwnerOptions,\n): Promise<CreateOwnerResult> {\n const { userId, transferKey } = opts\n\n // Managed mode requires a strong (Shamir) recovery profile, validated BEFORE\n // any disk write — same gate as createNoydb.\n if (isManaged(opts) && !opts.recovery.some((r) => r.profile === 'shamir')) {\n throw new AdoptionStateError(\n 'managed-mode adoption requires at least one strong (shamir) recovery profile in '\n + '`recovery` — paper alone is not strong when there is no user secret to fall back on.',\n )\n }\n\n // 1. Verify adopted-unowned state.\n const adoptionEnv = await store.get(vaultName, '_meta', 'adoption')\n if (!adoptionEnv) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" is not an adopted partition (no _meta/adoption). `\n + `createOwnerOnAdoptedPartition only applies to vaults created via adoptPartition.`,\n )\n }\n const adoption = JSON.parse(adoptionEnv._data) as {\n sealId: string; adoptedAt: string; needsOwner?: boolean\n consumedAt?: string; transferSeal?: TransferSealPayload\n }\n if (adoption.consumedAt !== undefined || adoption.transferSeal === undefined) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already has an owner (transfer seal consumed at ${adoption.consumedAt}).`,\n )\n }\n\n // 2. Recover the partition DEKs from the seal (throws on wrong key) BEFORE\n // writing any keyring, so a bad transfer key leaves no trace. Always\n // validated, including when resuming a partial prior call.\n const partitionDeks = await unsealDeks(adoption.transferSeal, transferKey)\n\n // The ceremony below is split into stages so a failure in the fallible\n // managed-enrollment step (network/provider outage) leaves the call RETRYABLE\n // — the seal is destroyed only once everything durable is in place. Each stage\n // detects its own prior completion rather than relying on a single resume bit.\n\n // A keyring present for a DIFFERENT user (with the seal still unconsumed) is a\n // genuine second-owner attempt — refuse it. A same-user keyring is a resumed\n // partial call and is handled by the stage checks below.\n const existingKeyring = await store.get(vaultName, '_keyring', userId)\n const otherOwners = (await store.list(vaultName, '_keyring')).filter((u) => u !== userId)\n if (otherOwners.length > 0) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already has a keyring for a different owner; cannot create owner \"${userId}\".`,\n )\n }\n\n // Stage A — mint the owner keyring + merge the partition DEKs. Considered done\n // only when the keyring already holds every partition DEK. createOwnerKeyring\n // overwrites (fresh KEK + fresh _users DEK), so re-running is safe ONLY while\n // no recovery has been enrolled yet — guaranteed here because enrollment\n // (Stage C) runs strictly after Stage A completes.\n const partitionCollections = [...partitionDeks.keys()]\n const priorDeks = existingKeyring ? (JSON.parse(existingKeyring._data) as KeyringFile).deks : {}\n const ownerMinted = existingKeyring !== null && partitionCollections.every((c) => c in priorDeks)\n if (!ownerMinted) {\n // Resolve the owner secret. Managed mode mints a random secret, seals\n // it under the provider, and persists _meta/sealed-secret (so the\n // partition auto-unlocks on the recipient's device); standard mode uses the\n // caller's secret. Idempotent under retry — resolveManagedSecret's reopen\n // arm reuses an already-sealed secret.\n const secret = isManaged(opts)\n ? await resolveManagedSecret(store, vaultName, opts.sealingKey)\n : opts.secret\n\n // Mint the owner keyring (KEK + _users DEK + canary, written to disk).\n const unlocked = await createOwnerKeyring(store, vaultName, { userId: userId, secret: secret })\n\n // Merge the partition DEKs (wrapped under the new KEK) into the keyring.\n const env = await store.get(vaultName, '_keyring', userId)\n if (!env) throw new AdoptionStateError(`keyring write for \"${userId}\" did not persist`)\n const keyringFile = JSON.parse(env._data) as KeyringFile\n const kek = unlocked.kek\n if (!kek) throw new AdoptionStateError(`owner keyring for \"${userId}\" has no KEK to wrap partition DEKs under`)\n const mergedDeks: Record<string, string> = { ...keyringFile.deks }\n for (const [collection, dek] of partitionDeks) {\n mergedDeks[collection] = await wrapKey(dek, kek)\n }\n // #1115 — RESTAMP. The roster tag now covers the DEK key SET, and this merge\n // is precisely a change to that set: adoption joins the partition's\n // collections to a keyring `createOwnerKeyring` stamped moments earlier\n // without them. Writing the merged file under the old tag would leave every\n // adopted vault failing `roster-tag-mismatch` on its first open.\n //\n // The roster key is the one just minted for this NEW vault — unlike\n // `liberateVault`, which joins an EXISTING vault and must keep the\n // incumbent key so co-members can still verify each other.\n const merged: KeyringFile = { ...keyringFile, deks: mergedDeks }\n // #1097 — stamped BEFORE the tag is minted, so it lands inside the\n // authenticated canonical and a store can neither edit nor strip it.\n const withEpoch = { ...merged, roster_epoch: nextRosterEpoch(keyringFile.roster_epoch) }\n const rosterKey = requireRosterKey(unlocked, 'adoptPartition')\n const mergedFile: KeyringFile = { ...withEpoch, roster_tag: await mintRosterTag(withEpoch, rosterKey) }\n await store.put(vaultName, '_keyring', userId, { ...env, _data: JSON.stringify(mergedFile) })\n }\n\n // Stage B — record the ownership transition on the carried\n // audit chain (carryLedger sealed the _ledger DEK). No-op without that DEK.\n // Idempotent: appended only if the closing `transfer-seal-consumed` entry is\n // absent, so a retry does not duplicate the pair.\n const ledgerDek = partitionDeks.get(LEDGER_COLLECTION)\n if (ledgerDek) {\n const ledger = new LedgerStore({\n adapter: store,\n vault: vaultName,\n encrypted: true,\n getDEK: async () => ledgerDek,\n actor: userId,\n })\n const creationReason = `creation-of-new-owner:${userId}`\n const consumedReason = `transfer-seal-consumed:${adoption.sealId}`\n // Gate each append on its own presence — a crash or store error strictly\n // between the two adjacent puts would otherwise re-append the first one\n // on retry. The pair is the audit record, not a single transaction.\n const recordedReasons = new Set((await ledger.loadAllEntries()).map((e) => e.reason))\n if (!recordedReasons.has(creationReason)) {\n await ledger.append({ op: 'lifecycle', collection: '', id: '', version: 0, actor: '', payloadHash: '', reason: creationReason })\n }\n if (!recordedReasons.has(consumedReason)) {\n await ledger.append({ op: 'lifecycle', collection: '', id: '', version: 0, actor: '', payloadHash: '', reason: consumedReason })\n }\n }\n\n // Stage C — Managed mode: enroll the mandatory strong recovery\n // by orchestrating the existing public ceremony. The partition is\n // now a managed-mode vault on disk (sealed secret + keyring), so we\n // open it as a normal client and let openVaultAndEnrollRecovery do the\n // gate-bypass + enroll + re-assert. Dynamic import keeps the Noydb class\n // out of the @noy-db/hub/cargo static graph. Runs BEFORE seal destruction\n // so a failure here leaves the seal intact and the call retryable.\n if (isManaged(opts)) {\n const { createNoydb } = await import('../kernel/noydb.js')\n const db = await createNoydb({\n store,\n user: userId,\n secretMode: 'managed',\n sealingKey: opts.sealingKey,\n shamirRecovery: opts.shamirRecovery,\n })\n await db.team.openVaultAndEnrollRecovery(vaultName, { recovery: opts.recovery })\n }\n\n // Stage D — Destroy the transfer seal LAST — the commit point. Everything\n // above is either idempotent or resumable, so the seal is only consumed\n // once the owner keyring (and, in managed mode, strong recovery) is\n // durably in place. Retain sealId + consumedAt for audit.\n const consumed = { sealId: adoption.sealId, adoptedAt: adoption.adoptedAt, consumedAt: new Date().toISOString() }\n await store.put(vaultName, '_meta', 'adoption', { ...adoptionEnv, _data: JSON.stringify(consumed) })\n\n return { vaultName, userId }\n}\n","/**\n * Read-side counterpart to `extractPartition`: decrypt an\n * extracted-partition bundle's records to plaintext using its transfer\n * key, WITHOUT adopting it into a vault. Used by an outward\n * orchestration layer's reconcile/merge and field-authority flows to\n * compare incoming records against a receiver. The transfer key validates the bundle\n * (wrong key throws).\n * @module\n */\nimport type { EncryptedEnvelope } from '../kernel/types.js'\nimport { openEnvelopeJson } from '../kernel/enclave/index.js'\nimport { readPodHeader, readPod, parseExtractedPartitionBody } from '../with-pod/pod.js'\nimport { unsealDeks } from './adopt-partition.js'\n\n/** One decrypted record from an extracted-partition compartment. */\nexport interface DecryptedRecord {\n readonly id: string\n readonly record: Record<string, unknown>\n /** Source envelope write timestamp (ISO) — for last-write-wins merges. */\n readonly ts: string\n /** Source envelope version. */\n readonly version: number\n /** Provenance source id (FR-5). Present only when the source collection had provenance:true and a source was supplied on put. */\n readonly source?: string\n /** ISO-8601 timestamp the provenance source was recorded (FR-5). */\n readonly sourceTs?: string\n}\n\n/**\n * Decrypt every record of an extracted-partition bundle to plaintext,\n * grouped by collection. Throws if the bundle isn't an\n * extracted-partition or the transfer key is wrong.\n */\nexport async function decryptExtractedPartition(\n bundleBytes: Uint8Array,\n transferKey: Uint8Array,\n): Promise<Record<string, DecryptedRecord[]>> {\n const header = readPodHeader(bundleBytes)\n if (header.bundleKind !== 'extracted-partition' || header.transferSeal === undefined) {\n throw new Error('decryptExtractedPartition: bundle is not an extracted-partition.')\n }\n const { dumpJson } = await readPod(bundleBytes)\n const { dump, seal } = parseExtractedPartitionBody(dumpJson)\n const deks = await unsealDeks(seal, transferKey) // throws TransferSealError on wrong key\n const backup = JSON.parse(dump) as { collections: Record<string, Record<string, EncryptedEnvelope>> }\n const out: Record<string, DecryptedRecord[]> = {}\n for (const [collection, byId] of Object.entries(backup.collections)) {\n const dek = deks.get(collection)\n if (dek === undefined) continue // no DEK sealed for this collection — skip\n const recs: DecryptedRecord[] = []\n for (const [id, env] of Object.entries(byId)) {\n const plaintext = await openEnvelopeJson({ collection, id }, env, dek)\n const body = JSON.parse(plaintext) as Record<string, unknown>\n recs.push({\n id,\n record: { ...body, id },\n ts: env._ts,\n version: env._v,\n ...(env._source !== undefined ? { source: env._source } : {}),\n ...(env._sourceTs !== undefined ? { sourceTs: env._sourceTs } : {}),\n })\n }\n out[collection] = recs\n }\n return out\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,YAA2B;AACzC,SAAO;AAAA,IACL,MAAM,iBAAiB,OAAO,MAAM;AAClC,YAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,iCAAwB;AACtE,aAAO,qBAAqB,OAAO,IAAI;AAAA,IACzC;AAAA,EACF;AACF;;;ACkBA,eAAsB,mBACpB,OACA,MAC4B;AAC5B,QAAM,EAAE,SAAS,OAAO,aAAa,IAAI,MAAM,YAAY,OAAO,IAAI;AAEtE,QAAM,EAAE,MAAM,WAAW,QAAQ,IAAI,MAAM,iBAAiB;AAC5D,QAAM,UAAU,IAAI,YAAY;AAEhC,QAAM,eAED,CAAC;A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AAK,GAAG;AACrE,YAAM,OAAO,KAAK,MAAM,SAAS;AACjC,WAAK,KAAK;AAAA,QACR;AAAA,QACA,QAAQ,EAAE,GAAG,MAAM,GAAG;AAAA,QACtB,IAAI,IAAI;AAAA,QACR,SAAS,IAAI;AAAA,QACb,GAAI,IAAI,YAAY,SAAY,EAAE,QAAQ,IAAI,QAAQ,IAAI,CAAC;AAAA,QAC3D,GAAI,IAAI,cAAc,SAAY,EAAE,UAAU,IAAI,UAAU,IAAI,CAAC;AAAA,MACnE,CAAC;AAAA,IACH;AACA,QAAI,UAAU,IAAI;AAAA,EACpB;AACA,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BrokerNotEnabledError
3
- } from "./chunk-JBIV4FLR.js";
3
+ } from "./chunk-7O3Y4PPD.js";
4
4
 
5
5
  // src/port/with/broker-strategy.ts
6
6
  var NO_BROKER = {
@@ -27,4 +27,4 @@ export {
27
27
  NO_BROKER,
28
28
  buildCredentialBrokerHandle
29
29
  };
30
- //# sourceMappingURL=chunk-4A4TYISP.js.map
30
+ //# sourceMappingURL=chunk-JBDFMYKQ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TierWriteRefusedError
3
- } from "./chunk-JBIV4FLR.js";
3
+ } from "./chunk-7O3Y4PPD.js";
4
4
 
5
5
  // src/kernel/tier-visibility.ts
6
6
  async function peekLiveTier(adapter, vault, name, id) {
@@ -49,4 +49,4 @@ export {
49
49
  dekKey,
50
50
  parseDekKey
51
51
  };
52
- //# sourceMappingURL=chunk-POS53FG6.js.map
52
+ //# sourceMappingURL=chunk-JMGDHKQF.js.map
@@ -7,28 +7,28 @@ import {
7
7
  deriveSchemaManifest,
8
8
  loadSchemaManifestEntry,
9
9
  saveSchemaManifest
10
- } from "./chunk-VSLUSXVK.js";
10
+ } from "./chunk-VXGSWL6L.js";
11
11
  import {
12
12
  MANIFEST_COLLECTION
13
13
  } from "./chunk-EPFF7LOX.js";
14
14
  import {
15
15
  loadFence,
16
16
  saveFence
17
- } from "./chunk-M7UC2QPT.js";
17
+ } from "./chunk-453F654R.js";
18
18
  import {
19
19
  derivePersistedSchema
20
- } from "./chunk-P6ASQOZR.js";
20
+ } from "./chunk-REDOOY2Q.js";
21
21
  import {
22
22
  loadPersistedSchemaEntry,
23
23
  savePersistedSchema
24
- } from "./chunk-626TSARM.js";
24
+ } from "./chunk-2Y4IMKA6.js";
25
25
  import {
26
26
  envelopePayloadHash
27
- } from "./chunk-WLFABTZ6.js";
27
+ } from "./chunk-BOET4NA4.js";
28
28
  import {
29
29
  ManifestConflictError,
30
30
  isConflictError
31
- } from "./chunk-JBIV4FLR.js";
31
+ } from "./chunk-7O3Y4PPD.js";
32
32
 
33
33
  // src/with-shape/persisted-schemas/field-ids.ts
34
34
  var BASE32URL_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
@@ -257,4 +257,4 @@ export {
257
257
  persistClassifiedMarker,
258
258
  persistSatelliteMarker
259
259
  };
260
- //# sourceMappingURL=chunk-Q7GEDVHC.js.map
260
+ //# sourceMappingURL=chunk-K6LHRFBL.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LookupHandle
3
- } from "./chunk-XBFEKTIY.js";
3
+ } from "./chunk-6I2RQCET.js";
4
4
 
5
5
  // src/via/lookup/active.ts
6
6
  function withLookup() {
@@ -33,4 +33,4 @@ function withLookup() {
33
33
  export {
34
34
  withLookup
35
35
  };
36
- //# sourceMappingURL=chunk-4JDIRUTT.js.map
36
+ //# sourceMappingURL=chunk-K7NTTA6P.js.map
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  buildRecordAad,
3
3
  openEnvelopeJson
4
- } from "./chunk-BYBB4ABD.js";
4
+ } from "./chunk-77K4PG6P.js";
5
5
  import {
6
6
  buildRecordEnvelope
7
- } from "./chunk-QU3YUP2X.js";
7
+ } from "./chunk-SZJ3DLZA.js";
8
8
  import {
9
9
  encrypt
10
- } from "./chunk-W5LHQXZU.js";
10
+ } from "./chunk-SL3JAAKN.js";
11
11
  import {
12
12
  ConflictError,
13
13
  USER_ENVELOPE_COLLECTION,
14
14
  USER_ENVELOPE_MAX_BYTES,
15
15
  UserEnvelopeOversizedError
16
- } from "./chunk-JBIV4FLR.js";
16
+ } from "./chunk-7O3Y4PPD.js";
17
17
 
18
18
  // src/with-party/directory/storage.ts
19
19
  var META_COLLECTION = "_meta";
@@ -142,4 +142,4 @@ export {
142
142
  deleteUserEnvelope,
143
143
  listUserEnvelopeIds
144
144
  };
145
- //# sourceMappingURL=chunk-26W5VETY.js.map
145
+ //# sourceMappingURL=chunk-KG7TZKZG.js.map
@@ -1,34 +1,34 @@
1
1
  import {
2
2
  assertTierAccess
3
- } from "./chunk-HTGRQZFB.js";
3
+ } from "./chunk-UGTBXF5U.js";
4
4
  import {
5
5
  dekKey
6
- } from "./chunk-POS53FG6.js";
6
+ } from "./chunk-JMGDHKQF.js";
7
7
  import {
8
8
  applyRewrappedBody,
9
9
  buildRecordAad,
10
10
  recordAadFor,
11
11
  rewrapBodyToDek
12
- } from "./chunk-BYBB4ABD.js";
12
+ } from "./chunk-77K4PG6P.js";
13
13
  import {
14
14
  buildRecordEnvelope,
15
15
  isDeleteMarker,
16
16
  isTombstoneShape
17
- } from "./chunk-QU3YUP2X.js";
17
+ } from "./chunk-SZJ3DLZA.js";
18
18
  import {
19
19
  decrypt,
20
20
  encrypt,
21
21
  unwrapCek
22
- } from "./chunk-W5LHQXZU.js";
22
+ } from "./chunk-SL3JAAKN.js";
23
23
  import {
24
24
  NOYDB_FORMAT_VERSION
25
- } from "./chunk-GU3LQYW2.js";
25
+ } from "./chunk-7MG7SJT7.js";
26
26
  import {
27
27
  PersistedIndexCompensationError,
28
28
  TierDemoteDeniedError,
29
29
  TiersNotEnabledError,
30
30
  UnsupportedTierCompositionError
31
- } from "./chunk-JBIV4FLR.js";
31
+ } from "./chunk-7O3Y4PPD.js";
32
32
 
33
33
  // src/with-audit/tiers/active.ts
34
34
  function withTiers() {
@@ -435,4 +435,4 @@ export {
435
435
  demote,
436
436
  classifySealedShred
437
437
  };
438
- //# sourceMappingURL=chunk-RJ7RIIX6.js.map
438
+ //# sourceMappingURL=chunk-KJIMGIWO.js.map
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  FieldNotQueryableError,
7
7
  IndexRequiredError
8
- } from "./chunk-JBIV4FLR.js";
8
+ } from "./chunk-7O3Y4PPD.js";
9
9
 
10
10
  // src/with-lookup/indexing/strategy.ts
11
11
  var NO_INDEXING = {
@@ -534,4 +534,4 @@ export {
534
534
  PersistedCollectionIndex,
535
535
  LazyQuery
536
536
  };
537
- //# sourceMappingURL=chunk-F7ZFRPGQ.js.map
537
+ //# sourceMappingURL=chunk-KTFRCC5C.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  getHistory,
3
3
  historyIdentity
4
- } from "./chunk-U6GCYG2T.js";
4
+ } from "./chunk-X2DLENDQ.js";
5
5
  import {
6
6
  liveRecordIsElevated
7
- } from "./chunk-POS53FG6.js";
7
+ } from "./chunk-JMGDHKQF.js";
8
8
  import {
9
9
  openEnvelopeJson
10
- } from "./chunk-BYBB4ABD.js";
10
+ } from "./chunk-77K4PG6P.js";
11
11
  import {
12
12
  ReadOnlyAtInstantError
13
- } from "./chunk-JBIV4FLR.js";
13
+ } from "./chunk-7O3Y4PPD.js";
14
14
 
15
15
  // src/with-commit/history/time-machine.ts
16
16
  var VaultInstant = class {
@@ -208,4 +208,4 @@ export {
208
208
  VaultInstant,
209
209
  CollectionInstant
210
210
  };
211
- //# sourceMappingURL=chunk-HSGEIMJS.js.map
211
+ //# sourceMappingURL=chunk-KUJDV5QH.js.map
@@ -1,13 +1,15 @@
1
1
  import {
2
- fallbackDerivationName,
2
+ fallbackDerivationName
3
+ } from "./chunk-RXLYKVTF.js";
4
+ import {
3
5
  jsonSchemaToFields
4
- } from "./chunk-KHKKD62N.js";
6
+ } from "./chunk-VYYM3MEN.js";
5
7
  import {
6
8
  derivePersistedSchema
7
- } from "./chunk-P6ASQOZR.js";
9
+ } from "./chunk-REDOOY2Q.js";
8
10
  import {
9
11
  loadPersistedSchema
10
- } from "./chunk-626TSARM.js";
12
+ } from "./chunk-2Y4IMKA6.js";
11
13
 
12
14
  // src/with-shape/introspection/walk.ts
13
15
  var INTERNAL_PREFIX = "_";
@@ -238,4 +240,4 @@ function summariseAggregateOp(value) {
238
240
  export {
239
241
  dumpVaultSchema
240
242
  };
241
- //# sourceMappingURL=chunk-XWNLKG6R.js.map
243
+ //# sourceMappingURL=chunk-KUX3OB6D.js.map