@noy-db/hub 0.2.0-pre.1 → 0.2.0-pre.11

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 (306) hide show
  1. package/dist/aggregate/index.cjs +9 -0
  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 +4 -4
  6. package/dist/attestation/index.cjs +305 -0
  7. package/dist/attestation/index.cjs.map +1 -0
  8. package/dist/attestation/index.d.cts +52 -0
  9. package/dist/attestation/index.d.ts +52 -0
  10. package/dist/attestation/index.js +36 -0
  11. package/dist/attestation/index.js.map +1 -0
  12. package/dist/blobs/index.cjs.map +1 -1
  13. package/dist/blobs/index.d.cts +7 -6
  14. package/dist/blobs/index.d.ts +7 -6
  15. package/dist/blobs/index.js +10 -8
  16. package/dist/blobs/index.js.map +1 -1
  17. package/dist/bundle/index.cjs +18912 -129
  18. package/dist/bundle/index.cjs.map +1 -1
  19. package/dist/bundle/index.d.cts +175 -6
  20. package/dist/bundle/index.d.ts +175 -6
  21. package/dist/bundle/index.js +533 -5
  22. package/dist/bundle/index.js.map +1 -1
  23. package/dist/{chunk-6HPZY4ON.js → chunk-26NK23DZ.js} +9 -4
  24. package/dist/chunk-26NK23DZ.js.map +1 -0
  25. package/dist/{chunk-XGSOTWYX.js → chunk-2LPPNWF6.js} +3 -3
  26. package/dist/{chunk-537VFZTR.js → chunk-3DGHRDCX.js} +4 -4
  27. package/dist/{chunk-HB3Z2GCR.js → chunk-5OEJ6GOT.js} +2 -2
  28. package/dist/chunk-5OEJ6GOT.js.map +1 -0
  29. package/dist/{chunk-UA4RI7OT.js → chunk-6MFH4BMK.js} +5 -5
  30. package/dist/chunk-6MFH4BMK.js.map +1 -0
  31. package/dist/{chunk-UZXLQCHP.js → chunk-6T2UDBKG.js} +2 -2
  32. package/dist/chunk-6T2UDBKG.js.map +1 -0
  33. package/dist/{chunk-23TTQXVO.js → chunk-6YLPHBKR.js} +214 -9
  34. package/dist/chunk-6YLPHBKR.js.map +1 -0
  35. package/dist/chunk-73YLDCNF.js +83 -0
  36. package/dist/chunk-73YLDCNF.js.map +1 -0
  37. package/dist/chunk-77DWLQRY.js +233 -0
  38. package/dist/chunk-77DWLQRY.js.map +1 -0
  39. package/dist/{chunk-Z72JH4KG.js → chunk-7CEGU63S.js} +5 -35
  40. package/dist/chunk-7CEGU63S.js.map +1 -0
  41. package/dist/{chunk-PEULZC6M.js → chunk-A3JMGXPG.js} +8 -1
  42. package/dist/chunk-A3JMGXPG.js.map +1 -0
  43. package/dist/{chunk-I6MX32UC.js → chunk-BDV7INMP.js} +4 -4
  44. package/dist/{chunk-MKSA2V7A.js → chunk-C3WE6UJY.js} +2 -2
  45. package/dist/{chunk-FCXOFQAJ.js → chunk-CH22FZHT.js} +19 -2
  46. package/dist/chunk-CH22FZHT.js.map +1 -0
  47. package/dist/{chunk-DYBQG5PQ.js → chunk-CXFOITNS.js} +2 -2
  48. package/dist/{chunk-5ZGZ6HIZ.js → chunk-CXJG63MA.js} +11 -2
  49. package/dist/chunk-CXJG63MA.js.map +1 -0
  50. package/dist/{chunk-EGQYGYIU.js → chunk-DAP2XL7Q.js} +3 -3
  51. package/dist/chunk-DAP2XL7Q.js.map +1 -0
  52. package/dist/chunk-EBVBE7UK.js +59 -0
  53. package/dist/chunk-EBVBE7UK.js.map +1 -0
  54. package/dist/{chunk-DPMFBCV6.js → chunk-FO3UEG4S.js} +20 -3
  55. package/dist/chunk-FO3UEG4S.js.map +1 -0
  56. package/dist/{chunk-SIZWEV2Y.js → chunk-GAUEWM7D.js} +7 -5
  57. package/dist/chunk-GAUEWM7D.js.map +1 -0
  58. package/dist/chunk-GKI4SDP7.js +57 -0
  59. package/dist/chunk-GKI4SDP7.js.map +1 -0
  60. package/dist/chunk-IMYKDWB4.js +139 -0
  61. package/dist/chunk-IMYKDWB4.js.map +1 -0
  62. package/dist/{chunk-5SCJ5UEF.js → chunk-JQ4NEJJ6.js} +3 -3
  63. package/dist/chunk-LJXYPGRH.js +251 -0
  64. package/dist/chunk-LJXYPGRH.js.map +1 -0
  65. package/dist/{chunk-5DWL3JBF.js → chunk-LSTBFLL2.js} +2 -2
  66. package/dist/chunk-MPOLUAMI.js +10531 -0
  67. package/dist/chunk-MPOLUAMI.js.map +1 -0
  68. package/dist/{chunk-ADQ5MQ54.js → chunk-O6EJ6WTI.js} +163 -2
  69. package/dist/chunk-O6EJ6WTI.js.map +1 -0
  70. package/dist/chunk-PC3ZZBTO.js +79 -0
  71. package/dist/chunk-PC3ZZBTO.js.map +1 -0
  72. package/dist/{chunk-OMLIZL2P.js → chunk-PC6ZEDRL.js} +12 -2
  73. package/dist/{chunk-OMLIZL2P.js.map → chunk-PC6ZEDRL.js.map} +1 -1
  74. package/dist/{chunk-34YSDCDP.js → chunk-PVUUIWHY.js} +2 -2
  75. package/dist/{chunk-PA6R5ZCI.js → chunk-QCXNMCHN.js} +18 -5
  76. package/dist/chunk-QCXNMCHN.js.map +1 -0
  77. package/dist/{chunk-DYECX3IX.js → chunk-QSOYKKMD.js} +4 -4
  78. package/dist/chunk-QSOYKKMD.js.map +1 -0
  79. package/dist/{chunk-WCA2NROQ.js → chunk-R233SLY3.js} +2 -2
  80. package/dist/chunk-RC6SU5NO.js +36 -0
  81. package/dist/chunk-RC6SU5NO.js.map +1 -0
  82. package/dist/{chunk-P7EQ2S5O.js → chunk-RRNA5GKT.js} +2 -2
  83. package/dist/{chunk-ZNOEIM6Y.js → chunk-RYIL3PI2.js} +2 -2
  84. package/dist/{chunk-YS3POABP.js → chunk-SLV4LAKX.js} +1 -1
  85. package/dist/chunk-SLV4LAKX.js.map +1 -0
  86. package/dist/chunk-STNPB3UM.js +9 -0
  87. package/dist/chunk-STNPB3UM.js.map +1 -0
  88. package/dist/{chunk-7H6DOO3E.js → chunk-TGALXXLV.js} +211 -36
  89. package/dist/chunk-TGALXXLV.js.map +1 -0
  90. package/dist/{chunk-MRIBLZL3.js → chunk-TV3YZ35S.js} +5 -1
  91. package/dist/chunk-TV3YZ35S.js.map +1 -0
  92. package/dist/{chunk-VMIO4IXG.js → chunk-V2PZC6AW.js} +6 -229
  93. package/dist/chunk-V2PZC6AW.js.map +1 -0
  94. package/dist/{chunk-YMYK7US4.js → chunk-WIBHRONM.js} +2 -2
  95. package/dist/chunk-WIBHRONM.js.map +1 -0
  96. package/dist/{chunk-KESP7GOK.js → chunk-Y26YV5R3.js} +3 -3
  97. package/dist/{chunk-MIQHZESA.js → chunk-YM7LFCG7.js} +5 -5
  98. package/dist/{chunk-MIQHZESA.js.map → chunk-YM7LFCG7.js.map} +1 -1
  99. package/dist/{chunk-CBAHB2BF.js → chunk-YVZRTCGG.js} +7 -70
  100. package/dist/chunk-YVZRTCGG.js.map +1 -0
  101. package/dist/{chunk-4TFSM22V.js → chunk-YW5DBAPG.js} +4 -4
  102. package/dist/{chunk-2AXFIYHT.js → chunk-Z6FNBOTC.js} +1 -1
  103. package/dist/chunk-Z6FNBOTC.js.map +1 -0
  104. package/dist/{chunk-NIOHFJPJ.js → chunk-ZBBW7YQN.js} +218 -119
  105. package/dist/chunk-ZBBW7YQN.js.map +1 -0
  106. package/dist/{chunk-RD5LYKD6.js → chunk-ZROPXHJY.js} +2 -2
  107. package/dist/chunk-ZROPXHJY.js.map +1 -0
  108. package/dist/consent/index.cjs.map +1 -1
  109. package/dist/consent/index.d.cts +7 -6
  110. package/dist/consent/index.d.ts +7 -6
  111. package/dist/consent/index.js +3 -3
  112. package/dist/{crypto-A7FRXYHC.js → crypto-2CRLG4F4.js} +3 -3
  113. package/dist/{delegation-YBA4X4JN.js → delegation-ZTRT2PRV.js} +5 -5
  114. package/dist/derivations/index.cjs +18 -1
  115. package/dist/derivations/index.cjs.map +1 -1
  116. package/dist/derivations/index.d.cts +10 -9
  117. package/dist/derivations/index.d.ts +10 -9
  118. package/dist/derivations/index.js +4 -4
  119. package/dist/{dev-unlock-D9s-loPr.d.ts → dev-unlock-BH6y3Hx0.d.ts} +1 -1
  120. package/dist/{dev-unlock-DRwVSy2S.d.cts → dev-unlock-H1Xwxc3U.d.cts} +1 -1
  121. package/dist/discriminant-BN9REW3o.d.cts +60 -0
  122. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  123. package/dist/executor-S76VN45G.js +8 -0
  124. package/dist/executor-UCXLIGLW.js +11 -0
  125. package/dist/executor-ZCNZJMGR.js +8 -0
  126. package/dist/{fanout-sidecar-VJ52RIEY.js → fanout-sidecar-F3ZRFU4H.js} +2 -2
  127. package/dist/fanout-sidecar-F3ZRFU4H.js.map +1 -0
  128. package/dist/guards/index.cjs +7 -0
  129. package/dist/guards/index.cjs.map +1 -1
  130. package/dist/guards/index.d.cts +8 -7
  131. package/dist/guards/index.d.ts +8 -7
  132. package/dist/guards/index.js +4 -4
  133. package/dist/{hash-DXXXusyk.d.ts → hash-D89JdDbj.d.ts} +1 -1
  134. package/dist/{hash-DtRih9MQ.d.cts → hash-_sDFvtmX.d.cts} +1 -1
  135. package/dist/history/index.cjs +2 -2
  136. package/dist/history/index.cjs.map +1 -1
  137. package/dist/history/index.d.cts +8 -7
  138. package/dist/history/index.d.ts +8 -7
  139. package/dist/history/index.js +6 -6
  140. package/dist/i18n/index.cjs +287 -27
  141. package/dist/i18n/index.cjs.map +1 -1
  142. package/dist/i18n/index.d.cts +7 -6
  143. package/dist/i18n/index.d.ts +7 -6
  144. package/dist/i18n/index.js +21 -6
  145. package/dist/i18n/index.js.map +1 -1
  146. package/dist/{index-CmVgTkqk.d.cts → index-B8bjExET.d.cts} +214 -18
  147. package/dist/{index-CNwA-B6-.d.ts → index-DfUbNad8.d.ts} +214 -18
  148. package/dist/index.cjs +3343 -447
  149. package/dist/index.cjs.map +1 -1
  150. package/dist/index.d.cts +43 -22
  151. package/dist/index.d.ts +43 -22
  152. package/dist/index.js +179 -8799
  153. package/dist/index.js.map +1 -1
  154. package/dist/indexing/index.cjs +5 -1
  155. package/dist/indexing/index.cjs.map +1 -1
  156. package/dist/indexing/index.d.cts +3 -3
  157. package/dist/indexing/index.d.ts +3 -3
  158. package/dist/indexing/index.js +4 -4
  159. package/dist/issue-IVTVSKWW.js +12 -0
  160. package/dist/{lazy-builder-Rpd-V3jP.d.ts → lazy-builder-Ci5_YG73.d.cts} +2 -2
  161. package/dist/{lazy-builder-C-rPfWG0.d.cts → lazy-builder-D5GU14TS.d.ts} +2 -2
  162. package/dist/{ledger-3TXNP47J.js → ledger-NYCGJX2D.js} +6 -6
  163. package/dist/materialized-views/index.cjs +21 -2
  164. package/dist/materialized-views/index.cjs.map +1 -1
  165. package/dist/materialized-views/index.d.cts +23 -20
  166. package/dist/materialized-views/index.d.ts +23 -20
  167. package/dist/materialized-views/index.js +12 -12
  168. package/dist/noydb-SH4RLE47.js +34 -0
  169. package/dist/overlay-views/index.cjs +11 -1
  170. package/dist/overlay-views/index.cjs.map +1 -1
  171. package/dist/overlay-views/index.d.cts +10 -9
  172. package/dist/overlay-views/index.d.ts +10 -9
  173. package/dist/overlay-views/index.js +6 -4
  174. package/dist/periods/index.cjs.map +1 -1
  175. package/dist/periods/index.d.cts +7 -6
  176. package/dist/periods/index.d.ts +7 -6
  177. package/dist/periods/index.js +6 -6
  178. package/dist/{predicate-Dnu81tsS.d.cts → predicate-Bt5ft-9c.d.cts} +28 -3
  179. package/dist/{predicate-Dnu81tsS.d.ts → predicate-Bt5ft-9c.d.ts} +28 -3
  180. package/dist/{public-envelope-PY6NKFLI.js → public-envelope-QOXZEHKH.js} +4 -4
  181. package/dist/query/index.cjs +255 -6
  182. package/dist/query/index.cjs.map +1 -1
  183. package/dist/query/index.d.cts +3 -3
  184. package/dist/query/index.d.ts +3 -3
  185. package/dist/query/index.js +12 -6
  186. package/dist/registry-DKEXOJVO.js +7 -0
  187. package/dist/{registry-3L3N3PTG.js → registry-ST2VNFZC.js} +3 -3
  188. package/dist/registry-UFIK7CSR.js +8 -0
  189. package/dist/registry-ZGYYSM5I.js +8 -0
  190. package/dist/registry-ZGYYSM5I.js.map +1 -0
  191. package/dist/revoke-RT7QYB4G.js +17 -0
  192. package/dist/revoke-RT7QYB4G.js.map +1 -0
  193. package/dist/session/index.cjs.map +1 -1
  194. package/dist/session/index.d.cts +8 -7
  195. package/dist/session/index.d.ts +8 -7
  196. package/dist/session/index.js +3 -3
  197. package/dist/shadow/index.cjs.map +1 -1
  198. package/dist/shadow/index.d.cts +7 -6
  199. package/dist/shadow/index.d.ts +7 -6
  200. package/dist/shadow/index.js +2 -2
  201. package/dist/signer-QNU66JF5.js +18 -0
  202. package/dist/signer-QNU66JF5.js.map +1 -0
  203. package/dist/snapshots/index.cjs +937 -0
  204. package/dist/snapshots/index.cjs.map +1 -0
  205. package/dist/snapshots/index.d.cts +28 -0
  206. package/dist/snapshots/index.d.ts +28 -0
  207. package/dist/snapshots/index.js +152 -0
  208. package/dist/snapshots/index.js.map +1 -0
  209. package/dist/{stale-HSC5YO2O.js → stale-VKXSXJF4.js} +2 -2
  210. package/dist/stale-VKXSXJF4.js.map +1 -0
  211. package/dist/store/index.cjs.map +1 -1
  212. package/dist/store/index.d.cts +7 -6
  213. package/dist/store/index.d.ts +7 -6
  214. package/dist/store/index.js +2 -2
  215. package/dist/{strategy-DSTrsZ8t.d.cts → strategy-CT2LCKAX.d.cts} +12 -0
  216. package/dist/{strategy-DSTrsZ8t.d.ts → strategy-CT2LCKAX.d.ts} +12 -0
  217. package/dist/sync/index.cjs.map +1 -1
  218. package/dist/sync/index.d.cts +6 -5
  219. package/dist/sync/index.d.ts +6 -5
  220. package/dist/sync/index.js +4 -4
  221. package/dist/team/index.cjs +1 -1
  222. package/dist/team/index.cjs.map +1 -1
  223. package/dist/team/index.d.cts +7 -6
  224. package/dist/team/index.d.ts +7 -6
  225. package/dist/team/index.js +13 -11
  226. package/dist/tx/index.cjs +82 -2
  227. package/dist/tx/index.cjs.map +1 -1
  228. package/dist/tx/index.d.cts +8 -7
  229. package/dist/tx/index.d.ts +8 -7
  230. package/dist/tx/index.js +56 -3
  231. package/dist/tx/index.js.map +1 -1
  232. package/dist/{types-DW9RGSSs.d.ts → types-CD8mc8zR.d.ts} +1279 -259
  233. package/dist/{types-C4lwMKKF.d.cts → types-DiSXn3a4.d.cts} +1279 -259
  234. package/dist/{index-4agOpzqd.d.ts → ulid-8p83wbR4.d.ts} +64 -46
  235. package/dist/{index-hdFvZkBP.d.cts → ulid-DQ1hcJvZ.d.cts} +64 -46
  236. package/dist/util/index.cjs +7 -0
  237. package/dist/util/index.cjs.map +1 -1
  238. package/dist/util/index.d.cts +2 -0
  239. package/dist/util/index.d.ts +2 -0
  240. package/dist/util/index.js +5 -1
  241. package/dist/util/index.js.map +1 -1
  242. package/dist/{with-derivation-C8LDlV7t.d.cts → with-derivation-CVT7-dUt.d.cts} +1 -1
  243. package/dist/{with-derivation-g-pGoMzL.d.ts → with-derivation-DWMTpgEH.d.ts} +1 -1
  244. package/dist/{with-guard-DWOCK4Ca.d.ts → with-guard-BRvt53da.d.ts} +1 -1
  245. package/dist/{with-guard-jI1x9Z3k.d.cts → with-guard-Dx2zZnTA.d.cts} +1 -1
  246. package/dist/{with-materialized-view-DaKR-N6J.d.ts → with-materialized-view-BTTU3BNK.d.cts} +2 -2
  247. package/dist/{with-materialized-view-DcTx4H3j.d.cts → with-materialized-view-X0CoL8-L.d.ts} +2 -2
  248. package/dist/{with-overlayed-view-N7jYuNOS.d.ts → with-overlayed-view-DQjO_DSG.d.ts} +2 -2
  249. package/dist/{with-overlayed-view-D-6oWAgM.d.cts → with-overlayed-view-DcacRRsS.d.cts} +2 -2
  250. package/package.json +27 -4
  251. package/dist/chunk-23TTQXVO.js.map +0 -1
  252. package/dist/chunk-2AXFIYHT.js.map +0 -1
  253. package/dist/chunk-5ZGZ6HIZ.js.map +0 -1
  254. package/dist/chunk-6HPZY4ON.js.map +0 -1
  255. package/dist/chunk-7H6DOO3E.js.map +0 -1
  256. package/dist/chunk-ADQ5MQ54.js.map +0 -1
  257. package/dist/chunk-CBAHB2BF.js.map +0 -1
  258. package/dist/chunk-DPMFBCV6.js.map +0 -1
  259. package/dist/chunk-DYECX3IX.js.map +0 -1
  260. package/dist/chunk-EGQYGYIU.js.map +0 -1
  261. package/dist/chunk-FCXOFQAJ.js.map +0 -1
  262. package/dist/chunk-HB3Z2GCR.js.map +0 -1
  263. package/dist/chunk-MRIBLZL3.js.map +0 -1
  264. package/dist/chunk-NIOHFJPJ.js.map +0 -1
  265. package/dist/chunk-PA6R5ZCI.js.map +0 -1
  266. package/dist/chunk-PEULZC6M.js.map +0 -1
  267. package/dist/chunk-RD5LYKD6.js.map +0 -1
  268. package/dist/chunk-SIZWEV2Y.js.map +0 -1
  269. package/dist/chunk-UA4RI7OT.js.map +0 -1
  270. package/dist/chunk-UZXLQCHP.js.map +0 -1
  271. package/dist/chunk-VMIO4IXG.js.map +0 -1
  272. package/dist/chunk-YMYK7US4.js.map +0 -1
  273. package/dist/chunk-YS3POABP.js.map +0 -1
  274. package/dist/chunk-Z72JH4KG.js.map +0 -1
  275. package/dist/executor-7E3VFGW7.js +0 -11
  276. package/dist/executor-CEWX2FQI.js +0 -8
  277. package/dist/executor-X4SQ3ZLC.js +0 -8
  278. package/dist/fanout-sidecar-VJ52RIEY.js.map +0 -1
  279. package/dist/registry-O47PUPSY.js +0 -8
  280. package/dist/registry-RFGGMVNJ.js +0 -7
  281. package/dist/registry-WLLMODKN.js +0 -8
  282. /package/dist/{chunk-XGSOTWYX.js.map → chunk-2LPPNWF6.js.map} +0 -0
  283. /package/dist/{chunk-537VFZTR.js.map → chunk-3DGHRDCX.js.map} +0 -0
  284. /package/dist/{chunk-I6MX32UC.js.map → chunk-BDV7INMP.js.map} +0 -0
  285. /package/dist/{chunk-MKSA2V7A.js.map → chunk-C3WE6UJY.js.map} +0 -0
  286. /package/dist/{chunk-DYBQG5PQ.js.map → chunk-CXFOITNS.js.map} +0 -0
  287. /package/dist/{chunk-5SCJ5UEF.js.map → chunk-JQ4NEJJ6.js.map} +0 -0
  288. /package/dist/{chunk-5DWL3JBF.js.map → chunk-LSTBFLL2.js.map} +0 -0
  289. /package/dist/{chunk-34YSDCDP.js.map → chunk-PVUUIWHY.js.map} +0 -0
  290. /package/dist/{chunk-WCA2NROQ.js.map → chunk-R233SLY3.js.map} +0 -0
  291. /package/dist/{chunk-P7EQ2S5O.js.map → chunk-RRNA5GKT.js.map} +0 -0
  292. /package/dist/{chunk-ZNOEIM6Y.js.map → chunk-RYIL3PI2.js.map} +0 -0
  293. /package/dist/{chunk-KESP7GOK.js.map → chunk-Y26YV5R3.js.map} +0 -0
  294. /package/dist/{chunk-4TFSM22V.js.map → chunk-YW5DBAPG.js.map} +0 -0
  295. /package/dist/{crypto-A7FRXYHC.js.map → crypto-2CRLG4F4.js.map} +0 -0
  296. /package/dist/{delegation-YBA4X4JN.js.map → delegation-ZTRT2PRV.js.map} +0 -0
  297. /package/dist/{executor-7E3VFGW7.js.map → executor-S76VN45G.js.map} +0 -0
  298. /package/dist/{executor-CEWX2FQI.js.map → executor-UCXLIGLW.js.map} +0 -0
  299. /package/dist/{executor-X4SQ3ZLC.js.map → executor-ZCNZJMGR.js.map} +0 -0
  300. /package/dist/{ledger-3TXNP47J.js.map → issue-IVTVSKWW.js.map} +0 -0
  301. /package/dist/{public-envelope-PY6NKFLI.js.map → ledger-NYCGJX2D.js.map} +0 -0
  302. /package/dist/{registry-3L3N3PTG.js.map → noydb-SH4RLE47.js.map} +0 -0
  303. /package/dist/{registry-O47PUPSY.js.map → public-envelope-QOXZEHKH.js.map} +0 -0
  304. /package/dist/{registry-RFGGMVNJ.js.map → registry-DKEXOJVO.js.map} +0 -0
  305. /package/dist/{registry-WLLMODKN.js.map → registry-ST2VNFZC.js.map} +0 -0
  306. /package/dist/{stale-HSC5YO2O.js.map → registry-UFIK7CSR.js.map} +0 -0
