feat: wasm build (#4412)

* chore: enable wasm build

* chore: bump collab

* chore: fix build

* chore: flowy-document wasm

* chore: fix compile

* chore: fix compile

* chore: fix compile

* chore: fix compile

* chore: fix ci

* chore: fix ci

* chore: fix ci
This commit is contained in:
Nathan.fooo
2024-01-22 13:34:15 +08:00
committed by GitHub
parent c4acba8216
commit 90516b6adc
43 changed files with 555 additions and 316 deletions

View File

@ -1,25 +1,36 @@
#[cfg(feature = "impl_from_collab_database")]
use collab_database::error::DatabaseError;
#[cfg(feature = "impl_from_collab_document")]
use collab_document::error::DocumentError;
#[cfg(feature = "impl_from_collab_document")]
use collab_plugins::local_storage::kv::PersistenceError;
use crate::{ErrorCode, FlowyError};
#[cfg(feature = "impl_from_collab_document")]
impl From<PersistenceError> for FlowyError {
fn from(err: PersistenceError) -> Self {
match err {
PersistenceError::UnexpectedEmptyUpdates => FlowyError::new(ErrorCode::RecordNotFound, err),
#[cfg(not(target_arch = "wasm32"))]
PersistenceError::RocksdbCorruption(_) => FlowyError::new(ErrorCode::RocksdbCorruption, err),
#[cfg(not(target_arch = "wasm32"))]
PersistenceError::RocksdbIOError(_) => FlowyError::new(ErrorCode::RocksdbIOError, err),
_ => FlowyError::new(ErrorCode::RocksdbInternal, err),
}
}
}
#[cfg(feature = "impl_from_collab_database")]
impl From<DatabaseError> for FlowyError {
fn from(error: DatabaseError) -> Self {
FlowyError::internal().with_context(error)
}
}
#[cfg(feature = "impl_from_collab_document")]
impl From<DocumentError> for FlowyError {
fn from(error: DocumentError) -> Self {
FlowyError::internal().with_context(error)

View File

@ -13,12 +13,9 @@ pub mod reqwest;
#[cfg(feature = "impl_from_sqlite")]
pub mod database;
#[cfg(feature = "impl_from_collab")]
#[cfg(feature = "impl_from_collab_document")]
pub mod collab;
#[cfg(feature = "impl_from_postgres")]
mod postgres;
#[cfg(feature = "impl_from_appflowy_cloud")]
mod cloud;
#[cfg(feature = "impl_from_url")]

View File

@ -1,7 +0,0 @@
use crate::FlowyError;
impl std::convert::From<tokio_postgres::Error> for FlowyError {
fn from(error: tokio_postgres::Error) -> Self {
FlowyError::internal().with_context(error)
}
}