Skip to content

Commit

Permalink
chore: bump collab that use yrs 0.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Oct 13, 2024
1 parent bbd21df commit 07d4010
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 37 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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 = []
Expand Down
8 changes: 4 additions & 4 deletions libs/client-api-test/src/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand All @@ -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(),
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions services/appflowy-worker/src/import_worker/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down
8 changes: 4 additions & 4 deletions src/biz/user/user_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()))?;

Expand Down
7 changes: 3 additions & 4 deletions src/biz/workspace/page_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 = {
Expand Down
8 changes: 4 additions & 4 deletions src/biz/workspace/publish_dup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 || {
Expand All @@ -220,12 +220,12 @@ impl PublishCollabDuplicator {
.map(|(database_id, view_ids)| (database_id, view_ids.into_iter().collect()))
.collect::<HashMap<_, _>>();

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| {
Expand Down
4 changes: 2 additions & 2 deletions tests/workspace/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 07d4010

Please sign in to comment.