@noy-db/hub 0.4.0-pre.6 → 0.4.0-pre.8

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 (460) hide show
  1. package/README.md +1 -2
  2. package/dist/api-3NKVNZPM.js +20 -0
  3. package/dist/attestation/index.js +18 -18
  4. package/dist/{backup-USYSNCYM.js → backup-PTSVXDDW.js} +13 -13
  5. package/dist/blobs/index.js +13 -13
  6. package/dist/blobs/index.js.map +1 -1
  7. package/dist/broker/index.js +12 -12
  8. package/dist/cargo/index.js +31 -29
  9. package/dist/{chunk-5WLDZZ6S.js → chunk-35NMVJ7I.js} +3 -3
  10. package/dist/{chunk-ZGEFBDPR.js → chunk-3HUYRN24.js} +3 -3
  11. package/dist/chunk-3HUYRN24.js.map +1 -0
  12. package/dist/{chunk-NA374QG7.js → chunk-3XKESW5E.js} +3 -3
  13. package/dist/{chunk-MUPZ6IZX.js → chunk-4JQK3L4V.js} +2 -2
  14. package/dist/{chunk-Z4D3YGAB.js → chunk-4ZKNC6A6.js} +2 -2
  15. package/dist/{chunk-ONB627HU.js → chunk-55LX6FSX.js} +2 -2
  16. package/dist/{chunk-M7W2KYTL.js → chunk-56IIVAEO.js} +2 -2
  17. package/dist/{chunk-FHHYCBBP.js → chunk-5DRROK5W.js} +2 -2
  18. package/dist/{chunk-GTNRMJYH.js → chunk-5GQEU4DN.js} +2 -2
  19. package/dist/{chunk-XSOGLHGY.js → chunk-6L3DKWRY.js} +6 -6
  20. package/dist/chunk-6LJY7X5A.js +18 -0
  21. package/dist/chunk-6LJY7X5A.js.map +1 -0
  22. package/dist/{chunk-44Y3P5U6.js → chunk-6M2I3DKF.js} +2 -2
  23. package/dist/{chunk-HDF5R2K6.js → chunk-6R6Q3MRN.js} +7 -7
  24. package/dist/{chunk-ZUDAK436.js → chunk-6UBZ6I5Z.js} +2 -2
  25. package/dist/{chunk-SEU6QHH4.js → chunk-6ZNSB3H6.js} +5 -17
  26. package/dist/chunk-6ZNSB3H6.js.map +1 -0
  27. package/dist/{chunk-7U6AB7DZ.js → chunk-AKKRXT23.js} +2 -2
  28. package/dist/{chunk-2PDBYF2O.js → chunk-AT2JJEKJ.js} +4 -4
  29. package/dist/chunk-AT2JJEKJ.js.map +1 -0
  30. package/dist/{chunk-OWLZONGX.js → chunk-BLBAQRBM.js} +2 -2
  31. package/dist/{chunk-XONZGK6J.js → chunk-BN4HRYAZ.js} +2 -2
  32. package/dist/{chunk-QVGEVZ5F.js → chunk-BQ6DHN4I.js} +3 -3
  33. package/dist/{chunk-ZHMUFYZF.js → chunk-BXHMZ2XW.js} +8 -8
  34. package/dist/{chunk-LG2GUYRX.js → chunk-BYFXLDVV.js} +9 -9
  35. package/dist/{chunk-M4GO4ZJK.js → chunk-C25JXSOR.js} +137 -11
  36. package/dist/chunk-C25JXSOR.js.map +1 -0
  37. package/dist/{chunk-3TZUC4WS.js → chunk-CCDP6EPB.js} +13 -355
  38. package/dist/chunk-CCDP6EPB.js.map +1 -0
  39. package/dist/{chunk-QRHEAZ2Q.js → chunk-CUZLNGD5.js} +1 -1
  40. package/dist/{chunk-HXVRRJBD.js → chunk-DGBIHDVK.js} +5 -5
  41. package/dist/chunk-DSDXAKIP.js +50 -0
  42. package/dist/chunk-DSDXAKIP.js.map +1 -0
  43. package/dist/{chunk-JGOKAZNB.js → chunk-DZAF24PG.js} +5 -5
  44. package/dist/{chunk-NIKO2BBZ.js → chunk-DZFQVICS.js} +2 -2
  45. package/dist/chunk-DZFQVICS.js.map +1 -0
  46. package/dist/chunk-E23UGFVC.js +63 -0
  47. package/dist/chunk-E23UGFVC.js.map +1 -0
  48. package/dist/{chunk-YGMREQAK.js → chunk-EBKCYQ2D.js} +14 -14
  49. package/dist/chunk-EBKCYQ2D.js.map +1 -0
  50. package/dist/chunk-EIPVYUEP.js +654 -0
  51. package/dist/chunk-EIPVYUEP.js.map +1 -0
  52. package/dist/{chunk-TMR64XPL.js → chunk-EZNTORXE.js} +2 -2
  53. package/dist/{chunk-WCJJQV2D.js → chunk-FMNU7IUG.js} +3 -3
  54. package/dist/{chunk-H5GMROCB.js → chunk-FO6RNKKW.js} +8 -46
  55. package/dist/chunk-FO6RNKKW.js.map +1 -0
  56. package/dist/{chunk-YMUGBZN2.js → chunk-FQ5CHJR7.js} +1 -1
  57. package/dist/chunk-FQ5CHJR7.js.map +1 -0
  58. package/dist/{chunk-MQBFT2OT.js → chunk-FRMW23UK.js} +7 -7
  59. package/dist/chunk-FRMW23UK.js.map +1 -0
  60. package/dist/chunk-GJW4HX2O.js +1 -0
  61. package/dist/{chunk-JTIPVW4J.js → chunk-GP3UWP22.js} +4 -4
  62. package/dist/{chunk-DOZFU7OZ.js → chunk-GZACYEOB.js} +1 -1
  63. package/dist/chunk-GZACYEOB.js.map +1 -0
  64. package/dist/{chunk-XG7OZDOS.js → chunk-HFUAFR6B.js} +6 -6
  65. package/dist/{chunk-LN3MQFUE.js → chunk-IF6WNGAK.js} +9 -6
  66. package/dist/chunk-IF6WNGAK.js.map +1 -0
  67. package/dist/{chunk-ZX5FNWH7.js → chunk-IG6KUWBX.js} +2 -2
  68. package/dist/chunk-IG6KUWBX.js.map +1 -0
  69. package/dist/{chunk-VDTWFN2P.js → chunk-IMRB2C4O.js} +3 -3
  70. package/dist/{chunk-2BVW754E.js → chunk-ISRKW4YN.js} +3 -3
  71. package/dist/{chunk-P4NUJVWL.js → chunk-IXNCZTWA.js} +2 -2
  72. package/dist/{chunk-ZHZ4PET5.js → chunk-JIDLU57U.js} +3 -3
  73. package/dist/{chunk-V2R2VWER.js → chunk-JTR75MKH.js} +12 -12
  74. package/dist/{chunk-V2R2VWER.js.map → chunk-JTR75MKH.js.map} +1 -1
  75. package/dist/{chunk-PTT2NB46.js → chunk-JYJFGD2H.js} +2 -2
  76. package/dist/{chunk-XY6MNSAF.js → chunk-JYV4JJV2.js} +5 -5
  77. package/dist/{chunk-AZXEOEQK.js → chunk-KFRPNHWR.js} +4 -4
  78. package/dist/chunk-KFRPNHWR.js.map +1 -0
  79. package/dist/{chunk-ZDFU34XY.js → chunk-KPXM4WO6.js} +58 -54
  80. package/dist/chunk-KPXM4WO6.js.map +1 -0
  81. package/dist/{chunk-HA7P3BTB.js → chunk-KRCBZYTZ.js} +4 -4
  82. package/dist/{chunk-VNJMLOQS.js → chunk-KW42W6SV.js} +6 -6
  83. package/dist/{chunk-GQT6J4FJ.js → chunk-L3YYLT4E.js} +2 -2
  84. package/dist/chunk-L3YYLT4E.js.map +1 -0
  85. package/dist/{chunk-3GXDB3NQ.js → chunk-MANUDU7I.js} +6 -6
  86. package/dist/{chunk-YJ3TREAC.js → chunk-MHMLXJ3I.js} +2 -2
  87. package/dist/chunk-MHMLXJ3I.js.map +1 -0
  88. package/dist/{chunk-D4LAJ737.js → chunk-MSMJJB4J.js} +2 -2
  89. package/dist/chunk-MSMJJB4J.js.map +1 -0
  90. package/dist/{chunk-VQNJ7UZL.js → chunk-MTJLOC3Y.js} +1 -1
  91. package/dist/chunk-MTJLOC3Y.js.map +1 -0
  92. package/dist/{chunk-RM5EXCFF.js → chunk-MXUT7FTE.js} +2 -2
  93. package/dist/chunk-MXUT7FTE.js.map +1 -0
  94. package/dist/{chunk-IUATR5UE.js → chunk-N5PLUFH2.js} +5 -5
  95. package/dist/{chunk-C2V7AJO2.js → chunk-NEX7JCMO.js} +4 -4
  96. package/dist/{chunk-5HSSTOOG.js → chunk-NFZGZ4AK.js} +2 -2
  97. package/dist/{chunk-5ABOFAHN.js → chunk-NJ4DYYO5.js} +2 -2
  98. package/dist/chunk-NJ4DYYO5.js.map +1 -0
  99. package/dist/{chunk-2ZSC454H.js → chunk-NQSO4UAH.js} +8 -8
  100. package/dist/chunk-NQSO4UAH.js.map +1 -0
  101. package/dist/{chunk-GHEMAVTN.js → chunk-NYEFP7DY.js} +4 -4
  102. package/dist/chunk-NYEFP7DY.js.map +1 -0
  103. package/dist/{chunk-32467U5J.js → chunk-OBPVWOSQ.js} +4 -4
  104. package/dist/{chunk-6SSWOUUS.js → chunk-OLIWCCFM.js} +2 -5
  105. package/dist/{chunk-UNREYBZO.js → chunk-OLSARBZU.js} +2 -2
  106. package/dist/{chunk-LC7DSMHR.js → chunk-PTHKZWEH.js} +2 -14
  107. package/dist/{chunk-LC7DSMHR.js.map → chunk-PTHKZWEH.js.map} +1 -1
  108. package/dist/chunk-QADFHRQM.js +367 -0
  109. package/dist/chunk-QADFHRQM.js.map +1 -0
  110. package/dist/{chunk-7LP7FFJ2.js → chunk-QD46HPZG.js} +2 -2
  111. package/dist/{chunk-G4MFQXYX.js → chunk-QJNCB5SK.js} +2 -2
  112. package/dist/{chunk-6SYOHUHM.js → chunk-QZWTRENR.js} +2 -2
  113. package/dist/chunk-QZWTRENR.js.map +1 -0
  114. package/dist/{chunk-TSNRZSRC.js → chunk-RO5NM6UI.js} +2 -2
  115. package/dist/chunk-RO5NM6UI.js.map +1 -0
  116. package/dist/{chunk-MMVQ3SUO.js → chunk-RZPOZPZU.js} +8 -8
  117. package/dist/chunk-SGDPRCC4.js +1075 -0
  118. package/dist/chunk-SGDPRCC4.js.map +1 -0
  119. package/dist/{chunk-E7FSBI6I.js → chunk-SGQ4N5FS.js} +5 -5
  120. package/dist/{chunk-522MBPE5.js → chunk-SHEEBRZ4.js} +2 -2
  121. package/dist/{chunk-EPME33Y4.js → chunk-SHYIA73K.js} +6 -6
  122. package/dist/chunk-SKM35Y4Q.js +77 -0
  123. package/dist/chunk-SKM35Y4Q.js.map +1 -0
  124. package/dist/{chunk-MLCTPWSO.js → chunk-TE6LH6J2.js} +5 -5
  125. package/dist/chunk-TG634KCO.js +63 -0
  126. package/dist/chunk-TG634KCO.js.map +1 -0
  127. package/dist/{chunk-QVIZDLAR.js → chunk-TIVK6PRK.js} +9 -10
  128. package/dist/chunk-TIVK6PRK.js.map +1 -0
  129. package/dist/{chunk-EWPS35AR.js → chunk-TWS3S62A.js} +185 -333
  130. package/dist/chunk-TWS3S62A.js.map +1 -0
  131. package/dist/{chunk-JOCMXSR2.js → chunk-UADPR6F4.js} +3 -3
  132. package/dist/{chunk-SBOHNJUD.js → chunk-V6UQZA2H.js} +2 -2
  133. package/dist/chunk-VG2ZSFYD.js +32 -0
  134. package/dist/chunk-VG2ZSFYD.js.map +1 -0
  135. package/dist/{chunk-KCZAFDP5.js → chunk-VH6SOCXH.js} +2 -2
  136. package/dist/{chunk-4B3DL75F.js → chunk-W3G5REIU.js} +2 -2
  137. package/dist/{chunk-EGU4PWQW.js → chunk-W66AM5IB.js} +2 -2
  138. package/dist/chunk-W66AM5IB.js.map +1 -0
  139. package/dist/{chunk-MPPWL64H.js → chunk-WBKZUO5V.js} +3 -3
  140. package/dist/{chunk-WWBC4KLB.js → chunk-WO4T4OD5.js} +2 -2
  141. package/dist/{chunk-7IQWHYL2.js → chunk-WZ3NCMK6.js} +6 -5
  142. package/dist/{chunk-BAAUFCJK.js → chunk-X4MVWPHV.js} +3 -3
  143. package/dist/{chunk-HVPW6PCX.js → chunk-XIDQKFZF.js} +3 -3
  144. package/dist/chunk-Y2NBBT6K.js +18 -0
  145. package/dist/chunk-Y2NBBT6K.js.map +1 -0
  146. package/dist/{chunk-OWOT7CFC.js → chunk-Y6B6HVKC.js} +2 -2
  147. package/dist/{chunk-ICYC5YNI.js → chunk-Y6VZQGGH.js} +6 -6
  148. package/dist/{chunk-ZM72UO3Y.js → chunk-ZFUFAHZ3.js} +4 -4
  149. package/dist/{chunk-PWWWMRT7.js → chunk-ZTLOXFPB.js} +2 -2
  150. package/dist/chunk-ZTLOXFPB.js.map +1 -0
  151. package/dist/{walk-JXMWKKQW.js → chunk-ZWBKDKXC.js} +4 -13
  152. package/dist/{walk-JXMWKKQW.js.map → chunk-ZWBKDKXC.js.map} +1 -1
  153. package/dist/classified/index.js +5 -5
  154. package/dist/{classified-marker-SVDRXLD3.js → classified-marker-EOOSMWFC.js} +3 -3
  155. package/dist/collection-facade-TTRF5NFJ.js +45 -0
  156. package/dist/{computed-33DRJDOC.js → computed-AB45PS4V.js} +3 -3
  157. package/dist/consent/index.js +9 -9
  158. package/dist/{cover-ADBCTIKN.js → cover/index.js} +7 -6
  159. package/dist/custody/index.js +26 -0
  160. package/dist/{dead-filter-HKDMTMVY.js → dead-filter-6DYY7S64.js} +2 -2
  161. package/dist/{chunk-ZF572E2M.js → delegation-ONOZVPIP.js} +12 -6
  162. package/dist/{chunk-ZF572E2M.js.map → delegation-ONOZVPIP.js.map} +1 -1
  163. package/dist/derivations/index.js +12 -12
  164. package/dist/derive-IGGVSUPH.js +22 -0
  165. package/dist/directory/index.js +46 -0
  166. package/dist/{dispatch-SPMYNXNW.js → dispatch-7T45NN7C.js} +18 -18
  167. package/dist/{dispatch-V5MSMQYX.js → dispatch-RPTLK7LJ.js} +5 -5
  168. package/dist/{enclave-ZA7C3H2L.js → enclave-CLJVSDFG.js} +9 -9
  169. package/dist/executor-IEBLTBCW.js +9 -0
  170. package/dist/executor-RM7XWQDU.js +9 -0
  171. package/dist/executor-XZYM4KHT.js +28 -0
  172. package/dist/export-accessible-24XCCD3A.js +23 -0
  173. package/dist/extract-partition-H2TPEEOF.js +38 -0
  174. package/dist/{fanout-sidecar-HRMHC34B.js → fanout-sidecar-TV7CXAJ6.js} +9 -9
  175. package/dist/find-OZMTRIK3.js +11 -0
  176. package/dist/forget/index.js +11 -11
  177. package/dist/forget/index.js.map +1 -1
  178. package/dist/guards/index.js +4 -4
  179. package/dist/history/index.js +12 -12
  180. package/dist/i18n/index.js +14 -14
  181. package/dist/index.d.ts +16 -19
  182. package/dist/index.js +208 -1961
  183. package/dist/index.js.map +1 -1
  184. package/dist/indexing/index.js +2 -2
  185. package/dist/indexing/index.js.map +1 -1
  186. package/dist/introspection/index.js +28 -0
  187. package/dist/issue-55HJE7JF.js +19 -0
  188. package/dist/kernel/collection-config.d.ts +1 -1
  189. package/dist/kernel/collection.d.ts +2 -2
  190. package/dist/kernel/errors.d.ts +2 -2
  191. package/dist/kernel/noydb.d.ts +1 -1
  192. package/dist/kernel/sync-policy.d.ts +1 -1
  193. package/dist/kernel/types.d.ts +20 -20
  194. package/dist/kernel/vault.d.ts +10 -10
  195. package/dist/{ledger-K6JBFL3Z.js → ledger-XY6NP3J2.js} +11 -11
  196. package/dist/liberate-LXOJ2EMB.js +24 -0
  197. package/dist/{link-set-XVZY2ODC.js → link-set-POQB7BU5.js} +11 -11
  198. package/dist/materialized-views/index.js +19 -19
  199. package/dist/money/index.js +31 -0
  200. package/dist/noydb-FHZ4ZDBP.js +82 -0
  201. package/dist/overlay-views/index.js +4 -4
  202. package/dist/periods/index.js +13 -13
  203. package/dist/pod/index.js +11 -11
  204. package/dist/{policy-QWGJB7P7.js → policy/index.js} +6 -6
  205. package/dist/port/with/blob-strategy.d.ts +15 -5
  206. package/dist/port/with/strategies.d.ts +9 -9
  207. package/dist/portability/index.js +8 -8
  208. package/dist/{post-register-5VHHVFJY.js → post-register-URQANI3B.js} +6 -6
  209. package/dist/query/index.js +3 -3
  210. package/dist/reduce/index.js +4 -4
  211. package/dist/register-5W6CG4RM.js +25 -0
  212. package/dist/registry-7Y5WF7GS.js +9 -0
  213. package/dist/{registry-VW6P6A3J.js → registry-BWD2ED52.js} +2 -2
  214. package/dist/registry-MCSGBZXI.js +18 -0
  215. package/dist/registry-UJFP3NWF.js +19 -0
  216. package/dist/request-withdrawal-IWYDM4SO.js +31 -0
  217. package/dist/{reveal-7OOT5XPD.js → reveal-BXZGWIOP.js} +6 -6
  218. package/dist/revoke-TINYPHYY.js +24 -0
  219. package/dist/satellites/index.js +1 -1
  220. package/dist/schema-update/index.js +26 -0
  221. package/dist/schema-update/index.js.map +1 -0
  222. package/dist/sealed-record/index.js +12 -12
  223. package/dist/search/index.js +36 -0
  224. package/dist/search/index.js.map +1 -0
  225. package/dist/{seed-GVOI6QP6.js → seed-F7YYQTRC.js} +11 -11
  226. package/dist/sequence/index.js +30 -0
  227. package/dist/sequence/index.js.map +1 -0
  228. package/dist/session/index.js +9 -9
  229. package/dist/shadow/index.js +2 -2
  230. package/dist/signer-WMZKCNKC.js +25 -0
  231. package/dist/signer-WMZKCNKC.js.map +1 -0
  232. package/dist/snapshots/index.js +11 -11
  233. package/dist/snapshots/index.js.map +1 -1
  234. package/dist/{stale-BJO2WIN7.js → stale-JOE7GBAE.js} +10 -10
  235. package/dist/stale-JOE7GBAE.js.map +1 -0
  236. package/dist/storage-B3WBKXKT.js +23 -0
  237. package/dist/storage-B3WBKXKT.js.map +1 -0
  238. package/dist/store/index.js +22 -0
  239. package/dist/store/index.js.map +1 -0
  240. package/dist/{store-coordination-provider-DX5HECK3.js → store-coordination-provider-5LX2UFU2.js} +3 -3
  241. package/dist/sync/index.js +11 -11
  242. package/dist/team/index.js +29 -20
  243. package/dist/tiers/index.js +10 -10
  244. package/dist/to/index.js +1 -1
  245. package/dist/{tx → transactions}/index.js +3 -3
  246. package/dist/{tx → transactions}/index.js.map +1 -1
  247. package/dist/util/index.js +1 -1
  248. package/dist/{verify-5X37OXRY.js → verify-7XWHJWUN.js} +5 -5
  249. package/dist/via/blob/active.d.ts +7 -18
  250. package/dist/via/blob/binding.d.ts +1 -1
  251. package/dist/via/blob/index.d.ts +2 -2
  252. package/dist/walk-6OHAWGBS.js +21 -0
  253. package/dist/walk-6OHAWGBS.js.map +1 -0
  254. package/dist/with-audit/forget/active.d.ts +3 -3
  255. package/dist/with-audit/forget/index.d.ts +4 -4
  256. package/dist/with-audit/forget/strategy.d.ts +3 -3
  257. package/dist/with-audit/guards/executor.d.ts +4 -4
  258. package/dist/with-audit/guards/immutable-guard.d.ts +3 -3
  259. package/dist/with-audit/guards/index.d.ts +1 -1
  260. package/dist/with-audit/guards/registry.d.ts +3 -3
  261. package/dist/with-audit/guards/transition-guard.d.ts +3 -3
  262. package/dist/with-audit/guards/types.d.ts +10 -10
  263. package/dist/with-audit/guards/with-guard.d.ts +2 -2
  264. package/dist/with-commit/numbering/descriptor.d.ts +16 -6
  265. package/dist/with-commit/tx/active.d.ts +5 -5
  266. package/dist/with-commit/tx/index.d.ts +2 -2
  267. package/dist/with-commit/tx/invariants.d.ts +1 -1
  268. package/dist/with-commit/tx/strategy.d.ts +3 -3
  269. package/dist/with-fork/snapshots/active.d.ts +2 -2
  270. package/dist/with-fork/snapshots/index.d.ts +1 -1
  271. package/dist/with-fork/snapshots/noydb-facade.d.ts +3 -3
  272. package/dist/with-fork/snapshots/strategy.d.ts +2 -2
  273. package/dist/with-formula/derivations/executor.d.ts +2 -2
  274. package/dist/with-formula/derivations/index.d.ts +2 -1
  275. package/dist/with-formula/derivations/registry.d.ts +3 -3
  276. package/dist/with-formula/derivations/stale.d.ts +2 -2
  277. package/dist/with-formula/derivations/types.d.ts +3 -3
  278. package/dist/with-formula/derivations/with-derivation.d.ts +2 -2
  279. package/dist/with-formula/derivations/with-rollup.d.ts +15 -8
  280. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +3 -3
  281. package/dist/with-formula/materialized-views/index.d.ts +1 -1
  282. package/dist/with-formula/materialized-views/registry.d.ts +4 -4
  283. package/dist/with-formula/materialized-views/types.d.ts +4 -4
  284. package/dist/with-formula/materialized-views/with-materialized-view.d.ts +2 -2
  285. package/dist/with-formula/overlay-views/index.d.ts +1 -1
  286. package/dist/with-formula/overlay-views/registry.d.ts +4 -4
  287. package/dist/with-formula/overlay-views/types.d.ts +3 -3
  288. package/dist/with-formula/overlay-views/virtual-collection.d.ts +2 -2
  289. package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +2 -2
  290. package/dist/with-lookup/indexing/active.d.ts +5 -5
  291. package/dist/with-lookup/indexing/index.d.ts +1 -1
  292. package/dist/with-lookup/indexing/strategy.d.ts +3 -3
  293. package/dist/with-lookup/search/build-docs.d.ts +7 -2
  294. package/dist/with-lookup/search/index.d.ts +1 -1
  295. package/dist/with-party/directory/cover/index.d.ts +1 -0
  296. package/dist/with-party/directory/index.d.ts +2 -0
  297. package/dist/with-party/team/index.d.ts +2 -0
  298. package/dist/with-party/team/keyring.d.ts +49 -20
  299. package/dist/with-party/team/noydb-facade.d.ts +2 -2
  300. package/dist/with-shape/blobs/blob-set.d.ts +1 -1
  301. package/dist/with-shape/introspection/index.d.ts +6 -0
  302. package/dist/with-shape/schema-update/index.d.ts +1 -0
  303. package/dist/with-store/index.d.ts +3 -2
  304. package/dist/with-store/route-store.d.ts +1 -1
  305. package/dist/withdraw-accessible-DEUCOO4F.js +28 -0
  306. package/dist/withdraw-accessible-DEUCOO4F.js.map +1 -0
  307. package/package.json +45 -5
  308. package/dist/api-5QVQX4HG.js +0 -20
  309. package/dist/chunk-2PDBYF2O.js.map +0 -1
  310. package/dist/chunk-2ZSC454H.js.map +0 -1
  311. package/dist/chunk-3S2YNMUS.js +0 -134
  312. package/dist/chunk-3S2YNMUS.js.map +0 -1
  313. package/dist/chunk-3TZUC4WS.js.map +0 -1
  314. package/dist/chunk-5ABOFAHN.js.map +0 -1
  315. package/dist/chunk-6SYOHUHM.js.map +0 -1
  316. package/dist/chunk-AZXEOEQK.js.map +0 -1
  317. package/dist/chunk-D4LAJ737.js.map +0 -1
  318. package/dist/chunk-DOZFU7OZ.js.map +0 -1
  319. package/dist/chunk-EGU4PWQW.js.map +0 -1
  320. package/dist/chunk-EWPS35AR.js.map +0 -1
  321. package/dist/chunk-GHEMAVTN.js.map +0 -1
  322. package/dist/chunk-GQT6J4FJ.js.map +0 -1
  323. package/dist/chunk-H5GMROCB.js.map +0 -1
  324. package/dist/chunk-LN3MQFUE.js.map +0 -1
  325. package/dist/chunk-M4GO4ZJK.js.map +0 -1
  326. package/dist/chunk-MQBFT2OT.js.map +0 -1
  327. package/dist/chunk-NIKO2BBZ.js.map +0 -1
  328. package/dist/chunk-PWWWMRT7.js.map +0 -1
  329. package/dist/chunk-QVIZDLAR.js.map +0 -1
  330. package/dist/chunk-RM5EXCFF.js.map +0 -1
  331. package/dist/chunk-SEU6QHH4.js.map +0 -1
  332. package/dist/chunk-TSNRZSRC.js.map +0 -1
  333. package/dist/chunk-VQNJ7UZL.js.map +0 -1
  334. package/dist/chunk-YGMREQAK.js.map +0 -1
  335. package/dist/chunk-YJ3TREAC.js.map +0 -1
  336. package/dist/chunk-YMUGBZN2.js.map +0 -1
  337. package/dist/chunk-ZDFU34XY.js.map +0 -1
  338. package/dist/chunk-ZGEFBDPR.js.map +0 -1
  339. package/dist/chunk-ZX5FNWH7.js.map +0 -1
  340. package/dist/collection-facade-S5PPKZD5.js +0 -44
  341. package/dist/delegation-EV7LKJPH.js +0 -25
  342. package/dist/derive-5LDJW76F.js +0 -21
  343. package/dist/executor-FCJEH3FU.js +0 -9
  344. package/dist/executor-OHET7TF7.js +0 -9
  345. package/dist/executor-SVHAJZ4A.js +0 -28
  346. package/dist/export-accessible-S35YKIBL.js +0 -23
  347. package/dist/extract-partition-UVHAM5WZ.js +0 -38
  348. package/dist/find-LEBUXVL7.js +0 -11
  349. package/dist/issue-5X3SMCF4.js +0 -19
  350. package/dist/liberate-NHTCKBU4.js +0 -24
  351. package/dist/noydb-TI3RFU6M.js +0 -78
  352. package/dist/register-CEX7R7NE.js +0 -23
  353. package/dist/registry-7CZWF3EQ.js +0 -9
  354. package/dist/registry-DIKMRXUC.js +0 -19
  355. package/dist/registry-EWIB5NTI.js +0 -18
  356. package/dist/request-withdrawal-AAG57QO4.js +0 -31
  357. package/dist/revoke-U5LCIJMF.js +0 -24
  358. package/dist/signer-NAA2OX7H.js +0 -25
  359. package/dist/storage-FL7XXZTN.js +0 -23
  360. package/dist/withdraw-accessible-GO6KQJVM.js +0 -28
  361. /package/dist/{api-5QVQX4HG.js.map → api-3NKVNZPM.js.map} +0 -0
  362. /package/dist/{backup-USYSNCYM.js.map → backup-PTSVXDDW.js.map} +0 -0
  363. /package/dist/{chunk-5WLDZZ6S.js.map → chunk-35NMVJ7I.js.map} +0 -0
  364. /package/dist/{chunk-NA374QG7.js.map → chunk-3XKESW5E.js.map} +0 -0
  365. /package/dist/{chunk-MUPZ6IZX.js.map → chunk-4JQK3L4V.js.map} +0 -0
  366. /package/dist/{chunk-Z4D3YGAB.js.map → chunk-4ZKNC6A6.js.map} +0 -0
  367. /package/dist/{chunk-ONB627HU.js.map → chunk-55LX6FSX.js.map} +0 -0
  368. /package/dist/{chunk-M7W2KYTL.js.map → chunk-56IIVAEO.js.map} +0 -0
  369. /package/dist/{chunk-FHHYCBBP.js.map → chunk-5DRROK5W.js.map} +0 -0
  370. /package/dist/{chunk-GTNRMJYH.js.map → chunk-5GQEU4DN.js.map} +0 -0
  371. /package/dist/{chunk-XSOGLHGY.js.map → chunk-6L3DKWRY.js.map} +0 -0
  372. /package/dist/{chunk-44Y3P5U6.js.map → chunk-6M2I3DKF.js.map} +0 -0
  373. /package/dist/{chunk-HDF5R2K6.js.map → chunk-6R6Q3MRN.js.map} +0 -0
  374. /package/dist/{chunk-ZUDAK436.js.map → chunk-6UBZ6I5Z.js.map} +0 -0
  375. /package/dist/{chunk-7U6AB7DZ.js.map → chunk-AKKRXT23.js.map} +0 -0
  376. /package/dist/{chunk-OWLZONGX.js.map → chunk-BLBAQRBM.js.map} +0 -0
  377. /package/dist/{chunk-XONZGK6J.js.map → chunk-BN4HRYAZ.js.map} +0 -0
  378. /package/dist/{chunk-QVGEVZ5F.js.map → chunk-BQ6DHN4I.js.map} +0 -0
  379. /package/dist/{chunk-ZHMUFYZF.js.map → chunk-BXHMZ2XW.js.map} +0 -0
  380. /package/dist/{chunk-LG2GUYRX.js.map → chunk-BYFXLDVV.js.map} +0 -0
  381. /package/dist/{chunk-QRHEAZ2Q.js.map → chunk-CUZLNGD5.js.map} +0 -0
  382. /package/dist/{chunk-HXVRRJBD.js.map → chunk-DGBIHDVK.js.map} +0 -0
  383. /package/dist/{chunk-JGOKAZNB.js.map → chunk-DZAF24PG.js.map} +0 -0
  384. /package/dist/{chunk-TMR64XPL.js.map → chunk-EZNTORXE.js.map} +0 -0
  385. /package/dist/{chunk-WCJJQV2D.js.map → chunk-FMNU7IUG.js.map} +0 -0
  386. /package/dist/{collection-facade-S5PPKZD5.js.map → chunk-GJW4HX2O.js.map} +0 -0
  387. /package/dist/{chunk-JTIPVW4J.js.map → chunk-GP3UWP22.js.map} +0 -0
  388. /package/dist/{chunk-XG7OZDOS.js.map → chunk-HFUAFR6B.js.map} +0 -0
  389. /package/dist/{chunk-VDTWFN2P.js.map → chunk-IMRB2C4O.js.map} +0 -0
  390. /package/dist/{chunk-2BVW754E.js.map → chunk-ISRKW4YN.js.map} +0 -0
  391. /package/dist/{chunk-P4NUJVWL.js.map → chunk-IXNCZTWA.js.map} +0 -0
  392. /package/dist/{chunk-ZHZ4PET5.js.map → chunk-JIDLU57U.js.map} +0 -0
  393. /package/dist/{chunk-PTT2NB46.js.map → chunk-JYJFGD2H.js.map} +0 -0
  394. /package/dist/{chunk-XY6MNSAF.js.map → chunk-JYV4JJV2.js.map} +0 -0
  395. /package/dist/{chunk-HA7P3BTB.js.map → chunk-KRCBZYTZ.js.map} +0 -0
  396. /package/dist/{chunk-VNJMLOQS.js.map → chunk-KW42W6SV.js.map} +0 -0
  397. /package/dist/{chunk-3GXDB3NQ.js.map → chunk-MANUDU7I.js.map} +0 -0
  398. /package/dist/{chunk-IUATR5UE.js.map → chunk-N5PLUFH2.js.map} +0 -0
  399. /package/dist/{chunk-C2V7AJO2.js.map → chunk-NEX7JCMO.js.map} +0 -0
  400. /package/dist/{chunk-5HSSTOOG.js.map → chunk-NFZGZ4AK.js.map} +0 -0
  401. /package/dist/{chunk-32467U5J.js.map → chunk-OBPVWOSQ.js.map} +0 -0
  402. /package/dist/{chunk-6SSWOUUS.js.map → chunk-OLIWCCFM.js.map} +0 -0
  403. /package/dist/{chunk-UNREYBZO.js.map → chunk-OLSARBZU.js.map} +0 -0
  404. /package/dist/{chunk-7LP7FFJ2.js.map → chunk-QD46HPZG.js.map} +0 -0
  405. /package/dist/{chunk-G4MFQXYX.js.map → chunk-QJNCB5SK.js.map} +0 -0
  406. /package/dist/{chunk-MMVQ3SUO.js.map → chunk-RZPOZPZU.js.map} +0 -0
  407. /package/dist/{chunk-E7FSBI6I.js.map → chunk-SGQ4N5FS.js.map} +0 -0
  408. /package/dist/{chunk-522MBPE5.js.map → chunk-SHEEBRZ4.js.map} +0 -0
  409. /package/dist/{chunk-EPME33Y4.js.map → chunk-SHYIA73K.js.map} +0 -0
  410. /package/dist/{chunk-MLCTPWSO.js.map → chunk-TE6LH6J2.js.map} +0 -0
  411. /package/dist/{chunk-JOCMXSR2.js.map → chunk-UADPR6F4.js.map} +0 -0
  412. /package/dist/{chunk-SBOHNJUD.js.map → chunk-V6UQZA2H.js.map} +0 -0
  413. /package/dist/{chunk-KCZAFDP5.js.map → chunk-VH6SOCXH.js.map} +0 -0
  414. /package/dist/{chunk-4B3DL75F.js.map → chunk-W3G5REIU.js.map} +0 -0
  415. /package/dist/{chunk-MPPWL64H.js.map → chunk-WBKZUO5V.js.map} +0 -0
  416. /package/dist/{chunk-WWBC4KLB.js.map → chunk-WO4T4OD5.js.map} +0 -0
  417. /package/dist/{chunk-7IQWHYL2.js.map → chunk-WZ3NCMK6.js.map} +0 -0
  418. /package/dist/{chunk-BAAUFCJK.js.map → chunk-X4MVWPHV.js.map} +0 -0
  419. /package/dist/{chunk-HVPW6PCX.js.map → chunk-XIDQKFZF.js.map} +0 -0
  420. /package/dist/{chunk-OWOT7CFC.js.map → chunk-Y6B6HVKC.js.map} +0 -0
  421. /package/dist/{chunk-ICYC5YNI.js.map → chunk-Y6VZQGGH.js.map} +0 -0
  422. /package/dist/{chunk-ZM72UO3Y.js.map → chunk-ZFUFAHZ3.js.map} +0 -0
  423. /package/dist/{classified-marker-SVDRXLD3.js.map → classified-marker-EOOSMWFC.js.map} +0 -0
  424. /package/dist/{computed-33DRJDOC.js.map → collection-facade-TTRF5NFJ.js.map} +0 -0
  425. /package/dist/{cover-ADBCTIKN.js.map → computed-AB45PS4V.js.map} +0 -0
  426. /package/dist/{delegation-EV7LKJPH.js.map → cover/index.js.map} +0 -0
  427. /package/dist/{derive-5LDJW76F.js.map → custody/index.js.map} +0 -0
  428. /package/dist/{dead-filter-HKDMTMVY.js.map → dead-filter-6DYY7S64.js.map} +0 -0
  429. /package/dist/{enclave-ZA7C3H2L.js.map → derive-IGGVSUPH.js.map} +0 -0
  430. /package/dist/{executor-FCJEH3FU.js.map → directory/index.js.map} +0 -0
  431. /package/dist/{dispatch-SPMYNXNW.js.map → dispatch-7T45NN7C.js.map} +0 -0
  432. /package/dist/{dispatch-V5MSMQYX.js.map → dispatch-RPTLK7LJ.js.map} +0 -0
  433. /package/dist/{executor-OHET7TF7.js.map → enclave-CLJVSDFG.js.map} +0 -0
  434. /package/dist/{executor-SVHAJZ4A.js.map → executor-IEBLTBCW.js.map} +0 -0
  435. /package/dist/{export-accessible-S35YKIBL.js.map → executor-RM7XWQDU.js.map} +0 -0
  436. /package/dist/{extract-partition-UVHAM5WZ.js.map → executor-XZYM4KHT.js.map} +0 -0
  437. /package/dist/{find-LEBUXVL7.js.map → export-accessible-24XCCD3A.js.map} +0 -0
  438. /package/dist/{issue-5X3SMCF4.js.map → extract-partition-H2TPEEOF.js.map} +0 -0
  439. /package/dist/{fanout-sidecar-HRMHC34B.js.map → fanout-sidecar-TV7CXAJ6.js.map} +0 -0
  440. /package/dist/{ledger-K6JBFL3Z.js.map → find-OZMTRIK3.js.map} +0 -0
  441. /package/dist/{liberate-NHTCKBU4.js.map → introspection/index.js.map} +0 -0
  442. /package/dist/{link-set-XVZY2ODC.js.map → issue-55HJE7JF.js.map} +0 -0
  443. /package/dist/{noydb-TI3RFU6M.js.map → ledger-XY6NP3J2.js.map} +0 -0
  444. /package/dist/{policy-QWGJB7P7.js.map → liberate-LXOJ2EMB.js.map} +0 -0
  445. /package/dist/{register-CEX7R7NE.js.map → link-set-POQB7BU5.js.map} +0 -0
  446. /package/dist/{registry-7CZWF3EQ.js.map → money/index.js.map} +0 -0
  447. /package/dist/{registry-DIKMRXUC.js.map → noydb-FHZ4ZDBP.js.map} +0 -0
  448. /package/dist/{registry-EWIB5NTI.js.map → policy/index.js.map} +0 -0
  449. /package/dist/{post-register-5VHHVFJY.js.map → post-register-URQANI3B.js.map} +0 -0
  450. /package/dist/{registry-VW6P6A3J.js.map → register-5W6CG4RM.js.map} +0 -0
  451. /package/dist/{request-withdrawal-AAG57QO4.js.map → registry-7Y5WF7GS.js.map} +0 -0
  452. /package/dist/{revoke-U5LCIJMF.js.map → registry-BWD2ED52.js.map} +0 -0
  453. /package/dist/{signer-NAA2OX7H.js.map → registry-MCSGBZXI.js.map} +0 -0
  454. /package/dist/{stale-BJO2WIN7.js.map → registry-UJFP3NWF.js.map} +0 -0
  455. /package/dist/{storage-FL7XXZTN.js.map → request-withdrawal-IWYDM4SO.js.map} +0 -0
  456. /package/dist/{reveal-7OOT5XPD.js.map → reveal-BXZGWIOP.js.map} +0 -0
  457. /package/dist/{withdraw-accessible-GO6KQJVM.js.map → revoke-TINYPHYY.js.map} +0 -0
  458. /package/dist/{seed-GVOI6QP6.js.map → seed-F7YYQTRC.js.map} +0 -0
  459. /package/dist/{store-coordination-provider-DX5HECK3.js.map → store-coordination-provider-5LX2UFU2.js.map} +0 -0
  460. /package/dist/{verify-5X37OXRY.js.map → verify-7XWHJWUN.js.map} +0 -0
