chore: bump client api (#5217)

* chore: bump client api

* chore: fix compile

* chore: fix compile
This commit is contained in:
Nathan.fooo 2024-04-27 21:55:12 +08:00 committed by GitHub
parent d4278a7549
commit 044dad1d3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 597 additions and 428 deletions

View File

@ -162,7 +162,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]] [[package]]
name = "app-error" name = "app-error"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -740,7 +740,7 @@ dependencies = [
[[package]] [[package]]
name = "client-api" name = "client-api"
version = "0.1.0" 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 = [ dependencies = [
"again", "again",
"anyhow", "anyhow",
@ -786,7 +786,7 @@ dependencies = [
[[package]] [[package]]
name = "client-websocket" name = "client-websocket"
version = "0.1.0" 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 = [ dependencies = [
"futures-channel", "futures-channel",
"futures-util", "futures-util",
@ -860,7 +860,7 @@ dependencies = [
[[package]] [[package]]
name = "collab" name = "collab"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -884,7 +884,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-database" name = "collab-database"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -914,7 +914,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-document" name = "collab-document"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -933,7 +933,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-entity" name = "collab-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -948,7 +948,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-folder" name = "collab-folder"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -986,7 +986,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-plugins" name = "collab-plugins"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-stream", "async-stream",
@ -1025,7 +1025,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-entity" name = "collab-rt-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -1050,7 +1050,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-protocol" name = "collab-rt-protocol"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -1064,7 +1064,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-user" name = "collab-user"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -1293,7 +1293,7 @@ dependencies = [
"cssparser-macros", "cssparser-macros",
"dtoa-short", "dtoa-short",
"itoa 1.0.6", "itoa 1.0.6",
"phf 0.8.0", "phf 0.11.2",
"smallvec", "smallvec",
] ]
@ -1404,7 +1404,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]] [[package]]
name = "database-entity" name = "database-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -2770,7 +2770,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue" name = "gotrue"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"futures-util", "futures-util",
@ -2787,7 +2787,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue-entity" name = "gotrue-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -3219,7 +3219,7 @@ dependencies = [
[[package]] [[package]]
name = "infra" name = "infra"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"reqwest", "reqwest",
@ -4722,7 +4722,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [ dependencies = [
"bytes", "bytes",
"heck 0.4.1", "heck 0.4.1",
"itertools 0.10.5", "itertools 0.11.0",
"log", "log",
"multimap", "multimap",
"once_cell", "once_cell",
@ -4743,7 +4743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools 0.10.5", "itertools 0.11.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.47", "syn 2.0.47",
@ -5707,7 +5707,7 @@ dependencies = [
[[package]] [[package]]
name = "shared-entity" name = "shared-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",

View File

@ -87,7 +87,7 @@ yrs = { git = "https://github.com/appflowy/y-crdt", rev = "3f25bb510ca5274e7657d
# Run the script: # Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id # 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. # Please use the following script to update collab.
# Working directory: frontend # 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: # To switch to the local path, run:
# scripts/tool/update_collab_source.sh # scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️ # ⚠️⚠️⚠️️
collab = { 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 = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }

View File

@ -216,7 +216,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]] [[package]]
name = "app-error" name = "app-error"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -542,7 +542,7 @@ dependencies = [
[[package]] [[package]]
name = "client-api" name = "client-api"
version = "0.1.0" 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 = [ dependencies = [
"again", "again",
"anyhow", "anyhow",
@ -588,7 +588,7 @@ dependencies = [
[[package]] [[package]]
name = "client-websocket" name = "client-websocket"
version = "0.1.0" 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 = [ dependencies = [
"futures-channel", "futures-channel",
"futures-util", "futures-util",
@ -632,7 +632,7 @@ dependencies = [
[[package]] [[package]]
name = "collab" name = "collab"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -656,7 +656,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-document" name = "collab-document"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -675,7 +675,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-entity" name = "collab-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -690,7 +690,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-folder" name = "collab-folder"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -728,7 +728,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-plugins" name = "collab-plugins"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-stream", "async-stream",
@ -766,7 +766,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-entity" name = "collab-rt-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -791,7 +791,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-protocol" name = "collab-rt-protocol"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -805,7 +805,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-user" name = "collab-user"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -957,7 +957,7 @@ dependencies = [
"cssparser-macros", "cssparser-macros",
"dtoa-short", "dtoa-short",
"itoa", "itoa",
"phf 0.8.0", "phf 0.11.2",
"smallvec", "smallvec",
] ]
@ -1002,7 +1002,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]] [[package]]
name = "database-entity" name = "database-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -1775,7 +1775,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue" name = "gotrue"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"futures-util", "futures-util",
@ -1792,7 +1792,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue-entity" name = "gotrue-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -2093,7 +2093,7 @@ dependencies = [
[[package]] [[package]]
name = "infra" name = "infra"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"reqwest", "reqwest",
@ -2777,7 +2777,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [ dependencies = [
"phf_macros", "phf_macros 0.8.0",
"phf_shared 0.8.0", "phf_shared 0.8.0",
"proc-macro-hack", "proc-macro-hack",
] ]
@ -2797,6 +2797,7 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [ dependencies = [
"phf_macros 0.11.2",
"phf_shared 0.11.2", "phf_shared 0.11.2",
] ]
@ -2864,6 +2865,19 @@ dependencies = [
"syn 1.0.109", "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]] [[package]]
name = "phf_shared" name = "phf_shared"
version = "0.8.0" version = "0.8.0"
@ -3719,7 +3733,7 @@ dependencies = [
[[package]] [[package]]
name = "shared-entity" name = "shared-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -4981,4 +4995,4 @@ dependencies = [
[[patch.unused]] [[patch.unused]]
name = "collab-database" name = "collab-database"
version = "0.1.0" 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"

View File

@ -55,7 +55,7 @@ codegen-units = 1
# Run the script: # Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id # 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. # Please use the following script to update collab.
# Working directory: frontend # 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: # To switch to the local path, run:
# scripts/tool/update_collab_source.sh # scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️ # ⚠️⚠️⚠️️
collab = { 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 = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }

View File

@ -153,7 +153,7 @@ checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
[[package]] [[package]]
name = "app-error" name = "app-error"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -714,7 +714,7 @@ dependencies = [
[[package]] [[package]]
name = "client-api" name = "client-api"
version = "0.1.0" 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 = [ dependencies = [
"again", "again",
"anyhow", "anyhow",
@ -760,7 +760,7 @@ dependencies = [
[[package]] [[package]]
name = "client-websocket" name = "client-websocket"
version = "0.1.0" 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 = [ dependencies = [
"futures-channel", "futures-channel",
"futures-util", "futures-util",
@ -843,7 +843,7 @@ dependencies = [
[[package]] [[package]]
name = "collab" name = "collab"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -867,7 +867,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-database" name = "collab-database"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -897,7 +897,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-document" name = "collab-document"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -916,7 +916,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-entity" name = "collab-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -931,7 +931,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-folder" name = "collab-folder"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -969,7 +969,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-plugins" name = "collab-plugins"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-stream", "async-stream",
@ -1008,7 +1008,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-entity" name = "collab-rt-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -1033,7 +1033,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-protocol" name = "collab-rt-protocol"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -1047,7 +1047,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-user" name = "collab-user"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -1280,7 +1280,7 @@ dependencies = [
"cssparser-macros", "cssparser-macros",
"dtoa-short", "dtoa-short",
"itoa 1.0.10", "itoa 1.0.10",
"phf 0.8.0", "phf 0.11.2",
"smallvec", "smallvec",
] ]
@ -1391,7 +1391,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]] [[package]]
name = "database-entity" name = "database-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -2844,7 +2844,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue" name = "gotrue"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"futures-util", "futures-util",
@ -2861,7 +2861,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue-entity" name = "gotrue-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -3298,7 +3298,7 @@ dependencies = [
[[package]] [[package]]
name = "infra" name = "infra"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"reqwest", "reqwest",
@ -4803,7 +4803,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [ dependencies = [
"bytes", "bytes",
"heck 0.4.1", "heck 0.4.1",
"itertools 0.11.0", "itertools 0.10.5",
"log", "log",
"multimap", "multimap",
"once_cell", "once_cell",
@ -4824,7 +4824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools 0.11.0", "itertools 0.10.5",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.55", "syn 2.0.55",
@ -5802,7 +5802,7 @@ dependencies = [
[[package]] [[package]]
name = "shared-entity" name = "shared-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",

View File

@ -86,7 +86,7 @@ yrs = { git = "https://github.com/appflowy/y-crdt", rev = "3f25bb510ca5274e7657d
# Run the script: # Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id # 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. # Please use the following script to update collab.
# Working directory: frontend # 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: # To switch to the local path, run:
# scripts/tool/update_collab_source.sh # scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️ # ⚠️⚠️⚠️️
collab = { 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 = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }

View File

@ -163,7 +163,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]] [[package]]
name = "app-error" name = "app-error"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -696,7 +696,7 @@ dependencies = [
[[package]] [[package]]
name = "client-api" name = "client-api"
version = "0.1.0" 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 = [ dependencies = [
"again", "again",
"anyhow", "anyhow",
@ -742,7 +742,7 @@ dependencies = [
[[package]] [[package]]
name = "client-websocket" name = "client-websocket"
version = "0.1.0" 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 = [ dependencies = [
"futures-channel", "futures-channel",
"futures-util", "futures-util",
@ -785,7 +785,7 @@ dependencies = [
[[package]] [[package]]
name = "collab" name = "collab"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -809,7 +809,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-database" name = "collab-database"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -839,7 +839,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-document" name = "collab-document"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -858,7 +858,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-entity" name = "collab-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -873,7 +873,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-folder" name = "collab-folder"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -911,7 +911,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-plugins" name = "collab-plugins"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"async-stream", "async-stream",
@ -950,7 +950,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-entity" name = "collab-rt-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -975,7 +975,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-rt-protocol" name = "collab-rt-protocol"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
@ -989,7 +989,7 @@ dependencies = [
[[package]] [[package]]
name = "collab-user" name = "collab-user"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"collab", "collab",
@ -1192,7 +1192,7 @@ dependencies = [
"cssparser-macros", "cssparser-macros",
"dtoa-short", "dtoa-short",
"itoa", "itoa",
"phf 0.11.2", "phf 0.8.0",
"smallvec", "smallvec",
] ]
@ -1326,7 +1326,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]] [[package]]
name = "database-entity" name = "database-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -2596,7 +2596,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue" name = "gotrue"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"futures-util", "futures-util",
@ -2613,7 +2613,7 @@ dependencies = [
[[package]] [[package]]
name = "gotrue-entity" name = "gotrue-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",
@ -2984,7 +2984,7 @@ dependencies = [
[[package]] [[package]]
name = "infra" name = "infra"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"reqwest", "reqwest",
@ -3859,7 +3859,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [ dependencies = [
"phf_macros 0.8.0", "phf_macros",
"phf_shared 0.8.0", "phf_shared 0.8.0",
"proc-macro-hack", "proc-macro-hack",
] ]
@ -3879,7 +3879,6 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [ dependencies = [
"phf_macros 0.11.2",
"phf_shared 0.11.2", "phf_shared 0.11.2",
] ]
@ -3947,19 +3946,6 @@ dependencies = [
"syn 1.0.109", "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]] [[package]]
name = "phf_shared" name = "phf_shared"
version = "0.8.0" version = "0.8.0"
@ -4163,7 +4149,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2"
dependencies = [ dependencies = [
"bytes", "bytes",
"heck 0.4.1", "heck 0.4.1",
"itertools 0.10.5", "itertools 0.11.0",
"log", "log",
"multimap", "multimap",
"once_cell", "once_cell",
@ -4184,7 +4170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"itertools 0.10.5", "itertools 0.11.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.47", "syn 2.0.47",
@ -5110,7 +5096,7 @@ dependencies = [
[[package]] [[package]]
name = "shared-entity" name = "shared-entity"
version = "0.1.0" 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 = [ dependencies = [
"anyhow", "anyhow",
"app-error", "app-error",

View File

@ -115,7 +115,7 @@ rocksdb = { git = "https://github.com/LucasXu0/rust-rocksdb", rev = "21cf4a23ec1
# Run the script.add_workspace_members: # Run the script.add_workspace_members:
# scripts/tool/update_client_api_rev.sh new_rev_id # 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. # Please use the following script to update collab.
# Working directory: frontend # 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: # To switch to the local path, run:
# scripts/tool/update_collab_source.sh # scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️ # ⚠️⚠️⚠️️
collab = { 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 = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "7dadc5ac7da58b862e856797583f5e40cb709bd1" } collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "85580a5c0e95b5dae4787336faa751da44365760" }

View File

@ -355,7 +355,6 @@ pub struct CreateRowPayloadPB {
pub data: HashMap<String, String>, pub data: HashMap<String, String>,
} }
#[derive(Default)]
pub struct CreateRowParams { pub struct CreateRowParams {
pub collab_params: collab_database::rows::CreateRowParams, pub collab_params: collab_database::rows::CreateRowParams,
pub open_after_create: bool, pub open_after_create: bool,

View File

@ -45,6 +45,7 @@ use super::notify_did_update_calculation;
use super::view_calculations::make_calculations_controller; use super::view_calculations::make_calculations_controller;
pub struct DatabaseViewEditor { pub struct DatabaseViewEditor {
database_id: String,
pub view_id: String, pub view_id: String,
delegate: Arc<dyn DatabaseViewOperation>, delegate: Arc<dyn DatabaseViewOperation>,
group_controller: Arc<RwLock<Option<Box<dyn GroupController>>>>, group_controller: Arc<RwLock<Option<Box<dyn GroupController>>>>,
@ -62,6 +63,7 @@ impl Drop for DatabaseViewEditor {
impl DatabaseViewEditor { impl DatabaseViewEditor {
pub async fn new( pub async fn new(
database_id: String,
view_id: String, view_id: String,
delegate: Arc<dyn DatabaseViewOperation>, delegate: Arc<dyn DatabaseViewOperation>,
cell_cache: CellCache, cell_cache: CellCache,
@ -104,6 +106,7 @@ impl DatabaseViewEditor {
make_calculations_controller(&view_id, delegate.clone(), notifier.clone()).await; make_calculations_controller(&view_id, delegate.clone(), notifier.clone()).await;
Ok(Self { Ok(Self {
database_id,
view_id, view_id,
delegate, delegate,
group_controller, group_controller,
@ -132,6 +135,7 @@ impl DatabaseViewEditor {
let mut result = CreateRowParams { let mut result = CreateRowParams {
collab_params: collab_database::rows::CreateRowParams { collab_params: collab_database::rows::CreateRowParams {
id: gen_row_id(), id: gen_row_id(),
database_id: self.database_id.clone(),
cells: Cells::new(), cells: Cells::new(),
height: 60, height: 60,
visibility: true, visibility: true,

View File

@ -65,8 +65,10 @@ impl DatabaseViews {
err err
)) ))
})?; })?;
let database_id = self.database.lock().get_database_id();
let editor = Arc::new( let editor = Arc::new(
DatabaseViewEditor::new( DatabaseViewEditor::new(
database_id,
view_id.to_owned(), view_id.to_owned(),
self.view_operation.clone(), self.view_operation.clone(),
self.cell_cache.clone(), self.cell_cache.clone(),

View File

@ -102,7 +102,7 @@ fn database_from_fields_and_rows(
let rows = rows let rows = rows
.iter() .iter()
.map(|cells| { .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() { for (index, cell_content) in cells.iter().enumerate() {
if let Some(field) = fields.get(index) { if let Some(field) = fields.get(index) {
let field_type = FieldType::from(field.field_type); let field_type = FieldType::from(field.field_type);

View File

@ -37,7 +37,7 @@ pub fn make_default_grid(view_id: &str, name: &str) -> CreateDatabaseParams {
database_id: database_id.clone(), database_id: database_id.clone(),
inline_view_id: view_id.to_string(), inline_view_id: view_id.to_string(),
views: vec![CreateViewParams { views: vec![CreateViewParams {
database_id, database_id: database_id.clone(),
view_id: view_id.to_string(), view_id: view_id.to_string(),
name: name.to_string(), name: name.to_string(),
layout: DatabaseLayout::Grid, layout: DatabaseLayout::Grid,
@ -51,9 +51,9 @@ pub fn make_default_grid(view_id: &str, name: &str) -> CreateDatabaseParams {
..Default::default() ..Default::default()
}], }],
rows: vec![ rows: vec![
CreateRowParams::new(gen_row_id()), CreateRowParams::new(gen_row_id(), database_id.clone()),
CreateRowParams::new(gen_row_id()), CreateRowParams::new(gen_row_id(), database_id.clone()),
CreateRowParams::new(gen_row_id()), CreateRowParams::new(gen_row_id(), database_id.clone()),
], ],
fields, fields,
} }
@ -85,7 +85,7 @@ pub fn make_default_board(view_id: &str, name: &str) -> CreateDatabaseParams {
let mut rows = vec![]; let mut rows = vec![];
for i in 0..3 { 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( row.cells.insert(
single_select_field_id.clone(), single_select_field_id.clone(),
insert_select_option_cell(vec![to_do_option.id.clone()], &single_select), insert_select_option_cell(vec![to_do_option.id.clone()], &single_select),

View File

@ -284,15 +284,17 @@ impl DatabaseEditorTest {
} }
pub struct TestRowBuilder<'a> { pub struct TestRowBuilder<'a> {
database_id: &'a str,
row_id: RowId, row_id: RowId,
fields: &'a [Field], fields: &'a [Field],
cell_build: CellBuilder<'a>, cell_build: CellBuilder<'a>,
} }
impl<'a> TestRowBuilder<'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); let cell_build = CellBuilder::with_cells(Default::default(), fields);
Self { Self {
database_id,
row_id, row_id,
fields, fields,
cell_build, cell_build,
@ -407,6 +409,7 @@ impl<'a> TestRowBuilder<'a> {
let timestamp = timestamp(); let timestamp = timestamp();
Row { Row {
id: self.row_id, id: self.row_id,
database_id: self.database_id.to_string(),
cells: self.cell_build.build(), cells: self.cell_build.build(),
height: 60, height: 60,
visibility: true, visibility: true,

View File

@ -16,6 +16,7 @@ use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, T
// Kanban board unit test mock data // Kanban board unit test mock data
pub fn make_test_board() -> DatabaseData { pub fn make_test_board() -> DatabaseData {
let database_id = gen_database_id();
let mut fields = vec![]; let mut fields = vec![];
let mut rows = vec![]; let mut rows = vec![];
// Iterate through the FieldType to create the corresponding Field. // 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. // 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 { 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 { match i {
0 => { 0 => {
for field_type in FieldType::iter() { for field_type in FieldType::iter() {
@ -242,7 +243,6 @@ pub fn make_test_board() -> DatabaseData {
let mut layout_settings = LayoutSettings::new(); let mut layout_settings = LayoutSettings::new();
layout_settings.insert(DatabaseLayout::Board, board_setting); layout_settings.insert(DatabaseLayout::Board, board_setting);
let database_id = gen_database_id();
let inline_view_id = gen_database_view_id(); let inline_view_id = gen_database_view_id();
let view = DatabaseView { let view = DatabaseView {

View File

@ -11,6 +11,7 @@ use crate::database::database_editor::TestRowBuilder;
// Calendar unit test mock data // Calendar unit test mock data
pub fn make_test_calendar() -> DatabaseData { pub fn make_test_calendar() -> DatabaseData {
let database_id = gen_database_id();
let mut fields = vec![]; let mut fields = vec![];
let mut rows = 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); let field_settings = default_field_settings_for_fields(&fields, DatabaseLayout::Calendar);
for i in 0..5 { 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 { match i {
0 => { 0 => {
for field_type in FieldType::iter() { for field_type in FieldType::iter() {
@ -106,7 +107,6 @@ pub fn make_test_calendar() -> DatabaseData {
let mut layout_settings = LayoutSettings::new(); let mut layout_settings = LayoutSettings::new();
layout_settings.insert(DatabaseLayout::Calendar, calendar_setting); layout_settings.insert(DatabaseLayout::Calendar, calendar_setting);
let database_id = gen_database_id();
let inline_view_id = gen_database_view_id(); let inline_view_id = gen_database_view_id();
let view = DatabaseView { let view = DatabaseView {

View File

@ -14,6 +14,7 @@ use crate::database::database_editor::TestRowBuilder;
use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER}; use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER};
pub fn make_test_grid() -> DatabaseData { pub fn make_test_grid() -> DatabaseData {
let database_id = gen_database_id();
let mut fields = vec![]; let mut fields = vec![];
let mut rows = 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); let field_settings = default_field_settings_for_fields(&fields, DatabaseLayout::Grid);
for i in 0..7 { 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 { match i {
0 => { 0 => {
for field_type in FieldType::iter() { for field_type in FieldType::iter() {
@ -265,7 +266,6 @@ pub fn make_test_grid() -> DatabaseData {
rows.push(row); rows.push(row);
} }
let database_id = gen_database_id();
let inline_view_id = gen_database_view_id(); let inline_view_id = gen_database_view_id();
let view = DatabaseView { let view = DatabaseView {
@ -287,6 +287,7 @@ pub fn make_test_grid() -> DatabaseData {
} }
pub fn make_no_date_test_grid() -> DatabaseData { pub fn make_no_date_test_grid() -> DatabaseData {
let database_id = gen_database_id();
let mut fields = vec![]; let mut fields = vec![];
let mut rows = 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); let field_settings = default_field_settings_for_fields(&fields, DatabaseLayout::Grid);
for i in 0..3 { 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 { match i {
0 => { 0 => {
for field_type in FieldType::iter() { for field_type in FieldType::iter() {
@ -353,7 +354,6 @@ pub fn make_no_date_test_grid() -> DatabaseData {
rows.push(row); rows.push(row);
} }
let database_id = gen_database_id();
let inline_view_id = gen_database_view_id(); let inline_view_id = gen_database_view_id();
let view = DatabaseView { let view = DatabaseView {

View File

@ -535,7 +535,7 @@ fn to_user_workspace(af_workspace: AFWorkspace) -> UserWorkspace {
id: af_workspace.workspace_id.to_string(), id: af_workspace.workspace_id.to_string(),
name: af_workspace.workspace_name, name: af_workspace.workspace_name,
created_at: af_workspace.created_at, 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, icon: af_workspace.icon,
} }
} }

View File

@ -231,7 +231,7 @@ fn make_user_workspace() -> UserWorkspace {
id: uuid::Uuid::new_v4().to_string(), id: uuid::Uuid::new_v4().to_string(),
name: "My Workspace".to_string(), name: "My Workspace".to_string(),
created_at: Default::default(), 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(), icon: "".to_string(),
} }
} }

View File

@ -21,10 +21,7 @@ async fn supabase_user_sign_up_test() {
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap(); let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
assert!(!user.latest_workspace.id.is_empty()); assert!(!user.latest_workspace.id.is_empty());
assert!(!user.user_workspaces.is_empty()); assert!(!user.user_workspaces.is_empty());
assert!(!user assert!(!user.latest_workspace.database_indexer_id.is_empty());
.latest_workspace
.workspace_database_object_id
.is_empty());
} }
#[tokio::test] #[tokio::test]
@ -41,10 +38,7 @@ async fn supabase_user_sign_up_with_existing_uuid_test() {
.unwrap(); .unwrap();
let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap(); let user: AuthResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
assert!(!user.latest_workspace.id.is_empty()); assert!(!user.latest_workspace.id.is_empty());
assert!(!user assert!(!user.latest_workspace.database_indexer_id.is_empty());
.latest_workspace
.workspace_database_object_id
.is_empty());
assert!(!user.user_workspaces.is_empty()); assert!(!user.user_workspaces.is_empty());
} }

View File

@ -139,7 +139,7 @@ pub struct UserWorkspace {
pub created_at: DateTime<Utc>, pub created_at: DateTime<Utc>,
/// The database storage id is used indexing all the database views in current workspace. /// The database storage id is used indexing all the database views in current workspace.
#[serde(rename = "database_storage_id")] #[serde(rename = "database_storage_id")]
pub workspace_database_object_id: String, pub database_indexer_id: String,
#[serde(default)] #[serde(default)]
pub icon: String, pub icon: String,
} }
@ -150,7 +150,7 @@ impl UserWorkspace {
id: workspace_id.to_string(), id: workspace_id.to_string(),
name: "".to_string(), name: "".to_string(),
created_at: Utc::now(), created_at: Utc::now(),
workspace_database_object_id: Uuid::new_v4().to_string(), database_indexer_id: Uuid::new_v4().to_string(),
icon: "".to_string(), icon: "".to_string(),
} }
} }

View File

@ -73,7 +73,7 @@ impl<'de> Visitor<'de> for SessionVisitor {
name: "My Workspace".to_string(), name: "My Workspace".to_string(),
created_at: Utc::now(), created_at: Utc::now(),
// For historical reasons, the database_storage_id is constructed by the user_id. // 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(), icon: "".to_owned(),
}) })
} }

View File

@ -35,6 +35,7 @@ pub fn migration_anon_user_on_sign_up(
.with_write_txn(|new_collab_w_txn| { .with_write_txn(|new_collab_w_txn| {
let old_collab_r_txn = old_collab_db.read_txn(); let old_collab_r_txn = old_collab_db.read_txn();
let old_to_new_id_map = Arc::new(Mutex::new(OldToNewIdMap::new())); let old_to_new_id_map = Arc::new(Mutex::new(OldToNewIdMap::new()));
migrate_user_awareness( migrate_user_awareness(
old_to_new_id_map.lock().deref_mut(), old_to_new_id_map.lock().deref_mut(),
old_user, 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 // Migration of all objects except the folder and database_with_views
object_ids.retain(|id| { object_ids.retain(|id| {
id != &old_user.session.user_workspace.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()); info!("migrate collab objects: {:?}", object_ids.len());
@ -84,7 +85,7 @@ pub fn migration_anon_user_on_sign_up(
// Migrate other collab objects // Migrate other collab objects
for object_id in &object_ids { for object_id in &object_ids {
if let Some(collab) = collab_by_oid.get(object_id) { 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,); tracing::debug!("migrate from: {}, to: {}", object_id, new_object_id,);
migrate_collab_object( migrate_collab_object(
collab, collab,
@ -109,7 +110,7 @@ impl OldToNewIdMap {
fn new() -> Self { fn new() -> Self {
Self::default() 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 let view_id = self
.0 .0
.entry(old_id.to_string()) .entry(old_id.to_string())
@ -148,7 +149,7 @@ where
{ {
let database_with_views_collab = Collab::new( let database_with_views_collab = Collab::new(
old_user.session.user_id, old_user.session.user_id,
&old_user.session.user_workspace.workspace_database_object_id, &old_user.session.user_workspace.database_indexer_id,
"phantom", "phantom",
vec![], vec![],
false, false,
@ -156,13 +157,13 @@ where
database_with_views_collab.with_origin_transact_mut(|txn| { database_with_views_collab.with_origin_transact_mut(|txn| {
old_collab_r_txn.load_doc_with_txn( old_collab_r_txn.load_doc_with_txn(
old_user.session.user_id, old_user.session.user_id,
&old_user.session.user_workspace.workspace_database_object_id, &old_user.session.user_workspace.database_indexer_id,
txn, txn,
) )
})?; })?;
let new_uid = new_user_session.user_id; 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); let array = DatabaseMetaList::from_collab(&database_with_views_collab);
for database_meta in array.get_all_database_meta() { for database_meta in array.get_all_database_meta() {
@ -170,9 +171,9 @@ where
let new_linked_views = update let new_linked_views = update
.linked_views .linked_views
.iter() .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(); .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; update.linked_views = new_linked_views;
}) })
} }
@ -237,7 +238,7 @@ where
let fav_map = old_fav_map let fav_map = old_fav_map
.into_iter() .into_iter()
.map(|mut item| { .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.id = new_view_id;
item item
}) })
@ -248,7 +249,7 @@ where
let trash_map = old_trash_map let trash_map = old_trash_map
.into_iter() .into_iter()
.map(|mut item| { .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.id = new_view_id;
item item
}) })
@ -260,7 +261,7 @@ where
let recent_map = old_recent_map let recent_map = old_recent_map
.into_iter() .into_iter()
.map(|mut item| { .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.id = new_view_id;
item item
}) })
@ -279,19 +280,19 @@ where
.child_views .child_views
.iter_mut() .iter_mut()
.for_each(|view_identifier| { .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| { folder_data.views.iter_mut().for_each(|view| {
// 2. replace the old parent view id of the 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 // 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 // 4. replace the old id of the children views
view.children.iter_mut().for_each(|view_identifier| { 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 // Migrate databases
let mut database_object_ids = vec![]; 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 { for object_id in &mut *object_ids {
if let Some(collab) = collab_by_oid.get(object_id) { if let Some(collab) = collab_by_oid.get(object_id) {
@ -359,14 +361,17 @@ where
database_object_ids.push(object_id.clone()); database_object_ids.push(object_id.clone());
reset_inline_view_id(collab, |old_inline_view_id| { 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| { 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 let new_database_id = old_to_new_id_map
.lock() .lock()
.get_new_id(&database_view.database_id); .exchange_new_id(&database_view.database_id);
tracing::trace!( tracing::trace!(
"migrate database view id from: {}, to: {}", "migrate database view id from: {}, to: {}",
@ -384,7 +389,7 @@ where
database_view.row_orders.iter_mut().for_each(|row_order| { database_view.row_orders.iter_mut().for_each(|row_order| {
let old_row_id = String::from(row_order.id.clone()); 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 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); 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!("migrate row id: {} to {}", row_order.id, new_row_id);
tracing::debug!( tracing::debug!(
@ -397,11 +402,15 @@ where
.insert(old_row_document_id, new_row_document_id); .insert(old_row_document_id, new_row_document_id);
row_order.id = RowId::from(new_row_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!( tracing::debug!(
"migrate database from: {}, to: {}", "migrate database from: {}, to: {}",
object_id, 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)); object_ids.retain(|id| !database_object_ids.contains(id));
let database_row_object_ids = database_row_object_ids.read(); // remove database row object ids from the imported object ids
for object_id in &*database_row_object_ids { object_ids.retain(|id| {
if let Some(collab) = collab_by_oid.get(object_id) { !imported_database_row_object_ids
let new_object_id = old_to_new_id_map.lock().get_new_id(object_id); .values()
tracing::info!( .flatten()
"migrate database row from: {}, to: {}", .any(|row_id| row_id == id)
object_id, });
new_object_id, for (database_id, imported_row_ids) in &*imported_database_row_object_ids {
); for imported_row_id in imported_row_ids {
mut_row_with_collab(collab, |row_update| { if let Some(imported_collab) = collab_by_oid.get(imported_row_id) {
row_update.set_row_id(RowId::from(new_object_id.clone())); 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);
migrate_collab_object( info!(
collab, "import database row from: {}, to: {}",
new_user_session.user_id, imported_row_id, new_row_id,
&new_object_id, );
new_collab_w_txn, 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(()) Ok(())
} }
@ -456,7 +484,7 @@ where
let collab = Collab::new( let collab = Collab::new(
old_user.session.user_id, old_user.session.user_id,
object_id, object_id,
"phantom", "migrate_device",
vec![], vec![],
false, false,
); );

View File

@ -43,7 +43,7 @@ pub async fn sync_supabase_user_data_to_cloud(
uid, uid,
&workspace_id, &workspace_id,
device_id, device_id,
&new_user_session.user_workspace.workspace_database_object_id, &new_user_session.user_workspace.database_indexer_id,
collab_db, collab_db,
user_service.clone(), user_service.clone(),
) )

View File

@ -14,7 +14,7 @@ use crate::notification::{send_notification, UserNotification};
use crate::services::cloud_config::{ use crate::services::cloud_config::{
get_cloud_config, get_or_create_cloud_config, save_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; use crate::user_manager::UserManager;
fn upgrade_manager(manager: AFPluginState<Weak<UserManager>>) -> FlowyResult<Arc<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 { af_spawn(async move {
let result = async { let result = async {
let manager = upgrade_manager(manager)?; 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()))? .map_err(|err| FlowyError::new(ErrorCode::AppFlowyDataFolderImportError, err.to_string()))?
.with_container_name(data.import_container_name); .with_container_name(data.import_container_name);
manager.import_appflowy_data_folder(context).await?;
manager.perform_import(imported_folder).await?;
Ok::<(), FlowyError>(()) Ok::<(), FlowyError>(())
} }
.await; .await;

View File

@ -69,7 +69,7 @@ impl AuthenticateUser {
pub fn workspace_database_object_id(&self) -> FlowyResult<String> { pub fn workspace_database_object_id(&self) -> FlowyResult<String> {
let session = self.get_session()?; 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>> { pub fn get_collab_db(&self, uid: i64) -> FlowyResult<Weak<CollabKVDB>> {

View File

@ -1,4 +1,5 @@
use crate::migrations::session_migration::migrate_session_with_user_uuid; use crate::migrations::session_migration::migrate_session_with_user_uuid;
use crate::services::data_import::importer::load_collab_by_oid; use crate::services::data_import::importer::load_collab_by_oid;
use crate::services::db::UserDBPath; use crate::services::db::UserDBPath;
use crate::services::entities::UserPaths; use crate::services::entities::UserPaths;
@ -20,6 +21,7 @@ use collab_entity::CollabType;
use collab_folder::{Folder, UserId, View, ViewIdentifier, ViewLayout}; use collab_folder::{Folder, UserId, View, ViewIdentifier, ViewLayout};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError}; use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use collab_plugins::local_storage::kv::KVTransactionDB; use collab_plugins::local_storage::kv::KVTransactionDB;
use flowy_error::FlowyError; use flowy_error::FlowyError;
use flowy_folder_pub::cloud::gen_view_id; use flowy_folder_pub::cloud::gen_view_id;
use flowy_folder_pub::entities::{AppFlowyData, ImportData}; use flowy_folder_pub::entities::{AppFlowyData, ImportData};
@ -35,20 +37,27 @@ use std::path::Path;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use tracing::{debug, error, event, info, instrument, warn}; use tracing::{debug, error, event, info, instrument, warn};
pub(crate) struct ImportContext { pub(crate) struct ImportedFolder {
pub imported_session: Session, pub imported_session: Session,
pub imported_collab_db: Arc<CollabKVDB>, pub imported_collab_db: Arc<CollabKVDB>,
pub container_name: Option<String>, pub container_name: Option<String>,
pub source: ImportedSource,
} }
impl ImportContext { #[derive(Clone)]
pub(crate) enum ImportedSource {
ExternalFolder,
AnonUser,
}
impl ImportedFolder {
pub fn with_container_name(mut self, container_name: Option<String>) -> Self { pub fn with_container_name(mut self, container_name: Option<String>) -> Self {
self.container_name = container_name; self.container_name = container_name;
self 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() { if !Path::new(path).exists() {
return Err(anyhow!("The path: {} is not exist", path)); 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, None,
); );
Ok(ImportContext { Ok(ImportedFolder {
imported_session, imported_session,
imported_collab_db, imported_collab_db,
container_name: None, 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: /// This path refers to the directory where AppFlowy stores its data. The directory structure is as follows:
/// root folder: /// root folder:
/// - cache.db /// - cache.db
/// - log (log files with unique identifiers) /// - log (log files with unique identifiers)
/// - 2761499 (other relevant files or directories, identified by unique numbers) /// - 2761499 (other relevant files or directories, identified by unique numbers)
pub(crate) fn import_appflowy_data_folder( pub(crate) fn generate_import_data(
session: &Session, current_session: &Session,
workspace_id: &str, workspace_id: &str,
collab_db: &Arc<CollabKVDB>, collab_db: &Arc<CollabKVDB>,
import_context: ImportContext, imported_folder: ImportedFolder,
) -> anyhow::Result<ImportData> { ) -> anyhow::Result<ImportData> {
let imported_session = import_context.imported_session; let imported_session = imported_folder.imported_session.clone();
let imported_collab_db = import_context.imported_collab_db; let imported_collab_db = imported_folder.imported_collab_db.clone();
let container_name = import_context.container_name; 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 mut database_view_ids_by_database_id: HashMap<String, Vec<String>> = HashMap::new();
let row_object_ids = Mutex::new(HashSet::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 document_object_ids = Mutex::new(HashSet::new());
let database_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(), // All the imported views will be attached to the container view. If the container view name is not provided,
Some(_) => gen_view_id().to_string(), // 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 views = collab_db.with_write_txn(|collab_write_txn| {
let imported_collab_read_txn = imported_collab_db.read_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 // 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())); 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 let mut all_imported_object_ids = imported_collab_read_txn
.get_all_docs() .get_all_docs()
.map(|iter| iter.collect::<Vec<String>>()) .map(|iter| iter.collect::<Vec<String>>())
.unwrap_or_default(); .unwrap_or_default();
// when doing import, we don't want to import the user workspace, database view tracker and the user awareness // when doing import, we don't want to import these objects:
all_imported_object_ids.retain(|id| id != &imported_session.user_workspace.id); // 1. user workspace
all_imported_object_ids // 2. database view tracker
.retain(|id| id != &imported_session.user_workspace.workspace_database_object_id); // 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| { all_imported_object_ids.retain(|id| {
id != &user_awareness_object_id( id != user_workspace_id && id != database_indexer_id && id != &user_awareness_id
&imported_session.user_uuid,
&imported_session.user_workspace.id,
)
.to_string()
}); });
// import database view tracker match imported_folder.source {
migrate_database_view_tracker( ImportedSource::ExternalFolder => {
&mut old_to_new_id_map.lock(), // 2. mapping the database indexer ids
&imported_session, mapping_database_indexer_ids(
&imported_collab_read_txn, &mut old_to_new_id_map.lock(),
&mut database_view_ids_by_database_id, &imported_session,
&database_object_ids, &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 let database_view_ids: Vec<String> = database_view_ids_by_database_id
.values() .values()
.flatten() .flatten()
@ -154,99 +199,74 @@ pub(crate) fn import_appflowy_data_folder(
.collect(); .collect();
all_imported_object_ids.retain(|id| !database_view_ids.contains(id)); 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( let imported_collab_by_oid = load_collab_by_oid(
imported_session.user_id, imported_session.user_id,
&imported_collab_read_txn, &imported_collab_read_txn,
&all_imported_object_ids, &all_imported_object_ids,
); );
// import the database // import the database
migrate_databases( migrate_databases(
&old_to_new_id_map, &old_to_new_id_map,
session, current_session,
collab_write_txn, collab_write_txn,
&mut all_imported_object_ids, &mut all_imported_object_ids,
&imported_collab_by_oid, &imported_collab_by_oid,
&row_object_ids, &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 // the object ids now only contains the document collab object ids
for object_id in &all_imported_object_ids { for object_id in &all_imported_object_ids {
if let Some(imported_collab) = imported_collab_by_oid.get(object_id) { 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()); document_object_ids.lock().insert(new_object_id.clone());
debug!("import from: {}, to: {}", object_id, new_object_id,); debug!("import from: {}, to: {}", object_id, new_object_id,);
write_collab_object( write_collab_object(
imported_collab, imported_collab,
session.user_id, current_session.user_id,
&new_object_id, &new_object_id,
collab_write_txn, collab_write_txn,
); );
} }
} }
// create a root view that contains all the views // Update the parent view IDs of all top-level views to match the new container view ID, making
let (mut child_views, orphan_views) = import_workspace_views( // 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, &import_container_view_id,
&mut old_to_new_id_map.lock(), &mut old_to_new_id_map.lock(),
&imported_session, &imported_session,
&imported_collab_read_txn, &imported_collab_read_txn,
)?; )?;
match container_name { match imported_folder.source {
None => { 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); child_views.extend(orphan_views);
Ok(child_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 { Ok(ImportData::AppFlowyDataFolder {
items: vec![ items: vec![
AppFlowyData::Folder { 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
};
fn migrate_database_view_tracker<'a, W>( // 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 mapping_database_indexer_ids<'a, W>(
old_to_new_id_map: &mut OldToNewIdMap, old_to_new_id_map: &mut OldToNewIdMap,
other_session: &Session, imported_session: &Session,
other_collab_read_txn: &W, imported_collab_read_txn: &W,
database_view_ids_by_database_id: &mut HashMap<String, Vec<String>>, database_view_ids_by_database_id: &mut HashMap<String, Vec<String>>,
database_object_ids: &Mutex<HashSet<String>>, database_object_ids: &Mutex<HashSet<String>>,
) -> Result<(), PersistenceError> ) -> Result<(), PersistenceError>
@ -273,29 +343,29 @@ where
W: CollabKVAction<'a>, W: CollabKVAction<'a>,
PersistenceError: From<W::Error>, PersistenceError: From<W::Error>,
{ {
let database_view_tracker_collab = Collab::new( let imported_database_indexer = Collab::new(
other_session.user_id, imported_session.user_id,
&other_session.user_workspace.workspace_database_object_id, &imported_session.user_workspace.database_indexer_id,
"phantom", "import_device",
vec![], vec![],
false, false,
); );
database_view_tracker_collab.with_origin_transact_mut(|txn| { imported_database_indexer.with_origin_transact_mut(|txn| {
other_collab_read_txn.load_doc_with_txn( imported_collab_read_txn.load_doc_with_txn(
other_session.user_id, imported_session.user_id,
&other_session.user_workspace.workspace_database_object_id, &imported_session.user_workspace.database_indexer_id,
txn, txn,
) )
})?; })?;
let array = DatabaseMetaList::from_collab(&database_view_tracker_collab); let array = DatabaseMetaList::from_collab(&imported_database_indexer);
for database_meta in array.get_all_database_meta() { for database_meta_list in array.get_all_database_meta() {
database_view_ids_by_database_id.insert( database_view_ids_by_database_id.insert(
old_to_new_id_map.renew_id(&database_meta.database_id), old_to_new_id_map.exchange_new_id(&database_meta_list.database_id),
database_meta database_meta_list
.linked_views .linked_views
.into_iter() .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(), .collect(),
); );
} }
@ -308,6 +378,59 @@ where
Ok(()) 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>( fn migrate_databases<'a, W>(
old_to_new_id_map: &Arc<Mutex<OldToNewIdMap>>, old_to_new_id_map: &Arc<Mutex<OldToNewIdMap>>,
session: &Session, session: &Session,
@ -315,15 +438,16 @@ fn migrate_databases<'a, W>(
imported_object_ids: &mut Vec<String>, imported_object_ids: &mut Vec<String>,
imported_collab_by_oid: &HashMap<String, Collab>, imported_collab_by_oid: &HashMap<String, Collab>,
row_object_ids: &Mutex<HashSet<String>>, row_object_ids: &Mutex<HashSet<String>>,
row_document_object_ids: &Mutex<HashSet<String>>,
) -> Result<(), PersistenceError> ) -> Result<(), PersistenceError>
where where
W: CollabKVAction<'a>, W: CollabKVAction<'a>,
PersistenceError: From<W::Error>, PersistenceError: From<W::Error>,
{ {
// Migrate databases // Migrate databases
let row_document_object_ids = Mutex::new(HashSet::new());
let mut database_object_ids = vec![]; 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 { for object_id in &mut *imported_object_ids {
if let Some(database_collab) = imported_collab_by_oid.get(object_id) { if let Some(database_collab) = imported_collab_by_oid.get(object_id) {
@ -333,21 +457,24 @@ where
database_object_ids.push(object_id.clone()); database_object_ids.push(object_id.clone());
reset_inline_view_id(database_collab, |old_inline_view_id| { 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| { 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 let new_database_id = old_to_new_id_map
.lock() .lock()
.renew_id(&database_view.database_id); .exchange_new_id(&database_view.database_id);
database_view.id = new_view_id; database_view.id = new_view_id;
database_view.database_id = new_database_id; database_view.database_id = new_database_id;
database_view.row_orders.iter_mut().for_each(|row_order| { database_view.row_orders.iter_mut().for_each(|row_order| {
let old_row_id = String::from(row_order.id.clone()); 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 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, // 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. // 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); 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); .insert(old_row_document_id.clone(), new_row_document_id);
row_order.id = RowId::from(new_row_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 // collect the ids
@ -369,7 +501,7 @@ where
row_object_ids.lock().extend(new_row_ids); 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!( debug!(
"migrate database from: {}, to: {}", "migrate database from: {}, to: {}",
object_id, new_object_id, object_id, new_object_id,
@ -386,38 +518,59 @@ where
// remove the database object ids from the object ids // remove the database object ids from the object ids
imported_object_ids.retain(|id| !database_object_ids.contains(id)); 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 { // remove database row object ids from the imported object ids
if let Some(imported_collab) = imported_collab_by_oid.get(imported_row_id) { imported_object_ids.retain(|id| {
let new_row_id = old_to_new_id_map.lock().renew_id(imported_row_id); !imported_database_row_object_ids
info!( .values()
"import database row from: {}, to: {}", .flatten()
imported_row_id, new_row_id, .any(|row_id| row_id == 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,
);
}
// imported_collab_by_oid contains all the collab object ids, including the row document collab object ids. for (database_id, imported_row_ids) in &*imported_database_row_object_ids {
// So, if the id exist in the imported_collab_by_oid, it means the row document collab object is exist. for imported_row_id in imported_row_ids {
let imported_row_document_id = database_row_document_id_from_row_id(imported_row_id); if let Some(imported_collab) = imported_collab_by_oid.get(imported_row_id) {
if imported_collab_by_oid let new_database_id = old_to_new_id_map.lock().exchange_new_id(database_id);
.get(&imported_row_document_id) let new_row_id = old_to_new_id_map.lock().exchange_new_id(imported_row_id);
.is_some() info!(
{ "import database row from: {}, to: {}",
let new_row_document_id = old_to_new_id_map.lock().renew_id(&imported_row_document_id); imported_row_id, new_row_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(()) Ok(())
} }
@ -476,58 +629,59 @@ where
Ok(()) Ok(())
} }
fn import_workspace_views<'a, W>( fn mapping_folder_views<'a, W>(
parent_view_id: &str, root_view_id: &str,
old_to_new_id_map: &mut OldToNewIdMap, old_to_new_id_map: &mut OldToNewIdMap,
other_session: &Session, imported_session: &Session,
other_collab_read_txn: &W, imported_collab_read_txn: &W,
) -> Result<(Vec<ParentChildViews>, Vec<ParentChildViews>), PersistenceError> ) -> Result<(Vec<ParentChildViews>, Vec<ParentChildViews>), PersistenceError>
where where
W: CollabKVAction<'a>, W: CollabKVAction<'a>,
PersistenceError: From<W::Error>, PersistenceError: From<W::Error>,
{ {
let other_folder_collab = Collab::new( let imported_folder_collab = Collab::new(
other_session.user_id, imported_session.user_id,
&other_session.user_workspace.id, &imported_session.user_workspace.id,
"phantom", "migrate_device",
vec![], vec![],
false, false,
); );
other_folder_collab.with_origin_transact_mut(|txn| { imported_folder_collab.with_origin_transact_mut(|txn| {
other_collab_read_txn.load_doc_with_txn( imported_collab_read_txn.load_doc_with_txn(
other_session.user_id, imported_session.user_id,
&other_session.user_workspace.id, &imported_session.user_workspace.id,
txn, txn,
) )
})?; })?;
let other_user_id = UserId::from(other_session.user_id); let other_user_id = UserId::from(imported_session.user_id);
let other_folder = Folder::open( let imported_folder = Folder::open(
other_user_id, other_user_id,
Arc::new(MutexCollab::new(other_folder_collab)), Arc::new(MutexCollab::new(imported_folder_collab)),
None, None,
) )
.map_err(|err| PersistenceError::InvalidData(err.to_string()))?; .map_err(|err| PersistenceError::InvalidData(err.to_string()))?;
let other_folder_data = other_folder let imported_folder_data = imported_folder
.get_folder_data(&other_session.user_workspace.id) .get_folder_data(&imported_session.user_workspace.id)
.ok_or(PersistenceError::Internal(anyhow!( .ok_or(PersistenceError::Internal(anyhow!(
"Can't read the folder data" "Can't read the folder data"
)))?; )))?;
// replace the old parent view id of the workspace // replace the old parent view id of the workspace
old_to_new_id_map.0.insert( old_to_new_id_map.0.insert(
other_session.user_workspace.id.clone(), imported_session.user_workspace.id.clone(),
parent_view_id.to_string(), root_view_id.to_string(),
); );
let trash_ids = other_folder_data
let trash_ids = imported_folder_data
.trash .trash
.into_values() .into_values()
.flatten() .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>>(); .collect::<Vec<String>>();
// 1. Replace the workspace views id to new id // 1. Replace the views id with new view id
let mut first_level_views = other_folder_data let mut first_level_views = imported_folder_data
.workspace .workspace
.child_views .child_views
.items .items
@ -536,20 +690,20 @@ where
.collect::<Vec<ViewIdentifier>>(); .collect::<Vec<ViewIdentifier>>();
first_level_views.iter_mut().for_each(|view_identifier| { 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| { all_views.iter_mut().for_each(|view| {
// 2. replace the old parent view id of the 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 // 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 // 4. replace the old id of the children views
view.children.iter_mut().for_each(|view_identifier| { 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)) .map(|view| (view.id.clone(), view))
.collect::<HashMap<String, View>>(); .collect::<HashMap<String, View>>();
// 5. create the parent views. Each parent view contains the children views.
let parent_views = first_level_views let parent_views = first_level_views
.into_iter() .into_iter()
.flat_map( .flat_map(
@ -569,7 +724,7 @@ where
) )
.collect::<Vec<ParentChildViews>>(); .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()); debug!("create orphan views: {:?}", all_views_map.keys());
let mut orphan_views = vec![]; let mut orphan_views = vec![];
for orphan_view in all_views_map.into_values() { for orphan_view in all_views_map.into_values() {
@ -610,7 +765,7 @@ impl OldToNewIdMap {
fn new() -> Self { fn new() -> Self {
Self::default() 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 let view_id = self
.0 .0
.entry(old_id.to_string()) .entry(old_id.to_string())

View File

@ -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 collab::preclude::Collab;
use flowy_folder_pub::entities::ImportData; use collab_integrate::{CollabKVAction, PersistenceError};
use std::sync::Arc; use std::collections::HashMap;
use tracing::instrument; 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)] #[instrument(level = "debug", skip_all)]
pub fn load_collab_by_oid<'a, R>( pub fn load_collab_by_oid<'a, R>(
uid: i64, uid: i64,

View File

@ -81,7 +81,7 @@ impl TryFrom<(i64, &UserWorkspace)> for UserWorkspaceTable {
if value.1.id.is_empty() { if value.1.id.is_empty() {
return Err(FlowyError::invalid_data().with_context("The 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")); 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(), name: value.1.name.clone(),
uid: value.0, uid: value.0,
created_at: value.1.created_at.timestamp(), 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(), icon: value.1.icon.clone(),
}) })
} }
@ -105,7 +105,7 @@ impl From<UserWorkspaceTable> for UserWorkspace {
.timestamp_opt(value.created_at, 0) .timestamp_opt(value.created_at, 0)
.single() .single()
.unwrap_or_default(), .unwrap_or_default(),
workspace_database_object_id: value.database_storage_id, database_indexer_id: value.database_storage_id,
icon: value.icon, icon: value.icon,
} }
} }

View File

@ -2,7 +2,7 @@ use collab_integrate::collab_builder::AppFlowyCollabBuilder;
use collab_integrate::CollabKVDB; use collab_integrate::CollabKVDB;
use collab_user::core::MutexUserAwareness; use collab_user::core::MutexUserAwareness;
use flowy_error::{internal_error, ErrorCode, FlowyResult}; use flowy_error::{internal_error, ErrorCode, FlowyResult};
use flowy_folder_pub::entities::ImportData;
use flowy_server_pub::AuthenticatorType; use flowy_server_pub::AuthenticatorType;
use flowy_sqlite::kv::StorePreferences; use flowy_sqlite::kv::StorePreferences;
use flowy_sqlite::schema::user_table; use flowy_sqlite::schema::user_table;
@ -36,8 +36,6 @@ use crate::migrations::AnonUser;
use crate::services::authenticate_user::AuthenticateUser; use crate::services::authenticate_user::AuthenticateUser;
use crate::services::cloud_config::get_cloud_config; use crate::services::cloud_config::get_cloud_config;
use crate::services::collab_interact::{CollabInteract, DefaultCollabInteract}; 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::services::sqlite_sql::user_sql::{select_user_profile, UserTable, UserTableChangeset};
use crate::user_manager::manager_user_encryption::validate_encryption_sign; use crate::user_manager::manager_user_encryption::validate_encryption_sign;
@ -791,24 +789,6 @@ impl UserManager {
)?; )?;
Ok(()) 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 { fn current_authenticator() -> Authenticator {

View File

@ -5,7 +5,7 @@ use collab_entity::{CollabObject, CollabType};
use collab_integrate::CollabKVDB; use collab_integrate::CollabKVDB;
use tracing::{error, info, instrument, warn}; 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_folder_pub::entities::{AppFlowyData, ImportData};
use flowy_sqlite::schema::user_workspace_table; use flowy_sqlite::schema::user_workspace_table;
use flowy_sqlite::{query_dsl::*, DBConnection, ExpressionMethods}; use flowy_sqlite::{query_dsl::*, DBConnection, ExpressionMethods};
@ -17,7 +17,9 @@ use lib_dispatch::prelude::af_spawn;
use crate::entities::{RepeatedUserWorkspacePB, ResetWorkspacePB}; use crate::entities::{RepeatedUserWorkspacePB, ResetWorkspacePB};
use crate::migrations::AnonUser; use crate::migrations::AnonUser;
use crate::notification::{send_notification, UserNotification}; 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::{ use crate::services::sqlite_sql::workspace_sql::{
get_all_user_workspace_op, get_user_workspace_op, insert_new_workspaces_op, UserWorkspaceTable, 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. /// 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. /// Otherwise, the data will be imported to the current workspace.
#[instrument(skip_all, err)] #[instrument(skip_all, err)]
pub(crate) async fn import_appflowy_data_folder( pub(crate) async fn perform_import(&self, imported_folder: ImportedFolder) -> FlowyResult<()> {
&self, let current_session = self.get_session()?;
context: ImportContext, let user_collab_db = self
) -> FlowyResult<()> { .authenticate_user
let session = self.get_session()?; .database
let import_data = self.import_appflowy_data(context).await?; .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 { match import_data {
ImportData::AppFlowyDataFolder { items } => { ImportData::AppFlowyDataFolder { items } => {
for item in 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( async fn upload_appflowy_data_item(
&self, &self,
session: &Session, current_session: &Session,
item: AppFlowyData, item: AppFlowyData,
) -> Result<(), FlowyError> { ) -> Result<(), FlowyError> {
match item { match item {
@ -79,13 +96,15 @@ impl UserManager {
document_object_ids, document_object_ids,
database_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 let user_collab_db = self
.get_collab_db(session.user_id)? .get_collab_db(current_session.user_id)?
.upgrade() .upgrade()
.ok_or_else(|| FlowyError::internal().with_context("Collab db not found"))?; .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_collab_db = Arc::downgrade(&user_collab_db);
let weak_user_cloud_service = self.cloud_services.get_user_service()?; let weak_user_cloud_service = self.cloud_services.get_user_service()?;
match upload_collab_objects_data( match upload_collab_objects_data(
@ -124,12 +143,13 @@ impl UserManager {
old_user: &AnonUser, old_user: &AnonUser,
old_collab_db: &Arc<CollabKVDB>, old_collab_db: &Arc<CollabKVDB>,
) -> FlowyResult<()> { ) -> FlowyResult<()> {
let import_context = ImportContext { let import_context = ImportedFolder {
imported_session: old_user.session.clone(), imported_session: old_user.session.clone(),
imported_collab_db: old_collab_db.clone(), imported_collab_db: old_collab_db.clone(),
container_name: None, container_name: None,
source: ImportedSource::AnonUser,
}; };
self.import_appflowy_data_folder(import_context).await?; self.perform_import(import_context).await?;
Ok(()) Ok(())
} }