import { judgePress } from "@/lib/library/presses.mjs"; import { ask, press } from "@/lib/library/route"; import { seenOf } from "@/lib/library/seen.mjs"; import { REPORTS_ROOT } from "@/lib/paths.mjs"; export const dynamic = "force-dynamic"; // POST { lib, set: [{id | thread, state, note?}], undo? } // POST { lib, bulk: { view, state, note? }, expect } // -> { ok, written, skipped, kept, archives, sentence, undo? } // // THE POSTS LIBRARY PAGE'S KEEP / DROP / LATER / CLEAR (lane posts-library): // the editor's `judge-trending`, written as the OPERATOR's whatever the body // says (lib/library/presses.mjs). umtool writes no file of the library and // asks X nothing: a keep's archiving is the editor's one paced capture job. // `bulk` judges every post the view's filters match, in chunks of at most // 500, and refuses when the match is no longer the `expect`ed count. export async function POST(request: Request) { return press(request, (body) => judgePress(ask, body, { seenAt: async (lib: string, topic: string) => (await seenOf(REPORTS_ROOT, lib))[topic] ?? null })); }