@noy-db/hub 0.2.0-pre.5 → 0.2.0-pre.7

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 (258) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.js +4 -4
  3. package/dist/attestation/index.cjs.map +1 -1
  4. package/dist/attestation/index.d.cts +4 -4
  5. package/dist/attestation/index.d.ts +4 -4
  6. package/dist/attestation/index.js +6 -6
  7. package/dist/blobs/index.cjs.map +1 -1
  8. package/dist/blobs/index.d.cts +5 -5
  9. package/dist/blobs/index.d.ts +5 -5
  10. package/dist/blobs/index.js +5 -5
  11. package/dist/bundle/index.cjs +379 -21
  12. package/dist/bundle/index.cjs.map +1 -1
  13. package/dist/bundle/index.d.cts +6 -6
  14. package/dist/bundle/index.d.ts +6 -6
  15. package/dist/bundle/index.js +12 -12
  16. package/dist/{chunk-E225X5CQ.js → chunk-22ESLVUM.js} +3 -3
  17. package/dist/{chunk-5QPF2MJ5.js → chunk-2TXMTYWZ.js} +3 -3
  18. package/dist/{chunk-BT7544RM.js → chunk-3O5FNO5O.js} +116 -54
  19. package/dist/chunk-3O5FNO5O.js.map +1 -0
  20. package/dist/{chunk-34XGYMQT.js → chunk-3XCXUJTM.js} +2 -2
  21. package/dist/{chunk-XDW37COG.js → chunk-4EOVWJL6.js} +212 -7
  22. package/dist/chunk-4EOVWJL6.js.map +1 -0
  23. package/dist/{chunk-KGFV72WK.js → chunk-4YVVF6JN.js} +5 -5
  24. package/dist/{chunk-UGVDIOY7.js → chunk-6ILPGZXZ.js} +2 -2
  25. package/dist/{chunk-DFCINPB5.js → chunk-6MXGU2PW.js} +2 -2
  26. package/dist/{chunk-Y3P5DEMZ.js → chunk-7IH5FDXD.js} +6 -6
  27. package/dist/{chunk-2GMRNNI3.js → chunk-ASFE2X62.js} +2 -2
  28. package/dist/{chunk-YZ6JETII.js → chunk-AYRTGXF3.js} +180 -5
  29. package/dist/chunk-AYRTGXF3.js.map +1 -0
  30. package/dist/{chunk-CCC25PA7.js → chunk-BE5ZALMB.js} +5 -5
  31. package/dist/{chunk-WEA4TDTJ.js → chunk-BNUCCUES.js} +3 -3
  32. package/dist/{chunk-PS5G6A3Y.js → chunk-BRZFN354.js} +4 -4
  33. package/dist/{chunk-RIHZBSWJ.js → chunk-CBHPW77B.js} +3 -3
  34. package/dist/{chunk-LWFQYT4N.js → chunk-CSHY53CZ.js} +2 -2
  35. package/dist/{chunk-MDIC4FAU.js → chunk-DCP4L4SH.js} +2 -2
  36. package/dist/{chunk-TNBIWSQ7.js → chunk-GI6S5ZF2.js} +2 -2
  37. package/dist/{chunk-G26QAQNI.js → chunk-GZIDTXC4.js} +2 -2
  38. package/dist/{chunk-ARZAHCCF.js → chunk-HNC55FLJ.js} +3 -3
  39. package/dist/{chunk-SGSHQ4PH.js → chunk-HNFXKQD7.js} +5 -5
  40. package/dist/{chunk-YEHUEUNP.js → chunk-JZDA2SRB.js} +4 -4
  41. package/dist/{chunk-PX3MJ6RB.js → chunk-KK44CQ5B.js} +3 -3
  42. package/dist/{chunk-OPD3PZOG.js → chunk-LSY46G55.js} +4 -4
  43. package/dist/{chunk-T6MTNGBM.js → chunk-N4CDTRDH.js} +4 -4
  44. package/dist/{chunk-ZQMYB56Z.js → chunk-O3JCRQT3.js} +3 -3
  45. package/dist/{chunk-LJO6Q3X6.js → chunk-OA6HE2RW.js} +3 -3
  46. package/dist/{chunk-HIELMTUK.js → chunk-OIF6LZUR.js} +2 -2
  47. package/dist/{chunk-YJ46RFCD.js → chunk-OXCFFRF3.js} +2 -2
  48. package/dist/{chunk-ED3E3OLO.js → chunk-PJKGXUMG.js} +2 -2
  49. package/dist/{chunk-6A4AMQ2H.js → chunk-QYO6I7KK.js} +4 -4
  50. package/dist/{chunk-6HJ2ZALB.js → chunk-REQJJIPP.js} +44 -2
  51. package/dist/chunk-REQJJIPP.js.map +1 -0
  52. package/dist/{chunk-7TX7HN42.js → chunk-SLJQIBT7.js} +20 -3
  53. package/dist/chunk-SLJQIBT7.js.map +1 -0
  54. package/dist/{chunk-A4JNVBPF.js → chunk-SYOSRZN4.js} +5 -5
  55. package/dist/{chunk-R4LTCI6O.js → chunk-TS4FQPDD.js} +2 -2
  56. package/dist/{chunk-ICH4AIGL.js → chunk-TV3YZ35S.js} +5 -1
  57. package/dist/chunk-TV3YZ35S.js.map +1 -0
  58. package/dist/{chunk-CKH247ZR.js → chunk-UPBZ7NVY.js} +4 -4
  59. package/dist/{chunk-XVJFFGTG.js → chunk-VZOZ3DBN.js} +3 -3
  60. package/dist/{chunk-5VMTAX4Y.js → chunk-W6EQLGMB.js} +2 -2
  61. package/dist/{chunk-JSYTGEX4.js → chunk-WBUG3324.js} +3 -3
  62. package/dist/{chunk-5OVIFUQE.js → chunk-WIRRPTFH.js} +1 -1
  63. package/dist/chunk-WIRRPTFH.js.map +1 -0
  64. package/dist/{chunk-25WFLKOH.js → chunk-WM5GFORS.js} +2 -2
  65. package/dist/{chunk-CGJFCT3X.js → chunk-WMKCAN4H.js} +2 -2
  66. package/dist/{chunk-R7JTYCRX.js → chunk-XZCBBZLS.js} +2 -2
  67. package/dist/{chunk-EKTOYEZ3.js → chunk-YAMTXW77.js} +2 -2
  68. package/dist/consent/index.cjs.map +1 -1
  69. package/dist/consent/index.d.cts +5 -5
  70. package/dist/consent/index.d.ts +5 -5
  71. package/dist/consent/index.js +3 -3
  72. package/dist/{crypto-5UDZZL26.js → crypto-TRZ5BJMY.js} +3 -3
  73. package/dist/{delegation-42LO4WFO.js → delegation-TLZTK2XW.js} +5 -5
  74. package/dist/derivations/index.cjs.map +1 -1
  75. package/dist/derivations/index.d.cts +6 -6
  76. package/dist/derivations/index.d.ts +6 -6
  77. package/dist/derivations/index.js +4 -4
  78. package/dist/{dev-unlock--ahUTrhc.d.ts → dev-unlock-ClAEZQC4.d.ts} +1 -1
  79. package/dist/{dev-unlock-BIwt2V3p.d.cts → dev-unlock-L3z34v0J.d.cts} +1 -1
  80. package/dist/executor-HAVRTQN4.js +11 -0
  81. package/dist/executor-V3DKOADS.js +8 -0
  82. package/dist/executor-XO4M4243.js +8 -0
  83. package/dist/{fanout-sidecar-EVICRM46.js → fanout-sidecar-OKPMMPLG.js} +2 -2
  84. package/dist/guards/index.cjs.map +1 -1
  85. package/dist/guards/index.d.cts +6 -6
  86. package/dist/guards/index.d.ts +6 -6
  87. package/dist/guards/index.js +3 -3
  88. package/dist/{hash-CJEFQxSD.d.ts → hash-B3lV6lw3.d.ts} +1 -1
  89. package/dist/{hash-BQVrGV-t.d.cts → hash-M6-JI3Yu.d.cts} +1 -1
  90. package/dist/history/index.cjs.map +1 -1
  91. package/dist/history/index.d.cts +6 -6
  92. package/dist/history/index.d.ts +6 -6
  93. package/dist/history/index.js +5 -5
  94. package/dist/i18n/index.cjs +75 -10
  95. package/dist/i18n/index.cjs.map +1 -1
  96. package/dist/i18n/index.d.cts +5 -5
  97. package/dist/i18n/index.d.ts +5 -5
  98. package/dist/i18n/index.js +15 -13
  99. package/dist/{index-fIPPh5dg.d.ts → index-CmWQyC4e.d.ts} +84 -7
  100. package/dist/{index-5I0MZ0jQ.d.cts → index-vB43MAt4.d.cts} +84 -7
  101. package/dist/index.cjs +516 -123
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.d.cts +13 -13
  104. package/dist/index.d.ts +13 -13
  105. package/dist/index.js +66 -60
  106. package/dist/index.js.map +1 -1
  107. package/dist/indexing/index.cjs +4 -0
  108. package/dist/indexing/index.cjs.map +1 -1
  109. package/dist/indexing/index.d.cts +3 -3
  110. package/dist/indexing/index.d.ts +3 -3
  111. package/dist/indexing/index.js +4 -4
  112. package/dist/issue-EJKUQ6FA.js +12 -0
  113. package/dist/{lazy-builder-D1MyR1qH.d.ts → lazy-builder-7tIpFyWN.d.ts} +1 -1
  114. package/dist/{lazy-builder-DXlSCNCJ.d.cts → lazy-builder-wY4pMCEe.d.cts} +1 -1
  115. package/dist/{ledger-UX4QIHWI.js → ledger-SQVVE2DR.js} +5 -5
  116. package/dist/materialized-views/index.cjs +18 -1
  117. package/dist/materialized-views/index.cjs.map +1 -1
  118. package/dist/materialized-views/index.d.cts +10 -8
  119. package/dist/materialized-views/index.d.ts +10 -8
  120. package/dist/materialized-views/index.js +12 -12
  121. package/dist/noydb-MK4UQ626.js +34 -0
  122. package/dist/overlay-views/index.cjs.map +1 -1
  123. package/dist/overlay-views/index.d.cts +6 -6
  124. package/dist/overlay-views/index.d.ts +6 -6
  125. package/dist/overlay-views/index.js +6 -6
  126. package/dist/periods/index.cjs.map +1 -1
  127. package/dist/periods/index.d.cts +5 -5
  128. package/dist/periods/index.d.ts +5 -5
  129. package/dist/periods/index.js +5 -5
  130. package/dist/{predicate-B0IKeBXx.d.cts → predicate-BSAGEyu5.d.cts} +26 -2
  131. package/dist/{predicate-B0IKeBXx.d.ts → predicate-BSAGEyu5.d.ts} +26 -2
  132. package/dist/{public-envelope-YKHKP74C.js → public-envelope-BXPXMN3U.js} +4 -4
  133. package/dist/query/index.cjs +244 -4
  134. package/dist/query/index.cjs.map +1 -1
  135. package/dist/query/index.d.cts +2 -2
  136. package/dist/query/index.d.ts +2 -2
  137. package/dist/query/index.js +12 -6
  138. package/dist/{registry-4NEW7LQY.js → registry-4R4IURUM.js} +3 -3
  139. package/dist/registry-GPBLCHG7.js +8 -0
  140. package/dist/registry-ZON5HNIV.js +8 -0
  141. package/dist/{revoke-R5NIQ74J.js → revoke-Y7UDOXGH.js} +6 -6
  142. package/dist/session/index.cjs.map +1 -1
  143. package/dist/session/index.d.cts +6 -6
  144. package/dist/session/index.d.ts +6 -6
  145. package/dist/session/index.js +3 -3
  146. package/dist/shadow/index.cjs.map +1 -1
  147. package/dist/shadow/index.d.cts +5 -5
  148. package/dist/shadow/index.d.ts +5 -5
  149. package/dist/shadow/index.js +2 -2
  150. package/dist/{signer-WGDJNWSU.js → signer-UD2ZSVDJ.js} +5 -5
  151. package/dist/snapshots/index.cjs +903 -0
  152. package/dist/snapshots/index.cjs.map +1 -0
  153. package/dist/snapshots/index.d.cts +21 -0
  154. package/dist/snapshots/index.d.ts +21 -0
  155. package/dist/snapshots/index.js +118 -0
  156. package/dist/snapshots/index.js.map +1 -0
  157. package/dist/{stale-74WGLVZ2.js → stale-F4V5E7ZK.js} +2 -2
  158. package/dist/store/index.cjs.map +1 -1
  159. package/dist/store/index.d.cts +5 -5
  160. package/dist/store/index.d.ts +5 -5
  161. package/dist/store/index.js +2 -2
  162. package/dist/sync/index.cjs.map +1 -1
  163. package/dist/sync/index.d.cts +4 -4
  164. package/dist/sync/index.d.ts +4 -4
  165. package/dist/sync/index.js +4 -4
  166. package/dist/team/index.cjs.map +1 -1
  167. package/dist/team/index.d.cts +5 -5
  168. package/dist/team/index.d.ts +5 -5
  169. package/dist/team/index.js +8 -8
  170. package/dist/tx/index.cjs.map +1 -1
  171. package/dist/tx/index.d.cts +5 -5
  172. package/dist/tx/index.d.ts +5 -5
  173. package/dist/tx/index.js +3 -3
  174. package/dist/{types-BV4AZKmx.d.ts → types-DT7cXRHq.d.ts} +84 -8
  175. package/dist/{types-BeKi0hCx.d.cts → types-r-y7TIqj.d.cts} +84 -8
  176. package/dist/{ulid-Cvljl7ZZ.d.cts → ulid-BkW3mLlz.d.cts} +1 -1
  177. package/dist/{ulid-CQc0eBxE.d.ts → ulid-Dt55yn4s.d.ts} +1 -1
  178. package/dist/util/index.cjs.map +1 -1
  179. package/dist/util/index.js +1 -1
  180. package/dist/{with-derivation-BkOBDhsu.d.cts → with-derivation-DB63Po2m.d.cts} +1 -1
  181. package/dist/{with-derivation-BWcwmevt.d.ts → with-derivation-D_Ids_H6.d.ts} +1 -1
  182. package/dist/{with-guard-BD4Hyu8s.d.cts → with-guard-BHThLppa.d.cts} +1 -1
  183. package/dist/{with-guard-Du54s3Ti.d.ts → with-guard-BJwdc0s6.d.ts} +1 -1
  184. package/dist/{with-materialized-view-BCPPZdjC.d.cts → with-materialized-view-BJmJ-FrO.d.cts} +1 -1
  185. package/dist/{with-materialized-view-B5W4wFAC.d.ts → with-materialized-view-D-CRVSDX.d.ts} +1 -1
  186. package/dist/{with-overlayed-view-Cw-h9p9N.d.ts → with-overlayed-view-CNf6GbDG.d.ts} +1 -1
  187. package/dist/{with-overlayed-view-B8RrlLsG.d.cts → with-overlayed-view-zePNtUSq.d.cts} +1 -1
  188. package/package.json +13 -3
  189. package/dist/chunk-5OVIFUQE.js.map +0 -1
  190. package/dist/chunk-6HJ2ZALB.js.map +0 -1
  191. package/dist/chunk-7TX7HN42.js.map +0 -1
  192. package/dist/chunk-BT7544RM.js.map +0 -1
  193. package/dist/chunk-ICH4AIGL.js.map +0 -1
  194. package/dist/chunk-NONMIU6C.js +0 -118
  195. package/dist/chunk-NONMIU6C.js.map +0 -1
  196. package/dist/chunk-XDW37COG.js.map +0 -1
  197. package/dist/chunk-YZ6JETII.js.map +0 -1
  198. package/dist/executor-AWCHQ2KN.js +0 -8
  199. package/dist/executor-RWICJI7J.js +0 -11
  200. package/dist/executor-SOLEQVUB.js +0 -8
  201. package/dist/issue-IODMTPME.js +0 -12
  202. package/dist/noydb-6TADQIYH.js +0 -34
  203. package/dist/registry-446I2NMN.js +0 -8
  204. package/dist/registry-524KJZG4.js +0 -8
  205. /package/dist/{chunk-E225X5CQ.js.map → chunk-22ESLVUM.js.map} +0 -0
  206. /package/dist/{chunk-5QPF2MJ5.js.map → chunk-2TXMTYWZ.js.map} +0 -0
  207. /package/dist/{chunk-34XGYMQT.js.map → chunk-3XCXUJTM.js.map} +0 -0
  208. /package/dist/{chunk-KGFV72WK.js.map → chunk-4YVVF6JN.js.map} +0 -0
  209. /package/dist/{chunk-UGVDIOY7.js.map → chunk-6ILPGZXZ.js.map} +0 -0
  210. /package/dist/{chunk-DFCINPB5.js.map → chunk-6MXGU2PW.js.map} +0 -0
  211. /package/dist/{chunk-Y3P5DEMZ.js.map → chunk-7IH5FDXD.js.map} +0 -0
  212. /package/dist/{chunk-2GMRNNI3.js.map → chunk-ASFE2X62.js.map} +0 -0
  213. /package/dist/{chunk-CCC25PA7.js.map → chunk-BE5ZALMB.js.map} +0 -0
  214. /package/dist/{chunk-WEA4TDTJ.js.map → chunk-BNUCCUES.js.map} +0 -0
  215. /package/dist/{chunk-PS5G6A3Y.js.map → chunk-BRZFN354.js.map} +0 -0
  216. /package/dist/{chunk-RIHZBSWJ.js.map → chunk-CBHPW77B.js.map} +0 -0
  217. /package/dist/{chunk-LWFQYT4N.js.map → chunk-CSHY53CZ.js.map} +0 -0
  218. /package/dist/{chunk-MDIC4FAU.js.map → chunk-DCP4L4SH.js.map} +0 -0
  219. /package/dist/{chunk-TNBIWSQ7.js.map → chunk-GI6S5ZF2.js.map} +0 -0
  220. /package/dist/{chunk-G26QAQNI.js.map → chunk-GZIDTXC4.js.map} +0 -0
  221. /package/dist/{chunk-ARZAHCCF.js.map → chunk-HNC55FLJ.js.map} +0 -0
  222. /package/dist/{chunk-SGSHQ4PH.js.map → chunk-HNFXKQD7.js.map} +0 -0
  223. /package/dist/{chunk-YEHUEUNP.js.map → chunk-JZDA2SRB.js.map} +0 -0
  224. /package/dist/{chunk-PX3MJ6RB.js.map → chunk-KK44CQ5B.js.map} +0 -0
  225. /package/dist/{chunk-OPD3PZOG.js.map → chunk-LSY46G55.js.map} +0 -0
  226. /package/dist/{chunk-T6MTNGBM.js.map → chunk-N4CDTRDH.js.map} +0 -0
  227. /package/dist/{chunk-ZQMYB56Z.js.map → chunk-O3JCRQT3.js.map} +0 -0
  228. /package/dist/{chunk-LJO6Q3X6.js.map → chunk-OA6HE2RW.js.map} +0 -0
  229. /package/dist/{chunk-HIELMTUK.js.map → chunk-OIF6LZUR.js.map} +0 -0
  230. /package/dist/{chunk-YJ46RFCD.js.map → chunk-OXCFFRF3.js.map} +0 -0
  231. /package/dist/{chunk-ED3E3OLO.js.map → chunk-PJKGXUMG.js.map} +0 -0
  232. /package/dist/{chunk-6A4AMQ2H.js.map → chunk-QYO6I7KK.js.map} +0 -0
  233. /package/dist/{chunk-A4JNVBPF.js.map → chunk-SYOSRZN4.js.map} +0 -0
  234. /package/dist/{chunk-R4LTCI6O.js.map → chunk-TS4FQPDD.js.map} +0 -0
  235. /package/dist/{chunk-CKH247ZR.js.map → chunk-UPBZ7NVY.js.map} +0 -0
  236. /package/dist/{chunk-XVJFFGTG.js.map → chunk-VZOZ3DBN.js.map} +0 -0
  237. /package/dist/{chunk-5VMTAX4Y.js.map → chunk-W6EQLGMB.js.map} +0 -0
  238. /package/dist/{chunk-JSYTGEX4.js.map → chunk-WBUG3324.js.map} +0 -0
  239. /package/dist/{chunk-25WFLKOH.js.map → chunk-WM5GFORS.js.map} +0 -0
  240. /package/dist/{chunk-CGJFCT3X.js.map → chunk-WMKCAN4H.js.map} +0 -0
  241. /package/dist/{chunk-R7JTYCRX.js.map → chunk-XZCBBZLS.js.map} +0 -0
  242. /package/dist/{chunk-EKTOYEZ3.js.map → chunk-YAMTXW77.js.map} +0 -0
  243. /package/dist/{crypto-5UDZZL26.js.map → crypto-TRZ5BJMY.js.map} +0 -0
  244. /package/dist/{delegation-42LO4WFO.js.map → delegation-TLZTK2XW.js.map} +0 -0
  245. /package/dist/{executor-AWCHQ2KN.js.map → executor-HAVRTQN4.js.map} +0 -0
  246. /package/dist/{executor-RWICJI7J.js.map → executor-V3DKOADS.js.map} +0 -0
  247. /package/dist/{executor-SOLEQVUB.js.map → executor-XO4M4243.js.map} +0 -0
  248. /package/dist/{fanout-sidecar-EVICRM46.js.map → fanout-sidecar-OKPMMPLG.js.map} +0 -0
  249. /package/dist/{issue-IODMTPME.js.map → issue-EJKUQ6FA.js.map} +0 -0
  250. /package/dist/{ledger-UX4QIHWI.js.map → ledger-SQVVE2DR.js.map} +0 -0
  251. /package/dist/{noydb-6TADQIYH.js.map → noydb-MK4UQ626.js.map} +0 -0
  252. /package/dist/{public-envelope-YKHKP74C.js.map → public-envelope-BXPXMN3U.js.map} +0 -0
  253. /package/dist/{registry-446I2NMN.js.map → registry-4R4IURUM.js.map} +0 -0
  254. /package/dist/{registry-4NEW7LQY.js.map → registry-GPBLCHG7.js.map} +0 -0
  255. /package/dist/{registry-524KJZG4.js.map → registry-ZON5HNIV.js.map} +0 -0
  256. /package/dist/{revoke-R5NIQ74J.js.map → revoke-Y7UDOXGH.js.map} +0 -0
  257. /package/dist/{signer-WGDJNWSU.js.map → signer-UD2ZSVDJ.js.map} +0 -0
  258. /package/dist/{stale-74WGLVZ2.js.map → stale-F4V5E7ZK.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ var init_types = __esm({
46
46
  });
47
47
 
48
48
  // src/errors.ts
49
- var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, PeriodClosedError, RecordLockedError, FieldFrozenError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError;
49
+ var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, PeriodClosedError, RecordLockedError, FieldFrozenError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError;
50
50
  var init_errors = __esm({
51
51
  "src/errors.ts"() {
52
52
  "use strict";
@@ -646,6 +646,34 @@ Resolutions:
646
646
  this.side = opts.side;
647
647
  }
648
648
  };
649
+ CrossJoinTooLargeError = class extends NoydbError {
650
+ target;
651
+ expected;
652
+ limit;
653
+ constructor(opts) {
654
+ super(
655
+ "CROSS_JOIN_TOO_LARGE",
656
+ `crossJoin("${opts.target}"): would produce ${opts.expected} rows, exceeding the limit of ${opts.limit}. Narrow the left side with .where() first, or raise the ceiling with crossJoin("${opts.target}", { ..., maxRows: ${opts.expected} }).`
657
+ );
658
+ this.name = "CrossJoinTooLargeError";
659
+ this.target = opts.target;
660
+ this.expected = opts.expected;
661
+ this.limit = opts.limit;
662
+ }
663
+ };
664
+ CrossJoinSourceUnknownError = class extends NoydbError {
665
+ target;
666
+ leftCollection;
667
+ constructor(target, leftCollection) {
668
+ super(
669
+ "CROSS_JOIN_SOURCE_UNKNOWN",
670
+ `crossJoin("${target}"): collection "${target}" is not known in the vault (cross-joining from "${leftCollection}"). Make sure "${target}" is open in the same vault before executing this query.`
671
+ );
672
+ this.name = "CrossJoinSourceUnknownError";
673
+ this.target = target;
674
+ this.leftCollection = leftCollection;
675
+ }
676
+ };
649
677
  DanglingReferenceError = class extends NoydbError {
650
678
  field;
651
679
  target;
@@ -836,6 +864,17 @@ Resolutions:
836
864
  this.expected = expected;
837
865
  }
838
866
  };
867
+ SnapshotNotFoundError = class extends NoydbError {
868
+ version;
869
+ constructor(version) {
870
+ super(
871
+ "SNAPSHOT_NOT_FOUND",
872
+ `Snapshot not found: "${version}" does not exist in the snapshot store. It may have been pruned by the retention policy or deleted manually.`
873
+ );
874
+ this.name = "SnapshotNotFoundError";
875
+ this.version = version;
876
+ }
877
+ };
839
878
  }
