fix(plugins): mangabaka never deletes on upsert without entry
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ddd938935e
commit
f30c0db2b1
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user