@klum-db/lobby 0.2.0-pre.31 → 0.2.0-pre.32
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/bin/klum.d.cts +1 -1
- package/dist/bin/klum.d.ts +1 -1
- package/dist/index.cjs +136 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +107 -2
- package/dist/index.js.map +1 -1
- package/dist/{vault-group-DqEyXbN1.d.cts → vault-group-BchRCDm5.d.cts} +61 -3
- package/dist/{vault-group-DqEyXbN1.d.ts → vault-group-BchRCDm5.d.ts} +61 -3
- package/package.json +11 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vault as Vault$1, IndexDef, Operator, LiveQuery, LiveAggregation, AggregateSpec, AggregateResult, Collection, Noydb, Query, JoinStrategy, ChangeEvent } from '@noy-db/hub/kernel';
|
|
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
2
|
import { Vault } from '@noy-db/hub';
|
|
3
3
|
import { DecryptedRecord } from '@noy-db/hub/bundle';
|
|
4
4
|
|
|
@@ -154,6 +154,17 @@ declare function mergeCompartment(receiver: Vault, compartmentBytes: Uint8Array,
|
|
|
154
154
|
* docs/superpowers/specs/2026-06-07-mvf-vaultgroup-routing-mvp-design.md.
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
|
+
/** A federation group's own descriptive metadata (reuses the noy-db VaultMeta shape). */
|
|
158
|
+
type GroupMeta = VaultMeta;
|
|
159
|
+
/** Federation-level metadata: the group's own meta + each member vault's vaultMeta. */
|
|
160
|
+
interface FederationMeta {
|
|
161
|
+
readonly meta: GroupMeta | undefined;
|
|
162
|
+
readonly vaults: ReadonlyArray<{
|
|
163
|
+
readonly vaultId: string;
|
|
164
|
+
readonly partitionKey: string;
|
|
165
|
+
readonly meta: VaultMeta | undefined;
|
|
166
|
+
}>;
|
|
167
|
+
}
|
|
157
168
|
/**
|
|
158
169
|
* A schema blueprint for a class of shard vaults. `configure` is
|
|
159
170
|
* re-applied to every shard handle so all shards are configured
|
|
@@ -210,6 +221,8 @@ interface VaultGroupOptions<T> {
|
|
|
210
221
|
* Zero cost for shards never opened. Default `false` (use `rolloutSchema`).
|
|
211
222
|
*/
|
|
212
223
|
readonly cutoverOnOpen?: boolean;
|
|
224
|
+
/** Descriptive group-level metadata (label/description/icon) for UIs. Descriptive-only. */
|
|
225
|
+
readonly meta?: GroupMeta;
|
|
213
226
|
}
|
|
214
227
|
/** Result of `VaultGroup.rolloutSchema` (#271 active batch runner). */
|
|
215
228
|
interface SchemaRolloutResult {
|
|
@@ -241,6 +254,32 @@ interface FanoutResult<R> {
|
|
|
241
254
|
readonly results: R[];
|
|
242
255
|
readonly skippedVaults: SkippedVault[];
|
|
243
256
|
}
|
|
257
|
+
/** Options for cross-vault federated retrieval (#26). Extends the fan-out base. */
|
|
258
|
+
interface FederatedRetrieveOptions extends FanoutQueryOptions {
|
|
259
|
+
readonly mode?: 'lexical' | 'semantic' | 'hybrid';
|
|
260
|
+
readonly limit?: number;
|
|
261
|
+
readonly minScore?: number;
|
|
262
|
+
readonly fields?: readonly string[];
|
|
263
|
+
readonly match?: 'any' | 'all';
|
|
264
|
+
readonly prefix?: boolean;
|
|
265
|
+
readonly snippetWindow?: number;
|
|
266
|
+
readonly includeRecord?: boolean;
|
|
267
|
+
/** Payload filter applied per-vault (retrieve ∩ where), rebuilt into each shard's `within`. */
|
|
268
|
+
readonly where?: ReadonlyArray<readonly [field: string, op: Operator, value: unknown]>;
|
|
269
|
+
/** RRF constant; default 60. */
|
|
270
|
+
readonly rrfK?: number;
|
|
271
|
+
/** Re-throw a per-shard retrieve() failure instead of skipping it. */
|
|
272
|
+
readonly failFast?: boolean;
|
|
273
|
+
}
|
|
274
|
+
/** A fused hit carrying the originating shard (provenance). */
|
|
275
|
+
interface FederatedRetrieveHit<R> extends RetrieveHit<R> {
|
|
276
|
+
readonly vault: string;
|
|
277
|
+
}
|
|
278
|
+
/** Result of `ShardedCollection.retrieve()`. */
|
|
279
|
+
interface FederatedRetrieveResult<R> {
|
|
280
|
+
readonly hits: FederatedRetrieveHit<R>[];
|
|
281
|
+
readonly skippedVaults: SkippedVault[];
|
|
282
|
+
}
|
|
244
283
|
/** A single captured where-clause, replayed inside each shard. */
|
|
245
284
|
interface WhereClause {
|
|
246
285
|
readonly field: string;
|
|
@@ -590,13 +629,15 @@ declare class VaultGroup<T> {
|
|
|
590
629
|
/** @internal */ readonly sharding: ShardingConfig<T>;
|
|
591
630
|
/** @internal */ readonly template: VaultTemplate;
|
|
592
631
|
/** @internal — lazy cutover-on-open (#271). */ readonly cutoverOnOpen: boolean;
|
|
632
|
+
/** @internal — group-level descriptive metadata (#27). */ readonly meta?: GroupMeta | undefined;
|
|
593
633
|
constructor(
|
|
594
634
|
/** @internal */ db: Noydb,
|
|
595
635
|
/** @internal */ name: string,
|
|
596
636
|
/** @internal */ registry: Collection<VaultRegistryRow>,
|
|
597
637
|
/** @internal */ sharding: ShardingConfig<T>,
|
|
598
638
|
/** @internal */ template: VaultTemplate,
|
|
599
|
-
/** @internal — lazy cutover-on-open (#271). */ cutoverOnOpen?: boolean
|
|
639
|
+
/** @internal — lazy cutover-on-open (#271). */ cutoverOnOpen?: boolean,
|
|
640
|
+
/** @internal — group-level descriptive metadata (#27). */ meta?: GroupMeta | undefined);
|
|
600
641
|
/** @internal — set when the group is managed (no explicit registry). */
|
|
601
642
|
private stateVault;
|
|
602
643
|
/** @internal */
|
|
@@ -619,6 +660,14 @@ declare class VaultGroup<T> {
|
|
|
619
660
|
* `liveBinding().isRelevant` already applies to the reactive path.
|
|
620
661
|
*/
|
|
621
662
|
allRows(): Promise<VaultRegistryRow[]>;
|
|
663
|
+
/**
|
|
664
|
+
* Federation-level descriptive metadata (#27): this group's `meta` plus each
|
|
665
|
+
* member vault's `vaultMeta` (read via `getMeta()`). Best-effort per shard — a
|
|
666
|
+
* shard that fails to open yields `meta: undefined` for that entry, never
|
|
667
|
+
* throwing. Member meta is transient per-open (noy-db sets it at `openVault`,
|
|
668
|
+
* does not persist it); this surfaces whatever each vault was opened with.
|
|
669
|
+
*/
|
|
670
|
+
federationMeta(): Promise<FederationMeta>;
|
|
622
671
|
/**
|
|
623
672
|
* Open an existing shard and apply the template. When `cutoverOnOpen` is set
|
|
624
673
|
* (#271) and the shard's registry version is behind the template, its cutover
|
|
@@ -757,6 +806,15 @@ declare class ShardedCollection<T, R = T> {
|
|
|
757
806
|
put(id: string, record: T): Promise<void>;
|
|
758
807
|
/** Begin a cross-shard fan-out query. */
|
|
759
808
|
query(): ShardedQuery<T, R>;
|
|
809
|
+
/**
|
|
810
|
+
* Cross-vault federated retrieval (#26): scatter-gather across all eligible
|
|
811
|
+
* shards — each shard runs its own trusted-tier `retrieve()`, then results are
|
|
812
|
+
* RRF-fused by rank only (no cross-vault statistics cross the DEK boundary).
|
|
813
|
+
* Every hit carries its originating `vault`. An unreachable, schema-drifted, or
|
|
814
|
+
* un-indexed shard is skipped (`skippedVaults`); pass `failFast` to re-throw
|
|
815
|
+
* the first per-shard error instead.
|
|
816
|
+
*/
|
|
817
|
+
retrieve(query: string, opts?: FederatedRetrieveOptions): Promise<FederatedRetrieveResult<R>>;
|
|
760
818
|
}
|
|
761
819
|
declare class ShardedQuery<T, R = T> {
|
|
762
820
|
private readonly group;
|
|
@@ -806,4 +864,4 @@ declare class ShardedGroupedQuery<T, R, F extends string> {
|
|
|
806
864
|
aggregate<Spec extends AggregateSpec>(spec: Spec): CrossVaultGroupedAggregation<R, F, Spec>;
|
|
807
865
|
}
|
|
808
866
|
|
|
809
|
-
export {
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vault as Vault$1, IndexDef, Operator, LiveQuery, LiveAggregation, AggregateSpec, AggregateResult, Collection, Noydb, Query, JoinStrategy, ChangeEvent } from '@noy-db/hub/kernel';
|
|
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
2
|
import { Vault } from '@noy-db/hub';
|
|
3
3
|
import { DecryptedRecord } from '@noy-db/hub/bundle';
|
|
4
4
|
|
|
@@ -154,6 +154,17 @@ declare function mergeCompartment(receiver: Vault, compartmentBytes: Uint8Array,
|
|
|
154
154
|
* docs/superpowers/specs/2026-06-07-mvf-vaultgroup-routing-mvp-design.md.
|
|
155
155
|
*/
|
|
156
156
|
|
|
157
|
+
/** A federation group's own descriptive metadata (reuses the noy-db VaultMeta shape). */
|
|
158
|
+
type GroupMeta = VaultMeta;
|
|
159
|
+
/** Federation-level metadata: the group's own meta + each member vault's vaultMeta. */
|
|
160
|
+
interface FederationMeta {
|
|
161
|
+
readonly meta: GroupMeta | undefined;
|
|
162
|
+
readonly vaults: ReadonlyArray<{
|
|
163
|
+
readonly vaultId: string;
|
|
164
|
+
readonly partitionKey: string;
|
|
165
|
+
readonly meta: VaultMeta | undefined;
|
|
166
|
+
}>;
|
|
167
|
+
}
|
|
157
168
|
/**
|
|
158
169
|
* A schema blueprint for a class of shard vaults. `configure` is
|
|
159
170
|
* re-applied to every shard handle so all shards are configured
|
|
@@ -210,6 +221,8 @@ interface VaultGroupOptions<T> {
|
|
|
210
221
|
* Zero cost for shards never opened. Default `false` (use `rolloutSchema`).
|
|
211
222
|
*/
|
|
212
223
|
readonly cutoverOnOpen?: boolean;
|
|
224
|
+
/** Descriptive group-level metadata (label/description/icon) for UIs. Descriptive-only. */
|
|
225
|
+
readonly meta?: GroupMeta;
|
|
213
226
|
}
|
|
214
227
|
/** Result of `VaultGroup.rolloutSchema` (#271 active batch runner). */
|
|
215
228
|
interface SchemaRolloutResult {
|
|
@@ -241,6 +254,32 @@ interface FanoutResult<R> {
|
|
|
241
254
|
readonly results: R[];
|
|
242
255
|
readonly skippedVaults: SkippedVault[];
|
|
243
256
|
}
|
|
257
|
+
/** Options for cross-vault federated retrieval (#26). Extends the fan-out base. */
|
|
258
|
+
interface FederatedRetrieveOptions extends FanoutQueryOptions {
|
|
259
|
+
readonly mode?: 'lexical' | 'semantic' | 'hybrid';
|
|
260
|
+
readonly limit?: number;
|
|
261
|
+
readonly minScore?: number;
|
|
262
|
+
readonly fields?: readonly string[];
|
|
263
|
+
readonly match?: 'any' | 'all';
|
|
264
|
+
readonly prefix?: boolean;
|
|
265
|
+
readonly snippetWindow?: number;
|
|
266
|
+
readonly includeRecord?: boolean;
|
|
267
|
+
/** Payload filter applied per-vault (retrieve ∩ where), rebuilt into each shard's `within`. */
|
|
268
|
+
readonly where?: ReadonlyArray<readonly [field: string, op: Operator, value: unknown]>;
|
|
269
|
+
/** RRF constant; default 60. */
|
|
270
|
+
readonly rrfK?: number;
|
|
271
|
+
/** Re-throw a per-shard retrieve() failure instead of skipping it. */
|
|
272
|
+
readonly failFast?: boolean;
|
|
273
|
+
}
|
|
274
|
+
/** A fused hit carrying the originating shard (provenance). */
|
|
275
|
+
interface FederatedRetrieveHit<R> extends RetrieveHit<R> {
|
|
276
|
+
readonly vault: string;
|
|
277
|
+
}
|
|
278
|
+
/** Result of `ShardedCollection.retrieve()`. */
|
|
279
|
+
interface FederatedRetrieveResult<R> {
|
|
280
|
+
readonly hits: FederatedRetrieveHit<R>[];
|
|
281
|
+
readonly skippedVaults: SkippedVault[];
|
|
282
|
+
}
|
|
244
283
|
/** A single captured where-clause, replayed inside each shard. */
|
|
245
284
|
interface WhereClause {
|
|
246
285
|
readonly field: string;
|
|
@@ -590,13 +629,15 @@ declare class VaultGroup<T> {
|
|
|
590
629
|
/** @internal */ readonly sharding: ShardingConfig<T>;
|
|
591
630
|
/** @internal */ readonly template: VaultTemplate;
|
|
592
631
|
/** @internal — lazy cutover-on-open (#271). */ readonly cutoverOnOpen: boolean;
|
|
632
|
+
/** @internal — group-level descriptive metadata (#27). */ readonly meta?: GroupMeta | undefined;
|
|
593
633
|
constructor(
|
|
594
634
|
/** @internal */ db: Noydb,
|
|
595
635
|
/** @internal */ name: string,
|
|
596
636
|
/** @internal */ registry: Collection<VaultRegistryRow>,
|
|
597
637
|
/** @internal */ sharding: ShardingConfig<T>,
|
|
598
638
|
/** @internal */ template: VaultTemplate,
|
|
599
|
-
/** @internal — lazy cutover-on-open (#271). */ cutoverOnOpen?: boolean
|
|
639
|
+
/** @internal — lazy cutover-on-open (#271). */ cutoverOnOpen?: boolean,
|
|
640
|
+
/** @internal — group-level descriptive metadata (#27). */ meta?: GroupMeta | undefined);
|
|
600
641
|
/** @internal — set when the group is managed (no explicit registry). */
|
|
601
642
|
private stateVault;
|
|
602
643
|
/** @internal */
|
|
@@ -619,6 +660,14 @@ declare class VaultGroup<T> {
|
|
|
619
660
|
* `liveBinding().isRelevant` already applies to the reactive path.
|
|
620
661
|
*/
|
|
621
662
|
allRows(): Promise<VaultRegistryRow[]>;
|
|
663
|
+
/**
|
|
664
|
+
* Federation-level descriptive metadata (#27): this group's `meta` plus each
|
|
665
|
+
* member vault's `vaultMeta` (read via `getMeta()`). Best-effort per shard — a
|
|
666
|
+
* shard that fails to open yields `meta: undefined` for that entry, never
|
|
667
|
+
* throwing. Member meta is transient per-open (noy-db sets it at `openVault`,
|
|
668
|
+
* does not persist it); this surfaces whatever each vault was opened with.
|
|
669
|
+
*/
|
|
670
|
+
federationMeta(): Promise<FederationMeta>;
|
|
622
671
|
/**
|
|
623
672
|
* Open an existing shard and apply the template. When `cutoverOnOpen` is set
|
|
624
673
|
* (#271) and the shard's registry version is behind the template, its cutover
|
|
@@ -757,6 +806,15 @@ declare class ShardedCollection<T, R = T> {
|
|
|
757
806
|
put(id: string, record: T): Promise<void>;
|
|
758
807
|
/** Begin a cross-shard fan-out query. */
|
|
759
808
|
query(): ShardedQuery<T, R>;
|
|
809
|
+
/**
|
|
810
|
+
* Cross-vault federated retrieval (#26): scatter-gather across all eligible
|
|
811
|
+
* shards — each shard runs its own trusted-tier `retrieve()`, then results are
|
|
812
|
+
* RRF-fused by rank only (no cross-vault statistics cross the DEK boundary).
|
|
813
|
+
* Every hit carries its originating `vault`. An unreachable, schema-drifted, or
|
|
814
|
+
* un-indexed shard is skipped (`skippedVaults`); pass `failFast` to re-throw
|
|
815
|
+
* the first per-shard error instead.
|
|
816
|
+
*/
|
|
817
|
+
retrieve(query: string, opts?: FederatedRetrieveOptions): Promise<FederatedRetrieveResult<R>>;
|
|
760
818
|
}
|
|
761
819
|
declare class ShardedQuery<T, R = T> {
|
|
762
820
|
private readonly group;
|
|
@@ -806,4 +864,4 @@ declare class ShardedGroupedQuery<T, R, F extends string> {
|
|
|
806
864
|
aggregate<Spec extends AggregateSpec>(spec: Spec): CrossVaultGroupedAggregation<R, F, Spec>;
|
|
807
865
|
}
|
|
808
866
|
|
|
809
|
-
export {
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klum-db/lobby",
|
|
3
|
-
"version": "0.2.0-pre.
|
|
3
|
+
"version": "0.2.0-pre.32",
|
|
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>",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"node": ">=18.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@noy-db/as-xlsx": "^0.2.0-pre.
|
|
45
|
-
"@noy-db/hub": "^0.2.0-pre.
|
|
46
|
-
"@noy-db/in-devtools": "^0.2.0-pre.
|
|
47
|
-
"@noy-db/to-meter": "^0.2.0-pre.
|
|
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"
|
|
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.
|
|
60
|
-
"@noy-db/as-zip": "0.2.0-pre.
|
|
61
|
-
"@noy-db/hub": "0.2.0-pre.
|
|
62
|
-
"@noy-db/in-devtools": "0.2.0-pre.
|
|
63
|
-
"@noy-db/to-memory": "0.2.0-pre.
|
|
64
|
-
"@noy-db/to-meter": "0.2.0-pre.
|
|
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",
|
|
65
65
|
"@types/node": "^22.0.0",
|
|
66
66
|
"eslint": "^9.18.0",
|
|
67
67
|
"tsup": "^8.4.0",
|