840
879
  });
841
880
 
@@ -2231,6 +2270,10 @@ function evaluateClause(record, clause) {
2231
2270
  return clause.fn(record);
2232
2271
  case "wherePredicate":
2233
2272
  return clause.fn(record, clause.ctx);
2273
+ case "crossJoin":
2274
+ throw new Error(
2275
+ `evaluateClause: 'crossJoin' clauses are expansion primitives and are not evaluated per-record. This is a query planner routing error \u2014 crossJoin clauses must be extracted from the clause list before calling evaluateClause or filterRecords.`
2276
+ );
2234
2277
  case "group":
2235
2278
  if (clause.op === "and") {
2236
2279
  for (const child of clause.clauses) {
@@ -2800,6 +2843,11 @@ function analyzeDependencies(query) {
2800
2843
  for (const leg of plan.joins) {
2801
2844
  deps.add(leg.target);
2802
2845
  }
2846
+ for (const clause of plan.clauses) {
2847
+ if (clause.type === "crossJoin") {
2848
+ deps.add(clause.target);
2849
+ }
2850
+ }
2803
2851
  walkClausesForJoins(plan, deps, ctx);
2804
2852
  return deps;
2805
2853
  }
@@ -2815,7 +2863,19 @@ function summarizeQueryPlan(query) {
2815
2863
  const ctx = query._joinContext();
2816
2864
  return JSON.stringify({
2817
2865
  root: ctx?.leftCollection ?? null,
2818
- clauses: plan.clauses,
2866
+ clauses: plan.clauses.map((c) => {
2867
+ if (c.type === "crossJoin") {
2868
+ return {
2869
+ type: "crossJoin",
2870
+ target: c.target,
2871
+ as: c.as,
2872
+ // Inline on: callback: use sentinel — drift detection disabled for this MV
2873
+ onPredicateName: c.onPredicateName ?? (c.on ? "[inline]" : null),
2874
+ maxRows: c.maxRows ?? null
2875
+ };
2876
+ }
2877
+ return c;
2878
+ }),
2819
2879
  orderBy: plan.orderBy,
2820
2880
  limit: plan.limit ?? null,
2821
2881
  offset: plan.offset,
@@ -3942,7 +4002,10 @@ __export(src_exports, {
3942
4002
  CollectionIndexes: () => CollectionIndexes,
3943
4003
  CollectionInstant: () => CollectionInstant,
3944
4004
  ConflictError: () => ConflictError,
4005
+ CrossJoinSourceUnknownError: () => CrossJoinSourceUnknownError,
4006
+ CrossJoinTooLargeError: () => CrossJoinTooLargeError,
3945
4007
  DEFAULT_CHUNK_SIZE: () => DEFAULT_CHUNK_SIZE,
4008
+ DEFAULT_CROSS_JOIN_MAX_ROWS: () => DEFAULT_CROSS_JOIN_MAX_ROWS,
3946
4009
  DEFAULT_FRESHNESS_MS: () => DEFAULT_FRESHNESS_MS,
3947
4010
  DEFAULT_JOIN_MAX_ROWS: () => DEFAULT_JOIN_MAX_ROWS,
3948
4011
  DEFAULT_PUBLIC_ENVELOPE_SCHEMA: () => DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
@@ -4055,6 +4118,7 @@ __export(src_exports, {
4055
4118
  SessionExpiredError: () => SessionExpiredError,
4056
4119
  SessionNotFoundError: () => SessionNotFoundError,
4057
4120
  SessionPolicyError: () => SessionPolicyError,
4121
+ SnapshotNotFoundError: () => SnapshotNotFoundError,
4058
4122
  StoreCapabilityError: () => StoreCapabilityError,
4059
4123
  SyncEngine: () => SyncEngine,
4060
4124
  SyncScheduler: () => SyncScheduler,
@@ -6223,6 +6287,7 @@ function withHealthCheck(opts = {}) {
6223
6287
 
6224
6288
  // src/index.ts
6225
6289
  init_errors();
6290
+ init_errors();
6226
6291
 
6227
6292
  // src/bundle/format.ts
6228
6293
  var NOYDB_BUNDLE_MAGIC = new Uint8Array([78, 68, 66, 49]);
@@ -9677,6 +9742,173 @@ var NO_CRDT = {
9677
9742
  }
9678
9743
  };
9679
9744
 
9745
+ // src/i18n/core.ts
9746
+ init_errors();
9747
+ function i18nText(options) {
9748
+ return { _noydbI18nText: true, options };
9749
+ }
9750
+ function isI18nTextDescriptor(x) {
9751
+ return typeof x === "object" && x !== null && x._noydbI18nText === true;
9752
+ }
9753
+ function validateI18nTextValue(value, field, descriptor) {
9754
+ const { options } = descriptor;
9755
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
9756
+ throw new MissingTranslationError(
9757
+ field,
9758
+ options.languages,
9759
+ `Field "${field}" must be a { [locale]: string } map, got ${typeof value}.`
9760
+ );
9761
+ }
9762
+ const map = value;
9763
+ for (const [locale, v] of Object.entries(map)) {
9764
+ if (typeof v !== "string") {
9765
+ throw new MissingTranslationError(
9766
+ field,
9767
+ [locale],
9768
+ `Field "${field}": locale "${locale}" must be a string, got ${typeof v}.`
9769
+ );
9770
+ }
9771
+ }
9772
+ const { required } = options;
9773
+ if (required === "all") {
9774
+ const missing = options.languages.filter(
9775
+ (lang) => !(lang in map) || map[lang] === ""
9776
+ );
9777
+ if (missing.length > 0) {
9778
+ throw new MissingTranslationError(
9779
+ field,
9780
+ missing,
9781
+ `Field "${field}" requires all declared languages. Missing: ${missing.join(", ")}.`
9782
+ );
9783
+ }
9784
+ } else if (required === "any") {
9785
+ const present = options.languages.some(
9786
+ (lang) => lang in map && map[lang] !== ""
9787
+ );
9788
+ if (!present) {
9789
+ throw new MissingTranslationError(
9790
+ field,
9791
+ options.languages,
9792
+ `Field "${field}" requires at least one declared language. None present.`
9793
+ );
9794
+ }
9795
+ } else {
9796
+ const requiredList = required;
9797
+ const missing = requiredList.filter(
9798
+ (lang) => !(lang in map) || map[lang] === ""
9799
+ );
9800
+ if (missing.length > 0) {
9801
+ throw new MissingTranslationError(
9802
+ field,
9803
+ missing,
9804
+ `Field "${field}" requires: ${requiredList.join(", ")}. Missing: ${missing.join(", ")}.`
9805
+ );
9806
+ }
9807
+ }
9808
+ }
9809
+ function resolveI18nText(value, locale, fallback, field) {
9810
+ if (locale === "raw") {
9811
+ return value;
9812
+ }
9813
+ if (!locale) {
9814
+ throw new LocaleNotSpecifiedError(field ?? "<unknown>");
9815
+ }
9816
+ if (value[locale] !== void 0 && value[locale] !== "") {
9817
+ return value[locale];
9818
+ }
9819
+ const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
9820
+ for (const fb of chain) {
9821
+ if (fb === "any") {
9822
+ const any = Object.values(value).find((v) => v !== "");
9823
+ if (any !== void 0) return any;
9824
+ } else if (value[fb] !== void 0 && value[fb] !== "") {
9825
+ return value[fb];
9826
+ }
9827
+ }
9828
+ throw new LocaleNotSpecifiedError(
9829
+ field ?? "<unknown>",
9830
+ `No translation available for locale "${locale}"` + (chain.length > 0 ? ` or fallback chain [${chain.join(", ")}]` : "") + "."
9831
+ );
9832
+ }
9833
+ function getAtPath(obj, path) {
9834
+ const arrayIdx = path.indexOf("[].");
9835
+ if (arrayIdx !== -1) {
9836
+ const arrayKey = path.slice(0, arrayIdx);
9837
+ const restPath = path.slice(arrayIdx + 3);
9838
+ const arr = obj[arrayKey];
9839
+ if (!Array.isArray(arr)) return [];
9840
+ return arr.flatMap((item) => {
9841
+ if (!item || typeof item !== "object" || Array.isArray(item)) return [];
9842
+ return getAtPath(item, restPath);
9843
+ });
9844
+ }
9845
+ const dotIdx = path.indexOf(".");
9846
+ if (dotIdx !== -1) {
9847
+ const head = path.slice(0, dotIdx);
9848
+ const rest = path.slice(dotIdx + 1);
9849
+ const nested = obj[head];
9850
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return [];
9851
+ return getAtPath(nested, rest);
9852
+ }
9853
+ const val = obj[path];
9854
+ return val !== void 0 ? [val] : [];
9855
+ }
9856
+ function setAtPathInPlace(obj, path, value) {
9857
+ const dotIdx = path.indexOf(".");
9858
+ if (dotIdx !== -1) {
9859
+ const head = path.slice(0, dotIdx);
9860
+ const rest = path.slice(dotIdx + 1);
9861
+ const nested = obj[head];
9862
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return;
9863
+ setAtPathInPlace(nested, rest, value);
9864
+ return;
9865
+ }
9866
+ obj[path] = value;
9867
+ }
9868
+ function applyAtPath(obj, path, locale, fallback) {
9869
+ const arrayIdx = path.indexOf("[].");
9870
+ if (arrayIdx !== -1) {
9871
+ const arrayKey = path.slice(0, arrayIdx);
9872
+ const restPath = path.slice(arrayIdx + 3);
9873
+ const arr = obj[arrayKey];
9874
+ if (!Array.isArray(arr)) return obj;
9875
+ return {
9876
+ ...obj,
9877
+ [arrayKey]: arr.map((item) => {
9878
+ if (!item || typeof item !== "object" || Array.isArray(item)) return item;
9879
+ return applyAtPath(item, restPath, locale, fallback);
9880
+ })
9881
+ };
9882
+ }
9883
+ const dotIdx = path.indexOf(".");
9884
+ if (dotIdx !== -1) {
9885
+ const head = path.slice(0, dotIdx);
9886
+ const rest = path.slice(dotIdx + 1);
9887
+ const nested = obj[head];
9888
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
9889
+ return {
9890
+ ...obj,
9891
+ [head]: applyAtPath(nested, rest, locale, fallback)
9892
+ };
9893
+ }
9894
+ const raw = obj[path];
9895
+ if (raw === void 0 || raw === null) return obj;
9896
+ if (typeof raw !== "object" || Array.isArray(raw)) return obj;
9897
+ return {
9898
+ ...obj,
9899
+ [path]: resolveI18nText(raw, locale, fallback, path)
9900
+ };
9901
+ }
9902
+ function applyI18nLocale(record, i18nFields, locale, fallback) {
9903
+ const fieldNames = Object.keys(i18nFields);
9904
+ if (fieldNames.length === 0) return record;
9905
+ let result = record;
9906
+ for (const field of fieldNames) {
9907
+ result = applyAtPath(result, field, locale, fallback);
9908
+ }
9909
+ return result;
9910
+ }
9911
+
9680
9912
  // src/i18n/strategy.ts
9681
9913
  function notEnabled(op) {
9682
9914
  return new Error(
@@ -9898,6 +10130,9 @@ function resetJoinWarnings() {
9898
10130
  warnedCeilingKeys.clear();
9899
10131
  }
9900
10132
 
10133
+ // src/query/builder.ts
10134
+ init_errors();
10135
+
9901
10136
  // src/query/live.ts
9902
10137
  function buildLiveQuery(recompute, upstreams) {
9903
10138
  return new LiveQueryImpl(recompute, upstreams);
@@ -9996,6 +10231,7 @@ var EMPTY_PLAN = {
9996
10231
  offset: 0,
9997
10232
  joins: []
9998
10233
  };
10234
+ var DEFAULT_CROSS_JOIN_MAX_ROWS = 5e4;
9999
10235
  var Query = class _Query {
10000
10236
  source;
10001
10237
  plan;
@@ -10277,6 +10513,78 @@ var Query = class _Query {
10277
10513
  this.predicates
10278
10514
  );
10279
10515
  }
10516
+ /**
10517
+ * Cartesian-product cross-join against `target` collection. Each result row
10518
+ * carries the original `T` fields plus `result[as]` populated from every
10519
+ * right-side row (or the filtered subset when `on:` is supplied).
10520
+ *
10521
+ * **Order matters:** `.where().crossJoin()` filters BEFORE expanding (cheaper);
10522
+ * `.crossJoin().where('alias.field', ...)` filters AFTER (required when the
10523
+ * where clause references the aliased fields).
10524
+ *
10525
+ * **Cost ceiling:** `CrossJoinTooLargeError` fires before allocation when
10526
+ * `leftRows × rightRows` (or the cumulative lateral count) exceeds the limit.
10527
+ * Default: 50,000 rows. Override per-clause with `{ maxRows: N }`.
10528
+ *
10529
+ * **`on:` shapes:**
10530
+ * - `on: (left) => TTarget[]` — subset form (most efficient)
10531
+ * - `on: (left) => (right) => boolean` — predicate form
10532
+ * - `on: { predicate: 'name' }` — MV-safe, hash-tracked form
10533
+ * (requires the Query to have been augmented via `_withPredicates`)
10534
+ *
10535
+ * Requires a JoinContext (constructed via `collection.query()`).
10536
+ */
10537
+ crossJoin(target, opts) {
10538
+ if (!this.joinContext) {
10539
+ throw new Error(
10540
+ `Query.crossJoin("${target}"): requires a join context. Use collection.query() to construct a cross-join-capable Query instead of the Query constructor directly.`
10541
+ );
10542
+ }
10543
+ let onFn;
10544
+ let onPredicateName;
10545
+ if (opts.on !== void 0) {
10546
+ if (typeof opts.on === "function") {
10547
+ onFn = opts.on;
10548
+ if (this.predicates) {
10549
+ console.warn(
10550
+ `Query.crossJoin("${target}", { on: callback }): inline on: callback inside a withMaterializedView query() disables queryHash drift detection for this cross-join. Use on: { predicate: '<name>' } to enable it.`
10551
+ );
10552
+ }
10553
+ } else {
10554
+ const predName = opts.on.predicate;
10555
+ if (!this.predicates) {
10556
+ throw new Error(
10557
+ `Query.crossJoin("${target}", { on: { predicate: "${predName}" } }): the { predicate } form requires a predicates map. Use this form inside a withMaterializedView query() callback that declares predicates: { ${predName}: { hash, fn } }.`
10558
+ );
10559
+ }
10560
+ const decl = this.predicates.get(predName);
10561
+ if (!decl) {
10562
+ throw new Error(
10563
+ `Query.crossJoin("${target}"): predicate "${predName}" not registered. Available: ${[...this.predicates.keys()].join(", ") || "(none)"}.`
10564
+ );
10565
+ }
10566
+ const as = opts.as;
10567
+ const predicateFn = decl.fn;
10568
+ onFn = (_left) => (right) => predicateFn({ ..._left, [as]: right });
10569
+ onPredicateName = predName;
10570
+ }
10571
+ }
10572
+ const clause = {
10573
+ type: "crossJoin",
10574
+ target,
10575
+ as: opts.as,
10576
+ ...onFn !== void 0 && { on: onFn },
10577
+ ...onPredicateName !== void 0 && { onPredicateName },
10578
+ ...opts.maxRows !== void 0 && { maxRows: opts.maxRows }
10579
+ };
10580
+ return new _Query(
10581
+ this.source,
10582
+ { ...this.plan, clauses: [...this.plan.clauses, clause] },
10583
+ this.joinContext,
10584
+ this.aggregateStrategy,
10585
+ this.predicates
10586
+ );
10587
+ }
10280
10588
  /**
10281
10589
  * Execute the plan and return the matching records. When the plan
10282
10590
  * carries any join legs, they are applied after `where` / `orderBy`
@@ -10284,7 +10592,7 @@ var Query = class _Query {
10284
10592
  * for the ordering rationale.
10285
10593
  */
10286
10594
  toArray() {
10287
- const base = executePlanWithSource(this.source, this.plan);
10595
+ const base = executePlanWithSource(this.source, this.plan, this.joinContext);
10288
10596
  if (this.plan.joins.length === 0) return base;
10289
10597
  if (!this.joinContext) {
10290
10598
  throw new Error(
@@ -10308,6 +10616,14 @@ var Query = class _Query {
10308
10616
  * intent is purely to count.
10309
10617
  */
10310
10618
  count() {
10619
+ if (this.plan.clauses.some((c) => c.type === "crossJoin")) {
10620
+ if (!this.joinContext) {
10621
+ throw new Error(
10622
+ `Query.count(): plan contains crossJoin clauses but no JoinContext is attached.`
10623
+ );
10624
+ }
10625
+ return executeClausePipeline(this.source, this.plan.clauses, this.joinContext).length;
10626
+ }
10311
10627
  const { candidates, remainingClauses } = candidateRecords(this.source, this.plan.clauses);
10312
10628
  if (remainingClauses.length === 0) return candidates.length;
10313
10629
  return filterRecords(candidates, remainingClauses).length;
@@ -10355,7 +10671,13 @@ var Query = class _Query {
10355
10671
  aggregate(spec) {
10356
10672
  const source = this.source;
10357
10673
  const clauses = this.plan.clauses;
10674
+ const joinCtx = this.joinContext;
10675
+ const hasCrossJoins = clauses.some((c) => c.type === "crossJoin");
10358
10676
  const executeRecords = () => {
10677
+ if (hasCrossJoins) {
10678
+ if (!joinCtx) throw new Error("Query.aggregate(): crossJoin requires a join context");
10679
+ return executeClausePipeline(source, clauses, joinCtx);
10680
+ }
10359
10681
  const { candidates, remainingClauses } = candidateRecords(source, clauses);
10360
10682
  return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
10361
10683
  };
@@ -10372,7 +10694,13 @@ var Query = class _Query {
10372
10694
  }
10373
10695
  const source = this.source;
10374
10696
  const clauses = this.plan.clauses;
10697
+ const joinCtx = this.joinContext;
10698
+ const hasCrossJoins = clauses.some((c) => c.type === "crossJoin");
10375
10699
  const executeRecords = () => {
10700
+ if (hasCrossJoins) {
10701
+ if (!joinCtx) throw new Error("Query.groupBy(): crossJoin requires a join context");
10702
+ return executeClausePipeline(source, clauses, joinCtx);
10703
+ }
10376
10704
  const { candidates, remainingClauses } = candidateRecords(source, clauses);
10377
10705
  return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
10378
10706
  };
@@ -10486,6 +10814,21 @@ var Query = class _Query {
10486
10814
  }
10487
10815
  }
10488
10816
  }
10817
+ if (this.joinContext) {
10818
+ const subscribedCross = /* @__PURE__ */ new Set();
10819
+ for (const clause of this.plan.clauses) {
10820
+ if (clause.type !== "crossJoin") continue;
10821
+ if (subscribedCross.has(clause.target)) continue;
10822
+ subscribedCross.add(clause.target);
10823
+ const rightSource = this.joinContext.resolveSource(clause.target);
10824
+ if (rightSource?.subscribe) {
10825
+ const rightSubscribe = rightSource.subscribe.bind(rightSource);
10826
+ upstreams.push({
10827
+ subscribe: (cb) => rightSubscribe(cb)
10828
+ });
10829
+ }
10830
+ }
10831
+ }
10489
10832
  return buildLiveQuery(() => this.toArray(), upstreams);
10490
10833
  }
10491
10834
  /**
@@ -10497,9 +10840,20 @@ var Query = class _Query {
10497
10840
  return serializePlan(this.plan);
10498
10841
  }
10499
10842
  };
10500
- function executePlanWithSource(source, plan) {
10501
- const { candidates, remainingClauses } = candidateRecords(source, plan.clauses);
10502
- let result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses);
10843
+ function executePlanWithSource(source, plan, joinContext) {
10844
+ const hasCrossJoins = plan.clauses.some((c) => c.type === "crossJoin");
10845
+ let result;
10846
+ if (hasCrossJoins) {
10847
+ if (!joinContext) {
10848
+ throw new Error(
10849
+ `Query.toArray(): plan contains crossJoin clauses but no JoinContext is attached. Use collection.query() instead of new Query() for cross-join support.`
10850
+ );
10851
+ }
10852
+ result = executeClausePipeline(source, plan.clauses, joinContext);
10853
+ } else {
10854
+ const { candidates, remainingClauses } = candidateRecords(source, plan.clauses);
10855
+ result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses);
10856
+ }
10503
10857
  if (plan.orderBy.length > 0) {
10504
10858
  result = sortRecords(result, plan.orderBy);
10505
10859
  }
@@ -10549,6 +10903,11 @@ function materializeIds(ids, lookupById) {
10549
10903
  return out;
10550
10904
  }
10551
10905
  function executePlan(records, plan) {
10906
+ if (plan.clauses.some((c) => c.type === "crossJoin")) {
10907
+ throw new Error(
10908
+ `executePlan(): does not support crossJoin clauses. executePlan is a stateless pure function \u2014 it cannot resolve cross-join right-side collections. Use Query.toArray() (via collection.query()) instead.`
10909
+ );
10910
+ }
10552
10911
  let result = filterRecords(records, plan.clauses);
10553
10912
  if (plan.orderBy.length > 0) {
10554
10913
  result = sortRecords(result, plan.orderBy);
@@ -10576,6 +10935,74 @@ function filterRecords(records, clauses) {
10576
10935
  }
10577
10936
  return out;
10578
10937
  }
10938
+ function executeClausePipeline(source, clauses, joinContext) {
10939
+ let rel = [...source.snapshot()];
10940
+ let filterBatch = [];
10941
+ for (const clause of clauses) {
10942
+ if (clause.type === "crossJoin") {
10943
+ if (filterBatch.length > 0) {
10944
+ rel = filterRecords(rel, filterBatch);
10945
+ filterBatch = [];
10946
+ }
10947
+ const rightSource = joinContext.resolveSource(clause.target);
10948
+ if (!rightSource) {
10949
+ throw new CrossJoinSourceUnknownError(clause.target, joinContext.leftCollection);
10950
+ }
10951
+ rel = applyCrossJoin(rel, clause, rightSource);
10952
+ } else {
10953
+ filterBatch.push(clause);
10954
+ }
10955
+ }
10956
+ if (filterBatch.length > 0) {
10957
+ rel = filterRecords(rel, filterBatch);
10958
+ }
10959
+ return rel;
10960
+ }
10961
+ function applyCrossJoin(leftRel, clause, rightSource) {
10962
+ const rightRows = rightSource.snapshot();
10963
+ const maxRows = clause.maxRows ?? DEFAULT_CROSS_JOIN_MAX_ROWS;
10964
+ const { as } = clause;
10965
+ if (!clause.on) {
10966
+ const product = leftRel.length * rightRows.length;
10967
+ if (product > maxRows) {
10968
+ throw new CrossJoinTooLargeError({ target: clause.target, expected: product, limit: maxRows });
10969
+ }
10970
+ const expanded2 = [];
10971
+ for (const left of leftRel) {
10972
+ const leftObj = left;
10973
+ for (const right of rightRows) {
10974
+ expanded2.push({ ...leftObj, [as]: right });
10975
+ }
10976
+ }
10977
+ return expanded2;
10978
+ }
10979
+ const expanded = [];
10980
+ let cumulative = 0;
10981
+ for (const left of leftRel) {
10982
+ const callbackResult = clause.on(left);
10983
+ let filteredRight;
10984
+ if (Array.isArray(callbackResult)) {
10985
+ filteredRight = callbackResult;
10986
+ } else {
10987
+ filteredRight = rightRows.filter(
10988
+ callbackResult
10989
+ );
10990
+ }
10991
+ cumulative += filteredRight.length;
10992
+ if (cumulative > maxRows) {
10993
+ throw new CrossJoinTooLargeError({
10994
+ target: clause.target,
10995
+ expected: cumulative,
10996
+ limit: maxRows
10997
+ });
10998
+ }
10999
+ const leftObj = left;
11000
+ for (const right of filteredRight) {
11001
+ expanded.push({ ...leftObj, [as]: right });
11002
+ }
11003
+ }
11004
+ return expanded;
11005
+ }
10579
11006
  function sortRecords(records, orderBy) {
10580
11007
  return [...records].sort((a, b) => {
10581
11008
  for (const { field, direction } of orderBy) {
@@ -10638,6 +11065,16 @@ function serializeClause(clause) {
10638
11065
  clauses: clause.clauses.map(serializeClause)
10639
11066
  };
10640
11067
  }
11068
+ if (clause.type === "crossJoin") {
11069
+ return {
11070
+ type: "crossJoin",
11071
+ target: clause.target,
11072
+ as: clause.as,
11073
+ on: clause.on ? "[function]" : void 0,
11074
+ onPredicateName: clause.onPredicateName,
11075
+ maxRows: clause.maxRows
11076
+ };
11077
+ }
10641
11078
  return clause;
10642
11079
  }
10643
11080
  function canonicalCtxHash(ctx) {
@@ -12645,7 +13082,9 @@ var Collection = class {
12645
13082
  const obj = record;
12646
13083
  for (const [field, descriptor] of Object.entries(this.i18nFields)) {
12647
13084
  if (!descriptor.options.autoTranslate) continue;
12648
- const value = obj[field];
13085
+ const leafValues = getAtPath(obj, field);
13086
+ if (leafValues.length !== 1) continue;
13087
+ const value = leafValues[0];
12649
13088
  if (!value || typeof value !== "object" || Array.isArray(value)) continue;
12650
13089
  const map = value;
12651
13090
  const { languages, required } = descriptor.options;
@@ -12669,8 +13108,7 @@ var Collection = class {
12669
13108
  this.name
12670
13109
  );
12671
13110
  }
12672
- ;
12673
- record[field] = translated;
13111
+ setAtPathInPlace(obj, field, translated);
12674
13112
  }
12675
13113
  }
12676
13114
  if (this.i18nPutValidator !== void 0) {
@@ -16736,9 +17174,11 @@ var Vault = class {
16736
17174
  if (!record || typeof record !== "object") return;
16737
17175
  const obj = record;
16738
17176
  for (const [field, descriptor] of Object.entries(i18nFields)) {
16739
- const value = obj[field];
16740
- if (value === void 0 || value === null) continue;
16741
- this.i18nStrategy.validateI18nTextValue(value, field, descriptor);
17177
+ const values = getAtPath(obj, field);
17178
+ for (const value of values) {
17179
+ if (value === void 0 || value === null) continue;
17180
+ this.i18nStrategy.validateI18nTextValue(value, field, descriptor);
17181
+ }
16742
17182
  }
16743
17183
  }
16744
17184
  /**
@@ -19294,16 +19734,32 @@ function isTabWriteMsg(x) {
19294
19734
  return o["kind"] === "tab-write" && typeof o["writerId"] === "string" && typeof o["vault"] === "string" && typeof o["collection"] === "string" && typeof o["docId"] === "string" && (o["action"] === "put" || o["action"] === "delete") && typeof o["baseV"] === "number" && typeof o["v"] === "number";
19295
19735
  }
19296
19736
 
19297
- // src/tx/strategy.ts
19737
+ // src/snapshots/strategy.ts
19298
19738
  var NOT_ENABLED5 = new Error(
19739
+ 'Snapshots require the snapshot strategy. Import `{ withSnapshots }` from "@noy-db/hub/snapshots" and pass it to `createNoydb({ snapshotStrategy: withSnapshots({ store }) })`.'
19740
+ );
19741
+ var NO_SNAPSHOTS = {
19742
+ async snapshot() {
19743
+ throw NOT_ENABLED5;
19744
+ },
19745
+ async listSnapshots() {
19746
+ throw NOT_ENABLED5;
19747
+ },
19748
+ async restoreSnapshot() {
19749
+ throw NOT_ENABLED5;
19750
+ }
19751
+ };
19752
+
19753
+ // src/tx/strategy.ts
19754
+ var NOT_ENABLED6 = new Error(
19299
19755
  'Multi-record transactions require the tx strategy. Import `{ withTransactions }` from "@noy-db/hub/tx" and pass it to `createNoydb({ txStrategy: withTransactions() })`.'
19300
19756
  );
19301
19757
  var NO_TX = {
19302
19758
  async runTransaction() {
19303
- throw NOT_ENABLED5;
19759
+ throw NOT_ENABLED6;
19304
19760
  },
19305
19761
  async runDryRun() {
19306
- throw NOT_ENABLED5;
19762
+ throw NOT_ENABLED6;
19307
19763
  }
19308
19764
  };
19309
19765
 
@@ -19646,6 +20102,7 @@ var Noydb = class {
19646
20102
  txStrategy;
19647
20103
  sessionStrategy;
19648
20104
  syncStrategy;
20105
+ snapshotStrategy;
19649
20106
  /**
19650
20107
  * Currently-running multi-record transaction, set by
19651
20108
  * `runTransaction` at the start of Phase 2 (commit) and cleared in
@@ -19670,6 +20127,7 @@ var Noydb = class {
19670
20127
  this.txStrategy = options.txStrategy ?? NO_TX;
19671
20128
  this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
19672
20129
  this.syncStrategy = options.syncStrategy ?? NO_SYNC;
20130
+ this.snapshotStrategy = options.snapshotStrategy ?? NO_SNAPSHOTS;
19673
20131
  this.publicEnvelopeSchema = resolveSchema(options.publicEnvelope);
19674
20132
  if (options.sessionPolicy) {
19675
20133
  this.sessionStrategy.validateSessionPolicy(options.sessionPolicy);
@@ -21656,6 +22114,45 @@ var Noydb = class {
21656
22114
  this.keyringCache.set(vault, keyring);
21657
22115
  return keyring;
21658
22116
  }
22117
+ /**
22118
+ * Take an on-demand checkpoint of the given vault.
22119
+ * Requires `snapshotStrategy: withSnapshots({ store })` in `createNoydb`.
22120
+ * @throws ValidationError when the vault is not open
22121
+ */
22122
+ async snapshot(vault, opts) {
22123
+ if (this.closed) throw new ValidationError("Instance is closed");
22124
+ const v = this.vaultCache.get(vault);
22125
+ if (!v) {
22126
+ throw new ValidationError(
22127
+ `Vault "${vault}" is not open. Call openVault() first.`
22128
+ );
22129
+ }
22130
+ return this.snapshotStrategy.snapshot(v, this.options.user, opts);
22131
+ }
22132
+ /**
22133
+ * List all snapshots for the given vault, newest first.
22134
+ * Reads only the sidecar index — does not download snapshot bytes.
22135
+ */
22136
+ async listSnapshots(vault) {
22137
+ if (this.closed) throw new ValidationError("Instance is closed");
22138
+ return this.snapshotStrategy.listSnapshots(vault);
22139
+ }
22140
+ /**
22141
+ * Restore the vault to a previously snapshotted state.
22142
+ * Runs `verifyBackupIntegrity()` automatically on restore.
22143
+ * @throws SnapshotNotFoundError when `version` doesn't exist in the store
22144
+ * @throws ValidationError when the vault is not open
22145
+ */
22146
+ async restoreSnapshot(vault, version) {
22147
+ if (this.closed) throw new ValidationError("Instance is closed");
22148
+ const v = this.vaultCache.get(vault);
22149
+ if (!v) {
22150
+ throw new ValidationError(
22151
+ `Vault "${vault}" is not open. Call openVault() first.`
22152
+ );
22153
+ }
22154
+ return this.snapshotStrategy.restoreSnapshot(v, version);
22155
+ }
21659
22156
  };
21660
22157
  async function createNoydb(options) {
21661
22158
  const encrypted = options.encrypt !== false;
@@ -22622,114 +23119,6 @@ function withOverlayedView(spec) {
22622
23119
  // src/index.ts
22623
23120
  init_errors();
22624
23121
  init_errors();
22625
-
22626
- // src/i18n/core.ts
22627
- init_errors();
22628
- function i18nText(options) {
22629
- return { _noydbI18nText: true, options };
22630
- }
22631
- function isI18nTextDescriptor(x) {
22632
- return typeof x === "object" && x !== null && x._noydbI18nText === true;
22633
- }
22634
- function validateI18nTextValue(value, field, descriptor) {
22635
- const { options } = descriptor;
22636
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
22637
- throw new MissingTranslationError(
22638
- field,
22639
- options.languages,
22640
- `Field "${field}" must be a { [locale]: string } map, got ${typeof value}.`
22641
- );
22642
- }
22643
- const map = value;
22644
- for (const [locale, v] of Object.entries(map)) {
22645
- if (typeof v !== "string") {
22646
- throw new MissingTranslationError(
22647
- field,
22648
- [locale],
22649
- `Field "${field}": locale "${locale}" must be a string, got ${typeof v}.`
22650
- );
22651
- }
22652
- }
22653
- const { required } = options;
22654
- if (required === "all") {
22655
- const missing = options.languages.filter(
22656
- (lang) => !(lang in map) || map[lang] === ""
22657
- );
22658
- if (missing.length > 0) {
22659
- throw new MissingTranslationError(
22660
- field,
22661
- missing,
22662
- `Field "${field}" requires all declared languages. Missing: ${missing.join(", ")}.`
22663
- );
22664
- }
22665
- } else if (required === "any") {
22666
- const present = options.languages.some(
22667
- (lang) => lang in map && map[lang] !== ""
22668
- );
22669
- if (!present) {
22670
- throw new MissingTranslationError(
22671
- field,
22672
- options.languages,
22673
- `Field "${field}" requires at least one declared language. None present.`
22674
- );
22675
- }
22676
- } else {
22677
- const requiredList = required;
22678
- const missing = requiredList.filter(
22679
- (lang) => !(lang in map) || map[lang] === ""
22680
- );
22681
- if (missing.length > 0) {
22682
- throw new MissingTranslationError(
22683
- field,
22684
- missing,
22685
- `Field "${field}" requires: ${requiredList.join(", ")}. Missing: ${missing.join(", ")}.`
22686
- );
22687
- }
22688
- }
22689
- }
22690
- function resolveI18nText(value, locale, fallback, field) {
22691
- if (locale === "raw") {
22692
- return value;
22693
- }
22694
- if (!locale) {
22695
- throw new LocaleNotSpecifiedError(field ?? "<unknown>");
22696
- }
22697
- if (value[locale] !== void 0 && value[locale] !== "") {
22698
- return value[locale];
22699
- }
22700
- const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
22701
- for (const fb of chain) {
22702
- if (fb === "any") {
22703
- const any = Object.values(value).find((v) => v !== "");
22704
- if (any !== void 0) return any;
22705
- } else if (value[fb] !== void 0 && value[fb] !== "") {
22706
- return value[fb];
22707
- }
22708
- }
22709
- throw new LocaleNotSpecifiedError(
22710
- field ?? "<unknown>",
22711
- `No translation available for locale "${locale}"` + (chain.length > 0 ? ` or fallback chain [${chain.join(", ")}]` : "") + "."
22712
- );
22713
- }
22714
- function applyI18nLocale(record, i18nFields, locale, fallback) {
22715
- const fieldNames = Object.keys(i18nFields);
22716
- if (fieldNames.length === 0) return record;
22717
- const result = { ...record };
22718
- for (const field of fieldNames) {
22719
- const raw = result[field];
22720
- if (raw === void 0 || raw === null) continue;
22721
- if (typeof raw !== "object" || Array.isArray(raw)) continue;
22722
- result[field] = resolveI18nText(
22723
- raw,
22724
- locale,
22725
- fallback,
22726
- field
22727
- );
22728
- }
22729
- return result;
22730
- }
22731
-
22732
- // src/index.ts
22733
23122
  init_errors();
22734
23123
 
22735
23124
  // src/team/sync-credentials.ts
@@ -23378,7 +23767,10 @@ function shortJSON(value) {
23378
23767
  CollectionIndexes,
23379
23768
  CollectionInstant,
23380
23769
  ConflictError,
23770
+ CrossJoinSourceUnknownError,
23771
+ CrossJoinTooLargeError,
23381
23772
  DEFAULT_CHUNK_SIZE,
23773
+ DEFAULT_CROSS_JOIN_MAX_ROWS,
23382
23774
  DEFAULT_FRESHNESS_MS,
23383
23775
  DEFAULT_JOIN_MAX_ROWS,
23384
23776
  DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
@@ -23491,6 +23883,7 @@ function shortJSON(value) {
23491
23883
  SessionExpiredError,
23492
23884
  SessionNotFoundError,
23493
23885
  SessionPolicyError,
23886
+ SnapshotNotFoundError,
23494
23887
  StoreCapabilityError,
23495
23888
  SyncEngine,
23496
23889
  SyncScheduler,