@noy-db/hub 0.1.0-pre.14 → 0.1.0-pre.15
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 +4 -4
- package/dist/blobs/index.d.ts +4 -4
- package/dist/blobs/index.js +4 -4
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +4 -4
- package/dist/bundle/index.d.ts +4 -4
- package/dist/bundle/index.js +4 -4
- package/dist/{chunk-7QGJ7RTL.js → chunk-2ATIBE2U.js} +4 -4
- package/dist/{chunk-IXFP66OV.js → chunk-2FF5VF7C.js} +2 -2
- package/dist/{chunk-SBOSKCXD.js → chunk-2T5LJCQX.js} +6 -6
- package/dist/{chunk-PMMNH7VZ.js → chunk-4IAJNGE2.js} +1 -1
- package/dist/chunk-4IAJNGE2.js.map +1 -0
- package/dist/chunk-5ZGZ6HIZ.js +100 -0
- package/dist/chunk-5ZGZ6HIZ.js.map +1 -0
- package/dist/{chunk-RGHN6WV7.js → chunk-6I5BJLCO.js} +2 -2
- package/dist/{chunk-XFVOTOYQ.js → chunk-6QV6BT5O.js} +5 -5
- package/dist/{chunk-HENWE2QQ.js → chunk-6ZY7XM7T.js} +2 -2
- package/dist/{chunk-562AT3V6.js → chunk-7PBKKVEK.js} +5 -5
- package/dist/{chunk-Q2L5ZYX7.js → chunk-CAX3UCWT.js} +2 -2
- package/dist/{chunk-GV47JHIF.js → chunk-DPTVWLT6.js} +2 -2
- package/dist/{chunk-3J5PYYUL.js → chunk-ECZUQXFL.js} +2 -2
- package/dist/chunk-FGFDKQEQ.js +82 -0
- package/dist/chunk-FGFDKQEQ.js.map +1 -0
- package/dist/{chunk-U7YDBNFC.js → chunk-ISWNROQJ.js} +2 -2
- package/dist/{chunk-W7M3E5M5.js → chunk-JMS64IO3.js} +11 -1
- package/dist/{chunk-W7M3E5M5.js.map → chunk-JMS64IO3.js.map} +1 -1
- package/dist/{chunk-EEEFQTYN.js → chunk-KJT434FJ.js} +2 -2
- package/dist/{chunk-432R4RDC.js → chunk-L3MI2IBQ.js} +35 -5
- package/dist/chunk-L3MI2IBQ.js.map +1 -0
- package/dist/{chunk-ERV4AXVO.js → chunk-LFYN7U7S.js} +90 -131
- package/dist/chunk-LFYN7U7S.js.map +1 -0
- package/dist/{chunk-PPJA7KL6.js → chunk-OCIUVQ4S.js} +3 -3
- package/dist/{chunk-J3E2UMET.js → chunk-OENCJSB5.js} +3 -3
- package/dist/{chunk-GVPFL6XF.js → chunk-PUUH5ABC.js} +2 -2
- package/dist/{chunk-AD4FMCXZ.js → chunk-PWDTXPVI.js} +2 -2
- package/dist/{chunk-TNYWH7Z2.js → chunk-RRHDNYHV.js} +2 -2
- package/dist/{chunk-LTKFPLTW.js → chunk-RZYYGREI.js} +3 -3
- package/dist/{chunk-CRNMA2FB.js → chunk-T3Z56SBF.js} +4 -4
- package/dist/{chunk-PNTWORBA.js → chunk-TOFQTQPP.js} +2 -2
- package/dist/{chunk-CX2S2IBB.js → chunk-UNTP5FG3.js} +53 -79
- package/dist/chunk-UNTP5FG3.js.map +1 -0
- package/dist/{chunk-5Y4AKEZ6.js → chunk-UOBFPYPO.js} +2 -2
- package/dist/{chunk-FB34MDSJ.js → chunk-V35XFIXZ.js} +3 -3
- package/dist/{chunk-Q3OWJPJI.js → chunk-W7SI2WV6.js} +32 -19
- package/dist/chunk-W7SI2WV6.js.map +1 -0
- package/dist/{chunk-7AQKLLI5.js → chunk-XDA43P7D.js} +2 -2
- package/dist/{chunk-PHSGPPV7.js → chunk-XXFA6X7N.js} +3 -3
- package/dist/{chunk-ZJICDHNH.js → chunk-Y524D7MO.js} +3 -3
- package/dist/{chunk-E4ZSYZSN.js → chunk-Z2ZJT7PX.js} +4 -4
- package/dist/{chunk-E3VAKWJ7.js → chunk-ZFLGSPJP.js} +4 -4
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +4 -4
- package/dist/consent/index.d.ts +4 -4
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-VTEMMJK6.js → crypto-KHVYHWLB.js} +3 -3
- package/dist/{delegation-HYQULPZR.js → delegation-T52VZVEZ.js} +5 -5
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +5 -5
- package/dist/derivations/index.d.ts +5 -5
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-CpJ9rHW2.d.ts → dev-unlock-B6Q50uMI.d.ts} +1 -1
- package/dist/{dev-unlock-DEUUpWoR.d.cts → dev-unlock-C9oO0MzZ.d.cts} +1 -1
- package/dist/executor-5ORS7Q44.js +8 -0
- package/dist/executor-7ZO2RKVN.js +11 -0
- package/dist/executor-KES5KTWO.js +8 -0
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +5 -5
- package/dist/guards/index.d.ts +5 -5
- package/dist/guards/index.js +3 -3
- package/dist/{hash-CJ9LfuY5.d.ts → hash-CVXn2zoI.d.ts} +1 -1
- package/dist/{hash-_9VyW44M.d.cts → hash-Dp9s2_t_.d.cts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +5 -5
- package/dist/history/index.d.ts +5 -5
- package/dist/history/index.js +5 -5
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +4 -4
- package/dist/i18n/index.d.ts +4 -4
- package/dist/i18n/index.js +5 -5
- package/dist/{index-BWAXR9tV.d.ts → index-BN9txQuj.d.ts} +2 -2
- package/dist/{index-7nd15fgy.d.ts → index-BrKaVyPN.d.ts} +26 -2
- package/dist/{index-s31g3m-D.d.cts → index-DbFmhrQI.d.cts} +2 -2
- package/dist/{index-CFJKJXWa.d.cts → index-GsDF2KlQ.d.cts} +26 -2
- package/dist/index.cjs +612 -444
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +62 -57
- 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-DAIXDB6Z.js} +5 -5
- package/dist/materialized-views/index.cjs +255 -21
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +6 -6
- package/dist/materialized-views/index.d.ts +6 -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 +5 -5
- package/dist/overlay-views/index.d.ts +5 -5
- package/dist/overlay-views/index.js +3 -3
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +4 -4
- package/dist/periods/index.d.ts +4 -4
- package/dist/periods/index.js +5 -5
- package/dist/{public-envelope-66ZBXVXK.js → public-envelope-V2SRY3FE.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-7ADDJ5A7.js +8 -0
- package/dist/registry-MMFWKVG3.js +8 -0
- package/dist/{registry-JYALMHGM.js → registry-UTVJPBCR.js} +3 -3
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +5 -5
- package/dist/session/index.d.ts +5 -5
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +4 -4
- package/dist/shadow/index.d.ts +4 -4
- package/dist/shadow/index.js +2 -2
- package/dist/{stale-EET5YFYL.js → stale-57YFBIYH.js} +2 -2
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +4 -4
- package/dist/store/index.d.ts +4 -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 +3 -3
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +4 -4
- package/dist/team/index.d.ts +4 -4
- package/dist/team/index.js +7 -7
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +4 -4
- package/dist/tx/index.d.ts +4 -4
- package/dist/tx/index.js +2 -2
- package/dist/{types-2JGVRzO2.d.cts → types-BQxk3BfV.d.cts} +108 -10
- package/dist/{types-DIOLYPUq.d.ts → types-CHg3c-4p.d.ts} +108 -10
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{with-derivation-ClhfQvRa.d.ts → with-derivation-2IEX6kda.d.ts} +1 -1
- package/dist/{with-derivation-3JX8SMxY.d.cts → with-derivation-DSl2vaNF.d.cts} +1 -1
- package/dist/{with-guard-fJVfWBLs.d.cts → with-guard-B1huEXLG.d.cts} +1 -1
- package/dist/{with-guard-Br3YPxRW.d.ts → with-guard-_9hGHy-s.d.ts} +1 -1
- package/dist/with-materialized-view-CWrhsQw0.d.ts +27 -0
- package/dist/with-materialized-view-CfedjOXj.d.cts +27 -0
- package/dist/{with-overlayed-view-CtvJxhU3.d.ts → with-overlayed-view-BzSWWR8-.d.ts} +1 -1
- package/dist/{with-overlayed-view-BLUKxdiJ.d.cts → with-overlayed-view-ChH8l6-c.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-432R4RDC.js.map +0 -1
- package/dist/chunk-CX2S2IBB.js.map +0 -1
- package/dist/chunk-ERV4AXVO.js.map +0 -1
- package/dist/chunk-PMMNH7VZ.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/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-7QGJ7RTL.js.map → chunk-2ATIBE2U.js.map} +0 -0
- /package/dist/{chunk-IXFP66OV.js.map → chunk-2FF5VF7C.js.map} +0 -0
- /package/dist/{chunk-SBOSKCXD.js.map → chunk-2T5LJCQX.js.map} +0 -0
- /package/dist/{chunk-RGHN6WV7.js.map → chunk-6I5BJLCO.js.map} +0 -0
- /package/dist/{chunk-XFVOTOYQ.js.map → chunk-6QV6BT5O.js.map} +0 -0
- /package/dist/{chunk-HENWE2QQ.js.map → chunk-6ZY7XM7T.js.map} +0 -0
- /package/dist/{chunk-562AT3V6.js.map → chunk-7PBKKVEK.js.map} +0 -0
- /package/dist/{chunk-Q2L5ZYX7.js.map → chunk-CAX3UCWT.js.map} +0 -0
- /package/dist/{chunk-GV47JHIF.js.map → chunk-DPTVWLT6.js.map} +0 -0
- /package/dist/{chunk-3J5PYYUL.js.map → chunk-ECZUQXFL.js.map} +0 -0
- /package/dist/{chunk-U7YDBNFC.js.map → chunk-ISWNROQJ.js.map} +0 -0
- /package/dist/{chunk-EEEFQTYN.js.map → chunk-KJT434FJ.js.map} +0 -0
- /package/dist/{chunk-PPJA7KL6.js.map → chunk-OCIUVQ4S.js.map} +0 -0
- /package/dist/{chunk-J3E2UMET.js.map → chunk-OENCJSB5.js.map} +0 -0
- /package/dist/{chunk-GVPFL6XF.js.map → chunk-PUUH5ABC.js.map} +0 -0
- /package/dist/{chunk-AD4FMCXZ.js.map → chunk-PWDTXPVI.js.map} +0 -0
- /package/dist/{chunk-TNYWH7Z2.js.map → chunk-RRHDNYHV.js.map} +0 -0
- /package/dist/{chunk-LTKFPLTW.js.map → chunk-RZYYGREI.js.map} +0 -0
- /package/dist/{chunk-CRNMA2FB.js.map → chunk-T3Z56SBF.js.map} +0 -0
- /package/dist/{chunk-PNTWORBA.js.map → chunk-TOFQTQPP.js.map} +0 -0
- /package/dist/{chunk-5Y4AKEZ6.js.map → chunk-UOBFPYPO.js.map} +0 -0
- /package/dist/{chunk-FB34MDSJ.js.map → chunk-V35XFIXZ.js.map} +0 -0
- /package/dist/{chunk-7AQKLLI5.js.map → chunk-XDA43P7D.js.map} +0 -0
- /package/dist/{chunk-PHSGPPV7.js.map → chunk-XXFA6X7N.js.map} +0 -0
- /package/dist/{chunk-ZJICDHNH.js.map → chunk-Y524D7MO.js.map} +0 -0
- /package/dist/{chunk-E4ZSYZSN.js.map → chunk-Z2ZJT7PX.js.map} +0 -0
- /package/dist/{chunk-E3VAKWJ7.js.map → chunk-ZFLGSPJP.js.map} +0 -0
- /package/dist/{crypto-VTEMMJK6.js.map → crypto-KHVYHWLB.js.map} +0 -0
- /package/dist/{delegation-HYQULPZR.js.map → delegation-T52VZVEZ.js.map} +0 -0
- /package/dist/{executor-3H3NSIVZ.js.map → executor-5ORS7Q44.js.map} +0 -0
- /package/dist/{executor-7ZOXGY7P.js.map → executor-7ZO2RKVN.js.map} +0 -0
- /package/dist/{executor-A5LTUAG2.js.map → executor-KES5KTWO.js.map} +0 -0
- /package/dist/{ledger-LHLIVPJ3.js.map → ledger-DAIXDB6Z.js.map} +0 -0
- /package/dist/{public-envelope-66ZBXVXK.js.map → public-envelope-V2SRY3FE.js.map} +0 -0
- /package/dist/{registry-J2UI37XJ.js.map → registry-7ADDJ5A7.js.map} +0 -0
- /package/dist/{registry-JYALMHGM.js.map → registry-MMFWKVG3.js.map} +0 -0
- /package/dist/{registry-UMAL72WL.js.map → registry-UTVJPBCR.js.map} +0 -0
- /package/dist/{stale-EET5YFYL.js.map → stale-57YFBIYH.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as IndexStrategy, d as LazyQuery } from './lazy-builder-C-rPfWG0.cjs';
|
|
2
|
-
import { A as AggregateStrategy } from './strategy-
|
|
2
|
+
import { b as AggregateSpec, A as AggregateStrategy } from './strategy-DSTrsZ8t.cjs';
|
|
3
3
|
import { C as CrdtStrategy, a as CrdtMode, b as CrdtState } from './strategy-BSxFXGzb.cjs';
|
|
4
|
-
import { N as NoydbError, Q as Query,
|
|
4
|
+
import { N as NoydbError, Q as Query, af as RefDescriptor, Y as JoinableSource, ak as RefViolation, al as ScanBuilder } from './index-GsDF2KlQ.cjs';
|
|
5
5
|
import { F as FieldClause, I as IndexDef, C as CollectionIndexes } from './predicate-Dnu81tsS.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -5062,6 +5062,39 @@ interface GuardStrategyHandle<T extends Record<string, unknown>> {
|
|
|
5062
5062
|
readonly __noydb_strategy: 'guard';
|
|
5063
5063
|
readonly spec: GuardStrategy<T>;
|
|
5064
5064
|
}
|
|
5065
|
+
/**
|
|
5066
|
+
* Existential erasure of `GuardStrategyHandle<T>` — used as the
|
|
5067
|
+
* element type of `ReadonlyArray<>` fields where the per-handle T
|
|
5068
|
+
* differs (e.g. `guardStrategies: [invoiceGuard, disbursementGuard]`).
|
|
5069
|
+
*
|
|
5070
|
+
* Background: `GuardStrategyHandle<T>` is INVARIANT in T because T
|
|
5071
|
+
* appears in callback positions on the spec (`check(incoming: T, ctx)`,
|
|
5072
|
+
* `invariant(changes: ReadonlyArray<GuardChange<T>>, ctx)`). So
|
|
5073
|
+
* `Handle<Invoice>` is not assignable to `Handle<Record<string, unknown>>`.
|
|
5074
|
+
* A bounded existential ("there exists some T satisfying the constraint
|
|
5075
|
+
* such that this is a Handle<T>") is the right shape; TypeScript has
|
|
5076
|
+
* no first-class existentials, so we fake it with a structurally narrow
|
|
5077
|
+
* interface that ERASES T from both the discriminant and the spec.
|
|
5078
|
+
*
|
|
5079
|
+
* Consumers continue to construct typed handles via `withGuard<T>(...)`
|
|
5080
|
+
* which returns `GuardStrategyHandle<T>`. Both `Handle<Invoice>` and
|
|
5081
|
+
* `Handle<Disbursement>` structurally assign to `GuardStrategyHandleAny`,
|
|
5082
|
+
* so an array of them is `GuardStrategyHandleAny[]`.
|
|
5083
|
+
*
|
|
5084
|
+
* Internal code that needs T re-narrows via the runtime discriminant
|
|
5085
|
+
* (`__noydb_strategy === 'guard'`) plus per-handle type information
|
|
5086
|
+
* carried by the registry.
|
|
5087
|
+
*
|
|
5088
|
+
* NOT exported from the public barrel — keeping this internal
|
|
5089
|
+
* discourages consumers from constructing it directly. Used only as
|
|
5090
|
+
* the array-element type on `Vault` / `NoydbOptions.guardStrategies`.
|
|
5091
|
+
*
|
|
5092
|
+
* @internal
|
|
5093
|
+
*/
|
|
5094
|
+
interface GuardStrategyHandleAny {
|
|
5095
|
+
readonly __noydb_strategy: 'guard';
|
|
5096
|
+
readonly spec: GuardStrategy<any>;
|
|
5097
|
+
}
|
|
5065
5098
|
/** Public registration shape. See `withGuard()`. */
|
|
5066
5099
|
interface GuardStrategy<T extends Record<string, unknown>> {
|
|
5067
5100
|
collection: string;
|
|
@@ -5298,6 +5331,28 @@ interface MaterializedViewOutput {
|
|
|
5298
5331
|
value: unknown;
|
|
5299
5332
|
};
|
|
5300
5333
|
}
|
|
5334
|
+
/**
|
|
5335
|
+
* One arm of a UNION materialized view. Reads rows from `collection`,
|
|
5336
|
+
* then maps each into the MV's row shape via `map`.
|
|
5337
|
+
*
|
|
5338
|
+
* The per-source `map` is the schema-unification boundary — sibling
|
|
5339
|
+
* collections can have different schemas, and `map` is where they
|
|
5340
|
+
* meet the MV's row type. The hub does NOT compare schemas across
|
|
5341
|
+
* arms; consumer responsibility is that every arm's `map` returns
|
|
5342
|
+
* the same shape (the strategy's `TRow` type parameter enforces this
|
|
5343
|
+
* at compile time).
|
|
5344
|
+
*/
|
|
5345
|
+
interface UnionSource<TRow extends Record<string, unknown>> {
|
|
5346
|
+
/** Source collection name. Must exist in the vault. */
|
|
5347
|
+
readonly collection: string;
|
|
5348
|
+
/**
|
|
5349
|
+
* Pure function from a source row to the unified MV row shape.
|
|
5350
|
+
* Called once per source row at materialization time. Each arm's
|
|
5351
|
+
* mapped output is concatenated into a single stream before
|
|
5352
|
+
* `groupBy` + `aggregate` run.
|
|
5353
|
+
*/
|
|
5354
|
+
readonly map: (sourceRow: Record<string, unknown>) => TRow;
|
|
5355
|
+
}
|
|
5301
5356
|
/**
|
|
5302
5357
|
* Registration shape passed to `withMaterializedView()`.
|
|
5303
5358
|
*
|
|
@@ -5310,16 +5365,59 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
5310
5365
|
*/
|
|
5311
5366
|
name: string;
|
|
5312
5367
|
/**
|
|
5313
|
-
* Declared query. Called at registration time
|
|
5314
|
-
* accessor so the closure can compose collections
|
|
5315
|
-
* pre-existing in-scope references; called again at each
|
|
5368
|
+
* Declared query (single-source mode). Called at registration time
|
|
5369
|
+
* with a vault-shaped accessor so the closure can compose collections
|
|
5370
|
+
* without pre-existing in-scope references; called again at each
|
|
5371
|
+
* refresh.
|
|
5316
5372
|
*
|
|
5317
5373
|
* Built via the same `Query<T>` chainable builder used elsewhere —
|
|
5318
5374
|
* `.where()`, `.join()`, `.groupBy()`, `.aggregate()`. The
|
|
5319
5375
|
* dependency analyzer walks the returned plan to determine source
|
|
5320
5376
|
* collections.
|
|
5377
|
+
*
|
|
5378
|
+
* Mutually exclusive with {@link unionSources}: a strategy must
|
|
5379
|
+
* declare exactly one of `query` (single-source) or `unionSources`
|
|
5380
|
+
* (multi-source UNION). Registration throws
|
|
5381
|
+
* `MaterializedViewConfigError` if both are set or neither is set.
|
|
5382
|
+
*/
|
|
5383
|
+
query?: (db: MVQueryContext) => Query<TRow>;
|
|
5384
|
+
/**
|
|
5385
|
+
* UNION-form sources (#165): an explicit list of sibling collections
|
|
5386
|
+
* that contribute rows to a single MV. Each arm's `map` projects a
|
|
5387
|
+
* source row into the MV's unified row shape; the mapped streams are
|
|
5388
|
+
* concatenated, then {@link groupBy} + {@link aggregate} run on the
|
|
5389
|
+
* combined output.
|
|
5390
|
+
*
|
|
5391
|
+
* Mutually exclusive with {@link query}. Registration throws
|
|
5392
|
+
* `MaterializedViewConfigError` if both are set, if `unionSources`
|
|
5393
|
+
* has fewer than 2 arms, or if two arms name the same `collection`.
|
|
5394
|
+
*
|
|
5395
|
+
* UNION mode replaces the dependency-analyzer path: the source
|
|
5396
|
+
* collections come directly from `unionSources[].collection`, and
|
|
5397
|
+
* {@link sources} is ignored.
|
|
5398
|
+
*/
|
|
5399
|
+
unionSources?: ReadonlyArray<UnionSource<TRow>>;
|
|
5400
|
+
/**
|
|
5401
|
+
* Group-key field(s) for UNION mode (#165). Applied to the
|
|
5402
|
+
* concatenated mapped-row stream from {@link unionSources} before
|
|
5403
|
+
* {@link aggregate} runs. Accepts a single field name or a tuple of
|
|
5404
|
+
* field names for multi-key grouping (same shape as
|
|
5405
|
+
* `Query.groupBy(...fields)`).
|
|
5406
|
+
*
|
|
5407
|
+
* UNION-mode only. Ignored if {@link query} is set — single-source
|
|
5408
|
+
* grouping is expressed inside the `Query<T>` returned from `query()`
|
|
5409
|
+
* via `.groupBy(...).aggregate(...)`.
|
|
5410
|
+
*/
|
|
5411
|
+
groupBy?: string | ReadonlyArray<string>;
|
|
5412
|
+
/**
|
|
5413
|
+
* Aggregation spec for UNION mode (#165). Applied per-group after
|
|
5414
|
+
* {@link groupBy} buckets the concatenated mapped-row stream from
|
|
5415
|
+
* {@link unionSources}. Same shape as the `AggregateSpec` passed to
|
|
5416
|
+
* `Query.aggregate()`.
|
|
5417
|
+
*
|
|
5418
|
+
* UNION-mode only. Ignored if {@link query} is set.
|
|
5321
5419
|
*/
|
|
5322
|
-
|
|
5420
|
+
aggregate?: AggregateSpec;
|
|
5323
5421
|
/**
|
|
5324
5422
|
* Pure function from a materialized row → stable id used in the
|
|
5325
5423
|
* output collection. Required — explicit always beats default-with-pitfalls
|
|
@@ -6502,7 +6600,7 @@ declare class Vault {
|
|
|
6502
6600
|
historyStrategy?: HistoryStrategy | undefined;
|
|
6503
6601
|
i18nStrategy?: I18nStrategy | undefined;
|
|
6504
6602
|
syncStrategy?: SyncStrategy | undefined;
|
|
6505
|
-
guardStrategies?: ReadonlyArray<
|
|
6603
|
+
guardStrategies?: ReadonlyArray<GuardStrategyHandleAny> | undefined;
|
|
6506
6604
|
});
|
|
6507
6605
|
/**
|
|
6508
6606
|
* Construct (or reconstruct) the lazy DEK resolver. Captures the
|
|
@@ -6876,7 +6974,7 @@ declare class Vault {
|
|
|
6876
6974
|
* accessor `_getReadOnlyFacade()` (called from the tx amendment
|
|
6877
6975
|
* runner) stays synchronous.
|
|
6878
6976
|
*/
|
|
6879
|
-
_initGuards(handles: ReadonlyArray<
|
|
6977
|
+
_initGuards(handles: ReadonlyArray<GuardStrategyHandleAny>): Promise<void>;
|
|
6880
6978
|
/**
|
|
6881
6979
|
* @internal — Collection.put calls into this. Returns `null` for
|
|
6882
6980
|
* vaults that never registered any guard strategy. Callers MUST
|
|
@@ -10656,7 +10754,7 @@ interface NoydbOptions {
|
|
|
10656
10754
|
* Multiple guards per collection are allowed; they are dispatched
|
|
10657
10755
|
* in registration order on `collection.put()`.
|
|
10658
10756
|
*/
|
|
10659
|
-
readonly guardStrategies?: ReadonlyArray<
|
|
10757
|
+
readonly guardStrategies?: ReadonlyArray<GuardStrategyHandleAny>;
|
|
10660
10758
|
/**
|
|
10661
10759
|
* Optional derivation strategies — source-to-output projections that
|
|
10662
10760
|
* fire on `collection.put()`. Each handle is the output of
|
|
@@ -10929,4 +11027,4 @@ interface DeleteManyResult {
|
|
|
10929
11027
|
}>;
|
|
10930
11028
|
}
|
|
10931
11029
|
|
|
10932
|
-
export { type ConsentAuditEntry as $, type BlobObject as A, type BlobStrategy as B, type BlobPutOptions as C, DICT_COLLECTION_PREFIX as D, type BlobResponseOptions as E, BlobSet as F, type BlobStrategyOpenArgs as G, type CompactRunOptions as H, type I18nStrategy as I, type CompactionContext as J, type CompactionResult as K, DEFAULT_CHUNK_SIZE as L, EXPORT_AUDIT_COLLECTION as M, ExportBlobsAbortedError as N, type ExportBlobsAuditEntry as O, PolicyEnforcer as P, type ExportBlobsHandle as Q, type ExportBlobsOptions as R, type SessionStrategy as S, type ExportedBlob as T, type SlotInfo as U, type SlotRecord as V, type VersionRecord as W, createExportBlobsHandle as X, runCompaction as Y, type ConsentStrategy as Z, CONSENT_AUDIT_COLLECTION as _, type DictEntry as a, applyPatch as a$, type ConsentAuditFilter as a0, type ConsentContext as a1, type ConsentOp as a2, loadConsentEntries as a3, writeConsentEntry as a4, type PeriodsStrategy as a5, type CarryForwardContext as a6, type ClosePeriodOptions as a7, type OpenPeriodOptions as a8, PERIODS_COLLECTION as a9, type DerivedFromMeta as aA, type OutputSpec as aB, type MaterializedViewStrategy as aC, type MaterializedViewStrategyHandle as aD, type OverlayedViewStrategy as aE, Collection as aF, OverlayedViewRegistry as aG, type OverlayedViewStrategyHandle as aH, type SyncStrategy as aI, type Role as aJ, type UnlockedKeyring as aK, type HistoryStrategy as aL, type NoydbStore as aM, type HistoryOptions as aN, type EncryptedEnvelope as aO, type PruneOptions as aP, type AppendInput as aQ, type ChangeType as aR, CollectionInstant as aS, type DiffEntry as aT, type JsonPatch as aU, type JsonPatchOp as aV, type LedgerEntry as aW, LedgerStore as aX, type VaultEngine as aY, VaultInstant as aZ, type VerifyResult as a_, type PeriodRecord as aa, type ReadOnlyCollection as ab, appendPeriodLedgerEntry as ac, assertTsWritable as ad, chainAnchor as ae, loadPeriods as af, validatePeriodName as ag, type GuardStrategy as ah, type GuardChange as ai, type GuardContext as aj, GuardRegistry as ak, type GuardStrategyHandle as al, ReadOnlyVaultFacade as am, type ShadowStrategy as an, CollectionFrame as ao, VaultFrame as ap, type TxStrategy as aq, type AmendmentTxOptions as ar, TxCollection as as, TxContext as at, TxVault as au, runTransaction as av, type DerivationStrategy as aw, type DerivationContext as ax, DerivationRegistry as ay, type DerivationStrategyHandle as az, type DictKeyDescriptor as b, type
|
|
11030
|
+
export { type ConsentAuditEntry as $, type BlobObject as A, type BlobStrategy as B, type BlobPutOptions as C, DICT_COLLECTION_PREFIX as D, type BlobResponseOptions as E, BlobSet as F, type BlobStrategyOpenArgs as G, type CompactRunOptions as H, type I18nStrategy as I, type CompactionContext as J, type CompactionResult as K, DEFAULT_CHUNK_SIZE as L, EXPORT_AUDIT_COLLECTION as M, ExportBlobsAbortedError as N, type ExportBlobsAuditEntry as O, PolicyEnforcer as P, type ExportBlobsHandle as Q, type ExportBlobsOptions as R, type SessionStrategy as S, type ExportedBlob as T, type SlotInfo as U, type SlotRecord as V, type VersionRecord as W, createExportBlobsHandle as X, runCompaction as Y, type ConsentStrategy as Z, CONSENT_AUDIT_COLLECTION as _, type DictEntry as a, applyPatch as a$, type ConsentAuditFilter as a0, type ConsentContext as a1, type ConsentOp as a2, loadConsentEntries as a3, writeConsentEntry as a4, type PeriodsStrategy as a5, type CarryForwardContext as a6, type ClosePeriodOptions as a7, type OpenPeriodOptions as a8, PERIODS_COLLECTION as a9, type DerivedFromMeta as aA, type OutputSpec as aB, type MaterializedViewStrategy as aC, type MaterializedViewStrategyHandle as aD, type OverlayedViewStrategy as aE, Collection as aF, OverlayedViewRegistry as aG, type OverlayedViewStrategyHandle as aH, type SyncStrategy as aI, type Role as aJ, type UnlockedKeyring as aK, type HistoryStrategy as aL, type NoydbStore as aM, type HistoryOptions as aN, type EncryptedEnvelope as aO, type PruneOptions as aP, type AppendInput as aQ, type ChangeType as aR, CollectionInstant as aS, type DiffEntry as aT, type JsonPatch as aU, type JsonPatchOp as aV, type LedgerEntry as aW, LedgerStore as aX, type VaultEngine as aY, VaultInstant as aZ, type VerifyResult as a_, type PeriodRecord as aa, type ReadOnlyCollection as ab, appendPeriodLedgerEntry as ac, assertTsWritable as ad, chainAnchor as ae, loadPeriods as af, validatePeriodName as ag, type GuardStrategy as ah, type GuardChange as ai, type GuardContext as aj, GuardRegistry as ak, type GuardStrategyHandle as al, ReadOnlyVaultFacade as am, type ShadowStrategy as an, CollectionFrame as ao, VaultFrame as ap, type TxStrategy as aq, type AmendmentTxOptions as ar, TxCollection as as, TxContext as at, TxVault as au, runTransaction as av, type DerivationStrategy as aw, type DerivationContext as ax, DerivationRegistry as ay, type DerivationStrategyHandle as az, type DictKeyDescriptor as b, type IssueDelegationOptions as b$, canonicalJson as b0, computePatch as b1, diff as b2, formatDiff as b3, hashEntry as b4, paddedIndex as b5, parseIndex as b6, sha256Hex as b7, type MVQueryContext as b8, type RegisteredMV as b9, type CrossTierAccessEvent as bA, DEFAULT_PUBLIC_ENVELOPE_SCHEMA as bB, DELEGATIONS_COLLECTION as bC, type DeepPartial as bD, type DeepPartialOrNull as bE, type DelegationToken as bF, type DeleteManyResult as bG, type DirtyEntry as bH, ELEVATION_AUDIT_COLLECTION as bI, ElevatedHandle as bJ, type EnrollAuthenticatorOptions as bK, type EnrollAuthenticatorWrappingDEKsOptions as bL, type EnrollAuthenticatorWrappingKEKOptions as bM, type ExportCapability as bN, type ExportChunk as bO, type ExportFormat as bP, type ExportStreamOptions as bQ, type FactorKind as bR, type FactorProofBundle as bS, type FactorRequirement as bT, type GhostRecord as bU, type GrantOptions as bV, type HistoryConfig as bW, type HistoryEntry as bX, INDEXED_STORE_POLICY as bY, type ImportCapability as bZ, type InferOutput as b_, MaterializedViewRegistry as ba, type MaterializedFromMeta as bb, type MaterializedViewOutput as bc, type UnionSource as bd, type UserEnvelope as be, type PublicEnvelope as bf, type GateName as bg, type GatePolicy as bh, type VaultPolicy as bi, type ActiveTier as bj, type FactorProof as bk, type DirectoryConfig as bl, type UserVisibility as bm, Vault as bn, type AccessibleVault as bo, BUNDLE_STORE_POLICY as bp, type BuiltInGateName as bq, type BundleRecipient as br, type CacheOptions as bs, type CacheStats as bt, type ChangeEvent as bu, type CollectionChangeEvent as bv, type CollectionConflictResolver as bw, type Conflict as bx, type ConflictPolicy as by, type ConflictStrategy as bz, DictionaryHandle as c, type SessionPolicy as c$, type IssueMagicLinkGrantOptions as c0, type KeyringAuthenticator as c1, type KeyringAuthenticatorWrappingDEKs as c2, type KeyringAuthenticatorWrappingKEK as c3, type KeyringFile as c4, type ListAccessibleVaultsOptions as c5, type ListPageResult as c6, type ListUsersOptions as c7, type LiveUserEnvelope as c8, type LocaleReadOptions as c9, type PresencePeer as cA, type PublicEnvelopeField as cB, type PublicEnvelopeSchema as cC, type PublicEnvelopeText as cD, type PullMode as cE, type PullOptions as cF, type PullPolicy as cG, type PullResult as cH, type PushMode as cI, type PushOptions as cJ, type PushPolicy as cK, type PushResult as cL, type PutManyItemOptions as cM, type PutManyOptions as cN, type PutManyResult as cO, type QueryAcrossOptions as cP, type QueryAcrossResult as cQ, type QuickUnlockState as cR, QuickUnlockStore as cS, type ReAuthOperation as cT, type RecoverPassphraseInput as cU, type RecoverPassphraseResult as cV, type RecoverUserOptions as cW, type RecoveryProof as cX, type ResolvedPublicEnvelopeSchema as cY, type RevokeOptions as cZ, type RotatePassphraseInput as c_, Lru as ca, type LruOptions as cb, type LruStats as cc, MAGIC_LINK_CONTENT_INFO_PREFIX as cd, MAGIC_LINK_GRANTS_COLLECTION as ce, MAGIC_LINK_KEK_INFO_PREFIX as cf, type MagicLinkGrantPayload as cg, type MagicLinkGrantRecord as ch, NOYDB_BACKUP_VERSION as ci, NOYDB_FORMAT_VERSION as cj, NOYDB_KEYRING_VERSION as ck, NOYDB_SYNC_VERSION as cl, Noydb as cm, type NoydbBundleStore as cn, type NoydbEventMap as co, type NoydbOptions as cp, PUBLIC_ENVELOPE_FIELDS as cq, type PaperRecoveryDoc as cr, type PaperRecoveryEntry as cs, type PassphrasePolicy as ct, type PassphraseValidationResult as cu, type Permission as cv, type Permissions as cw, type PlaintextTranslatorContext as cx, type PlaintextTranslatorFn as cy, PresenceHandle as cz, type DictionaryOptions as d, loadPaperRecoveryEntries as d$, type SetPublicEnvelopeInput as d0, type SlotRewrapCeremony as d1, type SlotRewrapContext as d2, type StandardSchemaV1 as d3, type StandardSchemaV1Issue as d4, type StandardSchemaV1SyncResult as d5, type StoreAuth as d6, type StoreAuthKind as d7, type StoreCapabilities as d8, SyncEngine as d9, type WarningRules as dA, WeakPassphraseError as dB, type WeakPassphraseReason as dC, type WrappedDeksBlob as dD, assertStrongPassphrase as dE, buildRecipientKeyringFile as dF, burnPaperRecoveryEntry as dG, createNoydb as dH, createStore as dI, deriveMagicLinkContentKey as dJ, enrollAuthenticator as dK, estimateEntropy as dL, evaluateExportCapability as dM, evaluateImportCapability as dN, findAuthenticator as dO, hasExportCapability as dP, hasImportCapability as dQ, hasRecoveryEnrolled as dR, isMagicLinkGrantExpired as dS, isPublicEnvelope as dT, issueDelegation as dU, recoverPassphrase as dV, rotatePassphrase as dW, listMagicLinkGrants as dX, listUsers as dY, listUsersWithEnvelopes as dZ, loadActiveDelegations as d_, type SyncMetadata as da, type SyncPolicy as db, SyncScheduler as dc, type SyncSchedulerStatus as dd, type SyncStatus as de, type SyncTarget as df, type SyncTargetRole as dg, SyncTransaction as dh, type SyncTransactionResult as di, type TierMode as dj, type TranslatorAuditEntry as dk, type TxOp as dl, USER_ENVELOPE_COLLECTION as dm, USER_ENVELOPE_MAX_BYTES as dn, type Unsubscribe as dp, type UpdateAuthenticatorOptions as dq, type UpdateUserOptions as dr, UserApi as ds, type UserEnvelopeCheckGate as dt, UserEnvelopeOversizedError as du, type UserEnvelopePresented as dv, type UserInfo as dw, type VaultBackup as dx, type VaultPolicyOnDisk as dy, type VaultSnapshot as dz, type I18nTextDescriptor as e, magicLinkGrantRecordId as e0, mintPaperRecoveryEntry as e1, mintWrappedDeksBlob as e2, readMagicLinkGrantRecord as e3, recoverUser as e4, removeAuthenticator as e5, resolveSchema as e6, revokeDelegation as e7, revokeMagicLinkGrant as e8, savePaperRecoveryEntries as e9, unwrapDeksFromBlob as ea, unwrapDeksFromPaperEntry as eb, unwrapMagicLinkGrant as ec, validatePassphrase as ed, validatePublicEnvelopeInput as ee, validateSchemaInput as ef, validateSchemaOutput as eg, writeMagicLinkGrant as eh, changeSecret as ei, createOwnerKeyring as ej, ensureCollectionDEK as ek, grant as el, loadKeyring as em, persistKeyring as en, revoke as eo, updateAuthenticator as ep, updateKeyringIdentity as eq, type I18nTextOptions as f, applyI18nLocale as g, dictCollectionName as h, dictKey as i, i18nText as j, isDictCollectionName as k, isDictKeyDescriptor as l, isI18nTextDescriptor as m, createEnforcer as n, validateSessionPolicy as o, BLOB_CHUNKS_COLLECTION as p, BLOB_COLLECTION as q, resolveI18nText as r, BLOB_EVICTION_AUDIT_COLLECTION as s, BLOB_INDEX_COLLECTION as t, BLOB_SLOTS_PREFIX as u, validateI18nTextValue as v, BLOB_VERSIONS_PREFIX as w, type BlobEvictionEntry as x, type BlobFieldPolicy as y, type BlobFieldsConfig as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { I as IndexStrategy, d as LazyQuery } from './lazy-builder-Rpd-V3jP.js';
|
|
2
|
-
import { A as AggregateStrategy } from './strategy-
|
|
2
|
+
import { b as AggregateSpec, A as AggregateStrategy } from './strategy-DSTrsZ8t.js';
|
|
3
3
|
import { C as CrdtStrategy, a as CrdtMode, b as CrdtState } from './strategy-BSxFXGzb.js';
|
|
4
|
-
import { N as NoydbError, Q as Query,
|
|
4
|
+
import { N as NoydbError, Q as Query, af as RefDescriptor, Y as JoinableSource, ak as RefViolation, al as ScanBuilder } from './index-BrKaVyPN.js';
|
|
5
5
|
import { F as FieldClause, I as IndexDef, C as CollectionIndexes } from './predicate-Dnu81tsS.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -5062,6 +5062,39 @@ interface GuardStrategyHandle<T extends Record<string, unknown>> {
|
|
|
5062
5062
|
readonly __noydb_strategy: 'guard';
|
|
5063
5063
|
readonly spec: GuardStrategy<T>;
|
|
5064
5064
|
}
|
|
5065
|
+
/**
|
|
5066
|
+
* Existential erasure of `GuardStrategyHandle<T>` — used as the
|
|
5067
|
+
* element type of `ReadonlyArray<>` fields where the per-handle T
|
|
5068
|
+
* differs (e.g. `guardStrategies: [invoiceGuard, disbursementGuard]`).
|
|
5069
|
+
*
|
|
5070
|
+
* Background: `GuardStrategyHandle<T>` is INVARIANT in T because T
|
|
5071
|
+
* appears in callback positions on the spec (`check(incoming: T, ctx)`,
|
|
5072
|
+
* `invariant(changes: ReadonlyArray<GuardChange<T>>, ctx)`). So
|
|
5073
|
+
* `Handle<Invoice>` is not assignable to `Handle<Record<string, unknown>>`.
|
|
5074
|
+
* A bounded existential ("there exists some T satisfying the constraint
|
|
5075
|
+
* such that this is a Handle<T>") is the right shape; TypeScript has
|
|
5076
|
+
* no first-class existentials, so we fake it with a structurally narrow
|
|
5077
|
+
* interface that ERASES T from both the discriminant and the spec.
|
|
5078
|
+
*
|
|
5079
|
+
* Consumers continue to construct typed handles via `withGuard<T>(...)`
|
|
5080
|
+
* which returns `GuardStrategyHandle<T>`. Both `Handle<Invoice>` and
|
|
5081
|
+
* `Handle<Disbursement>` structurally assign to `GuardStrategyHandleAny`,
|
|
5082
|
+
* so an array of them is `GuardStrategyHandleAny[]`.
|
|
5083
|
+
*
|
|
5084
|
+
* Internal code that needs T re-narrows via the runtime discriminant
|
|
5085
|
+
* (`__noydb_strategy === 'guard'`) plus per-handle type information
|
|
5086
|
+
* carried by the registry.
|
|
5087
|
+
*
|
|
5088
|
+
* NOT exported from the public barrel — keeping this internal
|
|
5089
|
+
* discourages consumers from constructing it directly. Used only as
|
|
5090
|
+
* the array-element type on `Vault` / `NoydbOptions.guardStrategies`.
|
|
5091
|
+
*
|
|
5092
|
+
* @internal
|
|
5093
|
+
*/
|
|
5094
|
+
interface GuardStrategyHandleAny {
|
|
5095
|
+
readonly __noydb_strategy: 'guard';
|
|
5096
|
+
readonly spec: GuardStrategy<any>;
|
|
5097
|
+
}
|
|
5065
5098
|
/** Public registration shape. See `withGuard()`. */
|
|
5066
5099
|
interface GuardStrategy<T extends Record<string, unknown>> {
|
|
5067
5100
|
collection: string;
|
|
@@ -5298,6 +5331,28 @@ interface MaterializedViewOutput {
|
|
|
5298
5331
|
value: unknown;
|
|
5299
5332
|
};
|
|
5300
5333
|
}
|
|
5334
|
+
/**
|
|
5335
|
+
* One arm of a UNION materialized view. Reads rows from `collection`,
|
|
5336
|
+
* then maps each into the MV's row shape via `map`.
|
|
5337
|
+
*
|
|
5338
|
+
* The per-source `map` is the schema-unification boundary — sibling
|
|
5339
|
+
* collections can have different schemas, and `map` is where they
|
|
5340
|
+
* meet the MV's row type. The hub does NOT compare schemas across
|
|
5341
|
+
* arms; consumer responsibility is that every arm's `map` returns
|
|
5342
|
+
* the same shape (the strategy's `TRow` type parameter enforces this
|
|
5343
|
+
* at compile time).
|
|
5344
|
+
*/
|
|
5345
|
+
interface UnionSource<TRow extends Record<string, unknown>> {
|
|
5346
|
+
/** Source collection name. Must exist in the vault. */
|
|
5347
|
+
readonly collection: string;
|
|
5348
|
+
/**
|
|
5349
|
+
* Pure function from a source row to the unified MV row shape.
|
|
5350
|
+
* Called once per source row at materialization time. Each arm's
|
|
5351
|
+
* mapped output is concatenated into a single stream before
|
|
5352
|
+
* `groupBy` + `aggregate` run.
|
|
5353
|
+
*/
|
|
5354
|
+
readonly map: (sourceRow: Record<string, unknown>) => TRow;
|
|
5355
|
+
}
|
|
5301
5356
|
/**
|
|
5302
5357
|
* Registration shape passed to `withMaterializedView()`.
|
|
5303
5358
|
*
|
|
@@ -5310,16 +5365,59 @@ interface MaterializedViewStrategy<TRow extends Record<string, unknown>> {
|
|
|
5310
5365
|
*/
|
|
5311
5366
|
name: string;
|
|
5312
5367
|
/**
|
|
5313
|
-
* Declared query. Called at registration time
|
|
5314
|
-
* accessor so the closure can compose collections
|
|
5315
|
-
* pre-existing in-scope references; called again at each
|
|
5368
|
+
* Declared query (single-source mode). Called at registration time
|
|
5369
|
+
* with a vault-shaped accessor so the closure can compose collections
|
|
5370
|
+
* without pre-existing in-scope references; called again at each
|
|
5371
|
+
* refresh.
|
|
5316
5372
|
*
|
|
5317
5373
|
* Built via the same `Query<T>` chainable builder used elsewhere —
|
|
5318
5374
|
* `.where()`, `.join()`, `.groupBy()`, `.aggregate()`. The
|
|
5319
5375
|
* dependency analyzer walks the returned plan to determine source
|
|
5320
5376
|
* collections.
|
|
5377
|
+
*
|
|
5378
|
+
* Mutually exclusive with {@link unionSources}: a strategy must
|
|
5379
|
+
* declare exactly one of `query` (single-source) or `unionSources`
|
|
5380
|
+
* (multi-source UNION). Registration throws
|
|
5381
|
+
* `MaterializedViewConfigError` if both are set or neither is set.
|
|
5382
|
+
*/
|
|
5383
|
+
query?: (db: MVQueryContext) => Query<TRow>;
|
|
5384
|
+
/**
|
|
5385
|
+
* UNION-form sources (#165): an explicit list of sibling collections
|
|
5386
|
+
* that contribute rows to a single MV. Each arm's `map` projects a
|
|
5387
|
+
* source row into the MV's unified row shape; the mapped streams are
|
|
5388
|
+
* concatenated, then {@link groupBy} + {@link aggregate} run on the
|
|
5389
|
+
* combined output.
|
|
5390
|
+
*
|
|
5391
|
+
* Mutually exclusive with {@link query}. Registration throws
|
|
5392
|
+
* `MaterializedViewConfigError` if both are set, if `unionSources`
|
|
5393
|
+
* has fewer than 2 arms, or if two arms name the same `collection`.
|
|
5394
|
+
*
|
|
5395
|
+
* UNION mode replaces the dependency-analyzer path: the source
|
|
5396
|
+
* collections come directly from `unionSources[].collection`, and
|
|
5397
|
+
* {@link sources} is ignored.
|
|
5398
|
+
*/
|
|
5399
|
+
unionSources?: ReadonlyArray<UnionSource<TRow>>;
|
|
5400
|
+
/**
|
|
5401
|
+
* Group-key field(s) for UNION mode (#165). Applied to the
|
|
5402
|
+
* concatenated mapped-row stream from {@link unionSources} before
|
|
5403
|
+
* {@link aggregate} runs. Accepts a single field name or a tuple of
|
|
5404
|
+
* field names for multi-key grouping (same shape as
|
|
5405
|
+
* `Query.groupBy(...fields)`).
|
|
5406
|
+
*
|
|
5407
|
+
* UNION-mode only. Ignored if {@link query} is set — single-source
|
|
5408
|
+
* grouping is expressed inside the `Query<T>` returned from `query()`
|
|
5409
|
+
* via `.groupBy(...).aggregate(...)`.
|
|
5410
|
+
*/
|
|
5411
|
+
groupBy?: string | ReadonlyArray<string>;
|
|
5412
|
+
/**
|
|
5413
|
+
* Aggregation spec for UNION mode (#165). Applied per-group after
|
|
5414
|
+
* {@link groupBy} buckets the concatenated mapped-row stream from
|
|
5415
|
+
* {@link unionSources}. Same shape as the `AggregateSpec` passed to
|
|
5416
|
+
* `Query.aggregate()`.
|
|
5417
|
+
*
|
|
5418
|
+
* UNION-mode only. Ignored if {@link query} is set.
|
|
5321
5419
|
*/
|
|
5322
|
-
|
|
5420
|
+
aggregate?: AggregateSpec;
|
|
5323
5421
|
/**
|
|
5324
5422
|
* Pure function from a materialized row → stable id used in the
|
|
5325
5423
|
* output collection. Required — explicit always beats default-with-pitfalls
|
|
@@ -6502,7 +6600,7 @@ declare class Vault {
|
|
|
6502
6600
|
historyStrategy?: HistoryStrategy | undefined;
|
|
6503
6601
|
i18nStrategy?: I18nStrategy | undefined;
|
|
6504
6602
|
syncStrategy?: SyncStrategy | undefined;
|
|
6505
|
-
guardStrategies?: ReadonlyArray<
|
|
6603
|
+
guardStrategies?: ReadonlyArray<GuardStrategyHandleAny> | undefined;
|
|
6506
6604
|
});
|
|
6507
6605
|
/**
|
|
6508
6606
|
* Construct (or reconstruct) the lazy DEK resolver. Captures the
|
|
@@ -6876,7 +6974,7 @@ declare class Vault {
|
|
|
6876
6974
|
* accessor `_getReadOnlyFacade()` (called from the tx amendment
|
|
6877
6975
|
* runner) stays synchronous.
|
|
6878
6976
|
*/
|
|
6879
|
-
_initGuards(handles: ReadonlyArray<
|
|
6977
|
+
_initGuards(handles: ReadonlyArray<GuardStrategyHandleAny>): Promise<void>;
|
|
6880
6978
|
/**
|
|
6881
6979
|
* @internal — Collection.put calls into this. Returns `null` for
|
|
6882
6980
|
* vaults that never registered any guard strategy. Callers MUST
|
|
@@ -10656,7 +10754,7 @@ interface NoydbOptions {
|
|
|
10656
10754
|
* Multiple guards per collection are allowed; they are dispatched
|
|
10657
10755
|
* in registration order on `collection.put()`.
|
|
10658
10756
|
*/
|
|
10659
|
-
readonly guardStrategies?: ReadonlyArray<
|
|
10757
|
+
readonly guardStrategies?: ReadonlyArray<GuardStrategyHandleAny>;
|
|
10660
10758
|
/**
|
|
10661
10759
|
* Optional derivation strategies — source-to-output projections that
|
|
10662
10760
|
* fire on `collection.put()`. Each handle is the output of
|
|
@@ -10929,4 +11027,4 @@ interface DeleteManyResult {
|
|
|
10929
11027
|
}>;
|
|
10930
11028
|
}
|
|
10931
11029
|
|
|
10932
|
-
export { type ConsentAuditEntry as $, type BlobObject as A, type BlobStrategy as B, type BlobPutOptions as C, DICT_COLLECTION_PREFIX as D, type BlobResponseOptions as E, BlobSet as F, type BlobStrategyOpenArgs as G, type CompactRunOptions as H, type I18nStrategy as I, type CompactionContext as J, type CompactionResult as K, DEFAULT_CHUNK_SIZE as L, EXPORT_AUDIT_COLLECTION as M, ExportBlobsAbortedError as N, type ExportBlobsAuditEntry as O, PolicyEnforcer as P, type ExportBlobsHandle as Q, type ExportBlobsOptions as R, type SessionStrategy as S, type ExportedBlob as T, type SlotInfo as U, type SlotRecord as V, type VersionRecord as W, createExportBlobsHandle as X, runCompaction as Y, type ConsentStrategy as Z, CONSENT_AUDIT_COLLECTION as _, type DictEntry as a, applyPatch as a$, type ConsentAuditFilter as a0, type ConsentContext as a1, type ConsentOp as a2, loadConsentEntries as a3, writeConsentEntry as a4, type PeriodsStrategy as a5, type CarryForwardContext as a6, type ClosePeriodOptions as a7, type OpenPeriodOptions as a8, PERIODS_COLLECTION as a9, type DerivedFromMeta as aA, type OutputSpec as aB, type MaterializedViewStrategy as aC, type MaterializedViewStrategyHandle as aD, type OverlayedViewStrategy as aE, Collection as aF, OverlayedViewRegistry as aG, type OverlayedViewStrategyHandle as aH, type SyncStrategy as aI, type Role as aJ, type UnlockedKeyring as aK, type HistoryStrategy as aL, type NoydbStore as aM, type HistoryOptions as aN, type EncryptedEnvelope as aO, type PruneOptions as aP, type AppendInput as aQ, type ChangeType as aR, CollectionInstant as aS, type DiffEntry as aT, type JsonPatch as aU, type JsonPatchOp as aV, type LedgerEntry as aW, LedgerStore as aX, type VaultEngine as aY, VaultInstant as aZ, type VerifyResult as a_, type PeriodRecord as aa, type ReadOnlyCollection as ab, appendPeriodLedgerEntry as ac, assertTsWritable as ad, chainAnchor as ae, loadPeriods as af, validatePeriodName as ag, type GuardStrategy as ah, type GuardChange as ai, type GuardContext as aj, GuardRegistry as ak, type GuardStrategyHandle as al, ReadOnlyVaultFacade as am, type ShadowStrategy as an, CollectionFrame as ao, VaultFrame as ap, type TxStrategy as aq, type AmendmentTxOptions as ar, TxCollection as as, TxContext as at, TxVault as au, runTransaction as av, type DerivationStrategy as aw, type DerivationContext as ax, DerivationRegistry as ay, type DerivationStrategyHandle as az, type DictKeyDescriptor as b, type
|
|
11030
|
+
export { type ConsentAuditEntry as $, type BlobObject as A, type BlobStrategy as B, type BlobPutOptions as C, DICT_COLLECTION_PREFIX as D, type BlobResponseOptions as E, BlobSet as F, type BlobStrategyOpenArgs as G, type CompactRunOptions as H, type I18nStrategy as I, type CompactionContext as J, type CompactionResult as K, DEFAULT_CHUNK_SIZE as L, EXPORT_AUDIT_COLLECTION as M, ExportBlobsAbortedError as N, type ExportBlobsAuditEntry as O, PolicyEnforcer as P, type ExportBlobsHandle as Q, type ExportBlobsOptions as R, type SessionStrategy as S, type ExportedBlob as T, type SlotInfo as U, type SlotRecord as V, type VersionRecord as W, createExportBlobsHandle as X, runCompaction as Y, type ConsentStrategy as Z, CONSENT_AUDIT_COLLECTION as _, type DictEntry as a, applyPatch as a$, type ConsentAuditFilter as a0, type ConsentContext as a1, type ConsentOp as a2, loadConsentEntries as a3, writeConsentEntry as a4, type PeriodsStrategy as a5, type CarryForwardContext as a6, type ClosePeriodOptions as a7, type OpenPeriodOptions as a8, PERIODS_COLLECTION as a9, type DerivedFromMeta as aA, type OutputSpec as aB, type MaterializedViewStrategy as aC, type MaterializedViewStrategyHandle as aD, type OverlayedViewStrategy as aE, Collection as aF, OverlayedViewRegistry as aG, type OverlayedViewStrategyHandle as aH, type SyncStrategy as aI, type Role as aJ, type UnlockedKeyring as aK, type HistoryStrategy as aL, type NoydbStore as aM, type HistoryOptions as aN, type EncryptedEnvelope as aO, type PruneOptions as aP, type AppendInput as aQ, type ChangeType as aR, CollectionInstant as aS, type DiffEntry as aT, type JsonPatch as aU, type JsonPatchOp as aV, type LedgerEntry as aW, LedgerStore as aX, type VaultEngine as aY, VaultInstant as aZ, type VerifyResult as a_, type PeriodRecord as aa, type ReadOnlyCollection as ab, appendPeriodLedgerEntry as ac, assertTsWritable as ad, chainAnchor as ae, loadPeriods as af, validatePeriodName as ag, type GuardStrategy as ah, type GuardChange as ai, type GuardContext as aj, GuardRegistry as ak, type GuardStrategyHandle as al, ReadOnlyVaultFacade as am, type ShadowStrategy as an, CollectionFrame as ao, VaultFrame as ap, type TxStrategy as aq, type AmendmentTxOptions as ar, TxCollection as as, TxContext as at, TxVault as au, runTransaction as av, type DerivationStrategy as aw, type DerivationContext as ax, DerivationRegistry as ay, type DerivationStrategyHandle as az, type DictKeyDescriptor as b, type IssueDelegationOptions as b$, canonicalJson as b0, computePatch as b1, diff as b2, formatDiff as b3, hashEntry as b4, paddedIndex as b5, parseIndex as b6, sha256Hex as b7, type MVQueryContext as b8, type RegisteredMV as b9, type CrossTierAccessEvent as bA, DEFAULT_PUBLIC_ENVELOPE_SCHEMA as bB, DELEGATIONS_COLLECTION as bC, type DeepPartial as bD, type DeepPartialOrNull as bE, type DelegationToken as bF, type DeleteManyResult as bG, type DirtyEntry as bH, ELEVATION_AUDIT_COLLECTION as bI, ElevatedHandle as bJ, type EnrollAuthenticatorOptions as bK, type EnrollAuthenticatorWrappingDEKsOptions as bL, type EnrollAuthenticatorWrappingKEKOptions as bM, type ExportCapability as bN, type ExportChunk as bO, type ExportFormat as bP, type ExportStreamOptions as bQ, type FactorKind as bR, type FactorProofBundle as bS, type FactorRequirement as bT, type GhostRecord as bU, type GrantOptions as bV, type HistoryConfig as bW, type HistoryEntry as bX, INDEXED_STORE_POLICY as bY, type ImportCapability as bZ, type InferOutput as b_, MaterializedViewRegistry as ba, type MaterializedFromMeta as bb, type MaterializedViewOutput as bc, type UnionSource as bd, type UserEnvelope as be, type PublicEnvelope as bf, type GateName as bg, type GatePolicy as bh, type VaultPolicy as bi, type ActiveTier as bj, type FactorProof as bk, type DirectoryConfig as bl, type UserVisibility as bm, Vault as bn, type AccessibleVault as bo, BUNDLE_STORE_POLICY as bp, type BuiltInGateName as bq, type BundleRecipient as br, type CacheOptions as bs, type CacheStats as bt, type ChangeEvent as bu, type CollectionChangeEvent as bv, type CollectionConflictResolver as bw, type Conflict as bx, type ConflictPolicy as by, type ConflictStrategy as bz, DictionaryHandle as c, type SessionPolicy as c$, type IssueMagicLinkGrantOptions as c0, type KeyringAuthenticator as c1, type KeyringAuthenticatorWrappingDEKs as c2, type KeyringAuthenticatorWrappingKEK as c3, type KeyringFile as c4, type ListAccessibleVaultsOptions as c5, type ListPageResult as c6, type ListUsersOptions as c7, type LiveUserEnvelope as c8, type LocaleReadOptions as c9, type PresencePeer as cA, type PublicEnvelopeField as cB, type PublicEnvelopeSchema as cC, type PublicEnvelopeText as cD, type PullMode as cE, type PullOptions as cF, type PullPolicy as cG, type PullResult as cH, type PushMode as cI, type PushOptions as cJ, type PushPolicy as cK, type PushResult as cL, type PutManyItemOptions as cM, type PutManyOptions as cN, type PutManyResult as cO, type QueryAcrossOptions as cP, type QueryAcrossResult as cQ, type QuickUnlockState as cR, QuickUnlockStore as cS, type ReAuthOperation as cT, type RecoverPassphraseInput as cU, type RecoverPassphraseResult as cV, type RecoverUserOptions as cW, type RecoveryProof as cX, type ResolvedPublicEnvelopeSchema as cY, type RevokeOptions as cZ, type RotatePassphraseInput as c_, Lru as ca, type LruOptions as cb, type LruStats as cc, MAGIC_LINK_CONTENT_INFO_PREFIX as cd, MAGIC_LINK_GRANTS_COLLECTION as ce, MAGIC_LINK_KEK_INFO_PREFIX as cf, type MagicLinkGrantPayload as cg, type MagicLinkGrantRecord as ch, NOYDB_BACKUP_VERSION as ci, NOYDB_FORMAT_VERSION as cj, NOYDB_KEYRING_VERSION as ck, NOYDB_SYNC_VERSION as cl, Noydb as cm, type NoydbBundleStore as cn, type NoydbEventMap as co, type NoydbOptions as cp, PUBLIC_ENVELOPE_FIELDS as cq, type PaperRecoveryDoc as cr, type PaperRecoveryEntry as cs, type PassphrasePolicy as ct, type PassphraseValidationResult as cu, type Permission as cv, type Permissions as cw, type PlaintextTranslatorContext as cx, type PlaintextTranslatorFn as cy, PresenceHandle as cz, type DictionaryOptions as d, loadPaperRecoveryEntries as d$, type SetPublicEnvelopeInput as d0, type SlotRewrapCeremony as d1, type SlotRewrapContext as d2, type StandardSchemaV1 as d3, type StandardSchemaV1Issue as d4, type StandardSchemaV1SyncResult as d5, type StoreAuth as d6, type StoreAuthKind as d7, type StoreCapabilities as d8, SyncEngine as d9, type WarningRules as dA, WeakPassphraseError as dB, type WeakPassphraseReason as dC, type WrappedDeksBlob as dD, assertStrongPassphrase as dE, buildRecipientKeyringFile as dF, burnPaperRecoveryEntry as dG, createNoydb as dH, createStore as dI, deriveMagicLinkContentKey as dJ, enrollAuthenticator as dK, estimateEntropy as dL, evaluateExportCapability as dM, evaluateImportCapability as dN, findAuthenticator as dO, hasExportCapability as dP, hasImportCapability as dQ, hasRecoveryEnrolled as dR, isMagicLinkGrantExpired as dS, isPublicEnvelope as dT, issueDelegation as dU, recoverPassphrase as dV, rotatePassphrase as dW, listMagicLinkGrants as dX, listUsers as dY, listUsersWithEnvelopes as dZ, loadActiveDelegations as d_, type SyncMetadata as da, type SyncPolicy as db, SyncScheduler as dc, type SyncSchedulerStatus as dd, type SyncStatus as de, type SyncTarget as df, type SyncTargetRole as dg, SyncTransaction as dh, type SyncTransactionResult as di, type TierMode as dj, type TranslatorAuditEntry as dk, type TxOp as dl, USER_ENVELOPE_COLLECTION as dm, USER_ENVELOPE_MAX_BYTES as dn, type Unsubscribe as dp, type UpdateAuthenticatorOptions as dq, type UpdateUserOptions as dr, UserApi as ds, type UserEnvelopeCheckGate as dt, UserEnvelopeOversizedError as du, type UserEnvelopePresented as dv, type UserInfo as dw, type VaultBackup as dx, type VaultPolicyOnDisk as dy, type VaultSnapshot as dz, type I18nTextDescriptor as e, magicLinkGrantRecordId as e0, mintPaperRecoveryEntry as e1, mintWrappedDeksBlob as e2, readMagicLinkGrantRecord as e3, recoverUser as e4, removeAuthenticator as e5, resolveSchema as e6, revokeDelegation as e7, revokeMagicLinkGrant as e8, savePaperRecoveryEntries as e9, unwrapDeksFromBlob as ea, unwrapDeksFromPaperEntry as eb, unwrapMagicLinkGrant as ec, validatePassphrase as ed, validatePublicEnvelopeInput as ee, validateSchemaInput as ef, validateSchemaOutput as eg, writeMagicLinkGrant as eh, changeSecret as ei, createOwnerKeyring as ej, ensureCollectionDEK as ek, grant as el, loadKeyring as em, persistKeyring as en, revoke as eo, updateAuthenticator as ep, updateKeyringIdentity as eq, type I18nTextOptions as f, applyI18nLocale as g, dictCollectionName as h, dictKey as i, i18nText as j, isDictCollectionName as k, isDictKeyDescriptor as l, isI18nTextDescriptor as m, createEnforcer as n, validateSessionPolicy as o, BLOB_CHUNKS_COLLECTION as p, BLOB_COLLECTION as q, resolveI18nText as r, BLOB_EVICTION_AUDIT_COLLECTION as s, BLOB_INDEX_COLLECTION as t, BLOB_SLOTS_PREFIX as u, validateI18nTextValue as v, BLOB_VERSIONS_PREFIX as w, type BlobEvictionEntry as x, type BlobFieldPolicy as y, type BlobFieldsConfig as z };
|