chore: update dep

This commit is contained in:
Zack Fu Zi Xiang 2024-09-13 14:51:15 +08:00
parent def42240ae
commit df66cfc6f4
No known key found for this signature in database
5 changed files with 53 additions and 57 deletions

12
Cargo.lock generated
View File

@ -2092,7 +2092,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=249ddc712757782117b383ad16beb7c90f5640ec#249ddc712757782117b383ad16beb7c90f5640ec"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=be973c5fa1dcb8872ff3ba021de748d98be26b89#be973c5fa1dcb8872ff3ba021de748d98be26b89"
dependencies = [
"anyhow",
"arc-swap",
@ -2117,7 +2117,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=249ddc712757782117b383ad16beb7c90f5640ec#249ddc712757782117b383ad16beb7c90f5640ec"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=be973c5fa1dcb8872ff3ba021de748d98be26b89#be973c5fa1dcb8872ff3ba021de748d98be26b89"
dependencies = [
"anyhow",
"async-trait",
@ -2148,7 +2148,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=249ddc712757782117b383ad16beb7c90f5640ec#249ddc712757782117b383ad16beb7c90f5640ec"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=be973c5fa1dcb8872ff3ba021de748d98be26b89#be973c5fa1dcb8872ff3ba021de748d98be26b89"
dependencies = [
"anyhow",
"arc-swap",
@ -2168,7 +2168,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=249ddc712757782117b383ad16beb7c90f5640ec#249ddc712757782117b383ad16beb7c90f5640ec"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=be973c5fa1dcb8872ff3ba021de748d98be26b89#be973c5fa1dcb8872ff3ba021de748d98be26b89"
dependencies = [
"anyhow",
"bytes",
@ -2187,7 +2187,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=249ddc712757782117b383ad16beb7c90f5640ec#249ddc712757782117b383ad16beb7c90f5640ec"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=be973c5fa1dcb8872ff3ba021de748d98be26b89#be973c5fa1dcb8872ff3ba021de748d98be26b89"
dependencies = [
"anyhow",
"arc-swap",
@ -2272,7 +2272,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=249ddc712757782117b383ad16beb7c90f5640ec#249ddc712757782117b383ad16beb7c90f5640ec"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=be973c5fa1dcb8872ff3ba021de748d98be26b89#be973c5fa1dcb8872ff3ba021de748d98be26b89"
dependencies = [
"anyhow",
"collab",

View File

@ -288,12 +288,12 @@ 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 = "249ddc712757782117b383ad16beb7c90f5640ec" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "249ddc712757782117b383ad16beb7c90f5640ec" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "249ddc712757782117b383ad16beb7c90f5640ec" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "249ddc712757782117b383ad16beb7c90f5640ec" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "249ddc712757782117b383ad16beb7c90f5640ec" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "249ddc712757782117b383ad16beb7c90f5640ec" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "be973c5fa1dcb8872ff3ba021de748d98be26b89" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "be973c5fa1dcb8872ff3ba021de748d98be26b89" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "be973c5fa1dcb8872ff3ba021de748d98be26b89" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "be973c5fa1dcb8872ff3ba021de748d98be26b89" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "be973c5fa1dcb8872ff3ba021de748d98be26b89" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "be973c5fa1dcb8872ff3ba021de748d98be26b89" }
[features]
history = []

View File

@ -271,6 +271,12 @@ impl From<crate::gotrue::GoTrueError> for AppError {
}
}
impl From<String> for AppError {
fn from(err: String) -> Self {
AppError::Unhandled(err)
}
}
#[cfg_attr(target_arch = "wasm32", derive(tsify::Tsify))]
#[derive(
Eq,

View File

@ -216,12 +216,6 @@ where
.is_destroyed
.store(true, std::sync::atomic::Ordering::SeqCst);
}
fn init(&self, _object_id: &str, _origin: &CollabOrigin, _doc: &yrs::Doc) {}
fn receive_update(&self, _object_id: &str, _txn: &yrs::TransactionMut, _update: &[u8]) {}
fn after_transaction(&self, _object_id: &str, _txn: &mut yrs::TransactionMut) {}
}
#[derive(Clone, Debug)]

View File

@ -11,7 +11,6 @@ use collab_database::rows::RowId;
use collab_database::rows::RowMetaKey;
use collab_database::rows::CELL_FIELD_TYPE;
use collab_database::rows::ROW_CELLS;
use collab_database::rows::ROW_DATABASE_ID;
use collab_database::template::entity::CELL_DATA;
use collab_database::workspace_database::WorkspaceDatabaseBody;
use collab_document::blocks::DocumentData;
@ -751,50 +750,47 @@ impl PublishCollabDuplicator {
{
let mut txn = db_row_collab.context.transact_mut();
// update database_id
db_row_body
.get_data()
.insert(&mut txn, ROW_DATABASE_ID, new_db_id.clone());
db_row_body.update(&mut txn, |u| {
u.set_database_id(new_db_id.clone());
});
// handle document in database row
match db_row_body.has_document(&txn) {
Ok(has_doc) => {
if has_doc {
let pub_row_doc_id =
meta_id_from_row_id(&pub_row_id.parse()?, RowMetaKey::DocumentId);
match published_db
.database_row_document_collabs
.get(&pub_row_doc_id)
{
Some(row_doc_doc_state) => {
let pub_doc_collab =
collab_from_doc_state(row_doc_doc_state.to_vec(), &pub_row_doc_id)?;
let pub_doc = Document::open(pub_doc_collab)
.map_err(|e| AppError::Unhandled(e.to_string()))?;
let dup_row_doc_id =
meta_id_from_row_id(&dup_row_id.parse()?, RowMetaKey::DocumentId);
let mut new_doc_view = Box::pin(self.deep_copy_doc(
&pub_row_doc_id,
dup_row_doc_id.clone(),
pub_doc,
PublishViewMetaData::default(),
))
.await?;
new_doc_view.parent_view_id.clone_from(&dup_row_doc_id); // orphan folder view
self
.views_to_add
.insert(dup_row_doc_id.clone(), new_doc_view);
},
None => tracing::error!("no document found for row: {}", pub_row_doc_id),
};
}
},
Err(err) => tracing::error!("failed to check if row has document: {}", err),
}
// get row document id before the id update
let pub_row_doc_id = db_row_body
.document_id(&txn)
.map_err(|e| AppError::Unhandled(e.to_string()))?;
// updates row id along with meta keys
db_row_body
.update_id(&mut txn, RowId::from(dup_row_id.clone()))
.map_err(|e| AppError::Unhandled(format!("failed to update row id: {:?}", e)))?;
// duplicate row document if exists
if let Some(pub_row_doc_id) = pub_row_doc_id {
if let Some(row_doc_doc_state) = published_db
.database_row_document_collabs
.get(&pub_row_doc_id)
{
let pub_doc_collab =
collab_from_doc_state(row_doc_doc_state.to_vec(), &pub_row_doc_id)?;
let pub_doc =
Document::open(pub_doc_collab).map_err(|e| AppError::Unhandled(e.to_string()))?;
let dup_row_doc_id = meta_id_from_row_id(&dup_row_id.parse()?, RowMetaKey::DocumentId);
let mut new_doc_view = Box::pin(self.deep_copy_doc(
&pub_row_doc_id,
dup_row_doc_id.clone(),
pub_doc,
PublishViewMetaData::default(),
))
.await?;
new_doc_view.parent_view_id.clone_from(&dup_row_doc_id); // orphan folder view
self
.views_to_add
.insert(dup_row_doc_id.clone(), new_doc_view);
} else {
tracing::error!("no document found for row: {}", pub_row_doc_id);
};
}
{
// "cells": Object {
// "MBaTsr": Object {