@@ -1,10 +1,11 @@
1
- import { a5 as PeriodsStrategy } from '../types-C4lwMKKF.cjs';
2
- export { a6 as CarryForwardContext, a7 as ClosePeriodOptions, a8 as OpenPeriodOptions, a9 as PERIODS_COLLECTION, aa as PeriodRecord, ab as ReadOnlyCollection, ac as appendPeriodLedgerEntry, ad as assertTsWritable, ae as chainAnchor, af as loadPeriods, ag as validatePeriodName } from '../types-C4lwMKKF.cjs';
3
- import '../lazy-builder-C-rPfWG0.cjs';
4
- import '../predicate-Dnu81tsS.cjs';
5
- import '../strategy-DSTrsZ8t.cjs';
1
+ import { ag as PeriodsStrategy } from '../types-DiSXn3a4.cjs';
2
+ export { ah as CarryForwardContext, ai as ClosePeriodOptions, aj as OpenPeriodOptions, ak as PERIODS_COLLECTION, al as PeriodRecord, am as ReadOnlyCollection, an as appendPeriodLedgerEntry, ao as assertTsWritable, ap as chainAnchor, aq as loadPeriods, ar as validatePeriodName } from '../types-DiSXn3a4.cjs';
3
+ import '../lazy-builder-Ci5_YG73.cjs';
4
+ import '../predicate-Bt5ft-9c.cjs';
5
+ import '../strategy-CT2LCKAX.cjs';
6
6
  import '../strategy-BSxFXGzb.cjs';
