@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/README.md
CHANGED
|
@@ -67,7 +67,7 @@ lobby.withVaultTemplate('client', { version: 1, configure: v => v.collection('in
|
|
|
67
67
|
const group = await lobby.openVaultGroup('clients', { registry, sharding: { keyOf, vaultTemplate: 'client', autoCreate: true } })
|
|
68
68
|
await group.shard('acme-co').collection('invoices').put('i1', { id: 'i1', total: '1200.00' })
|
|
69
69
|
const all = await group.queryAcross(/* … */) // fan-out read across shards
|
|
70
|
-
await group.
|
|
70
|
+
await group.rolloutSchema({ batchSize: 4 }) // resumable, registry-tracked
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### 2 · Interchange — move data between vaults, safely
|
|
@@ -137,11 +137,11 @@ await lobby.applySurface('tax-vault', surface, bundleBytes, transferKey)
|
|
|
137
137
|
|
|
138
138
|
- **Depends on `@noy-db/hub`**, binds to the stable **`@noy-db/hub/kernel`** subpath — never reaches into hub internals.
|
|
139
139
|
- **Custody is a vault-level concern** and lives *in* hub (keyring/CEK/consent primitives); the Lobby **re-exports** it (`createDeedOwner`, `liberateVault`, `CustodyApi`) so consumers have one import surface.
|
|
140
|
-
- **Federation**
|
|
140
|
+
- **Federation** lives in the Lobby, not in hub — open fleets with `lobby.openVaultGroup` (`@noy-db/hub` no longer ships the `openVaultGroup` / `openStateManagementVault` / `withVaultTemplate` fleet methods).
|
|
141
141
|
- The dependency is enforced one-way at build time; an `@noy-db` package importing `@klum-db` fails the architecture check.
|
|
142
142
|
|
|
143
143
|
## Status
|
|
144
144
|
|
|
145
|
-
Preview
|
|
145
|
+
Preview. `@klum-db/lobby` is its own repository and the sole publisher of `@klum-db/*` to npm. It depends on the **published** `@noy-db/*` packages through the stable `@noy-db/hub/kernel` boundary and versions **independently** (`0.2.0-pre.N`, decoupled from noy-db). Pilot-1 (FR-1…FR-9), the dock tier, and `Lobby.graduate()` are complete.
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
See [`PROVENANCE.md`](./PROVENANCE.md) for origin and build history.
|
package/dist/bin/klum.d.cts
CHANGED
package/dist/bin/klum.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1415,13 +1415,13 @@ var init_vault_group = __esm({
|
|
|
1415
1415
|
SHARD_SEPARATOR = "--";
|
|
1416
1416
|
SAFE_PARTITION_KEY = /^[A-Za-z0-9._-]+$/;
|
|
1417
1417
|
VaultGroup = class {
|
|
1418
|
-
constructor(db, name, registry, sharding, template,
|
|
1418
|
+
constructor(db, name, registry, sharding, template, cutoverOnOpen = false) {
|
|
1419
1419
|
this.db = db;
|
|
1420
1420
|
this.name = name;
|
|
1421
1421
|
this.registry = registry;
|
|
1422
1422
|
this.sharding = sharding;
|
|
1423
1423
|
this.template = template;
|
|
1424
|
-
this.
|
|
1424
|
+
this.cutoverOnOpen = cutoverOnOpen;
|
|
1425
1425
|
if (name.includes(SHARD_SEPARATOR)) {
|
|
1426
1426
|
throw new import_kernel10.ValidationError(
|
|
1427
1427
|
`VaultGroup name "${name}" must not contain "--" (reserved shard vault-id separator).`
|
|
@@ -1433,7 +1433,7 @@ var init_vault_group = __esm({
|
|
|
1433
1433
|
registry;
|
|
1434
1434
|
sharding;
|
|
1435
1435
|
template;
|
|
1436
|
-
|
|
1436
|
+
cutoverOnOpen;
|
|
1437
1437
|
/** @internal — set when the group is managed (no explicit registry). */
|
|
1438
1438
|
stateVault;
|
|
1439
1439
|
/** @internal */
|
|
@@ -1468,20 +1468,20 @@ var init_vault_group = __esm({
|
|
|
1468
1468
|
return rows.filter((r) => r.group === this.name);
|
|
1469
1469
|
}
|
|
1470
1470
|
/**
|
|
1471
|
-
* Open an existing shard and apply the template. When `
|
|
1471
|
+
* Open an existing shard and apply the template. When `cutoverOnOpen` is set
|
|
1472
1472
|
* (#271) and the shard's registry version is behind the template, its cutover
|
|
1473
1473
|
* runs inline first — so a behind shard never surfaces a stale handle.
|
|
1474
1474
|
*/
|
|
1475
1475
|
async openShard(partitionKey) {
|
|
1476
|
-
if (this.
|
|
1476
|
+
if (this.cutoverOnOpen) {
|
|
1477
1477
|
const row = await this.registry.get(this.registryId(partitionKey));
|
|
1478
1478
|
if (row && row.schemaVersion < this.template.version) {
|
|
1479
|
-
await this.
|
|
1479
|
+
await this.cutoverShard(partitionKey);
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
1482
|
return this._openShardRaw(partitionKey);
|
|
1483
1483
|
}
|
|
1484
|
-
/** @internal — open + configure with no
|
|
1484
|
+
/** @internal — open + configure with no cutover-on-open hook (used by the migration path itself to avoid recursion). */
|
|
1485
1485
|
async _openShardRaw(partitionKey) {
|
|
1486
1486
|
const vault = await this.db.openVault(this.shardVaultId(partitionKey), { create: false });
|
|
1487
1487
|
this.template.configure(vault);
|
|
@@ -1703,7 +1703,7 @@ var init_vault_group = __esm({
|
|
|
1703
1703
|
* Never throws on a cutover failure — it records `status: 'failed'` and
|
|
1704
1704
|
* returns the row, so a fleet run continues past a bad shard.
|
|
1705
1705
|
*/
|
|
1706
|
-
async
|
|
1706
|
+
async cutoverShard(partitionKey) {
|
|
1707
1707
|
const vaultId = this.shardVaultId(partitionKey);
|
|
1708
1708
|
const row = await this.registry.get(this.registryId(partitionKey));
|
|
1709
1709
|
if (!row) throw new import_kernel10.UnknownShardError(partitionKey, this.name);
|
|
@@ -1754,7 +1754,7 @@ var init_vault_group = __esm({
|
|
|
1754
1754
|
* - `batchSize` — max shards migrated concurrently per batch (back-pressure).
|
|
1755
1755
|
* Default 4. Batches run sequentially; shards within a batch run in parallel.
|
|
1756
1756
|
*/
|
|
1757
|
-
async
|
|
1757
|
+
async rolloutSchema(options = {}) {
|
|
1758
1758
|
const target = this.template.version;
|
|
1759
1759
|
const rows = await this.allRows();
|
|
1760
1760
|
const cohort = options.cohort;
|
|
@@ -1766,7 +1766,7 @@ var init_vault_group = __esm({
|
|
|
1766
1766
|
const failed = [];
|
|
1767
1767
|
for (let i = 0; i < todo.length; i += batchSize) {
|
|
1768
1768
|
const batch = todo.slice(i, i + batchSize);
|
|
1769
|
-
const settled = await Promise.all(batch.map((r) => this.
|
|
1769
|
+
const settled = await Promise.all(batch.map((r) => this.cutoverShard(r.partitionKey)));
|
|
1770
1770
|
for (const res of settled) {
|
|
1771
1771
|
if (res.status === "done") migrated.push(res.vaultId);
|
|
1772
1772
|
else failed.push({ vaultId: res.vaultId, error: res.error ?? "unknown" });
|
|
@@ -2214,7 +2214,7 @@ var Lobby = class {
|
|
|
2214
2214
|
const { StateManagementVault: StateManagementVault2 } = await Promise.resolve().then(() => (init_state_vault(), state_vault_exports));
|
|
2215
2215
|
const stateVault = opts.registry ? void 0 : await StateManagementVault2.open(db);
|
|
2216
2216
|
const registry = opts.registry ?? stateVault.registry;
|
|
2217
|
-
const group = new VaultGroup2(db, name, registry, opts.sharding, template, opts.
|
|
2217
|
+
const group = new VaultGroup2(db, name, registry, opts.sharding, template, opts.cutoverOnOpen ?? false);
|
|
2218
2218
|
if (stateVault) {
|
|
2219
2219
|
group._attachStateVault(stateVault);
|
|
2220
2220
|
await stateVault.recordManifest(opts.sharding.vaultTemplate, template);
|