@noy-db/hub 0.2.0-pre.9 → 0.3.0-pre.2

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 (541) hide show
  1. package/README.md +129 -3
  2. package/dist/adapter/index.d.ts +5 -0
  3. package/dist/adapter/index.js +15 -0
  4. package/dist/aggregate/index.d.ts +6 -2
  5. package/dist/aggregate/index.js +24 -16
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/api-RW3KP7WU.js +14 -0
  8. package/dist/as/index.d.ts +7 -0
  9. package/dist/as/index.js +24 -0
  10. package/dist/at/index.d.ts +5 -0
  11. package/dist/at/index.js +1 -0
  12. package/dist/attestation/index.d.ts +15 -47
  13. package/dist/attestation/index.js +54 -10
  14. package/dist/attestation/index.js.map +1 -1
  15. package/dist/backup-KMJQ66MF.js +219 -0
  16. package/dist/backup-KMJQ66MF.js.map +1 -0
  17. package/dist/blobs/index.d.ts +6 -8
  18. package/dist/blobs/index.js +19 -12
  19. package/dist/blobs/index.js.map +1 -1
  20. package/dist/bundle/index.d.ts +16 -70
  21. package/dist/bundle/index.js +39 -476
  22. package/dist/bundle/index.js.map +1 -1
  23. package/dist/{ulid-CJ8RzRrm.d.ts → bundle-PwBGkhpe.d.ts} +31 -86
  24. package/dist/by/index.d.ts +1 -0
  25. package/dist/by/index.js +11 -0
  26. package/dist/cargo/index.d.ts +9 -0
  27. package/dist/cargo/index.js +89 -0
  28. package/dist/chunk-26LGBE4T.js +42 -0
  29. package/dist/chunk-26LGBE4T.js.map +1 -0
  30. package/dist/{chunk-K3DK3NU5.js → chunk-3YFXJ3ZP.js} +20 -5
  31. package/dist/chunk-3YFXJ3ZP.js.map +1 -0
  32. package/dist/chunk-4Q6HSHHL.js +90 -0
  33. package/dist/chunk-4Q6HSHHL.js.map +1 -0
  34. package/dist/chunk-5LUY7UTV.js +380 -0
  35. package/dist/chunk-5LUY7UTV.js.map +1 -0
  36. package/dist/chunk-5N6CZTCY.js +367 -0
  37. package/dist/chunk-5N6CZTCY.js.map +1 -0
  38. package/dist/chunk-5O3AOPDT.js +992 -0
  39. package/dist/chunk-5O3AOPDT.js.map +1 -0
  40. package/dist/chunk-5R3ERCDH.js +239 -0
  41. package/dist/chunk-5R3ERCDH.js.map +1 -0
  42. package/dist/chunk-5TDJ56JE.js +32 -0
  43. package/dist/chunk-5TDJ56JE.js.map +1 -0
  44. package/dist/{chunk-T7JEBOGN.js → chunk-62QYRORB.js} +18 -11
  45. package/dist/chunk-62QYRORB.js.map +1 -0
  46. package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
  47. package/dist/chunk-6S7T6WC4.js.map +1 -0
  48. package/dist/chunk-76722EBH.js +451 -0
  49. package/dist/chunk-76722EBH.js.map +1 -0
  50. package/dist/{chunk-Z6FNBOTC.js → chunk-AIWULCUO.js} +13 -17
  51. package/dist/chunk-AIWULCUO.js.map +1 -0
  52. package/dist/{chunk-O3VZPBZG.js → chunk-AQTBSL7R.js} +47 -11
  53. package/dist/chunk-AQTBSL7R.js.map +1 -0
  54. package/dist/chunk-AURFOK3D.js +35 -0
  55. package/dist/chunk-AURFOK3D.js.map +1 -0
  56. package/dist/{chunk-53XBRIRT.js → chunk-AXRXJTE2.js} +9 -9
  57. package/dist/chunk-AXRXJTE2.js.map +1 -0
  58. package/dist/chunk-AZAOEIKW.js +155 -0
  59. package/dist/chunk-AZAOEIKW.js.map +1 -0
  60. package/dist/{chunk-HNRHLRDC.js → chunk-BG3SPSR4.js} +3 -3
  61. package/dist/chunk-BG3SPSR4.js.map +1 -0
  62. package/dist/chunk-BGIZAFY7.js +1 -0
  63. package/dist/chunk-CHFZDSE4.js +1 -0
  64. package/dist/{chunk-DJHHA6XH.js → chunk-CMGR4ZEW.js} +50 -20
  65. package/dist/chunk-CMGR4ZEW.js.map +1 -0
  66. package/dist/chunk-CWPPNPOH.js +23 -0
  67. package/dist/chunk-CWPPNPOH.js.map +1 -0
  68. package/dist/{chunk-QODLLGQ7.js → chunk-DFEMTNPJ.js} +371 -38
  69. package/dist/chunk-DFEMTNPJ.js.map +1 -0
  70. package/dist/{chunk-ZYWZWG6G.js → chunk-DGDI2D4M.js} +10 -10
  71. package/dist/chunk-DGDI2D4M.js.map +1 -0
  72. package/dist/{chunk-SYMWGEET.js → chunk-EIZUR2XW.js} +3 -3
  73. package/dist/chunk-EIZUR2XW.js.map +1 -0
  74. package/dist/{chunk-BVRYKATC.js → chunk-FISN7WE4.js} +36 -33
  75. package/dist/chunk-FISN7WE4.js.map +1 -0
  76. package/dist/chunk-GHVIKOHT.js +1 -0
  77. package/dist/chunk-GYGWYIOZ.js +200 -0
  78. package/dist/chunk-GYGWYIOZ.js.map +1 -0
  79. package/dist/chunk-HCIPRAGS.js +45 -0
  80. package/dist/chunk-HCIPRAGS.js.map +1 -0
  81. package/dist/{chunk-PX35GA7L.js → chunk-I2NOIW44.js} +10 -10
  82. package/dist/chunk-I2NOIW44.js.map +1 -0
  83. package/dist/{chunk-OIF6LZUR.js → chunk-I3TIKTJO.js} +3 -3
  84. package/dist/chunk-I3TIKTJO.js.map +1 -0
  85. package/dist/chunk-I7FD46FF.js +9 -0
  86. package/dist/chunk-I7FD46FF.js.map +1 -0
  87. package/dist/chunk-IAGBDSCS.js +40 -0
  88. package/dist/chunk-IAGBDSCS.js.map +1 -0
  89. package/dist/{chunk-JWRVQKRZ.js → chunk-IELYAOGG.js} +6 -18
  90. package/dist/chunk-IELYAOGG.js.map +1 -0
  91. package/dist/chunk-IGUYVGGI.js +205 -0
  92. package/dist/chunk-IGUYVGGI.js.map +1 -0
  93. package/dist/{chunk-U26HQ6KJ.js → chunk-IO6GRPT6.js} +4 -4
  94. package/dist/chunk-IO6GRPT6.js.map +1 -0
  95. package/dist/chunk-IPB7FTQX.js +273 -0
  96. package/dist/chunk-IPB7FTQX.js.map +1 -0
  97. package/dist/chunk-ITNUCOXM.js +148 -0
  98. package/dist/chunk-ITNUCOXM.js.map +1 -0
  99. package/dist/{chunk-WPLVTJ5D.js → chunk-IUEN57TV.js} +10 -10
  100. package/dist/chunk-IUEN57TV.js.map +1 -0
  101. package/dist/{chunk-DL3HWOQ5.js → chunk-JNUWZ6D3.js} +9 -9
  102. package/dist/chunk-JNUWZ6D3.js.map +1 -0
  103. package/dist/chunk-K2WCO3NX.js +1 -0
  104. package/dist/chunk-KVOXU4T5.js +30 -0
  105. package/dist/chunk-KVOXU4T5.js.map +1 -0
  106. package/dist/chunk-KXGNJJXB.js +135 -0
  107. package/dist/chunk-KXGNJJXB.js.map +1 -0
  108. package/dist/chunk-LB7FD65R.js +163 -0
  109. package/dist/chunk-LB7FD65R.js.map +1 -0
  110. package/dist/{chunk-22DWZL57.js → chunk-LFLXAY2W.js} +43 -218
  111. package/dist/chunk-LFLXAY2W.js.map +1 -0
  112. package/dist/chunk-LMTH2RM6.js +129 -0
  113. package/dist/chunk-LMTH2RM6.js.map +1 -0
  114. package/dist/{aggregate/index.cjs → chunk-LV7M27WM.js} +390 -219
  115. package/dist/chunk-LV7M27WM.js.map +1 -0
  116. package/dist/{chunk-PE2FR4J3.js → chunk-LXQT4WMP.js} +16 -18
  117. package/dist/chunk-LXQT4WMP.js.map +1 -0
  118. package/dist/chunk-M2YKN37S.js +524 -0
  119. package/dist/chunk-M2YKN37S.js.map +1 -0
  120. package/dist/chunk-M6OST55S.js +14 -0
  121. package/dist/chunk-M6OST55S.js.map +1 -0
  122. package/dist/{chunk-F3GDRNUT.js → chunk-MD3Y6J3L.js} +35 -69
  123. package/dist/chunk-MD3Y6J3L.js.map +1 -0
  124. package/dist/{chunk-XJFLDA7A.js → chunk-MTMJVJ5W.js} +8 -7
  125. package/dist/chunk-MTMJVJ5W.js.map +1 -0
  126. package/dist/{chunk-DFMLEQZB.js → chunk-NF5JWERG.js} +5 -10
  127. package/dist/chunk-NF5JWERG.js.map +1 -0
  128. package/dist/{chunk-DO7C2TOG.js → chunk-PKHL44ER.js} +3 -3
  129. package/dist/{chunk-DO7C2TOG.js.map → chunk-PKHL44ER.js.map} +1 -1
  130. package/dist/{chunk-6CME4UEK.js → chunk-PSHOXR6C.js} +7008 -4827
  131. package/dist/chunk-PSHOXR6C.js.map +1 -0
  132. package/dist/chunk-PSMV73A5.js +117 -0
  133. package/dist/chunk-PSMV73A5.js.map +1 -0
  134. package/dist/chunk-PY4KJPYU.js +9 -0
  135. package/dist/chunk-PY4KJPYU.js.map +1 -0
  136. package/dist/chunk-PZ5AY32C.js +10 -0
  137. package/dist/{chunk-DE6GKS6G.js → chunk-Q7SS3IME.js} +50 -9
  138. package/dist/chunk-Q7SS3IME.js.map +1 -0
  139. package/dist/chunk-QHJW5EXU.js +54 -0
  140. package/dist/chunk-QHJW5EXU.js.map +1 -0
  141. package/dist/chunk-QZISFCVG.js +233 -0
  142. package/dist/chunk-QZISFCVG.js.map +1 -0
  143. package/dist/{chunk-NONAAENK.js → chunk-RUEKROOS.js} +11 -4
  144. package/dist/chunk-RUEKROOS.js.map +1 -0
  145. package/dist/chunk-RUIMKQTA.js +23 -0
  146. package/dist/chunk-RUIMKQTA.js.map +1 -0
  147. package/dist/{chunk-TFBP23BX.js → chunk-SKF73JOP.js} +66 -7
  148. package/dist/chunk-SKF73JOP.js.map +1 -0
  149. package/dist/chunk-SM3AVUHC.js +42 -0
  150. package/dist/chunk-SM3AVUHC.js.map +1 -0
  151. package/dist/{chunk-ML236QKC.js → chunk-SMXWYP24.js} +5 -5
  152. package/dist/chunk-SMXWYP24.js.map +1 -0
  153. package/dist/chunk-SRB2XEWB.js +148 -0
  154. package/dist/chunk-SRB2XEWB.js.map +1 -0
  155. package/dist/chunk-SVLR4POP.js +64 -0
  156. package/dist/chunk-SVLR4POP.js.map +1 -0
  157. package/dist/chunk-TA66UMI4.js +123 -0
  158. package/dist/chunk-TA66UMI4.js.map +1 -0
  159. package/dist/chunk-TEILUWOI.js +664 -0
  160. package/dist/chunk-TEILUWOI.js.map +1 -0
  161. package/dist/chunk-TJYQIGAP.js +82 -0
  162. package/dist/chunk-TJYQIGAP.js.map +1 -0
  163. package/dist/{chunk-H2X3ISXG.js → chunk-UAG5KWVA.js} +7 -7
  164. package/dist/chunk-UAG5KWVA.js.map +1 -0
  165. package/dist/chunk-UDRIWL7A.js +382 -0
  166. package/dist/chunk-UDRIWL7A.js.map +1 -0
  167. package/dist/{chunk-2GLDA55J.js → chunk-UIU2THRG.js} +498 -133
  168. package/dist/chunk-UIU2THRG.js.map +1 -0
  169. package/dist/{chunk-3YPCK6JX.js → chunk-UPJNJGGA.js} +165 -423
  170. package/dist/chunk-UPJNJGGA.js.map +1 -0
  171. package/dist/chunk-UV5MFVO3.js +21 -0
  172. package/dist/chunk-UV5MFVO3.js.map +1 -0
  173. package/dist/{chunk-2WUSG3IT.js → chunk-V7RWQRG7.js} +5 -5
  174. package/dist/chunk-V7RWQRG7.js.map +1 -0
  175. package/dist/{chunk-VTKGMEPP.js → chunk-VCTFO5CO.js} +13 -3
  176. package/dist/chunk-VCTFO5CO.js.map +1 -0
  177. package/dist/{chunk-5T22KDPN.js → chunk-VFQGRQIH.js} +8 -8
  178. package/dist/chunk-VFQGRQIH.js.map +1 -0
  179. package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
  180. package/dist/chunk-VQNJ7UZL.js.map +1 -0
  181. package/dist/{chunk-DONMZAD2.js → chunk-WWGT2MDV.js} +43 -165
  182. package/dist/chunk-WWGT2MDV.js.map +1 -0
  183. package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
  184. package/dist/chunk-WXSYDNBT.js.map +1 -0
  185. package/dist/chunk-WYSO2NIH.js +30 -0
  186. package/dist/chunk-WYSO2NIH.js.map +1 -0
  187. package/dist/chunk-XXYIOFUB.js +164 -0
  188. package/dist/chunk-XXYIOFUB.js.map +1 -0
  189. package/dist/{chunk-3BFJOWSU.js → chunk-Y22T3KQE.js} +35 -7
  190. package/dist/chunk-Y22T3KQE.js.map +1 -0
  191. package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
  192. package/dist/chunk-YMUGBZN2.js.map +1 -0
  193. package/dist/{chunk-I5FOWO4J.js → chunk-ZCGAHGUS.js} +52 -73
  194. package/dist/chunk-ZCGAHGUS.js.map +1 -0
  195. package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
  196. package/dist/chunk-ZJADGNYF.js.map +1 -0
  197. package/dist/{chunk-B6PB7JLN.js → chunk-ZYUC53LT.js} +427 -6
  198. package/dist/chunk-ZYUC53LT.js.map +1 -0
  199. package/dist/collection-facade-GQAOGJP2.js +33 -0
  200. package/dist/consent/index.d.ts +5 -7
  201. package/dist/consent/index.js +7 -5
  202. package/dist/consent/index.js.map +1 -1
  203. package/dist/crdt/index.d.ts +6 -2
  204. package/dist/crdt/index.js +3 -2
  205. package/dist/crdt/index.js.map +1 -1
  206. package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
  207. package/dist/delegation-UL5HKLER.js +19 -0
  208. package/dist/derivations/index.d.ts +7 -9
  209. package/dist/derivations/index.js +11 -6
  210. package/dist/describe/index.d.ts +1 -0
  211. package/dist/describe/index.js +1 -0
  212. package/dist/describe-Ccd1hS7a.d.ts +143 -0
  213. package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-h0K-UZTk.d.ts} +1 -1
  214. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  215. package/dist/enclave-UL5LW66V.js +88 -0
  216. package/dist/executor-2FWQRLMG.js +15 -0
  217. package/dist/executor-QZ7BXICW.js +9 -0
  218. package/dist/executor-Z5ZLJVTV.js +9 -0
  219. package/dist/export-accessible-KRV5W4GH.js +17 -0
  220. package/dist/extract-partition-GLKBOXFQ.js +30 -0
  221. package/dist/{fanout-sidecar-OKPMMPLG.js → fanout-sidecar-GF3DJ6KR.js} +34 -14
  222. package/dist/fanout-sidecar-GF3DJ6KR.js.map +1 -0
  223. package/dist/forget/index.d.ts +36 -0
  224. package/dist/forget/index.js +19 -0
  225. package/dist/forget/index.js.map +1 -0
  226. package/dist/guards/index.d.ts +13 -9
  227. package/dist/guards/index.js +12 -5
  228. package/dist/{hash-DdpVypUp.d.cts → hash-CdSr06sm.d.ts} +5 -1
  229. package/dist/history/index.d.ts +6 -8
  230. package/dist/history/index.js +19 -12
  231. package/dist/history/index.js.map +1 -1
  232. package/dist/i18n/index.d.ts +5 -7
  233. package/dist/i18n/index.js +104 -15
  234. package/dist/i18n/index.js.map +1 -1
  235. package/dist/in/index.d.ts +5 -0
  236. package/dist/in/index.js +1 -0
  237. package/dist/in/index.js.map +1 -0
  238. package/dist/index-B9QdHytu.d.ts +123 -0
  239. package/dist/index-CGLLRtFc.d.ts +123 -0
  240. package/dist/{types-Df28QFKb.d.ts → index-_6At2_9_.d.ts} +16270 -8358
  241. package/dist/index.d.ts +1088 -450
  242. package/dist/index.js +1165 -293
  243. package/dist/index.js.map +1 -1
  244. package/dist/indexing/index.d.ts +6 -3
  245. package/dist/indexing/index.js +6 -5
  246. package/dist/indexing/index.js.map +1 -1
  247. package/dist/issue-Y6UVIR43.js +13 -0
  248. package/dist/issue-Y6UVIR43.js.map +1 -0
  249. package/dist/kernel/index.d.ts +32 -0
  250. package/dist/kernel/index.js +53 -0
  251. package/dist/kernel/index.js.map +1 -0
  252. package/dist/{ledger-TMRZYNVJ.js → ledger-RYI35CDS.js} +12 -9
  253. package/dist/ledger-RYI35CDS.js.map +1 -0
  254. package/dist/liberate-CRPZEV7O.js +18 -0
  255. package/dist/liberate-CRPZEV7O.js.map +1 -0
  256. package/dist/materialized-views/index.d.ts +6 -19
  257. package/dist/materialized-views/index.js +16 -12
  258. package/dist/mime-magic-B4RoFj3B.d.ts +103 -0
  259. package/dist/noydb-LDEBLNHY.js +50 -0
  260. package/dist/noydb-LDEBLNHY.js.map +1 -0
  261. package/dist/on/index.d.ts +5 -0
  262. package/dist/on/index.js +11 -0
  263. package/dist/on/index.js.map +1 -0
  264. package/dist/overlay-views/index.d.ts +27 -11
  265. package/dist/overlay-views/index.js +7 -6
  266. package/dist/periods/index.d.ts +5 -7
  267. package/dist/periods/index.js +13 -9
  268. package/dist/pod/index.d.ts +63 -0
  269. package/dist/pod/index.js +61 -0
  270. package/dist/pod/index.js.map +1 -0
  271. package/dist/policy-IXK4FVXP.js +41 -0
  272. package/dist/policy-IXK4FVXP.js.map +1 -0
  273. package/dist/portability/index.d.ts +20 -0
  274. package/dist/portability/index.js +43 -0
  275. package/dist/portability/index.js.map +1 -0
  276. package/dist/{public-envelope-BW6OXORV.js → public-envelope-JHDQCPSX.js} +6 -5
  277. package/dist/public-envelope-JHDQCPSX.js.map +1 -0
  278. package/dist/query/index.d.ts +5 -3
  279. package/dist/query/index.js +21 -13
  280. package/dist/read-only-facade-5ADRJVTM.js +8 -0
  281. package/dist/read-only-facade-5ADRJVTM.js.map +1 -0
  282. package/dist/registry-45RJNWGU.js +9 -0
  283. package/dist/registry-45RJNWGU.js.map +1 -0
  284. package/dist/registry-5GRV5VXI.js +13 -0
  285. package/dist/registry-5GRV5VXI.js.map +1 -0
  286. package/dist/registry-VW6P6A3J.js +8 -0
  287. package/dist/registry-VW6P6A3J.js.map +1 -0
  288. package/dist/registry-WEUCHBO4.js +11 -0
  289. package/dist/registry-WEUCHBO4.js.map +1 -0
  290. package/dist/request-withdrawal-GBPH2FDY.js +25 -0
  291. package/dist/request-withdrawal-GBPH2FDY.js.map +1 -0
  292. package/dist/revoke-TUFRGI6S.js +18 -0
  293. package/dist/revoke-TUFRGI6S.js.map +1 -0
  294. package/dist/sealed-record/index.d.ts +69 -0
  295. package/dist/sealed-record/index.js +65 -0
  296. package/dist/sealed-record/index.js.map +1 -0
  297. package/dist/session/index.d.ts +6 -8
  298. package/dist/session/index.js +7 -5
  299. package/dist/session/index.js.map +1 -1
  300. package/dist/shadow/index.d.ts +5 -7
  301. package/dist/shadow/index.js +4 -3
  302. package/dist/shadow/index.js.map +1 -1
  303. package/dist/{signer-72QAUSVW.js → signer-PNKTBVF7.js} +6 -5
  304. package/dist/signer-PNKTBVF7.js.map +1 -0
  305. package/dist/snapshots/index.d.ts +6 -8
  306. package/dist/snapshots/index.js +13 -11
  307. package/dist/snapshots/index.js.map +1 -1
  308. package/dist/{stale-6ZDBTQT7.js → stale-3JWHNDIY.js} +3 -2
  309. package/dist/stale-3JWHNDIY.js.map +1 -0
  310. package/dist/store-coordination-provider-3I7XWZZK.js +142 -0
  311. package/dist/store-coordination-provider-3I7XWZZK.js.map +1 -0
  312. package/dist/subject-index-O75wKshW.d.ts +362 -0
  313. package/dist/sync/index.d.ts +4 -6
  314. package/dist/sync/index.js +7 -6
  315. package/dist/sync/index.js.map +1 -1
  316. package/dist/team/index.d.ts +5 -7
  317. package/dist/team/index.js +20 -16
  318. package/dist/tiers/index.d.ts +5 -0
  319. package/dist/tiers/index.js +33 -0
  320. package/dist/tiers/index.js.map +1 -0
  321. package/dist/to/index.d.ts +5 -0
  322. package/dist/to/index.js +17 -0
  323. package/dist/to/index.js.map +1 -0
  324. package/dist/transition-guard-DqodPNKw.d.ts +165 -0
  325. package/dist/tx/index.d.ts +23 -9
  326. package/dist/tx/index.js +13 -8
  327. package/dist/tx/index.js.map +1 -1
  328. package/dist/ui/index.d.ts +1 -0
  329. package/dist/ui/index.js +1 -0
  330. package/dist/ui/index.js.map +1 -0
  331. package/dist/ulid-DRH25k3y.d.ts +66 -0
  332. package/dist/ulid-PTAIMDG4.js +10 -0
  333. package/dist/ulid-PTAIMDG4.js.map +1 -0
  334. package/dist/util/index.d.ts +2 -0
  335. package/dist/util/index.js +7 -2
  336. package/dist/util/index.js.map +1 -1
  337. package/dist/vault-diff-BtpiBvic.d.ts +147 -0
  338. package/dist/with/index.d.ts +38 -0
  339. package/dist/with/index.js +25 -0
  340. package/dist/with/index.js.map +1 -0
  341. package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-DMmWtYfJ.d.ts} +1 -1
  342. package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-D_IB2nkM.d.ts} +2 -3
  343. package/dist/with-rollup-em2wxoHP.d.ts +47 -0
  344. package/dist/withdraw-accessible-FFS46EOD.js +22 -0
  345. package/dist/withdraw-accessible-FFS46EOD.js.map +1 -0
  346. package/dist/zod-HAJM7LMS.js +14763 -0
  347. package/dist/zod-HAJM7LMS.js.map +1 -0
  348. package/package.json +121 -201
  349. package/dist/aggregate/index.cjs.map +0 -1
  350. package/dist/aggregate/index.d.cts +0 -38
  351. package/dist/attestation/index.cjs +0 -305
  352. package/dist/attestation/index.cjs.map +0 -1
  353. package/dist/attestation/index.d.cts +0 -52
  354. package/dist/blobs/index.cjs +0 -1480
  355. package/dist/blobs/index.cjs.map +0 -1
  356. package/dist/blobs/index.d.cts +0 -46
  357. package/dist/bundle/index.cjs +0 -19264
  358. package/dist/bundle/index.cjs.map +0 -1
  359. package/dist/bundle/index.d.cts +0 -176
  360. package/dist/chunk-22DWZL57.js.map +0 -1
  361. package/dist/chunk-2GLDA55J.js.map +0 -1
  362. package/dist/chunk-2QR2PQTT.js.map +0 -1
  363. package/dist/chunk-2WUSG3IT.js.map +0 -1
  364. package/dist/chunk-3BFJOWSU.js.map +0 -1
  365. package/dist/chunk-3YPCK6JX.js.map +0 -1
  366. package/dist/chunk-53XBRIRT.js.map +0 -1
  367. package/dist/chunk-5T22KDPN.js.map +0 -1
  368. package/dist/chunk-5XHKQ56N.js +0 -340
  369. package/dist/chunk-5XHKQ56N.js.map +0 -1
  370. package/dist/chunk-6CME4UEK.js.map +0 -1
  371. package/dist/chunk-6STK5TQP.js +0 -139
  372. package/dist/chunk-6STK5TQP.js.map +0 -1
  373. package/dist/chunk-A3JMGXPG.js.map +0 -1
  374. package/dist/chunk-B6PB7JLN.js.map +0 -1
  375. package/dist/chunk-BVRYKATC.js.map +0 -1
  376. package/dist/chunk-DE6GKS6G.js.map +0 -1
  377. package/dist/chunk-DFMLEQZB.js.map +0 -1
  378. package/dist/chunk-DJHHA6XH.js.map +0 -1
  379. package/dist/chunk-DL3HWOQ5.js.map +0 -1
  380. package/dist/chunk-DONMZAD2.js.map +0 -1
  381. package/dist/chunk-EMIGCR7X.js.map +0 -1
  382. package/dist/chunk-F3GDRNUT.js.map +0 -1
  383. package/dist/chunk-FZU343FL.js.map +0 -1
  384. package/dist/chunk-H2X3ISXG.js.map +0 -1
  385. package/dist/chunk-HNRHLRDC.js.map +0 -1
  386. package/dist/chunk-I5FOWO4J.js.map +0 -1
  387. package/dist/chunk-J66GRPNH.js.map +0 -1
  388. package/dist/chunk-JWRVQKRZ.js.map +0 -1
  389. package/dist/chunk-K3DK3NU5.js.map +0 -1
  390. package/dist/chunk-ML236QKC.js.map +0 -1
  391. package/dist/chunk-NONAAENK.js.map +0 -1
  392. package/dist/chunk-O3VZPBZG.js.map +0 -1
  393. package/dist/chunk-OIF6LZUR.js.map +0 -1
  394. package/dist/chunk-OQ6PIGHA.js +0 -19
  395. package/dist/chunk-OQ6PIGHA.js.map +0 -1
  396. package/dist/chunk-PE2FR4J3.js.map +0 -1
  397. package/dist/chunk-PP6W64Y3.js +0 -275
  398. package/dist/chunk-PP6W64Y3.js.map +0 -1
  399. package/dist/chunk-PX35GA7L.js.map +0 -1
  400. package/dist/chunk-QEILDE6R.js +0 -793
  401. package/dist/chunk-QEILDE6R.js.map +0 -1
  402. package/dist/chunk-QODLLGQ7.js.map +0 -1
  403. package/dist/chunk-RAZ4OVLL.js +0 -51
  404. package/dist/chunk-RAZ4OVLL.js.map +0 -1
  405. package/dist/chunk-SYMWGEET.js.map +0 -1
  406. package/dist/chunk-T7JEBOGN.js.map +0 -1
  407. package/dist/chunk-TFBP23BX.js.map +0 -1
  408. package/dist/chunk-TV3YZ35S.js +0 -90
  409. package/dist/chunk-TV3YZ35S.js.map +0 -1
  410. package/dist/chunk-U26HQ6KJ.js.map +0 -1
  411. package/dist/chunk-UF3BUNQZ.js +0 -1
  412. package/dist/chunk-UMLVJTYV.js +0 -20
  413. package/dist/chunk-UMLVJTYV.js.map +0 -1
  414. package/dist/chunk-VTKGMEPP.js.map +0 -1
  415. package/dist/chunk-W6EQLGMB.js +0 -100
  416. package/dist/chunk-W6EQLGMB.js.map +0 -1
  417. package/dist/chunk-WIRRPTFH.js +0 -17
  418. package/dist/chunk-WIRRPTFH.js.map +0 -1
  419. package/dist/chunk-WPLVTJ5D.js.map +0 -1
  420. package/dist/chunk-XJFLDA7A.js.map +0 -1
  421. package/dist/chunk-Z6FNBOTC.js.map +0 -1
  422. package/dist/chunk-ZYWZWG6G.js.map +0 -1
  423. package/dist/consent/index.cjs +0 -204
  424. package/dist/consent/index.cjs.map +0 -1
  425. package/dist/consent/index.d.cts +0 -25
  426. package/dist/crdt/index.cjs +0 -152
  427. package/dist/crdt/index.cjs.map +0 -1
  428. package/dist/crdt/index.d.cts +0 -30
  429. package/dist/crypto-HTZ4FJOP.js +0 -44
  430. package/dist/delegation-RI54P6I5.js +0 -17
  431. package/dist/derivations/index.cjs +0 -351
  432. package/dist/derivations/index.cjs.map +0 -1
  433. package/dist/derivations/index.d.cts +0 -72
  434. package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
  435. package/dist/executor-5PNY7LGW.js +0 -8
  436. package/dist/executor-B4QIYGZX.js +0 -8
  437. package/dist/executor-BWXXDQ7K.js +0 -11
  438. package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
  439. package/dist/guards/index.cjs +0 -322
  440. package/dist/guards/index.cjs.map +0 -1
  441. package/dist/guards/index.d.cts +0 -31
  442. package/dist/hash-HJqD14vS.d.ts +0 -63
  443. package/dist/history/index.cjs +0 -1222
  444. package/dist/history/index.cjs.map +0 -1
  445. package/dist/history/index.d.cts +0 -63
  446. package/dist/i18n/index.cjs +0 -1100
  447. package/dist/i18n/index.cjs.map +0 -1
  448. package/dist/i18n/index.d.cts +0 -39
  449. package/dist/index-4fBVt8j9.d.cts +0 -2387
  450. package/dist/index-D8I_pyJD.d.ts +0 -2387
  451. package/dist/index.cjs +0 -24487
  452. package/dist/index.cjs.map +0 -1
  453. package/dist/index.d.cts +0 -776
  454. package/dist/indexing/index.cjs +0 -742
  455. package/dist/indexing/index.cjs.map +0 -1
  456. package/dist/indexing/index.d.cts +0 -36
  457. package/dist/issue-VGDPP4B5.js +0 -12
  458. package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
  459. package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
  460. package/dist/materialized-views/index.cjs +0 -854
  461. package/dist/materialized-views/index.cjs.map +0 -1
  462. package/dist/materialized-views/index.d.cts +0 -186
  463. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  464. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  465. package/dist/noydb-G725ZSZG.js +0 -34
  466. package/dist/overlay-views/index.cjs +0 -359
  467. package/dist/overlay-views/index.cjs.map +0 -1
  468. package/dist/overlay-views/index.d.cts +0 -82
  469. package/dist/periods/index.cjs +0 -1041
  470. package/dist/periods/index.cjs.map +0 -1
  471. package/dist/periods/index.d.cts +0 -22
  472. package/dist/predicate-BSAGEyu5.d.cts +0 -209
  473. package/dist/predicate-BSAGEyu5.d.ts +0 -209
  474. package/dist/query/index.cjs +0 -2375
  475. package/dist/query/index.cjs.map +0 -1
  476. package/dist/query/index.d.cts +0 -3
  477. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  478. package/dist/registry-3QP3YKQS.js +0 -8
  479. package/dist/registry-DKEXOJVO.js +0 -7
  480. package/dist/registry-OJIOSBV6.js +0 -10
  481. package/dist/registry-USRVT6YF.js +0 -8
  482. package/dist/revoke-JCC7N56X.js +0 -17
  483. package/dist/session/index.cjs +0 -495
  484. package/dist/session/index.cjs.map +0 -1
  485. package/dist/session/index.d.cts +0 -46
  486. package/dist/shadow/index.cjs +0 -133
  487. package/dist/shadow/index.cjs.map +0 -1
  488. package/dist/shadow/index.d.cts +0 -17
  489. package/dist/snapshots/index.cjs +0 -937
  490. package/dist/snapshots/index.cjs.map +0 -1
  491. package/dist/snapshots/index.d.cts +0 -28
  492. package/dist/store/index.cjs +0 -1083
  493. package/dist/store/index.cjs.map +0 -1
  494. package/dist/store/index.d.cts +0 -492
  495. package/dist/store/index.d.ts +0 -492
  496. package/dist/store/index.js +0 -37
  497. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  498. package/dist/strategy-BSxFXGzb.d.ts +0 -110
  499. package/dist/strategy-DSTrsZ8t.d.cts +0 -601
  500. package/dist/strategy-DSTrsZ8t.d.ts +0 -601
  501. package/dist/sync/index.cjs +0 -1062
  502. package/dist/sync/index.cjs.map +0 -1
  503. package/dist/sync/index.d.cts +0 -43
  504. package/dist/team/index.cjs +0 -2798
  505. package/dist/team/index.cjs.map +0 -1
  506. package/dist/team/index.d.cts +0 -118
  507. package/dist/tx/index.cjs +0 -544
  508. package/dist/tx/index.cjs.map +0 -1
  509. package/dist/tx/index.d.cts +0 -21
  510. package/dist/types-DyXYr8rE.d.cts +0 -12818
  511. package/dist/ulid-COREQ2RQ.js +0 -9
  512. package/dist/ulid-Drr7ykr6.d.cts +0 -603
  513. package/dist/util/index.cjs +0 -230
  514. package/dist/util/index.cjs.map +0 -1
  515. package/dist/util/index.d.cts +0 -77
  516. package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
  517. package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
  518. package/dist/with-guard-ByyxmEe7.d.cts +0 -18
  519. package/dist/with-guard-qube6BMI.d.ts +0 -18
  520. package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
  521. package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
  522. /package/dist/{store → adapter}/index.js.map +0 -0
  523. /package/dist/{chunk-UF3BUNQZ.js.map → api-RW3KP7WU.js.map} +0 -0
  524. /package/dist/{crypto-HTZ4FJOP.js.map → as/index.js.map} +0 -0
  525. /package/dist/{delegation-RI54P6I5.js.map → at/index.js.map} +0 -0
  526. /package/dist/{executor-5PNY7LGW.js.map → by/index.js.map} +0 -0
  527. /package/dist/{executor-B4QIYGZX.js.map → cargo/index.js.map} +0 -0
  528. /package/dist/{executor-BWXXDQ7K.js.map → chunk-BGIZAFY7.js.map} +0 -0
  529. /package/dist/{issue-VGDPP4B5.js.map → chunk-CHFZDSE4.js.map} +0 -0
  530. /package/dist/{ledger-TMRZYNVJ.js.map → chunk-GHVIKOHT.js.map} +0 -0
  531. /package/dist/{noydb-G725ZSZG.js.map → chunk-K2WCO3NX.js.map} +0 -0
  532. /package/dist/{public-envelope-BW6OXORV.js.map → chunk-PZ5AY32C.js.map} +0 -0
  533. /package/dist/{read-only-facade-ITU6L7BL.js.map → collection-facade-GQAOGJP2.js.map} +0 -0
  534. /package/dist/{registry-3QP3YKQS.js.map → delegation-UL5HKLER.js.map} +0 -0
  535. /package/dist/{registry-DKEXOJVO.js.map → describe/index.js.map} +0 -0
  536. /package/dist/{registry-OJIOSBV6.js.map → enclave-UL5LW66V.js.map} +0 -0
  537. /package/dist/{registry-USRVT6YF.js.map → executor-2FWQRLMG.js.map} +0 -0
  538. /package/dist/{revoke-JCC7N56X.js.map → executor-QZ7BXICW.js.map} +0 -0
  539. /package/dist/{signer-72QAUSVW.js.map → executor-Z5ZLJVTV.js.map} +0 -0
  540. /package/dist/{stale-6ZDBTQT7.js.map → export-accessible-KRV5W4GH.js.map} +0 -0
  541. /package/dist/{ulid-COREQ2RQ.js.map → extract-partition-GLKBOXFQ.js.map} +0 -0
