@klum-db/lobby 0.2.0-pre.32 → 0.3.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.
@@ -1,5 +1,4 @@
1
- import { Vault as Vault$1, VaultMeta, IndexDef, Operator, LiveQuery, LiveAggregation, AggregateSpec, AggregateResult, RetrieveHit, Collection, Noydb, Query, JoinStrategy, ChangeEvent } from '@noy-db/hub/kernel';
2
- import { Vault } from '@noy-db/hub';
1
+ import { Vault, VaultMeta, IndexDef, Operator, LiveQuery, LiveAggregation, AggregateSpec, AggregateResult, RetrieveHit, Collection, Noydb, Query, JoinStrategy, ChangeEvent } from '@noy-db/hub/cargo';
3
2
  import { DecryptedRecord } from '@noy-db/hub/bundle';
4
3
 
5
4
  /**
@@ -174,7 +173,7 @@ interface FederationMeta {
174
173
  */
175
174
  interface VaultTemplate {
176
175
  readonly version: number;
177
- readonly configure: (vault: Vault$1) => void;
176
+ readonly configure: (vault: Vault) => void;
178
177
  }
179
178
  /** One row in the StateManagement `vault-registry` collection. */
180
179
  interface VaultRegistryRow {
@@ -317,6 +316,13 @@ interface CrossVaultDerivationContext {
317
316
  /** The shard's schema/template version, from its registry row. */
318
317
  readonly schemaVersion: number;
319
318
  }
319
+ /** Tuning for auto-push-on-write (#13). */
320
+ interface InsightAutoPushConfig {
321
+ /** Reset-debounce window (ms): batch a multi-tick write burst into one re-derive. Omit = microtask coalescing. */
322
+ readonly debounceMs?: number;
323
+ /** Skip auto-pushing a shard whose registry `schemaVersion` is below this. */
324
+ readonly minVersion?: number;
325
+ }
320
326
  /**
321
327
  * A push-model cross-vault derivation (#271, Insight Vault — Layer 4).
322
328
  *
@@ -344,8 +350,9 @@ interface CrossVaultDerivationSpec<R = Record<string, unknown>, S = Record<strin
344
350
  * `source` collection, recompute and push that shard's summary
345
351
  * automatically (coalesced per microtask). Default off — without this the
346
352
  * derivation is explicit-refresh-only (drive it with `refreshInsights()`).
353
+ * Pass an object to enable debounce / minVersion tuning (#13).
347
354
  */
348
- readonly autoPush?: boolean;
355
+ readonly autoPush?: boolean | InsightAutoPushConfig;
349
356
  }
350
357
  /** The result of `refreshInsights()`. */
