Skip to content

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.

chore: bump client api (#5217)

Nathan.fooo044dad1d3ee5
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock
index 2207d6a0af..b74cd9e39e 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=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -740,7 +740,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"again",
"anyhow",
@@ -786,7 +786,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"futures-channel",
"futures-util",
@@ -860,7 +860,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -884,7 +884,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -914,7 +914,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -933,7 +933,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"bytes",
@@ -948,7 +948,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"chrono",
@@ -986,7 +986,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-stream",
@@ -1025,7 +1025,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -1050,7 +1050,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -1064,7 +1064,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -1293,7 +1293,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 1.0.6",
- "phf 0.8.0",
+ "phf 0.11.2",
"smallvec",
]
@@ -1404,7 +1404,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -2770,7 +2770,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"futures-util",
@@ -2787,7 +2787,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -3219,7 +3219,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"reqwest",
@@ -4722,7 +4722,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [
"bytes",
"heck 0.4.1",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"log",
"multimap",
"once_cell",
@@ -4743,7 +4743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [
"anyhow",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"proc-macro2",
"quote",
"syn 2.0.47",
@@ -5707,7 +5707,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml
index 5577fe10ba..c7affc29d6 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml
@@ -87,7 +87,7 @@ yrs = { git = "https://github.com/appflowy/y-crdt", rev = "3f25bb510ca5274e7657d
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "e2fd0493339b3d769e3f827b3351f16dd0ad457f" }
# Please use the following script to update collab.
# Working directory: frontend
#
@@ -97,10 +97,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "7b4
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
diff --git a/frontend/appflowy_web/wasm-libs/Cargo.lock b/frontend/appflowy_web/wasm-libs/Cargo.lock
index 4650e864b1..53ffffedfe 100644
--- a/frontend/appflowy_web/wasm-libs/Cargo.lock
+++ b/frontend/appflowy_web/wasm-libs/Cargo.lock
@@ -216,7 +216,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -542,7 +542,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"again",
"anyhow",
@@ -588,7 +588,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"futures-channel",
"futures-util",
@@ -632,7 +632,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -656,7 +656,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -675,7 +675,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"bytes",
@@ -690,7 +690,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"chrono",
@@ -728,7 +728,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-stream",
@@ -766,7 +766,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -791,7 +791,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -805,7 +805,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -957,7 +957,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
- "phf 0.8.0",
+ "phf 0.11.2",
"smallvec",
]
@@ -1002,7 +1002,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -1775,7 +1775,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"futures-util",
@@ -1792,7 +1792,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -2093,7 +2093,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"reqwest",
@@ -2777,7 +2777,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
- "phf_macros",
+ "phf_macros 0.8.0",
"phf_shared 0.8.0",
"proc-macro-hack",
]
@@ -2797,6 +2797,7 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
+ "phf_macros 0.11.2",
"phf_shared 0.11.2",
]
@@ -2864,6 +2865,19 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "phf_macros"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
+dependencies = [
+ "phf_generator 0.11.2",
+ "phf_shared 0.11.2",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.48",
+]
+
[[package]]
name = "phf_shared"
version = "0.8.0"
@@ -3719,7 +3733,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -4981,4 +4995,4 @@ dependencies = [
[[patch.unused]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
diff --git a/frontend/appflowy_web/wasm-libs/Cargo.toml b/frontend/appflowy_web/wasm-libs/Cargo.toml
index 803ada04a4..73b02280e6 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 = "7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "e2fd0493339b3d769e3f827b3351f16dd0ad457f" }
# 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 = "7b4
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.lock b/frontend/appflowy_web_app/src-tauri/Cargo.lock
index ac8a37bd70..975fdea8ed 100644
--- a/frontend/appflowy_web_app/src-tauri/Cargo.lock
+++ b/frontend/appflowy_web_app/src-tauri/Cargo.lock
@@ -153,7 +153,7 @@ checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
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=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"again",
"anyhow",
@@ -760,7 +760,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"futures-channel",
"futures-util",
@@ -843,7 +843,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -867,7 +867,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -897,7 +897,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -916,7 +916,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"bytes",
@@ -931,7 +931,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"chrono",
@@ -969,7 +969,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-stream",
@@ -1008,7 +1008,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -1033,7 +1033,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -1047,7 +1047,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -1280,7 +1280,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 1.0.10",
- "phf 0.8.0",
+ "phf 0.11.2",
"smallvec",
]
@@ -1391,7 +1391,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -2844,7 +2844,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"futures-util",
@@ -2861,7 +2861,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -3298,7 +3298,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"reqwest",
@@ -4803,7 +4803,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [
"bytes",
"heck 0.4.1",
- "itertools 0.11.0",
+ "itertools 0.10.5",
"log",
"multimap",
"once_cell",
@@ -4824,7 +4824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [
"anyhow",
- "itertools 0.11.0",
+ "itertools 0.10.5",
"proc-macro2",
"quote",
"syn 2.0.55",
@@ -5802,7 +5802,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.toml
index bf5ca9463b..1acb930f16 100644
--- a/frontend/appflowy_web_app/src-tauri/Cargo.toml
+++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml
@@ -86,7 +86,7 @@ yrs = { git = "https://github.com/appflowy/y-crdt", rev = "3f25bb510ca5274e7657d
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "e2fd0493339b3d769e3f827b3351f16dd0ad457f" }
# Please use the following script to update collab.
# Working directory: frontend
#
@@ -96,10 +96,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "7b4
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 31073a6810..c2511160cb 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=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -696,7 +696,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"again",
"anyhow",
@@ -742,7 +742,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"futures-channel",
"futures-util",
@@ -785,7 +785,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -809,7 +809,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-trait",
@@ -839,7 +839,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -858,7 +858,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"bytes",
@@ -873,7 +873,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"chrono",
@@ -911,7 +911,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"async-stream",
@@ -950,7 +950,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -975,7 +975,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"bincode",
@@ -989,7 +989,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=7dadc5ac7da58b862e856797583f5e40cb709bd1#7dadc5ac7da58b862e856797583f5e40cb709bd1"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=85580a5c0e95b5dae4787336faa751da44365760#85580a5c0e95b5dae4787336faa751da44365760"
dependencies = [
"anyhow",
"collab",
@@ -1192,7 +1192,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
- "phf 0.11.2",
+ "phf 0.8.0",
"smallvec",
]
@@ -1326,7 +1326,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -2596,7 +2596,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"futures-util",
@@ -2613,7 +2613,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
@@ -2984,7 +2984,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"reqwest",
@@ -3859,7 +3859,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
- "phf_macros 0.8.0",
+ "phf_macros",
"phf_shared 0.8.0",
"proc-macro-hack",
]
@@ -3879,7 +3879,6 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
- "phf_macros 0.11.2",
"phf_shared 0.11.2",
]
@@ -3947,19 +3946,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "phf_macros"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
-dependencies = [
- "phf_generator 0.11.2",
- "phf_shared 0.11.2",
- "proc-macro2",
- "quote",
- "syn 2.0.47",
-]
-
[[package]]
name = "phf_shared"
version = "0.8.0"
@@ -4163,7 +4149,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [
"bytes",
"heck 0.4.1",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"log",
"multimap",
"once_cell",
@@ -4184,7 +4170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [
"anyhow",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"proc-macro2",
"quote",
"syn 2.0.47",
@@ -5110,7 +5096,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7#7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=e2fd0493339b3d769e3f827b3351f16dd0ad457f#e2fd0493339b3d769e3f827b3351f16dd0ad457f"
dependencies = [
"anyhow",
"app-error",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index df74f16214..f9387610d6 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -115,7 +115,7 @@ rocksdb = { git = "https://github.com/LucasXu0/rust-rocksdb", rev = "21cf4a23ec1
# Run the script.add_workspace_members:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = " https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "7b4b9d0c10cb2c8bbbff8fcb288ddc1b84371be7" }
+client-api = { git = " https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "e2fd0493339b3d769e3f827b3351f16dd0ad457f" }
# Please use the following script to update collab.
# Working directory: frontend
#
@@ -125,10 +125,10 @@ client-api = { git = " https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "7b
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" }
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
diff --git a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs
index 597bb293cc..1e0e63a0f2 100644
--- a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs
+++ b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs
@@ -355,7 +355,6 @@ pub struct CreateRowPayloadPB {
pub data: HashMap<String, String>,
}
-#[derive(Default)]
pub struct CreateRowParams {
pub collab_params: collab_database::rows::CreateRowParams,
pub open_after_create: bool,
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
index f0a85bbed8..e08faaac8d 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
@@ -45,6 +45,7 @@ use super::notify_did_update_calculation;
use super::view_calculations::make_calculations_controller;
pub struct DatabaseViewEditor {
+ database_id: String,
pub view_id: String,
delegate: Arc<dyn DatabaseViewOperation>,
group_controller: Arc<RwLock<Option<Box<dyn GroupController>>>>,
@@ -62,6 +63,7 @@ impl Drop for DatabaseViewEditor {
impl DatabaseViewEditor {
pub async fn new(
+ database_id: String,
view_id: String,
delegate: Arc<dyn DatabaseViewOperation>,
cell_cache: CellCache,
@@ -104,6 +106,7 @@ impl DatabaseViewEditor {
make_calculations_controller(&view_id, delegate.clone(), notifier.clone()).await;
Ok(Self {
+ database_id,
view_id,
delegate,
group_controller,
@@ -132,6 +135,7 @@ impl DatabaseViewEditor {
let mut result = CreateRowParams {
collab_params: collab_database::rows::CreateRowParams {
id: gen_row_id(),
+ database_id: self.database_id.clone(),
cells: Cells::new(),
height: 60,
visibility: true,
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/views.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/views.rs
index ca5697a6d9..132b480123 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/views.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/views.rs
@@ -65,8 +65,10 @@ impl DatabaseViews {
err
))
})?;
+ let database_id = self.database.lock().get_database_id();
let editor = Arc::new(
DatabaseViewEditor::new(
+ database_id,
view_id.to_owned(),
self.view_operation.clone(),
self.cell_cache.clone(),
diff --git a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs
index 2425ebffd3..dd1f0c1f6b 100644
--- a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs
@@ -102,7 +102,7 @@ fn database_from_fields_and_rows(
let rows = rows
.iter()
.map(|cells| {
- let mut params = CreateRowParams::new(gen_row_id());
+ let mut params = CreateRowParams::new(gen_row_id(), database_id.clone());
for (index, cell_content) in cells.iter().enumerate() {
if let Some(field) = fields.get(index) {
let field_type = FieldType::from(field.field_type);
diff --git a/frontend/rust-lib/flowy-database2/src/template.rs b/frontend/rust-lib/flowy-database2/src/template.rs
index c61c5220e4..c0347be580 100644
--- a/frontend/rust-lib/flowy-database2/src/template.rs
+++ b/frontend/rust-lib/flowy-database2/src/template.rs
@@ -37,7 +37,7 @@ pub fn make_default_grid(view_id: &str, name: &str) -> CreateDatabaseParams {
database_id: database_id.clone(),
inline_view_id: view_id.to_string(),
views: vec![CreateViewParams {
- database_id,
+ database_id: database_id.clone(),
view_id: view_id.to_string(),
name: name.to_string(),
layout: DatabaseLayout::Grid,
@@ -51,9 +51,9 @@ pub fn make_default_grid(view_id: &str, name: &str) -> CreateDatabaseParams {
..Default::default()
}],
rows: vec![
- CreateRowParams::new(gen_row_id()),
- CreateRowParams::new(gen_row_id()),
- CreateRowParams::new(gen_row_id()),
+ CreateRowParams::new(gen_row_id(), database_id.clone()),
+ CreateRowParams::new(gen_row_id(), database_id.clone()),
+ CreateRowParams::new(gen_row_id(), database_id.clone()),
],
fields,
}
@@ -85,7 +85,7 @@ pub fn make_default_board(view_id: &str, name: &str) -> CreateDatabaseParams {
let mut rows = vec![];
for i in 0..3 {
- let mut row = CreateRowParams::new(gen_row_id());
+ let mut row = CreateRowParams::new(gen_row_id(), database_id.clone());
row.cells.insert(
single_select_field_id.clone(),
insert_select_option_cell(vec![to_do_option.id.clone()], &single_select),
diff --git a/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs b/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs
index 8148be9945..2ffb058a56 100644
--- a/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs
+++ b/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs
@@ -284,15 +284,17 @@ impl DatabaseEditorTest {
}
pub struct TestRowBuilder<'a> {
+ database_id: &'a str,
row_id: RowId,
fields: &'a [Field],
cell_build: CellBuilder<'a>,
}
impl<'a> TestRowBuilder<'a> {
- pub fn new(row_id: RowId, fields: &'a [Field]) -> Self {
+ pub fn new(database_id: &'a str, row_id: RowId, fields: &'a [Field]) -> Self {
let cell_build = CellBuilder::with_cells(Default::default(), fields);
Self {
+ database_id,
row_id,
fields,
cell_build,
@@ -407,6 +409,7 @@ impl<'a> TestRowBuilder<'a> {
let timestamp = timestamp();
Row {
id: self.row_id,
+ database_id: self.database_id.to_string(),
cells: self.cell_build.build(),
height: 60,
visibility: true,
diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs
index 96d66dd714..3d51616e5d 100644
--- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs
+++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs
@@ -16,6 +16,7 @@ use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, T
// Kanban board unit test mock data
pub fn make_test_board() -> DatabaseData {
+ let database_id = gen_database_id();
let mut fields = vec![];
let mut rows = vec![];
// Iterate through the FieldType to create the corresponding Field.
@@ -135,7 +136,7 @@ pub fn make_test_board() -> DatabaseData {
// We have many assumptions base on the number of the rows, so do not change the number of the loop.
for i in 0..5 {
- let mut row_builder = TestRowBuilder::new(gen_row_id(), &fields);
+ let mut row_builder = TestRowBuilder::new(&database_id, gen_row_id(), &fields);
match i {
0 => {
for field_type in FieldType::iter() {
@@ -242,7 +243,6 @@ pub fn make_test_board() -> DatabaseData {
let mut layout_settings = LayoutSettings::new();
layout_settings.insert(DatabaseLayout::Board, board_setting);
- let database_id = gen_database_id();
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs
index 121d43b531..81f59d4f14 100644
--- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs
+++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs
@@ -11,6 +11,7 @@ use crate::database::database_editor::TestRowBuilder;
// Calendar unit test mock data
pub fn make_test_calendar() -> DatabaseData {
+ let database_id = gen_database_id();
let mut fields = vec![];
let mut rows = vec![];
@@ -40,7 +41,7 @@ pub fn make_test_calendar() -> DatabaseData {
let field_settings = default_field_settings_for_fields(&fields, DatabaseLayout::Calendar);
for i in 0..5 {
- let mut row_builder = TestRowBuilder::new(gen_row_id(), &fields);
+ let mut row_builder = TestRowBuilder::new(&database_id, gen_row_id(), &fields);
match i {
0 => {
for field_type in FieldType::iter() {
@@ -106,7 +107,6 @@ pub fn make_test_calendar() -> DatabaseData {
let mut layout_settings = LayoutSettings::new();
layout_settings.insert(DatabaseLayout::Calendar, calendar_setting);
- let database_id = gen_database_id();
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs
index 8d2aac139c..4a4236d295 100644
--- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs
+++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs
@@ -14,6 +14,7 @@ use crate::database::database_editor::TestRowBuilder;
use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER};
pub fn make_test_grid() -> DatabaseData {
+ let database_id = gen_database_id();
let mut fields = vec![];
let mut rows = vec![];
@@ -130,7 +131,7 @@ pub fn make_test_grid() -> DatabaseData {
let field_settings = default_field_settings_for_fields(&fields, DatabaseLayout::Grid);
for i in 0..7 {
- let mut row_builder = TestRowBuilder::new(gen_row_id(), &fields);
+ let mut row_builder = TestRowBuilder::new(&database_id, gen_row_id(), &fields);
match i {
0 => {
for field_type in FieldType::iter() {
@@ -265,7 +266,6 @@ pub fn make_test_grid() -> DatabaseData {
rows.push(row);
}
- let database_id = gen_database_id();
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
@@ -287,6 +287,7 @@ pub fn make_test_grid() -> DatabaseData {
}
pub fn make_no_date_test_grid() -> DatabaseData {
+ let database_id = gen_database_id();
let mut fields = vec![];
let mut rows = vec![];
@@ -317,7 +318,7 @@ pub fn make_no_date_test_grid() -> DatabaseData {
let field_settings = default_field_settings_for_fields(&fields, DatabaseLayout::Grid);
for i in 0..3 {
- let mut row_builder = TestRowBuilder::new(gen_row_id(), &fields);
+ let mut row_builder = TestRowBuilder::new(&database_id, gen_row_id(), &fields);
match i {
0 => {
for field_type in FieldType::iter() {
@@ -353,7 +354,6 @@ pub fn make_no_date_test_grid() -> DatabaseData {
rows.push(row);
}
- let database_id = gen_database_id();
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
index b49546fd6a..f602b404f8 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
@@ -535,7 +535,7 @@ fn to_user_workspace(af_workspace: AFWorkspace) -> UserWorkspace {
id: af_workspace.workspace_id.to_string(),
name: af_workspace.workspace_name,
created_at: af_workspace.created_at,
- workspace_database_object_id: af_workspace.database_storage_id.to_string(),
+ database_indexer_id: af_workspace.database_storage_id.to_string(),
icon: af_workspace.icon,
}
}
diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs
index d00b67654e..d5fa1524b6 100644
--- a/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs
+++ b/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs
@@ -231,7 +231,7 @@ fn make_user_workspace() -> UserWorkspace {
id: uuid::Uuid::new_v4().to_string(),
name: "My Workspace".to_string(),
created_at: Default::default(),
- workspace_database_object_id: uuid::Uuid::new_v4().to_string(),
+ database_indexer_id: uuid::Uuid::new_v4().to_string(),
icon: "".to_string(),
}
}
diff --git a/frontend/rust-lib/flowy-server/tests/supabase_test/user_test.rs b/frontend/rust-lib/flowy-server/tests/supabase_test/user_test.rs
index 178be52df3..13df930601 100644
--- a/frontend/rust-lib/flowy-server/tests/supabase_test/user_test.rs
+++ b/frontend/rust-lib/flowy-server/tests/supabase_test/user_test.rs
@@ -21,10 +21,7 @@ async fn supabase_user_sign_up_test() {
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
assert!(!user.latest_workspace.id.is_empty());
assert!(!user.user_workspaces.is_empty());
- assert!(!user
- .latest_workspace
- .workspace_database_object_id
- .is_empty());
+ assert!(!user.latest_workspace.database_indexer_id.is_empty());
}
#[tokio::test]
@@ -41,10 +38,7 @@ async fn supabase_user_sign_up_with_existing_uuid_test() {
.unwrap();
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
assert!(!user.latest_workspace.id.is_empty());
- assert!(!user
- .latest_workspace
- .workspace_database_object_id
- .is_empty());
+ assert!(!user.latest_workspace.database_indexer_id.is_empty());
assert!(!user.user_workspaces.is_empty());
}
diff --git a/frontend/rust-lib/flowy-user-pub/src/entities.rs b/frontend/rust-lib/flowy-user-pub/src/entities.rs
index 16a2607c31..db9a81e8d8 100644
--- a/frontend/rust-lib/flowy-user-pub/src/entities.rs
+++ b/frontend/rust-lib/flowy-user-pub/src/entities.rs
@@ -139,7 +139,7 @@ pub struct UserWorkspace {
pub created_at: DateTime<Utc>,
/// The database storage id is used indexing all the database views in current workspace.
#[serde(rename = "database_storage_id")]
- pub workspace_database_object_id: String,
+ pub database_indexer_id: String,
#[serde(default)]
pub icon: String,
}
@@ -150,7 +150,7 @@ impl UserWorkspace {
id: workspace_id.to_string(),
name: "".to_string(),
created_at: Utc::now(),
- workspace_database_object_id: Uuid::new_v4().to_string(),
+ database_indexer_id: Uuid::new_v4().to_string(),
icon: "".to_string(),
}
}
diff --git a/frontend/rust-lib/flowy-user-pub/src/session.rs b/frontend/rust-lib/flowy-user-pub/src/session.rs
index 312fa84878..82306e6e72 100644
--- a/frontend/rust-lib/flowy-user-pub/src/session.rs
+++ b/frontend/rust-lib/flowy-user-pub/src/session.rs
@@ -73,7 +73,7 @@ impl<'de> Visitor<'de> for SessionVisitor {
name: "My Workspace".to_string(),
created_at: Utc::now(),
// For historical reasons, the database_storage_id is constructed by the user_id.
- workspace_database_object_id: STANDARD.encode(format!("{}:user:database", user_id)),
+ database_indexer_id: STANDARD.encode(format!("{}:user:database", user_id)),
icon: "".to_owned(),
})
}
diff --git a/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs b/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs
index 126578e06f..a7adcbe803 100644
--- a/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs
+++ b/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs
@@ -35,6 +35,7 @@ pub fn migration_anon_user_on_sign_up(
.with_write_txn(|new_collab_w_txn| {
let old_collab_r_txn = old_collab_db.read_txn();
let old_to_new_id_map = Arc::new(Mutex::new(OldToNewIdMap::new()));
+
migrate_user_awareness(
old_to_new_id_map.lock().deref_mut(),
old_user,
@@ -57,7 +58,7 @@ pub fn migration_anon_user_on_sign_up(
// Migration of all objects except the folder and database_with_views
object_ids.retain(|id| {
id != &old_user.session.user_workspace.id
- && id != &old_user.session.user_workspace.workspace_database_object_id
+ && id != &old_user.session.user_workspace.database_indexer_id
});
info!("migrate collab objects: {:?}", object_ids.len());
@@ -84,7 +85,7 @@ pub fn migration_anon_user_on_sign_up(
// Migrate other collab objects
for object_id in &object_ids {
if let Some(collab) = collab_by_oid.get(object_id) {
- let new_object_id = old_to_new_id_map.lock().get_new_id(object_id);
+ let new_object_id = old_to_new_id_map.lock().exchange_new_id(object_id);
tracing::debug!("migrate from: {}, to: {}", object_id, new_object_id,);
migrate_collab_object(
collab,
@@ -109,7 +110,7 @@ impl OldToNewIdMap {
fn new() -> Self {
Self::default()
}
- fn get_new_id(&mut self, old_id: &str) -> String {
+ fn exchange_new_id(&mut self, old_id: &str) -> String {
let view_id = self
.0
.entry(old_id.to_string())
@@ -148,7 +149,7 @@ where
{
let database_with_views_collab = Collab::new(
old_user.session.user_id,
- &old_user.session.user_workspace.workspace_database_object_id,
+ &old_user.session.user_workspace.database_indexer_id,
"phantom",
vec![],
false,
@@ -156,13 +157,13 @@ where
database_with_views_collab.with_origin_transact_mut(|txn| {
old_collab_r_txn.load_doc_with_txn(
old_user.session.user_id,
- &old_user.session.user_workspace.workspace_database_object_id,
+ &old_user.session.user_workspace.database_indexer_id,
txn,
)
})?;
let new_uid = new_user_session.user_id;
- let new_object_id = &new_user_session.user_workspace.workspace_database_object_id;
+ let new_object_id = &new_user_session.user_workspace.database_indexer_id;
let array = DatabaseMetaList::from_collab(&database_with_views_collab);
for database_meta in array.get_all_database_meta() {
@@ -170,9 +171,9 @@ where
let new_linked_views = update
.linked_views
.iter()
- .map(|view_id| old_to_new_id_map.get_new_id(view_id))
+ .map(|view_id| old_to_new_id_map.exchange_new_id(view_id))
.collect();
- update.database_id = old_to_new_id_map.get_new_id(&update.database_id);
+ update.database_id = old_to_new_id_map.exchange_new_id(&update.database_id);
update.linked_views = new_linked_views;
})
}
@@ -237,7 +238,7 @@ where
let fav_map = old_fav_map
.into_iter()
.map(|mut item| {
- let new_view_id = old_to_new_id_map.get_new_id(&item.id);
+ let new_view_id = old_to_new_id_map.exchange_new_id(&item.id);
item.id = new_view_id;
item
})
@@ -248,7 +249,7 @@ where
let trash_map = old_trash_map
.into_iter()
.map(|mut item| {
- let new_view_id = old_to_new_id_map.get_new_id(&item.id);
+ let new_view_id = old_to_new_id_map.exchange_new_id(&item.id);
item.id = new_view_id;
item
})
@@ -260,7 +261,7 @@ where
let recent_map = old_recent_map
.into_iter()
.map(|mut item| {
- let new_view_id = old_to_new_id_map.get_new_id(&item.id);
+ let new_view_id = old_to_new_id_map.exchange_new_id(&item.id);
item.id = new_view_id;
item
})
@@ -279,19 +280,19 @@ where
.child_views
.iter_mut()
.for_each(|view_identifier| {
- view_identifier.id = old_to_new_id_map.get_new_id(&view_identifier.id);
+ view_identifier.id = old_to_new_id_map.exchange_new_id(&view_identifier.id);
});
folder_data.views.iter_mut().for_each(|view| {
// 2. replace the old parent view id of the view
- view.parent_view_id = old_to_new_id_map.get_new_id(&view.parent_view_id);
+ view.parent_view_id = old_to_new_id_map.exchange_new_id(&view.parent_view_id);
// 3. replace the old id of the view
- view.id = old_to_new_id_map.get_new_id(&view.id);
+ view.id = old_to_new_id_map.exchange_new_id(&view.id);
// 4. replace the old id of the children views
view.children.iter_mut().for_each(|view_identifier| {
- view_identifier.id = old_to_new_id_map.get_new_id(&view_identifier.id);
+ view_identifier.id = old_to_new_id_map.exchange_new_id(&view_identifier.id);
});
});
@@ -349,7 +350,8 @@ where
{
// Migrate databases
let mut database_object_ids = vec![];
- let database_row_object_ids = RwLock::new(HashSet::new());
+ let imported_database_row_object_ids: RwLock<HashMap<String, HashSet<String>>> =
+ RwLock::new(HashMap::new());
for object_id in &mut *object_ids {
if let Some(collab) = collab_by_oid.get(object_id) {
@@ -359,14 +361,17 @@ where
database_object_ids.push(object_id.clone());
reset_inline_view_id(collab, |old_inline_view_id| {
- old_to_new_id_map.lock().get_new_id(&old_inline_view_id)
+ old_to_new_id_map
+ .lock()
+ .exchange_new_id(&old_inline_view_id)
});
mut_database_views_with_collab(collab, |database_view| {
- let new_view_id = old_to_new_id_map.lock().get_new_id(&database_view.id);
+ let old_database_id = database_view.database_id.clone();
+ let new_view_id = old_to_new_id_map.lock().exchange_new_id(&database_view.id);
let new_database_id = old_to_new_id_map
.lock()
- .get_new_id(&database_view.database_id);
+ .exchange_new_id(&database_view.database_id);
tracing::trace!(
"migrate database view id from: {}, to: {}",
@@ -384,7 +389,7 @@ where
database_view.row_orders.iter_mut().for_each(|row_order| {
let old_row_id = String::from(row_order.id.clone());
let old_row_document_id = database_row_document_id_from_row_id(&old_row_id);
- let new_row_id = old_to_new_id_map.lock().get_new_id(&old_row_id);
+ let new_row_id = old_to_new_id_map.lock().exchange_new_id(&old_row_id);
let new_row_document_id = database_row_document_id_from_row_id(&new_row_id);
tracing::debug!("migrate row id: {} to {}", row_order.id, new_row_id);
tracing::debug!(
@@ -397,11 +402,15 @@ where
.insert(old_row_document_id, new_row_document_id);
row_order.id = RowId::from(new_row_id);
- database_row_object_ids.write().insert(old_row_id);
+ imported_database_row_object_ids
+ .write()
+ .entry(old_database_id.clone())
+ .or_default()
+ .insert(old_row_id);
});
});
- let new_object_id = old_to_new_id_map.lock().get_new_id(object_id);
+ let new_object_id = old_to_new_id_map.lock().exchange_new_id(object_id);
tracing::debug!(
"migrate database from: {}, to: {}",
object_id,
@@ -415,29 +424,48 @@ where
);
}
}
+
+ let imported_database_row_object_ids = imported_database_row_object_ids.read();
+ // remove the database object ids from the object ids
object_ids.retain(|id| !database_object_ids.contains(id));
- let database_row_object_ids = database_row_object_ids.read();
- for object_id in &*database_row_object_ids {
- if let Some(collab) = collab_by_oid.get(object_id) {
- let new_object_id = old_to_new_id_map.lock().get_new_id(object_id);
- tracing::info!(
- "migrate database row from: {}, to: {}",
- object_id,
- new_object_id,
- );
- mut_row_with_collab(collab, |row_update| {
- row_update.set_row_id(RowId::from(new_object_id.clone()));
- });
- migrate_collab_object(
- collab,
- new_user_session.user_id,
- &new_object_id,
- new_collab_w_txn,
- );
+ // remove database row object ids from the imported object ids
+ object_ids.retain(|id| {
+ !imported_database_row_object_ids
+ .values()
+ .flatten()
+ .any(|row_id| row_id == id)
+ });
+ for (database_id, imported_row_ids) in &*imported_database_row_object_ids {
+ for imported_row_id in imported_row_ids {
+ if let Some(imported_collab) = collab_by_oid.get(imported_row_id) {
+ let new_database_id = old_to_new_id_map.lock().exchange_new_id(database_id);
+ let new_row_id = old_to_new_id_map.lock().exchange_new_id(imported_row_id);
+ info!(
+ "import database row from: {}, to: {}",
+ imported_row_id, new_row_id,
+ );
+ mut_row_with_collab(imported_collab, |row_update| {
+ row_update.set_row_id(RowId::from(new_row_id.clone()), new_database_id.clone());
+ });
+ migrate_collab_object(
+ imported_collab,
+ new_user_session.user_id,
+ &new_row_id,
+ new_collab_w_txn,
+ );
+ }
+
+ // imported_collab_by_oid contains all the collab object ids, including the row document collab object ids.
+ // So, if the id exist in the imported_collab_by_oid, it means the row document collab object is exist.
+ let imported_row_document_id = database_row_document_id_from_row_id(imported_row_id);
+ if collab_by_oid.get(&imported_row_document_id).is_some() {
+ let _ = old_to_new_id_map
+ .lock()
+ .exchange_new_id(&imported_row_document_id);
+ }
}
}
- object_ids.retain(|id| !database_row_object_ids.contains(id));
Ok(())
}
@@ -456,7 +484,7 @@ where
let collab = Collab::new(
old_user.session.user_id,
object_id,
- "phantom",
+ "migrate_device",
vec![],
false,
);
diff --git a/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs b/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs
index 42e648d9f7..c6435531f3 100644
--- a/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs
+++ b/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs
@@ -43,7 +43,7 @@ pub async fn sync_supabase_user_data_to_cloud(
uid,
&workspace_id,
device_id,
- &new_user_session.user_workspace.workspace_database_object_id,
+ &new_user_session.user_workspace.database_indexer_id,
collab_db,
user_service.clone(),
)
diff --git a/frontend/rust-lib/flowy-user/src/event_handler.rs b/frontend/rust-lib/flowy-user/src/event_handler.rs
index 3dce1448a2..34389b8793 100644
--- a/frontend/rust-lib/flowy-user/src/event_handler.rs
+++ b/frontend/rust-lib/flowy-user/src/event_handler.rs
@@ -14,7 +14,7 @@ use crate::notification::{send_notification, UserNotification};
use crate::services::cloud_config::{
get_cloud_config, get_or_create_cloud_config, save_cloud_config,
};
-use crate::services::data_import::get_appflowy_data_folder_import_context;
+use crate::services::data_import::prepare_import;
use crate::user_manager::UserManager;
fn upgrade_manager(manager: AFPluginState<Weak<UserManager>>) -> FlowyResult<Arc<UserManager>> {
@@ -266,10 +266,11 @@ pub async fn import_appflowy_data_folder_handler(
af_spawn(async move {
let result = async {
let manager = upgrade_manager(manager)?;
- let context = get_appflowy_data_folder_import_context(&data.path)
+ let imported_folder = prepare_import(&data.path)
.map_err(|err| FlowyError::new(ErrorCode::AppFlowyDataFolderImportError, err.to_string()))?
.with_container_name(data.import_container_name);
- manager.import_appflowy_data_folder(context).await?;
+
+ manager.perform_import(imported_folder).await?;
Ok::<(), FlowyError>(())
}
.await;
diff --git a/frontend/rust-lib/flowy-user/src/services/authenticate_user.rs b/frontend/rust-lib/flowy-user/src/services/authenticate_user.rs
index ef272b6f00..c9d779a232 100644
--- a/frontend/rust-lib/flowy-user/src/services/authenticate_user.rs
+++ b/frontend/rust-lib/flowy-user/src/services/authenticate_user.rs
@@ -69,7 +69,7 @@ impl AuthenticateUser {
pub fn workspace_database_object_id(&self) -> FlowyResult<String> {
let session = self.get_session()?;
- Ok(session.user_workspace.workspace_database_object_id.clone())
+ Ok(session.user_workspace.database_indexer_id.clone())
}
pub fn get_collab_db(&self, uid: i64) -> FlowyResult<Weak<CollabKVDB>> {
diff --git a/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs b/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs
index 6acc12d291..f60f07deac 100644
--- a/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs
+++ b/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs
@@ -1,4 +1,5 @@
use crate::migrations::session_migration::migrate_session_with_user_uuid;
+
use crate::services::data_import::importer::load_collab_by_oid;
use crate::services::db::UserDBPath;
use crate::services::entities::UserPaths;
@@ -20,6 +21,7 @@ use collab_entity::CollabType;
use collab_folder::{Folder, UserId, View, ViewIdentifier, ViewLayout};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use collab_plugins::local_storage::kv::KVTransactionDB;
+
use flowy_error::FlowyError;
use flowy_folder_pub::cloud::gen_view_id;
use flowy_folder_pub::entities::{AppFlowyData, ImportData};
@@ -35,20 +37,27 @@ use std::path::Path;
use std::sync::{Arc, Weak};
use tracing::{debug, error, event, info, instrument, warn};
-pub(crate) struct ImportContext {
+pub(crate) struct ImportedFolder {
pub imported_session: Session,
pub imported_collab_db: Arc<CollabKVDB>,
pub container_name: Option<String>,
+ pub source: ImportedSource,
+}
+
+#[derive(Clone)]
+pub(crate) enum ImportedSource {
+ ExternalFolder,
+ AnonUser,
}
-impl ImportContext {
+impl ImportedFolder {
pub fn with_container_name(mut self, container_name: Option<String>) -> Self {
self.container_name = container_name;
self
}
}
-pub(crate) fn get_appflowy_data_folder_import_context(path: &str) -> anyhow::Result<ImportContext> {
+pub(crate) fn prepare_import(path: &str) -> anyhow::Result<ImportedFolder> {
if !Path::new(path).exists() {
return Err(anyhow!("The path: {} is not exist", path));
}
@@ -83,70 +92,106 @@ pub(crate) fn get_appflowy_data_folder_import_context(path: &str) -> anyhow::Res
None,
);
- Ok(ImportContext {
+ Ok(ImportedFolder {
imported_session,
imported_collab_db,
container_name: None,
+ source: ImportedSource::ExternalFolder,
})
}
+#[allow(dead_code)]
+fn migrate_user_awareness(
+ old_to_new_id_map: &mut OldToNewIdMap,
+ old_user_session: &Session,
+ new_user_session: &Session,
+) -> Result<(), PersistenceError> {
+ let old_uid = old_user_session.user_id;
+ let new_uid = new_user_session.user_id;
+ old_to_new_id_map.insert(old_uid.to_string(), new_uid.to_string());
+ Ok(())
+}
+
/// This path refers to the directory where AppFlowy stores its data. The directory structure is as follows:
/// root folder:
/// - cache.db
/// - log (log files with unique identifiers)
/// - 2761499 (other relevant files or directories, identified by unique numbers)
-pub(crate) fn import_appflowy_data_folder(
- session: &Session,
+pub(crate) fn generate_import_data(
+ current_session: &Session,
workspace_id: &str,
collab_db: &Arc<CollabKVDB>,
- import_context: ImportContext,
+ imported_folder: ImportedFolder,
) -> anyhow::Result<ImportData> {
- let imported_session = import_context.imported_session;
- let imported_collab_db = import_context.imported_collab_db;
- let container_name = import_context.container_name;
+ let imported_session = imported_folder.imported_session.clone();
+ let imported_collab_db = imported_folder.imported_collab_db.clone();
+ let imported_container_view_name = imported_folder.container_name.clone();
let mut database_view_ids_by_database_id: HashMap<String, Vec<String>> = HashMap::new();
let row_object_ids = Mutex::new(HashSet::new());
- let row_document_object_ids = Mutex::new(HashSet::new());
let document_object_ids = Mutex::new(HashSet::new());
let database_object_ids = Mutex::new(HashSet::new());
- let import_container_view_id = match &container_name {
- None => workspace_id.to_string(),
- Some(_) => gen_view_id().to_string(),
+
+ // All the imported views will be attached to the container view. If the container view name is not provided,
+ // the container view will be the workspace, which mean the root of the workspace.
+ let import_container_view_id = match imported_folder.source {
+ ImportedSource::ExternalFolder => match &imported_container_view_name {
+ None => workspace_id.to_string(),
+ Some(_) => gen_view_id().to_string(),
+ },
+ ImportedSource::AnonUser => workspace_id.to_string(),
};
let views = collab_db.with_write_txn(|collab_write_txn| {
let imported_collab_read_txn = imported_collab_db.read_txn();
// use the old_to_new_id_map to keep track of the other collab object id and the new collab object id
let old_to_new_id_map = Arc::new(Mutex::new(OldToNewIdMap::new()));
+
+ // 1. Get all the imported collab object ids
let mut all_imported_object_ids = imported_collab_read_txn
.get_all_docs()
.map(|iter| iter.collect::<Vec<String>>())
.unwrap_or_default();
- // when doing import, we don't want to import the user workspace, database view tracker and the user awareness
- all_imported_object_ids.retain(|id| id != &imported_session.user_workspace.id);
- all_imported_object_ids
- .retain(|id| id != &imported_session.user_workspace.workspace_database_object_id);
+ // when doing import, we don't want to import these objects:
+ // 1. user workspace
+ // 2. database view tracker
+ // 3. the user awareness
+ // So we remove these object ids from the list
+ let user_workspace_id = &imported_session.user_workspace.id;
+ let database_indexer_id = &imported_session.user_workspace.database_indexer_id;
+ let user_awareness_id =
+ user_awareness_object_id(&imported_session.user_uuid, user_workspace_id).to_string();
all_imported_object_ids.retain(|id| {
- id != &user_awareness_object_id(
- &imported_session.user_uuid,
- &imported_session.user_workspace.id,
- )
- .to_string()
+ id != user_workspace_id && id != database_indexer_id && id != &user_awareness_id
});
- // import database view tracker
- migrate_database_view_tracker(
- &mut old_to_new_id_map.lock(),
- &imported_session,
- &imported_collab_read_txn,
- &mut database_view_ids_by_database_id,
- &database_object_ids,
- )?;
+ match imported_folder.source {
+ ImportedSource::ExternalFolder => {
+ // 2. mapping the database indexer ids
+ mapping_database_indexer_ids(
+ &mut old_to_new_id_map.lock(),
+ &imported_session,
+ &imported_collab_read_txn,
+ &mut database_view_ids_by_database_id,
+ &database_object_ids,
+ )?;
+ },
+ ImportedSource::AnonUser => {
+ // 2. migrate the database with views object
+ migrate_database_with_views_object(
+ &mut old_to_new_id_map.lock(),
+ &imported_session,
+ &imported_collab_read_txn,
+ current_session,
+ collab_write_txn,
+ )?;
+ },
+ }
- // remove the database view ids from the object ids. Because there are no collab object for the database view
+ // remove the database view ids from the object ids. Because there are no physical collab object
+ // for the database view
let database_view_ids: Vec<String> = database_view_ids_by_database_id
.values()
.flatten()
@@ -154,99 +199,74 @@ pub(crate) fn import_appflowy_data_folder(
.collect();
all_imported_object_ids.retain(|id| !database_view_ids.contains(id));
- // load other collab objects
+ // 3. load imported collab objects data.
let imported_collab_by_oid = load_collab_by_oid(
imported_session.user_id,
&imported_collab_read_txn,
&all_imported_object_ids,
);
+
// import the database
migrate_databases(
&old_to_new_id_map,
- session,
+ current_session,
collab_write_txn,
&mut all_imported_object_ids,
&imported_collab_by_oid,
&row_object_ids,
- &row_document_object_ids,
)?;
- debug!(
- "import row document ids: {:?}",
- row_document_object_ids
- .lock()
- .iter()
- .collect::<Vec<&String>>()
- );
-
// the object ids now only contains the document collab object ids
for object_id in &all_imported_object_ids {
if let Some(imported_collab) = imported_collab_by_oid.get(object_id) {
- let new_object_id = old_to_new_id_map.lock().renew_id(object_id);
+ let new_object_id = old_to_new_id_map.lock().exchange_new_id(object_id);
document_object_ids.lock().insert(new_object_id.clone());
debug!("import from: {}, to: {}", object_id, new_object_id,);
write_collab_object(
imported_collab,
- session.user_id,
+ current_session.user_id,
&new_object_id,
collab_write_txn,
);
}
}
- // create a root view that contains all the views
- let (mut child_views, orphan_views) = import_workspace_views(
+ // Update the parent view IDs of all top-level views to match the new container view ID, making
+ // them child views of the container. This ensures that the hierarchy within the imported
+ // structure is correctly maintained.
+ let (mut child_views, orphan_views) = mapping_folder_views(
&import_container_view_id,
&mut old_to_new_id_map.lock(),
&imported_session,
&imported_collab_read_txn,
)?;
- match container_name {
- None => {
+ match imported_folder.source {
+ ImportedSource::ExternalFolder => match imported_container_view_name {
+ None => {
+ child_views.extend(orphan_views);
+ Ok(child_views)
+ },
+ Some(container_name) => {
+ // create a new view with given name and then attach views to it
+ attach_to_new_view(
+ current_session,
+ &document_object_ids,
+ &import_container_view_id,
+ collab_write_txn,
+ child_views,
+ orphan_views,
+ container_name,
+ )
+ },
+ },
+ ImportedSource::AnonUser => {
child_views.extend(orphan_views);
Ok(child_views)
},
- Some(container_name) => {
- let name = if container_name.is_empty() {
- format!(
- "import_{}",
- chrono::Local::now().format("%Y-%m-%d %H:%M:%S")
- )
- } else {
- container_name
- };
-
- // create the content for the container view
- let import_container_doc_state = default_document_collab_data(&import_container_view_id)
- .map_err(|err| PersistenceError::InvalidData(err.to_string()))?
- .doc_state
- .to_vec();
- import_collab_object_with_doc_state(
- import_container_doc_state,
- session.user_id,
- &import_container_view_id,
- collab_write_txn,
- )?;
-
- document_object_ids
- .lock()
- .insert(import_container_view_id.clone());
- let mut import_container_views =
- vec![
- ViewBuilder::new(session.user_id, session.user_workspace.id.clone())
- .with_view_id(import_container_view_id)
- .with_layout(ViewLayout::Document)
- .with_name(name)
- .with_child_views(child_views)
- .build(),
- ];
-
- import_container_views.extend(orphan_views);
- Ok(import_container_views)
- },
}
})?;
+
Ok(ImportData::AppFlowyDataFolder {
items: vec![
AppFlowyData::Folder {
@@ -261,11 +281,61 @@ pub(crate) fn import_appflowy_data_folder(
],
})
}
+fn attach_to_new_view<'a, W>(
+ current_session: &Session,
+ document_object_ids: &Mutex<HashSet<String>>,
+ import_container_view_id: &str,
+ collab_write_txn: &'a W,
+ child_views: Vec<ParentChildViews>,
+ orphan_views: Vec<ParentChildViews>,
+ container_name: String,
+) -> Result<Vec<ParentChildViews>, PersistenceError>
+where
+ W: CollabKVAction<'a>,
+ PersistenceError: From<W::Error>,
+{
+ let name = if container_name.is_empty() {
+ format!(
+ "import_{}",
+ chrono::Local::now().format("%Y-%m-%d %H:%M:%S")
+ )
+ } else {
+ container_name
+ };
+
+ // create the content for the container view
+ let import_container_doc_state = default_document_collab_data(import_container_view_id)
+ .map_err(|err| PersistenceError::InvalidData(err.to_string()))?
+ .doc_state
+ .to_vec();
+ import_collab_object_with_doc_state(
+ import_container_doc_state,
+ current_session.user_id,
+ import_container_view_id,
+ collab_write_txn,
+ )?;
+
+ document_object_ids
+ .lock()
+ .insert(import_container_view_id.to_string());
+ let mut import_container_views = vec![ViewBuilder::new(
+ current_session.user_id,
+ current_session.user_workspace.id.clone(),
+ )
+ .with_view_id(import_container_view_id)
+ .with_layout(ViewLayout::Document)
+ .with_name(name)
+ .with_child_views(child_views)
+ .build()];
+
+ import_container_views.extend(orphan_views);
+ Ok(import_container_views)
+}
-fn migrate_database_view_tracker<'a, W>(
+fn mapping_database_indexer_ids<'a, W>(
old_to_new_id_map: &mut OldToNewIdMap,
- other_session: &Session,
- other_collab_read_txn: &W,
+ imported_session: &Session,
+ imported_collab_read_txn: &W,
database_view_ids_by_database_id: &mut HashMap<String, Vec<String>>,
database_object_ids: &Mutex<HashSet<String>>,
) -> Result<(), PersistenceError>
@@ -273,29 +343,29 @@ where
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
- let database_view_tracker_collab = Collab::new(
- other_session.user_id,
- &other_session.user_workspace.workspace_database_object_id,
- "phantom",
+ let imported_database_indexer = Collab::new(
+ imported_session.user_id,
+ &imported_session.user_workspace.database_indexer_id,
+ "import_device",
vec![],
false,
);
- database_view_tracker_collab.with_origin_transact_mut(|txn| {
- other_collab_read_txn.load_doc_with_txn(
- other_session.user_id,
- &other_session.user_workspace.workspace_database_object_id,
+ imported_database_indexer.with_origin_transact_mut(|txn| {
+ imported_collab_read_txn.load_doc_with_txn(
+ imported_session.user_id,
+ &imported_session.user_workspace.database_indexer_id,
txn,
)
})?;
- let array = DatabaseMetaList::from_collab(&database_view_tracker_collab);
- for database_meta in array.get_all_database_meta() {
+ let array = DatabaseMetaList::from_collab(&imported_database_indexer);
+ for database_meta_list in array.get_all_database_meta() {
database_view_ids_by_database_id.insert(
- old_to_new_id_map.renew_id(&database_meta.database_id),
- database_meta
+ old_to_new_id_map.exchange_new_id(&database_meta_list.database_id),
+ database_meta_list
.linked_views
.into_iter()
- .map(|view_id| old_to_new_id_map.renew_id(&view_id))
+ .map(|view_id| old_to_new_id_map.exchange_new_id(&view_id))
.collect(),
);
}
@@ -308,6 +378,59 @@ where
Ok(())
}
+fn migrate_database_with_views_object<'a, 'b, W, R>(
+ old_to_new_id_map: &mut OldToNewIdMap,
+ old_user_session: &Session,
+ old_collab_r_txn: &R,
+ new_user_session: &Session,
+ new_collab_w_txn: &W,
+) -> Result<(), PersistenceError>
+where
+ 'a: 'b,
+ W: CollabKVAction<'a>,
+ R: CollabKVAction<'b>,
+ PersistenceError: From<W::Error>,
+ PersistenceError: From<R::Error>,
+{
+ let database_with_views_collab = Collab::new(
+ old_user_session.user_id,
+ &old_user_session.user_workspace.database_indexer_id,
+ "migrate_device",
+ vec![],
+ false,
+ );
+ database_with_views_collab.with_origin_transact_mut(|txn| {
+ old_collab_r_txn.load_doc_with_txn(
+ old_user_session.user_id,
+ &old_user_session.user_workspace.database_indexer_id,
+ txn,
+ )
+ })?;
+
+ let new_uid = new_user_session.user_id;
+ let new_object_id = &new_user_session.user_workspace.database_indexer_id;
+
+ let array = DatabaseMetaList::from_collab(&database_with_views_collab);
+ for database_meta in array.get_all_database_meta() {
+ array.update_database(&database_meta.database_id, |update| {
+ let new_linked_views = update
+ .linked_views
+ .iter()
+ .map(|view_id| old_to_new_id_map.exchange_new_id(view_id))
+ .collect();
+ update.database_id = old_to_new_id_map.exchange_new_id(&update.database_id);
+ update.linked_views = new_linked_views;
+ })
+ }
+
+ let txn = database_with_views_collab.transact();
+ if let Err(err) = new_collab_w_txn.create_new_doc(new_uid, new_object_id, &txn) {
+ error!("🔴migrate database storage failed: {:?}", err);
+ }
+ drop(txn);
+ Ok(())
+}
+
fn migrate_databases<'a, W>(
old_to_new_id_map: &Arc<Mutex<OldToNewIdMap>>,
session: &Session,
@@ -315,15 +438,16 @@ fn migrate_databases<'a, W>(
imported_object_ids: &mut Vec<String>,
imported_collab_by_oid: &HashMap<String, Collab>,
row_object_ids: &Mutex<HashSet<String>>,
- row_document_object_ids: &Mutex<HashSet<String>>,
) -> Result<(), PersistenceError>
where
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
// Migrate databases
+ let row_document_object_ids = Mutex::new(HashSet::new());
let mut database_object_ids = vec![];
- let imported_database_row_object_ids = RwLock::new(HashSet::new());
+ let imported_database_row_object_ids: RwLock<HashMap<String, HashSet<String>>> =
+ RwLock::new(HashMap::new());
for object_id in &mut *imported_object_ids {
if let Some(database_collab) = imported_collab_by_oid.get(object_id) {
@@ -333,21 +457,24 @@ where
database_object_ids.push(object_id.clone());
reset_inline_view_id(database_collab, |old_inline_view_id| {
- old_to_new_id_map.lock().renew_id(&old_inline_view_id)
+ old_to_new_id_map
+ .lock()
+ .exchange_new_id(&old_inline_view_id)
});
mut_database_views_with_collab(database_collab, |database_view| {
- let new_view_id = old_to_new_id_map.lock().renew_id(&database_view.id);
+ let new_view_id = old_to_new_id_map.lock().exchange_new_id(&database_view.id);
+ let old_database_id = database_view.database_id.clone();
let new_database_id = old_to_new_id_map
.lock()
- .renew_id(&database_view.database_id);
+ .exchange_new_id(&database_view.database_id);
database_view.id = new_view_id;
database_view.database_id = new_database_id;
database_view.row_orders.iter_mut().for_each(|row_order| {
let old_row_id = String::from(row_order.id.clone());
let old_row_document_id = database_row_document_id_from_row_id(&old_row_id);
- let new_row_id = old_to_new_id_map.lock().renew_id(&old_row_id);
+ let new_row_id = old_to_new_id_map.lock().exchange_new_id(&old_row_id);
// The row document might not exist in the database row. But by querying the old_row_document_id,
// we can know the document of the row is exist or not.
let new_row_document_id = database_row_document_id_from_row_id(&new_row_id);
@@ -357,7 +484,12 @@ where
.insert(old_row_document_id.clone(), new_row_document_id);
row_order.id = RowId::from(new_row_id);
- imported_database_row_object_ids.write().insert(old_row_id);
+
+ imported_database_row_object_ids
+ .write()
+ .entry(old_database_id.clone())
+ .or_default()
+ .insert(old_row_id);
});
// collect the ids
@@ -369,7 +501,7 @@ where
row_object_ids.lock().extend(new_row_ids);
});
- let new_object_id = old_to_new_id_map.lock().renew_id(object_id);
+ let new_object_id = old_to_new_id_map.lock().exchange_new_id(object_id);
debug!(
"migrate database from: {}, to: {}",
object_id, new_object_id,
@@ -386,38 +518,59 @@ where
// remove the database object ids from the object ids
imported_object_ids.retain(|id| !database_object_ids.contains(id));
- imported_object_ids.retain(|id| !imported_database_row_object_ids.contains(id));
- for imported_row_id in &*imported_database_row_object_ids {
- if let Some(imported_collab) = imported_collab_by_oid.get(imported_row_id) {
- let new_row_id = old_to_new_id_map.lock().renew_id(imported_row_id);
- info!(
- "import database row from: {}, to: {}",
- imported_row_id, new_row_id,
- );
- mut_row_with_collab(imported_collab, |row_update| {
- row_update.set_row_id(RowId::from(new_row_id.clone()));
- });
- write_collab_object(
- imported_collab,
- session.user_id,
- &new_row_id,
- collab_write_txn,
- );
- }
+ // remove database row object ids from the imported object ids
+ imported_object_ids.retain(|id| {
+ !imported_database_row_object_ids
+ .values()
+ .flatten()
+ .any(|row_id| row_id == id)
+ });
+
+ for (database_id, imported_row_ids) in &*imported_database_row_object_ids {
+ for imported_row_id in imported_row_ids {
+ if let Some(imported_collab) = imported_collab_by_oid.get(imported_row_id) {
+ let new_database_id = old_to_new_id_map.lock().exchange_new_id(database_id);
+ let new_row_id = old_to_new_id_map.lock().exchange_new_id(imported_row_id);
+ info!(
+ "import database row from: {}, to: {}",
+ imported_row_id, new_row_id,
+ );
- // imported_collab_by_oid contains all the collab object ids, including the row document collab object ids.
- // So, if the id exist in the imported_collab_by_oid, it means the row document collab object is exist.
- let imported_row_document_id = database_row_document_id_from_row_id(imported_row_id);
- if imported_collab_by_oid
- .get(&imported_row_document_id)
- .is_some()
- {
- let new_row_document_id = old_to_new_id_map.lock().renew_id(&imported_row_document_id);
- row_document_object_ids.lock().insert(new_row_document_id);
+ mut_row_with_collab(imported_collab, |row_update| {
+ row_update.set_row_id(RowId::from(new_row_id.clone()), new_database_id.clone());
+ });
+ write_collab_object(
+ imported_collab,
+ session.user_id,
+ &new_row_id,
+ collab_write_txn,
+ );
+ }
+
+ // imported_collab_by_oid contains all the collab object ids, including the row document collab object ids.
+ // So, if the id exist in the imported_collab_by_oid, it means the row document collab object is exist.
+ let imported_row_document_id = database_row_document_id_from_row_id(imported_row_id);
+ if imported_collab_by_oid
+ .get(&imported_row_document_id)
+ .is_some()
+ {
+ let new_row_document_id = old_to_new_id_map
+ .lock()
+ .exchange_new_id(&imported_row_document_id);
+ row_document_object_ids.lock().insert(new_row_document_id);
+ }
}
}
+ debug!(
+ "import row document ids: {:?}",
+ row_document_object_ids
+ .lock()
+ .iter()
+ .collect::<Vec<&String>>()
+ );
+
Ok(())
}
@@ -476,58 +629,59 @@ where
Ok(())
}
-fn import_workspace_views<'a, W>(
- parent_view_id: &str,
+fn mapping_folder_views<'a, W>(
+ root_view_id: &str,
old_to_new_id_map: &mut OldToNewIdMap,
- other_session: &Session,
- other_collab_read_txn: &W,
+ imported_session: &Session,
+ imported_collab_read_txn: &W,
) -> Result<(Vec<ParentChildViews>, Vec<ParentChildViews>), PersistenceError>
where
W: CollabKVAction<'a>,
PersistenceError: From<W::Error>,
{
- let other_folder_collab = Collab::new(
- other_session.user_id,
- &other_session.user_workspace.id,
- "phantom",
+ let imported_folder_collab = Collab::new(
+ imported_session.user_id,
+ &imported_session.user_workspace.id,
+ "migrate_device",
vec![],
false,
);
- other_folder_collab.with_origin_transact_mut(|txn| {
- other_collab_read_txn.load_doc_with_txn(
- other_session.user_id,
- &other_session.user_workspace.id,
+ imported_folder_collab.with_origin_transact_mut(|txn| {
+ imported_collab_read_txn.load_doc_with_txn(
+ imported_session.user_id,
+ &imported_session.user_workspace.id,
txn,
)
})?;
- let other_user_id = UserId::from(other_session.user_id);
- let other_folder = Folder::open(
+ let other_user_id = UserId::from(imported_session.user_id);
+ let imported_folder = Folder::open(
other_user_id,
- Arc::new(MutexCollab::new(other_folder_collab)),
+ Arc::new(MutexCollab::new(imported_folder_collab)),
None,
)
.map_err(|err| PersistenceError::InvalidData(err.to_string()))?;
- let other_folder_data = other_folder
- .get_folder_data(&other_session.user_workspace.id)
+ let imported_folder_data = imported_folder
+ .get_folder_data(&imported_session.user_workspace.id)
.ok_or(PersistenceError::Internal(anyhow!(
"Can't read the folder data"
)))?;
// replace the old parent view id of the workspace
old_to_new_id_map.0.insert(
- other_session.user_workspace.id.clone(),
- parent_view_id.to_string(),
+ imported_session.user_workspace.id.clone(),
+ root_view_id.to_string(),
);
- let trash_ids = other_folder_data
+
+ let trash_ids = imported_folder_data
.trash
.into_values()
.flatten()
- .map(|item| old_to_new_id_map.renew_id(&item.id))
+ .map(|item| old_to_new_id_map.exchange_new_id(&item.id))
.collect::<Vec<String>>();
- // 1. Replace the workspace views id to new id
- let mut first_level_views = other_folder_data
+ // 1. Replace the views id with new view id
+ let mut first_level_views = imported_folder_data
.workspace
.child_views
.items
@@ -536,20 +690,20 @@ where
.collect::<Vec<ViewIdentifier>>();
first_level_views.iter_mut().for_each(|view_identifier| {
- view_identifier.id = old_to_new_id_map.renew_id(&view_identifier.id);
+ view_identifier.id = old_to_new_id_map.exchange_new_id(&view_identifier.id);
});
- let mut all_views = other_folder_data.views;
+ let mut all_views = imported_folder_data.views;
all_views.iter_mut().for_each(|view| {
// 2. replace the old parent view id of the view
- view.parent_view_id = old_to_new_id_map.renew_id(&view.parent_view_id);
+ view.parent_view_id = old_to_new_id_map.exchange_new_id(&view.parent_view_id);
// 3. replace the old id of the view
- view.id = old_to_new_id_map.renew_id(&view.id);
+ view.id = old_to_new_id_map.exchange_new_id(&view.id);
// 4. replace the old id of the children views
view.children.iter_mut().for_each(|view_identifier| {
- view_identifier.id = old_to_new_id_map.renew_id(&view_identifier.id);
+ view_identifier.id = old_to_new_id_map.exchange_new_id(&view_identifier.id);
});
});
@@ -559,6 +713,7 @@ where
.map(|view| (view.id.clone(), view))
.collect::<HashMap<String, View>>();
+ // 5. create the parent views. Each parent view contains the children views.
let parent_views = first_level_views
.into_iter()
.flat_map(
@@ -569,7 +724,7 @@ where
)
.collect::<Vec<ParentChildViews>>();
- // the views in the all_views_map now, should be the orphan views
+ // 6. after the parent views are created, the all_views_map only contains the orphan views
debug!("create orphan views: {:?}", all_views_map.keys());
let mut orphan_views = vec![];
for orphan_view in all_views_map.into_values() {
@@ -610,7 +765,7 @@ impl OldToNewIdMap {
fn new() -> Self {
Self::default()
}
- fn renew_id(&mut self, old_id: &str) -> String {
+ fn exchange_new_id(&mut self, old_id: &str) -> String {
let view_id = self
.0
.entry(old_id.to_string())
diff --git a/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs b/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs
index b45cc87fa9..b1dee99774 100644
--- a/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs
+++ b/frontend/rust-lib/flowy-user/src/services/data_import/importer.rs
@@ -1,25 +1,8 @@
-use crate::services::data_import::appflowy_data_import::import_appflowy_data_folder;
-use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
-use flowy_user_pub::session::Session;
-use std::collections::HashMap;
-
-use crate::services::data_import::ImportContext;
use collab::preclude::Collab;
-use flowy_folder_pub::entities::ImportData;
-use std::sync::Arc;
+use collab_integrate::{CollabKVAction, PersistenceError};
+use std::collections::HashMap;
use tracing::instrument;
-/// Import appflowy data from the given path.
-/// If the container name is not empty, then the data will be imported to the given container.
-/// Otherwise, the data will be imported to the current workspace.
-pub(crate) fn import_data(
- session: &Session,
- context: ImportContext,
- collab_db: Arc<CollabKVDB>,
-) -> anyhow::Result<ImportData> {
- import_appflowy_data_folder(session, &session.user_workspace.id, &collab_db, context)
-}
-
#[instrument(level = "debug", skip_all)]
pub fn load_collab_by_oid<'a, R>(
uid: i64,
diff --git a/frontend/rust-lib/flowy-user/src/services/sqlite_sql/workspace_sql.rs b/frontend/rust-lib/flowy-user/src/services/sqlite_sql/workspace_sql.rs
index 529865234b..6f438d82e1 100644
--- a/frontend/rust-lib/flowy-user/src/services/sqlite_sql/workspace_sql.rs
+++ b/frontend/rust-lib/flowy-user/src/services/sqlite_sql/workspace_sql.rs
@@ -81,7 +81,7 @@ impl TryFrom<(i64, &UserWorkspace)> for UserWorkspaceTable {
if value.1.id.is_empty() {
return Err(FlowyError::invalid_data().with_context("The id is empty"));
}
- if value.1.workspace_database_object_id.is_empty() {
+ if value.1.database_indexer_id.is_empty() {
return Err(FlowyError::invalid_data().with_context("The database storage id is empty"));
}
@@ -90,7 +90,7 @@ impl TryFrom<(i64, &UserWorkspace)> for UserWorkspaceTable {
name: value.1.name.clone(),
uid: value.0,
created_at: value.1.created_at.timestamp(),
- database_storage_id: value.1.workspace_database_object_id.clone(),
+ database_storage_id: value.1.database_indexer_id.clone(),
icon: value.1.icon.clone(),
})
}
@@ -105,7 +105,7 @@ impl From<UserWorkspaceTable> for UserWorkspace {
.timestamp_opt(value.created_at, 0)
.single()
.unwrap_or_default(),
- workspace_database_object_id: value.database_storage_id,
+ database_indexer_id: value.database_storage_id,
icon: value.icon,
}
}
diff --git a/frontend/rust-lib/flowy-user/src/user_manager/manager.rs b/frontend/rust-lib/flowy-user/src/user_manager/manager.rs
index 5d62c326a3..878eb364ae 100644
--- a/frontend/rust-lib/flowy-user/src/user_manager/manager.rs
+++ b/frontend/rust-lib/flowy-user/src/user_manager/manager.rs
@@ -2,7 +2,7 @@ use collab_integrate::collab_builder::AppFlowyCollabBuilder;
use collab_integrate::CollabKVDB;
use collab_user::core::MutexUserAwareness;
use flowy_error::{internal_error, ErrorCode, FlowyResult};
-use flowy_folder_pub::entities::ImportData;
+
use flowy_server_pub::AuthenticatorType;
use flowy_sqlite::kv::StorePreferences;
use flowy_sqlite::schema::user_table;
@@ -36,8 +36,6 @@ use crate::migrations::AnonUser;
use crate::services::authenticate_user::AuthenticateUser;
use crate::services::cloud_config::get_cloud_config;
use crate::services::collab_interact::{CollabInteract, DefaultCollabInteract};
-use crate::services::data_import::importer::import_data;
-use crate::services::data_import::ImportContext;
use crate::services::sqlite_sql::user_sql::{select_user_profile, UserTable, UserTableChangeset};
use crate::user_manager::manager_user_encryption::validate_encryption_sign;
@@ -791,24 +789,6 @@ impl UserManager {
)?;
Ok(())
}
-
- pub(crate) async fn import_appflowy_data(
- &self,
- context: ImportContext,
- ) -> Result<ImportData, FlowyError> {
- let session = self.get_session()?;
- let user_collab_db = self
- .authenticate_user
- .database
- .get_collab_db(session.user_id)?;
- let import_data = tokio::task::spawn_blocking(move || {
- import_data(&session, context, user_collab_db)
- .map_err(|err| FlowyError::new(ErrorCode::AppFlowyDataFolderImportError, err.to_string()))
- })
- .await
- .map_err(internal_error)??;
- Ok(import_data)
- }
}
fn current_authenticator() -> Authenticator {
diff --git a/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs b/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs
index fdd945f143..b14db8d75b 100644
--- a/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs
+++ b/frontend/rust-lib/flowy-user/src/user_manager/manager_user_workspace.rs
@@ -5,7 +5,7 @@ use collab_entity::{CollabObject, CollabType};
use collab_integrate::CollabKVDB;
use tracing::{error, info, instrument, warn};
-use flowy_error::{FlowyError, FlowyResult};
+use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_folder_pub::entities::{AppFlowyData, ImportData};
use flowy_sqlite::schema::user_workspace_table;
use flowy_sqlite::{query_dsl::*, DBConnection, ExpressionMethods};
@@ -17,7 +17,9 @@ use lib_dispatch::prelude::af_spawn;
use crate::entities::{RepeatedUserWorkspacePB, ResetWorkspacePB};
use crate::migrations::AnonUser;
use crate::notification::{send_notification, UserNotification};
-use crate::services::data_import::{upload_collab_objects_data, ImportContext};
+use crate::services::data_import::{
+ generate_import_data, upload_collab_objects_data, ImportedFolder, ImportedSource,
+};
use crate::services::sqlite_sql::workspace_sql::{
get_all_user_workspace_op, get_user_workspace_op, insert_new_workspaces_op, UserWorkspaceTable,
};
@@ -29,16 +31,31 @@ impl UserManager {
/// If the container name is not empty, then the data will be imported to the given container.
/// Otherwise, the data will be imported to the current workspace.
#[instrument(skip_all, err)]
- pub(crate) async fn import_appflowy_data_folder(
- &self,
- context: ImportContext,
- ) -> FlowyResult<()> {
- let session = self.get_session()?;
- let import_data = self.import_appflowy_data(context).await?;
+ pub(crate) async fn perform_import(&self, imported_folder: ImportedFolder) -> FlowyResult<()> {
+ let current_session = self.get_session()?;
+ let user_collab_db = self
+ .authenticate_user
+ .database
+ .get_collab_db(current_session.user_id)?;
+
+ let cloned_current_session = current_session.clone();
+ let import_data = tokio::task::spawn_blocking(move || {
+ generate_import_data(
+ &cloned_current_session,
+ &cloned_current_session.user_workspace.id,
+ &user_collab_db,
+ imported_folder,
+ )
+ .map_err(|err| FlowyError::new(ErrorCode::AppFlowyDataFolderImportError, err.to_string()))
+ })
+ .await??;
+
match import_data {
ImportData::AppFlowyDataFolder { items } => {
for item in items {
- self.upload_appflowy_data_item(&session, item).await?;
+ self
+ .upload_appflowy_data_item(&current_session, item)
+ .await?;
}
},
}
@@ -47,7 +64,7 @@ impl UserManager {
async fn upload_appflowy_data_item(
&self,
- session: &Session,
+ current_session: &Session,
item: AppFlowyData,
) -> Result<(), FlowyError> {
match item {
@@ -79,13 +96,15 @@ impl UserManager {
document_object_ids,
database_object_ids,
} => {
- let user = self.get_user_profile_from_disk(session.user_id).await?;
+ let user = self
+ .get_user_profile_from_disk(current_session.user_id)
+ .await?;
let user_collab_db = self
- .get_collab_db(session.user_id)?
+ .get_collab_db(current_session.user_id)?
.upgrade()
.ok_or_else(|| FlowyError::internal().with_context("Collab db not found"))?;
- let user_id = session.user_id;
+ let user_id = current_session.user_id;
let weak_user_collab_db = Arc::downgrade(&user_collab_db);
let weak_user_cloud_service = self.cloud_services.get_user_service()?;
match upload_collab_objects_data(
@@ -124,12 +143,13 @@ impl UserManager {
old_user: &AnonUser,
old_collab_db: &Arc<CollabKVDB>,
) -> FlowyResult<()> {
- let import_context = ImportContext {
+ let import_context = ImportedFolder {
imported_session: old_user.session.clone(),
imported_collab_db: old_collab_db.clone(),
container_name: None,
+ source: ImportedSource::AnonUser,
};
- self.import_appflowy_data_folder(import_context).await?;
+ self.perform_import(import_context).await?;
Ok(())
}