@@ -1,7 +1,18 @@
1
1
  import {
2
- SCHEMAS_COLLECTION,
3
- resolveManagedSecret
4
- } from "../chunk-I5FOWO4J.js";
2
+ extractPartition,
3
+ walkClosure
4
+ } from "../chunk-76722EBH.js";
5
+ import "../chunk-CHFZDSE4.js";
6
+ import {
7
+ adoptPartition,
8
+ createOwnerOnAdoptedPartition,
9
+ decryptExtractedPartition,
10
+ unsealDeks
11
+ } from "../chunk-QZISFCVG.js";
12
+ import "../chunk-26LGBE4T.js";
13
+ import "../chunk-ZCGAHGUS.js";
14
+ import "../chunk-DFEMTNPJ.js";
15
+ import "../chunk-AZAOEIKW.js";
5
16
  import {
6
17
  COMPRESSION_BROTLI,
7
18
  COMPRESSION_GZIP,
@@ -11,45 +22,28 @@ import {
11
22
  NOYDB_BUNDLE_FORMAT_VERSION,
12
23
  NOYDB_BUNDLE_MAGIC,
13
24
  NOYDB_BUNDLE_PREFIX_BYTES,
14
- assembleBundleContainer,
15
- buildExtractedPartitionWrapper,
16
25
  encodeBundleHeader,
17
- parseExtractedPartitionBody,
18
26
  readNoydbBundle,
19
27
  readNoydbBundleHeader,
28
+ readPod,
29
+ readPodHeader,
20
30
  resetBrotliSupportCache,
21
31
  validateBundleHeader,
22
- writeNoydbBundle
23
- } from "../chunk-BVRYKATC.js";
24
- import "../chunk-ML236QKC.js";
25
- import {
26
- createOwnerKeyring
27
- } from "../chunk-DONMZAD2.js";
32
+ writeNoydbBundle,
33
+ writePod
34
+ } from "../chunk-FISN7WE4.js";
35
+ import "../chunk-SMXWYP24.js";
36
+ import "../chunk-WWGT2MDV.js";
37
+ import "../chunk-ITNUCOXM.js";
28
38
  import {
29
39
  generateULID,
30
40
  isULID
31
- } from "../chunk-FZU343FL.js";
32
- import {
33
- LEDGER_COLLECTION,
34
- LedgerStore
35
- } from "../chunk-PE2FR4J3.js";
36
- import {
37
- canonicalJson,
38
- envelopePayloadHash,
39
- hashEntry
40
- } from "../chunk-Z6FNBOTC.js";
41
- import {
42
- NOYDB_BACKUP_VERSION,
43
- NOYDB_FORMAT_VERSION
44
- } from "../chunk-WIRRPTFH.js";
45
- import {
46
- base64ToBuffer,
47
- bufferToBase64,
48
- decrypt,
49
- encrypt,
50
- generateDEK,
51
- wrapKey
52
- } from "../chunk-PP6W64Y3.js";
41
+ } from "../chunk-ZJADGNYF.js";
42
+ import "../chunk-LXQT4WMP.js";
43
+ import "../chunk-I7FD46FF.js";
44
+ import "../chunk-AIWULCUO.js";
45
+ import "../chunk-5O3AOPDT.js";
46
+ import "../chunk-5TDJ56JE.js";
53
47
  import {
54
48
  AdoptionStateError,
55
49
  BackupCorruptedError,
@@ -58,105 +52,12 @@ import {
58
52
  BundleSealMismatchError,
59
53
  BundleVersionConflictError,
60
54
  PartitionExtractionError,
61
- TransferSealError,
62
- ValidationError
63
- } from "../chunk-B6PB7JLN.js";
64
-
65
- // src/bundle/walk-closure.ts
66
- async function walkClosure(vault, opts) {
67
- const closure = /* @__PURE__ */ new Map();
68
- const requireStringId = (collection, record) => {
69
- const id = record["id"];
70
- if (typeof id !== "string") {
71
- throw new PartitionExtractionError(
72
- `walkClosure: record in collection "${collection}" has a non-string id (${typeof id}); cannot include it in the partition closure.`
73
- );
74
- }
75
- return id;
76
- };
77
- const add = (collection, id) => {
78
- let set = closure.get(collection);
79
- if (!set) {
80
- set = /* @__PURE__ */ new Set();
81
- closure.set(collection, set);
82
- }
83
- if (set.has(id)) return false;
84
- set.add(id);
85
- return true;
86
- };
87
- for (const [collectionName, predicate] of Object.entries(opts.seeds)) {
88
- const coll = vault.collection(collectionName);
89
- const records = await coll.list();
90
- for (const record of records) {
91
- if (await predicate(record)) {
92
- add(collectionName, requireStringId(collectionName, record));
93
- }
94
- }
95
- }
96
- const { refRegistry } = vault._introspectState();
97
- const maxDepth = opts.maxDepth ?? 16;
98
- let cyclesDetected = false;
99
- let inboundDepth = 0;
100
- let outboundDepth = 0;
101
- let frontier = [];
102
- for (const [c, ids] of closure) for (const id of ids) frontier.push([c, id]);
103
- while (frontier.length > 0) {
104
- const next = [];
105
- for (const [collectionName, id] of frontier) {
106
- for (const inbound of refRegistry.getInbound(collectionName)) {
107
- const childColl = vault.collection(inbound.collection);
108
- const childRecords = await childColl.list();
109
- for (const child of childRecords) {
110
- const fk = child[inbound.field];
111
- if (typeof fk !== "string" && typeof fk !== "number") continue;
112
- if (String(fk) !== id) continue;
113
- const childId = requireStringId(inbound.collection, child);
114
- if (add(inbound.collection, childId)) {
115
- next.push([inbound.collection, childId]);
116
- } else {
117
- cyclesDetected = true;
118
- }
119
- }
120
- }
121
- }
122
- if (next.length > 0 && ++inboundDepth > maxDepth) {
123
- throw new PartitionExtractionError(
124
- `walkClosure exceeded maxDepth=${maxDepth}; the FK graph may be unexpectedly deep or cyclic. Raise maxDepth or narrow the seeds.`
125
- );
126
- }
127
- frontier = next;
128
- }
129
- let outboundFrontier = [];
130
- for (const [c, ids] of closure) for (const id of ids) outboundFrontier.push([c, id]);
131
- while (outboundFrontier.length > 0) {
132
- const next = [];
133
- for (const [collectionName, id] of outboundFrontier) {
134
- const outbound = refRegistry.getOutbound(collectionName);
135
- if (Object.keys(outbound).length === 0) continue;
136
- const coll = vault.collection(collectionName);
137
- const record = await coll.get(id);
138
- if (!record) continue;
139
- for (const [field, descriptor] of Object.entries(outbound)) {
140
- const rawId = record[field];
141
- if (typeof rawId !== "string" && typeof rawId !== "number") continue;
142
- const parentId = String(rawId);
143
- if (add(descriptor.target, parentId)) {
144
- next.push([descriptor.target, parentId]);
145
- }
146
- }
147
- }
148
- if (next.length > 0 && ++outboundDepth > maxDepth) {
149
- throw new PartitionExtractionError(
150
- `walkClosure exceeded maxDepth=${maxDepth} during outbound completion.`
151
- );
152
- }
153
- outboundFrontier = next;
154
- }
155
- const depth = Math.max(inboundDepth, outboundDepth);
156
- return { closure, graph: { depth, cyclesDetected } };
157
- }
55
+ PodVersionConflictError,
56
+ TransferSealError
57
+ } from "../chunk-ZYUC53LT.js";
58
+ import "../chunk-PZ5AY32C.js";
158
59
 
