From 7c2289010dc7af7d5a2eb2d264590301ed113686 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Thu, 19 Sep 2024 16:32:40 -0500 Subject: [PATCH] WIP: No more empty outputs from modeling API Part of https://github.com/KittyCAD/modeling-api/issues/518 --- src/wasm-lib/Cargo.lock | 6 ++---- src/wasm-lib/Cargo.toml | 2 +- src/wasm-lib/kcl/src/engine/conn_mock.rs | 5 +++-- src/wasm-lib/kcl/src/engine/mod.rs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/wasm-lib/Cargo.lock b/src/wasm-lib/Cargo.lock index 8beff4a616..ce8111d857 100644 --- a/src/wasm-lib/Cargo.lock +++ b/src/wasm-lib/Cargo.lock @@ -1527,8 +1527,7 @@ dependencies = [ [[package]] name = "kittycad-modeling-cmds" version = "0.2.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee900033a5804ca2354f0760478e851a0ab04d32b38a9117d0bd4f87a8867110" +source = "git+https://github.com/KittyCAD/modeling-api?branch=achalmers/no-more-empty#36b6b4a196af32235f6059f615012e0f95d008fc" dependencies = [ "anyhow", "chrono", @@ -1552,8 +1551,7 @@ dependencies = [ [[package]] name = "kittycad-modeling-cmds-macros" version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cdc505a33bfffb87c317435ec41ced8f73474217cf30db685e479bf289757e" +source = "git+https://github.com/KittyCAD/modeling-api?branch=achalmers/no-more-empty#36b6b4a196af32235f6059f615012e0f95d008fc" dependencies = [ "proc-macro2", "quote", diff --git a/src/wasm-lib/Cargo.toml b/src/wasm-lib/Cargo.toml index e24ad4eff8..982003aaee 100644 --- a/src/wasm-lib/Cargo.toml +++ b/src/wasm-lib/Cargo.toml @@ -73,7 +73,7 @@ members = [ http = "0.2.12" kittycad = { version = "0.3.20", default-features = false, features = ["js", "requests"] } kittycad-modeling-session = "0.1.4" -kittycad-modeling-cmds = { version = "0.2.59", features = ["websocket"] } +kittycad-modeling-cmds = { git = "https://github.com/KittyCAD/modeling-api", branch="achalmers/no-more-empty", features = ["websocket"] } [[test]] name = "executor" diff --git a/src/wasm-lib/kcl/src/engine/conn_mock.rs b/src/wasm-lib/kcl/src/engine/conn_mock.rs index fa951eaba2..c19ab3e4cd 100644 --- a/src/wasm-lib/kcl/src/engine/conn_mock.rs +++ b/src/wasm-lib/kcl/src/engine/conn_mock.rs @@ -10,6 +10,7 @@ use anyhow::Result; use indexmap::IndexMap; use kcmc::{ ok_response::OkModelingCmdResponse, + output as mout, websocket::{ BatchResponse, ModelingBatch, OkWebSocketResponseData, SuccessWebSocketResponse, WebSocketRequest, WebSocketResponse, @@ -71,7 +72,7 @@ impl crate::engine::EngineManager for EngineConnection { responses.insert( request.cmd_id, BatchResponse::Success { - response: OkModelingCmdResponse::Empty {}, + response: OkModelingCmdResponse::StartPath(mout::StartPath {}), }, ); } @@ -84,7 +85,7 @@ impl crate::engine::EngineManager for EngineConnection { _ => Ok(WebSocketResponse::Success(SuccessWebSocketResponse { request_id: Some(id), resp: OkWebSocketResponseData::Modeling { - modeling_response: OkModelingCmdResponse::Empty {}, + modeling_response: OkModelingCmdResponse::StartPath(mout::StartPath {}), }, success: true, })), diff --git a/src/wasm-lib/kcl/src/engine/mod.rs b/src/wasm-lib/kcl/src/engine/mod.rs index 900d717ec9..32838b72e9 100644 --- a/src/wasm-lib/kcl/src/engine/mod.rs +++ b/src/wasm-lib/kcl/src/engine/mod.rs @@ -160,7 +160,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static { // Return early if we have no commands to send. if all_requests.is_empty() { return Ok(OkWebSocketResponseData::Modeling { - modeling_response: OkModelingCmdResponse::Empty {}, + modeling_response: OkModelingCmdResponse::StartPath(kcmc::output::StartPath {}), }); }