@noy-db/hub 0.4.0-pre.5 → 0.4.0-pre.7

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 (534) hide show
  1. package/dist/api-3NKVNZPM.js +20 -0
  2. package/dist/attestation/index.js +20 -20
  3. package/dist/{backup-YCHAC575.js → backup-PTSVXDDW.js} +13 -13
  4. package/dist/blobs/index.js +15 -12
  5. package/dist/blobs/index.js.map +1 -1
  6. package/dist/broker/index.js +12 -12
  7. package/dist/cargo/index.js +36 -36
  8. package/dist/{chunk-5WLDZZ6S.js → chunk-35NMVJ7I.js} +3 -3
  9. package/dist/{chunk-TNATF3HB.js → chunk-3HUYRN24.js} +4 -4
  10. package/dist/chunk-3HUYRN24.js.map +1 -0
  11. package/dist/{chunk-TNJVDG2B.js → chunk-3XKESW5E.js} +3 -3
  12. package/dist/{chunk-MUPZ6IZX.js → chunk-4JQK3L4V.js} +2 -2
  13. package/dist/{chunk-Z4D3YGAB.js → chunk-4ZKNC6A6.js} +2 -2
  14. package/dist/{chunk-ONB627HU.js → chunk-55LX6FSX.js} +2 -2
  15. package/dist/{chunk-QMZ5A6FQ.js → chunk-56IIVAEO.js} +2 -2
  16. package/dist/chunk-5D2ALSM5.js +19 -0
  17. package/dist/chunk-5D2ALSM5.js.map +1 -0
  18. package/dist/{chunk-FHHYCBBP.js → chunk-5DRROK5W.js} +2 -2
  19. package/dist/{chunk-GTNRMJYH.js → chunk-5GQEU4DN.js} +2 -2
  20. package/dist/{chunk-YQQPNXNO.js → chunk-6L3DKWRY.js} +6 -6
  21. package/dist/chunk-6LJY7X5A.js +18 -0
  22. package/dist/chunk-6LJY7X5A.js.map +1 -0
  23. package/dist/{chunk-M6QA2KK2.js → chunk-6M2I3DKF.js} +2 -2
  24. package/dist/{chunk-FTCGEUOY.js → chunk-6R6Q3MRN.js} +7 -7
  25. package/dist/{chunk-ZUDAK436.js → chunk-6UBZ6I5Z.js} +2 -2
  26. package/dist/{chunk-SEU6QHH4.js → chunk-6ZNSB3H6.js} +5 -17
  27. package/dist/chunk-6ZNSB3H6.js.map +1 -0
  28. package/dist/chunk-AFHQATY4.js +47 -0
  29. package/dist/chunk-AFHQATY4.js.map +1 -0
  30. package/dist/{chunk-7U6AB7DZ.js → chunk-AKKRXT23.js} +2 -2
  31. package/dist/{chunk-2PDBYF2O.js → chunk-AT2JJEKJ.js} +4 -4
  32. package/dist/chunk-AT2JJEKJ.js.map +1 -0
  33. package/dist/{chunk-OWLZONGX.js → chunk-BLBAQRBM.js} +2 -2
  34. package/dist/{chunk-QBOQI6PG.js → chunk-BN4HRYAZ.js} +2 -2
  35. package/dist/{chunk-QVGEVZ5F.js → chunk-BQ6DHN4I.js} +3 -3
  36. package/dist/{chunk-GP54LU5N.js → chunk-BYFXLDVV.js} +9 -9
  37. package/dist/{chunk-FIP7KI2P.js → chunk-C25JXSOR.js} +337 -21
  38. package/dist/chunk-C25JXSOR.js.map +1 -0
  39. package/dist/chunk-CADUYBQD.js +151 -0
  40. package/dist/chunk-CADUYBQD.js.map +1 -0
  41. package/dist/{chunk-HAPY7WFP.js → chunk-CCDP6EPB.js} +13 -355
  42. package/dist/chunk-CCDP6EPB.js.map +1 -0
  43. package/dist/{chunk-QRHEAZ2Q.js → chunk-CUZLNGD5.js} +1 -1
  44. package/dist/{chunk-YXIVUWDU.js → chunk-DGBIHDVK.js} +5 -5
  45. package/dist/chunk-DSDXAKIP.js +50 -0
  46. package/dist/chunk-DSDXAKIP.js.map +1 -0
  47. package/dist/{chunk-QZJEYZ4I.js → chunk-DZAF24PG.js} +5 -5
  48. package/dist/chunk-DZFQVICS.js +23 -0
  49. package/dist/chunk-DZFQVICS.js.map +1 -0
  50. package/dist/chunk-E23UGFVC.js +63 -0
  51. package/dist/chunk-E23UGFVC.js.map +1 -0
  52. package/dist/{chunk-X3MWEFPT.js → chunk-EBKCYQ2D.js} +14 -14
  53. package/dist/chunk-EBKCYQ2D.js.map +1 -0
  54. package/dist/chunk-EP5L47XV.js +22 -0
  55. package/dist/chunk-EP5L47XV.js.map +1 -0
  56. package/dist/{chunk-TMR64XPL.js → chunk-EZNTORXE.js} +2 -2
  57. package/dist/{chunk-JAMDDLIM.js → chunk-FMNU7IUG.js} +3 -3
  58. package/dist/{chunk-YXZNGHID.js → chunk-FO6RNKKW.js} +8 -46
  59. package/dist/chunk-FO6RNKKW.js.map +1 -0
  60. package/dist/{chunk-YMUGBZN2.js → chunk-FQ5CHJR7.js} +1 -1
  61. package/dist/chunk-FQ5CHJR7.js.map +1 -0
  62. package/dist/{chunk-YZN6NRTR.js → chunk-FRMW23UK.js} +13 -11
  63. package/dist/chunk-FRMW23UK.js.map +1 -0
  64. package/dist/chunk-GJW4HX2O.js +1 -0
  65. package/dist/{chunk-7BIJS6II.js → chunk-GP3UWP22.js} +4 -4
  66. package/dist/{chunk-YTW6ZIPD.js → chunk-GZACYEOB.js} +1 -1
  67. package/dist/chunk-GZACYEOB.js.map +1 -0
  68. package/dist/{chunk-JIHH26WQ.js → chunk-HFUAFR6B.js} +6 -6
  69. package/dist/{chunk-J5TEU77Q.js → chunk-IF6WNGAK.js} +59 -4
  70. package/dist/chunk-IF6WNGAK.js.map +1 -0
  71. package/dist/{chunk-ZX5FNWH7.js → chunk-IG6KUWBX.js} +2 -2
  72. package/dist/chunk-IG6KUWBX.js.map +1 -0
  73. package/dist/{chunk-CKUYQO2P.js → chunk-IMRB2C4O.js} +7 -5
  74. package/dist/chunk-IMRB2C4O.js.map +1 -0
  75. package/dist/{chunk-RWW3I3PO.js → chunk-ISRKW4YN.js} +3 -3
  76. package/dist/{chunk-P4NUJVWL.js → chunk-IXNCZTWA.js} +2 -2
  77. package/dist/{chunk-YFFEF6HR.js → chunk-JIDLU57U.js} +3 -3
  78. package/dist/{chunk-PTT2NB46.js → chunk-JYJFGD2H.js} +2 -2
  79. package/dist/{chunk-3OWYOECI.js → chunk-JYV4JJV2.js} +5 -5
  80. package/dist/{chunk-OGVE4IJW.js → chunk-KBPU5M2E.js} +7 -7
  81. package/dist/{chunk-I2XEBEEF.js → chunk-KFRPNHWR.js} +4 -4
  82. package/dist/chunk-KFRPNHWR.js.map +1 -0
  83. package/dist/{chunk-3LJYHE7S.js → chunk-KPXM4WO6.js} +64 -57
  84. package/dist/chunk-KPXM4WO6.js.map +1 -0
  85. package/dist/{chunk-QMMOMBH6.js → chunk-KRCBZYTZ.js} +26 -177
  86. package/dist/chunk-KRCBZYTZ.js.map +1 -0
  87. package/dist/{chunk-UTEATWHO.js → chunk-KW42W6SV.js} +6 -6
  88. package/dist/{chunk-BY5YBSXA.js → chunk-L3YYLT4E.js} +15 -2
  89. package/dist/chunk-L3YYLT4E.js.map +1 -0
  90. package/dist/{chunk-UVBHM7AK.js → chunk-MANUDU7I.js} +6 -6
  91. package/dist/{chunk-YJ3TREAC.js → chunk-MHMLXJ3I.js} +2 -2
  92. package/dist/chunk-MHMLXJ3I.js.map +1 -0
  93. package/dist/{chunk-D4LAJ737.js → chunk-MSMJJB4J.js} +2 -2
  94. package/dist/chunk-MSMJJB4J.js.map +1 -0
  95. package/dist/{chunk-DYZ5CCVM.js → chunk-MXUT7FTE.js} +2 -2
  96. package/dist/chunk-MXUT7FTE.js.map +1 -0
  97. package/dist/{chunk-7ICV4ASA.js → chunk-N5PLUFH2.js} +27 -5
  98. package/dist/chunk-N5PLUFH2.js.map +1 -0
  99. package/dist/{chunk-K7BADAOS.js → chunk-NEX7JCMO.js} +4 -4
  100. package/dist/{chunk-5HSSTOOG.js → chunk-NFZGZ4AK.js} +2 -2
  101. package/dist/{chunk-XUFAFHQM.js → chunk-NJ4DYYO5.js} +7 -4
  102. package/dist/chunk-NJ4DYYO5.js.map +1 -0
  103. package/dist/{chunk-VEGQYPCP.js → chunk-NQSO4UAH.js} +8 -8
  104. package/dist/chunk-NQSO4UAH.js.map +1 -0
  105. package/dist/{chunk-GHEMAVTN.js → chunk-NYEFP7DY.js} +4 -4
  106. package/dist/chunk-NYEFP7DY.js.map +1 -0
  107. package/dist/{chunk-S4YERMGJ.js → chunk-OBPVWOSQ.js} +4 -4
  108. package/dist/{chunk-OHV6T5JB.js → chunk-OLIWCCFM.js} +2 -5
  109. package/dist/{chunk-2CRZOVDI.js → chunk-OLSARBZU.js} +2 -2
  110. package/dist/chunk-PEOZ34EM.js +13 -0
  111. package/dist/chunk-PEOZ34EM.js.map +1 -0
  112. package/dist/{chunk-KJTIAECI.js → chunk-PT4XLP6I.js} +171 -12
  113. package/dist/chunk-PT4XLP6I.js.map +1 -0
  114. package/dist/{chunk-LC7DSMHR.js → chunk-PTHKZWEH.js} +2 -14
  115. package/dist/{chunk-LC7DSMHR.js.map → chunk-PTHKZWEH.js.map} +1 -1
  116. package/dist/chunk-PVEWA2DU.js +23 -0
  117. package/dist/chunk-PVEWA2DU.js.map +1 -0
  118. package/dist/chunk-QADFHRQM.js +367 -0
  119. package/dist/chunk-QADFHRQM.js.map +1 -0
  120. package/dist/{chunk-7LP7FFJ2.js → chunk-QD46HPZG.js} +2 -2
  121. package/dist/{chunk-G4MFQXYX.js → chunk-QJNCB5SK.js} +2 -2
  122. package/dist/{chunk-6SYOHUHM.js → chunk-QZWTRENR.js} +2 -2
  123. package/dist/chunk-QZWTRENR.js.map +1 -0
  124. package/dist/{chunk-TSNRZSRC.js → chunk-RO5NM6UI.js} +2 -2
  125. package/dist/chunk-RO5NM6UI.js.map +1 -0
  126. package/dist/{chunk-GEEJPID6.js → chunk-RZPOZPZU.js} +8 -8
  127. package/dist/chunk-SGDPRCC4.js +1075 -0
  128. package/dist/chunk-SGDPRCC4.js.map +1 -0
  129. package/dist/{chunk-YCAJDK4O.js → chunk-SGQ4N5FS.js} +5 -5
  130. package/dist/{chunk-522MBPE5.js → chunk-SHEEBRZ4.js} +2 -2
  131. package/dist/{chunk-YWZEDG7F.js → chunk-SHYIA73K.js} +6 -6
  132. package/dist/{chunk-L2CAWCQL.js → chunk-SKM35Y4Q.js} +17 -26
  133. package/dist/chunk-SKM35Y4Q.js.map +1 -0
  134. package/dist/chunk-SMY5X46Z.js +14 -0
  135. package/dist/chunk-SMY5X46Z.js.map +1 -0
  136. package/dist/{chunk-K4BWPNJO.js → chunk-TE6LH6J2.js} +5 -5
  137. package/dist/{chunk-AFAPBZAA.js → chunk-TG634KCO.js} +11 -2
  138. package/dist/chunk-TG634KCO.js.map +1 -0
  139. package/dist/{chunk-V5JUAW4M.js → chunk-TIVK6PRK.js} +9 -10
  140. package/dist/chunk-TIVK6PRK.js.map +1 -0
  141. package/dist/{chunk-JN3SGXJE.js → chunk-UADPR6F4.js} +3 -3
  142. package/dist/{chunk-JN3SGXJE.js.map → chunk-UADPR6F4.js.map} +1 -1
  143. package/dist/{chunk-SBOHNJUD.js → chunk-V6UQZA2H.js} +2 -2
  144. package/dist/chunk-VG2ZSFYD.js +32 -0
  145. package/dist/chunk-VG2ZSFYD.js.map +1 -0
  146. package/dist/{chunk-SC4JLMZI.js → chunk-VH6SOCXH.js} +2 -2
  147. package/dist/chunk-VKQCVU2Z.js +21 -0
  148. package/dist/chunk-VKQCVU2Z.js.map +1 -0
  149. package/dist/chunk-VSRSQ2CR.js +654 -0
  150. package/dist/chunk-VSRSQ2CR.js.map +1 -0
  151. package/dist/{chunk-WQN5SM7P.js → chunk-W3G5REIU.js} +2 -2
  152. package/dist/{chunk-EGU4PWQW.js → chunk-W66AM5IB.js} +2 -2
  153. package/dist/chunk-W66AM5IB.js.map +1 -0
  154. package/dist/{chunk-HQKRZIX6.js → chunk-WBKZUO5V.js} +26 -43
  155. package/dist/chunk-WBKZUO5V.js.map +1 -0
  156. package/dist/{chunk-OMSKGLYA.js → chunk-WO4T4OD5.js} +2 -2
  157. package/dist/{chunk-6RPWILRH.js → chunk-WZ3NCMK6.js} +6 -5
  158. package/dist/{chunk-BAAUFCJK.js → chunk-X4MVWPHV.js} +3 -3
  159. package/dist/{chunk-R2N37AA6.js → chunk-XIDQKFZF.js} +3 -3
  160. package/dist/{chunk-EEZCB74X.js → chunk-XOBHRD2M.js} +575 -651
  161. package/dist/chunk-XOBHRD2M.js.map +1 -0
  162. package/dist/chunk-XZHEOSQ2.js +16 -0
  163. package/dist/chunk-XZHEOSQ2.js.map +1 -0
  164. package/dist/chunk-Y2NBBT6K.js +18 -0
  165. package/dist/chunk-Y2NBBT6K.js.map +1 -0
  166. package/dist/{chunk-OWOT7CFC.js → chunk-Y6B6HVKC.js} +2 -2
  167. package/dist/{chunk-5ATANZSW.js → chunk-Y6VZQGGH.js} +6 -6
  168. package/dist/chunk-YMUFFJCO.js +23 -0
  169. package/dist/chunk-YMUFFJCO.js.map +1 -0
  170. package/dist/{chunk-YZNKFYDC.js → chunk-ZFUFAHZ3.js} +4 -4
  171. package/dist/{chunk-PWWWMRT7.js → chunk-ZTLOXFPB.js} +2 -2
  172. package/dist/chunk-ZTLOXFPB.js.map +1 -0
  173. package/dist/{walk-E3OVLBFR.js → chunk-ZWBKDKXC.js} +4 -13
  174. package/dist/{walk-E3OVLBFR.js.map → chunk-ZWBKDKXC.js.map} +1 -1
  175. package/dist/classified/index.js +5 -5
  176. package/dist/{classified-marker-52P3D72W.js → classified-marker-EOOSMWFC.js} +3 -3
  177. package/dist/collection-facade-TTRF5NFJ.js +45 -0
  178. package/dist/{computed-33DRJDOC.js → computed-AB45PS4V.js} +3 -3
  179. package/dist/consent/index.js +13 -9
  180. package/dist/consent/index.js.map +1 -1
  181. package/dist/{cover-5BSNJREH.js → cover/index.js} +7 -6
  182. package/dist/crdt/index.js +4 -0
  183. package/dist/crdt/index.js.map +1 -1
  184. package/dist/custody/index.js +26 -0
  185. package/dist/{dead-filter-JXVCKS6W.js → dead-filter-6DYY7S64.js} +2 -2
  186. package/dist/{chunk-ILM6X6CP.js → delegation-ONOZVPIP.js} +12 -6
  187. package/dist/{chunk-ILM6X6CP.js.map → delegation-ONOZVPIP.js.map} +1 -1
  188. package/dist/derivations/index.js +12 -12
  189. package/dist/derive-IGGVSUPH.js +22 -0
  190. package/dist/directory/index.js +46 -0
  191. package/dist/{dispatch-PKQQFDBT.js → dispatch-7T45NN7C.js} +19 -18
  192. package/dist/{dispatch-PKQQFDBT.js.map → dispatch-7T45NN7C.js.map} +1 -1
  193. package/dist/{dispatch-SMXUO7W5.js → dispatch-RPTLK7LJ.js} +5 -5
  194. package/dist/{enclave-I5H3GINP.js → enclave-CLJVSDFG.js} +9 -9
  195. package/dist/executor-IEBLTBCW.js +9 -0
  196. package/dist/executor-RM7XWQDU.js +9 -0
  197. package/dist/executor-XZYM4KHT.js +28 -0
  198. package/dist/export-accessible-24XCCD3A.js +23 -0
  199. package/dist/extract-partition-H2TPEEOF.js +38 -0
  200. package/dist/{fanout-sidecar-WWXVHHUH.js → fanout-sidecar-TV7CXAJ6.js} +9 -9
  201. package/dist/find-OZMTRIK3.js +11 -0
  202. package/dist/forget/index.js +11 -11
  203. package/dist/forget/index.js.map +1 -1
  204. package/dist/guards/index.js +4 -4
  205. package/dist/history/index.js +16 -12
  206. package/dist/history/index.js.map +1 -1
  207. package/dist/i18n/index.js +16 -14
  208. package/dist/i18n/index.js.map +1 -1
  209. package/dist/index.d.ts +18 -24
  210. package/dist/index.js +212 -2045
  211. package/dist/index.js.map +1 -1
  212. package/dist/indexing/index.js +4 -2
  213. package/dist/indexing/index.js.map +1 -1
  214. package/dist/introspection/index.js +28 -0
  215. package/dist/issue-55HJE7JF.js +19 -0
  216. package/dist/kernel/collection-config.d.ts +1 -1
  217. package/dist/kernel/collection.d.ts +2 -2
  218. package/dist/kernel/errors.d.ts +2 -2
  219. package/dist/kernel/lazy.d.ts +30 -0
  220. package/dist/kernel/noydb.d.ts +22 -11
  221. package/dist/kernel/query/builder.d.ts +10 -10
  222. package/dist/kernel/query/index.d.ts +0 -6
  223. package/dist/kernel/query/scan-builder.d.ts +4 -4
  224. package/dist/kernel/types.d.ts +25 -25
  225. package/dist/kernel/vault.d.ts +10 -10
  226. package/dist/{ledger-M2BKCNVS.js → ledger-XY6NP3J2.js} +11 -11
  227. package/dist/liberate-LXOJ2EMB.js +24 -0
  228. package/dist/{link-set-ZU4E5J5S.js → link-set-POQB7BU5.js} +11 -11
  229. package/dist/materialized-views/index.js +22 -19
  230. package/dist/money/index.js +31 -0
  231. package/dist/noydb-KXS35UJS.js +82 -0
  232. package/dist/overlay-views/index.js +4 -4
  233. package/dist/periods/index.js +15 -13
  234. package/dist/pod/index.js +11 -12
  235. package/dist/{policy-IY2YEA3A.js → policy/index.js} +6 -6
  236. package/dist/port/with/blob-strategy.d.ts +15 -5
  237. package/dist/port/with/collection-registries.d.ts +62 -0
  238. package/dist/port/with/strategies.d.ts +11 -11
  239. package/dist/port/with/team-strategy.d.ts +2 -1
  240. package/dist/portability/index.js +8 -8
  241. package/dist/{post-register-XIAHB6KF.js → post-register-URQANI3B.js} +6 -6
  242. package/dist/query/index.js +6 -46
  243. package/dist/{aggregate → reduce}/index.js +24 -17
  244. package/dist/reduce/index.js.map +1 -0
  245. package/dist/register-5W6CG4RM.js +25 -0
  246. package/dist/registry-7Y5WF7GS.js +9 -0
  247. package/dist/{registry-VW6P6A3J.js → registry-BWD2ED52.js} +2 -2
  248. package/dist/registry-MCSGBZXI.js +18 -0
  249. package/dist/registry-UJFP3NWF.js +19 -0
  250. package/dist/request-withdrawal-IWYDM4SO.js +31 -0
  251. package/dist/{reveal-VWXRV2XU.js → reveal-BXZGWIOP.js} +6 -6
  252. package/dist/revoke-TINYPHYY.js +24 -0
  253. package/dist/satellites/index.js +1 -1
  254. package/dist/schema-update/index.js +26 -0
  255. package/dist/sealed-record/index.js +12 -12
  256. package/dist/search/index.js +36 -0
  257. package/dist/{seed-CDBFOTIK.js → seed-F7YYQTRC.js} +11 -11
  258. package/dist/sequence/index.js +30 -0
  259. package/dist/session/index.js +13 -9
  260. package/dist/session/index.js.map +1 -1
  261. package/dist/shadow/index.js +6 -2
  262. package/dist/shadow/index.js.map +1 -1
  263. package/dist/signer-WMZKCNKC.js +25 -0
  264. package/dist/snapshots/index.js +14 -10
  265. package/dist/snapshots/index.js.map +1 -1
  266. package/dist/{stale-NBROTA66.js → stale-JOE7GBAE.js} +11 -10
  267. package/dist/storage-B3WBKXKT.js +23 -0
  268. package/dist/store/index.js +22 -0
  269. package/dist/{store-coordination-provider-P3IU5JHD.js → store-coordination-provider-5LX2UFU2.js} +3 -3
  270. package/dist/sync/index.js +14 -10
  271. package/dist/sync/index.js.map +1 -1
  272. package/dist/team/index.js +36 -29
  273. package/dist/tiers/index.js +10 -10
  274. package/dist/to/index.js +1 -1
  275. package/dist/{tx → transactions}/index.js +7 -3
  276. package/dist/transactions/index.js.map +1 -0
  277. package/dist/util/index.js +1 -1
  278. package/dist/{verify-5X37OXRY.js → verify-7XWHJWUN.js} +5 -5
  279. package/dist/via/blob/active.d.ts +7 -18
  280. package/dist/via/blob/binding.d.ts +1 -1
  281. package/dist/via/blob/index.d.ts +4 -2
  282. package/dist/via/i18n/core.d.ts +1 -1
  283. package/dist/via/i18n/index.d.ts +2 -0
  284. package/dist/via/money/money-reducer.d.ts +2 -2
  285. package/dist/walk-6OHAWGBS.js +21 -0
  286. package/dist/with-audit/consent/index.d.ts +2 -0
  287. package/dist/with-audit/forget/active.d.ts +3 -3
  288. package/dist/with-audit/forget/index.d.ts +4 -4
  289. package/dist/with-audit/forget/strategy.d.ts +3 -3
  290. package/dist/with-audit/guards/executor.d.ts +4 -4
  291. package/dist/with-audit/guards/immutable-guard.d.ts +3 -3
  292. package/dist/with-audit/guards/index.d.ts +1 -1
  293. package/dist/with-audit/guards/registry.d.ts +3 -3
  294. package/dist/with-audit/guards/transition-guard.d.ts +3 -3
  295. package/dist/with-audit/guards/types.d.ts +10 -10
  296. package/dist/with-audit/guards/with-guard.d.ts +2 -2
  297. package/dist/with-audit/periods/index.d.ts +2 -0
  298. package/dist/with-cargo/floor.d.ts +3 -3
  299. package/dist/with-commit/crdt/index.d.ts +2 -0
  300. package/dist/with-commit/history/index.d.ts +2 -0
  301. package/dist/with-commit/numbering/descriptor.d.ts +16 -6
  302. package/dist/with-commit/tx/active.d.ts +5 -5
  303. package/dist/with-commit/tx/index.d.ts +2 -2
  304. package/dist/with-commit/tx/invariants.d.ts +1 -1
  305. package/dist/with-commit/tx/strategy.d.ts +3 -3
  306. package/dist/with-fork/shadow/index.d.ts +2 -0
  307. package/dist/with-fork/snapshots/active.d.ts +2 -2
  308. package/dist/with-fork/snapshots/index.d.ts +3 -1
  309. package/dist/with-fork/snapshots/noydb-facade.d.ts +3 -3
  310. package/dist/with-fork/snapshots/strategy.d.ts +2 -2
  311. package/dist/with-formula/derivations/executor.d.ts +2 -2
  312. package/dist/with-formula/derivations/index.d.ts +2 -1
  313. package/dist/with-formula/derivations/registry.d.ts +3 -3
  314. package/dist/with-formula/derivations/stale.d.ts +2 -2
  315. package/dist/with-formula/derivations/types.d.ts +3 -3
  316. package/dist/with-formula/derivations/with-derivation.d.ts +2 -2
  317. package/dist/with-formula/derivations/with-rollup.d.ts +15 -8
  318. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +3 -3
  319. package/dist/with-formula/materialized-views/index.d.ts +1 -1
  320. package/dist/with-formula/materialized-views/registry.d.ts +4 -4
  321. package/dist/with-formula/materialized-views/types.d.ts +11 -11
  322. package/dist/with-formula/materialized-views/with-materialized-view.d.ts +2 -2
  323. package/dist/with-formula/overlay-views/index.d.ts +1 -1
  324. package/dist/with-formula/overlay-views/registry.d.ts +4 -4
  325. package/dist/with-formula/overlay-views/types.d.ts +3 -3
  326. package/dist/with-formula/overlay-views/virtual-collection.d.ts +2 -2
  327. package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +2 -2
  328. package/dist/with-lookup/indexing/active.d.ts +5 -5
  329. package/dist/with-lookup/indexing/index.d.ts +3 -1
  330. package/dist/with-lookup/indexing/strategy.d.ts +3 -3
  331. package/dist/with-lookup/{aggregate → reduce}/active.d.ts +8 -8
  332. package/dist/with-lookup/{aggregate → reduce}/groupby.d.ts +21 -21
  333. package/dist/with-lookup/reduce/index.d.ts +34 -0
  334. package/dist/with-lookup/{aggregate → reduce}/reducers.d.ts +10 -10
  335. package/dist/with-lookup/{aggregate/aggregation.d.ts → reduce/reduction.d.ts} +21 -21
  336. package/dist/with-lookup/{aggregate → reduce}/strategy.d.ts +15 -15
  337. package/dist/with-lookup/search/build-docs.d.ts +7 -2
  338. package/dist/with-lookup/search/index.d.ts +1 -1
  339. package/dist/with-party/directory/cover/index.d.ts +1 -0
  340. package/dist/with-party/directory/index.d.ts +2 -0
  341. package/dist/with-party/session/index.d.ts +2 -0
  342. package/dist/with-party/sync/index.d.ts +2 -0
  343. package/dist/with-party/team/index.d.ts +2 -0
  344. package/dist/with-party/team/keyring.d.ts +68 -20
  345. package/dist/with-party/team/noydb-facade.d.ts +2 -1
  346. package/dist/with-shape/blobs/blob-set.d.ts +1 -1
  347. package/dist/with-shape/introspection/index.d.ts +6 -0
  348. package/dist/with-shape/schema-update/index.d.ts +1 -0
  349. package/dist/with-store/index.d.ts +3 -2
  350. package/dist/withdraw-accessible-DEUCOO4F.js +28 -0
  351. package/dist/withdraw-accessible-DEUCOO4F.js.map +1 -0
  352. package/package.json +42 -30
  353. package/dist/aggregate/index.js.map +0 -1
  354. package/dist/api-22ES33N3.js +0 -20
  355. package/dist/as/index.js +0 -30
  356. package/dist/at/index.js +0 -1
  357. package/dist/by/index.js +0 -11
  358. package/dist/chunk-2PDBYF2O.js.map +0 -1
  359. package/dist/chunk-2YELV6TV.js +0 -1
  360. package/dist/chunk-3LJYHE7S.js.map +0 -1
  361. package/dist/chunk-6SYOHUHM.js.map +0 -1
  362. package/dist/chunk-7ICV4ASA.js.map +0 -1
  363. package/dist/chunk-AFAPBZAA.js.map +0 -1
  364. package/dist/chunk-BY5YBSXA.js.map +0 -1
  365. package/dist/chunk-CJVEAVYH.js +0 -205
  366. package/dist/chunk-CJVEAVYH.js.map +0 -1
  367. package/dist/chunk-CKUYQO2P.js.map +0 -1
  368. package/dist/chunk-D4LAJ737.js.map +0 -1
  369. package/dist/chunk-DYZ5CCVM.js.map +0 -1
  370. package/dist/chunk-EEZCB74X.js.map +0 -1
  371. package/dist/chunk-EGU4PWQW.js.map +0 -1
  372. package/dist/chunk-FIP7KI2P.js.map +0 -1
  373. package/dist/chunk-GHEMAVTN.js.map +0 -1
  374. package/dist/chunk-HAPY7WFP.js.map +0 -1
  375. package/dist/chunk-HQKRZIX6.js.map +0 -1
  376. package/dist/chunk-I2XEBEEF.js.map +0 -1
  377. package/dist/chunk-IGLU4ME7.js +0 -255
  378. package/dist/chunk-IGLU4ME7.js.map +0 -1
  379. package/dist/chunk-J5TEU77Q.js.map +0 -1
  380. package/dist/chunk-KJTIAECI.js.map +0 -1
  381. package/dist/chunk-L2CAWCQL.js.map +0 -1
  382. package/dist/chunk-LB7FD65R.js +0 -163
  383. package/dist/chunk-LB7FD65R.js.map +0 -1
  384. package/dist/chunk-PWWWMRT7.js.map +0 -1
  385. package/dist/chunk-QMMOMBH6.js.map +0 -1
  386. package/dist/chunk-SEU6QHH4.js.map +0 -1
  387. package/dist/chunk-TNATF3HB.js.map +0 -1
  388. package/dist/chunk-TSNRZSRC.js.map +0 -1
  389. package/dist/chunk-V5JUAW4M.js.map +0 -1
  390. package/dist/chunk-VEGQYPCP.js.map +0 -1
  391. package/dist/chunk-X3MWEFPT.js.map +0 -1
  392. package/dist/chunk-XUFAFHQM.js.map +0 -1
  393. package/dist/chunk-YJ3TREAC.js.map +0 -1
  394. package/dist/chunk-YMUGBZN2.js.map +0 -1
  395. package/dist/chunk-YTW6ZIPD.js.map +0 -1
  396. package/dist/chunk-YXZNGHID.js.map +0 -1
  397. package/dist/chunk-YZN6NRTR.js.map +0 -1
  398. package/dist/chunk-ZX5FNWH7.js.map +0 -1
  399. package/dist/collection-facade-XKCFHSLR.js +0 -44
  400. package/dist/delegation-WWZPEDK2.js +0 -25
  401. package/dist/derive-CWWFEQ4N.js +0 -21
  402. package/dist/executor-FCJEH3FU.js +0 -9
  403. package/dist/executor-OHET7TF7.js +0 -9
  404. package/dist/executor-SHYLIBOM.js +0 -26
  405. package/dist/export-accessible-FBL6TDSK.js +0 -23
  406. package/dist/extract-partition-ZYIRYMTI.js +0 -38
  407. package/dist/find-LEBUXVL7.js +0 -11
  408. package/dist/in/index.js +0 -1
  409. package/dist/issue-F76PAGIR.js +0 -19
  410. package/dist/liberate-ZP7UB57K.js +0 -24
  411. package/dist/noydb-BNDGEK5X.js +0 -71
  412. package/dist/on/index.js +0 -17
  413. package/dist/port/as/index.d.ts +0 -26
  414. package/dist/port/at/index.d.ts +0 -18
  415. package/dist/port/in/index.d.ts +0 -21
  416. package/dist/port/on/index.d.ts +0 -27
  417. package/dist/port/ui/index.d.ts +0 -21
  418. package/dist/port/with/index.d.ts +0 -18
  419. package/dist/register-HB4TQZSV.js +0 -23
  420. package/dist/registry-6BMBFEXT.js +0 -19
  421. package/dist/registry-7CZWF3EQ.js +0 -9
  422. package/dist/registry-JOFO7RAH.js +0 -18
  423. package/dist/request-withdrawal-UN3TRHWI.js +0 -31
  424. package/dist/revoke-OLO2OVR7.js +0 -24
  425. package/dist/signer-MGGKPYAN.js +0 -25
  426. package/dist/storage-3R37QZLA.js +0 -23
  427. package/dist/tx/index.js.map +0 -1
  428. package/dist/ui/index.js +0 -1
  429. package/dist/with/index.js +0 -31
  430. package/dist/with-lookup/aggregate/index.d.ts +0 -23
  431. package/dist/withdraw-accessible-Q2EMATCU.js +0 -28
  432. /package/dist/{api-22ES33N3.js.map → api-3NKVNZPM.js.map} +0 -0
  433. /package/dist/{backup-YCHAC575.js.map → backup-PTSVXDDW.js.map} +0 -0
  434. /package/dist/{chunk-5WLDZZ6S.js.map → chunk-35NMVJ7I.js.map} +0 -0
  435. /package/dist/{chunk-TNJVDG2B.js.map → chunk-3XKESW5E.js.map} +0 -0
  436. /package/dist/{chunk-MUPZ6IZX.js.map → chunk-4JQK3L4V.js.map} +0 -0
  437. /package/dist/{chunk-Z4D3YGAB.js.map → chunk-4ZKNC6A6.js.map} +0 -0
  438. /package/dist/{chunk-ONB627HU.js.map → chunk-55LX6FSX.js.map} +0 -0
  439. /package/dist/{chunk-QMZ5A6FQ.js.map → chunk-56IIVAEO.js.map} +0 -0
  440. /package/dist/{chunk-FHHYCBBP.js.map → chunk-5DRROK5W.js.map} +0 -0
  441. /package/dist/{chunk-GTNRMJYH.js.map → chunk-5GQEU4DN.js.map} +0 -0
  442. /package/dist/{chunk-YQQPNXNO.js.map → chunk-6L3DKWRY.js.map} +0 -0
  443. /package/dist/{chunk-M6QA2KK2.js.map → chunk-6M2I3DKF.js.map} +0 -0
  444. /package/dist/{chunk-FTCGEUOY.js.map → chunk-6R6Q3MRN.js.map} +0 -0
  445. /package/dist/{chunk-ZUDAK436.js.map → chunk-6UBZ6I5Z.js.map} +0 -0
  446. /package/dist/{chunk-7U6AB7DZ.js.map → chunk-AKKRXT23.js.map} +0 -0
  447. /package/dist/{chunk-OWLZONGX.js.map → chunk-BLBAQRBM.js.map} +0 -0
  448. /package/dist/{chunk-QBOQI6PG.js.map → chunk-BN4HRYAZ.js.map} +0 -0
  449. /package/dist/{chunk-QVGEVZ5F.js.map → chunk-BQ6DHN4I.js.map} +0 -0
  450. /package/dist/{chunk-GP54LU5N.js.map → chunk-BYFXLDVV.js.map} +0 -0
  451. /package/dist/{chunk-QRHEAZ2Q.js.map → chunk-CUZLNGD5.js.map} +0 -0
  452. /package/dist/{chunk-YXIVUWDU.js.map → chunk-DGBIHDVK.js.map} +0 -0
  453. /package/dist/{chunk-QZJEYZ4I.js.map → chunk-DZAF24PG.js.map} +0 -0
  454. /package/dist/{chunk-TMR64XPL.js.map → chunk-EZNTORXE.js.map} +0 -0
  455. /package/dist/{chunk-JAMDDLIM.js.map → chunk-FMNU7IUG.js.map} +0 -0
  456. /package/dist/{as/index.js.map → chunk-GJW4HX2O.js.map} +0 -0
  457. /package/dist/{chunk-7BIJS6II.js.map → chunk-GP3UWP22.js.map} +0 -0
  458. /package/dist/{chunk-JIHH26WQ.js.map → chunk-HFUAFR6B.js.map} +0 -0
  459. /package/dist/{chunk-RWW3I3PO.js.map → chunk-ISRKW4YN.js.map} +0 -0
  460. /package/dist/{chunk-P4NUJVWL.js.map → chunk-IXNCZTWA.js.map} +0 -0
  461. /package/dist/{chunk-YFFEF6HR.js.map → chunk-JIDLU57U.js.map} +0 -0
  462. /package/dist/{chunk-PTT2NB46.js.map → chunk-JYJFGD2H.js.map} +0 -0
  463. /package/dist/{chunk-3OWYOECI.js.map → chunk-JYV4JJV2.js.map} +0 -0
  464. /package/dist/{chunk-OGVE4IJW.js.map → chunk-KBPU5M2E.js.map} +0 -0
  465. /package/dist/{chunk-UTEATWHO.js.map → chunk-KW42W6SV.js.map} +0 -0
  466. /package/dist/{chunk-UVBHM7AK.js.map → chunk-MANUDU7I.js.map} +0 -0
  467. /package/dist/{chunk-K7BADAOS.js.map → chunk-NEX7JCMO.js.map} +0 -0
  468. /package/dist/{chunk-5HSSTOOG.js.map → chunk-NFZGZ4AK.js.map} +0 -0
  469. /package/dist/{chunk-S4YERMGJ.js.map → chunk-OBPVWOSQ.js.map} +0 -0
  470. /package/dist/{chunk-OHV6T5JB.js.map → chunk-OLIWCCFM.js.map} +0 -0
  471. /package/dist/{chunk-2CRZOVDI.js.map → chunk-OLSARBZU.js.map} +0 -0
  472. /package/dist/{chunk-7LP7FFJ2.js.map → chunk-QD46HPZG.js.map} +0 -0
  473. /package/dist/{chunk-G4MFQXYX.js.map → chunk-QJNCB5SK.js.map} +0 -0
  474. /package/dist/{chunk-GEEJPID6.js.map → chunk-RZPOZPZU.js.map} +0 -0
  475. /package/dist/{chunk-YCAJDK4O.js.map → chunk-SGQ4N5FS.js.map} +0 -0
  476. /package/dist/{chunk-522MBPE5.js.map → chunk-SHEEBRZ4.js.map} +0 -0
  477. /package/dist/{chunk-YWZEDG7F.js.map → chunk-SHYIA73K.js.map} +0 -0
  478. /package/dist/{chunk-K4BWPNJO.js.map → chunk-TE6LH6J2.js.map} +0 -0
  479. /package/dist/{chunk-SBOHNJUD.js.map → chunk-V6UQZA2H.js.map} +0 -0
  480. /package/dist/{chunk-SC4JLMZI.js.map → chunk-VH6SOCXH.js.map} +0 -0
  481. /package/dist/{chunk-WQN5SM7P.js.map → chunk-W3G5REIU.js.map} +0 -0
  482. /package/dist/{chunk-OMSKGLYA.js.map → chunk-WO4T4OD5.js.map} +0 -0
  483. /package/dist/{chunk-6RPWILRH.js.map → chunk-WZ3NCMK6.js.map} +0 -0
  484. /package/dist/{chunk-BAAUFCJK.js.map → chunk-X4MVWPHV.js.map} +0 -0
  485. /package/dist/{chunk-R2N37AA6.js.map → chunk-XIDQKFZF.js.map} +0 -0
  486. /package/dist/{chunk-OWOT7CFC.js.map → chunk-Y6B6HVKC.js.map} +0 -0
  487. /package/dist/{chunk-5ATANZSW.js.map → chunk-Y6VZQGGH.js.map} +0 -0
  488. /package/dist/{chunk-YZNKFYDC.js.map → chunk-ZFUFAHZ3.js.map} +0 -0
  489. /package/dist/{classified-marker-52P3D72W.js.map → classified-marker-EOOSMWFC.js.map} +0 -0
  490. /package/dist/{at/index.js.map → collection-facade-TTRF5NFJ.js.map} +0 -0
  491. /package/dist/{by/index.js.map → computed-AB45PS4V.js.map} +0 -0
  492. /package/dist/{in → cover}/index.js.map +0 -0
  493. /package/dist/{on → custody}/index.js.map +0 -0
  494. /package/dist/{dead-filter-JXVCKS6W.js.map → dead-filter-6DYY7S64.js.map} +0 -0
  495. /package/dist/{chunk-2YELV6TV.js.map → derive-IGGVSUPH.js.map} +0 -0
  496. /package/dist/{ui → directory}/index.js.map +0 -0
  497. /package/dist/{dispatch-SMXUO7W5.js.map → dispatch-RPTLK7LJ.js.map} +0 -0
  498. /package/dist/{collection-facade-XKCFHSLR.js.map → enclave-CLJVSDFG.js.map} +0 -0
  499. /package/dist/{computed-33DRJDOC.js.map → executor-IEBLTBCW.js.map} +0 -0
  500. /package/dist/{cover-5BSNJREH.js.map → executor-RM7XWQDU.js.map} +0 -0
  501. /package/dist/{delegation-WWZPEDK2.js.map → executor-XZYM4KHT.js.map} +0 -0
  502. /package/dist/{derive-CWWFEQ4N.js.map → export-accessible-24XCCD3A.js.map} +0 -0
  503. /package/dist/{enclave-I5H3GINP.js.map → extract-partition-H2TPEEOF.js.map} +0 -0
  504. /package/dist/{fanout-sidecar-WWXVHHUH.js.map → fanout-sidecar-TV7CXAJ6.js.map} +0 -0
  505. /package/dist/{executor-FCJEH3FU.js.map → find-OZMTRIK3.js.map} +0 -0
  506. /package/dist/{with → introspection}/index.js.map +0 -0
  507. /package/dist/{executor-OHET7TF7.js.map → issue-55HJE7JF.js.map} +0 -0
  508. /package/dist/{executor-SHYLIBOM.js.map → ledger-XY6NP3J2.js.map} +0 -0
  509. /package/dist/{export-accessible-FBL6TDSK.js.map → liberate-LXOJ2EMB.js.map} +0 -0
  510. /package/dist/{extract-partition-ZYIRYMTI.js.map → link-set-POQB7BU5.js.map} +0 -0
  511. /package/dist/{find-LEBUXVL7.js.map → money/index.js.map} +0 -0
  512. /package/dist/{issue-F76PAGIR.js.map → noydb-KXS35UJS.js.map} +0 -0
  513. /package/dist/{ledger-M2BKCNVS.js.map → policy/index.js.map} +0 -0
  514. /package/dist/{post-register-XIAHB6KF.js.map → post-register-URQANI3B.js.map} +0 -0
  515. /package/dist/{liberate-ZP7UB57K.js.map → register-5W6CG4RM.js.map} +0 -0
  516. /package/dist/{link-set-ZU4E5J5S.js.map → registry-7Y5WF7GS.js.map} +0 -0
  517. /package/dist/{noydb-BNDGEK5X.js.map → registry-BWD2ED52.js.map} +0 -0
  518. /package/dist/{policy-IY2YEA3A.js.map → registry-MCSGBZXI.js.map} +0 -0
  519. /package/dist/{register-HB4TQZSV.js.map → registry-UJFP3NWF.js.map} +0 -0
  520. /package/dist/{registry-6BMBFEXT.js.map → request-withdrawal-IWYDM4SO.js.map} +0 -0
  521. /package/dist/{reveal-VWXRV2XU.js.map → reveal-BXZGWIOP.js.map} +0 -0
  522. /package/dist/{registry-7CZWF3EQ.js.map → revoke-TINYPHYY.js.map} +0 -0
  523. /package/dist/{registry-JOFO7RAH.js.map → schema-update/index.js.map} +0 -0
  524. /package/dist/{registry-VW6P6A3J.js.map → search/index.js.map} +0 -0
  525. /package/dist/{seed-CDBFOTIK.js.map → seed-F7YYQTRC.js.map} +0 -0
  526. /package/dist/{request-withdrawal-UN3TRHWI.js.map → sequence/index.js.map} +0 -0
  527. /package/dist/{revoke-OLO2OVR7.js.map → signer-WMZKCNKC.js.map} +0 -0
  528. /package/dist/{signer-MGGKPYAN.js.map → stale-JOE7GBAE.js.map} +0 -0
  529. /package/dist/{stale-NBROTA66.js.map → storage-B3WBKXKT.js.map} +0 -0
  530. /package/dist/{storage-3R37QZLA.js.map → store/index.js.map} +0 -0
  531. /package/dist/{store-coordination-provider-P3IU5JHD.js.map → store-coordination-provider-5LX2UFU2.js.map} +0 -0
  532. /package/dist/{verify-5X37OXRY.js.map → verify-7XWHJWUN.js.map} +0 -0
  533. /package/dist/{withdraw-accessible-Q2EMATCU.js.map → walk-6OHAWGBS.js.map} +0 -0
  534. /package/dist/with-lookup/{aggregate → reduce}/canonical-key.d.ts +0 -0
