// file: crates/ksp-app-raw-transaction-ingest-desk/src/dto_common.rs // version: 1 //! Common Tauri DTOs shared by the Raw Transaction Ingest Desk shell. use ts_rs::TS; // rust-rules: trait-import /// Safe command error projection that never serializes arbitrary KSP error context or source values. #[derive(Clone, Debug, serde::Serialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export, export_to = "../frontend/ts/bindings/ksp_app_raw_transaction_ingest_desk/dto_common/CommandErrorDto.ts")] pub(crate) struct CommandErrorDto { /// Stable KSP error domain. pub(crate) domain: String, /// Stable KSP error code within the domain. pub(crate) code: String, /// Human-readable error message without arbitrary context fields. pub(crate) message: String, } impl crate::CommandErrorDto { /// Builds a bounded safe projection from a KSP error. #[must_use] pub(crate) fn from_error(error: &ksp_core_lib::Error) -> Self { return Self { domain: error.code().domain().to_owned(), code: error.code().code().to_owned(), message: error.message().to_owned(), }; } } /// Safe scaffold/runtime snapshot exposed to the Raw Transaction Ingest Desk shell. #[derive(Clone, Debug, serde::Serialize, TS)] #[serde(rename_all = "camelCase")] #[ts(export, export_to = "../frontend/ts/bindings/ksp_app_raw_transaction_ingest_desk/dto_common/ShellStatusDto.ts")] pub(crate) struct ShellStatusDto { /// Active composite profile selected by Config, when the composite resolves successfully. pub(crate) active_composite_profile: std::option::Option, /// Active configured Logging profile, or `None` while transient fallback Logging is active. pub(crate) active_logging_profile: std::option::Option, /// Cargo application version. pub(crate) application_version: String, /// Number of logical Config resources registered by the current runtime. pub(crate) config_document_count: u32, /// Whether Raw Transaction Ingest Desk had to install its transient in-memory Logging fallback. pub(crate) fallback_logging_active: bool, /// Current implementation phase exposed by the shell. pub(crate) shell_phase: String, /// Safe startup diagnostic that caused fallback Logging, when applicable. pub(crate) startup_diagnostic: std::option::Option, } #[cfg(test)] #[path = "../unit_tests/dto_common.rs"] mod tests;