@noy-db/hub 0.1.0-pre.14 → 0.1.0-pre.16

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 (232) hide show
  1. package/dist/aggregate/index.cjs +91 -36
  2. package/dist/aggregate/index.cjs.map +1 -1
  3. package/dist/aggregate/index.d.cts +2 -2
  4. package/dist/aggregate/index.d.ts +2 -2
  5. package/dist/aggregate/index.js +15 -8
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/blobs/index.cjs.map +1 -1
  8. package/dist/blobs/index.d.cts +5 -4
  9. package/dist/blobs/index.d.ts +5 -4
  10. package/dist/blobs/index.js +4 -4
  11. package/dist/bundle/index.cjs +214 -7
  12. package/dist/bundle/index.cjs.map +1 -1
  13. package/dist/bundle/index.d.cts +5 -4
  14. package/dist/bundle/index.d.ts +5 -4
  15. package/dist/bundle/index.js +6 -4
  16. package/dist/{chunk-CX2S2IBB.js → chunk-23TTQXVO.js} +53 -79
  17. package/dist/chunk-23TTQXVO.js.map +1 -0
  18. package/dist/{chunk-WLZWITX3.js → chunk-2AXFIYHT.js} +1 -1
  19. package/dist/chunk-2AXFIYHT.js.map +1 -0
  20. package/dist/{chunk-SBOSKCXD.js → chunk-2R6G2WST.js} +209 -13
  21. package/dist/chunk-2R6G2WST.js.map +1 -0
  22. package/dist/{chunk-HENWE2QQ.js → chunk-34YSDCDP.js} +2 -2
  23. package/dist/{chunk-3J5PYYUL.js → chunk-5DWL3JBF.js} +2 -2
  24. package/dist/{chunk-562AT3V6.js → chunk-5NGHX6ME.js} +5 -5
  25. package/dist/chunk-5ZGZ6HIZ.js +100 -0
  26. package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
  27. package/dist/{chunk-ZJICDHNH.js → chunk-6HPZY4ON.js} +5 -4
  28. package/dist/chunk-6HPZY4ON.js.map +1 -0
  29. package/dist/{chunk-LTKFPLTW.js → chunk-A3K2ECAM.js} +192 -11
  30. package/dist/chunk-A3K2ECAM.js.map +1 -0
  31. package/dist/{chunk-W7M3E5M5.js → chunk-ADQ5MQ54.js} +48 -1
  32. package/dist/{chunk-W7M3E5M5.js.map → chunk-ADQ5MQ54.js.map} +1 -1
  33. package/dist/{chunk-Q3OWJPJI.js → chunk-DPMFBCV6.js} +32 -19
  34. package/dist/chunk-DPMFBCV6.js.map +1 -0
  35. package/dist/{chunk-AD4FMCXZ.js → chunk-DYBQG5PQ.js} +2 -2
  36. package/dist/{chunk-PNTWORBA.js → chunk-DYECX3IX.js} +2 -2
  37. package/dist/chunk-EGQYGYIU.js +51 -0
  38. package/dist/chunk-EGQYGYIU.js.map +1 -0
  39. package/dist/{chunk-RGHN6WV7.js → chunk-FCXOFQAJ.js} +2 -2
  40. package/dist/{chunk-PMMNH7VZ.js → chunk-H7XROQJM.js} +1 -1
  41. package/dist/chunk-H7XROQJM.js.map +1 -0
  42. package/dist/chunk-HB3Z2GCR.js +124 -0
  43. package/dist/chunk-HB3Z2GCR.js.map +1 -0
  44. package/dist/{chunk-CRNMA2FB.js → chunk-I6MX32UC.js} +4 -4
  45. package/dist/{chunk-PHSGPPV7.js → chunk-KESP7GOK.js} +3 -3
  46. package/dist/{chunk-FB34MDSJ.js → chunk-KJJKHKFP.js} +4 -4
  47. package/dist/{chunk-J3E2UMET.js → chunk-MIQHZESA.js} +3 -3
  48. package/dist/{chunk-TNYWH7Z2.js → chunk-MKSA2V7A.js} +2 -2
  49. package/dist/{chunk-E4ZSYZSN.js → chunk-NVBUGT76.js} +4 -4
  50. package/dist/{chunk-XFVOTOYQ.js → chunk-O4RHR7FV.js} +6 -6
  51. package/dist/{chunk-EEEFQTYN.js → chunk-OMLIZL2P.js} +2 -2
  52. package/dist/{chunk-GVPFL6XF.js → chunk-P7EQ2S5O.js} +2 -2
  53. package/dist/{chunk-E3VAKWJ7.js → chunk-QQUUAXDY.js} +7 -6
  54. package/dist/chunk-QQUUAXDY.js.map +1 -0
  55. package/dist/chunk-RD5LYKD6.js +82 -0
  56. package/dist/chunk-RD5LYKD6.js.map +1 -0
  57. package/dist/{chunk-7QGJ7RTL.js → chunk-RRMDLTIL.js} +4 -4
  58. package/dist/{chunk-432R4RDC.js → chunk-SIZWEV2Y.js} +35 -5
  59. package/dist/chunk-SIZWEV2Y.js.map +1 -0
  60. package/dist/{chunk-U7YDBNFC.js → chunk-UZXLQCHP.js} +2 -2
  61. package/dist/{chunk-PPJA7KL6.js → chunk-V6SGP2KX.js} +3 -3
  62. package/dist/{chunk-7AQKLLI5.js → chunk-WCA2NROQ.js} +2 -2
  63. package/dist/{chunk-ERV4AXVO.js → chunk-XGSOTWYX.js} +90 -131
  64. package/dist/chunk-XGSOTWYX.js.map +1 -0
  65. package/dist/{chunk-5Y4AKEZ6.js → chunk-Z72JH4KG.js} +2 -2
  66. package/dist/{chunk-IXFP66OV.js → chunk-ZNOEIM6Y.js} +2 -2
  67. package/dist/consent/index.cjs.map +1 -1
  68. package/dist/consent/index.d.cts +5 -4
  69. package/dist/consent/index.d.ts +5 -4
  70. package/dist/consent/index.js +3 -3
  71. package/dist/{crypto-VTEMMJK6.js → crypto-A7FRXYHC.js} +3 -3
  72. package/dist/{delegation-HYQULPZR.js → delegation-YBA4X4JN.js} +5 -5
  73. package/dist/derivations/index.cjs +97 -1
  74. package/dist/derivations/index.cjs.map +1 -1
  75. package/dist/derivations/index.d.cts +37 -10
  76. package/dist/derivations/index.d.ts +37 -10
  77. package/dist/derivations/index.js +6 -4
  78. package/dist/{dev-unlock-CpJ9rHW2.d.ts → dev-unlock-C8u6MRfS.d.ts} +1 -1
  79. package/dist/{dev-unlock-DEUUpWoR.d.cts → dev-unlock-gBjwzB6A.d.cts} +1 -1
  80. package/dist/executor-7E3VFGW7.js +11 -0
  81. package/dist/executor-CEWX2FQI.js +8 -0
  82. package/dist/executor-X4SQ3ZLC.js +8 -0
  83. package/dist/fanout-sidecar-ACJNXFU6.js +51 -0
  84. package/dist/fanout-sidecar-ACJNXFU6.js.map +1 -0
  85. package/dist/guards/index.cjs.map +1 -1
  86. package/dist/guards/index.d.cts +6 -5
  87. package/dist/guards/index.d.ts +6 -5
  88. package/dist/guards/index.js +6 -6
  89. package/dist/{hash-_9VyW44M.d.cts → hash-BXy5DuTD.d.cts} +1 -1
  90. package/dist/{hash-CJ9LfuY5.d.ts → hash-C6KOPK9Q.d.ts} +1 -1
  91. package/dist/history/index.cjs +2 -1
  92. package/dist/history/index.cjs.map +1 -1
  93. package/dist/history/index.d.cts +6 -5
  94. package/dist/history/index.d.ts +6 -5
  95. package/dist/history/index.js +6 -6
  96. package/dist/i18n/index.cjs.map +1 -1
  97. package/dist/i18n/index.d.cts +5 -4
  98. package/dist/i18n/index.d.ts +5 -4
  99. package/dist/i18n/index.js +6 -6
  100. package/dist/{index-s31g3m-D.d.cts → index-BA7A-MJs.d.cts} +96 -4
  101. package/dist/{index-BWAXR9tV.d.ts → index-CLK67MZE.d.ts} +96 -4
  102. package/dist/{index-7nd15fgy.d.ts → index-CNwA-B6-.d.ts} +70 -2
  103. package/dist/{index-CFJKJXWa.d.cts → index-CmVgTkqk.d.cts} +70 -2
  104. package/dist/index.cjs +2400 -571
  105. package/dist/index.cjs.map +1 -1
  106. package/dist/index.d.cts +128 -18
  107. package/dist/index.d.ts +128 -18
  108. package/dist/index.js +1217 -107
  109. package/dist/index.js.map +1 -1
  110. package/dist/indexing/index.cjs.map +1 -1
  111. package/dist/indexing/index.js +2 -2
  112. package/dist/{ledger-LHLIVPJ3.js → ledger-GHIZQLKR.js} +6 -6
  113. package/dist/materialized-views/index.cjs +255 -21
  114. package/dist/materialized-views/index.cjs.map +1 -1
  115. package/dist/materialized-views/index.d.cts +7 -6
  116. package/dist/materialized-views/index.d.ts +7 -6
  117. package/dist/materialized-views/index.js +9 -5
  118. package/dist/overlay-views/index.cjs.map +1 -1
  119. package/dist/overlay-views/index.d.cts +6 -5
  120. package/dist/overlay-views/index.d.ts +6 -5
  121. package/dist/overlay-views/index.js +3 -3
  122. package/dist/periods/index.cjs +2 -1
  123. package/dist/periods/index.cjs.map +1 -1
  124. package/dist/periods/index.d.cts +5 -4
  125. package/dist/periods/index.d.ts +5 -4
  126. package/dist/periods/index.js +6 -6
  127. package/dist/{public-envelope-66ZBXVXK.js → public-envelope-CRJAVW3E.js} +4 -4
  128. package/dist/query/index.cjs +139 -113
  129. package/dist/query/index.cjs.map +1 -1
  130. package/dist/query/index.d.cts +2 -2
  131. package/dist/query/index.d.ts +2 -2
  132. package/dist/query/index.js +13 -9
  133. package/dist/{registry-JYALMHGM.js → registry-3L3N3PTG.js} +3 -3
  134. package/dist/registry-O47PUPSY.js +8 -0
  135. package/dist/registry-WLLMODKN.js +8 -0
  136. package/dist/session/index.cjs.map +1 -1
  137. package/dist/session/index.d.cts +6 -5
  138. package/dist/session/index.d.ts +6 -5
  139. package/dist/session/index.js +3 -3
  140. package/dist/shadow/index.cjs.map +1 -1
  141. package/dist/shadow/index.d.cts +5 -4
  142. package/dist/shadow/index.d.ts +5 -4
  143. package/dist/shadow/index.js +2 -2
  144. package/dist/{stale-EET5YFYL.js → stale-HSC5YO2O.js} +2 -2
  145. package/dist/store/index.cjs.map +1 -1
  146. package/dist/store/index.d.cts +5 -4
  147. package/dist/store/index.d.ts +5 -4
  148. package/dist/store/index.js +2 -2
  149. package/dist/{strategy-D-SrOLCl.d.cts → strategy-DSTrsZ8t.d.cts} +72 -19
  150. package/dist/{strategy-D-SrOLCl.d.ts → strategy-DSTrsZ8t.d.ts} +72 -19
  151. package/dist/sync/index.cjs.map +1 -1
  152. package/dist/sync/index.d.cts +4 -3
  153. package/dist/sync/index.d.ts +4 -3
  154. package/dist/sync/index.js +4 -4
  155. package/dist/team/index.cjs +136 -6
  156. package/dist/team/index.cjs.map +1 -1
  157. package/dist/team/index.d.cts +5 -4
  158. package/dist/team/index.d.ts +5 -4
  159. package/dist/team/index.js +7 -7
  160. package/dist/tx/index.cjs +2 -1
  161. package/dist/tx/index.cjs.map +1 -1
  162. package/dist/tx/index.d.cts +5 -4
  163. package/dist/tx/index.d.ts +5 -4
  164. package/dist/tx/index.js +2 -2
  165. package/dist/{types-2JGVRzO2.d.cts → types-DDy02bWN.d.cts} +1159 -257
  166. package/dist/{types-DIOLYPUq.d.ts → types-DImsOlJe.d.ts} +1159 -257
  167. package/dist/util/index.cjs.map +1 -1
  168. package/dist/util/index.js +1 -1
  169. package/dist/{with-derivation-ClhfQvRa.d.ts → with-derivation-3AdLeSw8.d.ts} +1 -1
  170. package/dist/{with-derivation-3JX8SMxY.d.cts → with-derivation-CkCHx_J8.d.cts} +1 -1
  171. package/dist/{with-guard-Br3YPxRW.d.ts → with-guard-Br9zLEdi.d.ts} +1 -1
  172. package/dist/{with-guard-fJVfWBLs.d.cts → with-guard-DtKsFExw.d.cts} +1 -1
  173. package/dist/with-materialized-view-CMhEX4FK.d.cts +27 -0
  174. package/dist/with-materialized-view-Zal2bE1T.d.ts +27 -0
  175. package/dist/{with-overlayed-view-BLUKxdiJ.d.cts → with-overlayed-view-CA6zHrBt.d.cts} +1 -1
  176. package/dist/{with-overlayed-view-CtvJxhU3.d.ts → with-overlayed-view-R4BNG9OB.d.ts} +1 -1
  177. package/package.json +14 -2
  178. package/dist/chunk-432R4RDC.js.map +0 -1
  179. package/dist/chunk-CX2S2IBB.js.map +0 -1
  180. package/dist/chunk-E3VAKWJ7.js.map +0 -1
  181. package/dist/chunk-ERV4AXVO.js.map +0 -1
  182. package/dist/chunk-GV47JHIF.js +0 -29
  183. package/dist/chunk-GV47JHIF.js.map +0 -1
  184. package/dist/chunk-LTKFPLTW.js.map +0 -1
  185. package/dist/chunk-PMMNH7VZ.js.map +0 -1
  186. package/dist/chunk-Q2L5ZYX7.js +0 -66
  187. package/dist/chunk-Q2L5ZYX7.js.map +0 -1
  188. package/dist/chunk-Q3OWJPJI.js.map +0 -1
  189. package/dist/chunk-SBK6CETA.js +0 -30
  190. package/dist/chunk-SBK6CETA.js.map +0 -1
  191. package/dist/chunk-SBOSKCXD.js.map +0 -1
  192. package/dist/chunk-WLZWITX3.js.map +0 -1
  193. package/dist/chunk-ZJICDHNH.js.map +0 -1
  194. package/dist/executor-3H3NSIVZ.js +0 -8
  195. package/dist/executor-7ZOXGY7P.js +0 -8
  196. package/dist/executor-A5LTUAG2.js +0 -9
  197. package/dist/registry-J2UI37XJ.js +0 -8
  198. package/dist/registry-UMAL72WL.js +0 -8
  199. package/dist/with-materialized-view-CHho83hN.d.cts +0 -15
  200. package/dist/with-materialized-view-CgPphnza.d.ts +0 -15
  201. /package/dist/{chunk-HENWE2QQ.js.map → chunk-34YSDCDP.js.map} +0 -0
  202. /package/dist/{chunk-3J5PYYUL.js.map → chunk-5DWL3JBF.js.map} +0 -0
  203. /package/dist/{chunk-562AT3V6.js.map → chunk-5NGHX6ME.js.map} +0 -0
  204. /package/dist/{chunk-AD4FMCXZ.js.map → chunk-DYBQG5PQ.js.map} +0 -0
  205. /package/dist/{chunk-PNTWORBA.js.map → chunk-DYECX3IX.js.map} +0 -0
  206. /package/dist/{chunk-RGHN6WV7.js.map → chunk-FCXOFQAJ.js.map} +0 -0
  207. /package/dist/{chunk-CRNMA2FB.js.map → chunk-I6MX32UC.js.map} +0 -0
  208. /package/dist/{chunk-PHSGPPV7.js.map → chunk-KESP7GOK.js.map} +0 -0
  209. /package/dist/{chunk-FB34MDSJ.js.map → chunk-KJJKHKFP.js.map} +0 -0
  210. /package/dist/{chunk-J3E2UMET.js.map → chunk-MIQHZESA.js.map} +0 -0
  211. /package/dist/{chunk-TNYWH7Z2.js.map → chunk-MKSA2V7A.js.map} +0 -0
  212. /package/dist/{chunk-E4ZSYZSN.js.map → chunk-NVBUGT76.js.map} +0 -0
  213. /package/dist/{chunk-XFVOTOYQ.js.map → chunk-O4RHR7FV.js.map} +0 -0
  214. /package/dist/{chunk-EEEFQTYN.js.map → chunk-OMLIZL2P.js.map} +0 -0
  215. /package/dist/{chunk-GVPFL6XF.js.map → chunk-P7EQ2S5O.js.map} +0 -0
  216. /package/dist/{chunk-7QGJ7RTL.js.map → chunk-RRMDLTIL.js.map} +0 -0
  217. /package/dist/{chunk-U7YDBNFC.js.map → chunk-UZXLQCHP.js.map} +0 -0
  218. /package/dist/{chunk-PPJA7KL6.js.map → chunk-V6SGP2KX.js.map} +0 -0
  219. /package/dist/{chunk-7AQKLLI5.js.map → chunk-WCA2NROQ.js.map} +0 -0
  220. /package/dist/{chunk-5Y4AKEZ6.js.map → chunk-Z72JH4KG.js.map} +0 -0
  221. /package/dist/{chunk-IXFP66OV.js.map → chunk-ZNOEIM6Y.js.map} +0 -0
  222. /package/dist/{crypto-VTEMMJK6.js.map → crypto-A7FRXYHC.js.map} +0 -0
  223. /package/dist/{delegation-HYQULPZR.js.map → delegation-YBA4X4JN.js.map} +0 -0
  224. /package/dist/{executor-3H3NSIVZ.js.map → executor-7E3VFGW7.js.map} +0 -0
  225. /package/dist/{executor-7ZOXGY7P.js.map → executor-CEWX2FQI.js.map} +0 -0
  226. /package/dist/{executor-A5LTUAG2.js.map → executor-X4SQ3ZLC.js.map} +0 -0
  227. /package/dist/{ledger-LHLIVPJ3.js.map → ledger-GHIZQLKR.js.map} +0 -0
  228. /package/dist/{public-envelope-66ZBXVXK.js.map → public-envelope-CRJAVW3E.js.map} +0 -0
  229. /package/dist/{registry-J2UI37XJ.js.map → registry-3L3N3PTG.js.map} +0 -0
  230. /package/dist/{registry-JYALMHGM.js.map → registry-O47PUPSY.js.map} +0 -0
  231. /package/dist/{registry-UMAL72WL.js.map → registry-WLLMODKN.js.map} +0 -0
  232. /package/dist/{stale-EET5YFYL.js.map → stale-HSC5YO2O.js.map} +0 -0
