@noy-db/hub 0.1.0-pre.14 → 0.1.0-pre.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +15 -8
- package/dist/aggregate/index.js.map +1 -1
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +5 -4
- package/dist/blobs/index.d.ts +5 -4
- package/dist/blobs/index.js +4 -4
- package/dist/bundle/index.cjs +214 -7
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +5 -4
- package/dist/bundle/index.d.ts +5 -4
- package/dist/bundle/index.js +6 -4
- package/dist/{chunk-CX2S2IBB.js → chunk-23TTQXVO.js} +53 -79
- package/dist/chunk-23TTQXVO.js.map +1 -0
- package/dist/{chunk-WLZWITX3.js → chunk-2AXFIYHT.js} +1 -1
- package/dist/chunk-2AXFIYHT.js.map +1 -0
- package/dist/{chunk-SBOSKCXD.js → chunk-2R6G2WST.js} +209 -13
- package/dist/chunk-2R6G2WST.js.map +1 -0
- package/dist/{chunk-HENWE2QQ.js → chunk-34YSDCDP.js} +2 -2
- package/dist/{chunk-3J5PYYUL.js → chunk-5DWL3JBF.js} +2 -2
- package/dist/{chunk-562AT3V6.js → chunk-5NGHX6ME.js} +5 -5
- package/dist/chunk-5ZGZ6HIZ.js +100 -0
- package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
- package/dist/{chunk-ZJICDHNH.js → chunk-6HPZY4ON.js} +5 -4
- package/dist/chunk-6HPZY4ON.js.map +1 -0
- package/dist/{chunk-LTKFPLTW.js → chunk-A3K2ECAM.js} +192 -11
- package/dist/chunk-A3K2ECAM.js.map +1 -0
- package/dist/{chunk-W7M3E5M5.js → chunk-ADQ5MQ54.js} +48 -1
- package/dist/{chunk-W7M3E5M5.js.map → chunk-ADQ5MQ54.js.map} +1 -1
- package/dist/{chunk-Q3OWJPJI.js → chunk-DPMFBCV6.js} +32 -19
- package/dist/chunk-DPMFBCV6.js.map +1 -0
- package/dist/{chunk-AD4FMCXZ.js → chunk-DYBQG5PQ.js} +2 -2
- package/dist/{chunk-PNTWORBA.js → chunk-DYECX3IX.js} +2 -2
- package/dist/chunk-EGQYGYIU.js +51 -0
- package/dist/chunk-EGQYGYIU.js.map +1 -0
- package/dist/{chunk-RGHN6WV7.js → chunk-FCXOFQAJ.js} +2 -2
- package/dist/{chunk-PMMNH7VZ.js → chunk-H7XROQJM.js} +1 -1
- package/dist/chunk-H7XROQJM.js.map +1 -0
- package/dist/chunk-HB3Z2GCR.js +124 -0
- package/dist/chunk-HB3Z2GCR.js.map +1 -0
- package/dist/{chunk-CRNMA2FB.js → chunk-I6MX32UC.js} +4 -4
- package/dist/{chunk-PHSGPPV7.js → chunk-KESP7GOK.js} +3 -3
- package/dist/{chunk-FB34MDSJ.js → chunk-KJJKHKFP.js} +4 -4
- package/dist/{chunk-J3E2UMET.js → chunk-MIQHZESA.js} +3 -3
- package/dist/{chunk-TNYWH7Z2.js → chunk-MKSA2V7A.js} +2 -2
- package/dist/{chunk-E4ZSYZSN.js → chunk-NVBUGT76.js} +4 -4
- package/dist/{chunk-XFVOTOYQ.js → chunk-O4RHR7FV.js} +6 -6
- package/dist/{chunk-EEEFQTYN.js → chunk-OMLIZL2P.js} +2 -2
- package/dist/{chunk-GVPFL6XF.js → chunk-P7EQ2S5O.js} +2 -2
- package/dist/{chunk-E3VAKWJ7.js → chunk-QQUUAXDY.js} +7 -6
- package/dist/chunk-QQUUAXDY.js.map +1 -0
- package/dist/chunk-RD5LYKD6.js +82 -0
- package/dist/chunk-RD5LYKD6.js.map +1 -0
- package/dist/{chunk-7QGJ7RTL.js → chunk-RRMDLTIL.js} +4 -4
- package/dist/{chunk-432R4RDC.js → chunk-SIZWEV2Y.js} +35 -5
- package/dist/chunk-SIZWEV2Y.js.map +1 -0
- package/dist/{chunk-U7YDBNFC.js → chunk-UZXLQCHP.js} +2 -2
- package/dist/{chunk-PPJA7KL6.js → chunk-V6SGP2KX.js} +3 -3
- package/dist/{chunk-7AQKLLI5.js → chunk-WCA2NROQ.js} +2 -2
- package/dist/{chunk-ERV4AXVO.js → chunk-XGSOTWYX.js} +90 -131
- package/dist/chunk-XGSOTWYX.js.map +1 -0
- package/dist/{chunk-5Y4AKEZ6.js → chunk-Z72JH4KG.js} +2 -2
- package/dist/{chunk-IXFP66OV.js → chunk-ZNOEIM6Y.js} +2 -2
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +5 -4
- package/dist/consent/index.d.ts +5 -4
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-VTEMMJK6.js → crypto-A7FRXYHC.js} +3 -3
- package/dist/{delegation-HYQULPZR.js → delegation-YBA4X4JN.js} +5 -5
- package/dist/derivations/index.cjs +97 -1
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +37 -10
- package/dist/derivations/index.d.ts +37 -10
- package/dist/derivations/index.js +6 -4
- package/dist/{dev-unlock-CpJ9rHW2.d.ts → dev-unlock-C8u6MRfS.d.ts} +1 -1
- package/dist/{dev-unlock-DEUUpWoR.d.cts → dev-unlock-gBjwzB6A.d.cts} +1 -1
- package/dist/executor-7E3VFGW7.js +11 -0
- package/dist/executor-CEWX2FQI.js +8 -0
- package/dist/executor-X4SQ3ZLC.js +8 -0
- package/dist/fanout-sidecar-ACJNXFU6.js +51 -0
- package/dist/fanout-sidecar-ACJNXFU6.js.map +1 -0
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +6 -5
- package/dist/guards/index.d.ts +6 -5
- package/dist/guards/index.js +6 -6
- package/dist/{hash-_9VyW44M.d.cts → hash-BXy5DuTD.d.cts} +1 -1
- package/dist/{hash-CJ9LfuY5.d.ts → hash-C6KOPK9Q.d.ts} +1 -1
- package/dist/history/index.cjs +2 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +6 -5
- package/dist/history/index.d.ts +6 -5
- package/dist/history/index.js +6 -6
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +5 -4
- package/dist/i18n/index.d.ts +5 -4
- package/dist/i18n/index.js +6 -6
- package/dist/{index-s31g3m-D.d.cts → index-BA7A-MJs.d.cts} +96 -4
- package/dist/{index-BWAXR9tV.d.ts → index-CLK67MZE.d.ts} +96 -4
- package/dist/{index-7nd15fgy.d.ts → index-CNwA-B6-.d.ts} +70 -2
- package/dist/{index-CFJKJXWa.d.cts → index-CmVgTkqk.d.cts} +70 -2
- package/dist/index.cjs +2400 -571
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +128 -18
- package/dist/index.d.ts +128 -18
- package/dist/index.js +1217 -107
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.js +2 -2
- package/dist/{ledger-LHLIVPJ3.js → ledger-GHIZQLKR.js} +6 -6
- package/dist/materialized-views/index.cjs +255 -21
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +7 -6
- package/dist/materialized-views/index.d.ts +7 -6
- package/dist/materialized-views/index.js +9 -5
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +6 -5
- package/dist/overlay-views/index.d.ts +6 -5
- package/dist/overlay-views/index.js +3 -3
- package/dist/periods/index.cjs +2 -1
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +5 -4
- package/dist/periods/index.d.ts +5 -4
- package/dist/periods/index.js +6 -6
- package/dist/{public-envelope-66ZBXVXK.js → public-envelope-CRJAVW3E.js} +4 -4
- package/dist/query/index.cjs +139 -113
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +13 -9
- package/dist/{registry-JYALMHGM.js → registry-3L3N3PTG.js} +3 -3
- package/dist/registry-O47PUPSY.js +8 -0
- package/dist/registry-WLLMODKN.js +8 -0
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +6 -5
- package/dist/session/index.d.ts +6 -5
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +5 -4
- package/dist/shadow/index.d.ts +5 -4
- package/dist/shadow/index.js +2 -2
- package/dist/{stale-EET5YFYL.js → stale-HSC5YO2O.js} +2 -2
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +5 -4
- package/dist/store/index.d.ts +5 -4
- package/dist/store/index.js +2 -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 +4 -3
- package/dist/sync/index.d.ts +4 -3
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs +136 -6
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +5 -4
- package/dist/team/index.d.ts +5 -4
- package/dist/team/index.js +7 -7
- package/dist/tx/index.cjs +2 -1
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +5 -4
- package/dist/tx/index.d.ts +5 -4
- package/dist/tx/index.js +2 -2
- package/dist/{types-2JGVRzO2.d.cts → types-DDy02bWN.d.cts} +1159 -257
- package/dist/{types-DIOLYPUq.d.ts → types-DImsOlJe.d.ts} +1159 -257
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{with-derivation-ClhfQvRa.d.ts → with-derivation-3AdLeSw8.d.ts} +1 -1
- package/dist/{with-derivation-3JX8SMxY.d.cts → with-derivation-CkCHx_J8.d.cts} +1 -1
- package/dist/{with-guard-Br3YPxRW.d.ts → with-guard-Br9zLEdi.d.ts} +1 -1
- package/dist/{with-guard-fJVfWBLs.d.cts → with-guard-DtKsFExw.d.cts} +1 -1
- package/dist/with-materialized-view-CMhEX4FK.d.cts +27 -0
- package/dist/with-materialized-view-Zal2bE1T.d.ts +27 -0
- package/dist/{with-overlayed-view-BLUKxdiJ.d.cts → with-overlayed-view-CA6zHrBt.d.cts} +1 -1
- package/dist/{with-overlayed-view-CtvJxhU3.d.ts → with-overlayed-view-R4BNG9OB.d.ts} +1 -1
- package/package.json +14 -2
- package/dist/chunk-432R4RDC.js.map +0 -1
- package/dist/chunk-CX2S2IBB.js.map +0 -1
- package/dist/chunk-E3VAKWJ7.js.map +0 -1
- package/dist/chunk-ERV4AXVO.js.map +0 -1
- package/dist/chunk-GV47JHIF.js +0 -29
- package/dist/chunk-GV47JHIF.js.map +0 -1
- package/dist/chunk-LTKFPLTW.js.map +0 -1
- package/dist/chunk-PMMNH7VZ.js.map +0 -1
- package/dist/chunk-Q2L5ZYX7.js +0 -66
- package/dist/chunk-Q2L5ZYX7.js.map +0 -1
- package/dist/chunk-Q3OWJPJI.js.map +0 -1
- package/dist/chunk-SBK6CETA.js +0 -30
- package/dist/chunk-SBK6CETA.js.map +0 -1
- package/dist/chunk-SBOSKCXD.js.map +0 -1
- package/dist/chunk-WLZWITX3.js.map +0 -1
- package/dist/chunk-ZJICDHNH.js.map +0 -1
- package/dist/executor-3H3NSIVZ.js +0 -8
- package/dist/executor-7ZOXGY7P.js +0 -8
- package/dist/executor-A5LTUAG2.js +0 -9
- package/dist/registry-J2UI37XJ.js +0 -8
- package/dist/registry-UMAL72WL.js +0 -8
- package/dist/with-materialized-view-CHho83hN.d.cts +0 -15
- package/dist/with-materialized-view-CgPphnza.d.ts +0 -15
- /package/dist/{chunk-HENWE2QQ.js.map → chunk-34YSDCDP.js.map} +0 -0
- /package/dist/{chunk-3J5PYYUL.js.map → chunk-5DWL3JBF.js.map} +0 -0
- /package/dist/{chunk-562AT3V6.js.map → chunk-5NGHX6ME.js.map} +0 -0
- /package/dist/{chunk-AD4FMCXZ.js.map → chunk-DYBQG5PQ.js.map} +0 -0
- /package/dist/{chunk-PNTWORBA.js.map → chunk-DYECX3IX.js.map} +0 -0
- /package/dist/{chunk-RGHN6WV7.js.map → chunk-FCXOFQAJ.js.map} +0 -0
- /package/dist/{chunk-CRNMA2FB.js.map → chunk-I6MX32UC.js.map} +0 -0
- /package/dist/{chunk-PHSGPPV7.js.map → chunk-KESP7GOK.js.map} +0 -0
- /package/dist/{chunk-FB34MDSJ.js.map → chunk-KJJKHKFP.js.map} +0 -0
- /package/dist/{chunk-J3E2UMET.js.map → chunk-MIQHZESA.js.map} +0 -0
- /package/dist/{chunk-TNYWH7Z2.js.map → chunk-MKSA2V7A.js.map} +0 -0
- /package/dist/{chunk-E4ZSYZSN.js.map → chunk-NVBUGT76.js.map} +0 -0
- /package/dist/{chunk-XFVOTOYQ.js.map → chunk-O4RHR7FV.js.map} +0 -0
- /package/dist/{chunk-EEEFQTYN.js.map → chunk-OMLIZL2P.js.map} +0 -0
- /package/dist/{chunk-GVPFL6XF.js.map → chunk-P7EQ2S5O.js.map} +0 -0
- /package/dist/{chunk-7QGJ7RTL.js.map → chunk-RRMDLTIL.js.map} +0 -0
- /package/dist/{chunk-U7YDBNFC.js.map → chunk-UZXLQCHP.js.map} +0 -0
- /package/dist/{chunk-PPJA7KL6.js.map → chunk-V6SGP2KX.js.map} +0 -0
- /package/dist/{chunk-7AQKLLI5.js.map → chunk-WCA2NROQ.js.map} +0 -0
- /package/dist/{chunk-5Y4AKEZ6.js.map → chunk-Z72JH4KG.js.map} +0 -0
- /package/dist/{chunk-IXFP66OV.js.map → chunk-ZNOEIM6Y.js.map} +0 -0
- /package/dist/{crypto-VTEMMJK6.js.map → crypto-A7FRXYHC.js.map} +0 -0
- /package/dist/{delegation-HYQULPZR.js.map → delegation-YBA4X4JN.js.map} +0 -0
- /package/dist/{executor-3H3NSIVZ.js.map → executor-7E3VFGW7.js.map} +0 -0
- /package/dist/{executor-7ZOXGY7P.js.map → executor-CEWX2FQI.js.map} +0 -0
- /package/dist/{executor-A5LTUAG2.js.map → executor-X4SQ3ZLC.js.map} +0 -0
- /package/dist/{ledger-LHLIVPJ3.js.map → ledger-GHIZQLKR.js.map} +0 -0
- /package/dist/{public-envelope-66ZBXVXK.js.map → public-envelope-CRJAVW3E.js.map} +0 -0
- /package/dist/{registry-J2UI37XJ.js.map → registry-3L3N3PTG.js.map} +0 -0
- /package/dist/{registry-JYALMHGM.js.map → registry-O47PUPSY.js.map} +0 -0
- /package/dist/{registry-UMAL72WL.js.map → registry-WLLMODKN.js.map} +0 -0
- /package/dist/{stale-EET5YFYL.js.map → stale-HSC5YO2O.js.map} +0 -0
package/dist/periods/index.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { a5 as PeriodsStrategy } from '../types-
|
|
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-
|
|
1
|
+
import { a5 as PeriodsStrategy } from '../types-DDy02bWN.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-DDy02bWN.cjs';
|
|
3
3
|
import '../lazy-builder-C-rPfWG0.cjs';
|
|
4
4
|
import '../predicate-Dnu81tsS.cjs';
|
|
5
|
-
import '../strategy-
|
|
5
|
+
import '../strategy-DSTrsZ8t.cjs';
|
|
6
6
|
import '../strategy-BSxFXGzb.cjs';
|
|
7
|
-
import '../index-
|
|
7
|
+
import '../index-CmVgTkqk.cjs';
|
|
8
|
+
import '@noy-db/on-shamir';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Active periods strategy factory. Only reachable through the
|
package/dist/periods/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { a5 as PeriodsStrategy } from '../types-
|
|
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-
|
|
1
|
+
import { a5 as PeriodsStrategy } from '../types-DImsOlJe.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-DImsOlJe.js';
|
|
3
3
|
import '../lazy-builder-Rpd-V3jP.js';
|
|
4
4
|
import '../predicate-Dnu81tsS.js';
|
|
5
|
-
import '../strategy-
|
|
5
|
+
import '../strategy-DSTrsZ8t.js';
|
|
6
6
|
import '../strategy-BSxFXGzb.js';
|
|
7
|
-
import '../index-
|
|
7
|
+
import '../index-CNwA-B6-.js';
|
|
8
|
+
import '@noy-db/on-shamir';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Active periods strategy factory. Only reachable through the
|
package/dist/periods/index.js
CHANGED
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
loadPeriods,
|
|
7
7
|
validatePeriodName,
|
|
8
8
|
withPeriods
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-KJJKHKFP.js";
|
|
10
10
|
import "../chunk-UF3BUNQZ.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-QQUUAXDY.js";
|
|
12
|
+
import "../chunk-2AXFIYHT.js";
|
|
13
|
+
import "../chunk-H7XROQJM.js";
|
|
14
|
+
import "../chunk-WCA2NROQ.js";
|
|
15
|
+
import "../chunk-ADQ5MQ54.js";
|
|
16
16
|
export {
|
|
17
17
|
PERIODS_COLLECTION,
|
|
18
18
|
appendPeriodLedgerEntry,
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
resolveLocale,
|
|
13
13
|
savePublicEnvelope,
|
|
14
14
|
validatePublicEnvelopeInput
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-V6SGP2KX.js";
|
|
16
|
+
import "./chunk-H7XROQJM.js";
|
|
17
|
+
import "./chunk-ADQ5MQ54.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-
|
|
31
|
+
//# sourceMappingURL=public-envelope-CRJAVW3E.js.map
|
package/dist/query/index.cjs
CHANGED
|
@@ -29,6 +29,7 @@ __export(query_exports, {
|
|
|
29
29
|
GroupCardinalityError: () => GroupCardinalityError,
|
|
30
30
|
GroupedAggregation: () => GroupedAggregation,
|
|
31
31
|
GroupedQuery: () => GroupedQuery,
|
|
32
|
+
GroupedQueryN: () => GroupedQueryN,
|
|
32
33
|
IndexRequiredError: () => IndexRequiredError,
|
|
33
34
|
IndexWriteFailureError: () => IndexWriteFailureError,
|
|
34
35
|
JoinTooLargeError: () => JoinTooLargeError,
|
|
@@ -457,6 +458,9 @@ var NO_AGGREGATE = {
|
|
|
457
458
|
groupBy() {
|
|
458
459
|
throw NOT_ENABLED;
|
|
459
460
|
},
|
|
461
|
+
groupByN() {
|
|
462
|
+
throw NOT_ENABLED;
|
|
463
|
+
},
|
|
460
464
|
scanAggregate() {
|
|
461
465
|
throw NOT_ENABLED;
|
|
462
466
|
}
|
|
@@ -840,53 +844,10 @@ var Query = class _Query {
|
|
|
840
844
|
}
|
|
841
845
|
return this.aggregateStrategy.aggregate(executeRecords, spec, upstreams);
|
|
842
846
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
*
|
|
848
|
-
* ```ts
|
|
849
|
-
* const byClient = invoices.query()
|
|
850
|
-
* .where('status', '==', 'open')
|
|
851
|
-
* .groupBy('clientId')
|
|
852
|
-
* .aggregate({ total: sum('amount'), n: count() })
|
|
853
|
-
* .run()
|
|
854
|
-
* // → [ { clientId: 'c1', total: 5250, n: 3 }, … ]
|
|
855
|
-
* ```
|
|
856
|
-
*
|
|
857
|
-
* Result rows carry the group key value under the grouping field
|
|
858
|
-
* name plus every reducer output from the spec. Buckets are
|
|
859
|
-
* emitted in first-seen order — consumers who want a specific
|
|
860
|
-
* ordering should `.sort()` downstream.
|
|
861
|
-
*
|
|
862
|
-
* **Cardinality caps:** a one-shot warning fires at 10_000
|
|
863
|
-
* distinct groups; `GroupCardinalityError` throws at 100_000.
|
|
864
|
-
* Grouping on a high-uniqueness field like `id` or `createdAt` is
|
|
865
|
-
* almost always a query mistake — the error message names the
|
|
866
|
-
* field and observed cardinality and suggests narrowing with
|
|
867
|
-
* `.where()` first.
|
|
868
|
-
*
|
|
869
|
-
* **Null / undefined keys:** records with a missing or explicitly
|
|
870
|
-
* `null` group field get their own buckets. `Map`-based
|
|
871
|
-
* partitioning distinguishes `undefined` from `null`, so the two
|
|
872
|
-
* cases do NOT merge. Consumers who want them merged should
|
|
873
|
-
* coalesce upstream with `.filter()`.
|
|
874
|
-
*
|
|
875
|
-
* **Joins are not applied** — same rationale as `.count()` and
|
|
876
|
-
* `.aggregate()`. Joined fields in are projection-only, so
|
|
877
|
-
* running a join inside a grouping pipeline would be wasteful and
|
|
878
|
-
* could trigger `DanglingReferenceError` in strict mode for a
|
|
879
|
-
* call whose intent is purely to bucket-and-reduce. Grouping by
|
|
880
|
-
* a joined field is explicitly out of scope for — file an
|
|
881
|
-
* issue if a real consumer needs it.
|
|
882
|
-
*
|
|
883
|
-
* **Filter clauses (`.filter(fn)`):** grouped queries still
|
|
884
|
-
* support filter clauses in the underlying plan — they run in
|
|
885
|
-
* the same candidate/filter pipeline that `.aggregate()` uses.
|
|
886
|
-
* The performance caveat is the same: filter clauses cost O(N)
|
|
887
|
-
* per record and can't be index-accelerated.
|
|
888
|
-
*/
|
|
889
|
-
groupBy(field) {
|
|
847
|
+
groupBy(...fields) {
|
|
848
|
+
if (fields.length === 0) {
|
|
849
|
+
throw new Error(".groupBy() requires at least one field");
|
|
850
|
+
}
|
|
890
851
|
const source = this.source;
|
|
891
852
|
const clauses = this.plan.clauses;
|
|
892
853
|
const executeRecords = () => {
|
|
@@ -898,36 +859,21 @@ var Query = class _Query {
|
|
|
898
859
|
const subscribe = source.subscribe.bind(source);
|
|
899
860
|
upstreams.push({ subscribe: (cb) => subscribe(cb) });
|
|
900
861
|
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
if (!labels) return void 0;
|
|
917
|
-
if (labels[locale] !== void 0) return labels[locale];
|
|
918
|
-
const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
|
|
919
|
-
for (const fb of chain) {
|
|
920
|
-
if (fb === "any") {
|
|
921
|
-
const any = Object.values(labels)[0];
|
|
922
|
-
if (any !== void 0) return any;
|
|
923
|
-
} else if (labels[fb] !== void 0) {
|
|
924
|
-
return labels[fb];
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
return void 0;
|
|
928
|
-
};
|
|
929
|
-
})() : void 0;
|
|
930
|
-
return this.aggregateStrategy.groupBy(executeRecords, field, upstreams, dictLabelResolver);
|
|
862
|
+
if (fields.length === 1) {
|
|
863
|
+
const field = fields[0];
|
|
864
|
+
const dictLabelResolver = buildDictLabelResolver(this.joinContext, field);
|
|
865
|
+
return this.aggregateStrategy.groupBy(
|
|
866
|
+
executeRecords,
|
|
867
|
+
field,
|
|
868
|
+
upstreams,
|
|
869
|
+
dictLabelResolver
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
return this.aggregateStrategy.groupByN(
|
|
873
|
+
executeRecords,
|
|
874
|
+
fields,
|
|
875
|
+
upstreams
|
|
876
|
+
);
|
|
931
877
|
}
|
|
932
878
|
/**
|
|
933
879
|
* Re-run the query whenever the source notifies of changes.
|
|
@@ -1190,6 +1136,35 @@ function canonicalCtxHash(ctx) {
|
|
|
1190
1136
|
}
|
|
1191
1137
|
return (h >>> 0).toString(16).padStart(8, "0");
|
|
1192
1138
|
}
|
|
1139
|
+
function buildDictLabelResolver(joinCtx, field) {
|
|
1140
|
+
if (!joinCtx?.resolveDictSource) return void 0;
|
|
1141
|
+
const dictSource = joinCtx.resolveDictSource(field);
|
|
1142
|
+
if (!dictSource) return void 0;
|
|
1143
|
+
const snapshot = dictSource.snapshot();
|
|
1144
|
+
const dictMap = /* @__PURE__ */ new Map();
|
|
1145
|
+
for (const entry of snapshot) {
|
|
1146
|
+
const k = entry["key"];
|
|
1147
|
+
const labels = entry["labels"];
|
|
1148
|
+
if (typeof k === "string" && labels && typeof labels === "object") {
|
|
1149
|
+
dictMap.set(k, labels);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return async (key, locale, fallback) => {
|
|
1153
|
+
const labels = dictMap.get(key);
|
|
1154
|
+
if (!labels) return void 0;
|
|
1155
|
+
if (labels[locale] !== void 0) return labels[locale];
|
|
1156
|
+
const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
|
|
1157
|
+
for (const fb of chain) {
|
|
1158
|
+
if (fb === "any") {
|
|
1159
|
+
const any = Object.values(labels)[0];
|
|
1160
|
+
if (any !== void 0) return any;
|
|
1161
|
+
} else if (labels[fb] !== void 0) {
|
|
1162
|
+
return labels[fb];
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
return void 0;
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1193
1168
|
|
|
1194
1169
|
// src/indexing/eager-indexes.ts
|
|
1195
1170
|
var CollectionIndexes = class {
|
|
@@ -1526,31 +1501,53 @@ function buildLiveAggregation(recompute, upstreams) {
|
|
|
1526
1501
|
return new LiveAggregationImpl(recompute, upstreams);
|
|
1527
1502
|
}
|
|
1528
1503
|
|
|
1504
|
+
// src/aggregate/canonical-key.ts
|
|
1505
|
+
function canonicalGroupKey(fields, row) {
|
|
1506
|
+
const sorted = [...fields].sort();
|
|
1507
|
+
const parts = [];
|
|
1508
|
+
for (const name of sorted) {
|
|
1509
|
+
const v = row[name];
|
|
1510
|
+
const serialised = v === void 0 ? "undefined" : JSON.stringify(v);
|
|
1511
|
+
parts.push(`${name}=${serialised}`);
|
|
1512
|
+
}
|
|
1513
|
+
return parts.join("|");
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1529
1516
|
// src/aggregate/groupby.ts
|
|
1530
1517
|
var GROUPBY_WARN_CARDINALITY = 1e4;
|
|
1531
1518
|
var GROUPBY_MAX_CARDINALITY = 1e5;
|
|
1532
1519
|
var warnedCardinalityFields = /* @__PURE__ */ new Set();
|
|
1533
|
-
function warnCardinalityApproaching(
|
|
1534
|
-
|
|
1535
|
-
warnedCardinalityFields.
|
|
1520
|
+
function warnCardinalityApproaching(fields, observed) {
|
|
1521
|
+
const key = JSON.stringify([...fields].sort());
|
|
1522
|
+
if (warnedCardinalityFields.has(key)) return;
|
|
1523
|
+
warnedCardinalityFields.add(key);
|
|
1524
|
+
const label = `[${fields.join(", ")}]`;
|
|
1536
1525
|
console.warn(
|
|
1537
|
-
`[noy-db] .groupBy(
|
|
1526
|
+
`[noy-db] .groupBy(${label}) produced ${observed} distinct groups, ${Math.round(observed / GROUPBY_MAX_CARDINALITY * 100)}% of the ${GROUPBY_MAX_CARDINALITY}-group ceiling. Narrow the query with .where() before grouping, or switch to a lower-cardinality field.`
|
|
1538
1527
|
);
|
|
1539
1528
|
}
|
|
1540
1529
|
function resetGroupByWarnings() {
|
|
1541
1530
|
warnedCardinalityFields.clear();
|
|
1542
1531
|
}
|
|
1543
|
-
var
|
|
1544
|
-
constructor(executeRecords,
|
|
1532
|
+
var GroupedQueryBase = class {
|
|
1533
|
+
constructor(executeRecords, fieldOrFields, upstreams, dictLabelResolver) {
|
|
1545
1534
|
this.executeRecords = executeRecords;
|
|
1546
|
-
this.field = field;
|
|
1547
1535
|
this.upstreams = upstreams;
|
|
1548
1536
|
this.dictLabelResolver = dictLabelResolver;
|
|
1537
|
+
this.fields = typeof fieldOrFields === "string" ? [fieldOrFields] : [...fieldOrFields];
|
|
1549
1538
|
}
|
|
1550
1539
|
executeRecords;
|
|
1551
|
-
field;
|
|
1552
1540
|
upstreams;
|
|
1553
1541
|
dictLabelResolver;
|
|
1542
|
+
/**
|
|
1543
|
+
* Field set this grouped query buckets on. Stored in declaration
|
|
1544
|
+
* order — the same order is preserved on every result row by
|
|
1545
|
+
* `groupAndReduce`. For the single-field constructor, this is
|
|
1546
|
+
* `[field]`.
|
|
1547
|
+
*/
|
|
1548
|
+
fields;
|
|
1549
|
+
};
|
|
1550
|
+
var GroupedQuery = class extends GroupedQueryBase {
|
|
1554
1551
|
/**
|
|
1555
1552
|
* Build a grouped aggregation. Returns a `GroupedAggregation`
|
|
1556
1553
|
* with `.run()`, `.runAsync()`, and `.live()` terminals — same shape
|
|
@@ -1560,70 +1557,93 @@ var GroupedQuery = class {
|
|
|
1560
1557
|
aggregate(spec) {
|
|
1561
1558
|
return new GroupedAggregation(
|
|
1562
1559
|
this.executeRecords,
|
|
1563
|
-
this.
|
|
1560
|
+
this.fields,
|
|
1561
|
+
spec,
|
|
1562
|
+
this.upstreams,
|
|
1563
|
+
this.dictLabelResolver
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
var GroupedQueryN = class extends GroupedQueryBase {
|
|
1568
|
+
aggregate(spec) {
|
|
1569
|
+
return new GroupedAggregation(
|
|
1570
|
+
this.executeRecords,
|
|
1571
|
+
this.fields,
|
|
1564
1572
|
spec,
|
|
1565
1573
|
this.upstreams,
|
|
1566
1574
|
this.dictLabelResolver
|
|
1567
1575
|
);
|
|
1568
1576
|
}
|
|
1569
1577
|
};
|
|
1570
|
-
function groupAndReduce(records,
|
|
1578
|
+
function groupAndReduce(records, fieldOrFields, spec) {
|
|
1579
|
+
const fields = typeof fieldOrFields === "string" ? [fieldOrFields] : fieldOrFields;
|
|
1580
|
+
if (fields.length === 0) {
|
|
1581
|
+
throw new Error(".groupBy() requires at least one field");
|
|
1582
|
+
}
|
|
1571
1583
|
const buckets = /* @__PURE__ */ new Map();
|
|
1584
|
+
const fieldLabel = fields.length === 1 ? fields[0] : `[${fields.join(", ")}]`;
|
|
1572
1585
|
for (const record of records) {
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1586
|
+
const keyValues = {};
|
|
1587
|
+
for (const f of fields) {
|
|
1588
|
+
keyValues[f] = readPath(record, f);
|
|
1589
|
+
}
|
|
1590
|
+
const dedupKey = canonicalGroupKey(fields, keyValues);
|
|
1591
|
+
let bucket = buckets.get(dedupKey);
|
|
1575
1592
|
if (bucket === void 0) {
|
|
1576
1593
|
if (buckets.size >= GROUPBY_MAX_CARDINALITY) {
|
|
1577
1594
|
throw new GroupCardinalityError(
|
|
1578
|
-
|
|
1595
|
+
fieldLabel,
|
|
1579
1596
|
buckets.size + 1,
|
|
1580
1597
|
GROUPBY_MAX_CARDINALITY
|
|
1581
1598
|
);
|
|
1582
1599
|
}
|
|
1583
|
-
bucket = [];
|
|
1584
|
-
buckets.set(
|
|
1600
|
+
bucket = { keyValues, records: [] };
|
|
1601
|
+
buckets.set(dedupKey, bucket);
|
|
1585
1602
|
}
|
|
1586
|
-
bucket.push(record);
|
|
1603
|
+
bucket.records.push(record);
|
|
1587
1604
|
}
|
|
1588
1605
|
if (buckets.size >= GROUPBY_WARN_CARDINALITY) {
|
|
1589
|
-
warnCardinalityApproaching(
|
|
1606
|
+
warnCardinalityApproaching(fields, buckets.size);
|
|
1590
1607
|
}
|
|
1591
|
-
const
|
|
1608
|
+
const reducerKeys = Object.keys(spec);
|
|
1592
1609
|
const out = [];
|
|
1593
|
-
for (const
|
|
1610
|
+
for (const bucket of buckets.values()) {
|
|
1594
1611
|
const state = {};
|
|
1595
|
-
for (const
|
|
1596
|
-
state[
|
|
1612
|
+
for (const rk of reducerKeys) {
|
|
1613
|
+
state[rk] = spec[rk].init();
|
|
1597
1614
|
}
|
|
1598
|
-
for (const record of
|
|
1599
|
-
for (const
|
|
1600
|
-
state[
|
|
1615
|
+
for (const record of bucket.records) {
|
|
1616
|
+
for (const rk of reducerKeys) {
|
|
1617
|
+
state[rk] = spec[rk].step(state[rk], record);
|
|
1601
1618
|
}
|
|
1602
1619
|
}
|
|
1603
|
-
const row = {
|
|
1604
|
-
for (const
|
|
1605
|
-
row[
|
|
1620
|
+
const row = {};
|
|
1621
|
+
for (const f of fields) {
|
|
1622
|
+
row[f] = bucket.keyValues[f];
|
|
1623
|
+
}
|
|
1624
|
+
for (const rk of reducerKeys) {
|
|
1625
|
+
row[rk] = spec[rk].finalize(state[rk]);
|
|
1606
1626
|
}
|
|
1607
1627
|
out.push(row);
|
|
1608
1628
|
}
|
|
1609
1629
|
return out;
|
|
1610
1630
|
}
|
|
1611
1631
|
var GroupedAggregation = class {
|
|
1612
|
-
constructor(executeRecords,
|
|
1632
|
+
constructor(executeRecords, fields, spec, upstreams, dictLabelResolver) {
|
|
1613
1633
|
this.executeRecords = executeRecords;
|
|
1614
|
-
this.field = field;
|
|
1615
1634
|
this.spec = spec;
|
|
1616
1635
|
this.upstreams = upstreams;
|
|
1617
1636
|
this.dictLabelResolver = dictLabelResolver;
|
|
1637
|
+
this.fields = typeof fields === "string" ? [fields] : [...fields];
|
|
1618
1638
|
}
|
|
1619
1639
|
executeRecords;
|
|
1620
|
-
field;
|
|
1621
1640
|
spec;
|
|
1622
1641
|
upstreams;
|
|
1623
1642
|
dictLabelResolver;
|
|
1643
|
+
fields;
|
|
1624
1644
|
/** Execute the query, group, reduce, and return an array of rows. */
|
|
1625
1645
|
run() {
|
|
1626
|
-
return groupAndReduce(this.executeRecords(), this.
|
|
1646
|
+
return groupAndReduce(this.executeRecords(), this.fields, this.spec);
|
|
1627
1647
|
}
|
|
1628
1648
|
/**
|
|
1629
1649
|
* Execute the query, group, reduce, and resolve `<field>Label` for
|
|
@@ -1633,17 +1653,22 @@ var GroupedAggregation = class {
|
|
|
1633
1653
|
*
|
|
1634
1654
|
* The `<field>Label` field is appended to each row. Rows whose group
|
|
1635
1655
|
* key has no dictionary entry get `<field>Label: undefined`.
|
|
1656
|
+
*
|
|
1657
|
+
* Dict-label resolution is single-field only — multi-key groupings
|
|
1658
|
+
* do not produce a `<field>Label`. The resolver is only attached
|
|
1659
|
+
* by the builder when `fields.length === 1`.
|
|
1636
1660
|
*/
|
|
1637
1661
|
async runAsync(opts) {
|
|
1638
|
-
const rows = groupAndReduce(this.executeRecords(), this.
|
|
1639
|
-
if (!opts?.locale || !this.dictLabelResolver) return rows;
|
|
1662
|
+
const rows = groupAndReduce(this.executeRecords(), this.fields, this.spec);
|
|
1663
|
+
if (!opts?.locale || !this.dictLabelResolver || this.fields.length !== 1) return rows;
|
|
1640
1664
|
const resolve = this.dictLabelResolver;
|
|
1641
1665
|
const locale = opts.locale;
|
|
1642
1666
|
const fallback = opts.fallback;
|
|
1643
|
-
const
|
|
1667
|
+
const field = this.fields[0];
|
|
1668
|
+
const labelKey = `${field}Label`;
|
|
1644
1669
|
return Promise.all(
|
|
1645
1670
|
rows.map(async (row) => {
|
|
1646
|
-
const key = row[
|
|
1671
|
+
const key = row[field];
|
|
1647
1672
|
if (typeof key !== "string") return row;
|
|
1648
1673
|
const label = await resolve(key, locale, fallback);
|
|
1649
1674
|
return { ...row, [labelKey]: label };
|
|
@@ -1667,7 +1692,7 @@ var GroupedAggregation = class {
|
|
|
1667
1692
|
* Always call `live.stop()` when finished.
|
|
1668
1693
|
*/
|
|
1669
1694
|
live() {
|
|
1670
|
-
const recompute = () => groupAndReduce(this.executeRecords(), this.
|
|
1695
|
+
const recompute = () => groupAndReduce(this.executeRecords(), this.fields, this.spec);
|
|
1671
1696
|
return buildLiveAggregation(recompute, this.upstreams);
|
|
1672
1697
|
}
|
|
1673
1698
|
};
|
|
@@ -2084,6 +2109,7 @@ function coerceRefKey2(value) {
|
|
|
2084
2109
|
GroupCardinalityError,
|
|
2085
2110
|
GroupedAggregation,
|
|
2086
2111
|
GroupedQuery,
|
|
2112
|
+
GroupedQueryN,
|
|
2087
2113
|
IndexRequiredError,
|
|
2088
2114
|
IndexWriteFailureError,
|
|
2089
2115
|
JoinTooLargeError,
|