superbee 0.4.2-pre.3 → 0.4.2-pre.4
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/portable-export.d.ts +119 -0
- package/dist/portable-export.mjs +474 -0
- package/dist/publication/index.d.ts +2 -0
- package/dist/publication/source-exclusions.d.ts +29 -0
- package/dist/publication.mjs +72 -53
- package/dist/superbee.mjs +179 -61
- package/package.json +5 -1
package/dist/publication.mjs
CHANGED
|
@@ -32850,7 +32850,7 @@ function buildKindRegistry(docs, initialWarnings = [], options = {}) {
|
|
|
32850
32850
|
});
|
|
32851
32851
|
continue;
|
|
32852
32852
|
}
|
|
32853
|
-
const { kind, reservedFieldsIgnored, reservedFieldPaths } = parsed;
|
|
32853
|
+
const { kind: kind2, reservedFieldsIgnored, reservedFieldPaths } = parsed;
|
|
32854
32854
|
warnings.push(...parsed.warnings);
|
|
32855
32855
|
if (reservedFieldsIgnored.length > 0) {
|
|
32856
32856
|
warnings.push({
|
|
@@ -32860,27 +32860,27 @@ function buildKindRegistry(docs, initialWarnings = [], options = {}) {
|
|
|
32860
32860
|
severity: "warning"
|
|
32861
32861
|
});
|
|
32862
32862
|
}
|
|
32863
|
-
if (accepted.has(
|
|
32863
|
+
if (accepted.has(kind2.governs)) {
|
|
32864
32864
|
warnings.push({
|
|
32865
32865
|
code: "KIND_DUPLICATE_GOVERNS",
|
|
32866
|
-
message: `duplicate kind convention for '${
|
|
32867
|
-
field:
|
|
32866
|
+
message: `duplicate kind convention for '${kind2.governs}': '${doc.id}' ignored, keeping the first-declared '${accepted.get(kind2.governs).id}'.`,
|
|
32867
|
+
field: kind2.governs,
|
|
32868
32868
|
severity: "warning"
|
|
32869
32869
|
});
|
|
32870
32870
|
continue;
|
|
32871
32871
|
}
|
|
32872
|
-
if (
|
|
32872
|
+
if (kind2.freshnessHorizon !== void 0 && freshnessHorizonMs(kind2) === void 0) {
|
|
32873
32873
|
warnings.push({
|
|
32874
32874
|
code: "KIND_HORIZON_MALFORMED",
|
|
32875
|
-
message: `kind convention '${doc.id}' has a malformed freshness_horizon '${
|
|
32875
|
+
message: `kind convention '${doc.id}' has a malformed freshness_horizon '${kind2.freshnessHorizon}' (expected <n>(m|h|d)); ignoring it.`,
|
|
32876
32876
|
field: "freshness_horizon",
|
|
32877
32877
|
severity: "warning"
|
|
32878
32878
|
});
|
|
32879
32879
|
}
|
|
32880
|
-
accepted.set(
|
|
32880
|
+
accepted.set(kind2.governs, kind2);
|
|
32881
32881
|
}
|
|
32882
32882
|
const kinds = /* @__PURE__ */ new Map();
|
|
32883
|
-
for (const
|
|
32883
|
+
for (const kind2 of [...accepted.values()].sort(compareReadingOrder)) kinds.set(kind2.governs, kind2);
|
|
32884
32884
|
return { kinds, warnings };
|
|
32885
32885
|
}
|
|
32886
32886
|
function compareReadingOrder(a, b) {
|
|
@@ -32897,13 +32897,13 @@ function progressStatusStorageField(okfVersion) {
|
|
|
32897
32897
|
if (version === "0.2") return SUPERBEE_PROGRESS_STATUS_FIELD;
|
|
32898
32898
|
return void 0;
|
|
32899
32899
|
}
|
|
32900
|
-
function declaresField(
|
|
32901
|
-
return
|
|
32900
|
+
function declaresField(kind2, field) {
|
|
32901
|
+
return kind2.fields.required.includes(field) || kind2.fields.optional.includes(field);
|
|
32902
32902
|
}
|
|
32903
|
-
function progressStatusCoordinate(okfVersion,
|
|
32904
|
-
if (declaresField(
|
|
32903
|
+
function progressStatusCoordinate(okfVersion, kind2) {
|
|
32904
|
+
if (declaresField(kind2, PROGRESS_STATUS_FIELD)) return void 0;
|
|
32905
32905
|
const storageField = progressStatusStorageField(okfVersion);
|
|
32906
|
-
if (storageField && declaresField(
|
|
32906
|
+
if (storageField && declaresField(kind2, storageField)) {
|
|
32907
32907
|
return {
|
|
32908
32908
|
logicalField: PROGRESS_STATUS_FIELD,
|
|
32909
32909
|
storageField
|
|
@@ -32911,18 +32911,18 @@ function progressStatusCoordinate(okfVersion, kind) {
|
|
|
32911
32911
|
}
|
|
32912
32912
|
return void 0;
|
|
32913
32913
|
}
|
|
32914
|
-
function resolveKindFieldCoordinate(okfVersion,
|
|
32915
|
-
if (declaresField(
|
|
32916
|
-
const progress = progressStatusCoordinate(okfVersion,
|
|
32914
|
+
function resolveKindFieldCoordinate(okfVersion, kind2, field) {
|
|
32915
|
+
if (declaresField(kind2, field)) return { logicalField: field, storageField: field };
|
|
32916
|
+
const progress = progressStatusCoordinate(okfVersion, kind2);
|
|
32917
32917
|
if (field === PROGRESS_STATUS_FIELD && progress) return progress;
|
|
32918
32918
|
return void 0;
|
|
32919
32919
|
}
|
|
32920
|
-
function readKindField(okfVersion,
|
|
32921
|
-
const coordinate = resolveKindFieldCoordinate(okfVersion,
|
|
32920
|
+
function readKindField(okfVersion, kind2, frontmatter2, field) {
|
|
32921
|
+
const coordinate = resolveKindFieldCoordinate(okfVersion, kind2, field);
|
|
32922
32922
|
return coordinate ? frontmatter2[coordinate.storageField] : void 0;
|
|
32923
32923
|
}
|
|
32924
|
-
function projectLogicalKindFields(okfVersion,
|
|
32925
|
-
const progress = progressStatusCoordinate(okfVersion,
|
|
32924
|
+
function projectLogicalKindFields(okfVersion, kind2, frontmatter2) {
|
|
32925
|
+
const progress = progressStatusCoordinate(okfVersion, kind2);
|
|
32926
32926
|
if (!progress || !hasOwn(frontmatter2, progress.storageField) || hasOwn(frontmatter2, progress.logicalField)) return frontmatter2;
|
|
32927
32927
|
const projected = { ...frontmatter2 };
|
|
32928
32928
|
setOwn(
|
|
@@ -33370,25 +33370,25 @@ function parseConventionDoc(doc, options = {}) {
|
|
|
33370
33370
|
});
|
|
33371
33371
|
}
|
|
33372
33372
|
}
|
|
33373
|
-
const
|
|
33373
|
+
const kind2 = {
|
|
33374
33374
|
id: doc.id,
|
|
33375
33375
|
title,
|
|
33376
33376
|
governs,
|
|
33377
33377
|
fields: { required, optional, values, valueDescriptions, terminal, descriptions }
|
|
33378
33378
|
};
|
|
33379
|
-
if (description !== void 0)
|
|
33380
|
-
if (path6 !== void 0)
|
|
33381
|
-
if (links !== void 0)
|
|
33382
|
-
if (linkDescriptions !== void 0)
|
|
33383
|
-
if (expectsInbound !== void 0)
|
|
33384
|
-
if (sections && sections.length > 0)
|
|
33385
|
-
if (freshnessHorizon !== void 0)
|
|
33386
|
-
if (browseCollapsed !== void 0)
|
|
33387
|
-
if (order !== void 0)
|
|
33388
|
-
if (claim !== void 0)
|
|
33379
|
+
if (description !== void 0) kind2.description = description;
|
|
33380
|
+
if (path6 !== void 0) kind2.path = path6;
|
|
33381
|
+
if (links !== void 0) kind2.links = links;
|
|
33382
|
+
if (linkDescriptions !== void 0) kind2.linkDescriptions = linkDescriptions;
|
|
33383
|
+
if (expectsInbound !== void 0) kind2.expectsInbound = expectsInbound;
|
|
33384
|
+
if (sections && sections.length > 0) kind2.sections = sections;
|
|
33385
|
+
if (freshnessHorizon !== void 0) kind2.freshnessHorizon = freshnessHorizon;
|
|
33386
|
+
if (browseCollapsed !== void 0) kind2.browseCollapsed = browseCollapsed;
|
|
33387
|
+
if (order !== void 0) kind2.order = order;
|
|
33388
|
+
if (claim !== void 0) kind2.claim = claim;
|
|
33389
33389
|
return {
|
|
33390
33390
|
ok: true,
|
|
33391
|
-
kind,
|
|
33391
|
+
kind: kind2,
|
|
33392
33392
|
reservedFieldsIgnored: [...reservedFieldsIgnored].sort(),
|
|
33393
33393
|
reservedFieldPaths: [...reservedFieldPaths].sort(),
|
|
33394
33394
|
warnings
|
|
@@ -33396,8 +33396,8 @@ function parseConventionDoc(doc, options = {}) {
|
|
|
33396
33396
|
}
|
|
33397
33397
|
var HORIZON_RE = /^(\d+)(m|h|d)$/;
|
|
33398
33398
|
var HORIZON_UNIT_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
33399
|
-
function freshnessHorizonMs(
|
|
33400
|
-
const raw =
|
|
33399
|
+
function freshnessHorizonMs(kind2) {
|
|
33400
|
+
const raw = kind2.freshnessHorizon;
|
|
33401
33401
|
if (raw === void 0) return void 0;
|
|
33402
33402
|
const m = HORIZON_RE.exec(raw);
|
|
33403
33403
|
if (!m) return void 0;
|
|
@@ -33406,9 +33406,9 @@ function freshnessHorizonMs(kind) {
|
|
|
33406
33406
|
const unit = m[2];
|
|
33407
33407
|
return n * HORIZON_UNIT_MS[unit];
|
|
33408
33408
|
}
|
|
33409
|
-
function isTerminal(
|
|
33409
|
+
function isTerminal(kind2, frontmatter2) {
|
|
33410
33410
|
const fm = frontmatter2;
|
|
33411
|
-
for (const [field, terminalValues] of Object.entries(
|
|
33411
|
+
for (const [field, terminalValues] of Object.entries(kind2.fields.terminal)) {
|
|
33412
33412
|
if (!hasOwn(fm, field)) continue;
|
|
33413
33413
|
const raw = fm[field];
|
|
33414
33414
|
if (raw === void 0 || raw === null) continue;
|
|
@@ -33421,7 +33421,7 @@ function isTerminal(kind, frontmatter2) {
|
|
|
33421
33421
|
// ../core/src/query-selection.ts
|
|
33422
33422
|
function applyQuerySelectionFilters(rows, params, kinds = []) {
|
|
33423
33423
|
let out = rows;
|
|
33424
|
-
const byGoverns = new Map(kinds.map((
|
|
33424
|
+
const byGoverns = new Map(kinds.map((kind2) => [kind2.governs, kind2]));
|
|
33425
33425
|
if (params.field) {
|
|
33426
33426
|
const eq = params.field.indexOf("=");
|
|
33427
33427
|
if (eq > 0) {
|
|
@@ -33431,9 +33431,9 @@ function applyQuerySelectionFilters(rows, params, kinds = []) {
|
|
|
33431
33431
|
if (key !== PROGRESS_STATUS_FIELD) {
|
|
33432
33432
|
return values.some((value) => matchesFilter(row, { fields: { [key]: value } }));
|
|
33433
33433
|
}
|
|
33434
|
-
const
|
|
33435
|
-
if (!
|
|
33436
|
-
const raw = readKindField(params.okfVersion,
|
|
33434
|
+
const kind2 = byGoverns.get(String(row.frontmatter.type ?? ""));
|
|
33435
|
+
if (!kind2) return false;
|
|
33436
|
+
const raw = readKindField(params.okfVersion, kind2, row.frontmatter, key);
|
|
33437
33437
|
const actual = raw === void 0 || raw === null ? [] : (Array.isArray(raw) ? raw : [raw]).map((value) => String(value));
|
|
33438
33438
|
return values.some((value) => actual.includes(value));
|
|
33439
33439
|
});
|
|
@@ -33441,8 +33441,8 @@ function applyQuerySelectionFilters(rows, params, kinds = []) {
|
|
|
33441
33441
|
}
|
|
33442
33442
|
if (params.open) {
|
|
33443
33443
|
out = out.filter((row) => {
|
|
33444
|
-
const
|
|
33445
|
-
return !
|
|
33444
|
+
const kind2 = byGoverns.get(String(row.frontmatter.type ?? ""));
|
|
33445
|
+
return !kind2 || !isTerminal(kind2, row.frontmatter);
|
|
33446
33446
|
});
|
|
33447
33447
|
}
|
|
33448
33448
|
const count = out.length;
|
|
@@ -38849,15 +38849,15 @@ function tokenizeListStart(effects, ok4, nok) {
|
|
|
38849
38849
|
let size = 0;
|
|
38850
38850
|
return start;
|
|
38851
38851
|
function start(code2) {
|
|
38852
|
-
const
|
|
38853
|
-
if (
|
|
38852
|
+
const kind2 = self.containerState.type || (code2 === 42 || code2 === 43 || code2 === 45 ? "listUnordered" : "listOrdered");
|
|
38853
|
+
if (kind2 === "listUnordered" ? !self.containerState.marker || code2 === self.containerState.marker : asciiDigit(code2)) {
|
|
38854
38854
|
if (!self.containerState.type) {
|
|
38855
|
-
self.containerState.type =
|
|
38856
|
-
effects.enter(
|
|
38855
|
+
self.containerState.type = kind2;
|
|
38856
|
+
effects.enter(kind2, {
|
|
38857
38857
|
_container: true
|
|
38858
38858
|
});
|
|
38859
38859
|
}
|
|
38860
|
-
if (
|
|
38860
|
+
if (kind2 === "listUnordered") {
|
|
38861
38861
|
effects.enter("listItemPrefix");
|
|
38862
38862
|
return code2 === 42 || code2 === 45 ? effects.check(thematicBreak, nok, atMarker)(code2) : atMarker(code2);
|
|
38863
38863
|
}
|
|
@@ -43218,8 +43218,8 @@ var BridgeService = class {
|
|
|
43218
43218
|
if (source.body !== void 0 && Buffer.byteLength(source.body, "utf8") > MAX_DOCUMENT_BODY_BYTES) {
|
|
43219
43219
|
return { reply: fail(request.id, request.bridge, "TOO_LARGE", "a document body exceeded the 1 MiB View limit") };
|
|
43220
43220
|
}
|
|
43221
|
-
const
|
|
43222
|
-
const frontmatter2 =
|
|
43221
|
+
const kind2 = registry.kinds.get(String(source.frontmatter.type ?? ""));
|
|
43222
|
+
const frontmatter2 = kind2 ? projectLogicalKindFields(okfVersion, kind2, source.frontmatter) : source.frontmatter;
|
|
43223
43223
|
documents.push({
|
|
43224
43224
|
id: head.id,
|
|
43225
43225
|
version: source.version,
|
|
@@ -43310,8 +43310,8 @@ var BridgeService = class {
|
|
|
43310
43310
|
[...registry.kinds.values()]
|
|
43311
43311
|
);
|
|
43312
43312
|
result.rows = result.rows.map((row) => {
|
|
43313
|
-
const
|
|
43314
|
-
return
|
|
43313
|
+
const kind2 = registry.kinds.get(String(row.frontmatter.type ?? ""));
|
|
43314
|
+
return kind2 ? { ...row, frontmatter: projectLogicalKindFields(okfVersion, kind2, row.frontmatter) } : row;
|
|
43315
43315
|
});
|
|
43316
43316
|
return { reply: ok3(request.id, request.bridge, request.type, { ...result, ...skippedReply(skipped) }) };
|
|
43317
43317
|
}
|
|
@@ -43324,8 +43324,8 @@ var BridgeService = class {
|
|
|
43324
43324
|
if (Buffer.byteLength(result.doc.body, "utf8") > MAX_DOCUMENT_BODY_BYTES) {
|
|
43325
43325
|
return { reply: fail(request.id, request.bridge, "TOO_LARGE", "the document body exceeded the 1 MiB View limit") };
|
|
43326
43326
|
}
|
|
43327
|
-
const
|
|
43328
|
-
const projectedDoc =
|
|
43327
|
+
const kind2 = registry.kinds.get(String(result.doc.frontmatter.type ?? ""));
|
|
43328
|
+
const projectedDoc = kind2 ? { ...result.doc, frontmatter: projectLogicalKindFields(okfVersion, kind2, result.doc.frontmatter) } : result.doc;
|
|
43329
43329
|
return {
|
|
43330
43330
|
reply: ok3(
|
|
43331
43331
|
request.id,
|
|
@@ -44235,11 +44235,30 @@ var publication_snapshot_v1_schema_default = {
|
|
|
44235
44235
|
|
|
44236
44236
|
// ../publication/src/schema.ts
|
|
44237
44237
|
var PUBLICATION_SNAPSHOT_SCHEMA_V1 = Object.freeze(publication_snapshot_v1_schema_default);
|
|
44238
|
+
|
|
44239
|
+
// ../publication/src/source-exclusions.ts
|
|
44240
|
+
var fold = (value) => value.normalize("NFKC").toLowerCase();
|
|
44241
|
+
var kind = (value) => fold(String(value)).trim().replace(/\s+/g, " ");
|
|
44242
|
+
function assertPublicationSourceExclusions(source, exclusions) {
|
|
44243
|
+
const directories = new Set((exclusions.directories ?? []).map(fold));
|
|
44244
|
+
const types = new Set((exclusions.types ?? []).map(kind));
|
|
44245
|
+
if ([...directories].some((directory) => !directory || directory.includes("/")) || types.has("")) {
|
|
44246
|
+
throw new PublicationError("INVALID_BUNDLE", "publication source exclusions are invalid");
|
|
44247
|
+
}
|
|
44248
|
+
const excludedPath = (path6) => {
|
|
44249
|
+
const slash = path6.indexOf("/");
|
|
44250
|
+
return slash > 0 && directories.has(fold(path6.slice(0, slash)));
|
|
44251
|
+
};
|
|
44252
|
+
const excludedType = (type) => type !== void 0 && type !== null && (types.has(kind(type)) || Array.isArray(type) && type.flat(Infinity).some((value) => types.has(kind(value))));
|
|
44253
|
+
const count = source.documents.filter((document3) => excludedPath(document3.id) || excludedType(document3.frontmatter.type)).length + source.reserved.filter((file) => excludedPath(`${file.dir}/${file.name}`)).length + source.blobs.filter((blob) => excludedPath(blob.key)).length;
|
|
44254
|
+
if (count > 0) throw new PublicationError("INVALID_BUNDLE", "the publication source contains excluded content", { details: { excludedEntries: count } });
|
|
44255
|
+
}
|
|
44238
44256
|
export {
|
|
44239
44257
|
PUBLICATION_BRIDGE_V0,
|
|
44240
44258
|
PUBLICATION_SNAPSHOT_SCHEMA_V1,
|
|
44241
44259
|
PUBLICATION_SNAPSHOT_V1,
|
|
44242
44260
|
PublicationError,
|
|
44261
|
+
assertPublicationSourceExclusions,
|
|
44243
44262
|
capturePublicationSnapshot,
|
|
44244
44263
|
createPublicationBridge,
|
|
44245
44264
|
isPublicationError
|