@noy-db/hub 0.1.0-pre.9 → 0.2.0-pre.1

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 (253) hide show
  1. package/dist/aggregate/index.cjs +91 -36
  2. package/dist/aggregate/index.cjs.map +1 -1
  3. package/dist/aggregate/index.d.cts +2 -2
  4. package/dist/aggregate/index.d.ts +2 -2
  5. package/dist/aggregate/index.js +16 -9
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/blobs/index.cjs.map +1 -1
  8. package/dist/blobs/index.d.cts +6 -6
  9. package/dist/blobs/index.d.ts +6 -6
  10. package/dist/blobs/index.js +4 -4
  11. package/dist/bundle/index.cjs +298 -7
  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 +15 -4
  16. package/dist/{chunk-GOUT6DND.js → chunk-23TTQXVO.js} +173 -91
  17. package/dist/chunk-23TTQXVO.js.map +1 -0
  18. package/dist/{chunk-CIMZBAZB.js → chunk-2AXFIYHT.js} +1 -1
  19. package/dist/chunk-2AXFIYHT.js.map +1 -0
  20. package/dist/chunk-34YSDCDP.js +73 -0
  21. package/dist/chunk-34YSDCDP.js.map +1 -0
  22. package/dist/{chunk-AVVPZ4BC.js → chunk-4TFSM22V.js} +4 -4
  23. package/dist/{chunk-QGZRWRSL.js → chunk-537VFZTR.js} +4 -4
  24. package/dist/{chunk-M62XNWRA.js → chunk-5DWL3JBF.js} +2 -2
  25. package/dist/{chunk-PTVMYYON.js → chunk-5SCJ5UEF.js} +3 -3
  26. package/dist/chunk-5ZGZ6HIZ.js +100 -0
  27. package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
  28. package/dist/chunk-6HPZY4ON.js +291 -0
  29. package/dist/chunk-6HPZY4ON.js.map +1 -0
  30. package/dist/{chunk-EXHNQEV4.js → chunk-7H6DOO3E.js} +239 -11
  31. package/dist/chunk-7H6DOO3E.js.map +1 -0
  32. package/dist/{chunk-ACLDOTNQ.js → chunk-ADQ5MQ54.js} +275 -3
  33. package/dist/chunk-ADQ5MQ54.js.map +1 -0
  34. package/dist/chunk-CBAHB2BF.js +893 -0
  35. package/dist/chunk-CBAHB2BF.js.map +1 -0
  36. package/dist/chunk-DPMFBCV6.js +296 -0
  37. package/dist/chunk-DPMFBCV6.js.map +1 -0
  38. package/dist/chunk-DYBQG5PQ.js +34 -0
  39. package/dist/chunk-DYBQG5PQ.js.map +1 -0
  40. package/dist/{chunk-ZFKD4QMV.js → chunk-DYECX3IX.js} +3 -3
  41. package/dist/chunk-EGQYGYIU.js +51 -0
  42. package/dist/chunk-EGQYGYIU.js.map +1 -0
  43. package/dist/chunk-FCXOFQAJ.js +79 -0
  44. package/dist/chunk-FCXOFQAJ.js.map +1 -0
  45. package/dist/chunk-HB3Z2GCR.js +124 -0
  46. package/dist/chunk-HB3Z2GCR.js.map +1 -0
  47. package/dist/{chunk-SCZXXXU4.js → chunk-I6MX32UC.js} +7 -32
  48. package/dist/chunk-I6MX32UC.js.map +1 -0
  49. package/dist/{chunk-VQBTTTUN.js → chunk-KESP7GOK.js} +4 -4
  50. package/dist/{chunk-VQBTTTUN.js.map → chunk-KESP7GOK.js.map} +1 -1
  51. package/dist/{chunk-NXFEYLVG.js → chunk-MIQHZESA.js} +4 -3
  52. package/dist/{chunk-NXFEYLVG.js.map → chunk-MIQHZESA.js.map} +1 -1
  53. package/dist/chunk-MKSA2V7A.js +19 -0
  54. package/dist/chunk-MKSA2V7A.js.map +1 -0
  55. package/dist/{chunk-M5INGEFC.js → chunk-MRIBLZL3.js} +3 -1
  56. package/dist/chunk-MRIBLZL3.js.map +1 -0
  57. package/dist/{chunk-MDDTIZUO.js → chunk-NIOHFJPJ.js} +6 -6
  58. package/dist/chunk-OMLIZL2P.js +61 -0
  59. package/dist/chunk-OMLIZL2P.js.map +1 -0
  60. package/dist/{chunk-USKYUS74.js → chunk-P7EQ2S5O.js} +2 -2
  61. package/dist/{chunk-WDM5XGGS.js → chunk-PA6R5ZCI.js} +181 -11
  62. package/dist/chunk-PA6R5ZCI.js.map +1 -0
  63. package/dist/chunk-PEULZC6M.js +118 -0
  64. package/dist/chunk-PEULZC6M.js.map +1 -0
  65. package/dist/chunk-RD5LYKD6.js +82 -0
  66. package/dist/chunk-RD5LYKD6.js.map +1 -0
  67. package/dist/chunk-SIZWEV2Y.js +145 -0
  68. package/dist/chunk-SIZWEV2Y.js.map +1 -0
  69. package/dist/{chunk-QAVUREFT.js → chunk-UA4RI7OT.js} +12 -6
  70. package/dist/chunk-UA4RI7OT.js.map +1 -0
  71. package/dist/chunk-UMLVJTYV.js +20 -0
  72. package/dist/chunk-UMLVJTYV.js.map +1 -0
  73. package/dist/chunk-UZXLQCHP.js +53 -0
  74. package/dist/chunk-UZXLQCHP.js.map +1 -0
  75. package/dist/{chunk-2CSJGFCB.js → chunk-VMIO4IXG.js} +5 -5
  76. package/dist/{chunk-MR4424N3.js → chunk-WCA2NROQ.js} +2 -2
  77. package/dist/{chunk-TDR6T5CJ.js → chunk-XGSOTWYX.js} +91 -132
  78. package/dist/chunk-XGSOTWYX.js.map +1 -0
  79. package/dist/{chunk-NPC4LFV5.js → chunk-YMYK7US4.js} +2 -2
  80. package/dist/{chunk-RKJ6OL7K.js → chunk-YS3POABP.js} +1 -1
  81. package/dist/chunk-YS3POABP.js.map +1 -0
  82. package/dist/chunk-Z72JH4KG.js +209 -0
  83. package/dist/chunk-Z72JH4KG.js.map +1 -0
  84. package/dist/{chunk-R36SIKES.js → chunk-ZNOEIM6Y.js} +2 -2
  85. package/dist/consent/index.cjs.map +1 -1
  86. package/dist/consent/index.d.cts +6 -6
  87. package/dist/consent/index.d.ts +6 -6
  88. package/dist/consent/index.js +3 -3
  89. package/dist/{crypto-IVKU7YTT.js → crypto-A7FRXYHC.js} +3 -3
  90. package/dist/{delegation-2DBS2EOH.js → delegation-YBA4X4JN.js} +5 -4
  91. package/dist/derivations/index.cjs +351 -0
  92. package/dist/derivations/index.cjs.map +1 -0
  93. package/dist/derivations/index.d.cts +71 -0
  94. package/dist/derivations/index.d.ts +71 -0
  95. package/dist/derivations/index.js +27 -0
  96. package/dist/{dev-unlock-BdPp68qn.d.ts → dev-unlock-D9s-loPr.d.ts} +1 -1
  97. package/dist/{dev-unlock-Da1B0TIK.d.cts → dev-unlock-DRwVSy2S.d.cts} +1 -1
  98. package/dist/executor-7E3VFGW7.js +11 -0
  99. package/dist/executor-CEWX2FQI.js +8 -0
  100. package/dist/executor-CEWX2FQI.js.map +1 -0
  101. package/dist/executor-X4SQ3ZLC.js +8 -0
  102. package/dist/executor-X4SQ3ZLC.js.map +1 -0
  103. package/dist/fanout-sidecar-VJ52RIEY.js +51 -0
  104. package/dist/fanout-sidecar-VJ52RIEY.js.map +1 -0
  105. package/dist/guards/index.cjs +315 -0
  106. package/dist/guards/index.cjs.map +1 -0
  107. package/dist/guards/index.d.cts +30 -0
  108. package/dist/guards/index.d.ts +30 -0
  109. package/dist/guards/index.js +29 -0
  110. package/dist/guards/index.js.map +1 -0
  111. package/dist/{hash-lsoL3eEW.d.ts → hash-DXXXusyk.d.ts} +1 -1
  112. package/dist/{hash-BEfzPKwo.d.cts → hash-DtRih9MQ.d.cts} +1 -1
  113. package/dist/history/index.cjs +8 -1
  114. package/dist/history/index.cjs.map +1 -1
  115. package/dist/history/index.d.cts +7 -7
  116. package/dist/history/index.d.ts +7 -7
  117. package/dist/history/index.js +6 -6
  118. package/dist/i18n/index.cjs +81 -0
  119. package/dist/i18n/index.cjs.map +1 -1
  120. package/dist/i18n/index.d.cts +6 -6
  121. package/dist/i18n/index.d.ts +6 -6
  122. package/dist/i18n/index.js +19 -6
  123. package/dist/i18n/index.js.map +1 -1
  124. package/dist/{index-8QDuznDr.d.ts → index-4agOpzqd.d.ts} +174 -3
  125. package/dist/{index-6xNpPsxR.d.cts → index-CNwA-B6-.d.ts} +303 -5
  126. package/dist/{index-DJTf9yxn.d.ts → index-CmVgTkqk.d.cts} +303 -5
  127. package/dist/{index-CywCC1qZ.d.cts → index-hdFvZkBP.d.cts} +174 -3
  128. package/dist/index.cjs +5615 -979
  129. package/dist/index.cjs.map +1 -1
  130. package/dist/index.d.cts +207 -16
  131. package/dist/index.d.ts +207 -16
  132. package/dist/index.js +2302 -741
  133. package/dist/index.js.map +1 -1
  134. package/dist/indexing/index.cjs +2 -0
  135. package/dist/indexing/index.cjs.map +1 -1
  136. package/dist/indexing/index.d.cts +3 -3
  137. package/dist/indexing/index.d.ts +3 -3
  138. package/dist/indexing/index.js +4 -4
  139. package/dist/{lazy-builder-CZVLKh0Z.d.cts → lazy-builder-C-rPfWG0.d.cts} +1 -1
  140. package/dist/{lazy-builder-BwEoBQZ9.d.ts → lazy-builder-Rpd-V3jP.d.ts} +1 -1
  141. package/dist/{ledger-QZTTHQAQ.js → ledger-3TXNP47J.js} +6 -6
  142. package/dist/ledger-3TXNP47J.js.map +1 -0
  143. package/dist/materialized-views/index.cjs +837 -0
  144. package/dist/materialized-views/index.cjs.map +1 -0
  145. package/dist/materialized-views/index.d.cts +183 -0
  146. package/dist/materialized-views/index.d.ts +183 -0
  147. package/dist/materialized-views/index.js +45 -0
  148. package/dist/materialized-views/index.js.map +1 -0
  149. package/dist/overlay-views/index.cjs +359 -0
  150. package/dist/overlay-views/index.cjs.map +1 -0
  151. package/dist/overlay-views/index.d.cts +81 -0
  152. package/dist/overlay-views/index.d.ts +81 -0
  153. package/dist/overlay-views/index.js +23 -0
  154. package/dist/overlay-views/index.js.map +1 -0
  155. package/dist/periods/index.cjs +7 -1
  156. package/dist/periods/index.cjs.map +1 -1
  157. package/dist/periods/index.d.cts +6 -6
  158. package/dist/periods/index.d.ts +6 -6
  159. package/dist/periods/index.js +6 -6
  160. package/dist/{predicate-SBHmi6D0.d.cts → predicate-Dnu81tsS.d.cts} +25 -1
  161. package/dist/{predicate-SBHmi6D0.d.ts → predicate-Dnu81tsS.d.ts} +25 -1
  162. package/dist/{public-envelope-6JTACYJV.js → public-envelope-PY6NKFLI.js} +4 -4
  163. package/dist/public-envelope-PY6NKFLI.js.map +1 -0
  164. package/dist/query/index.cjs +302 -124
  165. package/dist/query/index.cjs.map +1 -1
  166. package/dist/query/index.d.cts +3 -3
  167. package/dist/query/index.d.ts +3 -3
  168. package/dist/query/index.js +26 -11
  169. package/dist/read-only-facade-ITU6L7BL.js +7 -0
  170. package/dist/read-only-facade-ITU6L7BL.js.map +1 -0
  171. package/dist/registry-3L3N3PTG.js +10 -0
  172. package/dist/registry-3L3N3PTG.js.map +1 -0
  173. package/dist/registry-O47PUPSY.js +8 -0
  174. package/dist/registry-O47PUPSY.js.map +1 -0
  175. package/dist/registry-RFGGMVNJ.js +7 -0
  176. package/dist/registry-RFGGMVNJ.js.map +1 -0
  177. package/dist/registry-WLLMODKN.js +8 -0
  178. package/dist/registry-WLLMODKN.js.map +1 -0
  179. package/dist/session/index.cjs +7 -1
  180. package/dist/session/index.cjs.map +1 -1
  181. package/dist/session/index.d.cts +7 -7
  182. package/dist/session/index.d.ts +7 -7
  183. package/dist/session/index.js +10 -3
  184. package/dist/session/index.js.map +1 -1
  185. package/dist/shadow/index.cjs.map +1 -1
  186. package/dist/shadow/index.d.cts +6 -6
  187. package/dist/shadow/index.d.ts +6 -6
  188. package/dist/shadow/index.js +2 -2
  189. package/dist/stale-HSC5YO2O.js +13 -0
  190. package/dist/stale-HSC5YO2O.js.map +1 -0
  191. package/dist/store/index.cjs +14 -0
  192. package/dist/store/index.cjs.map +1 -1
  193. package/dist/store/index.d.cts +6 -6
  194. package/dist/store/index.d.ts +6 -6
  195. package/dist/store/index.js +5 -2
  196. package/dist/{strategy-D-SrOLCl.d.cts → strategy-DSTrsZ8t.d.cts} +72 -19
  197. package/dist/{strategy-D-SrOLCl.d.ts → strategy-DSTrsZ8t.d.ts} +72 -19
  198. package/dist/sync/index.cjs.map +1 -1
  199. package/dist/sync/index.d.cts +5 -5
  200. package/dist/sync/index.d.ts +5 -5
  201. package/dist/sync/index.js +4 -4
  202. package/dist/team/index.cjs +1554 -2
  203. package/dist/team/index.cjs.map +1 -1
  204. package/dist/team/index.d.cts +6 -6
  205. package/dist/team/index.d.ts +6 -6
  206. package/dist/team/index.js +76 -9
  207. package/dist/tx/index.cjs +296 -44
  208. package/dist/tx/index.cjs.map +1 -1
  209. package/dist/tx/index.d.cts +6 -6
  210. package/dist/tx/index.d.ts +6 -6
  211. package/dist/tx/index.js +2 -2
  212. package/dist/{types-Bnb82f5R.d.cts → types-C4lwMKKF.d.cts} +2605 -328
  213. package/dist/{types-Bo7NSXJr.d.ts → types-DW9RGSSs.d.ts} +2605 -328
  214. package/dist/util/index.cjs.map +1 -1
  215. package/dist/util/index.js +1 -1
  216. package/dist/with-derivation-C8LDlV7t.d.cts +13 -0
  217. package/dist/with-derivation-g-pGoMzL.d.ts +13 -0
  218. package/dist/with-guard-DWOCK4Ca.d.ts +18 -0
  219. package/dist/with-guard-jI1x9Z3k.d.cts +18 -0
  220. package/dist/with-materialized-view-DaKR-N6J.d.ts +27 -0
  221. package/dist/with-materialized-view-DcTx4H3j.d.cts +27 -0
  222. package/dist/with-overlayed-view-D-6oWAgM.d.cts +13 -0
  223. package/dist/with-overlayed-view-N7jYuNOS.d.ts +13 -0
  224. package/package.json +53 -2
  225. package/dist/chunk-4PWAI7Q4.js +0 -79
  226. package/dist/chunk-4PWAI7Q4.js.map +0 -1
  227. package/dist/chunk-ACLDOTNQ.js.map +0 -1
  228. package/dist/chunk-BTDCBVJW.js +0 -160
  229. package/dist/chunk-BTDCBVJW.js.map +0 -1
  230. package/dist/chunk-CIMZBAZB.js.map +0 -1
  231. package/dist/chunk-EXHNQEV4.js.map +0 -1
  232. package/dist/chunk-GOUT6DND.js.map +0 -1
  233. package/dist/chunk-M5INGEFC.js.map +0 -1
  234. package/dist/chunk-QAVUREFT.js.map +0 -1
  235. package/dist/chunk-RKJ6OL7K.js.map +0 -1
  236. package/dist/chunk-SCZXXXU4.js.map +0 -1
  237. package/dist/chunk-TDR6T5CJ.js.map +0 -1
  238. package/dist/chunk-WDM5XGGS.js.map +0 -1
  239. /package/dist/{chunk-AVVPZ4BC.js.map → chunk-4TFSM22V.js.map} +0 -0
  240. /package/dist/{chunk-QGZRWRSL.js.map → chunk-537VFZTR.js.map} +0 -0
  241. /package/dist/{chunk-M62XNWRA.js.map → chunk-5DWL3JBF.js.map} +0 -0
  242. /package/dist/{chunk-PTVMYYON.js.map → chunk-5SCJ5UEF.js.map} +0 -0
  243. /package/dist/{chunk-ZFKD4QMV.js.map → chunk-DYECX3IX.js.map} +0 -0
  244. /package/dist/{chunk-MDDTIZUO.js.map → chunk-NIOHFJPJ.js.map} +0 -0
  245. /package/dist/{chunk-USKYUS74.js.map → chunk-P7EQ2S5O.js.map} +0 -0
  246. /package/dist/{chunk-2CSJGFCB.js.map → chunk-VMIO4IXG.js.map} +0 -0
  247. /package/dist/{chunk-MR4424N3.js.map → chunk-WCA2NROQ.js.map} +0 -0
  248. /package/dist/{chunk-NPC4LFV5.js.map → chunk-YMYK7US4.js.map} +0 -0
  249. /package/dist/{chunk-R36SIKES.js.map → chunk-ZNOEIM6Y.js.map} +0 -0
  250. /package/dist/{crypto-IVKU7YTT.js.map → crypto-A7FRXYHC.js.map} +0 -0
  251. /package/dist/{delegation-2DBS2EOH.js.map → delegation-YBA4X4JN.js.map} +0 -0
  252. /package/dist/{ledger-QZTTHQAQ.js.map → derivations/index.js.map} +0 -0
  253. /package/dist/{public-envelope-6JTACYJV.js.map → executor-7E3VFGW7.js.map} +0 -0
