superbee 0.4.3-pre.8 → 0.4.3
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 +1 -5
- package/SKILL.md +2 -2
- package/dist/portable-export.mjs +2 -0
- package/dist/publication-bridge.mjs +839 -458
- package/dist/publication.mjs +781 -426
- package/dist/superbee.mjs +43921 -23499
- package/package.json +2 -2
- package/references/author-an-integration.md +192 -0
- package/references/hosted-checkout.md +96 -8
- package/references/integrations/rest-json-authoring/README.md +24 -0
- package/references/integrations/rest-json-authoring/fixture/fixture.json +2466 -0
- package/references/integrations/rest-json-authoring/recipe/connectors/tickets.md +42 -0
- package/references/integrations/rest-json-authoring/recipe/conventions/ticket.md +15 -0
- package/references/integrations/rest-json-authoring/recipe/recipe.md +13 -0
package/dist/publication.mjs
CHANGED
|
@@ -924,25 +924,25 @@ var require_pairs = __commonJS({
|
|
|
924
924
|
var _toString = Object.prototype.toString;
|
|
925
925
|
function resolveYamlPairs(data) {
|
|
926
926
|
if (data === null) return true;
|
|
927
|
-
var index2, length, pair,
|
|
927
|
+
var index2, length, pair, keys2, result, object = data;
|
|
928
928
|
result = new Array(object.length);
|
|
929
929
|
for (index2 = 0, length = object.length; index2 < length; index2 += 1) {
|
|
930
930
|
pair = object[index2];
|
|
931
931
|
if (_toString.call(pair) !== "[object Object]") return false;
|
|
932
|
-
|
|
933
|
-
if (
|
|
934
|
-
result[index2] = [
|
|
932
|
+
keys2 = Object.keys(pair);
|
|
933
|
+
if (keys2.length !== 1) return false;
|
|
934
|
+
result[index2] = [keys2[0], pair[keys2[0]]];
|
|
935
935
|
}
|
|
936
936
|
return true;
|
|
937
937
|
}
|
|
938
938
|
function constructYamlPairs(data) {
|
|
939
939
|
if (data === null) return [];
|
|
940
|
-
var index2, length, pair,
|
|
940
|
+
var index2, length, pair, keys2, result, object = data;
|
|
941
941
|
result = new Array(object.length);
|
|
942
942
|
for (index2 = 0, length = object.length; index2 < length; index2 += 1) {
|
|
943
943
|
pair = object[index2];
|
|
944
|
-
|
|
945
|
-
result[index2] = [
|
|
944
|
+
keys2 = Object.keys(pair);
|
|
945
|
+
result[index2] = [keys2[0], pair[keys2[0]]];
|
|
946
946
|
}
|
|
947
947
|
return result;
|
|
948
948
|
}
|
|
@@ -2349,12 +2349,12 @@ var require_dumper = __commonJS({
|
|
|
2349
2349
|
"OFF"
|
|
2350
2350
|
];
|
|
2351
2351
|
function compileStyleMap(schema, map) {
|
|
2352
|
-
var result,
|
|
2352
|
+
var result, keys2, index2, length, tag, style, type;
|
|
2353
2353
|
if (map === null) return {};
|
|
2354
2354
|
result = {};
|
|
2355
|
-
|
|
2356
|
-
for (index2 = 0, length =
|
|
2357
|
-
tag =
|
|
2355
|
+
keys2 = Object.keys(map);
|
|
2356
|
+
for (index2 = 0, length = keys2.length; index2 < length; index2 += 1) {
|
|
2357
|
+
tag = keys2[index2];
|
|
2358
2358
|
style = String(map[tag]);
|
|
2359
2359
|
if (tag.slice(0, 2) === "!!") {
|
|
2360
2360
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
@@ -30726,15 +30726,15 @@ var require_react_jsx_runtime_development = __commonJS({
|
|
|
30726
30726
|
else validateChildKeys(children);
|
|
30727
30727
|
if (hasOwnProperty2.call(config, "key")) {
|
|
30728
30728
|
children = getComponentNameFromType(type);
|
|
30729
|
-
var
|
|
30729
|
+
var keys2 = Object.keys(config).filter(function(k) {
|
|
30730
30730
|
return "key" !== k;
|
|
30731
30731
|
});
|
|
30732
|
-
isStaticChildren = 0 <
|
|
30733
|
-
didWarnAboutKeySpread[children + isStaticChildren] || (
|
|
30732
|
+
isStaticChildren = 0 < keys2.length ? "{key: someKey, " + keys2.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
30733
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys2 = 0 < keys2.length ? "{" + keys2.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
30734
30734
|
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
30735
30735
|
isStaticChildren,
|
|
30736
30736
|
children,
|
|
30737
|
-
|
|
30737
|
+
keys2,
|
|
30738
30738
|
children
|
|
30739
30739
|
), didWarnAboutKeySpread[children + isStaticChildren] = true);
|
|
30740
30740
|
}
|
|
@@ -30828,7 +30828,38 @@ import path5 from "node:path";
|
|
|
30828
30828
|
// ../core/src/backend.ts
|
|
30829
30829
|
import path3 from "node:path";
|
|
30830
30830
|
|
|
30831
|
-
// ../core/src/
|
|
30831
|
+
// ../core/src/errors.ts
|
|
30832
|
+
var InvalidInputError = class extends Error {
|
|
30833
|
+
constructor(message) {
|
|
30834
|
+
super(message);
|
|
30835
|
+
this.name = "InvalidInputError";
|
|
30836
|
+
}
|
|
30837
|
+
};
|
|
30838
|
+
var FilesystemIdentityAliasError = class extends InvalidInputError {
|
|
30839
|
+
rel;
|
|
30840
|
+
segment;
|
|
30841
|
+
constructor(rel, segment) {
|
|
30842
|
+
super(
|
|
30843
|
+
`Path '${rel}' does not match the exact spelling of an existing filesystem entry at segment '${segment}'; ids that differ only by case or Unicode normalization cannot share one file.`
|
|
30844
|
+
);
|
|
30845
|
+
this.name = "FilesystemIdentityAliasError";
|
|
30846
|
+
this.rel = rel;
|
|
30847
|
+
this.segment = segment;
|
|
30848
|
+
}
|
|
30849
|
+
};
|
|
30850
|
+
var ConcurrentReplacementError = class extends Error {
|
|
30851
|
+
rel;
|
|
30852
|
+
/** Optional bounded backoff hint for a transient host condition; ordinary observation races use zero. */
|
|
30853
|
+
retryAfterMs;
|
|
30854
|
+
constructor(rel, attempts, retryAfterMs = 0) {
|
|
30855
|
+
super(`Path '${rel}' could not be bound to one stable entry during ${attempts} filesystem attempt(s); retry.`);
|
|
30856
|
+
this.name = "ConcurrentReplacementError";
|
|
30857
|
+
this.rel = rel;
|
|
30858
|
+
this.retryAfterMs = retryAfterMs;
|
|
30859
|
+
}
|
|
30860
|
+
};
|
|
30861
|
+
|
|
30862
|
+
// ../core/src/portable-frontmatter.ts
|
|
30832
30863
|
var import_js_yaml = __toESM(require_js_yaml2(), 1);
|
|
30833
30864
|
|
|
30834
30865
|
// ../core/src/frontmatter-contract.ts
|
|
@@ -30876,187 +30907,21 @@ function splitLeadingFrontmatter(raw, context) {
|
|
|
30876
30907
|
throw new MalformedDocumentError(context, new Error("unterminated YAML frontmatter delimiter"));
|
|
30877
30908
|
}
|
|
30878
30909
|
|
|
30879
|
-
// ../core/src/frontmatter.ts
|
|
30880
|
-
|
|
30881
|
-
function requireYamlTimestampType() {
|
|
30882
|
-
const type = import_js_yaml.default.DEFAULT_SAFE_SCHEMA.implicit.find(
|
|
30883
|
-
(candidate) => candidate.tag === YAML_TIMESTAMP_TAG
|
|
30884
|
-
);
|
|
30885
|
-
if (!type) throw new Error("js-yaml safe schema is missing its timestamp type");
|
|
30886
|
-
return type;
|
|
30887
|
-
}
|
|
30888
|
-
var yamlTimestampType = requireYamlTimestampType();
|
|
30889
|
-
var stringTimestampType = new import_js_yaml.default.Type(YAML_TIMESTAMP_TAG, {
|
|
30890
|
-
kind: "scalar",
|
|
30891
|
-
resolve: (value) => yamlTimestampType.resolve(value),
|
|
30892
|
-
construct: (value) => value
|
|
30893
|
-
});
|
|
30894
|
-
var losslessDateSchema = new import_js_yaml.default.Schema({
|
|
30895
|
-
include: [import_js_yaml.default.DEFAULT_SAFE_SCHEMA],
|
|
30896
|
-
implicit: [stringTimestampType]
|
|
30897
|
-
});
|
|
30898
|
-
var yamlEngine = {
|
|
30899
|
-
parse(input) {
|
|
30900
|
-
return import_js_yaml.default.safeLoad(input, { schema: losslessDateSchema }) ?? {};
|
|
30901
|
-
}
|
|
30902
|
-
};
|
|
30903
|
-
function normalizeFrontmatter(data, okfVersion) {
|
|
30904
|
-
const out = { ...data };
|
|
30905
|
-
if (okfVersion === "0.2") return out;
|
|
30906
|
-
const value = out.timestamp;
|
|
30907
|
-
if (value instanceof Date) {
|
|
30908
|
-
out.timestamp = value.toISOString();
|
|
30909
|
-
} else if (typeof value === "number" && Number.isFinite(value)) {
|
|
30910
|
-
out.timestamp = new Date(value).toISOString();
|
|
30911
|
-
} else if (typeof value === "string" && yamlTimestampType.resolve(value)) {
|
|
30912
|
-
const parsed = yamlTimestampType.construct(value);
|
|
30913
|
-
if (parsed instanceof Date) out.timestamp = parsed.toISOString();
|
|
30914
|
-
}
|
|
30915
|
-
return out;
|
|
30916
|
-
}
|
|
30917
|
-
function parseMarkdown(raw, context, options = {}) {
|
|
30910
|
+
// ../core/src/portable-frontmatter.ts
|
|
30911
|
+
function parseLeadingFrontmatter(raw, context) {
|
|
30918
30912
|
const split = splitLeadingFrontmatter(raw, context);
|
|
30919
|
-
if (!("yamlSource" in split)) return {
|
|
30920
|
-
return { frontmatter: parseFrontmatter(split.yamlSource, context, options), body: split.body };
|
|
30921
|
-
}
|
|
30922
|
-
function parseFrontmatter(source, context, options = {}) {
|
|
30923
|
-
let parsed;
|
|
30913
|
+
if (!("yamlSource" in split)) return {};
|
|
30924
30914
|
try {
|
|
30925
|
-
parsed =
|
|
30926
|
-
|
|
30927
|
-
|
|
30928
|
-
|
|
30929
|
-
|
|
30930
|
-
|
|
30931
|
-
|
|
30932
|
-
|
|
30933
|
-
|
|
30934
|
-
function normalizeDocumentBodyForStorage(body) {
|
|
30935
|
-
return body.endsWith("\n") ? body : `${body}
|
|
30936
|
-
`;
|
|
30937
|
-
}
|
|
30938
|
-
function stringifyWithData(data, body) {
|
|
30939
|
-
return stringifyWithSerializedFrontmatter(stringifyFrontmatter(data), body);
|
|
30940
|
-
}
|
|
30941
|
-
function stringifyWithSerializedFrontmatter(dumped, body) {
|
|
30942
|
-
const content3 = body ?? "";
|
|
30943
|
-
const newline = (value) => value.endsWith("\n") ? value : `${value}
|
|
30944
|
-
`;
|
|
30945
|
-
if (dumped === "{}") return normalizeDocumentBodyForStorage(content3);
|
|
30946
|
-
return `---
|
|
30947
|
-
${newline(dumped)}---
|
|
30948
|
-
${normalizeDocumentBodyForStorage(content3)}`;
|
|
30949
|
-
}
|
|
30950
|
-
function stringifyDoc(frontmatter2, body) {
|
|
30951
|
-
return stringifyWithData(frontmatter2, body);
|
|
30952
|
-
}
|
|
30953
|
-
|
|
30954
|
-
// ../core/src/meaningful-change-time.ts
|
|
30955
|
-
function meaningfulChangeTimeField(frontmatter2) {
|
|
30956
|
-
const generated = frontmatter2.generated;
|
|
30957
|
-
if (generated !== null && typeof generated === "object" && !Array.isArray(generated) && generated.at !== void 0) return "generated.at";
|
|
30958
|
-
return "timestamp";
|
|
30959
|
-
}
|
|
30960
|
-
function meaningfulChangeTimeValue(frontmatter2) {
|
|
30961
|
-
return meaningfulChangeTimeField(frontmatter2) === "generated.at" ? frontmatter2.generated.at : frontmatter2.timestamp;
|
|
30962
|
-
}
|
|
30963
|
-
|
|
30964
|
-
// ../core/src/errors.ts
|
|
30965
|
-
var InvalidInputError = class extends Error {
|
|
30966
|
-
constructor(message) {
|
|
30967
|
-
super(message);
|
|
30968
|
-
this.name = "InvalidInputError";
|
|
30969
|
-
}
|
|
30970
|
-
};
|
|
30971
|
-
var FilesystemIdentityAliasError = class extends InvalidInputError {
|
|
30972
|
-
rel;
|
|
30973
|
-
segment;
|
|
30974
|
-
constructor(rel, segment) {
|
|
30975
|
-
super(
|
|
30976
|
-
`Path '${rel}' does not match the exact spelling of an existing filesystem entry at segment '${segment}'; ids that differ only by case or Unicode normalization cannot share one file.`
|
|
30977
|
-
);
|
|
30978
|
-
this.name = "FilesystemIdentityAliasError";
|
|
30979
|
-
this.rel = rel;
|
|
30980
|
-
this.segment = segment;
|
|
30981
|
-
}
|
|
30982
|
-
};
|
|
30983
|
-
var ConcurrentReplacementError = class extends Error {
|
|
30984
|
-
rel;
|
|
30985
|
-
/** Optional bounded backoff hint for a transient host condition; ordinary observation races use zero. */
|
|
30986
|
-
retryAfterMs;
|
|
30987
|
-
constructor(rel, attempts, retryAfterMs = 0) {
|
|
30988
|
-
super(`Path '${rel}' could not be bound to one stable entry during ${attempts} filesystem attempt(s); retry.`);
|
|
30989
|
-
this.name = "ConcurrentReplacementError";
|
|
30990
|
-
this.rel = rel;
|
|
30991
|
-
this.retryAfterMs = retryAfterMs;
|
|
30992
|
-
}
|
|
30993
|
-
};
|
|
30994
|
-
|
|
30995
|
-
// ../core/src/verification.ts
|
|
30996
|
-
var TRUST_TIERS = Object.freeze([
|
|
30997
|
-
"unverified",
|
|
30998
|
-
"machine-confirmed",
|
|
30999
|
-
"human-reviewed"
|
|
31000
|
-
]);
|
|
31001
|
-
var ISO_INSTANT = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(?:([Zz])|([+-])(\d{2})(?::?(\d{2}))?)$/;
|
|
31002
|
-
function parseIsoInstant(raw, rounding = "truncate") {
|
|
31003
|
-
const match = ISO_INSTANT.exec(raw);
|
|
31004
|
-
if (!match) return null;
|
|
31005
|
-
const [, y, mo, d, h, mi, sec = "0", frac = "0", zulu, sign, oh, om = "0"] = match;
|
|
31006
|
-
const year = Number(y);
|
|
31007
|
-
const month = Number(mo);
|
|
31008
|
-
const day = Number(d);
|
|
31009
|
-
const hour = Number(h);
|
|
31010
|
-
const minute = Number(mi);
|
|
31011
|
-
const second = Number(sec);
|
|
31012
|
-
if (month < 1 || month > 12) return null;
|
|
31013
|
-
const probe = /* @__PURE__ */ new Date(0);
|
|
31014
|
-
probe.setUTCFullYear(year, month, 0);
|
|
31015
|
-
if (day < 1 || day > probe.getUTCDate()) return null;
|
|
31016
|
-
if (hour > 23 || minute > 59 || second > 59) return null;
|
|
31017
|
-
let offsetMinutes = 0;
|
|
31018
|
-
if (!zulu) {
|
|
31019
|
-
const offsetHours = Number(oh);
|
|
31020
|
-
const offsetMins = Number(om);
|
|
31021
|
-
if (offsetHours > 23 || offsetMins > 59) return null;
|
|
31022
|
-
offsetMinutes = (sign === "-" ? -1 : 1) * (offsetHours * 60 + offsetMins);
|
|
30915
|
+
const parsed = import_js_yaml.default.safeLoad(split.yamlSource);
|
|
30916
|
+
if (parsed === void 0 || parsed === null) return {};
|
|
30917
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
30918
|
+
throw new TypeError("YAML frontmatter must be a mapping");
|
|
30919
|
+
}
|
|
30920
|
+
return parsed;
|
|
30921
|
+
} catch (error) {
|
|
30922
|
+
if (error instanceof MalformedDocumentError) throw error;
|
|
30923
|
+
throw new MalformedDocumentError(context, error);
|
|
31023
30924
|
}
|
|
31024
|
-
const millis = Number(frac.padEnd(3, "0").slice(0, 3));
|
|
31025
|
-
const instant = /* @__PURE__ */ new Date(0);
|
|
31026
|
-
instant.setUTCFullYear(year, month - 1, day);
|
|
31027
|
-
instant.setUTCHours(hour, minute, second, millis);
|
|
31028
|
-
const remainder = rounding === "ceil" && /[1-9]/.test(frac.slice(3)) ? 1 : 0;
|
|
31029
|
-
return instant.getTime() - offsetMinutes * 6e4 + remainder;
|
|
31030
|
-
}
|
|
31031
|
-
|
|
31032
|
-
// ../core/src/freshness.ts
|
|
31033
|
-
function parseTimestamp(ts, okfVersion) {
|
|
31034
|
-
if (okfVersion === "0.2") return typeof ts === "string" ? parseIsoInstant(ts) : null;
|
|
31035
|
-
if (ts instanceof Date) {
|
|
31036
|
-
const ms2 = ts.getTime();
|
|
31037
|
-
return Number.isNaN(ms2) ? null : ms2;
|
|
31038
|
-
}
|
|
31039
|
-
if (typeof ts === "number") {
|
|
31040
|
-
return Number.isFinite(ts) ? ts : null;
|
|
31041
|
-
}
|
|
31042
|
-
if (typeof ts !== "string" || ts.trim() === "") return null;
|
|
31043
|
-
const ms = Date.parse(ts);
|
|
31044
|
-
return Number.isNaN(ms) ? null : ms;
|
|
31045
|
-
}
|
|
31046
|
-
|
|
31047
|
-
// ../core/src/okf-lifecycle.ts
|
|
31048
|
-
var OKF_LIFECYCLE_STATUSES = Object.freeze(["draft", "stable", "deprecated"]);
|
|
31049
|
-
function isOkfLifecycleStatus(value) {
|
|
31050
|
-
return typeof value === "string" && OKF_LIFECYCLE_STATUSES.includes(value);
|
|
31051
|
-
}
|
|
31052
|
-
|
|
31053
|
-
// ../core/src/mutation-attribution.ts
|
|
31054
|
-
var SUPERBEE_UPDATED_BY_FIELD = "superbee_updated_by";
|
|
31055
|
-
function nonEmptyString(value) {
|
|
31056
|
-
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
31057
|
-
}
|
|
31058
|
-
function mutationActorFromFrontmatter(frontmatter2) {
|
|
31059
|
-
return nonEmptyString(frontmatter2[SUPERBEE_UPDATED_BY_FIELD]) ?? nonEmptyString(frontmatter2.updated_by) ?? nonEmptyString(frontmatter2.actor);
|
|
31060
30925
|
}
|
|
31061
30926
|
|
|
31062
30927
|
// ../core/src/paths.ts
|
|
@@ -31111,6 +30976,8 @@ function assertSafeConceptId(id) {
|
|
|
31111
30976
|
);
|
|
31112
30977
|
}
|
|
31113
30978
|
}
|
|
30979
|
+
var FORMAT_AT_EDGE = new RegExp("^\\p{Cf}|\\p{Cf}$", "u");
|
|
30980
|
+
var FORMAT_INSIDE = new RegExp("(?![\\u200c\\u200d])\\p{Cf}", "u");
|
|
31114
30981
|
function assertSafeBlobKey(key) {
|
|
31115
30982
|
if (typeof key !== "string" || key.trim() === "") {
|
|
31116
30983
|
throw new InvalidInputError("Blob key must be a non-empty string.");
|
|
@@ -31133,6 +31000,357 @@ function assertSafeReservedDir(dir) {
|
|
|
31133
31000
|
if (dir !== "") assertPortablePath(dir, "Reserved-file directory");
|
|
31134
31001
|
}
|
|
31135
31002
|
|
|
31003
|
+
// ../core/src/sha256.ts
|
|
31004
|
+
var K = new Uint32Array([
|
|
31005
|
+
1116352408,
|
|
31006
|
+
1899447441,
|
|
31007
|
+
3049323471,
|
|
31008
|
+
3921009573,
|
|
31009
|
+
961987163,
|
|
31010
|
+
1508970993,
|
|
31011
|
+
2453635748,
|
|
31012
|
+
2870763221,
|
|
31013
|
+
3624381080,
|
|
31014
|
+
310598401,
|
|
31015
|
+
607225278,
|
|
31016
|
+
1426881987,
|
|
31017
|
+
1925078388,
|
|
31018
|
+
2162078206,
|
|
31019
|
+
2614888103,
|
|
31020
|
+
3248222580,
|
|
31021
|
+
3835390401,
|
|
31022
|
+
4022224774,
|
|
31023
|
+
264347078,
|
|
31024
|
+
604807628,
|
|
31025
|
+
770255983,
|
|
31026
|
+
1249150122,
|
|
31027
|
+
1555081692,
|
|
31028
|
+
1996064986,
|
|
31029
|
+
2554220882,
|
|
31030
|
+
2821834349,
|
|
31031
|
+
2952996808,
|
|
31032
|
+
3210313671,
|
|
31033
|
+
3336571891,
|
|
31034
|
+
3584528711,
|
|
31035
|
+
113926993,
|
|
31036
|
+
338241895,
|
|
31037
|
+
666307205,
|
|
31038
|
+
773529912,
|
|
31039
|
+
1294757372,
|
|
31040
|
+
1396182291,
|
|
31041
|
+
1695183700,
|
|
31042
|
+
1986661051,
|
|
31043
|
+
2177026350,
|
|
31044
|
+
2456956037,
|
|
31045
|
+
2730485921,
|
|
31046
|
+
2820302411,
|
|
31047
|
+
3259730800,
|
|
31048
|
+
3345764771,
|
|
31049
|
+
3516065817,
|
|
31050
|
+
3600352804,
|
|
31051
|
+
4094571909,
|
|
31052
|
+
275423344,
|
|
31053
|
+
430227734,
|
|
31054
|
+
506948616,
|
|
31055
|
+
659060556,
|
|
31056
|
+
883997877,
|
|
31057
|
+
958139571,
|
|
31058
|
+
1322822218,
|
|
31059
|
+
1537002063,
|
|
31060
|
+
1747873779,
|
|
31061
|
+
1955562222,
|
|
31062
|
+
2024104815,
|
|
31063
|
+
2227730452,
|
|
31064
|
+
2361852424,
|
|
31065
|
+
2428436474,
|
|
31066
|
+
2756734187,
|
|
31067
|
+
3204031479,
|
|
31068
|
+
3329325298
|
|
31069
|
+
]);
|
|
31070
|
+
var INITIAL_STATE = new Uint32Array([
|
|
31071
|
+
1779033703,
|
|
31072
|
+
3144134277,
|
|
31073
|
+
1013904242,
|
|
31074
|
+
2773480762,
|
|
31075
|
+
1359893119,
|
|
31076
|
+
2600822924,
|
|
31077
|
+
528734635,
|
|
31078
|
+
1541459225
|
|
31079
|
+
]);
|
|
31080
|
+
var encoder = new TextEncoder();
|
|
31081
|
+
function rotr(value, bits) {
|
|
31082
|
+
return value >>> bits | value << 32 - bits;
|
|
31083
|
+
}
|
|
31084
|
+
function compress(h, w, view, offset) {
|
|
31085
|
+
for (let i = 0; i < 16; i++) {
|
|
31086
|
+
w[i] = view.getUint32(offset + i * 4);
|
|
31087
|
+
}
|
|
31088
|
+
for (let i = 16; i < 64; i++) {
|
|
31089
|
+
const w15 = w[i - 15];
|
|
31090
|
+
const w2 = w[i - 2];
|
|
31091
|
+
const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
|
|
31092
|
+
const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
|
|
31093
|
+
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
31094
|
+
}
|
|
31095
|
+
let a = h[0];
|
|
31096
|
+
let b = h[1];
|
|
31097
|
+
let c = h[2];
|
|
31098
|
+
let d = h[3];
|
|
31099
|
+
let e = h[4];
|
|
31100
|
+
let f = h[5];
|
|
31101
|
+
let g = h[6];
|
|
31102
|
+
let hh = h[7];
|
|
31103
|
+
for (let i = 0; i < 64; i++) {
|
|
31104
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
31105
|
+
const ch = e & f ^ ~e & g;
|
|
31106
|
+
const t1 = hh + S1 + ch + K[i] + w[i] >>> 0;
|
|
31107
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
31108
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
31109
|
+
const t2 = S0 + maj >>> 0;
|
|
31110
|
+
hh = g;
|
|
31111
|
+
g = f;
|
|
31112
|
+
f = e;
|
|
31113
|
+
e = d + t1 >>> 0;
|
|
31114
|
+
d = c;
|
|
31115
|
+
c = b;
|
|
31116
|
+
b = a;
|
|
31117
|
+
a = t1 + t2 >>> 0;
|
|
31118
|
+
}
|
|
31119
|
+
h[0] = h[0] + a >>> 0;
|
|
31120
|
+
h[1] = h[1] + b >>> 0;
|
|
31121
|
+
h[2] = h[2] + c >>> 0;
|
|
31122
|
+
h[3] = h[3] + d >>> 0;
|
|
31123
|
+
h[4] = h[4] + e >>> 0;
|
|
31124
|
+
h[5] = h[5] + f >>> 0;
|
|
31125
|
+
h[6] = h[6] + g >>> 0;
|
|
31126
|
+
h[7] = h[7] + hh >>> 0;
|
|
31127
|
+
}
|
|
31128
|
+
function sha256HexOfBytes(bytes) {
|
|
31129
|
+
const h = new Uint32Array(INITIAL_STATE);
|
|
31130
|
+
const w = new Uint32Array(64);
|
|
31131
|
+
const length = bytes.byteLength;
|
|
31132
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, length);
|
|
31133
|
+
const fullBlocks = length >>> 6;
|
|
31134
|
+
for (let block = 0; block < fullBlocks; block++) {
|
|
31135
|
+
compress(h, w, view, block * 64);
|
|
31136
|
+
}
|
|
31137
|
+
const remaining = length - fullBlocks * 64;
|
|
31138
|
+
const tail = new Uint8Array(remaining + 1 + 8 > 64 ? 128 : 64);
|
|
31139
|
+
tail.set(bytes.subarray(fullBlocks * 64));
|
|
31140
|
+
tail[remaining] = 128;
|
|
31141
|
+
const tailView = new DataView(tail.buffer);
|
|
31142
|
+
const bitLengthHigh = Math.floor(length / 536870912);
|
|
31143
|
+
const bitLengthLow = length << 3 >>> 0;
|
|
31144
|
+
tailView.setUint32(tail.length - 8, bitLengthHigh);
|
|
31145
|
+
tailView.setUint32(tail.length - 4, bitLengthLow);
|
|
31146
|
+
for (let offset = 0; offset < tail.length; offset += 64) {
|
|
31147
|
+
compress(h, w, tailView, offset);
|
|
31148
|
+
}
|
|
31149
|
+
let hex = "";
|
|
31150
|
+
for (let i = 0; i < 8; i++) {
|
|
31151
|
+
hex += h[i].toString(16).padStart(8, "0");
|
|
31152
|
+
}
|
|
31153
|
+
return hex;
|
|
31154
|
+
}
|
|
31155
|
+
function sha256HexOfUtf8(input) {
|
|
31156
|
+
return sha256HexOfBytes(encoder.encode(input));
|
|
31157
|
+
}
|
|
31158
|
+
|
|
31159
|
+
// ../core/src/inventory-guard.ts
|
|
31160
|
+
var INVENTORY_GUARD_DOMAIN = "cooperating-local-writers-v1";
|
|
31161
|
+
var InventoryGuardUnsupported = class extends Error {
|
|
31162
|
+
written = false;
|
|
31163
|
+
reason;
|
|
31164
|
+
constructor(reason) {
|
|
31165
|
+
super(`Inventory guard unsupported: ${reason}`);
|
|
31166
|
+
this.name = "InventoryGuardUnsupported";
|
|
31167
|
+
this.reason = reason;
|
|
31168
|
+
}
|
|
31169
|
+
};
|
|
31170
|
+
var InventoryGuardConflict = class extends Error {
|
|
31171
|
+
written = false;
|
|
31172
|
+
reason;
|
|
31173
|
+
constructor(reason) {
|
|
31174
|
+
super(`Inventory guard premise changed: ${reason}`);
|
|
31175
|
+
this.name = "InventoryGuardConflict";
|
|
31176
|
+
this.reason = reason;
|
|
31177
|
+
}
|
|
31178
|
+
};
|
|
31179
|
+
var capabilityOwners = /* @__PURE__ */ new WeakMap();
|
|
31180
|
+
function bindInventoryGuard(owner, guard) {
|
|
31181
|
+
capabilityOwners.set(guard, owner);
|
|
31182
|
+
return guard;
|
|
31183
|
+
}
|
|
31184
|
+
function assertInventoryGuardBound(count) {
|
|
31185
|
+
if (count > 1e4) throw new InventoryGuardUnsupported("inventory_document_bound");
|
|
31186
|
+
}
|
|
31187
|
+
function copyData(value, active = /* @__PURE__ */ new Set(), budget = { nodes: 1e5 }) {
|
|
31188
|
+
if (--budget.nodes < 0) throw new InvalidInputError("Inventory guard input exceeds its data bound.");
|
|
31189
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
31190
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
31191
|
+
if (typeof value !== "object") throw new InvalidInputError("Inventory guard accepts finite plain data only.");
|
|
31192
|
+
if (active.has(value)) throw new InvalidInputError("Inventory guard input is cyclic.");
|
|
31193
|
+
const array = Array.isArray(value);
|
|
31194
|
+
if (Object.getPrototypeOf(value) !== (array ? Array.prototype : Object.prototype) && Object.getPrototypeOf(value) !== null) {
|
|
31195
|
+
throw new InvalidInputError("Inventory guard accepts plain objects and arrays only.");
|
|
31196
|
+
}
|
|
31197
|
+
active.add(value);
|
|
31198
|
+
const result = array ? [] : /* @__PURE__ */ Object.create(null);
|
|
31199
|
+
if (array && Object.keys(value).length !== value.length) throw new InvalidInputError("Inventory guard input cannot carry sparse arrays or extra keys.");
|
|
31200
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
31201
|
+
if (array && key === "length") continue;
|
|
31202
|
+
if (array && (typeof key !== "string" || !/^(0|[1-9][0-9]*)$/.test(key))) throw new InvalidInputError("Inventory guard arrays require indexed data only.");
|
|
31203
|
+
if (typeof key !== "string") throw new InvalidInputError("Inventory guard input cannot carry symbol keys.");
|
|
31204
|
+
const property = Object.getOwnPropertyDescriptor(value, key);
|
|
31205
|
+
if (!property.enumerable || !("value" in property)) throw new InvalidInputError("Inventory guard input cannot carry accessors or hidden data.");
|
|
31206
|
+
Object.defineProperty(result, key, { value: copyData(property.value, active, budget), enumerable: true, configurable: true, writable: true });
|
|
31207
|
+
}
|
|
31208
|
+
if (array && result.length !== value.length) throw new InvalidInputError("Inventory guard input cannot carry sparse arrays.");
|
|
31209
|
+
active.delete(value);
|
|
31210
|
+
return result;
|
|
31211
|
+
}
|
|
31212
|
+
function record(value) {
|
|
31213
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new InvalidInputError("Inventory guard expected an object.");
|
|
31214
|
+
return value;
|
|
31215
|
+
}
|
|
31216
|
+
function keys(value, allowed) {
|
|
31217
|
+
if (Object.keys(value).some((key) => !allowed.includes(key))) throw new InvalidInputError("Inventory guard input has unsupported fields.");
|
|
31218
|
+
}
|
|
31219
|
+
function version(value) {
|
|
31220
|
+
if (typeof value !== "string" || !/^sha256:[0-9a-f]{64}$/.test(value)) throw new InvalidInputError("Inventory guard requires exact content versions.");
|
|
31221
|
+
}
|
|
31222
|
+
function captureInventoryGuardRequest(input) {
|
|
31223
|
+
const data = record(copyData(input));
|
|
31224
|
+
keys(data, ["target", "domain", "inventory", "id", "expectedVersion", "doc", "options"]);
|
|
31225
|
+
const target = record(data.target);
|
|
31226
|
+
keys(target, ["contract", "domain", "adapter", "store", "root_version", "edition"]);
|
|
31227
|
+
if (target.contract !== "inventory-guard/v1" || target.domain !== INVENTORY_GUARD_DOMAIN || data.domain !== INVENTORY_GUARD_DOMAIN) {
|
|
31228
|
+
throw new InventoryGuardUnsupported("domain_or_contract");
|
|
31229
|
+
}
|
|
31230
|
+
if (!["memory", "filesystem"].includes(String(target.adapter)) || typeof target.store !== "string" || target.store.length === 0 || !["0.1", "0.2"].includes(String(target.edition))) throw new InvalidInputError("Invalid inventory guard target.");
|
|
31231
|
+
version(target.root_version);
|
|
31232
|
+
if (typeof data.id !== "string") throw new InvalidInputError("Inventory guard requires a target id.");
|
|
31233
|
+
assertSafeConceptId(data.id);
|
|
31234
|
+
if (isReservedFile(pathFromConceptId(data.id))) throw new InvalidInputError("Inventory guard target must be a concept.");
|
|
31235
|
+
version(data.expectedVersion);
|
|
31236
|
+
if (!Array.isArray(data.inventory)) throw new InvalidInputError("Inventory guard requires a complete inventory.");
|
|
31237
|
+
assertInventoryGuardBound(data.inventory.length);
|
|
31238
|
+
let previous3;
|
|
31239
|
+
for (const raw of data.inventory) {
|
|
31240
|
+
const row = record(raw);
|
|
31241
|
+
keys(row, ["id", "version"]);
|
|
31242
|
+
if (typeof row.id !== "string") throw new InvalidInputError("Inventory guard inventory id is invalid.");
|
|
31243
|
+
assertSafeConceptId(row.id);
|
|
31244
|
+
if (isReservedFile(pathFromConceptId(row.id)) || previous3 !== void 0 && compareStorageKeys(previous3, row.id) >= 0) throw new InvalidInputError("Inventory guard inventory must be sorted, unique concepts.");
|
|
31245
|
+
version(row.version);
|
|
31246
|
+
previous3 = row.id;
|
|
31247
|
+
}
|
|
31248
|
+
if (!data.inventory.some((row) => row.id === data.id && row.version === data.expectedVersion)) throw new InvalidInputError("Inventory guard target/version is missing from inventory.");
|
|
31249
|
+
const doc = record(data.doc);
|
|
31250
|
+
keys(doc, ["id", "frontmatter", "body"]);
|
|
31251
|
+
if (doc.id !== data.id || typeof doc.body !== "string") throw new InvalidInputError("Inventory guard candidate identity/body is invalid.");
|
|
31252
|
+
record(doc.frontmatter);
|
|
31253
|
+
if (data.options !== void 0) {
|
|
31254
|
+
const options = record(data.options);
|
|
31255
|
+
keys(options, ["actor", "agent"]);
|
|
31256
|
+
if (Object.values(options).some((value) => typeof value !== "string")) throw new InvalidInputError("Inventory guard attribution must be strings.");
|
|
31257
|
+
}
|
|
31258
|
+
return data;
|
|
31259
|
+
}
|
|
31260
|
+
function guardEdition(content3) {
|
|
31261
|
+
if (content3 === null) throw new InventoryGuardUnsupported("root_metadata_absent");
|
|
31262
|
+
const edition = parseLeadingFrontmatter(content3, "index.md").okf_version;
|
|
31263
|
+
if (edition !== "0.1" && edition !== "0.2") throw new InventoryGuardUnsupported("root_edition_unestablished");
|
|
31264
|
+
return edition;
|
|
31265
|
+
}
|
|
31266
|
+
function compareInventoryPremises(expected, current, inventory) {
|
|
31267
|
+
if (expected.target.adapter !== current.adapter || expected.target.store !== current.store) throw new InventoryGuardConflict("identity");
|
|
31268
|
+
if (expected.target.edition !== current.edition) throw new InventoryGuardConflict("edition");
|
|
31269
|
+
if (expected.target.root_version !== current.root_version) throw new InventoryGuardConflict("root_metadata");
|
|
31270
|
+
if (expected.inventory.length !== inventory.length || expected.inventory.some((row, index2) => row.id !== inventory[index2]?.id)) throw new InventoryGuardConflict("membership");
|
|
31271
|
+
if (expected.inventory.some((row, index2) => row.version !== inventory[index2].version)) throw new InventoryGuardConflict("version");
|
|
31272
|
+
if (!inventory.some((row) => row.id === expected.id && row.version === expected.expectedVersion)) throw new InventoryGuardConflict("target_version");
|
|
31273
|
+
}
|
|
31274
|
+
function inventoryDigest(inventory) {
|
|
31275
|
+
return `sha256:${sha256HexOfUtf8(JSON.stringify(inventory.map((row) => [row.id, row.version])))}`;
|
|
31276
|
+
}
|
|
31277
|
+
|
|
31278
|
+
// ../core/src/frontmatter.ts
|
|
31279
|
+
var import_js_yaml2 = __toESM(require_js_yaml2(), 1);
|
|
31280
|
+
var YAML_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp";
|
|
31281
|
+
function requireYamlTimestampType() {
|
|
31282
|
+
const type = import_js_yaml2.default.DEFAULT_SAFE_SCHEMA.implicit.find(
|
|
31283
|
+
(candidate) => candidate.tag === YAML_TIMESTAMP_TAG
|
|
31284
|
+
);
|
|
31285
|
+
if (!type) throw new Error("js-yaml safe schema is missing its timestamp type");
|
|
31286
|
+
return type;
|
|
31287
|
+
}
|
|
31288
|
+
var yamlTimestampType = requireYamlTimestampType();
|
|
31289
|
+
var stringTimestampType = new import_js_yaml2.default.Type(YAML_TIMESTAMP_TAG, {
|
|
31290
|
+
kind: "scalar",
|
|
31291
|
+
resolve: (value) => yamlTimestampType.resolve(value),
|
|
31292
|
+
construct: (value) => value
|
|
31293
|
+
});
|
|
31294
|
+
var losslessDateSchema = new import_js_yaml2.default.Schema({
|
|
31295
|
+
include: [import_js_yaml2.default.DEFAULT_SAFE_SCHEMA],
|
|
31296
|
+
implicit: [stringTimestampType]
|
|
31297
|
+
});
|
|
31298
|
+
var yamlEngine = {
|
|
31299
|
+
parse(input) {
|
|
31300
|
+
return import_js_yaml2.default.safeLoad(input, { schema: losslessDateSchema }) ?? {};
|
|
31301
|
+
}
|
|
31302
|
+
};
|
|
31303
|
+
function normalizeFrontmatter(data, okfVersion) {
|
|
31304
|
+
const out = { ...data };
|
|
31305
|
+
if (okfVersion === "0.2") return out;
|
|
31306
|
+
const value = out.timestamp;
|
|
31307
|
+
if (value instanceof Date) {
|
|
31308
|
+
out.timestamp = value.toISOString();
|
|
31309
|
+
} else if (typeof value === "number" && Number.isFinite(value)) {
|
|
31310
|
+
out.timestamp = new Date(value).toISOString();
|
|
31311
|
+
} else if (typeof value === "string" && yamlTimestampType.resolve(value)) {
|
|
31312
|
+
const parsed = yamlTimestampType.construct(value);
|
|
31313
|
+
if (parsed instanceof Date) out.timestamp = parsed.toISOString();
|
|
31314
|
+
}
|
|
31315
|
+
return out;
|
|
31316
|
+
}
|
|
31317
|
+
function parseMarkdown(raw, context, options = {}) {
|
|
31318
|
+
const split = splitLeadingFrontmatter(raw, context);
|
|
31319
|
+
if (!("yamlSource" in split)) return { frontmatter: {}, body: split.body };
|
|
31320
|
+
return { frontmatter: parseFrontmatter(split.yamlSource, context, options), body: split.body };
|
|
31321
|
+
}
|
|
31322
|
+
function parseFrontmatter(source, context, options = {}) {
|
|
31323
|
+
let parsed;
|
|
31324
|
+
try {
|
|
31325
|
+
parsed = yamlEngine.parse(source);
|
|
31326
|
+
} catch (err) {
|
|
31327
|
+
throw new MalformedDocumentError(context, err);
|
|
31328
|
+
}
|
|
31329
|
+
return normalizeFrontmatter(parsed, options.okfVersion);
|
|
31330
|
+
}
|
|
31331
|
+
function stringifyFrontmatter(data) {
|
|
31332
|
+
return import_js_yaml2.default.safeDump(data).trim();
|
|
31333
|
+
}
|
|
31334
|
+
function normalizeDocumentBodyForStorage(body) {
|
|
31335
|
+
return body.endsWith("\n") ? body : `${body}
|
|
31336
|
+
`;
|
|
31337
|
+
}
|
|
31338
|
+
function stringifyWithData(data, body) {
|
|
31339
|
+
return stringifyWithSerializedFrontmatter(stringifyFrontmatter(data), body);
|
|
31340
|
+
}
|
|
31341
|
+
function stringifyWithSerializedFrontmatter(dumped, body) {
|
|
31342
|
+
const content3 = body ?? "";
|
|
31343
|
+
const newline = (value) => value.endsWith("\n") ? value : `${value}
|
|
31344
|
+
`;
|
|
31345
|
+
if (dumped === "{}") return normalizeDocumentBodyForStorage(content3);
|
|
31346
|
+
return `---
|
|
31347
|
+
${newline(dumped)}---
|
|
31348
|
+
${normalizeDocumentBodyForStorage(content3)}`;
|
|
31349
|
+
}
|
|
31350
|
+
function stringifyDoc(frontmatter2, body) {
|
|
31351
|
+
return stringifyWithData(frontmatter2, body);
|
|
31352
|
+
}
|
|
31353
|
+
|
|
31136
31354
|
// ../core/src/links.ts
|
|
31137
31355
|
function normalizeSegments(segments) {
|
|
31138
31356
|
const out = [];
|
|
@@ -31375,22 +31593,113 @@ function parseLinksFromDoc(doc) {
|
|
|
31375
31593
|
return links;
|
|
31376
31594
|
}
|
|
31377
31595
|
|
|
31378
|
-
// ../core/src/
|
|
31379
|
-
|
|
31380
|
-
|
|
31381
|
-
|
|
31382
|
-
|
|
31383
|
-
|
|
31384
|
-
|
|
31385
|
-
|
|
31386
|
-
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
|
-
|
|
31390
|
-
|
|
31391
|
-
|
|
31392
|
-
|
|
31596
|
+
// ../core/src/version-transport.ts
|
|
31597
|
+
function isContentVersion(value) {
|
|
31598
|
+
return typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value);
|
|
31599
|
+
}
|
|
31600
|
+
var VersionConflict = class extends Error {
|
|
31601
|
+
name = "VersionConflict";
|
|
31602
|
+
id;
|
|
31603
|
+
expected;
|
|
31604
|
+
actual;
|
|
31605
|
+
constructor(id, expected, actual) {
|
|
31606
|
+
super(
|
|
31607
|
+
`version conflict on '${id}': expected ${expected ?? "absent"}, found ${actual ?? "none"} (the document changed since you read it \u2014 re-read and retry)`
|
|
31608
|
+
);
|
|
31609
|
+
this.id = id;
|
|
31610
|
+
this.expected = expected;
|
|
31611
|
+
this.actual = actual;
|
|
31612
|
+
}
|
|
31613
|
+
};
|
|
31614
|
+
|
|
31615
|
+
// ../core/src/meaningful-change-time.ts
|
|
31616
|
+
function meaningfulChangeTimeField(frontmatter2) {
|
|
31617
|
+
const generated = frontmatter2.generated;
|
|
31618
|
+
if (generated !== null && typeof generated === "object" && !Array.isArray(generated) && generated.at !== void 0) return "generated.at";
|
|
31619
|
+
return "timestamp";
|
|
31620
|
+
}
|
|
31621
|
+
function meaningfulChangeTimeValue(frontmatter2) {
|
|
31622
|
+
return meaningfulChangeTimeField(frontmatter2) === "generated.at" ? frontmatter2.generated.at : frontmatter2.timestamp;
|
|
31623
|
+
}
|
|
31624
|
+
|
|
31625
|
+
// ../core/src/verification.ts
|
|
31626
|
+
var TRUST_TIERS = Object.freeze([
|
|
31627
|
+
"unverified",
|
|
31628
|
+
"machine-confirmed",
|
|
31629
|
+
"human-reviewed"
|
|
31630
|
+
]);
|
|
31631
|
+
var ISO_INSTANT = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(?:([Zz])|([+-])(\d{2})(?::?(\d{2}))?)$/;
|
|
31632
|
+
function parseIsoInstant(raw, rounding = "truncate") {
|
|
31633
|
+
const match = ISO_INSTANT.exec(raw);
|
|
31634
|
+
if (!match) return null;
|
|
31635
|
+
const [, y, mo, d, h, mi, sec = "0", frac = "0", zulu, sign, oh, om = "0"] = match;
|
|
31636
|
+
const year = Number(y);
|
|
31637
|
+
const month = Number(mo);
|
|
31638
|
+
const day = Number(d);
|
|
31639
|
+
const hour = Number(h);
|
|
31640
|
+
const minute = Number(mi);
|
|
31641
|
+
const second = Number(sec);
|
|
31642
|
+
if (month < 1 || month > 12) return null;
|
|
31643
|
+
const probe = /* @__PURE__ */ new Date(0);
|
|
31644
|
+
probe.setUTCFullYear(year, month, 0);
|
|
31645
|
+
if (day < 1 || day > probe.getUTCDate()) return null;
|
|
31646
|
+
if (hour > 23 || minute > 59 || second > 59) return null;
|
|
31647
|
+
let offsetMinutes = 0;
|
|
31648
|
+
if (!zulu) {
|
|
31649
|
+
const offsetHours = Number(oh);
|
|
31650
|
+
const offsetMins = Number(om);
|
|
31651
|
+
if (offsetHours > 23 || offsetMins > 59) return null;
|
|
31652
|
+
offsetMinutes = (sign === "-" ? -1 : 1) * (offsetHours * 60 + offsetMins);
|
|
31393
31653
|
}
|
|
31654
|
+
const millis = Number(frac.padEnd(3, "0").slice(0, 3));
|
|
31655
|
+
const instant = /* @__PURE__ */ new Date(0);
|
|
31656
|
+
instant.setUTCFullYear(year, month - 1, day);
|
|
31657
|
+
instant.setUTCHours(hour, minute, second, millis);
|
|
31658
|
+
const remainder = rounding === "ceil" && /[1-9]/.test(frac.slice(3)) ? 1 : 0;
|
|
31659
|
+
return instant.getTime() - offsetMinutes * 6e4 + remainder;
|
|
31660
|
+
}
|
|
31661
|
+
|
|
31662
|
+
// ../core/src/freshness.ts
|
|
31663
|
+
function parseTimestamp(ts, okfVersion) {
|
|
31664
|
+
if (okfVersion === "0.2") return typeof ts === "string" ? parseIsoInstant(ts) : null;
|
|
31665
|
+
if (ts instanceof Date) {
|
|
31666
|
+
const ms2 = ts.getTime();
|
|
31667
|
+
return Number.isNaN(ms2) ? null : ms2;
|
|
31668
|
+
}
|
|
31669
|
+
if (typeof ts === "number") {
|
|
31670
|
+
return Number.isFinite(ts) ? ts : null;
|
|
31671
|
+
}
|
|
31672
|
+
if (typeof ts !== "string" || ts.trim() === "") return null;
|
|
31673
|
+
const ms = Date.parse(ts);
|
|
31674
|
+
return Number.isNaN(ms) ? null : ms;
|
|
31675
|
+
}
|
|
31676
|
+
|
|
31677
|
+
// ../core/src/okf-authored-values.ts
|
|
31678
|
+
function isOkfRecord(value) {
|
|
31679
|
+
if (value === null || typeof value !== "object") return false;
|
|
31680
|
+
const prototype = Object.getPrototypeOf(value);
|
|
31681
|
+
return prototype === Object.prototype || prototype === null;
|
|
31682
|
+
}
|
|
31683
|
+
|
|
31684
|
+
// ../core/src/okf-lifecycle.ts
|
|
31685
|
+
var OKF_LIFECYCLE_STATUSES = Object.freeze(["draft", "stable", "deprecated"]);
|
|
31686
|
+
function isOkfLifecycleStatus(value) {
|
|
31687
|
+
return typeof value === "string" && OKF_LIFECYCLE_STATUSES.includes(value);
|
|
31688
|
+
}
|
|
31689
|
+
|
|
31690
|
+
// ../core/src/okf-standard-fields.ts
|
|
31691
|
+
var OKF_STANDARD_FIELD_NAMES = ["type", "title", "description", "resource", "tags", "status", "sources", "generated", "verified", "stale_after", "usage_window", "runtime", "computation", "parameters", "executor", "attester", "okf_version"];
|
|
31692
|
+
function isOkfStandardField(field) {
|
|
31693
|
+
return OKF_STANDARD_FIELD_NAMES.includes(field);
|
|
31694
|
+
}
|
|
31695
|
+
|
|
31696
|
+
// ../core/src/mutation-attribution.ts
|
|
31697
|
+
var SUPERBEE_UPDATED_BY_FIELD = "superbee_updated_by";
|
|
31698
|
+
function nonEmptyString(value) {
|
|
31699
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
31700
|
+
}
|
|
31701
|
+
function mutationActorFromFrontmatter(frontmatter2) {
|
|
31702
|
+
return nonEmptyString(frontmatter2[SUPERBEE_UPDATED_BY_FIELD]) ?? nonEmptyString(frontmatter2.updated_by) ?? nonEmptyString(frontmatter2.actor);
|
|
31394
31703
|
}
|
|
31395
31704
|
|
|
31396
31705
|
// ../core/src/query-filter.ts
|
|
@@ -31414,13 +31723,22 @@ function matchesFilter(doc, filter) {
|
|
|
31414
31723
|
}
|
|
31415
31724
|
return true;
|
|
31416
31725
|
}
|
|
31417
|
-
function
|
|
31418
|
-
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return
|
|
31726
|
+
function sourceIdentityOf(entry) {
|
|
31727
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return void 0;
|
|
31419
31728
|
const row = entry;
|
|
31729
|
+
const identity = {};
|
|
31730
|
+
for (const key of ["resource", "id"]) {
|
|
31731
|
+
if (Object.hasOwn(row, key) && typeof row[key] === "string") identity[key] = row[key];
|
|
31732
|
+
}
|
|
31733
|
+
return identity;
|
|
31734
|
+
}
|
|
31735
|
+
function matchesSourceIdentity(entry, identity) {
|
|
31736
|
+
const own3 = sourceIdentityOf(entry);
|
|
31737
|
+
if (!own3) return false;
|
|
31420
31738
|
for (const key of ["resource", "id"]) {
|
|
31421
31739
|
const expected = identity[key];
|
|
31422
31740
|
if (expected === void 0) continue;
|
|
31423
|
-
if (
|
|
31741
|
+
if (own3[key] === void 0 || own3[key] !== expected) return false;
|
|
31424
31742
|
}
|
|
31425
31743
|
return true;
|
|
31426
31744
|
}
|
|
@@ -31489,10 +31807,10 @@ async function queryHeads(backend, filter = {}, options = {}) {
|
|
|
31489
31807
|
rows.sort((a, b) => a.id.localeCompare(b.id));
|
|
31490
31808
|
return rows;
|
|
31491
31809
|
}
|
|
31492
|
-
return (await scanMatching(backend, filter, options.onSkip)).map(({ doc, version }) => ({
|
|
31810
|
+
return (await scanMatching(backend, filter, options.onSkip)).map(({ doc, version: version2 }) => ({
|
|
31493
31811
|
id: doc.id,
|
|
31494
31812
|
frontmatter: doc.frontmatter,
|
|
31495
|
-
version
|
|
31813
|
+
version: version2
|
|
31496
31814
|
}));
|
|
31497
31815
|
}
|
|
31498
31816
|
function normalizeEdgeSelector(raw) {
|
|
@@ -31604,13 +31922,13 @@ function snapshotHostPolicy(input, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
31604
31922
|
if (existing) return existing;
|
|
31605
31923
|
const result = Array.isArray(input) ? [] : {};
|
|
31606
31924
|
seen.set(input, result);
|
|
31607
|
-
const
|
|
31925
|
+
const keys2 = /* @__PURE__ */ new Set();
|
|
31608
31926
|
for (let owner = input; owner && owner !== Object.prototype && owner !== Array.prototype; owner = Object.getPrototypeOf(owner)) {
|
|
31609
31927
|
for (const key of Reflect.ownKeys(owner)) {
|
|
31610
|
-
if (key !== "constructor" && !(Array.isArray(input) && key === "length"))
|
|
31928
|
+
if (key !== "constructor" && !(Array.isArray(input) && key === "length")) keys2.add(key);
|
|
31611
31929
|
}
|
|
31612
31930
|
}
|
|
31613
|
-
for (const key of
|
|
31931
|
+
for (const key of keys2) {
|
|
31614
31932
|
const value = input[key];
|
|
31615
31933
|
Object.defineProperty(result, key, {
|
|
31616
31934
|
value: typeof value === "function" ? value.bind(result) : value && typeof value === "object" ? snapshotHostPolicy(value, seen) : value,
|
|
@@ -31735,14 +32053,14 @@ async function readOwnerRecord(lockPath) {
|
|
|
31735
32053
|
}
|
|
31736
32054
|
async function resolveOwnerRecord(lockPath, started, waitMs, pollMs) {
|
|
31737
32055
|
while (true) {
|
|
31738
|
-
const
|
|
31739
|
-
if (
|
|
32056
|
+
const record2 = await readOwnerRecord(lockPath);
|
|
32057
|
+
if (record2.state !== "unreadable" || Date.now() - started >= waitMs) return record2;
|
|
31740
32058
|
await delay(pollMs);
|
|
31741
32059
|
}
|
|
31742
32060
|
}
|
|
31743
32061
|
async function readOwner(lockPath) {
|
|
31744
|
-
const
|
|
31745
|
-
return
|
|
32062
|
+
const record2 = await readOwnerRecord(lockPath);
|
|
32063
|
+
return record2.state === "record" ? record2.owner : null;
|
|
31746
32064
|
}
|
|
31747
32065
|
function processExists(pid) {
|
|
31748
32066
|
try {
|
|
@@ -31937,12 +32255,12 @@ async function claimLockPath(lockPath, owner, waitMs, pollMs, policy) {
|
|
|
31937
32255
|
}
|
|
31938
32256
|
async function rollBackOwnClaim(lockPath, owner, claimed, waitMs, pollMs, policy) {
|
|
31939
32257
|
const started = Date.now();
|
|
31940
|
-
const
|
|
31941
|
-
if (
|
|
31942
|
-
if (
|
|
32258
|
+
const record2 = await resolveOwnerRecord(lockPath, started, waitMs, pollMs);
|
|
32259
|
+
if (record2.state === "record") {
|
|
32260
|
+
if (record2.owner.token === owner.token) await removeReleasedLock(lockPath, owner, started, waitMs, pollMs, policy);
|
|
31943
32261
|
return;
|
|
31944
32262
|
}
|
|
31945
|
-
if (
|
|
32263
|
+
if (record2.state === "unreadable" || !await isClaimedDirectory(lockPath, claimed)) return;
|
|
31946
32264
|
const remnant = releasedLockRemnantPath(lockPath, owner);
|
|
31947
32265
|
await fs.rename(lockPath, remnant);
|
|
31948
32266
|
await fs.rm(remnant, { recursive: true, force: true });
|
|
@@ -32105,12 +32423,62 @@ async function existingAnchor(resolved) {
|
|
|
32105
32423
|
candidate = parent;
|
|
32106
32424
|
}
|
|
32107
32425
|
}
|
|
32108
|
-
async function
|
|
32109
|
-
const foldedRel = relSegments(rel).map(foldSegment).join("/");
|
|
32426
|
+
async function foldedPhysicalRoot(root) {
|
|
32110
32427
|
const { anchor, tail } = await existingAnchor(path2.resolve(root));
|
|
32111
32428
|
const anchorSegments = anchor.split(path2.sep).filter((segment, index2) => index2 === 0 || segment !== "");
|
|
32112
|
-
|
|
32113
|
-
|
|
32429
|
+
return [...anchorSegments, ...tail].map(foldSegment).join("/");
|
|
32430
|
+
}
|
|
32431
|
+
async function identityKey(root, rel) {
|
|
32432
|
+
const foldedRel = relSegments(rel).map(foldSegment).join("/");
|
|
32433
|
+
return createHash2("sha256").update(`superbee-identity/v1\0${await foldedPhysicalRoot(root)}\0${foldedRel}`).digest("hex");
|
|
32434
|
+
}
|
|
32435
|
+
async function filesystemRootMutationKey(root) {
|
|
32436
|
+
return createHash2("sha256").update(`superbee-root-mutation/v1\0${await foldedPhysicalRoot(root)}`).digest("hex");
|
|
32437
|
+
}
|
|
32438
|
+
async function filesystemRootWitness(port, root) {
|
|
32439
|
+
const physical = await fs2.realpath(root);
|
|
32440
|
+
const witnesses = [];
|
|
32441
|
+
let current = physical;
|
|
32442
|
+
for (; ; ) {
|
|
32443
|
+
const witness = await port.probe(current);
|
|
32444
|
+
if (!witness || witness.kind !== "directory") throw new InvalidInputError("Inventory guard root identity is unavailable.");
|
|
32445
|
+
witnesses.push([current, witness.dev, witness.ino]);
|
|
32446
|
+
const parent = path2.dirname(current);
|
|
32447
|
+
if (parent === current) break;
|
|
32448
|
+
current = parent;
|
|
32449
|
+
}
|
|
32450
|
+
return createHash2("sha256").update(JSON.stringify(witnesses)).digest("hex");
|
|
32451
|
+
}
|
|
32452
|
+
var rootMutationQueues = /* @__PURE__ */ new Map();
|
|
32453
|
+
function createFilesystemMutationCoordinator(_port, root, hostPolicy) {
|
|
32454
|
+
const policy = captureFilesystemHostPolicy(hostPolicy);
|
|
32455
|
+
let lockRoot;
|
|
32456
|
+
const namespace = () => lockRoot ??= filesystemMutationLockRoot(root, policy);
|
|
32457
|
+
return Object.freeze({
|
|
32458
|
+
namespace,
|
|
32459
|
+
async run(body) {
|
|
32460
|
+
const key = await filesystemRootMutationKey(root);
|
|
32461
|
+
const lockRoot2 = namespace();
|
|
32462
|
+
const queueKey = `${lockRoot2}:${key}`;
|
|
32463
|
+
const previous3 = rootMutationQueues.get(queueKey) ?? Promise.resolve();
|
|
32464
|
+
const run = previous3.then(async () => {
|
|
32465
|
+
const release = await acquireFilesystemIdentityLock(key, root, { portableRoot: root, lockRoot: lockRoot2, hostPolicy: policy });
|
|
32466
|
+
try {
|
|
32467
|
+
return await body();
|
|
32468
|
+
} finally {
|
|
32469
|
+
await release();
|
|
32470
|
+
}
|
|
32471
|
+
});
|
|
32472
|
+
const settled = run.then(() => {
|
|
32473
|
+
}, () => {
|
|
32474
|
+
});
|
|
32475
|
+
rootMutationQueues.set(queueKey, settled);
|
|
32476
|
+
void settled.then(() => {
|
|
32477
|
+
if (rootMutationQueues.get(queueKey) === settled) rootMutationQueues.delete(queueKey);
|
|
32478
|
+
});
|
|
32479
|
+
return run;
|
|
32480
|
+
}
|
|
32481
|
+
});
|
|
32114
32482
|
}
|
|
32115
32483
|
function sameWitness(a, b) {
|
|
32116
32484
|
return a.dev === b.dev && a.ino === b.ino;
|
|
@@ -32644,181 +33012,6 @@ function createNodeFilesystemIdentityPort(hostPolicy) {
|
|
|
32644
33012
|
});
|
|
32645
33013
|
}
|
|
32646
33014
|
|
|
32647
|
-
// ../core/src/sha256.ts
|
|
32648
|
-
var K = new Uint32Array([
|
|
32649
|
-
1116352408,
|
|
32650
|
-
1899447441,
|
|
32651
|
-
3049323471,
|
|
32652
|
-
3921009573,
|
|
32653
|
-
961987163,
|
|
32654
|
-
1508970993,
|
|
32655
|
-
2453635748,
|
|
32656
|
-
2870763221,
|
|
32657
|
-
3624381080,
|
|
32658
|
-
310598401,
|
|
32659
|
-
607225278,
|
|
32660
|
-
1426881987,
|
|
32661
|
-
1925078388,
|
|
32662
|
-
2162078206,
|
|
32663
|
-
2614888103,
|
|
32664
|
-
3248222580,
|
|
32665
|
-
3835390401,
|
|
32666
|
-
4022224774,
|
|
32667
|
-
264347078,
|
|
32668
|
-
604807628,
|
|
32669
|
-
770255983,
|
|
32670
|
-
1249150122,
|
|
32671
|
-
1555081692,
|
|
32672
|
-
1996064986,
|
|
32673
|
-
2554220882,
|
|
32674
|
-
2821834349,
|
|
32675
|
-
2952996808,
|
|
32676
|
-
3210313671,
|
|
32677
|
-
3336571891,
|
|
32678
|
-
3584528711,
|
|
32679
|
-
113926993,
|
|
32680
|
-
338241895,
|
|
32681
|
-
666307205,
|
|
32682
|
-
773529912,
|
|
32683
|
-
1294757372,
|
|
32684
|
-
1396182291,
|
|
32685
|
-
1695183700,
|
|
32686
|
-
1986661051,
|
|
32687
|
-
2177026350,
|
|
32688
|
-
2456956037,
|
|
32689
|
-
2730485921,
|
|
32690
|
-
2820302411,
|
|
32691
|
-
3259730800,
|
|
32692
|
-
3345764771,
|
|
32693
|
-
3516065817,
|
|
32694
|
-
3600352804,
|
|
32695
|
-
4094571909,
|
|
32696
|
-
275423344,
|
|
32697
|
-
430227734,
|
|
32698
|
-
506948616,
|
|
32699
|
-
659060556,
|
|
32700
|
-
883997877,
|
|
32701
|
-
958139571,
|
|
32702
|
-
1322822218,
|
|
32703
|
-
1537002063,
|
|
32704
|
-
1747873779,
|
|
32705
|
-
1955562222,
|
|
32706
|
-
2024104815,
|
|
32707
|
-
2227730452,
|
|
32708
|
-
2361852424,
|
|
32709
|
-
2428436474,
|
|
32710
|
-
2756734187,
|
|
32711
|
-
3204031479,
|
|
32712
|
-
3329325298
|
|
32713
|
-
]);
|
|
32714
|
-
var INITIAL_STATE = new Uint32Array([
|
|
32715
|
-
1779033703,
|
|
32716
|
-
3144134277,
|
|
32717
|
-
1013904242,
|
|
32718
|
-
2773480762,
|
|
32719
|
-
1359893119,
|
|
32720
|
-
2600822924,
|
|
32721
|
-
528734635,
|
|
32722
|
-
1541459225
|
|
32723
|
-
]);
|
|
32724
|
-
var encoder = new TextEncoder();
|
|
32725
|
-
function rotr(value, bits) {
|
|
32726
|
-
return value >>> bits | value << 32 - bits;
|
|
32727
|
-
}
|
|
32728
|
-
function compress(h, w, view, offset) {
|
|
32729
|
-
for (let i = 0; i < 16; i++) {
|
|
32730
|
-
w[i] = view.getUint32(offset + i * 4);
|
|
32731
|
-
}
|
|
32732
|
-
for (let i = 16; i < 64; i++) {
|
|
32733
|
-
const w15 = w[i - 15];
|
|
32734
|
-
const w2 = w[i - 2];
|
|
32735
|
-
const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
|
|
32736
|
-
const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
|
|
32737
|
-
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
32738
|
-
}
|
|
32739
|
-
let a = h[0];
|
|
32740
|
-
let b = h[1];
|
|
32741
|
-
let c = h[2];
|
|
32742
|
-
let d = h[3];
|
|
32743
|
-
let e = h[4];
|
|
32744
|
-
let f = h[5];
|
|
32745
|
-
let g = h[6];
|
|
32746
|
-
let hh = h[7];
|
|
32747
|
-
for (let i = 0; i < 64; i++) {
|
|
32748
|
-
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
32749
|
-
const ch = e & f ^ ~e & g;
|
|
32750
|
-
const t1 = hh + S1 + ch + K[i] + w[i] >>> 0;
|
|
32751
|
-
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
32752
|
-
const maj = a & b ^ a & c ^ b & c;
|
|
32753
|
-
const t2 = S0 + maj >>> 0;
|
|
32754
|
-
hh = g;
|
|
32755
|
-
g = f;
|
|
32756
|
-
f = e;
|
|
32757
|
-
e = d + t1 >>> 0;
|
|
32758
|
-
d = c;
|
|
32759
|
-
c = b;
|
|
32760
|
-
b = a;
|
|
32761
|
-
a = t1 + t2 >>> 0;
|
|
32762
|
-
}
|
|
32763
|
-
h[0] = h[0] + a >>> 0;
|
|
32764
|
-
h[1] = h[1] + b >>> 0;
|
|
32765
|
-
h[2] = h[2] + c >>> 0;
|
|
32766
|
-
h[3] = h[3] + d >>> 0;
|
|
32767
|
-
h[4] = h[4] + e >>> 0;
|
|
32768
|
-
h[5] = h[5] + f >>> 0;
|
|
32769
|
-
h[6] = h[6] + g >>> 0;
|
|
32770
|
-
h[7] = h[7] + hh >>> 0;
|
|
32771
|
-
}
|
|
32772
|
-
function sha256HexOfBytes(bytes) {
|
|
32773
|
-
const h = new Uint32Array(INITIAL_STATE);
|
|
32774
|
-
const w = new Uint32Array(64);
|
|
32775
|
-
const length = bytes.byteLength;
|
|
32776
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, length);
|
|
32777
|
-
const fullBlocks = length >>> 6;
|
|
32778
|
-
for (let block = 0; block < fullBlocks; block++) {
|
|
32779
|
-
compress(h, w, view, block * 64);
|
|
32780
|
-
}
|
|
32781
|
-
const remaining = length - fullBlocks * 64;
|
|
32782
|
-
const tail = new Uint8Array(remaining + 1 + 8 > 64 ? 128 : 64);
|
|
32783
|
-
tail.set(bytes.subarray(fullBlocks * 64));
|
|
32784
|
-
tail[remaining] = 128;
|
|
32785
|
-
const tailView = new DataView(tail.buffer);
|
|
32786
|
-
const bitLengthHigh = Math.floor(length / 536870912);
|
|
32787
|
-
const bitLengthLow = length << 3 >>> 0;
|
|
32788
|
-
tailView.setUint32(tail.length - 8, bitLengthHigh);
|
|
32789
|
-
tailView.setUint32(tail.length - 4, bitLengthLow);
|
|
32790
|
-
for (let offset = 0; offset < tail.length; offset += 64) {
|
|
32791
|
-
compress(h, w, tailView, offset);
|
|
32792
|
-
}
|
|
32793
|
-
let hex = "";
|
|
32794
|
-
for (let i = 0; i < 8; i++) {
|
|
32795
|
-
hex += h[i].toString(16).padStart(8, "0");
|
|
32796
|
-
}
|
|
32797
|
-
return hex;
|
|
32798
|
-
}
|
|
32799
|
-
function sha256HexOfUtf8(input) {
|
|
32800
|
-
return sha256HexOfBytes(encoder.encode(input));
|
|
32801
|
-
}
|
|
32802
|
-
|
|
32803
|
-
// ../core/src/version-transport.ts
|
|
32804
|
-
function isContentVersion(value) {
|
|
32805
|
-
return typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value);
|
|
32806
|
-
}
|
|
32807
|
-
var VersionConflict = class extends Error {
|
|
32808
|
-
name = "VersionConflict";
|
|
32809
|
-
id;
|
|
32810
|
-
expected;
|
|
32811
|
-
actual;
|
|
32812
|
-
constructor(id, expected, actual) {
|
|
32813
|
-
super(
|
|
32814
|
-
`version conflict on '${id}': expected ${expected ?? "absent"}, found ${actual ?? "none"} (the document changed since you read it \u2014 re-read and retry)`
|
|
32815
|
-
);
|
|
32816
|
-
this.id = id;
|
|
32817
|
-
this.expected = expected;
|
|
32818
|
-
this.actual = actual;
|
|
32819
|
-
}
|
|
32820
|
-
};
|
|
32821
|
-
|
|
32822
33015
|
// ../core/src/versioning.ts
|
|
32823
33016
|
function sha256Hex(input) {
|
|
32824
33017
|
return sha256HexOfUtf8(input);
|
|
@@ -32878,6 +33071,66 @@ function reservedPath(dir, name) {
|
|
|
32878
33071
|
var FilesystemBackend = class _FilesystemBackend {
|
|
32879
33072
|
#root;
|
|
32880
33073
|
#port;
|
|
33074
|
+
#coordinator;
|
|
33075
|
+
/** The coordinator is private: no transaction callback or held-root capability escapes. */
|
|
33076
|
+
#withRootMutation(body) {
|
|
33077
|
+
return this.#coordinator.run(body);
|
|
33078
|
+
}
|
|
33079
|
+
#mutateExact(rel, body) {
|
|
33080
|
+
return this.#withRootMutation(() => mutateExact(this.#port, this.#root, rel, body));
|
|
33081
|
+
}
|
|
33082
|
+
#assertInventoryGuard() {
|
|
33083
|
+
if (Object.getPrototypeOf(this) !== _FilesystemBackend.prototype || ["read", "readMany", "list", "write", "delete", "writeReserved", "writeBlob", "deleteBlob", "readReserved"].some((name) => this[name] !== _FilesystemBackend.prototype[name])) {
|
|
33084
|
+
throw new InventoryGuardUnsupported("unqualified_filesystem_override");
|
|
33085
|
+
}
|
|
33086
|
+
}
|
|
33087
|
+
get inventoryGuard() {
|
|
33088
|
+
this.#assertInventoryGuard();
|
|
33089
|
+
return bindInventoryGuard(this, {
|
|
33090
|
+
observeTarget: () => this.#withRootMutation(() => {
|
|
33091
|
+
this.#assertInventoryGuard();
|
|
33092
|
+
return this.#guardTarget();
|
|
33093
|
+
}),
|
|
33094
|
+
compareInventoryAndWrite: async (input) => {
|
|
33095
|
+
const request = captureInventoryGuardRequest(input);
|
|
33096
|
+
const raw = stringifyDoc(request.doc.frontmatter, request.doc.body);
|
|
33097
|
+
return this.#withRootMutation(async () => {
|
|
33098
|
+
this.#assertInventoryGuard();
|
|
33099
|
+
const target = await this.#guardTarget();
|
|
33100
|
+
const inventory = [];
|
|
33101
|
+
const ids = await this.list();
|
|
33102
|
+
assertInventoryGuardBound(ids.length);
|
|
33103
|
+
const deadline = performance.now() + 5e3;
|
|
33104
|
+
for (const id of ids) {
|
|
33105
|
+
if (performance.now() > deadline) throw new InventoryGuardUnsupported("inventory_scan_time_bound");
|
|
33106
|
+
const raw2 = await readRawFilesystemDocument(this, id);
|
|
33107
|
+
parseMarkdown(new TextDecoder("utf-8", { fatal: true }).decode(raw2.bytes), pathFromConceptId(id), { okfVersion: target.edition });
|
|
33108
|
+
inventory.push({ id, version: raw2.version });
|
|
33109
|
+
}
|
|
33110
|
+
if (performance.now() > deadline) throw new InventoryGuardUnsupported("inventory_scan_time_bound");
|
|
33111
|
+
compareInventoryPremises(request, target, inventory);
|
|
33112
|
+
const version2 = await mutateExact(this.#port, this.#root, pathFromConceptId(request.id), async (leaf) => {
|
|
33113
|
+
compareInventoryPremises(request, await this.#guardTarget(), inventory);
|
|
33114
|
+
const bytes = await leaf.current();
|
|
33115
|
+
if (bytes === null || versionOfBytes(bytes.toString("utf8")) !== request.expectedVersion) throw new InventoryGuardConflict("target_version");
|
|
33116
|
+
await leaf.replace(Buffer.from(raw, "utf8"));
|
|
33117
|
+
return versionOfBytes(raw);
|
|
33118
|
+
});
|
|
33119
|
+
return { version: version2, target, inventory_digest: inventoryDigest(inventory) };
|
|
33120
|
+
});
|
|
33121
|
+
}
|
|
33122
|
+
});
|
|
33123
|
+
}
|
|
33124
|
+
async #guardTarget() {
|
|
33125
|
+
const witness = await filesystemRootWitness(this.#port, this.#root);
|
|
33126
|
+
const metadata = await readRawFilesystemReserved(this, "", "index.md");
|
|
33127
|
+
const content3 = metadata === null ? null : new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(metadata.bytes);
|
|
33128
|
+
const edition = guardEdition(content3);
|
|
33129
|
+
const after = await filesystemRootWitness(this.#port, this.#root);
|
|
33130
|
+
if (witness !== after) throw new InventoryGuardConflict("identity");
|
|
33131
|
+
const store = versionOfBytes(`${await filesystemRootMutationKey(this.#root)}:${this.#coordinator.namespace()}:${witness}`);
|
|
33132
|
+
return { contract: "inventory-guard/v1", domain: INVENTORY_GUARD_DOMAIN, adapter: "filesystem", store, edition, root_version: blobVersion(metadata.bytes) };
|
|
33133
|
+
}
|
|
32881
33134
|
/**
|
|
32882
33135
|
* The root is resolved once here: a relative root would otherwise re-resolve against the
|
|
32883
33136
|
* process's current directory on every operation, so a later `chdir` would silently move the
|
|
@@ -32886,6 +33139,7 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
32886
33139
|
constructor(root, options = {}) {
|
|
32887
33140
|
this.#port = createNodeFilesystemIdentityPort(options.hostPolicy);
|
|
32888
33141
|
this.#root = path3.resolve(root);
|
|
33142
|
+
this.#coordinator = createFilesystemMutationCoordinator(this.#port, this.#root, options.hostPolicy);
|
|
32889
33143
|
publicationContexts.set(this, { root: this.#root, port: this.#port });
|
|
32890
33144
|
}
|
|
32891
33145
|
async read(id) {
|
|
@@ -32930,7 +33184,7 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
32930
33184
|
assertSafeConceptId(id);
|
|
32931
33185
|
const raw = stringifyDoc(doc.frontmatter, doc.body ?? "");
|
|
32932
33186
|
const rel = pathFromConceptId(id);
|
|
32933
|
-
return mutateExact(
|
|
33187
|
+
return this.#mutateExact(rel, async (target) => {
|
|
32934
33188
|
if (options.expectedVersion !== void 0) {
|
|
32935
33189
|
const bytes = await target.current();
|
|
32936
33190
|
const current = bytes === null ? null : versionOfBytes(bytes.toString("utf8"));
|
|
@@ -32944,7 +33198,7 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
32944
33198
|
}
|
|
32945
33199
|
async delete(id, options = {}) {
|
|
32946
33200
|
assertSafeConceptId(id);
|
|
32947
|
-
return mutateExact(
|
|
33201
|
+
return this.#mutateExact(pathFromConceptId(id), async (target) => {
|
|
32948
33202
|
const bytes = await target.current();
|
|
32949
33203
|
if (bytes === null) return false;
|
|
32950
33204
|
const current = versionOfBytes(bytes.toString("utf8"));
|
|
@@ -33008,7 +33262,7 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
33008
33262
|
assertSafeReservedDir(dir);
|
|
33009
33263
|
assertSafeReservedFilename(name);
|
|
33010
33264
|
const rel = reservedPath(dir, name);
|
|
33011
|
-
return mutateExact(
|
|
33265
|
+
return this.#mutateExact(rel, async (target) => {
|
|
33012
33266
|
if (options.expectedVersion !== void 0) {
|
|
33013
33267
|
const bytes = await target.current();
|
|
33014
33268
|
const current = bytes === null ? null : versionOfBytes(bytes.toString("utf8"));
|
|
@@ -33030,7 +33284,7 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
33030
33284
|
}
|
|
33031
33285
|
async writeBlob(key, bytes, _contentType, options = {}) {
|
|
33032
33286
|
assertSafeBlobKey(key);
|
|
33033
|
-
return mutateExact(
|
|
33287
|
+
return this.#mutateExact(key, async (target) => {
|
|
33034
33288
|
if (options.expectedVersion !== void 0) {
|
|
33035
33289
|
const existing = await target.current();
|
|
33036
33290
|
const current = existing === null ? null : blobVersion(existing);
|
|
@@ -33044,7 +33298,7 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
33044
33298
|
}
|
|
33045
33299
|
async deleteBlob(key, options = {}) {
|
|
33046
33300
|
assertSafeBlobKey(key);
|
|
33047
|
-
return mutateExact(
|
|
33301
|
+
return this.#mutateExact(key, async (target) => {
|
|
33048
33302
|
const existing = await target.current();
|
|
33049
33303
|
if (existing === null) return false;
|
|
33050
33304
|
const current = blobVersion(existing);
|
|
@@ -33062,8 +33316,8 @@ var FilesystemBackend = class _FilesystemBackend {
|
|
|
33062
33316
|
}
|
|
33063
33317
|
async listBlobs(prefix) {
|
|
33064
33318
|
const files = await walkFiles(this.#port, this.#root, (name) => !name.toLowerCase().endsWith(".md"));
|
|
33065
|
-
const
|
|
33066
|
-
const filtered = prefix ?
|
|
33319
|
+
const keys2 = files.map(toPosix);
|
|
33320
|
+
const filtered = prefix ? keys2.filter((k) => k.startsWith(prefix)) : keys2;
|
|
33067
33321
|
filtered.sort(compareStorageKeys);
|
|
33068
33322
|
return filtered;
|
|
33069
33323
|
}
|
|
@@ -33170,6 +33424,86 @@ async function queryEdges2(bundle, filter = {}, options = {}) {
|
|
|
33170
33424
|
// ../core/src/bundle.ts
|
|
33171
33425
|
setDefaultBackendFactory((root) => new FilesystemBackend(root));
|
|
33172
33426
|
|
|
33427
|
+
// ../core/src/managed-document-metadata.ts
|
|
33428
|
+
var MANAGED_DOCUMENT_METADATA_FIELDS = /* @__PURE__ */ new Set([
|
|
33429
|
+
"generated",
|
|
33430
|
+
"verified",
|
|
33431
|
+
"superbee_updated_by",
|
|
33432
|
+
"actor",
|
|
33433
|
+
"timestamp"
|
|
33434
|
+
]);
|
|
33435
|
+
function isManagedDocumentMetadataField(field) {
|
|
33436
|
+
return MANAGED_DOCUMENT_METADATA_FIELDS.has(field);
|
|
33437
|
+
}
|
|
33438
|
+
|
|
33439
|
+
// ../core/src/kind-deprecation.ts
|
|
33440
|
+
var problem = (field, message) => ({
|
|
33441
|
+
code: "KIND_DEPRECATION_INVALID",
|
|
33442
|
+
field,
|
|
33443
|
+
message: `${field}: ${message}`,
|
|
33444
|
+
severity: "warning"
|
|
33445
|
+
});
|
|
33446
|
+
function parseKindDeprecation(raw, kind2, reserved, claimFields) {
|
|
33447
|
+
const result = { fields: [], values: {}, links: [] };
|
|
33448
|
+
const problems = [];
|
|
33449
|
+
const fail2 = (field, message) => {
|
|
33450
|
+
problems.push(problem(field, message));
|
|
33451
|
+
};
|
|
33452
|
+
const names = (value, path6) => {
|
|
33453
|
+
if (!Array.isArray(value) || value.some((v) => typeof v !== "string" || !v.trim() || v !== v.trim())) {
|
|
33454
|
+
fail2(path6, "expected a list of nonempty exact names");
|
|
33455
|
+
return [];
|
|
33456
|
+
}
|
|
33457
|
+
return [...new Set(value)];
|
|
33458
|
+
};
|
|
33459
|
+
const protectedField = (field) => reserved.includes(field) || isOkfStandardField(field) || isManagedDocumentMetadataField(field) || claimFields.includes(field);
|
|
33460
|
+
if (!isOkfRecord(raw)) fail2("deprecated", "expected a map of fields, values and links");
|
|
33461
|
+
else {
|
|
33462
|
+
for (const key of Object.keys(raw)) if (!["fields", "values", "links"].includes(key)) fail2(`deprecated.${key}`, "unknown policy coordinate");
|
|
33463
|
+
if (Object.hasOwn(raw, "fields")) result.fields = names(raw.fields, "deprecated.fields");
|
|
33464
|
+
for (const field of result.fields) {
|
|
33465
|
+
if (!kind2.fields.optional.includes(field) || kind2.fields.required.includes(field) || protectedField(field)) {
|
|
33466
|
+
fail2(`deprecated.fields.${field}`, "only an optional, nonstandard, nonreserved, nonclaim field can be deprecated");
|
|
33467
|
+
}
|
|
33468
|
+
}
|
|
33469
|
+
if (Object.hasOwn(raw, "values")) {
|
|
33470
|
+
if (!isOkfRecord(raw.values)) fail2("deprecated.values", "expected a field-to-values map");
|
|
33471
|
+
else for (const [field, value] of Object.entries(raw.values)) {
|
|
33472
|
+
const path6 = `deprecated.values.${field}`;
|
|
33473
|
+
const values = Array.isArray(value) && value.every((v) => ["string", "number", "boolean"].includes(typeof v)) ? [...new Set(value.map(String))] : void 0;
|
|
33474
|
+
if (!values || values.some((v) => !v.trim())) {
|
|
33475
|
+
fail2(path6, "expected a list of enum members");
|
|
33476
|
+
continue;
|
|
33477
|
+
}
|
|
33478
|
+
Object.defineProperty(result.values, field, { value: values, enumerable: true, writable: true, configurable: true });
|
|
33479
|
+
const allowed = Object.hasOwn(kind2.fields.values, field) ? kind2.fields.values[field] : void 0;
|
|
33480
|
+
if (protectedField(field) || ![...kind2.fields.required, ...kind2.fields.optional].includes(field) || !allowed || values.some((v) => !allowed.includes(v)) || kind2.fields.types?.[field] === "https-url-list") {
|
|
33481
|
+
fail2(path6, "expected members of a declared, nonstandard, nonclaim vocabulary");
|
|
33482
|
+
}
|
|
33483
|
+
const terminal = Object.hasOwn(kind2.fields.terminal, field) ? kind2.fields.terminal[field] : [];
|
|
33484
|
+
if (values.some((v) => terminal.includes(v))) fail2(path6, "terminal members require a separate migration");
|
|
33485
|
+
if (kind2.fields.required.includes(field) && allowed && !allowed.some((v) => !values.includes(v))) fail2(path6, "a required field must retain an active member");
|
|
33486
|
+
}
|
|
33487
|
+
}
|
|
33488
|
+
if (Object.hasOwn(raw, "links")) result.links = names(raw.links, "deprecated.links");
|
|
33489
|
+
for (const label of result.links) if (!kind2.links || !Object.hasOwn(kind2.links, label)) fail2(`deprecated.links.${label}`, "expected an existing outbound label");
|
|
33490
|
+
}
|
|
33491
|
+
if (problems.length) {
|
|
33492
|
+
result.problems = problems;
|
|
33493
|
+
result.raw = structuredClone(raw);
|
|
33494
|
+
}
|
|
33495
|
+
return result;
|
|
33496
|
+
}
|
|
33497
|
+
function kindDeprecationProblems(kind2, registry) {
|
|
33498
|
+
const problems = [...kind2.deprecated?.problems ?? []];
|
|
33499
|
+
for (const label of kind2.deprecated?.links ?? []) {
|
|
33500
|
+
if ([...registry?.kinds.values() ?? [kind2]].some((k) => k.expectsInbound && Object.hasOwn(k.expectsInbound, label))) {
|
|
33501
|
+
problems.push(problem(`deprecated.links.${label}`, "the admitted registry still declares an inbound expectation for this label"));
|
|
33502
|
+
}
|
|
33503
|
+
}
|
|
33504
|
+
return problems;
|
|
33505
|
+
}
|
|
33506
|
+
|
|
33173
33507
|
// ../core/src/kinds.ts
|
|
33174
33508
|
var CONVENTIONS_PREFIX = "conventions/";
|
|
33175
33509
|
var CONVENTION_TYPE = "Convention";
|
|
@@ -33233,6 +33567,7 @@ function buildKindRegistry(docs, initialWarnings = [], options = {}) {
|
|
|
33233
33567
|
}
|
|
33234
33568
|
accepted.set(kind2.governs, kind2);
|
|
33235
33569
|
}
|
|
33570
|
+
for (const kind2 of accepted.values()) warnings.push(...kindDeprecationProblems(kind2, { kinds: accepted, warnings: [] }).filter((w) => !warnings.includes(w)));
|
|
33236
33571
|
const kinds = /* @__PURE__ */ new Map();
|
|
33237
33572
|
for (const kind2 of [...accepted.values()].sort(compareReadingOrder)) kinds.set(kind2.governs, kind2);
|
|
33238
33573
|
return { kinds, warnings };
|
|
@@ -33246,9 +33581,9 @@ function compareReadingOrder(a, b) {
|
|
|
33246
33581
|
var PROGRESS_STATUS_FIELD = "progress_status";
|
|
33247
33582
|
var SUPERBEE_PROGRESS_STATUS_FIELD = "superbee_progress_status";
|
|
33248
33583
|
function progressStatusStorageField(okfVersion) {
|
|
33249
|
-
const
|
|
33250
|
-
if (
|
|
33251
|
-
if (
|
|
33584
|
+
const version2 = okfVersion?.trim() || "0.1";
|
|
33585
|
+
if (version2 === "0.1") return "status";
|
|
33586
|
+
if (version2 === "0.2") return SUPERBEE_PROGRESS_STATUS_FIELD;
|
|
33252
33587
|
return void 0;
|
|
33253
33588
|
}
|
|
33254
33589
|
function declaresField(kind2, field) {
|
|
@@ -33271,6 +33606,19 @@ function resolveKindFieldCoordinate(okfVersion, kind2, field) {
|
|
|
33271
33606
|
if (field === PROGRESS_STATUS_FIELD && progress) return progress;
|
|
33272
33607
|
return void 0;
|
|
33273
33608
|
}
|
|
33609
|
+
function claimCoordinates(okfVersion, kind2) {
|
|
33610
|
+
if (!kind2.claim) return void 0;
|
|
33611
|
+
const resolve = (field) => field === void 0 ? void 0 : resolveKindFieldCoordinate(okfVersion, kind2, field)?.storageField;
|
|
33612
|
+
const ownerField = resolve(kind2.claim.ownerField);
|
|
33613
|
+
const stateField = resolve(kind2.claim.stateField);
|
|
33614
|
+
const fields = [...new Set([ownerField, stateField].filter((f) => f !== void 0))];
|
|
33615
|
+
if (fields.length === 0) return void 0;
|
|
33616
|
+
return {
|
|
33617
|
+
...ownerField !== void 0 ? { ownerField } : {},
|
|
33618
|
+
...stateField !== void 0 ? { stateField } : {},
|
|
33619
|
+
fields
|
|
33620
|
+
};
|
|
33621
|
+
}
|
|
33274
33622
|
function readKindField(okfVersion, kind2, frontmatter2, field) {
|
|
33275
33623
|
const coordinate = resolveKindFieldCoordinate(okfVersion, kind2, field);
|
|
33276
33624
|
return coordinate ? frontmatter2[coordinate.storageField] : void 0;
|
|
@@ -33291,11 +33639,11 @@ function isPlainObject(value) {
|
|
|
33291
33639
|
const prototype = Object.getPrototypeOf(value);
|
|
33292
33640
|
return prototype === Object.prototype || prototype === null;
|
|
33293
33641
|
}
|
|
33294
|
-
function hasOwn(
|
|
33295
|
-
return Object.prototype.hasOwnProperty.call(
|
|
33642
|
+
function hasOwn(record2, key) {
|
|
33643
|
+
return Object.prototype.hasOwnProperty.call(record2, key);
|
|
33296
33644
|
}
|
|
33297
|
-
function setOwn(
|
|
33298
|
-
Object.defineProperty(
|
|
33645
|
+
function setOwn(record2, key, value) {
|
|
33646
|
+
Object.defineProperty(record2, key, { value, enumerable: true, configurable: true, writable: true });
|
|
33299
33647
|
}
|
|
33300
33648
|
function isScalar(value) {
|
|
33301
33649
|
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
@@ -33787,6 +34135,10 @@ function parseConventionDoc(doc, options = {}) {
|
|
|
33787
34135
|
if (browseCollapsed !== void 0) kind2.browseCollapsed = browseCollapsed;
|
|
33788
34136
|
if (order !== void 0) kind2.order = order;
|
|
33789
34137
|
if (claim !== void 0) kind2.claim = claim;
|
|
34138
|
+
if (Object.hasOwn(fm, "deprecated")) {
|
|
34139
|
+
kind2.deprecated = parseKindDeprecation(fm.deprecated, kind2, RESERVED_KIND_FIELD_NAMES, claimCoordinates(options.okfVersion, kind2)?.fields ?? []);
|
|
34140
|
+
warnings.push(...kind2.deprecated.problems ?? []);
|
|
34141
|
+
}
|
|
33790
34142
|
return {
|
|
33791
34143
|
ok: true,
|
|
33792
34144
|
kind: kind2,
|
|
@@ -42855,6 +43207,9 @@ function textOf(node2) {
|
|
|
42855
43207
|
if (!Array.isArray(children)) return "";
|
|
42856
43208
|
return children.map((child) => textOf(child)).join("");
|
|
42857
43209
|
}
|
|
43210
|
+
function renderTextFallback(node2, index2) {
|
|
43211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-markdown-fallback", children: textOf(node2) }, index2);
|
|
43212
|
+
}
|
|
42858
43213
|
function isBlankInline(node2) {
|
|
42859
43214
|
if (node2.type === "break") return true;
|
|
42860
43215
|
if (node2.type === "text") return (node2.value ?? "").trim() === "";
|
|
@@ -42949,7 +43304,7 @@ function renderNode(node2, state, depth, index2) {
|
|
|
42949
43304
|
state.count++;
|
|
42950
43305
|
if (depth > MAX_DEPTH) {
|
|
42951
43306
|
state.bounded = true;
|
|
42952
|
-
return
|
|
43307
|
+
return renderTextFallback(node2, index2);
|
|
42953
43308
|
}
|
|
42954
43309
|
switch (node2.type) {
|
|
42955
43310
|
case "text":
|
|
@@ -43050,7 +43405,7 @@ function renderNode(node2, state, depth, index2) {
|
|
|
43050
43405
|
case "html":
|
|
43051
43406
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-raw-html", children: node2.value }, index2);
|
|
43052
43407
|
default:
|
|
43053
|
-
return
|
|
43408
|
+
return renderTextFallback(node2, index2);
|
|
43054
43409
|
}
|
|
43055
43410
|
}
|
|
43056
43411
|
function renderEdgeList(links, state, index2) {
|
|
@@ -43069,7 +43424,7 @@ function renderEdgeList(links, state, index2) {
|
|
|
43069
43424
|
if (state.options.profile === "inert") {
|
|
43070
43425
|
rows.push(
|
|
43071
43426
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "doc-edge-row", "data-aslite-doc-id": to, children: [
|
|
43072
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-verb", children: verb }),
|
|
43427
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-verb doc-markdown-fallback", children: verb }),
|
|
43073
43428
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-arrow", "aria-hidden": "true", children: "\u2192" }),
|
|
43074
43429
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-target", children: target })
|
|
43075
43430
|
] }, i)
|
|
@@ -43084,7 +43439,7 @@ function renderEdgeList(links, state, index2) {
|
|
|
43084
43439
|
href: documentHref(to, state.options),
|
|
43085
43440
|
onClick: (event) => navigateDoc(event, to, state.options),
|
|
43086
43441
|
children: [
|
|
43087
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-verb", children: verb }),
|
|
43442
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-verb doc-markdown-fallback", children: verb }),
|
|
43088
43443
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-arrow", "aria-hidden": "true", children: "\u2192" }),
|
|
43089
43444
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "doc-edge-target", children: target })
|
|
43090
43445
|
]
|
|
@@ -43544,8 +43899,8 @@ var BridgeService = class {
|
|
|
43544
43899
|
if (!after) return this.reload(launchId, "the View changed while its subscription was polled");
|
|
43545
43900
|
const changes = [];
|
|
43546
43901
|
const removed = [];
|
|
43547
|
-
for (const [id,
|
|
43548
|
-
if (subscription.baseline.get(id) !==
|
|
43902
|
+
for (const [id, version2] of next) {
|
|
43903
|
+
if (subscription.baseline.get(id) !== version2) changes.push({ id, version: version2 });
|
|
43549
43904
|
}
|
|
43550
43905
|
for (const id of subscription.baseline.keys()) {
|
|
43551
43906
|
if (!next.has(id)) removed.push(id);
|
|
@@ -44200,7 +44555,7 @@ function buildSnapshot(first) {
|
|
|
44200
44555
|
blobs.sort((a, b) => a.key.localeCompare(b.key));
|
|
44201
44556
|
const blobsByKey = new Map(blobs.map((row) => [row.key, row]));
|
|
44202
44557
|
const views = [];
|
|
44203
|
-
for (const { doc, version } of parsedDocs.values()) {
|
|
44558
|
+
for (const { doc, version: version2 } of parsedDocs.values()) {
|
|
44204
44559
|
if (doc.frontmatter.type !== "View") continue;
|
|
44205
44560
|
const registration = parseRegistration(doc.id, doc.frontmatter);
|
|
44206
44561
|
if (!registration) {
|
|
@@ -44229,7 +44584,7 @@ function buildSnapshot(first) {
|
|
|
44229
44584
|
const presentation = doc.frontmatter.presentation;
|
|
44230
44585
|
views.push({
|
|
44231
44586
|
id: registration.id,
|
|
44232
|
-
registrationVersion:
|
|
44587
|
+
registrationVersion: version2,
|
|
44233
44588
|
title: typeof doc.frontmatter.title === "string" && doc.frontmatter.title.trim() ? doc.frontmatter.title.trim() : registration.id,
|
|
44234
44589
|
...typeof doc.frontmatter.description === "string" ? { description: doc.frontmatter.description } : {},
|
|
44235
44590
|
...presentation === "workspace" || presentation === "inline" || presentation === "adaptive" ? { presentation } : {},
|