@noy-db/hub 0.5.0 → 0.6.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/dist/api-67SBPMMH.js +20 -0
  2. package/dist/attestation/index.js +18 -18
  3. package/dist/{backup-ENTZYW37.js → backup-GAYWQAFN.js} +16 -11
  4. package/dist/backup-GAYWQAFN.js.map +1 -0
  5. package/dist/blobs/index.js +20 -20
  6. package/dist/broker/index.js +12 -12
  7. package/dist/bundle-handle-5OUAI7CV.js +36 -0
  8. package/dist/bundle-handle-5OUAI7CV.js.map +1 -0
  9. package/dist/cargo/index.js +36 -36
  10. package/dist/{chunk-V3EGXDFN.js → chunk-24UICKTB.js} +3 -3
  11. package/dist/{chunk-77AEMXFA.js → chunk-24ZLWWEO.js} +1 -1
  12. package/dist/chunk-24ZLWWEO.js.map +1 -0
  13. package/dist/{chunk-6PFST3FC.js → chunk-27TCYH6G.js} +5 -5
  14. package/dist/{chunk-PTSVGKSR.js → chunk-2KIV7BEK.js} +2 -2
  15. package/dist/{chunk-3LYMOSY7.js → chunk-2LGDCNFJ.js} +2 -2
  16. package/dist/{chunk-NWK6SVBM.js → chunk-35EBKWQU.js} +3 -3
  17. package/dist/{chunk-QMCWYN6O.js → chunk-3737A6EA.js} +3 -3
  18. package/dist/{chunk-5UKUOMO6.js → chunk-3CLZY46Y.js} +464 -237
  19. package/dist/chunk-3CLZY46Y.js.map +1 -0
  20. package/dist/{chunk-G7ZIMGPQ.js → chunk-3EO7RZLJ.js} +6 -6
  21. package/dist/{chunk-GYJRDALN.js → chunk-3FSX6LDG.js} +2 -2
  22. package/dist/{chunk-4SG5TOXK.js → chunk-3HYWYLXL.js} +2 -2
  23. package/dist/{chunk-653KOQ7A.js → chunk-3IIPWA75.js} +11 -11
  24. package/dist/{chunk-IQ423YMK.js → chunk-3UK6STWO.js} +3 -3
  25. package/dist/chunk-46V67XP5.js +117 -0
  26. package/dist/chunk-46V67XP5.js.map +1 -0
  27. package/dist/{chunk-F5UWVF6Z.js → chunk-4HDYQL3J.js} +2 -2
  28. package/dist/{chunk-J7YVY7TW.js → chunk-4MQDV3HZ.js} +2 -2
  29. package/dist/{chunk-UC5Y7OEJ.js → chunk-4UVDI4XE.js} +3 -3
  30. package/dist/{chunk-4DGBZEV6.js → chunk-4VCWI42L.js} +2 -2
  31. package/dist/{chunk-GIGLOQL7.js → chunk-747LRSOO.js} +2 -2
  32. package/dist/{chunk-W7C7MMIS.js → chunk-7F4DBNSP.js} +3 -3
  33. package/dist/{chunk-5EKL6BXI.js → chunk-7G6VDWXB.js} +3 -3
  34. package/dist/{chunk-PZRYKOKP.js → chunk-AHLJSVRL.js} +2 -2
  35. package/dist/{chunk-L67H6FAQ.js → chunk-AR2JDFAE.js} +2 -2
  36. package/dist/{chunk-TJOUKMWF.js → chunk-BPTZ4K5L.js} +11 -11
  37. package/dist/{chunk-MFW466PX.js → chunk-CCZJJ4I2.js} +4 -4
  38. package/dist/{chunk-OKBNFUUX.js → chunk-CJ73OLMW.js} +2 -2
  39. package/dist/{chunk-FHK6WWUE.js → chunk-CYQOUTMY.js} +3 -3
  40. package/dist/{chunk-LQVRK2XJ.js → chunk-DCMQR46R.js} +5 -5
  41. package/dist/{chunk-QTMZDMJ6.js → chunk-DG27IUVI.js} +2 -2
  42. package/dist/{chunk-XVK7TULT.js → chunk-DMQCLZ4Z.js} +8 -6
  43. package/dist/chunk-DMQCLZ4Z.js.map +1 -0
  44. package/dist/{chunk-IHYSIPEK.js → chunk-DPJTDNUF.js} +68 -34
  45. package/dist/chunk-DPJTDNUF.js.map +1 -0
  46. package/dist/{chunk-PKBONLCP.js → chunk-E6427JU2.js} +2 -2
  47. package/dist/{chunk-KDWBVCIX.js → chunk-EK7DT5BT.js} +220 -13
  48. package/dist/chunk-EK7DT5BT.js.map +1 -0
  49. package/dist/chunk-EPFF7LOX.js +14 -0
  50. package/dist/chunk-EPFF7LOX.js.map +1 -0
  51. package/dist/{chunk-XID22NOA.js → chunk-F3GVO44K.js} +6 -6
  52. package/dist/{chunk-U2ID5A2I.js → chunk-FAXZQ5UF.js} +2 -2
  53. package/dist/{chunk-P6UIVLZK.js → chunk-FNSMZQS4.js} +2 -2
  54. package/dist/{chunk-NIKQQXI2.js → chunk-FUHKW252.js} +2 -2
  55. package/dist/{chunk-623QEHDB.js → chunk-FY343IZR.js} +8 -8
  56. package/dist/{chunk-KPZS5QAQ.js → chunk-GQ3BX5EA.js} +9 -1
  57. package/dist/chunk-GQ3BX5EA.js.map +1 -0
  58. package/dist/{chunk-7P4LL3JH.js → chunk-GS5RT2KK.js} +4 -4
  59. package/dist/{chunk-IM2KST7E.js → chunk-HFKGIBMD.js} +3 -3
  60. package/dist/{chunk-AR5D76T2.js → chunk-HNGSV2YC.js} +129 -1
  61. package/dist/chunk-HNGSV2YC.js.map +1 -0
  62. package/dist/chunk-HNHCQ556.js +63 -0
  63. package/dist/chunk-HNHCQ556.js.map +1 -0
  64. package/dist/chunk-HS7HNYBD.js +91 -0
  65. package/dist/chunk-HS7HNYBD.js.map +1 -0
  66. package/dist/{chunk-FT5Y4VSP.js → chunk-HVQGCKY4.js} +2 -2
  67. package/dist/{chunk-MYSNNMJ3.js → chunk-HXGUIPQB.js} +3 -3
  68. package/dist/{chunk-GTQF32TP.js → chunk-JEM2IGS3.js} +9 -9
  69. package/dist/chunk-JH3OHQM4.js +260 -0
  70. package/dist/chunk-JH3OHQM4.js.map +1 -0
  71. package/dist/{chunk-ALUVACKT.js → chunk-JIUVJ4M7.js} +2 -2
  72. package/dist/{chunk-NJHQE4LT.js → chunk-JRCYZEHU.js} +2 -2
  73. package/dist/{chunk-G3ORJ3IQ.js → chunk-JSRU5W2M.js} +5 -5
  74. package/dist/{chunk-SBGXQK5I.js → chunk-JXIDGFKS.js} +2 -2
  75. package/dist/{chunk-VYYM3MEN.js → chunk-KHKKD62N.js} +16 -2
  76. package/dist/chunk-KHKKD62N.js.map +1 -0
  77. package/dist/{chunk-FQ5CHJR7.js → chunk-KUDZVJKQ.js} +21 -2
  78. package/dist/chunk-KUDZVJKQ.js.map +1 -0
  79. package/dist/{chunk-MGXUAID4.js → chunk-KZ3KMDN3.js} +2 -2
  80. package/dist/{chunk-HGDXJVK2.js → chunk-LBGPO5RL.js} +6 -6
  81. package/dist/{chunk-F2WWHKO7.js → chunk-LTU4FLHG.js} +57 -27
  82. package/dist/chunk-LTU4FLHG.js.map +1 -0
  83. package/dist/{chunk-CLE3TMIS.js → chunk-MC2LFTQM.js} +5 -2
  84. package/dist/{chunk-ECGDJU5R.js → chunk-MJWCLSQL.js} +17 -8
  85. package/dist/chunk-MJWCLSQL.js.map +1 -0
  86. package/dist/{chunk-EAN4TAPC.js → chunk-MSWYQLMQ.js} +2 -2
  87. package/dist/{chunk-WK7ULBTP.js → chunk-MVOWXQHN.js} +5 -3
  88. package/dist/chunk-MVOWXQHN.js.map +1 -0
  89. package/dist/{chunk-K5OFKXUG.js → chunk-MXZ5TSTR.js} +118 -4
  90. package/dist/chunk-MXZ5TSTR.js.map +1 -0
  91. package/dist/{chunk-OKRXXFZZ.js → chunk-MZ5ZFO2D.js} +3 -3
  92. package/dist/{chunk-RQILGK3N.js → chunk-NQCNSVGI.js} +5 -5
  93. package/dist/{chunk-EFJAAFBW.js → chunk-NQRJ5AJO.js} +2 -2
  94. package/dist/{chunk-Q2SEJMP2.js → chunk-NVU7ZMPN.js} +2 -2
  95. package/dist/{chunk-Y2PTKKIN.js → chunk-OF3L2SD6.js} +2 -2
  96. package/dist/{chunk-MDRCEA56.js → chunk-OMSAULZM.js} +11 -11
  97. package/dist/{chunk-SL3PLML2.js → chunk-OSFPNKY4.js} +3 -3
  98. package/dist/{chunk-XX7YB5BI.js → chunk-P7NGLLUF.js} +5 -5
  99. package/dist/{chunk-QITP2JGX.js → chunk-PGAPBZEK.js} +7 -7
  100. package/dist/{chunk-KJNMTE2W.js → chunk-PP5CO2PR.js} +6 -6
  101. package/dist/{chunk-FZAP4JNC.js → chunk-RLWY6Z44.js} +227 -41
  102. package/dist/chunk-RLWY6Z44.js.map +1 -0
  103. package/dist/{chunk-NG4AQIYJ.js → chunk-ROWL352P.js} +5 -5
  104. package/dist/{chunk-V4O6YZSP.js → chunk-RPXL6KSX.js} +4 -4
  105. package/dist/{chunk-ODCEOSJF.js → chunk-SKONR2OL.js} +3 -3
  106. package/dist/{chunk-RM4FIXY2.js → chunk-SRGJET2F.js} +16 -5
  107. package/dist/chunk-SRGJET2F.js.map +1 -0
  108. package/dist/{chunk-QQL6XPPG.js → chunk-T4GPR2IR.js} +2 -2
  109. package/dist/{chunk-WFYKIDCS.js → chunk-TFZ7LLOQ.js} +88 -30
  110. package/dist/chunk-TFZ7LLOQ.js.map +1 -0
  111. package/dist/{chunk-NMYH55MW.js → chunk-TLNNHG3A.js} +4 -4
  112. package/dist/{chunk-DDB626I7.js → chunk-UHXCLPGC.js} +2 -2
  113. package/dist/{chunk-Q6MXHDSE.js → chunk-V5C5NNBR.js} +4 -4
  114. package/dist/{chunk-ELJOLQIG.js → chunk-VBY6ZLJT.js} +7 -7
  115. package/dist/{chunk-RPWMDIGK.js → chunk-VCETL77O.js} +34 -16
  116. package/dist/chunk-VCETL77O.js.map +1 -0
  117. package/dist/{chunk-IJV56FWY.js → chunk-VJFMXYKP.js} +2 -2
  118. package/dist/{chunk-BFG7LD6Z.js → chunk-VMCCGUQB.js} +2 -2
  119. package/dist/{chunk-PWEMRXPO.js → chunk-W3TVWF6N.js} +2 -2
  120. package/dist/{chunk-4TXO442D.js → chunk-WLYIROCJ.js} +2 -2
  121. package/dist/{chunk-MPW6AHTC.js → chunk-XB7LUDKM.js} +4 -4
  122. package/dist/{chunk-YA7Y3EZP.js → chunk-XBLKM73C.js} +10 -10
  123. package/dist/{chunk-LXRVTJ5D.js → chunk-YAWK6AWF.js} +2 -2
  124. package/dist/{chunk-6RDTG6E5.js → chunk-ZGGVOADG.js} +5 -5
  125. package/dist/{chunk-JLBCK7XM.js → chunk-ZK4CO2KZ.js} +6 -6
  126. package/dist/{chunk-DSDXAKIP.js → chunk-ZVF37PKE.js} +34 -5
  127. package/dist/chunk-ZVF37PKE.js.map +1 -0
  128. package/dist/{chunk-NZEGQWQ5.js → chunk-ZWMO5GL5.js} +5 -5
  129. package/dist/{chunk-4MSNAB64.js → chunk-ZXJXDHNK.js} +4 -4
  130. package/dist/classified/index.js +5 -5
  131. package/dist/{classified-marker-ZALWKOBC.js → classified-marker-MH3ON5OL.js} +3 -3
  132. package/dist/collection-facade-AHT7FATG.js +45 -0
  133. package/dist/{computed-YOQCGUCS.js → computed-6G5M3UPH.js} +3 -3
  134. package/dist/consent/index.js +9 -9
  135. package/dist/cover/index.js +3 -3
  136. package/dist/custody/index.js +11 -11
  137. package/dist/{dead-filter-6DVWST6U.js → dead-filter-U575NGSH.js} +2 -2
  138. package/dist/debug/index.js +1 -1
  139. package/dist/{delegation-WMO3Q3O5.js → delegation-PDYL6RWT.js} +10 -10
  140. package/dist/derivations/index.js +12 -12
  141. package/dist/derive-AKT4KU36.js +22 -0
  142. package/dist/directory/index.js +10 -10
  143. package/dist/{dispatch-VNR3TLBX.js → dispatch-4XIJSFTT.js} +5 -5
  144. package/dist/{dispatch-TKV4UCKB.js → dispatch-N5HGVUGU.js} +18 -18
  145. package/dist/{enclave-YWP3QAIQ.js → enclave-OPK24QDR.js} +13 -9
  146. package/dist/executor-3JZ4POTW.js +28 -0
  147. package/dist/executor-CYJQLKKI.js +9 -0
  148. package/dist/executor-S4QIKEHW.js +9 -0
  149. package/dist/export-accessible-CPTP5STN.js +23 -0
  150. package/dist/extract-partition-TWXPHVU7.js +38 -0
  151. package/dist/{fanout-sidecar-WYXO6QQT.js → fanout-sidecar-T2ZGLQFE.js} +9 -9
  152. package/dist/find-RBBYKXI7.js +11 -0
  153. package/dist/forget/index.js +9 -9
  154. package/dist/guards/index.js +4 -4
  155. package/dist/history/index.js +15 -15
  156. package/dist/i18n/index.js +14 -14
  157. package/dist/index.d.ts +35 -7
  158. package/dist/index.js +276 -201
  159. package/dist/index.js.map +1 -1
  160. package/dist/indexing/index.js +3 -3
  161. package/dist/introspection/index.js +12 -12
  162. package/dist/issue-N74C55X6.js +19 -0
  163. package/dist/kernel/collection.d.ts +10 -2
  164. package/dist/kernel/cutover-transform.d.ts +64 -0
  165. package/dist/kernel/enclave/crypto.d.ts +24 -0
  166. package/dist/kernel/enclave/index.d.ts +2 -1
  167. package/dist/kernel/errors.d.ts +123 -0
  168. package/dist/kernel/noydb.d.ts +10 -1
  169. package/dist/kernel/secret-mode.d.ts +59 -0
  170. package/dist/kernel/types.d.ts +98 -7
  171. package/dist/kernel/validation.d.ts +33 -0
  172. package/dist/kernel/vault.d.ts +18 -6
  173. package/dist/{ledger-BLYDYRTQ.js → ledger-DONWFC5M.js} +11 -11
  174. package/dist/liberate-KICI7AJN.js +24 -0
  175. package/dist/{link-set-7F5ZPDEB.js → link-set-2TTP4VLO.js} +11 -11
  176. package/dist/managed-secret-EAOYWRYF.js +27 -0
  177. package/dist/materialized-views/index.js +24 -24
  178. package/dist/money/index.js +3 -3
  179. package/dist/noydb-6W2XGQCS.js +83 -0
  180. package/dist/overlay-views/index.js +6 -6
  181. package/dist/periods/index.js +16 -16
  182. package/dist/pod/index.js +121 -12
  183. package/dist/policy/index.js +4 -4
  184. package/dist/port/to/index.d.ts +3 -1
  185. package/dist/port/to/locator.d.ts +84 -0
  186. package/dist/port/with/device-seal-strategy.d.ts +16 -0
  187. package/dist/port/with/strategies.d.ts +2 -0
  188. package/dist/portability/index.js +8 -8
  189. package/dist/{post-register-PQSY544J.js → post-register-ORQOQJCS.js} +6 -6
  190. package/dist/query/index.js +4 -4
  191. package/dist/reduce/index.js +4 -4
  192. package/dist/register-LHETZRJM.js +32 -0
  193. package/dist/registry-AMAZ6QRZ.js +19 -0
  194. package/dist/registry-CZVINVQH.js +9 -0
  195. package/dist/registry-IKUR2MXD.js +9 -0
  196. package/dist/registry-JRIN447B.js +18 -0
  197. package/dist/request-withdrawal-2DN2RGCO.js +31 -0
  198. package/dist/{reveal-HY7DZST4.js → reveal-AG4SCHUQ.js} +6 -6
  199. package/dist/revoke-ZX4NM2CJ.js +24 -0
  200. package/dist/satellites/index.js +1 -1
  201. package/dist/schema-update/index.js +6 -6
  202. package/dist/sealed-record/index.js +12 -12
  203. package/dist/search/index.js +4 -4
  204. package/dist/{seed-ALU3BHFS.js → seed-IRCDGIRK.js} +11 -11
  205. package/dist/sequence/index.js +9 -9
  206. package/dist/session/index.js +9 -9
  207. package/dist/shadow/index.js +2 -2
  208. package/dist/signer-7KHD4OL2.js +25 -0
  209. package/dist/snapshots/index.js +10 -10
  210. package/dist/{stale-U3WO5MYN.js → stale-K734VACF.js} +10 -10
  211. package/dist/storage-4H2GF6RQ.js +23 -0
  212. package/dist/{store-coordination-provider-AHGFEMFA.js → store-coordination-provider-4SKLSFUG.js} +3 -3
  213. package/dist/sync/index.js +10 -10
  214. package/dist/team/index.js +27 -15
  215. package/dist/tiers/index.js +10 -10
  216. package/dist/to/index.js +28 -3
  217. package/dist/to/index.js.map +1 -1
  218. package/dist/transactions/index.js +3 -3
  219. package/dist/util/index.js +1 -1
  220. package/dist/{verify-JEIXSK5U.js → verify-RO5RTZOJ.js} +5 -5
  221. package/dist/walk-MQHYNDLZ.js +21 -0
  222. package/dist/with-audit/guards/registry.d.ts +8 -1
  223. package/dist/with-audit/guards/types.d.ts +5 -0
  224. package/dist/with-audit/periods/index.d.ts +1 -1
  225. package/dist/with-audit/periods/periods.d.ts +7 -0
  226. package/dist/with-formula/derivations/registry.d.ts +6 -0
  227. package/dist/with-formula/derivations/types.d.ts +5 -0
  228. package/dist/with-lookup/indexing/eager-indexes.d.ts +10 -0
  229. package/dist/with-party/team/device-seal.d.ts +25 -0
  230. package/dist/with-party/team/echo-ceremony.d.ts +74 -0
  231. package/dist/with-party/team/echo-secret.d.ts +56 -0
  232. package/dist/with-party/team/index.d.ts +8 -0
  233. package/dist/with-party/team/keyring.d.ts +71 -9
  234. package/dist/with-party/team/rotate-recover.d.ts +99 -5
  235. package/dist/with-pod/bundle-handle.d.ts +9 -0
  236. package/dist/with-pod/bundle.d.ts +100 -2
  237. package/dist/with-pod/format.d.ts +92 -1
  238. package/dist/with-pod/index.d.ts +22 -1
  239. package/dist/with-pod/open.d.ts +117 -0
  240. package/dist/with-pod/redirect.d.ts +78 -0
  241. package/dist/with-pod/signature.d.ts +13 -0
  242. package/dist/with-shape/introspection/behaviors.d.ts +100 -0
  243. package/dist/with-shape/introspection/derivation-key.d.ts +17 -0
  244. package/dist/with-shape/introspection/describe.d.ts +36 -0
  245. package/dist/with-shape/introspection/index.d.ts +1 -0
  246. package/dist/with-shape/introspection/subsystem-matrix.d.ts +22 -0
  247. package/dist/with-shape/introspection/types.d.ts +2 -1
  248. package/dist/with-shape/links/names.d.ts +14 -0
  249. package/dist/with-shape/manifest/derive.d.ts +86 -0
  250. package/dist/with-shape/manifest/reserved-collections.d.ts +27 -0
  251. package/dist/with-shape/manifest/storage.d.ts +62 -0
  252. package/dist/with-shape/manifest/sync.d.ts +135 -0
  253. package/dist/with-shape/manifest/types.d.ts +49 -0
  254. package/dist/with-shape/manifest/writer.d.ts +32 -0
  255. package/dist/with-shape/persisted-schemas/field-ids.d.ts +29 -0
  256. package/dist/with-shape/persisted-schemas/register.d.ts +3 -0
  257. package/dist/with-shape/persisted-schemas/types.d.ts +17 -0
  258. package/dist/with-shape/schema-update/fence-controller.d.ts +34 -0
  259. package/dist/with-shape/schema-update/fence.d.ts +9 -0
  260. package/dist/with-shape/schema-update/strategies.d.ts +18 -2
  261. package/dist/with-shape/schema-update/types.d.ts +11 -0
  262. package/dist/with-sync/engine.d.ts +4 -0
  263. package/dist/with-sync/presence.d.ts +31 -1
  264. package/dist/withdraw-accessible-JSDQHXHE.js +28 -0
  265. package/dist/withdraw-accessible-JSDQHXHE.js.map +1 -0
  266. package/package.json +3 -3
  267. package/dist/api-M7REIE7H.js +0 -20
  268. package/dist/backup-ENTZYW37.js.map +0 -1
  269. package/dist/chunk-5UKUOMO6.js.map +0 -1
  270. package/dist/chunk-77AEMXFA.js.map +0 -1
  271. package/dist/chunk-AJAOXFCF.js +0 -129
  272. package/dist/chunk-AJAOXFCF.js.map +0 -1
  273. package/dist/chunk-AR5D76T2.js.map +0 -1
  274. package/dist/chunk-DSDXAKIP.js.map +0 -1
  275. package/dist/chunk-EBETHILL.js +0 -41
  276. package/dist/chunk-EBETHILL.js.map +0 -1
  277. package/dist/chunk-ECGDJU5R.js.map +0 -1
  278. package/dist/chunk-F2WWHKO7.js.map +0 -1
  279. package/dist/chunk-FQ5CHJR7.js.map +0 -1
  280. package/dist/chunk-FUECZSRM.js +0 -23
  281. package/dist/chunk-FUECZSRM.js.map +0 -1
  282. package/dist/chunk-FZAP4JNC.js.map +0 -1
  283. package/dist/chunk-IHYSIPEK.js.map +0 -1
  284. package/dist/chunk-K5OFKXUG.js.map +0 -1
  285. package/dist/chunk-KDWBVCIX.js.map +0 -1
  286. package/dist/chunk-KPZS5QAQ.js.map +0 -1
  287. package/dist/chunk-RM4FIXY2.js.map +0 -1
  288. package/dist/chunk-RPWMDIGK.js.map +0 -1
  289. package/dist/chunk-US2AR4BI.js +0 -25
  290. package/dist/chunk-US2AR4BI.js.map +0 -1
  291. package/dist/chunk-VYYM3MEN.js.map +0 -1
  292. package/dist/chunk-WFYKIDCS.js.map +0 -1
  293. package/dist/chunk-WK7ULBTP.js.map +0 -1
  294. package/dist/chunk-XVK7TULT.js.map +0 -1
  295. package/dist/collection-facade-KI53O6QB.js +0 -45
  296. package/dist/derive-P2NXWUNB.js +0 -22
  297. package/dist/executor-M4ZZNX6S.js +0 -28
  298. package/dist/executor-TI64S4LE.js +0 -9
  299. package/dist/executor-YBK3I2OT.js +0 -9
  300. package/dist/export-accessible-GBLYLGW4.js +0 -23
  301. package/dist/extract-partition-SFV35U2R.js +0 -38
  302. package/dist/find-HUSSZRBR.js +0 -11
  303. package/dist/issue-6TIJYWKS.js +0 -19
  304. package/dist/liberate-TSOW7IG5.js +0 -24
  305. package/dist/noydb-KFN6M6UJ.js +0 -81
  306. package/dist/register-S3ECUZPV.js +0 -25
  307. package/dist/registry-BWD2ED52.js +0 -8
  308. package/dist/registry-FZOHKUME.js +0 -18
  309. package/dist/registry-RISV7IDZ.js +0 -19
  310. package/dist/registry-ZE35A7WC.js +0 -9
  311. package/dist/request-withdrawal-KXVTQKR5.js +0 -31
  312. package/dist/revoke-J473JJ22.js +0 -24
  313. package/dist/signer-XLUKCCH3.js +0 -25
  314. package/dist/storage-IQONEOYY.js +0 -23
  315. package/dist/walk-BF36V4SR.js +0 -21
  316. package/dist/withdraw-accessible-TYTA23XH.js +0 -28
  317. /package/dist/{api-M7REIE7H.js.map → api-67SBPMMH.js.map} +0 -0
  318. /package/dist/{chunk-V3EGXDFN.js.map → chunk-24UICKTB.js.map} +0 -0
  319. /package/dist/{chunk-6PFST3FC.js.map → chunk-27TCYH6G.js.map} +0 -0
  320. /package/dist/{chunk-PTSVGKSR.js.map → chunk-2KIV7BEK.js.map} +0 -0
  321. /package/dist/{chunk-3LYMOSY7.js.map → chunk-2LGDCNFJ.js.map} +0 -0
  322. /package/dist/{chunk-NWK6SVBM.js.map → chunk-35EBKWQU.js.map} +0 -0
  323. /package/dist/{chunk-QMCWYN6O.js.map → chunk-3737A6EA.js.map} +0 -0
  324. /package/dist/{chunk-G7ZIMGPQ.js.map → chunk-3EO7RZLJ.js.map} +0 -0
  325. /package/dist/{chunk-GYJRDALN.js.map → chunk-3FSX6LDG.js.map} +0 -0
  326. /package/dist/{chunk-4SG5TOXK.js.map → chunk-3HYWYLXL.js.map} +0 -0
  327. /package/dist/{chunk-653KOQ7A.js.map → chunk-3IIPWA75.js.map} +0 -0
  328. /package/dist/{chunk-IQ423YMK.js.map → chunk-3UK6STWO.js.map} +0 -0
  329. /package/dist/{chunk-F5UWVF6Z.js.map → chunk-4HDYQL3J.js.map} +0 -0
  330. /package/dist/{chunk-J7YVY7TW.js.map → chunk-4MQDV3HZ.js.map} +0 -0
  331. /package/dist/{chunk-UC5Y7OEJ.js.map → chunk-4UVDI4XE.js.map} +0 -0
  332. /package/dist/{chunk-4DGBZEV6.js.map → chunk-4VCWI42L.js.map} +0 -0
  333. /package/dist/{chunk-GIGLOQL7.js.map → chunk-747LRSOO.js.map} +0 -0
  334. /package/dist/{chunk-W7C7MMIS.js.map → chunk-7F4DBNSP.js.map} +0 -0
  335. /package/dist/{chunk-5EKL6BXI.js.map → chunk-7G6VDWXB.js.map} +0 -0
  336. /package/dist/{chunk-PZRYKOKP.js.map → chunk-AHLJSVRL.js.map} +0 -0
  337. /package/dist/{chunk-L67H6FAQ.js.map → chunk-AR2JDFAE.js.map} +0 -0
  338. /package/dist/{chunk-TJOUKMWF.js.map → chunk-BPTZ4K5L.js.map} +0 -0
  339. /package/dist/{chunk-MFW466PX.js.map → chunk-CCZJJ4I2.js.map} +0 -0
  340. /package/dist/{chunk-OKBNFUUX.js.map → chunk-CJ73OLMW.js.map} +0 -0
  341. /package/dist/{chunk-FHK6WWUE.js.map → chunk-CYQOUTMY.js.map} +0 -0
  342. /package/dist/{chunk-LQVRK2XJ.js.map → chunk-DCMQR46R.js.map} +0 -0
  343. /package/dist/{chunk-QTMZDMJ6.js.map → chunk-DG27IUVI.js.map} +0 -0
  344. /package/dist/{chunk-PKBONLCP.js.map → chunk-E6427JU2.js.map} +0 -0
  345. /package/dist/{chunk-XID22NOA.js.map → chunk-F3GVO44K.js.map} +0 -0
  346. /package/dist/{chunk-U2ID5A2I.js.map → chunk-FAXZQ5UF.js.map} +0 -0
  347. /package/dist/{chunk-P6UIVLZK.js.map → chunk-FNSMZQS4.js.map} +0 -0
  348. /package/dist/{chunk-NIKQQXI2.js.map → chunk-FUHKW252.js.map} +0 -0
  349. /package/dist/{chunk-623QEHDB.js.map → chunk-FY343IZR.js.map} +0 -0
  350. /package/dist/{chunk-7P4LL3JH.js.map → chunk-GS5RT2KK.js.map} +0 -0
  351. /package/dist/{chunk-IM2KST7E.js.map → chunk-HFKGIBMD.js.map} +0 -0
  352. /package/dist/{chunk-FT5Y4VSP.js.map → chunk-HVQGCKY4.js.map} +0 -0
  353. /package/dist/{chunk-MYSNNMJ3.js.map → chunk-HXGUIPQB.js.map} +0 -0
  354. /package/dist/{chunk-GTQF32TP.js.map → chunk-JEM2IGS3.js.map} +0 -0
  355. /package/dist/{chunk-ALUVACKT.js.map → chunk-JIUVJ4M7.js.map} +0 -0
  356. /package/dist/{chunk-NJHQE4LT.js.map → chunk-JRCYZEHU.js.map} +0 -0
  357. /package/dist/{chunk-G3ORJ3IQ.js.map → chunk-JSRU5W2M.js.map} +0 -0
  358. /package/dist/{chunk-SBGXQK5I.js.map → chunk-JXIDGFKS.js.map} +0 -0
  359. /package/dist/{chunk-MGXUAID4.js.map → chunk-KZ3KMDN3.js.map} +0 -0
  360. /package/dist/{chunk-HGDXJVK2.js.map → chunk-LBGPO5RL.js.map} +0 -0
  361. /package/dist/{chunk-CLE3TMIS.js.map → chunk-MC2LFTQM.js.map} +0 -0
  362. /package/dist/{chunk-EAN4TAPC.js.map → chunk-MSWYQLMQ.js.map} +0 -0
  363. /package/dist/{chunk-OKRXXFZZ.js.map → chunk-MZ5ZFO2D.js.map} +0 -0
  364. /package/dist/{chunk-RQILGK3N.js.map → chunk-NQCNSVGI.js.map} +0 -0
  365. /package/dist/{chunk-EFJAAFBW.js.map → chunk-NQRJ5AJO.js.map} +0 -0
  366. /package/dist/{chunk-Q2SEJMP2.js.map → chunk-NVU7ZMPN.js.map} +0 -0
  367. /package/dist/{chunk-Y2PTKKIN.js.map → chunk-OF3L2SD6.js.map} +0 -0
  368. /package/dist/{chunk-MDRCEA56.js.map → chunk-OMSAULZM.js.map} +0 -0
  369. /package/dist/{chunk-SL3PLML2.js.map → chunk-OSFPNKY4.js.map} +0 -0
  370. /package/dist/{chunk-XX7YB5BI.js.map → chunk-P7NGLLUF.js.map} +0 -0
  371. /package/dist/{chunk-QITP2JGX.js.map → chunk-PGAPBZEK.js.map} +0 -0
  372. /package/dist/{chunk-KJNMTE2W.js.map → chunk-PP5CO2PR.js.map} +0 -0
  373. /package/dist/{chunk-NG4AQIYJ.js.map → chunk-ROWL352P.js.map} +0 -0
  374. /package/dist/{chunk-V4O6YZSP.js.map → chunk-RPXL6KSX.js.map} +0 -0
  375. /package/dist/{chunk-ODCEOSJF.js.map → chunk-SKONR2OL.js.map} +0 -0
  376. /package/dist/{chunk-QQL6XPPG.js.map → chunk-T4GPR2IR.js.map} +0 -0
  377. /package/dist/{chunk-NMYH55MW.js.map → chunk-TLNNHG3A.js.map} +0 -0
  378. /package/dist/{chunk-DDB626I7.js.map → chunk-UHXCLPGC.js.map} +0 -0
  379. /package/dist/{chunk-Q6MXHDSE.js.map → chunk-V5C5NNBR.js.map} +0 -0
  380. /package/dist/{chunk-ELJOLQIG.js.map → chunk-VBY6ZLJT.js.map} +0 -0
  381. /package/dist/{chunk-IJV56FWY.js.map → chunk-VJFMXYKP.js.map} +0 -0
  382. /package/dist/{chunk-BFG7LD6Z.js.map → chunk-VMCCGUQB.js.map} +0 -0
  383. /package/dist/{chunk-PWEMRXPO.js.map → chunk-W3TVWF6N.js.map} +0 -0
  384. /package/dist/{chunk-4TXO442D.js.map → chunk-WLYIROCJ.js.map} +0 -0
  385. /package/dist/{chunk-MPW6AHTC.js.map → chunk-XB7LUDKM.js.map} +0 -0
  386. /package/dist/{chunk-YA7Y3EZP.js.map → chunk-XBLKM73C.js.map} +0 -0
  387. /package/dist/{chunk-LXRVTJ5D.js.map → chunk-YAWK6AWF.js.map} +0 -0
  388. /package/dist/{chunk-6RDTG6E5.js.map → chunk-ZGGVOADG.js.map} +0 -0
  389. /package/dist/{chunk-JLBCK7XM.js.map → chunk-ZK4CO2KZ.js.map} +0 -0
  390. /package/dist/{chunk-NZEGQWQ5.js.map → chunk-ZWMO5GL5.js.map} +0 -0
  391. /package/dist/{chunk-4MSNAB64.js.map → chunk-ZXJXDHNK.js.map} +0 -0
  392. /package/dist/{classified-marker-ZALWKOBC.js.map → classified-marker-MH3ON5OL.js.map} +0 -0
  393. /package/dist/{collection-facade-KI53O6QB.js.map → collection-facade-AHT7FATG.js.map} +0 -0
  394. /package/dist/{computed-YOQCGUCS.js.map → computed-6G5M3UPH.js.map} +0 -0
  395. /package/dist/{dead-filter-6DVWST6U.js.map → dead-filter-U575NGSH.js.map} +0 -0
  396. /package/dist/{delegation-WMO3Q3O5.js.map → delegation-PDYL6RWT.js.map} +0 -0
  397. /package/dist/{derive-P2NXWUNB.js.map → derive-AKT4KU36.js.map} +0 -0
  398. /package/dist/{dispatch-VNR3TLBX.js.map → dispatch-4XIJSFTT.js.map} +0 -0
  399. /package/dist/{dispatch-TKV4UCKB.js.map → dispatch-N5HGVUGU.js.map} +0 -0
  400. /package/dist/{enclave-YWP3QAIQ.js.map → enclave-OPK24QDR.js.map} +0 -0
  401. /package/dist/{executor-M4ZZNX6S.js.map → executor-3JZ4POTW.js.map} +0 -0
  402. /package/dist/{executor-TI64S4LE.js.map → executor-CYJQLKKI.js.map} +0 -0
  403. /package/dist/{executor-YBK3I2OT.js.map → executor-S4QIKEHW.js.map} +0 -0
  404. /package/dist/{export-accessible-GBLYLGW4.js.map → export-accessible-CPTP5STN.js.map} +0 -0
  405. /package/dist/{extract-partition-SFV35U2R.js.map → extract-partition-TWXPHVU7.js.map} +0 -0
  406. /package/dist/{fanout-sidecar-WYXO6QQT.js.map → fanout-sidecar-T2ZGLQFE.js.map} +0 -0
  407. /package/dist/{find-HUSSZRBR.js.map → find-RBBYKXI7.js.map} +0 -0
  408. /package/dist/{issue-6TIJYWKS.js.map → issue-N74C55X6.js.map} +0 -0
  409. /package/dist/{ledger-BLYDYRTQ.js.map → ledger-DONWFC5M.js.map} +0 -0
  410. /package/dist/{liberate-TSOW7IG5.js.map → liberate-KICI7AJN.js.map} +0 -0
  411. /package/dist/{link-set-7F5ZPDEB.js.map → link-set-2TTP4VLO.js.map} +0 -0
  412. /package/dist/{noydb-KFN6M6UJ.js.map → managed-secret-EAOYWRYF.js.map} +0 -0
  413. /package/dist/{register-S3ECUZPV.js.map → noydb-6W2XGQCS.js.map} +0 -0
  414. /package/dist/{post-register-PQSY544J.js.map → post-register-ORQOQJCS.js.map} +0 -0
  415. /package/dist/{registry-BWD2ED52.js.map → register-LHETZRJM.js.map} +0 -0
  416. /package/dist/{registry-FZOHKUME.js.map → registry-AMAZ6QRZ.js.map} +0 -0
  417. /package/dist/{registry-RISV7IDZ.js.map → registry-CZVINVQH.js.map} +0 -0
  418. /package/dist/{registry-ZE35A7WC.js.map → registry-IKUR2MXD.js.map} +0 -0
  419. /package/dist/{request-withdrawal-KXVTQKR5.js.map → registry-JRIN447B.js.map} +0 -0
  420. /package/dist/{revoke-J473JJ22.js.map → request-withdrawal-2DN2RGCO.js.map} +0 -0
  421. /package/dist/{reveal-HY7DZST4.js.map → reveal-AG4SCHUQ.js.map} +0 -0
  422. /package/dist/{signer-XLUKCCH3.js.map → revoke-ZX4NM2CJ.js.map} +0 -0
  423. /package/dist/{seed-ALU3BHFS.js.map → seed-IRCDGIRK.js.map} +0 -0
  424. /package/dist/{stale-U3WO5MYN.js.map → signer-7KHD4OL2.js.map} +0 -0
  425. /package/dist/{storage-IQONEOYY.js.map → stale-K734VACF.js.map} +0 -0
  426. /package/dist/{walk-BF36V4SR.js.map → storage-4H2GF6RQ.js.map} +0 -0
  427. /package/dist/{store-coordination-provider-AHGFEMFA.js.map → store-coordination-provider-4SKLSFUG.js.map} +0 -0
  428. /package/dist/{verify-JEIXSK5U.js.map → verify-RO5RTZOJ.js.map} +0 -0
  429. /package/dist/{withdraw-accessible-TYTA23XH.js.map → walk-MQHYNDLZ.js.map} +0 -0
