From b589b1f00d9993d7779b7479e6aa4f91009d40a0 Mon Sep 17 00:00:00 2001 From: Sergey Tatarintsev Date: Thu, 23 Nov 2023 14:33:33 +0100 Subject: [PATCH] Cleanup --- Cargo.lock | 1 - query-engine/driver-adapters/Cargo.toml | 1 - .../driver-adapters/src/wasm/async_js_function.rs | 13 +++---------- query-engine/driver-adapters/src/wasm/error.rs | 1 - query-engine/driver-adapters/src/wasm/result.rs | 6 +----- .../driver-adapters/src/wasm/transaction.rs | 7 +------ 6 files changed, 5 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a80d864b6ca..4d3e4de66ccb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,7 +1117,6 @@ dependencies = [ "uuid", "wasm-bindgen", "wasm-bindgen-futures", - "web-sys", ] [[package]] diff --git a/query-engine/driver-adapters/Cargo.toml b/query-engine/driver-adapters/Cargo.toml index 23244ab7dcb4..86d063603ed7 100644 --- a/query-engine/driver-adapters/Cargo.toml +++ b/query-engine/driver-adapters/Cargo.toml @@ -20,7 +20,6 @@ num-bigint = "0.4.3" bigdecimal = "0.3.0" chrono = "0.4.20" futures = "0.3" -web-sys = "0.3.65" [dev-dependencies] expect-test = "1" diff --git a/query-engine/driver-adapters/src/wasm/async_js_function.rs b/query-engine/driver-adapters/src/wasm/async_js_function.rs index e13f288f4a56..fe64847b5b1e 100644 --- a/query-engine/driver-adapters/src/wasm/async_js_function.rs +++ b/query-engine/driver-adapters/src/wasm/async_js_function.rs @@ -1,7 +1,6 @@ -use js_sys::{Function as JsFunction, JsString, Promise as JsPromise}; +use js_sys::{Function as JsFunction, Promise as JsPromise}; use serde::Serialize; use std::marker::PhantomData; -use std::str::FromStr; use wasm_bindgen::convert::FromWasmAbi; use wasm_bindgen::describe::WasmDescribe; use wasm_bindgen::{JsError, JsValue}; @@ -46,14 +45,8 @@ where let result = self.call_internal(arg1).await; match result { - Ok(js_result) => { - web_sys::console::log_1(&JsString::from_str("OK JS").unwrap().into()); - js_result.into() - } - Err(err) => { - web_sys::console::log_1(&JsString::from_str("CALL ERR").unwrap().into()); - Err(into_quaint_error(err)) - } + Ok(js_result) => js_result.into(), + Err(err) => Err(into_quaint_error(err)), } } diff --git a/query-engine/driver-adapters/src/wasm/error.rs b/query-engine/driver-adapters/src/wasm/error.rs index 49d7ad6cf440..0aa4fe7981f2 100644 --- a/query-engine/driver-adapters/src/wasm/error.rs +++ b/query-engine/driver-adapters/src/wasm/error.rs @@ -5,7 +5,6 @@ use wasm_bindgen::JsValue; /// transforms a Wasm error into a Quaint error pub(crate) fn into_quaint_error(wasm_err: JsValue) -> QuaintError { let status = "WASM_ERROR".to_string(); - web_sys::console::log_1(&wasm_err); let reason = Reflect::get(&wasm_err, &JsValue::from_str("stack")) .ok() .and_then(|value| value.as_string()) diff --git a/query-engine/driver-adapters/src/wasm/result.rs b/query-engine/driver-adapters/src/wasm/result.rs index fc5115e4a500..2e656a205c41 100644 --- a/query-engine/driver-adapters/src/wasm/result.rs +++ b/query-engine/driver-adapters/src/wasm/result.rs @@ -1,6 +1,4 @@ -use std::str::FromStr; - -use js_sys::{Boolean as JsBoolean, JsString}; +use js_sys::Boolean as JsBoolean; use quaint::error::{Error as QuaintError, ErrorKind}; use wasm_bindgen::{JsCast, JsValue}; @@ -46,9 +44,7 @@ where if ok { let js_value: JsValue = object.get("value".into())?; - web_sys::console::log_1(&JsString::from_str("BEFORE DESERIALIZE").unwrap().into()); let deserialized = T::from_js_value(js_value)?; - web_sys::console::log_1(&JsString::from_str(" DESERIALIZE").unwrap().into()); return Ok(Self::Ok(deserialized)); } diff --git a/query-engine/driver-adapters/src/wasm/transaction.rs b/query-engine/driver-adapters/src/wasm/transaction.rs index d1b93bd4bfd0..b9eac2965e48 100644 --- a/query-engine/driver-adapters/src/wasm/transaction.rs +++ b/query-engine/driver-adapters/src/wasm/transaction.rs @@ -1,12 +1,11 @@ use async_trait::async_trait; -use js_sys::{JsString, Object as JsObject}; +use js_sys::Object as JsObject; use metrics::decrement_gauge; use quaint::{ connector::{IsolationLevel, Transaction as QuaintTransaction}, prelude::{Query as QuaintQuery, Queryable, ResultSet}, Value, }; -use std::str::FromStr; use wasm_bindgen::JsCast; use super::{ @@ -41,13 +40,9 @@ impl JsTransaction { impl FromJsValue for JsTransaction { fn from_js_value(value: wasm_bindgen::prelude::JsValue) -> Result { let object: JsObjectExtern = value.dyn_into::()?.unchecked_into(); - web_sys::console::log_1(&JsString::from_str("OBJECT").unwrap().into()); let common_proxy = CommonProxy::new(&object)?; - web_sys::console::log_1(&JsString::from_str("PROXY").unwrap().into()); let base = JsBaseQueryable::new(common_proxy); - web_sys::console::log_1(&JsString::from_str("BASE").unwrap().into()); let tx_proxy = TransactionProxy::new(&object)?; - web_sys::console::log_1(&JsString::from_str("TX_PROXY").unwrap().into()); Ok(Self::new(base, tx_proxy)) }