@@ -1,11 +1,12 @@
1
- import { B as BlobStrategy } from '../types-2JGVRzO2.cjs';
2
- export { p as BLOB_CHUNKS_COLLECTION, q as BLOB_COLLECTION, s as BLOB_EVICTION_AUDIT_COLLECTION, t as BLOB_INDEX_COLLECTION, u as BLOB_SLOTS_PREFIX, w as BLOB_VERSIONS_PREFIX, x as BlobEvictionEntry, y as BlobFieldPolicy, z as BlobFieldsConfig, A as BlobObject, C as BlobPutOptions, E as BlobResponseOptions, F as BlobSet, G as BlobStrategyOpenArgs, H as CompactRunOptions, J as CompactionContext, K as CompactionResult, L as DEFAULT_CHUNK_SIZE, M as EXPORT_AUDIT_COLLECTION, N as ExportBlobsAbortedError, O as ExportBlobsAuditEntry, Q as ExportBlobsHandle, R as ExportBlobsOptions, T as ExportedBlob, U as SlotInfo, V as SlotRecord, W as VersionRecord, X as createExportBlobsHandle, Y as runCompaction } from '../types-2JGVRzO2.cjs';
1
+ import { B as BlobStrategy } from '../types-DDy02bWN.cjs';
2
+ export { p as BLOB_CHUNKS_COLLECTION, q as BLOB_COLLECTION, s as BLOB_EVICTION_AUDIT_COLLECTION, t as BLOB_INDEX_COLLECTION, u as BLOB_SLOTS_PREFIX, w as BLOB_VERSIONS_PREFIX, x as BlobEvictionEntry, y as BlobFieldPolicy, z as BlobFieldsConfig, A as BlobObject, C as BlobPutOptions, E as BlobResponseOptions, F as BlobSet, G as BlobStrategyOpenArgs, H as CompactRunOptions, J as CompactionContext, K as CompactionResult, L as DEFAULT_CHUNK_SIZE, M as EXPORT_AUDIT_COLLECTION, N as ExportBlobsAbortedError, O as ExportBlobsAuditEntry, Q as ExportBlobsHandle, R as ExportBlobsOptions, T as ExportedBlob, U as SlotInfo, V as SlotRecord, W as VersionRecord, X as createExportBlobsHandle, Y as runCompaction } from '../types-DDy02bWN.cjs';
3
3
  export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from '../mime-magic-CBBSOkjm.cjs';
