mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: add invitation api cloud services
This commit is contained in:
parent
d0c647203c
commit
162a875f46
34
frontend/appflowy_tauri/src-tauri/Cargo.lock
generated
34
frontend/appflowy_tauri/src-tauri/Cargo.lock
generated
@ -162,7 +162,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
|
||||
[[package]]
|
||||
name = "app-error"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -714,7 +714,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "client-api"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"again",
|
||||
"anyhow",
|
||||
@ -741,6 +741,7 @@ dependencies = [
|
||||
"realtime-protocol",
|
||||
"reqwest",
|
||||
"scraper 0.17.1",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
@ -1201,7 +1202,7 @@ dependencies = [
|
||||
"cssparser-macros",
|
||||
"dtoa-short",
|
||||
"itoa 1.0.6",
|
||||
"phf 0.11.2",
|
||||
"phf 0.8.0",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
@ -1312,7 +1313,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
|
||||
[[package]]
|
||||
name = "database-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -2586,7 +2587,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gotrue"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures-util",
|
||||
@ -2603,7 +2604,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gotrue-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -3058,7 +3059,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "infra"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"reqwest",
|
||||
@ -4789,7 +4790,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "realtime-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -4813,7 +4814,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "realtime-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -5282,9 +5283,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -5461,7 +5462,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "shared-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -6204,9 +6205,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
version = "1.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -6956,13 +6957,14 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
|
||||
[[package]]
|
||||
name = "websocket"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"httparse",
|
||||
"js-sys",
|
||||
"percent-encoding",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
@ -7375,7 +7377,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "workspace-template"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -82,7 +82,7 @@ custom-protocol = ["tauri/custom-protocol"]
|
||||
# Run the script:
|
||||
# scripts/tool/update_client_api_rev.sh new_rev_id
|
||||
# ⚠️⚠️⚠️️
|
||||
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "15c03e4f85fffd35089a82c2a84aca8042a38946" }
|
||||
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eed20c25197109a3f799a5d18d0e38e9f5529d69" }
|
||||
# Please use the following script to update collab.
|
||||
# Working directory: frontend
|
||||
#
|
||||
|
50
frontend/appflowy_web/wasm-libs/Cargo.lock
generated
50
frontend/appflowy_web/wasm-libs/Cargo.lock
generated
@ -221,7 +221,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
|
||||
[[package]]
|
||||
name = "app-error"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -545,7 +545,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "client-api"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"again",
|
||||
"anyhow",
|
||||
@ -572,6 +572,7 @@ dependencies = [
|
||||
"realtime-protocol",
|
||||
"reqwest",
|
||||
"scraper 0.17.1",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
@ -900,7 +901,7 @@ dependencies = [
|
||||
"cssparser-macros",
|
||||
"dtoa-short",
|
||||
"itoa",
|
||||
"phf 0.11.2",
|
||||
"phf 0.8.0",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
@ -945,7 +946,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
|
||||
[[package]]
|
||||
name = "database-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -1699,7 +1700,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gotrue"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures-util",
|
||||
@ -1716,7 +1717,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gotrue-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -2050,7 +2051,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "infra"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"reqwest",
|
||||
@ -2779,7 +2780,7 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
|
||||
dependencies = [
|
||||
"phf_macros 0.8.0",
|
||||
"phf_macros",
|
||||
"phf_shared 0.8.0",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
@ -2799,7 +2800,6 @@ version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
|
||||
dependencies = [
|
||||
"phf_macros 0.11.2",
|
||||
"phf_shared 0.11.2",
|
||||
]
|
||||
|
||||
@ -2867,19 +2867,6 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_macros"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
|
||||
dependencies = [
|
||||
"phf_generator 0.11.2",
|
||||
"phf_shared 0.11.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.8.0"
|
||||
@ -3308,7 +3295,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "realtime-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -3332,7 +3319,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "realtime-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -3665,6 +3652,12 @@ dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.195"
|
||||
@ -3779,7 +3772,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "shared-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -4145,9 +4138,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
version = "1.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -4721,13 +4714,14 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"
|
||||
[[package]]
|
||||
name = "websocket"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"httparse",
|
||||
"js-sys",
|
||||
"percent-encoding",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
|
@ -55,7 +55,7 @@ codegen-units = 1
|
||||
# Run the script:
|
||||
# scripts/tool/update_client_api_rev.sh new_rev_id
|
||||
# ⚠️⚠️⚠️️
|
||||
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "15c03e4f85fffd35089a82c2a84aca8042a38946" }
|
||||
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eed20c25197109a3f799a5d18d0e38e9f5529d69" }
|
||||
# Please use the following script to update collab.
|
||||
# Working directory: frontend
|
||||
#
|
||||
|
52
frontend/rust-lib/Cargo.lock
generated
52
frontend/rust-lib/Cargo.lock
generated
@ -163,7 +163,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
|
||||
[[package]]
|
||||
name = "app-error"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -673,7 +673,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "client-api"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"again",
|
||||
"anyhow",
|
||||
@ -700,6 +700,7 @@ dependencies = [
|
||||
"realtime-protocol",
|
||||
"reqwest",
|
||||
"scraper 0.17.1",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
@ -1103,7 +1104,7 @@ dependencies = [
|
||||
"cssparser-macros",
|
||||
"dtoa-short",
|
||||
"itoa",
|
||||
"phf 0.11.2",
|
||||
"phf 0.8.0",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
@ -1236,7 +1237,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
|
||||
[[package]]
|
||||
name = "database-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -2410,7 +2411,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gotrue"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"futures-util",
|
||||
@ -2427,7 +2428,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gotrue-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -2821,7 +2822,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "infra"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"reqwest",
|
||||
@ -3641,7 +3642,7 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
|
||||
dependencies = [
|
||||
"phf_macros 0.8.0",
|
||||
"phf_macros",
|
||||
"phf_shared 0.8.0",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
@ -3661,7 +3662,6 @@ version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
|
||||
dependencies = [
|
||||
"phf_macros 0.11.2",
|
||||
"phf_shared 0.11.2",
|
||||
]
|
||||
|
||||
@ -3729,19 +3729,6 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_macros"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
|
||||
dependencies = [
|
||||
"phf_generator 0.11.2",
|
||||
"phf_shared 0.11.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.47",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.8.0"
|
||||
@ -4318,7 +4305,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "realtime-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -4342,7 +4329,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "realtime-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
@ -4805,6 +4792,12 @@ dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.195"
|
||||
@ -4930,7 +4923,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "shared-entity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"app-error",
|
||||
@ -5364,9 +5357,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
version = "1.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@ -6120,13 +6113,14 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
|
||||
[[package]]
|
||||
name = "websocket"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"httparse",
|
||||
"js-sys",
|
||||
"percent-encoding",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
@ -6360,7 +6354,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "workspace-template"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eed20c25197109a3f799a5d18d0e38e9f5529d69#eed20c25197109a3f799a5d18d0e38e9f5529d69"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
@ -105,7 +105,7 @@ incremental = false
|
||||
# Run the script:
|
||||
# scripts/tool/update_client_api_rev.sh new_rev_id
|
||||
# ⚠️⚠️⚠️️
|
||||
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "15c03e4f85fffd35089a82c2a84aca8042a38946" }
|
||||
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eed20c25197109a3f799a5d18d0e38e9f5529d69" }
|
||||
# Please use the following script to update collab.
|
||||
# Working directory: frontend
|
||||
#
|
||||
|
@ -4,8 +4,11 @@ use std::sync::Arc;
|
||||
use anyhow::{anyhow, Error};
|
||||
use client_api::entity::workspace_dto::{
|
||||
CreateWorkspaceMember, CreateWorkspaceParam, PatchWorkspaceParam, WorkspaceMemberChangeset,
|
||||
WorkspaceMemberInvitation,
|
||||
};
|
||||
use client_api::entity::{
|
||||
AFRole, AFWorkspace, AFWorkspaceInvitation, AuthProvider, CollabParams, CreateCollabParams,
|
||||
};
|
||||
use client_api::entity::{AFRole, AFWorkspace, AuthProvider, CollabParams, CreateCollabParams};
|
||||
use client_api::{Client, ClientConfiguration};
|
||||
use collab::core::collab::CollabDocState;
|
||||
use collab_entity::CollabObject;
|
||||
@ -13,7 +16,10 @@ use parking_lot::RwLock;
|
||||
|
||||
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
|
||||
use flowy_user_pub::cloud::{UserCloudService, UserCollabParams, UserUpdate, UserUpdateReceiver};
|
||||
use flowy_user_pub::entities::*;
|
||||
use flowy_user_pub::entities::{
|
||||
AFCloudOAuthParams, AuthResponse, Role, UpdateUserProfileParams, UserCredentials, UserProfile,
|
||||
UserWorkspace, WorkspaceInvitation, WorkspaceInvitationStatus, WorkspaceMember,
|
||||
};
|
||||
use lib_infra::box_any::BoxAny;
|
||||
use lib_infra::future::FutureResult;
|
||||
use uuid::Uuid;
|
||||
@ -25,6 +31,8 @@ use crate::af_cloud::impls::user::dto::{
|
||||
use crate::af_cloud::impls::user::util::encryption_type_from_profile;
|
||||
use crate::af_cloud::{AFCloudClient, AFServer};
|
||||
|
||||
use super::dto::{from_af_workspace_invitation_status, to_workspace_invitation_status};
|
||||
|
||||
pub(crate) struct AFCloudUserAuthServiceImpl<T> {
|
||||
server: T,
|
||||
user_change_recv: RwLock<Option<tokio::sync::mpsc::Receiver<UserUpdate>>>,
|
||||
@ -173,6 +181,7 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
fn add_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
@ -193,6 +202,55 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
fn invite_workspace_member(
|
||||
&self,
|
||||
invitee_email: String,
|
||||
workspace_id: String,
|
||||
role: Role,
|
||||
) -> FutureResult<(), Error> {
|
||||
let try_get_client = self.server.try_get_client();
|
||||
FutureResult::new(async move {
|
||||
try_get_client?
|
||||
.invite_workspace_members(
|
||||
&workspace_id,
|
||||
vec![WorkspaceMemberInvitation {
|
||||
email: invitee_email,
|
||||
role: to_af_role(role),
|
||||
}],
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn list_workspace_invitations(
|
||||
&self,
|
||||
filter: Option<WorkspaceInvitationStatus>,
|
||||
) -> FutureResult<Vec<WorkspaceInvitation>, Error> {
|
||||
let try_get_client = self.server.try_get_client();
|
||||
let filter = filter.map(to_workspace_invitation_status);
|
||||
|
||||
FutureResult::new(async move {
|
||||
let r = try_get_client?
|
||||
.list_workspace_invitations(filter)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(to_workspace_invitation)
|
||||
.collect();
|
||||
Ok(r)
|
||||
})
|
||||
}
|
||||
|
||||
fn accept_workspace_invitations(&self, invite_id: String) -> FutureResult<(), Error> {
|
||||
let try_get_client = self.server.try_get_client();
|
||||
FutureResult::new(async move {
|
||||
try_get_client?
|
||||
.accept_workspace_invitation(&invite_id)
|
||||
.await?;
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
fn remove_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
@ -360,7 +418,7 @@ async fn get_admin_client(client: &Arc<AFCloudClient>) -> FlowyResult<Client> {
|
||||
client.gotrue_url(),
|
||||
&client.device_id,
|
||||
ClientConfiguration::default(),
|
||||
&client.client_id,
|
||||
&client.client_version.to_string().as_str(),
|
||||
);
|
||||
admin_client
|
||||
.sign_in_password(&admin_email, &admin_password)
|
||||
@ -420,6 +478,18 @@ fn to_user_workspaces(workspaces: Vec<AFWorkspace>) -> Result<Vec<UserWorkspace>
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn to_workspace_invitation(invi: AFWorkspaceInvitation) -> WorkspaceInvitation {
|
||||
WorkspaceInvitation {
|
||||
invite_id: invi.invite_id,
|
||||
workspace_id: invi.workspace_id,
|
||||
workspace_name: invi.workspace_name,
|
||||
inviter_email: invi.inviter_email,
|
||||
inviter_name: invi.inviter_name,
|
||||
status: from_af_workspace_invitation_status(invi.status),
|
||||
updated_at: invi.updated_at,
|
||||
}
|
||||
}
|
||||
|
||||
fn oauth_params_from_box_any(any: BoxAny) -> Result<AFCloudOAuthParams, Error> {
|
||||
let map: HashMap<String, String> = any.unbox_or_error()?;
|
||||
let sign_in_url = map
|
||||
|
@ -1,10 +1,11 @@
|
||||
use anyhow::Error;
|
||||
use client_api::entity::auth_dto::{UpdateUserParams, UserMetaData};
|
||||
use client_api::entity::{AFRole, AFUserProfile, AFWorkspaceMember};
|
||||
use client_api::entity::{AFRole, AFUserProfile, AFWorkspaceInvitationStatus, AFWorkspaceMember};
|
||||
|
||||
use flowy_user_pub::entities::{
|
||||
Authenticator, Role, UpdateUserProfileParams, UserProfile, WorkspaceMember,
|
||||
USER_METADATA_ICON_URL, USER_METADATA_OPEN_AI_KEY, USER_METADATA_STABILITY_AI_KEY,
|
||||
Authenticator, Role, UpdateUserProfileParams, UserProfile, WorkspaceInvitationStatus,
|
||||
WorkspaceMember, USER_METADATA_ICON_URL, USER_METADATA_OPEN_AI_KEY,
|
||||
USER_METADATA_STABILITY_AI_KEY,
|
||||
};
|
||||
|
||||
use crate::af_cloud::impls::user::util::encryption_type_from_profile;
|
||||
@ -90,3 +91,23 @@ pub fn from_af_workspace_member(member: AFWorkspaceMember) -> WorkspaceMember {
|
||||
name: member.name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_workspace_invitation_status(
|
||||
status: WorkspaceInvitationStatus,
|
||||
) -> AFWorkspaceInvitationStatus {
|
||||
match status {
|
||||
WorkspaceInvitationStatus::Pending => AFWorkspaceInvitationStatus::Pending,
|
||||
WorkspaceInvitationStatus::Accepted => AFWorkspaceInvitationStatus::Accepted,
|
||||
WorkspaceInvitationStatus::Rejected => AFWorkspaceInvitationStatus::Rejected,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_af_workspace_invitation_status(
|
||||
status: AFWorkspaceInvitationStatus,
|
||||
) -> WorkspaceInvitationStatus {
|
||||
match status {
|
||||
AFWorkspaceInvitationStatus::Pending => WorkspaceInvitationStatus::Pending,
|
||||
AFWorkspaceInvitationStatus::Accepted => WorkspaceInvitationStatus::Accepted,
|
||||
AFWorkspaceInvitationStatus::Rejected => WorkspaceInvitationStatus::Rejected,
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Error;
|
||||
use client_api::collab_sync::collab_msg::ServerCollabMessage;
|
||||
@ -13,7 +12,7 @@ use client_api::{Client, ClientConfiguration};
|
||||
use flowy_storage::ObjectStorageService;
|
||||
use tokio::sync::watch;
|
||||
use tokio_stream::wrappers::WatchStream;
|
||||
use tracing::{error, event, info, warn};
|
||||
use tracing::{error, info, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
use flowy_database_pub::cloud::DatabaseCloudService;
|
||||
@ -255,34 +254,35 @@ fn spawn_ws_conn(
|
||||
if let Some(ws_client) = weak_ws_client.upgrade() {
|
||||
let mut state_recv = ws_client.subscribe_connect_state();
|
||||
while let Ok(state) = state_recv.recv().await {
|
||||
info!("[websocket] state: {:?}", state);
|
||||
match state {
|
||||
ConnectState::PingTimeout | ConnectState::Closed => {
|
||||
// Try to reconnect if the connection is timed out.
|
||||
if let Some(api_client) = weak_api_client.upgrade() {
|
||||
if enable_sync.load(Ordering::SeqCst) {
|
||||
match api_client.ws_url(&cloned_device_id).await {
|
||||
Ok(ws_addr) => {
|
||||
// sleep two seconds and then try to reconnect
|
||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
todo!()
|
||||
// info!("[websocket] state: {:?}", state);
|
||||
// match state {
|
||||
// ConnectState::PingTimeout | ConnectState::Closed => {
|
||||
// // Try to reconnect if the connection is timed out.
|
||||
// if let Some(api_client) = weak_api_client.upgrade() {
|
||||
// if enable_sync.load(Ordering::SeqCst) {
|
||||
// match api_client.ws_url(&cloned_device_id).await {
|
||||
// Ok(ws_addr) => {
|
||||
// // sleep two seconds and then try to reconnect
|
||||
// tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
|
||||
event!(tracing::Level::INFO, "🟢reconnecting websocket");
|
||||
let _ = ws_client.connect(ws_addr, &cloned_device_id).await;
|
||||
},
|
||||
Err(err) => error!("Failed to get ws url: {}, connect state:{:?}", err, state),
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
ConnectState::Unauthorized => {
|
||||
if let Some(api_client) = weak_api_client.upgrade() {
|
||||
if let Err(err) = api_client.refresh_token().await {
|
||||
error!("Failed to refresh token: {}", err);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
// event!(tracing::Level::INFO, "🟢reconnecting websocket");
|
||||
// let _ = ws_client.connect(ws_addr, &cloned_device_id).await;
|
||||
// },
|
||||
// Err(err) => error!("Failed to get ws url: {}, connect state:{:?}", err, state),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// ConnectState::Unauthorized => {
|
||||
// if let Some(api_client) = weak_api_client.upgrade() {
|
||||
// if let Err(err) = api_client.refresh_token().await {
|
||||
// error!("Failed to refresh token: {}", err);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// _ => {},
|
||||
// }
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -292,27 +292,28 @@ fn spawn_ws_conn(
|
||||
let weak_api_client = Arc::downgrade(api_client);
|
||||
af_spawn(async move {
|
||||
while let Ok(token_state) = token_state_rx.recv().await {
|
||||
info!("🟢token state: {:?}", token_state);
|
||||
match token_state {
|
||||
TokenState::Refresh => {
|
||||
if let (Some(api_client), Some(ws_client)) =
|
||||
(weak_api_client.upgrade(), weak_ws_client.upgrade())
|
||||
{
|
||||
match api_client.ws_url(&device_id).await {
|
||||
Ok(ws_addr) => {
|
||||
let _ = ws_client.connect(ws_addr, &device_id).await;
|
||||
},
|
||||
Err(err) => error!("Failed to get ws url: {}", err),
|
||||
}
|
||||
}
|
||||
},
|
||||
TokenState::Invalid => {
|
||||
if let Some(ws_client) = weak_ws_client.upgrade() {
|
||||
info!("🟢token state: {:?}, disconnect websocket", token_state);
|
||||
ws_client.disconnect().await;
|
||||
}
|
||||
},
|
||||
}
|
||||
todo!()
|
||||
// info!("🟢token state: {:?}", token_state);
|
||||
// match token_state {
|
||||
// TokenState::Refresh => {
|
||||
// if let (Some(api_client), Some(ws_client)) =
|
||||
// (weak_api_client.upgrade(), weak_ws_client.upgrade())
|
||||
// {
|
||||
// match api_client.ws_url(&device_id).await {
|
||||
// Ok(ws_addr) => {
|
||||
// let _ = ws_client.connect(ws_addr, &device_id).await;
|
||||
// },
|
||||
// Err(err) => error!("Failed to get ws url: {}", err),
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// TokenState::Invalid => {
|
||||
// if let Some(ws_client) = weak_ws_client.upgrade() {
|
||||
// info!("🟢token state: {:?}, disconnect websocket", token_state);
|
||||
// ws_client.disconnect().await;
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ pub async fn generate_sign_in_url(user_email: &str, config: &AFCloudConfiguratio
|
||||
client.gotrue_url(),
|
||||
"fake_device_id",
|
||||
ClientConfiguration::default(),
|
||||
&client.client_id,
|
||||
client.client_version.to_string().as_str(),
|
||||
);
|
||||
admin_client
|
||||
.sign_in_password(&admin_email, &admin_password)
|
||||
|
@ -16,7 +16,7 @@ use uuid::Uuid;
|
||||
|
||||
use crate::entities::{
|
||||
AuthResponse, Authenticator, Role, UpdateUserProfileParams, UserCredentials, UserProfile,
|
||||
UserTokenState, UserWorkspace, WorkspaceMember,
|
||||
UserTokenState, UserWorkspace, WorkspaceInvitation, WorkspaceInvitationStatus, WorkspaceMember,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -182,6 +182,7 @@ pub trait UserCloudService: Send + Sync + 'static {
|
||||
/// Deletes a workspace owned by the user.
|
||||
fn delete_workspace(&self, workspace_id: &str) -> FutureResult<(), FlowyError>;
|
||||
|
||||
// Deprecated, use invite instead
|
||||
fn add_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
@ -190,6 +191,26 @@ pub trait UserCloudService: Send + Sync + 'static {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn invite_workspace_member(
|
||||
&self,
|
||||
invitee_email: String,
|
||||
workspace_id: String,
|
||||
role: Role,
|
||||
) -> FutureResult<(), Error> {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn list_workspace_invitations(
|
||||
&self,
|
||||
filter: Option<WorkspaceInvitationStatus>,
|
||||
) -> FutureResult<Vec<WorkspaceInvitation>, Error> {
|
||||
FutureResult::new(async { Ok(vec![]) })
|
||||
}
|
||||
|
||||
fn accept_workspace_invitations(&self, invite_id: String) -> FutureResult<(), Error> {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
|
||||
fn remove_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
|
@ -396,3 +396,20 @@ pub struct WorkspaceMember {
|
||||
pub fn awareness_oid_from_user_uuid(user_uuid: &Uuid) -> Uuid {
|
||||
Uuid::new_v5(user_uuid, b"user_awareness")
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum WorkspaceInvitationStatus {
|
||||
Pending,
|
||||
Accepted,
|
||||
Rejected,
|
||||
}
|
||||
|
||||
pub struct WorkspaceInvitation {
|
||||
pub invite_id: Uuid,
|
||||
pub workspace_id: Uuid,
|
||||
pub workspace_name: Option<String>,
|
||||
pub inviter_email: Option<String>,
|
||||
pub inviter_name: Option<String>,
|
||||
pub status: WorkspaceInvitationStatus,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use validator::Validate;
|
||||
|
||||
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
||||
use flowy_user_pub::entities::{Role, WorkspaceMember};
|
||||
use flowy_user_pub::entities::{Role, WorkspaceInvitation, WorkspaceMember};
|
||||
use lib_infra::validator_fn::required_not_empty_str;
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone)]
|
||||
@ -32,6 +32,65 @@ pub struct RepeatedWorkspaceMemberPB {
|
||||
pub items: Vec<WorkspaceMemberPB>,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone, Validate)]
|
||||
pub struct WorkspaceMemberInvitationPB {
|
||||
#[pb(index = 1)]
|
||||
#[validate(custom = "required_not_empty_str")]
|
||||
pub workspace_id: String,
|
||||
|
||||
#[pb(index = 2)]
|
||||
#[validate(email)]
|
||||
pub invitee_email: String,
|
||||
|
||||
#[pb(index = 3)]
|
||||
pub role: AFRolePB,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone)]
|
||||
pub struct RepeatedWorkspaceInvitationPB {
|
||||
#[pb(index = 1)]
|
||||
pub items: Vec<WorkspaceInvitationPB>,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone)]
|
||||
pub struct WorkspaceInvitationPB {
|
||||
#[pb(index = 1)]
|
||||
pub invite_id: String,
|
||||
#[pb(index = 2)]
|
||||
pub workspace_id: String,
|
||||
#[pb(index = 3)]
|
||||
pub workspace_name: String,
|
||||
#[pb(index = 4)]
|
||||
pub inviter_email: String,
|
||||
#[pb(index = 5)]
|
||||
pub inviter_name: String,
|
||||
#[pb(index = 6)]
|
||||
pub status: String,
|
||||
#[pb(index = 7)]
|
||||
pub updated_at_timestamp: i64,
|
||||
}
|
||||
|
||||
impl From<WorkspaceInvitation> for WorkspaceInvitationPB {
|
||||
fn from(value: WorkspaceInvitation) -> Self {
|
||||
Self {
|
||||
invite_id: value.invite_id.to_string(),
|
||||
workspace_id: value.workspace_id.to_string(),
|
||||
workspace_name: value.workspace_name.unwrap_or_default(),
|
||||
inviter_email: value.inviter_email.unwrap_or_default(),
|
||||
inviter_name: value.inviter_name.unwrap_or_default(),
|
||||
status: format!("{:?}", value.status),
|
||||
updated_at_timestamp: value.updated_at.timestamp(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone, Validate)]
|
||||
pub struct AcceptWorkspaceInvitationPB {
|
||||
#[pb(index = 1)]
|
||||
#[validate(custom = "required_not_empty_str")]
|
||||
pub invite_id: String,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone, Validate)]
|
||||
pub struct AddWorkspaceMemberPB {
|
||||
#[pb(index = 1)]
|
||||
|
@ -709,3 +709,43 @@ pub async fn change_workspace_icon_handler(
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||
pub async fn invite_members_to_workspace_handler(
|
||||
param: AFPluginData<WorkspaceMemberInvitationPB>,
|
||||
manager: AFPluginState<Weak<UserManager>>,
|
||||
) -> Result<(), FlowyError> {
|
||||
let param = param.try_into_inner()?;
|
||||
let manager = upgrade_manager(manager)?;
|
||||
manager
|
||||
.invite_member_to_workspace(param.workspace_id, param.invitee_email, param.role.into())
|
||||
.await?;
|
||||
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||
pub async fn list_workspace_invitations_handler(
|
||||
manager: AFPluginState<Weak<UserManager>>,
|
||||
) -> DataResult<RepeatedWorkspaceInvitationPB, FlowyError> {
|
||||
let manager = upgrade_manager(manager)?;
|
||||
let invitations = manager.list_pending_workspace_invitations().await?;
|
||||
let invitations_pb: Vec<WorkspaceInvitationPB> = invitations
|
||||
.into_iter()
|
||||
.map(WorkspaceInvitationPB::from)
|
||||
.collect();
|
||||
data_result_ok(RepeatedWorkspaceInvitationPB {
|
||||
items: invitations_pb,
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||
pub async fn accept_workspace_invitations_handler(
|
||||
param: AFPluginData<AcceptWorkspaceInvitationPB>,
|
||||
manager: AFPluginState<Weak<UserManager>>,
|
||||
) -> Result<(), FlowyError> {
|
||||
let invite_id = param.try_into_inner()?.invite_id;
|
||||
let manager = upgrade_manager(manager)?;
|
||||
manager.accept_workspace_invitation(invite_id).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -54,7 +54,9 @@ pub fn init(user_manager: Weak<UserManager>) -> AFPlugin {
|
||||
.event(UserEvent::GetNotificationSettings, get_notification_settings)
|
||||
.event(UserEvent::ImportAppFlowyDataFolder, import_appflowy_data_folder_handler)
|
||||
// Workspace member
|
||||
.event(UserEvent::AddWorkspaceMember, add_workspace_member_handler)
|
||||
.event(UserEvent::AddWorkspaceMember, add_workspace_member_handler) // deprecated, use invite
|
||||
// instead
|
||||
|
||||
.event(UserEvent::RemoveWorkspaceMember, delete_workspace_member_handler)
|
||||
.event(UserEvent::GetWorkspaceMember, get_workspace_member_handler)
|
||||
.event(UserEvent::UpdateWorkspaceMember, update_workspace_member_handler)
|
||||
@ -64,6 +66,10 @@ pub fn init(user_manager: Weak<UserManager>) -> AFPlugin {
|
||||
.event(UserEvent::DeleteWorkspace, delete_workspace_handler)
|
||||
.event(UserEvent::RenameWorkspace, rename_workspace_handler)
|
||||
.event(UserEvent::ChangeWorkspaceIcon, change_workspace_icon_handler)
|
||||
|
||||
.event(UserEvent::InviteMembersToWorkspace, invite_members_to_workspace_handler)
|
||||
.event(UserEvent::ListWorkspaceInvitations, list_workspace_invitations_handler)
|
||||
.event(UserEvent::AcceptWorkspaceInvitation, accept_workspace_invitations_handler)
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
|
||||
@ -208,6 +214,15 @@ pub enum UserEvent {
|
||||
|
||||
#[event(input = "ChangeWorkspaceIconPB")]
|
||||
ChangeWorkspaceIcon = 45,
|
||||
|
||||
#[event(input = "WorkspaceMemberInvitationPB")]
|
||||
InviteMembersToWorkspace = 46,
|
||||
|
||||
#[event(output = "RepeatedWorkspaceInvitationPB")]
|
||||
ListWorkspaceInvitations = 47,
|
||||
|
||||
#[event(input = "AcceptWorkspaceInvitationPB")]
|
||||
AcceptWorkspaceInvitation = 48,
|
||||
}
|
||||
|
||||
pub trait UserStatusCallback: Send + Sync + 'static {
|
||||
|
@ -9,7 +9,9 @@ use flowy_error::{FlowyError, FlowyResult};
|
||||
use flowy_folder_pub::entities::{AppFlowyData, ImportData};
|
||||
use flowy_sqlite::schema::user_workspace_table;
|
||||
use flowy_sqlite::{query_dsl::*, DBConnection, ExpressionMethods};
|
||||
use flowy_user_pub::entities::{Role, UserWorkspace, WorkspaceMember};
|
||||
use flowy_user_pub::entities::{
|
||||
Role, UserWorkspace, WorkspaceInvitation, WorkspaceInvitationStatus, WorkspaceMember,
|
||||
};
|
||||
use lib_dispatch::prelude::af_spawn;
|
||||
|
||||
use crate::entities::{RepeatedUserWorkspacePB, ResetWorkspacePB};
|
||||
@ -191,6 +193,40 @@ impl UserManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn invite_member_to_workspace(
|
||||
&self,
|
||||
workspace_id: String,
|
||||
invitee_email: String,
|
||||
role: Role,
|
||||
) -> FlowyResult<()> {
|
||||
self
|
||||
.cloud_services
|
||||
.get_user_service()?
|
||||
.invite_workspace_member(invitee_email, workspace_id, role)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn list_pending_workspace_invitations(&self) -> FlowyResult<Vec<WorkspaceInvitation>> {
|
||||
let status = Some(WorkspaceInvitationStatus::Pending);
|
||||
let invitations = self
|
||||
.cloud_services
|
||||
.get_user_service()?
|
||||
.list_workspace_invitations(status)
|
||||
.await?;
|
||||
Ok(invitations)
|
||||
}
|
||||
|
||||
pub async fn accept_workspace_invitation(&self, invite_id: String) -> FlowyResult<()> {
|
||||
self
|
||||
.cloud_services
|
||||
.get_user_service()?
|
||||
.accept_workspace_invitations(invite_id)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// deprecated, use invite instead
|
||||
pub async fn add_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
|
Loading…
Reference in New Issue
Block a user