Share one exporter, and flush the file before saying it is written (#686)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-15 14:56:23 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent caeebebc75
commit f827aae46d
8 changed files with 73 additions and 24 deletions
-27
View File
@@ -1,27 +0,0 @@
use crate::Result;
use yaak_models::query_manager::QueryManager;
use yaak_models::util::get_workspace_export_resources;
pub struct ExportDataParams<'a> {
pub query_manager: &'a QueryManager,
pub yaak_version: &'a str,
pub workspace_ids: Vec<&'a str>,
pub include_private_environments: bool,
}
/// The export document, as JSON.
///
/// Returned rather than written: where an export goes is the host's to decide, and a browser
/// tab has no path to be handed. The desktop hands the bytes to its save dialog; a tab hands
/// them to a download. Neither needs this function to know which.
pub fn export_data(params: ExportDataParams<'_>) -> Result<String> {
let db = params.query_manager.connect();
let export_data = get_workspace_export_resources(
&db,
params.yaak_version,
params.workspace_ids,
params.include_private_environments,
)?;
Ok(serde_json::to_string_pretty(&export_data)?)
}
-1
View File
@@ -1,6 +1,5 @@
pub mod error;
pub mod example;
pub mod export;
pub mod import;
pub mod plugin_events;
pub mod response_body;