@noy-db/hub 0.6.0-pre.22 → 0.6.0-pre.24

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 (380) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/dist/api-56KUWV6E.js +20 -0
  3. package/dist/attestation/index.js +18 -18
  4. package/dist/{backup-4PZAH67W.js → backup-WLKPDY3V.js} +12 -12
  5. package/dist/blobs/index.js +22 -20
  6. package/dist/blobs/index.js.map +1 -1
  7. package/dist/broker/index.js +12 -12
  8. package/dist/cargo/index.js +29 -29
  9. package/dist/{chunk-PNXJV4OS.js → chunk-24ZDSTEQ.js} +41 -17
  10. package/dist/chunk-24ZDSTEQ.js.map +1 -0
  11. package/dist/{chunk-4RZTW5JH.js → chunk-25HI46CB.js} +2 -2
  12. package/dist/{chunk-PWK3SSNB.js → chunk-264AKW4K.js} +4 -4
  13. package/dist/{chunk-7LJA7T4W.js → chunk-2CURJCLC.js} +3 -3
  14. package/dist/{chunk-YF3CIA6E.js → chunk-2D5NXYWY.js} +2 -2
  15. package/dist/{chunk-REQJLII3.js → chunk-2MYYXXVM.js} +2 -2
  16. package/dist/{chunk-DIYI32MG.js → chunk-2S6HROLU.js} +5 -5
  17. package/dist/{chunk-23XKHFNT.js → chunk-2ZSBPXFW.js} +3 -3
  18. package/dist/{chunk-XZZIZ544.js → chunk-34MSA4AO.js} +51 -16
  19. package/dist/chunk-34MSA4AO.js.map +1 -0
  20. package/dist/{chunk-BXHG26KN.js → chunk-35K4VWMD.js} +2 -2
  21. package/dist/{chunk-DIVPOJPV.js → chunk-43FOH2OK.js} +20 -8
  22. package/dist/chunk-43FOH2OK.js.map +1 -0
  23. package/dist/{chunk-UQUWSM33.js → chunk-4P3OG2AO.js} +5 -5
  24. package/dist/{chunk-KYUKZIW5.js → chunk-4Y7VHLCT.js} +2 -2
  25. package/dist/{chunk-RJYPFCID.js → chunk-576CTQ77.js} +5 -5
  26. package/dist/{chunk-OCW3IM2F.js → chunk-57MEX4LL.js} +3 -3
  27. package/dist/{chunk-PKUJ3JLQ.js → chunk-5OFC3QYL.js} +19 -2
  28. package/dist/chunk-5OFC3QYL.js.map +1 -0
  29. package/dist/{chunk-4O52JH3C.js → chunk-65WBEFVT.js} +6 -6
  30. package/dist/{chunk-JSTQGUE5.js → chunk-6J7SSCJW.js} +15 -10
  31. package/dist/chunk-6J7SSCJW.js.map +1 -0
  32. package/dist/{chunk-7JOXCSDU.js → chunk-6PLCNLBC.js} +2 -2
  33. package/dist/{chunk-QK2QAMF7.js → chunk-ACIEKVFR.js} +10 -10
  34. package/dist/{chunk-JPVJTTHU.js → chunk-AKPIBKHK.js} +4 -4
  35. package/dist/{chunk-AELW6OJZ.js → chunk-AM6V36AG.js} +2 -2
  36. package/dist/{chunk-DUUARUZI.js → chunk-AU45F5FD.js} +2 -2
  37. package/dist/{chunk-4BYZIQ5T.js → chunk-BZKQRED6.js} +2 -2
  38. package/dist/{chunk-OZ5QBLEL.js → chunk-C3FCXXNI.js} +6 -6
  39. package/dist/{chunk-FKZI4NSG.js → chunk-C4DFJ76X.js} +6 -6
  40. package/dist/{chunk-PGHSH4TY.js → chunk-CDHX3SRW.js} +3 -3
  41. package/dist/{chunk-O5QXH7U7.js → chunk-D7STIWJO.js} +11 -2
  42. package/dist/chunk-D7STIWJO.js.map +1 -0
  43. package/dist/{chunk-VMYXYFPX.js → chunk-DBPQUICN.js} +2 -2
  44. package/dist/{chunk-3TWEXEKX.js → chunk-DL7NXFAY.js} +2 -2
  45. package/dist/{chunk-2VMCJUK6.js → chunk-DM2BZDNV.js} +5 -5
  46. package/dist/{chunk-FFSQFH6D.js → chunk-DNKVKO7K.js} +2 -2
  47. package/dist/{chunk-IPA6ODWG.js → chunk-E2LYQUB7.js} +4 -4
  48. package/dist/{chunk-ANYVM4SX.js → chunk-ENTVT7PF.js} +2 -2
  49. package/dist/{chunk-M3FKPVOU.js → chunk-ESP4K32V.js} +3 -3
  50. package/dist/{chunk-A66LJYFG.js → chunk-FEWCVAFV.js} +131 -17
  51. package/dist/chunk-FEWCVAFV.js.map +1 -0
  52. package/dist/{chunk-H27DIXOV.js → chunk-FJGNYSB3.js} +6 -6
  53. package/dist/{chunk-OBPL43F3.js → chunk-FKLKAO2C.js} +54 -7
  54. package/dist/chunk-FKLKAO2C.js.map +1 -0
  55. package/dist/{chunk-PENPHA45.js → chunk-FX3UIDCS.js} +2 -2
  56. package/dist/{chunk-H3SEW5HB.js → chunk-G3ZMEUWD.js} +7 -7
  57. package/dist/{chunk-ZAZW5LLF.js → chunk-GCTZNHDO.js} +2 -2
  58. package/dist/{chunk-D5EXZVQC.js → chunk-GDYDYUO7.js} +6 -6
  59. package/dist/{chunk-47F6AI2K.js → chunk-GU5XWSH4.js} +3 -3
  60. package/dist/{chunk-6ZGDIN2D.js → chunk-H6J6MZ4J.js} +3 -3
  61. package/dist/{chunk-ZUDIY7YP.js → chunk-HMS3OCMA.js} +7 -7
  62. package/dist/{chunk-H6K24KLL.js → chunk-HUAAYTVS.js} +4 -4
  63. package/dist/{chunk-2DFE4TUE.js → chunk-HUDP5NSI.js} +4 -4
  64. package/dist/{chunk-VKYEEJJ2.js → chunk-HWJZCZSI.js} +2 -2
  65. package/dist/{chunk-NB2CKJ27.js → chunk-ICGLT356.js} +2 -2
  66. package/dist/{chunk-CW3VJARJ.js → chunk-IYXP6OR5.js} +3 -3
  67. package/dist/{chunk-A5YEUQOY.js → chunk-JSJS7RHS.js} +2 -2
  68. package/dist/{chunk-NHXIFF4Y.js → chunk-K6J7JKZM.js} +7 -7
  69. package/dist/{chunk-LLLSK7UQ.js → chunk-K7HPGV5K.js} +2 -2
  70. package/dist/{chunk-F3BICEMK.js → chunk-KC3S3OH6.js} +2 -2
  71. package/dist/{chunk-HZIIDYJV.js → chunk-KEMD6B3W.js} +4 -4
  72. package/dist/{chunk-SRR22EW2.js → chunk-L34HKPIS.js} +8 -8
  73. package/dist/{chunk-AGETRKC5.js → chunk-LG2P6S32.js} +3 -3
  74. package/dist/{chunk-FUIG7QSS.js → chunk-LT26SRU5.js} +4 -4
  75. package/dist/{chunk-6QMOJTC6.js → chunk-LTC77D4V.js} +2 -2
  76. package/dist/{chunk-QTWWZ25B.js → chunk-LU2HAOVP.js} +18 -14
  77. package/dist/chunk-LU2HAOVP.js.map +1 -0
  78. package/dist/{chunk-QMJI5VHV.js → chunk-M3XEJJDE.js} +2 -2
  79. package/dist/{chunk-VWPJX5B3.js → chunk-MGIAYREB.js} +5 -5
  80. package/dist/{chunk-VYLC5KAT.js → chunk-MLTGIDNB.js} +2 -2
  81. package/dist/{chunk-L2YYIQYR.js → chunk-MXJMCTSI.js} +2 -2
  82. package/dist/{chunk-F5IFR56V.js → chunk-NFARMKWK.js} +34 -12
  83. package/dist/chunk-NFARMKWK.js.map +1 -0
  84. package/dist/{chunk-IUQPNAGR.js → chunk-NK7DO6A2.js} +3 -3
  85. package/dist/{chunk-TKLQWOTY.js → chunk-NKND2IMW.js} +2 -2
  86. package/dist/{chunk-WUNRUSBJ.js → chunk-NSZGZYZL.js} +13 -3
  87. package/dist/{chunk-WUNRUSBJ.js.map → chunk-NSZGZYZL.js.map} +1 -1
  88. package/dist/{chunk-XPTYXXMD.js → chunk-NUHIPODK.js} +2 -2
  89. package/dist/{chunk-REKDM67V.js → chunk-ODGV6Q6U.js} +2 -2
  90. package/dist/{chunk-WRGNEAUZ.js → chunk-OJYLLNQN.js} +2 -2
  91. package/dist/{chunk-NCAMIRFB.js → chunk-OQT3G55N.js} +2 -2
  92. package/dist/{chunk-BPLSGN4X.js → chunk-PORGC5MH.js} +2 -2
  93. package/dist/{chunk-BFNBYT62.js → chunk-PRBJ4BJD.js} +2 -2
  94. package/dist/{chunk-4IPP2P74.js → chunk-PU5PNTE2.js} +2 -2
  95. package/dist/{chunk-L3AM6EGU.js → chunk-PZEDIO72.js} +7 -7
  96. package/dist/{chunk-M7VSXBUL.js → chunk-RTBCWDJ3.js} +10 -10
  97. package/dist/{chunk-OTHHO3KI.js → chunk-S2I5MYSA.js} +2 -2
  98. package/dist/{chunk-FHEVZQQY.js → chunk-S447GUNV.js} +4 -4
  99. package/dist/{chunk-WKT7NNNR.js → chunk-SP3AFEB7.js} +4 -4
  100. package/dist/{chunk-KMGAFLCK.js → chunk-SQWXF2HP.js} +5 -5
  101. package/dist/{chunk-HRSEAGLI.js → chunk-TTGZ6KGY.js} +3 -3
  102. package/dist/{chunk-MQFKH3ZJ.js → chunk-UHFF4G53.js} +3 -3
  103. package/dist/{chunk-IGNJOJEP.js → chunk-UJ4Z67UQ.js} +2 -2
  104. package/dist/chunk-UJ4Z67UQ.js.map +1 -0
  105. package/dist/{chunk-FGZ7GJXO.js → chunk-VZEBHQRT.js} +3 -3
  106. package/dist/{chunk-HUEG3YP4.js → chunk-VZHEFFUO.js} +97 -82
  107. package/dist/chunk-VZHEFFUO.js.map +1 -0
  108. package/dist/{chunk-OIW75CLW.js → chunk-WN377AAV.js} +6 -6
  109. package/dist/{chunk-ESXVNASI.js → chunk-XCNYOVFV.js} +5 -5
  110. package/dist/{chunk-FFESJQ5A.js → chunk-YEEV4ZXL.js} +95 -32
  111. package/dist/chunk-YEEV4ZXL.js.map +1 -0
  112. package/dist/{chunk-YOMI3ZCA.js → chunk-YIC34H3M.js} +2 -2
  113. package/dist/{chunk-MBZFAJKM.js → chunk-YZWRJRMF.js} +6 -2
  114. package/dist/chunk-YZWRJRMF.js.map +1 -0
  115. package/dist/{chunk-GWJJ5CK3.js → chunk-Z45PK2H5.js} +5 -5
  116. package/dist/{chunk-RT7CWTUG.js → chunk-ZI43U6FN.js} +6 -6
  117. package/dist/{chunk-WFC2GHJG.js → chunk-ZJJ46LNY.js} +3 -3
  118. package/dist/{chunk-3ENNPCIW.js → chunk-ZY6P7M52.js} +2 -2
  119. package/dist/classified/index.js +5 -5
  120. package/dist/{classified-marker-EPL2NX3H.js → classified-marker-DLLGRRXG.js} +3 -3
  121. package/dist/collection-facade-OHBCHCJV.js +45 -0
  122. package/dist/{computed-UXN4AMI5.js → computed-X2RKYFGX.js} +3 -3
  123. package/dist/consent/index.js +9 -9
  124. package/dist/cover/index.js +9 -9
  125. package/dist/custody/index.js +12 -11
  126. package/dist/{dead-filter-56AYTNAO.js → dead-filter-CCLDPNTJ.js} +2 -2
  127. package/dist/debug/index.js +1 -1
  128. package/dist/{delegation-MCCWCFZA.js → delegation-OSXUSSUO.js} +11 -11
  129. package/dist/derivations/index.js +12 -12
  130. package/dist/derive-6K35IOIN.js +22 -0
  131. package/dist/directory/index.js +10 -10
  132. package/dist/{dispatch-JM7X5BLP.js → dispatch-HCCQPOC7.js} +9 -6
  133. package/dist/dispatch-HCCQPOC7.js.map +1 -0
  134. package/dist/{dispatch-UPZW4MAO.js → dispatch-TRXQIBLA.js} +18 -18
  135. package/dist/{enclave-CCXI3WEU.js → enclave-K33BCSHB.js} +13 -9
  136. package/dist/executor-44ONIZTV.js +9 -0
  137. package/dist/executor-H7KLBIJN.js +9 -0
  138. package/dist/executor-PDK7IAPQ.js +29 -0
  139. package/dist/export-accessible-2LJH6JTI.js +23 -0
  140. package/dist/extract-partition-QQFOPCJ6.js +38 -0
  141. package/dist/{fanout-sidecar-2EHAV6UP.js → fanout-sidecar-ORVUHI3J.js} +9 -9
  142. package/dist/find-H6GHRBNL.js +11 -0
  143. package/dist/forget/index.js +9 -9
  144. package/dist/guards/index.js +4 -4
  145. package/dist/history/index.js +13 -13
  146. package/dist/i18n/index.js +14 -14
  147. package/dist/index.d.ts +1 -1
  148. package/dist/index.js +93 -91
  149. package/dist/index.js.map +1 -1
  150. package/dist/indexing/index.js +2 -2
  151. package/dist/introspection/index.js +11 -11
  152. package/dist/issue-LV2IWCKY.js +19 -0
  153. package/dist/kernel/collection.d.ts +8 -2
  154. package/dist/kernel/constants.d.ts +18 -0
  155. package/dist/kernel/enclave/crypto.d.ts +28 -0
  156. package/dist/kernel/enclave/index.d.ts +2 -2
  157. package/dist/kernel/enclave/record-keys/rekey.d.ts +23 -0
  158. package/dist/kernel/errors.d.ts +41 -0
  159. package/dist/kernel/refs.d.ts +3 -1
  160. package/dist/kernel/tier-visibility.d.ts +19 -0
  161. package/dist/kernel/types.d.ts +1 -1
  162. package/dist/kernel/via/reconcile.d.ts +12 -0
  163. package/dist/{ledger-TZIDVW22.js → ledger-RM5672K4.js} +11 -11
  164. package/dist/liberate-PNPIQ45H.js +25 -0
  165. package/dist/{link-set-VOMRQB2H.js → link-set-AZ6VDH5X.js} +11 -11
  166. package/dist/{managed-secret-N6FWB5LX.js → managed-secret-QZKTYCLD.js} +10 -10
  167. package/dist/materialized-views/index.js +20 -20
  168. package/dist/{migrate-cek-UEO2EUWI.js → migrate-cek-BVAPYJ5T.js} +2 -2
  169. package/dist/money/index.js +4 -4
  170. package/dist/noydb-QZN7G26J.js +85 -0
  171. package/dist/overlay-views/index.js +4 -4
  172. package/dist/periods/index.js +12 -12
  173. package/dist/pod/index.js +56 -55
  174. package/dist/{pod-handle-D6ZRTO4N.js → pod-handle-LVSMK4XC.js} +9 -9
  175. package/dist/policy/index.js +10 -10
  176. package/dist/portability/index.js +8 -8
  177. package/dist/{post-register-XVGHYYSB.js → post-register-TZGQ34YR.js} +6 -6
  178. package/dist/query/index.js +3 -3
  179. package/dist/reduce/index.js +4 -4
  180. package/dist/register-IQJGJSQQ.js +32 -0
  181. package/dist/registry-3JY3YSMU.js +9 -0
  182. package/dist/registry-G365BQDC.js +19 -0
  183. package/dist/registry-HVS6PGHV.js +9 -0
  184. package/dist/registry-TQ5FRB4T.js +18 -0
  185. package/dist/request-withdrawal-XQCCKMB3.js +31 -0
  186. package/dist/{reveal-Z62PLVJT.js → reveal-5PXWDCLZ.js} +6 -6
  187. package/dist/revoke-6NSQWTED.js +24 -0
  188. package/dist/satellites/index.js +1 -1
  189. package/dist/schema-update/index.js +2 -2
  190. package/dist/sealed-record/index.js +12 -12
  191. package/dist/search/index.js +4 -4
  192. package/dist/{seed-R2JK2YQK.js → seed-ZLOK3Z4M.js} +12 -11
  193. package/dist/{seed-R2JK2YQK.js.map → seed-ZLOK3Z4M.js.map} +1 -1
  194. package/dist/sequence/index.js +9 -9
  195. package/dist/session/index.js +9 -9
  196. package/dist/shadow/index.js +2 -2
  197. package/dist/signer-AJ3MCSPI.js +25 -0
  198. package/dist/snapshots/index.js +10 -10
  199. package/dist/{stale-FVK3WRMM.js → stale-KQR5QAYJ.js} +10 -10
  200. package/dist/storage-GACYAH6W.js +23 -0
  201. package/dist/{store-coordination-provider-HIPOZMC2.js → store-coordination-provider-RII4H3PJ.js} +10 -10
  202. package/dist/sync/index.js +10 -10
  203. package/dist/team/index.js +15 -15
  204. package/dist/tiers/index.js +11 -11
  205. package/dist/to/index.js +1 -1
  206. package/dist/transactions/index.js +3 -3
  207. package/dist/util/index.js +1 -1
  208. package/dist/vault-head/index.js +8 -8
  209. package/dist/{verify-KYICK5IW.js → verify-OMPYUO7C.js} +5 -5
  210. package/dist/via/blob/index.d.ts +3 -0
  211. package/dist/walk-ZYC74R65.js +21 -0
  212. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +4 -0
  213. package/dist/with-formula/materialized-views/projection-legs.d.ts +59 -0
  214. package/dist/with-formula/materialized-views/registry.d.ts +50 -0
  215. package/dist/with-formula/materialized-views/types.d.ts +68 -10
  216. package/dist/with-party/team/roster-tag.d.ts +1 -1
  217. package/dist/with-shape/blobs/blob-compaction.d.ts +13 -0
  218. package/dist/with-shape/blobs/blob-set.d.ts +23 -3
  219. package/dist/with-shape/blobs/orphan-report.d.ts +62 -0
  220. package/dist/withdraw-accessible-MEFFAGRD.js +28 -0
  221. package/package.json +3 -3
  222. package/dist/api-D6DBNTOS.js +0 -20
  223. package/dist/chunk-A66LJYFG.js.map +0 -1
  224. package/dist/chunk-DIVPOJPV.js.map +0 -1
  225. package/dist/chunk-F5IFR56V.js.map +0 -1
  226. package/dist/chunk-FFESJQ5A.js.map +0 -1
  227. package/dist/chunk-HUEG3YP4.js.map +0 -1
  228. package/dist/chunk-IGNJOJEP.js.map +0 -1
  229. package/dist/chunk-JSTQGUE5.js.map +0 -1
  230. package/dist/chunk-MBZFAJKM.js.map +0 -1
  231. package/dist/chunk-O5QXH7U7.js.map +0 -1
  232. package/dist/chunk-OBPL43F3.js.map +0 -1
  233. package/dist/chunk-PKUJ3JLQ.js.map +0 -1
  234. package/dist/chunk-PNXJV4OS.js.map +0 -1
  235. package/dist/chunk-QTWWZ25B.js.map +0 -1
  236. package/dist/chunk-XZZIZ544.js.map +0 -1
  237. package/dist/collection-facade-3DN4ETEP.js +0 -45
  238. package/dist/derive-BSAF6N5X.js +0 -22
  239. package/dist/dispatch-JM7X5BLP.js.map +0 -1
  240. package/dist/executor-6YQYFGHK.js +0 -9
  241. package/dist/executor-GLKPMISJ.js +0 -9
  242. package/dist/executor-ZEIX7Y7I.js +0 -29
  243. package/dist/export-accessible-SDIQEFHQ.js +0 -23
  244. package/dist/extract-partition-K232SO2V.js +0 -38
  245. package/dist/find-GKFC5753.js +0 -11
  246. package/dist/issue-QTQYQJCB.js +0 -19
  247. package/dist/liberate-FOK7RFYQ.js +0 -24
  248. package/dist/noydb-3BBLBSHI.js +0 -84
  249. package/dist/register-FVUE46K4.js +0 -32
  250. package/dist/registry-7PBVHSD5.js +0 -19
  251. package/dist/registry-CCXD57GV.js +0 -18
  252. package/dist/registry-K75FRKSU.js +0 -9
  253. package/dist/registry-KZYPKIOF.js +0 -9
  254. package/dist/request-withdrawal-WS7PXD7B.js +0 -31
  255. package/dist/revoke-JH4VQTJ3.js +0 -24
  256. package/dist/signer-AFV6AXSN.js +0 -25
  257. package/dist/storage-EIM5HO2O.js +0 -23
  258. package/dist/walk-FV6JFWXV.js +0 -21
  259. package/dist/withdraw-accessible-JYX3SPVY.js +0 -28
  260. /package/dist/{api-D6DBNTOS.js.map → api-56KUWV6E.js.map} +0 -0
  261. /package/dist/{backup-4PZAH67W.js.map → backup-WLKPDY3V.js.map} +0 -0
  262. /package/dist/{chunk-4RZTW5JH.js.map → chunk-25HI46CB.js.map} +0 -0
  263. /package/dist/{chunk-PWK3SSNB.js.map → chunk-264AKW4K.js.map} +0 -0
  264. /package/dist/{chunk-7LJA7T4W.js.map → chunk-2CURJCLC.js.map} +0 -0
  265. /package/dist/{chunk-YF3CIA6E.js.map → chunk-2D5NXYWY.js.map} +0 -0
  266. /package/dist/{chunk-REQJLII3.js.map → chunk-2MYYXXVM.js.map} +0 -0
  267. /package/dist/{chunk-DIYI32MG.js.map → chunk-2S6HROLU.js.map} +0 -0
  268. /package/dist/{chunk-23XKHFNT.js.map → chunk-2ZSBPXFW.js.map} +0 -0
  269. /package/dist/{chunk-BXHG26KN.js.map → chunk-35K4VWMD.js.map} +0 -0
  270. /package/dist/{chunk-UQUWSM33.js.map → chunk-4P3OG2AO.js.map} +0 -0
  271. /package/dist/{chunk-KYUKZIW5.js.map → chunk-4Y7VHLCT.js.map} +0 -0
  272. /package/dist/{chunk-RJYPFCID.js.map → chunk-576CTQ77.js.map} +0 -0
  273. /package/dist/{chunk-OCW3IM2F.js.map → chunk-57MEX4LL.js.map} +0 -0
  274. /package/dist/{chunk-4O52JH3C.js.map → chunk-65WBEFVT.js.map} +0 -0
  275. /package/dist/{chunk-7JOXCSDU.js.map → chunk-6PLCNLBC.js.map} +0 -0
  276. /package/dist/{chunk-QK2QAMF7.js.map → chunk-ACIEKVFR.js.map} +0 -0
  277. /package/dist/{chunk-JPVJTTHU.js.map → chunk-AKPIBKHK.js.map} +0 -0
  278. /package/dist/{chunk-AELW6OJZ.js.map → chunk-AM6V36AG.js.map} +0 -0
  279. /package/dist/{chunk-DUUARUZI.js.map → chunk-AU45F5FD.js.map} +0 -0
  280. /package/dist/{chunk-4BYZIQ5T.js.map → chunk-BZKQRED6.js.map} +0 -0
  281. /package/dist/{chunk-OZ5QBLEL.js.map → chunk-C3FCXXNI.js.map} +0 -0
  282. /package/dist/{chunk-FKZI4NSG.js.map → chunk-C4DFJ76X.js.map} +0 -0
  283. /package/dist/{chunk-PGHSH4TY.js.map → chunk-CDHX3SRW.js.map} +0 -0
  284. /package/dist/{chunk-VMYXYFPX.js.map → chunk-DBPQUICN.js.map} +0 -0
  285. /package/dist/{chunk-3TWEXEKX.js.map → chunk-DL7NXFAY.js.map} +0 -0
  286. /package/dist/{chunk-2VMCJUK6.js.map → chunk-DM2BZDNV.js.map} +0 -0
  287. /package/dist/{chunk-FFSQFH6D.js.map → chunk-DNKVKO7K.js.map} +0 -0
  288. /package/dist/{chunk-IPA6ODWG.js.map → chunk-E2LYQUB7.js.map} +0 -0
  289. /package/dist/{chunk-ANYVM4SX.js.map → chunk-ENTVT7PF.js.map} +0 -0
  290. /package/dist/{chunk-M3FKPVOU.js.map → chunk-ESP4K32V.js.map} +0 -0
  291. /package/dist/{chunk-H27DIXOV.js.map → chunk-FJGNYSB3.js.map} +0 -0
  292. /package/dist/{chunk-PENPHA45.js.map → chunk-FX3UIDCS.js.map} +0 -0
  293. /package/dist/{chunk-H3SEW5HB.js.map → chunk-G3ZMEUWD.js.map} +0 -0
  294. /package/dist/{chunk-ZAZW5LLF.js.map → chunk-GCTZNHDO.js.map} +0 -0
  295. /package/dist/{chunk-D5EXZVQC.js.map → chunk-GDYDYUO7.js.map} +0 -0
  296. /package/dist/{chunk-47F6AI2K.js.map → chunk-GU5XWSH4.js.map} +0 -0
  297. /package/dist/{chunk-6ZGDIN2D.js.map → chunk-H6J6MZ4J.js.map} +0 -0
  298. /package/dist/{chunk-ZUDIY7YP.js.map → chunk-HMS3OCMA.js.map} +0 -0
  299. /package/dist/{chunk-H6K24KLL.js.map → chunk-HUAAYTVS.js.map} +0 -0
  300. /package/dist/{chunk-2DFE4TUE.js.map → chunk-HUDP5NSI.js.map} +0 -0
  301. /package/dist/{chunk-VKYEEJJ2.js.map → chunk-HWJZCZSI.js.map} +0 -0
  302. /package/dist/{chunk-NB2CKJ27.js.map → chunk-ICGLT356.js.map} +0 -0
  303. /package/dist/{chunk-CW3VJARJ.js.map → chunk-IYXP6OR5.js.map} +0 -0
  304. /package/dist/{chunk-A5YEUQOY.js.map → chunk-JSJS7RHS.js.map} +0 -0
  305. /package/dist/{chunk-NHXIFF4Y.js.map → chunk-K6J7JKZM.js.map} +0 -0
  306. /package/dist/{chunk-LLLSK7UQ.js.map → chunk-K7HPGV5K.js.map} +0 -0
  307. /package/dist/{chunk-F3BICEMK.js.map → chunk-KC3S3OH6.js.map} +0 -0
  308. /package/dist/{chunk-HZIIDYJV.js.map → chunk-KEMD6B3W.js.map} +0 -0
  309. /package/dist/{chunk-SRR22EW2.js.map → chunk-L34HKPIS.js.map} +0 -0
  310. /package/dist/{chunk-AGETRKC5.js.map → chunk-LG2P6S32.js.map} +0 -0
  311. /package/dist/{chunk-FUIG7QSS.js.map → chunk-LT26SRU5.js.map} +0 -0
  312. /package/dist/{chunk-6QMOJTC6.js.map → chunk-LTC77D4V.js.map} +0 -0
  313. /package/dist/{chunk-QMJI5VHV.js.map → chunk-M3XEJJDE.js.map} +0 -0
  314. /package/dist/{chunk-VWPJX5B3.js.map → chunk-MGIAYREB.js.map} +0 -0
  315. /package/dist/{chunk-VYLC5KAT.js.map → chunk-MLTGIDNB.js.map} +0 -0
  316. /package/dist/{chunk-L2YYIQYR.js.map → chunk-MXJMCTSI.js.map} +0 -0
  317. /package/dist/{chunk-IUQPNAGR.js.map → chunk-NK7DO6A2.js.map} +0 -0
  318. /package/dist/{chunk-TKLQWOTY.js.map → chunk-NKND2IMW.js.map} +0 -0
  319. /package/dist/{chunk-XPTYXXMD.js.map → chunk-NUHIPODK.js.map} +0 -0
  320. /package/dist/{chunk-REKDM67V.js.map → chunk-ODGV6Q6U.js.map} +0 -0
  321. /package/dist/{chunk-WRGNEAUZ.js.map → chunk-OJYLLNQN.js.map} +0 -0
  322. /package/dist/{chunk-NCAMIRFB.js.map → chunk-OQT3G55N.js.map} +0 -0
  323. /package/dist/{chunk-BPLSGN4X.js.map → chunk-PORGC5MH.js.map} +0 -0
  324. /package/dist/{chunk-BFNBYT62.js.map → chunk-PRBJ4BJD.js.map} +0 -0
  325. /package/dist/{chunk-4IPP2P74.js.map → chunk-PU5PNTE2.js.map} +0 -0
  326. /package/dist/{chunk-L3AM6EGU.js.map → chunk-PZEDIO72.js.map} +0 -0
  327. /package/dist/{chunk-M7VSXBUL.js.map → chunk-RTBCWDJ3.js.map} +0 -0
  328. /package/dist/{chunk-OTHHO3KI.js.map → chunk-S2I5MYSA.js.map} +0 -0
  329. /package/dist/{chunk-FHEVZQQY.js.map → chunk-S447GUNV.js.map} +0 -0
  330. /package/dist/{chunk-WKT7NNNR.js.map → chunk-SP3AFEB7.js.map} +0 -0
  331. /package/dist/{chunk-KMGAFLCK.js.map → chunk-SQWXF2HP.js.map} +0 -0
  332. /package/dist/{chunk-HRSEAGLI.js.map → chunk-TTGZ6KGY.js.map} +0 -0
  333. /package/dist/{chunk-MQFKH3ZJ.js.map → chunk-UHFF4G53.js.map} +0 -0
  334. /package/dist/{chunk-FGZ7GJXO.js.map → chunk-VZEBHQRT.js.map} +0 -0
  335. /package/dist/{chunk-OIW75CLW.js.map → chunk-WN377AAV.js.map} +0 -0
  336. /package/dist/{chunk-ESXVNASI.js.map → chunk-XCNYOVFV.js.map} +0 -0
  337. /package/dist/{chunk-YOMI3ZCA.js.map → chunk-YIC34H3M.js.map} +0 -0
  338. /package/dist/{chunk-GWJJ5CK3.js.map → chunk-Z45PK2H5.js.map} +0 -0
  339. /package/dist/{chunk-RT7CWTUG.js.map → chunk-ZI43U6FN.js.map} +0 -0
  340. /package/dist/{chunk-WFC2GHJG.js.map → chunk-ZJJ46LNY.js.map} +0 -0
  341. /package/dist/{chunk-3ENNPCIW.js.map → chunk-ZY6P7M52.js.map} +0 -0
  342. /package/dist/{classified-marker-EPL2NX3H.js.map → classified-marker-DLLGRRXG.js.map} +0 -0
  343. /package/dist/{collection-facade-3DN4ETEP.js.map → collection-facade-OHBCHCJV.js.map} +0 -0
  344. /package/dist/{computed-UXN4AMI5.js.map → computed-X2RKYFGX.js.map} +0 -0
  345. /package/dist/{dead-filter-56AYTNAO.js.map → dead-filter-CCLDPNTJ.js.map} +0 -0
  346. /package/dist/{delegation-MCCWCFZA.js.map → delegation-OSXUSSUO.js.map} +0 -0
  347. /package/dist/{derive-BSAF6N5X.js.map → derive-6K35IOIN.js.map} +0 -0
  348. /package/dist/{dispatch-UPZW4MAO.js.map → dispatch-TRXQIBLA.js.map} +0 -0
  349. /package/dist/{enclave-CCXI3WEU.js.map → enclave-K33BCSHB.js.map} +0 -0
  350. /package/dist/{executor-6YQYFGHK.js.map → executor-44ONIZTV.js.map} +0 -0
  351. /package/dist/{executor-GLKPMISJ.js.map → executor-H7KLBIJN.js.map} +0 -0
  352. /package/dist/{executor-ZEIX7Y7I.js.map → executor-PDK7IAPQ.js.map} +0 -0
  353. /package/dist/{export-accessible-SDIQEFHQ.js.map → export-accessible-2LJH6JTI.js.map} +0 -0
  354. /package/dist/{extract-partition-K232SO2V.js.map → extract-partition-QQFOPCJ6.js.map} +0 -0
  355. /package/dist/{fanout-sidecar-2EHAV6UP.js.map → fanout-sidecar-ORVUHI3J.js.map} +0 -0
  356. /package/dist/{find-GKFC5753.js.map → find-H6GHRBNL.js.map} +0 -0
  357. /package/dist/{issue-QTQYQJCB.js.map → issue-LV2IWCKY.js.map} +0 -0
  358. /package/dist/{ledger-TZIDVW22.js.map → ledger-RM5672K4.js.map} +0 -0
  359. /package/dist/{liberate-FOK7RFYQ.js.map → liberate-PNPIQ45H.js.map} +0 -0
  360. /package/dist/{link-set-VOMRQB2H.js.map → link-set-AZ6VDH5X.js.map} +0 -0
  361. /package/dist/{managed-secret-N6FWB5LX.js.map → managed-secret-QZKTYCLD.js.map} +0 -0
  362. /package/dist/{migrate-cek-UEO2EUWI.js.map → migrate-cek-BVAPYJ5T.js.map} +0 -0
  363. /package/dist/{noydb-3BBLBSHI.js.map → noydb-QZN7G26J.js.map} +0 -0
  364. /package/dist/{pod-handle-D6ZRTO4N.js.map → pod-handle-LVSMK4XC.js.map} +0 -0
  365. /package/dist/{post-register-XVGHYYSB.js.map → post-register-TZGQ34YR.js.map} +0 -0
  366. /package/dist/{register-FVUE46K4.js.map → register-IQJGJSQQ.js.map} +0 -0
  367. /package/dist/{registry-7PBVHSD5.js.map → registry-3JY3YSMU.js.map} +0 -0
  368. /package/dist/{registry-CCXD57GV.js.map → registry-G365BQDC.js.map} +0 -0
  369. /package/dist/{registry-K75FRKSU.js.map → registry-HVS6PGHV.js.map} +0 -0
  370. /package/dist/{registry-KZYPKIOF.js.map → registry-TQ5FRB4T.js.map} +0 -0
  371. /package/dist/{request-withdrawal-WS7PXD7B.js.map → request-withdrawal-XQCCKMB3.js.map} +0 -0
  372. /package/dist/{reveal-Z62PLVJT.js.map → reveal-5PXWDCLZ.js.map} +0 -0
  373. /package/dist/{revoke-JH4VQTJ3.js.map → revoke-6NSQWTED.js.map} +0 -0
  374. /package/dist/{signer-AFV6AXSN.js.map → signer-AJ3MCSPI.js.map} +0 -0
  375. /package/dist/{stale-FVK3WRMM.js.map → stale-KQR5QAYJ.js.map} +0 -0
  376. /package/dist/{storage-EIM5HO2O.js.map → storage-GACYAH6W.js.map} +0 -0
  377. /package/dist/{store-coordination-provider-HIPOZMC2.js.map → store-coordination-provider-RII4H3PJ.js.map} +0 -0
  378. /package/dist/{verify-KYICK5IW.js.map → verify-OMPYUO7C.js.map} +0 -0
  379. /package/dist/{walk-FV6JFWXV.js.map → walk-ZYC74R65.js.map} +0 -0
  380. /package/dist/{withdraw-accessible-JYX3SPVY.js.map → withdraw-accessible-MEFFAGRD.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-cargo/vault-diff.ts","../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 * Vault-level diff orchestrator.\n *\n * Compares a live `Vault`'s plaintext state against a candidate state\n * (another vault, a plain `{ collection: records[] }` map, or a vault\n * dump JSON) and returns a structured `VaultDiff` plan listing the\n * records that would be added, modified, or deleted to bring the live\n * vault into the candidate's shape.\n *\n * Builds on two existing record-level helpers:\n *\n * 1. `diff(a, b)` from `./history/diff.ts` — emits dot-pathed\n * `DiffEntry[]` with `type: 'added' | 'removed' | 'changed'` for\n * each changed field of two records. Used here for the\n * `fieldDiffs` of every `modified` entry, and (with empty result)\n * as the default deep-equal check.\n *\n * 2. `Vault.exportStream()` from `./vault.ts` — the canonical\n * decrypt-and-stream-records iterator. Used to walk both sides\n * when the candidate is itself a `Vault`. ACL-scoped: collections\n * the caller can't read silently drop out, the same way every\n * other plaintext-emitting export pipeline filters them.\n *\n * The new orchestration is the **vault-level** enumeration: bucket\n * each record id into added (only in candidate), deleted (only in\n * vault), or modified (in both with field changes); leave the\n * field-level granularity to the existing `diff()`.\n *\n * Use cases:\n *\n * - Import preview (`@noy-db/as-*` `fromString` returns a plan\n * whose body is a `VaultDiff`).\n * - Backup verification (\"does this `.noydb` bundle from yesterday\n * match the current vault?\").\n * - Two-vault reconciliation (\"what's different between Office A\n * and Office B before we sync?\").\n * - Test assertions (golden-file testing with one-liner\n * `expect(plan.summary).toEqual(...)`).\n *\n * @module\n */\n\nimport type { Vault } from '../kernel/vault.js'\nimport { diff as fieldDiff, type DiffEntry as FieldDiffEntry } from '../with-commit/history/diff.js'\n\n// ─── Public types ──────────────────────────────────────────────────────\n\n/** Per-record entry shape — added and deleted records carry only the record value. */\nexport interface VaultDiffEntry<T = unknown> {\n readonly collection: string\n readonly id: string\n readonly record: T\n /**\n * Unencrypted envelope metadata for the RECEIVER-side record.\n * Populated only when `diffVault` is called with `{includeMetadata: true}`.\n * Default: `undefined` (zero extra reads, no behavior change).\n *\n * Populated for `modified` (the CURRENT receiver state, before the candidate\n * is applied) and `deleted` (the receiver envelope of the record being\n * removed). `added` entries have no receiver envelope at diff time, so their\n * `metadata` is always absent.\n */\n readonly metadata?: {\n readonly version: number\n readonly timestamp: string\n readonly by?: string\n readonly source?: string\n readonly sourceTs?: string\n }\n}\n\n/** Modified records carry both halves of the diff plus the field-level breakdown. */\nexport interface VaultDiffModifiedEntry<T = unknown> extends VaultDiffEntry<T> {\n /** The record as it stands in the live vault. */\n readonly before: T\n /** Top-level keys whose values differ between `before` and `record`. */\n readonly fieldsChanged: readonly string[]\n /**\n * Field-level diff entries from `diff(before, record)`. Reuses the\n * existing per-record diff helper so consumers can render git-style\n * `path: from → to` rows without re-walking the records.\n */\n readonly fieldDiffs: readonly FieldDiffEntry[]\n}\n\nexport interface VaultDiff<T = unknown> {\n readonly added: readonly VaultDiffEntry<T>[]\n readonly modified: readonly VaultDiffModifiedEntry<T>[]\n readonly deleted: readonly VaultDiffEntry<T>[]\n /** Only populated when `options.includeUnchanged: true`. */\n readonly unchanged: readonly VaultDiffEntry<T>[] | undefined\n readonly summary: {\n readonly add: number\n readonly modify: number\n readonly delete: number\n readonly total: number\n }\n /**\n * Format the diff as a human-readable string.\n *\n * - `'count'` — one line, just the numbers (`12 added · 3 modified · 0 deleted`)\n * - `'one-line'` — count plus a single overview line\n * - `'full'` — count + one row per added/modified/deleted record (default)\n */\n format(opts?: { detail?: 'count' | 'one-line' | 'full' }): string\n}\n\nexport interface DiffOptions {\n /** Restrict the diff to a subset of collections. */\n readonly collections?: readonly string[]\n /** Field on each record that carries its id. Defaults to `'id'`. */\n readonly idKey?: string\n /** Override the default deep-equal check for \"modified vs unchanged\". */\n readonly compareFn?: (a: unknown, b: unknown) => boolean\n /** If true, include unchanged records in the diff (off by default to save memory). */\n readonly includeUnchanged?: boolean\n /**\n * When `true`, each entry in `added`, `modified`, and `deleted` will carry a\n * `metadata` field with the RECEIVER-side envelope metadata\n * (`version`, `timestamp`, `by?`, `source?`, `sourceTs?`).\n *\n * Off by default — no extra adapter reads, no behavior change for existing callers.\n */\n readonly includeMetadata?: boolean\n}\n\n/**\n * Candidate state to diff the vault against:\n *\n * - A `Vault` instance — both sides are walked via `exportStream()`.\n * - A `Record<collection, records[]>` map — same shape `as-json.toObject()`\n * produces. Useful for diffing parsed file content against the live vault.\n * - A `VaultDump` (output of `vault.dump()`) — a JSON string carrying the\n * full vault state. Parsed and reduced to the map shape above.\n */\nexport type DiffCandidate<T = unknown> =\n | Vault\n | Record<string, readonly T[]>\n | string\n\n// ─── Implementation ────────────────────────────────────────────────────\n\n/**\n * Compute the diff between a live vault and a candidate state.\n *\n * Ungated shared import/merge infrastructure: the `as-*` exporters call this\n * internally from their `fromString`/import merge logic, so it is always\n * available (not behind `withCargo()`). Only `extractPartition` is a gated\n * cargo capability.\n *\n * Returns a fully buffered `VaultDiff` — no streaming. Memory cost is\n * O(n + m) in the row count of vault + candidate. For documented\n * 1K-50K-record vaults this is fine; a streaming variant lands as a\n * follow-up if a > 100K-record consumer arrives.\n */\nexport async function diffVault<T = unknown>(\n vault: Vault,\n candidate: DiffCandidate<T>,\n options: DiffOptions = {},\n): Promise<VaultDiff<T>> {\n const idKey = options.idKey ?? 'id'\n const filter = options.collections ? new Set(options.collections) : null\n const compareFn =\n options.compareFn ?? ((a: unknown, b: unknown) => fieldDiff(a, b).length === 0)\n\n // Side A — walk the live vault via exportStream(). Each chunk arrives\n // already decrypted and ACL-scoped, so collections the caller can't\n // read silently drop out. exportStream's records are typed `unknown[]`\n // — diffVault is the type-erasure boundary; the caller asserts the\n // record shape via the function's `<T>` generic.\n const live = new Map<string, Map<string, T>>()\n for await (const chunk of vault.exportStream({ granularity: 'collection' })) {\n if (filter && !filter.has(chunk.collection)) continue\n const collection = live.get(chunk.collection) ?? new Map<string, T>()\n for (const record of chunk.records) {\n const id = readIdField(record, idKey)\n if (!id) continue\n collection.set(id, record as T)\n }\n live.set(chunk.collection, collection)\n }\n\n // Side B — normalise the candidate into the same shape.\n const cand = await normaliseCandidate<T>(candidate, idKey, filter)\n\n // Walk every (collection, id) on either side and bucket.\n const added: VaultDiffEntry<T>[] = []\n const modified: VaultDiffModifiedEntry<T>[] = []\n const deleted: VaultDiffEntry<T>[] = []\n const unchanged: VaultDiffEntry<T>[] | undefined = options.includeUnchanged ? [] : undefined\n\n const collectionNames = new Set([...live.keys(), ...cand.keys()])\n for (const collection of [...collectionNames].sort()) {\n const liveColl = live.get(collection) ?? new Map<string, T>()\n const candColl = cand.get(collection) ?? new Map<string, T>()\n const allIds = new Set([...liveColl.keys(), ...candColl.keys()])\n\n for (const id of [...allIds].sort()) {\n const before = liveColl.get(id)\n const after = candColl.get(id)\n\n if (before === undefined && after !== undefined) {\n // added: record only in candidate — no receiver envelope\n added.push({ collection, id, record: after })\n } else if (before !== undefined && after === undefined) {\n // deleted: record only in receiver — attach metadata if requested\n const metadata = options.includeMetadata\n ? (await vault.collection(collection).getMetadata(id)) ?? undefined\n : undefined\n deleted.push({ collection, id, record: before, ...(metadata !== undefined ? { metadata } : {}) })\n } else if (before !== undefined && after !== undefined) {\n if (compareFn(before, after)) {\n unchanged?.push({ collection, id, record: after })\n } else {\n // modified: record in both — attach receiver-side metadata if requested\n const metadata = options.includeMetadata\n ? (await vault.collection(collection).getMetadata(id)) ?? undefined\n : undefined\n const fieldDiffs = fieldDiff(before, after)\n const fieldsChanged = uniqueTopLevelKeys(fieldDiffs)\n modified.push({\n collection,\n id,\n record: after,\n before,\n fieldsChanged,\n fieldDiffs,\n ...(metadata !== undefined ? { metadata } : {}),\n })\n }\n }\n }\n }\n\n const summary = {\n add: added.length,\n modify: modified.length,\n delete: deleted.length,\n total: added.length + modified.length + deleted.length,\n }\n\n return {\n added,\n modified,\n deleted,\n unchanged,\n summary,\n format(opts) {\n return formatDiff(opts?.detail ?? 'full', { added, modified, deleted, summary })\n },\n }\n}\n\n// ─── Internals ─────────────────────────────────────────────────────────\n\nasync function normaliseCandidate<T>(\n candidate: DiffCandidate<T>,\n idKey: string,\n filter: Set<string> | null,\n): Promise<Map<string, Map<string, T>>> {\n const out = new Map<string, Map<string, T>>()\n\n // Vault instance — duck-type via the exportStream method (matches\n // vault.ts's structural shape without forcing a runtime instanceof check\n // that would import the class and risk circular deps).\n if (\n typeof candidate === 'object' &&\n candidate !== null &&\n 'exportStream' in candidate &&\n typeof (candidate as Vault).exportStream === 'function'\n ) {\n for await (const chunk of (candidate as Vault).exportStream({ granularity: 'collection' })) {\n if (filter && !filter.has(chunk.collection)) continue\n const collection = out.get(chunk.collection) ?? new Map<string, T>()\n for (const record of chunk.records) {\n const id = readIdField(record, idKey)\n if (!id) continue\n collection.set(id, record as T)\n }\n out.set(chunk.collection, collection)\n }\n return out\n }\n\n // String — assume a vault.dump() JSON string. Parse and reduce to the map shape.\n if (typeof candidate === 'string') {\n let parsed: unknown\n try {\n parsed = JSON.parse(candidate)\n } catch (err) {\n throw new Error(\n `diffVault: candidate string is not valid JSON (${(err as Error).message})`,\n )\n }\n return collectionsFromObject<T>(parsed, idKey, filter)\n }\n\n // Plain object — `Record<collection, records[]>` (same shape as-json.toObject() returns).\n return collectionsFromObject<T>(candidate, idKey, filter)\n}\n\nfunction collectionsFromObject<T>(\n raw: unknown,\n idKey: string,\n filter: Set<string> | null,\n): Map<string, Map<string, T>> {\n const out = new Map<string, Map<string, T>>()\n if (raw === null || typeof raw !== 'object') {\n throw new Error('diffVault: candidate must be a Vault, an object, or a JSON string')\n }\n // A vault dump JSON has a top-level shape like { _compartment, _keyring, <coll>: <records[]> }.\n // We accept both: keys starting with `_` are skipped (they're metadata), the rest are collections.\n for (const [key, value] of Object.entries(raw)) {\n if (key.startsWith('_')) continue\n if (filter && !filter.has(key)) continue\n if (!Array.isArray(value)) continue\n const collection = new Map<string, T>()\n for (const record of value as readonly T[]) {\n if (record === null || typeof record !== 'object') continue\n const id = readIdField(record, idKey)\n if (!id) continue\n collection.set(id, record)\n }\n out.set(key, collection)\n }\n return out\n}\n\nfunction uniqueTopLevelKeys(diffs: readonly FieldDiffEntry[]): readonly string[] {\n const keys = new Set<string>()\n for (const d of diffs) {\n // path is dot-separated; the top-level key is everything before the\n // first `.` or `[`. (`a.b.c` → `a`, `tags[0]` → `tags`, `(root)` → `(root)`).\n const m = /^[^.[]+/.exec(d.path)\n if (m) keys.add(m[0])\n }\n return [...keys]\n}\n\n/**\n * Pull the id field off a record without going through `String(obj)`,\n * which would emit `[object Object]` for nested objects and silently\n * collapse rows that share the same parent. Only string and number ids\n * are accepted; anything else returns the empty string and the record\n * is skipped at the call site.\n */\nfunction readIdField(record: unknown, idKey: string): string {\n if (record === null || typeof record !== 'object') return ''\n const v = (record as Record<string, unknown>)[idKey]\n if (typeof v === 'string') return v\n if (typeof v === 'number' && Number.isFinite(v)) return String(v)\n return ''\n}\n\ninterface FormatBuckets<T> {\n readonly added: readonly VaultDiffEntry<T>[]\n readonly modified: readonly VaultDiffModifiedEntry<T>[]\n readonly deleted: readonly VaultDiffEntry<T>[]\n readonly summary: VaultDiff<T>['summary']\n}\n\nfunction formatDiff<T>(\n detail: 'count' | 'one-line' | 'full',\n b: FormatBuckets<T>,\n): string {\n const head = `${b.summary.add} added · ${b.summary.modify} modified · ${b.summary.delete} deleted`\n if (detail === 'count') return head\n if (b.summary.total === 0) return head + '\\n(no changes)'\n if (detail === 'one-line') return head\n\n const rows: string[] = [head, '']\n for (const e of b.added) rows.push(`${e.collection}/${e.id}\\tadded`)\n for (const e of b.modified) {\n const fields = e.fieldDiffs\n .map((f) => `${f.path}: ${shortJSON(f.from)} → ${shortJSON(f.to)}`)\n .join(', ')\n rows.push(`${e.collection}/${e.id}\\tmodified\\t${fields}`)\n }\n for (const e of b.deleted) rows.push(`${e.collection}/${e.id}\\tdeleted`)\n return rows.join('\\n')\n}\n\nfunction shortJSON(value: unknown): string {\n if (value === undefined) return 'undefined'\n const s = JSON.stringify(value)\n // JSON.stringify returns string for any JSON value except `undefined`\n // (handled above), `function`, and `symbol`. Fall back to a static\n // tag for those — never let an arbitrary object hit the default\n // stringifier (which the lint rule explicitly bans).\n if (typeof s !== 'string') return '<unrepresentable>'\n return s.length > 60 ? s.slice(0, 57) + '...' : s\n}\n","/**\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 } from '../with-party/team/keyring.js'\nimport { resolveManagedSecret } from '../with-party/team/managed-secret.js'\nimport type { SealingKeyProvider } from '../with-party/team/managed-secret.js'\nimport type { ShamirRecoveryProvider } from '../with-party/team/shamir-recovery-provider.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 `SealingKeyProvider` (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: SealingKeyProvider\n readonly recovery: ReadonlyArray<RecoveryEnrollmentInput>\n readonly shamirRecovery: ShamirRecoveryProvider\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 `SealingKeyProvider` 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 const mergedFile: KeyringFile = { ...keyringFile, deks: mergedDeks }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2JA,eAAsB,UACpB,OACA,WACA,UAAuB,CAAC,GACD;AACvB,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,SAAS,QAAQ,cAAc,IAAI,IAAI,QAAQ,WAAW,IAAI;AACpE,QAAM,YACJ,QAAQ,cAAc,CAAC,GAAY,MAAe,KAAU,GAAG,CAAC,EAAE,WAAW;AAO/E,QAAM,OAAO,oBAAI,IAA4B;AAC7C,mBAAiB,SAAS,MAAM,aAAa,EAAE,aAAa,aAAa,CAAC,GAAG;AAC3E,QA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,aAAW,CAAC,YAAY,IAAI,KAAK,OAAO,QAAQ,OAAO,WAAW,GAAG;AACnE,UAAM,MAAM,KAAK,IAAI,UAAU;AAC/B,QAAI,QAAQ,OAAW;AACvB,UAAM,OAA0B,CAAC;AACjC,eAAW,CAAC,IAAI,GAAG,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC5C,YAAM,YAAY,MAAM,iBAAiB,EAAE,YAAY,GAAG,GAAG,KAAK,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 +0,0 @@
1
- {"version":3,"sources":["../src/with-formula/materialized-views/executor.ts"],"sourcesContent":["import type { Collection } from '../../kernel/collection.js'\nimport type { TxContext } from '../../with-commit/tx/transaction.js'\nimport type { EncryptedEnvelope } from '../../kernel/types.js'\nimport { MaterializedViewTooLargeError, MaterializedViewConfigError, LocaleNotSpecifiedError, JoinTooLargeError } from '../../kernel/errors.js'\nimport { DEFAULT_JOIN_MAX_ROWS } from '../../kernel/query/join.js'\nimport type { MaterializedFromMeta, MVQueryContext, MaterializedViewSpec } from './types.js'\nimport type { RegisteredMV } from './registry.js'\nimport { wrapDbWithPredicates } from './registry.js'\nimport { groupAndReduce } from '../../with-lookup/reduce/groupby.js'\nimport { canonicalGroupKey } from '../../with-lookup/reduce/canonical-key.js'\nimport { applyI18nLocale, type I18nTextDescriptor } from '../../via/i18n/core.js'\nimport { canonicalizeMoneyFieldsAsDecimal, decodeMoneyFields } from '../../via/money/normalize.js'\nimport { exactMath } from '../../via/money/exact.js'\nimport { putDerivedOutput, type PutDerivedOutputCtx } from '../../kernel/via/dispatch.js'\n\n/**\n * Accessor shape passed in from the owning Vault. Mirrors v1's\n * `DerivationStaleAccessor` — provides the per-collection resolver\n * and the active TxContext so refresh writes/tombstones register on\n * `_executed` for rollback symmetry.\n */\nexport interface MVExecutorAccessor {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getCollection(name: string): Collection<any>\n getActiveTxContext(): TxContext | null\n /**\n * Vault-shaped accessor passed to the MV's `query()` callback at\n * each refresh. Same instance the registry used at registration\n * time; threading through the executor lets the refresh path\n * re-evaluate the closure against the live vault state.\n */\n getQueryContext(): MVQueryContext\n /**\n * #638 Task 5 — ctx for `putDerivedOutput`'s frozen-period skip+audit. #641: the lazy\n * resolve-on-read caller (`stale.ts#resolveStaleMVOnRead`) now supplies one too — built at\n * the `Collection.get()`/`list()` entry point with a `'resolve-on-read'` sentinel id (no\n * real \"reacting write\" for a read-triggered materialize, mirroring `refreshView()`'s\n * `'refreshView'` sentinel). Still declared optional here since `MVExecutorAccessor` is a\n * general shape and a future caller could reasonably omit it.\n */\n dispatchCtx?: PutDerivedOutputCtx\n}\n\nexport interface RefreshResult {\n /** Rows newly written / overwritten. */\n written: number\n /** Rows tombstoned via `_internalDelete` (only when `onEmpty: 'delete'`). */\n deleted: number\n /** Failed row writes (non-strict mode). */\n failed: number\n /** #782/#785 — `outputCollection:id` entries from the tombstone pass whose ownership stamp\n * couldn't be decoded under the collection's default DEK (undecodable, mirroring\n * `invalidateMVAtRest`'s #776 posture) — ownership UNCONFIRMED. Only populated when\n * `onEmpty: 'delete'`. */\n residueUndecodable: string[]\n /** #782/#785 — `outputCollection:id` entries that decoded, stamp-matched this MV, but\n * `_internalDelete` declined (the #718 tier-elevation gate) — ownership CONFIRMED, a real\n * silent survival, surfaced rather than dropped. Only populated when `onEmpty: 'delete'`. */\n residueDeclined: string[]\n}\n\n/** Default cost ceiling — overridable per-MV via `spec.maxRows`. */\nconst DEFAULT_MAX_ROWS = 100_000\n\n/**\n * Materialize a query terminal that may be a `Query<T>` (call\n * `.toArray()`), an `Reduction<R>` (call `.run()` returning a\n * single object — wrap as a one-row array), or a `GroupedReduction<R>`\n * (call `.run()` returning an array of grouped rows). Branches on\n * available terminal at runtime — no type-discrimination at registration.\n */\nasync function materializeQueryResult(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n q: any,\n mvName: string,\n i18nLocale?: string,\n i18nFields?: Record<string, I18nTextDescriptor>,\n): Promise<ReadonlyArray<Record<string, unknown>>> {\n if (typeof q?.toArray === 'function') {\n // Query<T> — non-aggregate path. `.toArray()` returns Promise<T[]>.\n return await q.toArray()\n }\n if (typeof q?.run === 'function') {\n // Reduction<R> or GroupedReduction<R>. `.run()` is synchronous\n // and returns either a single object (Reduction) or an array of\n // rows (GroupedReduction). Promise.resolve() normalizes both\n // sync and async (future) variants.\n // Query-form MV grouping: when the MV declares i18nLocale, pass it +\n // i18nFields so a GroupedReduction resolves i18n group keys before\n // bucketing (the Reduction path ignores the extra arg).\n const runOpts = i18nLocale !== undefined ? { locale: i18nLocale, i18nFields } : undefined\n const result: unknown = await Promise.resolve(q.run(runOpts))\n if (Array.isArray(result)) {\n return result as ReadonlyArray<Record<string, unknown>>\n }\n // Single-aggregate result — wrap as one-row array. The consumer's\n // `rowKey()` should return a stable identity (often a literal\n // constant like `'total'`) since there's only one row.\n return [result as Record<string, unknown>]\n }\n throw new Error(\n `MV \"${mvName}\": query() must return a Query<T>, Reduction, or GroupedReduction. ` +\n `Got something without a .toArray() or .run() terminal.`,\n )\n}\n\n/**\n * Materialize a UNION-form MV: read every arm's source\n * collection, apply each arm's `map` to project rows into the unified\n * MV row shape, concatenate the mapped streams, then optionally run\n * `groupBy` + `aggregate` over the result.\n *\n * Modes (driven by `spec.groupBy` / `spec.aggregate`):\n *\n * - No `groupBy` → return the concatenated mapped rows unchanged.\n * - `groupBy` without `aggregate` → dedupe by composite group key,\n * keep the first row seen per key (later arms don't overwrite\n * earlier arms — Map insertion order rules).\n * - `groupBy` + `aggregate` → delegate to the shared `groupAndReduce`\n * pipeline used by `Query.groupBy().aggregate()`.\n *\n * Per-arm `map` is the schema-unification boundary; the strategy's\n * `TRow` type parameter enforces that every arm projects into the\n * same shape at compile time.\n *\n * @internal\n */\nasync function materializeUnionResult<TRow extends Record<string, unknown>>(\n spec: MaterializedViewSpec<TRow>,\n db: MVQueryContext,\n): Promise<ReadonlyArray<Record<string, unknown>>> {\n const unified: TRow[] = []\n for (const arm of spec.unionSources!) {\n const coll = db.collection<Record<string, unknown>>(arm.collection)\n // Optional per-arm FK joins: chain `.join(field, { as, ... })` for\n // each declared leg before terminating. The aliased right-side\n // record lands at `sourceRow[leg.as]`, where the arm's `map` reads\n // it. Cast to `any` because the chained join widens the row type but\n // the executor treats every row as `Record<string, unknown>` — same\n // pattern the query-form join path uses.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let q: any = coll.query()\n if (arm.join?.length) {\n for (const leg of arm.join) {\n q = q.join(leg.field, { as: leg.as, maxRows: leg.maxRows, strategy: leg.strategy })\n }\n }\n const sourceRows = q.toArray() as ReadonlyArray<Record<string, unknown>>\n for (const r of sourceRows) {\n const mapped = arm.map(r)\n // null / undefined means \"omit this source row\" — skip without\n // pushing so groupBy/aggregate never see a null entry.\n if (mapped == null) continue\n unified.push(mapped)\n }\n }\n\n return finalizeMappedRows(spec, unified)\n}\n\n/**\n * Shared post-map tail for the UNION and projection (#810) forms:\n * optional `groupBy` (+ `aggregate`) over the mapped-row stream.\n * Extracted verbatim from `materializeUnionResult` so both forms feed\n * the identical grouping pipeline — i18n group-key resolution, the\n * object-group-key guard, dedup-without-aggregate, and the shared\n * `groupAndReduce` delegate.\n *\n * @internal\n */\nfunction finalizeMappedRows<TRow extends Record<string, unknown>>(\n spec: MaterializedViewSpec<TRow>,\n unified: TRow[],\n): ReadonlyArray<Record<string, unknown>> {\n if (!spec.groupBy) return unified\n\n const groupFields: readonly string[] =\n typeof spec.groupBy === 'string' ? [spec.groupBy] : spec.groupBy\n\n // i18n-aware group keys. An `i18nText` group field carries a raw\n // `{ locale: string }` map, an unstable object key. When `i18nLocale` is\n // declared (with `i18nFields` describing those fields), resolve the declared\n // group-key i18n fields to it at the `mv` layer FIRST — the same unified-rows\n // boundary where money is threaded — so buckets are stable strings and the\n // `mv`-layer `onMissing` policy fires here.\n if (spec.i18nLocale !== undefined && spec.i18nFields !== undefined) {\n const groupI18n: Record<string, I18nTextDescriptor> = {}\n for (const f of groupFields) {\n const d = spec.i18nFields[f]\n if (d !== undefined) groupI18n[f] = d\n }\n if (Object.keys(groupI18n).length > 0) {\n for (let i = 0; i < unified.length; i++) {\n unified[i] = applyI18nLocale(unified[i] as Record<string, unknown>, groupI18n, spec.i18nLocale, undefined, 'mv') as TRow\n }\n }\n }\n // Guard (always): a remaining object-valued group key — an undeclared i18n\n // field or a locale-less MV — would bucket on a map. Refuse, don't bucket wrong.\n for (const f of groupFields) {\n for (const row of unified) {\n const v = (row as Record<string, unknown>)[f]\n if (v !== null && typeof v === 'object') {\n throw new LocaleNotSpecifiedError(\n f,\n `Materialized view \"${spec.name}\" groups by \"${f}\", whose value is a raw i18n locale map — ` +\n `an unstable object group key. Declare { i18nLocale, i18nFields } on the MV to resolve it at ` +\n `the 'mv' layer, or group by a dictKey/staticDict code (the stable key) and resolve the label at read time.`,\n )\n }\n }\n }\n\n // groupBy without aggregate — dedupe by composite key, keep first\n // seen row per key. Useful for cross-arm uniqueness (e.g. unify two\n // sibling collections, keeping one row per natural key).\n if (!spec.aggregate) {\n const seen = new Map<string, TRow>()\n for (const row of unified) {\n const k = canonicalGroupKey(groupFields, row as Record<string, unknown>)\n if (!seen.has(k)) seen.set(k, row)\n }\n return [...seen.values()]\n }\n\n // groupBy + aggregate — delegate to the shared pipeline used by\n // `Query.groupBy().aggregate()`. Result rows carry each grouped\n // field in declaration order followed by the spec's reducer outputs.\n return groupAndReduce<Record<string, unknown>>(unified, groupFields, spec.aggregate, spec.moneyFields)\n}\n\n/**\n * Apply the spec's `derive` to each finished row (#1007).\n *\n * Three rules, all of them about keeping the hook narrow enough that the\n * engine never has to reason about the function:\n *\n * - a `null` / `undefined` return leaves the row untouched;\n * - a returned key that collides with a `groupBy` field is refused — group\n * keys are the row's identity and feed `rowKey`, so letting `derive`\n * rewrite one would silently re-home the row into a different bucket than\n * the one it was aggregated for;\n * - a derived field declared in `moneyFields` is quantised through its\n * descriptor, so the stored value is exact at the declared scale instead of\n * whatever the user's arithmetic produced.\n *\n * @internal\n */\nfunction applyDerive<TRow extends Record<string, unknown>>(\n spec: MaterializedViewSpec<TRow>,\n rows: ReadonlyArray<Record<string, unknown>>,\n): ReadonlyArray<Record<string, unknown>> {\n const groupFields = new Set<string>(\n spec.groupBy === undefined ? [] : typeof spec.groupBy === 'string' ? [spec.groupBy] : spec.groupBy,\n )\n return rows.map((row) => {\n // `derive` sees the row the way a READER would: money decoded to its\n // canonical decimal form, not the scaled integer the reducer left behind.\n // Handing over `1005` where the schema says `10.05` would make every\n // derived money expression quietly wrong by a factor of the scale.\n // `'raw'` keeps it at the exact decimal rather than a locale-formatted\n // string, which is what `exact.*` consumes.\n const view = spec.moneyFields ? decodeMoneyFields(row, spec.moneyFields, 'raw') : row\n const patch = spec.derive!(view as TRow, exactMath)\n if (patch === null || patch === undefined) return row\n for (const key of Object.keys(patch)) {\n if (groupFields.has(key)) {\n throw new MaterializedViewConfigError(\n `Materialized view \"${spec.name}\": derive() returned the group key \"${key}\". ` +\n 'A group key is the row\\'s identity and feeds rowKey — rewriting it would re-home the ' +\n 'row into a bucket it was not aggregated for. Emit a differently-named field instead.',\n )\n }\n }\n // Canonicalize the PATCH only, into the DECIMAL form the money-aware\n // reducers emit — not the scaled-integer storage form a collection uses.\n // An MV row's money fields are decimal strings, so a derived field\n // quantised into storage form reads back as the scaled integer beside\n // correctly-decoded siblings: `\"1000000\"` next to `\"10000.00\"` (#1018).\n // Precision is still enforced; only the output shape differs.\n const canonical = spec.moneyFields\n ? canonicalizeMoneyFieldsAsDecimal(patch, spec.moneyFields)\n : patch\n return { ...row, ...canonical }\n })\n}\n\n/**\n * Materialize a projection-form MV (#810): hydrate the primary source\n * rows, resolve forward FK legs through the same `.join()` machinery\n * the UNION arms use, attach reverse \"collect\" legs via one\n * hash-grouped snapshot pass per leg, then run the projection `map`\n * (null / undefined omits the primary row) and the shared post-map\n * grouping tail.\n *\n * @internal\n */\nasync function materializeProjectionResult<TRow extends Record<string, unknown>>(\n spec: MaterializedViewSpec<TRow>,\n db: MVQueryContext,\n): Promise<ReadonlyArray<Record<string, unknown>>> {\n const projection = spec.projection!\n const coll = db.collection<Record<string, unknown>>(projection.source)\n // Forward legs chain through the query builder exactly like UNION arm\n // joins — ref() resolution, dangling-mode semantics, presentation\n // dressing, and ceilings all ride the existing `.join()` path. Cast to\n // `any` for the same reason `materializeUnionResult` does.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let q: any = coll.query()\n for (const leg of projection.joins) {\n if ('collect' in leg) continue\n q = q.join(leg.field, { as: leg.as, maxRows: leg.maxRows, strategy: leg.strategy })\n }\n let rows = q.toArray() as Array<Record<string, unknown>>\n for (const leg of projection.joins) {\n if (!('collect' in leg)) continue\n rows = applyCollectLeg(rows, leg, spec.name, projection.source, db)\n }\n const mapped: TRow[] = []\n for (const r of rows) {\n const m = projection.map(r)\n // null / undefined means \"omit this primary row\" — same contract\n // as the UNION arm `map`.\n if (m == null) continue\n mapped.push(m)\n }\n return finalizeMappedRows(spec, mapped)\n}\n\n/**\n * Attach one reverse \"collect\" leg (#810): every row of `leg.collect`\n * whose `leg.on` field references a primary record's id lands in a\n * possibly-empty ARRAY under `leg.as` on that primary row. One\n * snapshot pass over the collect collection, hash-grouped by the `on`\n * FK — O(N+M), mirroring the forward hash-join fallback.\n *\n * Semantic check (first materialization, not factory time — parity\n * with join-time ref errors): `leg.on` must carry a `ref()` declared\n * on the collect collection targeting the projection `source`.\n *\n * @internal\n */\nfunction applyCollectLeg(\n primaryRows: ReadonlyArray<Record<string, unknown>>,\n leg: { readonly collect: string; readonly on: string; readonly as: string; readonly maxRows?: number },\n mvName: string,\n source: string,\n db: MVQueryContext,\n): Array<Record<string, unknown>> {\n const childColl = db.collection<Record<string, unknown>>(leg.collect)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const childQ = childColl.query() as any\n const refDesc = childQ._joinContext?.()?.resolveRef(leg.on) as { target: string } | null | undefined\n if (refDesc == null) {\n throw new MaterializedViewConfigError(\n `\"${mvName}\": projection collect leg \"${leg.as}\" requires a ref() on field \"${leg.on}\" of `\n + `collection \"${leg.collect}\" targeting \"${source}\" — declare `\n + `refs: { ${leg.on}: ref('${source}') } on collection \"${leg.collect}\", then retry`,\n )\n }\n if (refDesc.target !== source) {\n throw new MaterializedViewConfigError(\n `\"${mvName}\": projection collect leg \"${leg.as}\" expects field \"${leg.on}\" of collection `\n + `\"${leg.collect}\" to reference the projection source \"${source}\", but its ref() targets `\n + `\"${refDesc.target}\"`,\n )\n }\n const maxRows = leg.maxRows ?? DEFAULT_JOIN_MAX_ROWS\n const groups = new Map<string, Array<Record<string, unknown>>>()\n for (const child of childQ.toArray() as Array<Record<string, unknown>>) {\n const key = coerceCollectKey(child[leg.on])\n // Nullish / non-scalar FK values mean \"no reference\" — same\n // narrowing as the forward join path's key coercion.\n if (key === null) continue\n const bucket = groups.get(key)\n if (bucket) bucket.push(child)\n else groups.set(key, [child])\n }\n const out: Array<Record<string, unknown>> = []\n for (const row of primaryRows) {\n const key = coerceCollectKey(row.id)\n const children = key === null ? [] : groups.get(key) ?? []\n if (children.length > maxRows) {\n throw new JoinTooLargeError({\n leftRows: primaryRows.length,\n rightRows: children.length,\n maxRows,\n side: 'right',\n message:\n `projection MV \"${mvName}\": collect leg \"${leg.as}\" gathered ${children.length} ` +\n `\"${leg.collect}\" rows for one \"${source}\" record, exceeding the ${maxRows}-row ` +\n `per-primary-row ceiling. Raise the ceiling via { maxRows } on the leg if the ` +\n `fan-out genuinely fits in memory, or restructure the child collection.`,\n })\n }\n out.push({ ...row, [leg.as]: children })\n }\n return out\n}\n\n/**\n * Coerce an unknown FK value into a collect-grouping key. Same\n * narrowing as the join path's `coerceRefKey` (not exported from\n * there): strings and numbers are legitimate ref values; anything\n * else is \"no reference\" and returns `null`.\n *\n * @internal\n */\nfunction coerceCollectKey(value: unknown): string | null {\n if (value === null || value === undefined) return null\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'bigint') return String(value)\n return null\n}\n\n/**\n * Run an MV's `query()` and write the result rows to the output\n * collection. Same-DEK encryption: routes through the standard\n * `Collection.put` pipeline, so the output collection's DEK is what\n * gets used (matches the v2 spec's \"same DEK as the left-most source\"\n * invariant — `Collection.put` looks up the DEK by collection name,\n * and the output collection IS the MV's owned collection).\n *\n * Stamps `_materializedFrom` onto every emitted row.\n *\n * **Tombstoning:** when `spec.onEmpty: 'delete'` (default), rows\n * that existed in a prior refresh but no longer appear in the new\n * materialized result are deleted via `Collection._internalDelete` —\n * the housekeeping bypass primitive prevents user\n * `onDelete` guards on the output collection from firing on these\n * system-internal deletes. `onEmpty: 'keep'` opts out (rows from\n * prior refreshes linger even when the new result lacks them).\n *\n * **Cost ceiling:** if the materialized row count exceeds\n * `spec.maxRows` (default 100k), throws `MaterializedViewTooLargeError`\n * before any writes hit the store — so strict-mode rollback is\n * clean.\n *\n * **Strict mode:** `spec.strict === true` re-throws on any\n * row-write failure; the active TxContext registration means the\n * source-write rolls back atomically via `revertExecuted`.\n *\n * @internal\n */\nexport const MaterializedViewExecutor = {\n async refresh(\n reg: RegisteredMV,\n accessor: MVExecutorAccessor,\n ): Promise<RefreshResult> {\n const spec = reg.spec\n const outputColl = accessor.getCollection(reg.outputCollection)\n const maxRows = spec.maxRows ?? DEFAULT_MAX_ROWS\n const onEmpty = spec.onEmpty ?? 'delete'\n const strict = spec.strict ?? false\n\n // 1. Materialize the query (branches on terminal shape). If the\n // MV declared predicates, wrap the query context the same way\n // the registry did at registration time so `.wherePredicate()`\n // calls resolve to the registered functions.\n const baseCtx = accessor.getQueryContext()\n const ctxForQuery: MVQueryContext = spec.predicates\n ? wrapDbWithPredicates(baseCtx, spec.predicates)\n : baseCtx\n // UNION-form strategies: read every arm, map to the unified\n // row shape, concatenate, then optionally groupBy + aggregate.\n // Projection-form strategies (#810): hydrate the primary source,\n // attach forward + collect legs, map, then the same optional\n // grouping tail. The single-source `query()` path is untouched.\n let rows: ReadonlyArray<Record<string, unknown>>\n if (spec.unionSources) {\n rows = await materializeUnionResult(spec, ctxForQuery)\n } else if (spec.projection) {\n rows = await materializeProjectionResult(spec, ctxForQuery)\n } else {\n const q = spec.query!(ctxForQuery)\n rows = await materializeQueryResult(q, spec.name, spec.i18nLocale, spec.i18nFields)\n }\n\n // #1007 — the post-aggregate projection. Applied here, after every form has\n // produced its finished rows, so union / projection / query all get the\n // same single definition of \"last step before materialisation\".\n if (spec.derive) rows = applyDerive(spec, rows)\n\n // #777 — exclude this MV's OWN previously-stamped output rows from the\n // input scan. A same-collection Query-form MV copies the whole source row\n // verbatim into its output, so a stale output row can itself satisfy the\n // MV's own input filter (when the filter is on a field disjoint from the\n // partition field) and get re-selected as if it were live source — the\n // row self-perpetuates after its true source is gone. Prior output is\n // never this MV's own source.\n rows = rows.filter((row) => {\n const stamp = row._materializedFrom as { mvName?: string } | undefined\n return stamp?.mvName !== spec.name\n })\n\n // 2. Cost ceiling check BEFORE any writes — keeps the rollback\n // clean if the source-write is wrapped in a transaction.\n if (rows.length > maxRows) {\n throw new MaterializedViewTooLargeError(spec.name, rows.length, maxRows)\n }\n\n const txCtx = accessor.getActiveTxContext()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const adapter = (outputColl as any).adapter as {\n get(v: string, c: string, i: string): Promise<EncryptedEnvelope | null>\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const vaultName = (outputColl as any).vault as string\n\n // 3. Compute the post-refresh id set so we can diff against the\n // prior-emitted id set for tombstoning (when onEmpty === 'delete').\n const newIds = new Set<string>()\n const enrichedRows: Array<{ id: string; record: Record<string, unknown> }> = []\n for (const row of rows) {\n const id = spec.rowKey(row)\n newIds.add(id)\n const meta: MaterializedFromMeta = {\n mvName: spec.name,\n queryHash: reg.queryHash,\n sourceVersions: {},\n materializedAt: new Date().toISOString(),\n }\n enrichedRows.push({ id, record: { ...row, _materializedFrom: meta } })\n }\n\n // 4. Write the new rows.\n let written = 0\n let failed = 0\n for (const { id, record } of enrichedRows) {\n try {\n if (txCtx !== null) {\n const prior = await adapter.get(vaultName, reg.outputCollection, id)\n txCtx._executed.push({\n op: { type: 'put', vaultName, collectionName: reg.outputCollection, id },\n priorEnvelope: prior,\n })\n }\n if (accessor.dispatchCtx) {\n if (await putDerivedOutput(outputColl, id, record, accessor.dispatchCtx) === 'written') written++\n } else {\n await outputColl.put(id, record)\n written++\n }\n } catch (err) {\n failed++\n if (strict) throw err\n \n console.warn(`[mv] \"${spec.name}\" row write failed:`, err)\n }\n }\n\n // 5. Tombstone rows that existed before but don't appear now.\n // `onEmpty: 'keep'` skips this pass entirely. Uses\n // `_internalDelete` so a user-registered `onDelete` on the\n // output collection does NOT fire on housekeeping (composition fix).\n let deleted = 0\n const residueUndecodable: string[] = []\n const residueDeclined: string[] = []\n if (onEmpty === 'delete') {\n const priorIds = await listOutputIds(outputColl)\n for (const priorId of priorIds) {\n if (newIds.has(priorId)) continue\n // #762 — a same-collection partition MV (`output: { collection: <source>, partition }`,\n // the DERIV-PP30-001 shape) writes INTO its own source collection, so `listOutputIds`\n // also returns untouched USER source rows here. Decode each candidate and only\n // tombstone rows THIS MV stamped via `_materializedFrom.mvName` — the exact discipline\n // `invalidateMVAtRest` uses (stale.ts:151-162). An unstamped row, or one stamped by a\n // different MV, is never this MV's to delete.\n const priorEnvelope = await adapter.get(vaultName, reg.outputCollection, priorId)\n if (priorEnvelope === null) continue\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const priorDecoded = await (outputColl as any)._decodeEnvelope(priorEnvelope, priorId)\n if (priorDecoded === null) {\n // #782 part a — ownership unknown (undecodable, e.g. elevated above tier 0 on a\n // tiered output collection): can't rule out this being THIS MV's own stamped row.\n // Surface it rather than silently skip (mirrors invalidateMVAtRest's #776 posture —\n // previously this leg had NO residue channel at all).\n residueUndecodable.push(`${reg.outputCollection}:${priorId}`)\n continue\n }\n const priorStampedBy =\n typeof priorDecoded === 'object'\n ? (priorDecoded as Record<string, unknown>)._materializedFrom as { mvName?: string } | undefined\n : undefined\n if (priorStampedBy?.mvName !== spec.name) continue\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const outAny = outputColl as any\n if (typeof outAny._internalDelete === 'function') {\n // #776 part b — gate on the boolean, matching invalidateMVAtRest's discipline\n // (stale.ts): `_internalDelete` returns `false` for a #718 elevated-skip (no\n // erasure happened), and that must not inflate the tombstone count.\n if (await outAny._internalDelete(priorId, txCtx)) {\n deleted++\n } else {\n // #782 part b — decoded AND stamp-owned, but erasure was declined (#718\n // tier-elevation gate). Ownership IS confirmed here — a real silent survival,\n // not a legit stamp-mismatch skip. Surface it too.\n residueDeclined.push(`${reg.outputCollection}:${priorId}`)\n }\n } else {\n // Defensive fallback — should never hit in real flow since\n // every Collection has `_internalDelete`.\n await outputColl.delete(priorId)\n deleted++\n }\n } catch (err) {\n failed++\n if (strict) throw err\n\n console.warn(`[mv] \"${spec.name}\" tombstone failed for id=\"${priorId}\":`, err)\n }\n }\n }\n\n return { written, deleted, failed, residueUndecodable, residueDeclined }\n },\n}\n\n/**\n * List ids currently present in the MV's output collection via the\n * adapter directly (avoids triggering the lazy resolve-on-read path\n * we're INSIDE). Returns an empty array if the collection doesn't\n * exist or the adapter doesn't surface a list method.\n *\n * @internal\n */\nasync function listOutputIds(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n outputColl: Collection<any>,\n): Promise<string[]> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const cAny = outputColl as any\n const adapter = cAny.adapter as { list?: (v: string, c: string) => Promise<readonly string[]> }\n const vault = cAny.vault as string\n const name = cAny.name as string\n if (typeof adapter?.list !== 'function') return []\n try {\n const ids = await adapter.list(vault, name)\n return [...ids]\n } catch {\n return []\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAM,mBAAmB;AASzB,eAAe,uBAEb,GACA,QACA,YACA,YACiD;AACjD,MAAI,OAAO,GAAG,YAAY,YAAY;AAEpC,WAAO,MAAM,EAAE,QAAQ;AAAA,EACzB;AACA,MAAI,OAAO,GAAG,QAAQ,YAAY;AAQhC,UAAM,UAAU,eAAe,SAAY,EAAE,QAAQ,YAAY,WAAW,IAAI;AAChF,UAAM,SAAkB,MAAM,QAAQ,QAAQ,EAAE,IAAI,OAAO,CAAC;AAC5D,QAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,aAAO;AAAA,IACT;AAIA,WAAO,CAAC,MAAiC;AAAA,EAC3C;AACA,QAAM,IAAI;AAAA,IACR,OAAO,MAAM;AAAA,EAEf;AACF;AAuBA,eAAe,uBACb,MACA,IACiD;AACjD,QAAM,UAAkB,CAAC;AACzB,aAAW,OAAO,KAAK,cAAe;AACpC,UAAM,OAAO,GAAG,WAAoC,IAAI,UAAU;AAQlE,QAAI,IAAS,KAAK,MAAM;AACxB,QAAI,IAAI,MAAM,QAAQ;AACpB,iBAAW,OAAO,IAAI,MAAM;AAC1B,YAAI,EAAE,KAAK,IAAI,OAAO,EAAE,IAAI,IAAI,IAAI,SAAS,IAAI,SAAS,UAAU,IAAI,SAAS,CAAC;AAAA,MACpF;AAAA,IACF;AACA,UAAM,aAAa,EAAE,QAAQ;AAC7B,eAAW,KAAK,YAAY;AAC1B,YAAM,SAAS,IAAI,IAAI,CAAC;AAGxB,UAAI,UAAU,KAAM;AACpB,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AAEA,SAAO,mBAAmB,MAAM,OAAO;A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ersistedIndexCallbacks,
3
- buildRetrievalDocs,
4
- embedOnWrite,
5
- flushIndex,
6
- hasIndexedBlobFields,
7
- rebuildEmbeddings,
8
- retrieve,
9
- search,
10
- similarTo,
11
- syncTierSearch,
12
- warmIndex
13
- } from "./chunk-ESXVNASI.js";
14
- import "./chunk-QK2QAMF7.js";
15
- import "./chunk-AURFOK3D.js";
16
- import "./chunk-QMJI5VHV.js";
17
- import "./chunk-2DFE4TUE.js";
18
- import "./chunk-CW3VJARJ.js";
19
- import "./chunk-7JOXCSDU.js";
20
- import "./chunk-47F6AI2K.js";
21
- import "./chunk-WUNRUSBJ.js";
22
- import "./chunk-DIVPOJPV.js";
23
- import "./chunk-PENPHA45.js";
24
- import "./chunk-IUQPNAGR.js";
25
- import "./chunk-AELW6OJZ.js";
26
- import "./chunk-DUUARUZI.js";
27
- import "./chunk-LP7BEXCT.js";
28
- import "./chunk-O5QXH7U7.js";
29
- import "./chunk-IGNJOJEP.js";
30
- import "./chunk-PKUJ3JLQ.js";
31
- import "./chunk-PZ5AY32C.js";
32
- export {
33
- buildPersistedIndexCallbacks,
34
- buildRetrievalDocs,
35
- embedOnWrite,
36
- flushIndex,
37
- hasIndexedBlobFields,
38
- rebuildEmbeddings,
39
- retrieve,
40
- search,
41
- similarTo,
42
- syncTierSearch,
43
- warmIndex
44
- };
45
- //# sourceMappingURL=collection-facade-3DN4ETEP.js.map
@@ -1,22 +0,0 @@
1
- import {
2
- derivePersistedSchema,
3
- isZod4Schema,
4
- isZodSchema
5
- } from "./chunk-BPLSGN4X.js";
6
- import "./chunk-Y2NBBT6K.js";
7
- import "./chunk-DIVPOJPV.js";
8
- import "./chunk-PENPHA45.js";
9
- import "./chunk-IUQPNAGR.js";
10
- import "./chunk-AELW6OJZ.js";
11
- import "./chunk-DUUARUZI.js";
12
- import "./chunk-LP7BEXCT.js";
13
- import "./chunk-O5QXH7U7.js";
14
- import "./chunk-IGNJOJEP.js";
15
- import "./chunk-PKUJ3JLQ.js";
16
- import "./chunk-PZ5AY32C.js";
17
- export {
18
- derivePersistedSchema,
19
- isZod4Schema,
20
- isZodSchema
21
- };
22
- //# sourceMappingURL=derive-BSAF6N5X.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-formula/materialized-views/dispatch.ts"],"sourcesContent":["/**\n * Materialized-view dispatch, lifted out of the kernel spine (#842 part b).\n *\n * Reached from `Collection` by dynamic `import()` only — `port-layering`\n * forbids a static spine→`with-*` import, and rejects a type-only one too\n * (it scans import statements, not their erasure). See\n * `with-formula/derivations/dispatch.ts` for the same note.\n *\n * The `Collection` reference below is TYPE-ONLY and points inward\n * (service → kernel), so it is both allowed and erased at build.\n *\n * @internal\n */\n\nimport type { TxContext } from '../../with-commit/tx/transaction.js'\nimport type { Collection } from '../../kernel/collection.js'\nimport type { ledgerAuditHook, WaveContext } from '../../kernel/via/dispatch.js'\nimport type { MaterializedViewExecutor } from './executor.js'\nimport type * as MVStale from './stale.js'\nimport type { MaterializedViewRegistry } from './registry.js'\nimport type { MVQueryContext } from './types.js'\n\n/** The per-write dispatch context the MV executor threads through. */\ninterface DispatchCtx {\n emit: (e: string, p: unknown) => void\n source: { readonly collection: string; readonly id: string }\n audit: ReturnType<typeof ledgerAuditHook>\n}\n\n/** What the MV dispatchers need from the collection that owns them. */\nexport interface MvDispatchCtx {\n readonly materializedViewSource: {\n registry(): MaterializedViewRegistry\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getCollection(name: string): Collection<any>\n getActiveTxContext(): TxContext | null\n getQueryContext(): MVQueryContext\n }\n /** The collection the delete happened in. */\n readonly collectionName: string\n /** Builds the per-write dispatch context the executor threads through. */\n readonly dispatchCtx: (source: { readonly collection: string; readonly id: string }) => DispatchCtx\n}\n\n/**\n * Fire every MV whose dependency set includes this collection, on write.\n *\n * Skips entirely when the record being written is itself an MV-emitted row\n * (it carries `_materializedFrom`) — a defensive guard against missed cycle\n * detection.\n *\n * @param wave #638 Task 4 — the sync/cutover/restore dispatch wave. An eager\n * MV already refreshed in this wave is skipped, deduped per target on the\n * spec name.\n */\nexport async function dispatchMaterializedViews(\n ctx: MvDispatchCtx,\n id: string,\n record: Record<string, unknown>,\n wave?: WaveContext,\n): Promise<void> {\n const { materializedViewSource: source, collectionName, dispatchCtx } = ctx\n\n if (record && typeof record === 'object' && '_materializedFrom' in record) return\n\n const registry = source.registry()\n const mvs = registry.mvsForSource(collectionName)\n if (mvs.length === 0) return\n\n let executor: typeof MaterializedViewExecutor | null = null\n let staleHelpers: typeof MVStale | null = null\n\n for (const reg of mvs) {\n const mode = reg.spec.refresh\n\n if (mode === 'eager') {\n if (wave?.seen(`mv\\0${reg.spec.name}`)) continue\n if (executor === null) {\n ;({ MaterializedViewExecutor: executor } = await import('./executor.js'))\n }\n await executor.refresh(reg, {\n getCollection: (name) => source.getCollection(name),\n getActiveTxContext: () => source.getActiveTxContext(),\n getQueryContext: () => source.getQueryContext(),\n dispatchCtx: dispatchCtx({ collection: collectionName, id }),\n })\n } else if (mode === 'lazy') {\n if (staleHelpers === null) staleHelpers = await import('./stale.js')\n staleHelpers.markMVStale(registry, reg.spec.name)\n }\n // manual: no-op on source-write. `vault.refreshView(name)` is the only\n // path that materializes a manual MV.\n }\n}\n\n/**\n * Mirror of {@link dispatchMaterializedViews} for the delete/forget path. There is\n * no `_materializedFrom` skip — the record is gone — and the `internal` gate\n * at `_doDelete` is the recursion guard.\n *\n * @returns rows TOMBSTONED across every MV sourced here (#638 T6). Eager and\n * lazy/manual `invalidateMVAtRest` purges both contribute (#761 item 1,\n * previously eager-only): lazy persists a stale mark for cold-session\n * recompute, manual serves empty until `refreshView()`.\n * `residueUndecodable` / `residueDeclined` (#776/#785) carry\n * `outputCollection:id` entries whose ownership stamp `invalidateMVAtRest`\n * could not decode, respectively decoded and stamp-matched but declined to\n * erase — surfaced, not erased.\n */\nexport async function dispatchMaterializedViewsOnDelete(\n ctx: MvDispatchCtx,\n id: string,\n): Promise<{ deleted: number; residueUndecodable: string[]; residueDeclined: string[] }> {\n const { materializedViewSource: source, collectionName, dispatchCtx } = ctx\n\n const mvs = source.registry().mvsForSource(collectionName)\n const empty = { deleted: 0, residueUndecodable: [], residueDeclined: [] }\n if (mvs.length === 0) return empty\n\n let executor: typeof MaterializedViewExecutor | null = null\n let staleHelpers: typeof MVStale | null = null\n\n let deleted = 0\n const residueUndecodable: string[] = []\n const residueDeclined: string[] = []\n\n for (const reg of mvs) {\n const mode = reg.spec.refresh\n\n if (mode === 'eager') {\n if (executor === null) {\n ;({ MaterializedViewExecutor: executor } = await import('./executor.js'))\n }\n const rr = await executor.refresh(reg, {\n getCollection: (name) => source.getCollection(name),\n getActiveTxContext: () => source.getActiveTxContext(),\n getQueryContext: () => source.getQueryContext(),\n dispatchCtx: dispatchCtx({ collection: collectionName, id }),\n })\n // #782/#785 — the eager leg reports both residue channels.\n deleted += rr.deleted\n residueUndecodable.push(...rr.residueUndecodable)\n residueDeclined.push(...rr.residueDeclined)\n continue\n }\n\n if (staleHelpers === null) staleHelpers = await import('./stale.js')\n const inv = await staleHelpers.invalidateMVAtRest(source, reg, mode)\n deleted += inv.deleted\n residueUndecodable.push(...inv.residueUndecodable.map((rid) => `${reg.outputCollection}:${rid}`))\n residueDeclined.push(...inv.residueDeclined.map((rid) => `${reg.outputCollection}:${rid}`))\n }\n\n return { deleted, residueUndecodable, residueDeclined }\n}\n"],"mappings":";;;AAuDA,eAAsB,0BACpB,KACA,IACA,QACA,MACe;AACf,QAAM,EAAE,wBAAwB,QAAQ,gBAAgB,YAAY,IAAI;AAExE,MAAI,UAAU,OAAO,WAAW,YAAY,uBAAuB,OAAQ;AAE3E,QAAM,WAAW,OAAO,SAAS;AACjC,QAAM,MAAM,SAAS,aAAa,cAAc;AAChD,MAAI,IAAI,WAAW,EAAG;AAEtB,MAAI,WAAmD;AACvD,MAAI,eAAsC;AAE1C,aAAW,OAAO,KAAK;AACrB,UAAM,OAAO,IAAI,KAAK;AAEtB,QAAI,SAAS,SAAS;AACpB,UAAI,MAA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AAM,OAAO,gBAAgB;AAAA,QAC9C,aAAa,YAAY,EAAE,YAAY,gBAAgB,GAAG,CAAC;AAAA,MAC7D,CAAC;AAED,iBAAW,GAAG;AACd,yBAAmB,KAAK,GAAG,GAAG,kBAAkB;AAChD,sBAAgB,KAAK,GAAG,GAAG,eAAe;AAC1C;AAAA,IACF;AAEA,QAAI,iBAAiB,KAAM,gBAAe,MAAM,OAAO,qBAAY;AACnE,UAAM,MAAM,MAAM,aAAa,mBAAmB,QAAQ,KAAK,IAAI;AACnE,eAAW,IAAI;AACf,uBAAmB,KAAK,GAAG,IAAI,mBAAmB,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,IAAI,GAAG,EAAE,CAAC;AAChG,oBAAgB,KAAK,GAAG,IAAI,gBAAgB,IAAI,CAAC,QAAQ,GAAG,IAAI,gBAAgB,IAAI,GAAG,EAAE,CAAC;AAAA,EAC5F;AAEA,SAAO,EAAE,SAAS,oBAAoB,gBAAgB;AACxD;","names":[]}
@@ -1,9 +0,0 @@
1
- import {
2
- GuardExecutor
3
- } from "./chunk-YF3CIA6E.js";
4
- import "./chunk-PKUJ3JLQ.js";
5
- import "./chunk-PZ5AY32C.js";
6
- export {
7
- GuardExecutor
8
- };
9
- //# sourceMappingURL=executor-6YQYFGHK.js.map
@@ -1,9 +0,0 @@
1
- import {
2
- DerivationExecutor
3
- } from "./chunk-VYLC5KAT.js";
4
- import "./chunk-PKUJ3JLQ.js";
5
- import "./chunk-PZ5AY32C.js";
6
- export {
7
- DerivationExecutor
8
- };
9
- //# sourceMappingURL=executor-GLKPMISJ.js.map
@@ -1,29 +0,0 @@
1
- import {
2
- MaterializedViewExecutor
3
- } from "./chunk-XZZIZ544.js";
4
- import "./chunk-A66LJYFG.js";
5
- import "./chunk-23XKHFNT.js";
6
- import "./chunk-H6K24KLL.js";
7
- import "./chunk-XPTYXXMD.js";
8
- import "./chunk-PWK3SSNB.js";
9
- import "./chunk-XZHEOSQ2.js";
10
- import "./chunk-ATL3ZVXT.js";
11
- import "./chunk-NSITFOCJ.js";
12
- import "./chunk-2DFE4TUE.js";
13
- import "./chunk-CW3VJARJ.js";
14
- import "./chunk-7JOXCSDU.js";
15
- import "./chunk-47F6AI2K.js";
16
- import "./chunk-DIVPOJPV.js";
17
- import "./chunk-PENPHA45.js";
18
- import "./chunk-IUQPNAGR.js";
19
- import "./chunk-AELW6OJZ.js";
20
- import "./chunk-DUUARUZI.js";
21
- import "./chunk-LP7BEXCT.js";
22
- import "./chunk-O5QXH7U7.js";
23
- import "./chunk-IGNJOJEP.js";
24
- import "./chunk-PKUJ3JLQ.js";
25
- import "./chunk-PZ5AY32C.js";
26
- export {
27
- MaterializedViewExecutor
28
- };
29
- //# sourceMappingURL=executor-ZEIX7Y7I.js.map
@@ -1,23 +0,0 @@
1
- import {
2
- buildAccessibleBundle,
3
- exportAccessibleData,
4
- resolveAccessibleCollections
5
- } from "./chunk-BXHG26KN.js";
6
- import "./chunk-2VMCJUK6.js";
7
- import "./chunk-HRSEAGLI.js";
8
- import "./chunk-DIVPOJPV.js";
9
- import "./chunk-PENPHA45.js";
10
- import "./chunk-IUQPNAGR.js";
11
- import "./chunk-AELW6OJZ.js";
12
- import "./chunk-DUUARUZI.js";
13
- import "./chunk-LP7BEXCT.js";
14
- import "./chunk-O5QXH7U7.js";
15
- import "./chunk-IGNJOJEP.js";
16
- import "./chunk-PKUJ3JLQ.js";
17
- import "./chunk-PZ5AY32C.js";
18
- export {
19
- buildAccessibleBundle,
20
- exportAccessibleData,
21
- resolveAccessibleCollections
22
- };
23
- //# sourceMappingURL=export-accessible-SDIQEFHQ.js.map
@@ -1,38 +0,0 @@
1
- import {
2
- extractPartition,
3
- extractPartitionCore,
4
- reKeyBlobs,
5
- reKeyClosure,
6
- reKeyLedger,
7
- reKeySchemas,
8
- sealDeks
9
- } from "./chunk-M7VSXBUL.js";
10
- import "./chunk-JPVJTTHU.js";
11
- import "./chunk-2VMCJUK6.js";
12
- import "./chunk-HRSEAGLI.js";
13
- import "./chunk-PNXJV4OS.js";
14
- import "./chunk-OCW3IM2F.js";
15
- import "./chunk-4AOERLTV.js";
16
- import "./chunk-I7FD46FF.js";
17
- import "./chunk-47F6AI2K.js";
18
- import "./chunk-WUNRUSBJ.js";
19
- import "./chunk-DIVPOJPV.js";
20
- import "./chunk-PENPHA45.js";
21
- import "./chunk-IUQPNAGR.js";
22
- import "./chunk-AELW6OJZ.js";
23
- import "./chunk-DUUARUZI.js";
24
- import "./chunk-LP7BEXCT.js";
25
- import "./chunk-O5QXH7U7.js";
26
- import "./chunk-IGNJOJEP.js";
27
- import "./chunk-PKUJ3JLQ.js";
28
- import "./chunk-PZ5AY32C.js";
29
- export {
30
- extractPartition,
31
- extractPartitionCore,
32
- reKeyBlobs,
33
- reKeyClosure,
34
- reKeyLedger,
35
- reKeySchemas,
36
- sealDeks
37
- };
38
- //# sourceMappingURL=extract-partition-K232SO2V.js.map
@@ -1,11 +0,0 @@
1
- import {
2
- computeBidxTarget
3
- } from "./chunk-DUUARUZI.js";
4
- import "./chunk-LP7BEXCT.js";
5
- import "./chunk-O5QXH7U7.js";
6
- import "./chunk-PKUJ3JLQ.js";
7
- import "./chunk-PZ5AY32C.js";
8
- export {
9
- computeBidxTarget
10
- };
11
- //# sourceMappingURL=find-GKFC5753.js.map
@@ -1,19 +0,0 @@
1
- import {
2
- issueAttestationCore
3
- } from "./chunk-OZ5QBLEL.js";
4
- import "./chunk-GWJJ5CK3.js";
5
- import "./chunk-4AOERLTV.js";
6
- import "./chunk-DIVPOJPV.js";
7
- import "./chunk-PENPHA45.js";
8
- import "./chunk-IUQPNAGR.js";
9
- import "./chunk-AELW6OJZ.js";
10
- import "./chunk-DUUARUZI.js";
11
- import "./chunk-LP7BEXCT.js";
12
- import "./chunk-O5QXH7U7.js";
13
- import "./chunk-IGNJOJEP.js";
14
- import "./chunk-PKUJ3JLQ.js";
15
- import "./chunk-PZ5AY32C.js";
16
- export {
17
- issueAttestationCore
18
- };
19
- //# sourceMappingURL=issue-QTQYQJCB.js.map
@@ -1,24 +0,0 @@
1
- import {
2
- liberateVault
3
- } from "./chunk-L3AM6EGU.js";
4
- import "./chunk-RJYPFCID.js";
5
- import "./chunk-BXHG26KN.js";
6
- import "./chunk-OTHHO3KI.js";
7
- import "./chunk-2VMCJUK6.js";
8
- import "./chunk-HRSEAGLI.js";
9
- import "./chunk-FFESJQ5A.js";
10
- import "./chunk-KMGAFLCK.js";
11
- import "./chunk-DIVPOJPV.js";
12
- import "./chunk-PENPHA45.js";
13
- import "./chunk-IUQPNAGR.js";
14
- import "./chunk-AELW6OJZ.js";
15
- import "./chunk-DUUARUZI.js";
16
- import "./chunk-LP7BEXCT.js";
17
- import "./chunk-O5QXH7U7.js";
18
- import "./chunk-IGNJOJEP.js";
19
- import "./chunk-PKUJ3JLQ.js";
20
- import "./chunk-PZ5AY32C.js";
21
- export {
22
- liberateVault
23
- };
24
- //# sourceMappingURL=liberate-FOK7RFYQ.js.map
@@ -1,84 +0,0 @@
1
- import {
2
- Noydb,
3
- createNoydb
4
- } from "./chunk-HUEG3YP4.js";
5
- import "./chunk-VKYEEJJ2.js";
6
- import "./chunk-TKLQWOTY.js";
7
- import "./chunk-YOMI3ZCA.js";
8
- import "./chunk-EPFF7LOX.js";
9
- import "./chunk-ESXVNASI.js";
10
- import "./chunk-GYGLAVCX.js";
11
- import "./chunk-FFSQFH6D.js";
12
- import "./chunk-KHKKD62N.js";
13
- import "./chunk-BPLSGN4X.js";
14
- import "./chunk-6LJY7X5A.js";
15
- import "./chunk-Y2NBBT6K.js";
16
- import "./chunk-NB2CKJ27.js";
17
- import "./chunk-IPA6ODWG.js";
18
- import "./chunk-SRR22EW2.js";
19
- import "./chunk-BFNBYT62.js";
20
- import "./chunk-ZAZW5LLF.js";
21
- import "./chunk-OTHHO3KI.js";
22
- import "./chunk-JPVJTTHU.js";
23
- import "./chunk-DIYI32MG.js";
24
- import "./chunk-HZIIDYJV.js";
25
- import "./chunk-REKDM67V.js";
26
- import "./chunk-H6K24KLL.js";
27
- import "./chunk-ANYVM4SX.js";
28
- import "./chunk-T7IR4N2S.js";
29
- import "./chunk-PEOZ34EM.js";
30
- import "./chunk-FKZI4NSG.js";
31
- import "./chunk-GHVIKOHT.js";
32
- import "./chunk-NCAMIRFB.js";
33
- import "./chunk-SMY5X46Z.js";
34
- import "./chunk-DZFQVICS.js";
35
- import "./chunk-FGZ7GJXO.js";
36
- import "./chunk-5D2ALSM5.js";
37
- import "./chunk-QK2QAMF7.js";
38
- import "./chunk-AURFOK3D.js";
39
- import "./chunk-A5YEUQOY.js";
40
- import "./chunk-JSTQGUE5.js";
41
- import "./chunk-XPTYXXMD.js";
42
- import "./chunk-OBPL43F3.js";
43
- import "./chunk-3TWEXEKX.js";
44
- import "./chunk-I3ISCYT7.js";
45
- import "./chunk-NO272T7Q.js";
46
- import "./chunk-XZHEOSQ2.js";
47
- import "./chunk-YMUFFJCO.js";
48
- import "./chunk-ATL3ZVXT.js";
49
- import "./chunk-NSITFOCJ.js";
50
- import "./chunk-PVEWA2DU.js";
51
- import "./chunk-QMJI5VHV.js";
52
- import "./chunk-2DFE4TUE.js";
53
- import "./chunk-CW3VJARJ.js";
54
- import "./chunk-7JOXCSDU.js";
55
- import "./chunk-F5IFR56V.js";
56
- import "./chunk-3ENNPCIW.js";
57
- import "./chunk-FFESJQ5A.js";
58
- import "./chunk-KMGAFLCK.js";
59
- import "./chunk-OCW3IM2F.js";
60
- import "./chunk-LLLSK7UQ.js";
61
- import "./chunk-VKQCVU2Z.js";
62
- import "./chunk-4AOERLTV.js";
63
- import "./chunk-AGETRKC5.js";
64
- import "./chunk-H27DIXOV.js";
65
- import "./chunk-I7FD46FF.js";
66
- import "./chunk-47F6AI2K.js";
67
- import "./chunk-WUNRUSBJ.js";
68
- import "./chunk-HK67PX4J.js";
69
- import "./chunk-FUIG7QSS.js";
70
- import "./chunk-DIVPOJPV.js";
71
- import "./chunk-PENPHA45.js";
72
- import "./chunk-IUQPNAGR.js";
73
- import "./chunk-AELW6OJZ.js";
74
- import "./chunk-DUUARUZI.js";
75
- import "./chunk-LP7BEXCT.js";
76
- import "./chunk-O5QXH7U7.js";
77
- import "./chunk-IGNJOJEP.js";
78
- import "./chunk-PKUJ3JLQ.js";
79
- import "./chunk-PZ5AY32C.js";
80
- export {
81
- Noydb,
82
- createNoydb
83
- };
84
- //# sourceMappingURL=noydb-3BBLBSHI.js.map
@@ -1,32 +0,0 @@
1
- import {
2
- persistClassifiedMarker,
3
- persistSatelliteMarker,
4
- persistSchemaIfNeeded
5
- } from "./chunk-NHXIFF4Y.js";
6
- import "./chunk-ZVF37PKE.js";
7
- import "./chunk-OIW75CLW.js";
8
- import "./chunk-EPFF7LOX.js";
9
- import "./chunk-FFSQFH6D.js";
10
- import "./chunk-BPLSGN4X.js";
11
- import "./chunk-Y2NBBT6K.js";
12
- import "./chunk-JPVJTTHU.js";
13
- import "./chunk-GHVIKOHT.js";
14
- import "./chunk-H27DIXOV.js";
15
- import "./chunk-I7FD46FF.js";
16
- import "./chunk-47F6AI2K.js";
17
- import "./chunk-DIVPOJPV.js";
18
- import "./chunk-PENPHA45.js";
19
- import "./chunk-IUQPNAGR.js";
20
- import "./chunk-AELW6OJZ.js";
21
- import "./chunk-DUUARUZI.js";
22
- import "./chunk-LP7BEXCT.js";
23
- import "./chunk-O5QXH7U7.js";
24
- import "./chunk-IGNJOJEP.js";
25
- import "./chunk-PKUJ3JLQ.js";
26
- import "./chunk-PZ5AY32C.js";
27
- export {
28
- persistClassifiedMarker,
29
- persistSatelliteMarker,
30
- persistSchemaIfNeeded
31
- };
32
- //# sourceMappingURL=register-FVUE46K4.js.map
@@ -1,19 +0,0 @@
1
- import {
2
- MaterializedViewRegistry,
3
- wrapDbWithPredicates
4
- } from "./chunk-A66LJYFG.js";
5
- import "./chunk-DIVPOJPV.js";
6
- import "./chunk-PENPHA45.js";
7
- import "./chunk-IUQPNAGR.js";
8
- import "./chunk-AELW6OJZ.js";
9
- import "./chunk-DUUARUZI.js";
10
- import "./chunk-LP7BEXCT.js";
11
- import "./chunk-O5QXH7U7.js";
12
- import "./chunk-IGNJOJEP.js";
13
- import "./chunk-PKUJ3JLQ.js";
14
- import "./chunk-PZ5AY32C.js";
15
- export {
16
- MaterializedViewRegistry,
17
- wrapDbWithPredicates
18
- };
19
- //# sourceMappingURL=registry-7PBVHSD5.js.map