@noy-db/hub 0.1.0-pre.8 → 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.
- package/dist/aggregate/index.cjs +91 -36
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +2 -2
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/aggregate/index.js +16 -9
- package/dist/aggregate/index.js.map +1 -1
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/blobs/index.js +4 -4
- package/dist/bundle/index.cjs +298 -7
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +6 -6
- package/dist/bundle/index.d.ts +6 -6
- package/dist/bundle/index.js +15 -4
- package/dist/{chunk-GOUT6DND.js → chunk-23TTQXVO.js} +173 -91
- package/dist/chunk-23TTQXVO.js.map +1 -0
- package/dist/{chunk-CIMZBAZB.js → chunk-2AXFIYHT.js} +1 -1
- package/dist/chunk-2AXFIYHT.js.map +1 -0
- package/dist/chunk-34YSDCDP.js +73 -0
- package/dist/chunk-34YSDCDP.js.map +1 -0
- package/dist/{chunk-HC7Z5EQZ.js → chunk-4TFSM22V.js} +4 -4
- package/dist/{chunk-7XBQS42M.js → chunk-537VFZTR.js} +4 -4
- package/dist/{chunk-M62XNWRA.js → chunk-5DWL3JBF.js} +2 -2
- package/dist/{chunk-RSPLI376.js → chunk-5SCJ5UEF.js} +3 -3
- package/dist/chunk-5ZGZ6HIZ.js +100 -0
- package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
- package/dist/chunk-6HPZY4ON.js +291 -0
- package/dist/chunk-6HPZY4ON.js.map +1 -0
- package/dist/{chunk-WN6UK7PM.js → chunk-7H6DOO3E.js} +239 -11
- package/dist/chunk-7H6DOO3E.js.map +1 -0
- package/dist/{chunk-ACLDOTNQ.js → chunk-ADQ5MQ54.js} +275 -3
- package/dist/chunk-ADQ5MQ54.js.map +1 -0
- package/dist/chunk-CBAHB2BF.js +893 -0
- package/dist/chunk-CBAHB2BF.js.map +1 -0
- package/dist/chunk-DPMFBCV6.js +296 -0
- package/dist/chunk-DPMFBCV6.js.map +1 -0
- package/dist/chunk-DYBQG5PQ.js +34 -0
- package/dist/chunk-DYBQG5PQ.js.map +1 -0
- package/dist/{chunk-ZFKD4QMV.js → chunk-DYECX3IX.js} +3 -3
- package/dist/chunk-EGQYGYIU.js +51 -0
- package/dist/chunk-EGQYGYIU.js.map +1 -0
- package/dist/chunk-FCXOFQAJ.js +79 -0
- package/dist/chunk-FCXOFQAJ.js.map +1 -0
- package/dist/chunk-HB3Z2GCR.js +124 -0
- package/dist/chunk-HB3Z2GCR.js.map +1 -0
- package/dist/{chunk-SCZXXXU4.js → chunk-I6MX32UC.js} +7 -32
- package/dist/chunk-I6MX32UC.js.map +1 -0
- package/dist/{chunk-VQBTTTUN.js → chunk-KESP7GOK.js} +4 -4
- package/dist/{chunk-VQBTTTUN.js.map → chunk-KESP7GOK.js.map} +1 -1
- package/dist/{chunk-NXFEYLVG.js → chunk-MIQHZESA.js} +4 -3
- package/dist/{chunk-NXFEYLVG.js.map → chunk-MIQHZESA.js.map} +1 -1
- package/dist/chunk-MKSA2V7A.js +19 -0
- package/dist/chunk-MKSA2V7A.js.map +1 -0
- package/dist/{chunk-M5INGEFC.js → chunk-MRIBLZL3.js} +3 -1
- package/dist/chunk-MRIBLZL3.js.map +1 -0
- package/dist/{chunk-2WGMYBYS.js → chunk-NIOHFJPJ.js} +6 -6
- package/dist/chunk-OMLIZL2P.js +61 -0
- package/dist/chunk-OMLIZL2P.js.map +1 -0
- package/dist/{chunk-USKYUS74.js → chunk-P7EQ2S5O.js} +2 -2
- package/dist/{chunk-YVFTBQHL.js → chunk-PA6R5ZCI.js} +217 -10
- package/dist/chunk-PA6R5ZCI.js.map +1 -0
- package/dist/chunk-PEULZC6M.js +118 -0
- package/dist/chunk-PEULZC6M.js.map +1 -0
- package/dist/chunk-RD5LYKD6.js +82 -0
- package/dist/chunk-RD5LYKD6.js.map +1 -0
- package/dist/chunk-SIZWEV2Y.js +145 -0
- package/dist/chunk-SIZWEV2Y.js.map +1 -0
- package/dist/{chunk-Y4CMTMUW.js → chunk-UA4RI7OT.js} +12 -6
- package/dist/chunk-UA4RI7OT.js.map +1 -0
- package/dist/chunk-UMLVJTYV.js +20 -0
- package/dist/chunk-UMLVJTYV.js.map +1 -0
- package/dist/chunk-UZXLQCHP.js +53 -0
- package/dist/chunk-UZXLQCHP.js.map +1 -0
- package/dist/{chunk-R2ZTGEVP.js → chunk-VMIO4IXG.js} +5 -5
- package/dist/{chunk-MR4424N3.js → chunk-WCA2NROQ.js} +2 -2
- package/dist/{chunk-TDR6T5CJ.js → chunk-XGSOTWYX.js} +91 -132
- package/dist/chunk-XGSOTWYX.js.map +1 -0
- package/dist/{chunk-NPC4LFV5.js → chunk-YMYK7US4.js} +2 -2
- package/dist/{chunk-PJK6IOBC.js → chunk-YS3POABP.js} +1 -1
- package/dist/chunk-YS3POABP.js.map +1 -0
- package/dist/chunk-Z72JH4KG.js +209 -0
- package/dist/chunk-Z72JH4KG.js.map +1 -0
- package/dist/{chunk-R36SIKES.js → chunk-ZNOEIM6Y.js} +2 -2
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-IVKU7YTT.js → crypto-A7FRXYHC.js} +3 -3
- package/dist/{delegation-2DBS2EOH.js → delegation-YBA4X4JN.js} +5 -4
- package/dist/derivations/index.cjs +351 -0
- package/dist/derivations/index.cjs.map +1 -0
- package/dist/derivations/index.d.cts +71 -0
- package/dist/derivations/index.d.ts +71 -0
- package/dist/derivations/index.js +27 -0
- package/dist/{dev-unlock-BygpnIWe.d.ts → dev-unlock-D9s-loPr.d.ts} +1 -1
- package/dist/{dev-unlock-BZKx666y.d.cts → dev-unlock-DRwVSy2S.d.cts} +1 -1
- package/dist/executor-7E3VFGW7.js +11 -0
- package/dist/executor-CEWX2FQI.js +8 -0
- package/dist/executor-CEWX2FQI.js.map +1 -0
- package/dist/executor-X4SQ3ZLC.js +8 -0
- package/dist/executor-X4SQ3ZLC.js.map +1 -0
- package/dist/fanout-sidecar-VJ52RIEY.js +51 -0
- package/dist/fanout-sidecar-VJ52RIEY.js.map +1 -0
- package/dist/guards/index.cjs +315 -0
- package/dist/guards/index.cjs.map +1 -0
- package/dist/guards/index.d.cts +30 -0
- package/dist/guards/index.d.ts +30 -0
- package/dist/guards/index.js +29 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/{hash-B0eU2Qv9.d.ts → hash-DXXXusyk.d.ts} +1 -1
- package/dist/{hash-CIyfmKsg.d.cts → hash-DtRih9MQ.d.cts} +1 -1
- package/dist/history/index.cjs +8 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +7 -7
- package/dist/history/index.d.ts +7 -7
- package/dist/history/index.js +6 -6
- package/dist/i18n/index.cjs +81 -0
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +6 -6
- package/dist/i18n/index.d.ts +6 -6
- package/dist/i18n/index.js +19 -6
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-Dp4tKCjX.d.ts → index-4agOpzqd.d.ts} +174 -3
- package/dist/{index-6xNpPsxR.d.cts → index-CNwA-B6-.d.ts} +303 -5
- package/dist/{index-DJTf9yxn.d.ts → index-CmVgTkqk.d.cts} +303 -5
- package/dist/{index-DsVbTDZI.d.cts → index-hdFvZkBP.d.cts} +174 -3
- package/dist/index.cjs +5929 -1089
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +207 -16
- package/dist/index.d.ts +207 -16
- package/dist/index.js +2402 -672
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +2 -0
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.d.cts +3 -3
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +4 -4
- package/dist/{lazy-builder-CZVLKh0Z.d.cts → lazy-builder-C-rPfWG0.d.cts} +1 -1
- package/dist/{lazy-builder-BwEoBQZ9.d.ts → lazy-builder-Rpd-V3jP.d.ts} +1 -1
- package/dist/{ledger-UQIMMKO5.js → ledger-3TXNP47J.js} +6 -6
- package/dist/ledger-3TXNP47J.js.map +1 -0
- package/dist/materialized-views/index.cjs +837 -0
- package/dist/materialized-views/index.cjs.map +1 -0
- package/dist/materialized-views/index.d.cts +183 -0
- package/dist/materialized-views/index.d.ts +183 -0
- package/dist/materialized-views/index.js +45 -0
- package/dist/materialized-views/index.js.map +1 -0
- package/dist/overlay-views/index.cjs +359 -0
- package/dist/overlay-views/index.cjs.map +1 -0
- package/dist/overlay-views/index.d.cts +81 -0
- package/dist/overlay-views/index.d.ts +81 -0
- package/dist/overlay-views/index.js +23 -0
- package/dist/overlay-views/index.js.map +1 -0
- package/dist/periods/index.cjs +7 -1
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +6 -6
- package/dist/periods/index.d.ts +6 -6
- package/dist/periods/index.js +6 -6
- package/dist/{predicate-SBHmi6D0.d.cts → predicate-Dnu81tsS.d.cts} +25 -1
- package/dist/{predicate-SBHmi6D0.d.ts → predicate-Dnu81tsS.d.ts} +25 -1
- package/dist/{public-envelope-3QTQADDW.js → public-envelope-PY6NKFLI.js} +4 -4
- package/dist/public-envelope-PY6NKFLI.js.map +1 -0
- package/dist/query/index.cjs +302 -124
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +26 -11
- package/dist/read-only-facade-ITU6L7BL.js +7 -0
- package/dist/read-only-facade-ITU6L7BL.js.map +1 -0
- package/dist/registry-3L3N3PTG.js +10 -0
- package/dist/registry-3L3N3PTG.js.map +1 -0
- package/dist/registry-O47PUPSY.js +8 -0
- package/dist/registry-O47PUPSY.js.map +1 -0
- package/dist/registry-RFGGMVNJ.js +7 -0
- package/dist/registry-RFGGMVNJ.js.map +1 -0
- package/dist/registry-WLLMODKN.js +8 -0
- package/dist/registry-WLLMODKN.js.map +1 -0
- package/dist/session/index.cjs +7 -1
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +7 -7
- package/dist/session/index.d.ts +7 -7
- package/dist/session/index.js +10 -3
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +6 -6
- package/dist/shadow/index.d.ts +6 -6
- package/dist/shadow/index.js +2 -2
- package/dist/stale-HSC5YO2O.js +13 -0
- package/dist/stale-HSC5YO2O.js.map +1 -0
- package/dist/store/index.cjs +14 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +6 -6
- package/dist/store/index.d.ts +6 -6
- package/dist/store/index.js +5 -2
- package/dist/{strategy-D-SrOLCl.d.cts → strategy-DSTrsZ8t.d.cts} +72 -19
- package/dist/{strategy-D-SrOLCl.d.ts → strategy-DSTrsZ8t.d.ts} +72 -19
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +5 -5
- package/dist/sync/index.d.ts +5 -5
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs +1554 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +6 -6
- package/dist/team/index.d.ts +6 -6
- package/dist/team/index.js +76 -9
- package/dist/tx/index.cjs +296 -44
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +6 -6
- package/dist/tx/index.d.ts +6 -6
- package/dist/tx/index.js +2 -2
- package/dist/{types-DD9eKKNc.d.ts → types-C4lwMKKF.d.cts} +2771 -322
- package/dist/{types-arFMsCtn.d.cts → types-DW9RGSSs.d.ts} +2771 -322
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/with-derivation-C8LDlV7t.d.cts +13 -0
- package/dist/with-derivation-g-pGoMzL.d.ts +13 -0
- package/dist/with-guard-DWOCK4Ca.d.ts +18 -0
- package/dist/with-guard-jI1x9Z3k.d.cts +18 -0
- package/dist/with-materialized-view-DaKR-N6J.d.ts +27 -0
- package/dist/with-materialized-view-DcTx4H3j.d.cts +27 -0
- package/dist/with-overlayed-view-D-6oWAgM.d.cts +13 -0
- package/dist/with-overlayed-view-N7jYuNOS.d.ts +13 -0
- package/package.json +53 -2
- package/dist/chunk-ACLDOTNQ.js.map +0 -1
- package/dist/chunk-BTDCBVJW.js +0 -160
- package/dist/chunk-BTDCBVJW.js.map +0 -1
- package/dist/chunk-CIMZBAZB.js.map +0 -1
- package/dist/chunk-GOUT6DND.js.map +0 -1
- package/dist/chunk-M5INGEFC.js.map +0 -1
- package/dist/chunk-PJK6IOBC.js.map +0 -1
- package/dist/chunk-SCZXXXU4.js.map +0 -1
- package/dist/chunk-TDR6T5CJ.js.map +0 -1
- package/dist/chunk-TOQK4KAN.js +0 -79
- package/dist/chunk-TOQK4KAN.js.map +0 -1
- package/dist/chunk-WN6UK7PM.js.map +0 -1
- package/dist/chunk-Y4CMTMUW.js.map +0 -1
- package/dist/chunk-YVFTBQHL.js.map +0 -1
- /package/dist/{chunk-HC7Z5EQZ.js.map → chunk-4TFSM22V.js.map} +0 -0
- /package/dist/{chunk-7XBQS42M.js.map → chunk-537VFZTR.js.map} +0 -0
- /package/dist/{chunk-M62XNWRA.js.map → chunk-5DWL3JBF.js.map} +0 -0
- /package/dist/{chunk-RSPLI376.js.map → chunk-5SCJ5UEF.js.map} +0 -0
- /package/dist/{chunk-ZFKD4QMV.js.map → chunk-DYECX3IX.js.map} +0 -0
- /package/dist/{chunk-2WGMYBYS.js.map → chunk-NIOHFJPJ.js.map} +0 -0
- /package/dist/{chunk-USKYUS74.js.map → chunk-P7EQ2S5O.js.map} +0 -0
- /package/dist/{chunk-R2ZTGEVP.js.map → chunk-VMIO4IXG.js.map} +0 -0
- /package/dist/{chunk-MR4424N3.js.map → chunk-WCA2NROQ.js.map} +0 -0
- /package/dist/{chunk-NPC4LFV5.js.map → chunk-YMYK7US4.js.map} +0 -0
- /package/dist/{chunk-R36SIKES.js.map → chunk-ZNOEIM6Y.js.map} +0 -0
- /package/dist/{crypto-IVKU7YTT.js.map → crypto-A7FRXYHC.js.map} +0 -0
- /package/dist/{delegation-2DBS2EOH.js.map → delegation-YBA4X4JN.js.map} +0 -0
- /package/dist/{ledger-UQIMMKO5.js.map → derivations/index.js.map} +0 -0
- /package/dist/{public-envelope-3QTQADDW.js.map → executor-7E3VFGW7.js.map} +0 -0
package/dist/bundle/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
import '../
|
|
4
|
-
import '../
|
|
5
|
-
import '../
|
|
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';
|
package/dist/bundle/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
import '../
|
|
4
|
-
import '../
|
|
5
|
-
import '../
|
|
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';
|
package/dist/bundle/index.js
CHANGED
|
@@ -13,15 +13,26 @@ import {
|
|
|
13
13
|
resetBrotliSupportCache,
|
|
14
14
|
validateBundleHeader,
|
|
15
15
|
writeNoydbBundle
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
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-
|
|
23
|
-
import
|
|
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-
|
|
4
|
+
} from "./chunk-MRIBLZL3.js";
|
|
5
5
|
import {
|
|
6
6
|
DanglingReferenceError,
|
|
7
7
|
JoinTooLargeError
|
|
8
|
-
} from "./chunk-
|
|
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
|
-
|
|
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
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
-
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
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-
|
|
1367
|
+
//# sourceMappingURL=chunk-23TTQXVO.js.map
|