@@ -0,0 +1,63 @@
1
+ import {
2
+ NonAdditiveSchemaChangeError,
3
+ SchemaLockedError
4
+ } from "./chunk-QZWTRENR.js";
5
+
6
+ // src/with-shape/schema-update/strategies.ts
7
+ function blindUpdate() {
8
+ return { name: "blindUpdate", onSchemaDelta: () => ({ action: "allow" }) };
9
+ }
10
+ function additiveOnly() {
11
+ return {
12
+ name: "additiveOnly",
13
+ onSchemaDelta(delta) {
14
+ if (delta.kind === "non-additive") {
15
+ return {
16
+ action: "reject",
17
+ error: new NonAdditiveSchemaChangeError(
18
+ `Non-additive schema change to "${delta.collection}" (added: [${delta.added.join(", ")}], removed: [${delta.removed.join(", ")}], changed: [${delta.changed.map((c) => c.field).join(", ")}]). Register a coordinatedCutover() strategy to migrate, or revert the change.`
19
+ )
20
+ };
21
+ }
22
+ return { action: "allow" };
23
+ }
24
+ };
25
+ }
26
+ function lockSchema(opts) {
27
+ const fields = opts?.fields;
28
+ return {
29
+ name: "lockSchema",
30
+ onSchemaDelta(delta) {
31
+ if (delta.kind === "none") return { action: "allow" };
32
+ const touched = fields ? [...delta.added, ...delta.removed, ...delta.changed.map((c) => c.field)].filter((f) => fields.includes(f)) : ["<any>"];
33
+ if (touched.length === 0) return { action: "allow" };
34
+ return {
35
+ action: "reject",
36
+ error: new SchemaLockedError(
37
+ `Schema for "${delta.collection}" is locked` + (fields ? ` on fields [${fields.join(", ")}] (touched: [${touched.join(", ")}])` : "") + `; the change was refused.`
38
+ )
39
+ };
40
+ }
41
+ };
42
+ }
43
+
44
+ // src/with-shape/schema-update/cutover.ts
45
+ function coordinatedCutover(opts) {
46
+ return {
47
+ name: "coordinatedCutover",
48
+ onSchemaDelta(delta) {
49
+ if (delta.kind === "non-additive") {
50
+ return { action: "cutover", transform: opts.transform };
51
+ }
52
+ return { action: "allow" };
53
+ }
54
+ };
55
+ }
56
+
57
+ export {
58
+ blindUpdate,
59
+ additiveOnly,
60
+ lockSchema,
61
+ coordinatedCutover
62
+ };
63
+ //# sourceMappingURL=chunk-E23UGFVC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/schema-update/strategies.ts","../src/with-shape/schema-update/cutover.ts"],"sourcesContent":["/** Bundled light update strategies. */\nimport { NonAdditiveSchemaChangeError, SchemaLockedError } from '../../kernel/errors.js'\nimport type { SchemaUpdateStrategy, SchemaDelta } from './types.js'\n\n/** Allow any schema change. Explicit blind / back-compat. */\nexport function blindUpdate(): SchemaUpdateStrategy {\n return { name: 'blindUpdate', onSchemaDelta: () => ({ action: 'allow' }) }\n}\n\n/** Allow additive changes; reject non-additive ones. The safety backstop. */\nexport function additiveOnly(): SchemaUpdateStrategy {\n return {\n name: 'additiveOnly',\n onSchemaDelta(delta: SchemaDelta) {\n if (delta.kind === 'non-additive') {\n return {\n action: 'reject' as const,\n error: new NonAdditiveSchemaChangeError(\n `Non-additive schema change to \"${delta.collection}\" ` +\n `(added: [${delta.added.join(', ')}], removed: [${delta.removed.join(', ')}], ` +\n `changed: [${delta.changed.map(c => c.field).join(', ')}]). ` +\n `Register a coordinatedCutover() strategy to migrate, or revert the change.`,\n ),\n }\n }\n return { action: 'allow' as const }\n },\n }\n}\n\n/**\n * Reject schema changes. With `fields`, reject only when one of those\n * fields is added/removed/changed; otherwise reject any non-`none` delta.\n */\nexport function lockSchema(opts?: { readonly fields?: readonly string[] }): SchemaUpdateStrategy {\n const fields = opts?.fields\n return {\n name: 'lockSchema',\n onSchemaDelta(delta: SchemaDelta) {\n if (delta.kind === 'none') return { action: 'allow' as const }\n const touched = fields\n ? [...delta.added, ...delta.removed, ...delta.changed.map(c => c.field)].filter(f => fields.includes(f))\n : ['<any>']\n if (touched.length === 0) return { action: 'allow' as const }\n return {\n action: 'reject' as const,\n error: new SchemaLockedError(\n `Schema for \"${delta.collection}\" is locked` +\n (fields ? ` on fields [${fields.join(', ')}] (touched: [${touched.join(', ')}])` : '') +\n `; the change was refused.`,\n ),\n }\n },\n }\n}\n","/** The coordinatedCutover update strategy (single-step — no from/to). */\nimport type { SchemaUpdateStrategy, SchemaDelta, TransformFn } from './types.js'\n\nexport function coordinatedCutover(opts: { readonly transform: TransformFn }): SchemaUpdateStrategy {\n return {\n name: 'coordinatedCutover',\n onSchemaDelta(delta: SchemaDelta) {\n if (delta.kind === 'non-additive') {\n return { action: 'cutover' as const, transform: opts.transform }\n }\n return { action: 'allow' as const }\n },\n }\n}\n"],"mappings":";;;;;;AAKO,SAAS,cAAoC;AAClD,SAAO,EAAE,MAAM,eAAe,eAAe,OAAO,EAAE,QAAQ,QAAQ,GAAG;AAC3E;AAGO,SAAS,eAAqC;AACnD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,OAAoB;AAChC,UAAI,MAAM,SAAS,gBAAgB;AACjC,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,OAAO,IAAI;AAAA,YACT,kCAAkC,MAAM,UAAU,cACpC,MAAM,MAAM,KAAK,IAAI,CAAC,gBAAgB,MAAM,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";
7
7
  import {
8
8
  NOYDB_FORMAT_VERSION
9
- } from "./chunk-YTW6ZIPD.js";
9
+ } from "./chunk-GZACYEOB.js";
10
10
  import {
11
11
  ConflictError,
12
12
  SequenceContentionError,
13
13
  SequenceNotEnabledError,
14
14
  SequenceOfflineError,
15
15
  ValidationError
16
- } from "./chunk-6SYOHUHM.js";
16
+ } from "./chunk-QZWTRENR.js";
17
+
18
+ // src/with-commit/sequence/active.ts
19
+ function withSequence() {
20
+ return {
21
+ createStore(opts) {
22
+ return new SequenceStore(opts);
23
+ }
24
+ };
25
+ }
17
26
 
