From d6afb0630ed5d56cd6b78742ecba9161e5e96670 Mon Sep 17 00:00:00 2001 From: Ramon Iglesias Date: Wed, 24 Apr 2024 16:57:48 -0700 Subject: [PATCH 1/5] modifications to make it work with wasm --- .gitignore | 2 ++ Cargo.toml | 19 +++++++++++-------- src/lib.rs | 6 ++++++ src/sync/mod.rs | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f2f9e58 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 94e6f95..724488c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ proptest-derive = { optional = true, version = "0.4.0" } rand = { version = "0.8" } serde_json = { features = [ "float_roundtrip", "preserve_order" ], version = "1" } thiserror = { version = "1" } -tokio = { features = [ "full" ], version = "1" } +tokio = { optional = true, features = [ "sync" ], version = "1" } tokio-stream = { features = [ "io-util", "sync" ], version = "^0.1.8" } -tokio-tungstenite = { version = "0.20.0" } +tokio-tungstenite = { optional = true, version = "0.20.0" } tracing = { version = "0.1" } url = { version = "2" } uuid = { features = [ "serde", "v4" ], version = "1.6" } @@ -43,9 +43,12 @@ proptest-derive = { version = "0.4.0" } tracing-subscriber = { features = [ "env-filter" ], version = "0.3.17" } [features] -default = [ "native-tls" ] -native-tls = [ "tokio-tungstenite/native-tls" ] -native-tls-vendored = [ "tokio-tungstenite/native-tls-vendored" ] -rustls-tls-native-roots = [ "tokio-tungstenite/rustls-tls-native-roots" ] -rustls-tls-webpki-roots = [ "tokio-tungstenite/rustls-tls-webpki-roots" ] -testing = [ "convex_sync_types/testing", "proptest", "proptest-derive", "parking_lot" ] +default = [ "full", "native-tls" ] +native-tls = [ "full", "tokio-tungstenite/native-tls" ] +native-tls-vendored = [ "full", "tokio-tungstenite/native-tls-vendored" ] +rustls-tls-native-roots = [ "full", "tokio-tungstenite/rustls-tls-native-roots" ] +rustls-tls-webpki-roots = [ "full", "tokio-tungstenite/rustls-tls-webpki-roots" ] +testing = [ "full", "convex_sync_types/testing", "proptest", "proptest-derive", "parking_lot" ] +full = [ "full-client", "base-client" ] +full-client = [ "tokio-tungstenite", "tokio/full"] +base-client = ["tokio/sync"] \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index adeffed..d56196e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,7 +49,10 @@ pub use value::{ Value, }; +#[cfg(any(feature = "full-client"))] mod client; + +#[cfg(any(feature = "full-client"))] pub use client::{ subscription::{ QuerySetSubscription, @@ -58,7 +61,10 @@ pub use client::{ ConvexClient, }; +#[cfg(any(feature = "base-client"))] pub mod base_client; + +#[cfg(any(feature = "base-client"))] #[doc(inline)] pub use base_client::{ FunctionResult, diff --git a/src/sync/mod.rs b/src/sync/mod.rs index 177971d..c523aa6 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -10,6 +10,7 @@ use crate::value::Value; #[cfg(test)] pub mod testing; +#[cfg(any(feature = "full-client"))] pub mod web_socket_manager; /// Upon a protocol failure, an explanation of the failure to pass in on From 2370d9c0bbcc4ad5439e2c15c58e2ad79b959136 Mon Sep 17 00:00:00 2001 From: Ramon Iglesias Date: Wed, 24 Apr 2024 17:22:13 -0700 Subject: [PATCH 2/5] trying something --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d56196e..edf3b4c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,3 +73,6 @@ pub use base_client::{ }; mod sync; + + +pub use convex_sync_types; \ No newline at end of file From e53d9af58c6517e06fc04ff5617955b0a16d32a7 Mon Sep 17 00:00:00 2001 From: Ramon Iglesias Date: Wed, 24 Apr 2024 17:26:26 -0700 Subject: [PATCH 3/5] trying thigns --- src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index edf3b4c..0180bc7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,5 +74,8 @@ pub use base_client::{ mod sync; - -pub use convex_sync_types; \ No newline at end of file +mod convex_sync_types; +pub use convex_sync_types::{ + ClientMessage, + Timestamp, +}; \ No newline at end of file From 0dfd0a7f7490c2a4d5783f4a7d778a7a0a644a31 Mon Sep 17 00:00:00 2001 From: Ramon Iglesias Date: Wed, 24 Apr 2024 17:29:41 -0700 Subject: [PATCH 4/5] still trying --- src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0180bc7..fcbaee6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,8 +74,7 @@ pub use base_client::{ mod sync; -mod convex_sync_types; +pub mod convex_sync_types; pub use convex_sync_types::{ - ClientMessage, - Timestamp, + UdfPath, ServerMessage }; \ No newline at end of file From a1b59fc70a17fb9967f4753465ac2ea39e03f384 Mon Sep 17 00:00:00 2001 From: Ramon Iglesias Date: Wed, 24 Apr 2024 21:29:12 -0700 Subject: [PATCH 5/5] cleaned a bit --- src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fcbaee6..14d850d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,9 +72,4 @@ pub use base_client::{ SubscriberId, }; -mod sync; - -pub mod convex_sync_types; -pub use convex_sync_types::{ - UdfPath, ServerMessage -}; \ No newline at end of file +mod sync; \ No newline at end of file