@@ -0,0 +1,63 @@
1
+ import {
2
+ NoydbError,
3
+ ValidationError
4
+ } from "./chunk-HNGSV2YC.js";
5
+
6
+ // src/with-shape/links/names.ts
7
+ var LINK_COLLECTION_PREFIX = "_links_";
8
+ function linkCollectionName(name) {
9
+ return `${LINK_COLLECTION_PREFIX}${name}`;
10
+ }
11
+ function isLinkCollectionName(name) {
12
+ return name.startsWith(LINK_COLLECTION_PREFIX);
13
+ }
14
+ function declareLink(linkRegistry, name, spec) {
15
+ const a = typeof spec.a === "string" ? spec.a : spec.a.target;
16
+ const b = typeof spec.b === "string" ? spec.b : spec.b.target;
17
+ for (const [slot, target] of [["a", a], ["b", b]]) {
18
+ if (!target || target.startsWith("_") || target.includes("/")) {
19
+ throw new ValidationError(
20
+ `vault.link("${name}"): endpoint "${slot}" must be a simple collection name, got "${target}".`
21
+ );
22
+ }
23
+ }
24
+ const resolved = { a, b, ...spec.onDelete ? { onDelete: spec.onDelete } : {} };
25
+ const existing = linkRegistry.get(name);
26
+ if (existing) {
27
+ if (existing.a !== resolved.a || existing.b !== resolved.b || (existing.onDelete ?? "cascade") !== (resolved.onDelete ?? "cascade")) {
28
+ throw new ValidationError(`vault.link("${name}"): conflicting re-declaration.`);
29
+ }
30
+ return;
31
+ }
32
+ linkRegistry.set(name, resolved);
33
+ }
34
+ function linkRowKey(aId, bId) {
35
+ return `${encodeURIComponent(aId)}|${encodeURIComponent(bId)}`;
36
+ }
37
+ var LinkIntegrityError = class extends NoydbError {
38
+ link;
39
+ endpoint;
40
+ id;
41
+ count;
42
+ constructor(link, endpoint, id, count) {
43
+ super(
44
+ "LINK_INTEGRITY",
45
+ `Cannot delete "${endpoint}"/"${id}": ${count} link(s) in "${link}" still reference it (onDelete: 'strict').`
46
+ );
47
+ this.name = "LinkIntegrityError";
48
+ this.link = link;
49
+ this.endpoint = endpoint;
50
+ this.id = id;
51
+ this.count = count;
52
+ }
53
+ };
54
+
55
+ export {
56
+ LINK_COLLECTION_PREFIX,
57
+ linkCollectionName,
58
+ isLinkCollectionName,
59
+ declareLink,
60
+ linkRowKey,
61
+ LinkIntegrityError
62
+ };
63
+ //# sourceMappingURL=chunk-HNHCQ556.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/links/names.ts"],"sourcesContent":["/**\n * Link-set naming helpers, declaration types, and errors — the tiny,\n * always-loadable slice of the links feature (#553).\n *\n * Split out of `link-set.ts` so the kernel floor (reserved-name guard in\n * `vault.collection()`, the lazy `vault.links()` handle) and the ref/link\n * enforcement facade can bind these few lines WITHOUT statically pulling\n * the `LinkSet` storage engine; that class now loads via dynamic import\n * on first link I/O. `link-set.ts` re-exports everything here, so import\n * paths and class identities are unchanged for existing consumers.\n */\n\nimport { NoydbError, ValidationError } from '../../kernel/errors.js'\nimport type { RefDescriptor } from '../../kernel/refs.js'\n\nexport const LINK_COLLECTION_PREFIX = '_links_'\n\n/** Storage collection name for a logical link set. */\nexport function linkCollectionName(name: string): string {\n return `${LINK_COLLECTION_PREFIX}${name}`\n}\n\n/** True for any reserved link-collection name. */\nexport function isLinkCollectionName(name: string): boolean {\n return name.startsWith(LINK_COLLECTION_PREFIX)\n}\n\n/** What happens to a link's rows when one of its endpoint records is deleted. */\nexport type LinkOnDelete = 'cascade' | 'strict' | 'warn'\n\n/**\n * Declaration for a link set, passed to `vault.link(name, spec)`. `a` and\n * `b` are the endpoint collection names (slot-typed). `onDelete` governs\n * what happens to link rows when an endpoint record is deleted:\n * `'cascade'` (default) removes the touching link rows, `'strict'` blocks\n * the endpoint delete while links exist, `'warn'` leaves orphan rows\n * (surfaced by `vault.checkIntegrity()`).\n */\nexport interface LinkSpec {\n readonly a: string\n readonly b: string\n readonly onDelete?: LinkOnDelete\n}\n\n/**\n * Validate + register a `vault.link(name, spec)` declaration. `a`/`b`\n * accept either a collection name or a `ref(target)` descriptor (only\n * `target` is used). Idempotent for an identical re-declaration; throws\n * `ValidationError` for an invalid endpoint or a conflicting\n * re-declaration. Body extracted out of `Vault.link()` (shrink-first,\n * #947) — the kernel floor keeps a thin delegator.\n */\nexport function declareLink(\n linkRegistry: Map<string, LinkSpec>,\n name: string,\n spec: { a: string | RefDescriptor; b: string | RefDescriptor; onDelete?: LinkSpec['onDelete'] },\n): void {\n const a = typeof spec.a === 'string' ? spec.a : spec.a.target\n const b = typeof spec.b === 'string' ? spec.b : spec.b.target\n for (const [slot, target] of [['a', a], ['b', b]] as const) {\n if (!target || target.startsWith('_') || target.includes('/')) {\n throw new ValidationError(\n `vault.link(\"${name}\"): endpoint \"${slot}\" must be a simple collection name, got \"${target}\".`,\n )\n }\n }\n const resolved: LinkSpec = { a, b, ...(spec.onDelete ? { onDelete: spec.onDelete } : {}) }\n const existing = linkRegistry.get(name)\n if (existing) {\n if (existing.a !== resolved.a || existing.b !== resolved.b || (existing.onDelete ?? 'cascade') !== (resolved.onDelete ?? 'cascade')) {\n throw new ValidationError(`vault.link(\"${name}\"): conflicting re-declaration.`)\n }\n return\n }\n linkRegistry.set(name, resolved)\n}\n\n/** One link tuple as returned by `of()` / `list()`. */\nexport interface LinkRow {\n readonly a: string\n readonly b: string\n readonly meta?: Record<string, unknown>\n}\n\n/**\n * Compose the row key for an ordered `(a, b)` pair. Each id is\n * URI-encoded and joined with `|` — encodeURIComponent escapes `|`, so the\n * key is unambiguous regardless of id contents.\n */\nexport function linkRowKey(aId: string, bId: string): string {\n return `${encodeURIComponent(aId)}|${encodeURIComponent(bId)}`\n}\n\n/** Public handle returned by `vault.links(name)`. */\nexport interface LinkSetHandle {\n /** Create (or overwrite the metadata of) the link `(aId, bId)`. Validates both endpoints exist. */\n connect(aId: string, bId: string, meta?: Record<string, unknown>): Promise<void>\n /** Remove the link `(aId, bId)`. Idempotent — a no-op if it doesn't exist. */\n disconnect(aId: string, bId: string): Promise<void>\n /** Whether the link `(aId, bId)` exists. */\n has(aId: string, bId: string): Promise<boolean>\n /** All links touching `id` on EITHER endpoint. */\n of(id: string): Promise<LinkRow[]>\n /** All links in the set. */\n list(): Promise<LinkRow[]>\n}\n\n/** Thrown when a `strict` link blocks deletion of an endpoint that still has links. */\nexport class LinkIntegrityError extends NoydbError {\n readonly link: string\n readonly endpoint: string\n readonly id: string\n readonly count: number\n constructor(link: string, endpoint: string, id: string, count: number) {\n super(\n 'LINK_INTEGRITY',\n `Cannot delete \"${endpoint}\"/\"${id}\": ${count} link(s) in \"${link}\" still reference it (onDelete: 'strict').`,\n )\n this.name = 'LinkIntegrityError'\n this.link = link\n this.endpoint = endpoint\n this.id = id\n this.count = count\n }\n}\n"],"mappings":";;;;;;AAeO,IAAM,yBAAyB;AAG/B,SAAS,mBAAmB,MAAsB;AACvD,SAAO,GAAG,sBAAsB,GAAG,IAAI;AACzC;AAGO,SAAS,qBAAqB,MAAuB;AAC1D,SAAO,KAAK,WAAW,sBAAsB;AAC/C;AA2BO,SAAS,YACd,cACA,MACA,MACM;AACN,QAAM,IAAI,OAAO,KAAK,MAAM,WAAW,KAAK,IAAI,KAAK,EAAE;AACvD,QAAM,IAAI,OAAO,KAAK,MAAM,WAAW,KAAK,IAAI,KAAK,EAAE;AACvD,aAAW,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAY;AAC1D,QAAI,CAAC,UAAU,OAAO,WAAW,GAAG,KAAK,OAAO,SAAS,GAAG,GAAG;AAC7D,YAAM,IAAI;AAAA,QACR,eAAe,IAAI,iBAAiB,IAAI,4CAA4C,MAAM;AAAA,MAC5F;AAAA,IACF;AAAA,EACF;AACA,QAAM,WAAqB,EAAE,GAAG,GAAG,GAAI,KAAK,WAAW,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC,EAAG;AACzF,QAAM,WAAW,aAAa,IAAI,IAAI;AACtC,MAAI,UAAU;AACZ,QAAI,SAAS,MAAM,SAAS,KAAK,SAAS,MAAM,SAAS,MAAM,SAAS,YAAY,gBAAgB,SAAS,YAAY,YAAY;AACnI,YAAM,IAAI,gBAAgB,eAAe,IAAI,iCAAiC;AAAA,IAChF;AACA;AAAA,EACF;AACA,eAAa,IAAI,MAAM,QAAQ;AACjC;AAcO,SAAS,WAAW,KAAa,KAAqB;AAC3D,SAAO,GAAG,mBAAmB,GAAG,CAAC,IAAI,mBAAmB,GAAG,CAAC;AAC9D;AAiBO,IAAM,qBAAN,cAAiC,WAAW;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACT,YAAY,MAAc,UAAkB,IAAY,OAAe;AACrE;AAAA,MACE;AAAA,MACA,kBAAkB,QAAQ,MAAM,EAAE,MAAM,KAAK,gBAAgB,IAAI;AAAA,IACnE;AACA,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,KAAK;AACV,SAAK,QAAQ;AAAA,EACf;AACF;","names":[]}
@@ -0,0 +1,91 @@
1
+ import {
2
+ MANIFEST_COLLECTION
3
+ } from "./chunk-EPFF7LOX.js";
4
+ import {
5
+ loadFence
6
+ } from "./chunk-MVOWXQHN.js";
7
+ import {
8
+ SCHEMAS_COLLECTION,
9
+ loadPersistedSchema
10
+ } from "./chunk-V5C5NNBR.js";
11
+ import {
12
+ canonicalJson,
13
+ sha256Hex
14
+ } from "./chunk-24UICKTB.js";
15
+ import {
16
+ openEnvelopeJson,
17
+ writeEnvelopeBody
18
+ } from "./chunk-FY343IZR.js";
19
+ import {
20
+ NOYDB_FORMAT_VERSION
21
+ } from "./chunk-24ZLWWEO.js";
22
+
23
+ // src/with-shape/manifest/types.ts
24
+ var MANIFEST_SCHEMA_RECORD_ID = "schema";
25
+
26
+ // src/with-shape/manifest/storage.ts
27
+ async function loadSchemaManifestEntry(store, vault, getDEK) {
28
+ const envelope = await store.get(vault, MANIFEST_COLLECTION, MANIFEST_SCHEMA_RECORD_ID);
29
+ if (!envelope) return void 0;
30
+ const dek = await getDEK(MANIFEST_COLLECTION);
31
+ try {
32
+ const plaintext = await openEnvelopeJson(envelope, dek);
33
+ const parsed = JSON.parse(plaintext);
34
+ if (parsed.v !== 1 || parsed.kind !== "schema") return void 0;
35
+ return { version: envelope._v, manifest: parsed };
36
+ } catch {
37
+ return void 0;
38
+ }
39
+ }
40
+ async function saveSchemaManifest(store, vault, manifest, expectedVersion, getDEK) {
41
+ const dek = await getDEK(MANIFEST_COLLECTION);
42
+ const json = JSON.stringify(manifest);
43
+ const body = await writeEnvelopeBody(json, dek);
44
+ const env = {
45
+ _noydb: NOYDB_FORMAT_VERSION,
46
+ _v: expectedVersion + 1,
47
+ _ts: (/* @__PURE__ */ new Date()).toISOString(),
48
+ ...body
49
+ };
50
+ await store.put(vault, MANIFEST_COLLECTION, MANIFEST_SCHEMA_RECORD_ID, env, expectedVersion);
51
+ }
52
+ async function computeAggregateHash(collections) {
53
+ return sha256Hex(canonicalJson(collections));
54
+ }
55
+
56
+ // src/with-shape/manifest/derive.ts
57
+ async function deriveSchemaManifest(store, vault, lookupDEK) {
58
+ const fence = await loadFence(store, vault);
59
+ const collectionNames = await store.list(vault, SCHEMAS_COLLECTION);
60
+ const collections = {};
61
+ const undecodableCollections = [];
62
+ for (const name of collectionNames) {
63
+ const dek = await lookupDEK(name);
64
+ if (dek === void 0) {
65
+ undecodableCollections.push(name);
66
+ continue;
67
+ }
68
+ const payload = await loadPersistedSchema(store, vault, name, dek);
69
+ if (!payload) {
70
+ undecodableCollections.push(name);
71
+ continue;
72
+ }
73
+ if (payload.hash === null) continue;
74
+ const entry = {
75
+ generation: payload.generation ?? fence.currentSchemaVersion,
76
+ contentHash: payload.hash
77
+ };
78
+ collections[name] = payload.fieldIds !== void 0 ? { ...entry, fieldIds: payload.fieldIds } : entry;
79
+ }
80
+ const aggregateHash = await computeAggregateHash(collections);
81
+ const manifest = { v: 1, kind: "schema", generation: fence.currentSchemaVersion, collections, aggregateHash };
82
+ return { manifest, undecodableCollections };
83
+ }
84
+
85
+ export {
86
+ MANIFEST_SCHEMA_RECORD_ID,
87
+ loadSchemaManifestEntry,
88
+ saveSchemaManifest,
89
+ deriveSchemaManifest
90
+ };
91
+ //# sourceMappingURL=chunk-HS7HNYBD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/manifest/types.ts","../src/with-shape/manifest/storage.ts","../src/with-shape/manifest/derive.ts"],"sourcesContent":["/**\n * The pod-wide **schema manifest** record type (#941).\n *\n * This is an INDEX, not a full-inline manifest: `SchemaManifest.collections`\n * carries per-collection *metadata* (generation / content hash / field ids),\n * never the JSON Schema body itself. The JSON Schema stays the source of\n * truth at `_schemas/<collection>`, encrypted under that collection's own\n * DEK (see `with-shape/persisted-schemas`). Inlining full schemas into one\n * pod-wide manifest record would either leak every collection's schema to a\n * principal scoped to a single collection, or force the manifest itself\n * onto a collection-DEK it has no business holding — the index preserves\n * per-collection DEK isolation while still giving a single place to answer\n * \"what schema generation is this pod at, and does collection X's stored\n * schema match its declared content hash.\"\n *\n * `aggregateHash` binds the whole per-collection index's content: it is\n * `sha256Hex(canonicalJson(collections))`, so any change to any collection's\n * entry (a new generation, a changed hash, added/renamed field ids) changes\n * `aggregateHash` too. Canonical JSON (sorted object keys, no whitespace)\n * makes the hash independent of the map's key insertion order.\n *\n * @module\n */\n\n/** Per-collection entry inside a {@link SchemaManifest}'s `collections` index. */\nexport interface SchemaManifestEntry {\n /** The vault-wide schema-fence generation this collection's schema was last written at. */\n readonly generation: number\n /** SHA-256 (hex) of the collection's canonicalised JSON Schema (see `persisted-schemas/derive.ts`). */\n readonly contentHash: string\n /** Stable per-field ids (#946), keyed by the field's current name. Absent when the collection has none. */\n readonly fieldIds?: Record<string, string>\n}\n\n/**\n * The pod-wide schema manifest — one record per pod, stored at\n * `_manifest/schema` (see `storage.ts`). An INDEX over the per-collection\n * `_schemas/<collection>` entries, not the schemas themselves.\n */\nexport interface SchemaManifest {\n readonly v: 1\n readonly kind: 'schema'\n /** Pod-wide schema-fence generation (`FenceDoc.currentSchemaVersion`) as of this manifest's derivation. */\n readonly generation: number\n /** Per-collection index: collection name → its manifest entry. */\n readonly collections: Record<string, SchemaManifestEntry>\n /** `sha256Hex(canonicalJson(collections))` — the pod-wide content binding over the index. */\n readonly aggregateHash: string\n}\n\n/** The record id the schema manifest is stored under inside `_manifest`. */\nexport const MANIFEST_SCHEMA_RECORD_ID = 'schema' as const\n","/**\n * Read / write the pod-wide `_manifest/schema` envelope.\n *\n * Mirrors `with-shape/persisted-schemas/storage.ts`'s shape: the same\n * standard noy-db record envelope, AES-GCM encrypted with a collection DEK\n * (here, the `_manifest` collection's own DEK — the manifest INDEX\n * discloses collection names + hashes + generations + field ids, metadata\n * rather than schema bodies, so it gets the same encryption grain as\n * `_schemas` itself).\n *\n * Storage layout:\n *\n * <vault>/_manifest/schema → EncryptedEnvelope\n *\n * Unlike `persisted-schemas/storage.ts` (which takes an already-resolved\n * `EnclaveKey`), these functions take a `getDEK` resolver and call\n * `getDEK(MANIFEST_COLLECTION)` themselves — there is exactly one manifest\n * record per pod, so there is no per-collection DEK the caller needs to\n * pick; resolving it here keeps every manifest call-site symmetric.\n *\n * @module\n */\n\nimport { openEnvelopeJson, writeEnvelopeBody, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { canonicalJson, sha256Hex } from '../../with-commit/history/ledger/index.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { MANIFEST_COLLECTION } from './reserved-collections.js'\nimport { MANIFEST_SCHEMA_RECORD_ID, type SchemaManifest, type SchemaManifestEntry } from './types.js'\n\n/** A resolver for a collection's DEK — the same shape as `Vault`'s internal `getDEK`. */\nexport type GetManifestDEK = (collectionName: string) => Promise<EnclaveKey>\n\n/**\n * A decrypted schema-manifest read paired with the wrapping envelope's `_v`\n * — the optimistic-concurrency token. Pass `version` back to\n * {@link saveSchemaManifest} (via `writeSchemaManifest`'s `expectedVersion`)\n * to make the write a strict CAS.\n */\nexport interface LoadedSchemaManifest {\n /** Wrapping envelope `_v`. */\n readonly version: number\n /** Decrypted schema manifest. */\n readonly manifest: SchemaManifest\n}\n\n/**\n * Read the `_manifest/schema` envelope together with its wrapping `_v`.\n * Returns `undefined` when no manifest has ever been written, when the\n * envelope fails to decrypt (wrong DEK), or when it doesn't parse as a\n * `v: 1, kind: 'schema'` manifest.\n */\nexport async function loadSchemaManifestEntry(\n store: NoydbStore,\n vault: string,\n getDEK: GetManifestDEK,\n): Promise<LoadedSchemaManifest | undefined> {\n const envelope = await store.get(vault, MANIFEST_COLLECTION, MANIFEST_SCHEMA_RECORD_ID)\n if (!envelope) return undefined\n const dek = await getDEK(MANIFEST_COLLECTION)\n try {\n const plaintext = await openEnvelopeJson(envelope, dek)\n const parsed = JSON.parse(plaintext) as SchemaManifest\n if (parsed.v !== 1 || parsed.kind !== 'schema') return undefined\n return { version: envelope._v, manifest: parsed }\n } catch {\n return undefined\n }\n}\n\n/**\n * Encrypt and persist the schema manifest as a strict CAS write:\n * `expectedVersion` must match the stored envelope's `_v` (0 when no\n * envelope exists yet) or `store.put` throws `ConflictError` — surfaced by\n * `writer.ts`'s `writeSchemaManifest` as `ManifestConflictError` rather than\n * retried.\n */\nexport async function saveSchemaManifest(\n store: NoydbStore,\n vault: string,\n manifest: SchemaManifest,\n expectedVersion: number,\n getDEK: GetManifestDEK,\n): Promise<void> {\n const dek = await getDEK(MANIFEST_COLLECTION)\n const json = JSON.stringify(manifest)\n const body = await writeEnvelopeBody(json, dek)\n const env: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: expectedVersion + 1,\n _ts: new Date().toISOString(),\n ...body,\n }\n await store.put(vault, MANIFEST_COLLECTION, MANIFEST_SCHEMA_RECORD_ID, env, expectedVersion)\n}\n\n/**\n * `sha256Hex(canonicalJson(collections))` — the pod-wide content binding\n * over a schema manifest's per-collection index. Canonical JSON sorts\n * object keys at every depth, so the result is independent of the map's\n * key insertion order. Shared by the writer's tests and (#941 Task 3) the\n * derivation path, so the hash is computed identically everywhere.\n */\nexport async function computeAggregateHash(\n collections: Record<string, SchemaManifestEntry>,\n): Promise<string> {\n return sha256Hex(canonicalJson(collections))\n}\n","/**\n * Derive the pod-wide {@link SchemaManifest} from the per-collection\n * `_schemas/<collection>` records — the source of truth (#941 Task 3).\n *\n * The manifest is an INDEX, never a cache with independent state: every\n * field in a {@link SchemaManifestEntry} is a direct projection of the\n * matching `PersistedSchemaEnvelope` (`hash` → `contentHash`, `fieldIds` →\n * `fieldIds`, `generation` → `generation`, falling back to the live fence's\n * `currentSchemaVersion` for a legacy pre-#946 envelope that never got a\n * generation stamp). Re-running this function against the same stored state\n * always produces the same manifest — that's what makes round-trip identity\n * (AC #2: dump → restore → re-derive matches the original) hold for free,\n * with no special-cased restore logic.\n *\n * A collection whose `_schemas/<collection>` envelope decrypts successfully\n * but has no derivable content (`hash === null` — a stub envelope for a\n * non-Zod validator) is legitimately omitted from the index: there is no\n * content hash to bind.\n *\n * ## Scoped principals: \"cannot decrypt\" is NOT \"doesn't exist\"\n *\n * A `_schemas/<collection>` envelope is encrypted under **that data\n * collection's own DEK** — the same key its records use — NOT a shared\n * `_schemas`-wide key. In a team vault, a collection-scoped grantee (e.g.\n * `grant(..., { role: 'operator', permissions: { invoices: 'rw' } })`) holds\n * only the DEKs their `permissions` name, plus every system-prefixed (`_*`)\n * collection's DEK — `_manifest` included, by `grant()`'s \"propagate system\n * collections to every role\" rule (`keyring.ts`). So a member scoped to\n * `invoices` CAN decrypt `_manifest/schema` (the pod-wide index) but CANNOT\n * decrypt a sibling's `_schemas/customers` envelope — even though that\n * envelope is right there in `store.list(vault, SCHEMAS_COLLECTION)`.\n *\n * `lookupDEK` (the {@link LookupDEK} passed in) reflects this: it returns\n * `undefined` for a collection name whose DEK the caller does not hold —\n * deliberately NEVER minting a fresh one (see the module doc on\n * `LookupDEK` for why). This function distinguishes that case\n * (`undecodableCollections`) from \"the schema envelope legitimately has no\n * derivable content\" (`hash === null`) — the caller (`sync.ts`) MUST treat\n * an incomplete view differently: writing a manifest derived from a\n * partial view would silently drop every collection this principal can't\n * see. See `sync.ts`'s module doc for how the sync path handles this.\n *\n * @module\n */\n\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\nimport { loadFence } from '../schema-update/fence.js'\nimport { loadPersistedSchema, SCHEMAS_COLLECTION } from '../persisted-schemas/storage.js'\nimport { computeAggregateHash } from './storage.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { SchemaManifest, SchemaManifestEntry } from './types.js'\n\n/**\n * A NON-MINTING DEK lookup: returns the collection's DEK if the caller\n * already holds it, `undefined` otherwise. Deliberately distinct from\n * `storage.ts`'s `GetManifestDEK` (which mints+persists a fresh DEK for an\n * absent collection — correct for a caller about to WRITE that collection,\n * e.g. `_manifest` itself). `deriveSchemaManifest` only ever READS sibling\n * collections it never created and has no business minting keys for — an\n * absent DEK here means \"not my collection to see,\" never \"new collection\n * that needs a key.\" Minting here would be worse than a no-op: it would\n * silently persist a garbage DEK into the caller's OWN `_keyring/<user>`\n * file (via `ensureCollectionDEK`'s `persistKeyring` side effect) that\n * still can't decrypt anything — see `sync.ts` / `with-pod/open.ts`'s\n * fix notes (#941 review).\n */\nexport type LookupDEK = (collectionName: string) => Promise<EnclaveKey | undefined>\n\nexport interface DeriveSchemaManifestResult {\n /** The derived manifest — an index over every collection this principal could decrypt. */\n readonly manifest: SchemaManifest\n /**\n * Names present in `_schemas` (per `store.list`) whose envelope this\n * principal could NOT decrypt — either no DEK held for that collection,\n * or the DEK held failed to decrypt/parse it (treated the same: the\n * caller cannot verify what's there, so it cannot safely be omitted or\n * asserted). Empty for a principal with full visibility (typically the\n * owner/admin/custodian). Non-empty means `manifest.collections` is\n * DEFINITELY INCOMPLETE relative to the pod's true collection set —\n * see `sync.ts` for why that must gate whether the manifest gets written.\n */\n readonly undecodableCollections: readonly string[]\n}\n\n/**\n * Read the fence generation + every `_schemas/<collection>` envelope this\n * principal can decrypt, and project them into a fresh {@link SchemaManifest}.\n * `lookupDEK` is called once per collection found under `_schemas` (never\n * mints — see {@link LookupDEK}). Names whose DEK isn't held, or whose\n * envelope fails to decrypt/parse despite holding a DEK, are reported via\n * `undecodableCollections` rather than silently dropped from the result.\n */\nexport async function deriveSchemaManifest(\n store: NoydbStore,\n vault: string,\n lookupDEK: LookupDEK,\n): Promise<DeriveSchemaManifestResult> {\n const fence = await loadFence(store, vault)\n const collectionNames = await store.list(vault, SCHEMAS_COLLECTION)\n\n const collections: Record<string, SchemaManifestEntry> = {}\n const undecodableCollections: string[] = []\n for (const name of collectionNames) {\n const dek = await lookupDEK(name)\n if (dek === undefined) {\n undecodableCollections.push(name) // present in _schemas, but not decodable by this principal\n continue\n }\n\n const payload = await loadPersistedSchema(store, vault, name, dek)\n if (!payload) {\n // Held a DEK but still couldn't decrypt/parse — cannot distinguish\n // \"wrong key after all\" from real corruption from here; treat as\n // undecodable (never silently drop) rather than \"no content.\"\n undecodableCollections.push(name)\n continue\n }\n if (payload.hash === null) continue // legitimately no derivable content (stub envelope)\n\n const entry: SchemaManifestEntry = {\n generation: payload.generation ?? fence.currentSchemaVersion,\n contentHash: payload.hash,\n }\n collections[name] = payload.fieldIds !== undefined ? { ...entry, fieldIds: payload.fieldIds } : entry\n }\n\n const aggregateHash = await computeAggregateHash(collections)\n const manifest: SchemaManifest = { v: 1, kind: 'schema', generation: fence.currentSchemaVersion, collections, aggregateHash }\n return { manifest, undecodableCollections }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmDO,IAAM,4BAA4B;;;ACCzC,eAAsB,wBACpB,OACA,OACA,QAC2C;AAC3C,QAAM,WAAW,MAAM,MAAM,IAAI,OAAO,qBAAqB,yBAAyB;AACtF,MAAI,CAAC,SAAU,QAAO;AACtB,QAAM,MAAM,MAAM,OAAO,mBAAmB;AAC5C,MAAI;AACF,UAAM,YAAY,MAAM,iBAAiB,UAAU,GAAG;AACtD,UAAM,SAAS,KAAK,MAAM,SAAS;AACnC,QAAI,OAAO,MAAM,KAAK,OAAO,SAAS,SAAU,QAAO;AACvD,WAAO,EAAE,SAAS,SAAS,IAAI,UAAU,OAAO;AAAA,EAClD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AASA,eAAsB,mBACpB,OACA,OACA,UACA,iBACA,QACe;AACf,QAAM,MAAM,MAAM,OAAO,mBAAmB;AAC5C,QAAM,OAAO,KAAK,UAAU,Q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D76T2.js";
3
+ } from "./chunk-HNGSV2YC.js";
4
4
 