4
4
  import '../lazy-builder-C-rPfWG0.cjs';
5
5
  import '../predicate-Dnu81tsS.cjs';
6
- import '../strategy-D-SrOLCl.cjs';
6
+ import '../strategy-DSTrsZ8t.cjs';
7
7
  import '../strategy-BSxFXGzb.cjs';
8
- import '../index-CFJKJXWa.cjs';
8
+ import '../index-CmVgTkqk.cjs';
9
+ import '@noy-db/on-shamir';
9
10
 
10
11
  /**
11
12
  * Active blob strategy factory. Calling `blobs()` returns a
@@ -1,11 +1,12 @@
1
- import { B as BlobStrategy } from '../types-DIOLYPUq.js';
2
- export { p as BLOB_CHUNKS_COLLECTION, q as BLOB_COLLECTION, s as BLOB_EVICTION_AUDIT_COLLECTION, t as BLOB_INDEX_COLLECTION, u as BLOB_SLOTS_PREFIX, w as BLOB_VERSIONS_PREFIX, x as BlobEvictionEntry, y as BlobFieldPolicy, z as BlobFieldsConfig, A as BlobObject, C as BlobPutOptions, E as BlobResponseOptions, F as BlobSet, G as BlobStrategyOpenArgs, H as CompactRunOptions, J as CompactionContext, K as CompactionResult, L as DEFAULT_CHUNK_SIZE, M as EXPORT_AUDIT_COLLECTION, N as ExportBlobsAbortedError, O as ExportBlobsAuditEntry, Q as ExportBlobsHandle, R as ExportBlobsOptions, T as ExportedBlob, U as SlotInfo, V as SlotRecord, W as VersionRecord, X as createExportBlobsHandle, Y as runCompaction } from '../types-DIOLYPUq.js';
1
+ import { B as BlobStrategy } from '../types-DImsOlJe.js';
2
+ export { p as BLOB_CHUNKS_COLLECTION, q as BLOB_COLLECTION, s as BLOB_EVICTION_AUDIT_COLLECTION, t as BLOB_INDEX_COLLECTION, u as BLOB_SLOTS_PREFIX, w as BLOB_VERSIONS_PREFIX, x as BlobEvictionEntry, y as BlobFieldPolicy, z as BlobFieldsConfig, A as BlobObject, C as BlobPutOptions, E as BlobResponseOptions, F as BlobSet, G as BlobStrategyOpenArgs, H as CompactRunOptions, J as CompactionContext, K as CompactionResult, L as DEFAULT_CHUNK_SIZE, M as EXPORT_AUDIT_COLLECTION, N as ExportBlobsAbortedError, O as ExportBlobsAuditEntry, Q as ExportBlobsHandle, R as ExportBlobsOptions, T as ExportedBlob, U as SlotInfo, V as SlotRecord, W as VersionRecord, X as createExportBlobsHandle, Y as runCompaction } from '../types-DImsOlJe.js';
3
3
  export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from '../mime-magic-CBBSOkjm.js';
4
4
  import '../lazy-builder-Rpd-V3jP.js';
5
5
  import '../predicate-Dnu81tsS.js';
6
- import '../strategy-D-SrOLCl.js';
6
+ import '../strategy-DSTrsZ8t.js';
7
7
  import '../strategy-BSxFXGzb.js';
8
- import '../index-7nd15fgy.js';
8
+ import '../index-CNwA-B6-.js';
9
+ import '@noy-db/on-shamir';
9
10
 
10
11
  /**
11
12
  * Active blob strategy factory. Calling `blobs()` returns a
@@ -14,10 +14,10 @@ import {
14
14
  detectMimeType,
15
15
  isPreCompressed,
16
16
  runCompaction
17
- } from "../chunk-562AT3V6.js";
18
- import "../chunk-PMMNH7VZ.js";
19
- import "../chunk-7AQKLLI5.js";
20
- import "../chunk-W7M3E5M5.js";
17
+ } from "../chunk-5NGHX6ME.js";
18
+ import "../chunk-H7XROQJM.js";
19
+ import "../chunk-WCA2NROQ.js";
20
+ import "../chunk-ADQ5MQ54.js";
21
21
 
22
22
  // src/blobs/active.ts
23
23
  function withBlobs() {
@@ -23,6 +23,7 @@ __export(bundle_exports, {
23
23
  BackupCorruptedError: () => BackupCorruptedError,
24
24
  BackupLedgerError: () => BackupLedgerError,
25
25
  BundleIntegrityError: () => BundleIntegrityError,
26
+ BundleSealMismatchError: () => BundleSealMismatchError,
26
27
  BundleVersionConflictError: () => BundleVersionConflictError,
27
28
  COMPRESSION_BROTLI: () => COMPRESSION_BROTLI,
28
29
  COMPRESSION_GZIP: () => COMPRESSION_GZIP,
@@ -57,7 +58,8 @@ var ALLOWED_HEADER_KEYS = /* @__PURE__ */ new Set([
57
58
  "handle",
58
59
  "bodyBytes",
59
60
  "bodySha256",
60
- "publicEnvelope"
61
+ "publicEnvelope",
62
+ "autoUnlock"
61
63
  ]);
