chore: bump appflowy collab (#6649)

* chore: fix test

* chore: fix duplicated view name

* chore: fix windows build

* chore: clippy
This commit is contained in:
Nathan.fooo 2024-10-29 11:21:49 +08:00 committed by GitHub
parent 4e739c857b
commit 9707148b86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 477 additions and 188 deletions

View File

@ -219,7 +219,7 @@ dependencies = [
"tokio-stream",
"tokio-util",
"tracing",
"zip",
"zip 2.2.0",
"zip-extensions",
]
@ -305,8 +305,8 @@ dependencies = [
"memchr",
"pin-project-lite",
"xz2",
"zstd",
"zstd-safe",
"zstd 0.13.2",
"zstd-safe 7.2.0",
]
[[package]]
@ -455,6 +455,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "base64ct"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bincode"
version = "1.3.3"
@ -1024,7 +1030,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1049,7 +1055,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-trait",
@ -1088,7 +1094,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1109,7 +1115,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"bytes",
@ -1129,7 +1135,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1151,7 +1157,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-recursion",
@ -1164,6 +1170,7 @@ dependencies = [
"collab-document",
"collab-entity",
"collab-folder",
"csv",
"fancy-regex 0.13.0",
"futures",
"futures-lite",
@ -1183,6 +1190,7 @@ dependencies = [
"tracing",
"uuid",
"walkdir",
"zip 0.6.6",
]
[[package]]
@ -1210,7 +1218,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-stream",
@ -1290,7 +1298,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"collab",
@ -1343,6 +1351,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "constant_time_eq"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "constant_time_eq"
version = "0.3.0"
@ -1539,7 +1553,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 1.0.6",
"phf 0.11.2",
"phf 0.8.0",
"smallvec",
]
@ -2155,7 +2169,7 @@ dependencies = [
"tracing",
"uuid",
"validator 0.18.1",
"zip",
"zip 2.2.0",
"zip-extensions",
]
@ -2419,7 +2433,7 @@ dependencies = [
"base64 0.21.5",
"getrandom 0.2.10",
"hmac",
"pbkdf2",
"pbkdf2 0.12.2",
"rand 0.8.5",
"sha2",
]
@ -3999,7 +4013,7 @@ dependencies = [
"tracing",
"validator 0.18.1",
"walkdir",
"zip",
"zip 2.2.0",
]
[[package]]
@ -4898,12 +4912,35 @@ dependencies = [
"regex",
]
[[package]]
name = "password-hash"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"subtle",
]
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "pbkdf2"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest",
"hmac",
"password-hash",
"sha2",
]
[[package]]
name = "pbkdf2"
version = "0.12.2"
@ -6864,7 +6901,7 @@ dependencies = [
"tantivy-bitpacker",
"tantivy-common",
"tantivy-fst",
"zstd",
"zstd 0.13.2",
]
[[package]]
@ -8728,9 +8765,9 @@ dependencies = [
[[package]]
name = "yrs"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7744baf8d4f74beba8f47ca3a611c512766c82023f271167b14d21216559b014"
checksum = "81de5913bca29f43a1d12ca92a7b39a2945e9420e01602a7563917c7bfc60f70"
dependencies = [
"arc-swap",
"async-lock",
@ -8784,6 +8821,26 @@ dependencies = [
"syn 2.0.47",
]
[[package]]
name = "zip"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
"aes",
"byteorder",
"bzip2",
"constant_time_eq 0.1.5",
"crc32fast",
"crossbeam-utils",
"flate2",
"hmac",
"pbkdf2 0.11.0",
"sha1",
"time",
"zstd 0.11.2+zstd.1.5.2",
]
[[package]]
name = "zip"
version = "2.2.0"
@ -8793,7 +8850,7 @@ dependencies = [
"aes",
"arbitrary",
"bzip2",
"constant_time_eq",
"constant_time_eq 0.3.0",
"crc32fast",
"crossbeam-utils",
"deflate64",
@ -8803,14 +8860,14 @@ dependencies = [
"indexmap 2.1.0",
"lzma-rs",
"memchr",
"pbkdf2",
"pbkdf2 0.12.2",
"rand 0.8.5",
"sha1",
"thiserror",
"time",
"zeroize",
"zopfli",
"zstd",
"zstd 0.13.2",
]
[[package]]
@ -8819,7 +8876,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb0a99499b3497d765525c5d05e3ade9ca4a731c184365c19472c3fd6ba86341"
dependencies = [
"zip",
"zip 2.2.0",
]
[[package]]
@ -8836,13 +8893,32 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "zstd"
version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [
"zstd-safe 5.0.2+zstd.1.5.2",
]
[[package]]
name = "zstd"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9"
dependencies = [
"zstd-safe",
"zstd-safe 7.2.0",
]
[[package]]
name = "zstd-safe"
version = "5.0.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
dependencies = [
"libc",
"zstd-sys",
]
[[package]]

View File

@ -120,14 +120,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
# Working directory: frontend
# To update the commit ID, run:

View File

@ -210,7 +210,7 @@ dependencies = [
"tokio-stream",
"tokio-util",
"tracing",
"zip",
"zip 2.2.0",
"zip-extensions",
]
@ -315,8 +315,8 @@ dependencies = [
"memchr",
"pin-project-lite",
"xz2",
"zstd",
"zstd-safe",
"zstd 0.13.2",
"zstd-safe 7.2.0",
]
[[package]]
@ -465,6 +465,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "base64ct"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bincode"
version = "1.3.3"
@ -1022,7 +1028,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1047,7 +1053,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-trait",
@ -1086,7 +1092,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1107,7 +1113,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"bytes",
@ -1127,7 +1133,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1149,7 +1155,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-recursion",
@ -1162,6 +1168,7 @@ dependencies = [
"collab-document",
"collab-entity",
"collab-folder",
"csv",
"fancy-regex 0.13.0",
"futures",
"futures-lite",
@ -1181,6 +1188,7 @@ dependencies = [
"tracing",
"uuid",
"walkdir",
"zip 0.6.6",
]
[[package]]
@ -1208,7 +1216,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-stream",
@ -1288,7 +1296,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"collab",
@ -1341,6 +1349,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "constant_time_eq"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "constant_time_eq"
version = "0.3.0"
@ -1544,7 +1558,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 1.0.10",
"phf 0.11.2",
"phf 0.8.0",
"smallvec",
]
@ -2200,7 +2214,7 @@ dependencies = [
"tracing",
"uuid",
"validator 0.18.1",
"zip",
"zip 2.2.0",
"zip-extensions",
]
@ -2464,7 +2478,7 @@ dependencies = [
"base64 0.21.7",
"getrandom 0.2.12",
"hmac",
"pbkdf2",
"pbkdf2 0.12.2",
"rand 0.8.5",
"sha2",
]
@ -4091,7 +4105,7 @@ dependencies = [
"tracing",
"validator 0.18.1",
"walkdir",
"zip",
"zip 2.2.0",
]
[[package]]
@ -4975,12 +4989,35 @@ dependencies = [
"regex",
]
[[package]]
name = "password-hash"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"subtle",
]
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "pbkdf2"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest",
"hmac",
"password-hash",
"sha2",
]
[[package]]
name = "pbkdf2"
version = "0.12.2"
@ -6941,7 +6978,7 @@ dependencies = [
"tantivy-bitpacker",
"tantivy-common",
"tantivy-fst",
"zstd",
"zstd 0.13.2",
]
[[package]]
@ -8970,9 +9007,9 @@ dependencies = [
[[package]]
name = "yrs"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7744baf8d4f74beba8f47ca3a611c512766c82023f271167b14d21216559b014"
checksum = "81de5913bca29f43a1d12ca92a7b39a2945e9420e01602a7563917c7bfc60f70"
dependencies = [
"arc-swap",
"async-lock",
@ -9026,6 +9063,26 @@ dependencies = [
"syn 2.0.55",
]
[[package]]
name = "zip"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
"aes",
"byteorder",
"bzip2",
"constant_time_eq 0.1.5",
"crc32fast",
"crossbeam-utils",
"flate2",
"hmac",
"pbkdf2 0.11.0",
"sha1",
"time",
"zstd 0.11.2+zstd.1.5.2",
]
[[package]]
name = "zip"
version = "2.2.0"
@ -9035,7 +9092,7 @@ dependencies = [
"aes",
"arbitrary",
"bzip2",
"constant_time_eq",
"constant_time_eq 0.3.0",
"crc32fast",
"crossbeam-utils",
"deflate64",
@ -9045,14 +9102,14 @@ dependencies = [
"indexmap 2.2.6",
"lzma-rs",
"memchr",
"pbkdf2",
"pbkdf2 0.12.2",
"rand 0.8.5",
"sha1",
"thiserror",
"time",
"zeroize",
"zopfli",
"zstd",
"zstd 0.13.2",
]
[[package]]
@ -9061,7 +9118,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb0a99499b3497d765525c5d05e3ade9ca4a731c184365c19472c3fd6ba86341"
dependencies = [
"zip",
"zip 2.2.0",
]
[[package]]
@ -9078,13 +9135,32 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "zstd"
version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [
"zstd-safe 5.0.2+zstd.1.5.2",
]
[[package]]
name = "zstd"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9"
dependencies = [
"zstd-safe",
"zstd-safe 7.2.0",
]
[[package]]
name = "zstd-safe"
version = "5.0.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
dependencies = [
"libc",
"zstd-sys",
]
[[package]]

View File

@ -118,14 +118,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
# Working directory: frontend

View File

@ -210,7 +210,7 @@ dependencies = [
"tokio-stream",
"tokio-util",
"tracing",
"zip",
"zip 2.2.0",
"zip-extensions",
]
@ -279,8 +279,8 @@ dependencies = [
"memchr",
"pin-project-lite",
"xz2",
"zstd",
"zstd-safe",
"zstd 0.13.2",
"zstd-safe 7.2.0",
]
[[package]]
@ -450,6 +450,12 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "base64ct"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
[[package]]
name = "bincode"
version = "1.3.3"
@ -885,7 +891,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -910,7 +916,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-trait",
@ -949,7 +955,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -970,7 +976,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"bytes",
@ -990,7 +996,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"arc-swap",
@ -1012,7 +1018,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-recursion",
@ -1025,6 +1031,7 @@ dependencies = [
"collab-document",
"collab-entity",
"collab-folder",
"csv",
"fancy-regex 0.13.0",
"futures",
"futures-lite",
@ -1044,6 +1051,7 @@ dependencies = [
"tracing",
"uuid",
"walkdir",
"zip 0.6.6",
]
[[package]]
@ -1071,7 +1079,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"async-stream",
@ -1151,7 +1159,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c57466ae765669d79879c7d1d3fca219044f2a16#c57466ae765669d79879c7d1d3fca219044f2a16"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a302e9aaa3a86b7c2fe63992c312959feaf80bc0#a302e9aaa3a86b7c2fe63992c312959feaf80bc0"
dependencies = [
"anyhow",
"collab",
@ -1225,6 +1233,12 @@ dependencies = [
"tracing-subscriber",
]
[[package]]
name = "constant_time_eq"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "constant_time_eq"
version = "0.3.0"
@ -1374,7 +1388,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
"phf 0.11.2",
"phf 0.8.0",
"smallvec",
]
@ -1830,7 +1844,7 @@ dependencies = [
"tracing",
"uuid",
"walkdir",
"zip",
"zip 2.2.0",
]
[[package]]
@ -2015,7 +2029,7 @@ dependencies = [
"tracing-subscriber",
"uuid",
"validator 0.18.1",
"zip",
"zip 2.2.0",
"zip-extensions",
]
@ -2284,7 +2298,7 @@ dependencies = [
"base64 0.21.5",
"getrandom 0.2.10",
"hmac",
"pbkdf2",
"pbkdf2 0.12.2",
"rand 0.8.5",
"sha2",
]
@ -3546,7 +3560,7 @@ dependencies = [
"tracing",
"validator 0.18.1",
"walkdir",
"zip",
"zip 2.2.0",
]
[[package]]
@ -4241,6 +4255,29 @@ dependencies = [
"regex",
]
[[package]]
name = "password-hash"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"subtle",
]
[[package]]
name = "pbkdf2"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
dependencies = [
"digest",
"hmac",
"password-hash",
"sha2",
]
[[package]]
name = "pbkdf2"
version = "0.12.2"
@ -4327,7 +4364,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
"phf_macros 0.8.0",
"phf_macros",
"phf_shared 0.8.0",
"proc-macro-hack",
]
@ -4347,7 +4384,6 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_macros 0.11.2",
"phf_shared 0.11.2",
]
@ -4415,19 +4451,6 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "phf_macros"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
dependencies = [
"phf_generator 0.11.2",
"phf_shared 0.11.2",
"proc-macro2",
"quote",
"syn 2.0.47",
]
[[package]]
name = "phf_shared"
version = "0.8.0"
@ -6097,7 +6120,7 @@ dependencies = [
"tantivy-bitpacker",
"tantivy-common",
"tantivy-fst",
"zstd",
"zstd 0.13.2",
]
[[package]]
@ -7377,9 +7400,9 @@ dependencies = [
[[package]]
name = "yrs"
version = "0.21.2"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7744baf8d4f74beba8f47ca3a611c512766c82023f271167b14d21216559b014"
checksum = "81de5913bca29f43a1d12ca92a7b39a2945e9420e01602a7563917c7bfc60f70"
dependencies = [
"arc-swap",
"async-lock",
@ -7433,6 +7456,26 @@ dependencies = [
"syn 2.0.47",
]
[[package]]
name = "zip"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
"aes",
"byteorder",
"bzip2",
"constant_time_eq 0.1.5",
"crc32fast",
"crossbeam-utils",
"flate2",
"hmac",
"pbkdf2 0.11.0",
"sha1",
"time",
"zstd 0.11.2+zstd.1.5.2",
]
[[package]]
name = "zip"
version = "2.2.0"
@ -7442,7 +7485,7 @@ dependencies = [
"aes",
"arbitrary",
"bzip2",
"constant_time_eq",
"constant_time_eq 0.3.0",
"crc32fast",
"crossbeam-utils",
"deflate64",
@ -7452,14 +7495,14 @@ dependencies = [
"indexmap 2.1.0",
"lzma-rs",
"memchr",
"pbkdf2",
"pbkdf2 0.12.2",
"rand 0.8.5",
"sha1",
"thiserror",
"time",
"zeroize",
"zopfli",
"zstd",
"zstd 0.13.2",
]
[[package]]
@ -7468,7 +7511,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb0a99499b3497d765525c5d05e3ade9ca4a731c184365c19472c3fd6ba86341"
dependencies = [
"zip",
"zip 2.2.0",
]
[[package]]
@ -7485,13 +7528,32 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "zstd"
version = "0.11.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
dependencies = [
"zstd-safe 5.0.2+zstd.1.5.2",
]
[[package]]
name = "zstd"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9"
dependencies = [
"zstd-safe",
"zstd-safe 7.2.0",
]
[[package]]
name = "zstd-safe"
version = "5.0.2+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
dependencies = [
"libc",
"zstd-sys",
]
[[package]]

View File

@ -142,14 +142,14 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c57466ae765669d79879c7d1d3fca219044f2a16" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
# Working directory: frontend
# To update the commit ID, run:

View File

@ -1,4 +1,4 @@
use flowy_folder::view_operation::EncodedCollabWrapper;
use flowy_folder::view_operation::{EncodedCollabWrapper, ViewData};
use std::sync::Arc;
use collab_folder::{FolderData, View};
@ -128,7 +128,7 @@ impl EventIntegrationTest {
desc: "".to_string(),
layout: view.layout.into(),
view_id: view.id,
initial_data: vec![],
initial_data: ViewData::Empty,
meta: Default::default(),
set_as_current: false,
index: None,

View File

@ -36,10 +36,9 @@ pub fn make_test_summary_grid() -> DatabaseData {
let rows = create_rows(&database_id, &fields, options);
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
database_id: database_id.clone(),
id: inline_view_id.clone(),
id: gen_database_view_id(),
name: "".to_string(),
layout: DatabaseLayout::Grid,
field_settings,
@ -48,7 +47,6 @@ pub fn make_test_summary_grid() -> DatabaseData {
DatabaseData {
database_id,
inline_view_id,
views: vec![view],
fields,
rows,

View File

@ -178,10 +178,14 @@ impl FolderOperationHandler for DocumentFolderOperation {
params: CreateViewParams,
) -> Result<Option<EncodedCollab>, FlowyError> {
debug_assert_eq!(params.layout, ViewLayoutPB::Document);
let data = DocumentDataPB::try_from(Bytes::from(params.initial_data))?;
let data = match params.initial_data {
ViewData::DuplicateData(data) => Some(DocumentDataPB::try_from(data)?),
ViewData::Data(data) => Some(DocumentDataPB::try_from(data)?),
ViewData::Empty => None,
};
let encoded_collab = self
.0
.create_document(user_id, &params.view_id, Some(data.into()))
.create_document(user_id, &params.view_id, data.map(|d| d.into()))
.await?;
Ok(Some(encoded_collab))
}
@ -227,7 +231,7 @@ impl FolderOperationHandler for DocumentFolderOperation {
}
/// Create a view with built-in data.
async fn create_built_in_view(
async fn create_view_with_default_data(
&self,
user_id: i64,
view_id: &str,
@ -276,6 +280,10 @@ impl FolderOperationHandler for DocumentFolderOperation {
) -> Result<(), FlowyError> {
Ok(())
}
fn name(&self) -> &str {
"DocumentFolderOperationHandler"
}
}
struct DatabaseFolderOperation(Arc<DatabaseManager>);
@ -405,8 +413,7 @@ impl FolderOperationHandler for DatabaseFolderOperation {
}
async fn duplicate_view(&self, view_id: &str) -> Result<Bytes, FlowyError> {
let delta_bytes = self.0.get_database_json_bytes(view_id).await?;
Ok(Bytes::from(delta_bytes))
Ok(Bytes::from(view_id.to_string()))
}
/// Create a database view with duplicated data.
@ -418,12 +425,24 @@ impl FolderOperationHandler for DatabaseFolderOperation {
params: CreateViewParams,
) -> Result<Option<EncodedCollab>, FlowyError> {
match CreateDatabaseExtParams::from_map(params.meta.clone()) {
None => {
let encoded_collab = self
.0
.create_database_with_database_data(&params.view_id, params.initial_data)
.await?;
Ok(Some(encoded_collab))
None => match params.initial_data {
ViewData::DuplicateData(data) => {
let duplicated_view_id =
String::from_utf8(data.to_vec()).map_err(|_| FlowyError::invalid_data())?;
let encoded_collab = self
.0
.duplicate_database(&duplicated_view_id, &params.view_id)
.await?;
Ok(Some(encoded_collab))
},
ViewData::Data(data) => {
let encoded_collab = self
.0
.create_database_with_data(&params.view_id, data.to_vec())
.await?;
Ok(Some(encoded_collab))
},
ViewData::Empty => Ok(None),
},
Some(database_params) => {
let layout = match params.layout {
@ -456,7 +475,7 @@ impl FolderOperationHandler for DatabaseFolderOperation {
/// If the ext contains the {"database_id": "xx"}, then it will link to
/// the existing database. The data of the database will be shared within
/// these references views.
async fn create_built_in_view(
async fn create_view_with_default_data(
&self,
_user_id: i64,
view_id: &str,
@ -553,6 +572,10 @@ impl FolderOperationHandler for DatabaseFolderOperation {
Ok(())
}
}
fn name(&self) -> &str {
"DatabaseFolderOperationHandler"
}
}
#[derive(Debug, serde::Deserialize)]
@ -571,6 +594,10 @@ struct ChatFolderOperation(Arc<AIManager>);
#[async_trait]
impl FolderOperationHandler for ChatFolderOperation {
fn name(&self) -> &str {
"ChatFolderOperationHandler"
}
async fn open_view(&self, view_id: &str) -> Result<(), FlowyError> {
self.0.open_chat(view_id).await
}
@ -583,7 +610,7 @@ impl FolderOperationHandler for ChatFolderOperation {
self.0.delete_chat(view_id).await
}
async fn duplicate_view(&self, _view_id: &str) -> Result<ViewData, FlowyError> {
async fn duplicate_view(&self, _view_id: &str) -> Result<Bytes, FlowyError> {
Err(FlowyError::not_support())
}
@ -595,7 +622,7 @@ impl FolderOperationHandler for ChatFolderOperation {
Err(FlowyError::not_support())
}
async fn create_built_in_view(
async fn create_view_with_default_data(
&self,
user_id: i64,
view_id: &str,

View File

@ -340,12 +340,11 @@ impl DatabaseManager {
Ok(())
}
pub async fn get_database_json_bytes(&self, view_id: &str) -> FlowyResult<Vec<u8>> {
pub async fn get_database_data(&self, view_id: &str) -> FlowyResult<DatabaseData> {
let lock = self.workspace_database()?;
let wdb = lock.read().await;
let data = wdb.get_database_data(view_id).await?;
let json_bytes = data.to_json_bytes()?;
Ok(json_bytes)
Ok(data)
}
pub async fn get_database_json_string(&self, view_id: &str) -> FlowyResult<String> {
@ -358,25 +357,24 @@ impl DatabaseManager {
/// Create a new database with the given data that can be deserialized to [DatabaseData].
#[tracing::instrument(level = "trace", skip_all, err)]
pub async fn create_database_with_database_data(
pub async fn create_database_with_data(
&self,
view_id: &str,
new_database_view_id: &str,
data: Vec<u8>,
) -> FlowyResult<EncodedCollab> {
let database_data = DatabaseData::from_json_bytes(data)?;
let mut create_database_params = CreateDatabaseParams::from_database_data(database_data, None);
let old_view_id = create_database_params.inline_view_id.clone();
create_database_params.inline_view_id = view_id.to_string();
if let Some(create_view_params) = create_database_params
.views
.iter_mut()
.find(|view| view.view_id == old_view_id)
{
create_view_params.view_id = view_id.to_string();
if database_data.views.is_empty() {
return Err(FlowyError::invalid_data().with_context("The database data is empty"));
}
// choose the first view as the display view. The new database_view_id is the ID in the Folder.
let database_view_id = database_data.views[0].id.clone();
let create_database_params = CreateDatabaseParams::from_database_data(
database_data,
&database_view_id,
new_database_view_id,
);
let lock = self.workspace_database()?;
let mut wdb = lock.write().await;
let database = wdb.create_database(create_database_params).await?;
@ -390,6 +388,29 @@ impl DatabaseManager {
Ok(encoded_collab)
}
/// When duplicating a database view, it will duplicate all the database views and replace the duplicated
/// database_view_id with the new_database_view_id. The new database id is the ID created by Folder.
#[tracing::instrument(level = "trace", skip_all, err)]
pub async fn duplicate_database(
&self,
database_view_id: &str,
new_database_view_id: &str,
) -> FlowyResult<EncodedCollab> {
let lock = self.workspace_database()?;
let mut wdb = lock.write().await;
let database = wdb
.duplicate_database(database_view_id, new_database_view_id)
.await?;
drop(wdb);
let encoded_collab = database
.read()
.await
.encode_collab_v1(|collab| CollabType::Database.validate_require_data(collab))
.map_err(|err| FlowyError::internal().with_context(err))?;
Ok(encoded_collab)
}
pub async fn import_database(
&self,
params: CreateDatabaseParams,
@ -448,14 +469,17 @@ impl DatabaseManager {
let database_template = csv_template.try_into_database_template(None).await?;
database_template.into_params()
},
CSVFormat::META => tokio::task::spawn_blocking(move || {
CSVImporter.import_csv_from_string(view_id, content, format)
})
.await
.map_err(internal_error)??,
CSVFormat::META => {
let cloned_view_id = view_id.clone();
tokio::task::spawn_blocking(move || {
CSVImporter.import_csv_from_string(cloned_view_id, content, format)
})
.await
.map_err(internal_error)??
},
};
let view_id = params.inline_view_id.clone();
let database_id = params.database_id.clone();
let database = self.import_database(params).await?;
let encoded_database = database.read().await.encode_database_collabs().await?;

View File

@ -131,7 +131,6 @@ fn database_from_fields_and_rows(
CreateDatabaseParams {
database_id: database_id.clone(),
inline_view_id: view_id.to_string(),
rows,
fields,
views: vec![CreateViewParams {

View File

@ -35,7 +35,6 @@ pub fn make_default_grid(view_id: &str, name: &str) -> CreateDatabaseParams {
CreateDatabaseParams {
database_id: database_id.clone(),
inline_view_id: view_id.to_string(),
views: vec![CreateViewParams {
database_id: database_id.clone(),
view_id: view_id.to_string(),
@ -106,7 +105,6 @@ pub fn make_default_board(view_id: &str, name: &str) -> CreateDatabaseParams {
CreateDatabaseParams {
database_id: database_id.clone(),
inline_view_id: view_id.to_string(),
views: vec![CreateViewParams {
database_id,
view_id: view_id.to_string(),
@ -159,7 +157,6 @@ pub fn make_default_calendar(view_id: &str, name: &str) -> CreateDatabaseParams
CreateDatabaseParams {
database_id: database_id.clone(),
inline_view_id: view_id.to_string(),
views: vec![CreateViewParams {
database_id,
view_id: view_id.to_string(),

View File

@ -250,10 +250,8 @@ pub fn make_test_board() -> DatabaseData {
let mut layout_settings = LayoutSettings::new();
layout_settings.insert(DatabaseLayout::Board, board_setting);
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
id: inline_view_id.clone(),
id: gen_database_view_id(),
database_id: database_id.clone(),
name: "".to_string(),
layout: DatabaseLayout::Board,
@ -266,11 +264,11 @@ pub fn make_test_board() -> DatabaseData {
created_at: 0,
modified_at: 0,
field_settings,
is_inline: false,
};
DatabaseData {
database_id,
inline_view_id,
views: vec![view],
fields,
rows,

View File

@ -98,11 +98,9 @@ pub fn make_test_calendar() -> DatabaseData {
let mut layout_settings = LayoutSettings::new();
layout_settings.insert(DatabaseLayout::Calendar, calendar_setting);
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
database_id: database_id.clone(),
id: inline_view_id.clone(),
id: gen_database_view_id(),
name: "".to_string(),
layout: DatabaseLayout::Calendar,
layout_settings,
@ -114,11 +112,11 @@ pub fn make_test_calendar() -> DatabaseData {
created_at: 0,
modified_at: 0,
field_settings,
is_inline: false,
};
DatabaseData {
database_id,
inline_view_id,
views: vec![view],
fields,
rows,

View File

@ -304,11 +304,9 @@ pub fn make_test_grid() -> DatabaseData {
rows.push(row);
}
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
database_id: database_id.clone(),
id: inline_view_id.clone(),
id: gen_database_view_id(),
name: "".to_string(),
layout: DatabaseLayout::Grid,
field_settings,
@ -317,7 +315,6 @@ pub fn make_test_grid() -> DatabaseData {
DatabaseData {
database_id,
inline_view_id,
views: vec![view],
fields,
rows,
@ -392,11 +389,9 @@ pub fn make_no_date_test_grid() -> DatabaseData {
rows.push(row);
}
let inline_view_id = gen_database_view_id();
let view = DatabaseView {
database_id: database_id.clone(),
id: inline_view_id.clone(),
id: gen_database_view_id(),
name: "".to_string(),
layout: DatabaseLayout::Grid,
field_settings,
@ -405,7 +400,6 @@ pub fn make_no_date_test_grid() -> DatabaseData {
DatabaseData {
database_id,
inline_view_id,
views: vec![view],
fields,
rows,

View File

@ -1,16 +1,16 @@
use collab_folder::{View, ViewIcon, ViewLayout};
use std::collections::HashMap;
use std::convert::TryInto;
use std::ops::{Deref, DerefMut};
use std::sync::Arc;
use collab_folder::{View, ViewIcon, ViewLayout};
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use flowy_error::ErrorCode;
use flowy_folder_pub::cloud::gen_view_id;
use crate::entities::icon::ViewIconPB;
use crate::entities::parser::view::{ViewIdentify, ViewName, ViewThumbnail};
use crate::view_operation::ViewData;
#[derive(Eq, PartialEq, ProtoBuf, Debug, Default, Clone)]
pub struct ChildViewUpdatePB {
@ -313,7 +313,7 @@ pub struct CreateViewParams {
pub desc: String,
pub layout: ViewLayoutPB,
pub view_id: String,
pub initial_data: Vec<u8>,
pub initial_data: ViewData,
pub meta: HashMap<String, String>,
// Mark the view as current view after creation.
pub set_as_current: bool,
@ -343,7 +343,7 @@ impl TryInto<CreateViewParams> for CreateViewPayloadPB {
desc: self.desc,
layout: self.layout,
view_id,
initial_data: self.initial_data,
initial_data: ViewData::Data(self.initial_data.into()),
meta: self.meta,
set_as_current: self.set_as_current,
index: self.index,
@ -367,7 +367,7 @@ impl TryInto<CreateViewParams> for CreateOrphanViewPayloadPB {
desc: self.desc,
layout: self.layout,
view_id: self.view_id,
initial_data: self.initial_data,
initial_data: ViewData::Data(self.initial_data.into()),
meta: Default::default(),
set_as_current: false,
index: None,

View File

@ -16,7 +16,7 @@ use crate::publish_util::{generate_publish_name, view_pb_to_publish_view};
use crate::share::{ImportParams, ImportValue};
use crate::util::{folder_not_init_error, workspace_data_not_sync_error};
use crate::view_operation::{
create_view, EncodedCollabWrapper, FolderOperationHandler, FolderOperationHandlers,
create_view, EncodedCollabWrapper, FolderOperationHandler, FolderOperationHandlers, ViewData,
};
use arc_swap::ArcSwapOption;
use collab::core::collab::DataSource;
@ -497,13 +497,18 @@ impl FolderManager {
let user_id = self.user.user_id()?;
let mut encoded_collab: Option<EncodedCollab> = None;
info!(
"{} create view {}, name:{}, layout:{:?}",
handler.name(),
params.view_id,
params.name,
params.layout
);
if params.meta.is_empty() && params.initial_data.is_empty() {
tracing::trace!("Create view with build-in data");
handler
.create_built_in_view(user_id, &params.view_id, &params.name, view_layout.clone())
.create_view_with_default_data(user_id, &params.view_id, &params.name, view_layout.clone())
.await?;
} else {
tracing::trace!("Create view with view data");
encoded_collab = handler
.create_view_with_view_data(user_id, params.clone())
.await?;
@ -539,7 +544,7 @@ impl FolderManager {
let handler = self.get_handler(&view_layout)?;
let user_id = self.user.user_id()?;
handler
.create_built_in_view(user_id, &params.view_id, &params.name, view_layout.clone())
.create_view_with_default_data(user_id, &params.view_id, &params.name, view_layout.clone())
.await?;
let view = create_view(self.user.user_id()?, params, view_layout);
@ -987,6 +992,13 @@ impl FolderManager {
})?;
let handler = self.get_handler(&view.layout)?;
info!(
"{} duplicate view{}, name:{}, layout:{:?}",
handler.name(),
view.id,
view.name,
view.layout
);
let view_data = handler.duplicate_view(&view.id).await?;
let index = self
@ -1010,7 +1022,15 @@ impl FolderManager {
};
let name = if is_source_view {
format!("{}{}", &view.name, suffix)
format!(
"{}{}",
if view.name.is_empty() {
"Untitled"
} else {
view.name.as_str()
},
suffix
)
} else {
view.name.clone()
};
@ -1020,7 +1040,7 @@ impl FolderManager {
name,
desc: view.desc.clone(),
layout: view.layout.clone().into(),
initial_data: view_data.to_vec(),
initial_data: ViewData::DuplicateData(view_data),
view_id: gen_view_id().to_string(),
meta: Default::default(),
set_as_current: is_source_view && open_after_duplicated,
@ -1583,7 +1603,7 @@ impl FolderManager {
name: import_data.name,
desc: "".to_string(),
layout: import_data.view_layout.clone().into(),
initial_data: vec![],
initial_data: ViewData::Empty,
view_id,
meta: Default::default(),
set_as_current: false,

View File

@ -4,6 +4,7 @@ use flowy_folder_pub::cloud::gen_view_id;
use crate::entities::{CreateViewParams, ViewLayoutPB, ViewSectionPB};
use crate::manager::FolderManager;
use crate::view_operation::ViewData;
#[cfg(feature = "test_helper")]
impl FolderManager {
@ -43,7 +44,7 @@ impl FolderManager {
desc: "".to_string(),
layout,
view_id: view_id.clone(),
initial_data: vec![],
initial_data: ViewData::Empty,
meta: ext,
set_as_current: true,
index: None,

View File

@ -17,8 +17,6 @@ use crate::entities::{CreateViewParams, ViewLayoutPB};
use crate::manager::FolderUser;
use crate::share::ImportType;
pub type ViewData = Bytes;
#[derive(Debug, Clone)]
pub enum EncodedCollabWrapper {
Document(DocumentEncodedCollab),
@ -46,6 +44,7 @@ pub type ImportedData = (String, CollabType, EncodedCollab);
/// view, the [ViewLayout] will be used to get the handler.
#[async_trait]
pub trait FolderOperationHandler {
fn name(&self) -> &str;
/// Create the view for the workspace of new user.
/// Only called once when the user is created.
async fn create_workspace_view(
@ -66,7 +65,7 @@ pub trait FolderOperationHandler {
async fn delete_view(&self, view_id: &str) -> Result<(), FlowyError>;
/// Returns the [ViewData] that can be used to create the same view.
async fn duplicate_view(&self, view_id: &str) -> Result<ViewData, FlowyError>;
async fn duplicate_view(&self, view_id: &str) -> Result<Bytes, FlowyError>;
/// get the encoded collab data from the disk.
async fn get_encoded_collab_v1_from_disk(
@ -104,7 +103,7 @@ pub trait FolderOperationHandler {
/// Create a view with the pre-defined data.
/// For example, the initial data of the grid/calendar/kanban board when
/// you create a new view.
async fn create_built_in_view(
async fn create_view_with_default_data(
&self,
user_id: i64,
view_id: &str,
@ -171,3 +170,22 @@ pub(crate) fn create_view(uid: i64, params: CreateViewParams, layout: ViewLayout
children: Default::default(),
}
}
#[derive(Debug, Clone)]
pub enum ViewData {
/// Indicate the data is duplicated from another view.
DuplicateData(Bytes),
/// Indicate the data is created by the user.
Data(Bytes),
Empty,
}
impl ViewData {
pub fn is_empty(&self) -> bool {
match self {
ViewData::DuplicateData(data) => data.is_empty(),
ViewData::Data(data) => data.is_empty(),
ViewData::Empty => true,
}
}
}

View File

@ -24,6 +24,7 @@ impl DatabaseCloudService for LocalServerDatabaseCloudServiceImpl {
Ok(Some(encode_collab))
},
CollabType::Database => default_database_data(object_id)
.await
.map(Some)
.map_err(Into::into),
CollabType::WorkspaceDatabase => Ok(Some(default_workspace_database_data(object_id))),