@klum-db/lobby 0.3.0-pre.1 → 0.4.0-pre.0

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 CHANGED
@@ -167,26 +167,29 @@ The one-way law and the kernel seam are covered up top — here are the specific
167
167
  - **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).
168
168
  - **Enforced, not conventional:** an `@noy-db` package importing `@klum-db` fails noy-db's build-time architecture check.
169
169
 
170
- ## Consumer requirements (hub >= 0.3.0-pre.1)
170
+ ## Consumer requirements (hub >= 0.4.0-pre.0)
171
171
 
172
- `@noy-db/hub` gates `extractPartition` (the primitive under `extractCrossVaultPartition`, `mergeCompartment`, `migrateThenMerge`, `exportSurface`/`applySurface`) and search/retrieval behind opt-in strategies. The Lobby never constructs your `Noydb`/`Vault` instances — you do — so **you** must opt in on any vault passed into these APIs:
172
+ `@noy-db/hub` gates `extractPartition` (the primitive under `extractCrossVaultPartition`, `mergeCompartment`, `migrateThenMerge`, `exportSurface`/`applySurface`), search/retrieval, and multi-user grants behind opt-in strategies. The Lobby never constructs your `Noydb`/`Vault` instances — you do — so **you** must opt in on any vault passed into these APIs:
173
173
 
174
174
  - **Interchange** (`extractCrossVaultPartition`, `mergeCompartment`, `migrateThenMerge`, `exportSurface`, `applySurface`): every source vault involved must be created with `cargoStrategy: withCargo()` from `@noy-db/hub/cargo`, or these calls throw `CargoNotEnabledError`.
175
175
  - **Federated retrieve** (`ShardedCollection.retrieve()` across a `VaultGroup`): additionally requires `searchStrategy: withSearch()` from `@noy-db/hub` on every vault in the group, or lexical retrieve silently returns no hits and semantic/hybrid retrieve throws `SearchNotEnabledError`.
176
+ - **Multi-user grants** (sharing shards/registry vaults across operators and advisors): the *granting* session must be created with `teamStrategy: withTeam()` from `@noy-db/hub/team`, or `grant`/`revoke`/`rotate` throw `TeamNotEnabledError`. Grantees opening an already-granted vault need no strategy.
176
177
 
177
178
  ```ts
178
179
  import { createNoydb, withSearch } from '@noy-db/hub'
179
180
  import { withCargo } from '@noy-db/hub/cargo'
181
+ import { withTeam } from '@noy-db/hub/team'
180
182
 
181
183
  const db = await createNoydb({
182
184
  store, user, secret,
183
185
  cargoStrategy: withCargo(), // required for interchange (extractPartition-backed APIs)
184
186
  searchStrategy: withSearch(), // required for federated retrieve()
187
+ teamStrategy: withTeam(), // required to grant/revoke/rotate multi-user access
185
188
  })
186
189
  ```
187
190
 
188
191
  ## Status
189
192
 
