Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 87530077384f9a82410d61aafc5d0d05f0506ce7
parent 9f5cdbd16573bc534cfafcf37655c9d162ccded7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 17 Nov 2026 15:16:50 -0500

manifest: a post item's and a card narration's mutation as in-memory writers (postItemIn, cardNarrationIn)

updatePostItem and updateCardNarration keep their behaviour; their mutation is exported so a write of
several reads (lane reads-find: a replace over a video's spoken text) runs the same checks in one
structural write, one undo point.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/lib/report/manifest.mjs | 34++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -2959,6 +2959,12 @@ const POST_REF_FIELDS = Object.freeze(["id", "author", "handle", "badge", "date" * @param {{ token?: string | null }} [opts] */ export async function updatePostItem(dir, id, patch, { token = null } = {}) { + postItemPatchCheck(patch); + return structural(dir, "post-item", token, (m) => postItemIn(m, id, patch)); +} + +/** A post item patch's keys checked (updatePostItem, postItemIn): throws naming one that is no knob. */ +function postItemPatchCheck(patch) { if (!isObj(patch)) throw new Error("a post item's patch is an object"); for (const k of Object.keys(patch)) { if (!["media", "mediaAdd", "mediaHide", "mediaShow", "quoted", "parents", "links", "linksAdd"].includes(k) && !POST_ITEM_KNOBS.includes(k)) throw new Error(`${k} is not a post item knob (${[...POST_ITEM_KNOBS, "media", "mediaAdd", "mediaHide", "mediaShow", "quoted", "parents", "links", "linksAdd"].join(", ")})`); @@ -2967,7 +2973,17 @@ export async function updatePostItem(dir, id, patch, { token = null } = {}) { // whole between `media` and `mediaOff` (post-item.mjs), its knobs kept -- alone in its write, so no index moves under it. const toggles = ["mediaHide", "mediaShow"].filter((k) => k in patch); if (toggles.length && Object.keys(patch).length !== toggles.length) throw new Error("mediaHide / mediaShow go alone in a write"); - return structural(dir, "post-item", token, (m) => { + return toggles; +} + +/** + * ONE POST ITEM's KNOBS, changed in place (`m` the manifest inside a write) -- updatePostItem's mutation, and the one a + * write of several items runs for each (lane reads-find: a replace over a video's reads, one undo point). Refused in + * the build's words, as updatePostItem is. + */ +export function postItemIn(m, id, patch) { + const toggles = postItemPatchCheck(patch); + { const i = entryIndex(m.timeline, id); const e = m.timeline[i]; if (e?.type !== "post") throw new Error(`${id} is a ${e?.type ?? "?"} entry, not a post item`); @@ -3153,7 +3169,7 @@ export async function updatePostItem(dir, id, patch, { token = null } = {}) { if (now.length) throw new StructureRefused(now); } return { id, at: i, entry: e }; - }); + } } /** @@ -4473,7 +4489,17 @@ export async function updateNarration(dir, id, text, { token = null, at = null } export async function updateCardNarration(dir, id, patch, { token = null } = {}) { if (!isObj(patch) || !Object.keys(patch).length) throw new Error("a card narration patch is { text?, reading?, tuning? }"); for (const k of Object.keys(patch)) if (!["text", "reading", "tuning"].includes(k)) throw new Error(`${k} is not a card narration's (text, reading, tuning)`); - return structural(dir, "narration", token, (m) => { + return structural(dir, "narration", token, (m) => cardNarrationIn(m, id, patch)); +} + +/** + * ONE CARD's NARRATION changed in place (`m` the manifest inside a write): updateCardNarration's mutation, and the one a + * write of several reads runs for each card (lane reads-find). Refused in the build's words. + */ +export function cardNarrationIn(m, id, patch) { + if (!isObj(patch) || !Object.keys(patch).length) throw new Error("a card narration patch is { text?, reading?, tuning? }"); + for (const k of Object.keys(patch)) if (!["text", "reading", "tuning"].includes(k)) throw new Error(`${k} is not a card narration's (text, reading, tuning)`); + { const e = m.timeline[entryIndex(m.timeline, id)]; if (e.type !== "card" || !e.narration || typeof e.narration !== "object") throw new Error(`${id} is not a card with a narration`); const before = JSON.stringify(e.narration); @@ -4489,7 +4515,7 @@ export async function updateCardNarration(dir, id, patch, { token = null } = {}) const errors = validateNarration({ render: m.render, timeline: [e] }); if (errors.length) throw new StructureRefused(errors); return { id, entry: e, changed: before !== JSON.stringify(e.narration) }; - }); + } } /**