62
64
  function validateBundleHeader(parsed) {
63
65
  if (parsed === null || typeof parsed !== "object") {
@@ -112,6 +114,14 @@ function validateBundleHeader(parsed) {
112
114
  );
113
115
  }
114
116
  }
117
+ if (h["autoUnlock"] !== void 0) {
118
+ if (h["autoUnlock"] !== "unsealed" && h["autoUnlock"] !== "sealed") {
119
+ const got = typeof h["autoUnlock"] === "string" ? `"${h["autoUnlock"]}"` : typeof h["autoUnlock"];
120
+ throw new Error(
121
+ `.noydb bundle header.autoUnlock must be 'unsealed' or 'sealed' when present, got ${got}.`
122
+ );
123
+ }
124
+ }
115
125
  }
116
126
  function encodeBundleHeader(header) {
117
127
  validateBundleHeader(header);
@@ -120,7 +130,8 @@ function encodeBundleHeader(header) {
120
130
  handle: header.handle,
121
131
  bodyBytes: header.bodyBytes,
122
132
  bodySha256: header.bodySha256,
123
- ...header.publicEnvelope !== void 0 ? { publicEnvelope: header.publicEnvelope } : {}
133
+ ...header.publicEnvelope !== void 0 ? { publicEnvelope: header.publicEnvelope } : {},
134
+ ...header.autoUnlock !== void 0 ? { autoUnlock: header.autoUnlock } : {}
124
135
  });