@@ -0,0 +1,654 @@
1
+ // src/with-store/route-store.ts
2
+ var BLOB_CHUNKS = "_blob_chunks";
3
+ var BLOB_INDEX = "_blob_index";
4
+ var BLOB_SLOTS = "_blob_slots_";
5
+ var BLOB_VERSIONS = "_blob_versions_";
6
+ function routeStore(opts) {
7
+ const primary = opts.default;
8
+ const blobsIsSimple = opts.blobs && "get" in opts.blobs;
9
+ const simpleBlobStore = blobsIsSimple ? opts.blobs : void 0;
10
+ const tieredBlobs = !blobsIsSimple ? opts.blobs : void 0;
11
+ const blobThreshold = tieredBlobs?.threshold ?? 400 * 1024;
12
+ const allStores = /* @__PURE__ */ new Set([primary]);
13
+ if (simpleBlobStore) allStores.add(simpleBlobStore);
14
+ if (tieredBlobs?.large) allStores.add(tieredBlobs.large);
15
+ if (tieredBlobs?.small) allStores.add(tieredBlobs.small);
16
+ if (opts.age?.cold) allStores.add(opts.age.cold);
17
+ if (opts.routes) for (const s of Object.values(opts.routes)) allStores.add(s);
18
+ if (opts.vaultRoutes) for (const s of Object.values(opts.vaultRoutes)) allStores.add(s);
19
+ if (opts.blobRoutes) for (const s of Object.values(opts.blobRoutes)) allStores.add(s);
20
+ if (opts.overflow) allStores.add(opts.overflow);
21
+ if (opts.blobLifecycle?.archiveStore) allStores.add(opts.blobLifecycle.archiveStore);
22
+ const overrides = /* @__PURE__ */ new Map();
23
+ const suspended = /* @__PURE__ */ new Set();
24
+ const writeQueues = /* @__PURE__ */ new Map();
25
+ const NULL_STORE = {
26
+ name: "suspended",
27
+ async get() {
28
+ return null;
29
+ },
30
+ async put() {
31
+ },
32
+ async delete() {
33
+ },
34
+ async list() {
35
+ return [];
36
+ },
37
+ async loadAll() {
38
+ return {};
39
+ },
40
+ async saveAll() {
41
+ }
42
+ };
43
+ function routeNameFor(vault, collection) {
44
+ if (opts.vaultRoutes) {
45
+ for (const prefix of Object.keys(opts.vaultRoutes)) {
46
+ if (vault.startsWith(prefix)) return prefix;
47
+ }
48
+ }
49
+ if (opts.routes && !collection.startsWith("_") && opts.routes[collection]) {
50
+ return collection;
51
+ }
52
+ if (isBlobChunks(collection) && (simpleBlobStore || tieredBlobs)) return "blobs";
53
+ if (opts.routeBlobMeta && isBlobMeta(collection) && (simpleBlobStore || tieredBlobs)) return "blobs";
54
+ if (opts.age && !collection.startsWith("_")) {
55
+ }
56
+ return "default";
57
+ }
58
+ const quotaExceeded = false;
59
+ function resolveOriginalStore(route) {
60
+ if (route === "blobs") return simpleBlobStore ?? tieredBlobs?.large ?? primary;
61
+ if (route === "cold") return opts.age?.cold ?? primary;
62
+ if (opts.routes?.[route]) return opts.routes[route];
63
+ if (opts.vaultRoutes?.[route]) return opts.vaultRoutes[route];
64
+ return primary;
65
+ }
66
+ function maybeQueueWrite(routeName, method, vault, collection, id, envelope, expectedVersion) {
67
+ if (!suspended.has(routeName)) return false;
68
+ const queue = writeQueues.get(routeName);
69
+ if (!queue) return false;
70
+ if (queue.writes.length >= queue.maxSize) {
71
+ queue.writes.shift();
72
+ }
73
+ queue.writes.push({
74
+ method,
75
+ vault,
76
+ collection,
77
+ id,
78
+ ...envelope !== void 0 ? { envelope } : {},
79
+ ...expectedVersion !== void 0 ? { expectedVersion } : {}
80
+ });
81
+ return true;
82
+ }
83
+ function isBlobChunks(collection) {
84
+ return collection === BLOB_CHUNKS;
85
+ }
86
+ function isBlobMeta(collection) {
87
+ return collection === BLOB_INDEX || collection.startsWith(BLOB_SLOTS) || collection.startsWith(BLOB_VERSIONS);
88
+ }
89
+ function isInternal(collection) {
90
+ return collection.startsWith("_");
91
+ }
92
+ function storeFor(vault, collection) {
93
+ const rName = routeNameFor(vault, collection);
94
+ if (suspended.has(rName)) return NULL_STORE;
95
+ if (overrides.has(rName)) return overrides.get(rName);
96
+ if (opts.vaultRoutes) {
97
+ for (const [prefix, store2] of Object.entries(opts.vaultRoutes)) {
98
+ if (vault.startsWith(prefix)) return store2;
99
+ }
100
+ }
101
+ if (opts.routes && !isInternal(collection) && opts.routes[collection]) {
102
+ return opts.routes[collection];
103
+ }
104
+ if (isBlobChunks(collection)) {
105
+ if (simpleBlobStore) return simpleBlobStore;
106
+ if (tieredBlobs) return tieredBlobs.large;
107
+ }
108
+ if (opts.routeBlobMeta && isBlobMeta(collection)) {
109
+ if (simpleBlobStore) return simpleBlobStore;
110
+ if (tieredBlobs) return tieredBlobs.large;
111
+ }
112
+ if (quotaExceeded && opts.overflow) return opts.overflow;
113
+ return primary;
114
+ }
115
+ function blobStoreForSize(dataSize) {
116
+ if (!tieredBlobs) return simpleBlobStore ?? primary;
117
+ if (dataSize <= blobThreshold) {
118
+ return tieredBlobs.small ?? primary;
119
+ }
120
+ return tieredBlobs.large;
121
+ }
122
+ function isCold(collection, envelope, before) {
123
+ if (!opts.age) return false;
124
+ if (isInternal(collection)) return false;
125
+ if (opts.age.collections && opts.age.collections.length > 0) {
126
+ if (!opts.age.collections.includes(collection)) return false;
127
+ }
128
+ const cutoffIso = before ?? (opts.age.coldAfterDays != null ? new Date(Date.now() - opts.age.coldAfterDays * 24 * 60 * 60 * 1e3).toISOString() : void 0);
129
+ if (cutoffIso === void 0) return false;
130
+ return envelope._ts < cutoffIso;
131
+ }
132
+ const store = {
133
+ name: buildName(),
134
+ ...opts.age?.cold ? { capabilities: { ...primary.capabilities, coldArchival: true } } : primary.capabilities ? { capabilities: { ...primary.capabilities, coldArchival: false } } : {},
135
+ async get(vault, collection, id) {
136
+ const s = storeFor(vault, collection);
137
+ const result = await s.get(vault, collection, id);
138
+ if (result === null && opts.age && !isInternal(collection)) {
139
+ if (!opts.age.collections?.length || opts.age.collections.includes(collection)) {
140
+ return opts.age.cold.get(vault, collection, id);
141
+ }
142
+ }
143
+ return result;
144
+ },
145
+ async put(vault, collection, id, envelope, expectedVersion) {
146
+ const rn = routeNameFor(vault, collection);
147
+ if (maybeQueueWrite(rn, "put", vault, collection, id, envelope, expectedVersion)) return;
148
+ if (isBlobChunks(collection) && tieredBlobs) {
149
+ const dataSize = envelope._data.length;
150
+ const s2 = blobStoreForSize(dataSize);
151
+ return s2.put(vault, collection, id, envelope, expectedVersion);
152
+ }
153
+ const s = storeFor(vault, collection);
154
+ if (opts.age && !isInternal(collection)) {
155
+ opts.age.cold.delete(vault, collection, id).catch(() => {
156
+ });
157
+ }
158
+ return s.put(vault, collection, id, envelope, expectedVersion);
159
+ },
160
+ async delete(vault, collection, id) {
161
+ const rn = routeNameFor(vault, collection);
162
+ if (maybeQueueWrite(rn, "delete", vault, collection, id)) return;
163
+ const s = storeFor(vault, collection);
164
+ await s.delete(vault, collection, id);
165
+ if (opts.age && !isInternal(collection)) {
166
+ await opts.age.cold.delete(vault, collection, id).catch(() => {
167
+ });
168
+ }
169
+ },
170
+ async list(vault, collection) {
171
+ const s = storeFor(vault, collection);
172
+ const ids = await s.list(vault, collection);
173
+ if (opts.age && !isInternal(collection)) {
174
+ if (!opts.age.collections?.length || opts.age.collections.includes(collection)) {
175
+ const coldIds = await opts.age.cold.list(vault, collection).catch(() => []);
176
+ if (coldIds.length > 0) {
177
+ const merged = new Set(ids);
178
+ for (const id of coldIds) merged.add(id);
179
+ return [...merged];
180
+ }
181
+ }
182
+ }
183
+ return ids;
184
+ },
185
+ async loadAll(vault) {
186
+ const stores = getStoresForVault(vault);
187
+ const snapshots = await Promise.all(
188
+ stores.map((s) => s.loadAll(vault).catch(() => ({})))
189
+ );
190
+ return mergeSnapshots(snapshots);
191
+ },
192
+ async saveAll(vault, data) {
193
+ const partitioned = /* @__PURE__ */ new Map();
194
+ for (const [collection, records] of Object.entries(data)) {
195
+ const s = storeFor(vault, collection);
196
+ if (!partitioned.has(s)) partitioned.set(s, {});
197
+ partitioned.get(s)[collection] = records;
198
+ }
199
+ await Promise.all(
200
+ [...partitioned.entries()].map(([s, snap]) => s.saveAll(vault, snap))
201
+ );
202
+ },
203
+ async compact(vault, compactOpts) {
204
+ if (!opts.age) return 0;
205
+ let migrated = 0;
206
+ const collections = opts.age.collections?.length ? opts.age.collections : Object.keys(await primary.loadAll(vault).catch(() => ({})));
207
+ for (const collection of collections) {
208
+ const ids = await primary.list(vault, collection).catch(() => []);
209
+ for (const id of ids) {
210
+ const envelope = await primary.get(vault, collection, id);
211
+ if (!envelope) continue;
212
+ if (isCold(collection, envelope, compactOpts?.before)) {
213
+ await opts.age.cold.put(vault, collection, id, envelope);
214
+ await primary.delete(vault, collection, id);
215
+ migrated++;
216
+ }
217
+ }
218
+ }
219
+ return migrated;
220
+ },
221
+ // ── Runtime override / suspend ──────────────────────
222
+ override(route, overrideStore, overrideOpts) {
223
+ if (overrideOpts?.hydrate) {
224
+ return (async () => {
225
+ overrides.set(route, overrideStore);
226
+ })();
227
+ }
228
+ overrides.set(route, overrideStore);
229
+ },
230
+ clearOverride(route) {
231
+ overrides.delete(route);
232
+ },
233
+ suspend(route, suspendOpts) {
234
+ suspended.add(route);
235
+ if (suspendOpts?.queue) {
236
+ writeQueues.set(route, {
237
+ writes: [],
238
+ maxSize: suspendOpts.maxQueueSize ?? 1e4
239
+ });
240
+ }
241
+ },
242
+ async resume(route) {
243
+ suspended.delete(route);
244
+ const queue = writeQueues.get(route);
245
+ if (!queue || queue.writes.length === 0) {
246
+ writeQueues.delete(route);
247
+ return 0;
248
+ }
249
+ let replayed = 0;
250
+ const target = overrides.get(route) ?? resolveOriginalStore(route);
251
+ for (const write of queue.writes) {
252
+ try {
253
+ if (write.method === "put" && write.envelope) {
254
+ await target.put(write.vault, write.collection, write.id, write.envelope, write.expectedVersion);
255
+ } else if (write.method === "delete") {
256
+ await target.delete(write.vault, write.collection, write.id);
257
+ }
258
+ replayed++;
259
+ } catch {
260
+ }
261
+ }
262
+ writeQueues.delete(route);
263
+ return replayed;
264
+ },
265
+ routeStatus() {
266
+ const ov = {};
267
+ for (const [k, v] of overrides) ov[k] = v.name ?? "unnamed";
268
+ const q = {};
269
+ for (const [k, v] of writeQueues) q[k] = v.writes.length;
270
+ return { overrides: ov, suspended: [...suspended], queued: q };
271
+ },
272
+ resolveBackend(vaultId) {
273
+ if (opts.vaultRoutes) {
274
+ for (const [prefix, s] of Object.entries(opts.vaultRoutes)) {
275
+ if (vaultId.startsWith(prefix)) return s;
276
+ }
277
+ }
278
+ return primary;
279
+ }
280
+ };
281
+ if (anyHas("listVaults")) {
282
+ store.listVaults = async () => {
283
+ const results = await Promise.all(
284
+ [...allStores].filter((s) => s.listVaults !== void 0).map((s) => s.listVaults().catch(() => []))
285
+ );
286
+ return [...new Set(results.flat())];
287
+ };
288
+ }
289
+ if (anyHas("ping")) {
290
+ store.ping = async () => {
291
+ const results = await Promise.all(
292
+ [...allStores].filter((s) => s.ping !== void 0).map((s) => s.ping().catch(() => false))
293
+ );
294
+ return results.some(Boolean);
295
+ };
296
+ }
297
+ return store;
298
+ function buildName() {
299
+ const names = [...allStores].map((s) => s.name ?? "?").join("+");
300
+ return `route(${names})`;
301
+ }
302
+ function anyHas(method) {
303
+ return [...allStores].some((s) => s[method]);
304
+ }
305
+ function getStoresForVault(vault) {
306
+ const stores = /* @__PURE__ */ new Set();
307
+ if (opts.vaultRoutes) {
308
+ for (const [prefix, s] of Object.entries(opts.vaultRoutes)) {
309
+ if (vault.startsWith(prefix)) {
310
+ stores.add(s);
311
+ return [...stores];
312
+ }
313
+ }
314
+ }
315
+ stores.add(primary);
316
+ if (simpleBlobStore) stores.add(simpleBlobStore);
317
+ if (tieredBlobs?.large) stores.add(tieredBlobs.large);
318
+ if (tieredBlobs?.small && tieredBlobs.small !== primary) stores.add(tieredBlobs.small);
319
+ if (opts.age?.cold) stores.add(opts.age.cold);
320
+ if (opts.routes) {
321
+ for (const s of Object.values(opts.routes)) stores.add(s);
322
+ }
323
+ return [...stores];
324
+ }
325
+ }
326
+ function mergeSnapshots(snapshots) {
327
+ const merged = {};
328
+ for (const snap of snapshots) {
329
+ for (const [collection, records] of Object.entries(snap)) {
330
+ if (!merged[collection]) {
331
+ merged[collection] = { ...records };
332
+ continue;
333
+ }
334
+ for (const [id, envelope] of Object.entries(records)) {
335
+ const existing = merged[collection][id];
336
+ if (!existing || envelope._ts >= existing._ts) {
337
+ merged[collection][id] = envelope;
338
+ }
339
+ }
340
+ }
341
+ }
342
+ return merged;
343
+ }
344
+
345
+ // src/with-store/store-middleware.ts
346
+ function wrapStore(store, ...middlewares) {
347
+ let result = store;
348
+ for (let i = middlewares.length - 1; i >= 0; i--) {
349
+ result = middlewares[i](result);
350
+ }
351
+ return result;
352
+ }
353
+ function withRetry(opts = {}) {
354
+ const maxRetries = opts.maxRetries ?? 3;
355
+ const backoffMs = opts.backoffMs ?? 500;
356
+ const jitter = opts.jitter ?? 0.3;
357
+ const retryOn = opts.retryOn ? new Set(opts.retryOn) : null;
358
+ function shouldRetry(err) {
359
+ if (!retryOn) return true;
360
+ if (err && typeof err === "object" && "code" in err) {
361
+ return retryOn.has(err.code);
362
+ }
363
+ return true;
364
+ }
365
+ async function retryable(fn) {
366
+ let lastError;
367
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
368
+ try {
369
+ return await fn();
370
+ } catch (err) {
371
+ lastError = err;
372
+ if (attempt >= maxRetries || !shouldRetry(err)) throw err;
373
+ const delay = backoffMs * Math.pow(2, attempt) * (1 + Math.random() * jitter);
374
+ await new Promise((r) => setTimeout(r, delay));
375
+ }
376
+ }
377
+ throw lastError;
378
+ }
379
+ return (next) => ({
380
+ ...next,
381
+ name: next.name ? `retry(${next.name})` : "retry",
382
+ get: (v, c, id) => retryable(() => next.get(v, c, id)),
383
+ put: (v, c, id, env, ev) => retryable(() => next.put(v, c, id, env, ev)),
384
+ delete: (v, c, id) => retryable(() => next.delete(v, c, id)),
385
+ list: (v, c) => retryable(() => next.list(v, c)),
386
+ loadAll: (v) => retryable(() => next.loadAll(v)),
387
+ saveAll: (v, d) => retryable(() => next.saveAll(v, d))
388
+ });
389
+ }
390
+ var LOG_LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
391
+ function withLogging(opts = {}) {
392
+ const minLevel = LOG_LEVELS[opts.level ?? "info"];
393
+ const logger = opts.logger ?? console;
394
+ const logData = opts.logData ?? false;
395
+ function log(level, method, args, durationMs) {
396
+ if (LOG_LEVELS[level] < minLevel) return;
397
+ const parts = [`[noydb:${method}]`, ...Object.entries(args).map(([k, v]) => `${k}=${String(v)}`)];
398
+ if (durationMs !== void 0) parts.push(`${durationMs}ms`);
399
+ logger[level](parts.join(" "));
400
+ }
401
+ function timed(method, args, fn) {
402
+ const start = Date.now();
403
+ return fn().then(
404
+ (result) => {
405
+ log("debug", method, args, Date.now() - start);
406
+ return result;
407
+ },
408
+ (err) => {
409
+ log("error", method, { ...args, error: err.message }, Date.now() - start);
410
+ throw err;
411
+ }
412
+ );
413
+ }
414
+ return (next) => ({
415
+ ...next,
416
+ name: next.name ? `log(${next.name})` : "log",
417
+ get: (v, c, id) => timed("get", { vault: v, collection: c, id }, () => next.get(v, c, id)),
418
+ put: (v, c, id, env, ev) => timed("put", {
419
+ vault: v,
420
+ collection: c,
421
+ id,
422
+ version: env._v,
423
+ ...logData ? { data: env._data.slice(0, 40) + "..." } : {}
424
+ }, () => next.put(v, c, id, env, ev)),
425
+ delete: (v, c, id) => timed("delete", { vault: v, collection: c, id }, () => next.delete(v, c, id)),
426
+ list: (v, c) => timed("list", { vault: v, collection: c }, () => next.list(v, c)),
427
+ loadAll: (v) => timed("loadAll", { vault: v }, () => next.loadAll(v)),
428
+ saveAll: (v, d) => timed("saveAll", { vault: v }, () => next.saveAll(v, d))
429
+ });
430
+ }
431
+ function withMetrics(opts) {
432
+ function tracked(method, vault, fn, collection, id) {
433
+ const start = Date.now();
434
+ return fn().then(
435
+ (result) => {
436
+ opts.onOperation({
437
+ method,
438
+ vault,
439
+ ...collection !== void 0 ? { collection } : {},
440
+ ...id !== void 0 ? { id } : {},
441
+ durationMs: Date.now() - start,
442
+ success: true
443
+ });
444
+ return result;
445
+ },
446
+ (err) => {
447
+ opts.onOperation({
448
+ method,
449
+ vault,
450
+ ...collection !== void 0 ? { collection } : {},
451
+ ...id !== void 0 ? { id } : {},
452
+ durationMs: Date.now() - start,
453
+ success: false,
454
+ error: err
455
+ });
456
+ throw err;
457
+ }
458
+ );
459
+ }
460
+ return (next) => ({
461
+ ...next,
462
+ name: next.name ? `metrics(${next.name})` : "metrics",
463
+ get: (v, c, id) => tracked("get", v, () => next.get(v, c, id), c, id),
464
+ put: (v, c, id, env, ev) => tracked("put", v, () => next.put(v, c, id, env, ev), c, id),
465
+ delete: (v, c, id) => tracked("delete", v, () => next.delete(v, c, id), c, id),
466
+ list: (v, c) => tracked("list", v, () => next.list(v, c), c),
467
+ loadAll: (v) => tracked("loadAll", v, () => next.loadAll(v)),
468
+ saveAll: (v, d) => tracked("saveAll", v, () => next.saveAll(v, d))
469
+ });
470
+ }
471
+ function withCircuitBreaker(opts = {}) {
472
+ const threshold = opts.failureThreshold ?? 5;
473
+ const resetMs = opts.resetTimeoutMs ?? 3e4;
474
+ let state = "closed";
475
+ let failures = 0;
476
+ let lastFailureTime = 0;
477
+ function recordSuccess() {
478
+ if (state === "half-open") {
479
+ state = "closed";
480
+ failures = 0;
481
+ opts.onClose?.();
482
+ }
483
+ failures = 0;
484
+ }
485
+ function recordFailure() {
486
+ failures++;
487
+ lastFailureTime = Date.now();
488
+ if (failures >= threshold && state === "closed") {
489
+ state = "open";
490
+ opts.onOpen?.();
491
+ }
492
+ }
493
+ function canAttempt() {
494
+ if (state === "closed") return true;
495
+ if (state === "open") {
496
+ if (Date.now() - lastFailureTime >= resetMs) {
497
+ state = "half-open";
498
+ return true;
499
+ }
500
+ return false;
501
+ }
502
+ return true;
503
+ }
504
+ async function guarded(fn, fallback) {
505
+ if (!canAttempt()) return fallback;
506
+ try {
507
+ const result = await fn();
508
+ recordSuccess();
509
+ return result;
510
+ } catch (err) {
511
+ recordFailure();
512
+ throw err;
513
+ }
514
+ }
515
+ return (next) => ({
516
+ ...next,
517
+ name: next.name ? `cb(${next.name})` : "cb",
518
+ get: (v, c, id) => guarded(() => next.get(v, c, id), null),
519
+ put: (v, c, id, env, ev) => guarded(() => next.put(v, c, id, env, ev), void 0),
520
+ delete: (v, c, id) => guarded(() => next.delete(v, c, id), void 0),
521
+ list: (v, c) => guarded(() => next.list(v, c), []),
522
+ loadAll: (v) => guarded(() => next.loadAll(v), {}),
523
+ saveAll: (v, d) => guarded(() => next.saveAll(v, d), void 0)
524
+ });
525
+ }
526
+ function withCache(opts = {}) {
527
+ const maxEntries = opts.maxEntries ?? 500;
528
+ const ttlMs = opts.ttlMs ?? 6e4;
529
+ const cache = /* @__PURE__ */ new Map();
530
+ function cacheKey(vault, collection, id) {
531
+ return `${vault}\0${collection}\0${id}`;
532
+ }
533
+ function getFromCache(key) {
534
+ const entry = cache.get(key);
535
+ if (!entry) return void 0;
536
+ if (ttlMs > 0 && Date.now() - entry.cachedAt > ttlMs) {
537
+ cache.delete(key);
538
+ return void 0;
539
+ }
540
+ cache.delete(key);
541
+ cache.set(key, entry);
542
+ return entry.envelope;
543
+ }
544
+ function setInCache(key, envelope) {
545
+ if (cache.size >= maxEntries) {
546
+ const oldest = cache.keys().next().value;
547
+ if (oldest !== void 0) cache.delete(oldest);
548
+ }
549
+ cache.set(key, { envelope, cachedAt: Date.now() });
550
+ }
551
+ function invalidate(key) {
552
+ cache.delete(key);
553
+ }
554
+ return (next) => ({
555
+ ...next,
556
+ name: next.name ? `cache(${next.name})` : "cache",
557
+ async get(vault, collection, id) {
558
+ const key = cacheKey(vault, collection, id);
559
+ const cached = getFromCache(key);
560
+ if (cached !== void 0) return cached;
561
+ const result = await next.get(vault, collection, id);
562
+ setInCache(key, result);
563
+ return result;
564
+ },
565
+ async put(vault, collection, id, env, ev) {
566
+ invalidate(cacheKey(vault, collection, id));
567
+ await next.put(vault, collection, id, env, ev);
568
+ setInCache(cacheKey(vault, collection, id), env);
569
+ },
570
+ async delete(vault, collection, id) {
571
+ invalidate(cacheKey(vault, collection, id));
572
+ await next.delete(vault, collection, id);
573
+ },
574
+ list: (v, c) => next.list(v, c),
575
+ loadAll: (v) => next.loadAll(v),
576
+ saveAll: (v, d) => next.saveAll(v, d)
577
+ });
578
+ }
579
+ function withHealthCheck(opts = {}) {
580
+ const intervalMs = opts.checkIntervalMs ?? 3e4;
581
+ const failThreshold = opts.suspendAfterFailures ?? 3;
582
+ const successThreshold = opts.resumeAfterSuccess ?? 1;
583
+ let isSuspended = false;
584
+ let consecutiveFailures = 0;
585
+ let consecutiveSuccesses = 0;
586
+ return (next) => {
587
+ const checkFn = opts.check ?? (next.ping ? () => next.ping() : async () => {
588
+ await next.list("__health__", "__ping__");
589
+ return true;
590
+ });
591
+ async function doCheck() {
592
+ try {
593
+ const ok = await checkFn();
594
+ if (ok) {
595
+ consecutiveFailures = 0;
596
+ consecutiveSuccesses++;
597
+ if (isSuspended && consecutiveSuccesses >= successThreshold) {
598
+ isSuspended = false;
599
+ consecutiveSuccesses = 0;
600
+ opts.onResume?.();
601
+ }
602
+ } else {
603
+ throw new Error("Health check returned false");
604
+ }
605
+ } catch {
606
+ consecutiveSuccesses = 0;
607
+ consecutiveFailures++;
608
+ if (!isSuspended && consecutiveFailures >= failThreshold) {
609
+ isSuspended = true;
610
+ consecutiveFailures = 0;
611
+ opts.onSuspend?.();
612
+ }
613
+ }
614
+ }
615
+ setInterval(() => {
616
+ void doCheck();
617
+ }, intervalMs);
618
+ const wrapped = {
619
+ ...next,
620
+ name: next.name ? `health(${next.name})` : "health",
621
+ async get(v, c, id) {
622
+ return isSuspended ? null : next.get(v, c, id);
623
+ },
624
+ async put(v, c, id, env, ev) {
625
+ if (!isSuspended) await next.put(v, c, id, env, ev);
626
+ },
627
+ async delete(v, c, id) {
628
+ if (!isSuspended) await next.delete(v, c, id);
629
+ },
630
+ async list(v, c) {
631
+ return isSuspended ? [] : next.list(v, c);
632
+ },
633
+ async loadAll(v) {
634
+ return isSuspended ? {} : next.loadAll(v);
635
+ },
636
+ async saveAll(v, d) {
637
+ if (!isSuspended) await next.saveAll(v, d);
638
+ }
639
+ };
640
+ return wrapped;
641
+ };
642
+ }
643
+
644
+ export {
645
+ routeStore,
646
+ wrapStore,
647
+ withRetry,
648
+ withLogging,
649
+ withMetrics,
650
+ withCircuitBreaker,
651
+ withCache,
652
+ withHealthCheck
653
+ };
654
+ //# sourceMappingURL=chunk-EIPVYUEP.js.map