chore: update to latest client api (#5529)

This commit is contained in:
Zack 2024-06-13 15:14:20 +08:00 committed by GitHub
parent aa621a8d84
commit 6be9c00127
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 41 additions and 74 deletions

View File

@ -52,7 +52,7 @@ collab-user = { version = "0.2" }
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { version = "0.2" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "9d3d28ad8937712cc688c20be7c0ee6e4d14a168" }
[dependencies]
serde_json.workspace = true
@ -113,6 +113,3 @@ collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFl
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }
shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }

View File

@ -55,7 +55,7 @@ yrs = "0.18.8"
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { version = "0.2" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "9d3d28ad8937712cc688c20be7c0ee6e4d14a168" }
[profile.dev]
opt-level = 0
@ -75,6 +75,3 @@ collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFl
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6febf0397e66ebf0a281980a2e7602d7af00c975" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6febf0397e66ebf0a281980a2e7602d7af00c975" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6febf0397e66ebf0a281980a2e7602d7af00c975" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }
shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }

View File

@ -52,7 +52,7 @@ collab-user = { version = "0.2" }
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { version = "0.2" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "9d3d28ad8937712cc688c20be7c0ee6e4d14a168" }
[dependencies]
serde_json.workspace = true
@ -114,6 +114,3 @@ collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFl
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }
shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }

View File