125
136
  return new TextEncoder().encode(json);
126
137
  }
@@ -173,12 +184,38 @@ var BundleVersionConflictError = class extends NoydbError {
173
184
  this.remoteVersion = remoteVersion;
174
185
  }
175
186
  };
187
+ var ValidationError = class extends NoydbError {
188
+ constructor(message = "Validation error") {
189
+ super("VALIDATION_ERROR", message);
190
+ this.name = "ValidationError";
191
+ }
192
+ };
176
193
  var BundleIntegrityError = class extends NoydbError {
177
194
  constructor(message) {
178
195
  super("BUNDLE_INTEGRITY", `.noydb bundle integrity check failed: ${message}`);
179
196
  this.name = "BundleIntegrityError";
180
197
  }
181
198
  };
199
+ var BundleSealMismatchError = class extends NoydbError {
200
+ userId;
201
+ pid;
202
+ constructor(userId, pid) {
203
+ super(
204
+ "BUNDLE_SEAL_MISMATCH",
205
+ `bundle carries sealed passphrase for user "${userId}" under provider "${pid}", but no registered provider matches that pid.
206
+
207
+ Resolutions:
208
+ 1. Configure a provider matching the pid and retry import.
209
+ 2. Pass \`attemptUnsealAcrossProviders: true\` to try each registered
210
+ provider regardless of pid (extra credential prompts may surface).
211
+ 3. Inspect the bundle without unsealing \u2014 pass no \`sealingProviders\`
212
+ to receive the sealed entries unmodified for offline analysis.`
213
+ );
214
+ this.name = "BundleSealMismatchError";
215
+ this.userId = userId;
216
+ this.pid = pid;
217
+ }
218
+ };
182
219
  var BackupLedgerError = class extends NoydbError {
183
220
  /** First-broken-entry index, if known. */
184
221
  divergedAt;
@@ -201,6 +238,167 @@ var BackupCorruptedError = class extends NoydbError {
201
238
  };
202
239
 
203
240
  // src/bundle/bundle.ts
241
+ function validateAutoUnlockOptions(opts) {
242
+ if (opts.autoPassphrases !== void 0 && opts.sealedPassphrases !== void 0) {
243
+ throw new ValidationError(
244
+ "writeNoydbBundle: `autoPassphrases` and `sealedPassphrases` are mutually exclusive. Choose one or the other."
245
+ );
246
+ }
247
+ if (opts.autoPassphrases !== void 0) {
248
+ if (opts.autoPassphrases.policy !== "public-by-design") {
249
+ throw new ValidationError(
250
+ 'writeNoydbBundle: `autoPassphrases` requires `policy: "public-by-design"`. This is an explicit opt-in marker \u2014 bundling plaintext credentials is safe only when those credentials are intended to be public (demo data, sample vaults). For production credentials, use `sealedPassphrases` instead.'
251
+ );
252
+ }
253
+ const userCount = Object.keys(opts.autoPassphrases.perUser).length;
254
+ if (userCount === 0) {
255
+ throw new ValidationError(
256
+ "writeNoydbBundle: `autoPassphrases.perUser` must have at least one entry."
257
+ );
258
+ }
259
+ return "unsealed";
260
+ }
261
+ if (opts.sealedPassphrases !== void 0) {
262
+ if (opts.sealedPassphrases.mode !== "self-target") {
263
+ throw new ValidationError(
264
+ `writeNoydbBundle: \`sealedPassphrases.mode\` must be 'self-target' in slice 1 (got '${opts.sealedPassphrases.mode}'). Recipient-target sealing via the RecipientSealer interface is deferred per foundation \xA711.4.`
265
+ );
266
+ }
267
+ if (opts.sealedPassphrases.provider === void 0) {
268
+ throw new ValidationError(
269
+ "writeNoydbBundle: `sealedPassphrases.provider` is required (a `SealingKeyProvider`)."
270
+ );
271
+ }
272
+ const userCount = Object.keys(opts.sealedPassphrases.perUser).length;
273
+ if (userCount === 0) {
274
+ throw new ValidationError(
275
+ "writeNoydbBundle: `sealedPassphrases.perUser` must have at least one entry."
276
+ );
277
+ }
278
+ return "sealed";
279
+ }
280
+ return null;
281
+ }
282
+ async function buildAutoUnlockWrapper(dumpJson, opts) {
283
+ if (opts.autoPassphrases !== void 0) {
284
+ return {
285
+ _noydb_bundle_body: 1,
286
+ dump: dumpJson,
287
+ _autoUnlock: {
288
+ kind: "unsealed",
289
+ perUser: { ...opts.autoPassphrases.perUser }
290
+ }
291
+ };
292
+ }
293
+ if (opts.sealedPassphrases === void 0) {
294
+ throw new Error("unreachable \u2014 validation should have caught this");
295
+ }
296
+ const { provider, perUser } = opts.sealedPassphrases;
297
+ const sealedPerUser = {};
298
+ const encoder = new TextEncoder();
299
+ for (const [userId, passphrase] of Object.entries(perUser)) {
300
+ const sealed = await provider.seal(encoder.encode(passphrase));
301
+ sealedPerUser[userId] = {
302
+ pid: provider.id,
303
+ sealed: bytesToBase64(sealed),
304
+ alg: "aes-256-gcm"
305
+ };
306
+ }
307
+ return {
308
+ _noydb_bundle_body: 1,
309
+ dump: dumpJson,
310
+ _autoUnlock: { kind: "sealed", perUser: sealedPerUser }
311
+ };
312
+ }
313
+ function parseAutoUnlockBody(bodyString) {
314
+ let parsed;
315
+ try {
316
+ parsed = JSON.parse(bodyString);
317
+ } catch (err) {
318
+ throw new BundleIntegrityError(
319
+ "header declared autoUnlock but body could not be parsed as JSON wrapper: " + (err instanceof Error ? err.message : String(err))
320
+ );
321
+ }
322
+ if (typeof parsed !== "object" || parsed === null) {
323
+ throw new BundleIntegrityError("autoUnlock body is not a JSON object");
324
+ }
325
+ const obj = parsed;
326
+ if (obj["_noydb_bundle_body"] !== 1) {
327
+ throw new BundleIntegrityError(
328
+ "autoUnlock body missing `_noydb_bundle_body: 1` discriminator"
329
+ );
330
+ }
331
+ if (typeof obj["dump"] !== "string") {
332
+ throw new BundleIntegrityError("autoUnlock body must carry a string `dump` field");
333
+ }
334
+ const blob = obj["_autoUnlock"];
335
+ if (typeof blob !== "object" || blob === null) {
336
+ throw new BundleIntegrityError("autoUnlock body missing `_autoUnlock` blob");
337
+ }
338
+ const blobObj = blob;
339
+ const kind = blobObj["kind"];
340
+ if (kind !== "unsealed" && kind !== "sealed") {
341
+ throw new BundleIntegrityError(
342
+ `autoUnlock blob has invalid kind ${String(kind)}; expected 'unsealed' or 'sealed'`
343
+ );
344
+ }
345
+ return {
346
+ dump: obj["dump"],
347
+ blob
348
+ };
349
+ }
350
+ async function resolveAutoUnlock(blob, opts) {
351
+ if (blob.kind === "unsealed") {
352
+ return { kind: "unsealed", perUser: { ...blob.perUser } };
353
+ }
354
+ if (opts.sealingProviders === void 0 || opts.sealingProviders.length === 0) {
355
+ const passthrough = {};
356
+ for (const [userId, entry] of Object.entries(blob.perUser)) {
357
+ passthrough[userId] = entry.sealed;
358
+ }
359
+ return { kind: "sealed", perUser: passthrough };
360
+ }
361
+ const providersByPid = /* @__PURE__ */ new Map();
362
+ for (const p of opts.sealingProviders) providersByPid.set(p.id, p);
363
+ const decoder = new TextDecoder();
364
+ const unsealedMap = {};
365
+ for (const [userId, entry] of Object.entries(blob.perUser)) {
366
+ const provider = providersByPid.get(entry.pid);
367
+ if (provider === void 0) {
368
+ if (opts.attemptUnsealAcrossProviders === true) {
369
+ let opened = null;
370
+ for (const candidate of opts.sealingProviders) {
371
+ try {
372
+ const plaintextBytes2 = await candidate.unseal(base64ToBytes(entry.sealed));
373
+ opened = decoder.decode(plaintextBytes2);
374
+ break;
375
+ } catch {
376
+ }
377
+ }
378
+ if (opened === null) {
379
+ throw new BundleSealMismatchError(userId, entry.pid);
380
+ }
381
+ unsealedMap[userId] = opened;
382
+ continue;
383
+ }
384
+ throw new BundleSealMismatchError(userId, entry.pid);
385
+ }
386
+ const plaintextBytes = await provider.unseal(base64ToBytes(entry.sealed));
387
+ unsealedMap[userId] = decoder.decode(plaintextBytes);
388
+ }
389
+ return { kind: "sealed", perUser: unsealedMap };
390
+ }
391
+ function bytesToBase64(bytes) {
392
+ let binary = "";
393
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
394
+ return btoa(binary);
395
+ }
396
+ function base64ToBytes(b64) {
397
+ const binary = atob(b64);
398
+ const out = new Uint8Array(binary.length);
399
+ for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
400
+ return out;
401
+ }
204
402
  var cachedBrotliSupport = null;
205
403
  function supportsBrotliCompression() {
206
404
  if (cachedBrotliSupport !== null) return cachedBrotliSupport;
@@ -356,12 +554,14 @@ async function writeNoydbBundle(vault, opts = {}) {
356
554
  "writeNoydbBundle: pass either exportPassphrase or recipients, not both"
357
555
  );
358
556
  }
557
+ const autoUnlockMode = validateAutoUnlockOptions(opts);
359
558
  const handle = await vault.getBundleHandle();
360
559
  const dumpJson = await vault.dump();
361
560
  const rekeyed = await applyRecipientRewrap(vault, dumpJson, opts);
362
561
  const plainFiltered = await applyPlaintextFilters(vault, rekeyed, opts);
363
562
  const filtered = applySliceFilters(plainFiltered, opts);
364
- const dumpBytes = new TextEncoder().encode(filtered);
563
+ const bodyJsonStr = autoUnlockMode === null ? filtered : JSON.stringify(await buildAutoUnlockWrapper(filtered, opts));
564
+ const dumpBytes = new TextEncoder().encode(bodyJsonStr);
365
565
  const { format, streamFormat } = selectCompression(opts.compression);
366
566
  const body = streamFormat === null ? dumpBytes : await pumpThroughStream(dumpBytes, new CompressionStream(streamFormat));
367
567
  const bodySha256 = await sha256Hex(body);
@@ -371,7 +571,8 @@ async function writeNoydbBundle(vault, opts = {}) {
371
571
  handle,
372
572
  bodyBytes: body.length,
373
573
  bodySha256,
374
- ...publicEnvelope !== void 0 ? { publicEnvelope } : {}
574
+ ...publicEnvelope !== void 0 ? { publicEnvelope } : {},
575
+ ...autoUnlockMode !== null ? { autoUnlock: autoUnlockMode } : {}
375
576
  };
376
577
  const headerBytes = encodeBundleHeader(header);
377
578
  const prefix = new Uint8Array(NOYDB_BUNDLE_PREFIX_BYTES);
@@ -413,7 +614,7 @@ function parsePrefixAndHeader(bytes) {
413
614
  function readNoydbBundleHeader(bytes) {
414
615
  return parsePrefixAndHeader(bytes).header;
415
616
  }
416
- async function readNoydbBundle(bytes) {
617
+ async function readNoydbBundle(bytes, opts = {}) {
417
618
  const { header, bodyOffset, algo } = parsePrefixAndHeader(bytes);
418
619
  const body = bytes.slice(bodyOffset);
419
620
  if (body.length !== header.bodyBytes) {
@@ -440,8 +641,13 @@ async function readNoydbBundle(bytes) {
440
641
  );
441
642
  }
442
643
  }
443
- const dumpJson = new TextDecoder("utf-8", { fatal: true }).decode(dumpBytes);
444
- return { header, dumpJson };
644
+ const bodyString = new TextDecoder("utf-8", { fatal: true }).decode(dumpBytes);
645
+ if (header.autoUnlock === void 0) {
646
+ return { header, dumpJson: bodyString };
647
+ }
648
+ const { dump, blob } = parseAutoUnlockBody(bodyString);
649
+ const autoUnlock = await resolveAutoUnlock(blob, opts);
650
+ return { header, dumpJson: dump, autoUnlock };
445
651
  }
446
652
 
447
653
  // src/bundle/ulid.ts
@@ -475,6 +681,7 @@ function isULID(value) {
475
681
  BackupCorruptedError,
476
682
  BackupLedgerError,
477
683
  BundleIntegrityError,
684
+ BundleSealMismatchError,
478
685
  BundleVersionConflictError,
479
686
  COMPRESSION_BROTLI,
480
687
  COMPRESSION_GZIP,