@klum-db/lobby 0.2.0-pre.28 → 0.2.0-pre.30
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/README.md +4 -4
- package/dist/bin/klum.d.cts +1 -1
- package/dist/bin/klum.d.ts +1 -1
- package/dist/index.cjs +11 -11
- 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 +11 -11
- package/dist/index.js.map +1 -1
- package/dist/{vault-group-DeBoCFT9.d.cts → vault-group-BXjO5kHB.d.cts} +14 -14
- package/dist/{vault-group-DeBoCFT9.d.ts → vault-group-BXjO5kHB.d.ts} +14 -14
- package/package.json +9 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vault, SealingKeyProvider, PublicEnvelope, Noydb } from '@noy-db/hub';
|
|
2
2
|
export { CustodyApi, DeedMarker, GrantCustodianOptions, LiberateOptions, LiberateResult, createDeedOwner, isDeedVault, liberateVault, loadDeedMarker } from '@noy-db/hub';
|
|
3
|
-
import { a as VaultTemplate, S as StateManagementVault, V as VaultGroup, b as SkippedVault, M as MergeCompartmentOptions, c as MergeReport, d as SurfaceDirection, e as SurfaceConflictPolicy, f as SurfaceRow, g as VaultGroupOptions } from './vault-group-
|
|
4
|
-
export { C as CapturedBlueprint, h as CrossVaultAggregation, i as CrossVaultDerivationContext, j as CrossVaultDerivationSpec, k as CrossVaultGroupedAggregation, G as CrossVaultGroupedRow, l as CrossVaultLiveAggregation, m as CrossVaultLiveQuery, D as DecryptedMergeOptions, n as DeploymentEvent, F as FanoutQueryOptions, o as FanoutResult, p as FieldAuthorityInputs, q as FieldAuthorityPolicy, r as FieldAuthorityPolicyMissingError, s as FieldAuthorityRule, t as FieldLevelDeferredError,
|
|
3
|
+
import { a as VaultTemplate, S as StateManagementVault, V as VaultGroup, b as SkippedVault, M as MergeCompartmentOptions, c as MergeReport, d as SurfaceDirection, e as SurfaceConflictPolicy, f as SurfaceRow, g as VaultGroupOptions } from './vault-group-BXjO5kHB.cjs';
|
|
4
|
+
export { C as CapturedBlueprint, h as CrossVaultAggregation, i as CrossVaultDerivationContext, j as CrossVaultDerivationSpec, k as CrossVaultGroupedAggregation, G as CrossVaultGroupedRow, l as CrossVaultLiveAggregation, m as CrossVaultLiveQuery, D as DecryptedMergeOptions, n as DeploymentEvent, F as FanoutQueryOptions, o as FanoutResult, p as FieldAuthorityInputs, q as FieldAuthorityPolicy, r as FieldAuthorityPolicyMissingError, s as FieldAuthorityRule, t as FieldLevelDeferredError, L as LiveQueryOptions, u as MergeConflict, v as MergeStrategy, w as MigrationStatusRow, R as RefreshInsightsResult, x as SchemaManifestRow, y as SchemaRolloutResult, z as ShardedCollection, A as ShardedGroupedQuery, B as ShardedQuery, E as ShardingConfig, H as SurfaceStatus, I as VaultRegistryRow, J as mergeCompartment, K as mergeDecryptedRecords, N as resolveFieldAuthority, O as resolveRecordByFieldAuthority } from './vault-group-BXjO5kHB.cjs';
|
|
5
5
|
import { AsXlsxSheetOptions } from '@noy-db/as-xlsx';
|
|
6
6
|
export { MultiVaultDenormColumn, MultiVaultXlsxEntry, MultiVaultXlsxOptions } from '@noy-db/as-xlsx';
|
|
7
7
|
import { ExtractionPreview, WriteNoydbBundleOptions } from '@noy-db/hub/bundle';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vault, SealingKeyProvider, PublicEnvelope, Noydb } from '@noy-db/hub';
|
|
2
2
|
export { CustodyApi, DeedMarker, GrantCustodianOptions, LiberateOptions, LiberateResult, createDeedOwner, isDeedVault, liberateVault, loadDeedMarker } from '@noy-db/hub';
|
|
3
|
-
import { a as VaultTemplate, S as StateManagementVault, V as VaultGroup, b as SkippedVault, M as MergeCompartmentOptions, c as MergeReport, d as SurfaceDirection, e as SurfaceConflictPolicy, f as SurfaceRow, g as VaultGroupOptions } from './vault-group-
|
|
4
|
-
export { C as CapturedBlueprint, h as CrossVaultAggregation, i as CrossVaultDerivationContext, j as CrossVaultDerivationSpec, k as CrossVaultGroupedAggregation, G as CrossVaultGroupedRow, l as CrossVaultLiveAggregation, m as CrossVaultLiveQuery, D as DecryptedMergeOptions, n as DeploymentEvent, F as FanoutQueryOptions, o as FanoutResult, p as FieldAuthorityInputs, q as FieldAuthorityPolicy, r as FieldAuthorityPolicyMissingError, s as FieldAuthorityRule, t as FieldLevelDeferredError,
|
|
3
|
+
import { a as VaultTemplate, S as StateManagementVault, V as VaultGroup, b as SkippedVault, M as MergeCompartmentOptions, c as MergeReport, d as SurfaceDirection, e as SurfaceConflictPolicy, f as SurfaceRow, g as VaultGroupOptions } from './vault-group-BXjO5kHB.js';
|
|
4
|
+
export { C as CapturedBlueprint, h as CrossVaultAggregation, i as CrossVaultDerivationContext, j as CrossVaultDerivationSpec, k as CrossVaultGroupedAggregation, G as CrossVaultGroupedRow, l as CrossVaultLiveAggregation, m as CrossVaultLiveQuery, D as DecryptedMergeOptions, n as DeploymentEvent, F as FanoutQueryOptions, o as FanoutResult, p as FieldAuthorityInputs, q as FieldAuthorityPolicy, r as FieldAuthorityPolicyMissingError, s as FieldAuthorityRule, t as FieldLevelDeferredError, L as LiveQueryOptions, u as MergeConflict, v as MergeStrategy, w as MigrationStatusRow, R as RefreshInsightsResult, x as SchemaManifestRow, y as SchemaRolloutResult, z as ShardedCollection, A as ShardedGroupedQuery, B as ShardedQuery, E as ShardingConfig, H as SurfaceStatus, I as VaultRegistryRow, J as mergeCompartment, K as mergeDecryptedRecords, N as resolveFieldAuthority, O as resolveRecordByFieldAuthority } from './vault-group-BXjO5kHB.js';
|
|
5
5
|
import { AsXlsxSheetOptions } from '@noy-db/as-xlsx';
|
|
6
6
|
export { MultiVaultDenormColumn, MultiVaultXlsxEntry, MultiVaultXlsxOptions } from '@noy-db/as-xlsx';
|
|
7
7
|
import { ExtractionPreview, WriteNoydbBundleOptions } from '@noy-db/hub/bundle';
|
package/dist/index.js
CHANGED
|
@@ -1401,13 +1401,13 @@ var init_vault_group = __esm({
|
|
|
1401
1401
|
SHARD_SEPARATOR = "--";
|
|
1402
1402
|
SAFE_PARTITION_KEY = /^[A-Za-z0-9._-]+$/;
|
|
1403
1403
|
VaultGroup = class {
|
|
1404
|
-
constructor(db, name, registry, sharding, template,
|
|
1404
|
+
constructor(db, name, registry, sharding, template, cutoverOnOpen = false) {
|
|
1405
1405
|
this.db = db;
|
|
1406
1406
|
this.name = name;
|
|
1407
1407
|
this.registry = registry;
|
|
1408
1408
|
this.sharding = sharding;
|
|
1409
1409
|
this.template = template;
|
|
1410
|
-
this.
|
|
1410
|
+
this.cutoverOnOpen = cutoverOnOpen;
|
|
1411
1411
|
if (name.includes(SHARD_SEPARATOR)) {
|
|
1412
1412
|
throw new ValidationError(
|
|
1413
1413
|
`VaultGroup name "${name}" must not contain "--" (reserved shard vault-id separator).`
|
|
@@ -1419,7 +1419,7 @@ var init_vault_group = __esm({
|
|
|
1419
1419
|
registry;
|
|
1420
1420
|
sharding;
|
|
1421
1421
|
template;
|
|
1422
|
-
|
|
1422
|
+
cutoverOnOpen;
|
|
1423
1423
|
/** @internal — set when the group is managed (no explicit registry). */
|
|
1424
1424
|
stateVault;
|
|
1425
1425
|
/** @internal */
|
|
@@ -1454,20 +1454,20 @@ var init_vault_group = __esm({
|
|
|
1454
1454
|
return rows.filter((r) => r.group === this.name);
|
|
1455
1455
|
}
|
|
1456
1456
|
/**
|
|
1457
|
-
* Open an existing shard and apply the template. When `
|
|
1457
|
+
* Open an existing shard and apply the template. When `cutoverOnOpen` is set
|
|
1458
1458
|
* (#271) and the shard's registry version is behind the template, its cutover
|
|
1459
1459
|
* runs inline first — so a behind shard never surfaces a stale handle.
|
|
1460
1460
|
*/
|
|
1461
1461
|
async openShard(partitionKey) {
|
|
1462
|
-
if (this.
|
|
1462
|
+
if (this.cutoverOnOpen) {
|
|
1463
1463
|
const row = await this.registry.get(this.registryId(partitionKey));
|
|
1464
1464
|
if (row && row.schemaVersion < this.template.version) {
|
|
1465
|
-
await this.
|
|
1465
|
+
await this.cutoverShard(partitionKey);
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
1468
|
return this._openShardRaw(partitionKey);
|
|
1469
1469
|
}
|
|
1470
|
-
/** @internal — open + configure with no
|
|
1470
|
+
/** @internal — open + configure with no cutover-on-open hook (used by the migration path itself to avoid recursion). */
|
|
1471
1471
|
async _openShardRaw(partitionKey) {
|
|
1472
1472
|
const vault = await this.db.openVault(this.shardVaultId(partitionKey), { create: false });
|
|
1473
1473
|
this.template.configure(vault);
|
|
@@ -1689,7 +1689,7 @@ var init_vault_group = __esm({
|
|
|
1689
1689
|
* Never throws on a cutover failure — it records `status: 'failed'` and
|
|
1690
1690
|
* returns the row, so a fleet run continues past a bad shard.
|
|
1691
1691
|
*/
|
|
1692
|
-
async
|
|
1692
|
+
async cutoverShard(partitionKey) {
|
|
1693
1693
|
const vaultId = this.shardVaultId(partitionKey);
|
|
1694
1694
|
const row = await this.registry.get(this.registryId(partitionKey));
|
|
1695
1695
|
if (!row) throw new UnknownShardError(partitionKey, this.name);
|
|
@@ -1740,7 +1740,7 @@ var init_vault_group = __esm({
|
|
|
1740
1740
|
* - `batchSize` — max shards migrated concurrently per batch (back-pressure).
|
|
1741
1741
|
* Default 4. Batches run sequentially; shards within a batch run in parallel.
|
|
1742
1742
|
*/
|
|
1743
|
-
async
|
|
1743
|
+
async rolloutSchema(options = {}) {
|
|
1744
1744
|
const target = this.template.version;
|
|
1745
1745
|
const rows = await this.allRows();
|
|
1746
1746
|
const cohort = options.cohort;
|
|
@@ -1752,7 +1752,7 @@ var init_vault_group = __esm({
|
|
|
1752
1752
|
const failed = [];
|
|
1753
1753
|
for (let i = 0; i < todo.length; i += batchSize) {
|
|
1754
1754
|
const batch = todo.slice(i, i + batchSize);
|
|
1755
|
-
const settled = await Promise.all(batch.map((r) => this.
|
|
1755
|
+
const settled = await Promise.all(batch.map((r) => this.cutoverShard(r.partitionKey)));
|
|
1756
1756
|
for (const res of settled) {
|
|
1757
1757
|
if (res.status === "done") migrated.push(res.vaultId);
|
|
1758
1758
|
else failed.push({ vaultId: res.vaultId, error: res.error ?? "unknown" });
|
|
@@ -2154,7 +2154,7 @@ var Lobby = class {
|
|
|
2154
2154
|
const { StateManagementVault: StateManagementVault2 } = await Promise.resolve().then(() => (init_state_vault(), state_vault_exports));
|
|
2155
2155
|
const stateVault = opts.registry ? void 0 : await StateManagementVault2.open(db);
|
|
2156
2156
|
const registry = opts.registry ?? stateVault.registry;
|
|
2157
|
-
const group = new VaultGroup2(db, name, registry, opts.sharding, template, opts.
|
|
2157
|
+
const group = new VaultGroup2(db, name, registry, opts.sharding, template, opts.cutoverOnOpen ?? false);
|
|
2158
2158
|
if (stateVault) {
|
|
2159
2159
|
group._attachStateVault(stateVault);
|
|
2160
2160
|
await stateVault.recordManifest(opts.sharding.vaultTemplate, template);
|