@ -163,7 +163,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"bincode",
@ -183,7 +183,7 @@ dependencies = [
[[package]]
name = "appflowy-ai-client"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"bytes",
@ -194,20 +194,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "appflowy-cloud-billing-client"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud-Billing-Client?rev=9f9c2d1ad180987a31d18c6c067a56a5fa1f6da6#9f9c2d1ad180987a31d18c6c067a56a5fa1f6da6"
dependencies = [
"client-api",
"reqwest",
"serde",
"serde_json",
"shared-entity",
"tokio",
"yrs",
]
[[package]]
name = "arc-swap"
version = "1.7.1"
@ -678,7 +664,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"again",
"anyhow",
@ -725,7 +711,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"futures-channel",
"futures-util",
@ -934,7 +920,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"bincode",
@ -959,7 +945,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"async-trait",
@ -1279,7 +1265,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"app-error",
@ -2086,7 +2072,6 @@ name = "flowy-server"
version = "0.1.0"
dependencies = [
"anyhow",
"appflowy-cloud-billing-client",
"assert-json-diff",
"bytes",
"chrono",
@ -2546,7 +2531,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"futures-util",
@ -2563,7 +2548,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"app-error",
@ -2928,7 +2913,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"reqwest",
@ -5012,7 +4997,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=9d3d28ad8937712cc688c20be7c0ee6e4d14a168#9d3d28ad8937712cc688c20be7c0ee6e4d14a168"
dependencies = [
"anyhow",
"app-error",

View File

@ -94,8 +94,7 @@ yrs = "0.18.8"
# Run the script.add_workspace_members:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { version = "0.2" }
appflowy-cloud-billing-client = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud-Billing-Client", rev = "9f9c2d1ad180987a31d18c6c067a56a5fa1f6da6" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "9d3d28ad8937712cc688c20be7c0ee6e4d14a168" }
[profile.dev]
opt-level = 1
@ -122,9 +121,6 @@ lto = false
incremental = false
[patch.crates-io]
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }
shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" }
# TODO(Lucas.Xu) Upgrade to the latest version of RocksDB once PR(https://github.com/rust-rocksdb/rust-rocksdb/pull/869) is merged.
# Currently, using the following revision id. This commit is patched to fix the 32-bit build issue and it's checked out from 0.21.0, not 0.22.0.
rocksdb = { git = "https://github.com/LucasXu0/rust-rocksdb", rev = "21cf4a23ec131b9d82dc94e178fe8efc0c147b09" }

View File

@ -37,7 +37,6 @@ flowy-user-pub = { workspace = true }
flowy-folder-pub = { workspace = true }
flowy-database-pub = { workspace = true }
flowy-document-pub = { workspace = true }
appflowy-cloud-billing-client = { workspace = true }
flowy-error = { workspace = true, features = ["impl_from_serde", "impl_from_reqwest", "impl_from_url", "impl_from_appflowy_cloud"] }
flowy-server-pub = { workspace = true }
flowy-search-pub = { workspace = true }

View File

@ -1,11 +1,10 @@
use appflowy_cloud_billing_client::entities::{
RecurringInterval, SubscriptionPlan, WorkspaceSubscriptionStatus,
};
use std::collections::HashMap;
use std::sync::Arc;
use anyhow::anyhow;
use appflowy_cloud_billing_client::BillingClient;
use client_api::entity::billing_dto::{
SubscriptionPlan, SubscriptionStatus, WorkspaceSubscriptionPlan, WorkspaceSubscriptionStatus,
};
use client_api::entity::workspace_dto::{
CreateWorkspaceMember, CreateWorkspaceParam, PatchWorkspaceParam, WorkspaceMemberChangeset,
WorkspaceMemberInvitation,
@ -491,7 +490,7 @@ where
FutureResult::new(async move {
let subscription_plan = to_workspace_subscription_plan(workspace_subscription_plan)?;
let client = try_get_client?;
let payment_link = BillingClient::from(client.as_ref())
let payment_link = client
.create_subscription(
&workspace_id,
to_recurring_interval(recurring_interval),
@ -507,7 +506,7 @@ where
let try_get_client = self.server.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
let workspace_subscriptions = BillingClient::from(client.as_ref())
let workspace_subscriptions = client
.list_subscription()
.await?
.into_iter()
@ -521,9 +520,7 @@ where
let try_get_client = self.server.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
BillingClient::from(client.as_ref())
.cancel_subscription(&workspace_id)
.await?;
client.cancel_subscription(&workspace_id).await?;
Ok(())
})
}
@ -532,9 +529,7 @@ where
let try_get_client = self.server.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
let usage = BillingClient::from(client.as_ref())
.get_workspace_usage(&workspace_id)
.await?;
let usage = client.get_billing_workspace_usage(&workspace_id).await?;
Ok(WorkspaceUsage {
member_count: usage.member_count,
member_count_limit: usage.member_count_limit,
@ -548,9 +543,7 @@ where
let try_get_client = self.server.try_get_client();
FutureResult::new(async move {
let client = try_get_client?;
let url = BillingClient::from(client.as_ref())
.get_portal_session_link()
.await?;
let url = client.get_portal_session_link().await?;
Ok(url)
})
}
@ -651,10 +644,16 @@ fn oauth_params_from_box_any(any: BoxAny) -> Result<AFCloudOAuthParams, FlowyErr
})
}
fn to_recurring_interval(r: flowy_user_pub::entities::RecurringInterval) -> RecurringInterval {
fn to_recurring_interval(
r: flowy_user_pub::entities::RecurringInterval,
) -> client_api::entity::billing_dto::RecurringInterval {
match r {
flowy_user_pub::entities::RecurringInterval::Month => RecurringInterval::Month,
flowy_user_pub::entities::RecurringInterval::Year => RecurringInterval::Year,
flowy_user_pub::entities::RecurringInterval::Month => {
client_api::entity::billing_dto::RecurringInterval::Month
},
flowy_user_pub::entities::RecurringInterval::Year => {
client_api::entity::billing_dto::RecurringInterval::Year
},
}
}
@ -675,22 +674,19 @@ fn to_workspace_subscription(s: WorkspaceSubscriptionStatus) -> WorkspaceSubscri
WorkspaceSubscription {
workspace_id: s.workspace_id,
subscription_plan: match s.workspace_plan {
appflowy_cloud_billing_client::entities::WorkspaceSubscriptionPlan::Pro => {
flowy_user_pub::entities::SubscriptionPlan::Pro
},
appflowy_cloud_billing_client::entities::WorkspaceSubscriptionPlan::Team => {
flowy_user_pub::entities::SubscriptionPlan::Team
},
WorkspaceSubscriptionPlan::Pro => flowy_user_pub::entities::SubscriptionPlan::Pro,
WorkspaceSubscriptionPlan::Team => flowy_user_pub::entities::SubscriptionPlan::Team,
_ => flowy_user_pub::entities::SubscriptionPlan::None,
},
recurring_interval: match s.recurring_interval {
RecurringInterval::Month => flowy_user_pub::entities::RecurringInterval::Month,
RecurringInterval::Year => flowy_user_pub::entities::RecurringInterval::Year,
client_api::entity::billing_dto::RecurringInterval::Month => {
flowy_user_pub::entities::RecurringInterval::Month
},
client_api::entity::billing_dto::RecurringInterval::Year => {
flowy_user_pub::entities::RecurringInterval::Year
},
},
is_active: matches!(
s.subscription_status,
appflowy_cloud_billing_client::entities::SubscriptionStatus::Active
),
is_active: matches!(s.subscription_status, SubscriptionStatus::Active),
canceled_at: s.canceled_at,
}
}