351
358
  interface RefreshInsightsResult {
@@ -673,7 +680,7 @@ declare class VaultGroup<T> {
673
680
  * (#271) and the shard's registry version is behind the template, its cutover
674
681
  * runs inline first — so a behind shard never surfaces a stale handle.
675
682
  */
676
- openShard(partitionKey: string): Promise<Vault$1>;
683
+ openShard(partitionKey: string): Promise<Vault>;
677
684
  /** @internal — open + configure with no cutover-on-open hook (used by the migration path itself to avoid recursion). */
678
685
  private _openShardRaw;
679
686
  /**
@@ -688,13 +695,13 @@ declare class VaultGroup<T> {
688
695
  * the candidate backend's `capabilities.region` must match or this throws
689
696
  * `DataResidencyError` BEFORE provisioning (#271 data-residency guard).
690
697
  */
691
- createShard(partitionKey: string, region?: string): Promise<Vault$1>;
698
+ createShard(partitionKey: string, region?: string): Promise<Vault>;
692
699
  /**
693
700
  * Drill down to a single shard's full Collection API. Throws if the shard is unknown.
694
701
  * Also throws ShardProvisioningError if the registry row exists but the vault has been deleted
695
702
  * (registry/store divergence).
696
703
  */
697
- shard(partitionKey: string): Promise<Vault$1>;
704
+ shard(partitionKey: string): Promise<Vault>;
698
705
  /** A sharded view over one logical collection across all shards. */
699
706
  collection<R = T>(collectionName: string): ShardedCollection<T, R>;
700
707
  /** @internal — eligible (openable-candidate) rows + drift/divergence/unreachable skips. */
@@ -847,10 +854,24 @@ declare class ShardedQuery<T, R = T> {
847
854
  toArray(options?: FanoutQueryOptions): Promise<FanoutResult<R>>;
848
855
  /** @internal — build the change-subscription + relevance binding for this query's group+collection. */
849
856
  liveBinding(): LiveBinding;
850
- /** @internal — joined queries don't support reactive/aggregate surfaces in v1. */
851
- private assertNoJoinLegs;
852
- /** Returns a reactive cross-shard live query — a facade over CrossVaultLive. */
857
+ /**
858
+ * Returns a reactive cross-shard live query — a facade over CrossVaultLive.
859
+ *
860
+ * Joined queries (crossShardJoin / broadcastJoin) are supported (#14): the live
861
+ * value reflects the fully-joined rows. **v1 limitation:** recomputes only on
862
+ * writes to the primary (left) collection; writes to a co-partitioned right
863
+ * collection or a broadcast-dimension collection do NOT trigger a recompute —
864
+ * re-run the query to pick those up.
865
+ */
853
866
  live(options?: LiveQueryOptions): CrossVaultLiveQuery<R>;
867
+ /**
868
+ * @internal — the FanoutRecordSource for aggregate surfaces. With no join legs,
869
+ * returns `this` (partial-reduce-eligible, #8). With join legs, returns a
870
+ * toArray-backed source (fully-joined rows) and NO fanoutReduce, forcing
871
+ * central-reduce over the joined rows (partial-reduce can't span the central
872
+ * broadcast join). Used by scalar `aggregate()` and `ShardedGroupedQuery`.
873
+ */
874
+ aggregateSource(): FanoutRecordSource<R>;
854
875
  /** One-shot distributed aggregate — central reduce over all shard records. */
855
876
  aggregate<Spec extends AggregateSpec>(spec: Spec): CrossVaultAggregation<R, Spec>;
856
877
  /** Begin a grouped cross-shard aggregate. */
@@ -864,4 +885,4 @@ declare class ShardedGroupedQuery<T, R, F extends string> {
864
885
  aggregate<Spec extends AggregateSpec>(spec: Spec): CrossVaultGroupedAggregation<R, F, Spec>;
865
886
  }
866
887
 
867
- export { type MergeStrategy as A, type MigrationStatusRow as B, type CapturedBlueprint as C, type DecryptedMergeOptions as D, type SchemaManifestRow as E, type FanoutQueryOptions as F, type GroupedRow as G, type SchemaRolloutResult as H, ShardedCollection as I, ShardedGroupedQuery as J, ShardedQuery as K, type LiveQueryOptions as L, type MergeCompartmentOptions as M, type ShardingConfig as N, type SurfaceStatus as O, type VaultRegistryRow as P, mergeCompartment as Q, type RefreshInsightsResult as R, StateManagementVault as S, mergeDecryptedRecords as T, resolveFieldAuthority as U, VaultGroup as V, resolveRecordByFieldAuthority as W, type VaultTemplate as a, type SkippedVault as b, type MergeReport as c, type SurfaceDirection as d, type SurfaceConflictPolicy as e, type SurfaceRow as f, type VaultGroupOptions as g, CrossVaultAggregation as h, type CrossVaultDerivationContext as i, type CrossVaultDerivationSpec as j, CrossVaultGroupedAggregation as k, type CrossVaultLiveAggregation as l, type CrossVaultLiveQuery as m, type DeploymentEvent as n, type FanoutResult as o, type FederatedRetrieveHit as p, type FederatedRetrieveOptions as q, type FederatedRetrieveResult as r, type FederationMeta as s, type FieldAuthorityInputs as t, type FieldAuthorityPolicy as u, FieldAuthorityPolicyMissingError as v, type FieldAuthorityRule as w, FieldLevelDeferredError as x, type GroupMeta as y, type MergeConflict as z };
888
+ export { type MergeStrategy as A, type MigrationStatusRow as B, type CapturedBlueprint as C, type DecryptedMergeOptions as D, type SchemaManifestRow as E, type FanoutQueryOptions as F, type GroupedRow as G, type SchemaRolloutResult as H, type InsightAutoPushConfig as I, ShardedCollection as J, ShardedGroupedQuery as K, type LiveQueryOptions as L, type MergeCompartmentOptions as M, ShardedQuery as N, type ShardingConfig as O, type SurfaceStatus as P, type VaultRegistryRow as Q, type RefreshInsightsResult as R, StateManagementVault as S, mergeCompartment as T, mergeDecryptedRecords as U, VaultGroup as V, resolveFieldAuthority as W, resolveRecordByFieldAuthority as X, type VaultTemplate as a, type SkippedVault as b, type MergeReport as c, type SurfaceDirection as d, type SurfaceConflictPolicy as e, type SurfaceRow as f, type VaultGroupOptions as g, CrossVaultAggregation as h, type CrossVaultDerivationContext as i, type CrossVaultDerivationSpec as j, CrossVaultGroupedAggregation as k, type CrossVaultLiveAggregation as l, type CrossVaultLiveQuery as m, type DeploymentEvent as n, type FanoutResult as o, type FederatedRetrieveHit as p, type FederatedRetrieveOptions as q, type FederatedRetrieveResult as r, type FederationMeta as s, type FieldAuthorityInputs as t, type FieldAuthorityPolicy as u, FieldAuthorityPolicyMissingError as v, type FieldAuthorityRule as w, FieldLevelDeferredError as x, type GroupMeta as y, type MergeConflict as z };
@@ -1,5 +1,4 @@
1
- import { Vault as Vault$1, VaultMeta, IndexDef, Operator, LiveQuery, LiveAggregation, AggregateSpec, AggregateResult, RetrieveHit, Collection, Noydb, Query, JoinStrategy, ChangeEvent } from '@noy-db/hub/kernel';
2
- import { Vault } from '@noy-db/hub';
1
+ import { Vault, VaultMeta, IndexDef, Operator, LiveQuery, LiveAggregation, AggregateSpec, AggregateResult, RetrieveHit, Collection, Noydb, Query, JoinStrategy, ChangeEvent } from '@noy-db/hub/cargo';
3
2
  import { DecryptedRecord } from '@noy-db/hub/bundle';
4
3
 
5
4
  /**
@@ -174,7 +173,7 @@ interface FederationMeta {
174
173
  */
175
174
  interface VaultTemplate {
176
175
  readonly version: number;
177
- readonly configure: (vault: Vault$1) => void;
176
+ readonly configure: (vault: Vault) => void;
178
177
  }
179
178
  /** One row in the StateManagement `vault-registry` collection. */
180
179
  interface VaultRegistryRow {
@@ -317,6 +316,13 @@ interface CrossVaultDerivationContext {
317
316
  /** The shard's schema/template version, from its registry row. */
318
317
  readonly schemaVersion: number;
319
318
  }
319
+ /** Tuning for auto-push-on-write (#13). */
320
+ interface InsightAutoPushConfig {
321
+ /** Reset-debounce window (ms): batch a multi-tick write burst into one re-derive. Omit = microtask coalescing. */
322
+ readonly debounceMs?: number;
323
+ /** Skip auto-pushing a shard whose registry `schemaVersion` is below this. */
324
+ readonly minVersion?: number;
325
+ }
320
326
  /**
321
327
  * A push-model cross-vault derivation (#271, Insight Vault — Layer 4).
322
328
  *
@@ -344,8 +350,9 @@ interface CrossVaultDerivationSpec<R = Record<string, unknown>, S = Record<strin
344
350
  * `source` collection, recompute and push that shard's summary
345
351
  * automatically (coalesced per microtask). Default off — without this the
346
352
  * derivation is explicit-refresh-only (drive it with `refreshInsights()`).
353
+ * Pass an object to enable debounce / minVersion tuning (#13).
347
354
  */
348
- readonly autoPush?: boolean;
355
+ readonly autoPush?: boolean | InsightAutoPushConfig;
349
356
  }
350
357
  /** The result of `refreshInsights()`. */
351
358
  interface RefreshInsightsResult {
@@ -673,7 +680,7 @@ declare class VaultGroup<T> {
673
680
  * (#271) and the shard's registry version is behind the template, its cutover
674
681
  * runs inline first — so a behind shard never surfaces a stale handle.
675
682
  */
676
- openShard(partitionKey: string): Promise<Vault$1>;
683
+ openShard(partitionKey: string): Promise<Vault>;
677
684
  /** @internal — open + configure with no cutover-on-open hook (used by the migration path itself to avoid recursion). */
678
685
  private _openShardRaw;
679
686
  /**
@@ -688,13 +695,13 @@ declare class VaultGroup<T> {
688
695
  * the candidate backend's `capabilities.region` must match or this throws
689
696
  * `DataResidencyError` BEFORE provisioning (#271 data-residency guard).
690
697
  */
691
- createShard(partitionKey: string, region?: string): Promise<Vault$1>;
698
+ createShard(partitionKey: string, region?: string): Promise<Vault>;
692
699
  /**
693
700
  * Drill down to a single shard's full Collection API. Throws if the shard is unknown.
694
701
  * Also throws ShardProvisioningError if the registry row exists but the vault has been deleted
695
702
  * (registry/store divergence).
696
703
  */
697
- shard(partitionKey: string): Promise<Vault$1>;
704
+ shard(partitionKey: string): Promise<Vault>;
698
705
  /** A sharded view over one logical collection across all shards. */
699
706
  collection<R = T>(collectionName: string): ShardedCollection<T, R>;
700
707
  /** @internal — eligible (openable-candidate) rows + drift/divergence/unreachable skips. */
@@ -847,10 +854,24 @@ declare class ShardedQuery<T, R = T> {
847
854
  toArray(options?: FanoutQueryOptions): Promise<FanoutResult<R>>;
848
855
  /** @internal — build the change-subscription + relevance binding for this query's group+collection. */
849
856
  liveBinding(): LiveBinding;
850
- /** @internal — joined queries don't support reactive/aggregate surfaces in v1. */
851
- private assertNoJoinLegs;
852
- /** Returns a reactive cross-shard live query — a facade over CrossVaultLive. */
857
+ /**
858
+ * Returns a reactive cross-shard live query — a facade over CrossVaultLive.
859
+ *
860
+ * Joined queries (crossShardJoin / broadcastJoin) are supported (#14): the live
861
+ * value reflects the fully-joined rows. **v1 limitation:** recomputes only on
862
+ * writes to the primary (left) collection; writes to a co-partitioned right
863
+ * collection or a broadcast-dimension collection do NOT trigger a recompute —
864
+ * re-run the query to pick those up.
865
+ */
853
866
  live(options?: LiveQueryOptions): CrossVaultLiveQuery<R>;
867
+ /**
868
+ * @internal — the FanoutRecordSource for aggregate surfaces. With no join legs,
869
+ * returns `this` (partial-reduce-eligible, #8). With join legs, returns a
870
+ * toArray-backed source (fully-joined rows) and NO fanoutReduce, forcing
871
+ * central-reduce over the joined rows (partial-reduce can't span the central
872
+ * broadcast join). Used by scalar `aggregate()` and `ShardedGroupedQuery`.
873
+ */
874
+ aggregateSource(): FanoutRecordSource<R>;
854
875
  /** One-shot distributed aggregate — central reduce over all shard records. */
855
876
  aggregate<Spec extends AggregateSpec>(spec: Spec): CrossVaultAggregation<R, Spec>;
856
877
  /** Begin a grouped cross-shard aggregate. */
@@ -864,4 +885,4 @@ declare class ShardedGroupedQuery<T, R, F extends string> {
864
885
  aggregate<Spec extends AggregateSpec>(spec: Spec): CrossVaultGroupedAggregation<R, F, Spec>;
865
886
  }
866
887
 
867
- export { type MergeStrategy as A, type MigrationStatusRow as B, type CapturedBlueprint as C, type DecryptedMergeOptions as D, type SchemaManifestRow as E, type FanoutQueryOptions as F, type GroupedRow as G, type SchemaRolloutResult as H, ShardedCollection as I, ShardedGroupedQuery as J, ShardedQuery as K, type LiveQueryOptions as L, type MergeCompartmentOptions as M, type ShardingConfig as N, type SurfaceStatus as O, type VaultRegistryRow as P, mergeCompartment as Q, type RefreshInsightsResult as R, StateManagementVault as S, mergeDecryptedRecords as T, resolveFieldAuthority as U, VaultGroup as V, resolveRecordByFieldAuthority as W, type VaultTemplate as a, type SkippedVault as b, type MergeReport as c, type SurfaceDirection as d, type SurfaceConflictPolicy as e, type SurfaceRow as f, type VaultGroupOptions as g, CrossVaultAggregation as h, type CrossVaultDerivationContext as i, type CrossVaultDerivationSpec as j, CrossVaultGroupedAggregation as k, type CrossVaultLiveAggregation as l, type CrossVaultLiveQuery as m, type DeploymentEvent as n, type FanoutResult as o, type FederatedRetrieveHit as p, type FederatedRetrieveOptions as q, type FederatedRetrieveResult as r, type FederationMeta as s, type FieldAuthorityInputs as t, type FieldAuthorityPolicy as u, FieldAuthorityPolicyMissingError as v, type FieldAuthorityRule as w, FieldLevelDeferredError as x, type GroupMeta as y, type MergeConflict as z };
888
+ export { type MergeStrategy as A, type MigrationStatusRow as B, type CapturedBlueprint as C, type DecryptedMergeOptions as D, type SchemaManifestRow as E, type FanoutQueryOptions as F, type GroupedRow as G, type SchemaRolloutResult as H, type InsightAutoPushConfig as I, ShardedCollection as J, ShardedGroupedQuery as K, type LiveQueryOptions as L, type MergeCompartmentOptions as M, ShardedQuery as N, type ShardingConfig as O, type SurfaceStatus as P, type VaultRegistryRow as Q, type RefreshInsightsResult as R, StateManagementVault as S, mergeCompartment as T, mergeDecryptedRecords as U, VaultGroup as V, resolveFieldAuthority as W, resolveRecordByFieldAuthority as X, type VaultTemplate as a, type SkippedVault as b, type MergeReport as c, type SurfaceDirection as d, type SurfaceConflictPolicy as e, type SurfaceRow as f, type VaultGroupOptions as g, CrossVaultAggregation as h, type CrossVaultDerivationContext as i, type CrossVaultDerivationSpec as j, CrossVaultGroupedAggregation as k, type CrossVaultLiveAggregation as l, type CrossVaultLiveQuery as m, type DeploymentEvent as n, type FanoutResult as o, type FederatedRetrieveHit as p, type FederatedRetrieveOptions as q, type FederatedRetrieveResult as r, type FederationMeta as s, type FieldAuthorityInputs as t, type FieldAuthorityPolicy as u, FieldAuthorityPolicyMissingError as v, type FieldAuthorityRule as w, FieldLevelDeferredError as x, type GroupMeta as y, type MergeConflict as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klum-db/lobby",
3
- "version": "0.2.0-pre.32",
3
+ "version": "0.3.0-pre.1",
4
4
  "description": "klum-db Lobby — orchestrates a group of sovereign noy-db vaults (federation, interchange, custody). The outward framework to noy-db's inward vault.",
5
5
  "license": "MIT",
6
6
  "author": "vLannaAi <vicio@lanna.ai>",
@@ -38,13 +38,13 @@
38
38
  "LICENSE"
39
39
  ],
40
40
  "engines": {
41
- "node": ">=18.0.0"
41
+ "node": ">=22.0.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@noy-db/as-xlsx": "^0.2.0-pre.29",
45
- "@noy-db/hub": "^0.2.0-pre.29",
46
- "@noy-db/in-devtools": "^0.2.0-pre.29",
47
- "@noy-db/to-meter": "^0.2.0-pre.29"
44
+ "@noy-db/as-xlsx": "^0.3.0-pre.1",
45
+ "@noy-db/hub": "^0.3.0-pre.1",
46
+ "@noy-db/in-devtools": "^0.3.0-pre.1",
47
+ "@noy-db/to-meter": "^0.3.0-pre.1"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@noy-db/in-devtools": {
@@ -56,12 +56,12 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@eslint/js": "^9.18.0",
59
- "@noy-db/as-xlsx": "0.2.0-pre.30",
60
- "@noy-db/as-zip": "0.2.0-pre.30",
61
- "@noy-db/hub": "0.2.0-pre.30",
62
- "@noy-db/in-devtools": "0.2.0-pre.30",
63
- "@noy-db/to-memory": "0.2.0-pre.30",
64
- "@noy-db/to-meter": "0.2.0-pre.30",
59
+ "@noy-db/as-xlsx": "0.3.0-pre.1",
60
+ "@noy-db/as-zip": "0.3.0-pre.1",
61
+ "@noy-db/hub": "0.3.0-pre.1",
62
+ "@noy-db/in-devtools": "0.3.0-pre.1",
63
+ "@noy-db/to-memory": "0.3.0-pre.1",
64
+ "@noy-db/to-meter": "0.3.0-pre.1",
65
65
  "@types/node": "^22.0.0",
66
66
  "eslint": "^9.18.0",
67
67
  "tsup": "^8.4.0",
@@ -87,7 +87,8 @@
87
87
  "scripts": {
88
88
  "build": "tsup",
89
89
  "test": "vitest run",
90
- "lint": "eslint src/",
91
- "typecheck": "tsc --noEmit"
90
+ "lint": "eslint src/ && pnpm check:architecture",
91
+ "typecheck": "tsc --noEmit",
92
+ "check:architecture": "node scripts/check-architecture.mjs"
92
93
  }
93
94
  }