diff --git a/crates/yaak-web/pkg/yaak_web_bg.js b/crates/yaak-web/pkg/yaak_web_bg.js index c87d81b1..325c0b98 100644 --- a/crates/yaak-web/pkg/yaak_web_bg.js +++ b/crates/yaak-web/pkg/yaak_web_bg.js @@ -678,22 +678,22 @@ export function __wbg_versions_215a3ab1c9d5745a(arg0) { return ret; } export function __wbindgen_cast_0000000000000001(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1104, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1102, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hf84d53817e0238b4); return ret; } export function __wbindgen_cast_0000000000000002(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 202, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 200, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h7e06bb925b918fbb); return ret; } export function __wbindgen_cast_0000000000000003(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 180, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 70, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h7e53e249a4dc4aa9); return ret; } export function __wbindgen_cast_0000000000000004(arg0, arg1) { - // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 200, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 198, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`. const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h87640adb2bbfa2fc); return ret; } diff --git a/crates/yaak-web/pkg/yaak_web_bg.wasm b/crates/yaak-web/pkg/yaak_web_bg.wasm index c14a70bc..3025eaf1 100644 Binary files a/crates/yaak-web/pkg/yaak_web_bg.wasm and b/crates/yaak-web/pkg/yaak_web_bg.wasm differ diff --git a/crates/yaak-web/src/lib.rs b/crates/yaak-web/src/lib.rs index 2be014a5..c11f1ef7 100644 --- a/crates/yaak-web/src/lib.rs +++ b/crates/yaak-web/src/lib.rs @@ -312,6 +312,34 @@ fn dispatch( to_json(db.get_or_create_workspace_meta(&workspace.id).map_err(js_error)?) } + // Deleting responses is a pure database operation — the same one the + // desktop performs. It has nothing to do with *producing* responses + // (that is sending, which needs a socket); it only removes rows the + // user already has. Both delegate to the exact query-layer functions + // `yaak_commands::models` calls, so the cascade and the delete events + // match the desktop's. + "cmd_delete_all_http_responses" => { + let req: RequestIdReq = from_js(payload)?; + host.queries + .connect() + .delete_all_http_responses_for_request(&req.request_id, source) + .map_err(js_error)?; + to_json(()) + } + + "cmd_delete_send_history" => { + let req: WorkspaceIdReq = from_js(payload)?; + host.queries + .with_tx(|tx| { + tx.delete_all_http_responses_for_workspace(&req.workspace_id, source)?; + tx.delete_all_grpc_connections_for_workspace(&req.workspace_id, source)?; + tx.delete_all_websocket_connections_for_workspace(&req.workspace_id, source)?; + Ok::<(), yaak_models::error::Error>(()) + }) + .map_err(js_error)?; + to_json(()) + } + other => Err(js_error(format!("yaak-web: `{other}` is not a command this host answers"))), } } diff --git a/packages/platform/src/web/commands.ts b/packages/platform/src/web/commands.ts index f3eb5b29..5c422fd9 100644 --- a/packages/platform/src/web/commands.ts +++ b/packages/platform/src/web/commands.ts @@ -66,6 +66,12 @@ const HANDLERS: Partial> = { models_websocket_events: (payload, db) => db.rpc("models_websocket_events", payload), cmd_get_workspace_meta: (payload, db) => db.rpc("cmd_get_workspace_meta", payload), + // Deleting responses (and clearing send history) is database work, not a + // send: it removes rows the user already has. The model layer in the worker + // answers these with the same queries the desktop uses, cascade and all. + cmd_delete_all_http_responses: (payload, db) => db.rpc("cmd_delete_all_http_responses", payload), + cmd_delete_send_history: (payload, db) => db.rpc("cmd_delete_send_history", payload), + /* -------------------------------- app ---------------------------------- */ async cmd_metadata() { @@ -298,10 +304,6 @@ const DECLINED: Partial