@noy-db/hub 0.3.0-pre.1 → 0.3.0-pre.10

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 (435) hide show
  1. package/dist/aggregate/index.d.ts +3 -4
  2. package/dist/aggregate/index.js +9 -8
  3. package/dist/aggregate/index.js.map +1 -1
  4. package/dist/api-TX2EX2FX.js +20 -0
  5. package/dist/as/index.d.ts +4 -5
  6. package/dist/as/index.js +12 -6
  7. package/dist/at/index.d.ts +2 -3
  8. package/dist/attestation/index.d.ts +3 -4
  9. package/dist/attestation/index.js +19 -13
  10. package/dist/attestation/index.js.map +1 -1
  11. package/dist/{backup-XV3IOEGB.js → backup-R7NTDFKY.js} +14 -6
  12. package/dist/backup-R7NTDFKY.js.map +1 -0
  13. package/dist/blobs/index.d.ts +4 -5
  14. package/dist/blobs/index.js +12 -6
  15. package/dist/blobs/index.js.map +1 -1
  16. package/dist/bundle/index.d.ts +5 -6
  17. package/dist/bundle/index.js +21 -15
  18. package/dist/bundle/index.js.map +1 -1
  19. package/dist/{bundle-CH-H06dp.d.ts → bundle-D6GxiUfq.d.ts} +1 -1
  20. package/dist/by/index.js +2 -2
  21. package/dist/cargo/index.d.ts +4 -6
  22. package/dist/cargo/index.js +27 -21
  23. package/dist/chunk-2OV5NVE7.js +95 -0
  24. package/dist/chunk-2OV5NVE7.js.map +1 -0
  25. package/dist/{chunk-5N6CZTCY.js → chunk-2OZXVKVP.js} +3 -3
  26. package/dist/{chunk-BG3SPSR4.js → chunk-2REPHKET.js} +5 -4
  27. package/dist/chunk-2REPHKET.js.map +1 -0
  28. package/dist/{chunk-LXQT4WMP.js → chunk-3JXPAHOZ.js} +8 -6
  29. package/dist/{chunk-LXQT4WMP.js.map → chunk-3JXPAHOZ.js.map} +1 -1
  30. package/dist/{chunk-UAG5KWVA.js → chunk-3MATJ6O4.js} +3 -3
  31. package/dist/chunk-3OPY6MK2.js +404 -0
  32. package/dist/chunk-3OPY6MK2.js.map +1 -0
  33. package/dist/{chunk-62QYRORB.js → chunk-3QSIU3UT.js} +34 -63
  34. package/dist/chunk-3QSIU3UT.js.map +1 -0
  35. package/dist/{chunk-DGDI2D4M.js → chunk-4OMCIY6F.js} +29 -9
  36. package/dist/chunk-4OMCIY6F.js.map +1 -0
  37. package/dist/chunk-5I35DOHK.js +94 -0
  38. package/dist/chunk-5I35DOHK.js.map +1 -0
  39. package/dist/{chunk-2P2HZEXU.js → chunk-5VG4IJR7.js} +11 -9
  40. package/dist/{chunk-2P2HZEXU.js.map → chunk-5VG4IJR7.js.map} +1 -1
  41. package/dist/{chunk-AZAOEIKW.js → chunk-5YESYH2C.js} +2 -2
  42. package/dist/{chunk-GYGWYIOZ.js → chunk-6G5ORS5D.js} +7 -5
  43. package/dist/{chunk-GYGWYIOZ.js.map → chunk-6G5ORS5D.js.map} +1 -1
  44. package/dist/{chunk-VCTFO5CO.js → chunk-6P5XCKSD.js} +2 -2
  45. package/dist/{chunk-IO6GRPT6.js → chunk-7BWJHO2A.js} +2 -2
  46. package/dist/{chunk-IPB7FTQX.js → chunk-7P2SDJG3.js} +15 -9
  47. package/dist/chunk-7P2SDJG3.js.map +1 -0
  48. package/dist/{chunk-SRB2XEWB.js → chunk-ANB77BVV.js} +6 -4
  49. package/dist/chunk-ANB77BVV.js.map +1 -0
  50. package/dist/{chunk-UDRIWL7A.js → chunk-BKARNZJN.js} +3 -3
  51. package/dist/{chunk-Y22T3KQE.js → chunk-BQISD5ZV.js} +3 -3
  52. package/dist/chunk-BQISD5ZV.js.map +1 -0
  53. package/dist/{chunk-UIU2THRG.js → chunk-BUAQ7YI3.js} +138 -378
  54. package/dist/chunk-BUAQ7YI3.js.map +1 -0
  55. package/dist/{chunk-V7RWQRG7.js → chunk-CB7CWSKW.js} +3 -3
  56. package/dist/{chunk-LV7M27WM.js → chunk-DFVUTGT2.js} +14 -201
  57. package/dist/chunk-DFVUTGT2.js.map +1 -0
  58. package/dist/{chunk-CWPPNPOH.js → chunk-DJ7KIPLV.js} +2 -2
  59. package/dist/{chunk-5R5JW2JT.js → chunk-DSKDQP3G.js} +3480 -1916
  60. package/dist/chunk-DSKDQP3G.js.map +1 -0
  61. package/dist/{chunk-VFQGRQIH.js → chunk-DV4HUP5G.js} +7 -5
  62. package/dist/{chunk-VFQGRQIH.js.map → chunk-DV4HUP5G.js.map} +1 -1
  63. package/dist/{chunk-5LUY7UTV.js → chunk-EOXAAJTY.js} +289 -48
  64. package/dist/chunk-EOXAAJTY.js.map +1 -0
  65. package/dist/chunk-ET67AY6B.js +74 -0
  66. package/dist/chunk-ET67AY6B.js.map +1 -0
  67. package/dist/{chunk-TA66UMI4.js → chunk-F4CEK5YM.js} +2 -2
  68. package/dist/chunk-FORYWFN6.js +130 -0
  69. package/dist/chunk-FORYWFN6.js.map +1 -0
  70. package/dist/{chunk-IELYAOGG.js → chunk-FRP6D2DM.js} +19 -6
  71. package/dist/chunk-FRP6D2DM.js.map +1 -0
  72. package/dist/chunk-FUOE7UUV.js +341 -0
  73. package/dist/chunk-FUOE7UUV.js.map +1 -0
  74. package/dist/{chunk-SM3AVUHC.js → chunk-G4JYND6L.js} +2 -2
  75. package/dist/{chunk-AXRXJTE2.js → chunk-G6XV4H65.js} +5 -5
  76. package/dist/{chunk-I2NOIW44.js → chunk-GNMXXTMN.js} +8 -6
  77. package/dist/{chunk-I2NOIW44.js.map → chunk-GNMXXTMN.js.map} +1 -1
  78. package/dist/chunk-GYGLAVCX.js +19 -0
  79. package/dist/chunk-GYGLAVCX.js.map +1 -0
  80. package/dist/{chunk-UV5MFVO3.js → chunk-HPWKV3YB.js} +2 -2
  81. package/dist/chunk-HY3AUMFI.js +41 -0
  82. package/dist/chunk-HY3AUMFI.js.map +1 -0
  83. package/dist/chunk-HYR4WZZ3.js +69 -0
  84. package/dist/chunk-HYR4WZZ3.js.map +1 -0
  85. package/dist/{chunk-SKF73JOP.js → chunk-ICXIFFYZ.js} +3 -3
  86. package/dist/chunk-IGJCYUT5.js +99 -0
  87. package/dist/chunk-IGJCYUT5.js.map +1 -0
  88. package/dist/{chunk-MD3Y6J3L.js → chunk-IVLTXX4W.js} +7 -5
  89. package/dist/{chunk-MD3Y6J3L.js.map → chunk-IVLTXX4W.js.map} +1 -1
  90. package/dist/{chunk-WWGT2MDV.js → chunk-J4LPNIGK.js} +26 -11
  91. package/dist/chunk-J4LPNIGK.js.map +1 -0
  92. package/dist/chunk-JJZ2LW6T.js +36 -0
  93. package/dist/chunk-JJZ2LW6T.js.map +1 -0
  94. package/dist/{chunk-RUIMKQTA.js → chunk-JK733I5V.js} +1 -1
  95. package/dist/chunk-JK733I5V.js.map +1 -0
  96. package/dist/{chunk-UPJNJGGA.js → chunk-KJ2BCBTL.js} +25 -8
  97. package/dist/chunk-KJ2BCBTL.js.map +1 -0
  98. package/dist/{chunk-LMTH2RM6.js → chunk-KNZB6JMR.js} +2 -2
  99. package/dist/{chunk-I3TIKTJO.js → chunk-KPZS5QAQ.js} +29 -10
  100. package/dist/chunk-KPZS5QAQ.js.map +1 -0
  101. package/dist/{chunk-PKHL44ER.js → chunk-LEJIKBBB.js} +2 -2
  102. package/dist/{chunk-AQTBSL7R.js → chunk-LL2NIVUR.js} +14 -7
  103. package/dist/chunk-LL2NIVUR.js.map +1 -0
  104. package/dist/chunk-LP7BEXCT.js +32 -0
  105. package/dist/chunk-LP7BEXCT.js.map +1 -0
  106. package/dist/{chunk-5O3AOPDT.js → chunk-MCHVVJIA.js} +443 -467
  107. package/dist/chunk-MCHVVJIA.js.map +1 -0
  108. package/dist/chunk-NO272T7Q.js +194 -0
  109. package/dist/chunk-NO272T7Q.js.map +1 -0
  110. package/dist/{chunk-LFLXAY2W.js → chunk-NUEQU36L.js} +71 -93
  111. package/dist/chunk-NUEQU36L.js.map +1 -0
  112. package/dist/chunk-O45M6LDB.js +38 -0
  113. package/dist/chunk-O45M6LDB.js.map +1 -0
  114. package/dist/{chunk-PSMV73A5.js → chunk-OBKWYKYC.js} +5 -5
  115. package/dist/{chunk-CMGR4ZEW.js → chunk-OHHKHSJP.js} +2 -2
  116. package/dist/{chunk-HCIPRAGS.js → chunk-OT76OZL6.js} +2 -2
  117. package/dist/{chunk-ITNUCOXM.js → chunk-OVYRLHPE.js} +7 -5
  118. package/dist/{chunk-ITNUCOXM.js.map → chunk-OVYRLHPE.js.map} +1 -1
  119. package/dist/{chunk-SMXWYP24.js → chunk-OXCSVM3B.js} +3 -3
  120. package/dist/{chunk-IGUYVGGI.js → chunk-P33LUIML.js} +3 -3
  121. package/dist/{chunk-JNUWZ6D3.js → chunk-PLS64NCS.js} +7 -5
  122. package/dist/{chunk-JNUWZ6D3.js.map → chunk-PLS64NCS.js.map} +1 -1
  123. package/dist/{chunk-EIZUR2XW.js → chunk-PS2NEWEX.js} +2 -2
  124. package/dist/chunk-QA2KUPCP.js +45 -0
  125. package/dist/chunk-QA2KUPCP.js.map +1 -0
  126. package/dist/{chunk-WYSO2NIH.js → chunk-QOC3VYL2.js} +2 -2
  127. package/dist/{chunk-FISN7WE4.js → chunk-QSFOZUYL.js} +30 -5
  128. package/dist/{chunk-FISN7WE4.js.map → chunk-QSFOZUYL.js.map} +1 -1
  129. package/dist/{chunk-KVOXU4T5.js → chunk-RHK32N73.js} +2 -2
  130. package/dist/{chunk-3YFXJ3ZP.js → chunk-RW3Y22MW.js} +2 -2
  131. package/dist/{chunk-ZYUC53LT.js → chunk-S7VFUQM2.js} +117 -3
  132. package/dist/chunk-S7VFUQM2.js.map +1 -0
  133. package/dist/chunk-T7WSLRAU.js +49 -0
  134. package/dist/chunk-T7WSLRAU.js.map +1 -0
  135. package/dist/{chunk-IUEN57TV.js → chunk-TAKWLZZX.js} +280 -58
  136. package/dist/chunk-TAKWLZZX.js.map +1 -0
  137. package/dist/chunk-THNJ3IKU.js +17 -0
  138. package/dist/chunk-THNJ3IKU.js.map +1 -0
  139. package/dist/{chunk-MTMJVJ5W.js → chunk-TMBXVJKT.js} +5 -3
  140. package/dist/chunk-TMBXVJKT.js.map +1 -0
  141. package/dist/{chunk-QHJW5EXU.js → chunk-TWKKOM55.js} +2 -2
  142. package/dist/{chunk-M6OST55S.js → chunk-U3WZCU7E.js} +2 -2
  143. package/dist/{chunk-AIWULCUO.js → chunk-UF362QVH.js} +5 -3
  144. package/dist/{chunk-AIWULCUO.js.map → chunk-UF362QVH.js.map} +1 -1
  145. package/dist/{chunk-KXGNJJXB.js → chunk-UN4FVIBH.js} +7 -7
  146. package/dist/chunk-VEAVKDDB.js +29 -0
  147. package/dist/chunk-VEAVKDDB.js.map +1 -0
  148. package/dist/chunk-VEPTFUJY.js +29 -0
  149. package/dist/chunk-VEPTFUJY.js.map +1 -0
  150. package/dist/{chunk-TEILUWOI.js → chunk-VJV7GKQK.js} +10 -12
  151. package/dist/chunk-VJV7GKQK.js.map +1 -0
  152. package/dist/chunk-VQRAIPYF.js +50 -0
  153. package/dist/chunk-VQRAIPYF.js.map +1 -0
  154. package/dist/{chunk-NF5JWERG.js → chunk-VRIYFLBA.js} +2 -2
  155. package/dist/chunk-VWM3DAVB.js +265 -0
  156. package/dist/chunk-VWM3DAVB.js.map +1 -0
  157. package/dist/{chunk-RUEKROOS.js → chunk-VWRRVE6D.js} +2 -2
  158. package/dist/chunk-VYYM3MEN.js +98 -0
  159. package/dist/chunk-VYYM3MEN.js.map +1 -0
  160. package/dist/chunk-WBJIQSLL.js +167 -0
  161. package/dist/chunk-WBJIQSLL.js.map +1 -0
  162. package/dist/{chunk-XXYIOFUB.js → chunk-WIGQB62E.js} +5 -5
  163. package/dist/chunk-WZSCE6RM.js +466 -0
  164. package/dist/chunk-WZSCE6RM.js.map +1 -0
  165. package/dist/{chunk-5R3ERCDH.js → chunk-XGDAPN6M.js} +25 -9
  166. package/dist/{chunk-5R3ERCDH.js.map → chunk-XGDAPN6M.js.map} +1 -1
  167. package/dist/{chunk-DFEMTNPJ.js → chunk-XH7XP3OL.js} +8 -6
  168. package/dist/{chunk-DFEMTNPJ.js.map → chunk-XH7XP3OL.js.map} +1 -1
  169. package/dist/{chunk-IAGBDSCS.js → chunk-XREOISSI.js} +2 -2
  170. package/dist/chunk-XUBPSPKD.js +164 -0
  171. package/dist/chunk-XUBPSPKD.js.map +1 -0
  172. package/dist/chunk-Y3A5CB5G.js +247 -0
  173. package/dist/chunk-Y3A5CB5G.js.map +1 -0
  174. package/dist/{chunk-ZCGAHGUS.js → chunk-YCXCR7VG.js} +2 -2
  175. package/dist/{chunk-76722EBH.js → chunk-YMVQD5Q5.js} +11 -9
  176. package/dist/{chunk-76722EBH.js.map → chunk-YMVQD5Q5.js.map} +1 -1
  177. package/dist/{chunk-5TDJ56JE.js → chunk-YN5IAHN6.js} +1 -1
  178. package/dist/chunk-YN5IAHN6.js.map +1 -0
  179. package/dist/{chunk-TJYQIGAP.js → chunk-ZYJ55N7N.js} +9 -5
  180. package/dist/chunk-ZYJ55N7N.js.map +1 -0
  181. package/dist/classified/index.d.ts +16 -0
  182. package/dist/classified/index.js +40 -0
  183. package/dist/classified-marker-H6YSHYNK.js +24 -0
  184. package/dist/classified-marker-H6YSHYNK.js.map +1 -0
  185. package/dist/collection-facade-LVD22JLM.js +39 -0
  186. package/dist/computed-EXDMQODG.js +11 -0
  187. package/dist/consent/index.d.ts +3 -4
  188. package/dist/consent/index.js +10 -4
  189. package/dist/consent/index.js.map +1 -1
  190. package/dist/crdt/index.d.ts +3 -4
  191. package/dist/dead-filter-HQIE2YG7.js +28 -0
  192. package/dist/dead-filter-HQIE2YG7.js.map +1 -0
  193. package/dist/delegation-BJP73GAP.js +25 -0
  194. package/dist/derivations/index.d.ts +4 -5
  195. package/dist/derivations/index.js +13 -6
  196. package/dist/derive-BME7HDWO.js +21 -0
  197. package/dist/{dev-unlock-C9Ro3v_O.d.ts → dev-unlock-Bmm2pgJ0.d.ts} +1 -1
  198. package/dist/{enclave-UL5LW66V.js → enclave-NHORSWSF.js} +55 -18
  199. package/dist/executor-FE6X4LFX.js +9 -0
  200. package/dist/executor-KSHKRJXP.js +25 -0
  201. package/dist/executor-ZHTJJICG.js +9 -0
  202. package/dist/export-accessible-DACHM5VT.js +23 -0
  203. package/dist/extract-partition-RNENZZ4T.js +36 -0
  204. package/dist/{fanout-sidecar-GF3DJ6KR.js → fanout-sidecar-OFWN3NM7.js} +17 -14
  205. package/dist/fanout-sidecar-OFWN3NM7.js.map +1 -0
  206. package/dist/fence-watcher-DHQ775JB.js +69 -0
  207. package/dist/fence-watcher-DHQ775JB.js.map +1 -0
  208. package/dist/find-BNGBJNKP.js +11 -0
  209. package/dist/forget/index.d.ts +2 -2
  210. package/dist/forget/index.js +10 -4
  211. package/dist/forget/index.js.map +1 -1
  212. package/dist/guards/index.d.ts +4 -5
  213. package/dist/guards/index.js +4 -4
  214. package/dist/{hash-Cp5uwiox.d.ts → hash-DAJjMsCE.d.ts} +7 -2
  215. package/dist/history/index.d.ts +4 -5
  216. package/dist/history/index.js +12 -6
  217. package/dist/history/index.js.map +1 -1
  218. package/dist/i18n/index.d.ts +24 -5
  219. package/dist/i18n/index.js +50 -31
  220. package/dist/i18n/index.js.map +1 -1
  221. package/dist/in/index.d.ts +2 -3
  222. package/dist/{index-BzUo1B6n.d.ts → index-DjWbxsjb.d.ts} +8596 -5747
  223. package/dist/{index-BF9_96A5.d.ts → index-qwuNvO2B.d.ts} +26 -5
  224. package/dist/index.d.ts +116 -24
  225. package/dist/index.js +1479 -139
  226. package/dist/index.js.map +1 -1
  227. package/dist/indexing/index.d.ts +3 -4
  228. package/dist/indexing/index.js +4 -4
  229. package/dist/issue-NDI4CVZU.js +19 -0
  230. package/dist/json-schema-I22JCYCG.js +44 -0
  231. package/dist/json-schema-I22JCYCG.js.map +1 -0
  232. package/dist/lazy/index.d.ts +20 -0
  233. package/dist/lazy/index.js +12 -0
  234. package/dist/{ledger-RYI35CDS.js → ledger-6NDS2EO4.js} +12 -6
  235. package/dist/liberate-HN3RIGIP.js +24 -0
  236. package/dist/link-set-SJB2MVJV.js +31 -0
  237. package/dist/materialized-views/index.d.ts +22 -6
  238. package/dist/materialized-views/index.js +20 -10
  239. package/dist/{mime-magic-CGhw37_E.d.ts → mime-magic-bBj5OgUC.d.ts} +1 -1
  240. package/dist/noydb-BWF6EPIR.js +66 -0
  241. package/dist/on/index.d.ts +2 -3
  242. package/dist/on/index.js +10 -4
  243. package/dist/overlay-views/index.d.ts +4 -5
  244. package/dist/overlay-views/index.js +4 -4
  245. package/dist/periods/index.d.ts +3 -4
  246. package/dist/periods/index.js +21 -7
  247. package/dist/pod/index.d.ts +3 -4
  248. package/dist/pod/index.js +12 -6
  249. package/dist/{policy-IXK4FVXP.js → policy-WGNAG5H6.js} +5 -5
  250. package/dist/portability/index.d.ts +3 -4
  251. package/dist/portability/index.js +8 -8
  252. package/dist/post-register-CWKBQRC7.js +55 -0
  253. package/dist/post-register-CWKBQRC7.js.map +1 -0
  254. package/dist/{public-envelope-JHDQCPSX.js → public-envelope-EJLVIFX7.js} +4 -4
  255. package/dist/query/index.d.ts +2 -3
  256. package/dist/query/index.js +9 -6
  257. package/dist/{read-only-facade-5ADRJVTM.js → read-only-facade-CHCKSEPD.js} +2 -2
  258. package/dist/register-SBIX7TVV.js +23 -0
  259. package/dist/registry-3EQG6OOE.js +18 -0
  260. package/dist/registry-CA327ACV.js +9 -0
  261. package/dist/registry-E7OXOTSV.js +19 -0
  262. package/dist/request-withdrawal-KAH2AAXC.js +31 -0
  263. package/dist/reveal-R3JLHMUF.js +38 -0
  264. package/dist/reveal-R3JLHMUF.js.map +1 -0
  265. package/dist/revoke-IXLOJ3IH.js +24 -0
  266. package/dist/satellites/index.d.ts +4 -0
  267. package/dist/satellites/index.js +8 -0
  268. package/dist/sealed-record/index.d.ts +3 -4
  269. package/dist/sealed-record/index.js +13 -7
  270. package/dist/sealed-record/index.js.map +1 -1
  271. package/dist/session/index.d.ts +4 -5
  272. package/dist/session/index.js +10 -4
  273. package/dist/session/index.js.map +1 -1
  274. package/dist/shadow/index.d.ts +3 -4
  275. package/dist/shadow/index.js +2 -2
  276. package/dist/signer-Y46N2GJ3.js +25 -0
  277. package/dist/signer-Y46N2GJ3.js.map +1 -0
  278. package/dist/snapshots/index.d.ts +3 -4
  279. package/dist/snapshots/index.js +11 -5
  280. package/dist/snapshots/index.js.map +1 -1
  281. package/dist/{stale-3JWHNDIY.js → stale-Z7IW6RIL.js} +2 -2
  282. package/dist/stale-Z7IW6RIL.js.map +1 -0
  283. package/dist/storage-ADNP2UWI.js +23 -0
  284. package/dist/storage-ADNP2UWI.js.map +1 -0
  285. package/dist/{store-coordination-provider-3I7XWZZK.js → store-coordination-provider-DTDMI6VL.js} +3 -3
  286. package/dist/{subject-index-O75wKshW.d.ts → subject-index-CyOgGMJL.d.ts} +18 -0
  287. package/dist/sync/index.d.ts +2 -3
  288. package/dist/sync/index.js +10 -4
  289. package/dist/sync/index.js.map +1 -1
  290. package/dist/team/index.d.ts +45 -7
  291. package/dist/team/index.js +25 -12
  292. package/dist/tiers/index.d.ts +2 -3
  293. package/dist/tiers/index.js +11 -5
  294. package/dist/to/index.d.ts +2 -3
  295. package/dist/to/index.js +1 -2
  296. package/dist/{transition-guard-C7ol6oPw.d.ts → transition-guard-DI-krBsZ.d.ts} +1 -1
  297. package/dist/tx/index.d.ts +3 -4
  298. package/dist/tx/index.js +3 -3
  299. package/dist/ui/index.d.ts +4 -1
  300. package/dist/util/index.js +1 -1
  301. package/dist/validators-BUcli5Nh.d.ts +101 -0
  302. package/dist/{vault-diff-B5fYNBL7.d.ts → vault-diff-Z2DUayMe.d.ts} +1 -1
  303. package/dist/verify-JPF2YR5E.js +139 -0
  304. package/dist/verify-JPF2YR5E.js.map +1 -0
  305. package/dist/walk-XYA2O3LW.js +241 -0
  306. package/dist/walk-XYA2O3LW.js.map +1 -0
  307. package/dist/with/index.d.ts +3 -4
  308. package/dist/with/index.js +12 -6
  309. package/dist/{with-materialized-view-6p0Fk8bL.d.ts → with-materialized-view-BUmzlXue.d.ts} +1 -1
  310. package/dist/{with-overlayed-view-BJ6mXGMd.d.ts → with-overlayed-view-m4FaXXTO.d.ts} +1 -1
  311. package/dist/{with-rollup-BvQo3ROo.d.ts → with-rollup-DEKGI9vb.d.ts} +1 -1
  312. package/dist/withdraw-accessible-WLV4MTEN.js +28 -0
  313. package/dist/withdraw-accessible-WLV4MTEN.js.map +1 -0
  314. package/package.json +16 -16
  315. package/dist/adapter/index.d.ts +0 -5
  316. package/dist/adapter/index.js +0 -15
  317. package/dist/api-RW3KP7WU.js +0 -14
  318. package/dist/backup-XV3IOEGB.js.map +0 -1
  319. package/dist/chunk-26LGBE4T.js +0 -42
  320. package/dist/chunk-26LGBE4T.js.map +0 -1
  321. package/dist/chunk-5LUY7UTV.js.map +0 -1
  322. package/dist/chunk-5O3AOPDT.js.map +0 -1
  323. package/dist/chunk-5R5JW2JT.js.map +0 -1
  324. package/dist/chunk-5TDJ56JE.js.map +0 -1
  325. package/dist/chunk-62QYRORB.js.map +0 -1
  326. package/dist/chunk-AQTBSL7R.js.map +0 -1
  327. package/dist/chunk-BG3SPSR4.js.map +0 -1
  328. package/dist/chunk-BGIZAFY7.js +0 -1
  329. package/dist/chunk-DGDI2D4M.js.map +0 -1
  330. package/dist/chunk-I3TIKTJO.js.map +0 -1
  331. package/dist/chunk-IELYAOGG.js.map +0 -1
  332. package/dist/chunk-IPB7FTQX.js.map +0 -1
  333. package/dist/chunk-IUEN57TV.js.map +0 -1
  334. package/dist/chunk-K2WCO3NX.js +0 -1
  335. package/dist/chunk-LFLXAY2W.js.map +0 -1
  336. package/dist/chunk-LV7M27WM.js.map +0 -1
  337. package/dist/chunk-M2YKN37S.js +0 -524
  338. package/dist/chunk-M2YKN37S.js.map +0 -1
  339. package/dist/chunk-MTMJVJ5W.js.map +0 -1
  340. package/dist/chunk-Q7SS3IME.js +0 -120
  341. package/dist/chunk-Q7SS3IME.js.map +0 -1
  342. package/dist/chunk-RUIMKQTA.js.map +0 -1
  343. package/dist/chunk-SRB2XEWB.js.map +0 -1
  344. package/dist/chunk-TEILUWOI.js.map +0 -1
  345. package/dist/chunk-TJYQIGAP.js.map +0 -1
  346. package/dist/chunk-UIU2THRG.js.map +0 -1
  347. package/dist/chunk-UPJNJGGA.js.map +0 -1
  348. package/dist/chunk-WWGT2MDV.js.map +0 -1
  349. package/dist/chunk-Y22T3KQE.js.map +0 -1
  350. package/dist/chunk-ZYUC53LT.js.map +0 -1
  351. package/dist/collection-facade-GQAOGJP2.js +0 -33
  352. package/dist/delegation-UL5HKLER.js +0 -19
  353. package/dist/describe/index.d.ts +0 -1
  354. package/dist/describe/index.js +0 -1
  355. package/dist/describe-aBkJR2sd.d.ts +0 -131
  356. package/dist/executor-2FWQRLMG.js +0 -15
  357. package/dist/executor-QZ7BXICW.js +0 -9
  358. package/dist/executor-Z5ZLJVTV.js +0 -9
  359. package/dist/export-accessible-KRV5W4GH.js +0 -17
  360. package/dist/extract-partition-GLKBOXFQ.js +0 -30
  361. package/dist/fanout-sidecar-GF3DJ6KR.js.map +0 -1
  362. package/dist/issue-Y6UVIR43.js +0 -13
  363. package/dist/kernel/index.d.ts +0 -32
  364. package/dist/kernel/index.js +0 -53
  365. package/dist/liberate-CRPZEV7O.js +0 -18
  366. package/dist/noydb-367AM4HT.js +0 -50
  367. package/dist/registry-45RJNWGU.js +0 -9
  368. package/dist/registry-5GRV5VXI.js +0 -13
  369. package/dist/registry-WEUCHBO4.js +0 -11
  370. package/dist/request-withdrawal-GBPH2FDY.js +0 -25
  371. package/dist/revoke-TUFRGI6S.js +0 -18
  372. package/dist/signer-PNKTBVF7.js +0 -19
  373. package/dist/withdraw-accessible-FFS46EOD.js +0 -22
  374. /package/dist/{adapter/index.js.map → api-TX2EX2FX.js.map} +0 -0
  375. /package/dist/{chunk-5N6CZTCY.js.map → chunk-2OZXVKVP.js.map} +0 -0
  376. /package/dist/{chunk-UAG5KWVA.js.map → chunk-3MATJ6O4.js.map} +0 -0
  377. /package/dist/{chunk-AZAOEIKW.js.map → chunk-5YESYH2C.js.map} +0 -0
  378. /package/dist/{chunk-VCTFO5CO.js.map → chunk-6P5XCKSD.js.map} +0 -0
  379. /package/dist/{chunk-IO6GRPT6.js.map → chunk-7BWJHO2A.js.map} +0 -0
  380. /package/dist/{chunk-UDRIWL7A.js.map → chunk-BKARNZJN.js.map} +0 -0
  381. /package/dist/{chunk-V7RWQRG7.js.map → chunk-CB7CWSKW.js.map} +0 -0
  382. /package/dist/{chunk-CWPPNPOH.js.map → chunk-DJ7KIPLV.js.map} +0 -0
  383. /package/dist/{chunk-TA66UMI4.js.map → chunk-F4CEK5YM.js.map} +0 -0
  384. /package/dist/{chunk-SM3AVUHC.js.map → chunk-G4JYND6L.js.map} +0 -0
  385. /package/dist/{chunk-AXRXJTE2.js.map → chunk-G6XV4H65.js.map} +0 -0
  386. /package/dist/{chunk-UV5MFVO3.js.map → chunk-HPWKV3YB.js.map} +0 -0
  387. /package/dist/{chunk-SKF73JOP.js.map → chunk-ICXIFFYZ.js.map} +0 -0
  388. /package/dist/{chunk-LMTH2RM6.js.map → chunk-KNZB6JMR.js.map} +0 -0
  389. /package/dist/{chunk-PKHL44ER.js.map → chunk-LEJIKBBB.js.map} +0 -0
  390. /package/dist/{chunk-PSMV73A5.js.map → chunk-OBKWYKYC.js.map} +0 -0
  391. /package/dist/{chunk-CMGR4ZEW.js.map → chunk-OHHKHSJP.js.map} +0 -0
  392. /package/dist/{chunk-HCIPRAGS.js.map → chunk-OT76OZL6.js.map} +0 -0
  393. /package/dist/{chunk-SMXWYP24.js.map → chunk-OXCSVM3B.js.map} +0 -0
  394. /package/dist/{chunk-IGUYVGGI.js.map → chunk-P33LUIML.js.map} +0 -0
  395. /package/dist/{chunk-EIZUR2XW.js.map → chunk-PS2NEWEX.js.map} +0 -0
  396. /package/dist/{chunk-WYSO2NIH.js.map → chunk-QOC3VYL2.js.map} +0 -0
  397. /package/dist/{chunk-KVOXU4T5.js.map → chunk-RHK32N73.js.map} +0 -0
  398. /package/dist/{chunk-3YFXJ3ZP.js.map → chunk-RW3Y22MW.js.map} +0 -0
  399. /package/dist/{chunk-QHJW5EXU.js.map → chunk-TWKKOM55.js.map} +0 -0
  400. /package/dist/{chunk-M6OST55S.js.map → chunk-U3WZCU7E.js.map} +0 -0
  401. /package/dist/{chunk-KXGNJJXB.js.map → chunk-UN4FVIBH.js.map} +0 -0
  402. /package/dist/{chunk-NF5JWERG.js.map → chunk-VRIYFLBA.js.map} +0 -0
  403. /package/dist/{chunk-RUEKROOS.js.map → chunk-VWRRVE6D.js.map} +0 -0
  404. /package/dist/{chunk-XXYIOFUB.js.map → chunk-WIGQB62E.js.map} +0 -0
  405. /package/dist/{chunk-IAGBDSCS.js.map → chunk-XREOISSI.js.map} +0 -0
  406. /package/dist/{chunk-ZCGAHGUS.js.map → chunk-YCXCR7VG.js.map} +0 -0
  407. /package/dist/{describe → classified}/index.js.map +0 -0
  408. /package/dist/{api-RW3KP7WU.js.map → collection-facade-LVD22JLM.js.map} +0 -0
  409. /package/dist/{chunk-BGIZAFY7.js.map → computed-EXDMQODG.js.map} +0 -0
  410. /package/dist/{chunk-K2WCO3NX.js.map → delegation-BJP73GAP.js.map} +0 -0
  411. /package/dist/{collection-facade-GQAOGJP2.js.map → derive-BME7HDWO.js.map} +0 -0
  412. /package/dist/{delegation-UL5HKLER.js.map → enclave-NHORSWSF.js.map} +0 -0
  413. /package/dist/{enclave-UL5LW66V.js.map → executor-FE6X4LFX.js.map} +0 -0
  414. /package/dist/{executor-2FWQRLMG.js.map → executor-KSHKRJXP.js.map} +0 -0
  415. /package/dist/{executor-QZ7BXICW.js.map → executor-ZHTJJICG.js.map} +0 -0
  416. /package/dist/{executor-Z5ZLJVTV.js.map → export-accessible-DACHM5VT.js.map} +0 -0
  417. /package/dist/{export-accessible-KRV5W4GH.js.map → extract-partition-RNENZZ4T.js.map} +0 -0
  418. /package/dist/{extract-partition-GLKBOXFQ.js.map → find-BNGBJNKP.js.map} +0 -0
  419. /package/dist/{issue-Y6UVIR43.js.map → issue-NDI4CVZU.js.map} +0 -0
  420. /package/dist/{kernel → lazy}/index.js.map +0 -0
  421. /package/dist/{ledger-RYI35CDS.js.map → ledger-6NDS2EO4.js.map} +0 -0
  422. /package/dist/{liberate-CRPZEV7O.js.map → liberate-HN3RIGIP.js.map} +0 -0
  423. /package/dist/{noydb-367AM4HT.js.map → link-set-SJB2MVJV.js.map} +0 -0
  424. /package/dist/{policy-IXK4FVXP.js.map → noydb-BWF6EPIR.js.map} +0 -0
  425. /package/dist/{public-envelope-JHDQCPSX.js.map → policy-WGNAG5H6.js.map} +0 -0
  426. /package/dist/{read-only-facade-5ADRJVTM.js.map → public-envelope-EJLVIFX7.js.map} +0 -0
  427. /package/dist/{registry-45RJNWGU.js.map → read-only-facade-CHCKSEPD.js.map} +0 -0
  428. /package/dist/{registry-5GRV5VXI.js.map → register-SBIX7TVV.js.map} +0 -0
  429. /package/dist/{registry-WEUCHBO4.js.map → registry-3EQG6OOE.js.map} +0 -0
  430. /package/dist/{request-withdrawal-GBPH2FDY.js.map → registry-CA327ACV.js.map} +0 -0
  431. /package/dist/{revoke-TUFRGI6S.js.map → registry-E7OXOTSV.js.map} +0 -0
  432. /package/dist/{signer-PNKTBVF7.js.map → request-withdrawal-KAH2AAXC.js.map} +0 -0
  433. /package/dist/{stale-3JWHNDIY.js.map → revoke-IXLOJ3IH.js.map} +0 -0
  434. /package/dist/{withdraw-accessible-FFS46EOD.js.map → satellites/index.js.map} +0 -0
  435. /package/dist/{store-coordination-provider-3I7XWZZK.js.map → store-coordination-provider-DTDMI6VL.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  hasExportCapability,
3
3
  hasImportCapability
4
- } from "./chunk-WWGT2MDV.js";
4
+ } from "./chunk-J4LPNIGK.js";
5
5
  import {
6
6
  ExportCapabilityError,
7
7
  ImportCapabilityError
8
- } from "./chunk-ZYUC53LT.js";
8
+ } from "./chunk-S7VFUQM2.js";
9
9
 
