@superbee/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend.d.ts +77 -0
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js +380 -0
- package/dist/backend.js.map +1 -0
- package/dist/bundle.d.ts +38 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +107 -0
- package/dist/bundle.js.map +1 -0
- package/dist/content-type.d.ts +72 -0
- package/dist/content-type.d.ts.map +1 -0
- package/dist/content-type.js +149 -0
- package/dist/content-type.js.map +1 -0
- package/dist/document-mutation.d.ts +83 -0
- package/dist/document-mutation.d.ts.map +1 -0
- package/dist/document-mutation.js +319 -0
- package/dist/document-mutation.js.map +1 -0
- package/dist/document-precondition.d.ts +62 -0
- package/dist/document-precondition.d.ts.map +1 -0
- package/dist/document-precondition.js +134 -0
- package/dist/document-precondition.js.map +1 -0
- package/dist/document-write-policy.d.ts +42 -0
- package/dist/document-write-policy.d.ts.map +1 -0
- package/dist/document-write-policy.js +134 -0
- package/dist/document-write-policy.js.map +1 -0
- package/dist/engine.d.ts +48 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +209 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.d.ts +36 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +50 -0
- package/dist/errors.js.map +1 -0
- package/dist/filesystem-identity.d.ts +208 -0
- package/dist/filesystem-identity.d.ts.map +1 -0
- package/dist/filesystem-identity.js +675 -0
- package/dist/filesystem-identity.js.map +1 -0
- package/dist/filesystem-lock.d.ts +65 -0
- package/dist/filesystem-lock.d.ts.map +1 -0
- package/dist/filesystem-lock.js +460 -0
- package/dist/filesystem-lock.js.map +1 -0
- package/dist/freshness.d.ts +31 -0
- package/dist/freshness.d.ts.map +1 -0
- package/dist/freshness.js +98 -0
- package/dist/freshness.js.map +1 -0
- package/dist/frontmatter-contract.d.ts +17 -0
- package/dist/frontmatter-contract.d.ts.map +1 -0
- package/dist/frontmatter-contract.js +29 -0
- package/dist/frontmatter-contract.js.map +1 -0
- package/dist/frontmatter.d.ts +30 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +115 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/index-marker.d.ts +3 -0
- package/dist/index-marker.d.ts.map +1 -0
- package/dist/index-marker.js +3 -0
- package/dist/index-marker.js.map +1 -0
- package/dist/index-projection.d.ts +79 -0
- package/dist/index-projection.d.ts.map +1 -0
- package/dist/index-projection.js +245 -0
- package/dist/index-projection.js.map +1 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -0
- package/dist/kinds-load.d.ts +13 -0
- package/dist/kinds-load.d.ts.map +1 -0
- package/dist/kinds-load.js +34 -0
- package/dist/kinds-load.js.map +1 -0
- package/dist/kinds.d.ts +241 -0
- package/dist/kinds.d.ts.map +1 -0
- package/dist/kinds.js +1001 -0
- package/dist/kinds.js.map +1 -0
- package/dist/links.d.ts +62 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +203 -0
- package/dist/links.js.map +1 -0
- package/dist/meaningful-change-time.d.ts +11 -0
- package/dist/meaningful-change-time.d.ts.map +1 -0
- package/dist/meaningful-change-time.js +16 -0
- package/dist/meaningful-change-time.js.map +1 -0
- package/dist/memory-backend.d.ts +55 -0
- package/dist/memory-backend.d.ts.map +1 -0
- package/dist/memory-backend.js +214 -0
- package/dist/memory-backend.js.map +1 -0
- package/dist/mutation-attribution.d.ts +19 -0
- package/dist/mutation-attribution.d.ts.map +1 -0
- package/dist/mutation-attribution.js +34 -0
- package/dist/mutation-attribution.js.map +1 -0
- package/dist/mutation.d.ts +89 -0
- package/dist/mutation.d.ts.map +1 -0
- package/dist/mutation.js +94 -0
- package/dist/mutation.js.map +1 -0
- package/dist/page.d.ts +87 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +151 -0
- package/dist/page.js.map +1 -0
- package/dist/paths.d.ts +78 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +148 -0
- package/dist/paths.js.map +1 -0
- package/dist/portable-frontmatter.d.ts +8 -0
- package/dist/portable-frontmatter.d.ts.map +1 -0
- package/dist/portable-frontmatter.js +35 -0
- package/dist/portable-frontmatter.js.map +1 -0
- package/dist/publication-filesystem.d.ts +6 -0
- package/dist/publication-filesystem.d.ts.map +1 -0
- package/dist/publication-filesystem.js +6 -0
- package/dist/publication-filesystem.js.map +1 -0
- package/dist/query-filter.d.ts +12 -0
- package/dist/query-filter.d.ts.map +1 -0
- package/dist/query-filter.js +29 -0
- package/dist/query-filter.js.map +1 -0
- package/dist/query-selection.d.ts +25 -0
- package/dist/query-selection.d.ts.map +1 -0
- package/dist/query-selection.js +48 -0
- package/dist/query-selection.js.map +1 -0
- package/dist/remote-backend.d.ts +152 -0
- package/dist/remote-backend.d.ts.map +1 -0
- package/dist/remote-backend.js +505 -0
- package/dist/remote-backend.js.map +1 -0
- package/dist/remote.d.ts +4 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +3 -0
- package/dist/remote.js.map +1 -0
- package/dist/storage.d.ts +7 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +6 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +438 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +22 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +12 -0
- package/dist/validation.js.map +1 -0
- package/dist/version-transport.d.ts +13 -0
- package/dist/version-transport.d.ts.map +1 -0
- package/dist/version-transport.js +26 -0
- package/dist/version-transport.js.map +1 -0
- package/dist/versioning.d.ts +48 -0
- package/dist/versioning.d.ts.map +1 -0
- package/dist/versioning.js +62 -0
- package/dist/versioning.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable `index.md` projection policy.
|
|
3
|
+
*
|
|
4
|
+
* Concept heads are authoritative. Index files are deterministic, replaceable views over
|
|
5
|
+
* one observed head set. Planning is pure; preparation reads and classifies EVERY target
|
|
6
|
+
* before a write; application uses those exact versions with single-shot CAS. A conflict
|
|
7
|
+
* stops the batch instead of silently re-deciding one file outside the global preflight.
|
|
8
|
+
*/
|
|
9
|
+
import { backendFor } from "./bundle.js";
|
|
10
|
+
import { InvalidInputError } from "./errors.js";
|
|
11
|
+
import { parseMarkdown, stringifyWithData } from "./frontmatter.js";
|
|
12
|
+
import { GENERATED_INDEX_MARKER } from "./index-marker.js";
|
|
13
|
+
import { assertSafeConceptId, toPosix } from "./paths.js";
|
|
14
|
+
export { GENERATED_INDEX_MARKER } from "./index-marker.js";
|
|
15
|
+
/** A terminal per-file failure after zero or more earlier targets completed. */
|
|
16
|
+
export class IndexProjectionWriteError extends Error {
|
|
17
|
+
name = "IndexProjectionWriteError";
|
|
18
|
+
failed;
|
|
19
|
+
completed;
|
|
20
|
+
pending;
|
|
21
|
+
constructor(failed, completed, pending, cause) {
|
|
22
|
+
super(`index projection write failed at '${displayDir(failed)}'`, { cause });
|
|
23
|
+
this.failed = failed;
|
|
24
|
+
this.completed = completed;
|
|
25
|
+
this.pending = pending;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function displayDir(dir) {
|
|
29
|
+
return dir === "" ? "index.md" : `${dir}/index.md`;
|
|
30
|
+
}
|
|
31
|
+
/** Collapse frontmatter display text to one Markdown line. */
|
|
32
|
+
function inlineText(value) {
|
|
33
|
+
if (typeof value !== "string")
|
|
34
|
+
return undefined;
|
|
35
|
+
const collapsed = value.replace(/\s+/g, " ").trim();
|
|
36
|
+
return collapsed === "" ? undefined : collapsed;
|
|
37
|
+
}
|
|
38
|
+
function escapeLabel(value) {
|
|
39
|
+
return value.replace(/\\/g, "\\\\").replace(/\[/g, "\\[").replace(/\]/g, "\\]");
|
|
40
|
+
}
|
|
41
|
+
/** URL-encode each path segment while preserving hierarchy and the `.md` suffix. */
|
|
42
|
+
function hrefSegment(value) {
|
|
43
|
+
return encodeURIComponent(value).replace(/[!'()*]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
44
|
+
}
|
|
45
|
+
function ensureDirectory(map, dir) {
|
|
46
|
+
const existing = map.get(dir);
|
|
47
|
+
if (existing)
|
|
48
|
+
return existing;
|
|
49
|
+
const created = { direct: [], children: new Set() };
|
|
50
|
+
map.set(dir, created);
|
|
51
|
+
return created;
|
|
52
|
+
}
|
|
53
|
+
function depth(dir) {
|
|
54
|
+
return dir === "" ? 0 : dir.split("/").length;
|
|
55
|
+
}
|
|
56
|
+
/** Locale-independent code-unit ordering keeps projection bytes portable across hosts. */
|
|
57
|
+
function compareText(a, b) {
|
|
58
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Plan root + every ancestor directory from ONE complete `queryHeads`-shaped set.
|
|
62
|
+
* The caller supplies the root display name; core never derives it from a local path or URL.
|
|
63
|
+
*/
|
|
64
|
+
export function planIndexProjection(displayName, heads) {
|
|
65
|
+
const directories = new Map();
|
|
66
|
+
ensureDirectory(directories, "");
|
|
67
|
+
for (const head of heads) {
|
|
68
|
+
assertSafeConceptId(head.id);
|
|
69
|
+
const normalized = toPosix(head.id).replace(/^\.\//, "");
|
|
70
|
+
const segments = normalized.split("/");
|
|
71
|
+
const conceptName = segments.pop();
|
|
72
|
+
let parent = "";
|
|
73
|
+
for (const child of segments) {
|
|
74
|
+
const next = parent === "" ? child : `${parent}/${child}`;
|
|
75
|
+
ensureDirectory(directories, parent).children.add(child);
|
|
76
|
+
ensureDirectory(directories, next);
|
|
77
|
+
parent = next;
|
|
78
|
+
}
|
|
79
|
+
ensureDirectory(directories, parent).direct.push({ ...head, id: parent === "" ? conceptName : `${parent}/${conceptName}` });
|
|
80
|
+
}
|
|
81
|
+
const rootTitle = inlineText(displayName) ?? "bundle";
|
|
82
|
+
const targets = [...directories.entries()]
|
|
83
|
+
.sort(([a], [b]) => compareText(a, b))
|
|
84
|
+
.map(([dir, projection]) => {
|
|
85
|
+
const groups = new Map();
|
|
86
|
+
const prefix = dir === "" ? "" : `${dir}/`;
|
|
87
|
+
for (const head of projection.direct) {
|
|
88
|
+
const fileName = head.id.slice(prefix.length);
|
|
89
|
+
const type = inlineText(head.frontmatter.type) ?? "Concept";
|
|
90
|
+
const title = inlineText(head.frontmatter.title) ?? fileName;
|
|
91
|
+
const description = inlineText(head.frontmatter.description);
|
|
92
|
+
const href = `${hrefSegment(fileName)}.md`;
|
|
93
|
+
const bullet = `* [${escapeLabel(title)}](${href})${description ? ` - ${description}` : ""}`;
|
|
94
|
+
const group = groups.get(type) ?? [];
|
|
95
|
+
group.push(bullet);
|
|
96
|
+
groups.set(type, group);
|
|
97
|
+
}
|
|
98
|
+
const sections = [];
|
|
99
|
+
for (const type of [...groups.keys()].sort()) {
|
|
100
|
+
sections.push(`# ${type}\n\n${groups.get(type).sort().join("\n")}\n`);
|
|
101
|
+
}
|
|
102
|
+
if (projection.children.size > 0) {
|
|
103
|
+
const bullets = [...projection.children]
|
|
104
|
+
.sort()
|
|
105
|
+
.map((child) => `* [${escapeLabel(child)}](${hrefSegment(child)}/index.md)`);
|
|
106
|
+
sections.push(`# Subdirectories\n\n${bullets.join("\n")}\n`);
|
|
107
|
+
}
|
|
108
|
+
const title = dir === "" ? rootTitle : inlineText(dir.split("/").pop()) ?? "directory";
|
|
109
|
+
const body = `${GENERATED_INDEX_MARKER}\n# ${title}\n\n${sections.join("\n")}`.trimEnd() + "\n";
|
|
110
|
+
return { dir, body };
|
|
111
|
+
});
|
|
112
|
+
return { targets };
|
|
113
|
+
}
|
|
114
|
+
function markerOwnership(body) {
|
|
115
|
+
const lines = body.split("\n");
|
|
116
|
+
const exact = lines.filter((line) => line === GENERATED_INDEX_MARKER).length;
|
|
117
|
+
const markerLike = lines.filter((line) => /^\s*<!--\s*agentstate-lite:generated-index(?::[^>]*)?\s*-->\s*$/.test(line)).length;
|
|
118
|
+
if (exact > 1)
|
|
119
|
+
return { owned: false, reason: "duplicate-marker" };
|
|
120
|
+
if (exact === 1 && markerLike === 1 && lines[0] === GENERATED_INDEX_MARKER)
|
|
121
|
+
return { owned: true };
|
|
122
|
+
if (markerLike > 0)
|
|
123
|
+
return { owned: false, reason: "malformed-marker" };
|
|
124
|
+
return { owned: false, reason: "unmarked" };
|
|
125
|
+
}
|
|
126
|
+
function inspectExisting(dir, content) {
|
|
127
|
+
if (dir === "") {
|
|
128
|
+
try {
|
|
129
|
+
const { frontmatter, body } = parseMarkdown(content, "index.md");
|
|
130
|
+
const keys = Object.keys(frontmatter);
|
|
131
|
+
if (keys.length !== 1 || keys[0] !== "okf_version" || typeof frontmatter.okf_version !== "string") {
|
|
132
|
+
return { owned: false, body, reason: "malformed-root" };
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
...markerOwnership(body),
|
|
136
|
+
body,
|
|
137
|
+
okfVersion: frontmatter.okf_version,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return { owned: false, body: content, reason: "malformed-root" };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const { frontmatter, body } = parseMarkdown(content, `${dir}/index.md`);
|
|
146
|
+
if (Object.keys(frontmatter).length > 0) {
|
|
147
|
+
return { owned: false, body, reason: "nested-frontmatter" };
|
|
148
|
+
}
|
|
149
|
+
return { ...markerOwnership(body), body };
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return { owned: false, body: content, reason: "nested-frontmatter" };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function desiredContent(dir, body, okfVersion) {
|
|
156
|
+
return dir === "" ? stringifyWithData({ okf_version: okfVersion ?? "0.1" }, body) : body;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Read and classify every planned target before any write. A single refusal blocks the
|
|
160
|
+
* whole preparation; `force` makes each unmarked/malformed target an explicit adoption.
|
|
161
|
+
*/
|
|
162
|
+
export async function prepareIndexProjection(bundle, plan, options = {}) {
|
|
163
|
+
const backend = backendFor(bundle);
|
|
164
|
+
const targets = [];
|
|
165
|
+
for (const planned of plan.targets) {
|
|
166
|
+
const current = await backend.readReserved(planned.dir, "index.md");
|
|
167
|
+
if (current === null) {
|
|
168
|
+
targets.push({
|
|
169
|
+
dir: planned.dir,
|
|
170
|
+
content: desiredContent(planned.dir, planned.body),
|
|
171
|
+
expectedVersion: null,
|
|
172
|
+
disposition: "missing",
|
|
173
|
+
});
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const ownership = inspectExisting(planned.dir, current.content);
|
|
177
|
+
const content = desiredContent(planned.dir, planned.body, ownership.okfVersion);
|
|
178
|
+
if (ownership.owned) {
|
|
179
|
+
targets.push({
|
|
180
|
+
dir: planned.dir,
|
|
181
|
+
content,
|
|
182
|
+
expectedVersion: current.version,
|
|
183
|
+
disposition: current.content === content ? "unchanged" : "generated",
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
else if (options.force) {
|
|
187
|
+
targets.push({
|
|
188
|
+
dir: planned.dir,
|
|
189
|
+
content,
|
|
190
|
+
expectedVersion: current.version,
|
|
191
|
+
disposition: "adopted",
|
|
192
|
+
...(ownership.reason ? { reason: ownership.reason } : {}),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
targets.push({
|
|
197
|
+
dir: planned.dir,
|
|
198
|
+
content,
|
|
199
|
+
expectedVersion: current.version,
|
|
200
|
+
disposition: "refused",
|
|
201
|
+
...(ownership.reason ? { reason: ownership.reason } : {}),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const refused = targets.filter((target) => target.disposition === "refused");
|
|
206
|
+
return refused.length > 0
|
|
207
|
+
? { ready: false, targets, refused }
|
|
208
|
+
: { ready: true, targets, refused: [] };
|
|
209
|
+
}
|
|
210
|
+
function writableDisposition(disposition) {
|
|
211
|
+
return disposition === "missing" || disposition === "generated" || disposition === "adopted";
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Apply a ready preparation deepest-first and root-last. Each target gets ONE CAS attempt
|
|
215
|
+
* against the version captured during global preparation; a conflict is terminal and reports
|
|
216
|
+
* completed/pending paths so a full re-prepare can resume idempotently.
|
|
217
|
+
*/
|
|
218
|
+
export async function applyIndexProjection(bundle, prepared, options = {}) {
|
|
219
|
+
if (!prepared.ready) {
|
|
220
|
+
throw new InvalidInputError("Cannot apply a refused index projection; re-prepare with explicit force to adopt it.");
|
|
221
|
+
}
|
|
222
|
+
const backend = backendFor(bundle);
|
|
223
|
+
const unchanged = prepared.targets
|
|
224
|
+
.filter((target) => target.disposition === "unchanged")
|
|
225
|
+
.map((target) => target.dir);
|
|
226
|
+
const writable = prepared.targets
|
|
227
|
+
.filter((target) => writableDisposition(target.disposition))
|
|
228
|
+
.sort((a, b) => depth(b.dir) - depth(a.dir) || compareText(a.dir, b.dir));
|
|
229
|
+
const completed = [];
|
|
230
|
+
for (let index = 0; index < writable.length; index++) {
|
|
231
|
+
const target = writable[index];
|
|
232
|
+
try {
|
|
233
|
+
const version = await backend.writeReserved(target.dir, "index.md", target.content, {
|
|
234
|
+
expectedVersion: target.expectedVersion,
|
|
235
|
+
...(options.actor !== undefined ? { actor: options.actor } : {}),
|
|
236
|
+
});
|
|
237
|
+
completed.push({ dir: target.dir, disposition: target.disposition, version });
|
|
238
|
+
}
|
|
239
|
+
catch (cause) {
|
|
240
|
+
throw new IndexProjectionWriteError(target.dir, completed, writable.slice(index + 1).map((pending) => pending.dir), cause);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return { completed, unchanged, pending: [] };
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=index-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-proj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CAAC;IAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@superbee/core` — the OKF store engine.
|
|
3
|
+
*
|
|
4
|
+
* An **Open Knowledge Format (OKF v0.1 or v0.2)** *Knowledge Bundle* is a
|
|
5
|
+
* directory tree of UTF-8 markdown files, each carrying a YAML frontmatter block
|
|
6
|
+
* (delimited by `---` lines) plus a markdown body. Every non-reserved `.md` file
|
|
7
|
+
* is a *Concept*; its *Concept ID* is the file path minus `.md`
|
|
8
|
+
* (e.g. `tables/users.md` -> `tables/users`).
|
|
9
|
+
*
|
|
10
|
+
* The FILESYSTEM is the source of truth by default, but storage is routed through
|
|
11
|
+
* a pluggable {@link StorageBackend} (default: {@link FilesystemBackend}). This
|
|
12
|
+
* module implements bundle I/O, standard-markdown cross-links (never wikilinks),
|
|
13
|
+
* derived backlinks, freshness derived from the edition's meaningful-change clock, and reserved-file
|
|
14
|
+
* (`index.md`/`log.md`) handling. Human-facing bundle Pages consume this engine through the
|
|
15
|
+
* reference server's narrow browser bridge (read-only v0 plus shell-confirmed local proposals).
|
|
16
|
+
*
|
|
17
|
+
* The public function signatures below are contract-stable; everything past the
|
|
18
|
+
* "extensions" line is additive (pure helpers, reserved-file accessors, and the
|
|
19
|
+
* ported content_type utilities).
|
|
20
|
+
*
|
|
21
|
+
* @see OKF spec — GoogleCloudPlatform/knowledge-catalog, `okf/SPEC.md`
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
24
|
+
export type { ConceptId, Frontmatter, OkfDocument, Bundle, InitBundleOptions, QueryFilter, Link, EdgeFilter, FreshnessVerdict, FreshnessOptions, FreshnessResult, ReservedFilename, StorageBackend, StorageCapabilities, Version, ReadResult, ReservedReadResult, VersionInfo, WriteOptions, DeleteOptions, } from "./types.js";
|
|
25
|
+
export { initBundle, readBundleOkfVersion, resolveOkfAuthoringVersion, DEFAULT_OKF_AUTHORING_VERSION, SUPPORTED_OKF_AUTHORING_VERSIONS, writeDoc, readDoc, existsDoc, query, parseLinks, backlinks, queryEdges, } from "./bundle.js";
|
|
26
|
+
export { writeDocVersioned, readDocVersioned, docVersions } from "./bundle.js";
|
|
27
|
+
export type { WriteResult } from "./bundle.js";
|
|
28
|
+
export { deleteDoc, deleteBlob } from "./bundle.js";
|
|
29
|
+
export { readBlob, writeBlob, existsBlob, listBlobs } from "./bundle.js";
|
|
30
|
+
export type { BlobKey, ReadBlobResult } from "./types.js";
|
|
31
|
+
export { freshness } from "./freshness.js";
|
|
32
|
+
export { FilesystemBackend } from "./backend.js";
|
|
33
|
+
export { MemoryBackend } from "./memory-backend.js";
|
|
34
|
+
export { withFilesystemMutationLock, FilesystemMutationLockError, filesystemMutationLockPath, } from "./filesystem-lock.js";
|
|
35
|
+
export type { FilesystemMutationLockOptions, FilesystemMutationLockOwner, } from "./filesystem-lock.js";
|
|
36
|
+
export { RemoteBackend, RemoteError } from "./remote-backend.js";
|
|
37
|
+
export type { FetchLike, RemoteBackendOptions } from "./remote-backend.js";
|
|
38
|
+
export { contentVersion, versionOfBytes, blobVersion, defaultActor, VersionConflict, stripETagWrapper, } from "./versioning.js";
|
|
39
|
+
export { versionedMutation } from "./mutation.js";
|
|
40
|
+
export type { MutationDecision, VersionedMutationOptions, VersionedMutationOutcome } from "./mutation.js";
|
|
41
|
+
export { mutateDocument, DocumentNotFoundError, KindConformanceError, } from "./document-mutation.js";
|
|
42
|
+
export type { DocumentMutationCandidate, DocumentMutationContext, DocumentMutationMode, DocumentMutationResult, MutateDocumentOptions, } from "./document-mutation.js";
|
|
43
|
+
export { PreconditionFailed, assertFieldPreconditions } from "./document-precondition.js";
|
|
44
|
+
export type { FieldExpectation, FieldPrecondition } from "./document-precondition.js";
|
|
45
|
+
export { list } from "./bundle.js";
|
|
46
|
+
export type { QueryOptions, SkippedDoc } from "./bundle.js";
|
|
47
|
+
export { queryHeads } from "./bundle.js";
|
|
48
|
+
export { matchesFilter } from "./query-filter.js";
|
|
49
|
+
export { applyQuerySelectionFilters } from "./query-selection.js";
|
|
50
|
+
export type { QuerySelectionParams } from "./query-selection.js";
|
|
51
|
+
export type { HeadResult } from "./types.js";
|
|
52
|
+
export { GENERATED_INDEX_MARKER, IndexProjectionWriteError, planIndexProjection, prepareIndexProjection, applyIndexProjection, } from "./index-projection.js";
|
|
53
|
+
export type { PlannedIndex, IndexProjectionPlan, IndexProjectionDisposition, PreparedIndexTarget, ReadyIndexProjection, RefusedIndexProjection, IndexProjectionPreparation, AppliedIndexTarget, IndexProjectionApplyResult, } from "./index-projection.js";
|
|
54
|
+
export { RESERVED_FILENAMES, isReservedFile, conceptIdFromPath, pathFromConceptId, assertSafeConceptId, assertSafeReservedDir, assertSafeBlobKey, toPosix, } from "./paths.js";
|
|
55
|
+
export { extractMarkdownLinks, resolveConceptId, relativeHref, parseLinksFromDoc, isExternalHref, } from "./links.js";
|
|
56
|
+
export type { RawLink } from "./links.js";
|
|
57
|
+
export { parseTimestamp } from "./freshness.js";
|
|
58
|
+
export { SUPERBEE_UPDATED_BY_FIELD, mutationActorFromFrontmatter, persistMutationActor, } from "./mutation-attribution.js";
|
|
59
|
+
export type { PersistMutationActorOptions } from "./mutation-attribution.js";
|
|
60
|
+
export { parseMarkdown, stringifyDoc, stringifyWithData, normalizeDocumentBodyForStorage, isUsableTimestamp, MalformedDocumentError, } from "./frontmatter.js";
|
|
61
|
+
export { InvalidInputError, FilesystemIdentityAliasError, ConcurrentReplacementError } from "./errors.js";
|
|
62
|
+
export { applyV02MutationMetadata } from "./document-write-policy.js";
|
|
63
|
+
export { CONVENTIONS_PREFIX, CONVENTION_TYPE, PROGRESS_STATUS_FIELD, SUPERBEE_PROGRESS_STATUS_FIELD, RESERVED_KIND_FIELD_NAMES, progressStatusStorageField, progressStatusCoordinate, resolveKindFieldCoordinate, claimCoordinates, kindInputFieldNames, readKindField, projectLogicalKindFields, projectKindForAuthoring, projectKindValidationWarnings, validateAgainstKind, isPresent, defaultTimestampAndValidateAgainstRegistry, freshnessHorizonMs, kindConventionDoc, parseConventionDoc, buildKindRegistry, splitSections, isTerminal, } from "./kinds.js";
|
|
64
|
+
export { loadKinds } from "./kinds-load.js";
|
|
65
|
+
export type { KindClaimCoordinates, KindClaimPolicy, KindConvention, KindFieldCoordinate, KindFields, KindRegistry, RegistryValidationResult, } from "./kinds.js";
|
|
66
|
+
export { EXTENSION_CONTENT_TYPES, extensionOfDocKey, inferContentTypeFromDocKey, inferContentTypeForNewBlob, resolveContentType, DEFAULT_BLOB_CONTENT_TYPE, } from "./content-type.js";
|
|
67
|
+
export type { ContentTypeInference, ValidationWarning } from "./content-type.js";
|
|
68
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,YAAY,EACV,SAAS,EACT,WAAW,EACX,WAAW,EACX,MAAM,EACN,iBAAiB,EACjB,WAAW,EACX,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,OAAO,EACP,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,6BAA6B,EAC7B,gCAAgC,EAChC,QAAQ,EACR,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,EACV,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC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,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,8BAA8B,EAC9B,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,EAC7B,mBAAmB,EACnB,SAAS,EACT,0CAA0C,EAC1C,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@superbee/core` — the OKF store engine.
|
|
3
|
+
*
|
|
4
|
+
* An **Open Knowledge Format (OKF v0.1 or v0.2)** *Knowledge Bundle* is a
|
|
5
|
+
* directory tree of UTF-8 markdown files, each carrying a YAML frontmatter block
|
|
6
|
+
* (delimited by `---` lines) plus a markdown body. Every non-reserved `.md` file
|
|
7
|
+
* is a *Concept*; its *Concept ID* is the file path minus `.md`
|
|
8
|
+
* (e.g. `tables/users.md` -> `tables/users`).
|
|
9
|
+
*
|
|
10
|
+
* The FILESYSTEM is the source of truth by default, but storage is routed through
|
|
11
|
+
* a pluggable {@link StorageBackend} (default: {@link FilesystemBackend}). This
|
|
12
|
+
* module implements bundle I/O, standard-markdown cross-links (never wikilinks),
|
|
13
|
+
* derived backlinks, freshness derived from the edition's meaningful-change clock, and reserved-file
|
|
14
|
+
* (`index.md`/`log.md`) handling. Human-facing bundle Pages consume this engine through the
|
|
15
|
+
* reference server's narrow browser bridge (read-only v0 plus shell-confirmed local proposals).
|
|
16
|
+
*
|
|
17
|
+
* The public function signatures below are contract-stable; everything past the
|
|
18
|
+
* "extensions" line is additive (pure helpers, reserved-file accessors, and the
|
|
19
|
+
* ported content_type utilities).
|
|
20
|
+
*
|
|
21
|
+
* @see OKF spec — GoogleCloudPlatform/knowledge-catalog, `okf/SPEC.md`
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
24
|
+
// ── Contract functions ────────────────────────────────────────────────────────
|
|
25
|
+
export { initBundle, readBundleOkfVersion, resolveOkfAuthoringVersion, DEFAULT_OKF_AUTHORING_VERSION, SUPPORTED_OKF_AUTHORING_VERSIONS, writeDoc, readDoc, existsDoc, query, parseLinks, backlinks, queryEdges, } from "./bundle.js";
|
|
26
|
+
// Version-surfacing engine API (additive; the seam's hard-case capabilities threaded
|
|
27
|
+
// through the engine): `writeDocVersioned` returns the write's version token; `readDocVersioned`
|
|
28
|
+
// returns a document with its version; `docVersions` exposes attributed history. The plain
|
|
29
|
+
// `writeDoc`/`readDoc` above keep their historical `OkfDocument` returns unchanged.
|
|
30
|
+
export { writeDocVersioned, readDocVersioned, docVersions } from "./bundle.js";
|
|
31
|
+
// Delete (additive; the DELETE-operation pass): hard-delete, non-cascading, reserved files
|
|
32
|
+
// stay non-deletable (guarded at the SAME engine layer writeDocVersioned's reserved-file
|
|
33
|
+
// check lives at), idempotent (absent -> false, never an error). `deleteDoc` carries the
|
|
34
|
+
// engine's id-safety/reserved-file guard; `deleteBlob` is a pure pass-through, mirroring
|
|
35
|
+
// the blob wrappers above.
|
|
36
|
+
export { deleteDoc, deleteBlob } from "./bundle.js";
|
|
37
|
+
// Blob storage engine wrappers: opaque bytes + a
|
|
38
|
+
// content-type, addressed by a bundle-relative key DISJOINT from the concept-document
|
|
39
|
+
// namespace, versioned by a raw-byte content hash, CAS-able, actor-attributed — reusing
|
|
40
|
+
// the doc seam's version/CAS/actor machinery. Future consumers (the CLI's `promote`/
|
|
41
|
+
// `pull`) route through ONLY these, never a backend directly.
|
|
42
|
+
export { readBlob, writeBlob, existsBlob, listBlobs } from "./bundle.js";
|
|
43
|
+
export { freshness } from "./freshness.js";
|
|
44
|
+
// Pluggable storage: the seam is `StorageBackend` (types.ts). `FilesystemBackend` is
|
|
45
|
+
// the DEGENERATE default adapter (the engine falls back to it for a `{ root }` bundle);
|
|
46
|
+
// `MemoryBackend` implements the SAME contract for the hard case (real version chain,
|
|
47
|
+
// enforced compare-and-swap, per-write actor) and proves the engine is backend-neutral.
|
|
48
|
+
export { FilesystemBackend } from "./backend.js";
|
|
49
|
+
export { MemoryBackend } from "./memory-backend.js";
|
|
50
|
+
// Internal-workspace filesystem arbitration authority. CLI create-only policy reuses this
|
|
51
|
+
// external same-user lock rather than defining a second lock protocol or writing claims into a
|
|
52
|
+
// portable bundle tree.
|
|
53
|
+
export { withFilesystemMutationLock, FilesystemMutationLockError, filesystemMutationLockPath, } from "./filesystem-lock.js";
|
|
54
|
+
// `RemoteBackend` is the CLIENT half of the wire-protocol v0 seam-over-HTTP contract
|
|
55
|
+
// (docs/WIRE-PROTOCOL.md) — a FUTURE plug-in adapter, proven here against the
|
|
56
|
+
// in-repo reference server (`@superbee/server`) by the tri-backend contract
|
|
57
|
+
// tests. No CF/D1/production deployment is implied by its presence.
|
|
58
|
+
export { RemoteBackend, RemoteError } from "./remote-backend.js";
|
|
59
|
+
// Versioning / attribution primitives shared by every adapter: the content-addressed
|
|
60
|
+
// version token, a default actor, and the typed compare-and-swap conflict error.
|
|
61
|
+
// `blobVersion` is the raw-bytes sibling of `contentVersion`/`versionOfBytes` (blobs
|
|
62
|
+
// are hashed directly, never routed through a string/UTF-8 step).
|
|
63
|
+
export { contentVersion, versionOfBytes, blobVersion, defaultActor, VersionConflict, stripETagWrapper, } from "./versioning.js";
|
|
64
|
+
// The ONE versioned-mutation boundary: a shared read-decide-CAS-retry
|
|
65
|
+
// primitive consumed by document, link, and index mutation policies instead of
|
|
66
|
+
// independently hand-rolled loops.
|
|
67
|
+
export { versionedMutation } from "./mutation.js";
|
|
68
|
+
// Shared document mutation policy below any transport or presentation boundary. CLI and
|
|
69
|
+
// future trusted consumers reuse create/overwrite/patch semantics without importing CLI code.
|
|
70
|
+
export { mutateDocument, DocumentNotFoundError, KindConformanceError, } from "./document-mutation.js";
|
|
71
|
+
// Field preconditions: the domain-invariant guard `mutateDocument` evaluates against each
|
|
72
|
+
// attempt's fresh read, inside the same decision the CAS write is paired with. `PreconditionFailed`
|
|
73
|
+
// is terminal — consumers branch on the type and map it to their own conflict shape.
|
|
74
|
+
export { PreconditionFailed, assertFieldPreconditions } from "./document-precondition.js";
|
|
75
|
+
// ── Extensions (additive; do not break the contract) ──────────────────────────
|
|
76
|
+
// `list` is an alias of `query` (the `list/query` API surface).
|
|
77
|
+
export { list } from "./bundle.js";
|
|
78
|
+
// Head-projection scan + its canonical filter predicate — contracts documented at the
|
|
79
|
+
// definition sites (bundle.ts/types.ts). The delete-tolerant batch read they share
|
|
80
|
+
// (`readManyExisting`) is internal: its one-time export for the reference router was
|
|
81
|
+
// withdrawn when the router switched to consuming `queryHeads` wholesale.
|
|
82
|
+
export { queryHeads } from "./bundle.js";
|
|
83
|
+
export { matchesFilter } from "./query-filter.js";
|
|
84
|
+
export { applyQuerySelectionFilters } from "./query-selection.js";
|
|
85
|
+
// Portable, ownership-governed `index.md` projection. Raw reserved-file interop stays on the backend seam.
|
|
86
|
+
export { GENERATED_INDEX_MARKER, IndexProjectionWriteError, planIndexProjection, prepareIndexProjection, applyIndexProjection, } from "./index-projection.js";
|
|
87
|
+
// Pure, unit-testable path / link / note / freshness helpers.
|
|
88
|
+
export { RESERVED_FILENAMES, isReservedFile, conceptIdFromPath, pathFromConceptId, assertSafeConceptId, assertSafeReservedDir, assertSafeBlobKey, toPosix, } from "./paths.js";
|
|
89
|
+
export { extractMarkdownLinks, resolveConceptId, relativeHref, parseLinksFromDoc, isExternalHref, } from "./links.js";
|
|
90
|
+
export { parseTimestamp } from "./freshness.js";
|
|
91
|
+
export { SUPERBEE_UPDATED_BY_FIELD, mutationActorFromFrontmatter, persistMutationActor, } from "./mutation-attribution.js";
|
|
92
|
+
export { parseMarkdown, stringifyDoc, stringifyWithData, normalizeDocumentBodyForStorage, isUsableTimestamp, MalformedDocumentError, } from "./frontmatter.js";
|
|
93
|
+
// Typed input-validation rejection — consumer boundaries branch on the TYPE (CLI: USAGE/exit 2),
|
|
94
|
+
// never on message prose. `FilesystemIdentityAliasError` is the alias verdict of the filesystem
|
|
95
|
+
// adapter (a subclass, so it maps through the same branch); `ConcurrentReplacementError` is its
|
|
96
|
+
// bounded-retry runtime condition.
|
|
97
|
+
export { InvalidInputError, FilesystemIdentityAliasError, ConcurrentReplacementError } from "./errors.js";
|
|
98
|
+
export { applyV02MutationMetadata } from "./document-write-policy.js";
|
|
99
|
+
// Kind conventions: a bundle-declared, opt-in document-kind
|
|
100
|
+
// registry — validation + per-kind freshness horizons, read from `Convention` docs under
|
|
101
|
+
// `conventions/`. THE mechanism is core (one implementation, consumed by CLI/server/future
|
|
102
|
+
// MCP); usage is opt-in per bundle. A conventions-free bundle is byte-for-byte unaffected.
|
|
103
|
+
export { CONVENTIONS_PREFIX, CONVENTION_TYPE, PROGRESS_STATUS_FIELD, SUPERBEE_PROGRESS_STATUS_FIELD, RESERVED_KIND_FIELD_NAMES, progressStatusStorageField, progressStatusCoordinate, resolveKindFieldCoordinate, claimCoordinates, kindInputFieldNames, readKindField, projectLogicalKindFields, projectKindForAuthoring, projectKindValidationWarnings, validateAgainstKind, isPresent, defaultTimestampAndValidateAgainstRegistry, freshnessHorizonMs, kindConventionDoc, parseConventionDoc, buildKindRegistry, splitSections, isTerminal, } from "./kinds.js";
|
|
104
|
+
export { loadKinds } from "./kinds-load.js";
|
|
105
|
+
// Ported MIME utilities (holaxis-agentstate `packages/schemas/src/content-type.ts`).
|
|
106
|
+
// `resolveContentType` is the ONE place a blob's content-type is resolved (explicit
|
|
107
|
+
// override > inferred from key extension > `DEFAULT_BLOB_CONTENT_TYPE`) — every
|
|
108
|
+
// backend's blob methods route through it.
|
|
109
|
+
export { EXTENSION_CONTENT_TYPES, extensionOfDocKey, inferContentTypeFromDocKey, inferContentTypeForNewBlob, resolveContentType, DEFAULT_BLOB_CONTENT_TYPE, } from "./content-type.js";
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA0BH,iFAAiF;AACjF,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,6BAA6B,EAC7B,gCAAgC,EAChC,QAAQ,EACR,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,EACV,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,qFAAqF;AACrF,iGAAiG;AACjG,2FAA2F;AAC3F,oFAAoF;AACpF,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/E,2FAA2F;AAC3F,yFAAyF;AACzF,yFAAyF;AACzF,yFAAyF;AACzF,2BAA2B;AAC3B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpD,iDAAiD;AACjD,sFAAsF;AACtF,wFAAwF;AACxF,qFAAqF;AACrF,8DAA8D;AAC9D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,S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AClB,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,qFAAqF;AACrF,oFAAoF;AACpF,gFAAgF;AAChF,2CAA2C;AAC3C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KindRegistry } from "./kinds.js";
|
|
2
|
+
import type { Bundle } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Build the {@link KindRegistry} for `bundle`: every `Convention` doc under
|
|
5
|
+
* {@link CONVENTIONS_PREFIX}, keyed by the `type` it governs. A Convention doc OUTSIDE
|
|
6
|
+
* the prefix is NOT discovered — that is the documented contract (CONTRIBUTING.md, "Kind conventions"),
|
|
7
|
+
* not a bug. Malformed docs are skipped with a collected warning (never thrown); a
|
|
8
|
+
* duplicate `governs` keeps the first-by-id declaration (query's results are
|
|
9
|
+
* id-sorted) and warns about the shadowed one. Callers build this ONCE per invocation
|
|
10
|
+
* and pass it down — no engine path calls this on its own.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadKinds(bundle: Bundle): Promise<KindRegistry>;
|
|
13
|
+
//# sourceMappingURL=kinds-load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds-load.d.ts","sourceRoot":"","sources":["../src/kinds-load.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAiBrE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The backend-touching half of the kind-convention registry: {@link loadKinds}
|
|
3
|
+
* queries a bundle's `conventions/` prefix and builds the registry out of `kinds.ts`'s pure
|
|
4
|
+
* parsing/derivation. Split from `kinds.ts` ONLY by dependency weight — `kinds.ts` is the
|
|
5
|
+
* browser-safe `@superbee/core/kinds` subpath (zero value imports), while this module may
|
|
6
|
+
* pull the engine (`query` -> backends -> node built-ins). One registry, two entry weights.
|
|
7
|
+
*/
|
|
8
|
+
import { query } from "./bundle.js";
|
|
9
|
+
import { CONVENTIONS_PREFIX, CONVENTION_TYPE, buildKindRegistry, } from "./kinds.js";
|
|
10
|
+
/**
|
|
11
|
+
* Build the {@link KindRegistry} for `bundle`: every `Convention` doc under
|
|
12
|
+
* {@link CONVENTIONS_PREFIX}, keyed by the `type` it governs. A Convention doc OUTSIDE
|
|
13
|
+
* the prefix is NOT discovered — that is the documented contract (CONTRIBUTING.md, "Kind conventions"),
|
|
14
|
+
* not a bug. Malformed docs are skipped with a collected warning (never thrown); a
|
|
15
|
+
* duplicate `governs` keeps the first-by-id declaration (query's results are
|
|
16
|
+
* id-sorted) and warns about the shadowed one. Callers build this ONCE per invocation
|
|
17
|
+
* and pass it down — no engine path calls this on its own.
|
|
18
|
+
*/
|
|
19
|
+
export async function loadKinds(bundle) {
|
|
20
|
+
const warnings = [];
|
|
21
|
+
// A convention doc whose YAML frontmatter is itself corrupt must not crash the WHOLE registry
|
|
22
|
+
// load (which every `kinds`/`status`/`new`/`doc write` invocation runs) — it is reported as a
|
|
23
|
+
// registry warning, exactly like a semantically-malformed convention, and the rest still load.
|
|
24
|
+
const docs = await query(bundle, { prefix: CONVENTIONS_PREFIX, type: CONVENTION_TYPE }, {
|
|
25
|
+
onSkip: ({ id, reason }) => warnings.push({
|
|
26
|
+
code: "KIND_CONVENTION_MALFORMED",
|
|
27
|
+
message: `skipped kind convention '${id}' with unparseable frontmatter: ${reason}`,
|
|
28
|
+
field: id,
|
|
29
|
+
severity: "warning",
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
return buildKindRegistry(docs, warnings);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=kinds-load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds-load.js","sourceRoot":"","sources":["../src/kinds-load.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAKpB;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc;IAC5C,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,8FAA8F;IAC9F,8FAA8F;IAC9F,+FAA+F;IAC/F,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE;QACtF,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CACzB,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,2BAA2B;YACjC,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,MAAM,EAAE;YAClF,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,SAAS;SACpB,CAAC;KACL,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC"}
|