7
- import '../index-CmVgTkqk.cjs';
7
+ import '../index-B8bjExET.cjs';
8
+ import '@noy-db/attestation';
8
9
 
9
10
  /**
10
11
  * Active periods strategy factory. Only reachable through the
@@ -1,10 +1,11 @@
1
- import { a5 as PeriodsStrategy } from '../types-DW9RGSSs.js';
2
- export { a6 as CarryForwardContext, a7 as ClosePeriodOptions, a8 as OpenPeriodOptions, a9 as PERIODS_COLLECTION, aa as PeriodRecord, ab as ReadOnlyCollection, ac as appendPeriodLedgerEntry, ad as assertTsWritable, ae as chainAnchor, af as loadPeriods, ag as validatePeriodName } from '../types-DW9RGSSs.js';
3
- import '../lazy-builder-Rpd-V3jP.js';
4
- import '../predicate-Dnu81tsS.js';
5
- import '../strategy-DSTrsZ8t.js';
1
+ import { ag as PeriodsStrategy } from '../types-CD8mc8zR.js';
2
+ export { ah as CarryForwardContext, ai as ClosePeriodOptions, aj as OpenPeriodOptions, ak as PERIODS_COLLECTION, al as PeriodRecord, am as ReadOnlyCollection, an as appendPeriodLedgerEntry, ao as assertTsWritable, ap as chainAnchor, aq as loadPeriods, ar as validatePeriodName } from '../types-CD8mc8zR.js';
3
+ import '../lazy-builder-D5GU14TS.js';
4
+ import '../predicate-Bt5ft-9c.js';
5
+ import '../strategy-CT2LCKAX.js';
6
6
  import '../strategy-BSxFXGzb.js';
7
- import '../index-CNwA-B6-.js';
7
+ import '../index-DfUbNad8.js';
8
+ import '@noy-db/attestation';
8
9
 
9
10
  /**
10
11
  * Active periods strategy factory. Only reachable through the
@@ -6,13 +6,13 @@ import {
6
6
  loadPeriods,
7
7
  validatePeriodName,
8
8
  withPeriods
9
- } from "../chunk-537VFZTR.js";
9
+ } from "../chunk-3DGHRDCX.js";
10
10
  import "../chunk-UF3BUNQZ.js";
11
- import "../chunk-UA4RI7OT.js";
12
- import "../chunk-2AXFIYHT.js";
13
- import "../chunk-YS3POABP.js";
14
- import "../chunk-WCA2NROQ.js";
15
- import "../chunk-ADQ5MQ54.js";
11
+ import "../chunk-6MFH4BMK.js";
12
+ import "../chunk-Z6FNBOTC.js";
13
+ import "../chunk-SLV4LAKX.js";
14
+ import "../chunk-R233SLY3.js";
15
+ import "../chunk-O6EJ6WTI.js";
16
16
  export {
17
17
  PERIODS_COLLECTION,
18
18
  appendPeriodLedgerEntry,
@@ -30,6 +30,7 @@
30
30
  */
