diff --git a/Cargo.lock b/Cargo.lock index 48d119d41..6a43f46af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2232,7 +2232,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "arc-swap", @@ -2257,7 +2257,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "async-trait", @@ -2296,7 +2296,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "arc-swap", @@ -2317,7 +2317,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "bytes", @@ -2337,7 +2337,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "arc-swap", @@ -2359,7 +2359,7 @@ dependencies = [ [[package]] name = "collab-importer" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "async-recursion", @@ -2457,7 +2457,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=83c85320f74de9694f4f520580261c41e8b012a1#83c85320f74de9694f4f520580261c41e8b012a1" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=8987e035accc81bd5ca0acc9812da8e4c6023eba#8987e035accc81bd5ca0acc9812da8e4c6023eba" dependencies = [ "anyhow", "collab", @@ -8541,9 +8541,9 @@ dependencies = [ [[package]] name = "yrs" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fc56b25e3aaf4b81a73f2a9a68ceae1e02d9005552e24058cfb9f96db73f33" +checksum = "7744baf8d4f74beba8f47ca3a611c512766c82023f271167b14d21216559b014" dependencies = [ "arc-swap", "async-lock", diff --git a/Cargo.toml b/Cargo.toml index ac2b8e83c..89bcfcc58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -272,7 +272,7 @@ pgvector = { version = "0.4", features = ["sqlx"] } client-api-entity = { path = "libs/client-api-entity" } # collaboration -yrs = { version = "0.21.0", features = ["sync"] } +yrs = { version = "0.21.2", features = ["sync"] } collab = { version = "0.2.0" } collab-entity = { version = "0.2.0" } collab-folder = { version = "0.2.0" } @@ -293,13 +293,13 @@ debug = true [patch.crates-io] # It's diffcult to resovle different version with the same crate used in AppFlowy Frontend and the Client-API crate. # So using patch to workaround this issue. -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } -collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } -collab-importer = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "83c85320f74de9694f4f520580261c41e8b012a1" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } +collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } +collab-importer = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "8987e035accc81bd5ca0acc9812da8e4c6023eba" } [features] history = [] diff --git a/libs/client-api-test/src/test_client.rs b/libs/client-api-test/src/test_client.rs index 4c16b81ac..45b3932fe 100644 --- a/libs/client-api-test/src/test_client.rs +++ b/libs/client-api-test/src/test_client.rs @@ -14,7 +14,7 @@ use collab::entity::EncodedCollab; use collab::lock::{Mutex, RwLock}; use collab::preclude::{Collab, Prelim}; use collab_database::database::{Database, DatabaseContext}; -use collab_database::workspace_database::WorkspaceDatabaseBody; +use collab_database::workspace_database::WorkspaceDatabase; use collab_document::document::Document; use collab_entity::CollabType; use collab_folder::Folder; @@ -168,7 +168,7 @@ impl TestClient { Document::open(collab).unwrap() } - pub async fn get_workspace_database(&self, workspace_id: &str) -> WorkspaceDatabaseBody { + pub async fn get_workspace_database(&self, workspace_id: &str) -> WorkspaceDatabase { let workspaces = self.api_client.get_workspaces().await.unwrap(); let workspace_database_id = workspaces .iter() @@ -187,7 +187,7 @@ impl TestClient { .await .unwrap(); - WorkspaceDatabaseBody::from_collab_doc_state( + WorkspaceDatabase::from_collab_doc_state( &workspace_database_id, CollabOrigin::Empty, collab.encode_collab.into(), @@ -287,7 +287,7 @@ impl TestClient { pub async fn get_db_collab_from_view(&mut self, workspace_id: &str, view_id: &str) -> Collab { let ws_db_collab = self.get_workspace_database_collab(workspace_id).await; - let ws_db_body = WorkspaceDatabaseBody::open(ws_db_collab).unwrap(); + let ws_db_body = WorkspaceDatabase::open(ws_db_collab).unwrap(); let db_id = ws_db_body .get_all_database_meta() .into_iter() diff --git a/services/appflowy-worker/src/import_worker/worker.rs b/services/appflowy-worker/src/import_worker/worker.rs index 081ca4676..89ba1b97b 100644 --- a/services/appflowy-worker/src/import_worker/worker.rs +++ b/services/appflowy-worker/src/import_worker/worker.rs @@ -8,7 +8,7 @@ use aws_sdk_s3::primitives::ByteStream; use bytes::Bytes; use collab::core::origin::CollabOrigin; use collab::entity::EncodedCollab; -use collab_database::workspace_database::WorkspaceDatabaseBody; +use collab_database::workspace_database::WorkspaceDatabase; use collab_entity::CollabType; use collab_folder::Folder; use collab_importer::imported_collab::ImportType; @@ -449,7 +449,7 @@ async fn process_unzip_file( if !database_view_ids_by_database_id.is_empty() { let w_db_collab = get_encode_collab_from_bytes(&w_database_id, &CollabType::WorkspaceDatabase, pg_pool).await?; - let mut w_database = WorkspaceDatabaseBody::from_collab_doc_state( + let mut w_database = WorkspaceDatabase::from_collab_doc_state( &w_database_id, CollabOrigin::Server, w_db_collab.into(), diff --git a/src/biz/user/user_init.rs b/src/biz/user/user_init.rs index 5c46b8fbb..d16ee3804 100644 --- a/src/biz/user/user_init.rs +++ b/src/biz/user/user_init.rs @@ -4,7 +4,7 @@ use app_error::AppError; use appflowy_collaborate::collab::storage::CollabAccessControlStorage; use collab::core::origin::CollabOrigin; use collab::preclude::Collab; -use collab_database::workspace_database::WorkspaceDatabaseBody; +use collab_database::workspace_database::WorkspaceDatabase; use collab_entity::CollabType; use collab_folder::{Folder, FolderData, Workspace}; use collab_user::core::UserAwareness; @@ -197,11 +197,11 @@ pub(crate) async fn create_workspace_database_collab( ) -> Result<(), AppError> { let collab_type = CollabType::WorkspaceDatabase; let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false); - let mut workspace_database_body = WorkspaceDatabaseBody::create(collab); + let mut workspace_database = WorkspaceDatabase::create(collab); for (object_id, database_id) in initial_database_records { - workspace_database_body.add_database(&database_id, vec![object_id]); + workspace_database.add_database(&database_id, vec![object_id]); } - let encode_collab = workspace_database_body + let encode_collab = workspace_database .encode_collab_v1() .map_err(|err| AppError::Internal(err.into()))?; diff --git a/src/biz/workspace/page_view.rs b/src/biz/workspace/page_view.rs index 69ed3d535..cee0e93f6 100644 --- a/src/biz/workspace/page_view.rs +++ b/src/biz/workspace/page_view.rs @@ -3,9 +3,8 @@ use app_error::{AppError, ErrorCode}; use appflowy_collaborate::collab::storage::CollabAccessControlStorage; use chrono::DateTime; use collab::core::collab::Collab; -use collab_database::{ - database::DatabaseBody, rows::RowId, workspace_database::WorkspaceDatabaseBody, -}; +use collab_database::workspace_database::WorkspaceDatabase; +use collab_database::{database::DatabaseBody, rows::RowId}; use collab_entity::{CollabType, EncodedCollab}; use collab_folder::CollabOrigin; use database::collab::{select_workspace_database_oid, CollabStorage, GetCollabOrigin}; @@ -132,7 +131,7 @@ async fn get_page_collab_data_for_database( ) .await?; let ws_db_collab = collab_from_doc_state(ws_db.doc_state.to_vec(), &ws_db_oid)?; - let ws_db_body = WorkspaceDatabaseBody::open(ws_db_collab).map_err(|err| { + let ws_db_body = WorkspaceDatabase::open(ws_db_collab).map_err(|err| { AppError::Internal(anyhow!("Failed to open workspace database body: {}", err)) })?; let db_oid = { diff --git a/src/biz/workspace/publish_dup.rs b/src/biz/workspace/publish_dup.rs index d9daafe96..d61920bc1 100644 --- a/src/biz/workspace/publish_dup.rs +++ b/src/biz/workspace/publish_dup.rs @@ -14,7 +14,7 @@ use collab_database::rows::RowMetaKey; use collab_database::rows::CELL_FIELD_TYPE; use collab_database::rows::ROW_CELLS; use collab_database::template::entity::CELL_DATA; -use collab_database::workspace_database::WorkspaceDatabaseBody; +use collab_database::workspace_database::WorkspaceDatabase; use collab_document::blocks::DocumentData; use collab_document::document::Document; use collab_entity::CollabType; @@ -210,7 +210,7 @@ impl PublishCollabDuplicator { collab_from_doc_state(ws_database_ec.doc_state.to_vec(), &ws_db_oid)? }; - let mut ws_db_body = WorkspaceDatabaseBody::open(ws_db_collab).map_err(|err| { + let mut ws_db = WorkspaceDatabase::open(ws_db_collab).map_err(|err| { AppError::Unhandled(format!("failed to open workspace database: {}", err)) })?; let (ws_db_updates, updated_ws_w_db_collab) = tokio::task::spawn_blocking(move || { @@ -220,12 +220,12 @@ impl PublishCollabDuplicator { .map(|(database_id, view_ids)| (database_id, view_ids.into_iter().collect())) .collect::>(); - ws_db_body + ws_db .batch_add_database(view_ids_by_database_id) .encode_update_v1() }; - let updated_ws_w_db_collab = ws_db_body + let updated_ws_w_db_collab = ws_db .encode_collab_v1() .map(|encoded_collab| encoded_collab.encode_to_bytes().unwrap()) .map_err(|err| { diff --git a/tests/workspace/publish.rs b/tests/workspace/publish.rs index 39f801e7d..650daeb20 100644 --- a/tests/workspace/publish.rs +++ b/tests/workspace/publish.rs @@ -9,7 +9,7 @@ use collab_database::database::DatabaseBody; use collab_database::entity::FieldType; use collab_database::rows::RowDetail; use collab_database::views::DatabaseViews; -use collab_database::workspace_database::WorkspaceDatabaseBody; +use collab_database::workspace_database::WorkspaceDatabase; use collab_document::document::Document; use collab_entity::CollabType; use collab_folder::{CollabOrigin, Folder, UserId}; @@ -893,7 +893,7 @@ async fn duplicate_to_workspace_doc_inline_database() { let ws_db_collab = client_2 .get_workspace_database_collab(&workspace_id_2) .await; - let ws_db_body = WorkspaceDatabaseBody::open(ws_db_collab).unwrap(); + let ws_db_body = WorkspaceDatabase::open(ws_db_collab).unwrap(); let dup_grid1_db_id = ws_db_body .get_all_database_meta() .into_iter()