diff --git a/Cargo.lock b/Cargo.lock index 7cf24af0f..b9db35bbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1311,24 +1311,6 @@ dependencies = [ "time", ] -[[package]] -name = "diesel-wasm-sqlite" -version = "0.0.1" -source = "git+https://github.com/xmtp/sqlite-web-rs?branch=main#7f0f938aa4d49ed7bfe5624d086e7f6583805419" -dependencies = [ - "diesel", - "diesel_derives", - "js-sys", - "serde", - "serde-wasm-bindgen", - "talc", - "thiserror 2.0.6", - "tokio", - "tracing", - "wasm-bindgen", - "wasm-bindgen-futures", -] - [[package]] name = "diesel_derives" version = "2.2.0" @@ -5512,6 +5494,24 @@ dependencies = [ "der 0.7.9", ] +[[package]] +name = "sqlite-web" +version = "0.0.1" +source = "git+https://github.com/xmtp/sqlite-web-rs?branch=main#0aa53058cbf3a1044e79cb6dd68a91c857308059" +dependencies = [ + "diesel", + "diesel_derives", + "js-sys", + "serde", + "serde-wasm-bindgen", + "talc", + "thiserror 2.0.6", + "tokio", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -7401,7 +7401,6 @@ dependencies = [ "criterion", "ctor", "diesel", - "diesel-wasm-sqlite", "diesel_migrations", "dyn-clone", "ethers", @@ -7430,6 +7429,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", + "sqlite-web", "tempfile", "thiserror 2.0.6", "tls_codec", diff --git a/Cargo.toml b/Cargo.toml index 0dde776cf..2af2e6f26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ members = [ "xtask", "xmtp_debug", "xmtp_content_types", - "common" + "common", ] # Make the feature resolver explicit. @@ -75,7 +75,6 @@ bincode = "1.3" console_error_panic_hook = "0.1" const_format = "0.2" diesel = { version = "2.2", default-features = false } -diesel-wasm-sqlite = "0.0.1" diesel_migrations = { version = "2.2", default-features = false } dyn-clone = "1" fdlimit = "0.3" @@ -87,6 +86,7 @@ libsqlite3-sys = { version = "0.29", features = [ openssl = { version = "0.10", features = ["vendored"] } openssl-sys = { version = "0.9", features = ["vendored"] } parking_lot = "0.12.3" +sqlite-web = "0.0.1" tonic = { version = "0.12", default-features = false } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3", default-features = false } @@ -100,12 +100,12 @@ zeroize = "1.8" # Internal Crate Dependencies xmtp_api_grpc = { path = "xmtp_api_grpc" } +xmtp_common = { path = "common" } +xmtp_content_types = { path = "xmtp_content_types" } xmtp_cryptography = { path = "xmtp_cryptography" } xmtp_id = { path = "xmtp_id" } xmtp_mls = { path = "xmtp_mls" } xmtp_proto = { path = "xmtp_proto" } -xmtp_content_types = { path = "xmtp_content_types" } -xmtp_common = { path = "common" } [profile.dev] # Disabling debug info speeds up builds a bunch, @@ -147,6 +147,6 @@ opt-level = "s" # (cfg-specific patche support does not exist) [patch.crates-io] diesel = { git = "https://github.com/diesel-rs/diesel", branch = "master" } -diesel-wasm-sqlite = { git = "https://github.com/xmtp/sqlite-web-rs", branch = "main" } diesel_derives = { git = "https://github.com/diesel-rs/diesel", branch = "master" } diesel_migrations = { git = "https://github.com/diesel-rs/diesel", branch = "master" } +sqlite-web = { git = "https://github.com/xmtp/sqlite-web-rs", branch = "main" } diff --git a/xmtp_mls/Cargo.toml b/xmtp_mls/Cargo.toml index ef9d49670..9a524420d 100644 --- a/xmtp_mls/Cargo.toml +++ b/xmtp_mls/Cargo.toml @@ -40,7 +40,7 @@ test-utils = [ "xmtp_api_grpc/test-utils", "dep:const_format", "mockall", - "xmtp_common/test-utils" + "xmtp_common/test-utils", ] update-schema = ["toml"] @@ -69,8 +69,8 @@ tokio-stream = { version = "0.1", default-features = false, features = [ ] } tracing.workspace = true trait-variant.workspace = true -zeroize.workspace = true xmtp_common.workspace = true +zeroize.workspace = true # XMTP/Local xmtp_content_types = { path = "../xmtp_content_types" } @@ -133,10 +133,10 @@ diesel = { workspace = true, features = [ "r2d2", "returning_clauses_for_sqlite_3_35", ] } -diesel-wasm-sqlite = { workspace = true } getrandom = { workspace = true, features = ["js"] } gloo-timers = { workspace = true, features = ["futures"] } openmls = { workspace = true, features = ["js"] } +sqlite-web = { workspace = true } tokio = { workspace = true, features = ["macros", "rt", "time"] } wasm-bindgen-futures.workspace = true web-sys.workspace = true @@ -147,10 +147,10 @@ anyhow.workspace = true const_format.workspace = true mockall = "0.13.1" openmls_basic_credential.workspace = true +wasm-bindgen-test.workspace = true +xmtp_common = { workspace = true, features = ["test-utils"] } xmtp_id = { path = "../xmtp_id", features = ["test-utils"] } xmtp_proto = { workspace = true, features = ["test-utils"] } -xmtp_common = { workspace = true, features = ["test-utils"]} -wasm-bindgen-test.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] ctor.workspace = true @@ -169,12 +169,9 @@ xmtp_api_http = { path = "../xmtp_api_http", features = ["test-utils"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] console_error_panic_hook = { version = "0.1" } -diesel-wasm-sqlite = { workspace = true, features = [ - "unsafe-debug-query", - "r2d2", -] } ethers = { workspace = true, features = ["rustls"] } openmls = { workspace = true, features = ["js"] } +sqlite-web = { workspace = true, features = ["unsafe-debug-query", "r2d2"] } tracing-subscriber = { workspace = true, features = ["env-filter", "json"] } tracing-wasm = { version = "0.2" } wasm-bindgen-test.workspace = true diff --git a/xmtp_mls/src/storage/encrypted_store/db_connection.rs b/xmtp_mls/src/storage/encrypted_store/db_connection.rs index d0ef3942a..078892e0a 100644 --- a/xmtp_mls/src/storage/encrypted_store/db_connection.rs +++ b/xmtp_mls/src/storage/encrypted_store/db_connection.rs @@ -7,7 +7,7 @@ use std::sync::Arc; pub type DbConnection = DbConnectionPrivate; #[cfg(target_arch = "wasm32")] -pub type DbConnection = DbConnectionPrivate; +pub type DbConnection = DbConnectionPrivate; /// A wrapper for RawDbConnection that houses all XMTP DB operations. /// Uses a [`Mutex]` internally for interior mutability, so that the connection diff --git a/xmtp_mls/src/storage/encrypted_store/identity_update.rs b/xmtp_mls/src/storage/encrypted_store/identity_update.rs index 1c5c6b564..0a0c87b0a 100644 --- a/xmtp_mls/src/storage/encrypted_store/identity_update.rs +++ b/xmtp_mls/src/storage/encrypted_store/identity_update.rs @@ -9,7 +9,7 @@ use super::{ use diesel::{dsl::max, prelude::*}; #[cfg(target_arch = "wasm32")] -use diesel_wasm_sqlite::dsl::RunQueryDsl; +use sqlite_web::dsl::RunQueryDsl; use xmtp_id::associations::{unverified::UnverifiedIdentityUpdate, AssociationError}; diff --git a/xmtp_mls/src/storage/encrypted_store/mod.rs b/xmtp_mls/src/storage/encrypted_store/mod.rs index c7172dd5b..bf6d0a633 100644 --- a/xmtp_mls/src/storage/encrypted_store/mod.rs +++ b/xmtp_mls/src/storage/encrypted_store/mod.rs @@ -42,9 +42,7 @@ pub use sqlcipher_connection::EncryptedConnection; #[cfg(target_arch = "wasm32")] pub use self::wasm::SqliteConnection; #[cfg(target_arch = "wasm32")] -pub use diesel_wasm_sqlite::{ - connection::WasmSqliteConnection as RawDbConnection, WasmSqlite as Sqlite, -}; +pub use sqlite_web::{connection::WasmSqliteConnection as RawDbConnection, WasmSqlite as Sqlite}; use super::StorageError; use crate::{xmtp_openmls_provider::XmtpOpenMlsProviderPrivate, Store}; diff --git a/xmtp_mls/src/storage/encrypted_store/wallet_addresses.rs b/xmtp_mls/src/storage/encrypted_store/wallet_addresses.rs index 42e17f02f..4f13cd184 100644 --- a/xmtp_mls/src/storage/encrypted_store/wallet_addresses.rs +++ b/xmtp_mls/src/storage/encrypted_store/wallet_addresses.rs @@ -3,9 +3,9 @@ use crate::storage::{DbConnection, StorageError}; use crate::{impl_fetch, impl_fetch_list_with_key, impl_store, FetchListWithKey}; use diesel::prelude::*; use diesel::{Insertable, Queryable}; -#[cfg(target_arch = "wasm32")] -use diesel_wasm_sqlite::dsl::RunQueryDsl; use serde::{Deserialize, Serialize}; +#[cfg(target_arch = "wasm32")] +use sqlite_web::dsl::RunQueryDsl; use xmtp_id::{InboxId, WalletAddress}; #[derive(Insertable, Queryable, Debug, Clone, Deserialize, Serialize)] diff --git a/xmtp_mls/src/storage/encrypted_store/wasm.rs b/xmtp_mls/src/storage/encrypted_store/wasm.rs index 7cbc05fc0..e2f223161 100644 --- a/xmtp_mls/src/storage/encrypted_store/wasm.rs +++ b/xmtp_mls/src/storage/encrypted_store/wasm.rs @@ -3,8 +3,8 @@ use std::sync::Arc; use diesel::{connection::AnsiTransactionManager, prelude::*}; -pub use diesel_wasm_sqlite::connection::WasmSqliteConnection as SqliteConnection; use parking_lot::Mutex; +pub use sqlite_web::connection::WasmSqliteConnection as SqliteConnection; use super::{db_connection::DbConnectionPrivate, StorageError, StorageOption, XmtpDb}; @@ -26,7 +26,7 @@ impl std::fmt::Debug for WasmDb { impl WasmDb { pub async fn new(opts: &StorageOption) -> Result { use super::StorageOption::*; - diesel_wasm_sqlite::init_sqlite().await; + sqlite_web::init_sqlite().await; let conn = match opts { Ephemeral => SqliteConnection::establish(":memory:"), Persistent(ref db_path) => SqliteConnection::establish(db_path), diff --git a/xmtp_mls/src/storage/mod.rs b/xmtp_mls/src/storage/mod.rs index d3c525897..f8ce9357c 100644 --- a/xmtp_mls/src/storage/mod.rs +++ b/xmtp_mls/src/storage/mod.rs @@ -9,7 +9,7 @@ pub use errors::*; /// Initialize the SQLite WebAssembly Library #[cfg(target_arch = "wasm32")] pub async fn init_sqlite() { - diesel_wasm_sqlite::init_sqlite().await; + sqlite_web::init_sqlite().await; } #[cfg(not(target_arch = "wasm32"))] pub async fn init_sqlite() {}