/** * Tauri adapter for {@link EmbedderGateway} (L14 / lot C2). Like the sibling * adapters this is one of the *only* places that calls `invoke()`; components * reach it exclusively through the port. * * Commands use snake_case (Tauri convention); payload keys are camelCase * (matching the backend DTO `#[serde(rename_all = "camelCase")]`). The mutating * command `save_embedder_profile` wraps its field under a `request` key (as * `save_profile` does); `delete_embedder_profile` passes its arg flat. */ import { invoke } from "@tauri-apps/api/core"; import type { EmbedderEngines, EmbedderProfile } from "@/domain"; import type { EmbedderGateway } from "@/ports"; export class TauriEmbedderGateway implements EmbedderGateway { listEmbedderProfiles(): Promise { return invoke("list_embedder_profiles"); } saveEmbedderProfile(profile: EmbedderProfile): Promise { return invoke("save_embedder_profile", { request: { profile }, }); } async deleteEmbedderProfile(embedderId: string): Promise { await invoke("delete_embedder_profile", { embedderId }); } describeEmbedderEngines(): Promise { return invoke("describe_embedder_engines"); } }