Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: doc open sync (#4732)
Nathan.foooc3e5aa29fcc7
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lockindex 12b1f0adaf..2e40e87a12 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock@@ -162,7 +162,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -714,7 +714,7 @@ dependencies = [[[package]]name = "client-api"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["again","anyhow",@@ -733,6 +733,7 @@ dependencies = ["gotrue","gotrue-entity","governor",+ "log","mime","mime_guess","parking_lot 0.12.1",@@ -817,7 +818,7 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","async-trait",@@ -839,7 +840,7 @@ dependencies = [[[package]]name = "collab-database"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","async-trait",@@ -868,7 +869,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","collab",@@ -887,7 +888,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","bytes",@@ -902,7 +903,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","chrono",@@ -939,7 +940,7 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","async-stream",@@ -978,7 +979,7 @@ dependencies = [[[package]]name = "collab-user"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","collab",@@ -1312,7 +1313,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -1909,6 +1910,7 @@ dependencies = ["client-api","collab-database","collab-document",+ "collab-folder","collab-plugins","fancy-regex 0.11.0","flowy-codegen",@@ -2584,7 +2586,7 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","futures-util",@@ -2601,7 +2603,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -3056,7 +3058,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","reqwest",@@ -4780,7 +4782,7 @@ dependencies = [[[package]]name = "realtime-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -4794,6 +4796,7 @@ dependencies = ["realtime-protocol","serde","serde_json",+ "serde_repr","thiserror","tokio-tungstenite","websocket",@@ -4803,7 +4806,7 @@ dependencies = [[[package]]name = "realtime-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -5451,7 +5454,7 @@ dependencies = [[[package]]name = "shared-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -6931,7 +6934,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"[[package]]name = "websocket"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["futures-channel","futures-util",@@ -7331,7 +7334,7 @@ dependencies = [[[package]]name = "workspace-template"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","async-trait",diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.tomlindex 91ad303b12..16e5300515 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml@@ -82,7 +82,7 @@ custom-protocol = ["tauri/custom-protocol"]# Run the script:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "29a0851f485957cc6410ccf9d261c781c1d2f757" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8e9031c6692a73b4ceb2c94ae887af5fa3d42afe" }# Please use the following script to update collab.# Working directory: frontend#@@ -92,10 +92,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "29a# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }diff --git a/frontend/appflowy_tauri/src-tauri/src/main.rs b/frontend/appflowy_tauri/src-tauri/src/main.rsindex edc59ed240..111de889f1 100644--- a/frontend/appflowy_tauri/src-tauri/src/main.rs+++ b/frontend/appflowy_tauri/src-tauri/src/main.rs@@ -30,10 +30,10 @@ fn main() {on_event(app_handler.clone(), event);});})- .setup(|app| {+ .setup(|_app| {#[cfg(debug_assertions)]{- let window = app.get_window("main").unwrap();+ let window = _app.get_window("main").unwrap();window.open_devtools();}Ok(())diff --git a/frontend/appflowy_web/wasm-libs/Cargo.lock b/frontend/appflowy_web/wasm-libs/Cargo.lockindex 36621755a2..73c60c24a9 100644--- a/frontend/appflowy_web/wasm-libs/Cargo.lock+++ b/frontend/appflowy_web/wasm-libs/Cargo.lock@@ -221,7 +221,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -545,7 +545,7 @@ dependencies = [[[package]]name = "client-api"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["again","anyhow",@@ -564,6 +564,7 @@ dependencies = ["gotrue","gotrue-entity","governor",+ "log","mime","mime_guess","parking_lot 0.12.1",@@ -617,7 +618,7 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"dependencies = ["anyhow","async-trait",@@ -639,7 +640,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"dependencies = ["anyhow","collab",@@ -658,7 +659,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"dependencies = ["anyhow","bytes",@@ -673,7 +674,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"dependencies = ["anyhow","chrono",@@ -710,7 +711,7 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"dependencies = ["anyhow","async-stream",@@ -748,7 +749,7 @@ dependencies = [[[package]]name = "collab-user"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"dependencies = ["anyhow","collab",@@ -945,7 +946,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -1698,7 +1699,7 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","futures-util",@@ -1715,7 +1716,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -2049,7 +2050,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","reqwest",@@ -3307,7 +3308,7 @@ dependencies = [[[package]]name = "realtime-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -3321,6 +3322,7 @@ dependencies = ["realtime-protocol","serde","serde_json",+ "serde_repr","thiserror","tokio-tungstenite","websocket",@@ -3330,7 +3332,7 @@ dependencies = [[[package]]name = "realtime-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -3777,7 +3779,7 @@ dependencies = [[[package]]name = "shared-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -4719,7 +4721,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"[[package]]name = "websocket"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["futures-channel","futures-util",@@ -5026,4 +5028,4 @@ dependencies = [[[patch.unused]]name = "collab-database"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=2de6d172f56fed29ee6f32b82040cca4867647ac#2de6d172f56fed29ee6f32b82040cca4867647ac"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=35c649ea201e12bf40f5352a8bf9c46141e013a5#35c649ea201e12bf40f5352a8bf9c46141e013a5"diff --git a/frontend/appflowy_web/wasm-libs/Cargo.toml b/frontend/appflowy_web/wasm-libs/Cargo.tomlindex ab51d15e38..df72d4d313 100644--- a/frontend/appflowy_web/wasm-libs/Cargo.toml+++ b/frontend/appflowy_web/wasm-libs/Cargo.toml@@ -55,7 +55,7 @@ codegen-units = 1# Run the script:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "29a0851f485957cc6410ccf9d261c781c1d2f757" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8e9031c6692a73b4ceb2c94ae887af5fa3d42afe" }# Please use the following script to update collab.# Working directory: frontend#@@ -65,10 +65,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "29a# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }diff --git a/frontend/appflowy_web/wasm-libs/af-wasm/src/integrate/server.rs b/frontend/appflowy_web/wasm-libs/af-wasm/src/integrate/server.rsindex 0dfbf45f05..335c16381f 100644--- a/frontend/appflowy_web/wasm-libs/af-wasm/src/integrate/server.rs+++ b/frontend/appflowy_web/wasm-libs/af-wasm/src/integrate/server.rs@@ -55,7 +55,7 @@ impl CollabCloudPluginProvider for ServerProviderWASM {CollabPluginProviderType::AppFlowyCloud}- fn get_plugins(&self, _context: CollabPluginProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {+ fn get_plugins(&self, _context: CollabPluginProviderContext) -> Fut<Vec<Box<dyn CollabPlugin>>> {to_fut(async move { vec![] })}diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex d63672345d..d9fa856d09 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -163,7 +163,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -673,7 +673,7 @@ dependencies = [[[package]]name = "client-api"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["again","anyhow",@@ -692,6 +692,7 @@ dependencies = ["gotrue","gotrue-entity","governor",+ "log","mime","mime_guess","parking_lot 0.12.1",@@ -745,7 +746,7 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","async-trait",@@ -767,7 +768,7 @@ dependencies = [[[package]]name = "collab-database"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","async-trait",@@ -796,7 +797,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","collab",@@ -815,7 +816,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","bytes",@@ -830,7 +831,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","chrono",@@ -867,7 +868,7 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","async-stream",@@ -906,7 +907,7 @@ dependencies = [[[package]]name = "collab-user"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=195fabd025c3021ce0a42a3f76b8f2bad44cb45c#195fabd025c3021ce0a42a3f76b8f2bad44cb45c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=cf37285dd5adee7ead61b6fdc51bf735e5129c53#cf37285dd5adee7ead61b6fdc51bf735e5129c53"dependencies = ["anyhow","collab",@@ -1236,7 +1237,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -1899,6 +1900,7 @@ dependencies = ["client-api","collab-database","collab-document",+ "collab-folder","collab-plugins","fancy-regex 0.11.0","flowy-codegen",@@ -2408,7 +2410,7 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","futures-util",@@ -2425,7 +2427,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -2819,7 +2821,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","reqwest",@@ -4295,7 +4297,7 @@ dependencies = [[[package]]name = "realtime-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -4309,6 +4311,7 @@ dependencies = ["realtime-protocol","serde","serde_json",+ "serde_repr","thiserror","tokio-tungstenite","websocket",@@ -4318,7 +4321,7 @@ dependencies = [[[package]]name = "realtime-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","bincode",@@ -4906,7 +4909,7 @@ dependencies = [[[package]]name = "shared-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","app-error",@@ -6081,7 +6084,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"[[package]]name = "websocket"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["futures-channel","futures-util",@@ -6302,7 +6305,7 @@ dependencies = [[[package]]name = "workspace-template"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=29a0851f485957cc6410ccf9d261c781c1d2f757#29a0851f485957cc6410ccf9d261c781c1d2f757"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8e9031c6692a73b4ceb2c94ae887af5fa3d42afe#8e9031c6692a73b4ceb2c94ae887af5fa3d42afe"dependencies = ["anyhow","async-trait",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex 7c91189191..cf3f0f5634 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -105,7 +105,7 @@ incremental = false# Run the script:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "29a0851f485957cc6410ccf9d261c781c1d2f757" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8e9031c6692a73b4ceb2c94ae887af5fa3d42afe" }# Please use the following script to update collab.# Working directory: frontend#@@ -115,10 +115,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "29a# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "195fabd025c3021ce0a42a3f76b8f2bad44cb45c" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "cf37285dd5adee7ead61b6fdc51bf735e5129c53" }diff --git a/frontend/rust-lib/collab-integrate/src/wasm/plugin_provider.rs b/frontend/rust-lib/collab-integrate/src/wasm/plugin_provider.rsindex 9a954783ab..86c4a26a63 100644--- a/frontend/rust-lib/collab-integrate/src/wasm/plugin_provider.rs+++ b/frontend/rust-lib/collab-integrate/src/wasm/plugin_provider.rs@@ -7,7 +7,7 @@ use std::sync::Arc;pub trait CollabCloudPluginProvider: 'static {fn provider_type(&self) -> CollabPluginProviderType;- fn get_plugins(&self, context: CollabPluginProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>>;+ fn get_plugins(&self, context: CollabPluginProviderContext) -> Fut<Vec<Box<dyn CollabPlugin>>>;fn is_sync_enabled(&self) -> bool;}@@ -20,7 +20,7 @@ where(**self).provider_type()}- fn get_plugins(&self, context: CollabPluginProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {+ fn get_plugins(&self, context: CollabPluginProviderContext) -> Fut<Vec<Box<dyn CollabPlugin>>> {(**self).get_plugins(context)}diff --git a/frontend/rust-lib/flowy-document/src/manager.rs b/frontend/rust-lib/flowy-document/src/manager.rsindex 78cc0c493a..3710b56708 100644--- a/frontend/rust-lib/flowy-document/src/manager.rs+++ b/frontend/rust-lib/flowy-document/src/manager.rs@@ -129,26 +129,31 @@ impl DocumentManager {}}- /// Return the document+ /// Returns Document for given object id+ /// If the document does not exist in local disk, try get the doc state from the cloud.+ /// If the document exists, open the document and cache it#[tracing::instrument(level = "debug", skip(self), err)]pub async fn get_document(&self, doc_id: &str) -> FlowyResult<Arc<MutexDocument>> {if let Some(doc) = self.documents.lock().get(doc_id).cloned() {return Ok(doc);}- let mut doc_state = vec![];+ let mut doc_state = CollabDocState::default();+ // If the document does not exist in local disk, try get the doc state from the cloud. This happens+ // When user_device_a create a document and user_device_b open the document.if !self.is_doc_exist(doc_id).await? {- // Try to get the document from the cloud servicedoc_state = self.cloud_service.get_document_doc_state(doc_id, &self.user_service.workspace_id()?).await?;- event!(- tracing::Level::DEBUG,- "get document from cloud service: {}, size:{}",- doc_id,- doc_state.len()- );++ // the doc_state should not be empty if remote return the doc state without error.+ if doc_state.is_empty() {+ return Err(FlowyError::new(+ ErrorCode::RecordNotFound,+ format!("document {} not found", doc_id),+ ));+ }}let uid = self.user_service.user_id()?;@@ -156,15 +161,25 @@ impl DocumentManager {let collab = self.collab_for_document(uid, doc_id, doc_state, true).await?;- let document = Arc::new(MutexDocument::open(doc_id, collab)?);-- // save the document to the memory and read it from the memory if we open the same document again.- // and we don't want to subscribe to the document changes if we open the same document again.- self- .documents- .lock()- .put(doc_id.to_string(), document.clone());- Ok(document)++ match MutexDocument::open(doc_id, collab) {+ Ok(document) => {+ let document = Arc::new(document);+ self+ .documents+ .lock()+ .put(doc_id.to_string(), document.clone());+ Ok(document)+ },+ Err(err) => {+ if err.is_invalid_data() {+ if let Some(db) = self.user_service.collab_db(uid)?.upgrade() {+ db.delete_doc(uid, doc_id).await?;+ }+ }+ return Err(err);+ },+ }}pub async fn get_document_data(&self, doc_id: &str) -> FlowyResult<DocumentData> {@@ -224,18 +239,6 @@ impl DocumentManager {}).collect::<Vec<_>>();- // let snapshots = self- // .cloud_service- // .get_document_snapshots(document_id, limit, &workspace_id)- // .await?- // .into_iter()- // .map(|snapshot| DocumentSnapshotPB {- // snapshot_id: snapshot.snapshot_id,- // snapshot_desc: "".to_string(),- // created_at: snapshot.created_at,- // })- // .collect::<Vec<_>>();-Ok(metas)}diff --git a/frontend/rust-lib/flowy-error/Cargo.toml b/frontend/rust-lib/flowy-error/Cargo.tomlindex 659e354427..adb03672a0 100644--- a/frontend/rust-lib/flowy-error/Cargo.toml+++ b/frontend/rust-lib/flowy-error/Cargo.toml@@ -30,6 +30,7 @@ url = { version = "2.2", optional = true }collab-database = { version = "0.1.0", optional = true }collab-document = { version = "0.1.0", optional = true }collab-plugins = { version = "0.1.0", optional = true }+collab-folder = { version = "0.1.0", optional = true }client-api = { version = "0.1.0", optional = true }[features]@@ -38,6 +39,7 @@ 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_folder = ["collab-folder"]impl_from_collab_database= ["collab-database"]impl_from_url = ["url"]diff --git a/frontend/rust-lib/flowy-error/src/errors.rs b/frontend/rust-lib/flowy-error/src/errors.rsindex 96a735c2e4..47151ed8ec 100644--- a/frontend/rust-lib/flowy-error/src/errors.rs+++ b/frontend/rust-lib/flowy-error/src/errors.rs@@ -64,6 +64,10 @@ impl FlowyError {self.code == ErrorCode::UserUnauthorized || self.code == ErrorCode::RecordNotFound}+ pub fn is_invalid_data(&self) -> bool {+ self.code == ErrorCode::InvalidParams+ }+pub fn is_local_version_not_support(&self) -> bool {self.code == ErrorCode::LocalVersionNotSupport}diff --git a/frontend/rust-lib/flowy-error/src/impl_from/collab.rs b/frontend/rust-lib/flowy-error/src/impl_from/collab.rsindex 3af53b1ffe..400be07661 100644--- a/frontend/rust-lib/flowy-error/src/impl_from/collab.rs+++ b/frontend/rust-lib/flowy-error/src/impl_from/collab.rs@@ -15,6 +15,22 @@ impl From<DatabaseError> for FlowyError {#[cfg(feature = "impl_from_collab_document")]impl From<DocumentError> for FlowyError {fn from(error: DocumentError) -> Self {- FlowyError::internal().with_context(error)+ match error {+ DocumentError::NoRequiredData => FlowyError::invalid_data().with_context(error),+ _ => FlowyError::internal().with_context(error),+ }+ }+}++#[cfg(feature = "impl_from_collab_folder")]+use collab_folder::error::FolderError;++#[cfg(feature = "impl_from_collab_folder")]+impl From<FolderError> for FlowyError {+ fn from(error: FolderError) -> Self {+ match error {+ FolderError::NoRequiredData(_) => FlowyError::invalid_data().with_context(error),+ _ => FlowyError::internal().with_context(error),+ }}}diff --git a/frontend/rust-lib/flowy-folder/Cargo.toml b/frontend/rust-lib/flowy-folder/Cargo.tomlindex 757e9bfff7..5a4ee05ec3 100644--- a/frontend/rust-lib/flowy-folder/Cargo.toml+++ b/frontend/rust-lib/flowy-folder/Cargo.toml@@ -18,7 +18,7 @@ flowy-notification = { workspace = true }parking_lot.workspace = trueunicode-segmentation = "1.10"tracing.workspace = true-flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error"]}+flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error", "impl_from_collab_folder"]}lib-dispatch = { workspace = true }bytes.workspace = truelib-infra = { workspace = true }diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rsindex a759217282..89c89b9ff3 100644--- a/frontend/rust-lib/flowy-folder/src/manager.rs+++ b/frontend/rust-lib/flowy-folder/src/manager.rs@@ -4,8 +4,10 @@ use std::sync::{Arc, Weak};use collab::core::collab::{CollabDocState, MutexCollab};use collab_entity::CollabType;+use collab_folder::error::FolderError;use collab_folder::{- Folder, FolderData, Section, SectionItem, TrashInfo, View, ViewLayout, ViewUpdate, Workspace,+ Folder, FolderData, FolderNotify, Section, SectionItem, TrashInfo, UserId, View, ViewLayout,+ ViewUpdate, Workspace,};use parking_lot::{Mutex, RwLock};use tracing::{error, info, instrument};@@ -15,6 +17,7 @@ use collab_integrate::{CollabKVDB, CollabPersistenceConfig};use flowy_error::{ErrorCode, FlowyError, FlowyResult};use flowy_folder_pub::cloud::{gen_view_id, FolderCloudService};use flowy_folder_pub::folder_builder::ParentChildViews;+use lib_infra::conditional_send_sync_trait;use crate::entities::icon::UpdateViewIconParams;@@ -46,7 +49,7 @@ conditional_send_sync_trait! {pub struct FolderManager {pub(crate) workspace_id: RwLock<Option<String>>,pub(crate) mutex_folder: Arc<MutexFolder>,- collab_builder: Arc<AppFlowyCollabBuilder>,+ pub(crate) collab_builder: Arc<AppFlowyCollabBuilder>,pub(crate) user: Arc<dyn FolderUser>,pub(crate) operation_handlers: FolderOperationHandlers,pub cloud_service: Arc<dyn FolderCloudService>,@@ -147,13 +150,15 @@ impl FolderManager {Ok(views)}- pub(crate) async fn collab_for_folder(+ pub(crate) async fn make_folder<T: Into<Option<FolderNotify>>>(&self,uid: i64,workspace_id: &str,collab_db: Weak<CollabKVDB>,collab_doc_state: CollabDocState,- ) -> Result<Arc<MutexCollab>, FlowyError> {+ folder_notifier: T,+ ) -> Result<Folder, FlowyError> {+ let folder_notifier = folder_notifier.into();let collab = self.collab_builder.build_with_config(@@ -168,6 +173,45 @@ impl FolderManager {CollabBuilderConfig::default().sync_enable(true),).await?;+ let (should_clear, err) = match Folder::open(UserId::from(uid), collab, folder_notifier) {+ Ok(folder) => {+ return Ok(folder);+ },+ Err(err) => (matches!(err, FolderError::NoRequiredData(_)), err),+ };++ // If opening the folder fails due to missing required data (indicated by a `FolderError::NoRequiredData`),+ // the function logs an informational message and attempts to clear the folder data by deleting its+ // document from the collaborative database. It then returns the encountered error.+ if should_clear {+ info!("Clear the folder data and try to open the folder again");+ if let Some(db) = self.user.collab_db(uid).ok().and_then(|a| a.upgrade()) {+ let _ = db.delete_doc(uid, workspace_id).await;+ }+ }+ Err(err.into())+ }++ pub(crate) async fn create_empty_collab(+ &self,+ uid: i64,+ workspace_id: &str,+ collab_db: Weak<CollabKVDB>,+ ) -> Result<Arc<MutexCollab>, FlowyError> {+ let collab = self+ .collab_builder+ .build_with_config(+ uid,+ workspace_id,+ CollabType::Folder,+ collab_db,+ vec![],+ CollabPersistenceConfig::new()+ .enable_snapshot(true)+ .snapshot_per_update(50),+ CollabBuilderConfig::default().sync_enable(true),+ )+ .await?;Ok(collab)}diff --git a/frontend/rust-lib/flowy-folder/src/manager_init.rs b/frontend/rust-lib/flowy-folder/src/manager_init.rsindex 5d3475a10d..f73ea35953 100644--- a/frontend/rust-lib/flowy-folder/src/manager_init.rs+++ b/frontend/rust-lib/flowy-folder/src/manager_init.rs@@ -1,7 +1,11 @@use collab_entity::CollabType;+use collab_folder::{Folder, FolderNotify, UserId};+use collab_integrate::CollabKVDB;+use flowy_error::{FlowyError, FlowyResult};+use std::sync::{Arc, Weak};use tracing::{event, Level};@@ -48,8 +52,9 @@ impl FolderManager {let is_exist = self.is_workspace_exist_in_local(uid, &workspace_id).await;// 1. if the folder exists, open it from local diskif is_exist {+ event!(Level::INFO, "Init folder from local disk");self- .open_local_folder(uid, &workspace_id, collab_db, folder_notifier)+ .make_folder(uid, &workspace_id, collab_db, vec![], folder_notifier).await?} else if create_if_not_exist {// 2. if the folder doesn't exist and create_if_not_exist is true, create a default folder@@ -66,30 +71,40 @@ impl FolderManager {.get_folder_doc_state(&workspace_id, uid, CollabType::Folder, &workspace_id).await?;- let collab = self- .collab_for_folder(uid, &workspace_id, collab_db.clone(), doc_state)- .await?;- Folder::open(UserId::from(uid), collab, Some(folder_notifier.clone()))?+ self+ .make_folder(+ uid,+ &workspace_id,+ collab_db.clone(),+ doc_state,+ folder_notifier.clone(),+ )+ .await?}},FolderInitDataSource::Cloud(doc_state) => {if doc_state.is_empty() {event!(Level::ERROR, "remote folder data is empty, open from local");self- .open_local_folder(uid, &workspace_id, collab_db, folder_notifier)+ .make_folder(uid, &workspace_id, collab_db, vec![], folder_notifier).await?} else {- event!(Level::INFO, "Restore folder with remote data");- let collab = self- .collab_for_folder(uid, &workspace_id, collab_db.clone(), doc_state)- .await?;- Folder::open(UserId::from(uid), collab, Some(folder_notifier.clone()))?+ event!(Level::INFO, "Restore folder from remote data");+ self+ .make_folder(+ uid,+ &workspace_id,+ collab_db.clone(),+ doc_state,+ folder_notifier.clone(),+ )+ .await?}},FolderInitDataSource::FolderData(folder_data) => {event!(Level::INFO, "Restore folder with passed-in folder data");let collab = self- .collab_for_folder(uid, &workspace_id, collab_db, vec![])+ .create_empty_collab(uid, &workspace_id, collab_db).await?;Folder::create(UserId::from(uid),@@ -135,7 +150,7 @@ impl FolderManager {let folder_data =DefaultFolderBuilder::build(uid, workspace_id.to_string(), &self.operation_handlers).await;let collab = self- .collab_for_folder(uid, workspace_id, collab_db, vec![])+ .create_empty_collab(uid, workspace_id, collab_db).await?;Ok(Folder::create(UserId::from(uid),@@ -144,19 +159,4 @@ impl FolderManager {folder_data,))}-- async fn open_local_folder(- &self,- uid: i64,- workspace_id: &str,- collab_db: Weak<CollabKVDB>,- folder_notifier: FolderNotify,- ) -> Result<Folder, FlowyError> {- event!(Level::INFO, "Init folder from local disk");- let collab = self- .collab_for_folder(uid, workspace_id, collab_db, vec![])- .await?;- let folder = Folder::open(UserId::from(uid), collab, Some(folder_notifier))?;- Ok(folder)- }}diff --git a/frontend/rust-lib/flowy-user/Cargo.toml b/frontend/rust-lib/flowy-user/Cargo.tomlindex 71163380a2..ec423d9bda 100644--- a/frontend/rust-lib/flowy-user/Cargo.toml+++ b/frontend/rust-lib/flowy-user/Cargo.toml@@ -9,7 +9,7 @@ edition = "2018"flowy-derive.workspace = trueflowy-sqlite = { workspace = true, optional = true }flowy-encrypt = { workspace = true }-flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_sqlite"] }+flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_sqlite", "impl_from_collab_folder", "impl_from_collab_persistence"] }flowy-folder-pub = { workspace = true }lib-infra = { workspace = true }flowy-notification = { workspace = true }diff --git a/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rs b/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rsindex 94c4a6104d..dfe4723596 100644--- a/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rs+++ b/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rs@@ -9,7 +9,7 @@ use collab_plugins::local_storage::kv::KVTransactionDB;use tracing::{event, instrument};use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};-use flowy_error::{internal_error, FlowyError, FlowyResult};+use flowy_error::{FlowyError, FlowyResult};use flowy_user_pub::entities::Authenticator;use crate::migrations::migration::UserDataMigration;@@ -37,33 +37,32 @@ impl UserDataMigration for HistoricalEmptyDocumentMigration {if !matches!(authenticator, Authenticator::Local) {return Ok(());}- collab_db- .with_write_txn(|write_txn| {- let origin = CollabOrigin::Client(CollabClient::new(session.user_id, "phantom"));- let folder_collab =- match load_collab(session.user_id, write_txn, &session.user_workspace.id) {- Ok(fc) => fc,- Err(_) => return Ok(()),- };+ collab_db.with_write_txn(|write_txn| {+ let origin = CollabOrigin::Client(CollabClient::new(session.user_id, "phantom"));+ let folder_collab = match load_collab(session.user_id, write_txn, &session.user_workspace.id)+ {+ Ok(fc) => fc,+ Err(_) => return Ok(()),+ };- let folder = Folder::open(session.user_id, folder_collab, None)?;- let migration_views = folder.get_workspace_views();+ let folder = Folder::open(session.user_id, folder_collab, None)+ .map_err(|err| PersistenceError::Internal(err.into()))?;+ let migration_views = folder.get_workspace_views();- // For historical reasons, the first level documents are empty. So migrate them by inserting- // the default document data.- for view in migration_views {- if migrate_empty_document(write_txn, &origin, &view, session.user_id).is_err() {- event!(- tracing::Level::ERROR,- "Failed to migrate document {}",- view.id- );- }+ // For historical reasons, the first level documents are empty. So migrate them by inserting+ // the default document data.+ for view in migration_views {+ if migrate_empty_document(write_txn, &origin, &view, session.user_id).is_err() {+ event!(+ tracing::Level::ERROR,+ "Failed to migrate document {}",+ view.id+ );}+ }- Ok(())- })- .map_err(internal_error)?;+ Ok(())+ })?;Ok(())}diff --git a/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rs b/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rsindex 2f3e7aca3c..be200eb8a4 100644--- a/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rs+++ b/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rs@@ -1,11 +1,11 @@use std::sync::Arc;use collab_folder::Folder;-use collab_plugins::local_storage::kv::KVTransactionDB;+use collab_plugins::local_storage::kv::{KVTransactionDB, PersistenceError};use tracing::instrument;use collab_integrate::{CollabKVAction, CollabKVDB};-use flowy_error::{internal_error, FlowyResult};+use flowy_error::FlowyResult;use flowy_user_pub::entities::Authenticator;use crate::migrations::migration::UserDataMigration;@@ -29,33 +29,32 @@ impl UserDataMigration for FavoriteV1AndWorkspaceArrayMigration {collab_db: &Arc<CollabKVDB>,_authenticator: &Authenticator,) -> FlowyResult<()> {- collab_db- .with_write_txn(|write_txn| {- if let Ok(collab) = load_collab(session.user_id, write_txn, &session.user_workspace.id) {- let folder = Folder::open(session.user_id, collab, None)?;- folder.migrate_workspace_to_view();-- let favorite_view_ids = folder- .get_favorite_v1()- .into_iter()- .map(|fav| fav.id)- .collect::<Vec<String>>();-- if !favorite_view_ids.is_empty() {- folder.add_favorites(favorite_view_ids);- }-- let encode = folder.encode_collab_v1();- write_txn.flush_doc_with(- session.user_id,- &session.user_workspace.id,- &encode.doc_state,- &encode.state_vector,- )?;+ collab_db.with_write_txn(|write_txn| {+ if let Ok(collab) = load_collab(session.user_id, write_txn, &session.user_workspace.id) {+ let folder = Folder::open(session.user_id, collab, None)+ .map_err(|err| PersistenceError::Internal(err.into()))?;+ folder.migrate_workspace_to_view();++ let favorite_view_ids = folder+ .get_favorite_v1()+ .into_iter()+ .map(|fav| fav.id)+ .collect::<Vec<String>>();++ if !favorite_view_ids.is_empty() {+ folder.add_favorites(favorite_view_ids);}- Ok(())- })- .map_err(internal_error)?;++ let encode = folder.encode_collab_v1();+ write_txn.flush_doc_with(+ session.user_id,+ &session.user_workspace.id,+ &encode.doc_state,+ &encode.state_vector,+ )?;+ }+ Ok(())+ })?;Ok(())}diff --git a/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rs b/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rsindex 8e3e65c73b..fe90d6e1db 100644--- a/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rs+++ b/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rs@@ -1,11 +1,11 @@use std::sync::Arc;use collab_folder::Folder;-use collab_plugins::local_storage::kv::KVTransactionDB;+use collab_plugins::local_storage::kv::{KVTransactionDB, PersistenceError};use tracing::instrument;use collab_integrate::{CollabKVAction, CollabKVDB};-use flowy_error::{internal_error, FlowyResult};+use flowy_error::FlowyResult;use flowy_user_pub::entities::Authenticator;use crate::migrations::migration::UserDataMigration;@@ -27,31 +27,30 @@ impl UserDataMigration for WorkspaceTrashMapToSectionMigration {collab_db: &Arc<CollabKVDB>,_authenticator: &Authenticator,) -> FlowyResult<()> {- collab_db- .with_write_txn(|write_txn| {- if let Ok(collab) = load_collab(session.user_id, write_txn, &session.user_workspace.id) {- let folder = Folder::open(session.user_id, collab, None)?;- let trash_ids = folder- .get_trash_v1()- .into_iter()- .map(|fav| fav.id)- .collect::<Vec<String>>();-- if !trash_ids.is_empty() {- folder.add_trash(trash_ids);- }-- let encode = folder.encode_collab_v1();- write_txn.flush_doc_with(- session.user_id,- &session.user_workspace.id,- &encode.doc_state,- &encode.state_vector,- )?;+ collab_db.with_write_txn(|write_txn| {+ if let Ok(collab) = load_collab(session.user_id, write_txn, &session.user_workspace.id) {+ let folder = Folder::open(session.user_id, collab, None)+ .map_err(|err| PersistenceError::Internal(err.into()))?;+ let trash_ids = folder+ .get_trash_v1()+ .into_iter()+ .map(|fav| fav.id)+ .collect::<Vec<String>>();++ if !trash_ids.is_empty() {+ folder.add_trash(trash_ids);}- Ok(())- })- .map_err(internal_error)?;++ let encode = folder.encode_collab_v1();+ write_txn.flush_doc_with(+ session.user_id,+ &session.user_workspace.id,+ &encode.doc_state,+ &encode.state_vector,+ )?;+ }+ Ok(())+ })?;Ok(())}