159
- // src/bundle/describe-extraction.ts
60
+ // src/with-cargo/describe-extraction.ts
160
61
  async function describeExtraction(vault, opts) {
161
62
  const { closure, graph } = await walkClosure(vault, opts);
162
63
  const { name: vaultName, adapter } = vault._introspectState();
@@ -203,349 +104,6 @@ async function describeExtraction(vault, opts) {
203
104
  inaccessible
204
105
  });
205
106
  }
206
-
207
- // src/bundle/extract-partition.ts
208
- async function reKeyClosure(vault, closure) {
209
- const { name: vaultName, adapter, getDEK } = vault._introspectState();
210
- const collections = {};
211
- const deks = /* @__PURE__ */ new Map();
212
- for (const [collectionName, ids] of closure) {
213
- const srcDek = await getDEK(collectionName);
214
- const destDek = await generateDEK();
215
- deks.set(collectionName, destDek);
216
- const out = {};
217
- for (const id of ids) {
218
- const env = await adapter.get(vaultName, collectionName, id);
219
- if (!env) continue;
220
- const plaintext = await decrypt(env._iv, env._data, srcDek);
221
- const { iv, data } = await encrypt(plaintext, destDek);
222
- out[id] = { ...env, _iv: iv, _data: data };
223
- }
224
- collections[collectionName] = out;
225
- }
226
- return { collections, deks };
227
- }
228
- async function reKeySchemas(vault, closure, destDeks) {
229
- const { name: vaultName, adapter, getDEK } = vault._introspectState();
230
- const out = {};
231
- for (const collectionName of closure.keys()) {
232
- const env = await adapter.get(vaultName, SCHEMAS_COLLECTION, collectionName);
233
- if (!env) continue;
234
- const destDek = destDeks.get(collectionName);
235
- if (!destDek) continue;
236
- const srcDek = await getDEK(collectionName);
237
- const plaintext = await decrypt(env._iv, env._data, srcDek);
238
- const { iv, data } = await encrypt(plaintext, destDek);
239
- out[collectionName] = { ...env, _iv: iv, _data: data };
240
- }
241
- return out;
242
- }
243
- var paddedIndex = (n) => String(n).padStart(10, "0");
244
- async function reKeyLedger(vault, closure, reKeyedCollections, ledgerDek) {
245
- const { name: vaultName, adapter, getDEK } = vault._introspectState();
246
- const srcLedgerDek = await getDEK(LEDGER_COLLECTION);
247
- const ids = (await adapter.list(vaultName, LEDGER_COLLECTION)).sort();
248
- const srcEntries = [];
249
- for (const id of ids) {
250
- const env = await adapter.get(vaultName, LEDGER_COLLECTION, id);
251
- if (!env) continue;
252
- srcEntries.push(JSON.parse(await decrypt(env._iv, env._data, srcLedgerDek)));
253
- }
254
- const kept = srcEntries.filter(
255
- (e) => (e.op === "put" || e.op === "delete") && (closure.get(e.collection)?.has(e.id) ?? false)
256
- );
257
- const latestPutIndex = /* @__PURE__ */ new Map();
258
- for (let i = kept.length - 1; i >= 0; i--) {
259
- const e = kept[i];
260
- if (e.op !== "put") continue;
261
- const key = `${e.collection}/${e.id}`;
262
- if (!latestPutIndex.has(key)) latestPutIndex.set(key, i);
263
- }
264
- const entries = {};
265
- let prevHash = "";
266
- let last;
267
- for (let i = 0; i < kept.length; i++) {
268
- const src = kept[i];
269
- const key = `${src.collection}/${src.id}`;
270
- const isLatestPut = src.op === "put" && latestPutIndex.get(key) === i;
271
- const reKeyedEnv = reKeyedCollections[src.collection]?.[src.id];
272
- const payloadHash = isLatestPut && reKeyedEnv ? await envelopePayloadHash(reKeyedEnv) : src.payloadHash;
273
- const entry = {
274
- index: i,
275
- prevHash,
276
- op: src.op,
277
- collection: src.collection,
278
- id: src.id,
279
- version: src.version,
280
- ts: src.ts,
281
- actor: src.actor,
282
- payloadHash,
283
- ...src.reason !== void 0 ? { reason: src.reason } : {}
284
- };
285
- const { iv, data } = await encrypt(canonicalJson(entry), ledgerDek);
286
- entries[paddedIndex(i)] = {
287
- _noydb: NOYDB_FORMAT_VERSION,
288
- _v: i + 1,
289
- _ts: entry.ts,
290
- _iv: iv,
291
- _data: data,
292
- _by: entry.actor
293
- };
294
- prevHash = await hashEntry(entry);
295
- last = entry;
296
- }
297
- return {
298
- entries,
299
- head: last ? { hash: prevHash, index: last.index, ts: last.ts } : { hash: "", index: -1, ts: "" }
300
- };
301
- }
302
- async function sealDeks(deks) {
303
- const dekMap = {};
304
- for (const [collection, dek] of deks) {
305
- const raw = await crypto.subtle.exportKey("raw", dek);
306
- dekMap[collection] = bufferToBase64(raw);
307
- }
308
- const transferKey = crypto.getRandomValues(new Uint8Array(32));
309
- const key = await crypto.subtle.importKey("raw", transferKey, "AES-GCM", false, ["encrypt"]);
310
- const iv = crypto.getRandomValues(new Uint8Array(12));
311
- const plaintext = new TextEncoder().encode(JSON.stringify(dekMap));
312
- const ct = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, key, plaintext);
313
- const combined = new Uint8Array(iv.byteLength + ct.byteLength);
314
- combined.set(iv, 0);
315
- combined.set(new Uint8Array(ct), iv.byteLength);
316
- const sealId = bufferToBase64(crypto.getRandomValues(new Uint8Array(12)));
317
- return {
318
- seal: { v: 1, alg: "aes-256-gcm-pre-shared", sealId, payload: bufferToBase64(combined) },
319
- transferKey
320
- };
321
- }
322
- async function extractPartition(vault, opts) {
323
- if (vault.role !== "owner") {
324
- throw new PartitionExtractionError(
325
- `extractPartition requires the 'owner' role on the source vault; caller is '${vault.role}'. Producing a re-keyed standalone partition is an ownership operation.`
326
- );
327
- }
328
- if (opts.carrySchemas) await vault._drainPendingSchemaWrites();
329
- const { closure } = await walkClosure(vault, opts);
330
- const { collections, deks } = await reKeyClosure(vault, closure);
331
- let ledgerHead;
332
- let ledgerEntries;
333
- if (opts.carryLedger && vault._getLedgerOrNull() !== null) {
334
- const ledgerDek = await generateDEK();
335
- const built = await reKeyLedger(vault, closure, collections, ledgerDek);
336
- if (built.head.index >= 0) {
337
- ledgerEntries = built.entries;
338
- ledgerHead = built.head;
339
- deks.set(LEDGER_COLLECTION, ledgerDek);
340
- }
341
- }
342
- const internalSchemas = opts.carrySchemas ? await reKeySchemas(vault, closure, deks) : {};
343
- const internal = {};
344
- if (Object.keys(internalSchemas).length > 0) internal[SCHEMAS_COLLECTION] = internalSchemas;
345
- if (ledgerEntries) internal[LEDGER_COLLECTION] = ledgerEntries;
346
- const hasInternal = Object.keys(internal).length > 0;
347
- const { seal, transferKey } = await sealDeks(deks);
348
- await vault._getLedgerOrNull()?.append({
349
- op: "lifecycle",
350
- collection: "",
351
- id: "",
352
- version: 0,
353
- actor: "",
354
- payloadHash: "",
355
- reason: `partition-handed-over:${seal.sealId}`
356
- });
357
- const { name: vaultName } = vault._introspectState();
358
- const backup = {
359
- _noydb_backup: NOYDB_BACKUP_VERSION,
360
- _compartment: vaultName,
361
- _exported_at: (/* @__PURE__ */ new Date()).toISOString(),
362
- _exported_by: "",
363
- // unowned — no source user travels
364
- keyrings: {},
365
- collections,
366
- ...hasInternal ? { _internal: internal } : {},
367
- ...ledgerHead ? { ledgerHead: { hash: ledgerHead.hash, index: ledgerHead.index, ts: ledgerHead.ts } } : {}
368
- };
369
- const bodyJsonStr = JSON.stringify(buildExtractedPartitionWrapper(JSON.stringify(backup), seal));
370
- const handle = generateULID();
371
- const bundleBytes = await assembleBundleContainer({
372
- handle,
373
- bodyJsonStr,
374
- compression: opts.compression,
375
- headerExtras: {
376
- bundleKind: "extracted-partition",
377
- transferSeal: { v: seal.v, alg: seal.alg, sealId: seal.sealId }
378
- // indicator only
379
- }
380
- });
381
- return { bundleBytes, transferKey, sealId: seal.sealId };
382
- }
383
-
384
- // src/bundle/adopt-partition.ts
385
- async function unsealDeks(seal, transferKey) {
386
- if (transferKey.byteLength !== 32) {
387
- throw new TransferSealError(
388
- `transfer key must be 32 bytes, got ${transferKey.byteLength}.`
389
- );
390
- }
391
- const key = await crypto.subtle.importKey("raw", transferKey, "AES-GCM", false, ["decrypt"]);
392
- const raw = base64ToBuffer(seal.payload);
393
- let plaintext;
394
- try {
395
- plaintext = await crypto.subtle.decrypt(
396
- { name: "AES-GCM", iv: raw.slice(0, 12) },
397
- key,
398
- raw.slice(12)
399
- );
400
- } catch {
401
- throw new TransferSealError(
402
- "transfer seal could not be opened \u2014 wrong transfer key (AES-GCM authentication failed)."
403
- );
404
- }
405
- let dekMap;
406
- try {
407
- dekMap = JSON.parse(new TextDecoder().decode(plaintext));
408
- } catch {
409
- throw new TransferSealError("transfer seal payload is not valid JSON after decryption.");
410
- }
411
- const deks = /* @__PURE__ */ new Map();
412
- for (const [collection, b64] of Object.entries(dekMap)) {
413
- const dek = await crypto.subtle.importKey("raw", base64ToBuffer(b64), "AES-GCM", true, ["encrypt", "decrypt"]);
414
- deks.set(collection, dek);
415
- }
416
- return deks;
417
- }
418
- async function adoptPartition(bundleBytes, opts) {
419
- const { transferKey, destinationStore, vaultName } = opts;
420
- const header = readNoydbBundleHeader(bundleBytes);
421
- if (header.bundleKind !== "extracted-partition" || header.transferSeal === void 0) {
422
- throw new ValidationError(
423
- "adoptPartition requires an extracted-partition bundle with a transfer seal. For ordinary backups use readNoydbBundle + vault.load."
424
- );
425
- }
426
- const { dumpJson } = await readNoydbBundle(bundleBytes);
427
- const { dump, seal } = parseExtractedPartitionBody(dumpJson);
428
- await unsealDeks(seal, transferKey);
429
- const existing = await destinationStore.get(vaultName, "_meta", "adoption");
430
- if (existing) {
431
- const prior = JSON.parse(existing._data);
432
- if (prior.sealId === seal.sealId) {
433
- throw new AdoptionStateError(
434
- `partition (sealId ${seal.sealId}) is already adopted into vault "${vaultName}".`
435
- );
436
- }
437
- throw new AdoptionStateError(
438
- `vault "${vaultName}" already holds an adopted partition (sealId ${prior.sealId}); adopting a different partition (sealId ${seal.sealId}) here would overwrite it. Adopt into a fresh vaultName instead.`
439
- );
440
- }
441
- const existingKeyring = await destinationStore.list(vaultName, "_keyring");
442
- if (existingKeyring.length > 0) {
443
- throw new AdoptionStateError(
444
- `vault "${vaultName}" already holds a keyring (an unrelated owner exists at this slot); adoptPartition requires a fresh vaultName to avoid destructive saveAll on SQL adapters.`
445
- );
446
- }
447
- const backup = JSON.parse(dump);
448
- await destinationStore.saveAll(vaultName, backup.collections);
449
- if (backup._internal) {
450
- for (const [collection, records] of Object.entries(backup._internal)) {
451
- for (const [id, envelope] of Object.entries(records)) {
452
- await destinationStore.put(vaultName, collection, id, envelope);
453
- }
454
- }
455
- }
456
- const adoptedAt = (/* @__PURE__ */ new Date()).toISOString();
457
- const adoption = { sealId: seal.sealId, adoptedAt, needsOwner: true, transferSeal: seal };
458
- await destinationStore.put(vaultName, "_meta", "adoption", {
459
- _noydb: 1,
460
- _v: 1,
461
- _ts: adoptedAt,
462
- _iv: "",
463
- _data: JSON.stringify(adoption)
464
- });
465
- return { vaultName, needsOwner: true, sealId: seal.sealId };
466
- }
467
- function isManaged(o) {
468
- return "passphraseMode" in o && o.passphraseMode === "managed";
469
- }
470
- async function createOwnerOnAdoptedPartition(store, vaultName, opts) {
471
- const { userId, transferKey } = opts;
472
- if (isManaged(opts) && !opts.recovery.some((r) => r.profile === "shamir")) {
473
- throw new AdoptionStateError(
474
- "managed-mode adoption requires at least one strong (shamir) recovery profile in `recovery` \u2014 paper alone is not strong when there is no user passphrase to fall back on."
475
- );
476
- }
477
- const adoptionEnv = await store.get(vaultName, "_meta", "adoption");
478
- if (!adoptionEnv) {
479
- throw new AdoptionStateError(
480
- `vault "${vaultName}" is not an adopted partition (no _meta/adoption). createOwnerOnAdoptedPartition only applies to vaults created via adoptPartition.`
481
- );
482
- }
483
- const adoption = JSON.parse(adoptionEnv._data);
484
- if (adoption.consumedAt !== void 0 || adoption.transferSeal === void 0) {
485
- throw new AdoptionStateError(
486
- `vault "${vaultName}" already has an owner (transfer seal consumed at ${adoption.consumedAt}).`
487
- );
488
- }
489
- const partitionDeks = await unsealDeks(adoption.transferSeal, transferKey);
490
- const existingKeyring = await store.get(vaultName, "_keyring", userId);
491
- const otherOwners = (await store.list(vaultName, "_keyring")).filter((u) => u !== userId);
492
- if (otherOwners.length > 0) {
493
- throw new AdoptionStateError(
494
- `vault "${vaultName}" already has a keyring for a different owner; cannot create owner "${userId}".`
495
- );
496
- }
497
- const partitionCollections = [...partitionDeks.keys()];
498
- const priorDeks = existingKeyring ? JSON.parse(existingKeyring._data).deks : {};
499
- const ownerMinted = existingKeyring !== null && partitionCollections.every((c) => c in priorDeks);
500
- if (!ownerMinted) {
501
- const passphrase = isManaged(opts) ? await resolveManagedSecret(store, vaultName, opts.sealingKey) : opts.passphrase;
502
- const unlocked = await createOwnerKeyring(store, vaultName, userId, passphrase);
503
- const env = await store.get(vaultName, "_keyring", userId);
504
- if (!env) throw new AdoptionStateError(`keyring write for "${userId}" did not persist`);
505
- const keyringFile = JSON.parse(env._data);
506
- const kek = unlocked.kek;
507
- if (!kek) throw new AdoptionStateError(`owner keyring for "${userId}" has no KEK to wrap partition DEKs under`);
508
- const mergedDeks = { ...keyringFile.deks };
509
- for (const [collection, dek] of partitionDeks) {
510
- mergedDeks[collection] = await wrapKey(dek, kek);
511
- }
512
- const mergedFile = { ...keyringFile, deks: mergedDeks };
513
- await store.put(vaultName, "_keyring", userId, { ...env, _data: JSON.stringify(mergedFile) });
514
- }
515
- const ledgerDek = partitionDeks.get(LEDGER_COLLECTION);
516
- if (ledgerDek) {
517
- const ledger = new LedgerStore({
518
- adapter: store,
519
- vault: vaultName,
520
- encrypted: true,
521
- getDEK: async () => ledgerDek,
522
- actor: userId
523
- });
524
- const creationReason = `creation-of-new-owner:${userId}`;
525
- const consumedReason = `transfer-seal-consumed:${adoption.sealId}`;
526
- const recordedReasons = new Set((await ledger.loadAllEntries()).map((e) => e.reason));
527
- if (!recordedReasons.has(creationReason)) {
528
- await ledger.append({ op: "lifecycle", collection: "", id: "", version: 0, actor: "", payloadHash: "", reason: creationReason });
529
- }
530
- if (!recordedReasons.has(consumedReason)) {
531
- await ledger.append({ op: "lifecycle", collection: "", id: "", version: 0, actor: "", payloadHash: "", reason: consumedReason });
532
- }
533
- }
534
- if (isManaged(opts)) {
535
- const { createNoydb } = await import("../noydb-G725ZSZG.js");
536
- const db = await createNoydb({
537
- store,
538
- user: userId,
539
- passphraseMode: "managed",
540
- sealingKey: opts.sealingKey,
541
- shamirRecovery: opts.shamirRecovery
542
- });
543
- await db.openVaultAndEnrollRecovery(vaultName, { recovery: opts.recovery });
544
- }
545
- const consumed = { sealId: adoption.sealId, adoptedAt: adoption.adoptedAt, consumedAt: (/* @__PURE__ */ new Date()).toISOString() };
546
- await store.put(vaultName, "_meta", "adoption", { ...adoptionEnv, _data: JSON.stringify(consumed) });
547
- return { vaultName, userId };
548
- }
549
107
  export {
550
108
  AdoptionStateError,
551
109
  BackupCorruptedError,
@@ -562,9 +120,11 @@ export {
562
120
  NOYDB_BUNDLE_MAGIC,
563
121
  NOYDB_BUNDLE_PREFIX_BYTES,
564
122
  PartitionExtractionError,
123
+ PodVersionConflictError,
565
124
  TransferSealError,
566
125
  adoptPartition,
567
126
  createOwnerOnAdoptedPartition,
127
+ decryptExtractedPartition,
568
128
  describeExtraction,
569
129
  encodeBundleHeader,
570
130
  extractPartition,
@@ -572,10 +132,13 @@ export {
572
132
  isULID,
573
133
  readNoydbBundle,
574
134
  readNoydbBundleHeader,
135
+ readPod,
136
+ readPodHeader,
575
137
  resetBrotliSupportCache,
576
138
  unsealDeks,
577
139
  validateBundleHeader,
578
140
  walkClosure,
579
- writeNoydbBundle
141
+ writeNoydbBundle,
142
+ writePod
580
143
  };
581
144
  //# sourceMappingURL=index.js.map