190
- 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.
193
+ 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/cargo` + `/pod` boundaries and versions **independently** (`0.4.0-pre.N`, decoupled from noy-db). Pilot-1 (FR-1…FR-9), the dock tier, and `Lobby.graduate()` are complete.
191
194
 
192
195
  See [`docs/architecture.md`](docs/architecture.md) for the detailed noy-db ↔ klum-db boundary, [`docs/roadmap.md`](docs/roadmap.md) for what's next, and [`PROVENANCE.md`](./PROVENANCE.md) for origin and build history.
package/dist/index.cjs CHANGED
@@ -72,6 +72,11 @@ function encodeMultiBundle(manifest, inner) {
72
72
  }
73
73
  return out;
74
74
  }
75
+ function hasPodMagic(bytes) {
76
+ if (bytes.length < import_pod.NOYDB_BUNDLE_MAGIC.length) return false;
77
+ for (let i = 0; i < import_pod.NOYDB_BUNDLE_MAGIC.length; i++) if (bytes[i] !== import_pod.NOYDB_BUNDLE_MAGIC[i]) return false;
78
+ return true;
79
+ }
75
80
  function hasMultiMagic(bytes) {
76
81
  if (bytes.length < NOYDB_MULTI_BUNDLE_MAGIC.length) return false;
77
82
  for (let i = 0; i < NOYDB_MULTI_BUNDLE_MAGIC.length; i++) if (bytes[i] !== NOYDB_MULTI_BUNDLE_MAGIC[i]) return false;
@@ -148,7 +153,7 @@ async function writeMultiVaultBundle(compartments, opts = {}) {
148
153
  );
149
154
  }
150
155
  if (c.disclose?.publicEnvelope === true) {
151
- const env = (0, import_hub.readNoydbBundlePublicEnvelope)(innerBytes);
156
+ const env = (0, import_pod.readPodCover)(innerBytes);
152
157
  if (env !== void 0) entry.publicEnvelope = env;
153
158
  }
154
159
  const fence = await c.vault.schemaFenceState();
@@ -165,9 +170,9 @@ async function writeMultiVaultBundle(compartments, opts = {}) {
165
170
  }
166
171
  async function readNoydbBundleManifest(bytes) {
167
172
  if (hasMultiMagic(bytes)) return [...decodeMultiBundle(bytes).manifest.compartments];
168
- if ((0, import_hub.hasNoydbBundleMagic)(bytes)) {
173
+ if (hasPodMagic(bytes)) {
169
174
  const header = (0, import_pod.readPodHeader)(bytes);
170
- const env = (0, import_hub.readNoydbBundlePublicEnvelope)(bytes);
175
+ const env = (0, import_pod.readPodCover)(bytes);
171
176
  const entry = {
172
177
  handle: header.handle,
173
178
  innerBytes: bytes.length,
@@ -182,7 +187,7 @@ function readMultiVaultBundleCompartment(bytes, selector) {
182
187
  if (typeof selector === "number" && !Number.isInteger(selector)) {
183
188
  throw new Error(`readMultiVaultBundleCompartment: numeric selector must be an integer, got ${selector}.`);
184
189
  }
185
- if ((0, import_hub.hasNoydbBundleMagic)(bytes) && !hasMultiMagic(bytes)) {
190
+ if (hasPodMagic(bytes) && !hasMultiMagic(bytes)) {
186
191
  const header = (0, import_pod.readPodHeader)(bytes);
187
192
  if (selector === 0 || selector === header.handle) return bytes;
188
193
  throw new Error(`readMultiVaultBundleCompartment: single v1 bundle has only compartment "${header.handle}".`);
@@ -192,13 +197,12 @@ function readMultiVaultBundleCompartment(bytes, selector) {
192
197
  if (idx < 0 || idx >= inner.length) throw new Error(`readMultiVaultBundleCompartment: no compartment ${typeof selector === "number" ? `at index ${selector}` : `"${selector}"`}.`);
193
198
  return inner[idx];
194
199
  }
195
- var import_cargo, import_pod, import_hub, NOYDB_MULTI_BUNDLE_MAGIC, NOYDB_MULTI_BUNDLE_PREFIX_BYTES, NOYDB_MULTI_BUNDLE_VERSION;
200
+ var import_cargo, import_pod, NOYDB_MULTI_BUNDLE_MAGIC, NOYDB_MULTI_BUNDLE_PREFIX_BYTES, NOYDB_MULTI_BUNDLE_VERSION;
196
201
  var init_multi_bundle = __esm({
197
202
  "src/bundle/multi-bundle.ts"() {
198
203
  "use strict";
199
204
  import_cargo = require("@noy-db/hub/cargo");
200
205
  import_pod = require("@noy-db/hub/pod");
201
- import_hub = require("@noy-db/hub");
202
206
  init_uint32();
203
207
  NOYDB_MULTI_BUNDLE_MAGIC = new Uint8Array([78, 68, 66, 77]);
204
208
  NOYDB_MULTI_BUNDLE_PREFIX_BYTES = 10;