fix: close marketplace client review findings

This commit is contained in:
2026-08-28 21:01:51 +08:00
parent 8dfa542860
commit 1614f7efc1
25 changed files with 1224 additions and 143 deletions

View File

@@ -175,6 +175,21 @@ export class AccountPluginCache {
return result;
}
/**
* Forget device-resolution snapshots for one plugin in one account binding.
* The Library projection is intentionally retained so uninstalling a device
* package never becomes an account Library mutation.
*/
invalidatePlugin(binding: AccountBinding, pluginId: string): void {
const record = this.records.get(bindingId(binding));
if (!record) return;
for (const [key, snapshot] of record.resolves.entries()) {
const items = snapshot.items.filter((item) => item.pluginId !== pluginId);
if (items.length === 0) record.resolves.delete(key);
else if (items.length !== snapshot.items.length) record.resolves.set(key, { ...snapshot, items });
}
}
clearAccount(binding: AccountBinding): void {
assertBinding(binding);
for (const [key, record] of this.records.entries()) {