31
31
  type IndexDef = string | {
32
32
  readonly fields: readonly string[];
33
+ readonly unique?: boolean;
33
34
  } | readonly string[];
34
35
  /**
35
36
  * Internal representation of a built hash index.
@@ -134,7 +135,7 @@ interface FilterClause {
134
135
  readonly fn: (record: unknown) => boolean;
135
136
  }
136
137
  /**
137
- * A declared deterministic predicate reference (#153). The query
138
+ * A declared deterministic predicate reference. The query
138
139
  * builder produces this via `.wherePredicate(name, ctx?)` when a
139
140
  * Query has been augmented with a predicates map (typically by the
140
141
  * materialized-view registry — see MV v2 spec § Function-based
@@ -163,7 +164,31 @@ interface GroupClause {
163
164
  readonly op: 'and' | 'or';
164
165
  readonly clauses: readonly Clause[];
165
166
  }
166
- type Clause = FieldClause | FilterClause | WherePredicateClause | GroupClause;
167
+ /**
168
+ * Cartesian-product expansion clause. Appended to `QueryPlan.clauses`
169
+ * by `Query.crossJoin()`. Processed in declaration order by
170
+ * `executeClausePipeline` — NOT by `evaluateClause` (which is a
171
+ * per-record predicate and throws on this type).
172
+ */
173
+ interface CrossJoinClause {
174
+ readonly type: 'crossJoin';
175
+ /** Target collection name to cross-join against. */
176
+ readonly target: string;
177
+ /** Alias under which the right-side record is exposed on each result row. */
178
+ readonly as: string;
179
+ /**
180
+ * Lateral filter callback. `undefined` → full cartesian product.
181
+ * Two call shapes:
182
+ * - Subset: `(left) => TTarget[]` — returns the right rows for this left row
183
+ * - Predicate: `(left) => (right) => boolean` — executor materializes then filters
184
+ */
185
+ readonly on?: (left: unknown) => unknown[] | ((right: unknown) => boolean);
186
+ /** When `on:` was supplied as `{ predicate: name }`, the name is stored here for queryHash. */
187
+ readonly onPredicateName?: string;
188
+ /** Per-clause row ceiling override. `undefined` → `DEFAULT_CROSS_JOIN_MAX_ROWS`. */
189
+ readonly maxRows?: number;
190
+ }
191
+ type Clause = FieldClause | FilterClause | WherePredicateClause | GroupClause | CrossJoinClause;
167
192
  /**
168
193
  * Read a possibly nested field path like "address.city" from a record.
169
194
  * Returns undefined if any segment is missing.
@@ -182,4 +207,4 @@ declare function evaluateFieldClause(record: unknown, clause: FieldClause): bool
182
207
  */