18
27
  // src/with-commit/sequence/strategy.ts
19
28
  var NO_SEQUENCE = {
@@ -182,15 +191,6 @@ var SequenceStore = class {
182
191
  }
183
192
  };
184
193
 
185
- // src/with-commit/sequence/active.ts
186
- function withSequence() {
187
- return {
188
- createStore(opts) {
189
- return new SequenceStore(opts);
190
- }
191
- };
192
- }
193
-
194
194
  export {
195
195
  withSequence,
196
196
  NO_SEQUENCE,
@@ -199,4 +199,4 @@ export {
199
199
  resolveSequenceKey,
200
200
  SequenceStore
201
201
  };
202
- //# sourceMappingURL=chunk-X3MWEFPT.js.map
202
+ //# sourceMappingURL=chunk-EBKCYQ2D.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-commit/sequence/active.ts","../src/with-commit/sequence/strategy.ts","../src/with-commit/sequence/index.ts"],"sourcesContent":["/**\n * Enable the atomic-sequence capability.\n * Pass to `createNoydb({ sequenceStrategy: withSequence() })` to make\n * `vault.sequence('name').next()` / `.peek()` / `.seedTo()` live. The\n * {@link SequenceStore} CAS engine is statically imported here, so it is pulled\n * into the bundle only when `withSequence()` is referenced (the floor never\n * imports it).\n */\nimport type { SequenceStrategy } from './strategy.js'\nimport { SequenceStore } from './index.js'\n\nexport function withSequence(): SequenceStrategy {\n return {\n createStore(opts) {\n return new SequenceStore(opts)\n },\n }\n}\n","/**\n * Sequence capability strategy — the single on-demand factory the vault routes\n * `vault.sequence()` through to build its atomic-CAS {@link SequenceStore}. The\n * active engine ({@link withSequence}) constructs the real store (kept out of\n * the floor bundle — the store class is reached only via the opt-in\n * `active.ts` chunk); {@link NO_SEQUENCE} throws. The vault always assembles the\n * per-call {@link SequenceStoreOptions} and delegates here, so an un-opted-in\n * caller hits `NO_SEQUENCE`'s throw at `vault.sequence()`.\n *\n * Note: `vault.sequence()` is synchronous, so the factory is a plain (sync)\n * constructor — the engine is tree-shaken by reachability (only `withSequence()`\n * pulls `active.ts`, which statically imports the store), not by a dynamic\n * import. Deferred-numbering series (`withDeferredNumbering`) are a distinct\n * capability and are NOT routed through this strategy.\n * @internal\n */\nimport type { SequenceStore, SequenceStoreOptions } from './index.js'\nimport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport interface SequenceStrategy {\n createStore(opts: SequenceStoreOptions): SequenceStore\n}\n\n/**\n * No-op stub — the floor default. The capability factory throws\n * {@link SequenceNotEnabledError}; opt in with `sequenceStrategy: withSequence()`\n * in createNoydb. @internal\n */\nexport const NO_SEQUENCE: SequenceStrategy = {\n createStore(): SequenceStore {\n throw new SequenceNotEnabledError()\n },\n}\n","/**\n * Atomic sequence primitive — online-coordinated gap-free numbering.\n *\n * `vault.sequence('invoice-2026').next()` returns 1, 2, 3, … with no\n * gaps and no duplicates, even under concurrent callers. Each named\n * sequence is an independent counter record at `_sequences/<name>`,\n * incremented with an optimistic compare-and-swap retry loop — the same\n * proven pattern as the ledger head (`history/ledger/store.ts`).\n *\n * **Explicitly online-only.** Gap-free numbering requires single-authority\n * serialization, which an offline / non-CAS store cannot provide. `next()`\n * throws {@link SequenceOfflineError} unless the backing store advertises\n * `capabilities.casAtomic`. This is a deliberate, honest wall — an offline\n * writer cannot safely allocate a global sequence number.\n *\n * Note on \"gap-free\": the *sequence* is gap-free (each `next()` yields a\n * unique, +1 value). If a caller discards a value without using it, that\n * is a gap in *usage*, not in the sequence — assign each `next()` result\n * to its record in the same operation.\n */\n\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport { encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { ConflictError, SequenceContentionError, SequenceOfflineError, ValidationError } from '../../kernel/errors.js'\n\n// Capability opt-in seam (S4): `vault.sequence()` builds its CAS store through\n// the sequenceStrategy, so it throws SequenceNotEnabledError unless opted in.\nexport { withSequence } from './active.js'\nexport { NO_SEQUENCE, type SequenceStrategy } from './strategy.js'\nexport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport const SEQUENCE_COLLECTION = '_sequences'\n// A sequence is a single hot CAS row — higher contention than a ledger\n// append. A larger budget + jittered backoff absorbs moderate concurrency;\n// a genuine burst beyond this surfaces SequenceContentionError so the\n// caller can retry / queue (the honest online-only contract).\nconst MAX_NEXT_ATTEMPTS = 16\n\ninterface SequenceState {\n value: number\n}\n\n/** Options for `SequenceHandle.next`. Deferred-numbering series use `for`; the CAS counter ignores all of these. */\nexport interface NextOptions {\n /** Deferred mode: the record id to number. Ignored by the CAS counter. */\n readonly for?: string\n /** Deferred mode: reject after this many ms if still unsealed (reserved; not yet enforced in this slice). */\n readonly timeoutMs?: number\n}\n\n/**\n * Partitioning for a CAS sequence. A partitioned sequence is an\n * independent counter scoped to one tuple of values — e.g.\n * `sequence('invoice', { partition: [2026, 'EU'] })` numbers EU-2026 invoices\n * separately from `[2026, 'US']` and from the bare `invoice` series.\n *\n * Partition components are URI-encoded (so `/`, null bytes and other\n * separators in a value can never collide with the structural separators) and\n * `'/'`-joined, then appended to the series with a null-byte (`\\x00`)\n * separator. The null byte is illegal in a plain series name, which guarantees\n * a partitioned key is always disjoint from any unpartitioned series.\n */\nexport interface SequenceOptions {\n /** Partition tuple. Each component is URI-encoded and `'/'`-joined. */\n readonly partition?: readonly (string | number)[]\n /**\n * Render template for the serial string. When set, `vault.sequence`\n * returns a {@link FormattedSequenceHandle} whose `next()` resolves to\n * `{ serial, formatted }`. Tokens:\n * - `{seq}` — the allocated integer\n * - `{seq:0N}` — zero-padded to width N (e.g. `{seq:04}` → `0001`)\n * - `{partition.i}` — the i-th `partition` component (original value)\n *\n * Any other token, or a `{partition.i}` index beyond the supplied\n * `partition`, throws `ValidationError` at `vault.sequence()` construction.\n * Per-partition reset is inherent: a new partition tuple starts at 1.\n */\n readonly format?: string\n}\n\n/**\n * A formatted sequence handle. Identical to {@link SequenceHandle}\n * except `next()` also returns the rendered `formatted` string. `peek()` /\n * `seedTo()` operate on the underlying integer counter, unchanged.\n */\nexport interface FormattedSequenceHandle {\n /** Allocate the next value and return it with its rendered serial string. */\n next(opts?: NextOptions): Promise<{ serial: number; formatted: string }>\n /** Read the current integer value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /** Set-if-greater on the underlying integer counter. See {@link SequenceHandle.seedTo}. */\n seedTo(n: number): Promise<void>\n}\n\n// Matches a single `{...}` token with no nested braces.\nconst SEQ_FORMAT_TOKEN = /\\{([^{}]*)\\}/g\nconst SEQ_PAD_TOKEN = /^seq:0(\\d+)$/\nconst SEQ_PARTITION_TOKEN = /^partition\\.(\\d+)$/\n\n/**\n * Validate a sequence `format` against the supplied partition and return a\n * pure `(serial) => string` renderer. Eager validation: every token is\n * checked now, so a bad pattern throws `ValidationError` at construction —\n * never at `next()` time.\n */\nexport function compileSequenceFormat(\n format: string,\n series: string,\n partition: readonly (string | number)[] | undefined,\n): (serial: number) => string {\n const parts = partition ?? []\n for (const m of format.matchAll(SEQ_FORMAT_TOKEN)) {\n const token = m[1] ?? ''\n if (token === 'seq') continue\n if (SEQ_PAD_TOKEN.test(token)) continue\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) {\n const idx = Number(partMatch[1])\n if (idx >= parts.length) {\n throw new ValidationError(\n `sequence(\"${series}\"): format token \"{${token}}\" references partition index ${idx}, ` +\n `but only ${parts.length} partition component(s) were supplied.`,\n )\n }\n continue\n }\n throw new ValidationError(\n `sequence(\"${series}\"): format contains unknown token \"{${token}}\". ` +\n `Accepted tokens: {seq}, {seq:0N}, {partition.i}.`,\n )\n }\n return (serial: number): string =>\n format.replace(SEQ_FORMAT_TOKEN, (full, token: string) => {\n if (token === 'seq') return String(serial)\n const padMatch = SEQ_PAD_TOKEN.exec(token)\n if (padMatch) return String(serial).padStart(Number(padMatch[1]), '0')\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) return String(parts[Number(partMatch[1])])\n return full // unreachable — validated above\n })\n}\n\n/**\n * Resolve the CAS storage key for a (series, partition) pair.\n *\n * With no partition the key is `series` verbatim. With a partition the key is\n * `${series}\\x00${parts}` where `parts` is each component passed through\n * `encodeURIComponent(String(part))` and `'/'`-joined. The null-byte separator\n * is illegal in a plain series name, so partitioned keys never collide with\n * unpartitioned ones; URI-encoding keeps any component containing `/` distinct\n * from a multi-component partition.\n *\n * @throws {ValidationError} if any partition component is empty after `String()`\n * or is a non-finite number (`NaN`, `±Infinity`).\n */\nexport function resolveSequenceKey(series: string, opts?: SequenceOptions): string {\n const partition = opts?.partition\n if (!partition || partition.length === 0) return series\n const parts = partition.map((p) => {\n if (typeof p === 'number' && !Number.isFinite(p)) {\n throw new ValidationError(`sequence partition component must be a finite number, got ${p}`)\n }\n const s = String(p)\n if (s === '') {\n throw new ValidationError('sequence partition component must not be empty')\n }\n return encodeURIComponent(s)\n })\n return `${series}\\x00${parts.join('/')}`\n}\n\nexport interface SequenceHandle {\n /** Atomically allocate and return the next value (1, 2, 3, …). Deferred series resolve at the next pass. */\n next(opts?: NextOptions): Promise<number>\n /** Read the current value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /**\n * Set-if-greater: advance the counter to at least `n`. A no-op if the\n * current value is already `>= n` (so it never rewinds), and `seedTo(0)` is\n * a no-op. Idempotent and CAS-safe under concurrent `next()` / `seedTo()`.\n *\n * Use after a bundle / CSV import to fast-forward the counter past the\n * highest imported serial, so subsequent `next()` calls cannot re-use a\n * number that is already on a record.\n *\n * Online-only: throws {@link SequenceOfflineError} on a non-CAS store.\n */\n seedTo(n: number): Promise<void>\n}\n\nasync function sleepBackoff(attempt: number): Promise<void> {\n // Exponential backoff with full jitter to break the thundering herd\n // when many writers contend on the same counter row.\n const ceil = Math.min(2 ** attempt, 32)\n const ms = Math.floor(Math.random() * ceil)\n await new Promise((r) => setTimeout(r, ms))\n}\n\n/** Per-call context the vault assembles to build a {@link SequenceStore}. */\nexport interface SequenceStoreOptions {\n adapter: NoydbStore\n vault: string\n encrypted: boolean\n getDEK: (collectionName: string) => Promise<EnclaveKey>\n actor: string\n}\n\nexport class SequenceStore {\n private readonly adapter: NoydbStore\n private readonly vault: string\n private readonly encrypted: boolean\n private readonly getDEK: (collectionName: string) => Promise<EnclaveKey>\n private readonly actor: string\n /**\n * Memoized DEK promise. The `_sequences` collection DEK is created on\n * first access; without sharing one promise, a burst of concurrent\n * `next()` calls would each trigger DEK creation and diverge (one\n * writer's ciphertext unreadable by another). One shared promise → one\n * DEK.\n */\n private dekPromise: Promise<EnclaveKey> | null = null\n\n constructor(opts: SequenceStoreOptions) {\n this.adapter = opts.adapter\n this.vault = opts.vault\n this.encrypted = opts.encrypted\n this.getDEK = opts.getDEK\n this.actor = opts.actor\n }\n\n /** A handle bound to one sequence name. */\n handle(name: string): SequenceHandle {\n return {\n next: () => this.next(name),\n peek: () => this.peek(name),\n seedTo: (n) => this.seedTo(name, n),\n }\n }\n\n private assertOnline(): void {\n if (this.adapter.capabilities?.casAtomic !== true) {\n throw new SequenceOfflineError()\n }\n }\n\n private dek(): Promise<EnclaveKey> {\n if (!this.dekPromise) this.dekPromise = this.getDEK(SEQUENCE_COLLECTION)\n return this.dekPromise\n }\n\n private async read(name: string): Promise<{ env: EncryptedEnvelope | null; value: number }> {\n const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name)\n if (!env) return { env: null, value: 0 }\n const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data\n const state = JSON.parse(json) as SequenceState\n return { env, value: state.value }\n }\n\n private async encryptState(state: SequenceState, version: number): Promise<EncryptedEnvelope> {\n const json = JSON.stringify(state)\n if (!this.encrypted) {\n return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: new Date().toISOString(), _iv: '', _data: json, _by: this.actor }\n }\n const { iv, data } = await encrypt(json, await this.dek())\n return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: new Date().toISOString(), _iv: iv, _data: data, _by: this.actor }\n }\n\n async peek(name: string): Promise<number> {\n return (await this.read(name)).value\n }\n\n async next(name: string): Promise<number> {\n this.assertOnline()\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n const nextValue = value + 1\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState({ value: nextValue }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return nextValue\n } catch (err) {\n if (err instanceof ConflictError) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n\n async seedTo(name: string, n: number): Promise<void> {\n this.assertOnline()\n if (n <= 0) return // set-if-greater: 0 (and any non-positive seed) is a no-op\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n if (value >= n) return // already at or past the floor — no write, idempotent\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState({ value: n }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return\n } catch (err) {\n if (err instanceof ConflictError) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\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/team/sync-strategy.ts
2
+ function notEnabled(op) {
3
+ return new Error(
4
+ `${op} requires the sync strategy. Import \`{ withSync }\` from "@noy-db/hub/sync" and pass it to \`createNoydb({ syncStrategy: withSync() })\`.`
5
+ );
6
+ }
7
+ var NO_SYNC = {
8
+ buildSyncEngine() {
9
+ throw notEnabled("SyncEngine");
10
+ },
11
+ buildSyncTransaction() {
12
+ throw notEnabled("SyncTransaction");
13
+ },
14
+ buildPresence() {
15
+ throw notEnabled("collection.presence()");
16
+ }
17
+ };
18
+
19
+ export {
20
+ NO_SYNC
21
+ };
22
+ //# sourceMappingURL=chunk-EP5L47XV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-party/team/sync-strategy.ts"],"sourcesContent":["/**\n * Strategy seam for the optional sync engine + presence service.\n * Core imports `SyncStrategy` type-only + `NO_SYNC` stub; the real\n * `SyncEngine`, `SyncTransaction`, and `PresenceHandle` constructors\n * are only reachable via `withSync()` in `./sync-active.ts`.\n *\n * Solo apps that never configure `sync` and never call\n * `collection.presence()` ship none of the ~856 LOC behind this seam\n * (`sync.ts` + `sync-transaction.ts` + `presence.ts`).\n *\n * Note: `keyring.ts` (~746 LOC) stays in core because it's required\n * for any multi-user vault — even single-owner vaults use a keyring\n * to wrap the DEK. The team package's grant/revoke/magic-link/\n * delegation modules tree-shake naturally via direct named imports.\n *\n * Behavior under NO_SYNC:\n *\n * - **buildSyncEngine** — throws. Only fires when `createNoydb({ sync })`\n * passes a remote target.\n * - **buildSyncTransaction** — throws. Only fires when `db.transaction(vault)`\n * is called on a vault with sync configured.\n * - **buildPresence** — throws. Only fires when user code calls\n * `collection.presence()`.\n *\n * @internal\n */\n\nimport type {\n NoydbStore,\n ConflictStrategy,\n SyncTargetRole,\n} from '../../kernel/types.js'\nimport type { NoydbEventEmitter } from '../../kernel/events.js'\nimport type { SyncPolicy } from '../../kernel/sync-policy.js'\nimport type { SyncEngine } from './sync.js'\nimport type { SyncTransaction } from './sync-transaction.js'\nimport type { PresenceHandle, PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../../kernel/vault.js'\n\n/**\n * Options accepted by `SyncStrategy.buildSyncEngine`. Mirrors the\n * `SyncEngine` constructor verbatim — kept here so core code never\n * imports the sync module at runtime.\n *\n * @internal\n */\nexport interface BuildSyncEngineOptions {\n local: NoydbStore\n remote: NoydbStore\n vault: string\n strategy: ConflictStrategy\n emitter: NoydbEventEmitter\n syncPolicy?: SyncPolicy\n role?: SyncTargetRole\n label?: string\n}\n\n/**\n * @internal\n */\nexport interface SyncStrategy {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P>\n}\n\nfunction notEnabled(op: string): Error {\n return new Error(\n `${op} requires the sync strategy. Import ` +\n '`{ withSync }` from \"@noy-db/hub/sync\" and pass it to ' +\n '`createNoydb({ syncStrategy: withSync() })`.',\n )\n}\n\n/**\n * No-sync stub. Every constructor throws with an actionable pointer\n * — there is no useful \"off\" mode for sync engine / presence /\n * sync-transaction; if the consumer reached one of these surfaces,\n * they intended to use it.\n *\n * @internal\n */\nexport const NO_SYNC: SyncStrategy = {\n buildSyncEngine() { throw notEnabled('SyncEngine') },\n buildSyncTransaction() { throw notEnabled('SyncTransaction') },\n buildPresence() { throw notEnabled('collection.presence()') },\n}\n"],"mappings":";AAkEA,SAAS,WAAW,IAAmB;AACrC,SAAO,IAAI;AAAA,IACT,GAAG,EAAE;AAAA,EAGP;AACF;AAUO,IAAM,UAAwB;AAAA,EACnC,kBAAkB;AAAE,UAAM,WAAW,YAAY;AAAA,EAAE;AAAA,EACnD,uBAAuB;AAAE,UAAM,WAAW,iBAAiB;AAAA,EAAE;AAAA,EAC7D,gBAAgB;AAAE,UAAM,WAAW,uBAAuB;AAAA,EAAE;AAC9D;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ValidationError
3
- } from "./chunk-6SYOHUHM.js";
3
+ } from "./chunk-QZWTRENR.js";
4
4
 