5
5
  // src/with-shape/satellites/validate.ts
6
6
  function validateSatelliteDeclaration(input) {
@@ -47,4 +47,4 @@ export {
47
47
  validateSatelliteDeclaration,
48
48
  hashFields
49
49
  };
50
- //# sourceMappingURL=chunk-FT5Y4VSP.js.map
50
+ //# sourceMappingURL=chunk-HVQGCKY4.js.map
@@ -2,10 +2,10 @@ import {
2
2
  base64ToBuffer,
3
3
  decryptBytesWithAAD,
4
4
  encryptBytesWithAAD
5
- } from "./chunk-RPWMDIGK.js";
5
+ } from "./chunk-VCETL77O.js";
6
6
  import {
7
7
  TamperedError
8
- } from "./chunk-AR5D76T2.js";
8
+ } from "./chunk-HNGSV2YC.js";
9
9
 
10
10
  // src/kernel/enclave/classify/compare.ts
11
11
  var subtle = globalThis.crypto.subtle;
@@ -92,4 +92,4 @@ export {
92
92
  openVdigPayload,
93
93
  evaluateKofN
94
94
  };
95
- //# sourceMappingURL=chunk-MYSNNMJ3.js.map
95
+ //# sourceMappingURL=chunk-HXGUIPQB.js.map
@@ -1,21 +1,21 @@
1
- import {
2
- resolveManagedSecret
3
- } from "./chunk-CLE3TMIS.js";
4
1
  import {
5
2
  freezeSnapshotOnly
6
- } from "./chunk-G3ORJ3IQ.js";
3
+ } from "./chunk-JSRU5W2M.js";
4
+ import {
5
+ resolveManagedSecret
6
+ } from "./chunk-MC2LFTQM.js";
7
7
  import {
8
8
  createOwnerKeyring
9
- } from "./chunk-FZAP4JNC.js";
9
+ } from "./chunk-RLWY6Z44.js";
10
10
  import {
11
11
  wrapKey
12
- } from "./chunk-RPWMDIGK.js";
12
+ } from "./chunk-VCETL77O.js";
13
13
  import {
14
14
  NOYDB_FORMAT_VERSION
15
- } from "./chunk-77AEMXFA.js";
15
+ } from "./chunk-24ZLWWEO.js";
16
16
  import {
17
17
  PermissionDeniedError
18
- } from "./chunk-AR5D76T2.js";
18
+ } from "./chunk-HNGSV2YC.js";
19
19
 
