diff --git a/packages/tauri-plugins/jarvis/build.rs b/packages/tauri-plugins/jarvis/build.rs index 94829c3..ae9bb8b 100644 --- a/packages/tauri-plugins/jarvis/build.rs +++ b/packages/tauri-plugins/jarvis/build.rs @@ -81,23 +81,23 @@ const COMMANDS: &[&str] = &[ // "ext_store_wrapper_save", "get_server_port", /* ----------------------------- sqlite database ---------------------------- */ - "create_extension", - "get_all_extensions", - "get_unique_extension_by_identifier", - "get_unique_extension_by_path", - "get_all_extensions_by_identifier", - "delete_extension_by_path", - "delete_extension_by_ext_id", - "create_command", - "get_command_by_id", - "get_commands_by_ext_id", - "delete_command_by_id", - "update_command_by_id", - "create_extension_data", - "get_extension_data_by_id", - "search_extension_data", - "delete_extension_data_by_id", - "update_extension_data_by_id", + // "create_extension", + // "get_all_extensions", + // "get_unique_extension_by_identifier", + // "get_unique_extension_by_path", + // "get_all_extensions_by_identifier", + // "delete_extension_by_path", + // "delete_extension_by_ext_id", + // "create_command", + // "get_command_by_id", + // "get_commands_by_ext_id", + // "delete_command_by_id", + // "update_command_by_id", + // "create_extension_data", + // "get_extension_data_by_id", + // "search_extension_data", + // "delete_extension_data_by_id", + // "update_extension_data_by_id", "select", "execute", /* -------------------------------- Clipboard ------------------------------- */ diff --git a/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md b/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md index ddf14e4..06546b4 100644 --- a/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md +++ b/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md @@ -1,3 +1,4 @@ + ## Permission Table @@ -6,6 +7,7 @@ +
Description
diff --git a/packages/tauri-plugins/jarvis/src/commands/db.rs b/packages/tauri-plugins/jarvis/src/commands/db.rs index dc0a1ff..aa7d9a9 100644 --- a/packages/tauri-plugins/jarvis/src/commands/db.rs +++ b/packages/tauri-plugins/jarvis/src/commands/db.rs @@ -22,231 +22,6 @@ impl DBState { } } -/* -------------------------------------------------------------------------- */ -/* Extension CRUD */ -/* -------------------------------------------------------------------------- */ -#[tauri::command] -pub async fn create_extension( - db: State<'_, DBState>, - identifier: &str, - version: &str, - enabled: Option, - path: Option<&str>, - data: Option<&str>, -) -> Result<(), String> { - db.db - .lock() - .unwrap() - .create_extension(identifier, version, enabled.unwrap_or(true), path, data) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn get_all_extensions(db: State<'_, DBState>) -> Result, String> { - db.db - .lock() - .unwrap() - .get_all_extensions() - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn get_all_extensions_by_identifier( - identifier: &str, - db: State<'_, DBState>, -) -> Result, String> { - db.db - .lock() - .unwrap() - .get_all_extensions_by_identifier(identifier) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn get_unique_extension_by_identifier( - identifier: &str, - db: State<'_, DBState>, -) -> Result, String> { - let ext = db - .db - .lock() - .unwrap() - .get_unique_extension_by_identifier(identifier) - .map_err(|err| err.to_string())?; - Ok(ext) -} - -#[tauri::command] -pub async fn get_unique_extension_by_path( - path: &str, - db: State<'_, DBState>, -) -> Result, String> { - let ext = db - .db - .lock() - .unwrap() - .get_unique_extension_by_path(path) - .map_err(|err| err.to_string())?; - Ok(ext) -} - -#[tauri::command] -pub async fn delete_extension_by_path(path: &str, db: State<'_, DBState>) -> Result<(), String> { - db.db - .lock() - .unwrap() - .delete_extension_by_path(path) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn delete_extension_by_ext_id(ext_id: i32, db: State<'_, DBState>) -> Result<(), String> { - db.db - .lock() - .unwrap() - .delete_extension_by_ext_id(ext_id) - .map_err(|err| err.to_string()) -} - -/* -------------------------------------------------------------------------- */ -/* Extension Command CRUD */ -/* -------------------------------------------------------------------------- */ - -#[tauri::command] -pub async fn create_command( - db: State<'_, DBState>, - ext_id: i32, - name: &str, - cmd_type: CmdType, - data: &str, - enabled: bool, - alias: Option<&str>, - hotkey: Option<&str>, -) -> Result<(), String> { - db.db - .lock() - .unwrap() - .create_command(ext_id, name, cmd_type, data, enabled, alias, hotkey) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn get_command_by_id(db: State<'_, DBState>, cmd_id: i32) -> Result, String> { - db.db - .lock() - .unwrap() - .get_command_by_id(cmd_id) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn get_commands_by_ext_id( - db: State<'_, DBState>, - ext_id: i32, -) -> Result, String> { - db.db - .lock() - .unwrap() - .get_commands_by_ext_id(ext_id) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn delete_command_by_id(db: State<'_, DBState>, cmd_id: i32) -> Result<(), String> { - db.db - .lock() - .unwrap() - .delete_command_by_id(cmd_id) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn update_command_by_id( - db: State<'_, DBState>, - cmd_id: i32, - name: &str, - cmd_type: CmdType, - data: &str, - enabled: bool, - alias: Option<&str>, - hotkey: Option<&str>, -) -> Result<(), String> { - db.db - .lock() - .unwrap() - .update_command_by_id(cmd_id, name, cmd_type, data, enabled, alias, hotkey) - .map_err(|err| err.to_string()) -} - -/* -------------------------------------------------------------------------- */ -/* Extension Data CRUD */ -/* -------------------------------------------------------------------------- */ -#[tauri::command] -pub async fn create_extension_data( - ext_id: i32, - data_type: &str, - data: &str, - search_text: Option<&str>, - db: State<'_, DBState>, -) -> Result<(), String> { - db.db - .lock() - .unwrap() - .create_extension_data(ext_id, data_type, data, search_text, None) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn get_extension_data_by_id( - data_id: i32, - fields: Option>, - db: State<'_, DBState>, -) -> Result, String> { - db.db - .lock() - .unwrap() - .get_extension_data_by_id(data_id, fields) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn search_extension_data( - db: State<'_, DBState>, - search_query: ExtDataSearchQuery, -) -> Result, String> { - db.db - .lock() - .unwrap() - .search_extension_data(search_query) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn delete_extension_data_by_id( - data_id: i32, - db: State<'_, DBState>, -) -> Result<(), String> { - db.db - .lock() - .unwrap() - .delete_extension_data_by_id(data_id) - .map_err(|err| err.to_string()) -} - -#[tauri::command] -pub async fn update_extension_data_by_id( - data_id: i32, - data: &str, - search_text: Option<&str>, - db: State<'_, DBState>, -) -> Result<(), String> { - db.db - .lock() - .unwrap() - .update_extension_data_by_id(data_id, data, search_text) - .map_err(|err| err.to_string()) -} - #[tauri::command] pub async fn select( db: State<'_, DBState>, diff --git a/packages/tauri-plugins/jarvis/src/lib.rs b/packages/tauri-plugins/jarvis/src/lib.rs index 06d3087..50a20b6 100644 --- a/packages/tauri-plugins/jarvis/src/lib.rs +++ b/packages/tauri-plugins/jarvis/src/lib.rs @@ -142,24 +142,6 @@ pub fn init() -> TauriPlugin { /* -------------------------------- database -------------------------------- */ commands::db::select, commands::db::execute, - commands::db::create_extension, - commands::db::create_extension, - commands::db::get_all_extensions, - commands::db::get_unique_extension_by_identifier, - commands::db::get_unique_extension_by_path, - commands::db::get_all_extensions_by_identifier, - commands::db::delete_extension_by_path, - commands::db::delete_extension_by_ext_id, - commands::db::create_command, - commands::db::get_command_by_id, - commands::db::get_commands_by_ext_id, - commands::db::delete_command_by_id, - commands::db::update_command_by_id, - commands::db::create_extension_data, - commands::db::get_extension_data_by_id, - commands::db::search_extension_data, - commands::db::delete_extension_data_by_id, - commands::db::update_extension_data_by_id, /* -------------------------------- Clipboard ------------------------------- */ commands::clipboard::get_history, commands::clipboard::add_to_history,