5
5
  // src/with-audit/periods/window.ts
6
6
  var PERIODS_COLLECTION = "_periods";
@@ -21,4 +21,4 @@ export {
21
21
  PERIOD_TARGET_PURGES_COLLECTION,
22
22
  periodExclusiveUpperBound
23
23
  };
24
- //# sourceMappingURL=chunk-TMR64XPL.js.map
24
+ //# sourceMappingURL=chunk-EZNTORXE.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  loadVaultPolicy,
3
3
  saveVaultPolicy
4
- } from "./chunk-QMZ5A6FQ.js";
4
+ } from "./chunk-56IIVAEO.js";
5
5
  import {
6
6
  PolicyDeniedError,
7
7
  ValidationError
8
- } from "./chunk-6SYOHUHM.js";
8
+ } from "./chunk-QZWTRENR.js";
9
9
 
10
10
  // src/with-party/policy/presets.ts
11
11
  var PERSONAL_POLICY = Object.freeze({
@@ -364,4 +364,4 @@ export {
364
364
  describeGate,
365
365
  createNoydbPolicy
366
366
  };
367
- //# sourceMappingURL=chunk-JAMDDLIM.js.map
367
+ //# sourceMappingURL=chunk-FMNU7IUG.js.map
@@ -1,55 +1,17 @@
1
1
  import {
2
- canonicalize,
2
+ computeSchemaDelta,
3
+ evaluateStrategies
4
+ } from "./chunk-DSDXAKIP.js";
5
+ import {
3
6
  derivePersistedSchema
4
- } from "./chunk-SEU6QHH4.js";
7
+ } from "./chunk-6ZNSB3H6.js";
5
8
  import {
6
9
  loadPersistedSchemaEntry,
7
10
  savePersistedSchema
8
- } from "./chunk-S4YERMGJ.js";
11
+ } from "./chunk-OBPVWOSQ.js";
9
12
  import {
10
13
  ConflictError
11
- } from "./chunk-6SYOHUHM.js";
12
-
13
- // src/with-shape/schema-update/delta.ts
14
- function computeSchemaDelta(stored, fresh, collection) {
15
- const a = stored;
16
- const b = fresh;
17
- const aProps = a.properties ?? {};
18
- const bProps = b.properties ?? {};
19
- const aReq = new Set(a.required ?? []);
20
- const bReq = new Set(b.required ?? []);
21
- const aKeys = Object.keys(aProps);
22
- const bKeys = Object.keys(bProps);
23
- const added = bKeys.filter((k) => !(k in aProps));
24
- const removed = aKeys.filter((k) => !(k in bProps));
25
- const changed = [];
26
- for (const k of bKeys) {
27
- if (!(k in aProps)) continue;
28
- const shapeChanged = canonicalize(aProps[k]) !== canonicalize(bProps[k]);
29
- const requiredChanged = aReq.has(k) !== bReq.has(k);
30
- if (shapeChanged || requiredChanged) {
31
- changed.push({ field: k, requiredChanged, shapeChanged });
32
- }
33
- }
34
- let kind;
35
- if (added.length === 0 && removed.length === 0 && changed.length === 0) {
36
- kind = "none";
37
- } else if (removed.length === 0 && changed.length === 0 && added.every((k) => !bReq.has(k))) {
38
- kind = "additive";
39
- } else {
40
- kind = "non-additive";
41
- }
42
- return { collection, kind, added, removed, changed };
43
- }
44
-
45
- // src/with-shape/schema-update/dispatch.ts
46
- async function evaluateStrategies(delta, strategies, ctx) {
47
- for (const strategy of strategies) {
48
- const decision = await strategy.onSchemaDelta(delta, ctx);
49
- if (decision.action !== "allow") return decision;
50
- }
51
- return { action: "allow" };
52
- }
14
+ } from "./chunk-QZWTRENR.js";
53
15
 