10
10
  // src/port/with/capabilities.ts
11
11
  function assertCanExport(keyring, tier, format) {
@@ -185,18 +185,23 @@ var ServiceBus = class {
185
185
  this.#depth--;
186
186
  }
187
187
  }
188
- /** Register a write-gating handler. A throw from the handler ABORTS the write. Returns an unsubscribe fn. */
189
- registerGate(point, handler) {
188
+ /**
189
+ * Register a write-gating handler. A throw from the handler ABORTS the
190
+ * write. Returns an unsubscribe fn. See {@link GateRegisterOptions} for
191
+ * the `needsPrior` prior-read declaration (#267).
192
+ */
193
+ registerGate(point, handler, opts) {
190
194
  let arr = this.#gateHandlers.get(point);
191
195
  if (!arr) {
192
196
  arr = [];
193
197
  this.#gateHandlers.set(point, arr);
194
198
  }
195
- arr.push(handler);
199
+ const entry = { fn: handler, needsPrior: opts?.needsPrior !== false };
200
+ arr.push(entry);
196
201
  return () => {
197
202
  const a = this.#gateHandlers.get(point);
198
203
  if (!a) return;
199
- const i = a.indexOf(handler);
204
+ const i = a.indexOf(entry);
200
205
  if (i >= 0) a.splice(i, 1);
201
206
  };
202
207
  }
@@ -205,6 +210,17 @@ var ServiceBus = class {
205
210
  const a = this.#gateHandlers.get(point);
206
211
  return a !== void 0 && a.length > 0;
207
212
  }
213
+ /**
214
+ * True when at least one gate handler at `point` needs the prior record
215
+ * (the default). False when the point has no handlers or every handler
216
+ * registered with `needsPrior: false` — the write path then skips the
217
+ * prior-read before dispatching (#267 prior-read elision).
218
+ */
219
+ gateNeedsPrior(point) {
220
+ const a = this.#gateHandlers.get(point);
221
+ if (!a) return false;
222
+ return a.some((e) => e.needsPrior);
223
+ }
208
224
  /**
209
225
  * Run gate handlers in registration order, awaited. Unlike `dispatch`
210
226
  * (observe), a handler throw is NOT swallowed — it PROPAGATES, aborting the
@@ -220,8 +236,8 @@ var ServiceBus = class {
220
236
  async dispatchGate(point, event) {
221
237
  const a = this.#gateHandlers.get(point);
222
238
  if (!a || a.length === 0) return;
223
- for (const h of a.slice()) {
224
- await h(event);
239
+ for (const e of a.slice()) {
240
+ await e.fn(event);
225
241
  }
226
242
  }
227
243
  };
@@ -236,4 +252,4 @@ export {
236
252
  ServiceBus,
237
253
  SubsystemBus
238
254
  };
239
- //# sourceMappingURL=chunk-5R3ERCDH.js.map
255
+ //# sourceMappingURL=chunk-XGDAPN6M.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/port/with/capabilities.ts","../src/port/with/write-hooks.ts","../src/port/with/service-bus.ts"],"sourcesContent":["/**\n * Export/import capability gating.\n *\n * Pure predicates over a keyring's `exportCapability` / `importCapability`: the\n * `assert*` variants throw {@link ExportCapabilityError} / {@link ImportCapabilityError}\n * when the invoking keyring is not authorised; the `can*` variants return a\n * boolean for UI affordances. They wrap the role-default resolution in\n * {@link hasExportCapability} / {@link hasImportCapability}. Behaviour is\n * byte-identical to the inline `Vault` methods they replaced — every dependency\n * is the unlocked keyring, passed in. `Vault` keeps the typed (overloaded)\n * public methods and delegates here.\n *\n * Internal — reached through `vault.assertCanExport(...)` etc.\n */\nimport { ExportCapabilityError, ImportCapabilityError } from '../../kernel/errors.js'\nimport { hasExportCapability, hasImportCapability } from '../../with-party/team/keyring.js'\nimport type { UnlockedKeyring } from '../../with-party/team/keyring.js'\nimport type { ExportFormat } from '../../kernel/types.js'\n\n/**\n * Authorize an `@noy-db/as-*` export against the keyring's `exportCapability`.\n * Throws `ExportCapabilityError` if the keyring is not authorised.\n *\n * - plaintext tier requires a `format`; defaults to empty for every role.\n * - bundle tier defaults to on for owner/admin, off for others.\n */\nexport function assertCanExport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): void {\n if (tier === 'plaintext') {\n if (format === undefined) {\n throw new Error('vault.assertCanExport: plaintext tier requires a format')\n }\n if (!hasExportCapability(keyring, 'plaintext', format)) {\n throw new ExportCapabilityError({\n tier: 'plaintext',\n userId: keyring.userId,\n format,\n })\n }\n return\n }\n if (!hasExportCapability(keyring, 'bundle')) {\n throw new ExportCapabilityError({\n tier: 'bundle',\n userId: keyring.userId,\n })\n }\n}\n\n/**\n * Authorize an `@noy-db/as-*` import against the keyring's `importCapability`.\n * Throws `ImportCapabilityError` if the keyring is not authorised.\n *\n * - plaintext tier requires a `format`; default-closed for every role.\n * - bundle tier is default-closed for every role, including owner — import is\n * more dangerous than export (corrupts vs leaks).\n */\nexport function assertCanImport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): void {\n if (tier === 'plaintext') {\n if (format === undefined) {\n throw new Error('vault.assertCanImport: plaintext tier requires a format')\n }\n if (!hasImportCapability(keyring, 'plaintext', format)) {\n throw new ImportCapabilityError({\n tier: 'plaintext',\n userId: keyring.userId,\n format,\n })\n }\n return\n }\n if (!hasImportCapability(keyring, 'bundle')) {\n throw new ImportCapabilityError({\n tier: 'bundle',\n userId: keyring.userId,\n })\n }\n}\n\n/**\n * Read-only accessor for the keyring's export capability, with role-based\n * defaults resolved. Useful for UI affordances (grey out the export button if\n * no capability) without throwing.\n */\nexport function canExport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): boolean {\n if (tier === 'plaintext') {\n if (format === undefined) return false\n return hasExportCapability(keyring, 'plaintext', format)\n }\n return hasExportCapability(keyring, 'bundle')\n}\n\n/**\n * Read-only accessor for the keyring's import capability. UI affordance —\n * returns false in every default-closed case (every role with no explicit\n * `importCapability` grant).\n */\nexport function canImport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): boolean {\n if (tier === 'plaintext') {\n if (format === undefined) return false\n return hasImportCapability(keyring, 'plaintext', format)\n }\n return hasImportCapability(keyring, 'bundle')\n}\n","/**\n * Hub-level write lifecycle hooks. `onBeforeWrite` may abort (throw);\n * `onAfterWrite` is awaited and its errors are warned, not thrown. A\n * re-entrancy flag suppresses nested firing so a handler that writes can't\n * loop. Held on the Noydb instance, threaded into every Collection.\n */\nexport interface WriteEvent {\n readonly op: 'create' | 'update' | 'delete'\n readonly vault: string\n readonly collection: string\n readonly docId: string\n readonly before: unknown // decrypted prior record; null on 'create'\n readonly after: unknown // the record written; null on 'delete'\n readonly baseVersion: number // version the writer started from (0 on create)\n readonly version: number // version the writer wrote (baseVersion + 1)\n readonly userId: string\n readonly timestamp: number\n readonly txId: string\n}\n\nexport type WriteHook = (event: WriteEvent) => void | Promise<void>\nexport type Unsubscribe = () => void\n\nexport class WriteHookRegistry {\n readonly #before: WriteHook[] = []\n readonly #after: WriteHook[] = []\n #suppressed = false\n\n /** True while handlers are running — used by the write path to skip nested firing. */\n get suppressed(): boolean { return this.#suppressed }\n\n /** True when any hook is registered (cheap gate for the write path). */\n get hasHandlers(): boolean { return this.#before.length > 0 || this.#after.length > 0 }\n\n onBeforeWrite(handler: WriteHook): Unsubscribe {\n this.#before.push(handler)\n return () => { const i = this.#before.indexOf(handler); if (i >= 0) this.#before.splice(i, 1) }\n }\n\n onAfterWrite(handler: WriteHook): Unsubscribe {\n this.#after.push(handler)\n return () => { const i = this.#after.indexOf(handler); if (i >= 0) this.#after.splice(i, 1) }\n }\n\n /** Run before-hooks (awaited, in order). A throw propagates and aborts the write. */\n async runBefore(event: WriteEvent): Promise<void> {\n if (this.#before.length === 0) return\n this.#suppressed = true\n try {\n for (const h of this.#before.slice()) await h(event)\n } finally {\n this.#suppressed = false\n }\n }\n\n /** Run after-hooks (awaited, in order). Per-handler errors are warned, not thrown. */\n async runAfter(event: WriteEvent): Promise<void> {\n if (this.#after.length === 0) return\n this.#suppressed = true\n try {\n for (const h of this.#after.slice()) {\n try {\n await h(event)\n } catch (err) {\n console.warn(\n `[noy-db] onAfterWrite handler failed for ${event.collection}/${event.docId}: ` +\n (err instanceof Error ? err.message : String(err)),\n )\n }\n }\n } finally {\n this.#suppressed = false\n }\n }\n}\n","/**\n * Generic per-instance **observe** bus. Observe-class\n * services (devtools inspector, audit, sync-dirty notification) register\n * handlers against named lifecycle points instead of the kernel naming each\n * service. Mirrors the registry pattern of {@link WriteHookRegistry} but is\n * internal and keyed by lifecycle point.\n *\n * OBSERVE SEMANTICS: handlers react to a write that already happened. A\n * handler throw is warned, not propagated — it can never abort a write. Write-\n * *gating* services (guards, periods) need a throw-propagating gate bus.\n * Add observe points by extending {@link LifecycleEventMap}. Write-*gating*\n * services use the sibling gate API on this same class\n * (`registerGate`/`dispatchGate`, throw-propagating); see {@link GateEventMap}.\n *\n * @module\n */\nimport type { WriteEvent } from './write-hooks.js'\nimport type { Role } from '../../kernel/types.js'\n\n/** Typed map of OBSERVE lifecycle point → event payload. Extend by adding keys. */\nexport interface LifecycleEventMap {\n afterPut: WriteEvent\n afterDelete: WriteEvent\n}\n\nexport type LifecyclePoint = keyof LifecycleEventMap\nexport type BusHandler<P extends LifecyclePoint> = (event: LifecycleEventMap[P]) => void | Promise<void>\nexport type Unsubscribe = () => void\n\ntype AnyHandler = (event: unknown) => void | Promise<void>\n\n/** Payload for a `beforePut` gate — carries the data guards and periods need to validate or reject a write. */\nexport interface GatePutEvent {\n readonly op: 'create' | 'update'\n readonly vault: string\n readonly collection: string\n readonly docId: string\n /**\n * The record about to be written (pre schema-validation). Money fields\n * are presented in their canonical decoded form — equal on both\n * sides for an unchanged value, regardless of how the caller wrote them.\n */\n readonly incoming: unknown\n /**\n * Decrypted prior record, or null on create / when prior is unreadable.\n * Money fields are decoded to the canonical decimal `get()` shape, NOT\n * the stored scaled-int — `incoming[f] === existing[f]` holds\n * for an unchanged money field.\n */\n readonly existing: unknown\n /** Prior envelope version, or 0 when none. */\n readonly existingVersion: number\n /** Prior envelope timestamp (`_ts` ISO string), or undefined when none — periods compares against this. */\n readonly existingTs: string | undefined\n readonly userId: string\n readonly role: Role\n /**\n * Names of fields whose values are schema-owned computed fields for this\n * collection. Gate handlers (e.g. `frozenFields`) must skip these: the\n * incoming record is the raw user input (computed fields not yet evaluated),\n * so comparing `existing[computedField]` vs `incoming[computedField]`\n * would always see a change even when the computed result is unchanged.\n */\n readonly computedFieldNames?: ReadonlySet<string>\n}\n\n/** Payload for a `beforeDelete` gate. Like {@link GatePutEvent} without `incoming`. */\nexport interface GateDeleteEvent {\n readonly vault: string\n readonly collection: string\n readonly docId: string\n /** True for system-internal (housekeeping) deletes — handlers branch on this. */\n readonly internal: boolean\n /** Decrypted prior record; money fields decoded to the canonical `get()` shape. */\n readonly existing: unknown\n readonly existingVersion: number\n readonly existingTs: string | undefined\n readonly userId: string\n readonly role: Role\n}\n\n/** Typed map of GATE lifecycle point → event payload. Extend by adding keys. */\nexport interface GateEventMap {\n beforePut: GatePutEvent\n beforeDelete: GateDeleteEvent\n}\n\nexport type GatePoint = keyof GateEventMap\nexport type GateHandler<P extends GatePoint> = (event: GateEventMap[P]) => void | Promise<void>\n\nexport class ServiceBus {\n readonly #handlers = new Map<LifecyclePoint, AnyHandler[]>()\n readonly #gateHandlers = new Map<GatePoint, AnyHandler[]>()\n #depth = 0\n\n /** Register a handler for an observe point. Returns an unsubscribe fn. */\n register<P extends LifecyclePoint>(point: P, handler: BusHandler<P>): Unsubscribe {\n let arr = this.#handlers.get(point)\n if (!arr) { arr = []; this.#handlers.set(point, arr) }\n arr.push(handler as AnyHandler)\n return () => {\n const a = this.#handlers.get(point)\n if (!a) return\n const i = a.indexOf(handler as AnyHandler)\n if (i >= 0) a.splice(i, 1)\n }\n }\n\n /** Cheap gate for the write path — true when any handler is registered for the point. */\n hasHandlers(point: LifecyclePoint): boolean {\n const a = this.#handlers.get(point)\n return a !== undefined && a.length > 0\n }\n\n /**\n * True while one or more dispatches are in flight. Backed by a depth counter\n * so that two concurrent async dispatches (`Promise.all([put('a'), put('b')])`\n * each captured `busAfterPut=true` at their respective put() tops while depth\n * was 0) both proceed independently — the counter stays > 0 until BOTH finish,\n * so any nested write attempted by a handler still sees `dispatching === true`\n * and is suppressed by the write-path gate in `collection.ts`\n * (`busAfterPut = hasHandlers('afterPut') && !dispatching`). Re-entrancy\n * suppression lives exclusively on that write-path gate; concurrent independent\n * dispatches must not drop each other's events.\n */\n get dispatching(): boolean { return this.#depth > 0 }\n\n /**\n * Dispatch in registration order, awaited. Per-handler errors are warned, not\n * thrown — an observe handler must never abort a completed write. A\n * re-entrancy guard suppresses nested firing so a handler that itself writes\n * cannot loop (same rationale as WriteHookRegistry.#suppressed).\n */\n async dispatch<P extends LifecyclePoint>(point: P, event: LifecycleEventMap[P]): Promise<void> {\n const a = this.#handlers.get(point)\n if (!a || a.length === 0) return\n this.#depth++\n try {\n for (const h of a.slice()) {\n try {\n await h(event)\n } catch (err) {\n console.warn(\n `[noy-db] service observe handler failed at ${point}: ` +\n (err instanceof Error ? err.message : String(err)),\n )\n }\n }\n } finally {\n this.#depth--\n }\n }\n\n /** Register a write-gating handler. A throw from the handler ABORTS the write. Returns an unsubscribe fn. */\n registerGate<P extends GatePoint>(point: P, handler: GateHandler<P>): Unsubscribe {\n let arr = this.#gateHandlers.get(point)\n if (!arr) { arr = []; this.#gateHandlers.set(point, arr) }\n arr.push(handler as AnyHandler)\n return () => {\n const a = this.#gateHandlers.get(point)\n if (!a) return\n const i = a.indexOf(handler as AnyHandler)\n if (i >= 0) a.splice(i, 1)\n }\n }\n\n /** Cheap gate for the write path — true when any gate handler is registered for the point. */\n hasGateHandlers(point: GatePoint): boolean {\n const a = this.#gateHandlers.get(point)\n return a !== undefined && a.length > 0\n }\n\n /**\n * Run gate handlers in registration order, awaited. Unlike `dispatch`\n * (observe), a handler throw is NOT swallowed — it PROPAGATES, aborting the\n * write before it reaches the store. The first throw stops the remaining\n * handlers (fail-fast). This is the seam guards/periods migrate onto.\n *\n * Note: gate handlers are validators that read, not write. A gate handler\n * that writes back into the same collection would re-enter the write path\n * and re-dispatch this point; loop-suppression for that case is deferred to\n * the migration slice (contract: gate handlers must not perform writes that\n * re-trigger their own point).\n */\n async dispatchGate<P extends GatePoint>(point: P, event: GateEventMap[P]): Promise<void> {\n const a = this.#gateHandlers.get(point)\n if (!a || a.length === 0) return\n for (const h of a.slice()) {\n await h(event) // throw propagates → aborts the write\n }\n }\n}\n\n/** @deprecated Use ServiceBus. */\nexport const SubsystemBus = ServiceBus\n/** @deprecated Use ServiceBus. */\nexport type SubsystemBus = ServiceBus\n"],"mappings":";;;;;;;;;;AA0BO,SAAS,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,UAClD;AAAA,QACF;AAAA,MACF;AAAA,IACF,UAAE;AACA,WAAK;AAAA,IACP;AAAA,EACF;AAAA;AAAA,EAGA,aAAkC,OAAU,SAAsC;AAChF,QAAI,MAAM,KAAK,cAAc,IAAI,KAAK;AACtC,QAAI,CAAC,KAAK;AAAE,YAAM,CAAC;AAAG,WAAK,cAAc,IAAI,OAAO,GAAG;AAAA,IAAE;AACzD,QAAI,KAAK,OAAqB;AAC9B,WAAO,MAAM;AACX,YAAM,IAAI,KAAK,cAAc,IAAI,KAAK;AACtC,UAAI,CAAC,EAAG;AACR,YAAM,IAAI,EAAE,QAAQ,OAAqB;AACzC,UAAI,KAAK,EAAG,GAAE,OAAO,GAAG,CAAC;AAAA,IAC3B;AAAA,EACF;AAAA;AAAA,EAGA,gBAAgB,OAA2B;AACzC,UAAM,IAAI,KAAK,cAAc,IAAI,KAAK;AACtC,WAAO,MAAM,UAAa,EAAE,SAAS;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,aAAkC,OAAU,OAAuC;AACvF,UAAM,IAAI,KAAK,cAAc,IAAI,KAAK;AACtC,QAAI,CAAC,KAAK,EAAE,WAAW,EAAG;AAC1B,eAAW,KAAK,EAAE,MAAM,GAAG;AACzB,YAAM,EAAE,KAAK;AAAA,IACf;AAAA,EACF;AACF;AAGO,IAAM,eAAe;","names":[]}
1
+ {"version":3,"sources":["../src/port/with/capabilities.ts","../src/port/with/write-hooks.ts","../src/port/with/service-bus.ts"],"sourcesContent":["/**\n * Export/import capability gating.\n *\n * Pure predicates over a keyring's `exportCapability` / `importCapability`: the\n * `assert*` variants throw {@link ExportCapabilityError} / {@link ImportCapabilityError}\n * when the invoking keyring is not authorised; the `can*` variants return a\n * boolean for UI affordances. They wrap the role-default resolution in\n * {@link hasExportCapability} / {@link hasImportCapability}. Behaviour is\n * byte-identical to the inline `Vault` methods they replaced — every dependency\n * is the unlocked keyring, passed in. `Vault` keeps the typed (overloaded)\n * public methods and delegates here.\n *\n * Internal — reached through `vault.assertCanExport(...)` etc.\n */\nimport { ExportCapabilityError, ImportCapabilityError } from '../../kernel/errors.js'\nimport { hasExportCapability, hasImportCapability } from '../../with-party/team/keyring.js'\nimport type { UnlockedKeyring } from '../../with-party/team/keyring.js'\nimport type { ExportFormat } from '../../kernel/types.js'\n\n/**\n * Authorize an `@noy-db/as-*` export against the keyring's `exportCapability`.\n * Throws `ExportCapabilityError` if the keyring is not authorised.\n *\n * - plaintext tier requires a `format`; defaults to empty for every role.\n * - bundle tier defaults to on for owner/admin, off for others.\n */\nexport function assertCanExport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): void {\n if (tier === 'plaintext') {\n if (format === undefined) {\n throw new Error('vault.assertCanExport: plaintext tier requires a format')\n }\n if (!hasExportCapability(keyring, 'plaintext', format)) {\n throw new ExportCapabilityError({\n tier: 'plaintext',\n userId: keyring.userId,\n format,\n })\n }\n return\n }\n if (!hasExportCapability(keyring, 'bundle')) {\n throw new ExportCapabilityError({\n tier: 'bundle',\n userId: keyring.userId,\n })\n }\n}\n\n/**\n * Authorize an `@noy-db/as-*` import against the keyring's `importCapability`.\n * Throws `ImportCapabilityError` if the keyring is not authorised.\n *\n * - plaintext tier requires a `format`; default-closed for every role.\n * - bundle tier is default-closed for every role, including owner — import is\n * more dangerous than export (corrupts vs leaks).\n */\nexport function assertCanImport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): void {\n if (tier === 'plaintext') {\n if (format === undefined) {\n throw new Error('vault.assertCanImport: plaintext tier requires a format')\n }\n if (!hasImportCapability(keyring, 'plaintext', format)) {\n throw new ImportCapabilityError({\n tier: 'plaintext',\n userId: keyring.userId,\n format,\n })\n }\n return\n }\n if (!hasImportCapability(keyring, 'bundle')) {\n throw new ImportCapabilityError({\n tier: 'bundle',\n userId: keyring.userId,\n })\n }\n}\n\n/**\n * Read-only accessor for the keyring's export capability, with role-based\n * defaults resolved. Useful for UI affordances (grey out the export button if\n * no capability) without throwing.\n */\nexport function canExport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): boolean {\n if (tier === 'plaintext') {\n if (format === undefined) return false\n return hasExportCapability(keyring, 'plaintext', format)\n }\n return hasExportCapability(keyring, 'bundle')\n}\n\n/**\n * Read-only accessor for the keyring's import capability. UI affordance —\n * returns false in every default-closed case (every role with no explicit\n * `importCapability` grant).\n */\nexport function canImport(keyring: UnlockedKeyring, tier: 'plaintext' | 'bundle', format?: ExportFormat): boolean {\n if (tier === 'plaintext') {\n if (format === undefined) return false\n return hasImportCapability(keyring, 'plaintext', format)\n }\n return hasImportCapability(keyring, 'bundle')\n}\n","/**\n * Hub-level write lifecycle hooks. `onBeforeWrite` may abort (throw);\n * `onAfterWrite` is awaited and its errors are warned, not thrown. A\n * re-entrancy flag suppresses nested firing so a handler that writes can't\n * loop. Held on the Noydb instance, threaded into every Collection.\n */\nexport interface WriteEvent {\n readonly op: 'create' | 'update' | 'delete'\n readonly vault: string\n readonly collection: string\n readonly docId: string\n readonly before: unknown // decrypted prior record; null on 'create'\n readonly after: unknown // the record written; null on 'delete'\n readonly baseVersion: number // version the writer started from (0 on create)\n readonly version: number // version the writer wrote (baseVersion + 1)\n readonly userId: string\n readonly timestamp: number\n readonly txId: string\n}\n\nexport type WriteHook = (event: WriteEvent) => void | Promise<void>\nexport type Unsubscribe = () => void\n\nexport class WriteHookRegistry {\n readonly #before: WriteHook[] = []\n readonly #after: WriteHook[] = []\n #suppressed = false\n\n /** True while handlers are running — used by the write path to skip nested firing. */\n get suppressed(): boolean { return this.#suppressed }\n\n /** True when any hook is registered (cheap gate for the write path). */\n get hasHandlers(): boolean { return this.#before.length > 0 || this.#after.length > 0 }\n\n onBeforeWrite(handler: WriteHook): Unsubscribe {\n this.#before.push(handler)\n return () => { const i = this.#before.indexOf(handler); if (i >= 0) this.#before.splice(i, 1) }\n }\n\n onAfterWrite(handler: WriteHook): Unsubscribe {\n this.#after.push(handler)\n return () => { const i = this.#after.indexOf(handler); if (i >= 0) this.#after.splice(i, 1) }\n }\n\n /** Run before-hooks (awaited, in order). A throw propagates and aborts the write. */\n async runBefore(event: WriteEvent): Promise<void> {\n if (this.#before.length === 0) return\n this.#suppressed = true\n try {\n for (const h of this.#before.slice()) await h(event)\n } finally {\n this.#suppressed = false\n }\n }\n\n /** Run after-hooks (awaited, in order). Per-handler errors are warned, not thrown. */\n async runAfter(event: WriteEvent): Promise<void> {\n if (this.#after.length === 0) return\n this.#suppressed = true\n try {\n for (const h of this.#after.slice()) {\n try {\n await h(event)\n } catch (err) {\n console.warn(\n `[noy-db] onAfterWrite handler failed for ${event.collection}/${event.docId}: ` +\n (err instanceof Error ? err.message : String(err)),\n )\n }\n }\n } finally {\n this.#suppressed = false\n }\n }\n}\n","/**\n * Generic per-instance **observe** bus. Observe-class\n * services (devtools inspector, audit, sync-dirty notification) register\n * handlers against named lifecycle points instead of the kernel naming each\n * service. Mirrors the registry pattern of {@link WriteHookRegistry} but is\n * internal and keyed by lifecycle point.\n *\n * OBSERVE SEMANTICS: handlers react to a write that already happened. A\n * handler throw is warned, not propagated — it can never abort a write. Write-\n * *gating* services (guards, periods) need a throw-propagating gate bus.\n * Add observe points by extending {@link LifecycleEventMap}. Write-*gating*\n * services use the sibling gate API on this same class\n * (`registerGate`/`dispatchGate`, throw-propagating); see {@link GateEventMap}.\n *\n * @module\n */\nimport type { WriteEvent } from './write-hooks.js'\nimport type { Role } from '../../kernel/types.js'\n\n/** Typed map of OBSERVE lifecycle point → event payload. Extend by adding keys. */\nexport interface LifecycleEventMap {\n afterPut: WriteEvent\n afterDelete: WriteEvent\n}\n\nexport type LifecyclePoint = keyof LifecycleEventMap\nexport type BusHandler<P extends LifecyclePoint> = (event: LifecycleEventMap[P]) => void | Promise<void>\nexport type Unsubscribe = () => void\n\ntype AnyHandler = (event: unknown) => void | Promise<void>\n\n/** Payload for a `beforePut` gate — carries the data guards and periods need to validate or reject a write. */\nexport interface GatePutEvent {\n readonly op: 'create' | 'update'\n readonly vault: string\n readonly collection: string\n readonly docId: string\n /**\n * The record about to be written (pre schema-validation). Money fields\n * are presented in their canonical decoded form — equal on both\n * sides for an unchanged value, regardless of how the caller wrote them.\n */\n readonly incoming: unknown\n /**\n * Decrypted prior record, or null on create / when prior is unreadable.\n * Money fields are decoded to the canonical decimal `get()` shape, NOT\n * the stored scaled-int — `incoming[f] === existing[f]` holds\n * for an unchanged money field.\n */\n readonly existing: unknown\n /** Prior envelope version, or 0 when none. */\n readonly existingVersion: number\n /** Prior envelope timestamp (`_ts` ISO string), or undefined when none — periods compares against this. */\n readonly existingTs: string | undefined\n readonly userId: string\n readonly role: Role\n /**\n * Names of fields whose values are schema-owned computed fields for this\n * collection. Gate handlers (e.g. `frozenFields`) must skip these: the\n * incoming record is the raw user input (computed fields not yet evaluated),\n * so comparing `existing[computedField]` vs `incoming[computedField]`\n * would always see a change even when the computed result is unchanged.\n */\n readonly computedFieldNames?: ReadonlySet<string>\n}\n\n/** Payload for a `beforeDelete` gate. Like {@link GatePutEvent} without `incoming`. */\nexport interface GateDeleteEvent {\n readonly vault: string\n readonly collection: string\n readonly docId: string\n /** True for system-internal (housekeeping) deletes — handlers branch on this. */\n readonly internal: boolean\n /** Decrypted prior record; money fields decoded to the canonical `get()` shape. */\n readonly existing: unknown\n readonly existingVersion: number\n readonly existingTs: string | undefined\n readonly userId: string\n readonly role: Role\n}\n\n/** Typed map of GATE lifecycle point → event payload. Extend by adding keys. */\nexport interface GateEventMap {\n beforePut: GatePutEvent\n beforeDelete: GateDeleteEvent\n}\n\nexport type GatePoint = keyof GateEventMap\nexport type GateHandler<P extends GatePoint> = (event: GateEventMap[P]) => void | Promise<void>\n\n/**\n * Registration options for a gate handler.\n *\n * `needsPrior` (default `true`) declares whether the handler reads the\n * prior-derived event fields — `existing`, `existingVersion`, `existingTs`,\n * and (on `beforePut`) `op`. When EVERY handler registered at a point set\n * `needsPrior: false`, the write path skips the prior-read (store get +\n * decrypt) entirely and dispatches the event with `existing: null`,\n * `existingVersion: 0`, `existingTs: undefined` (and `op: 'create'` on\n * `beforePut`; a `beforeDelete` gate then also fires for delete-of-absent).\n * A handler that opts out MUST NOT rely on those fields. (#267 prior-read\n * elision — pure perf; one prior-needing handler restores the old behavior\n * for the whole point.)\n */\nexport interface GateRegisterOptions {\n readonly needsPrior?: boolean\n}\n\ntype GateEntry = { readonly fn: AnyHandler; readonly needsPrior: boolean }\n\nexport class ServiceBus {\n readonly #handlers = new Map<LifecyclePoint, AnyHandler[]>()\n readonly #gateHandlers = new Map<GatePoint, GateEntry[]>()\n #depth = 0\n\n /** Register a handler for an observe point. Returns an unsubscribe fn. */\n register<P extends LifecyclePoint>(point: P, handler: BusHandler<P>): Unsubscribe {\n let arr = this.#handlers.get(point)\n if (!arr) { arr = []; this.#handlers.set(point, arr) }\n arr.push(handler as AnyHandler)\n return () => {\n const a = this.#handlers.get(point)\n if (!a) return\n const i = a.indexOf(handler as AnyHandler)\n if (i >= 0) a.splice(i, 1)\n }\n }\n\n /** Cheap gate for the write path — true when any handler is registered for the point. */\n hasHandlers(point: LifecyclePoint): boolean {\n const a = this.#handlers.get(point)\n return a !== undefined && a.length > 0\n }\n\n /**\n * True while one or more dispatches are in flight. Backed by a depth counter\n * so that two concurrent async dispatches (`Promise.all([put('a'), put('b')])`\n * each captured `busAfterPut=true` at their respective put() tops while depth\n * was 0) both proceed independently — the counter stays > 0 until BOTH finish,\n * so any nested write attempted by a handler still sees `dispatching === true`\n * and is suppressed by the write-path gate in `collection.ts`\n * (`busAfterPut = hasHandlers('afterPut') && !dispatching`). Re-entrancy\n * suppression lives exclusively on that write-path gate; concurrent independent\n * dispatches must not drop each other's events.\n */\n get dispatching(): boolean { return this.#depth > 0 }\n\n /**\n * Dispatch in registration order, awaited. Per-handler errors are warned, not\n * thrown — an observe handler must never abort a completed write. A\n * re-entrancy guard suppresses nested firing so a handler that itself writes\n * cannot loop (same rationale as WriteHookRegistry.#suppressed).\n */\n async dispatch<P extends LifecyclePoint>(point: P, event: LifecycleEventMap[P]): Promise<void> {\n const a = this.#handlers.get(point)\n if (!a || a.length === 0) return\n this.#depth++\n try {\n for (const h of a.slice()) {\n try {\n await h(event)\n } catch (err) {\n console.warn(\n `[noy-db] service observe handler failed at ${point}: ` +\n (err instanceof Error ? err.message : String(err)),\n )\n }\n }\n } finally {\n this.#depth--\n }\n }\n\n /**\n * Register a write-gating handler. A throw from the handler ABORTS the\n * write. Returns an unsubscribe fn. See {@link GateRegisterOptions} for\n * the `needsPrior` prior-read declaration (#267).\n */\n registerGate<P extends GatePoint>(point: P, handler: GateHandler<P>, opts?: GateRegisterOptions): Unsubscribe {\n let arr = this.#gateHandlers.get(point)\n if (!arr) { arr = []; this.#gateHandlers.set(point, arr) }\n const entry: GateEntry = { fn: handler as AnyHandler, needsPrior: opts?.needsPrior !== false }\n arr.push(entry)\n return () => {\n const a = this.#gateHandlers.get(point)\n if (!a) return\n const i = a.indexOf(entry)\n if (i >= 0) a.splice(i, 1)\n }\n }\n\n /** Cheap gate for the write path — true when any gate handler is registered for the point. */\n hasGateHandlers(point: GatePoint): boolean {\n const a = this.#gateHandlers.get(point)\n return a !== undefined && a.length > 0\n }\n\n /**\n * True when at least one gate handler at `point` needs the prior record\n * (the default). False when the point has no handlers or every handler\n * registered with `needsPrior: false` — the write path then skips the\n * prior-read before dispatching (#267 prior-read elision).\n */\n gateNeedsPrior(point: GatePoint): boolean {\n const a = this.#gateHandlers.get(point)\n if (!a) return false\n return a.some((e) => e.needsPrior)\n }\n\n /**\n * Run gate handlers in registration order, awaited. Unlike `dispatch`\n * (observe), a handler throw is NOT swallowed — it PROPAGATES, aborting the\n * write before it reaches the store. The first throw stops the remaining\n * handlers (fail-fast). This is the seam guards/periods migrate onto.\n *\n * Note: gate handlers are validators that read, not write. A gate handler\n * that writes back into the same collection would re-enter the write path\n * and re-dispatch this point; loop-suppression for that case is deferred to\n * the migration slice (contract: gate handlers must not perform writes that\n * re-trigger their own point).\n */\n async dispatchGate<P extends GatePoint>(point: P, event: GateEventMap[P]): Promise<void> {\n const a = this.#gateHandlers.get(point)\n if (!a || a.length === 0) return\n for (const e of a.slice()) {\n await e.fn(event) // throw propagates → aborts the write\n }\n }\n}\n\n/** @deprecated Use ServiceBus. */\nexport const SubsystemBus = ServiceBus\n/** @deprecated Use ServiceBus. */\nexport type SubsystemBus = ServiceBus\n"],"mappings":";;;;;;;;;;AA0BO,SAAS,gBAAgB,SAA0B,MAA8B,QAA6B;AACnH,MAAI,SAAS,aAAa;AACxB,QAAI,WAAW,QAAW;AACxB,YAAM,IAAI,MAAM,yDAAyD;AAAA,IAC3E;AACA,QAAI,CAAC,oBAAoB,SAAS,aAAa,MAAM,GAAG;AACtD,YAAM,IAAI,sBAAsB;AAAA,QAC9B,MAAM;AAAA,QACN,QAAQ,QAAQ;AAAA,QAChB;AAAA,MACF,CAAC;AAAA,IACH;AACA;AAAA,EACF;AACA,MAAI,CAAC,oBAAoB,SAAS,QAAQ,GAAG;AAC3C,UAAM,IAAI,sBAAsB;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB,CAAC;AAAA,EACH;AACF;AAUO,SAAS,gBAAgB,SAA0B,MAA8B,QAA6B;AACnH,MAAI,SAAS,aAAa;AACxB,QAAI,WAAW,QAAW;AACxB,YAAM,IAAI,MAAM,yDAAyD;AAAA,IAC3E;AACA,QAAI,CAAC,oBAAoB,SAAS,aAAa,MAAM,GAAG;AACtD,YAAM,IAAI,sBAAsB;AAAA,QAC9B,MAAM;AAAA,QACN,QAAQ,QAAQ;AAAA,QAChB;AAAA,MACF,CAAC;AAAA,IACH;AACA;AAAA,EACF;AACA,MAAI,CAAC,oBAAoB,SAAS,QAAQ,GAAG;AAC3C,UAAM,IAAI,sBAAsB;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB,CAAC;AAAA,EACH;AAC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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,aAAkC,OAAU,OAAuC;AACvF,UAAM,IAAI,KAAK,cAAc,IAAI,KAAK;AACtC,QAAI,CAAC,KAAK,EAAE,WAAW,EAAG;AAC1B,eAAW,KAAK,EAAE,MAAM,GAAG;AACzB,YAAM,EAAE,GAAG,KAAK;AAAA,IAClB;AAAA,EACF;AACF;AAGO,IAAM,eAAe;","names":[]}
@@ -1,3 +1,6 @@
1
+ import {
2
+ openEnvelopeJson
3
+ } from "./chunk-MCHVVJIA.js";
1
4
  import {
2
5
  base64ToBuffer,
3
6
  bufferToBase64,
@@ -6,18 +9,17 @@ import {
6
9
  encryptBytesWithAAD,
7
10
  generateDEK,
8
11
  hmacSha256Hex,
9
- openEnvelopeJson,
10
12
  sha256Hex,
11
13
  unwrapCek,
12
14
  wrapCek
13
- } from "./chunk-5O3AOPDT.js";
15
+ } from "./chunk-3OPY6MK2.js";
14
16
  import {
15
17
  NOYDB_FORMAT_VERSION
16
- } from "./chunk-5TDJ56JE.js";
18
+ } from "./chunk-YN5IAHN6.js";
17
19
  import {
18
20
  ConflictError,
19
21
  NotFoundError
20
- } from "./chunk-ZYUC53LT.js";
22
+ } from "./chunk-S7VFUQM2.js";
21
23
 
22
24
  // src/with-shape/blobs/mime-magic.ts
23
25
  function hex(s) {
@@ -1153,7 +1155,7 @@ var BlobSet = class {
1153
1155
  return this.buildResponse(slot, result.blob, { inline: true });
1154
1156
  }
1155
1157
  const aad = chunkAAD(slot.eTag, 0, result.blob.chunkCount);
1156
- const { decryptBytesWithAAD: decryptAAD } = await import("./enclave-UL5LW66V.js");
1158
+ const { decryptBytesWithAAD: decryptAAD } = await import("./enclave-NHORSWSF.js");
1157
1159
  const decrypted = await decryptAAD(envelope._iv, envelope._data, blobDEK, aad);
1158
1160
  const plaintext = result.blob.compression === "gzip" ? await decompressBytes(decrypted) : decrypted;
1159
1161
  const body = new ReadableStream({
@@ -1216,4 +1218,4 @@ export {
1216
1218
  DEFAULT_CHUNK_SIZE,
1217
1219
  BlobSet
1218
1220
  };
1219
- //# sourceMappingURL=chunk-DFEMTNPJ.js.map
1221
+ //# sourceMappingURL=chunk-XH7XP3OL.js.map