20
20
  // src/with-party/team/deed.ts
21
21
  var DEED_RECORD_ID = "deed";
@@ -131,4 +131,4 @@ export {
131
131
  isDeedVault,
132
132
  liberateVault
133
133
  };
134
- //# sourceMappingURL=chunk-GTQF32TP.js.map
134
+ //# sourceMappingURL=chunk-JEM2IGS3.js.map
@@ -0,0 +1,260 @@
1
+ import {
2
+ computeSchemaDelta,
3
+ evaluateStrategies
4
+ } from "./chunk-ZVF37PKE.js";
5
+ import {
6
+ MANIFEST_SCHEMA_RECORD_ID,
7
+ deriveSchemaManifest,
8
+ loadSchemaManifestEntry,
9
+ saveSchemaManifest
10
+ } from "./chunk-HS7HNYBD.js";
11
+ import {
12
+ MANIFEST_COLLECTION
13
+ } from "./chunk-EPFF7LOX.js";
14
+ import {
15
+ loadFence,
16
+ saveFence
17
+ } from "./chunk-MVOWXQHN.js";
18
+ import {
19
+ derivePersistedSchema
20
+ } from "./chunk-2LGDCNFJ.js";
21
+ import {
22
+ loadPersistedSchemaEntry,
23
+ savePersistedSchema
24
+ } from "./chunk-V5C5NNBR.js";
25
+ import {
26
+ envelopePayloadHash
27
+ } from "./chunk-24UICKTB.js";
28
+ import {
29
+ ManifestConflictError,
30
+ isConflictError
31
+ } from "./chunk-HNGSV2YC.js";
32
+
33
+ // src/with-shape/persisted-schemas/field-ids.ts
34
+ var BASE32URL_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
35
+ function encodeBase32Url(bytes) {
36
+ let bits = 0;
37
+ let value = 0;
38
+ let out = "";
39
+ for (const byte of bytes) {
40
+ value = value << 8 | byte;
41
+ bits += 8;
42
+ while (bits >= 5) {
43
+ out += BASE32URL_ALPHABET[value >>> bits - 5 & 31];
44
+ bits -= 5;
45
+ }
46
+ }
47
+ if (bits > 0) {
48
+ out += BASE32URL_ALPHABET[value << 5 - bits & 31];
49
+ }
50
+ return out;
51
+ }
52
+ function mintFieldId() {
53
+ const bytes = new Uint8Array(12);
54
+ crypto.getRandomValues(bytes);
55
+ return encodeBase32Url(bytes);
56
+ }
57
+ function topLevelFieldNames(jsonSchema) {
58
+ if (jsonSchema === null) return [];
59
+ const props = jsonSchema.properties;
60
+ if (props === null || typeof props !== "object") return [];
61
+ return Object.keys(props);
62
+ }
63
+ function resolveFieldIds(freshJsonSchema, priorFieldIds, renamed) {
64
+ const names = topLevelFieldNames(freshJsonSchema);
65
+ if (names.length === 0) return void 0;
66
+ const priorNameFor = /* @__PURE__ */ new Map();
67
+ if (renamed) for (const { from, to } of renamed) priorNameFor.set(to, from);
68
+ const out = {};
69
+ for (const name of names) {
70
+ const priorName = priorNameFor.get(name) ?? name;
71
+ out[name] = priorFieldIds?.[priorName] ?? mintFieldId();
72
+ }
73
+ return out;
74
+ }
75
+
76
+ // src/with-shape/manifest/writer.ts
77
+ async function writeSchemaManifest(store, vault, manifest, expectedVersion, getDEK) {
78
+ try {
79
+ await saveSchemaManifest(store, vault, manifest, expectedVersion, getDEK);
80
+ } catch (err) {
81
+ if (isConflictError(err)) {
82
+ throw new ManifestConflictError(err.version, expectedVersion);
83
+ }
84
+ throw err;
85
+ }
86
+ }
87
+
88
+ // src/with-shape/manifest/sync.ts
89
+ var MAX_SYNC_ATTEMPTS = 16;
90
+ async function syncSchemaManifest(store, vault, deps) {
91
+ for (let attempt = 0; attempt < MAX_SYNC_ATTEMPTS; attempt++) {
92
+ const { manifest: derived, undecodableCollections } = await deriveSchemaManifest(store, vault, deps.lookupDEK);
93
+ if (undecodableCollections.length > 0) {
94
+ return;
95
+ }
96
+ const existing = await loadSchemaManifestEntry(store, vault, deps.getDEK);
97
+ if (existing && existing.manifest.generation === derived.generation && existing.manifest.aggregateHash === derived.aggregateHash) {
98
+ return;
99
+ }
100
+ const expectedVersion = existing?.version ?? 0;
101
+ try {
102
+ await writeSchemaManifest(store, vault, derived, expectedVersion, deps.getDEK);
103
+ } catch (err) {
104
+ if (err instanceof ManifestConflictError) continue;
105
+ throw err;
106
+ }
107
+ await auditManifestWrite(store, vault, deps, derived, expectedVersion);
108
+ const recheck = await deriveSchemaManifest(store, vault, deps.lookupDEK);
109
+ if (recheck.undecodableCollections.length > 0) return;
110
+ if (recheck.manifest.generation === derived.generation && recheck.manifest.aggregateHash === derived.aggregateHash) {
111
+ return;
112
+ }
113
+ }
114
+ console.warn(
115
+ `[noy-db] schema-manifest sync did not converge after ${MAX_SYNC_ATTEMPTS} attempts; the persisted manifest may be stale until the next schema write or open()'s re-derive.`
116
+ );
117
+ }
118
+ async function auditManifestWrite(store, vault, deps, derived, expectedVersion) {
119
+ const ledger = deps.getLedgerOrNull?.();
120
+ if (!ledger) return;
121
+ const envelope = await store.get(vault, MANIFEST_COLLECTION, MANIFEST_SCHEMA_RECORD_ID);
122
+ await ledger.append({
123
+ op: "migration",
124
+ collection: MANIFEST_COLLECTION,
125
+ id: MANIFEST_SCHEMA_RECORD_ID,
126
+ version: expectedVersion + 1,
127
+ actor: "",
128
+ payloadHash: await envelopePayloadHash(envelope),
129
+ reason: `schema-manifest-sync:generation=${derived.generation}`
130
+ });
131
+ }
132
+
133
+ // src/with-shape/persisted-schemas/register.ts
134
+ var MAX_SCHEMA_CAS_RETRIES = 5;
135
+ async function persistSchemaIfNeeded(opts) {
136
+ const fresh = await derivePersistedSchema(opts.validator);
137
+ for (let attempt = 0; ; attempt++) {
138
+ const { version, payload: stored } = await loadPersistedSchemaEntry(
139
+ opts.store,
140
+ opts.vault,
141
+ opts.collectionName,
142
+ opts.dek
143
+ );
144
+ if (stored && isEquivalent(stored, fresh)) {
145
+ return { written: false, skipped: true, envelope: stored, decision: { action: "allow" } };
146
+ }
147
+ let decision = { action: "allow" };
148
+ const strategies = opts.strategies ?? [];
149
+ let delta;
150
+ if (stored && stored.kind === fresh.kind && isPlainObject(stored.jsonSchema) && isPlainObject(fresh.jsonSchema)) {
151
+ delta = computeSchemaDelta(stored.jsonSchema, fresh.jsonSchema, opts.collectionName);
152
+ if (strategies.length > 0) {
153
+ decision = await evaluateStrategies(delta, strategies, { collection: opts.collectionName });
154
+ }
155
+ }
156
+ if (decision.action !== "allow") {
157
+ return { written: false, skipped: false, envelope: stored ?? fresh, decision };
158
+ }
159
+ let toSave = fresh;
160
+ if (stored?.classified !== void 0) toSave = { ...toSave, classified: stored.classified };
161
+ if (stored?.satellite !== void 0) toSave = { ...toSave, satellite: stored.satellite };
162
+ const fieldIds = resolveFieldIds(fresh.jsonSchema, stored?.fieldIds, delta?.renamed);
163
+ if (fieldIds !== void 0) toSave = { ...toSave, fieldIds };
164
+ const fence = await loadFence(opts.store, opts.vault);
165
+ toSave = { ...toSave, generation: fence.currentSchemaVersion };
166
+ try {
167
+ await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, toSave, version);
168
+ if (toSave.hash !== null) {
169
+ const freshFence = await loadFence(opts.store, opts.vault);
170
+ await saveFence(opts.store, opts.vault, { ...freshFence, schemaHash: toSave.hash });
171
+ }
172
+ if (opts.manifestSync) {
173
+ await syncSchemaManifest(opts.store, opts.vault, opts.manifestSync);
174
+ }
175
+ return { written: true, skipped: false, envelope: toSave, decision };
176
+ } catch (err) {
177
+ if (isConflictError(err) && attempt < MAX_SCHEMA_CAS_RETRIES) continue;
178
+ throw err;
179
+ }
180
+ }
181
+ }
182
+ async function persistClassifiedMarker(opts) {
183
+ for (let attempt = 0; ; attempt++) {
184
+ const { version, payload: stored } = await loadPersistedSchemaEntry(
185
+ opts.store,
186
+ opts.vault,
187
+ opts.collectionName,
188
+ opts.dek
189
+ );
190
+ if (stored?.classified !== void 0 && markersEqual(stored.classified, opts.marker)) return;
191
+ const payload = stored !== void 0 ? { ...stored, classified: opts.marker } : {
192
+ _noydb_schema: 1,
193
+ kind: "Unknown",
194
+ jsonSchema: null,
195
+ hash: null,
196
+ derivedAt: (/* @__PURE__ */ new Date()).toISOString(),
197
+ classified: opts.marker
198
+ };
199
+ try {
200
+ await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, payload, version);
201
+ return;
202
+ } catch (err) {
203
+ if (isConflictError(err) && attempt < MAX_SCHEMA_CAS_RETRIES) continue;
204
+ throw err;
205
+ }
206
+ }
207
+ }
208
+ async function persistSatelliteMarker(opts) {
209
+ for (let attempt = 0; ; attempt++) {
210
+ const { version, payload: stored } = await loadPersistedSchemaEntry(
211
+ opts.store,
212
+ opts.vault,
213
+ opts.collectionName,
214
+ opts.dek
215
+ );
216
+ if (stored?.satellite !== void 0 && satelliteMarkersEqual(stored.satellite, opts.marker)) return;
217
+ const payload = stored !== void 0 ? { ...stored, satellite: opts.marker } : {
218
+ _noydb_schema: 1,
219
+ kind: "Unknown",
220
+ jsonSchema: null,
221
+ hash: null,
222
+ derivedAt: (/* @__PURE__ */ new Date()).toISOString(),
223
+ satellite: opts.marker
224
+ };
225
+ try {
226
+ await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, payload, version);
227
+ return;
228
+ } catch (err) {
229
+ if (isConflictError(err) && attempt < MAX_SCHEMA_CAS_RETRIES) continue;
230
+ throw err;
231
+ }
232
+ }
233
+ }
234
+ function satelliteMarkersEqual(a, b) {
235
+ return a.base === b.base && a.fieldsHash === b.fieldsHash && (a.joined ?? null) === (b.joined ?? null);
236
+ }
237
+ function markersEqual(a, b) {
238
+ return sameSet(a.digestOnly, b.digestOnly) && sameSet(a.equatable, b.equatable);
239
+ }
240
+ function sameSet(a, b) {
241
+ if (a.length !== b.length) return false;
242
+ const s = new Set(a);
243
+ return b.every((x) => s.has(x));
244
+ }
245
+ function isPlainObject(v) {
246
+ return typeof v === "object" && v !== null && !Array.isArray(v);
247
+ }
248
+ function isEquivalent(a, b) {
249
+ if (a.kind !== b.kind) return false;
250
+ if (a.hash && b.hash) return a.hash === b.hash;
251
+ if (a.hash === null && b.hash === null) return true;
252
+ return false;
253
+ }
254
+
255
+ export {
256
+ persistSchemaIfNeeded,
257
+ persistClassifiedMarker,
258
+ persistSatelliteMarker
259
+ };
260
+ //# sourceMappingURL=chunk-JH3OHQM4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/persisted-schemas/field-ids.ts","../src/with-shape/manifest/writer.ts","../src/with-shape/manifest/sync.ts","../src/with-shape/persisted-schemas/register.ts"],"sourcesContent":["/**\n * Stable field-identifier minting (#946).\n *\n * A field's `id` is opaque and permanent — minted once, from randomness\n * only, with no timestamp and no name-derivation. A name-derived id would\n * change when the field is renamed, defeating the whole point (identity\n * must survive a rename). See `PersistedSchemaEnvelope.fieldIds`.\n *\n * @module\n */\n\nconst BASE32URL_ALPHABET = 'abcdefghijklmnopqrstuvwxyz234567'\n\n/** Unpadded RFC 4648 §7 base32url encoding of an arbitrary byte string. */\nfunction encodeBase32Url(bytes: Uint8Array): string {\n let bits = 0\n let value = 0\n let out = ''\n for (const byte of bytes) {\n value = (value << 8) | byte\n bits += 8\n while (bits >= 5) {\n out += BASE32URL_ALPHABET[(value >>> (bits - 5)) & 31]\n bits -= 5\n }\n }\n if (bits > 0) {\n out += BASE32URL_ALPHABET[(value << (5 - bits)) & 31]\n }\n return out\n}\n\n/**\n * Mint a fresh opaque field id: 12 random bytes (96 bits) from\n * `crypto.getRandomValues`, encoded as a 20-character base32url token.\n * Not exported — Task 2/3 (#946) may need to export this later; keep it\n * module-internal until an external consumer exists.\n */\nfunction mintFieldId(): string {\n const bytes = new Uint8Array(12)\n crypto.getRandomValues(bytes)\n return encodeBase32Url(bytes)\n}\n\n/** Top-level property names of a Draft 2020-12 object JSON Schema, or `[]` when not an object schema. */\nfunction topLevelFieldNames(jsonSchema: object | null): readonly string[] {\n if (jsonSchema === null) return []\n const props = (jsonSchema as { properties?: unknown }).properties\n if (props === null || typeof props !== 'object') return []\n return Object.keys(props as Record<string, unknown>)\n}\n\n/**\n * Resolve the `fieldIds` map for a freshly-derived schema against the\n * previously-stored envelope's map (if any). Existing ids are preserved by\n * name — a field keeps its id across re-derivation as long as its name is\n * unchanged; a genuinely new field name mints a fresh id. Returns\n * `undefined` when the fresh schema has no derivable top-level field set\n * (e.g. a stub envelope, or a non-object root schema).\n *\n * `renamed` (#946 Task 2) — unambiguous rename pairs from\n * `computeSchemaDelta`'s `SchemaDelta.renamed`. When the fresh name is a\n * rename target (`to`), the id is looked up under its OLD name (`from`)\n * instead of the fresh name itself — the whole point of a stable field id\n * is that it survives exactly this case; without it, a rename would mint a\n * fresh id for the new name and silently drop the old one.\n */\nexport function resolveFieldIds(\n freshJsonSchema: object | null,\n priorFieldIds: Record<string, string> | undefined,\n renamed?: readonly { readonly from: string; readonly to: string }[],\n): Record<string, string> | undefined {\n const names = topLevelFieldNames(freshJsonSchema)\n if (names.length === 0) return undefined\n const priorNameFor = new Map<string, string>()\n if (renamed) for (const { from, to } of renamed) priorNameFor.set(to, from)\n const out: Record<string, string> = {}\n for (const name of names) {\n const priorName = priorNameFor.get(name) ?? name\n out[name] = priorFieldIds?.[priorName] ?? mintFieldId()\n }\n return out\n}\n","/**\n * Strict-CAS schema-manifest writer (#941, AC #1).\n *\n * Every other reserved-collection writer in the hub (`persisted-schemas`'s\n * `savePersistedSchema` callers, the classified/satellite marker writers)\n * retries on a CAS conflict: re-read, re-apply, try again. The schema\n * manifest deliberately does NOT — two concurrent *direct* edits to the\n * manifest must be refused and surfaced, never silently merged or\n * retry-resolved, because a manifest write encodes a specific point-in-time\n * claim about the pod's schema generation/content-hash set. A caller that\n * lost the race must re-derive against the fresh state and decide what to\n * do, not have its stale write quietly re-applied on top of someone else's.\n *\n * Ledger audit: this writer does not have a `LedgerStore` handle at this\n * seam (mirroring `persisted-schemas`, whose `_schemas/<collection>` writes\n * are likewise not ledger-audited today). Wiring `LedgerStore.append({ op:\n * 'migration', ... })` around a manifest write belongs at the call site\n * where a ledger handle is already in scope (the open/write integration —\n * #941 Task 3/4), not here.\n *\n * @module\n */\n\nimport { isConflictError, ManifestConflictError } from '../../kernel/errors.js'\nimport { saveSchemaManifest, type GetManifestDEK } from './storage.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { SchemaManifest } from './types.js'\n\n/**\n * Write the schema manifest as a strict CAS: `expectedVersion` must match\n * the stored envelope's `_v` (0 when no manifest exists yet). On a\n * conflict, throws {@link ManifestConflictError} — this function never\n * retries.\n */\nexport async function writeSchemaManifest(\n store: NoydbStore,\n vault: string,\n manifest: SchemaManifest,\n expectedVersion: number,\n getDEK: GetManifestDEK,\n): Promise<void> {\n try {\n await saveSchemaManifest(store, vault, manifest, expectedVersion, getDEK)\n } catch (err) {\n if (isConflictError(err)) {\n throw new ManifestConflictError(err.version, expectedVersion)\n }\n throw err\n }\n}\n","/**\n * Keep the persisted `_manifest/schema` record in sync with the\n * per-collection `_schemas/<collection>` source of truth (#941 Task 3).\n *\n * Called from `persisted-schemas/register.ts`'s `persistSchemaIfNeeded`\n * right after a `_schemas/<collection>` write succeeds.\n *\n * ## Reconciling strict-CAS-refuse with the derived nature of the manifest\n *\n * `writer.ts`'s `writeSchemaManifest` is deliberately strict-CAS: a\n * concurrent *direct* edit to the manifest is refused, never retried (AC\n * #1). But this call site is not a direct edit — it is a re-derivation\n * from the source of truth, triggered as a side effect of a `_schemas`\n * write that has ALREADY succeeded. When N collections are declared\n * together (one `openVault()` call registering several `persistJsonSchema:\n * true` collections), their `persistSchemaIfNeeded` calls run CONCURRENTLY\n * — each one's own `_schemas/<collection>` write lands independently, and\n * each then calls this function. A single derive-then-write with no\n * feedback loop is NOT enough here: a call whose `deriveSchemaManifest`\n * snapshot ran before a sibling's `_schemas` write landed would persist a\n * manifest that's missing that sibling forever (nothing re-triggers it) —\n * this was a REAL bug (not a test-isolation artifact — reproduced with 0\n * shared state, purely from concurrent `_schemas` writes racing the derive\n * snapshot; see #941 flake fix commit). `syncSchemaManifest` therefore\n * loops (bounded by {@link MAX_SYNC_ATTEMPTS}):\n *\n * 1. Derive fresh, compare to what's persisted. Already converged → done.\n * 2. Write via strict-CAS. `ManifestConflictError` (another writer moved\n * the manifest first) → loop: re-derive against the NEW state and\n * retry, exactly like a normal optimistic-CAS retry.\n * 3. On a successful write, derive ONE more time. If a sibling's\n * `_schemas` write landed while we were deriving/writing, the state\n * has already moved past what we just wrote — loop again to catch it\n * up. If the re-derive matches what we wrote, we're the last writer\n * and the manifest is provably converged: return.\n *\n * This guarantees that whichever collection's `_schemas` write is the LAST\n * to land (in real wall-clock order — there is always exactly one, even\n * though no single caller knows which) ends up running a sync whose own\n * derive sees every sibling's write already committed, and whose\n * recheck-after-write confirms nothing moved further — so it converges the\n * manifest deterministically, regardless of interleaving. If attempts are\n * exhausted under pathological contention, the loop gives up — with a\n * `console.warn` (see cap-exhaustion note below), not silently — leaving\n * the last successful write in place; the manifest is a derivable cache\n * (not a correctness invariant), so a next schema write or `open()`'s\n * re-derive still converges it, matching how `persistSchemaIfNeeded`\n * already treats its own write failures.\n * Any error OTHER than `ManifestConflictError` (store failure, DEK\n * resolution failure, etc.) is NOT swallowed — it propagates to the\n * caller immediately, matching how `persistSchemaIfNeeded` already treats\n * its own write failures as a visible (not silently discarded) fingerprint\n * failure.\n *\n * ## CRITICAL fix (#941 review): a scoped principal must never write a\n * partial manifest\n *\n * `deriveSchemaManifest` returns `undecodableCollections` for any\n * `_schemas/<collection>` entry this principal's `lookupDEK` couldn't\n * resolve — e.g. a member `grant()`-scoped to one collection can decrypt\n * `_manifest` itself (system-prefixed DEKs propagate to every role) but\n * NOT a sibling data collection's `_schemas/<sibling>` entry. Before this\n * fix, `deriveSchemaManifest` silently treated \"can't decrypt\" the same as\n * \"no derivable content\" and omitted the sibling — so a scoped member's\n * OWN schema declare would derive a manifest missing every collection they\n * can't see, load the real (complete) persisted manifest as a valid CAS\n * token, observe a hash mismatch, and OVERWRITE it — permanently dropping\n * the siblings, silently, ledger-audited as a legitimate migration. The\n * converging recheck loop above made this WORSE, not better: re-deriving\n * from the same restricted view just re-confirms the same partial result\n * and declares it \"stable.\"\n *\n * Fix: if `undecodableCollections` is non-empty, `syncSchemaManifest`\n * `SKIP`s entirely — no read-compare, no write, no audit, no loop. It does\n * NOT try to merge-preserve the undecodable entries from what's currently\n * persisted: an `aggregateHash` computed over entries this principal can't\n * verify would be a hash asserting something it never actually checked,\n * which is worse than not writing at all. This is safe because:\n *\n * - The source of truth, `_schemas/<their-collection>`, was ALREADY\n * updated by their declare — nothing about their own change is lost.\n * - The pod-wide `_manifest` cache simply isn't rewritten by a principal\n * who'd corrupt it by omission — it stays whatever a full-visibility\n * principal (owner/admin/custodian) last wrote.\n * - `open()` re-derives from `_schemas` directly (not from the cached\n * manifest) for whoever opens it, so a stale cache is never load-bearing.\n * - The NEXT full-visibility principal's declare (or any subsequent sync\n * by someone with complete access) naturally refreshes the cache,\n * including the scoped member's own just-landed change.\n *\n * ## Ledger audit (AC #5)\n *\n * Schema-generation transitions are not ledger-audited anywhere else today\n * (neither the `_schemas/<collection>` write in `register.ts` nor the fence\n * bump in `schema-update/fence-controller.ts#runCutover`). This is the\n * first ledger-audited signal for a schema change: every manifest write\n * that actually happens (i.e. every time the derived manifest differs from\n * what's stored) appends an `op: 'migration'` entry via the optional\n * `getLedgerOrNull` callback — `null`/absent when the history strategy\n * isn't opted in, matching every other optional-ledger call site\n * (`vault._getLedgerOrNull()?.append(...)`, see `liberate.ts`,\n * `with-audit/periods/vault-facade.ts`). No audit fires on the no-op path\n * (derived manifest unchanged), on a swallowed conflict (the winning\n * writer's own sync already audits its write), or on the scoped-principal\n * SKIP path above (nothing was written).\n *\n * @module\n */\n\nimport type { LedgerStore } from '../../with-commit/history/ledger/store.js'\nimport { envelopePayloadHash } from '../../with-commit/history/ledger/hash.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport { ManifestConflictError } from '../../kernel/errors.js'\nimport { deriveSchemaManifest, type LookupDEK } from './derive.js'\nimport { loadSchemaManifestEntry, type GetManifestDEK } from './storage.js'\nimport { writeSchemaManifest } from './writer.js'\nimport { MANIFEST_COLLECTION } from './reserved-collections.js'\nimport { MANIFEST_SCHEMA_RECORD_ID, type SchemaManifest } from './types.js'\n\nexport interface ManifestSyncDeps {\n /** Resolver for `_manifest`'s OWN DEK — mints if absent (this principal's declare is about to write it). */\n readonly getDEK: GetManifestDEK\n /**\n * NON-MINTING lookup for every OTHER (sibling data) collection's DEK,\n * used by `deriveSchemaManifest` to build the index — see `derive.ts`'s\n * `LookupDEK` doc for why minting here would be actively harmful.\n */\n readonly lookupDEK: LookupDEK\n /** Optional ledger handle — absent when the history strategy isn't opted in (no-op audit). */\n readonly getLedgerOrNull?: () => LedgerStore | null\n}\n\n/**\n * Bound on the derive→write→recheck loop (see module doc). Headroom above\n * what any realistic `openVault()` batch (a handful of collections) needs —\n * a 40-way concurrent-declare stress repro converged within single digits.\n */\nconst MAX_SYNC_ATTEMPTS = 16\n\n/**\n * Re-derive the schema manifest and write it if it changed, looping until\n * the write is provably stable against concurrent sibling `_schemas`\n * writes (see module doc). SKIPS entirely (no write, no audit) when this\n * principal's view is incomplete (`undecodableCollections` non-empty) —\n * see the module doc's CRITICAL fix section. Swallows a\n * {@link ManifestConflictError} by retrying against the fresher state; any\n * other error propagates. Ledger-audits (`op: 'migration'`) once per\n * successful write.\n */\nexport async function syncSchemaManifest(\n store: NoydbStore,\n vault: string,\n deps: ManifestSyncDeps,\n): Promise<void> {\n for (let attempt = 0; attempt < MAX_SYNC_ATTEMPTS; attempt++) {\n const { manifest: derived, undecodableCollections } = await deriveSchemaManifest(store, vault, deps.lookupDEK)\n if (undecodableCollections.length > 0) {\n // Scoped principal — see module doc's CRITICAL fix. Never write a\n // manifest we know is missing collections we couldn't decrypt.\n return\n }\n\n const existing = await loadSchemaManifestEntry(store, vault, deps.getDEK)\n\n if (\n existing &&\n existing.manifest.generation === derived.generation &&\n existing.manifest.aggregateHash === derived.aggregateHash\n ) {\n return // already converged — no write, no audit\n }\n\n const expectedVersion = existing?.version ?? 0\n try {\n await writeSchemaManifest(store, vault, derived, expectedVersion, deps.getDEK)\n } catch (err) {\n if (err instanceof ManifestConflictError) continue // another writer moved it first — re-derive + retry\n throw err\n }\n\n await auditManifestWrite(store, vault, deps, derived, expectedVersion)\n\n // A sibling's `_schemas` write can land while WE were deriving/writing\n // (#941 flake fix — see module doc). Re-derive once more: if the truth\n // has already moved past what we just wrote, loop again to catch it up\n // instead of leaving a permanently-partial manifest. (A principal with\n // full visibility at the top of this iteration cannot lose that\n // visibility mid-call — the keyring doesn't change during one sync —\n // so this recheck is never itself subject to the undecodable-skip; the\n // `for` loop's own guard covers it defensively regardless.)\n const recheck = await deriveSchemaManifest(store, vault, deps.lookupDEK)\n if (recheck.undecodableCollections.length > 0) return // defensive — see comment above\n if (recheck.manifest.generation === derived.generation && recheck.manifest.aggregateHash === derived.aggregateHash) {\n return // stable — we were the last writer\n }\n }\n // Attempts exhausted under pathological contention — see module doc:\n // the manifest is a derivable cache, not a correctness invariant, so a\n // later schema write or open()'s re-derive still converges it. Warn\n // rather than fail silently — a silent give-up on a completeness\n // invariant is exactly what hid the original concurrent-declare race.\n console.warn(\n `[noy-db] schema-manifest sync did not converge after ${MAX_SYNC_ATTEMPTS} attempts; ` +\n 'the persisted manifest may be stale until the next schema write or open()\\'s re-derive.',\n )\n}\n\nasync function auditManifestWrite(\n store: NoydbStore,\n vault: string,\n deps: ManifestSyncDeps,\n derived: SchemaManifest,\n expectedVersion: number,\n): Promise<void> {\n const ledger = deps.getLedgerOrNull?.()\n if (!ledger) return\n // `_manifest/schema` has a real, individually-addressable envelope (unlike\n // a `lifecycle` entry's empty collection/id) — `verifyBackupIntegrity`'s\n // data cross-check (`with-pod/backup.ts`) treats any non-amendment,\n // non-lifecycle entry's `collection`/`id` as \"the latest write to this\n // record\" and recomputes+compares its ciphertext hash, so `payloadHash`\n // must be the real `envelopePayloadHash` of the just-written envelope\n // (ciphertext domain), NOT `derived.aggregateHash` (plaintext domain) —\n // using the wrong domain here trips a false-positive tamper failure on\n // restore.\n const envelope = await store.get(vault, MANIFEST_COLLECTION, MANIFEST_SCHEMA_RECORD_ID)\n await ledger.append({\n op: 'migration',\n collection: MANIFEST_COLLECTION,\n id: MANIFEST_SCHEMA_RECORD_ID,\n version: expectedVersion + 1,\n actor: '',\n payloadHash: await envelopePayloadHash(envelope),\n reason: `schema-manifest-sync:generation=${derived.generation}`,\n })\n}\n","/**\n * Orchestrate the derive → hash → skip-or-write cycle for a collection's\n * persisted JSON Schema. Called by the Vault at collection-registration\n * time when the developer opts in via `collection({ persistJsonSchema:\n * true })`.\n *\n * Skip semantics:\n *\n * - Zod validators: skip when the new hash equals the stored hash.\n * - Non-Zod (stub envelopes have hash=null): skip when the stored\n * envelope's `kind` matches the freshly-detected kind (since there's\n * no body to compare yet — a kind change is the only signal).\n *\n * @module\n */\n\nimport { derivePersistedSchema } from './derive.js'\nimport { loadPersistedSchemaEntry, savePersistedSchema } from './storage.js'\nimport { resolveFieldIds } from './field-ids.js'\nimport { computeSchemaDelta } from '../schema-update/delta.js'\nimport { evaluateStrategies } from '../schema-update/dispatch.js'\nimport { loadFence, saveFence } from '../schema-update/fence.js'\nimport { isConflictError } from '../../kernel/errors.js'\nimport { syncSchemaManifest, type ManifestSyncDeps } from '../manifest/sync.js'\nimport type { SchemaUpdateStrategy, UpdateDecision, SchemaDelta } from '../schema-update/types.js'\nimport type { NoydbStore, ClassifiedMarker } from '../../kernel/types.js'\nimport type { PersistedSchemaEnvelope } from './types.js'\nimport type { PairingMarker } from '../satellites/types.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\n\n/**\n * Max optimistic-CAS retries for the shared `_schemas/<collection>` record\n * (#583). Only two writers ever contend (the JSON-Schema writer and the\n * classified-marker writer), so one retry suffices; the headroom covers a\n * pathological re-order. Exhausting it rethrows the {@link ConflictError}\n * rather than silently losing a write.\n */\nconst MAX_SCHEMA_CAS_RETRIES = 5\n\nexport interface PersistSchemaResult {\n /** True when a fresh envelope was written to storage. */\n readonly written: boolean\n /** True when an existing envelope matched and the write was skipped. */\n readonly skipped: boolean\n /** The envelope that was either written or matched. */\n readonly envelope: PersistedSchemaEnvelope\n /** The update-strategy decision, present when strategies ran. */\n readonly decision?: UpdateDecision\n}\n\nexport async function persistSchemaIfNeeded(opts: {\n readonly store: NoydbStore\n readonly vault: string\n readonly collectionName: string\n readonly validator: unknown\n readonly dek: EnclaveKey\n readonly strategies?: readonly SchemaUpdateStrategy[]\n /** #941 Task 3: re-derive + sync the `_manifest/schema` INDEX after a write. Omitted → no sync (e.g. tests that don't care). */\n readonly manifestSync?: ManifestSyncDeps\n}): Promise<PersistSchemaResult> {\n const fresh = await derivePersistedSchema(opts.validator)\n\n // The `_schemas/<collection>` record is shared with the classified-marker\n // writer, so a plain load→save loses whichever writer put first (#583). Read\n // the version at load time and CAS on it; on conflict re-read (picking up the\n // other writer's field), re-evaluate, and retry.\n for (let attempt = 0; ; attempt++) {\n const { version, payload: stored } = await loadPersistedSchemaEntry(\n opts.store, opts.vault, opts.collectionName, opts.dek,\n )\n\n if (stored && isEquivalent(stored, fresh)) {\n return { written: false, skipped: true, envelope: stored, decision: { action: 'allow' } }\n }\n\n // Changed (or first registration). Compute the delta whenever we have a\n // comparable JSON-Schema baseline — independent of whether strategies\n // were registered (#946: the rename pairing it carries feeds the\n // fieldIds id-carry below even on a bare re-declare with no\n // `schemaUpdate` strategies configured). Strategies only run when\n // registered.\n let decision: UpdateDecision = { action: 'allow' }\n const strategies = opts.strategies ?? []\n let delta: SchemaDelta | undefined\n if (\n stored &&\n stored.kind === fresh.kind &&\n isPlainObject(stored.jsonSchema) &&\n isPlainObject(fresh.jsonSchema)\n ) {\n delta = computeSchemaDelta(stored.jsonSchema, fresh.jsonSchema, opts.collectionName)\n if (strategies.length > 0) {\n decision = await evaluateStrategies(delta, strategies, { collection: opts.collectionName })\n }\n }\n\n if (decision.action !== 'allow') {\n // reject (or cutover): do NOT overwrite the baseline — the\n // old schema stays the source of truth until the change is resolved.\n return { written: false, skipped: false, envelope: stored ?? fresh, decision }\n }\n\n // Preserve a previously-persisted classified marker (C-A / R10) and\n // satellite pairing marker (R-S9) — the schema derivation knows nothing\n // about them, so a naive overwrite here would drop the config-drift\n // guards' cross-session signals.\n let toSave: PersistedSchemaEnvelope = fresh\n if (stored?.classified !== undefined) toSave = { ...toSave, classified: stored.classified }\n if (stored?.satellite !== undefined) toSave = { ...toSave, satellite: stored.satellite }\n\n // #946: mint/preserve stable per-field ids (by name, carrying a\n // detected rename's id from its old name — see `delta.renamed`) and\n // stamp the vault-wide schema-fence generation this write happened at —\n // binds \"generation N\" to this envelope's content hash\n // (schemaFenceState() + loadPersistedSchema agree).\n const fieldIds = resolveFieldIds(fresh.jsonSchema, stored?.fieldIds, delta?.renamed)\n if (fieldIds !== undefined) toSave = { ...toSave, fieldIds }\n const fence = await loadFence(opts.store, opts.vault)\n toSave = { ...toSave, generation: fence.currentSchemaVersion }\n\n try {\n await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, toSave, version)\n if (toSave.hash !== null) {\n // This is the FIRST non-barrier writer to `_meta/schema-fence` —\n // previously only SchemaFenceController.#setState wrote it, and only\n // sequentially, under the drain barrier. There is no CAS on the fence\n // doc (out of scope to add here), so re-read it immediately before\n // writing rather than reusing the `fence` snapshot captured above\n // (before the potentially-slow `savePersistedSchema` call): spreading\n // a stale snapshot here would roll back `currentSchemaVersion`/\n // `fenceState` if a concurrent cutover (on a different collection)\n // advanced the fence in between — corrupting the vault-wide gate the\n // whole barrier + MigrationRequiredError check depends on. Re-reading\n // narrows (does not eliminate) that window to just this one overlay.\n const freshFence = await loadFence(opts.store, opts.vault)\n await saveFence(opts.store, opts.vault, { ...freshFence, schemaHash: toSave.hash })\n }\n // #941 Task 3: keep the `_manifest/schema` INDEX in sync with the\n // `_schemas/<collection>` write that just landed. Opt-in via\n // `opts.manifestSync` (threaded from vault.ts, which is the only\n // caller with a general-purpose `getDEK` resolver + ledger handle).\n if (opts.manifestSync) {\n await syncSchemaManifest(opts.store, opts.vault, opts.manifestSync)\n }\n return { written: true, skipped: false, envelope: toSave, decision }\n } catch (err) {\n if (isConflictError(err) && attempt < MAX_SCHEMA_CAS_RETRIES) continue\n throw err\n }\n }\n}\n\n/**\n * Persist (or refresh) the C-A / R10 classified marker into the collection's\n * `_schemas/<collection>` record, preserving any existing derived JSON-Schema\n * body. Idempotent — a no-op when an equivalent marker is already stored.\n * Independent of `persistJsonSchema`: called on the first classified write so a\n * later naive handle can detect the drift cross-session.\n */\nexport async function persistClassifiedMarker(opts: {\n readonly store: NoydbStore\n readonly vault: string\n readonly collectionName: string\n readonly dek: EnclaveKey\n readonly marker: ClassifiedMarker\n}): Promise<void> {\n // Shares the `_schemas/<collection>` record with the JSON-Schema writer;\n // CAS on the loaded version so a concurrent schema (re)registration can't\n // silently drop the marker (and vice-versa) — see #583.\n for (let attempt = 0; ; attempt++) {\n const { version, payload: stored } = await loadPersistedSchemaEntry(\n opts.store, opts.vault, opts.collectionName, opts.dek,\n )\n if (stored?.classified !== undefined && markersEqual(stored.classified, opts.marker)) return\n const payload: PersistedSchemaEnvelope =\n stored !== undefined\n ? { ...stored, classified: opts.marker }\n : {\n _noydb_schema: 1,\n kind: 'Unknown',\n jsonSchema: null,\n hash: null,\n derivedAt: new Date().toISOString(),\n classified: opts.marker,\n }\n try {\n await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, payload, version)\n return\n } catch (err) {\n if (isConflictError(err) && attempt < MAX_SCHEMA_CAS_RETRIES) continue\n throw err\n }\n }\n}\n\n/**\n * Persist (or refresh) the R-S9 satellite pairing marker into the collection's\n * `_schemas/<collection>` record, preserving any existing derived JSON-Schema\n * body. Idempotent — a no-op when an equivalent marker is already stored.\n * Independent of `persistJsonSchema`: called on satellite declaration so a\n * later divergent re-declaration can be detected cross-session.\n */\nexport async function persistSatelliteMarker(opts: {\n readonly store: NoydbStore\n readonly vault: string\n readonly collectionName: string\n readonly dek: EnclaveKey\n readonly marker: PairingMarker\n}): Promise<void> {\n // Shares the `_schemas/<collection>` record with the JSON-Schema writer;\n // CAS on the loaded version so a concurrent schema (re)registration can't\n // silently drop the marker (and vice-versa) — see #583.\n for (let attempt = 0; ; attempt++) {\n const { version, payload: stored } = await loadPersistedSchemaEntry(\n opts.store, opts.vault, opts.collectionName, opts.dek,\n )\n if (stored?.satellite !== undefined && satelliteMarkersEqual(stored.satellite, opts.marker)) return\n const payload: PersistedSchemaEnvelope =\n stored !== undefined\n ? { ...stored, satellite: opts.marker }\n : {\n _noydb_schema: 1,\n kind: 'Unknown',\n jsonSchema: null,\n hash: null,\n derivedAt: new Date().toISOString(),\n satellite: opts.marker,\n }\n try {\n await savePersistedSchema(opts.store, opts.vault, opts.collectionName, opts.dek, payload, version)\n return\n } catch (err) {\n if (isConflictError(err) && attempt < MAX_SCHEMA_CAS_RETRIES) continue\n throw err\n }\n }\n}\n\n// #597: both equality checks below deliberately do NOT compare `epoch`. A\n// live collection re-opening itself computes a fresh epoch candidate on\n// every declare (marker.ts / config-drift.ts) that must still be treated as\n// \"the same marker\" so the no-op fast path fires and the already-persisted\n// epoch is left untouched — that's what makes epoch stable across re-opens.\n// Comparing epoch here would break that fast path today, with no\n// corresponding benefit: there is no delete-collection API yet, so a\n// mismatched epoch can't (yet) mean \"this name was reused for a genuinely\n// new collection.\" Wiring an epoch-mismatch REJECTION is a deferred\n// follow-up for whenever collection deletion ships.\n\nfunction satelliteMarkersEqual(a: PairingMarker, b: PairingMarker): boolean {\n return a.base === b.base && a.fieldsHash === b.fieldsHash && (a.joined ?? null) === (b.joined ?? null)\n}\n\nfunction markersEqual(a: ClassifiedMarker, b: ClassifiedMarker): boolean {\n return sameSet(a.digestOnly, b.digestOnly) && sameSet(a.equatable, b.equatable)\n}\n\nfunction sameSet(a: readonly string[], b: readonly string[]): boolean {\n if (a.length !== b.length) return false\n const s = new Set(a)\n return b.every((x) => s.has(x))\n}\n\nfunction isPlainObject(v: unknown): v is object {\n return typeof v === 'object' && v !== null && !Array.isArray(v)\n}\n\nfunction isEquivalent(a: PersistedSchemaEnvelope, b: PersistedSchemaEnvelope): boolean {\n if (a.kind !== b.kind) return false\n // Zod path: real hashes — compare directly.\n if (a.hash && b.hash) return a.hash === b.hash\n // Stub path: both have hash=null. Kind equality is the only signal we have.\n if (a.hash === null && b.hash === null) return true\n // Mixed (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AAE,WAAW,EAAE,OAAQ,QAAO;AAClC,QAAM,IAAI,IAAI,IAAI,CAAC;AACnB,SAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAChC;AAEA,SAAS,cAAc,GAAyB;AAC9C,SAAO,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAChE;AAEA,SAAS,aAAa,GAA4B,GAAqC;AACrF,MAAI,EAAE,SAAS,EAAE,KAAM,QAAO;AAE9B,MAAI,EAAE,QAAQ,EAAE,KAAM,QAAO,EAAE,SAAS,EAAE;AAE1C,MAAI,EAAE,SAAS,QAAQ,EAAE,SAAS,KAAM,QAAO;AAE/C,SAAO;AACT;","names":[]}
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  FieldNotQueryableError,
7
7
  IndexRequiredError
8
- } from "./chunk-AR5D76T2.js";
8
+ } from "./chunk-HNGSV2YC.js";
9
9
 
10
10
  // src/with-lookup/indexing/strategy.ts
11
11
  var NO_INDEXING = {
@@ -534,4 +534,4 @@ export {
534
534
  PersistedCollectionIndex,
535
535
  LazyQuery
536
536
  };
537
- //# sourceMappingURL=chunk-ALUVACKT.js.map
537
+ //# sourceMappingURL=chunk-JIUVJ4M7.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ReadOnlyFrameError
3
- } from "./chunk-AR5D76T2.js";
3
+ } from "./chunk-HNGSV2YC.js";
4
4
 
5
5
  // src/with-fork/shadow/vault-frame.ts
6
6
  var VaultFrame = class {
@@ -71,4 +71,4 @@ export {
71
71
  VaultFrame,
72
72
  CollectionFrame
73
73
  };
74
- //# sourceMappingURL=chunk-NJHQE4LT.js.map
74
+ //# sourceMappingURL=chunk-JRCYZEHU.js.map