54
16
  // src/with-shape/persisted-schemas/register.ts
55
17
  var MAX_SCHEMA_CAS_RETRIES = 5;
@@ -164,4 +126,4 @@ export {
164
126
  persistClassifiedMarker,
165
127
  persistSatelliteMarker
166
128
  };
167
- //# sourceMappingURL=chunk-YXZNGHID.js.map
129
+ //# sourceMappingURL=chunk-FO6RNKKW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/persisted-schemas/register.ts"],"sourcesContent":["/**\n * Orchestrate the derive → hash → skip-or-write cycle for a collection's\n * persisted JSON Schema. Called by the Vault at collection-registration\n * time when the developer opts in via `collection({ persistJsonSchema:\n * true })`.\n *\n * Skip semantics:\n *\n * - Zod validators: skip when the new hash equals the stored hash.\n * - Non-Zod (stub envelopes have hash=null): skip when the stored\n * envelope's `kind` matches the freshly-detected kind (since there's\n * no body to compare yet — a kind change is the only signal).\n *\n * @module\n */\n\nimport { derivePersistedSchema } from './derive.js'\nimport { loadPersistedSchemaEntry, savePersistedSchema } from './storage.js'\nimport { computeSchemaDelta } from '../schema-update/delta.js'\nimport { evaluateStrategies } from '../schema-update/dispatch.js'\nimport { ConflictError } from '../../kernel/errors.js'\nimport type { SchemaUpdateStrategy, UpdateDecision } from '../schema-update/types.js'\nimport type { NoydbStore, ClassifiedMarker } from '../../kernel/types.js'\nimport type { PersistedSchemaEnvelope } from './types.js'\nimport type { PairingMarker } from '../satellites/types.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\n\n/**\n * Max optimistic-CAS retries for the shared `_schemas/<collection>` record\n * (#583). Only two writers ever contend (the JSON-Schema writer and the\n * classified-marker writer), so one retry suffices; the headroom covers a\n * pathological re-order. Exhausting it rethrows the {@link ConflictError}\n * rather than silently losing a write.\n */\nconst MAX_SCHEMA_CAS_RETRIES = 5\n\nexport interface PersistSchemaResult {\n /** True when a fresh envelope was written to storage. */\n readonly written: boolean\n /** True when an existing envelope matched and the write was skipped. */\n readonly skipped: boolean\n /** The envelope that was either written or matched. */\n readonly envelope: PersistedSchemaEnvelope\n /** The update-strategy decision, present when strategies ran. */\n readonly decision?: UpdateDecision\n}\n\nexport async function persistSchemaIfNeeded(opts: {\n readonly store: NoydbStore\n readonly vault: string\n readonly collectionName: string\n readonly validator: unknown\n readonly dek: EnclaveKey\n readonly strategies?: readonly SchemaUpdateStrategy[]\n}): Promise<PersistSchemaResult> {\n const fresh = await derivePersistedSchema(opts.validator)\n\n // The `_schemas/<collection>` record is shared with the classified-marker\n // writer, so a plain load→save loses whichever writer put first (#583). Read\n // the version at load time and CAS on it; on conflict re-read (picking up the\n // other writer's field), re-evaluate, and retry.\n for (let attempt = 0; ; attempt++) {\n const { version, payload: stored } = await loadPersistedSchemaEntry(\n opts.store, opts.vault, opts.collectionName, opts.dek,\n )\n\n if (stored && isEquivalent(stored, fresh)) {\n return { written: false, skipped: true, envelope: stored, decision: { action: 'allow' } }\n }\n\n // Changed (or first registration). Run update strategies only when we\n // have a comparable JSON-Schema baseline and strategies were registered.\n let decision: UpdateDecision = { action: 'allow' }\n const strategies = opts.strategies ?? []\n if (\n stored &&\n strategies.length > 0 &&\n stored.kind === fresh.kind &&\n isPlainObject(stored.jsonSchema) &&\n isPlainObject(fresh.jsonSchema)\n ) {\n const delta = computeSchemaDelta(stored.jsonSchema, fresh.jsonSchema, opts.collectionName)\n decision = await evaluateStrategies(delta, strategies, { collection: opts.collectionName })\n }\n\n if (decision.action !== 'allow') {\n // reject (or cutover): do NOT overwrite the baseline — the\n // old schema stays the source of truth until the change is resolved.\n return { written: false, skipped: false, envelope: stored ?? fresh, decision }\n }\n\n // Preserve a previously-persisted classified marker (C-A / R10) and\n // satellite pairing marker (R-S9) — the schema derivation knows nothing\n // about them, so a naive overwrite here would drop the config-drift\n // guards' cross-session signals.\n let toSave: PersistedSchemaEnvelope = fresh\n if (stored?.classified !== undefined) toSave = { ...toSave, classified: stored.classified }\n if (stored?.satellite !== undefined) toSave = { ...toSave, satellite: stored.satellite }\n try {\n await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, toSave, version)\n return { written: true, skipped: false, envelope: toSave, decision }\n } catch (err) {\n if (err instanceof ConflictError && attempt < MAX_SCHEMA_CAS_RETRIES) continue\n throw err\n }\n }\n}\n\n/**\n * Persist (or refresh) the C-A / R10 classified marker into the collection's\n * `_schemas/<collection>` record, preserving any existing derived JSON-Schema\n * body. Idempotent — a no-op when an equivalent marker is already stored.\n * Independent of `persistJsonSchema`: called on the first classified write so a\n * later naive handle can detect the drift cross-session.\n */\nexport async function persistClassifiedMarker(opts: {\n readonly store: NoydbStore\n readonly vault: string\n readonly collectionName: string\n readonly dek: EnclaveKey\n readonly marker: ClassifiedMarker\n}): Promise<void> {\n // Shares the `_schemas/<collection>` record with the JSON-Schema writer;\n // CAS on the loaded version so a concurrent schema (re)registration can't\n // silently drop the marker (and vice-versa) — see #583.\n for (let attempt = 0; ; attempt++) {\n const { version, payload: stored } = await loadPersistedSchemaEntry(\n opts.store, opts.vault, opts.collectionName, opts.dek,\n )\n if (stored?.classified !== undefined && markersEqual(stored.classified, opts.marker)) return\n const payload: PersistedSchemaEnvelope =\n stored !== undefined\n ? { ...stored, classified: opts.marker }\n : {\n _noydb_schema: 1,\n kind: 'Unknown',\n jsonSchema: null,\n hash: null,\n derivedAt: new Date().toISOString(),\n classified: opts.marker,\n }\n try {\n await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, payload, version)\n return\n } catch (err) {\n if (err instanceof ConflictError && attempt < MAX_SCHEMA_CAS_RETRIES) continue\n throw err\n }\n }\n}\n\n/**\n * Persist (or refresh) the R-S9 satellite pairing marker into the collection's\n * `_schemas/<collection>` record, preserving any existing derived JSON-Schema\n * body. Idempotent — a no-op when an equivalent marker is already stored.\n * Independent of `persistJsonSchema`: called on satellite declaration so a\n * later divergent re-declaration can be detected cross-session.\n */\nexport async function persistSatelliteMarker(opts: {\n readonly store: NoydbStore\n readonly vault: string\n readonly collectionName: string\n readonly dek: EnclaveKey\n readonly marker: PairingMarker\n}): Promise<void> {\n // Shares the `_schemas/<collection>` record with the JSON-Schema writer;\n // CAS on the loaded version so a concurrent schema (re)registration can't\n // silently drop the marker (and vice-versa) — see #583.\n for (let attempt = 0; ; attempt++) {\n const { version, payload: stored } = await loadPersistedSchemaEntry(\n opts.store, opts.vault, opts.collectionName, opts.dek,\n )\n if (stored?.satellite !== undefined && satelliteMarkersEqual(stored.satellite, opts.marker)) return\n const payload: PersistedSchemaEnvelope =\n stored !== undefined\n ? { ...stored, satellite: opts.marker }\n : {\n _noydb_schema: 1,\n kind: 'Unknown',\n jsonSchema: null,\n hash: null,\n derivedAt: new Date().toISOString(),\n satellite: opts.marker,\n }\n try {\n await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, payload, version)\n return\n } catch (err) {\n if (err instanceof ConflictError && attempt < MAX_SCHEMA_CAS_RETRIES) continue\n throw err\n }\n }\n}\n\n// #597: both equality checks below deliberately do NOT compare `epoch`. A\n// live collection re-opening itself computes a fresh epoch candidate on\n// every declare (marker.ts / config-drift.ts) that must still be treated as\n// \"the same marker\" so the no-op fast path fires and the already-persisted\n// epoch is left untouched — that's what makes epoch stable across re-opens.\n// Comparing epoch here would break that fast path today, with no\n// corresponding benefit: there is no delete-collection API yet, so a\n// mismatched epoch can't (yet) mean \"this name was reused for a genuinely\n// new collection.\" Wiring an epoch-mismatch REJECTION is a deferred\n// follow-up for whenever collection deletion ships.\n\nfunction satelliteMarkersEqual(a: PairingMarker, b: PairingMarker): boolean {\n return a.base === b.base && a.fieldsHash === b.fieldsHash && (a.joined ?? null) === (b.joined ?? null)\n}\n\nfunction markersEqual(a: ClassifiedMarker, b: ClassifiedMarker): boolean {\n return sameSet(a.digestOnly, b.digestOnly) && sameSet(a.equatable, b.equatable)\n}\n\nfunction sameSet(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false\n const s = new Set(a)\n return b.every((x) => s.has(x))\n}\n\nfunction isPlainObject(v: unknown): v is object {\n return typeof v === 'object' && v !== null && !Array.isArray(v)\n}\n\nfunction isEquivalent(a: PersistedSchemaEnvelope, b: PersistedSchemaEnvelope): boolean {\n if (a.kind !== b.kind) return false\n // Zod path: real hashes — compare directly.\n if (a.hash && b.hash) return a.hash === b.hash\n // Stub path: both have hash=null. Kind equality is the only signal we have.\n if (a.hash === null && b.hash === null) return true\n // Mixed (one has a hash, the other doesn't) — treat as changed.\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,IAAM,yBAAyB;AAa/B,eAAsB,sBAAsB,MAOX;AAC/B,QAAM,QAAQ,MAAM,sBAAsB,KAAK,SAAS;AAMxD,WAAS,UAAU,KAAK,WAAW;AACjC,UAAM,EAAE,SAAS,SAAS,OAAO,IAAI,MAAM;AAAA,MACzC,KAAK;AAAA,MAAO,KAAK;AAAA,MAAO,KAAK;AAAA,MAAgB,KAAK;AAAA,IACpD;AAEA,Q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,EAAE,UAAU,WAAW,EAAE,UAAU;AACnG;AAEA,SAAS,aAAa,GAAqB,GAA8B;AACvE,SAAO,QAAQ,EAAE,YAAY,EAAE,UAAU,KAAK,QAAQ,EAAE,WAAW,EAAE,SAAS;AAChF;AAEA,SAAS,QAAQ,GAAsB,GAA+B;AACpE,MAAI,EAAE,WAAW,EAAE,OAAQ,QAAO;AAClC,QAAM,IAAI,IAAI,IAAI,CAAC;AACnB,SAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAChC;AAEA,SAAS,cAAc,GAAyB;AAC9C,SAAO,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAChE;AAEA,SAAS,aAAa,GAA4B,GAAqC;AACrF,MAAI,EAAE,SAAS,EAAE,KAAM,QAAO;AAE9B,MAAI,EAAE,QAAQ,EAAE,KAAM,QAAO,EAAE,SAAS,EAAE;AAE1C,MAAI,EAAE,SAAS,QAAQ,EAAE,SAAS,KAAM,QAAO;AAE/C,SAAO;AACT;","names":[]}
@@ -122,4 +122,4 @@ var GuardRegistry = class {
122
122
  export {
123
123
  GuardRegistry
124
124
  };
125
- //# sourceMappingURL=chunk-YMUGBZN2.js.map
125
+ //# sourceMappingURL=chunk-FQ5CHJR7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-audit/guards/registry.ts"],"sourcesContent":["import type { GuardSpec, GuardContext, GuardChange } from './types.js'\n\n/**\n * Per-record metadata attached to every entry in an amendment's\n * change-set. Carried in a parallel map alongside `_amendmentChanges`\n * so the public {@link GuardChange} shape (`{ before, after }`) stays\n * clean for invariant authors — the audit ledger reads this side\n * structure to produce the `{ collection, id, vBefore, vAfter }`\n * tuples for the amendment entry.\n *\n * @internal\n */\nexport interface AmendmentChangeMeta {\n readonly id: string\n readonly vBefore: number\n readonly vAfter: number\n}\n\n/**\n * Vault-internal singleton that holds the guard graph and dispatches\n * per-collection guard execution. Owned by `Vault`; not exported.\n *\n * @internal\n */\n// Internal storage alias — guards are heterogeneous in their record type T,\n// so the registry stores them at the upper bound of GuardSpec's T constraint.\ntype AnyGuard = GuardSpec<Record<string, unknown>>\ntype AnyChange = GuardChange<Record<string, unknown>>\n\nexport class GuardRegistry {\n private readonly _byCollection = new Map<string, AnyGuard[]>()\n private _amendmentChanges: Map<string, AnyChange[]> | null = null\n private _amendmentMeta: Map<string, AmendmentChangeMeta[]> | null = null\n\n /** Register a guard. Multiple guards per collection are allowed. */\n register<T extends Record<string, unknown>>(spec: GuardSpec<T>): void {\n const existing = this._byCollection.get(spec.collection)\n if (existing) existing.push(spec as unknown as AnyGuard)\n else this._byCollection.set(spec.collection, [spec as unknown as AnyGuard])\n }\n\n /** All guards registered against `collection` in registration order. */\n guardsFor(collection: string): ReadonlyArray<AnyGuard> {\n return this._byCollection.get(collection) ?? []\n }\n\n /** Per-collection guard counts, for introspection. */\n summary(): { collection: string; count: number }[] {\n return [...this._byCollection.entries()].map(([collection, guards]) => ({\n collection,\n count: guards.length,\n }))\n }\n\n /**\n * Run every guard's `check` for this collection. First throw wins —\n * remaining guards are not invoked. Guards without a `check` skip.\n */\n async runChecks<T>(\n collection: string,\n incoming: T,\n ctx: GuardContext<T>,\n ): Promise<void> {\n const guards = this._byCollection.get(collection)\n if (!guards) return\n for (const g of guards) {\n if (g.check) {\n await g.check(\n incoming as unknown as Record<string, unknown>,\n ctx as unknown as GuardContext<Record<string, unknown>>,\n )\n }\n }\n }\n\n /**\n * Run every guard's `onDelete` for this collection. First throw wins —\n * remaining guards are not invoked. Guards without an `onDelete` skip.\n * Mirrors {@link runChecks} but for the delete path.\n */\n async runOnDelete<T>(\n collection: string,\n existing: T,\n ctx: GuardContext<T>,\n ): Promise<void> {\n const guards = this._byCollection.get(collection)\n if (!guards) return\n for (const g of guards) {\n if (g.onDelete) {\n await g.onDelete(\n existing as unknown as Record<string, unknown>,\n ctx as unknown as GuardContext<Record<string, unknown>>,\n )\n }\n }\n }\n\n /** True if any guard for `collection` declares an `amendment` block. */\n hasAmendment(collection: string): boolean {\n const guards = this._byCollection.get(collection)\n if (!guards) return false\n return guards.some(g => g.amendment !== undefined)\n }\n\n /** Open a new amendment change-collection window. */\n beginAmendment(): void {\n this._amendmentChanges = new Map()\n this._amendmentMeta = new Map()\n }\n\n /** True iff we're currently inside an amendment transaction. */\n isAmendmentActive(): boolean {\n return this._amendmentChanges !== null\n }\n\n /**\n * Record a {before, after} pair for the active amendment. `vBefore`\n * and `vAfter` are stored in a parallel meta structure so the public\n * {@link GuardChange} shape handed to invariant callbacks stays\n * `{ before, after }` only — the audit ledger reads version metadata\n * via {@link consumeMeta}.\n */\n collectChange<T>(\n collection: string,\n id: string,\n before: T | null,\n after: T,\n vBefore = 0,\n vAfter = 0,\n ): void {\n if (this._amendmentChanges === null || this._amendmentMeta === null) {\n throw new Error('GuardRegistry.collectChange called outside an amendment')\n }\n const list = this._amendmentChanges.get(collection)\n const entry = { before, after } as unknown as AnyChange\n if (list) list.push(entry)\n else this._amendmentChanges.set(collection, [entry])\n\n const metaList = this._amendmentMeta.get(collection)\n const metaEntry: AmendmentChangeMeta = { id, vBefore, vAfter }\n if (metaList) metaList.push(metaEntry)\n else this._amendmentMeta.set(collection, [metaEntry])\n }\n\n /**\n * Drain the change-set and close the amendment window. The caller\n * (transaction commit) feeds these to each affected guard's invariant.\n */\n consumeChanges(): ReadonlyMap<string, ReadonlyArray<AnyChange>> {\n const out = this._amendmentChanges ?? new Map()\n this._amendmentChanges = null\n return out\n }\n\n /**\n * Drain the parallel id/version metadata captured during the\n * amendment. Returned as a flat list with `collection` denormalised\n * so the audit ledger can emit one `{ collection, id, vBefore,\n * vAfter }` tuple per record. Must be called AFTER\n * {@link consumeChanges} (or independently) — calling it closes the\n * meta window in the same way.\n */\n consumeMeta(): ReadonlyArray<{ collection: string; id: string; vBefore: number; vAfter: number }> {\n const out: { collection: string; id: string; vBefore: number; vAfter: number }[] = []\n if (this._amendmentMeta) {\n for (const [collection, list] of this._amendmentMeta) {\n for (const m of list) {\n out.push({ collection, id: m.id, vBefore: m.vBefore, vAfter: m.vAfter })\n }\n }\n }\n this._amendmentMeta = null\n return out\n }\n}\n"],"mappings":";AA6BO,IAAM,gBAAN,MAAoB;AAAA,EACR,gBAAgB,oBAAI,IAAwB;AAAA,EACrD,oBAAqD;AAAA,EACrD,iBAA4D;AAAA;AAAA,EAGpE,SAA4C,MAA0B;AACpE,UAAM,WAAW,KAAK,cAAc,IAAI,KAAK,UAAU;AACvD,QAAI,SAAU,UAAS,KAAK,IAA2B;AAAA,QAClD,MAAK,cAAc,IAAI,KAAK,YAAY,CAAC,IAA2B,CAAC;AAAA,EAC5E;AAAA;AAAA,EAGA,UAAU,YAA6C;AACrD,WAAO,KAAK,cAAc,IAAI,UAAU,KAAK,CAAC;AAAA,EAChD;AAAA;AAAA,EAGA,UAAmD;AACjD,WAAO,CAAC,GAAG,KAAK,cAAc,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,YAAY,MAAM,OAAO;AAAA,MACtE;AAAA,MACA,OAAO,OAAO;AAAA,IAChB,EAAE;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,UACJ,YACA,UACA,KACe;AACf,UAAM,SAAS,KAAK,cAAc,IAAI,UAAU;AAChD,QAAI,CAAC,OAAQ;AACb,eAAW,KAAK,QAAQ;AACtB,UAAI,EAAE,OAAO;AACX,cAAM,EAAE;AAAA,UACN;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,YACJ,YACA,UACA,KACe;AACf,UAAM,SAAS,KAAK,cAAc,IAAI,UAAU;AAChD,QAAI,CAAC,OAAQ;AACb,eAAW,KAAK,QAAQ;AACtB,UAAI,EAAE,UAAU;AACd,cAAM,EAAE;AAAA,UACN;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,aAA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E,YAAY,IAAI,EAAE,IAAI,SAAS,EAAE,SAAS,QAAQ,EAAE,OAAO,CAAC;AAAA,QACzE;AAAA,MACF;AAAA,IACF;AACA,SAAK,iBAAiB;AACtB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,25 +1,27 @@
1
- import {
2
- wrapDbWithPredicates
3
- } from "./chunk-TNATF3HB.js";
4
1
  import {
5
2
  putDerivedOutput
6
- } from "./chunk-7BIJS6II.js";
3
+ } from "./chunk-GP3UWP22.js";
4
+ import {
5
+ wrapDbWithPredicates
6
+ } from "./chunk-3HUYRN24.js";
7
7
  import {
8
8
  DEFAULT_JOIN_MAX_ROWS
9
- } from "./chunk-SBOHNJUD.js";
9
+ } from "./chunk-V6UQZA2H.js";
10
10
  import {
11
- canonicalGroupKey,
12
11
  groupAndReduce
13
- } from "./chunk-QMMOMBH6.js";
12
+ } from "./chunk-KRCBZYTZ.js";
13
+ import {
14
+ canonicalGroupKey
15
+ } from "./chunk-XZHEOSQ2.js";
14
16
  import {
15
17
  applyI18nLocale
16
- } from "./chunk-JN3SGXJE.js";
18
+ } from "./chunk-UADPR6F4.js";
17
19
  import {
18
20
  JoinTooLargeError,
19
21
  LocaleNotSpecifiedError,
20
22
  MaterializedViewConfigError,
21
23
  MaterializedViewTooLargeError
22
- } from "./chunk-6SYOHUHM.js";
24
+ } from "./chunk-QZWTRENR.js";
23
25
 
