@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 +6 -3
- package/dist/index.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -6,8 +6,7 @@ import { AsXlsxSheetOptions } from '@noy-db/as-xlsx';
|
|
|
6
6
|
export { MultiVaultDenormColumn, MultiVaultXlsxEntry, MultiVaultXlsxOptions } from '@noy-db/as-xlsx';
|
|
7
7
|
import { ExtractionPreview } from '@noy-db/hub/bundle';
|
|
8
8
|
import { InspectableContainer } from '@noy-db/in-devtools';
|
|
9
|
-
import { WritePodOptions } from '@noy-db/hub/pod';
|
|
10
|
-
import { PublicEnvelope } from '@noy-db/hub';
|
|
9
|
+
import { Cover, WritePodOptions } from '@noy-db/hub/pod';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @klum-db/lobby interchange — cross-vault FK-closure extraction.
|
|
@@ -313,8 +312,8 @@ interface CompartmentManifest {
|
|
|
313
312
|
readonly name: string;
|
|
314
313
|
readonly count: number;
|
|
315
314
|
}[];
|
|
316
|
-
/** Inner bundle's owner-curated public envelope
|
|
317
|
-
readonly publicEnvelope?:
|
|
315
|
+
/** Inner bundle's owner-curated cover (né public envelope — manifest key is this repo's wire). Opt-in. */
|
|
316
|
+
readonly publicEnvelope?: Cover;
|
|
318
317
|
/** Byte length of the inner v1 bundle (drives framing). */
|
|
319
318
|
readonly innerBytes: number;
|
|
320
319
|
/** SHA-256 (lowercase hex) of the inner v1 bundle bytes — pre-decrypt integrity. */
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,7 @@ import { AsXlsxSheetOptions } from '@noy-db/as-xlsx';
|
|
|
6
6
|
export { MultiVaultDenormColumn, MultiVaultXlsxEntry, MultiVaultXlsxOptions } from '@noy-db/as-xlsx';
|
|
7
7
|
import { ExtractionPreview } from '@noy-db/hub/bundle';
|
|
8
8
|
import { InspectableContainer } from '@noy-db/in-devtools';
|
|
9
|
-
import { WritePodOptions } from '@noy-db/hub/pod';
|
|
10
|
-
import { PublicEnvelope } from '@noy-db/hub';
|
|
9
|
+
import { Cover, WritePodOptions } from '@noy-db/hub/pod';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* @klum-db/lobby interchange — cross-vault FK-closure extraction.
|
|
@@ -313,8 +312,8 @@ interface CompartmentManifest {
|
|
|
313
312
|
readonly name: string;
|
|
314
313
|
readonly count: number;
|
|
315
314
|
}[];
|
|
316
|
-
/** Inner bundle's owner-curated public envelope
|
|
317
|
-
readonly publicEnvelope?:
|
|
315
|
+
/** Inner bundle's owner-curated cover (né public envelope — manifest key is this repo's wire). Opt-in. */
|
|
316
|
+
readonly publicEnvelope?: Cover;
|
|
318
317
|
/** Byte length of the inner v1 bundle (drives framing). */
|
|
319
318
|
readonly innerBytes: number;
|
|
320
319
|
/** SHA-256 (lowercase hex) of the inner v1 bundle bytes — pre-decrypt integrity. */
|
package/dist/index.js
CHANGED
|
@@ -28,12 +28,10 @@ var init_uint32 = __esm({
|
|
|
28
28
|
import { sha256Hex, generateULID } from "@noy-db/hub/cargo";
|
|
29
29
|
import {
|
|
30
30
|
writePod,
|
|
31
|
-
readPodHeader
|
|
31
|
+
readPodHeader,
|
|
32
|
+
readPodCover,
|
|
33
|
+
NOYDB_BUNDLE_MAGIC
|
|
32
34
|
} from "@noy-db/hub/pod";
|
|
33
|
-
import {
|
|
34
|
-
readNoydbBundlePublicEnvelope,
|
|
35
|
-
hasNoydbBundleMagic
|
|
36
|
-
} from "@noy-db/hub";
|
|
37
35
|
function encodeMultiBundle(manifest, inner) {
|
|
38
36
|
validateManifest(manifest);
|
|
39
37
|
if (manifest.compartments.length !== inner.length) {
|
|
@@ -59,6 +57,11 @@ function encodeMultiBundle(manifest, inner) {
|
|
|
59
57
|
}
|
|
60
58
|
return out;
|
|
61
59
|
}
|
|
60
|
+
function hasPodMagic(bytes) {
|
|
61
|
+
if (bytes.length < NOYDB_BUNDLE_MAGIC.length) return false;
|
|
62
|
+
for (let i = 0; i < NOYDB_BUNDLE_MAGIC.length; i++) if (bytes[i] !== NOYDB_BUNDLE_MAGIC[i]) return false;
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
62
65
|
function hasMultiMagic(bytes) {
|
|
63
66
|
if (bytes.length < NOYDB_MULTI_BUNDLE_MAGIC.length) return false;
|
|
64
67
|
for (let i = 0; i < NOYDB_MULTI_BUNDLE_MAGIC.length; i++) if (bytes[i] !== NOYDB_MULTI_BUNDLE_MAGIC[i]) return false;
|
|
@@ -135,7 +138,7 @@ async function writeMultiVaultBundle(compartments, opts = {}) {
|
|
|
135
138
|
);
|
|
136
139
|
}
|
|
137
140
|
if (c.disclose?.publicEnvelope === true) {
|
|
138
|
-
const env =
|
|
141
|
+
const env = readPodCover(innerBytes);
|
|
139
142
|
if (env !== void 0) entry.publicEnvelope = env;
|
|
140
143
|
}
|
|
141
144
|
const fence = await c.vault.schemaFenceState();
|
|
@@ -152,9 +155,9 @@ async function writeMultiVaultBundle(compartments, opts = {}) {
|
|
|
152
155
|
}
|
|
153
156
|
async function readNoydbBundleManifest(bytes) {
|
|
154
157
|
if (hasMultiMagic(bytes)) return [...decodeMultiBundle(bytes).manifest.compartments];
|
|
155
|
-
if (
|
|
158
|
+
if (hasPodMagic(bytes)) {
|
|
156
159
|
const header = readPodHeader(bytes);
|
|
157
|
-
const env =
|
|
160
|
+
const env = readPodCover(bytes);
|
|
158
161
|
const entry = {
|
|
159
162
|
handle: header.handle,
|
|
160
163
|
innerBytes: bytes.length,
|
|
@@ -169,7 +172,7 @@ function readMultiVaultBundleCompartment(bytes, selector) {
|
|
|
169
172
|
if (typeof selector === "number" && !Number.isInteger(selector)) {
|
|
170
173
|
throw new Error(`readMultiVaultBundleCompartment: numeric selector must be an integer, got ${selector}.`);
|
|
171
174
|
}
|
|
172
|
-
if (
|
|
175
|
+
if (hasPodMagic(bytes) && !hasMultiMagic(bytes)) {
|
|
173
176
|
const header = readPodHeader(bytes);
|
|
174
177
|
if (selector === 0 || selector === header.handle) return bytes;
|
|
175
178
|
throw new Error(`readMultiVaultBundleCompartment: single v1 bundle has only compartment "${header.handle}".`);
|