refactor(frontend,plugins): normalise les DTOs review backend et corrige le mock (#120)
- plugin.ts: normalizeReview() garantit issues/installable définis même si backend omet ces champs - mock/index.ts: MockPluginGateway.uninstall() retourne removalOutcome pour cohérence avec le domaine - domain/index.ts: PluginUninstallResult ajoute removalOutcome optionnel - Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -21,15 +21,29 @@ import type {
|
||||
} from "@/domain";
|
||||
import type { PluginGateway, ReviewPluginPackageInput } from "@/ports";
|
||||
|
||||
type TauriPluginReviewDto = Omit<PluginReview, "issues" | "installable"> & {
|
||||
issues?: PluginReview["issues"];
|
||||
installable?: boolean;
|
||||
};
|
||||
|
||||
function normalizeReview(review: TauriPluginReviewDto): PluginReview {
|
||||
return {
|
||||
...review,
|
||||
issues: review.issues ?? [],
|
||||
installable: review.installable ?? true,
|
||||
};
|
||||
}
|
||||
|
||||
export class TauriPluginGateway implements PluginGateway {
|
||||
listPlugins(): Promise<PluginAdmin[]> {
|
||||
return invoke<PluginAdmin[]>("plugin_list_plugins");
|
||||
}
|
||||
|
||||
reviewPackage(input: ReviewPluginPackageInput): Promise<PluginReview> {
|
||||
return invoke<PluginReview>("plugin_review_package", {
|
||||
async reviewPackage(input: ReviewPluginPackageInput): Promise<PluginReview> {
|
||||
const review = await invoke<TauriPluginReviewDto>("plugin_review_package", {
|
||||
input: { sourceKind: input.sourceKind, path: input.path },
|
||||
});
|
||||
return normalizeReview(review);
|
||||
}
|
||||
|
||||
installFromArchive(path: string): Promise<PluginInstallResult> {
|
||||
|
||||
Reference in New Issue
Block a user