24
26
  // src/with-formula/materialized-views/executor.ts
25
27
  var DEFAULT_MAX_ROWS = 1e5;
@@ -36,7 +38,7 @@ async function materializeQueryResult(q, mvName, i18nLocale, i18nFields) {
36
38
  return [result];
37
39
  }
38
40
  throw new Error(
39
- `MV "${mvName}": query() must return a Query<T>, Aggregation, or GroupedAggregation. Got something without a .toArray() or .run() terminal.`
41
+ `MV "${mvName}": query() must return a Query<T>, Reduction, or GroupedReduction. Got something without a .toArray() or .run() terminal.`
40
42
  );
41
43
  }
42
44
  async function materializeUnionResult(spec, db) {
@@ -280,4 +282,4 @@ async function listOutputIds(outputColl) {
280
282
  export {
281
283
  MaterializedViewExecutor
282
284
  };
283
- //# sourceMappingURL=chunk-YZN6NRTR.js.map
285
+ //# sourceMappingURL=chunk-FRMW23UK.js.map
@@ -0,0 +1 @@
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 { 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 * 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 // #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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,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;AAQl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ACJ,OAAO,iBAAiB,WACnB,aAAyC,oBAC1C;AACN,YAAI,gBAAgB,WAAW,KAAK,KAAM;AAC1C,YAAI;AAEF,gBAAM,SAAS;AACf,cAAI,OAAO,OAAO,oBAAoB,YAAY;AAIhD,gBAAI,MAAM,OAAO,gBAAgB,SAAS,KAAK,GAAG;AAChD;AAAA,YACF,OAAO;AAIL,8BAAgB,KAAK,GAAG,IAAI,gBAAgB,IAAI,OAAO,EAAE;AAAA,YAC3D;AAAA,UACF,OAAO;AAGL,kBAAM,WAAW,OAAO,OAAO;AAC/B;AAAA,UACF;AAAA,QACF,SAAS,KAAK;AACZ;AACA,cAAI,OAAQ,OAAM;AAElB,kBAAQ,KAAK,SAAS,KAAK,IAAI,8BAA8B,OAAO,MAAM,GAAG;AAAA,QAC/E;AAAA,MACF;AAAA,IACF;AAEA,WAAO,EAAE,SAAS,SAAS,QAAQ,oBAAoB,gBAAgB;AAAA,EACzE;AACF;AAUA,eAAe,cAEb,YACmB;AAEnB,QAAM,OAAO;AACb,QAAM,UAAU,KAAK;AACrB,QAAM,QAAQ,KAAK;AACnB,QAAM,OAAO,KAAK;AAClB,MAAI,OAAO,SAAS,SAAS,WAAY,QAAO,CAAC;AACjD,MAAI;AACF,UAAM,MAAM,MAAM,QAAQ,KAAK,OAAO,IAAI;AAC1C,WAAO,CAAC,GAAG,GAAG;AAAA,EAChB,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-GJW4HX2O.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  dictCollectionName
3
- } from "./chunk-K7BADAOS.js";
3
+ } from "./chunk-NEX7JCMO.js";
4
4
  import {
5
5
  getAtPath,
6
6
  presentI18nForJoin
7
- } from "./chunk-JN3SGXJE.js";
7
+ } from "./chunk-UADPR6F4.js";
8
8
  import {
9
9
  PeriodClosedError,
10
10
  UnknownDictCodeError,
11
11
  ValidationError
12
- } from "./chunk-6SYOHUHM.js";
12
+ } from "./chunk-QZWTRENR.js";
13
13
 
14
14
  // src/via/lookup/registry.ts
15
15
  function enforceStaticDictOnPut(staticFields, record) {
@@ -487,4 +487,4 @@ export {
487
487
  forgetDerivedFanout,
488
488
  selfWriteFieldEqual
489
489
  };
490
- //# sourceMappingURL=chunk-7BIJS6II.js.map
490
+ //# sourceMappingURL=chunk-GP3UWP22.js.map
@@ -29,4 +29,4 @@ export {
29
29
  SealedHandle,
30
30
  createStore
31
31
  };
32
- //# sourceMappingURL=chunk-YTW6ZIPD.js.map
32
+ //# sourceMappingURL=chunk-GZACYEOB.js.map