183
208
  declare function evaluateClause(record: unknown, clause: Clause): boolean;
184
209
 
185
- export { CollectionIndexes as C, type FieldClause as F, type GroupClause as G, type HashIndex as H, type IndexDef as I, type Operator as O, type Clause as a, type FilterClause as b, evaluateFieldClause as c, evaluateClause as e, readPath as r };
210
+ export { CollectionIndexes as C, type FieldClause as F, type GroupClause as G, type HashIndex as H, type IndexDef as I, type Operator as O, type Clause as a, type FilterClause as b, evaluateFieldClause as c, type CrossJoinClause as d, evaluateClause as e, readPath as r };
@@ -30,6 +30,7 @@
30
30
  */
31
31
  type IndexDef = string | {
32
32
  readonly fields: readonly string[];
33
+ readonly unique?: boolean;
33
34
  } | readonly string[];
34
35
  /**
35
36
  * Internal representation of a built hash index.
@@ -134,7 +135,7 @@ interface FilterClause {
134
135
  readonly fn: (record: unknown) => boolean;
135
136
  }
136
137
  /**
137
- * A declared deterministic predicate reference (#153). The query
138
+ * A declared deterministic predicate reference. The query
138
139
  * builder produces this via `.wherePredicate(name, ctx?)` when a
139
140
  * Query has been augmented with a predicates map (typically by the
140
141
  * materialized-view registry — see MV v2 spec § Function-based
@@ -163,7 +164,31 @@ interface GroupClause {
163
164
  readonly op: 'and' | 'or';
164
165
  readonly clauses: readonly Clause[];
165
166
  }
166
- type Clause = FieldClause | FilterClause | WherePredicateClause | GroupClause;
167
+ /**
168
+ * Cartesian-product expansion clause. Appended to `QueryPlan.clauses`
169
+ * by `Query.crossJoin()`. Processed in declaration order by
170
+ * `executeClausePipeline` — NOT by `evaluateClause` (which is a
171
+ * per-record predicate and throws on this type).
172
+ */
173
+ interface CrossJoinClause {
174
+ readonly type: 'crossJoin';
175
+ /** Target collection name to cross-join against. */
176
+ readonly target: string;
177
+ /** Alias under which the right-side record is exposed on each result row. */
178
+ readonly as: string;
179
+ /**
180
+ * Lateral filter callback. `undefined` → full cartesian product.
181
+ * Two call shapes:
182
+ * - Subset: `(left) => TTarget[]` — returns the right rows for this left row
183
+ * - Predicate: `(left) => (right) => boolean` — executor materializes then filters
184
+ */
185
+ readonly on?: (left: unknown) => unknown[] | ((right: unknown) => boolean);
186
+ /** When `on:` was supplied as `{ predicate: name }`, the name is stored here for queryHash. */
187
+ readonly onPredicateName?: string;
188
+ /** Per-clause row ceiling override. `undefined` → `DEFAULT_CROSS_JOIN_MAX_ROWS`. */
189
+ readonly maxRows?: number;
190
+ }
191
+ type Clause = FieldClause | FilterClause | WherePredicateClause | GroupClause | CrossJoinClause;
167
192
  /**
168
193
  * Read a possibly nested field path like "address.city" from a record.
169
194
  * Returns undefined if any segment is missing.
@@ -182,4 +207,4 @@ declare function evaluateFieldClause(record: unknown, clause: FieldClause): bool
182
207
  */
