fix(plugins): mangabaka never deletes on upsert without entry

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-30 15:50:32 +01:00
co-authored by Claude Opus 5.5
parent ddd938935e
commit f30c0db2b1
3 changed files with 24 additions and 4 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export const STATE_MAP: Record<string, Status> = {
};
export function mapState(s: string | null | undefined): Status {
return (s != null && STATE_MAP[s]) || "none";
return s != null && Object.hasOwn(STATE_MAP, s) ? STATE_MAP[s]! : "none";
}
function hint(e: ApiEntry): WorkHint {
+3 -2
View File
@@ -18,8 +18,9 @@ export async function* pullChanges(ctx: PluginContext): AsyncIterable<SourceReco
for (;;) {
const res = await ctx.http.json<ChangesPage>(`${BASE_URL}/v2/my/library/changes`, { headers, query: { cursor }, signal: ctx.signal });
for (const c of res.data) {
if (c.type === "delete" || !c.entry) yield* mapDeletion(c.series_id);
else yield* mapEntry(c.entry);
if (c.type === "delete") yield* mapDeletion(c.series_id);
else if (c.entry) yield* mapEntry(c.entry);
else ctx.log(`mangabaka: upsert without entry for series ${c.series_id}, skipped`);
}
const next = res.next_cursor;
if (next) {