Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: integrate appflowy-cloud (#3359)

Zack1c84ee1d5302
diff --git a/.gitignore b/.gitignore
index 3b0b860e55..489c26223f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,5 @@ pubspec.lock
# ignore the deb filegit
frontend/package
frontend/*.deb
+
+**/Cargo.toml.bak
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock
index 6754aa787b..74dbe453ab 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock
@@ -70,6 +70,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
+ "getrandom 0.2.10",
"once_cell",
"version_check",
]
@@ -107,6 +108,12 @@ dependencies = [
"alloc-no-stdlib",
]
+[[package]]
+name = "allocator-api2"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
+
[[package]]
name = "android-tzdata"
version = "0.1.1"
@@ -137,33 +144,12 @@ version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
-[[package]]
-name = "appflowy-integrate"
-version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
-dependencies = [
- "anyhow",
- "collab",
- "collab-database",
- "collab-define",
- "collab-document",
- "collab-folder",
- "collab-persistence",
- "collab-plugins",
- "futures",
- "parking_lot",
- "serde",
- "serde_json",
- "tracing",
-]
-
[[package]]
name = "appflowy_tauri"
version = "0.0.0"
dependencies = [
"bytes",
"flowy-core",
- "flowy-net",
"flowy-notification",
"lib-dispatch",
"serde",
@@ -243,6 +229,15 @@ dependencies = [
"system-deps 6.1.1",
]
+[[package]]
+name = "atoi"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
+dependencies = [
+ "num-traits",
+]
+
[[package]]
name = "atomic_refcell"
version = "0.1.10"
@@ -367,7 +362,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b"
dependencies = [
"borsh-derive",
- "hashbrown 0.13.2",
+ "hashbrown 0.12.3",
]
[[package]]
@@ -433,6 +428,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
dependencies = [
"memchr",
+ "once_cell",
+ "regex-automata",
"serde",
]
@@ -592,18 +589,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
-version = "0.4.26"
+version = "0.4.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5"
+checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"serde",
- "time 0.1.45",
"wasm-bindgen",
- "winapi",
+ "windows-targets",
]
[[package]]
@@ -671,6 +667,32 @@ dependencies = [
"libloading",
]
+[[package]]
+name = "client-api"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "anyhow",
+ "bytes",
+ "collab-sync-protocol",
+ "futures-util",
+ "gotrue-entity",
+ "opener",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "serde_repr",
+ "shared_entity",
+ "storage-entity",
+ "thiserror",
+ "tokio",
+ "tokio-retry",
+ "tokio-stream",
+ "tokio-tungstenite",
+ "tracing",
+ "url",
+]
+
[[package]]
name = "cmd_lib"
version = "1.3.0"
@@ -730,7 +752,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"async-trait",
@@ -749,7 +771,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"async-trait",
@@ -779,7 +801,7 @@ dependencies = [
[[package]]
name = "collab-define"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"collab",
@@ -791,7 +813,7 @@ dependencies = [
[[package]]
name = "collab-derive"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"proc-macro2",
"quote",
@@ -803,7 +825,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"collab",
@@ -823,7 +845,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"chrono",
@@ -840,10 +862,30 @@ dependencies = [
"tracing",
]
+[[package]]
+name = "collab-integrate"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "collab",
+ "collab-database",
+ "collab-define",
+ "collab-document",
+ "collab-folder",
+ "collab-persistence",
+ "collab-plugins",
+ "futures",
+ "parking_lot",
+ "serde",
+ "serde_json",
+ "tracing",
+]
+
[[package]]
name = "collab-persistence"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"async-trait",
"bincode",
@@ -864,7 +906,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"async-trait",
@@ -872,7 +914,6 @@ dependencies = [
"collab-define",
"collab-persistence",
"collab-sync-protocol",
- "collab-ws",
"futures-util",
"lib0",
"parking_lot",
@@ -893,10 +934,11 @@ dependencies = [
[[package]]
name = "collab-sync-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"bytes",
"collab",
+ "collab-define",
"md5",
"serde",
"serde_json",
@@ -907,7 +949,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"collab",
@@ -920,24 +962,6 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "collab-ws"
-version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
-dependencies = [
- "bytes",
- "collab-sync-protocol",
- "futures-util",
- "serde",
- "serde_json",
- "thiserror",
- "tokio",
- "tokio-retry",
- "tokio-stream",
- "tokio-tungstenite",
- "tracing",
-]
-
[[package]]
name = "color_quant"
version = "1.1.0"
@@ -1036,6 +1060,21 @@ dependencies = [
"libc",
]
+[[package]]
+name = "crc"
+version = "3.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484"
+
[[package]]
name = "crc32fast"
version = "1.3.2"
@@ -1079,6 +1118,16 @@ dependencies = [
"scopeguard",
]
+[[package]]
+name = "crossbeam-queue"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add"
+dependencies = [
+ "cfg-if",
+ "crossbeam-utils",
+]
+
[[package]]
name = "crossbeam-utils"
version = "0.8.16"
@@ -1315,6 +1364,12 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
+[[package]]
+name = "dotenvy"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
+
[[package]]
name = "dtoa"
version = "1.0.6"
@@ -1347,6 +1402,9 @@ name = "either"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+dependencies = [
+ "serde",
+]
[[package]]
name = "embed-resource"
@@ -1418,6 +1476,12 @@ dependencies = [
"backtrace",
]
+[[package]]
+name = "event-listener"
+version = "2.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+
[[package]]
name = "faccess"
version = "0.2.4"
@@ -1522,7 +1586,7 @@ dependencies = [
"console",
"fancy-regex 0.10.0",
"flowy-ast",
- "itertools",
+ "itertools 0.10.5",
"lazy_static",
"log",
"phf 0.8.0",
@@ -1556,9 +1620,12 @@ dependencies = [
name = "flowy-core"
version = "0.1.0"
dependencies = [
- "appflowy-integrate",
+ "anyhow",
"bytes",
+ "collab",
"collab-define",
+ "collab-integrate",
+ "collab-plugins",
"diesel",
"flowy-config",
"flowy-database-deps",
@@ -1568,7 +1635,6 @@ dependencies = [
"flowy-error",
"flowy-folder-deps",
"flowy-folder2",
- "flowy-net",
"flowy-server",
"flowy-server-config",
"flowy-sqlite",
@@ -1604,7 +1670,6 @@ name = "flowy-database2"
version = "0.1.0"
dependencies = [
"anyhow",
- "appflowy-integrate",
"async-stream",
"async-trait",
"bytes",
@@ -1613,6 +1678,7 @@ dependencies = [
"collab",
"collab-database",
"collab-define",
+ "collab-integrate",
"csv",
"dashmap",
"fancy-regex 0.10.0",
@@ -1673,11 +1739,11 @@ name = "flowy-document2"
version = "0.1.0"
dependencies = [
"anyhow",
- "appflowy-integrate",
"bytes",
"collab",
"collab-define",
"collab-document",
+ "collab-integrate",
"flowy-codegen",
"flowy-derive",
"flowy-document-deps",
@@ -1719,6 +1785,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bytes",
+ "client-api",
"collab-database",
"collab-document",
"flowy-codegen",
@@ -1751,12 +1818,12 @@ dependencies = [
name = "flowy-folder2"
version = "0.1.0"
dependencies = [
- "appflowy-integrate",
"bytes",
"chrono",
"collab",
"collab-define",
"collab-folder",
+ "collab-integrate",
"flowy-codegen",
"flowy-derive",
"flowy-error",
@@ -1776,17 +1843,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "flowy-net"
-version = "0.1.0"
-dependencies = [
- "bytes",
- "flowy-codegen",
- "lib-dispatch",
- "protobuf",
- "tracing",
-]
-
[[package]]
name = "flowy-notification"
version = "0.1.0"
@@ -1808,6 +1864,7 @@ dependencies = [
"anyhow",
"bytes",
"chrono",
+ "client-api",
"collab",
"collab-define",
"collab-document",
@@ -1901,7 +1958,6 @@ name = "flowy-user"
version = "0.1.0"
dependencies = [
"anyhow",
- "appflowy-integrate",
"base64 0.21.2",
"bytes",
"chrono",
@@ -1910,6 +1966,7 @@ dependencies = [
"collab-define",
"collab-document",
"collab-folder",
+ "collab-integrate",
"collab-user",
"diesel",
"diesel_derives",
@@ -2045,6 +2102,17 @@ dependencies = [
"futures-util",
]
+[[package]]
+name = "futures-intrusive"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
+dependencies = [
+ "futures-core",
+ "lock_api",
+ "parking_lot",
+]
+
[[package]]
name = "futures-io"
version = "0.3.28"
@@ -2376,6 +2444,15 @@ dependencies = [
"system-deps 6.1.1",
]
+[[package]]
+name = "gotrue-entity"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "serde",
+ "serde_json",
+]
+
[[package]]
name = "gtk"
version = "0.15.5"
@@ -2473,6 +2550,19 @@ name = "hashbrown"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
+dependencies = [
+ "ahash 0.8.3",
+ "allocator-api2",
+]
+
+[[package]]
+name = "hashlink"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
+dependencies = [
+ "hashbrown 0.14.0",
+]
[[package]]
name = "heck"
@@ -2488,6 +2578,9 @@ name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+dependencies = [
+ "unicode-segmentation",
+]
[[package]]
name = "hermit-abi"
@@ -2681,6 +2774,12 @@ dependencies = [
"unicode-normalization",
]
+[[package]]
+name = "if_chain"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
+
[[package]]
name = "ignore"
version = "0.4.20"
@@ -2785,6 +2884,15 @@ dependencies = [
"either",
]
+[[package]]
+name = "itertools"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itoa"
version = "0.4.8"
@@ -3338,6 +3446,15 @@ dependencies = [
"minimal-lexical",
]
+[[package]]
+name = "normpath"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5"
+dependencies = [
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
@@ -3468,6 +3585,17 @@ dependencies = [
"windows-sys 0.42.0",
]
+[[package]]
+name = "opener"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788"
+dependencies = [
+ "bstr",
+ "normpath",
+ "winapi",
+]
+
[[package]]
name = "openssl"
version = "0.10.55"
@@ -3595,6 +3723,12 @@ dependencies = [
"regex",
]
+[[package]]
+name = "paste"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+
[[package]]
name = "pathdiff"
version = "0.2.1"
@@ -3863,7 +3997,7 @@ dependencies = [
"line-wrap",
"quick-xml",
"serde",
- "time 0.3.22",
+ "time",
]
[[package]]
@@ -4665,9 +4799,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.164"
+version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
+checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
dependencies = [
"serde_derive",
]
@@ -4685,9 +4819,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.164"
+version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
+checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
@@ -4696,9 +4830,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.99"
+version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
+checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
dependencies = [
"itoa 1.0.6",
"ryu",
@@ -4707,9 +4841,9 @@ dependencies = [
[[package]]
name = "serde_repr"
-version = "0.1.12"
+version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
+checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
dependencies = [
"proc-macro2",
"quote",
@@ -4750,7 +4884,7 @@ dependencies = [
"serde",
"serde_json",
"serde_with_macros",
- "time 0.3.22",
+ "time",
]
[[package]]
@@ -4834,6 +4968,21 @@ dependencies = [
"lazy_static",
]
+[[package]]
+name = "shared_entity"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "anyhow",
+ "opener",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "serde_repr",
+ "thiserror",
+ "url",
+]
+
[[package]]
name = "shlex"
version = "1.1.0"
@@ -4966,6 +5115,99 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
+[[package]]
+name = "sqlformat"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85"
+dependencies = [
+ "itertools 0.11.0",
+ "nom 7.1.3",
+ "unicode_categories",
+]
+
+[[package]]
+name = "sqlx"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721"
+dependencies = [
+ "sqlx-core",
+ "sqlx-macros",
+]
+
+[[package]]
+name = "sqlx-core"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53"
+dependencies = [
+ "ahash 0.8.3",
+ "atoi",
+ "byteorder",
+ "bytes",
+ "crc",
+ "crossbeam-queue",
+ "dotenvy",
+ "either",
+ "event-listener",
+ "futures-channel",
+ "futures-core",
+ "futures-intrusive",
+ "futures-io",
+ "futures-util",
+ "hashlink",
+ "hex",
+ "indexmap 2.0.0",
+ "log",
+ "memchr",
+ "once_cell",
+ "paste",
+ "percent-encoding",
+ "serde",
+ "sha2",
+ "smallvec",
+ "sqlformat",
+ "thiserror",
+ "tracing",
+ "url",
+]
+
+[[package]]
+name = "sqlx-macros"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "sqlx-core",
+ "sqlx-macros-core",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "sqlx-macros-core"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc"
+dependencies = [
+ "dotenvy",
+ "either",
+ "heck 0.4.1",
+ "hex",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "sha2",
+ "sqlx-core",
+ "syn 1.0.109",
+ "tempfile",
+ "url",
+]
+
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
@@ -4987,6 +5229,20 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+[[package]]
+name = "storage-entity"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "chrono",
+ "collab-define",
+ "serde",
+ "serde_json",
+ "sqlx",
+ "uuid",
+ "validator",
+]
+
[[package]]
name = "string_cache"
version = "0.8.7"
@@ -5280,7 +5536,7 @@ dependencies = [
"sha2",
"tauri-utils",
"thiserror",
- "time 0.3.22",
+ "time",
"uuid",
"walkdir",
]
@@ -5445,18 +5701,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thiserror"
-version = "1.0.40"
+version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
+checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.40"
+version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
+checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
@@ -5483,17 +5739,6 @@ dependencies = [
"once_cell",
]
-[[package]]
-name = "time"
-version = "0.1.45"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
-dependencies = [
- "libc",
- "wasi 0.10.0+wasi-snapshot-preview1",
- "winapi",
-]
-
[[package]]
name = "time"
version = "0.3.22"
@@ -5978,6 +6223,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+[[package]]
+name = "unicode_categories"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
+
[[package]]
name = "universal-hash"
version = "0.5.1"
@@ -5996,9 +6247,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "url"
-version = "2.4.0"
+version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
+checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
dependencies = [
"form_urlencoded",
"idna",
@@ -6014,11 +6265,12 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "uuid"
-version = "1.3.4"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81"
+checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d"
dependencies = [
"getrandom 0.2.10",
+ "serde",
"sha1_smol",
]
@@ -6035,6 +6287,33 @@ dependencies = [
"serde_derive",
"serde_json",
"url",
+ "validator_derive",
+]
+
+[[package]]
+name = "validator_derive"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af"
+dependencies = [
+ "if_chain",
+ "lazy_static",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "syn 1.0.109",
+ "validator_types",
+]
+
+[[package]]
+name = "validator_types"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3"
+dependencies = [
+ "proc-macro2",
+ "syn 1.0.109",
]
[[package]]
@@ -6112,12 +6391,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-[[package]]
-name = "wasi"
-version = "0.10.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
-
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml
index 3fc8b474c6..7a555090b7 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml
@@ -23,7 +23,6 @@ tracing = { version = "0.1", features = ["log"] }
lib-dispatch = { path = "../../rust-lib/lib-dispatch", features = ["use_serde"] }
flowy-core = { path = "../../rust-lib/flowy-core", features = ["rev-sqlite", "ts"] }
flowy-notification = { path = "../../rust-lib/flowy-notification", features = ["ts"] }
-flowy-net = { path = "../../rust-lib/flowy-net" }
[features]
# by default Tauri runs in production mode
@@ -34,24 +33,33 @@ default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
[patch.crates-io]
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8f8f6a" }
+
+# ⚠️⚠️⚠️
+# Please using the following command to update the revision id
+# Current directory: frontend
+# Run the script:
+# scripts/tool/update_collab_rev.sh new_rev_id
+# ⚠️⚠️⚠️️
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-sync-protocol = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
#collab = { path = "../../../../AppFlowy-Collab/collab" }
#collab-folder = { path = "../../../../AppFlowy-Collab/collab-folder" }
#collab-document = { path = "../../../../AppFlowy-Collab/collab-document" }
#collab-database = { path = "../../../../AppFlowy-Collab/collab-database" }
-#appflowy-integrate = { path = "../../../../AppFlowy-Collab/appflowy-integrate" }
#collab-plugins = { path = "../../../../AppFlowy-Collab/collab-plugins" }
+#collab-persistence = { path = "../../../../AppFlowy-Collab/collab-persistence" }
#collab-user = { path = "../../../../AppFlowy-Collab/collab-user" }
#collab-define = { path = "../../../../AppFlowy-Collab/collab-define" }
+#collab-sync-protocol = { path = "../../../../AppFlowy-Collab/collab-sync-protocol" }
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 374ebae20b..bae37eebe9 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
-version = "0.19.0"
+version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
"gimli",
]
@@ -58,7 +58,7 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"once_cell",
"version_check",
]
@@ -70,29 +70,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
+ "getrandom 0.2.10",
"once_cell",
"version_check",
]
[[package]]
name = "aho-corasick"
-version = "0.7.20"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
+checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783"
dependencies = [
"memchr",
]
[[package]]
name = "allo-isolate"
-version = "0.1.14"
+version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ed55848be9f41d44c79df6045b680a74a78bc579e0813f7f196cd7928e22fb1"
+checksum = "71441b1911974f09ca413fc93fb2e3bfc60f4a284fdc7fd51e5a81b6afc61727"
dependencies = [
"atomic",
"pin-project",
]
+[[package]]
+name = "allocator-api2"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
+
+[[package]]
+name = "android-tzdata"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
+
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -117,26 +130,6 @@ version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
-[[package]]
-name = "appflowy-integrate"
-version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
-dependencies = [
- "anyhow",
- "collab",
- "collab-database",
- "collab-define",
- "collab-document",
- "collab-folder",
- "collab-persistence",
- "collab-plugins",
- "futures",
- "parking_lot",
- "serde",
- "serde_json",
- "tracing",
-]
-
[[package]]
name = "arrayvec"
version = "0.5.2"
@@ -145,9 +138,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
-version = "0.7.2"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
+checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]]
name = "assert-json-diff"
@@ -178,7 +171,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -189,23 +182,29 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
-name = "atomic"
-version = "0.5.1"
+name = "atoi"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c"
+checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528"
dependencies = [
- "autocfg",
+ "num-traits",
]
+[[package]]
+name = "atomic"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
+
[[package]]
name = "atomic_refcell"
-version = "0.1.9"
+version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "857253367827bd9d0fd973f0ef15506a96e79e41b0ad7aa691203a4e3214f6c8"
+checksum = "112ef6b3f6cb3cb6fc5b6b494ef7a848492cff1ab0ef4de10b0f7d572861c905"
[[package]]
name = "autocfg"
@@ -215,13 +214,13 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "axum"
-version = "0.6.15"
+version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b32c5ea3aabaf4deb5f5ced2d688ec0844c881c9e6c696a8b769a05fc691e62"
+checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
dependencies = [
"async-trait",
"axum-core",
- "bitflags",
+ "bitflags 1.3.2",
"bytes",
"futures-util",
"http",
@@ -260,9 +259,9 @@ dependencies = [
[[package]]
name = "backtrace"
-version = "0.3.67"
+version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
+checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [
"addr2line",
"cc",
@@ -281,9 +280,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
-version = "0.21.2"
+version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
+checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
[[package]]
name = "base64ct"
@@ -306,7 +305,7 @@ version = "0.65.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"cexpr",
"clang-sys",
"lazy_static",
@@ -318,7 +317,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -342,6 +341,24 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+[[package]]
+name = "bitflags"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
+
+[[package]]
+name = "bitvec"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
+dependencies = [
+ "funty",
+ "radium",
+ "tap",
+ "wyz",
+]
+
[[package]]
name = "block-buffer"
version = "0.10.4"
@@ -358,7 +375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b"
dependencies = [
"borsh-derive",
- "hashbrown 0.13.2",
+ "hashbrown 0.12.3",
]
[[package]]
@@ -398,25 +415,26 @@ dependencies = [
[[package]]
name = "bstr"
-version = "1.4.0"
+version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09"
+checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a"
dependencies = [
"memchr",
+ "regex-automata 0.3.8",
"serde",
]
[[package]]
name = "bumpalo"
-version = "3.12.0"
+version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
+checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "bytecheck"
-version = "0.6.10"
+version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13fe11640a23eb24562225322cd3e452b93a3d4091d62fab69c70542fcd17d1f"
+checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627"
dependencies = [
"bytecheck_derive",
"ptr_meta",
@@ -425,9 +443,9 @@ dependencies = [
[[package]]
name = "bytecheck_derive"
-version = "0.6.10"
+version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e31225543cb46f81a7e224762764f4a6a0f097b1db0b175f69e8065efaa42de5"
+checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61"
dependencies = [
"proc-macro2",
"quote",
@@ -442,9 +460,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
+checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
dependencies = [
"serde",
]
@@ -472,11 +490,12 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.79"
+version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
+checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [
"jobserver",
+ "libc",
]
[[package]]
@@ -496,62 +515,40 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
-version = "0.4.24"
+version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b"
+checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02"
dependencies = [
+ "android-tzdata",
"iana-time-zone",
"js-sys",
- "num-integer",
"num-traits",
"serde",
"time 0.1.45",
"wasm-bindgen",
- "winapi",
-]
-
-[[package]]
-name = "chrono-tz"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552"
-dependencies = [
- "chrono",
- "chrono-tz-build 0.0.2",
- "phf 0.10.1",
+ "windows-targets",
]
[[package]]
name = "chrono-tz"
-version = "0.8.2"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf9cc2b23599e6d7479755f3594285efb3f74a1bdca7a7374948bc831e23a552"
+checksum = "f1369bc6b9e9a7dfdae2055f6ec151fe9c554a9d23d357c0237cee2e25eaabb7"
dependencies = [
"chrono",
- "chrono-tz-build 0.1.0",
- "phf 0.11.1",
-]
-
-[[package]]
-name = "chrono-tz-build"
-version = "0.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069"
-dependencies = [
- "parse-zoneinfo",
- "phf 0.10.1",
- "phf_codegen 0.10.0",
+ "chrono-tz-build",
+ "phf 0.11.2",
]
[[package]]
name = "chrono-tz-build"
-version = "0.1.0"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9998fb9f7e9b2111641485bf8beb32f92945f97f92a3d061f744cfef335f751"
+checksum = "e2f5ebdc942f57ed96d560a6d1a459bae5851102a25d5bf89dc04ae453e31ecf"
dependencies = [
"parse-zoneinfo",
- "phf 0.11.1",
- "phf_codegen 0.11.1",
+ "phf 0.11.2",
+ "phf_codegen",
]
[[package]]
@@ -575,6 +572,32 @@ dependencies = [
"libloading",
]
+[[package]]
+name = "client-api"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "anyhow",
+ "bytes",
+ "collab-sync-protocol",
+ "futures-util",
+ "gotrue-entity",
+ "opener",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "serde_repr",
+ "shared_entity",
+ "storage-entity",
+ "thiserror",
+ "tokio",
+ "tokio-retry",
+ "tokio-stream",
+ "tokio-tungstenite",
+ "tracing",
+ "url",
+]
+
[[package]]
name = "cmd_lib"
version = "1.3.0"
@@ -600,20 +623,10 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "codespan-reporting"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
-dependencies = [
- "termcolor",
- "unicode-width",
-]
-
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"async-trait",
@@ -632,11 +645,11 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"async-trait",
- "base64 0.21.2",
+ "base64 0.21.3",
"chrono",
"collab",
"collab-define",
@@ -662,7 +675,7 @@ dependencies = [
[[package]]
name = "collab-define"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"collab",
@@ -674,7 +687,7 @@ dependencies = [
[[package]]
name = "collab-derive"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"proc-macro2",
"quote",
@@ -686,7 +699,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"collab",
@@ -706,7 +719,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"chrono",
@@ -723,10 +736,30 @@ dependencies = [
"tracing",
]
+[[package]]
+name = "collab-integrate"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "collab",
+ "collab-database",
+ "collab-define",
+ "collab-document",
+ "collab-folder",
+ "collab-persistence",
+ "collab-plugins",
+ "futures",
+ "parking_lot",
+ "serde",
+ "serde_json",
+ "tracing",
+]
+
[[package]]
name = "collab-persistence"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"async-trait",
"bincode",
@@ -747,7 +780,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"async-trait",
@@ -755,7 +788,6 @@ dependencies = [
"collab-define",
"collab-persistence",
"collab-sync-protocol",
- "collab-ws",
"futures-util",
"lib0",
"parking_lot",
@@ -776,10 +808,11 @@ dependencies = [
[[package]]
name = "collab-sync-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"bytes",
"collab",
+ "collab-define",
"md5",
"serde",
"serde_json",
@@ -790,7 +823,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=20eff3#20eff314f7963e30bdbe85c860060269b12197ef"
dependencies = [
"anyhow",
"collab",
@@ -803,24 +836,6 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "collab-ws"
-version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=9bb9a7#9bb9a7e33c17677ec6f553fb8b98f66d6c9b6c2e"
-dependencies = [
- "bytes",
- "collab-sync-protocol",
- "futures-util",
- "serde",
- "serde_json",
- "thiserror",
- "tokio",
- "tokio-retry",
- "tokio-stream",
- "tokio-tungstenite",
- "tracing",
-]
-
[[package]]
name = "config"
version = "0.10.1"
@@ -828,7 +843,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3"
dependencies = [
"lazy_static",
- "nom 5.1.2",
+ "nom 5.1.3",
"serde",
"yaml-rust",
]
@@ -850,9 +865,9 @@ dependencies = [
[[package]]
name = "console-api"
-version = "0.4.0"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e57ff02e8ad8e06ab9731d5dc72dc23bef9200778eae1a89d555d8c42e5d4a86"
+checksum = "c2895653b4d9f1538a83970077cb01dfc77a4810524e51a110944688e916b18e"
dependencies = [
"prost",
"prost-types",
@@ -862,9 +877,9 @@ dependencies = [
[[package]]
name = "console-subscriber"
-version = "0.1.8"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22a3a81dfaf6b66bce5d159eddae701e3a002f194d378cbf7be5f053c281d9be"
+checksum = "d4cf42660ac07fcebed809cfe561dd8730bcd35b075215e6479c516bcd0d11cb"
dependencies = [
"console-api",
"crossbeam-channel",
@@ -881,7 +896,7 @@ dependencies = [
"tonic",
"tracing",
"tracing-core",
- "tracing-subscriber 0.3.16",
+ "tracing-subscriber 0.3.17",
]
[[package]]
@@ -908,13 +923,28 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "cpufeatures"
-version = "0.2.6"
+version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181"
+checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
dependencies = [
"libc",
]
+[[package]]
+name = "crc"
+version = "3.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
+dependencies = [
+ "crc-catalog",
+]
+
+[[package]]
+name = "crc-catalog"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484"
+
[[package]]
name = "crc32fast"
version = "1.3.2"
@@ -947,9 +977,9 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
-version = "0.9.14"
+version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
+checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [
"autocfg",
"cfg-if",
@@ -958,11 +988,21 @@ dependencies = [
"scopeguard",
]
+[[package]]
+name = "crossbeam-queue"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add"
+dependencies = [
+ "cfg-if",
+ "crossbeam-utils",
+]
+
[[package]]
name = "crossbeam-utils"
-version = "0.8.15"
+version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
+checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if",
]
@@ -980,9 +1020,9 @@ dependencies = [
[[package]]
name = "csv"
-version = "1.2.1"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b015497079b9a9d69c02ad25de6c0a6edef051ea6360a327d0bd05802ef64ad"
+checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086"
dependencies = [
"csv-core",
"itoa",
@@ -1008,63 +1048,18 @@ dependencies = [
"cipher",
]
-[[package]]
-name = "cxx"
-version = "1.0.94"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93"
-dependencies = [
- "cc",
- "cxxbridge-flags",
- "cxxbridge-macro",
- "link-cplusplus",
-]
-
-[[package]]
-name = "cxx-build"
-version = "1.0.94"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b"
-dependencies = [
- "cc",
- "codespan-reporting",
- "once_cell",
- "proc-macro2",
- "quote",
- "scratch",
- "syn 2.0.27",
-]
-
-[[package]]
-name = "cxxbridge-flags"
-version = "1.0.94"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb"
-
-[[package]]
-name = "cxxbridge-macro"
-version = "1.0.94"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.27",
-]
-
[[package]]
name = "dart-ffi"
version = "0.1.0"
dependencies = [
"allo-isolate",
- "appflowy-integrate",
"byteorder",
"bytes",
+ "collab-integrate",
"crossbeam-utils",
"flowy-codegen",
"flowy-core",
"flowy-derive",
- "flowy-net",
"flowy-notification",
"flowy-server",
"flowy-server-config",
@@ -1081,17 +1076,23 @@ dependencies = [
[[package]]
name = "dashmap"
-version = "5.4.0"
+version = "5.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
+checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [
"cfg-if",
- "hashbrown 0.12.3",
+ "hashbrown 0.14.0",
"lock_api",
"once_cell",
"parking_lot_core",
]
+[[package]]
+name = "deranged"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
+
[[package]]
name = "derivative"
version = "2.2.0"
@@ -1105,9 +1106,9 @@ dependencies = [
[[package]]
name = "deunicode"
-version = "0.4.3"
+version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
+checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43"
[[package]]
name = "diesel"
@@ -1159,17 +1160,26 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
+[[package]]
+name = "dotenvy"
+version = "0.15.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
+
[[package]]
name = "dyn-clone"
-version = "1.0.11"
+version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30"
+checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555"
[[package]]
name = "either"
-version = "1.8.1"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+dependencies = [
+ "serde",
+]
[[package]]
name = "encode_unicode"
@@ -1179,9 +1189,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
[[package]]
name = "encoding_rs"
-version = "0.8.32"
+version = "0.8.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
+checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
dependencies = [
"cfg-if",
]
@@ -1196,15 +1206,21 @@ dependencies = [
"regex",
]
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
[[package]]
name = "errno"
-version = "0.3.1"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
+checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd"
dependencies = [
"errno-dragonfly",
"libc",
- "windows-sys 0.48.0",
+ "windows-sys",
]
[[package]]
@@ -1226,24 +1242,31 @@ dependencies = [
"backtrace",
]
+[[package]]
+name = "event-listener"
+version = "2.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+
[[package]]
name = "faccess"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59ae66425802d6a903e268ae1a08b8c38ba143520f227a205edf4e9c7e3e26d5"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"libc",
"winapi",
]
[[package]]
name = "fake"
-version = "2.5.0"
+version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d68f517805463f3a896a9d29c1d6ff09d3579ded64a7201b4069f8f9c0d52fd"
+checksum = "9af7b0c58ac9d03169e27f080616ce9f64004edca3d2ef4147a811c21b23b319"
dependencies = [
"rand 0.8.5",
+ "unidecode",
]
[[package]]
@@ -1274,18 +1297,21 @@ dependencies = [
[[package]]
name = "fastrand"
-version = "1.9.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
-dependencies = [
- "instant",
-]
+checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
+
+[[package]]
+name = "finl_unicode"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6"
[[package]]
name = "flate2"
-version = "1.0.25"
+version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
+checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -1308,7 +1334,7 @@ dependencies = [
"console",
"fancy-regex 0.10.0",
"flowy-ast",
- "itertools",
+ "itertools 0.10.5",
"lazy_static",
"log",
"phf 0.8.0",
@@ -1342,9 +1368,12 @@ dependencies = [
name = "flowy-core"
version = "0.1.0"
dependencies = [
- "appflowy-integrate",
+ "anyhow",
"bytes",
+ "collab",
"collab-define",
+ "collab-integrate",
+ "collab-plugins",
"console-subscriber",
"diesel",
"flowy-config",
@@ -1355,7 +1384,6 @@ dependencies = [
"flowy-error",
"flowy-folder-deps",
"flowy-folder2",
- "flowy-net",
"flowy-server",
"flowy-server-config",
"flowy-sqlite",
@@ -1391,15 +1419,15 @@ name = "flowy-database2"
version = "0.1.0"
dependencies = [
"anyhow",
- "appflowy-integrate",
"async-stream",
"async-trait",
"bytes",
"chrono",
- "chrono-tz 0.8.2",
+ "chrono-tz",
"collab",
"collab-database",
"collab-define",
+ "collab-integrate",
"csv",
"dashmap",
"fancy-regex 0.10.0",
@@ -1411,7 +1439,7 @@ dependencies = [
"flowy-task",
"flowy-test",
"futures",
- "indexmap",
+ "indexmap 1.9.3",
"lazy_static",
"lib-dispatch",
"lib-infra",
@@ -1461,11 +1489,11 @@ name = "flowy-document2"
version = "0.1.0"
dependencies = [
"anyhow",
- "appflowy-integrate",
"bytes",
"collab",
"collab-define",
"collab-document",
+ "collab-integrate",
"flowy-codegen",
"flowy-derive",
"flowy-document-deps",
@@ -1473,7 +1501,7 @@ dependencies = [
"flowy-notification",
"flowy-storage",
"futures",
- "indexmap",
+ "indexmap 1.9.3",
"lib-dispatch",
"lib-infra",
"nanoid",
@@ -1486,7 +1514,7 @@ dependencies = [
"tokio",
"tokio-stream",
"tracing",
- "tracing-subscriber 0.3.16",
+ "tracing-subscriber 0.3.17",
"uuid",
]
@@ -1496,7 +1524,7 @@ version = "0.1.0"
dependencies = [
"aes-gcm",
"anyhow",
- "base64 0.21.2",
+ "base64 0.21.3",
"hmac",
"pbkdf2 0.12.2",
"rand 0.8.5",
@@ -1509,6 +1537,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bytes",
+ "client-api",
"collab-database",
"collab-document",
"flowy-codegen",
@@ -1542,12 +1571,12 @@ dependencies = [
name = "flowy-folder2"
version = "0.1.0"
dependencies = [
- "appflowy-integrate",
"bytes",
"chrono",
"collab",
"collab-define",
"collab-folder",
+ "collab-integrate",
"flowy-codegen",
"flowy-derive",
"flowy-error",
@@ -1569,17 +1598,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "flowy-net"
-version = "0.1.0"
-dependencies = [
- "bytes",
- "flowy-codegen",
- "lib-dispatch",
- "protobuf",
- "tracing",
-]
-
[[package]]
name = "flowy-notification"
version = "0.1.0"
@@ -1602,6 +1620,7 @@ dependencies = [
"assert-json-diff",
"bytes",
"chrono",
+ "client-api",
"collab",
"collab-define",
"collab-document",
@@ -1634,7 +1653,7 @@ dependencies = [
"tokio-retry",
"tokio-util",
"tracing",
- "tracing-subscriber 0.3.16",
+ "tracing-subscriber 0.3.17",
"url",
"uuid",
"yrs",
@@ -1707,6 +1726,7 @@ dependencies = [
"bytes",
"collab",
"collab-database",
+ "collab-define",
"collab-document",
"collab-folder",
"collab-plugins",
@@ -1719,7 +1739,6 @@ dependencies = [
"flowy-encrypt",
"flowy-folder-deps",
"flowy-folder2",
- "flowy-net",
"flowy-notification",
"flowy-server",
"flowy-server-config",
@@ -1748,8 +1767,7 @@ name = "flowy-user"
version = "0.1.0"
dependencies = [
"anyhow",
- "appflowy-integrate",
- "base64 0.21.2",
+ "base64 0.21.3",
"bytes",
"chrono",
"collab",
@@ -1757,6 +1775,7 @@ dependencies = [
"collab-define",
"collab-document",
"collab-folder",
+ "collab-integrate",
"collab-user",
"diesel",
"diesel_derives",
@@ -1846,6 +1865,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
+[[package]]
+name = "funty"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
+
[[package]]
name = "futures"
version = "0.3.28"
@@ -1888,6 +1913,17 @@ dependencies = [
"futures-util",
]
+[[package]]
+name = "futures-intrusive"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f"
+dependencies = [
+ "futures-core",
+ "lock_api",
+ "parking_lot",
+]
+
[[package]]
name = "futures-io"
version = "0.3.28"
@@ -1902,7 +1938,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -1970,9 +2006,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.9"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
+checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
@@ -1991,9 +2027,9 @@ dependencies = [
[[package]]
name = "gimli"
-version = "0.27.2"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
+checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]]
name = "glob"
@@ -2003,9 +2039,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "globset"
-version = "0.4.10"
+version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
+checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
dependencies = [
"aho-corasick",
"bstr",
@@ -2020,16 +2056,25 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"ignore",
"walkdir",
]
+[[package]]
+name = "gotrue-entity"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "serde",
+ "serde_json",
+]
+
[[package]]
name = "h2"
-version = "0.3.17"
+version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f"
+checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833"
dependencies = [
"bytes",
"fnv",
@@ -2037,7 +2082,7 @@ dependencies = [
"futures-sink",
"futures-util",
"http",
- "indexmap",
+ "indexmap 1.9.3",
"slab",
"tokio",
"tokio-util",
@@ -2063,8 +2108,27 @@ dependencies = [
]
[[package]]
-name = "hdrhistogram"
-version = "7.5.2"
+name = "hashbrown"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
+dependencies = [
+ "ahash 0.8.3",
+ "allocator-api2",
+]
+
+[[package]]
+name = "hashlink"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
+dependencies = [
+ "hashbrown 0.14.0",
+]
+
+[[package]]
+name = "hdrhistogram"
+version = "7.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8"
dependencies = [
@@ -2089,21 +2153,15 @@ name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-
-[[package]]
-name = "hermit-abi"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
- "libc",
+ "unicode-segmentation",
]
[[package]]
name = "hermit-abi"
-version = "0.3.1"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
+checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
[[package]]
name = "hex"
@@ -2120,6 +2178,15 @@ dependencies = [
"digest",
]
+[[package]]
+name = "home"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
+dependencies = [
+ "windows-sys",
+]
+
[[package]]
name = "http"
version = "0.2.9"
@@ -2150,9 +2217,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]]
name = "httpdate"
-version = "1.0.2"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "humansize"
@@ -2171,9 +2238,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "hyper"
-version = "0.14.26"
+version = "0.14.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4"
+checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
dependencies = [
"bytes",
"futures-channel",
@@ -2234,9 +2301,9 @@ dependencies = [
[[package]]
name = "iana-time-zone"
-version = "0.1.56"
+version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c"
+checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -2248,34 +2315,28 @@ dependencies = [
[[package]]
name = "iana-time-zone-haiku"
-version = "0.1.1"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca"
+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
- "cxx",
- "cxx-build",
+ "cc",
]
[[package]]
name = "idna"
-version = "0.2.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
+checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [
- "matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
-name = "idna"
-version = "0.4.0"
+name = "if_chain"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
-dependencies = [
- "unicode-bidi",
- "unicode-normalization",
-]
+checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed"
[[package]]
name = "ignore"
@@ -2305,6 +2366,16 @@ dependencies = [
"serde",
]
+[[package]]
+name = "indexmap"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.14.0",
+]
+
[[package]]
name = "inout"
version = "0.1.3"
@@ -2315,45 +2386,34 @@ dependencies = [
]
[[package]]
-name = "instant"
-version = "0.1.12"
+name = "ipnet"
+version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
+checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
[[package]]
-name = "io-lifetimes"
-version = "1.0.10"
+name = "itertools"
+version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
+checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
- "hermit-abi 0.3.1",
- "libc",
- "windows-sys 0.48.0",
+ "either",
]
-[[package]]
-name = "ipnet"
-version = "2.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f"
-
[[package]]
name = "itertools"
-version = "0.10.5"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
+checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
dependencies = [
"either",
]
[[package]]
name = "itoa"
-version = "1.0.6"
+version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
+checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "jobserver"
@@ -2366,9 +2426,9 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.61"
+version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
+checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [
"wasm-bindgen",
]
@@ -2392,7 +2452,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe"
dependencies = [
"arrayvec 0.5.2",
- "bitflags",
+ "bitflags 1.3.2",
"cfg-if",
"ryu",
"static_assertions",
@@ -2456,9 +2516,9 @@ dependencies = [
[[package]]
name = "lib0"
-version = "0.16.5"
+version = "0.16.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "daf23122cb1c970b77ea6030eac5e328669415b65d2ab245c99bfb110f9d62dc"
+checksum = "29dc19a026a0d45fc391898c6d4a6d0a5aab5ae6a826ebddc0f33572ffdae8dc"
dependencies = [
"serde",
"serde_json",
@@ -2467,9 +2527,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.141"
+version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]]
name = "libloading"
@@ -2483,9 +2543,9 @@ dependencies = [
[[package]]
name = "libm"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
+checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
[[package]]
name = "librocksdb-sys"
@@ -2515,24 +2575,15 @@ dependencies = [
[[package]]
name = "libz-sys"
-version = "1.1.8"
+version = "1.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
+checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b"
dependencies = [
"cc",
"pkg-config",
"vcpkg",
]
-[[package]]
-name = "link-cplusplus"
-version = "1.0.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
-dependencies = [
- "cc",
-]
-
[[package]]
name = "linked-hash-map"
version = "0.5.6"
@@ -2541,15 +2592,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
-version = "0.3.1"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
+checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
[[package]]
name = "lock_api"
-version = "0.4.9"
+version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
+checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [
"autocfg",
"scopeguard",
@@ -2557,18 +2608,15 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.17"
+version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
-]
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "lru"
-version = "0.10.0"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03f1160296536f10c833a82dca22267d5486734230d47bf00bf435885814ba1e"
+checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670"
dependencies = [
"hashbrown 0.13.2",
]
@@ -2579,7 +2627,7 @@ version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
dependencies = [
- "regex-automata",
+ "regex-automata 0.1.10",
]
[[package]]
@@ -2588,20 +2636,14 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
- "regex-automata",
+ "regex-automata 0.1.10",
]
-[[package]]
-name = "matches"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
-
[[package]]
name = "matchit"
-version = "0.7.0"
+version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"
+checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef"
[[package]]
name = "md-5"
@@ -2620,15 +2662,15 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
[[package]]
name = "memchr"
-version = "2.5.0"
+version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
+checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
[[package]]
name = "memoffset"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
+checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [
"autocfg",
]
@@ -2678,23 +2720,22 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
-version = "0.6.2"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
+checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
dependencies = [
"adler",
]
[[package]]
name = "mio"
-version = "0.8.6"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
+checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
dependencies = [
"libc",
- "log",
"wasi 0.11.0+wasi-snapshot-preview1",
- "windows-sys 0.45.0",
+ "windows-sys",
]
[[package]]
@@ -2726,9 +2767,9 @@ dependencies = [
[[package]]
name = "nom"
-version = "5.1.2"
+version = "5.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
+checksum = "08959a387a676302eebf4ddbcbc611da04285579f76f88ee0506c63b1a61dd4b"
dependencies = [
"lexical-core",
"memchr",
@@ -2746,58 +2787,57 @@ dependencies = [
]
[[package]]
-name = "nu-ansi-term"
-version = "0.46.0"
+name = "normpath"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5"
dependencies = [
- "overload",
- "winapi",
+ "windows-sys",
]
[[package]]
-name = "num-integer"
-version = "0.1.45"
+name = "nu-ansi-term"
+version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
- "autocfg",
- "num-traits",
+ "overload",
+ "winapi",
]
[[package]]
name = "num-traits"
-version = "0.2.15"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
+checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
-version = "1.15.0"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
- "hermit-abi 0.2.6",
+ "hermit-abi",
"libc",
]
[[package]]
name = "object"
-version = "0.30.3"
+version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
+checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
-version = "1.17.1"
+version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
name = "opaque-debug"
@@ -2805,13 +2845,24 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
+[[package]]
+name = "opener"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788"
+dependencies = [
+ "bstr",
+ "normpath",
+ "winapi",
+]
+
[[package]]
name = "openssl"
-version = "0.10.50"
+version = "0.10.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1"
+checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c"
dependencies = [
- "bitflags",
+ "bitflags 2.4.0",
"cfg-if",
"foreign-types",
"libc",
@@ -2828,7 +2879,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -2839,18 +2890,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
-version = "111.25.2+1.1.1t"
+version = "300.1.3+3.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "320708a054ad9b3bf314688b5db87cf4d6683d64cfc835e2337924ae62bf4431"
+checksum = "cd2c101a165fff9935e34def4669595ab1c7847943c42be86e21503e482be107"
dependencies = [
"cc",
]
[[package]]
name = "openssl-sys"
-version = "0.9.85"
+version = "0.9.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0"
+checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d"
dependencies = [
"cc",
"libc",
@@ -2887,15 +2938,15 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.7"
+version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
+checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall 0.2.16",
+ "redox_syscall 0.3.5",
"smallvec",
- "windows-sys 0.45.0",
+ "windows-targets",
]
[[package]]
@@ -2918,6 +2969,12 @@ dependencies = [
"subtle",
]
+[[package]]
+name = "paste"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+
[[package]]
name = "pbkdf2"
version = "0.11.0"
@@ -2954,19 +3011,20 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pest"
-version = "2.5.7"
+version = "2.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b1403e8401ad5dedea73c626b99758535b342502f8d1e361f4a2dd952749122"
+checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33"
dependencies = [
+ "memchr",
"thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
-version = "2.5.7"
+version = "2.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be99c4c1d2fc2769b1d00239431d711d08f6efedcecb8b6e30707160aee99c15"
+checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a"
dependencies = [
"pest",
"pest_generator",
@@ -2974,22 +3032,22 @@ dependencies = [
[[package]]
name = "pest_generator"
-version = "2.5.7"
+version = "2.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e56094789873daa36164de2e822b3888c6ae4b4f9da555a1103587658c805b1e"
+checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
name = "pest_meta"
-version = "2.5.7"
+version = "2.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e"
+checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f"
dependencies = [
"once_cell",
"pest",
@@ -3009,40 +3067,21 @@ dependencies = [
[[package]]
name = "phf"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
-dependencies = [
- "phf_shared 0.10.0",
-]
-
-[[package]]
-name = "phf"
-version = "0.11.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c"
+checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
- "phf_shared 0.11.1",
+ "phf_shared 0.11.2",
]
[[package]]
name = "phf_codegen"
-version = "0.10.0"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
+checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
dependencies = [
- "phf_generator 0.10.0",
- "phf_shared 0.10.0",
-]
-
-[[package]]
-name = "phf_codegen"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770"
-dependencies = [
- "phf_generator 0.11.1",
- "phf_shared 0.11.1",
+ "phf_generator 0.11.2",
+ "phf_shared 0.11.2",
]
[[package]]
@@ -3057,21 +3096,11 @@ dependencies = [
[[package]]
name = "phf_generator"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
-dependencies = [
- "phf_shared 0.10.0",
- "rand 0.8.5",
-]
-
-[[package]]
-name = "phf_generator"
-version = "0.11.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf"
+checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
- "phf_shared 0.11.1",
+ "phf_shared 0.11.2",
"rand 0.8.5",
]
@@ -3100,48 +3129,38 @@ dependencies = [
[[package]]
name = "phf_shared"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
-dependencies = [
- "siphasher",
- "uncased",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.11.1"
+version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676"
+checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
]
[[package]]
name = "pin-project"
-version = "1.0.12"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
+checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
-version = "1.0.12"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
+checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.31",
]
[[package]]
name = "pin-project-lite"
-version = "0.2.9"
+version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
+checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]]
name = "pin-utils"
@@ -3151,9 +3170,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
-version = "0.3.26"
+version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
+checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "polyval"
@@ -3169,11 +3188,11 @@ dependencies = [
[[package]]
name = "postgres-protocol"
-version = "0.6.5"
+version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78b7fa9f396f51dffd61546fd8573ee20592287996568e6175ceb0f8699ad75d"
+checksum = "49b6c5ef183cd3ab4ba005f1ca64c21e8bd97ce4699cfea9e8d9a2c4958ca520"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
"byteorder",
"bytes",
"fallible-iterator",
@@ -3187,9 +3206,9 @@ dependencies = [
[[package]]
name = "postgres-types"
-version = "0.2.5"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f028f05971fe20f512bcc679e2c10227e57809a3af86a7606304435bc8896cd6"
+checksum = "8d2234cdee9408b523530a9b6d2d6b373d1db34f6a8e51dc03ded1828d7fb67c"
dependencies = [
"bytes",
"fallible-iterator",
@@ -3213,12 +3232,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "prettyplease"
-version = "0.2.5"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "617feabb81566b593beb4886fb8c1f38064169dae4dccad0e3220160c3b37203"
+checksum = "8832c0f9be7e3cae60727e6256cfd2cd3c3e2b6cd5dad4190ecb2fd658c9030b"
dependencies = [
"proc-macro2",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -3286,7 +3305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4"
dependencies = [
"anyhow",
- "itertools",
+ "itertools 0.10.5",
"proc-macro2",
"quote",
"syn 1.0.109",
@@ -3432,9 +3451,9 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.32"
+version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
@@ -3450,6 +3469,12 @@ dependencies = [
"scheduled-thread-pool",
]
+[[package]]
+name = "radium"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
+
[[package]]
name = "rand"
version = "0.4.6"
@@ -3538,7 +3563,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
]
[[package]]
@@ -3596,33 +3621,25 @@ version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
-[[package]]
-name = "redox_syscall"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
-dependencies = [
- "bitflags",
-]
-
[[package]]
name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
]
[[package]]
name = "regex"
-version = "1.7.3"
+version = "1.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
+checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47"
dependencies = [
"aho-corasick",
"memchr",
- "regex-syntax",
+ "regex-automata 0.3.8",
+ "regex-syntax 0.7.5",
]
[[package]]
@@ -3631,7 +3648,18 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
- "regex-syntax",
+ "regex-syntax 0.6.29",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax 0.7.5",
]
[[package]]
@@ -3640,6 +3668,12 @@ version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
+[[package]]
+name = "regex-syntax"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
+
[[package]]
name = "remove_dir_all"
version = "0.5.3"
@@ -3664,7 +3698,7 @@ version = "0.11.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
"bytes",
"encoding_rs",
"futures-core",
@@ -3720,23 +3754,26 @@ dependencies = [
[[package]]
name = "rkyv"
-version = "0.7.41"
+version = "0.7.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21499ed91807f07ae081880aabb2ccc0235e9d88011867d984525e9a4c3cfa3e"
+checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58"
dependencies = [
+ "bitvec",
"bytecheck",
"hashbrown 0.12.3",
"ptr_meta",
"rend",
"rkyv_derive",
"seahash",
+ "tinyvec",
+ "uuid",
]
[[package]]
name = "rkyv_derive"
-version = "0.7.41"
+version = "0.7.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac1c672430eb41556291981f45ca900a0239ad007242d1cb4b4167af842db666"
+checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d"
dependencies = [
"proc-macro2",
"quote",
@@ -3755,14 +3792,12 @@ dependencies = [
[[package]]
name = "rust_decimal"
-version = "1.29.1"
+version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26bd36b60561ee1fb5ec2817f198b6fd09fa571c897a5e86d1487cfc2b096dfc"
+checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd"
dependencies = [
- "arrayvec 0.7.2",
+ "arrayvec 0.7.4",
"borsh",
- "bytecheck",
- "byteorder",
"bytes",
"num-traits",
"rand 0.8.5",
@@ -3773,9 +3808,9 @@ dependencies = [
[[package]]
name = "rust_decimal_macros"
-version = "1.29.1"
+version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e773fd3da1ed42472fdf3cfdb4972948a555bc3d73f5e0bdb99d17e7b54c687"
+checksum = "86444b802de0b10ac5e563b5ddb43b541b9705de4e01a50e82194d2b183c1835"
dependencies = [
"quote",
"rust_decimal",
@@ -3783,9 +3818,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
-version = "0.1.22"
+version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b"
+checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustc-hash"
@@ -3795,16 +3830,15 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustix"
-version = "0.37.11"
+version = "0.38.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77"
+checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453"
dependencies = [
- "bitflags",
+ "bitflags 2.4.0",
"errno",
- "io-lifetimes",
"libc",
"linux-raw-sys",
- "windows-sys 0.48.0",
+ "windows-sys",
]
[[package]]
@@ -3821,11 +3855,11 @@ dependencies = [
[[package]]
name = "rustls-pemfile"
-version = "1.0.2"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
+checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2"
dependencies = [
- "base64 0.21.2",
+ "base64 0.21.3",
]
[[package]]
@@ -3840,9 +3874,9 @@ dependencies = [
[[package]]
name = "rustversion"
-version = "1.0.12"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "rusty-money"
@@ -3856,9 +3890,9 @@ dependencies = [
[[package]]
name = "ryu"
-version = "1.0.13"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
+checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "same-file"
@@ -3871,11 +3905,11 @@ dependencies = [
[[package]]
name = "schannel"
-version = "0.1.21"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
+checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
dependencies = [
- "windows-sys 0.42.0",
+ "windows-sys",
]
[[package]]
@@ -3889,15 +3923,9 @@ dependencies = [
[[package]]
name = "scopeguard"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
-
-[[package]]
-name = "scratch"
-version = "1.0.5"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sct"
@@ -3917,11 +3945,11 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "security-framework"
-version = "2.8.2"
+version = "2.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
+checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
"core-foundation",
"core-foundation-sys",
"libc",
@@ -3930,9 +3958,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
-version = "2.8.0"
+version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
+checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
dependencies = [
"core-foundation-sys",
"libc",
@@ -3940,9 +3968,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.175"
+version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b"
+checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
dependencies = [
"serde_derive",
]
@@ -3960,20 +3988,20 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.175"
+version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4"
+checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
name = "serde_json"
-version = "1.0.104"
+version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
+checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
dependencies = [
"itoa",
"ryu",
@@ -3982,13 +4010,13 @@ dependencies = [
[[package]]
name = "serde_repr"
-version = "0.1.12"
+version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
+checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -4040,11 +4068,26 @@ dependencies = [
"lazy_static",
]
+[[package]]
+name = "shared_entity"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "anyhow",
+ "opener",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "serde_repr",
+ "thiserror",
+ "url",
+]
+
[[package]]
name = "shlex"
-version = "1.1.0"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
+checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
[[package]]
name = "signal-hook-registry"
@@ -4075,15 +4118,15 @@ checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
[[package]]
name = "siphasher"
-version = "0.3.10"
+version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
+checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "slab"
-version = "0.4.8"
+version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
@@ -4108,9 +4151,9 @@ dependencies = [
[[package]]
name = "smallvec"
-version = "1.10.0"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
+checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
[[package]]
name = "socket2"
@@ -4129,7 +4172,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [
"libc",
- "windows-sys 0.48.0",
+ "windows-sys",
]
[[package]]
@@ -4138,18 +4181,126 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
+[[package]]
+name = "sqlformat"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85"
+dependencies = [
+ "itertools 0.11.0",
+ "nom 7.1.3",
+ "unicode_categories",
+]
+
+[[package]]
+name = "sqlx"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721"
+dependencies = [
+ "sqlx-core",
+ "sqlx-macros",
+]
+
+[[package]]
+name = "sqlx-core"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53"
+dependencies = [
+ "ahash 0.8.3",
+ "atoi",
+ "byteorder",
+ "bytes",
+ "crc",
+ "crossbeam-queue",
+ "dotenvy",
+ "either",
+ "event-listener",
+ "futures-channel",
+ "futures-core",
+ "futures-intrusive",
+ "futures-io",
+ "futures-util",
+ "hashlink",
+ "hex",
+ "indexmap 2.0.0",
+ "log",
+ "memchr",
+ "once_cell",
+ "paste",
+ "percent-encoding",
+ "serde",
+ "sha2",
+ "smallvec",
+ "sqlformat",
+ "thiserror",
+ "tracing",
+ "url",
+]
+
+[[package]]
+name = "sqlx-macros"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "sqlx-core",
+ "sqlx-macros-core",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "sqlx-macros-core"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc"
+dependencies = [
+ "dotenvy",
+ "either",
+ "heck 0.4.1",
+ "hex",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "sha2",
+ "sqlx-core",
+ "syn 1.0.109",
+ "tempfile",
+ "url",
+]
+
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+[[package]]
+name = "storage-entity"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=8f8f6a#8f8f6af0f9fa1229d43e0dcbc54c62cc41ccaa3b"
+dependencies = [
+ "chrono",
+ "collab-define",
+ "serde",
+ "serde_json",
+ "sqlx",
+ "uuid",
+ "validator",
+]
+
[[package]]
name = "stringprep"
-version = "0.1.2"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1"
+checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6"
dependencies = [
+ "finl_unicode",
"unicode-bidi",
"unicode-normalization",
]
@@ -4182,14 +4333,14 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
name = "subtle"
-version = "2.4.1"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "syn"
@@ -4204,9 +4355,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.27"
+version = "2.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0"
+checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398"
dependencies = [
"proc-macro2",
"quote",
@@ -4219,6 +4370,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
+[[package]]
+name = "tap"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
+
[[package]]
name = "tempdir"
version = "0.3.7"
@@ -4231,25 +4388,25 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.5.0"
+version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
+checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
dependencies = [
"cfg-if",
"fastrand",
"redox_syscall 0.3.5",
"rustix",
- "windows-sys 0.45.0",
+ "windows-sys",
]
[[package]]
name = "tera"
-version = "1.18.1"
+version = "1.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95a665751302f22a03c56721e23094e4dc22b04a80f381e6737a07bf7a7c70c0"
+checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8"
dependencies = [
"chrono",
- "chrono-tz 0.6.1",
+ "chrono-tz",
"globwalk",
"humansize",
"lazy_static",
@@ -4261,19 +4418,9 @@ dependencies = [
"serde",
"serde_json",
"slug",
- "thread_local",
"unic-segment",
]
-[[package]]
-name = "termcolor"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
-dependencies = [
- "winapi-util",
-]
-
[[package]]
name = "terminal_size"
version = "0.1.17"
@@ -4286,22 +4433,22 @@ dependencies = [
[[package]]
name = "thiserror"
-version = "1.0.40"
+version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
+checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.40"
+version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
+checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -4317,10 +4464,11 @@ dependencies = [
[[package]]
name = "thread_local"
-version = "1.1.4"
+version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
+checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
+ "cfg-if",
"once_cell",
]
@@ -4337,10 +4485,11 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.21"
+version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc"
+checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48"
dependencies = [
+ "deranged",
"serde",
"time-core",
]
@@ -4368,11 +4517,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.27.0"
+version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001"
+checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
dependencies = [
- "autocfg",
+ "backtrace",
"bytes",
"libc",
"mio",
@@ -4380,10 +4529,10 @@ dependencies = [
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
- "socket2 0.4.9",
+ "socket2 0.5.3",
"tokio-macros",
"tracing",
- "windows-sys 0.45.0",
+ "windows-sys",
]
[[package]]
@@ -4398,13 +4547,13 @@ dependencies = [
[[package]]
name = "tokio-macros"
-version = "2.0.0"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce"
+checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.27",
+ "syn 2.0.31",
]
[[package]]
@@ -4419,9 +4568,9 @@ dependencies = [
[[package]]
name = "tokio-postgres"
-version = "0.7.8"
+version = "0.7.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e89f6234aa8fd43779746012fcf53603cdb91fdd8399aa0de868c2d56b6dde1"
+checksum = "d340244b32d920260ae7448cb72b6e238bddc3d4f7603394e7dd46ed8e48f5b8"
dependencies = [
"async-trait",
"byteorder",
@@ -4432,13 +4581,15 @@ dependencies = [
"log",
"parking_lot",
"percent-encoding",
- "phf 0.11.1",
+ "phf 0.11.2",
"pin-project-lite",
"postgres-protocol",
"postgres-types",
+ "rand 0.8.5",
"socket2 0.5.3",
"tokio",
"tokio-util",
+ "whoami",
]
[[package]]
@@ -4488,9 +4639,9 @@ dependencies = [
[[package]]
name = "tokio-util"
-version = "0.7.7"
+version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2"
+checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d"
dependencies = [
"bytes",
"futures-core",
@@ -4511,14 +4662,13 @@ dependencies = [
[[package]]
name = "tonic"
-version = "0.8.3"
+version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb"
+checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a"
dependencies = [
- "async-stream",
"async-trait",
"axum",
- "base64 0.13.1",
+ "base64 0.21.3",
"bytes",
"futures-core",
"futures-util",
@@ -4530,15 +4680,12 @@ dependencies = [
"percent-encoding",
"pin-project",
"prost",
- "prost-derive",
"tokio",
"tokio-stream",
- "tokio-util",
"tower",
"tower-layer",
"tower-service",
"tracing",
- "tracing-futures",
]
[[package]]
@@ -4549,7 +4696,7 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
dependencies = [
"futures-core",
"futures-util",
- "indexmap",
+ "indexmap 1.9.3",
"pin-project",
"pin-project-lite",
"rand 0.8.5",
@@ -4599,13 +4746,13 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.23"
+version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
+checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.31",
]
[[package]]
@@ -4627,24 +4774,14 @@ dependencies = [
[[package]]
name = "tracing-core"
-version = "0.1.30"
+version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
+checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
dependencies = [
"once_cell",
"valuable",
]
-[[package]]
-name = "tracing-futures"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
-dependencies = [
- "pin-project",
- "tracing",
-]
-
[[package]]
name = "tracing-log"
version = "0.1.3"
@@ -4690,9 +4827,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.16"
+version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
+checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
dependencies = [
"matchers 0.1.0",
"nu-ansi-term",
@@ -4739,18 +4876,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "ucd-trie"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"
-
-[[package]]
-name = "uncased"
-version = "0.9.7"
+version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09b01702b0fd0b3fadcf98e098780badda8742d4f4a7676615cad90e8ac73622"
-dependencies = [
- "version_check",
-]
+checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "unic-char-property"
@@ -4819,9 +4947,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
-version = "1.0.8"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
+checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "unicode-normalization"
@@ -4844,6 +4972,18 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+[[package]]
+name = "unicode_categories"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
+
+[[package]]
+name = "unidecode"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "402bb19d8e03f1d1a7450e2bd613980869438e0666331be3e073089124aa1adc"
+
[[package]]
name = "universal-hash"
version = "0.5.1"
@@ -4867,7 +5007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
dependencies = [
"form_urlencoded",
- "idna 0.4.0",
+ "idna",
"percent-encoding",
]
@@ -4879,28 +5019,55 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "uuid"
-version = "1.3.3"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2"
+checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d"
dependencies = [
- "getrandom 0.2.9",
+ "getrandom 0.2.10",
"serde",
"sha1_smol",
]
[[package]]
name = "validator"
-version = "0.16.0"
+version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32ad5bf234c7d3ad1042e5252b7eddb2c4669ee23f32c7dd0e9b7705f07ef591"
+checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd"
dependencies = [
- "idna 0.2.3",
+ "idna",
"lazy_static",
"regex",
"serde",
"serde_derive",
"serde_json",
"url",
+ "validator_derive",
+]
+
+[[package]]
+name = "validator_derive"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af"
+dependencies = [
+ "if_chain",
+ "lazy_static",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "syn 1.0.109",
+ "validator_types",
+]
+
+[[package]]
+name = "validator_types"
+version = "0.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3"
+dependencies = [
+ "proc-macro2",
+ "syn 1.0.109",
]
[[package]]
@@ -4923,9 +5090,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "walkdir"
-version = "2.3.3"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
+checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
dependencies = [
"same-file",
"winapi-util",
@@ -4933,11 +5100,10 @@ dependencies = [
[[package]]
name = "want"
-version = "0.3.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
- "log",
"try-lock",
]
@@ -4961,9 +5127,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.84"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
+checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -4971,24 +5137,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.84"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
+checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.31",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.34"
+version = "0.4.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
+checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
dependencies = [
"cfg-if",
"js-sys",
@@ -4998,9 +5164,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.84"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
+checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -5008,22 +5174,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.84"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
+checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.31",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.84"
+version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
+checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]]
name = "wasm-streams"
@@ -5040,9 +5206,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.61"
+version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
+checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -5056,13 +5222,24 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
[[package]]
name = "which"
-version = "4.4.0"
+version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
+checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
- "libc",
+ "home",
"once_cell",
+ "rustix",
+]
+
+[[package]]
+name = "whoami"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50"
+dependencies = [
+ "wasm-bindgen",
+ "web-sys",
]
[[package]]
@@ -5102,31 +5279,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [
- "windows-targets 0.48.0",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.42.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
-dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.45.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
-dependencies = [
- "windows-targets 0.42.2",
+ "windows-targets",
]
[[package]]
@@ -5135,122 +5288,65 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
- "windows-targets 0.48.0",
+ "windows-targets",
]
[[package]]
name = "windows-targets"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
- "windows_aarch64_gnullvm 0.42.2",
- "windows_aarch64_msvc 0.42.2",
- "windows_i686_gnu 0.42.2",
- "windows_i686_msvc 0.42.2",
- "windows_x86_64_gnu 0.42.2",
- "windows_x86_64_gnullvm 0.42.2",
- "windows_x86_64_msvc 0.42.2",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
-dependencies = [
- "windows_aarch64_gnullvm 0.48.0",
- "windows_aarch64_msvc 0.48.0",
- "windows_i686_gnu 0.48.0",
- "windows_i686_msvc 0.48.0",
- "windows_x86_64_gnu 0.48.0",
- "windows_x86_64_gnullvm 0.48.0",
- "windows_x86_64_msvc 0.48.0",
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
-
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.42.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
-
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.48.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.42.2"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.48.0"
+version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "winreg"
@@ -5259,7 +5355,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
"cfg-if",
- "windows-sys 0.48.0",
+ "windows-sys",
+]
+
+[[package]]
+name = "wyz"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
+dependencies = [
+ "tap",
]
[[package]]
@@ -5312,7 +5417,7 @@ dependencies = [
"hmac",
"pbkdf2 0.11.0",
"sha1",
- "time 0.3.21",
+ "time 0.3.28",
"zstd",
]
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index 6d21ec0641..cf01c8e948 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -2,7 +2,6 @@
members = [
"lib-dispatch",
"lib-log",
- "flowy-net",
"flowy-core",
"dart-ffi",
"flowy-user",
@@ -23,8 +22,33 @@ members = [
"flowy-config",
"flowy-encrypt",
"flowy-storage",
+ "collab-integrate",
]
+[workspace.dependencies]
+lib-dispatch = { workspace = true, path = "lib-dispatch" }
+lib-log = { workspace = true, path = "lib-log" }
+flowy-core = { workspace = true, path = "flowy-core" }
+dart-ffi = { workspace = true, path = "dart-ffi" }
+flowy-user = { workspace = true, path = "flowy-user" }
+flowy-user-deps = { workspace = true, path = "flowy-user-deps" }
+flowy-sqlite = { workspace = true, path = "flowy-sqlite" }
+flowy-folder2 = { workspace = true, path = "flowy-folder2" }
+flowy-folder-deps = { workspace = true, path = "flowy-folder-deps" }
+flowy-notification = { workspace = true, path = "flowy-notification" }
+flowy-document2 = { workspace = true, path = "flowy-document2" }
+flowy-document-deps = { workspace = true, path = "flowy-document-deps" }
+flowy-error = { workspace = true, path = "flowy-error" }
+flowy-database2 = { workspace = true, path = "flowy-database2" }
+flowy-database-deps = { workspace = true, path = "flowy-database-deps" }
+flowy-task = { workspace = true, path = "flowy-task" }
+flowy-server = { workspace = true, path = "flowy-server" }
+flowy-server-config = { workspace = true, path = "flowy-server-config" }
+flowy-config = { workspace = true, path = "flowy-config" }
+flowy-encrypt = { workspace = true, path = "flowy-encrypt" }
+flowy-storage = { workspace = true, path = "flowy-storage" }
+collab-integrate = { workspace = true, path = "collab-integrate" }
+
[profile.dev]
opt-level = 0
lto = false
@@ -49,20 +73,30 @@ lto = false
incremental = false
[patch.crates-io]
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
-collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "9bb9a7" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "8f8f6a" }
+
+# ⚠️⚠️⚠️
+# Please using the following command to update the revision id
+# Current directory: frontend
+# Run the script:
+# scripts/tool/update_collab_rev.sh new_rev_id
+# ⚠️⚠️⚠️️
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-define = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-sync-protocol = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
+collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "20eff3" }
#collab = { path = "../AppFlowy-Collab/collab" }
#collab-folder = { path = "../AppFlowy-Collab/collab-folder" }
#collab-database= { path = "../AppFlowy-Collab/collab-database" }
#collab-document = { path = "../AppFlowy-Collab/collab-document" }
#collab-plugins = { path = "../AppFlowy-Collab/collab-plugins" }
-#appflowy-integrate = { path = "../AppFlowy-Collab/appflowy-integrate" }
+#collab-persistence = { path = "../AppFlowy-Collab/collab-persistence" }
#collab-user = { path = "../AppFlowy-Collab/collab-user" }
#collab-define = { path = "../AppFlowy-Collab/collab-define" }
+#collab-sync-protocol = { path = "../AppFlowy-Collab/collab-sync-protocol" }
diff --git a/frontend/rust-lib/collab-integrate/Cargo.toml b/frontend/rust-lib/collab-integrate/Cargo.toml
new file mode 100644
index 0000000000..8dba6f268f
--- /dev/null
+++ b/frontend/rust-lib/collab-integrate/Cargo.toml
@@ -0,0 +1,28 @@
+[package]
+name = "collab-integrate"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+collab = { version = "0.1.0" }
+collab-persistence = { version = "0.1.0", features = ["rocksdb_persistence"] }
+collab-folder = { version = "0.1.0" }
+collab-database = { version = "0.1.0" }
+collab-plugins = { version = "0.1.0" }
+collab-document = { version = "0.1.0" }
+collab-define = { version = "0.1.0" }
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+anyhow = "1.0"
+tracing = "0.1"
+parking_lot = "0.12.1"
+futures = "0.3"
+async-trait = "0.1.73"
+
+[features]
+default = []
+supabase_integrate = ["collab-plugins/postgres_storage_plugin", "collab-plugins/rocksdb_plugin"]
+appflowy_cloud_integrate = ["collab-plugins/sync_plugin", "collab-plugins/rocksdb_plugin"]
+snapshot_plugin = ["collab-plugins/snapshot_plugin"]
\ No newline at end of file
diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rs
new file mode 100644
index 0000000000..b0e1cbb59d
--- /dev/null
+++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs
@@ -0,0 +1,261 @@
+use std::fmt::Debug;
+use std::sync::{Arc, Weak};
+
+use anyhow::Error;
+use async_trait::async_trait;
+use collab::core::collab::{CollabRawData, MutexCollab};
+use collab::preclude::{CollabBuilder, CollabPlugin};
+use collab_define::{CollabObject, CollabType};
+use collab_persistence::kv::rocks_kv::RocksCollabDB;
+use collab_plugins::cloud_storage::network_state::{CollabNetworkReachability, CollabNetworkState};
+use collab_plugins::local_storage::rocksdb::RocksdbDiskPlugin;
+use collab_plugins::local_storage::CollabPersistenceConfig;
+use collab_plugins::snapshot::{CollabSnapshotPlugin, SnapshotPersistence};
+use futures::executor::block_on;
+use parking_lot::{Mutex, RwLock};
+
+#[derive(Clone, Debug)]
+pub enum CollabSource {
+ Local,
+ AFCloud,
+ Supabase,
+}
+
+pub enum CollabPluginContext {
+ Local,
+ AppFlowyCloud {
+ uid: i64,
+ collab_object: CollabObject,
+ local_collab: Weak<MutexCollab>,
+ },
+ Supabase {
+ uid: i64,
+ collab_object: CollabObject,
+ local_collab: Weak<MutexCollab>,
+ local_collab_db: Weak<RocksCollabDB>,
+ },
+}
+
+#[async_trait]
+pub trait CollabStorageProvider: Send + Sync + 'static {
+ fn storage_source(&self) -> CollabSource;
+
+ async fn get_plugins(
+ &self,
+ context: CollabPluginContext,
+ ) -> Vec<Arc<dyn collab::core::collab_plugin::CollabPlugin>>;
+
+ fn is_sync_enabled(&self) -> bool;
+}
+
+#[async_trait]
+impl<T> CollabStorageProvider for Arc<T>
+where
+ T: CollabStorageProvider,
+{
+ fn storage_source(&self) -> CollabSource {
+ (**self).storage_source()
+ }
+
+ async fn get_plugins(&self, context: CollabPluginContext) -> Vec<Arc<dyn CollabPlugin>> {
+ (**self).get_plugins(context).await
+ }
+
+ fn is_sync_enabled(&self) -> bool {
+ (**self).is_sync_enabled()
+ }
+}
+
+pub struct AppFlowyCollabBuilder {
+ network_reachability: CollabNetworkReachability,
+ workspace_id: RwLock<Option<String>>,
+ cloud_storage: RwLock<Arc<dyn CollabStorageProvider>>,
+ snapshot_persistence: Mutex<Option<Arc<dyn SnapshotPersistence>>>,
+ device_id: Mutex<String>,
+}
+
+impl AppFlowyCollabBuilder {
+ pub fn new<T: CollabStorageProvider>(storage_provider: T) -> Self {
+ Self {
+ network_reachability: CollabNetworkReachability::new(),
+ workspace_id: Default::default(),
+ cloud_storage: RwLock::new(Arc::new(storage_provider)),
+ snapshot_persistence: Default::default(),
+ device_id: Default::default(),
+ }
+ }
+
+ pub fn set_snapshot_persistence(&self, snapshot_persistence: Arc<dyn SnapshotPersistence>) {
+ *self.snapshot_persistence.lock() = Some(snapshot_persistence);
+ }
+
+ pub fn initialize(&self, workspace_id: String) {
+ *self.workspace_id.write() = Some(workspace_id);
+ }
+
+ pub fn set_sync_device(&self, device_id: String) {
+ *self.device_id.lock() = device_id;
+ }
+
+ pub fn update_network(&self, reachable: bool) {
+ if reachable {
+ self
+ .network_reachability
+ .set_state(CollabNetworkState::Connected)
+ } else {
+ self
+ .network_reachability
+ .set_state(CollabNetworkState::Disconnected)
+ }
+ }
+
+ fn collab_object(
+ &self,
+ uid: i64,
+ object_id: &str,
+ collab_type: CollabType,
+ ) -> Result<CollabObject, Error> {
+ let workspace_id = self.workspace_id.read().clone().ok_or_else(|| {
+ anyhow::anyhow!("When using supabase plugin, the workspace_id should not be empty")
+ })?;
+ Ok(CollabObject::new(
+ uid,
+ object_id.to_string(),
+ collab_type,
+ workspace_id,
+ self.device_id.lock().clone(),
+ ))
+ }
+
+ /// Creates a new collaboration builder with the default configuration.
+ ///
+ /// This function will initiate the creation of a [MutexCollab] object if it does not already exist.
+ /// To check for the existence of the object prior to creation, you should utilize a transaction
+ /// returned by the [read_txn] method of the [RocksCollabDB]. Then, invoke the [is_exist] method
+ /// to confirm the object's presence.
+ ///
+ /// # Parameters
+ /// - `uid`: The user ID associated with the collaboration.
+ /// - `object_id`: A string reference representing the ID of the object.
+ /// - `object_type`: The type of the collaboration, defined by the [CollabType] enum.
+ /// - `raw_data`: The raw data of the collaboration object, defined by the [CollabRawData] type.
+ /// - `collab_db`: A weak reference to the [RocksCollabDB].
+ ///
+ pub fn build(
+ &self,
+ uid: i64,
+ object_id: &str,
+ object_type: CollabType,
+ raw_data: CollabRawData,
+ collab_db: Weak<RocksCollabDB>,
+ ) -> Result<Arc<MutexCollab>, Error> {
+ self.build_with_config(
+ uid,
+ object_id,
+ object_type,
+ collab_db,
+ raw_data,
+ &CollabPersistenceConfig::default(),
+ )
+ }
+
+ /// Creates a new collaboration builder with the custom configuration.
+ ///
+ /// This function will initiate the creation of a [MutexCollab] object if it does not already exist.
+ /// To check for the existence of the object prior to creation, you should utilize a transaction
+ /// returned by the [read_txn] method of the [RocksCollabDB]. Then, invoke the [is_exist] method
+ /// to confirm the object's presence.
+ ///
+ /// # Parameters
+ /// - `uid`: The user ID associated with the collaboration.
+ /// - `object_id`: A string reference representing the ID of the object.
+ /// - `object_type`: The type of the collaboration, defined by the [CollabType] enum.
+ /// - `raw_data`: The raw data of the collaboration object, defined by the [CollabRawData] type.
+ /// - `collab_db`: A weak reference to the [RocksCollabDB].
+ ///
+ pub fn build_with_config(
+ &self,
+ uid: i64,
+ object_id: &str,
+ object_type: CollabType,
+ collab_db: Weak<RocksCollabDB>,
+ collab_raw_data: CollabRawData,
+ config: &CollabPersistenceConfig,
+ ) -> Result<Arc<MutexCollab>, Error> {
+ let collab = Arc::new(
+ CollabBuilder::new(uid, object_id)
+ .with_raw_data(collab_raw_data)
+ .with_plugin(RocksdbDiskPlugin::new_with_config(
+ uid,
+ collab_db.clone(),
+ config.clone(),
+ ))
+ .with_device_id(self.device_id.lock().clone())
+ .build()?,
+ );
+ {
+ let cloud_storage = self.cloud_storage.read();
+ let cloud_storage_type = cloud_storage.storage_source();
+ let collab_object = self.collab_object(uid, object_id, object_type)?;
+ match cloud_storage_type {
+ CollabSource::AFCloud => {
+ #[cfg(feature = "appflowy_cloud_integrate")]
+ {
+ //
+ }
+ },
+ CollabSource::Supabase => {
+ #[cfg(feature = "supabase_integrate")]
+ {
+ let local_collab = Arc::downgrade(&collab);
+ let local_collab_db = collab_db.clone();
+ let plugins = block_on(cloud_storage.get_plugins(CollabPluginContext::Supabase {
+ uid,
+ collab_object: collab_object.clone(),
+ local_collab,
+ local_collab_db,
+ }));
+ for plugin in plugins {
+ collab.lock().add_plugin(plugin);
+ }
+ }
+ },
+ CollabSource::Local => {},
+ }
+
+ if let Some(snapshot_persistence) = self.snapshot_persistence.lock().as_ref() {
+ if config.enable_snapshot {
+ let snapshot_plugin = CollabSnapshotPlugin::new(
+ uid,
+ collab_object,
+ snapshot_persistence.clone(),
+ collab_db,
+ config.snapshot_per_update,
+ );
+ // tracing::trace!("add snapshot plugin: {}", object_id);
+ collab.lock().add_plugin(Arc::new(snapshot_plugin));
+ }
+ }
+ }
+
+ block_on(collab.async_initialize());
+ Ok(collab)
+ }
+}
+
+pub struct DefaultCollabStorageProvider();
+
+#[async_trait]
+impl CollabStorageProvider for DefaultCollabStorageProvider {
+ fn storage_source(&self) -> CollabSource {
+ CollabSource::Local
+ }
+
+ async fn get_plugins(&self, _context: CollabPluginContext) -> Vec<Arc<dyn CollabPlugin>> {
+ vec![]
+ }
+
+ fn is_sync_enabled(&self) -> bool {
+ false
+ }
+}
diff --git a/frontend/rust-lib/collab-integrate/src/config.rs b/frontend/rust-lib/collab-integrate/src/config.rs
new file mode 100644
index 0000000000..c114dcc68d
--- /dev/null
+++ b/frontend/rust-lib/collab-integrate/src/config.rs
@@ -0,0 +1,70 @@
+use std::str::FromStr;
+
+use serde::{Deserialize, Serialize};
+
+pub enum CollabDBPluginProvider {
+ AWS,
+ Supabase,
+}
+
+#[derive(Clone, Debug, Serialize, Deserialize, Default)]
+pub struct CollabPluginConfig {
+ /// Only one of the following two fields should be set.
+ aws_config: Option<AWSDynamoDBConfig>,
+}
+
+impl CollabPluginConfig {
+ pub fn from_env() -> Self {
+ let aws_config = AWSDynamoDBConfig::from_env();
+ Self { aws_config }
+ }
+
+ pub fn aws_config(&self) -> Option<&AWSDynamoDBConfig> {
+ self.aws_config.as_ref()
+ }
+}
+
+impl CollabPluginConfig {}
+
+impl FromStr for CollabPluginConfig {
+ type Err = serde_json::Error;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ serde_json::from_str(s)
+ }
+}
+
+pub const AWS_ACCESS_KEY_ID: &str = "AWS_ACCESS_KEY_ID";
+pub const AWS_SECRET_ACCESS_KEY: &str = "AWS_SECRET_ACCESS_KEY";
+pub const AWS_REGION: &str = "AWS_REGION";
+
+// To enable this test, you should set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in your environment variables.
+// or create the ~/.aws/credentials file following the instructions in https://docs.aws.amazon.com/sdk-for-rust/latest/dg/credentials.html
+#[derive(Default, Clone, Debug, Serialize, Deserialize)]
+pub struct AWSDynamoDBConfig {
+ pub access_key_id: String,
+ pub secret_access_key: String,
+ // Region list: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
+ pub region: String,
+ pub enable: bool,
+}
+
+impl AWSDynamoDBConfig {
+ pub fn from_env() -> Option<Self> {
+ let access_key_id = std::env::var(AWS_ACCESS_KEY_ID).ok()?;
+ let secret_access_key = std::env::var(AWS_SECRET_ACCESS_KEY).ok()?;
+ let region = std::env::var(AWS_REGION).unwrap_or_else(|_| "us-east-1".to_string());
+ Some(Self {
+ access_key_id,
+ secret_access_key,
+ region,
+ enable: true,
+ })
+ }
+
+ pub fn write_env(&self) {
+ std::env::set_var(AWS_ACCESS_KEY_ID, &self.access_key_id);
+ std::env::set_var(AWS_SECRET_ACCESS_KEY, &self.secret_access_key);
+ std::env::set_var(AWS_REGION, &self.region);
+ }
+}
diff --git a/frontend/rust-lib/collab-integrate/src/lib.rs b/frontend/rust-lib/collab-integrate/src/lib.rs
new file mode 100644
index 0000000000..2b825add0e
--- /dev/null
+++ b/frontend/rust-lib/collab-integrate/src/lib.rs
@@ -0,0 +1,26 @@
+pub use collab::core::collab::MutexCollab;
+pub use collab::preclude::Snapshot;
+pub use collab_persistence::doc::YrsDocAction;
+pub use collab_persistence::error::PersistenceError;
+#[cfg(any(
+ feature = "appflowy_cloud_integrate",
+ feature = "supabase_integrate",
+ feature = "rocksdb_plugin"
+))]
+pub use collab_persistence::kv::rocks_kv::RocksCollabDB;
+pub use collab_persistence::snapshot::CollabSnapshot;
+#[cfg(feature = "supabase_integrate")]
+pub use collab_plugins::cloud_storage::*;
+#[cfg(any(
+ feature = "appflowy_cloud_integrate",
+ feature = "supabase_integrate",
+ feature = "rocksdb_plugin"
+))]
+pub use collab_plugins::local_storage::CollabPersistenceConfig;
+#[cfg(feature = "snapshot_plugin")]
+pub use collab_plugins::snapshot::{
+ calculate_snapshot_diff, try_encode_snapshot, SnapshotPersistence,
+};
+
+pub mod collab_builder;
+pub mod config;
diff --git a/frontend/rust-lib/dart-ffi/Cargo.toml b/frontend/rust-lib/dart-ffi/Cargo.toml
index 38e86087d0..76e6540309 100644
--- a/frontend/rust-lib/dart-ffi/Cargo.toml
+++ b/frontend/rust-lib/dart-ffi/Cargo.toml
@@ -24,15 +24,15 @@ crossbeam-utils = "0.8.15"
lazy_static = "1.4.0"
parking_lot = "0.12.1"
tracing = { version = "0.1", features = ["log"] }
-appflowy-integrate = {version = "0.1.0" }
-lib-dispatch = { path = "../lib-dispatch" }
-flowy-core = { path = "../flowy-core" }
-flowy-notification = { path = "../flowy-notification" }
-flowy-net = { path = "../flowy-net" }
+# workspace
+lib-dispatch = { workspace = true }
+flowy-core = { workspace = true }
+flowy-notification = { workspace = true }
+flowy-server = { workspace = true }
+flowy-server-config = { workspace = true }
+collab-integrate = { workspace = true }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-flowy-server = { path = "../flowy-server" }
-flowy-server-config = { path = "../flowy-server-config" }
[features]
default = ["dart", "rev-sqlite"]
diff --git a/frontend/rust-lib/flowy-config/Cargo.toml b/frontend/rust-lib/flowy-config/Cargo.toml
index 6f425568f5..1df04bdb14 100644
--- a/frontend/rust-lib/flowy-config/Cargo.toml
+++ b/frontend/rust-lib/flowy-config/Cargo.toml
@@ -6,12 +6,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-flowy-sqlite = { path = "../flowy-sqlite" }
+# workspace
+flowy-sqlite = { workspace = true }
+lib-dispatch = { workspace = true }
+flowy-error = { workspace = true }
+
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-lib-dispatch = { path = "../lib-dispatch" }
protobuf = {version = "2.28.0"}
bytes = { version = "1.4" }
-flowy-error = { path = "../flowy-error" }
strum_macros = "0.21"
[build-dependencies]
diff --git a/frontend/rust-lib/flowy-core/Cargo.toml b/frontend/rust-lib/flowy-core/Cargo.toml
index cf5f1347ad..3fb78e45c2 100644
--- a/frontend/rust-lib/flowy-core/Cargo.toml
+++ b/frontend/rust-lib/flowy-core/Cargo.toml
@@ -6,28 +6,29 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-lib-dispatch = { path = "../lib-dispatch" }
-lib-log = { path = "../lib-log" }
-flowy-user = { path = "../flowy-user" }
-flowy-user-deps = { path = "../flowy-user-deps" }
-flowy-net = { path = "../flowy-net" }
-flowy-folder2 = { path = "../flowy-folder2" }
-flowy-folder-deps = { path = "../flowy-folder-deps" }
-flowy-database2 = { path = "../flowy-database2" }
-flowy-database-deps = { path = "../flowy-database-deps" }
-flowy-sqlite = { path = "../flowy-sqlite" }
-flowy-document2 = { path = "../flowy-document2" }
-flowy-document-deps = { path = "../flowy-document-deps" }
-flowy-error = { path = "../flowy-error" }
-flowy-task = { path = "../flowy-task" }
-flowy-server = { path = "../flowy-server" }
-flowy-server-config = { path = "../flowy-server-config" }
-flowy-config = { path = "../flowy-config" }
-appflowy-integrate = { version = "0.1.0", features = ["postgres_storage_plugin", "snapshot_plugin"] }
+lib-dispatch = { workspace = true }
+lib-log = { workspace = true }
+flowy-user = { workspace = true }
+flowy-user-deps = { workspace = true }
+flowy-folder2 = { workspace = true }
+flowy-folder-deps = { workspace = true }
+flowy-database2 = { workspace = true }
+flowy-database-deps = { workspace = true }
+flowy-sqlite = { workspace = true }
+flowy-document2 = { workspace = true }
+flowy-document-deps = { workspace = true }
+flowy-error = { workspace = true }
+flowy-task = { workspace = true }
+flowy-server = { workspace = true }
+flowy-server-config = { workspace = true }
+flowy-config = { workspace = true }
+collab-integrate = { workspace = true, features = ["supabase_integrate", "appflowy_cloud_integrate", "snapshot_plugin"] }
collab-define = { version = "0.1.0" }
+collab-plugins = { version = "0.1.0", features = ["sync_plugin"] }
+collab = { version = "0.1.0" }
diesel = { version = "1.4.8", features = ["sqlite"] }
uuid = { version = "1.3.3", features = ["v4"] }
-flowy-storage = { path = "../flowy-storage" }
+flowy-storage = { workspace = true }
tracing = { version = "0.1", features = ["log"] }
futures-core = { version = "0.3", default-features = false }
@@ -35,6 +36,7 @@ bytes = "1.4"
tokio = { version = "1.26", features = ["full"] }
console-subscriber = { version = "0.1.8", optional = true }
parking_lot = "0.12.1"
+anyhow = "1.0.75"
lib-infra = { path = "../../../shared-lib/lib-infra" }
serde = "1.0"
@@ -49,7 +51,6 @@ native_sync = []
use_bunyan = ["lib-log/use_bunyan"]
dart = [
"flowy-user/dart",
- "flowy-net/dart",
"flowy-folder2/dart",
"flowy-database2/dart",
"flowy-document2/dart",
@@ -57,7 +58,6 @@ dart = [
]
ts = [
"flowy-user/ts",
- "flowy-net/ts",
"flowy-folder2/ts",
"flowy-database2/ts",
"flowy-document2/ts",
@@ -67,3 +67,4 @@ rev-sqlite = [
"flowy-user/rev-sqlite",
]
openssl_vendored = ["flowy-sqlite/openssl_vendored"]
+
diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/collab_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/collab_deps.rs
index dbd1a57ad0..cef0cf1689 100644
--- a/frontend/rust-lib/flowy-core/src/deps_resolve/collab_deps.rs
+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/collab_deps.rs
@@ -1,10 +1,10 @@
use std::sync::Weak;
-use appflowy_integrate::{
- calculate_snapshot_diff, CollabSnapshot, PersistenceError, SnapshotPersistence,
-};
use diesel::SqliteConnection;
+use collab_integrate::{
+ calculate_snapshot_diff, CollabSnapshot, PersistenceError, SnapshotPersistence,
+};
use flowy_error::FlowyError;
use flowy_sqlite::{
insert_or_ignore_into,
diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/database_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/database_deps.rs
index 6079cc25f7..34c5cc7801 100644
--- a/frontend/rust-lib/flowy-core/src/deps_resolve/database_deps.rs
+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/database_deps.rs
@@ -1,9 +1,9 @@
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::RocksCollabDB;
use tokio::sync::RwLock;
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::RocksCollabDB;
use flowy_database2::{DatabaseManager, DatabaseUser};
use flowy_database_deps::cloud::DatabaseCloudService;
use flowy_error::FlowyError;
diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs
index af8cf8ea13..7673e011d3 100644
--- a/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs
+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs
@@ -1,8 +1,7 @@
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::RocksCollabDB;
-
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::RocksCollabDB;
use flowy_database2::DatabaseManager;
use flowy_document2::manager::{DocumentManager, DocumentUser};
use flowy_document_deps::cloud::DocumentCloudService;
diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs
index 18b26124ca..a3907b2e19 100644
--- a/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs
+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs
@@ -2,11 +2,11 @@ use std::collections::HashMap;
use std::convert::TryFrom;
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::RocksCollabDB;
use bytes::Bytes;
use tokio::sync::RwLock;
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::RocksCollabDB;
use flowy_database2::entities::DatabaseLayoutPB;
use flowy_database2::services::share::csv::CSVFormat;
use flowy_database2::template::{make_default_board, make_default_calendar, make_default_grid};
diff --git a/frontend/rust-lib/flowy-core/src/integrate/mod.rs b/frontend/rust-lib/flowy-core/src/integrate/mod.rs
index da8d32a924..3df4bdcc6e 100644
--- a/frontend/rust-lib/flowy-core/src/integrate/mod.rs
+++ b/frontend/rust-lib/flowy-core/src/integrate/mod.rs
@@ -1 +1,2 @@
pub(crate) mod server;
+mod trait_impls;
diff --git a/frontend/rust-lib/flowy-core/src/integrate/server.rs b/frontend/rust-lib/flowy-core/src/integrate/server.rs
index 512691122a..522c361a91 100644
--- a/frontend/rust-lib/flowy-core/src/integrate/server.rs
+++ b/frontend/rust-lib/flowy-core/src/integrate/server.rs
@@ -2,18 +2,11 @@ use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::{CollabStorageProvider, CollabStorageType};
-use appflowy_integrate::{RemoteCollabStorage, YrsDocAction};
-use bytes::Bytes;
-use collab_define::{CollabObject, CollabType};
use parking_lot::RwLock;
use serde_repr::*;
-use flowy_database_deps::cloud::*;
-use flowy_document2::deps::DocumentData;
-use flowy_document_deps::cloud::{DocumentCloudService, DocumentSnapshot};
+use collab_integrate::YrsDocAction;
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
-use flowy_folder_deps::cloud::*;
use flowy_server::af_cloud::configuration::appflowy_cloud_server_configuration;
use flowy_server::af_cloud::AFCloudServer;
use flowy_server::local_server::{LocalServer, LocalServerDB};
@@ -21,22 +14,19 @@ use flowy_server::supabase::SupabaseServer;
use flowy_server::{AppFlowyEncryption, AppFlowyServer, EncryptionImpl};
use flowy_server_config::supabase_config::SupabaseConfiguration;
use flowy_sqlite::kv::StorePreferences;
-use flowy_storage::{FileStorageService, StorageObject};
-use flowy_user::event_map::UserCloudServiceProvider;
use flowy_user::services::database::{
get_user_profile, get_user_workspace, open_collab_db, open_user_db,
};
use flowy_user_deps::cloud::UserCloudService;
use flowy_user_deps::entities::*;
-use lib_infra::future::FutureResult;
use crate::AppFlowyCoreConfig;
-const SERVER_PROVIDER_TYPE_KEY: &str = "server_provider_type";
+pub(crate) const SERVER_PROVIDER_TYPE_KEY: &str = "server_provider_type";
#[derive(Debug, Clone, Hash, Eq, PartialEq, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
-pub enum ServerProviderType {
+pub enum ServerType {
/// Local server provider.
/// Offline mode, no user authentication and the data is stored locally.
Local = 0,
@@ -45,48 +35,48 @@ pub enum ServerProviderType {
/// progress.
AppFlowyCloud = 1,
/// Supabase server provider.
- /// It uses supabase's postgresql database to store data and user authentication.
+ /// It uses supabase postgresql database to store data and user authentication.
Supabase = 2,
}
-impl Display for ServerProviderType {
+impl Display for ServerType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
- ServerProviderType::Local => write!(f, "Local"),
- ServerProviderType::AppFlowyCloud => write!(f, "AppFlowyCloud"),
- ServerProviderType::Supabase => write!(f, "Supabase"),
+ ServerType::Local => write!(f, "Local"),
+ ServerType::AppFlowyCloud => write!(f, "AppFlowyCloud"),
+ ServerType::Supabase => write!(f, "Supabase"),
}
}
}
-/// The [AppFlowyServerProvider] provides list of [AppFlowyServer] base on the [AuthType]. Using
-/// the auth type, the [AppFlowyServerProvider] will create a new [AppFlowyServer] if it doesn't
+/// The [ServerProvider] provides list of [AppFlowyServer] base on the [AuthType]. Using
+/// the auth type, the [ServerProvider] will create a new [AppFlowyServer] if it doesn't
/// exist.
/// Each server implements the [AppFlowyServer] trait, which provides the [UserCloudService], etc.
-pub struct AppFlowyServerProvider {
+pub struct ServerProvider {
config: AppFlowyCoreConfig,
- provider_type: RwLock<ServerProviderType>,
- providers: RwLock<HashMap<ServerProviderType, Arc<dyn AppFlowyServer>>>,
- encryption: RwLock<Arc<dyn AppFlowyEncryption>>,
- store_preferences: Weak<StorePreferences>,
- cache_user_service: RwLock<HashMap<ServerProviderType, Arc<dyn UserCloudService>>>,
-
- device_id: Arc<RwLock<String>>,
- enable_sync: RwLock<bool>,
- uid: Arc<RwLock<Option<i64>>>,
+ server_type: RwLock<ServerType>,
+ providers: RwLock<HashMap<ServerType, Arc<dyn AppFlowyServer>>>,
+ pub(crate) encryption: RwLock<Arc<dyn AppFlowyEncryption>>,
+ pub(crate) store_preferences: Weak<StorePreferences>,
+ pub(crate) cache_user_service: RwLock<HashMap<ServerType, Arc<dyn UserCloudService>>>,
+
+ pub(crate) device_id: Arc<RwLock<String>>,
+ pub(crate) enable_sync: RwLock<bool>,
+ pub(crate) uid: Arc<RwLock<Option<i64>>>,
}
-impl AppFlowyServerProvider {
+impl ServerProvider {
pub fn new(
config: AppFlowyCoreConfig,
- provider_type: ServerProviderType,
+ provider_type: ServerType,
store_preferences: Weak<StorePreferences>,
) -> Self {
let encryption = EncryptionImpl::new(None);
Self {
config,
- provider_type: RwLock::new(provider_type),
- device_id: Default::default(),
+ server_type: RwLock::new(provider_type),
+ device_id: Arc::new(RwLock::new(uuid::Uuid::new_v4().to_string())),
providers: RwLock::new(HashMap::new()),
enable_sync: RwLock::new(true),
encryption: RwLock::new(Arc::new(encryption)),
@@ -96,42 +86,51 @@ impl AppFlowyServerProvider {
}
}
- pub fn provider_type(&self) -> ServerProviderType {
- self.provider_type.read().clone()
+ pub fn get_server_type(&self) -> ServerType {
+ self.server_type.read().clone()
+ }
+
+ pub fn set_server_type(&self, server_type: ServerType) {
+ *self.server_type.write() = server_type;
}
/// Returns a [AppFlowyServer] trait implementation base on the provider_type.
- fn get_provider(
+ pub(crate) fn get_server(
&self,
- provider_type: &ServerProviderType,
+ server_type: &ServerType,
) -> FlowyResult<Arc<dyn AppFlowyServer>> {
- if let Some(provider) = self.providers.read().get(provider_type) {
+ if let Some(provider) = self.providers.read().get(server_type) {
return Ok(provider.clone());
}
- let server = match provider_type {
- ServerProviderType::Local => {
+ let server = match server_type {
+ ServerType::Local => {
let local_db = Arc::new(LocalServerDBImpl {
storage_path: self.config.storage_path.clone(),
});
let server = Arc::new(LocalServer::new(local_db));
-
Ok::<Arc<dyn AppFlowyServer>, FlowyError>(server)
},
- ServerProviderType::AppFlowyCloud => {
+ ServerType::AppFlowyCloud => {
let config = appflowy_cloud_server_configuration().map_err(|e| {
FlowyError::new(
ErrorCode::InvalidAuthConfig,
format!(
"Missing self host config: {:?}. Error: {:?}",
- provider_type, e
+ server_type, e
),
)
})?;
- let server = Arc::new(AFCloudServer::new(config));
+ tracing::trace!("🔑AppFlowy cloud config: {:?}", config);
+ let server = Arc::new(AFCloudServer::new(
+ config,
+ *self.enable_sync.read(),
+ self.device_id.clone(),
+ ));
+
Ok::<Arc<dyn AppFlowyServer>, FlowyError>(server)
},
- ServerProviderType::Supabase => {
+ ServerType::Supabase => {
let config = match SupabaseConfiguration::from_env() {
Ok(config) => config,
Err(e) => {
@@ -155,287 +154,30 @@ impl AppFlowyServerProvider {
self
.providers
.write()
- .insert(provider_type.clone(), server.clone());
+ .insert(server_type.clone(), server.clone());
Ok(server)
}
}
-impl FileStorageService for AppFlowyServerProvider {
- fn create_object(&self, object: StorageObject) -> FutureResult<String, FlowyError> {
- let server = self.get_provider(&self.provider_type.read());
- FutureResult::new(async move {
- let storage = server?.file_storage().ok_or(FlowyError::internal())?;
- storage.create_object(object).await
- })
- }
-
- fn delete_object_by_url(&self, object_url: String) -> FutureResult<(), FlowyError> {
- let server = self.get_provider(&self.provider_type.read());
- FutureResult::new(async move {
- let storage = server?.file_storage().ok_or(FlowyError::internal())?;
- storage.delete_object_by_url(object_url).await
- })
- }
-
- fn get_object_by_url(&self, object_url: String) -> FutureResult<Bytes, FlowyError> {
- let server = self.get_provider(&self.provider_type.read());
- FutureResult::new(async move {
- let storage = server?.file_storage().ok_or(FlowyError::internal())?;
- storage.get_object_by_url(object_url).await
- })
- }
-}
-
-impl UserCloudServiceProvider for AppFlowyServerProvider {
- fn set_enable_sync(&self, uid: i64, enable_sync: bool) {
- match self.get_provider(&self.provider_type.read()) {
- Ok(server) => {
- server.set_enable_sync(uid, enable_sync);
- *self.enable_sync.write() = enable_sync;
- *self.uid.write() = Some(uid);
- },
- Err(e) => tracing::error!("🔴Failed to enable sync: {:?}", e),
- }
- }
-
- fn set_encrypt_secret(&self, secret: String) {
- tracing::info!("🔑Set encrypt secret");
- self.encryption.write().set_secret(secret);
- }
-
- /// When user login, the provider type is set by the [AuthType] and save to disk for next use.
- ///
- /// Each [AuthType] has a corresponding [ServerProviderType]. The [ServerProviderType] is used
- /// to create a new [AppFlowyServer] if it doesn't exist. Once the [ServerProviderType] is set,
- /// it will be used when user open the app again.
- ///
- fn set_auth_type(&self, auth_type: AuthType) {
- let provider_type: ServerProviderType = auth_type.into();
- *self.provider_type.write() = provider_type.clone();
-
- match self.store_preferences.upgrade() {
- None => tracing::error!("🔴Failed to update server provider type: store preferences is drop"),
- Some(store_preferences) => {
- match store_preferences.set_object(SERVER_PROVIDER_TYPE_KEY, provider_type.clone()) {
- Ok(_) => tracing::trace!("Update server provider type to: {:?}", provider_type),
- Err(e) => {
- tracing::error!("🔴Failed to update server provider type: {:?}", e);
- },
- }
- },
- }
- }
-
- fn set_device_id(&self, device_id: &str) {
- *self.device_id.write() = device_id.to_string();
- }
-
- /// Returns the [UserCloudService] base on the current [ServerProviderType].
- /// Creates a new [AppFlowyServer] if it doesn't exist.
- fn get_user_service(&self) -> Result<Arc<dyn UserCloudService>, FlowyError> {
- if let Some(user_service) = self
- .cache_user_service
- .read()
- .get(&self.provider_type.read())
- {
- return Ok(user_service.clone());
- }
-
- let provider_type = self.provider_type.read().clone();
- let user_service = self.get_provider(&provider_type)?.user_service();
- self
- .cache_user_service
- .write()
- .insert(provider_type, user_service.clone());
- Ok(user_service)
- }
-
- fn service_name(&self) -> String {
- self.provider_type.read().to_string()
- }
-}
-
-impl FolderCloudService for AppFlowyServerProvider {
- fn create_workspace(&self, uid: i64, name: &str) -> FutureResult<Workspace, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let name = name.to_string();
- FutureResult::new(async move { server?.folder_service().create_workspace(uid, &name).await })
- }
-
- fn get_folder_data(&self, workspace_id: &str) -> FutureResult<Option<FolderData>, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let workspace_id = workspace_id.to_string();
- FutureResult::new(async move {
- server?
- .folder_service()
- .get_folder_data(&workspace_id)
- .await
- })
- }
-
- fn get_folder_snapshots(
- &self,
- workspace_id: &str,
- limit: usize,
- ) -> FutureResult<Vec<FolderSnapshot>, Error> {
- let workspace_id = workspace_id.to_string();
- let server = self.get_provider(&self.provider_type.read());
- FutureResult::new(async move {
- server?
- .folder_service()
- .get_folder_snapshots(&workspace_id, limit)
- .await
- })
- }
-
- fn get_folder_updates(&self, workspace_id: &str, uid: i64) -> FutureResult<Vec<Vec<u8>>, Error> {
- let workspace_id = workspace_id.to_string();
- let server = self.get_provider(&self.provider_type.read());
- FutureResult::new(async move {
- server?
- .folder_service()
- .get_folder_updates(&workspace_id, uid)
- .await
- })
- }
-
- fn service_name(&self) -> String {
- self
- .get_provider(&self.provider_type.read())
- .map(|provider| provider.folder_service().service_name())
- .unwrap_or_default()
- }
-}
-
-impl DatabaseCloudService for AppFlowyServerProvider {
- fn get_collab_update(
- &self,
- object_id: &str,
- object_ty: CollabType,
- ) -> FutureResult<CollabObjectUpdate, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let database_id = object_id.to_string();
- FutureResult::new(async move {
- server?
- .database_service()
- .get_collab_update(&database_id, object_ty)
- .await
- })
- }
-
- fn batch_get_collab_updates(
- &self,
- object_ids: Vec<String>,
- object_ty: CollabType,
- ) -> FutureResult<CollabObjectUpdateByOid, Error> {
- let server = self.get_provider(&self.provider_type.read());
- FutureResult::new(async move {
- server?
- .database_service()
- .batch_get_collab_updates(object_ids, object_ty)
- .await
- })
- }
-
- fn get_collab_snapshots(
- &self,
- object_id: &str,
- limit: usize,
- ) -> FutureResult<Vec<DatabaseSnapshot>, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let database_id = object_id.to_string();
- FutureResult::new(async move {
- server?
- .database_service()
- .get_collab_snapshots(&database_id, limit)
- .await
- })
- }
-}
-
-impl DocumentCloudService for AppFlowyServerProvider {
- fn get_document_updates(&self, document_id: &str) -> FutureResult<Vec<Vec<u8>>, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let document_id = document_id.to_string();
- FutureResult::new(async move {
- server?
- .document_service()
- .get_document_updates(&document_id)
- .await
- })
- }
-
- fn get_document_snapshots(
- &self,
- document_id: &str,
- limit: usize,
- ) -> FutureResult<Vec<DocumentSnapshot>, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let document_id = document_id.to_string();
- FutureResult::new(async move {
- server?
- .document_service()
- .get_document_snapshots(&document_id, limit)
- .await
- })
- }
-
- fn get_document_data(&self, document_id: &str) -> FutureResult<Option<DocumentData>, Error> {
- let server = self.get_provider(&self.provider_type.read());
- let document_id = document_id.to_string();
- FutureResult::new(async move {
- server?
- .document_service()
- .get_document_data(&document_id)
- .await
- })
- }
-}
-
-impl CollabStorageProvider for AppFlowyServerProvider {
- fn storage_type(&self) -> CollabStorageType {
- self.provider_type().into()
- }
-
- fn get_storage(
- &self,
- collab_object: &CollabObject,
- storage_type: &CollabStorageType,
- ) -> Option<Arc<dyn RemoteCollabStorage>> {
- match storage_type {
- CollabStorageType::Local => None,
- CollabStorageType::AWS => None,
- CollabStorageType::Supabase => self
- .get_provider(&ServerProviderType::Supabase)
- .ok()
- .and_then(|provider| provider.collab_storage(collab_object)),
- }
- }
-
- fn is_sync_enabled(&self) -> bool {
- *self.enable_sync.read()
- }
-}
-
-impl From<AuthType> for ServerProviderType {
+impl From<AuthType> for ServerType {
fn from(auth_provider: AuthType) -> Self {
match auth_provider {
- AuthType::Local => ServerProviderType::Local,
- AuthType::SelfHosted => ServerProviderType::AppFlowyCloud,
- AuthType::Supabase => ServerProviderType::Supabase,
+ AuthType::Local => ServerType::Local,
+ AuthType::SelfHosted => ServerType::AppFlowyCloud,
+ AuthType::Supabase => ServerType::Supabase,
}
}
}
-impl From<&AuthType> for ServerProviderType {
+impl From<&AuthType> for ServerType {
fn from(auth_provider: &AuthType) -> Self {
Self::from(auth_provider.clone())
}
}
-pub fn current_server_provider(store_preferences: &Arc<StorePreferences>) -> ServerProviderType {
- match store_preferences.get_object::<ServerProviderType>(SERVER_PROVIDER_TYPE_KEY) {
- None => ServerProviderType::Local,
+pub fn current_server_provider(store_preferences: &Arc<StorePreferences>) -> ServerType {
+ match store_preferences.get_object::<ServerType>(SERVER_PROVIDER_TYPE_KEY) {
+ None => ServerType::Local,
Some(provider_type) => provider_type,
}
}
diff --git a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs
new file mode 100644
index 0000000000..fbac71045c
--- /dev/null
+++ b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs
@@ -0,0 +1,321 @@
+use std::sync::Arc;
+
+use anyhow::Error;
+use bytes::Bytes;
+use collab::core::origin::{CollabClient, CollabOrigin};
+use collab::preclude::CollabPlugin;
+use collab_define::CollabType;
+use collab_plugins::sync_plugin::{SyncObject, SyncPlugin};
+
+use collab_integrate::collab_builder::{CollabPluginContext, CollabSource, CollabStorageProvider};
+use collab_integrate::postgres::SupabaseDBPlugin;
+use flowy_database_deps::cloud::{
+ CollabObjectUpdate, CollabObjectUpdateByOid, DatabaseCloudService, DatabaseSnapshot,
+};
+use flowy_document2::deps::DocumentData;
+use flowy_document_deps::cloud::{DocumentCloudService, DocumentSnapshot};
+use flowy_error::FlowyError;
+use flowy_folder_deps::cloud::{FolderCloudService, FolderData, FolderSnapshot, Workspace};
+use flowy_storage::{FileStorageService, StorageObject};
+use flowy_user::event_map::UserCloudServiceProvider;
+use flowy_user_deps::cloud::UserCloudService;
+use flowy_user_deps::entities::AuthType;
+use lib_infra::async_trait::async_trait;
+use lib_infra::future::FutureResult;
+
+use crate::integrate::server::{ServerProvider, ServerType, SERVER_PROVIDER_TYPE_KEY};
+
+impl FileStorageService for ServerProvider {
+ fn create_object(&self, object: StorageObject) -> FutureResult<String, FlowyError> {
+ let server = self.get_server(&self.get_server_type());
+ FutureResult::new(async move {
+ let storage = server?.file_storage().ok_or(FlowyError::internal())?;
+ storage.create_object(object).await
+ })
+ }
+
+ fn delete_object_by_url(&self, object_url: String) -> FutureResult<(), FlowyError> {
+ let server = self.get_server(&self.get_server_type());
+ FutureResult::new(async move {
+ let storage = server?.file_storage().ok_or(FlowyError::internal())?;
+ storage.delete_object_by_url(object_url).await
+ })
+ }
+
+ fn get_object_by_url(&self, object_url: String) -> FutureResult<Bytes, FlowyError> {
+ let server = self.get_server(&self.get_server_type());
+ FutureResult::new(async move {
+ let storage = server?.file_storage().ok_or(FlowyError::internal())?;
+ storage.get_object_by_url(object_url).await
+ })
+ }
+}
+
+impl UserCloudServiceProvider for ServerProvider {
+ fn set_enable_sync(&self, uid: i64, enable_sync: bool) {
+ match self.get_server(&self.get_server_type()) {
+ Ok(server) => {
+ server.set_enable_sync(uid, enable_sync);
+ *self.enable_sync.write() = enable_sync;
+ *self.uid.write() = Some(uid);
+ },
+ Err(e) => tracing::error!("🔴Failed to enable sync: {:?}", e),
+ }
+ }
+
+ fn set_encrypt_secret(&self, secret: String) {
+ tracing::info!("🔑Set encrypt secret");
+ self.encryption.write().set_secret(secret);
+ }
+
+ /// When user login, the provider type is set by the [AuthType] and save to disk for next use.
+ ///
+ /// Each [AuthType] has a corresponding [ServerType]. The [ServerType] is used
+ /// to create a new [AppFlowyServer] if it doesn't exist. Once the [ServerType] is set,
+ /// it will be used when user open the app again.
+ ///
+ fn set_auth_type(&self, auth_type: AuthType) {
+ let server_type: ServerType = auth_type.into();
+ self.set_server_type(server_type.clone());
+
+ match self.store_preferences.upgrade() {
+ None => tracing::error!("🔴Failed to update server provider type: store preferences is drop"),
+ Some(store_preferences) => {
+ match store_preferences.set_object(SERVER_PROVIDER_TYPE_KEY, server_type.clone()) {
+ Ok(_) => tracing::trace!("Update server provider type to: {:?}", server_type),
+ Err(e) => {
+ tracing::error!("🔴Failed to update server provider type: {:?}", e);
+ },
+ }
+ },
+ }
+ }
+
+ fn set_device_id(&self, device_id: &str) {
+ if device_id.is_empty() {
+ tracing::error!("🔴Device id is empty");
+ return;
+ }
+
+ *self.device_id.write() = device_id.to_string();
+ }
+
+ /// Returns the [UserCloudService] base on the current [ServerType].
+ /// Creates a new [AppFlowyServer] if it doesn't exist.
+ fn get_user_service(&self) -> Result<Arc<dyn UserCloudService>, FlowyError> {
+ if let Some(user_service) = self.cache_user_service.read().get(&self.get_server_type()) {
+ return Ok(user_service.clone());
+ }
+
+ let server_type = self.get_server_type();
+ let user_service = self.get_server(&server_type)?.user_service();
+ self
+ .cache_user_service
+ .write()
+ .insert(server_type, user_service.clone());
+ Ok(user_service)
+ }
+
+ fn service_name(&self) -> String {
+ self.get_server_type().to_string()
+ }
+}
+
+impl FolderCloudService for ServerProvider {
+ fn create_workspace(&self, uid: i64, name: &str) -> FutureResult<Workspace, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let name = name.to_string();
+ FutureResult::new(async move { server?.folder_service().create_workspace(uid, &name).await })
+ }
+
+ fn get_folder_data(&self, workspace_id: &str) -> FutureResult<Option<FolderData>, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let workspace_id = workspace_id.to_string();
+ FutureResult::new(async move {
+ server?
+ .folder_service()
+ .get_folder_data(&workspace_id)
+ .await
+ })
+ }
+
+ fn get_folder_snapshots(
+ &self,
+ workspace_id: &str,
+ limit: usize,
+ ) -> FutureResult<Vec<FolderSnapshot>, Error> {
+ let workspace_id = workspace_id.to_string();
+ let server = self.get_server(&self.get_server_type());
+ FutureResult::new(async move {
+ server?
+ .folder_service()
+ .get_folder_snapshots(&workspace_id, limit)
+ .await
+ })
+ }
+
+ fn get_folder_updates(&self, workspace_id: &str, uid: i64) -> FutureResult<Vec<Vec<u8>>, Error> {
+ let workspace_id = workspace_id.to_string();
+ let server = self.get_server(&self.get_server_type());
+ FutureResult::new(async move {
+ server?
+ .folder_service()
+ .get_folder_updates(&workspace_id, uid)
+ .await
+ })
+ }
+
+ fn service_name(&self) -> String {
+ self
+ .get_server(&self.get_server_type())
+ .map(|provider| provider.folder_service().service_name())
+ .unwrap_or_default()
+ }
+}
+
+impl DatabaseCloudService for ServerProvider {
+ fn get_collab_update(
+ &self,
+ object_id: &str,
+ object_ty: CollabType,
+ ) -> FutureResult<CollabObjectUpdate, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let database_id = object_id.to_string();
+ FutureResult::new(async move {
+ server?
+ .database_service()
+ .get_collab_update(&database_id, object_ty)
+ .await
+ })
+ }
+
+ fn batch_get_collab_updates(
+ &self,
+ object_ids: Vec<String>,
+ object_ty: CollabType,
+ ) -> FutureResult<CollabObjectUpdateByOid, Error> {
+ let server = self.get_server(&self.get_server_type());
+ FutureResult::new(async move {
+ server?
+ .database_service()
+ .batch_get_collab_updates(object_ids, object_ty)
+ .await
+ })
+ }
+
+ fn get_collab_snapshots(
+ &self,
+ object_id: &str,
+ limit: usize,
+ ) -> FutureResult<Vec<DatabaseSnapshot>, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let database_id = object_id.to_string();
+ FutureResult::new(async move {
+ server?
+ .database_service()
+ .get_collab_snapshots(&database_id, limit)
+ .await
+ })
+ }
+}
+
+impl DocumentCloudService for ServerProvider {
+ fn get_document_updates(&self, document_id: &str) -> FutureResult<Vec<Vec<u8>>, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let document_id = document_id.to_string();
+ FutureResult::new(async move {
+ server?
+ .document_service()
+ .get_document_updates(&document_id)
+ .await
+ })
+ }
+
+ fn get_document_snapshots(
+ &self,
+ document_id: &str,
+ limit: usize,
+ ) -> FutureResult<Vec<DocumentSnapshot>, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let document_id = document_id.to_string();
+ FutureResult::new(async move {
+ server?
+ .document_service()
+ .get_document_snapshots(&document_id, limit)
+ .await
+ })
+ }
+
+ fn get_document_data(&self, document_id: &str) -> FutureResult<Option<DocumentData>, Error> {
+ let server = self.get_server(&self.get_server_type());
+ let document_id = document_id.to_string();
+ FutureResult::new(async move {
+ server?
+ .document_service()
+ .get_document_data(&document_id)
+ .await
+ })
+ }
+}
+
+#[async_trait]
+impl CollabStorageProvider for ServerProvider {
+ fn storage_source(&self) -> CollabSource {
+ self.get_server_type().into()
+ }
+
+ async fn get_plugins(&self, context: CollabPluginContext) -> Vec<Arc<dyn CollabPlugin>> {
+ let mut plugins: Vec<Arc<dyn CollabPlugin>> = vec![];
+ match context {
+ CollabPluginContext::Local => {},
+ CollabPluginContext::AppFlowyCloud {
+ uid: _,
+ collab_object,
+ local_collab,
+ } => {
+ if let Ok(server) = self.get_server(&ServerType::AppFlowyCloud) {
+ match server.collab_ws_channel(&collab_object.object_id).await {
+ Ok(Some(channel)) => {
+ let origin = CollabOrigin::Client(CollabClient::new(
+ collab_object.uid,
+ collab_object.device_id.clone(),
+ ));
+ let sync_object = SyncObject::from(collab_object);
+ let (sink, stream) = (channel.sink(), channel.stream());
+ let sync_plugin = SyncPlugin::new(origin, sync_object, local_collab, sink, stream);
+ plugins.push(Arc::new(sync_plugin));
+ },
+ Ok(None) => {},
+ Err(err) => tracing::error!("🔴Failed to get collab ws channel: {:?}", err),
+ }
+ }
+ },
+ CollabPluginContext::Supabase {
+ uid,
+ collab_object,
+ local_collab,
+ local_collab_db,
+ } => {
+ if let Some(remote_collab_storage) = self
+ .get_server(&ServerType::Supabase)
+ .ok()
+ .and_then(|provider| provider.collab_storage(&collab_object))
+ {
+ plugins.push(Arc::new(SupabaseDBPlugin::new(
+ uid,
+ collab_object,
+ local_collab,
+ 1,
+ remote_collab_storage,
+ local_collab_db,
+ )));
+ }
+ },
+ }
+ plugins
+ }
+
+ fn is_sync_enabled(&self) -> bool {
+ *self.enable_sync.read()
+ }
+}
diff --git a/frontend/rust-lib/flowy-core/src/lib.rs b/frontend/rust-lib/flowy-core/src/lib.rs
index fa27d74557..f430f005bd 100644
--- a/frontend/rust-lib/flowy-core/src/lib.rs
+++ b/frontend/rust-lib/flowy-core/src/lib.rs
@@ -10,9 +10,9 @@ use std::{
},
};
-use appflowy_integrate::collab_builder::{AppFlowyCollabBuilder, CollabStorageType};
use tokio::sync::RwLock;
+use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabSource};
use flowy_database2::DatabaseManager;
use flowy_document2::manager::DocumentManager;
use flowy_error::FlowyResult;
@@ -31,9 +31,7 @@ use module::make_plugins;
pub use module::*;
use crate::deps_resolve::*;
-use crate::integrate::server::{
- current_server_provider, AppFlowyServerProvider, ServerProviderType,
-};
+use crate::integrate::server::{current_server_provider, ServerProvider, ServerType};
mod deps_resolve;
mod integrate;
@@ -121,7 +119,7 @@ pub struct AppFlowyCore {
pub folder_manager: Arc<FolderManager>,
pub database_manager: Arc<DatabaseManager>,
pub event_dispatcher: Arc<AFPluginDispatcher>,
- pub server_provider: Arc<AppFlowyServerProvider>,
+ pub server_provider: Arc<ServerProvider>,
pub task_dispatcher: Arc<RwLock<TaskDispatcher>>,
pub store_preference: Arc<StorePreferences>,
}
@@ -147,7 +145,7 @@ impl AppFlowyCore {
runtime.spawn(TaskRunner::run(task_dispatcher.clone()));
let provider_type = current_server_provider(&store_preference);
- let server_provider = Arc::new(AppFlowyServerProvider::new(
+ let server_provider = Arc::new(ServerProvider::new(
config.clone(),
provider_type,
Arc::downgrade(&store_preference),
@@ -282,7 +280,7 @@ struct UserStatusCallbackImpl {
folder_manager: Arc<FolderManager>,
database_manager: Arc<DatabaseManager>,
document_manager: Arc<DocumentManager>,
- server_provider: Arc<AppFlowyServerProvider>,
+ server_provider: Arc<ServerProvider>,
#[allow(dead_code)]
config: AppFlowyCoreConfig,
}
@@ -298,7 +296,8 @@ impl UserStatusCallback for UserStatusCallbackImpl {
_device_id: &str,
) -> Fut<FlowyResult<()>> {
let user_workspace = user_workspace.clone();
- let collab_builder = self.collab_builder.clone();
+ self.collab_builder.initialize(user_workspace.id.clone());
+
let folder_manager = self.folder_manager.clone();
let database_manager = self.database_manager.clone();
let document_manager = self.document_manager.clone();
@@ -315,7 +314,6 @@ impl UserStatusCallback for UserStatusCallbackImpl {
}
to_fut(async move {
- collab_builder.initialize(user_workspace.id.clone());
folder_manager
.initialize(
user_id,
@@ -419,13 +417,13 @@ impl UserStatusCallback for UserStatusCallbackImpl {
fn open_workspace(&self, user_id: i64, user_workspace: &UserWorkspace) -> Fut<FlowyResult<()>> {
let user_workspace = user_workspace.clone();
- let collab_builder = self.collab_builder.clone();
+ self.collab_builder.initialize(user_workspace.id.clone());
+
let folder_manager = self.folder_manager.clone();
let database_manager = self.database_manager.clone();
let document_manager = self.document_manager.clone();
to_fut(async move {
- collab_builder.initialize(user_workspace.id.clone());
folder_manager
.initialize_with_workspace_id(user_id, &user_workspace.id)
.await?;
@@ -449,12 +447,12 @@ impl UserStatusCallback for UserStatusCallbackImpl {
}
}
-impl From<ServerProviderType> for CollabStorageType {
- fn from(server_provider: ServerProviderType) -> Self {
+impl From<ServerType> for CollabSource {
+ fn from(server_provider: ServerType) -> Self {
match server_provider {
- ServerProviderType::Local => CollabStorageType::Local,
- ServerProviderType::AppFlowyCloud => CollabStorageType::Local,
- ServerProviderType::Supabase => CollabStorageType::Supabase,
+ ServerType::Local => CollabSource::Local,
+ ServerType::AppFlowyCloud => CollabSource::Local,
+ ServerType::Supabase => CollabSource::Supabase,
}
}
}
diff --git a/frontend/rust-lib/flowy-core/src/module.rs b/frontend/rust-lib/flowy-core/src/module.rs
index 829f9bafb7..1229cf90d4 100644
--- a/frontend/rust-lib/flowy-core/src/module.rs
+++ b/frontend/rust-lib/flowy-core/src/module.rs
@@ -18,14 +18,12 @@ pub fn make_plugins(
.unwrap();
let user_plugin = flowy_user::event_map::init(user_session);
let folder_plugin = flowy_folder2::event_map::init(folder_manager);
- let network_plugin = flowy_net::event_map::init();
let database_plugin = flowy_database2::event_map::init(database_manager);
let document_plugin2 = flowy_document2::event_map::init(document_manager2);
let config_plugin = flowy_config::event_map::init(store_preferences);
vec![
user_plugin,
folder_plugin,
- network_plugin,
database_plugin,
document_plugin2,
config_plugin,
diff --git a/frontend/rust-lib/flowy-database-deps/Cargo.toml b/frontend/rust-lib/flowy-database-deps/Cargo.toml
index 115c548037..b5503d95f0 100644
--- a/frontend/rust-lib/flowy-database-deps/Cargo.toml
+++ b/frontend/rust-lib/flowy-database-deps/Cargo.toml
@@ -7,6 +7,6 @@ edition = "2021"
[dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-error = { path = "../flowy-error" }
+flowy-error = { workspace = true }
collab-define = { version = "0.1.0" }
anyhow = "1.0.71"
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-database2/Cargo.toml b/frontend/rust-lib/flowy-database2/Cargo.toml
index e1c9334e33..61573968fa 100644
--- a/frontend/rust-lib/flowy-database2/Cargo.toml
+++ b/frontend/rust-lib/flowy-database2/Cargo.toml
@@ -9,24 +9,24 @@ edition = "2021"
collab = { version = "0.1.0" }
collab-database = { version = "0.1.0" }
collab-define = { version = "0.1.0" }
-appflowy-integrate = {version = "0.1.0" }
-flowy-database-deps = { path = "../flowy-database-deps" }
+collab-integrate = { workspace = true }
+flowy-database-deps = { workspace = true }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-flowy-notification = { path = "../flowy-notification" }
+flowy-notification = { workspace = true }
parking_lot = "0.12.1"
protobuf = {version = "2.28.0"}
-flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error", "impl_from_collab"]}
-lib-dispatch = { path = "../lib-dispatch" }
+flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_collab"]}
+lib-dispatch = { workspace = true }
tokio = { version = "1.26", features = ["sync"] }
-flowy-task= { path = "../flowy-task" }
+flowy-task= { workspace = true }
bytes = { version = "1.4" }
tracing = { version = "0.1", features = ["log"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}
serde_repr = "0.1"
lib-infra = { path = "../../../shared-lib/lib-infra" }
-chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
+chrono = { version = "0.4.27", default-features = false, features = ["clock"] }
rust_decimal = "1.28.1"
rusty-money = {version = "0.4.1", features = ["iso"]}
lazy_static = "1.4.0"
diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rs
index ef3ec7eb9a..9c9a869ef2 100644
--- a/frontend/rust-lib/flowy-database2/src/manager.rs
+++ b/frontend/rust-lib/flowy-database2/src/manager.rs
@@ -1,8 +1,6 @@
use std::collections::HashMap;
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::{CollabPersistenceConfig, RocksCollabDB};
use collab::core::collab::{CollabRawData, MutexCollab};
use collab_database::blocks::BlockEvent;
use collab_database::database::{DatabaseData, YrsDocAction};
@@ -15,6 +13,8 @@ use collab_database::views::{CreateDatabaseParams, CreateViewParams, DatabaseLay
use collab_define::CollabType;
use tokio::sync::RwLock;
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::{CollabPersistenceConfig, RocksCollabDB};
use flowy_database_deps::cloud::DatabaseCloudService;
use flowy_error::{internal_error, FlowyError, FlowyResult};
use flowy_task::TaskDispatcher;
diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
index 01098e6431..88ce9c9f12 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
@@ -1464,7 +1464,7 @@ impl DatabaseViewData for DatabaseViewDataImpl {
field_id: &str,
visibility: Option<FieldVisibility>,
) {
- let field_settings_map = self.get_field_settings(view_id, &vec![field_id.to_string()]);
+ let field_settings_map = self.get_field_settings(view_id, &[field_id.to_string()]);
let new_field_settings = if let Some(field_settings) = field_settings_map.get(field_id) {
let mut field_settings = field_settings.to_owned();
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
index 65aff62db8..69252c4677 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
@@ -910,10 +910,7 @@ impl DatabaseViewEditor {
.send();
}
- pub async fn v_get_field_settings(
- &self,
- field_ids: &Vec<String>,
- ) -> HashMap<String, FieldSettings> {
+ pub async fn v_get_field_settings(&self, field_ids: &[String]) -> HashMap<String, FieldSettings> {
self.delegate.get_field_settings(&self.view_id, field_ids)
}
diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_tests.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_tests.rs
index 3df61c1dfd..91606a9fbc 100644
--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_tests.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_tests.rs
@@ -292,7 +292,7 @@ mod tests {
let native_timestamp = 1647251762;
let native = NaiveDateTime::from_timestamp_opt(native_timestamp, 0).unwrap();
- let utc = chrono::DateTime::<chrono::Utc>::from_utc(native, chrono::Utc);
+ let utc = chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset(native, chrono::Utc);
// utc_timestamp doesn't carry timezone
let utc_timestamp = utc.timestamp();
assert_eq!(native_timestamp, utc_timestamp);
@@ -304,7 +304,8 @@ mod tests {
// Mon Mar 14 2022 17:56:02 GMT+0800 (China Standard Time)
let gmt_8_offset = FixedOffset::east_opt(8 * 3600).unwrap();
- let china_local = chrono::DateTime::<chrono::Local>::from_utc(native, gmt_8_offset);
+ let china_local =
+ chrono::DateTime::<chrono::Local>::from_naive_utc_and_offset(native, gmt_8_offset);
let china_local_time = format!(
"{}",
china_local.format_with_items(StrftimeItems::new(&format))
diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs
index ced65b1640..fe17e92143 100644
--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs
@@ -22,23 +22,13 @@ use crate::services::sort::SortCondition;
/// The [DateTypeOption] is used by [FieldType::Date], [FieldType::LastEditedTime], and [FieldType::CreatedTime].
/// So, storing the field type is necessary to distinguish the field type.
/// Most of the cases, each [FieldType] has its own [TypeOption] implementation.
-#[derive(Clone, Debug, Serialize, Deserialize)]
+#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct DateTypeOption {
pub date_format: DateFormat,
pub time_format: TimeFormat,
pub timezone_id: String,
}
-impl Default for DateTypeOption {
- fn default() -> Self {
- Self {
- date_format: Default::default(),
- time_format: Default::default(),
- timezone_id: Default::default(),
- }
- }
-}
-
impl TypeOption for DateTypeOption {
type CellData = DateCellData;
type CellChangeset = DateCellChangeset;
@@ -113,7 +103,7 @@ impl DateTypeOption {
if let Some(timestamp) = timestamp {
let naive = chrono::NaiveDateTime::from_timestamp_opt(*timestamp, 0).unwrap();
let offset = self.get_timezone_offset(naive);
- let date_time = DateTime::<Local>::from_utc(naive, offset);
+ let date_time = DateTime::<Local>::from_naive_utc_and_offset(naive, offset);
let fmt = self.date_format.format_str();
let date = format!("{}", date_time.format(fmt));
diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs
index 30aacb4b55..549b777a3d 100644
--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs
@@ -108,7 +108,7 @@ impl TimestampTypeOption {
if let Some(timestamp) = timestamp {
let naive = chrono::NaiveDateTime::from_timestamp_opt(*timestamp, 0).unwrap();
let offset = Local::now().offset().fix();
- let date_time = DateTime::<Local>::from_utc(naive, offset);
+ let date_time = DateTime::<Local>::from_naive_utc_and_offset(naive, offset);
let fmt = self.date_format.format_str();
let date = format!("{}", date_time.format(fmt));
diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs
index 59cb8fa14e..4e06f7b1af 100644
--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option.rs
@@ -262,16 +262,12 @@ pub fn default_type_option_data_from_type(field_type: &FieldType) -> TypeOptionD
match field_type {
FieldType::RichText => RichTextTypeOption::default().into(),
FieldType::Number => NumberTypeOption::default().into(),
- FieldType::DateTime => DateTypeOption {
- ..Default::default()
- }
- .into(),
+ FieldType::DateTime => DateTypeOption::default().into(),
FieldType::LastEditedTime | FieldType::CreatedTime => TimestampTypeOption {
field_type: field_type.clone(),
date_format: DateFormat::Friendly,
time_format: TimeFormat::TwelveHour,
include_time: true,
- ..Default::default()
}
.into(),
FieldType::SingleSelect => SingleSelectTypeOption::default().into(),
diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs
index 0b24ed65d2..b905b1453b 100644
--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs
@@ -443,7 +443,7 @@ fn date_time_from_timestamp(timestamp: Option<i64>, timezone_id: &str) -> DateTi
Err(_) => *Local::now().offset(),
};
- DateTime::<Local>::from_utc(naive, offset)
+ DateTime::<Local>::from_naive_utc_and_offset(naive, offset)
},
None => DateTime::default(),
}
diff --git a/frontend/rust-lib/flowy-document-deps/Cargo.toml b/frontend/rust-lib/flowy-document-deps/Cargo.toml
index af40092bf6..9c926cea76 100644
--- a/frontend/rust-lib/flowy-document-deps/Cargo.toml
+++ b/frontend/rust-lib/flowy-document-deps/Cargo.toml
@@ -7,6 +7,6 @@ edition = "2021"
[dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-error = { path = "../flowy-error" }
+flowy-error = { workspace = true }
collab-document = { version = "0.1.0" }
anyhow = "1.0.71"
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-document2/Cargo.toml b/frontend/rust-lib/flowy-document2/Cargo.toml
index 0c809c2fd2..b87c17aa26 100644
--- a/frontend/rust-lib/flowy-document2/Cargo.toml
+++ b/frontend/rust-lib/flowy-document2/Cargo.toml
@@ -9,14 +9,14 @@ edition = "2021"
collab = { version = "0.1.0" }
collab-document = { version = "0.1.0" }
collab-define = { version = "0.1.0" }
-appflowy-integrate = {version = "0.1.0" }
-flowy-document-deps = { path = "../flowy-document-deps" }
-flowy-storage = { path = "../flowy-storage" }
+collab-integrate = { workspace = true }
+flowy-document-deps = { workspace = true }
+flowy-storage = { workspace = true }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-flowy-notification = { path = "../flowy-notification" }
+flowy-notification = { workspace = true }
flowy-error = { path = "../flowy-error", features = ["impl_from_serde", "impl_from_sqlite", "impl_from_dispatch_error", "impl_from_collab"] }
-lib-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { workspace = true }
lib-infra = { path = "../../../shared-lib/lib-infra" }
protobuf = {version = "2.28.0"}
diff --git a/frontend/rust-lib/flowy-document2/src/manager.rs b/frontend/rust-lib/flowy-document2/src/manager.rs
index c2de568778..dd4cb5af77 100644
--- a/frontend/rust-lib/flowy-document2/src/manager.rs
+++ b/frontend/rust-lib/flowy-document2/src/manager.rs
@@ -1,8 +1,6 @@
use std::sync::Weak;
use std::{collections::HashMap, sync::Arc};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::RocksCollabDB;
use collab::core::collab::MutexCollab;
use collab_define::CollabType;
use collab_document::blocks::DocumentData;
@@ -11,6 +9,8 @@ use collab_document::document_data::default_document_data;
use collab_document::YrsDocAction;
use parking_lot::RwLock;
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::RocksCollabDB;
use flowy_document_deps::cloud::DocumentCloudService;
use flowy_error::{internal_error, FlowyError, FlowyResult};
use flowy_storage::FileStorageService;
diff --git a/frontend/rust-lib/flowy-document2/tests/document/util.rs b/frontend/rust-lib/flowy-document2/tests/document/util.rs
index 917d1d7360..70378775bc 100644
--- a/frontend/rust-lib/flowy-document2/tests/document/util.rs
+++ b/frontend/rust-lib/flowy-document2/tests/document/util.rs
@@ -2,8 +2,6 @@ use std::ops::Deref;
use std::sync::Arc;
use anyhow::Error;
-use appflowy_integrate::collab_builder::{AppFlowyCollabBuilder, DefaultCollabStorageProvider};
-use appflowy_integrate::RocksCollabDB;
use bytes::Bytes;
use collab_document::blocks::DocumentData;
use collab_document::document_data::default_document_data;
@@ -12,6 +10,8 @@ use parking_lot::Once;
use tempfile::TempDir;
use tracing_subscriber::{fmt::Subscriber, util::SubscriberInitExt, EnvFilter};
+use collab_integrate::collab_builder::{AppFlowyCollabBuilder, DefaultCollabStorageProvider};
+use collab_integrate::RocksCollabDB;
use flowy_document2::document::MutexDocument;
use flowy_document2::manager::{DocumentManager, DocumentUser};
use flowy_document_deps::cloud::*;
@@ -57,18 +57,15 @@ impl FakeUser {
}
impl DocumentUser for FakeUser {
- fn user_id(&self) -> Result<i64, flowy_error::FlowyError> {
+ fn user_id(&self) -> Result<i64, FlowyError> {
Ok(1)
}
- fn token(&self) -> Result<Option<String>, flowy_error::FlowyError> {
+ fn token(&self) -> Result<Option<String>, FlowyError> {
Ok(None)
}
- fn collab_db(
- &self,
- _uid: i64,
- ) -> Result<std::sync::Weak<RocksCollabDB>, flowy_error::FlowyError> {
+ fn collab_db(&self, _uid: i64) -> Result<std::sync::Weak<RocksCollabDB>, FlowyError> {
Ok(Arc::downgrade(&self.collab_db))
}
}
@@ -92,6 +89,7 @@ pub fn db() -> Arc<RocksCollabDB> {
pub fn default_collab_builder() -> Arc<AppFlowyCollabBuilder> {
let builder = AppFlowyCollabBuilder::new(DefaultCollabStorageProvider());
builder.set_sync_device(uuid::Uuid::new_v4().to_string());
+ builder.initialize(uuid::Uuid::new_v4().to_string());
Arc::new(builder)
}
diff --git a/frontend/rust-lib/flowy-error/Cargo.toml b/frontend/rust-lib/flowy-error/Cargo.toml
index 09db6f8d2c..0298ebc383 100644
--- a/frontend/rust-lib/flowy-error/Cargo.toml
+++ b/frontend/rust-lib/flowy-error/Cargo.toml
@@ -12,18 +12,19 @@ bytes = "1.4"
anyhow = "1.0"
thiserror = "1.0"
-lib-dispatch = { path = "../lib-dispatch", optional = true }
+lib-dispatch = { workspace = true, optional = true }
serde_json = {version = "1.0", optional = true}
serde_repr = { version = "0.1" }
serde = "1.0"
reqwest = { version = "0.11.14", optional = true, features = ["native-tls-vendored"] }
-flowy-sqlite = { path = "../flowy-sqlite", optional = true}
+flowy-sqlite = { workspace = true, optional = true}
r2d2 = { version = "0.8", optional = true}
url = { version = "2.2", optional = true }
collab-database = { version = "0.1.0", optional = true }
collab-document = { version = "0.1.0", optional = true }
tokio-postgres = { version = "0.7.8", optional = true }
tokio = { version = "1.0", optional = true }
+client-api = { version = "0.1.0", optional = true }
[features]
impl_from_dispatch_error = ["lib-dispatch"]
@@ -34,6 +35,7 @@ impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest"]
impl_from_postgres = ["tokio-postgres"]
impl_from_tokio= ["tokio"]
impl_from_url= ["url"]
+impl_from_appflowy_cloud = ["client-api"]
dart = ["flowy-codegen/dart"]
ts = ["flowy-codegen/ts"]
diff --git a/frontend/rust-lib/flowy-error/src/code.rs b/frontend/rust-lib/flowy-error/src/code.rs
index 7f1d3c3841..f3d1b89dec 100644
--- a/frontend/rust-lib/flowy-error/src/code.rs
+++ b/frontend/rust-lib/flowy-error/src/code.rs
@@ -238,8 +238,18 @@ pub enum ErrorCode {
#[error("Parse url failed")]
InvalidURL = 78,
+
+ #[error("Require Email Confirmation, Sign in after email confirmation")]
+ AwaitingEmailConfirmation = 79,
+
#[error("Text id is empty")]
- TextIdIsEmpty = 79,
+ TextIdIsEmpty = 80,
+
+ #[error("Record already exists")]
+ RecordAlreadyExists = 81,
+
+ #[error("Missing payload")]
+ MissingPayload = 82,
}
impl ErrorCode {
diff --git a/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs b/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
new file mode 100644
index 0000000000..23d85c72b1
--- /dev/null
+++ b/frontend/rust-lib/flowy-error/src/impl_from/cloud.rs
@@ -0,0 +1,27 @@
+use client_api::error::AppError;
+
+use crate::{ErrorCode, FlowyError};
+
+impl From<AppError> for FlowyError {
+ fn from(error: AppError) -> Self {
+ let code = match error.code {
+ client_api::error::ErrorCode::Ok => ErrorCode::Internal,
+ client_api::error::ErrorCode::Unhandled => ErrorCode::Internal,
+ client_api::error::ErrorCode::RecordNotFound => ErrorCode::RecordNotFound,
+ client_api::error::ErrorCode::RecordAlreadyExists => ErrorCode::RecordAlreadyExists,
+ client_api::error::ErrorCode::InvalidEmail => ErrorCode::EmailFormatInvalid,
+ client_api::error::ErrorCode::InvalidPassword => ErrorCode::PasswordFormatInvalid,
+ client_api::error::ErrorCode::OAuthError => ErrorCode::UserUnauthorized,
+ client_api::error::ErrorCode::MissingPayload => ErrorCode::MissingPayload,
+ client_api::error::ErrorCode::StorageError => ErrorCode::Internal,
+ client_api::error::ErrorCode::OpenError => ErrorCode::Internal,
+ client_api::error::ErrorCode::InvalidUrl => ErrorCode::InvalidURL,
+ client_api::error::ErrorCode::InvalidRequestParams => ErrorCode::InvalidParams,
+ client_api::error::ErrorCode::UrlMissingParameter => ErrorCode::InvalidParams,
+ client_api::error::ErrorCode::InvalidOAuthProvider => ErrorCode::InvalidAuthConfig,
+ client_api::error::ErrorCode::NotLoggedIn => ErrorCode::UserUnauthorized,
+ };
+
+ FlowyError::new(code, error.message)
+ }
+}
diff --git a/frontend/rust-lib/flowy-error/src/impl_from/mod.rs b/frontend/rust-lib/flowy-error/src/impl_from/mod.rs
index ccce462d97..7886818867 100644
--- a/frontend/rust-lib/flowy-error/src/impl_from/mod.rs
+++ b/frontend/rust-lib/flowy-error/src/impl_from/mod.rs
@@ -22,5 +22,7 @@ mod postgres;
#[cfg(feature = "impl_from_tokio")]
mod tokio;
+#[cfg(feature = "impl_from_appflowy_cloud")]
+mod cloud;
#[cfg(feature = "impl_from_url")]
mod url;
diff --git a/frontend/rust-lib/flowy-folder-deps/Cargo.toml b/frontend/rust-lib/flowy-folder-deps/Cargo.toml
index c26b04e90c..ec01d5bb05 100644
--- a/frontend/rust-lib/flowy-folder-deps/Cargo.toml
+++ b/frontend/rust-lib/flowy-folder-deps/Cargo.toml
@@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-error = { path = "../flowy-error" }
+flowy-error = { workspace = true }
collab-folder = { version = "0.1.0" }
uuid = { version = "1.3.3", features = ["v4"] }
anyhow = "1.0.71"
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-folder2/Cargo.toml b/frontend/rust-lib/flowy-folder2/Cargo.toml
index ccf90ea28c..4cf15268c6 100644
--- a/frontend/rust-lib/flowy-folder2/Cargo.toml
+++ b/frontend/rust-lib/flowy-folder2/Cargo.toml
@@ -9,29 +9,29 @@ edition = "2021"
collab = { version = "0.1.0" }
collab-folder = { version = "0.1.0" }
collab-define = { version = "0.1.0" }
-appflowy-integrate = {version = "0.1.0" }
-flowy-folder-deps = { path = "../flowy-folder-deps" }
+collab-integrate = { workspace = true }
+flowy-folder-deps = { workspace = true }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-flowy-notification = { path = "../flowy-notification" }
+flowy-notification = { workspace = true }
parking_lot = "0.12.1"
unicode-segmentation = "1.10"
tracing = { version = "0.1", features = ["log"] }
flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error"]}
-lib-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { workspace = true }
bytes = { version = "1.4" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
tokio = { version = "1.26", features = ["full"] }
nanoid = "0.4.0"
lazy_static = "1.4.0"
-chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
+chrono = { version = "0.4.27", default-features = false, features = ["clock"] }
strum_macros = "0.21"
protobuf = {version = "2.28.0"}
uuid = { version = "1.3.3", features = ["v4"] }
tokio-stream = { version = "0.1.14", features = ["sync"] }
[dev-dependencies]
-flowy-folder2 = { path = "../flowy-folder2"}
+flowy-folder2 = { workspace = true }
flowy-test = { path = "../flowy-test", default-features = false }
[build-dependencies]
diff --git a/frontend/rust-lib/flowy-folder2/src/manager.rs b/frontend/rust-lib/flowy-folder2/src/manager.rs
index 8cc54eb716..f5e3d87557 100644
--- a/frontend/rust-lib/flowy-folder2/src/manager.rs
+++ b/frontend/rust-lib/flowy-folder2/src/manager.rs
@@ -2,8 +2,6 @@ use std::collections::HashSet;
use std::ops::Deref;
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::{CollabPersistenceConfig, RocksCollabDB, YrsDocAction};
use collab::core::collab::{CollabRawData, MutexCollab};
use collab::core::collab_state::SyncState;
use collab_define::CollabType;
@@ -16,6 +14,8 @@ use tokio_stream::wrappers::WatchStream;
use tokio_stream::StreamExt;
use tracing::{event, Level};
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::{CollabPersistenceConfig, RocksCollabDB, YrsDocAction};
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_folder_deps::cloud::{gen_view_id, FolderCloudService};
diff --git a/frontend/rust-lib/flowy-net/Cargo.toml b/frontend/rust-lib/flowy-net/Cargo.toml
deleted file mode 100644
index 7494f35238..0000000000
--- a/frontend/rust-lib/flowy-net/Cargo.toml
+++ /dev/null
@@ -1,25 +0,0 @@
-[package]
-name = "flowy-net"
-version = "0.1.0"
-edition = "2018"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-lib-dispatch = { path = "../lib-dispatch" }
-protobuf = {version = "2.28.0"}
-bytes = { version = "1.4" }
-tracing = { version = "0.1"}
-
-[features]
-http_server = []
-dart = [
- "flowy-codegen/dart",
-]
-
-ts = [
- "flowy-codegen/ts",
-]
-
-[build-dependencies]
-flowy-codegen = { path = "../../../shared-lib/flowy-codegen"}
diff --git a/frontend/rust-lib/flowy-net/Flowy.toml b/frontend/rust-lib/flowy-net/Flowy.toml
deleted file mode 100644
index cf8a73600d..0000000000
--- a/frontend/rust-lib/flowy-net/Flowy.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Check out the FlowyConfig (located in flowy_toml.rs) for more details.
-proto_input = ["src/event_map.rs", "src/entities"]
-event_files = ["src/event_map.rs"]
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-net/build.rs b/frontend/rust-lib/flowy-net/build.rs
deleted file mode 100644
index 0f8949d3e5..0000000000
--- a/frontend/rust-lib/flowy-net/build.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-fn main() {
- // let crate_name = env!("CARGO_PKG_NAME");
- // flowy_codegen::protobuf_file::gen(crate_name);
- //
- // #[cfg(feature = "dart")]
- // flowy_codegen::dart_event::gen(crate_name);
- //
- // #[cfg(feature = "ts")]
- // flowy_codegen::ts_event::gen(crate_name);
-}
diff --git a/frontend/rust-lib/flowy-net/src/entities/mod.rs b/frontend/rust-lib/flowy-net/src/entities/mod.rs
deleted file mode 100644
index 10dad6191c..0000000000
--- a/frontend/rust-lib/flowy-net/src/entities/mod.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-mod network_state;
-pub use network_state::*;
diff --git a/frontend/rust-lib/flowy-net/src/entities/network_state.rs b/frontend/rust-lib/flowy-net/src/entities/network_state.rs
deleted file mode 100644
index 2be6434015..0000000000
--- a/frontend/rust-lib/flowy-net/src/entities/network_state.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
-//
-// #[derive(ProtoBuf_Enum, Debug, Clone, Eq, PartialEq, Default)]
-// pub enum NetworkTypePB {
-// #[default]
-// Unknown = 0,
-// Wifi = 1,
-// Cell = 2,
-// Ethernet = 3,
-// Bluetooth = 4,
-// VPN = 5,
-// }
-//
-// impl NetworkTypePB {
-// pub fn is_connect(&self) -> bool {
-// match self {
-// NetworkTypePB::Unknown | NetworkTypePB::Bluetooth => false,
-// NetworkTypePB::Wifi | NetworkTypePB::Cell | NetworkTypePB::Ethernet | NetworkTypePB::VPN => {
-// true
-// },
-// }
-// }
-// }
-//
-// #[derive(ProtoBuf, Debug, Default, Clone)]
-// pub struct NetworkStatePB {
-// #[pb(index = 1)]
-// pub ty: NetworkTypePB,
-// }
diff --git a/frontend/rust-lib/flowy-net/src/event_map.rs b/frontend/rust-lib/flowy-net/src/event_map.rs
deleted file mode 100644
index 968b49c9df..0000000000
--- a/frontend/rust-lib/flowy-net/src/event_map.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-use lib_dispatch::prelude::*;
-
-pub fn init() -> AFPlugin {
- AFPlugin::new().name("Flowy-Network")
-}
diff --git a/frontend/rust-lib/flowy-net/src/handlers/mod.rs b/frontend/rust-lib/flowy-net/src/handlers/mod.rs
deleted file mode 100644
index c7b715c332..0000000000
--- a/frontend/rust-lib/flowy-net/src/handlers/mod.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-// pub async fn update_network_ty(_data: AFPluginData<NetworkStatePB>) -> Result<(), FlowyError> {
-// Ok(())
-// }
diff --git a/frontend/rust-lib/flowy-net/src/lib.rs b/frontend/rust-lib/flowy-net/src/lib.rs
deleted file mode 100644
index 0cbe80f4e4..0000000000
--- a/frontend/rust-lib/flowy-net/src/lib.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-pub mod entities;
-pub mod event_map;
-mod handlers;
diff --git a/frontend/rust-lib/flowy-notification/Cargo.toml b/frontend/rust-lib/flowy-notification/Cargo.toml
index 7157f375f8..6c93f1c66e 100644
--- a/frontend/rust-lib/flowy-notification/Cargo.toml
+++ b/frontend/rust-lib/flowy-notification/Cargo.toml
@@ -13,7 +13,7 @@ bytes = { version = "1.4" }
serde = "1.0"
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-lib-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { workspace = true }
[build-dependencies]
flowy-codegen = { path = "../../../shared-lib/flowy-codegen" }
diff --git a/frontend/rust-lib/flowy-server-config/Cargo.toml b/frontend/rust-lib/flowy-server-config/Cargo.toml
index 97831957ee..8e11e35439 100644
--- a/frontend/rust-lib/flowy-server-config/Cargo.toml
+++ b/frontend/rust-lib/flowy-server-config/Cargo.toml
@@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-flowy-error = { path = "../flowy-error" }
+flowy-error = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.toml
index 7861a2b820..acf943f484 100644
--- a/frontend/rust-lib/flowy-server/Cargo.toml
+++ b/frontend/rust-lib/flowy-server/Cargo.toml
@@ -23,25 +23,26 @@ bytes = { version = "1.0.1", features = ["serde"] }
tokio-retry = "0.3"
anyhow = "1.0"
uuid = { version = "1.3.3", features = ["v4"] }
-chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
+chrono = { version = "0.4.27", default-features = false, features = ["clock"] }
collab = { version = "0.1.0" }
-collab-plugins = { version = "0.1.0" }
+collab-plugins = { version = "0.1.0", features = ["sync_plugin"] }
collab-document = { version = "0.1.0" }
collab-define = { version = "0.1.0" }
hex = "0.4.3"
postgrest = "1.0"
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-user-deps = { path = "../flowy-user-deps" }
-flowy-folder-deps = { path = "../flowy-folder-deps" }
-flowy-database-deps = { path = "../flowy-database-deps" }
-flowy-document-deps = { path = "../flowy-document-deps" }
-flowy-error = { path = "../flowy-error", features = ["impl_from_postgres", "impl_from_serde", "impl_from_reqwest", "impl_from_url"] }
-flowy-server-config = { path = "../flowy-server-config" }
-flowy-encrypt = { path = "../flowy-encrypt" }
-flowy-storage = { path = "../flowy-storage" }
+flowy-user-deps = { workspace = true }
+flowy-folder-deps = { workspace = true }
+flowy-database-deps = { workspace = true }
+flowy-document-deps = { workspace = true }
+flowy-error = { workspace = true, features = ["impl_from_postgres", "impl_from_serde", "impl_from_reqwest", "impl_from_url", "impl_from_appflowy_cloud"] }
+flowy-server-config = { workspace = true }
+flowy-encrypt = { workspace = true }
+flowy-storage = { workspace = true }
mime_guess = "2.0"
url = "2.4"
tokio-util = "0.7"
+client-api = { version = "0.1.0" }
[dev-dependencies]
uuid = { version = "1.3.3", features = ["v4"] }
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/configuration.rs b/frontend/rust-lib/flowy-server/src/af_cloud/configuration.rs
index ed132e2d78..3893788866 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/configuration.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/configuration.rs
@@ -20,7 +20,7 @@ pub fn appflowy_cloud_server_configuration() -> Result<AFCloudConfiguration, con
settings.merge(config::File::from_str(base, FileFormat::Yaml).required(true))?;
let environment: Environment = std::env::var("APP_ENVIRONMENT")
- .unwrap_or_else(|_| "local".into())
+ .unwrap_or_else(|_| "local".to_owned())
.try_into()
.expect("Failed to parse APP_ENVIRONMENT.");
@@ -43,42 +43,6 @@ impl AFCloudConfiguration {
format!("{}://{}:{}", self.http_scheme, self.host, self.port)
}
- pub fn sign_up_url(&self) -> String {
- format!("{}/api/register", self.base_url())
- }
-
- pub fn sign_in_url(&self) -> String {
- format!("{}/api/auth", self.base_url())
- }
-
- pub fn sign_out_url(&self) -> String {
- format!("{}/api/auth", self.base_url())
- }
-
- pub fn user_profile_url(&self) -> String {
- format!("{}/api/user", self.base_url())
- }
-
- pub fn workspace_url(&self) -> String {
- format!("{}/api/workspace", self.base_url())
- }
-
- pub fn app_url(&self) -> String {
- format!("{}/api/app", self.base_url())
- }
-
- pub fn view_url(&self) -> String {
- format!("{}/api/view", self.base_url())
- }
-
- pub fn doc_url(&self) -> String {
- format!("{}/api/doc", self.base_url())
- }
-
- pub fn trash_url(&self) -> String {
- format!("{}/api/trash", self.base_url())
- }
-
pub fn ws_addr(&self) -> String {
format!("{}://{}:{}/ws", self.ws_scheme, self.host, self.port)
}
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs
index d6494d9126..a8e154790b 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/database.rs
@@ -6,9 +6,14 @@ use flowy_database_deps::cloud::{
};
use lib_infra::future::FutureResult;
-pub(crate) struct AFCloudDatabaseCloudServiceImpl();
+use crate::af_cloud::AFServer;
-impl DatabaseCloudService for AFCloudDatabaseCloudServiceImpl {
+pub(crate) struct AFCloudDatabaseCloudServiceImpl<T>(pub T);
+
+impl<T> DatabaseCloudService for AFCloudDatabaseCloudServiceImpl<T>
+where
+ T: AFServer,
+{
fn get_collab_update(
&self,
_object_id: &str,
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs
index ce78d33b37..05f6ce2ae8 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs
@@ -3,9 +3,14 @@ use anyhow::Error;
use flowy_document_deps::cloud::*;
use lib_infra::future::FutureResult;
-pub(crate) struct AFCloudDocumentCloudServiceImpl();
+use crate::af_cloud::AFServer;
-impl DocumentCloudService for AFCloudDocumentCloudServiceImpl {
+pub(crate) struct AFCloudDocumentCloudServiceImpl<T>(pub T);
+
+impl<T> DocumentCloudService for AFCloudDocumentCloudServiceImpl<T>
+where
+ T: AFServer,
+{
fn get_document_updates(&self, _document_id: &str) -> FutureResult<Vec<Vec<u8>>, Error> {
FutureResult::new(async move { Ok(vec![]) })
}
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs
index 89320a036c..8a8d658696 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs
@@ -1,24 +1,18 @@
use anyhow::Error;
-use flowy_folder_deps::cloud::{
- gen_workspace_id, FolderCloudService, FolderData, FolderSnapshot, Workspace,
-};
+use flowy_folder_deps::cloud::{FolderCloudService, FolderData, FolderSnapshot, Workspace};
use lib_infra::future::FutureResult;
-use lib_infra::util::timestamp;
-
-pub(crate) struct AFCloudFolderCloudServiceImpl();
-
-impl FolderCloudService for AFCloudFolderCloudServiceImpl {
- fn create_workspace(&self, _uid: i64, name: &str) -> FutureResult<Workspace, Error> {
- let name = name.to_string();
- FutureResult::new(async move {
- Ok(Workspace {
- id: gen_workspace_id().to_string(),
- name: name.to_string(),
- child_views: Default::default(),
- created_at: timestamp(),
- })
- })
+
+use crate::af_cloud::AFServer;
+
+pub(crate) struct AFCloudFolderCloudServiceImpl<T>(pub T);
+
+impl<T> FolderCloudService for AFCloudFolderCloudServiceImpl<T>
+where
+ T: AFServer,
+{
+ fn create_workspace(&self, _uid: i64, _name: &str) -> FutureResult<Workspace, Error> {
+ FutureResult::new(async move { todo!() })
}
fn get_folder_data(&self, _workspace_id: &str) -> FutureResult<Option<FolderData>, Error> {
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user.rs
index 510e776953..92ddd482ed 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user.rs
@@ -1,96 +1,60 @@
+use std::sync::Arc;
+
use anyhow::Error;
use collab_define::CollabObject;
-use flowy_error::{ErrorCode, FlowyError};
+use flowy_error::FlowyError;
use flowy_user_deps::cloud::UserCloudService;
use flowy_user_deps::entities::*;
use lib_infra::box_any::BoxAny;
use lib_infra::future::FutureResult;
-use crate::af_cloud::configuration::{AFCloudConfiguration, HEADER_TOKEN};
-use crate::request::HttpRequestBuilder;
+use crate::af_cloud::{AFCloudClient, AFServer};
-pub(crate) struct AFCloudUserAuthServiceImpl {
- config: AFCloudConfiguration,
+pub(crate) struct AFCloudUserAuthServiceImpl<T> {
+ server: T,
}
-impl AFCloudUserAuthServiceImpl {
- pub(crate) fn new(config: AFCloudConfiguration) -> Self {
- Self { config }
+impl<T> AFCloudUserAuthServiceImpl<T> {
+ pub(crate) fn new(server: T) -> Self {
+ Self { server }
}
}
-impl UserCloudService for AFCloudUserAuthServiceImpl {
+impl<T> UserCloudService for AFCloudUserAuthServiceImpl<T>
+where
+ T: AFServer,
+{
fn sign_up(&self, params: BoxAny) -> FutureResult<SignUpResponse, Error> {
- let url = self.config.sign_up_url();
+ let try_get_client = self.server.try_get_client();
FutureResult::new(async move {
let params = params.unbox_or_error::<SignUpParams>()?;
- let resp = user_sign_up_request(params, &url).await?;
+ let resp = user_sign_up_request(try_get_client?, params).await?;
Ok(resp)
})
}
- fn sign_in(&self, params: BoxAny) -> FutureResult<SignInResponse, Error> {
- let url = self.config.sign_in_url();
- FutureResult::new(async move {
- let params = params.unbox_or_error::<SignInParams>()?;
- let resp = user_sign_in_request(params, &url).await?;
- Ok(resp)
- })
+ fn sign_in(&self, _params: BoxAny) -> FutureResult<SignInResponse, Error> {
+ todo!()
}
- fn sign_out(&self, token: Option<String>) -> FutureResult<(), Error> {
- match token {
- None => FutureResult::new(async {
- Err(FlowyError::new(ErrorCode::InvalidParams, "Token should not be empty").into())
- }),
- Some(token) => {
- let token = token;
- let url = self.config.sign_out_url();
- FutureResult::new(async move {
- let _ = user_sign_out_request(&token, &url).await;
- Ok(())
- })
- },
- }
+ fn sign_out(&self, _token: Option<String>) -> FutureResult<(), Error> {
+ todo!()
}
fn update_user(
&self,
- credential: UserCredentials,
- params: UpdateUserProfileParams,
+ _credential: UserCredentials,
+ _params: UpdateUserProfileParams,
) -> FutureResult<(), Error> {
- match credential.token {
- None => FutureResult::new(async {
- Err(FlowyError::new(ErrorCode::InvalidParams, "Token should not be empty").into())
- }),
- Some(token) => {
- let token = token;
- let url = self.config.user_profile_url();
- FutureResult::new(async move {
- update_user_profile_request(&token, params, &url).await?;
- Ok(())
- })
- },
- }
+ todo!()
}
fn get_user_profile(
&self,
- credential: UserCredentials,
+ _credential: UserCredentials,
) -> FutureResult<Option<UserProfile>, Error> {
- let url = self.config.user_profile_url();
- FutureResult::new(async move {
- match credential.token {
- None => {
- Err(FlowyError::new(ErrorCode::UnexpectedEmpty, "Token should not be empty").into())
- },
- Some(token) => {
- let profile = get_user_profile_request(&token, &url).await?;
- Ok(Some(profile))
- },
- }
- })
+ todo!()
}
fn get_user_workspaces(
@@ -145,53 +109,30 @@ impl UserCloudService for AFCloudUserAuthServiceImpl {
}
pub async fn user_sign_up_request(
+ client: Arc<AFCloudClient>,
params: SignUpParams,
- url: &str,
) -> Result<SignUpResponse, FlowyError> {
- let response = request_builder().post(url).json(params)?.response().await?;
- Ok(response)
-}
-
-pub async fn user_sign_in_request(
- params: SignInParams,
- url: &str,
-) -> Result<SignInResponse, FlowyError> {
- let response = request_builder().post(url).json(params)?.response().await?;
- Ok(response)
-}
-
-pub async fn user_sign_out_request(token: &str, url: &str) -> Result<(), FlowyError> {
- request_builder()
- .delete(url)
- .header(HEADER_TOKEN, token)
- .send()
- .await?;
- Ok(())
-}
-
-pub async fn get_user_profile_request(token: &str, url: &str) -> Result<UserProfile, FlowyError> {
- let user_profile = request_builder()
- .get(url)
- .header(HEADER_TOKEN, token)
- .response()
+ client
+ .read()
+ .await
+ .sign_up(&params.email, &params.password)
.await?;
- Ok(user_profile)
-}
-
-pub async fn update_user_profile_request(
- token: &str,
- params: UpdateUserProfileParams,
- url: &str,
-) -> Result<(), FlowyError> {
- request_builder()
- .patch(url)
- .header(HEADER_TOKEN, token)
- .json(params)?
- .send()
- .await?;
- Ok(())
-}
-
-fn request_builder() -> HttpRequestBuilder {
- HttpRequestBuilder::new()
+ todo!()
+ // tracing::info!("User signed up: {:?}", user);
+ // match user.confirmed_at {
+ // Some(_) => {
+ // // User is already confirmed, help her/him to sign in
+ // let token = client.sign_in_password(&params.email, &params.password).await?;
+ //
+ // // TODO:
+ // // Query workspace list
+ // // Query user profile
+ //
+ // todo!()
+ // },
+ // None => Err(FlowyError::new(
+ // ErrorCode::AwaitingEmailConfirmation,
+ // "Awaiting email confirmation".to_string(),
+ // )),
+ // }
}
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs b/frontend/rust-lib/flowy-server/src/af_cloud/server.rs
index 324b3f92a2..f24b624cda 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/server.rs
@@ -1,13 +1,19 @@
+use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
-use collab_define::CollabObject;
-use collab_plugins::cloud_storage::RemoteCollabStorage;
+use anyhow::Error;
+use client_api::notify::{TokenState, TokenStateReceiver};
+use client_api::ws::{BusinessID, WSClient, WSClientConfig, WebSocketChannel};
+use client_api::Client;
+use tokio::sync::RwLock;
use flowy_database_deps::cloud::DatabaseCloudService;
use flowy_document_deps::cloud::DocumentCloudService;
+use flowy_error::{ErrorCode, FlowyError};
use flowy_folder_deps::cloud::FolderCloudService;
use flowy_storage::FileStorageService;
use flowy_user_deps::cloud::UserCloudService;
+use lib_infra::future::FutureResult;
use crate::af_cloud::configuration::AFCloudConfiguration;
use crate::af_cloud::impls::{
@@ -16,38 +22,178 @@ use crate::af_cloud::impls::{
};
use crate::AppFlowyServer;
+pub(crate) type AFCloudClient = RwLock<client_api::Client>;
+
pub struct AFCloudServer {
+ #[allow(dead_code)]
pub(crate) config: AFCloudConfiguration,
+ pub(crate) client: Arc<AFCloudClient>,
+ enable_sync: AtomicBool,
+ #[allow(dead_code)]
+ device_id: Arc<parking_lot::RwLock<String>>,
+ ws_client: Arc<RwLock<WSClient>>,
}
impl AFCloudServer {
- pub fn new(config: AFCloudConfiguration) -> Self {
- Self { config }
+ pub fn new(
+ config: AFCloudConfiguration,
+ enable_sync: bool,
+ device_id: Arc<parking_lot::RwLock<String>>,
+ ) -> Self {
+ let http_client = reqwest::Client::new();
+ let api_client = client_api::Client::from(http_client, &config.base_url(), &config.ws_addr());
+ let token_state_rx = api_client.subscribe_token_state();
+ let enable_sync = AtomicBool::new(enable_sync);
+
+ let ws_client = WSClient::new(WSClientConfig {
+ buffer_capacity: 100,
+ ping_per_secs: 2,
+ retry_connect_per_pings: 5,
+ });
+ let ws_client = Arc::new(RwLock::new(ws_client));
+ let api_client = Arc::new(RwLock::new(api_client));
+
+ spawn_ws_conn(&device_id, token_state_rx, &ws_client, &api_client);
+ Self {
+ config,
+ client: api_client,
+ enable_sync,
+ device_id,
+ ws_client,
+ }
+ }
+
+ fn get_client(&self) -> Option<Arc<AFCloudClient>> {
+ if self.enable_sync.load(Ordering::SeqCst) {
+ Some(self.client.clone())
+ } else {
+ None
+ }
}
}
impl AppFlowyServer for AFCloudServer {
+ fn set_enable_sync(&self, uid: i64, enable: bool) {
+ tracing::info!("{} cloud sync: {}", uid, enable);
+ self.enable_sync.store(enable, Ordering::SeqCst);
+ }
fn user_service(&self) -> Arc<dyn UserCloudService> {
- Arc::new(AFCloudUserAuthServiceImpl::new(self.config.clone()))
+ let server = AFServerImpl(self.get_client());
+ Arc::new(AFCloudUserAuthServiceImpl::new(server))
}
fn folder_service(&self) -> Arc<dyn FolderCloudService> {
- Arc::new(AFCloudFolderCloudServiceImpl())
+ let server = AFServerImpl(self.get_client());
+ Arc::new(AFCloudFolderCloudServiceImpl(server))
}
fn database_service(&self) -> Arc<dyn DatabaseCloudService> {
- Arc::new(AFCloudDatabaseCloudServiceImpl())
+ let server = AFServerImpl(self.get_client());
+ Arc::new(AFCloudDatabaseCloudServiceImpl(server))
}
fn document_service(&self) -> Arc<dyn DocumentCloudService> {
- Arc::new(AFCloudDocumentCloudServiceImpl())
+ let server = AFServerImpl(self.get_client());
+ Arc::new(AFCloudDocumentCloudServiceImpl(server))
}
- fn collab_storage(&self, _collab_object: &CollabObject) -> Option<Arc<dyn RemoteCollabStorage>> {
- None
+ fn collab_ws_channel(
+ &self,
+ object_id: &str,
+ ) -> FutureResult<Option<Arc<WebSocketChannel>>, anyhow::Error> {
+ if self.enable_sync.load(Ordering::SeqCst) {
+ let object_id = object_id.to_string();
+ let weak_ws_client = Arc::downgrade(&self.ws_client);
+ FutureResult::new(async move {
+ match weak_ws_client.upgrade() {
+ None => {
+ tracing::warn!("🟡Collab WS client is dropped");
+ Ok(None)
+ },
+ Some(ws_client) => Ok(
+ ws_client
+ .read()
+ .await
+ .subscribe(BusinessID::CollabId, object_id)
+ .await
+ .ok(),
+ ),
+ }
+ })
+ } else {
+ FutureResult::new(async { Ok(None) })
+ }
}
fn file_storage(&self) -> Option<Arc<dyn FileStorageService>> {
None
}
}
+
+/// Spawns a new asynchronous task to handle WebSocket connections based on token state.
+///
+/// This function listens to the `token_state_rx` channel for token state updates. Depending on the
+/// received state, it either refreshes the WebSocket connection or disconnects from it.
+fn spawn_ws_conn(
+ device_id: &Arc<parking_lot::RwLock<String>>,
+ mut token_state_rx: TokenStateReceiver,
+ ws_client: &Arc<RwLock<WSClient>>,
+ api_client: &Arc<RwLock<Client>>,
+) {
+ let weak_device_id = Arc::downgrade(device_id);
+ let weak_ws_client = Arc::downgrade(ws_client);
+ let weak_api_client = Arc::downgrade(api_client);
+ tokio::spawn(async move {
+ while let Ok(token_state) = token_state_rx.recv().await {
+ tracing::info!("🟢Token state: {:?}", token_state);
+ match token_state {
+ TokenState::Refresh => {
+ if let (Some(api_client), Some(ws_client), Some(device_id)) = (
+ weak_api_client.upgrade(),
+ weak_ws_client.upgrade(),
+ weak_device_id.upgrade(),
+ ) {
+ let device_id = device_id.read().clone();
+ if let Ok(ws_addr) = api_client.read().await.ws_url(&device_id) {
+ tracing::info!("🟢Connecting to websocket");
+ let _ = ws_client.write().await.connect(ws_addr).await;
+ }
+ }
+ },
+ TokenState::Invalid => {
+ if let Some(ws_client) = weak_ws_client.upgrade() {
+ tracing::info!("🟡Disconnecting from websocket");
+ ws_client.write().await.disconnect().await;
+ }
+ },
+ }
+ }
+ });
+}
+
+pub trait AFServer: Send + Sync + 'static {
+ fn get_client(&self) -> Option<Arc<AFCloudClient>>;
+ fn try_get_client(&self) -> Result<Arc<AFCloudClient>, Error>;
+}
+
+#[derive(Clone)]
+pub struct AFServerImpl(pub Option<Arc<AFCloudClient>>);
+
+impl AFServer for AFServerImpl {
+ fn get_client(&self) -> Option<Arc<AFCloudClient>> {
+ self.0.clone()
+ }
+
+ fn try_get_client(&self) -> Result<Arc<AFCloudClient>, Error> {
+ match self.0.clone() {
+ None => Err(
+ FlowyError::new(
+ ErrorCode::DataSyncRequired,
+ "Data Sync is disabled, please enable it first",
+ )
+ .into(),
+ ),
+ Some(client) => Ok(client),
+ }
+ }
+}
diff --git a/frontend/rust-lib/flowy-server/src/lib.rs b/frontend/rust-lib/flowy-server/src/lib.rs
index 5b68da59a9..66086909a8 100644
--- a/frontend/rust-lib/flowy-server/src/lib.rs
+++ b/frontend/rust-lib/flowy-server/src/lib.rs
@@ -2,7 +2,7 @@ pub use server::*;
pub mod af_cloud;
pub mod local_server;
-mod request;
+// mod request;
mod response;
mod server;
pub mod supabase;
diff --git a/frontend/rust-lib/flowy-server/src/local_server/server.rs b/frontend/rust-lib/flowy-server/src/local_server/server.rs
index d941a13e06..17ec06f4ed 100644
--- a/frontend/rust-lib/flowy-server/src/local_server/server.rs
+++ b/frontend/rust-lib/flowy-server/src/local_server/server.rs
@@ -1,7 +1,5 @@
use std::sync::Arc;
-use collab_define::CollabObject;
-use collab_plugins::cloud_storage::RemoteCollabStorage;
use parking_lot::RwLock;
use tokio::sync::mpsc;
@@ -70,10 +68,6 @@ impl AppFlowyServer for LocalServer {
Arc::new(LocalServerDocumentCloudServiceImpl())
}
- fn collab_storage(&self, _collab_object: &CollabObject) -> Option<Arc<dyn RemoteCollabStorage>> {
- None
- }
-
fn file_storage(&self) -> Option<Arc<dyn FileStorageService>> {
None
}
diff --git a/frontend/rust-lib/flowy-server/src/server.rs b/frontend/rust-lib/flowy-server/src/server.rs
index b301f507e6..bb28cb907d 100644
--- a/frontend/rust-lib/flowy-server/src/server.rs
+++ b/frontend/rust-lib/flowy-server/src/server.rs
@@ -1,5 +1,6 @@
use std::sync::Arc;
+use client_api::ws::WebSocketChannel;
use collab_define::CollabObject;
use collab_plugins::cloud_storage::RemoteCollabStorage;
use parking_lot::RwLock;
@@ -9,6 +10,7 @@ use flowy_document_deps::cloud::DocumentCloudService;
use flowy_folder_deps::cloud::FolderCloudService;
use flowy_storage::FileStorageService;
use flowy_user_deps::cloud::UserCloudService;
+use lib_infra::future::FutureResult;
pub trait AppFlowyEncryption: Send + Sync + 'static {
fn get_secret(&self) -> Option<String>;
@@ -85,7 +87,16 @@ pub trait AppFlowyServer: Send + Sync + 'static {
/// # Returns
///
/// An `Option` that might contain an `Arc` wrapping the `RemoteCollabStorage` interface.
- fn collab_storage(&self, collab_object: &CollabObject) -> Option<Arc<dyn RemoteCollabStorage>>;
+ fn collab_storage(&self, _collab_object: &CollabObject) -> Option<Arc<dyn RemoteCollabStorage>> {
+ None
+ }
+
+ fn collab_ws_channel(
+ &self,
+ _object_id: &str,
+ ) -> FutureResult<Option<Arc<WebSocketChannel>>, anyhow::Error> {
+ FutureResult::new(async { Ok(None) })
+ }
fn file_storage(&self) -> Option<Arc<dyn FileStorageService>>;
}
diff --git a/frontend/rust-lib/flowy-server/src/supabase/api/collab_storage.rs b/frontend/rust-lib/flowy-server/src/supabase/api/collab_storage.rs
index bd68b45c01..a021f78f1d 100644
--- a/frontend/rust-lib/flowy-server/src/supabase/api/collab_storage.rs
+++ b/frontend/rust-lib/flowy-server/src/supabase/api/collab_storage.rs
@@ -62,8 +62,11 @@ where
async fn get_all_updates(&self, object: &CollabObject) -> Result<Vec<Vec<u8>>, Error> {
let postgrest = self.server.try_get_weak_postgrest()?;
- let action =
- FetchObjectUpdateAction::new(object.object_id.clone(), object.ty.clone(), postgrest);
+ let action = FetchObjectUpdateAction::new(
+ object.object_id.clone(),
+ object.collab_type.clone(),
+ postgrest,
+ );
let updates = action.run().await?;
Ok(updates)
}
@@ -140,10 +143,14 @@ where
update: Vec<u8>,
) -> Result<(), Error> {
if let Some(postgrest) = self.server.get_postgrest() {
- let workspace_id = object.get_workspace_id().ok_or(anyhow::anyhow!(
- "Can't get the workspace id in CollabObject"
- ))?;
- send_update(workspace_id, object, update, &postgrest, &self.secret()).await?;
+ send_update(
+ object.workspace_id.clone(),
+ object,
+ update,
+ &postgrest,
+ &self.secret(),
+ )
+ .await?;
}
Ok(())
@@ -156,16 +163,14 @@ where
init_update: Vec<u8>,
) -> Result<(), Error> {
let postgrest = self.server.try_get_postgrest()?;
- let workspace_id = object
- .get_workspace_id()
- .ok_or(anyhow::anyhow!("Invalid workspace id"))?;
- let update_items = get_updates_from_server(&object.object_id, &object.ty, &postgrest).await?;
+ let update_items =
+ get_updates_from_server(&object.object_id, &object.collab_type, &postgrest).await?;
// If the update_items is empty, we can send the init_update directly
if update_items.is_empty() {
send_update(
- workspace_id,
+ object.workspace_id.clone(),
object,
init_update,
&postgrest,
@@ -197,18 +202,13 @@ pub(crate) async fn flush_collab_with_update(
) -> Result<(), Error> {
// 2.Merge the updates into one and then delete the merged updates
let merge_result = spawn_blocking(move || merge_updates(update_items, update)).await??;
-
- let workspace_id = object
- .get_workspace_id()
- .ok_or(anyhow::anyhow!("Invalid workspace id"))?;
-
let value_size = merge_result.new_update.len() as i32;
let md5 = md5(&merge_result.new_update);
tracing::trace!(
"Flush collab id:{} type:{} is_encrypt: {}",
object.object_id,
- object.ty,
+ object.collab_type,
secret.is_some()
);
let (new_update, encrypt) =
@@ -219,11 +219,11 @@ pub(crate) async fn flush_collab_with_update(
.insert("encrypt", encrypt)
.insert("md5", md5)
.insert("value_size", value_size)
- .insert("partition_key", partition_key(&object.ty))
+ .insert("partition_key", partition_key(&object.collab_type))
.insert("uid", object.uid)
- .insert("workspace_id", workspace_id)
+ .insert("workspace_id", &object.workspace_id)
.insert("removed_keys", merge_result.merged_keys)
- .insert("did", object.get_device_id())
+ .insert("did", &object.device_id)
.build();
postgrest
@@ -247,13 +247,13 @@ pub(crate) async fn send_update(
let (update, encrypt) = SupabaseBinaryColumnEncoder::encode(update, encryption_secret)?;
let builder = InsertParamsBuilder::new()
.insert("oid", object.object_id.clone())
- .insert("partition_key", partition_key(&object.ty))
+ .insert("partition_key", partition_key(&object.collab_type))
.insert("value", update)
.insert("encrypt", encrypt)
.insert("uid", object.uid)
.insert("md5", md5)
.insert("workspace_id", workspace_id)
- .insert("did", object.get_device_id())
+ .insert("did", &object.device_id)
.insert("value_size", value_size);
let params = builder.build();
diff --git a/frontend/rust-lib/flowy-server/src/supabase/api/request.rs b/frontend/rust-lib/flowy-server/src/supabase/api/request.rs
index c0eec4d74c..477170ddbd 100644
--- a/frontend/rust-lib/flowy-server/src/supabase/api/request.rs
+++ b/frontend/rust-lib/flowy-server/src/supabase/api/request.rs
@@ -150,7 +150,7 @@ pub async fn create_snapshot(
.insert(
InsertParamsBuilder::new()
.insert(AF_COLLAB_SNAPSHOT_OID_COLUMN, object.object_id.clone())
- .insert("name", object.ty.to_string())
+ .insert("name", object.collab_type.to_string())
.insert(AF_COLLAB_SNAPSHOT_ENCRYPT_COLUMN, encrypt)
.insert(AF_COLLAB_SNAPSHOT_BLOB_COLUMN, snapshot)
.insert(AF_COLLAB_SNAPSHOT_BLOB_SIZE_COLUMN, value_size)
diff --git a/frontend/rust-lib/flowy-server/src/supabase/api/user.rs b/frontend/rust-lib/flowy-server/src/supabase/api/user.rs
index c07b17e6f4..cc539a9c69 100644
--- a/frontend/rust-lib/flowy-server/src/supabase/api/user.rs
+++ b/frontend/rust-lib/flowy-server/src/supabase/api/user.rs
@@ -292,9 +292,12 @@ where
.upgrade()
.ok_or(anyhow::anyhow!("postgrest is not available"))?;
- let updates =
- get_updates_from_server(&collab_object.object_id, &collab_object.ty, &postgrest)
- .await?;
+ let updates = get_updates_from_server(
+ &collab_object.object_id,
+ &collab_object.collab_type,
+ &postgrest,
+ )
+ .await?;
flush_collab_with_update(
&collab_object,
diff --git a/frontend/rust-lib/flowy-server/tests/main.rs b/frontend/rust-lib/flowy-server/tests/main.rs
index 819ec4faf0..edbbb44472 100644
--- a/frontend/rust-lib/flowy-server/tests/main.rs
+++ b/frontend/rust-lib/flowy-server/tests/main.rs
@@ -9,7 +9,7 @@ mod supabase_test;
pub fn setup_log() {
static START: Once = Once::new();
START.call_once(|| {
- let level = "debug";
+ let level = "trace";
let mut filters = vec![];
filters.push(format!("flowy_server={}", level));
std::env::set_var("RUST_LOG", filters.join(","));
diff --git a/frontend/rust-lib/flowy-server/tests/supabase_test/database_test.rs b/frontend/rust-lib/flowy-server/tests/supabase_test/database_test.rs
index 2a2bf80c7a..94dbc344df 100644
--- a/frontend/rust-lib/flowy-server/tests/supabase_test/database_test.rs
+++ b/frontend/rust-lib/flowy-server/tests/supabase_test/database_test.rs
@@ -10,7 +10,7 @@ use crate::supabase_test::util::{
};
#[tokio::test]
-async fn supabase_create_workspace_test() {
+async fn supabase_create_database_test() {
if get_supabase_ci_config().is_none() {
return;
}
@@ -27,13 +27,13 @@ async fn supabase_create_workspace_test() {
for _i in 0..3 {
let row_id = uuid::Uuid::new_v4().to_string();
row_ids.push(row_id.clone());
- let collab_object = CollabObject {
- object_id: row_id,
- uid: user.user_id,
- ty: CollabType::DatabaseRow,
- meta: Default::default(),
- }
- .with_workspace_id(user.latest_workspace.id.clone());
+ let collab_object = CollabObject::new(
+ user.user_id,
+ row_id,
+ CollabType::DatabaseRow,
+ user.latest_workspace.id.clone(),
+ "fake_device_id".to_string(),
+ );
collab_service
.send_update(&collab_object, 0, vec![1, 2, 3])
.await
diff --git a/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs b/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs
index 03b0541618..e395f7bf20 100644
--- a/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs
+++ b/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs
@@ -39,13 +39,13 @@ async fn supabase_get_folder_test() {
let params = third_party_sign_up_param(uuid);
let user: SignUpResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
- let collab_object = CollabObject {
- object_id: user.latest_workspace.id.clone(),
- uid: user.user_id,
- ty: CollabType::Folder,
- meta: Default::default(),
- }
- .with_workspace_id(user.latest_workspace.id.clone());
+ let collab_object = CollabObject::new(
+ user.user_id,
+ user.latest_workspace.id.clone(),
+ CollabType::Folder,
+ user.latest_workspace.id.clone(),
+ "fake_device_id".to_string(),
+ );
let doc = Doc::with_client_id(1);
let map = { doc.get_or_insert_map("map") };
@@ -113,13 +113,13 @@ async fn supabase_duplicate_updates_test() {
let params = third_party_sign_up_param(uuid);
let user: SignUpResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
- let collab_object = CollabObject {
- object_id: user.latest_workspace.id.clone(),
- uid: user.user_id,
- ty: CollabType::Folder,
- meta: Default::default(),
- }
- .with_workspace_id(user.latest_workspace.id.clone());
+ let collab_object = CollabObject::new(
+ user.user_id,
+ user.latest_workspace.id.clone(),
+ CollabType::Folder,
+ user.latest_workspace.id.clone(),
+ "fake_device_id".to_string(),
+ );
let doc = Doc::with_client_id(1);
let map = { doc.get_or_insert_map("map") };
let mut duplicated_updates = vec![];
@@ -220,13 +220,13 @@ async fn supabase_diff_state_vector_test() {
let params = third_party_sign_up_param(uuid);
let user: SignUpResponse = user_service.sign_up(BoxAny::new(params)).await.unwrap();
- let collab_object = CollabObject {
- object_id: user.latest_workspace.id.clone(),
- uid: user.user_id,
- ty: CollabType::Folder,
- meta: Default::default(),
- }
- .with_workspace_id(user.latest_workspace.id.clone());
+ let collab_object = CollabObject::new(
+ user.user_id,
+ user.latest_workspace.id.clone(),
+ CollabType::Folder,
+ user.latest_workspace.id.clone(),
+ "fake_device_id".to_string(),
+ );
let doc = Doc::with_client_id(1);
let map = { doc.get_or_insert_map("map") };
let array = { doc.get_or_insert_array("array") };
diff --git a/frontend/rust-lib/flowy-storage/Cargo.toml b/frontend/rust-lib/flowy-storage/Cargo.toml
index 30c51decce..1387ec98ac 100644
--- a/frontend/rust-lib/flowy-storage/Cargo.toml
+++ b/frontend/rust-lib/flowy-storage/Cargo.toml
@@ -14,4 +14,4 @@ bytes = "1.0.1"
mime_guess = "2.0"
lib-infra = { path = "../../../shared-lib/lib-infra" }
url = "2.2.2"
-flowy-error = { path = "../flowy-error", features = ["impl_from_reqwest"] }
\ No newline at end of file
+flowy-error = { workspace = true, features = ["impl_from_reqwest"] }
diff --git a/frontend/rust-lib/flowy-test/Cargo.toml b/frontend/rust-lib/flowy-test/Cargo.toml
index b49d32da39..18ec1cf419 100644
--- a/frontend/rust-lib/flowy-test/Cargo.toml
+++ b/frontend/rust-lib/flowy-test/Cargo.toml
@@ -6,24 +6,23 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-flowy-core = { path = "../flowy-core" }
-flowy-user = { path = "../flowy-user"}
-flowy-user-deps = { path = "../flowy-user-deps"}
-flowy-net = { path = "../flowy-net"}
+flowy-core = { workspace = true }
+flowy-user = { workspace = true }
+flowy-user-deps = { workspace = true }
flowy-folder2 = { path = "../flowy-folder2", features = ["test_helper"] }
-flowy-folder-deps = { path = "../flowy-folder-deps" }
+flowy-folder-deps = { workspace = true }
flowy-database2 = { path = "../flowy-database2" }
-flowy-database-deps = { path = "../flowy-database-deps" }
+flowy-database-deps = { workspace = true }
flowy-document2 = { path = "../flowy-document2" }
-flowy-document-deps = { path = "../flowy-document-deps" }
-flowy-encrypt = { path = "../flowy-encrypt" }
-lib-dispatch = { path = "../lib-dispatch" }
+flowy-document-deps = { workspace = true }
+flowy-encrypt = { workspace = true }
+lib-dispatch = { workspace = true }
lib-infra = { path = "../../../shared-lib/lib-infra" }
flowy-server = { path = "../flowy-server" }
-flowy-server-config = { path = "../flowy-server-config" }
-flowy-notification = { path = "../flowy-notification" }
+flowy-server-config = { workspace = true }
+flowy-notification = { workspace = true }
anyhow = "1.0.71"
-flowy-storage = { path = "../flowy-storage" }
+flowy-storage = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}
@@ -46,6 +45,7 @@ collab-document = { version = "0.1.0" }
collab-folder = { version = "0.1.0" }
collab-database = { version = "0.1.0" }
collab-plugins = { version = "0.1.0" }
+collab-define = { version = "0.1.0" }
assert-json-diff = "2.0.2"
tokio-postgres = { version = "0.7.8" }
zip = "0.6.6"
diff --git a/frontend/rust-lib/flowy-test/tests/database/local_test/test.rs b/frontend/rust-lib/flowy-test/tests/database/local_test/test.rs
index e24c007472..43787ec921 100644
--- a/frontend/rust-lib/flowy-test/tests/database/local_test/test.rs
+++ b/frontend/rust-lib/flowy-test/tests/database/local_test/test.rs
@@ -527,7 +527,7 @@ async fn update_date_cell_event_test() {
let error = test
.update_date_cell(DateChangesetPB {
cell_id: cell_path,
- date: Some(timestamp.clone()),
+ date: Some(timestamp),
time: None,
include_time: None,
clear_flag: None,
diff --git a/frontend/rust-lib/flowy-test/tests/database/supabase_test/helper.rs b/frontend/rust-lib/flowy-test/tests/database/supabase_test/helper.rs
index f9c1c3aa21..ade3149a7e 100644
--- a/frontend/rust-lib/flowy-test/tests/database/supabase_test/helper.rs
+++ b/frontend/rust-lib/flowy-test/tests/database/supabase_test/helper.rs
@@ -5,7 +5,7 @@ use collab::core::collab::MutexCollab;
use collab::core::origin::CollabOrigin;
use collab::preclude::updates::decoder::Decode;
use collab::preclude::{merge_updates_v1, JsonValue, Update};
-use collab_plugins::cloud_storage::CollabType;
+use collab_define::CollabType;
use flowy_database2::entities::{DatabasePB, DatabaseViewIdPB, RepeatedDatabaseSnapshotPB};
use flowy_database2::event_map::DatabaseEvent::*;
diff --git a/frontend/rust-lib/flowy-test/tests/user/supabase_test/auth_test.rs b/frontend/rust-lib/flowy-test/tests/user/supabase_test/auth_test.rs
index 4980cc3521..6fa1f5b30f 100644
--- a/frontend/rust-lib/flowy-test/tests/user/supabase_test/auth_test.rs
+++ b/frontend/rust-lib/flowy-test/tests/user/supabase_test/auth_test.rs
@@ -2,6 +2,7 @@ use std::collections::HashMap;
use assert_json_diff::assert_json_eq;
use collab_database::rows::database_row_document_id_from_row_id;
+use collab_define::CollabType;
use collab_document::blocks::DocumentData;
use collab_folder::core::FolderData;
use nanoid::nanoid;
@@ -9,7 +10,7 @@ use serde_json::json;
use flowy_core::DEFAULT_NAME;
use flowy_encrypt::decrypt_text;
-use flowy_server::supabase::define::{CollabType, USER_EMAIL, USER_UUID};
+use flowy_server::supabase::define::{USER_EMAIL, USER_UUID};
use flowy_test::document::document_event::DocumentEventTest;
use flowy_test::event_builder::EventBuilder;
use flowy_test::FlowyCoreTest;
diff --git a/frontend/rust-lib/flowy-user-deps/Cargo.toml b/frontend/rust-lib/flowy-user-deps/Cargo.toml
index e61c66e24d..b147033533 100644
--- a/frontend/rust-lib/flowy-user-deps/Cargo.toml
+++ b/frontend/rust-lib/flowy-user-deps/Cargo.toml
@@ -7,12 +7,12 @@ edition = "2021"
[dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-error = { path = "../flowy-error" }
+flowy-error = { workspace = true }
uuid = { version = "1.3.3", features = ["v4"] }
serde = { version = "1.0", features = ["derive"] }
collab-define = { version = "0.1.0" }
-serde_json = {version = "1.0"}
+serde_json = { version = "1.0"}
serde_repr = "0.1"
-chrono = { version = "0.4.22", default-features = false, features = ["clock", "serde"] }
+chrono = { version = "0.4.27", default-features = false, features = ["clock", "serde"] }
anyhow = "1.0.71"
tokio = { version = "1.26", features = ["sync"] }
diff --git a/frontend/rust-lib/flowy-user/Cargo.toml b/frontend/rust-lib/flowy-user/Cargo.toml
index adc25e2503..2141c3840b 100644
--- a/frontend/rust-lib/flowy-user/Cargo.toml
+++ b/frontend/rust-lib/flowy-user/Cargo.toml
@@ -7,22 +7,22 @@ edition = "2018"
[dependencies]
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
-flowy-sqlite = { path = "../flowy-sqlite", optional = true }
-flowy-encrypt = { path = "../flowy-encrypt" }
-flowy-error = { path = "../flowy-error", features = ["impl_from_sqlite", "impl_from_dispatch_error"] }
-flowy-folder-deps = { path = "../flowy-folder-deps" }
+flowy-sqlite = { workspace = true, optional = true }
+flowy-encrypt = { workspace = true }
+flowy-error = { workspace = true, features = ["impl_from_sqlite", "impl_from_dispatch_error"] }
+flowy-folder-deps = { workspace = true }
lib-infra = { path = "../../../shared-lib/lib-infra" }
-flowy-notification = { path = "../flowy-notification" }
-flowy-server-config = { path = "../flowy-server-config" }
-lib-dispatch = { path = "../lib-dispatch" }
-appflowy-integrate = { version = "0.1.0" }
+flowy-notification = { workspace = true }
+flowy-server-config = { workspace = true }
+lib-dispatch = { workspace = true }
+collab-integrate = { workspace = true }
collab = { version = "0.1.0" }
collab-folder = { version = "0.1.0" }
collab-document = { version = "0.1.0" }
collab-database = { version = "0.1.0" }
collab-user = { version = "0.1.0" }
collab-define = { version = "0.1.0" }
-flowy-user-deps = { path = "../flowy-user-deps" }
+flowy-user-deps = { workspace = true }
anyhow = "1.0.75"
tracing = { version = "0.1", features = ["log"] }
@@ -43,7 +43,7 @@ validator = "0.16.0"
unicode-segmentation = "1.10"
fancy-regex = "0.11.0"
uuid = { version = "1.3.3", features = [ "v4"] }
-chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
+chrono = { version = "0.4.27", default-features = false, features = ["clock"] }
base64 = "^0.21"
[dev-dependencies]
diff --git a/frontend/rust-lib/flowy-user/src/event_handler.rs b/frontend/rust-lib/flowy-user/src/event_handler.rs
index a6539e7986..823d444d5f 100644
--- a/frontend/rust-lib/flowy-user/src/event_handler.rs
+++ b/frontend/rust-lib/flowy-user/src/event_handler.rs
@@ -453,6 +453,7 @@ pub async fn reset_workspace_handler(
"The workspace id is empty",
));
}
- manager.reset_workspace(reset_pb).await?;
+ let session = manager.get_session()?;
+ manager.reset_workspace(reset_pb, session.device_id).await?;
Ok(())
}
diff --git a/frontend/rust-lib/flowy-user/src/manager.rs b/frontend/rust-lib/flowy-user/src/manager.rs
index a372e075d9..386e7d82ca 100644
--- a/frontend/rust-lib/flowy-user/src/manager.rs
+++ b/frontend/rust-lib/flowy-user/src/manager.rs
@@ -1,13 +1,13 @@
use std::string::ToString;
use std::sync::{Arc, Weak};
-use appflowy_integrate::collab_builder::AppFlowyCollabBuilder;
-use appflowy_integrate::RocksCollabDB;
use collab_user::core::MutexUserAwareness;
use serde_json::Value;
use tokio::sync::{Mutex, RwLock};
use uuid::Uuid;
+use collab_integrate::collab_builder::AppFlowyCollabBuilder;
+use collab_integrate::RocksCollabDB;
use flowy_error::{internal_error, ErrorCode, FlowyResult};
use flowy_sqlite::kv::StorePreferences;
use flowy_sqlite::schema::user_table;
@@ -597,6 +597,7 @@ impl UserManager {
if let Err(err) = sync_user_data_to_cloud(
self.cloud_services.get_user_service()?,
+ "",
new_user,
&new_collab_db,
)
diff --git a/frontend/rust-lib/flowy-user/src/migrations/historical_document.rs b/frontend/rust-lib/flowy-user/src/migrations/historical_document.rs
index 03fab05565..0b25614173 100644
--- a/frontend/rust-lib/flowy-user/src/migrations/historical_document.rs
+++ b/frontend/rust-lib/flowy-user/src/migrations/historical_document.rs
@@ -1,12 +1,12 @@
use std::sync::Arc;
-use appflowy_integrate::{RocksCollabDB, YrsDocAction};
use collab::core::collab::MutexCollab;
use collab::core::origin::{CollabClient, CollabOrigin};
use collab_document::document::Document;
use collab_document::document_data::default_document_data;
use collab_folder::core::Folder;
+use collab_integrate::{RocksCollabDB, YrsDocAction};
use flowy_error::{internal_error, FlowyResult};
use crate::migrations::migration::UserDataMigration;
diff --git a/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs b/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs
index 301313ce56..e9cb39ef2d 100644
--- a/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs
+++ b/frontend/rust-lib/flowy-user/src/migrations/migrate_to_new_user.rs
@@ -3,7 +3,6 @@ use std::ops::{Deref, DerefMut};
use std::sync::Arc;
use anyhow::anyhow;
-use appflowy_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab::core::collab::MutexCollab;
use collab::core::origin::{CollabClient, CollabOrigin};
use collab::preclude::Collab;
@@ -15,6 +14,7 @@ use collab_database::user::DatabaseWithViewsArray;
use collab_folder::core::Folder;
use parking_lot::{Mutex, RwLock};
+use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use flowy_folder_deps::cloud::gen_view_id;
diff --git a/frontend/rust-lib/flowy-user/src/migrations/migration.rs b/frontend/rust-lib/flowy-user/src/migrations/migration.rs
index 21aaa3a6f1..e874c39946 100644
--- a/frontend/rust-lib/flowy-user/src/migrations/migration.rs
+++ b/frontend/rust-lib/flowy-user/src/migrations/migration.rs
@@ -1,9 +1,9 @@
use std::sync::Arc;
-use appflowy_integrate::RocksCollabDB;
use chrono::NaiveDateTime;
use diesel::{RunQueryDsl, SqliteConnection};
+use collab_integrate::RocksCollabDB;
use flowy_error::FlowyResult;
use flowy_sqlite::schema::user_data_migration_records;
use flowy_sqlite::ConnectionPool;
diff --git a/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs b/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs
index a1c1c00252..5dc69cf94d 100644
--- a/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs
+++ b/frontend/rust-lib/flowy-user/src/migrations/sync_new_user.rs
@@ -4,7 +4,6 @@ use std::pin::Pin;
use std::sync::Arc;
use anyhow::{anyhow, Error};
-use appflowy_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use collab::core::collab::MutexCollab;
use collab::preclude::Collab;
use collab_database::database::get_database_row_ids;
@@ -14,6 +13,7 @@ use collab_define::{CollabObject, CollabType};
use collab_folder::core::{Folder, View, ViewLayout};
use parking_lot::Mutex;
+use collab_integrate::{PersistenceError, RocksCollabDB, YrsDocAction};
use flowy_error::FlowyResult;
use flowy_user_deps::cloud::UserCloudService;
@@ -22,16 +22,27 @@ use crate::migrations::MigrationUser;
#[tracing::instrument(level = "info", skip_all, err)]
pub async fn sync_user_data_to_cloud(
user_service: Arc<dyn UserCloudService>,
+ device_id: &str,
new_user: &MigrationUser,
collab_db: &Arc<RocksCollabDB>,
) -> FlowyResult<()> {
let workspace_id = new_user.session.user_workspace.id.clone();
let uid = new_user.session.user_id;
- let folder = Arc::new(sync_folder(uid, &workspace_id, collab_db, user_service.clone()).await?);
+ let folder = Arc::new(
+ sync_folder(
+ uid,
+ &workspace_id,
+ device_id,
+ collab_db,
+ user_service.clone(),
+ )
+ .await?,
+ );
let database_records = sync_database_views(
uid,
&workspace_id,
+ device_id,
&new_user.session.user_workspace.database_views_aggregate_id,
collab_db,
user_service.clone(),
@@ -46,6 +57,7 @@ pub async fn sync_user_data_to_cloud(
folder.clone(),
database_records.clone(),
workspace_id.to_string(),
+ device_id.to_string(),
view,
collab_db.clone(),
user_service.clone(),
@@ -63,6 +75,7 @@ fn sync_views(
folder: Arc<MutexFolder>,
database_records: Vec<Arc<DatabaseWithViews>>,
workspace_id: String,
+ device_id: String,
view: Arc<View>,
collab_db: Arc<RocksCollabDB>,
user_service: Arc<dyn UserCloudService>,
@@ -77,8 +90,13 @@ fn sync_views(
object_id
);
- let collab_object =
- CollabObject::new(uid, object_id, collab_type).with_workspace_id(workspace_id.to_string());
+ let collab_object = CollabObject::new(
+ uid,
+ object_id,
+ collab_type,
+ workspace_id.to_string(),
+ device_id.clone(),
+ );
match view.layout {
ViewLayout::Document => {
@@ -108,8 +126,13 @@ fn sync_views(
tracing::debug!("sync row: {}", row_id);
let document_id = database_row_document_id_from_row_id(&row_id);
- let database_row_collab_object = CollabObject::new(uid, row_id, CollabType::DatabaseRow)
- .with_workspace_id(workspace_id.to_string());
+ let database_row_collab_object = CollabObject::new(
+ uid,
+ row_id,
+ CollabType::DatabaseRow,
+ workspace_id.to_string(),
+ device_id.clone(),
+ );
let database_row_update =
get_collab_init_update(uid, &database_row_collab_object, &collab_db)?;
tracing::info!(
@@ -122,8 +145,13 @@ fn sync_views(
.create_collab_object(&database_row_collab_object, database_row_update)
.await;
- let database_row_document = CollabObject::new(uid, document_id, CollabType::Document)
- .with_workspace_id(workspace_id.to_string());
+ let database_row_document = CollabObject::new(
+ uid,
+ document_id,
+ CollabType::Document,
+ workspace_id.to_string(),
+ device_id.to_string(),
+ );
// sync document in the row if exist
if let Ok(document_update) =
get_collab_init_update(uid, &database_row_document, &collab_db)
@@ -149,6 +177,7 @@ fn sync_views(
folder.clone(),
database_records.clone(),
workspace_id.clone(),
+ device_id.to_string(),
child_view,
collab_db.clone(),
user_service.clone(),
@@ -210,6 +239,7 @@ fn get_database_init_update(
async fn sync_folder(
uid: i64,
workspace_id: &str,
+ device_id: &str,
collab_db: &Arc<RocksCollabDB>,
user_service: Arc<dyn UserCloudService>,
) -> Result<MutexFolder, Error> {
@@ -231,8 +261,13 @@ async fn sync_folder(
)
};
- let collab_object = CollabObject::new(uid, workspace_id.to_string(), CollabType::Folder)
- .with_workspace_id(workspace_id.to_string());
+ let collab_object = CollabObject::new(
+ uid,
+ workspace_id.to_string(),
+ CollabType::Folder,
+ workspace_id.to_string(),
+ device_id.to_string(),
+ );
tracing::info!(
"sync object: {} with update: {}",
collab_object,
@@ -251,6 +286,7 @@ async fn sync_folder(
async fn sync_database_views(
uid: i64,
workspace_id: &str,
+ device_id: &str,
database_views_aggregate_id: &str,
collab_db: &Arc<RocksCollabDB>,
user_service: Arc<dyn UserCloudService>,
@@ -259,8 +295,9 @@ async fn sync_database_views(
uid,
database_views_aggregate_id.to_string(),
CollabType::WorkspaceDatabase,
- )
- .with_workspace_id(workspace_id.to_string());
+ workspace_id.to_string(),
+ device_id.to_string(),
+ );
// Use the temporary result to short the lifetime of the TransactionMut
let result = {
diff --git a/frontend/rust-lib/flowy-user/src/services/database.rs b/frontend/rust-lib/flowy-user/src/services/database.rs
index eada8dfbb4..bb2f4cf7d4 100644
--- a/frontend/rust-lib/flowy-user/src/services/database.rs
+++ b/frontend/rust-lib/flowy-user/src/services/database.rs
@@ -1,10 +1,10 @@
use std::path::PathBuf;
use std::{collections::HashMap, sync::Arc, time::Duration};
-use appflowy_integrate::RocksCollabDB;
use lazy_static::lazy_static;
use parking_lot::RwLock;
+use collab_integrate::RocksCollabDB;
use flowy_error::{ErrorCode, FlowyError};
use flowy_sqlite::schema::user_workspace_table;
use flowy_sqlite::ConnectionPool;
diff --git a/frontend/rust-lib/flowy-user/src/services/user_awareness.rs b/frontend/rust-lib/flowy-user/src/services/user_awareness.rs
index f239f5b128..47cbc65947 100644
--- a/frontend/rust-lib/flowy-user/src/services/user_awareness.rs
+++ b/frontend/rust-lib/flowy-user/src/services/user_awareness.rs
@@ -1,11 +1,11 @@
use std::sync::{Arc, Weak};
-use appflowy_integrate::RocksCollabDB;
use collab::core::collab::{CollabRawData, MutexCollab};
use collab_define::reminder::Reminder;
use collab_define::CollabType;
use collab_user::core::{MutexUserAwareness, UserAwareness};
+use collab_integrate::RocksCollabDB;
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
use crate::entities::ReminderPB;
diff --git a/frontend/rust-lib/flowy-user/src/services/user_workspace.rs b/frontend/rust-lib/flowy-user/src/services/user_workspace.rs
index 03c493414f..9ac76c622e 100644
--- a/frontend/rust-lib/flowy-user/src/services/user_workspace.rs
+++ b/frontend/rust-lib/flowy-user/src/services/user_workspace.rs
@@ -89,10 +89,18 @@ impl UserManager {
/// Reset the remote workspace using local workspace data. This is useful when a user wishes to
/// open a workspace on a new device that hasn't fully synchronized with the server.
- pub async fn reset_workspace(&self, reset: ResetWorkspacePB) -> FlowyResult<()> {
- let collab_object =
- CollabObject::new(reset.uid, reset.workspace_id.clone(), CollabType::Folder)
- .with_workspace_id(reset.workspace_id);
+ pub async fn reset_workspace(
+ &self,
+ reset: ResetWorkspacePB,
+ device_id: String,
+ ) -> FlowyResult<()> {
+ let collab_object = CollabObject::new(
+ reset.uid,
+ reset.workspace_id.clone(),
+ CollabType::Folder,
+ reset.workspace_id.clone(),
+ device_id,
+ );
self
.cloud_services
.get_user_service()?
diff --git a/frontend/scripts/tool/update_collab_rev.sh b/frontend/scripts/tool/update_collab_rev.sh
new file mode 100755
index 0000000000..c137625afb
--- /dev/null
+++ b/frontend/scripts/tool/update_collab_rev.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Ensure a new revision ID is provided
+if [ "$#" -ne 1 ]; then
+ echo "Usage: $0 <new_revision_id>"
+ exit 1
+fi
+
+NEW_REV="$1"
+echo "New revision: $NEW_REV"
+directories=("rust-lib" "appflowy_tauri/src-tauri")
+
+for dir in "${directories[@]}"; do
+ echo "Updating $dir"
+
+ cd "$dir"
+ sed -i.bak "/^collab[[:alnum:]-]*[[:space:]]*=/s/rev = \"[a-fA-F0-9]\{6,40\}\"/rev = \"$NEW_REV\"/g" Cargo.toml
+
+ # Detect changed crates
+ collab_crates=($(grep -E '^collab[a-zA-Z0-9_-]* =' Cargo.toml | awk -F'=' '{print $1}' | tr -d ' '))
+
+ # Update only the changed crates in Cargo.lock
+ for crate in "${collab_crates[@]}"; do
+ echo "Updating $crate"
+ cargo update -p $crate
+ done
+
+ cd ..
+done
+
diff --git a/shared-lib/Cargo.lock b/shared-lib/Cargo.lock
index 451d38cb10..ffd5a62872 100644
--- a/shared-lib/Cargo.lock
+++ b/shared-lib/Cargo.lock
@@ -46,29 +46,12 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi 0.1.19",
- "libc",
- "winapi",
-]
-
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-[[package]]
-name = "base64"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
-
[[package]]
name = "basic-toml"
version = "0.1.2"
@@ -99,15 +82,6 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-[[package]]
-name = "block-buffer"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
-dependencies = [
- "generic-array",
-]
-
[[package]]
name = "block-buffer"
version = "0.10.4"
@@ -133,12 +107,6 @@ version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
-[[package]]
-name = "byteorder"
-version = "1.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
-
[[package]]
name = "bytes"
version = "1.4.0"
@@ -327,22 +295,13 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
-[[package]]
-name = "digest"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
-dependencies = [
- "generic-array",
-]
-
[[package]]
name = "digest"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
- "block-buffer 0.10.4",
+ "block-buffer",
"crypto-common",
]
@@ -358,19 +317,6 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
-[[package]]
-name = "env_logger"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
-dependencies = [
- "atty",
- "humantime",
- "log",
- "regex",
- "termcolor",
-]
-
[[package]]
name = "errno"
version = "0.3.1"
@@ -479,104 +425,12 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-[[package]]
-name = "form_urlencoded"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
-dependencies = [
- "percent-encoding",
-]
-
-[[package]]
-name = "futures"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-channel"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
-dependencies = [
- "futures-core",
- "futures-sink",
-]
-
[[package]]
name = "futures-core"
version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
-[[package]]
-name = "futures-executor"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
-dependencies = [
- "futures-core",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-io"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
-
-[[package]]
-name = "futures-macro"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "futures-sink"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
-
-[[package]]
-name = "futures-task"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
-
-[[package]]
-name = "futures-util"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-macro",
- "futures-sink",
- "futures-task",
- "memchr",
- "pin-project-lite",
- "pin-utils",
- "slab",
-]
-
[[package]]
name = "generic-array"
version = "0.14.4"
@@ -669,23 +523,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
-[[package]]
-name = "http"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b"
-dependencies = [
- "bytes",
- "fnv",
- "itoa",
-]
-
-[[package]]
-name = "httparse"
-version = "1.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"
-
[[package]]
name = "humansize"
version = "2.1.3"
@@ -695,12 +532,6 @@ dependencies = [
"libm",
]
-[[package]]
-name = "humantime"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
-
[[package]]
name = "iana-time-zone"
version = "0.1.53"
@@ -725,16 +556,6 @@ dependencies = [
"cxx-build",
]
-[[package]]
-name = "idna"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
-dependencies = [
- "unicode-bidi",
- "unicode-normalization",
-]
-
[[package]]
name = "ignore"
version = "0.4.20"
@@ -851,32 +672,6 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "lib-ws"
-version = "0.1.0"
-dependencies = [
- "bytes",
- "dashmap",
- "env_logger",
- "futures",
- "futures-channel",
- "futures-core",
- "futures-util",
- "lib-infra",
- "log",
- "parking_lot",
- "pin-project",
- "protobuf",
- "serde",
- "serde_json",
- "serde_repr",
- "strum_macros",
- "tokio",
- "tokio-tungstenite",
- "tracing",
- "url",
-]
-
[[package]]
name = "libc"
version = "0.2.139"
@@ -981,12 +776,6 @@ version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
-[[package]]
-name = "opaque-debug"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
-
[[package]]
name = "os_pipe"
version = "0.9.2"
@@ -1188,12 +977,6 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
[[package]]
name = "ppv-lite86"
version = "0.2.15"
@@ -1523,30 +1306,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "serde_repr"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.109",
-]
-
-[[package]]
-name = "sha-1"
-version = "0.9.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"
-dependencies = [
- "block-buffer 0.9.0",
- "cfg-if",
- "cpufeatures",
- "digest 0.9.0",
- "opaque-debug",
-]
-
[[package]]
name = "sha2"
version = "0.10.6"
@@ -1555,7 +1314,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
- "digest 0.10.6",
+ "digest",
]
[[package]]
@@ -1579,12 +1338,6 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
-[[package]]
-name = "slab"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
-
[[package]]
name = "slug"
version = "0.1.4"
@@ -1734,21 +1487,6 @@ dependencies = [
"once_cell",
]
-[[package]]
-name = "tinyvec"
-version = "1.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
-dependencies = [
- "tinyvec_macros",
-]
-
-[[package]]
-name = "tinyvec_macros"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
-
[[package]]
name = "tokio"
version = "1.26.0"
@@ -1780,19 +1518,6 @@ dependencies = [
"syn 1.0.109",
]
-[[package]]
-name = "tokio-tungstenite"
-version = "0.15.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "511de3f85caf1c98983545490c3d09685fa8eb634e57eec22bb4db271f46cbd8"
-dependencies = [
- "futures-util",
- "log",
- "pin-project",
- "tokio",
- "tungstenite",
-]
-
[[package]]
name = "toml"
version = "0.5.11"
@@ -1850,25 +1575,6 @@ dependencies = [
"termcolor",
]
-[[package]]
-name = "tungstenite"
-version = "0.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0b2d8558abd2e276b0a8df5c05a2ec762609344191e5fd23e292c910e9165b5"
-dependencies = [
- "base64",
- "byteorder",
- "bytes",
- "http",
- "httparse",
- "log",
- "rand 0.8.5",
- "sha-1",
- "thiserror",
- "url",
- "utf-8",
-]
-
[[package]]
name = "typenum"
version = "1.14.0"
@@ -1940,27 +1646,12 @@ dependencies = [
"unic-common",
]
-[[package]]
-name = "unicode-bidi"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
-
[[package]]
name = "unicode-ident"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
-[[package]]
-name = "unicode-normalization"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
-dependencies = [
- "tinyvec",
-]
-
[[package]]
name = "unicode-segmentation"
version = "1.10.1"
@@ -1973,23 +1664,6 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
-[[package]]
-name = "url"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
-dependencies = [
- "form_urlencoded",
- "idna",
- "percent-encoding",
-]
-
-[[package]]
-name = "utf-8"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
-
[[package]]
name = "version_check"
version = "0.9.3"
diff --git a/shared-lib/Cargo.toml b/shared-lib/Cargo.toml
index a22f84d67c..82438fe2e4 100644
--- a/shared-lib/Cargo.toml
+++ b/shared-lib/Cargo.toml
@@ -1,7 +1,6 @@
[workspace]
members = [
"lib-ot",
- "lib-ws",
"lib-infra",
"flowy-derive",
"flowy-ast",
diff --git a/shared-lib/lib-infra/Cargo.toml b/shared-lib/lib-infra/Cargo.toml
index 5d4a7d644b..8b76c804e4 100644
--- a/shared-lib/lib-infra/Cargo.toml
+++ b/shared-lib/lib-infra/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-chrono = { version = "0.4.22", default-features = false, features = ["clock"] }
+chrono = { version = "0.4.27", default-features = false, features = ["clock"] }
bytes = { version = "1.4" }
pin-project = "1.0.12"
futures-core = { version = "0.3" }
diff --git a/shared-lib/lib-ws/Cargo.toml b/shared-lib/lib-ws/Cargo.toml
deleted file mode 100644
index 0191ea4fa5..0000000000
--- a/shared-lib/lib-ws/Cargo.toml
+++ /dev/null
@@ -1,32 +0,0 @@
-[package]
-name = "lib-ws"
-version = "0.1.0"
-edition = "2018"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-serde_repr = "0.1"
-serde = "1.0"
-serde_json = {version = "1.0"}
-lib-infra = { path = "../lib-infra" }
-
-tokio-tungstenite = "0.15"
-futures-util = "0.3.26"
-futures-channel = "0.3.26"
-tokio = { version = "1.26", features = ["full"]}
-futures = "0.3.26"
-bytes = "1.4"
-pin-project = "1.0"
-futures-core = { version = "0.3", default-features = false }
-url = "2.3.1"
-log = "0.4"
-tracing = { version = "0.1", features = ["log"] }
-protobuf = {version = "2.28.0"}
-strum_macros = "0.21"
-parking_lot = "0.12.1"
-dashmap = "5"
-
-[dev-dependencies]
-tokio = { version = "1.26", features = ["full"]}
-env_logger = "0.8.4"
diff --git a/shared-lib/lib-ws/src/connect.rs b/shared-lib/lib-ws/src/connect.rs
deleted file mode 100644
index 7863cb4859..0000000000
--- a/shared-lib/lib-ws/src/connect.rs
+++ /dev/null
@@ -1,223 +0,0 @@
-#![allow(clippy::all)]
-use crate::{
- errors::{internal_error, WSError},
- MsgReceiver, MsgSender,
-};
-use futures_core::{future::BoxFuture, ready};
-use futures_util::{FutureExt, StreamExt};
-use pin_project::pin_project;
-use std::{
- fmt,
- future::Future,
- pin::Pin,
- task::{Context, Poll},
-};
-use tokio::net::TcpStream;
-use tokio_tungstenite::{
- connect_async,
- tungstenite::{handshake::client::Response, Error, Message},
- MaybeTlsStream, WebSocketStream,
-};
-
-type WsConnectResult = Result<(WebSocketStream<MaybeTlsStream<TcpStream>>, Response), Error>;
-
-#[pin_project]
-pub struct WSConnectionFuture {
- msg_tx: Option<MsgSender>,
- ws_rx: Option<MsgReceiver>,
- #[pin]
- fut: Pin<Box<dyn Future<Output = WsConnectResult> + Send + Sync>>,
-}
-
-impl WSConnectionFuture {
- pub fn new(msg_tx: MsgSender, ws_rx: MsgReceiver, addr: String) -> Self {
- WSConnectionFuture {
- msg_tx: Some(msg_tx),
- ws_rx: Some(ws_rx),
- fut: Box::pin(async move { connect_async(&addr).await }),
- }
- }
-}
-
-impl Future for WSConnectionFuture {
- type Output = Result<WSStream, WSError>;
- fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
- // [[pin]]
- // poll async function. The following methods not work.
- // 1.
- // let f = connect_async("");
- // pin_mut!(f);
- // ready!(Pin::new(&mut a).poll(cx))
- //
- // 2.ready!(Pin::new(&mut Box::pin(connect_async(""))).poll(cx))
- //
- // An async method calls poll multiple times and might return to the executor. A
- // single poll call can only return to the executor once and will get
- // resumed through another poll invocation. the connect_async call multiple time
- // from the beginning. So I use fut to hold the future and continue to
- // poll it. (Fix me if i was wrong)
- loop {
- return match ready!(self.as_mut().project().fut.poll(cx)) {
- Ok((stream, _)) => {
- tracing::debug!("[WebSocket]: connect success");
- let (msg_tx, ws_rx) = (
- self
- .msg_tx
- .take()
- .expect("[WebSocket]: WSConnection should be call once "),
- self
- .ws_rx
- .take()
- .expect("[WebSocket]: WSConnection should be call once "),
- );
- Poll::Ready(Ok(WSStream::new(msg_tx, ws_rx, stream)))
- },
- Err(error) => {
- tracing::debug!("[WebSocket]: ❌ connect failed: {:?}", error);
- Poll::Ready(Err(error.into()))
- },
- };
- }
- }
-}
-
-type Fut = BoxFuture<'static, Result<(), WSError>>;
-#[pin_project]
-pub struct WSStream {
- #[allow(dead_code)]
- msg_tx: MsgSender,
- #[pin]
- inner: Option<(Fut, Fut)>,
-}
-
-impl WSStream {
- pub fn new(
- msg_tx: MsgSender,
- ws_rx: MsgReceiver,
- stream: WebSocketStream<MaybeTlsStream<TcpStream>>,
- ) -> Self {
- let (ws_write, ws_read) = stream.split();
- Self {
- msg_tx: msg_tx.clone(),
- inner: Some((
- Box::pin(async move {
- let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
- let read = async {
- ws_read
- .for_each(|message| async {
- match tx.send(send_message(msg_tx.clone(), message)) {
- Ok(_) => {},
- Err(e) => log::error!("[WebSocket]: WSStream sender closed unexpectedly: {} ", e),
- }
- })
- .await;
- Ok(())
- };
-
- let read_ret = async {
- loop {
- match rx.recv().await {
- None => {
- return Err(
- WSError::internal()
- .context("[WebSocket]: WSStream receiver closed unexpectedly"),
- );
- },
- Some(result) => {
- if result.is_err() {
- return result;
- }
- },
- }
- }
- };
- futures::pin_mut!(read);
- futures::pin_mut!(read_ret);
- return tokio::select! {
- result = read => result,
- result = read_ret => result,
- };
- }),
- Box::pin(async move {
- let result = ws_rx
- .map(Ok)
- .forward(ws_write)
- .await
- .map_err(internal_error);
- result
- }),
- )),
- }
- }
-}
-
-impl fmt::Debug for WSStream {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("WSStream").finish()
- }
-}
-
-impl Future for WSStream {
- type Output = Result<(), WSError>;
-
- fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
- let (mut ws_read, mut ws_write) = self.inner.take().unwrap();
- match ws_read.poll_unpin(cx) {
- Poll::Ready(l) => Poll::Ready(l),
- Poll::Pending => {
- //
- match ws_write.poll_unpin(cx) {
- Poll::Ready(r) => Poll::Ready(r),
- Poll::Pending => {
- self.inner = Some((ws_read, ws_write));
- Poll::Pending
- },
- }
- },
- }
- }
-}
-
-fn send_message(msg_tx: MsgSender, message: Result<Message, Error>) -> Result<(), WSError> {
- match message {
- Ok(Message::Binary(bytes)) => msg_tx
- .unbounded_send(Message::Binary(bytes))
- .map_err(internal_error),
- Ok(_) => Ok(()),
- Err(e) => Err(WSError::internal().context(e)),
- }
-}
-#[allow(dead_code)]
-pub struct Retry<F> {
- f: F,
- #[allow(dead_code)]
- retry_time: usize,
- addr: String,
-}
-
-impl<F> Retry<F>
-where
- F: Fn(&str),
-{
- #[allow(dead_code)]
- pub fn new(addr: &str, f: F) -> Self {
- Self {
- f,
- retry_time: 3,
- addr: addr.to_owned(),
- }
- }
-}
-
-impl<F> Future for Retry<F>
-where
- F: Fn(&str),
-{
- type Output = ();
-
- fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
- (self.f)(&self.addr);
-
- Poll::Ready(())
- }
-}
diff --git a/shared-lib/lib-ws/src/errors.rs b/shared-lib/lib-ws/src/errors.rs
deleted file mode 100644
index 2591dc1661..0000000000
--- a/shared-lib/lib-ws/src/errors.rs
+++ /dev/null
@@ -1,101 +0,0 @@
-use futures_channel::mpsc::TrySendError;
-use serde::{Deserialize, Serialize};
-use serde_repr::*;
-use std::fmt::Debug;
-use strum_macros::Display;
-use tokio::sync::oneshot::error::RecvError;
-use tokio_tungstenite::tungstenite::{http::StatusCode, Message};
-use url::ParseError;
-
-#[derive(Debug, Default, Clone, Serialize, Deserialize)]
-pub struct WSError {
- pub code: ErrorCode,
- pub msg: String,
-}
-
-macro_rules! static_ws_error {
- ($name:ident, $status:expr) => {
- #[allow(non_snake_case, missing_docs)]
- pub fn $name() -> WSError {
- WSError {
- code: $status,
- msg: format!("{}", $status),
- }
- }
- };
-}
-
-impl WSError {
- #[allow(dead_code)]
- pub(crate) fn new(code: ErrorCode) -> WSError {
- WSError {
- code,
- msg: "".to_string(),
- }
- }
-
- pub fn context<T: Debug>(mut self, error: T) -> Self {
- self.msg = format!("{:?}", error);
- self
- }
-
- static_ws_error!(internal, ErrorCode::InternalError);
- static_ws_error!(unsupported_message, ErrorCode::UnsupportedMessage);
- static_ws_error!(unauthorized, ErrorCode::Unauthorized);
-}
-
-pub(crate) fn internal_error<T>(e: T) -> WSError
-where
- T: std::fmt::Debug,
-{
- WSError::internal().context(e)
-}
-
-#[derive(Debug, Clone, Serialize_repr, Deserialize_repr, Display, PartialEq, Eq)]
-#[repr(u8)]
-#[derive(Default)]
-pub enum ErrorCode {
- #[default]
- InternalError = 0,
- UnsupportedMessage = 1,
- Unauthorized = 2,
-}
-
-impl std::convert::From<url::ParseError> for WSError {
- fn from(error: ParseError) -> Self {
- WSError::internal().context(error)
- }
-}
-
-impl std::convert::From<protobuf::ProtobufError> for WSError {
- fn from(error: protobuf::ProtobufError) -> Self {
- WSError::internal().context(error)
- }
-}
-
-impl std::convert::From<futures_channel::mpsc::TrySendError<Message>> for WSError {
- fn from(error: TrySendError<Message>) -> Self {
- WSError::internal().context(error)
- }
-}
-
-impl std::convert::From<RecvError> for WSError {
- fn from(error: RecvError) -> Self {
- WSError::internal().context(error)
- }
-}
-
-impl std::convert::From<tokio_tungstenite::tungstenite::Error> for WSError {
- fn from(error: tokio_tungstenite::tungstenite::Error) -> Self {
- match error {
- tokio_tungstenite::tungstenite::Error::Http(response) => {
- if response.status() == StatusCode::UNAUTHORIZED {
- WSError::unauthorized()
- } else {
- WSError::internal().context(response)
- }
- },
- _ => WSError::internal().context(error),
- }
- }
-}
diff --git a/shared-lib/lib-ws/src/lib.rs b/shared-lib/lib-ws/src/lib.rs
deleted file mode 100644
index d1be0a9f37..0000000000
--- a/shared-lib/lib-ws/src/lib.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-pub mod connect;
-pub mod errors;
-mod msg;
-mod ws;
-
-pub use msg::*;
-pub use ws::*;
diff --git a/shared-lib/lib-ws/src/msg.rs b/shared-lib/lib-ws/src/msg.rs
deleted file mode 100644
index cc1c78a749..0000000000
--- a/shared-lib/lib-ws/src/msg.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-use serde::{Deserialize, Serialize};
-use serde_repr::*;
-use tokio_tungstenite::tungstenite::Message as TokioMessage;
-
-#[derive(Serialize, Deserialize, Debug, Clone, Default)]
-pub struct WebSocketRawMessage {
- pub channel: WSChannel,
- pub data: Vec<u8>,
-}
-
-impl WebSocketRawMessage {
- pub fn to_bytes(&self) -> Vec<u8> {
- serde_json::to_vec(&self).unwrap_or_default()
- }
-
- pub fn from_bytes<T: AsRef<[u8]>>(bytes: T) -> Self {
- serde_json::from_slice(bytes.as_ref()).unwrap_or_default()
- }
-}
-
-// The lib-ws crate should not contain business logic.So WSChannel should be removed into another place.
-#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Eq, PartialEq, Hash)]
-#[repr(u8)]
-#[derive(Default)]
-pub enum WSChannel {
- #[default]
- Document = 0,
- Folder = 1,
- Database = 2,
-}
-
-impl ToString for WSChannel {
- fn to_string(&self) -> String {
- match self {
- WSChannel::Document => "0".to_string(),
- WSChannel::Folder => "1".to_string(),
- WSChannel::Database => "2".to_string(),
- }
- }
-}
-
-impl std::convert::From<WebSocketRawMessage> for TokioMessage {
- fn from(msg: WebSocketRawMessage) -> Self {
- TokioMessage::Binary(msg.to_bytes())
- }
-}
diff --git a/shared-lib/lib-ws/src/ws.rs b/shared-lib/lib-ws/src/ws.rs
deleted file mode 100644
index c589bc3dac..0000000000
--- a/shared-lib/lib-ws/src/ws.rs
+++ /dev/null
@@ -1,435 +0,0 @@
-#![allow(clippy::type_complexity)]
-use crate::{
- connect::{WSConnectionFuture, WSStream},
- errors::WSError,
- WSChannel, WebSocketRawMessage,
-};
-use dashmap::DashMap;
-use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
-use futures_core::{ready, Stream};
-use lib_infra::retry::{Action, FixedInterval, Retry};
-use pin_project::pin_project;
-use std::{
- fmt::Formatter,
- future::Future,
- pin::Pin,
- sync::Arc,
- task::{Context, Poll},
- time::Duration,
-};
-use tokio::sync::{broadcast, oneshot, RwLock};
-use tokio_tungstenite::tungstenite::{
- protocol::{frame::coding::CloseCode, CloseFrame},
- Message,
-};
-
-pub type MsgReceiver = UnboundedReceiver<Message>;
-pub type MsgSender = UnboundedSender<Message>;
-type Handlers = DashMap<WSChannel, Arc<dyn WSMessageReceiver>>;
-
-pub trait WSMessageReceiver: Sync + Send + 'static {
- fn source(&self) -> WSChannel;
- fn receive_message(&self, msg: WebSocketRawMessage);
-}
-
-pub struct WSController {
- handlers: Handlers,
- addr: Arc<RwLock<Option<String>>>,
- sender: Arc<RwLock<Option<Arc<WSSender>>>>,
- conn_state_notify: Arc<RwLock<WSConnectStateNotifier>>,
-}
-
-impl std::fmt::Display for WSController {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- f.write_str("WebSocket")
- }
-}
-
-impl std::default::Default for WSController {
- fn default() -> Self {
- Self {
- handlers: DashMap::new(),
- addr: Arc::new(RwLock::new(None)),
- sender: Arc::new(RwLock::new(None)),
- conn_state_notify: Arc::new(RwLock::new(WSConnectStateNotifier::default())),
- }
- }
-}
-
-impl WSController {
- pub fn new() -> Self {
- WSController::default()
- }
-
- pub fn add_ws_message_receiver(
- &self,
- handler: Arc<dyn WSMessageReceiver>,
- ) -> Result<(), WSError> {
- let source = handler.source();
- if self.handlers.contains_key(&source) {
- log::error!("{:?} is already registered", source);
- }
- self.handlers.insert(source, handler);
- Ok(())
- }
-
- pub async fn start(&self, addr: String) -> Result<(), WSError> {
- *self.addr.write().await = Some(addr.clone());
- let strategy = FixedInterval::from_millis(5000).take(3);
- self.connect(addr, strategy).await
- }
-
- pub async fn stop(&self) {
- if self
- .conn_state_notify
- .read()
- .await
- .conn_state
- .is_connected()
- {
- tracing::trace!("[{}] stop", self);
- self
- .conn_state_notify
- .write()
- .await
- .update_state(WSConnectState::Disconnected);
- }
- }
-
- async fn connect<T, I>(&self, addr: String, strategy: T) -> Result<(), WSError>
- where
- T: IntoIterator<IntoIter = I, Item = Duration>,
- I: Iterator<Item = Duration> + Send + 'static,
- {
- let mut conn_state_notify = self.conn_state_notify.write().await;
- let conn_state = conn_state_notify.conn_state.clone();
- if conn_state.is_connected() || conn_state.is_connecting() {
- return Ok(());
- }
-
- let (ret, rx) = oneshot::channel::<Result<(), WSError>>();
- *self.addr.write().await = Some(addr.clone());
- let action = WSConnectAction {
- addr,
- handlers: self.handlers.clone(),
- };
- let retry = Retry::new(strategy, action);
- conn_state_notify.update_state(WSConnectState::Connecting);
- drop(conn_state_notify);
-
- let cloned_conn_state = self.conn_state_notify.clone();
- let cloned_sender = self.sender.clone();
- tracing::trace!("[{}] start connecting", self);
- tokio::spawn(async move {
- match retry.await {
- Ok(result) => {
- let WSConnectResult {
- stream,
- handlers_fut,
- sender,
- } = result;
-
- cloned_conn_state
- .write()
- .await
- .update_state(WSConnectState::Connected);
- *cloned_sender.write().await = Some(Arc::new(sender));
-
- let _ = ret.send(Ok(()));
- spawn_stream_and_handlers(stream, handlers_fut).await;
- },
- Err(e) => {
- cloned_conn_state
- .write()
- .await
- .update_state(WSConnectState::Disconnected);
- let _ = ret.send(Err(WSError::internal().context(e)));
- },
- }
- });
- rx.await?
- }
-
- pub async fn retry(&self, count: usize) -> Result<(), WSError> {
- if !self
- .conn_state_notify
- .read()
- .await
- .conn_state
- .is_disconnected()
- {
- return Ok(());
- }
-
- tracing::trace!("[WebSocket]: retry connect...");
- let strategy = FixedInterval::from_millis(5000).take(count);
- let addr = self
- .addr
- .read()
- .await
- .as_ref()
- .expect("Retry web socket connection failed, should call start_connect first")
- .clone();
-
- self.connect(addr, strategy).await
- }
-
- pub async fn subscribe_state(&self) -> broadcast::Receiver<WSConnectState> {
- self.conn_state_notify.read().await.notify.subscribe()
- }
-
- pub async fn ws_message_sender(&self) -> Result<Option<Arc<WSSender>>, WSError> {
- let sender = self.sender.read().await.clone();
- match sender {
- None => match self.conn_state_notify.read().await.conn_state {
- WSConnectState::Disconnected => {
- let msg = "WebSocket is disconnected";
- Err(WSError::internal().context(msg))
- },
- _ => Ok(None),
- },
- Some(sender) => Ok(Some(sender)),
- }
- }
-}
-
-async fn spawn_stream_and_handlers(stream: WSStream, handlers: WSHandlerFuture) {
- tokio::select! {
- result = stream => {
- if let Err(e) = result {
- tracing::error!("WSStream error: {:?}", e);
- }
- },
- result = handlers => tracing::debug!("handlers completed {:?}", result),
- };
-}
-
-#[pin_project]
-pub struct WSHandlerFuture {
- #[pin]
- msg_rx: MsgReceiver,
- handlers: Handlers,
-}
-
-impl WSHandlerFuture {
- fn new(handlers: Handlers, msg_rx: MsgReceiver) -> Self {
- Self { msg_rx, handlers }
- }
-
- fn handler_ws_message(&self, message: Message) {
- if let Message::Binary(bytes) = message {
- self.handle_binary_message(bytes)
- }
- }
-
- fn handle_binary_message(&self, bytes: Vec<u8>) {
- let msg = WebSocketRawMessage::from_bytes(bytes);
- match self.handlers.get(&msg.channel) {
- None => log::error!("Can't find any handler for message: {:?}", msg),
- Some(handler) => handler.receive_message(msg),
- }
- }
-}
-
-impl Future for WSHandlerFuture {
- type Output = ();
- fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
- loop {
- match ready!(self.as_mut().project().msg_rx.poll_next(cx)) {
- None => {
- return Poll::Ready(());
- },
- Some(message) => self.handler_ws_message(message),
- }
- }
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct WSSender(MsgSender);
-
-impl WSSender {
- pub fn send_msg<T: Into<WebSocketRawMessage>>(&self, msg: T) -> Result<(), WSError> {
- let msg = msg.into();
- self
- .0
- .unbounded_send(msg.into())
- .map_err(|e| WSError::internal().context(e))?;
- Ok(())
- }
-
- pub fn send_text(&self, source: &WSChannel, text: &str) -> Result<(), WSError> {
- let msg = WebSocketRawMessage {
- channel: source.clone(),
- data: text.as_bytes().to_vec(),
- };
- self.send_msg(msg)
- }
-
- pub fn send_binary(&self, source: &WSChannel, bytes: Vec<u8>) -> Result<(), WSError> {
- let msg = WebSocketRawMessage {
- channel: source.clone(),
- data: bytes,
- };
- self.send_msg(msg)
- }
-
- pub fn send_disconnect(&self, reason: &str) -> Result<(), WSError> {
- let frame = CloseFrame {
- code: CloseCode::Normal,
- reason: reason.to_owned().into(),
- };
- let msg = Message::Close(Some(frame));
- self
- .0
- .unbounded_send(msg)
- .map_err(|e| WSError::internal().context(e))?;
- Ok(())
- }
-}
-
-struct WSConnectAction {
- addr: String,
- handlers: Handlers,
-}
-
-impl Action for WSConnectAction {
- type Future = Pin<Box<dyn Future<Output = Result<Self::Item, Self::Error>> + Send + Sync>>;
- type Item = WSConnectResult;
- type Error = WSError;
-
- fn run(&mut self) -> Self::Future {
- let addr = self.addr.clone();
- let handlers = self.handlers.clone();
- Box::pin(WSConnectActionFut::new(addr, handlers))
- }
-}
-
-struct WSConnectResult {
- stream: WSStream,
- handlers_fut: WSHandlerFuture,
- sender: WSSender,
-}
-
-#[pin_project]
-struct WSConnectActionFut {
- addr: String,
- #[pin]
- conn: WSConnectionFuture,
- handlers_fut: Option<WSHandlerFuture>,
- sender: Option<WSSender>,
-}
-
-impl WSConnectActionFut {
- fn new(addr: String, handlers: Handlers) -> Self {
- // Stream User
- // ┌───────────────┐ ┌──────────────┐
- // ┌──────┐ │ ┌─────────┐ │ ┌────────┐ │ ┌────────┐ │
- // │Server│──────┼─▶│ ws_read │──┼───▶│ msg_tx │───┼─▶│ msg_rx │ │
- // └──────┘ │ └─────────┘ │ └────────┘ │ └────────┘ │
- // ▲ │ │ │ │
- // │ │ ┌─────────┐ │ ┌────────┐ │ ┌────────┐ │
- // └─────────┼──│ws_write │◀─┼────│ ws_rx │◀──┼──│ ws_tx │ │
- // │ └─────────┘ │ └────────┘ │ └────────┘ │
- // └───────────────┘ └──────────────┘
- let (msg_tx, msg_rx) = futures_channel::mpsc::unbounded();
- let (ws_tx, ws_rx) = futures_channel::mpsc::unbounded();
- let sender = WSSender(ws_tx);
- let handlers_fut = WSHandlerFuture::new(handlers, msg_rx);
- let conn = WSConnectionFuture::new(msg_tx, ws_rx, addr.clone());
- Self {
- addr,
- conn,
- handlers_fut: Some(handlers_fut),
- sender: Some(sender),
- }
- }
-}
-
-impl Future for WSConnectActionFut {
- type Output = Result<WSConnectResult, WSError>;
- fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
- let mut this = self.project();
- match ready!(this.conn.as_mut().poll(cx)) {
- Ok(stream) => {
- let handlers_fut = this.handlers_fut.take().expect("Only take once");
- let sender = this.sender.take().expect("Only take once");
- Poll::Ready(Ok(WSConnectResult {
- stream,
- handlers_fut,
- sender,
- }))
- },
- Err(e) => Poll::Ready(Err(e)),
- }
- }
-}
-
-#[derive(Clone, Eq, PartialEq)]
-pub enum WSConnectState {
- Init,
- Connecting,
- Connected,
- Disconnected,
-}
-
-impl WSConnectState {
- fn is_connected(&self) -> bool {
- self == &WSConnectState::Connected
- }
-
- fn is_connecting(&self) -> bool {
- self == &WSConnectState::Connecting
- }
-
- fn is_disconnected(&self) -> bool {
- self == &WSConnectState::Disconnected || self == &WSConnectState::Init
- }
-}
-
-impl std::fmt::Display for WSConnectState {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- match self {
- WSConnectState::Init => f.write_str("Init"),
- WSConnectState::Connected => f.write_str("Connected"),
- WSConnectState::Connecting => f.write_str("Connecting"),
- WSConnectState::Disconnected => f.write_str("Disconnected"),
- }
- }
-}
-
-impl std::fmt::Debug for WSConnectState {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- f.write_str(&format!("{}", self))
- }
-}
-
-struct WSConnectStateNotifier {
- conn_state: WSConnectState,
- notify: Arc<broadcast::Sender<WSConnectState>>,
-}
-
-impl std::default::Default for WSConnectStateNotifier {
- fn default() -> Self {
- let (state_notify, _) = broadcast::channel(16);
- Self {
- conn_state: WSConnectState::Init,
- notify: Arc::new(state_notify),
- }
- }
-}
-
-impl WSConnectStateNotifier {
- fn update_state(&mut self, new_state: WSConnectState) {
- if self.conn_state == new_state {
- return;
- }
- tracing::debug!(
- "WebSocket connect state did change: {} -> {}",
- self.conn_state,
- new_state
- );
- self.conn_state = new_state.clone();
- let _ = self.notify.send(new_state);
- }
-}