183
208
  declare function evaluateClause(record: unknown, clause: Clause): boolean;
184
209
 
185
- export { CollectionIndexes as C, type FieldClause as F, type GroupClause as G, type HashIndex as H, type IndexDef as I, type Operator as O, type Clause as a, type FilterClause as b, evaluateFieldClause as c, evaluateClause as e, readPath as r };
210
+ export { CollectionIndexes as C, type FieldClause as F, type GroupClause as G, type HashIndex as H, type IndexDef as I, type Operator as O, type Clause as a, type FilterClause as b, evaluateFieldClause as c, type CrossJoinClause as d, evaluateClause as e, readPath as r };
@@ -12,9 +12,9 @@ import {
12
12
  resolveLocale,
13
13
  savePublicEnvelope,
14
14
  validatePublicEnvelopeInput
15
- } from "./chunk-5SCJ5UEF.js";
16
- import "./chunk-YS3POABP.js";
17
- import "./chunk-ADQ5MQ54.js";
15
+ } from "./chunk-JQ4NEJJ6.js";
16
+ import "./chunk-SLV4LAKX.js";
17
+ import "./chunk-O6EJ6WTI.js";
18
18
  export {
19
19
  DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
20
20
  PUBLIC_ENVELOPE_FIELDS,
@@ -28,4 +28,4 @@ export {
28
28
  savePublicEnvelope,
29
29
  validatePublicEnvelopeInput
30
30
  };
31
- //# sourceMappingURL=public-envelope-PY6NKFLI.js.map
31
+ //# sourceMappingURL=public-envelope-QOXZEHKH.js.map
@@ -22,6 +22,9 @@ var query_exports = {};
22
22
  __export(query_exports, {
23
23
  Aggregation: () => Aggregation,
24
24
  CollectionIndexes: () => CollectionIndexes,
25
+ CrossJoinSourceUnknownError: () => CrossJoinSourceUnknownError,
26
+ CrossJoinTooLargeError: () => CrossJoinTooLargeError,
27
+ DEFAULT_CROSS_JOIN_MAX_ROWS: () => DEFAULT_CROSS_JOIN_MAX_ROWS,
25
28
  DEFAULT_JOIN_MAX_ROWS: () => DEFAULT_JOIN_MAX_ROWS,
26
29
  DanglingReferenceError: () => DanglingReferenceError,
27
30
  GROUPBY_MAX_CARDINALITY: () => GROUPBY_MAX_CARDINALITY,
@@ -119,6 +122,10 @@ function evaluateClause(record, clause) {
119
122
  return clause.fn(record);
120
123
  case "wherePredicate":
121
124
  return clause.fn(record, clause.ctx);
125
+ case "crossJoin":
126
+ throw new Error(
127
+ `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.`
128
+ );
122
129
  case "group":
123
130
  if (clause.op === "and") {
124
131
  for (const child of clause.clauses) {
@@ -208,6 +215,34 @@ var JoinTooLargeError = class extends NoydbError {
208
215
  this.side = opts.side;
209
216
  }
210
217
  };
218
+ var CrossJoinTooLargeError = class extends NoydbError {
219
+ target;
220
+ expected;
221
+ limit;
222
+ constructor(opts) {
223
+ super(
224
+ "CROSS_JOIN_TOO_LARGE",
225
+ `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} }).`
226
+ );
227
+ this.name = "CrossJoinTooLargeError";
228
+ this.target = opts.target;
229
+ this.expected = opts.expected;
230
+ this.limit = opts.limit;
231
+ }
232
+ };
233
+ var CrossJoinSourceUnknownError = class extends NoydbError {
234
+ target;
235
+ leftCollection;
236
+ constructor(target, leftCollection) {
237
+ super(
238
+ "CROSS_JOIN_SOURCE_UNKNOWN",
239
+ `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.`
240
+ );
241
+ this.name = "CrossJoinSourceUnknownError";
242
+ this.target = target;
243
+ this.leftCollection = leftCollection;
244
+ }
245
+ };
211
246
  var DanglingReferenceError = class extends NoydbError {
212
247
  field;
213
248
  target;
@@ -474,6 +509,7 @@ var EMPTY_PLAN = {
474
509
  offset: 0,
475
510
  joins: []
476
511
  };
512
+ var DEFAULT_CROSS_JOIN_MAX_ROWS = 5e4;
477
513
  var Query = class _Query {
478
514
  source;
479
515
  plan;
@@ -506,7 +542,7 @@ var Query = class _Query {
506
542
  /**
507
543
  * @internal — clone this Query with a declared-predicate map
508
544
  * attached. Used by the materialized-view registry to enable
509
- * `.wherePredicate(name, ctx?)` for the MV's query callback (#153).
545
+ * `.wherePredicate(name, ctx?)` for the MV's query callback.
510
546
  * Consumers don't call this directly.
511
547
  */
512
548
  _withPredicates(predicates) {
@@ -519,7 +555,7 @@ var Query = class _Query {
519
555
  );
520
556
  }
521
557
  /**
522
- * Filter by a registered deterministic predicate (#153). Requires
558
+ * Filter by a registered deterministic predicate. Requires
523
559
  * the Query to have been augmented with a predicates map (typically
524
560
  * via the materialized-view registry — bare Queries constructed
525
561
  * outside an MV throw on `.wherePredicate()`).
@@ -755,6 +791,78 @@ var Query = class _Query {
755
791
  this.predicates
756
792
  );
757
793
  }
794
+ /**
795
+ * Cartesian-product cross-join against `target` collection. Each result row
796
+ * carries the original `T` fields plus `result[as]` populated from every
797
+ * right-side row (or the filtered subset when `on:` is supplied).
798
+ *
799
+ * **Order matters:** `.where().crossJoin()` filters BEFORE expanding (cheaper);
800
+ * `.crossJoin().where('alias.field', ...)` filters AFTER (required when the
801
+ * where clause references the aliased fields).
802
+ *
803
+ * **Cost ceiling:** `CrossJoinTooLargeError` fires before allocation when
804
+ * `leftRows × rightRows` (or the cumulative lateral count) exceeds the limit.
805
+ * Default: 50,000 rows. Override per-clause with `{ maxRows: N }`.
806
+ *
807
+ * **`on:` shapes:**
808
+ * - `on: (left) => TTarget[]` — subset form (most efficient)
809
+ * - `on: (left) => (right) => boolean` — predicate form
810
+ * - `on: { predicate: 'name' }` — MV-safe, hash-tracked form
811
+ * (requires the Query to have been augmented via `_withPredicates`)
812
+ *
813
+ * Requires a JoinContext (constructed via `collection.query()`).
814
+ */
815
+ crossJoin(target, opts) {
816
+ if (!this.joinContext) {
817
+ throw new Error(
818
+ `Query.crossJoin("${target}"): requires a join context. Use collection.query() to construct a cross-join-capable Query instead of the Query constructor directly.`
819
+ );
820
+ }
821
+ let onFn;
822
+ let onPredicateName;
823
+ if (opts.on !== void 0) {
824
+ if (typeof opts.on === "function") {
825
+ onFn = opts.on;
826
+ if (this.predicates) {
827
+ console.warn(
828
+ `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.`
829
+ );
830
+ }
831
+ } else {
832
+ const predName = opts.on.predicate;
833
+ if (!this.predicates) {
834
+ throw new Error(
835
+ `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 } }.`
836
+ );
837
+ }
838
+ const decl = this.predicates.get(predName);
839
+ if (!decl) {
840
+ throw new Error(
841
+ `Query.crossJoin("${target}"): predicate "${predName}" not registered. Available: ${[...this.predicates.keys()].join(", ") || "(none)"}.`
842
+ );
843
+ }
844
+ const as = opts.as;
845
+ const predicateFn = decl.fn;
846
+ onFn = (_left) => (right) => predicateFn({ ..._left, [as]: right });
847
+ onPredicateName = predName;
848
+ }
849
+ }
850
+ const clause = {
851
+ type: "crossJoin",
852
+ target,
853
+ as: opts.as,
854
+ ...onFn !== void 0 && { on: onFn },
855
+ ...onPredicateName !== void 0 && { onPredicateName },
856
+ ...opts.maxRows !== void 0 && { maxRows: opts.maxRows }
857
+ };
858
+ return new _Query(
859
+ this.source,
860
+ { ...this.plan, clauses: [...this.plan.clauses, clause] },
861
+ this.joinContext,
862
+ this.aggregateStrategy,
863
+ this.predicates
864
+ );
865
+ }
758
866
  /**
759
867
  * Execute the plan and return the matching records. When the plan
760
868
  * carries any join legs, they are applied after `where` / `orderBy`
@@ -762,7 +870,7 @@ var Query = class _Query {
762
870
  * for the ordering rationale.
763
871
  */
764
872
  toArray() {
765
- const base = executePlanWithSource(this.source, this.plan);
873
+ const base = executePlanWithSource(this.source, this.plan, this.joinContext);
766
874
  if (this.plan.joins.length === 0) return base;
767
875
  if (!this.joinContext) {
768
876
  throw new Error(
@@ -786,6 +894,14 @@ var Query = class _Query {
786
894
  * intent is purely to count.
787
895
  */
788
896
  count() {
897
+ if (this.plan.clauses.some((c) => c.type === "crossJoin")) {
898
+ if (!this.joinContext) {
899
+ throw new Error(
900
+ `Query.count(): plan contains crossJoin clauses but no JoinContext is attached.`
901
+ );
902
+ }
903
+ return executeClausePipeline(this.source, this.plan.clauses, this.joinContext).length;
904
+ }
789
905
  const { candidates, remainingClauses } = candidateRecords(this.source, this.plan.clauses);
790
906
  if (remainingClauses.length === 0) return candidates.length;
791
907
  return filterRecords(candidates, remainingClauses).length;
@@ -833,7 +949,13 @@ var Query = class _Query {
833
949
  aggregate(spec) {
834
950
  const source = this.source;
835
951
  const clauses = this.plan.clauses;
952
+ const joinCtx = this.joinContext;
953
+ const hasCrossJoins = clauses.some((c) => c.type === "crossJoin");
836
954
  const executeRecords = () => {
955
+ if (hasCrossJoins) {
956
+ if (!joinCtx) throw new Error("Query.aggregate(): crossJoin requires a join context");
957
+ return executeClausePipeline(source, clauses, joinCtx);
958
+ }
837
959
  const { candidates, remainingClauses } = candidateRecords(source, clauses);
838
960
  return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
839
961
  };
@@ -850,7 +972,13 @@ var Query = class _Query {
850
972
  }
851
973
  const source = this.source;
852
974
  const clauses = this.plan.clauses;
975
+ const joinCtx = this.joinContext;
976
+ const hasCrossJoins = clauses.some((c) => c.type === "crossJoin");
853
977
  const executeRecords = () => {
978
+ if (hasCrossJoins) {
979
+ if (!joinCtx) throw new Error("Query.groupBy(): crossJoin requires a join context");
980
+ return executeClausePipeline(source, clauses, joinCtx);
981
+ }
854
982
  const { candidates, remainingClauses } = candidateRecords(source, clauses);
855
983
  return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
856
984
  };
@@ -964,6 +1092,21 @@ var Query = class _Query {
964
1092
  }
965
1093
  }
966
1094
  }
1095
+ if (this.joinContext) {
1096
+ const subscribedCross = /* @__PURE__ */ new Set();
1097
+ for (const clause of this.plan.clauses) {
1098
+ if (clause.type !== "crossJoin") continue;
1099
+ if (subscribedCross.has(clause.target)) continue;
1100
+ subscribedCross.add(clause.target);
1101
+ const rightSource = this.joinContext.resolveSource(clause.target);
1102
+ if (rightSource?.subscribe) {
1103
+ const rightSubscribe = rightSource.subscribe.bind(rightSource);
1104
+ upstreams.push({
1105
+ subscribe: (cb) => rightSubscribe(cb)
1106
+ });
1107
+ }
1108
+ }
1109
+ }
967
1110
  return buildLiveQuery(() => this.toArray(), upstreams);
968
1111
  }
969
1112
  /**
@@ -975,9 +1118,20 @@ var Query = class _Query {
975
1118
  return serializePlan(this.plan);
976
1119
  }
977
1120
  };
978
- function executePlanWithSource(source, plan) {
979
- const { candidates, remainingClauses } = candidateRecords(source, plan.clauses);
980
- let result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses);
1121
+ function executePlanWithSource(source, plan, joinContext) {
1122
+ const hasCrossJoins = plan.clauses.some((c) => c.type === "crossJoin");
1123
+ let result;
1124
+ if (hasCrossJoins) {
1125
+ if (!joinContext) {
1126
+ throw new Error(
1127
+ `Query.toArray(): plan contains crossJoin clauses but no JoinContext is attached. Use collection.query() instead of new Query() for cross-join support.`
1128
+ );
1129
+ }
1130
+ result = executeClausePipeline(source, plan.clauses, joinContext);
1131
+ } else {
1132
+ const { candidates, remainingClauses } = candidateRecords(source, plan.clauses);
1133
+ result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses);
1134
+ }
981
1135
  if (plan.orderBy.length > 0) {
982
1136
  result = sortRecords(result, plan.orderBy);
983
1137
  }
@@ -1027,6 +1181,11 @@ function materializeIds(ids, lookupById) {
1027
1181
  return out;
1028
1182
  }
1029
1183
  function executePlan(records, plan) {
1184
+ if (plan.clauses.some((c) => c.type === "crossJoin")) {
1185
+ throw new Error(
1186
+ `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.`
1187
+ );
1188
+ }
1030
1189
  let result = filterRecords(records, plan.clauses);
1031
1190
  if (plan.orderBy.length > 0) {
1032
1191
  result = sortRecords(result, plan.orderBy);
@@ -1054,6 +1213,74 @@ function filterRecords(records, clauses) {
1054
1213
  }
1055
1214
  return out;
1056
1215
  }
1216
+ function executeClausePipeline(source, clauses, joinContext) {
1217
+ let rel = [...source.snapshot()];
1218
+ let filterBatch = [];
1219
+ for (const clause of clauses) {
1220
+ if (clause.type === "crossJoin") {
1221
+ if (filterBatch.length > 0) {
1222
+ rel = filterRecords(rel, filterBatch);
1223
+ filterBatch = [];
1224
+ }
1225
+ const rightSource = joinContext.resolveSource(clause.target);
1226
+ if (!rightSource) {
1227
+ throw new CrossJoinSourceUnknownError(clause.target, joinContext.leftCollection);
1228
+ }
1229
+ rel = applyCrossJoin(rel, clause, rightSource);
1230
+ } else {
1231
+ filterBatch.push(clause);
1232
+ }
1233
+ }
1234
+ if (filterBatch.length > 0) {
1235
+ rel = filterRecords(rel, filterBatch);
1236
+ }
1237
+ return rel;
1238
+ }
1239
+ function applyCrossJoin(leftRel, clause, rightSource) {
1240
+ const rightRows = rightSource.snapshot();
1241
+ const maxRows = clause.maxRows ?? DEFAULT_CROSS_JOIN_MAX_ROWS;
1242
+ const { as } = clause;
1243
+ if (!clause.on) {
1244
+ const product = leftRel.length * rightRows.length;
1245
+ if (product > maxRows) {
1246
+ throw new CrossJoinTooLargeError({ target: clause.target, expected: product, limit: maxRows });
1247
+ }
1248
+ const expanded2 = [];
1249
+ for (const left of leftRel) {
1250
+ const leftObj = left;
1251
+ for (const right of rightRows) {
1252
+ expanded2.push({ ...leftObj, [as]: right });
1253
+ }
1254
+ }
1255
+ return expanded2;
1256
+ }
1257
+ const expanded = [];
1258
+ let cumulative = 0;
1259
+ for (const left of leftRel) {
1260
+ const callbackResult = clause.on(left);
1261
+ let filteredRight;
1262
+ if (Array.isArray(callbackResult)) {
1263
+ filteredRight = callbackResult;
1264
+ } else {
1265
+ filteredRight = rightRows.filter(
1266
+ callbackResult
1267
+ );
1268
+ }
1269
+ cumulative += filteredRight.length;
1270
+ if (cumulative > maxRows) {
1271
+ throw new CrossJoinTooLargeError({
1272
+ target: clause.target,
1273
+ expected: cumulative,
1274
+ limit: maxRows
1275
+ });
1276
+ }
1277
+ const leftObj = left;
1278
+ for (const right of filteredRight) {
1279
+ expanded.push({ ...leftObj, [as]: right });
1280
+ }
1281
+ }
1282
+ return expanded;
1283
+ }
1057
1284
  function sortRecords(records, orderBy) {
1058
1285
  return [...records].sort((a, b) => {
1059
1286
  for (const { field, direction } of orderBy) {
@@ -1116,6 +1343,16 @@ function serializeClause(clause) {
1116
1343
  clauses: clause.clauses.map(serializeClause)
1117
1344
  };
1118
1345
  }
1346
+ if (clause.type === "crossJoin") {
1347
+ return {
1348
+ type: "crossJoin",
1349
+ target: clause.target,
1350
+ as: clause.as,
1351
+ on: clause.on ? "[function]" : void 0,
1352
+ onPredicateName: clause.onPredicateName,
1353
+ maxRows: clause.maxRows
1354
+ };
1355
+ }
1119
1356
  return clause;
1120
1357
  }
1121
1358
  function canonicalCtxHash(ctx) {
@@ -1295,6 +1532,7 @@ function count(opts) {
1295
1532
  const _seed = opts?.seed;
1296
1533
  void _seed;
1297
1534
  return {
1535
+ op: "count",
1298
1536
  init: () => 0,
1299
1537
  step: (state) => state + 1,
1300
1538
  remove: (state) => state - 1,
@@ -1305,6 +1543,8 @@ function sum(field, opts) {
1305
1543
  const _seed = opts?.seed;
1306
1544
  void _seed;
1307
1545
  return {
1546
+ op: "sum",
1547
+ field,
1308
1548
  init: () => 0,
1309
1549
  step: (state, record) => state + readNumber(record, field),
1310
1550
  remove: (state, record) => state - readNumber(record, field),
@@ -1315,6 +1555,8 @@ function avg(field, opts) {
1315
1555
  const _seed = opts?.seed;
1316
1556
  void _seed;
1317
1557
  return {
1558
+ op: "avg",
1559
+ field,
1318
1560
  init: () => ({ sum: 0, count: 0 }),
1319
1561
  step: (state, record) => ({
1320
1562
  sum: state.sum + readNumber(record, field),
@@ -1341,6 +1583,8 @@ function min(field, opts) {
1341
1583
  const _seed = opts?.seed;
1342
1584
  void _seed;
1343
1585
  return {
1586
+ op: "min",
1587
+ field,
1344
1588
  init: () => ({ values: [] }),
1345
1589
  step: (state, record) => pushValue(state, readNumber(record, field)),
1346
1590
  remove: (state, record) => removeValue(state, readNumber(record, field)),
@@ -1359,6 +1603,8 @@ function max(field, opts) {
1359
1603
  const _seed = opts?.seed;
1360
1604
  void _seed;
1361
1605
  return {
1606
+ op: "max",
1607
+ field,
1362
1608
  init: () => ({ values: [] }),
1363
1609
  step: (state, record) => pushValue(state, readNumber(record, field)),
1364
1610
  remove: (state, record) => removeValue(state, readNumber(record, field)),
@@ -2102,6 +2348,9 @@ function coerceRefKey2(value) {
2102
2348
  0 && (module.exports = {
2103
2349
  Aggregation,
2104
2350
  CollectionIndexes,
2351
+ CrossJoinSourceUnknownError,
2352
+ CrossJoinTooLargeError,
2353
+ DEFAULT_CROSS_JOIN_MAX_ROWS,
2105
2354
  DEFAULT_JOIN_MAX_ROWS,
2106
2355
  DanglingReferenceError,
2107
2356
  GROUPBY_MAX_CARDINALITY,