Mountain/Binary/IPC/
ConfigurationUpdateCommand.rs

1//! # ConfigurationUpdateCommand
2//!
3//! Updates configuration from Wind frontend.
4//!
5//! ## RESPONSIBILITIES
6//!
7//! ### Configuration Update
8//! - Accept configuration updates from Wind
9//! - Delegate to ConfigurationBridge for processing
10//! - Validate configuration structure
11//! - Return update confirmation
12//!
13//! ## ARCHITECTURAL ROLE
14//!
15//! ### Position in Mountain
16//! - IPC wrapper command in Binary subsystem
17//! - Bridge for Wind configuration updates
18//!
19//! ### Dependencies
20//! - crate::IPC::ConfigurationBridge: Configuration management
21//! - tauri: IPC framework
22//! - serde_json: JSON serialization
23//!
24//! ### Dependents
25//! - Wind frontend: Sends configuration updates
26//! - Tauri IPC handler: Routes update requests
27//!
28//! ## SECURITY
29//!
30//! ### Considerations
31//! - Validate configuration structure before applying
32//! - Prevent modification of protected configuration keys
33//! - Sanitize user-provided values
34//!
35//! ## PERFORMANCE
36//!
37//! ### Considerations
38//! - Configuration updates trigger I/O operations
39//! - Consider debouncing rapid updates
40
41use serde_json::Value;
42use tauri::AppHandle;
43
44/// Update configuration from Wind.
45///
46/// This command accepts configuration updates from the Wind frontend
47/// and processes them through the ConfigurationBridge.
48///
49/// # Arguments
50///
51/// * `app_handle` - Tauri application handle
52/// * `config` - JSON object containing configuration updates
53///
54/// # Returns
55///
56/// Returns a JSON response confirming the update, or an error string.
57///
58/// # Errors
59///
60/// Returns an error if:
61/// - Configuration structure is invalid
62/// - Update cannot be persisted
63#[tauri::command]
64pub async fn MountainUpdateConfigurationFromWind(app_handle:AppHandle, config:Value) -> Result<Value, String> {
65	crate::IPC::ConfigurationBridge::mountain_update_configuration_from_wind(app_handle, config).await?;
66	Ok(Value::Null)
67}