feat: calling user event from web (#4535)

* refactor: user manager

* refactor: user manager

* refactor: session location

* refactor: user manager

* chore: gen ts files

* feat: implement indexeddb persistence

* chore: integrate user manager

* chore: update

* chore: run on web thread

* chore: run on web thread

* chore: fix test

* chore: add test

* chore: add test

* chore: add user & sign in with password

* chore: fix test

* chore: update docs

* chore: fix warnings

* chore: gen files

* chore: add user

* chore: add files

* chore: update config

* chore: update scirpt

* chore: update scirpt

* fix: build

* chore: update command

* fix: ci

* ci: fix

* fix: compile

* fix: compile

* fix: ci

* fix: compile

* fix: tauri build

* chore: fix test

* chore: fix test
This commit is contained in:
Nathan.fooo
2024-01-30 05:36:27 +08:00
committed by GitHub
parent 86a0569d84
commit 55c97b56a3
164 changed files with 9334 additions and 2885 deletions

View File

@ -36,15 +36,16 @@ client-api = { version = "0.1.0", optional = true }
impl_from_dispatch_error = ["lib-dispatch"]
impl_from_serde = []
impl_from_reqwest = ["reqwest"]
impl_from_collab_persistence = ["collab-plugins"]
impl_from_collab_document = ["collab-document", "impl_from_reqwest", "collab-plugins"]
impl_from_collab_database= ["collab-database"]
impl_from_url = ["url"]
wasm_build = ["lib-dispatch/wasm_build"]
impl_from_sqlite = ["flowy-sqlite", "r2d2"]
impl_from_appflowy_cloud = ["client-api"]
dart = ["flowy-codegen/dart"]
ts = ["flowy-codegen/ts"]
tauri_ts = ["flowy-codegen/ts"]
web_ts = ["flowy-codegen/ts"]
[build-dependencies]
flowy-codegen = { workspace = true, features = [

View File

@ -1,3 +1,15 @@
fn main() {
flowy_codegen::protobuf_file::gen("flowy-error");
#[cfg(feature = "dart")]
flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));
#[cfg(feature = "tauri_ts")]
flowy_codegen::protobuf_file::ts_gen(env!("CARGO_PKG_NAME"), flowy_codegen::Project::Tauri);
#[cfg(feature = "web_ts")]
flowy_codegen::protobuf_file::ts_gen(
env!("CARGO_PKG_NAME"),
flowy_codegen::Project::Web {
relative_path: "../../".to_string(),
},
);
}

View File

@ -1,28 +1,10 @@
use crate::FlowyError;
#[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 {

View File

@ -0,0 +1,17 @@
use crate::{ErrorCode, FlowyError};
#[cfg(feature = "impl_from_collab_persistence")]
use collab_plugins::local_storage::kv::PersistenceError;
#[cfg(feature = "impl_from_collab_persistence")]
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),
}
}
}

View File

@ -16,7 +16,11 @@ pub mod database;
#[cfg(feature = "impl_from_collab_document")]
pub mod collab;
#[cfg(feature = "impl_from_collab_persistence")]
mod collab_persistence;
#[cfg(feature = "impl_from_appflowy_cloud")]
mod cloud;
#[cfg(feature = "impl_from_url")]
mod url;