@@ -1,7 +1,7 @@
1
- export { k as COMPRESSION_BROTLI, l as COMPRESSION_GZIP, m as COMPRESSION_NONE, C as CompressionAlgo, F as FLAG_COMPRESSED, n as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, a as NOYDB_BUNDLE_MAGIC, b as NOYDB_BUNDLE_PREFIX_BYTES, c as NoydbBundleHeader, d as NoydbBundleReadResult, W as WriteNoydbBundleOptions, o as encodeBundleHeader, g as generateULID, i as isULID, r as readNoydbBundle, e as readNoydbBundleHeader, j as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../index-CywCC1qZ.cjs';
2
- import '../types-Bnb82f5R.cjs';
3
- import '../lazy-builder-CZVLKh0Z.cjs';
4
- import '../predicate-SBHmi6D0.cjs';
5
- import '../strategy-D-SrOLCl.cjs';
1
+ export { l as COMPRESSION_BROTLI, m as COMPRESSION_GZIP, n as COMPRESSION_NONE, C as CompressionAlgo, F as FLAG_COMPRESSED, o as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, b as NOYDB_BUNDLE_MAGIC, c as NOYDB_BUNDLE_PREFIX_BYTES, d as NoydbBundleHeader, e as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, p as encodeBundleHeader, g as generateULID, i as isULID, r as readNoydbBundle, f as readNoydbBundleHeader, k as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../index-hdFvZkBP.cjs';
2
+ export { B as BackupCorruptedError, r as BackupLedgerError, s as BundleIntegrityError, t as BundleSealMismatchError, u as BundleVersionConflictError } from '../index-CmVgTkqk.cjs';
3
+ import '../types-C4lwMKKF.cjs';
4
+ import '../lazy-builder-C-rPfWG0.cjs';
5
+ import '../predicate-Dnu81tsS.cjs';
6
+ import '../strategy-DSTrsZ8t.cjs';
6
7
  import '../strategy-BSxFXGzb.cjs';
7
- import '../index-6xNpPsxR.cjs';
@@ -1,7 +1,7 @@
1
- export { k as COMPRESSION_BROTLI, l as COMPRESSION_GZIP, m as COMPRESSION_NONE, C as CompressionAlgo, F as FLAG_COMPRESSED, n as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, a as NOYDB_BUNDLE_MAGIC, b as NOYDB_BUNDLE_PREFIX_BYTES, c as NoydbBundleHeader, d as NoydbBundleReadResult, W as WriteNoydbBundleOptions, o as encodeBundleHeader, g as generateULID, i as isULID, r as readNoydbBundle, e as readNoydbBundleHeader, j as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../index-8QDuznDr.js';
2
- import '../types-Bo7NSXJr.js';
3
- import '../lazy-builder-BwEoBQZ9.js';
4
- import '../predicate-SBHmi6D0.js';
5
- import '../strategy-D-SrOLCl.js';
1
+ export { l as COMPRESSION_BROTLI, m as COMPRESSION_GZIP, n as COMPRESSION_NONE, C as CompressionAlgo, F as FLAG_COMPRESSED, o as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, b as NOYDB_BUNDLE_MAGIC, c as NOYDB_BUNDLE_PREFIX_BYTES, d as NoydbBundleHeader, e as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, p as encodeBundleHeader, g as generateULID, i as isULID, r as readNoydbBundle, f as readNoydbBundleHeader, k as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../index-4agOpzqd.js';
2
+ export { B as BackupCorruptedError, r as BackupLedgerError, s as BundleIntegrityError, t as BundleSealMismatchError, u as BundleVersionConflictError } from '../index-CNwA-B6-.js';
3
+ import '../types-DW9RGSSs.js';
4
+ import '../lazy-builder-Rpd-V3jP.js';
5
+ import '../predicate-Dnu81tsS.js';
6
+ import '../strategy-DSTrsZ8t.js';
6
7
  import '../strategy-BSxFXGzb.js';
7
- import '../index-DJTf9yxn.js';
@@ -13,15 +13,26 @@ import {
13
13
  resetBrotliSupportCache,
14
14
  validateBundleHeader,
15
15
  writeNoydbBundle
16
- } from "../chunk-EXHNQEV4.js";
17
- import "../chunk-PTVMYYON.js";
16
+ } from "../chunk-7H6DOO3E.js";
17
+ import "../chunk-5SCJ5UEF.js";
18
18
  import {
19
19
  generateULID,
20
20
  isULID
21
21
  } from "../chunk-FZU343FL.js";
22
- import "../chunk-RKJ6OL7K.js";
23
- import "../chunk-ACLDOTNQ.js";
22
+ import "../chunk-YS3POABP.js";
23
+ import {
24
+ BackupCorruptedError,
25
+ BackupLedgerError,
26
+ BundleIntegrityError,
27
+ BundleSealMismatchError,
28
+ BundleVersionConflictError
29
+ } from "../chunk-ADQ5MQ54.js";
24
30
  export {
31
+ BackupCorruptedError,
32
+ BackupLedgerError,
33
+ BundleIntegrityError,
34
+ BundleSealMismatchError,
35
+ BundleVersionConflictError,
25
36
  COMPRESSION_BROTLI,
26
37
  COMPRESSION_GZIP,
27
38
  COMPRESSION_NONE,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  evaluateClause,
3
3
  readPath
4
- } from "./chunk-M5INGEFC.js";
4
+ } from "./chunk-MRIBLZL3.js";
5
5
  import {
6
6
  DanglingReferenceError,
7
7
  JoinTooLargeError
8
- } from "./chunk-ACLDOTNQ.js";
8
+ } from "./chunk-ADQ5MQ54.js";
9
9
 
10
10
  // src/query/join.ts
11
11
  var DEFAULT_JOIN_MAX_ROWS = 5e4;
@@ -244,6 +244,9 @@ var NO_AGGREGATE = {
244
244
  groupBy() {
245
245
  throw NOT_ENABLED;
246
246
  },
247
+ groupByN() {
248
+ throw NOT_ENABLED;
249
+ },
247
250
  scanAggregate() {
248
251
  throw NOT_ENABLED;
249
252
  }
@@ -262,11 +265,83 @@ var Query = class _Query {
262
265
  plan;
263
266
  joinContext;
264
267
  aggregateStrategy;
265
- constructor(source, plan = EMPTY_PLAN, joinContext, aggregateStrategy = NO_AGGREGATE) {
268
+ predicates;
269
+ constructor(source, plan = EMPTY_PLAN, joinContext, aggregateStrategy = NO_AGGREGATE, predicates) {
266
270
  this.source = source;
267
271
  this.plan = plan;
268
272
  this.joinContext = joinContext;
269
273
  this.aggregateStrategy = aggregateStrategy;
274
+ this.predicates = predicates;
275
+ }
276
+ /**
277
+ * @internal — accessor for the materialized-view dependency
278
+ * analyzer. Not part of the public API; consumers should use the
279
+ * builder methods, not inspect the plan directly.
280
+ */
281
+ _plan() {
282
+ return this.plan;
283
+ }
284
+ /**
285
+ * @internal — accessor for the materialized-view dependency
286
+ * analyzer. Returns the join resolution context (or `undefined` for
287
+ * queries constructed without a Collection backing).
288
+ */
289
+ _joinContext() {
290
+ return this.joinContext;
291
+ }
292
+ /**
293
+ * @internal — clone this Query with a declared-predicate map
294
+ * attached. Used by the materialized-view registry to enable
295
+ * `.wherePredicate(name, ctx?)` for the MV's query callback (#153).
296
+ * Consumers don't call this directly.
297
+ */
298
+ _withPredicates(predicates) {
299
+ return new _Query(
300
+ this.source,
301
+ this.plan,
302
+ this.joinContext,
303
+ this.aggregateStrategy,
304
+ predicates
305
+ );
306
+ }
307
+ /**
308
+ * Filter by a registered deterministic predicate (#153). Requires
309
+ * the Query to have been augmented with a predicates map (typically
310
+ * via the materialized-view registry — bare Queries constructed
311
+ * outside an MV throw on `.wherePredicate()`).
312
+ *
313
+ * `ctx` is an optional opaque value passed verbatim to the predicate
314
+ * function. Both `predicateHash` (from the registration) and a
315
+ * canonical-JSON hash of `ctx` fold into the MV's `queryHash`, so
316
+ * either changing forces refresh on next visit.
317
+ */
318
+ wherePredicate(name, ctx) {
319
+ if (!this.predicates) {
320
+ throw new Error(
321
+ `.wherePredicate("${name}"): no predicates registered on this Query. Function-based predicates require the Query to be obtained from inside a materialized-view query() callback whose strategy declares \`predicates: { ${name}: { hash, fn } }\`.`
322
+ );
323
+ }
324
+ const decl = this.predicates.get(name);
325
+ if (!decl) {
326
+ throw new Error(
327
+ `.wherePredicate("${name}"): predicate not registered. Available: ${[...this.predicates.keys()].join(", ") || "(none)"}.`
328
+ );
329
+ }
330
+ const clause = {
331
+ type: "wherePredicate",
332
+ name,
333
+ ctx,
334
+ predicateHash: decl.hash,
335
+ ctxHash: canonicalCtxHash(ctx),
336
+ fn: decl.fn
337
+ };
338
+ return new _Query(
339
+ this.source,
340
+ { ...this.plan, clauses: [...this.plan.clauses, clause] },
341
+ this.joinContext,
342
+ this.aggregateStrategy,
343
+ this.predicates
344
+ );
270
345
  }
271
346
  /** Add a field comparison. Multiple where() calls are AND-combined. */
272
347
  where(field, op, value) {
@@ -275,7 +350,8 @@ var Query = class _Query {
275
350
  this.source,
276
351
  { ...this.plan, clauses: [...this.plan.clauses, clause] },
277
352
  this.joinContext,
278
- this.aggregateStrategy
353
+ this.aggregateStrategy,
354
+ this.predicates
279
355
  );
280
356
  }
281
357
  /**
@@ -285,7 +361,7 @@ var Query = class _Query {
285
361
  */
286
362
  or(builder) {
287
363
  const sub = builder(
288
- new _Query(this.source, EMPTY_PLAN, this.joinContext, this.aggregateStrategy)
364
+ new _Query(this.source, EMPTY_PLAN, this.joinContext, this.aggregateStrategy, this.predicates)
289
365
  );
290
366
  const group = {
291
367
  type: "group",
@@ -296,7 +372,8 @@ var Query = class _Query {
296
372
  this.source,
297
373
  { ...this.plan, clauses: [...this.plan.clauses, group] },
298
374
  this.joinContext,
299
- this.aggregateStrategy
375
+ this.aggregateStrategy,
376
+ this.predicates
300
377
  );
301
378
  }
302
379
  /**
@@ -305,7 +382,7 @@ var Query = class _Query {
305
382
  */
306
383
  and(builder) {
307
384
  const sub = builder(
308
- new _Query(this.source, EMPTY_PLAN, this.joinContext, this.aggregateStrategy)
385
+ new _Query(this.source, EMPTY_PLAN, this.joinContext, this.aggregateStrategy, this.predicates)
309
386
  );
310
387
  const group = {
311
388
  type: "group",
@@ -316,7 +393,8 @@ var Query = class _Query {
316
393
  this.source,
317
394
  { ...this.plan, clauses: [...this.plan.clauses, group] },
318
395
  this.joinContext,
319
- this.aggregateStrategy
396
+ this.aggregateStrategy,
397
+ this.predicates
320
398
  );
321
399
  }
322
400
  /** Escape hatch: add an arbitrary predicate function. Not serializable. */
@@ -329,7 +407,8 @@ var Query = class _Query {
329
407
  this.source,
330
408
  { ...this.plan, clauses: [...this.plan.clauses, clause] },
331
409
  this.joinContext,
332
- this.aggregateStrategy
410
+ this.aggregateStrategy,
411
+ this.predicates
333
412
  );
334
413
  }
335
414
  /** Sort by a field. Subsequent calls are tie-breakers. */
@@ -338,7 +417,8 @@ var Query = class _Query {
338
417
  this.source,
339
418
  { ...this.plan, orderBy: [...this.plan.orderBy, { field, direction }] },
340
419
  this.joinContext,
341
- this.aggregateStrategy
420
+ this.aggregateStrategy,
421
+ this.predicates
342
422
  );
343
423
  }
344
424
  /** Cap the result size. */
@@ -347,7 +427,8 @@ var Query = class _Query {
347
427
  this.source,
348
428
  { ...this.plan, limit: n },
349
429
  this.joinContext,
350
- this.aggregateStrategy
430
+ this.aggregateStrategy,
431
+ this.predicates
351
432
  );
352
433
  }
353
434
  /** Skip the first N matching records (after ordering). */
@@ -356,7 +437,8 @@ var Query = class _Query {
356
437
  this.source,
357
438
  { ...this.plan, offset: n },
358
439
  this.joinContext,
359
- this.aggregateStrategy
440
+ this.aggregateStrategy,
441
+ this.predicates
360
442
  );
361
443
  }
362
444
  /**
@@ -455,7 +537,8 @@ var Query = class _Query {
455
537
  this.source,
456
538
  { ...this.plan, joins: [...this.plan.joins, leg] },
457
539
  this.joinContext,
458
- this.aggregateStrategy
540
+ this.aggregateStrategy,
541
+ this.predicates
459
542
  );
460
543
  }
461
544
  /**
@@ -547,53 +630,10 @@ var Query = class _Query {
547
630
  }
548
631
  return this.aggregateStrategy.aggregate(executeRecords, spec, upstreams);
549
632
  }
550
- /**
551
- * Partition matching records into buckets keyed by a field, then
552
- * terminate with `.aggregate(spec)` to compute per-bucket
553
- * reducers..
554
- *
555
- * ```ts
556
- * const byClient = invoices.query()
557
- * .where('status', '==', 'open')
558
- * .groupBy('clientId')
559
- * .aggregate({ total: sum('amount'), n: count() })
560
- * .run()
561
- * // → [ { clientId: 'c1', total: 5250, n: 3 }, … ]
562
- * ```
563
- *
564
- * Result rows carry the group key value under the grouping field
565
- * name plus every reducer output from the spec. Buckets are
566
- * emitted in first-seen order — consumers who want a specific
567
- * ordering should `.sort()` downstream.
568
- *
569
- * **Cardinality caps:** a one-shot warning fires at 10_000
570
- * distinct groups; `GroupCardinalityError` throws at 100_000.
571
- * Grouping on a high-uniqueness field like `id` or `createdAt` is
572
- * almost always a query mistake — the error message names the
573
- * field and observed cardinality and suggests narrowing with
574
- * `.where()` first.
575
- *
576
- * **Null / undefined keys:** records with a missing or explicitly
577
- * `null` group field get their own buckets. `Map`-based
578
- * partitioning distinguishes `undefined` from `null`, so the two
579
- * cases do NOT merge. Consumers who want them merged should
580
- * coalesce upstream with `.filter()`.
581
- *
582
- * **Joins are not applied** — same rationale as `.count()` and
583
- * `.aggregate()`. Joined fields in are projection-only, so
584
- * running a join inside a grouping pipeline would be wasteful and
585
- * could trigger `DanglingReferenceError` in strict mode for a
586
- * call whose intent is purely to bucket-and-reduce. Grouping by
587
- * a joined field is explicitly out of scope for — file an
588
- * issue if a real consumer needs it.
589
- *
590
- * **Filter clauses (`.filter(fn)`):** grouped queries still
591
- * support filter clauses in the underlying plan — they run in
592
- * the same candidate/filter pipeline that `.aggregate()` uses.
593
- * The performance caveat is the same: filter clauses cost O(N)
594
- * per record and can't be index-accelerated.
595
- */
596
- groupBy(field) {
633
+ groupBy(...fields) {
634
+ if (fields.length === 0) {
635
+ throw new Error(".groupBy() requires at least one field");
636
+ }
597
637
  const source = this.source;
598
638
  const clauses = this.plan.clauses;
599
639
  const executeRecords = () => {
@@ -605,36 +645,21 @@ var Query = class _Query {
605
645
  const subscribe = source.subscribe.bind(source);
606
646
  upstreams.push({ subscribe: (cb) => subscribe(cb) });
607
647
  }
608
- const joinCtx = this.joinContext;
609
- const dictLabelResolver = joinCtx?.resolveDictSource ? (() => {
610
- const dictSource = joinCtx.resolveDictSource(field);
611
- if (!dictSource) return void 0;
612
- const snapshot = dictSource.snapshot();
613
- const dictMap = /* @__PURE__ */ new Map();
614
- for (const entry of snapshot) {
615
- const k = entry["key"];
616
- const labels = entry["labels"];
617
- if (typeof k === "string" && labels && typeof labels === "object") {
618
- dictMap.set(k, labels);
619
- }
620
- }
621
- return async (key, locale, fallback) => {
622
- const labels = dictMap.get(key);
623
- if (!labels) return void 0;
624
- if (labels[locale] !== void 0) return labels[locale];
625
- const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
626
- for (const fb of chain) {
627
- if (fb === "any") {
628
- const any = Object.values(labels)[0];
629
- if (any !== void 0) return any;
630
- } else if (labels[fb] !== void 0) {
631
- return labels[fb];
632
- }
633
- }
634
- return void 0;
635
- };
636
- })() : void 0;
637
- return this.aggregateStrategy.groupBy(executeRecords, field, upstreams, dictLabelResolver);
648
+ if (fields.length === 1) {
649
+ const field = fields[0];
650
+ const dictLabelResolver = buildDictLabelResolver(this.joinContext, field);
651
+ return this.aggregateStrategy.groupBy(
652
+ executeRecords,
653
+ field,
654
+ upstreams,
655
+ dictLabelResolver
656
+ );
657
+ }
658
+ return this.aggregateStrategy.groupByN(
659
+ executeRecords,
660
+ fields,
661
+ upstreams
662
+ );
638
663
  }
639
664
  /**
640
665
  * Re-run the query whenever the source notifies of changes.
@@ -860,6 +885,16 @@ function serializeClause(clause) {
860
885
  if (clause.type === "filter") {
861
886
  return { type: "filter", fn: "[function]" };
862
887
  }
888
+ if (clause.type === "wherePredicate") {
889
+ return {
890
+ type: "wherePredicate",
891
+ name: clause.name,
892
+ ctx: clause.ctx,
893
+ predicateHash: clause.predicateHash,
894
+ ctxHash: clause.ctxHash,
895
+ fn: "[function]"
896
+ };
897
+ }
863
898
  if (clause.type === "group") {
864
899
  return {
865
900
  type: "group",
@@ -869,6 +904,53 @@ function serializeClause(clause) {
869
904
  }
870
905
  return clause;
871
906
  }
907
+ function canonicalCtxHash(ctx) {
908
+ if (ctx === void 0) return "";
909
+ const canonical = JSON.stringify(ctx, (_key, value) => {
910
+ if (value && typeof value === "object" && !Array.isArray(value)) {
911
+ const sorted = {};
912
+ for (const k of Object.keys(value).sort()) {
913
+ sorted[k] = value[k];
914
+ }
915
+ return sorted;
916
+ }
917
+ return value;
918
+ });
919
+ let h = 5381;
920
+ for (let i = 0; i < canonical.length; i++) {
921
+ h = (h << 5) + h ^ canonical.charCodeAt(i);
922
+ }
923
+ return (h >>> 0).toString(16).padStart(8, "0");
924
+ }
925
+ function buildDictLabelResolver(joinCtx, field) {
926
+ if (!joinCtx?.resolveDictSource) return void 0;
927
+ const dictSource = joinCtx.resolveDictSource(field);
928
+ if (!dictSource) return void 0;
929
+ const snapshot = dictSource.snapshot();
930
+ const dictMap = /* @__PURE__ */ new Map();
931
+ for (const entry of snapshot) {
932
+ const k = entry["key"];
933
+ const labels = entry["labels"];
934
+ if (typeof k === "string" && labels && typeof labels === "object") {
935
+ dictMap.set(k, labels);
936
+ }
937
+ }
938
+ return async (key, locale, fallback) => {
939
+ const labels = dictMap.get(key);
940
+ if (!labels) return void 0;
941
+ if (labels[locale] !== void 0) return labels[locale];
942
+ const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
943
+ for (const fb of chain) {
944
+ if (fb === "any") {
945
+ const any = Object.values(labels)[0];
946
+ if (any !== void 0) return any;
947
+ } else if (labels[fb] !== void 0) {
948
+ return labels[fb];
949
+ }
950
+ }
951
+ return void 0;
952
+ };
953
+ }
872
954
 
873
955
  // src/query/scan-builder.ts
874
956
  var DEFAULT_SCAN_PAGE_SIZE = 100;
@@ -1282,4 +1364,4 @@ export {
1282
1364
  executePlan,
1283
1365
  ScanBuilder
1284
1366
  };
1285
- //# sourceMappingURL=chunk-GOUT6DND.js.map
1367
+ //# sourceMappingURL=chunk-23TTQXVO.js.map