diff --git a/frontend/appflowy_flutter/pubspec.lock b/frontend/appflowy_flutter/pubspec.lock index 8ad8a3f762..ffdf26e42a 100644 --- a/frontend/appflowy_flutter/pubspec.lock +++ b/frontend/appflowy_flutter/pubspec.lock @@ -1041,6 +1041,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.19.0" + intl_utils: + dependency: transitive + description: + name: intl_utils + sha256: c2b1f5c72c25512cbeef5ab015c008fc50fe7e04813ba5541c25272300484bf4 + url: "https://pub.dev" + source: hosted + version: "2.8.7" io: dependency: transitive description: @@ -2192,6 +2200,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + universal_html: + dependency: transitive + description: + name: universal_html + sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" universal_platform: dependency: transitive description: diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock index 277f884e74..26dc1c2782 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.lock +++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock @@ -172,7 +172,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -189,6 +189,38 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "app-error" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "getrandom 0.2.10", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tsify", + "url", + "uuid", + "wasm-bindgen", +] + +[[package]] +name = "appflowy-ai-client" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "bytes", + "futures", + "serde", + "serde_json", + "serde_repr", + "thiserror", +] + [[package]] name = "appflowy-ai-client" version = "0.1.0" @@ -212,7 +244,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "tokio", "yrs", ] @@ -786,11 +818,11 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "again", "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "async-trait", "bincode", "brotli", @@ -801,12 +833,12 @@ dependencies = [ "collab-entity", "collab-rt-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures-core", "futures-util", "getrandom 0.2.10", "gotrue", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "mime", "parking_lot 0.12.1", "prost", @@ -817,7 +849,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "thiserror", "tokio", "tokio-retry", @@ -833,7 +865,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "futures-channel", "futures-util", @@ -1073,7 +1105,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -1083,7 +1115,7 @@ dependencies = [ "collab", "collab-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "prost", "prost-build", "protoc-bin-vendored", @@ -1098,7 +1130,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "async-trait", @@ -1452,13 +1484,32 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +[[package]] +name = "database-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "bincode", + "chrono", + "collab-entity", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tracing", + "uuid", + "validator", +] + [[package]] name = "database-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "bincode", "chrono", "collab-entity", @@ -2876,12 +2927,12 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "futures-util", "getrandom 0.2.10", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "infra", "reqwest", "serde", @@ -2890,13 +2941,27 @@ dependencies = [ "tracing", ] +[[package]] +name = "gotrue-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "chrono", + "jsonwebtoken", + "lazy_static", + "serde", + "serde_json", +] + [[package]] name = "gotrue-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "chrono", "jsonwebtoken", "lazy_static", @@ -3325,7 +3390,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "reqwest", @@ -5815,17 +5880,41 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", - "app-error", - "appflowy-ai-client", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "bytes", "chrono", "collab-entity", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "log", + "pin-project", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "uuid", +] + +[[package]] +name = "shared-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "bytes", + "chrono", + "collab-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "futures", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "log", "pin-project", "reqwest", diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml index c21aa283d9..0e6920e96d 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.toml +++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml @@ -114,5 +114,5 @@ collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFl 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" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" } shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" } diff --git a/frontend/appflowy_web/wasm-libs/Cargo.lock b/frontend/appflowy_web/wasm-libs/Cargo.lock index 183530fefd..bad5850f55 100644 --- a/frontend/appflowy_web/wasm-libs/Cargo.lock +++ b/frontend/appflowy_web/wasm-libs/Cargo.lock @@ -216,7 +216,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -233,6 +233,38 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "app-error" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "getrandom 0.2.12", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tsify", + "url", + "uuid", + "wasm-bindgen", +] + +[[package]] +name = "appflowy-ai-client" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "bytes", + "futures", + "serde", + "serde_json", + "serde_repr", + "thiserror", +] + [[package]] name = "appflowy-ai-client" version = "0.1.0" @@ -256,7 +288,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "tokio", "yrs", ] @@ -576,11 +608,11 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "again", "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "async-trait", "bincode", "brotli", @@ -591,12 +623,12 @@ dependencies = [ "collab-entity", "collab-rt-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures-core", "futures-util", "getrandom 0.2.12", "gotrue", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "mime", "parking_lot 0.12.1", "prost", @@ -607,7 +639,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "thiserror", "tokio", "tokio-retry", @@ -623,7 +655,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "futures-channel", "futures-util", @@ -801,7 +833,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -811,7 +843,7 @@ dependencies = [ "collab", "collab-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "prost", "prost-build", "protoc-bin-vendored", @@ -826,7 +858,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "async-trait", @@ -1037,13 +1069,32 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +[[package]] +name = "database-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "bincode", + "chrono", + "collab-entity", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tracing", + "uuid", + "validator", +] + [[package]] name = "database-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "bincode", "chrono", "collab-entity", @@ -1901,12 +1952,12 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "futures-util", "getrandom 0.2.12", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "infra", "reqwest", "serde", @@ -1915,13 +1966,27 @@ dependencies = [ "tracing", ] +[[package]] +name = "gotrue-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "chrono", + "jsonwebtoken", + "lazy_static", + "serde", + "serde_json", +] + [[package]] name = "gotrue-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "chrono", "jsonwebtoken", "lazy_static", @@ -2219,7 +2284,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "reqwest", @@ -3921,17 +3986,41 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", - "app-error", - "appflowy-ai-client", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "bytes", "chrono", "collab-entity", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "log", + "pin-project", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "uuid", +] + +[[package]] +name = "shared-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "bytes", + "chrono", + "collab-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "futures", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "log", "pin-project", "reqwest", diff --git a/frontend/appflowy_web/wasm-libs/Cargo.toml b/frontend/appflowy_web/wasm-libs/Cargo.toml index 6f3221b392..f61236d282 100644 --- a/frontend/appflowy_web/wasm-libs/Cargo.toml +++ b/frontend/appflowy_web/wasm-libs/Cargo.toml @@ -76,5 +76,5 @@ collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFl 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" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" } shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" } diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.lock b/frontend/appflowy_web_app/src-tauri/Cargo.lock index 844f7d57c2..70c41acb0e 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.lock +++ b/frontend/appflowy_web_app/src-tauri/Cargo.lock @@ -163,7 +163,7 @@ checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -180,6 +180,38 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "app-error" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "getrandom 0.2.12", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tsify", + "url", + "uuid", + "wasm-bindgen", +] + +[[package]] +name = "appflowy-ai-client" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "bytes", + "futures", + "serde", + "serde_json", + "serde_repr", + "thiserror", +] + [[package]] name = "appflowy-ai-client" version = "0.1.0" @@ -194,6 +226,20 @@ 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 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "tokio", + "yrs", +] + [[package]] name = "appflowy_tauri" version = "0.0.0" @@ -746,11 +792,11 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "again", "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "async-trait", "bincode", "brotli", @@ -761,12 +807,12 @@ dependencies = [ "collab-entity", "collab-rt-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures-core", "futures-util", "getrandom 0.2.12", "gotrue", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "mime", "parking_lot 0.12.1", "prost", @@ -777,7 +823,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "thiserror", "tokio", "tokio-retry", @@ -793,7 +839,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "futures-channel", "futures-util", @@ -1042,7 +1088,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -1052,7 +1098,7 @@ dependencies = [ "collab", "collab-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "prost", "prost-build", "protoc-bin-vendored", @@ -1067,7 +1113,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "async-trait", @@ -1317,7 +1363,7 @@ dependencies = [ "cssparser-macros", "dtoa-short", "itoa 1.0.10", - "phf 0.11.2", + "phf 0.8.0", "smallvec", ] @@ -1425,13 +1471,32 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +[[package]] +name = "database-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "bincode", + "chrono", + "collab-entity", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tracing", + "uuid", + "validator", +] + [[package]] name = "database-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "bincode", "chrono", "collab-entity", @@ -2248,6 +2313,7 @@ dependencies = [ "flowy-codegen", "flowy-derive", "flowy-error", + "flowy-folder", "flowy-notification", "flowy-search-pub", "flowy-sqlite", @@ -2284,6 +2350,7 @@ name = "flowy-server" version = "0.1.0" dependencies = [ "anyhow", + "appflowy-cloud-billing-client", "bytes", "chrono", "client-api", @@ -2934,12 +3001,12 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "futures-util", "getrandom 0.2.12", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "infra", "reqwest", "serde", @@ -2948,13 +3015,27 @@ dependencies = [ "tracing", ] +[[package]] +name = "gotrue-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "chrono", + "jsonwebtoken", + "lazy_static", + "serde", + "serde_json", +] + [[package]] name = "gotrue-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "chrono", "jsonwebtoken", "lazy_static", @@ -3388,7 +3469,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "reqwest", @@ -4895,7 +4976,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ "bytes", "heck 0.4.1", - "itertools 0.11.0", + "itertools 0.10.5", "log", "multimap", "once_cell", @@ -4916,7 +4997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.10.5", "proc-macro2", "quote", "syn 2.0.55", @@ -5894,17 +5975,41 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", - "app-error", - "appflowy-ai-client", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "bytes", "chrono", "collab-entity", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "log", + "pin-project", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "uuid", +] + +[[package]] +name = "shared-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "bytes", + "chrono", + "collab-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "futures", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "log", "pin-project", "reqwest", @@ -6873,9 +6978,9 @@ checksum = "c7c4ceeeca15c8384bbc3e011dbd8fccb7f068a440b752b7d9b32ceb0ca0e2e8" [[package]] name = "tokio" -version = "1.36.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -6893,9 +6998,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", diff --git a/frontend/appflowy_web_app/src-tauri/Cargo.toml b/frontend/appflowy_web_app/src-tauri/Cargo.toml index 54e0f74644..f4334bd722 100644 --- a/frontend/appflowy_web_app/src-tauri/Cargo.toml +++ b/frontend/appflowy_web_app/src-tauri/Cargo.toml @@ -115,5 +115,5 @@ collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFl 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" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" } shared-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" } diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 17bd8e1646..f44d35b527 100644 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -180,6 +180,38 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "app-error" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "getrandom 0.2.10", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tsify", + "url", + "uuid", + "wasm-bindgen", +] + +[[package]] +name = "appflowy-ai-client" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "bytes", + "futures", + "serde", + "serde_json", + "serde_repr", + "thiserror", +] + [[package]] name = "appflowy-ai-client" version = "0.1.0" @@ -203,7 +235,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "tokio", "yrs", ] @@ -678,11 +710,11 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "again", "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "async-trait", "bincode", "brotli", @@ -693,12 +725,12 @@ dependencies = [ "collab-entity", "collab-rt-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures-core", "futures-util", "getrandom 0.2.10", "gotrue", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "mime", "parking_lot 0.12.1", "prost", @@ -709,7 +741,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "shared-entity", + "shared-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "thiserror", "tokio", "tokio-retry", @@ -725,7 +757,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "futures-channel", "futures-util", @@ -934,7 +966,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "bincode", @@ -944,7 +976,7 @@ dependencies = [ "collab", "collab-entity", "collab-rt-protocol", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "prost", "prost-build", "protoc-bin-vendored", @@ -959,7 +991,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "async-trait", @@ -1276,13 +1308,32 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +[[package]] +name = "database-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "bincode", + "chrono", + "collab-entity", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "tracing", + "uuid", + "validator", +] + [[package]] name = "database-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "bincode", "chrono", "collab-entity", @@ -2546,12 +2597,12 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "futures-util", "getrandom 0.2.10", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "infra", "reqwest", "serde", @@ -2560,13 +2611,27 @@ dependencies = [ "tracing", ] +[[package]] +name = "gotrue-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "chrono", + "jsonwebtoken", + "lazy_static", + "serde", + "serde_json", +] + [[package]] name = "gotrue-entity" version = "0.1.0" source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" dependencies = [ "anyhow", - "app-error", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "chrono", "jsonwebtoken", "lazy_static", @@ -2928,7 +2993,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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", "reqwest", @@ -5012,17 +5077,41 @@ 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=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685#d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" dependencies = [ "anyhow", - "app-error", - "appflowy-ai-client", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "bytes", "chrono", "collab-entity", - "database-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", "futures", - "gotrue-entity", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685)", + "log", + "pin-project", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "thiserror", + "uuid", +] + +[[package]] +name = "shared-entity" +version = "0.1.0" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471#ff4384fbd07a4b7394a9af8c9159cd65715d3471" +dependencies = [ + "anyhow", + "app-error 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "appflowy-ai-client 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "bytes", + "chrono", + "collab-entity", + "database-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", + "futures", + "gotrue-entity 0.1.0 (git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=ff4384fbd07a4b7394a9af8c9159cd65715d3471)", "log", "pin-project", "reqwest", diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index 039f280eef..53eab30d5f 100644 --- a/frontend/rust-lib/Cargo.toml +++ b/frontend/rust-lib/Cargo.toml @@ -122,7 +122,7 @@ lto = false incremental = false [patch.crates-io] -client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "ff4384fbd07a4b7394a9af8c9159cd65715d3471" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "d1c586ee56ee1f0a04c0364a80ab5eee6ef0e685" } 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. diff --git a/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs b/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs index 25ef9920c8..0e93cb1e78 100644 --- a/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs +++ b/frontend/rust-lib/event-integration-test/tests/database/af_cloud/util.rs @@ -6,6 +6,7 @@ use collab_database::fields::Field; use collab_database::rows::Row; use flowy_database2::entities::FieldType; use flowy_database2::services::field::summary_type_option::summary::SummarizationTypeOption; +use flowy_database2::services::field::tag_type_option::tag::TagTypeOption; use flowy_database2::services::field::translate_type_option::translate::TranslateTypeOption; use flowy_database2::services::field::{ FieldBuilder, NumberFormat, NumberTypeOption, SelectOption, SelectOptionColor, @@ -63,6 +64,7 @@ fn create_fields() -> Vec { FieldType::SingleSelect => fields.push(create_single_select_field("Status")), FieldType::Summary => fields.push(create_summary_field("AI summary")), FieldType::Translate => fields.push(create_translate_field("AI Translate")), + FieldType::Tag => fields.push(create_tag_field("AI Tag")), _ => {}, } } @@ -137,3 +139,11 @@ fn create_translate_field(name: &str) -> Field { .name(name) .build() } + +#[allow(dead_code)] +fn create_tag_field(name: &str) -> Field { + let type_option = TagTypeOption::default(); + FieldBuilder::new(FieldType::Tag, type_option) + .name(name) + .build() +} diff --git a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs index 1853fd12d3..3e58b039db 100644 --- a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs +++ b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use anyhow::Error; use client_api::collab_sync::{SinkConfig, SyncObject, SyncPlugin}; -use client_api::entity::ai_dto::RepeatedRelatedQuestion; +use client_api::entity::ai_dto::{RepeatedRelatedQuestion, TagRowResponse}; use client_api::entity::ChatMessageType; use collab::core::origin::{CollabClient, CollabOrigin}; @@ -23,7 +23,7 @@ use flowy_chat_pub::cloud::{ StreamAnswer, }; use flowy_database_pub::cloud::{ - CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, + CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, TagRowContent, TranslateRowContent, TranslateRowResponse, }; use flowy_document::deps::DocumentData; @@ -313,6 +313,21 @@ impl DatabaseCloudService for ServerProvider { .await }) } + + fn tag_database_row( + &self, + workspace_id: &str, + tag_row: TagRowContent, + ) -> FutureResult { + let workspace_id = workspace_id.to_string(); + let server = self.get_server(); + FutureResult::new(async move { + server? + .database_service() + .tag_database_row(&workspace_id, tag_row) + .await + }) + } } impl DocumentCloudService for ServerProvider { diff --git a/frontend/rust-lib/flowy-database-pub/src/cloud.rs b/frontend/rust-lib/flowy-database-pub/src/cloud.rs index 3a43eb36da..11a3968547 100644 --- a/frontend/rust-lib/flowy-database-pub/src/cloud.rs +++ b/frontend/rust-lib/flowy-database-pub/src/cloud.rs @@ -1,5 +1,7 @@ use anyhow::Error; -pub use client_api::entity::ai_dto::{TranslateItem, TranslateRowResponse}; +pub use client_api::entity::ai_dto::{ + TagItem, TagRowData, TagRowResponse, TranslateItem, TranslateRowResponse, +}; use collab::core::collab::DataSource; use collab_entity::CollabType; use lib_infra::future::FutureResult; @@ -8,6 +10,8 @@ use std::collections::HashMap; pub type CollabDocStateByOid = HashMap; pub type SummaryRowContent = HashMap; pub type TranslateRowContent = Vec; + +pub type TagRowContent = TagRowData; /// A trait for database cloud service. /// Each kind of server should implement this trait. Check out the [AppFlowyServerProvider] of /// [flowy-server] crate for more information. @@ -48,6 +52,12 @@ pub trait DatabaseCloudService: Send + Sync { translate_row: TranslateRowContent, language: &str, ) -> FutureResult; + + fn tag_database_row( + &self, + workspace_id: &str, + tag_row: TagRowContent, + ) -> FutureResult; } pub struct DatabaseSnapshot { diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs index 3a1dd63b2f..298111389d 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs @@ -450,6 +450,7 @@ pub enum FieldType { Relation = 10, Summary = 11, Translate = 12, + Tag = 13, } impl Display for FieldType { @@ -491,12 +492,16 @@ impl FieldType { FieldType::Relation => "Relation", FieldType::Summary => "Summarize", FieldType::Translate => "Translate", + FieldType::Tag => "Tag", }; s.to_string() } pub fn is_ai_field(&self) -> bool { - matches!(self, FieldType::Summary | FieldType::Translate) + matches!( + self, + FieldType::Summary | FieldType::Translate | FieldType::Tag + ) } pub fn is_number(&self) -> bool { diff --git a/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs b/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs index d4f3bedb7c..ada6212fab 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/filter_entities/util.rs @@ -113,6 +113,10 @@ impl From<&Filter> for FilterPB { .cloned::() .unwrap() .try_into(), + FieldType::Tag => condition_and_content + .cloned::() + .unwrap() + .try_into(), }; Self { @@ -163,6 +167,9 @@ impl TryFrom for FilterInner { FieldType::Translate => { BoxAny::new(TextFilterPB::try_from(bytes).map_err(|_| ErrorCode::ProtobufSerde)?) }, + FieldType::Tag => { + BoxAny::new(TextFilterPB::try_from(bytes).map_err(|_| ErrorCode::ProtobufSerde)?) + }, }; Ok(Self::Data { diff --git a/frontend/rust-lib/flowy-database2/src/entities/macros.rs b/frontend/rust-lib/flowy-database2/src/entities/macros.rs index 35c594a07e..463b936964 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/macros.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/macros.rs @@ -17,6 +17,7 @@ macro_rules! impl_into_field_type { 10 => FieldType::Relation, 11 => FieldType::Summary, 12 => FieldType::Translate, + 13 => FieldType::Tag, _ => { tracing::error!("🔴Can't parse FieldType from value: {}", ty); FieldType::RichText diff --git a/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/mod.rs b/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/mod.rs index ceeeab3874..b3ad1c4c7e 100644 --- a/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/mod.rs +++ b/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/mod.rs @@ -5,6 +5,7 @@ mod number_entities; mod relation_entities; mod select_option_entities; mod summary_entities; +mod tag_entities; mod text_entities; mod timestamp_entities; mod translate_entities; @@ -17,6 +18,7 @@ pub use number_entities::*; pub use relation_entities::*; pub use select_option_entities::*; pub use summary_entities::*; +pub use tag_entities::*; pub use text_entities::*; pub use timestamp_entities::*; pub use translate_entities::*; diff --git a/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/tag_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/tag_entities.rs new file mode 100644 index 0000000000..b1dca5d3f6 --- /dev/null +++ b/frontend/rust-lib/flowy-database2/src/entities/type_option_entities/tag_entities.rs @@ -0,0 +1,36 @@ +use crate::entities::TranslateTypeOptionPB; +use crate::services::field::tag_type_option::tag::{TagOption, TagTypeOption}; +use flowy_derive::ProtoBuf; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Default, ProtoBuf)] +pub struct TagTypeOptionPB { + #[pb(index = 1)] + pub tags: Vec, +} + +#[derive(ProtoBuf, Debug, Clone, Default)] +pub struct TagItemPB { + #[pb(index = 1)] + color: String, + + #[pb(index = 2)] + text: String, +} + +impl From for TagItemPB { + fn from(value: TagOption) -> Self { + Self { + color: value.color, + text: value.text, + } + } +} + +impl From for TagTypeOptionPB { + fn from(value: TagTypeOption) -> Self { + Self { + tags: value.tags.into_iter().map(TagItemPB::from).collect(), + } + } +} diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rs index 598d3cec37..1dff9435a6 100644 --- a/frontend/rust-lib/flowy-database2/src/manager.rs +++ b/frontend/rust-lib/flowy-database2/src/manager.rs @@ -18,7 +18,8 @@ use tracing::{event, instrument, trace}; use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig}; use collab_integrate::{CollabKVAction, CollabKVDB, CollabPersistenceConfig}; use flowy_database_pub::cloud::{ - DatabaseCloudService, SummaryRowContent, TranslateItem, TranslateRowContent, + DatabaseCloudService, SummaryRowContent, TagItem, TagRowContent, TranslateItem, + TranslateRowContent, }; use flowy_error::{internal_error, FlowyError, FlowyResult}; use lib_infra::box_any::BoxAny; @@ -28,6 +29,7 @@ use crate::entities::{DatabaseLayoutPB, DatabaseSnapshotPB, FieldType}; use crate::services::cell::stringify_cell; use crate::services::database::DatabaseEditor; use crate::services::database_view::DatabaseLayoutDepsResolver; +use crate::services::field::tag_type_option::tag::{TagOption, TagTypeOption}; use crate::services::field::translate_type_option::translate::TranslateTypeOption; use crate::services::field_settings::default_field_settings_by_layout_map; @@ -506,7 +508,6 @@ impl DatabaseManager { } } - // Call the cloud service to summarize the row. trace!( "[AI]:translate to {}, content:{:?}", language, @@ -539,6 +540,59 @@ impl DatabaseManager { Ok(()) } + #[instrument(level = "debug", skip_all)] + pub async fn tag_row(&self, view_id: String, row_id: RowId, field_id: String) -> FlowyResult<()> { + let database = self.get_database_with_view_id(&view_id).await?; + let mut tag_row = TagRowContent { + existing_tags: vec![], + items: vec![], + num_tags: 5, + }; + if let Some(row) = database.get_row(&view_id, &row_id) { + let fields = database.get_fields(&view_id, None); + for field in fields { + if field.id != field_id { + if FieldType::from(field.field_type).is_ai_field() { + continue; + } + + if let Some(cell) = row.cells.get(&field.id) { + tag_row.items.push(TagItem { + title: field.name.clone(), + content: stringify_cell(cell, &field), + }) + } + } else { + tag_row.existing_tags.extend( + field + .type_options + .get(&FieldType::Tag.to_string()) + .cloned() + .map(TagTypeOption::from) + .unwrap_or_default() + .tags + .into_iter() + .map(|tag| tag.text) + .collect(), + ) + } + } + } + + let response = self + .cloud_service + .tag_database_row(&self.user.workspace_id()?, tag_row) + .await?; + + // Format the response items into a single string + let content = response.tags.map(|v| v).collect::>().join(", "); + trace!("[AI]:tag row response: {}", content); + database + .update_cell_with_changeset(&view_id, &row_id, &field_id, BoxAny::new(content)) + .await?; + Ok(()) + } + /// Only expose this method for testing #[cfg(debug_assertions)] pub fn get_cloud_service(&self) -> &Arc { diff --git a/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs b/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs index 068eea5da4..9d42cc735a 100644 --- a/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs +++ b/frontend/rust-lib/flowy-database2/src/services/cell/cell_operation.rs @@ -265,6 +265,9 @@ impl<'a> CellBuilder<'a> { FieldType::Translate => { cells.insert(field_id, insert_text_cell(cell_str, field)); }, + FieldType::Tag => { + cells.insert(field_id, insert_text_cell(cell_str, field)); + }, } } } diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/mod.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/mod.rs index 49451f3820..bd032a064c 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/mod.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/mod.rs @@ -5,6 +5,7 @@ pub mod number_type_option; pub mod relation_type_option; pub mod selection_type_option; pub mod summary_type_option; +pub mod tag_type_option; pub mod text_type_option; pub mod timestamp_type_option; pub mod translate_type_option; diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/mod.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/mod.rs new file mode 100644 index 0000000000..b699081b93 --- /dev/null +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/mod.rs @@ -0,0 +1,2 @@ +pub mod tag; +pub mod tag_entities; diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/tag.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/tag.rs new file mode 100644 index 0000000000..0a723286ea --- /dev/null +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/tag.rs @@ -0,0 +1,132 @@ +use crate::entities::TextFilterPB; +use crate::services::cell::{CellDataChangeset, CellDataDecoder}; +use crate::services::field::type_options::tag_type_option::tag_entities::TagCellData; +use crate::services::field::type_options::util::ProtobufStr; +use crate::services::field::{ + TypeOption, TypeOptionCellData, TypeOptionCellDataCompare, TypeOptionCellDataFilter, + TypeOptionCellDataSerde, TypeOptionTransform, +}; +use crate::services::sort::SortCondition; +use collab::core::any_map::{AnyMap, AnyMapExtension}; +use collab_database::fields::{TypeOptionData, TypeOptionDataBuilder}; +use collab_database::rows::Cell; +use flowy_error::FlowyResult; +use serde::{Deserialize, Serialize}; +use std::cmp::Ordering; + +#[derive(Debug, Clone, Default)] +pub struct TagTypeOption { + pub tags: Vec, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct TagOption { + pub color: String, + pub text: String, +} + +impl From for TagOption { + fn from(value: AnyMap) -> Self { + let color = value.get_string("color").unwrap_or_default(); + let text = value.get_string("text").unwrap_or_default(); + Self { color, text } + } +} + +impl From for AnyMap { + fn from(value: TagOption) -> Self { + let mut map = AnyMap::new(); + map.insert_string("color", value.color); + map.insert_string("text", value.text); + map + } +} +impl From for TagTypeOption { + fn from(value: TypeOptionData) -> Self { + let tags = value.get_array("tags"); + Self { tags } + } +} + +impl From for TypeOptionData { + fn from(value: TagTypeOption) -> Self { + TypeOptionDataBuilder::new() + .insert_maps("tags", value.tags) + .build() + } +} + +impl TypeOption for TagTypeOption { + type CellData = TagCellData; + type CellChangeset = String; + type CellProtobufType = ProtobufStr; + type CellFilter = TextFilterPB; +} + +impl CellDataChangeset for TagTypeOption { + fn apply_changeset( + &self, + changeset: String, + _cell: Option, + ) -> FlowyResult<(Cell, TagCellData)> { + let cell_data = TagCellData(changeset); + Ok((cell_data.clone().into(), cell_data)) + } +} + +impl TypeOptionCellDataFilter for TagTypeOption { + fn apply_filter( + &self, + filter: &::CellFilter, + cell_data: &::CellData, + ) -> bool { + filter.is_visible(cell_data) + } +} + +impl TypeOptionCellDataCompare for TagTypeOption { + fn apply_cmp( + &self, + cell_data: &::CellData, + other_cell_data: &::CellData, + sort_condition: SortCondition, + ) -> Ordering { + match (cell_data.is_cell_empty(), other_cell_data.is_cell_empty()) { + (true, true) => Ordering::Equal, + (true, false) => Ordering::Greater, + (false, true) => Ordering::Less, + (false, false) => { + let order = cell_data.0.cmp(&other_cell_data.0); + sort_condition.evaluate_order(order) + }, + } + } +} + +impl CellDataDecoder for TagTypeOption { + fn decode_cell(&self, cell: &Cell) -> FlowyResult { + Ok(TagCellData::from(cell)) + } + + fn stringify_cell_data(&self, cell_data: TagCellData) -> String { + cell_data.to_string() + } + + fn numeric_cell(&self, _cell: &Cell) -> Option { + None + } +} +impl TypeOptionTransform for TagTypeOption {} + +impl TypeOptionCellDataSerde for TagTypeOption { + fn protobuf_encode( + &self, + cell_data: ::CellData, + ) -> ::CellProtobufType { + ProtobufStr::from(cell_data.0) + } + + fn parse_cell(&self, cell: &Cell) -> FlowyResult<::CellData> { + Ok(TagCellData::from(cell)) + } +} diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/tag_entities.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/tag_entities.rs new file mode 100644 index 0000000000..cdad1eff46 --- /dev/null +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/tag_type_option/tag_entities.rs @@ -0,0 +1,46 @@ +use crate::entities::FieldType; +use crate::services::field::{TypeOptionCellData, CELL_DATA}; +use collab::core::any_map::AnyMapExtension; +use collab_database::rows::{new_cell_builder, Cell}; + +#[derive(Default, Debug, Clone)] +pub struct TagCellData(pub String); +impl std::ops::Deref for TagCellData { + type Target = String; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl TypeOptionCellData for TagCellData { + fn is_cell_empty(&self) -> bool { + self.0.is_empty() + } +} + +impl From<&Cell> for TagCellData { + fn from(cell: &Cell) -> Self { + Self(cell.get_str_value(CELL_DATA).unwrap_or_default()) + } +} + +impl From for Cell { + fn from(data: TagCellData) -> Self { + new_cell_builder(FieldType::Tag) + .insert_str_value(CELL_DATA, data.0) + .build() + } +} + +impl ToString for TagCellData { + fn to_string(&self) -> String { + self.0.clone() + } +} + +impl AsRef for TagCellData { + fn as_ref(&self) -> &str { + &self.0 + } +} diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs index 1627b04465..d9f557128a 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/text_type_option/text_type_option.rs @@ -86,6 +86,7 @@ impl CellDataDecoder for RichTextTypeOption { | FieldType::Relation => None, FieldType::Summary => Some(StringCellData::from(stringify_cell(cell, field))), FieldType::Translate => Some(StringCellData::from(stringify_cell(cell, field))), + FieldType::Tag => Some(StringCellData::from(stringify_cell(cell, field))), } } 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 c283d39bbc..32069fb344 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 @@ -11,12 +11,13 @@ use flowy_error::FlowyResult; use crate::entities::{ CheckboxTypeOptionPB, ChecklistTypeOptionPB, DateTypeOptionPB, FieldType, MultiSelectTypeOptionPB, NumberTypeOptionPB, RelationTypeOptionPB, RichTextTypeOptionPB, - SingleSelectTypeOptionPB, SummarizationTypeOptionPB, TimestampTypeOptionPB, + SingleSelectTypeOptionPB, SummarizationTypeOptionPB, TagTypeOptionPB, TimestampTypeOptionPB, TranslateTypeOptionPB, URLTypeOptionPB, }; use crate::services::cell::CellDataDecoder; use crate::services::field::checklist_type_option::ChecklistTypeOption; use crate::services::field::summary_type_option::summary::SummarizationTypeOption; +use crate::services::field::tag_type_option::tag::TagTypeOption; use crate::services::field::translate_type_option::translate::TranslateTypeOption; use crate::services::field::{ CheckboxTypeOption, DateTypeOption, MultiSelectTypeOption, NumberTypeOption, RelationTypeOption, @@ -190,6 +191,7 @@ pub fn type_option_data_from_pb>( FieldType::Translate => { TranslateTypeOptionPB::try_from(bytes).map(|pb| TranslateTypeOption::from(pb).into()) }, + FieldType::Tag => TagTypeOptionPB::try_from(bytes).map(|pb| TagTypeOption::from(pb).into()), } } @@ -263,6 +265,10 @@ pub fn type_option_to_pb(type_option: TypeOptionData, field_type: &FieldType) -> .try_into() .unwrap() }, + FieldType::Tag => { + let tag_type_option: TagTypeOption = type_option.into(); + TagTypeOptionPB::from(tag_type_option).try_into().unwrap() + }, } } @@ -284,5 +290,6 @@ pub fn default_type_option_data_from_type(field_type: FieldType) -> TypeOptionDa FieldType::Relation => RelationTypeOption::default().into(), FieldType::Summary => SummarizationTypeOption::default().into(), FieldType::Translate => TranslateTypeOption::default().into(), + FieldType::Tag => TagTypeOption::default().into(), } } diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs index 19f7faf31b..d1a5f72963 100644 --- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs +++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/type_option_cell.rs @@ -11,6 +11,7 @@ use lib_infra::box_any::BoxAny; use crate::entities::FieldType; use crate::services::cell::{CellCache, CellDataChangeset, CellDataDecoder, CellProtobufBlob}; use crate::services::field::summary_type_option::summary::SummarizationTypeOption; +use crate::services::field::tag_type_option::tag::TagTypeOption; use crate::services::field::translate_type_option::translate::TranslateTypeOption; use crate::services::field::{ CheckboxTypeOption, ChecklistTypeOption, DateTypeOption, MultiSelectTypeOption, NumberTypeOption, @@ -460,6 +461,18 @@ impl<'a> TypeOptionCellExt<'a> { self.cell_data_cache.clone(), ) }), + FieldType::Tag => { + self + .field + .get_type_option::(field_type) + .map(|type_option| { + TypeOptionCellDataHandlerImpl::new_with_boxed( + type_option, + field_type, + self.cell_data_cache.clone(), + ) + }) + }, } } @@ -566,6 +579,9 @@ fn get_type_option_transform_handler( FieldType::Translate => { Box::new(TranslateTypeOption::from(type_option_data)) as Box }, + FieldType::Tag => { + Box::new(TagTypeOption::from(type_option_data)) as Box + }, } } diff --git a/frontend/rust-lib/flowy-database2/src/services/filter/entities.rs b/frontend/rust-lib/flowy-database2/src/services/filter/entities.rs index 3b7d6444ef..e0971eeb52 100644 --- a/frontend/rust-lib/flowy-database2/src/services/filter/entities.rs +++ b/frontend/rust-lib/flowy-database2/src/services/filter/entities.rs @@ -282,6 +282,7 @@ impl FilterInner { FieldType::Relation => BoxAny::new(RelationFilterPB::parse(condition as u8, content)), FieldType::Summary => BoxAny::new(TextFilterPB::parse(condition as u8, content)), FieldType::Translate => BoxAny::new(TextFilterPB::parse(condition as u8, content)), + FieldType::Tag => BoxAny::new(TextFilterPB::parse(condition as u8, content)), }; FilterInner::Data { @@ -372,6 +373,10 @@ impl<'a> From<&'a Filter> for FilterMap { let filter = condition_and_content.cloned::()?; (filter.condition as u8, filter.content) }, + FieldType::Tag => { + let filter = condition_and_content.cloned::()?; + (filter.condition as u8, filter.content) + }, }; Some((condition, content)) }; diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs index 70d3cd77a3..e3bfb091d7 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/board_mock_data.rs @@ -135,6 +135,7 @@ pub fn make_test_board() -> DatabaseData { fields.push(relation_field); }, FieldType::Translate => {}, + FieldType::Tag => {}, } } diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs index 0666d9171c..a77f8cf1e6 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/grid_mock_data.rs @@ -6,6 +6,7 @@ use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, T use event_integration_test::database_event::TestRowBuilder; use flowy_database2::entities::FieldType; use flowy_database2::services::field::summary_type_option::summary::SummarizationTypeOption; +use flowy_database2::services::field::tag_type_option::tag::TagTypeOption; use flowy_database2::services::field::translate_type_option::translate::TranslateTypeOption; use flowy_database2::services::field::{ ChecklistTypeOption, DateFormat, DateTypeOption, FieldBuilder, MultiSelectTypeOption, @@ -143,6 +144,13 @@ pub fn make_test_grid() -> DatabaseData { .build(); fields.push(translate_field); }, + FieldType::Tag => { + let type_option = TagTypeOption { tags: vec![] }; + let translate_field = FieldBuilder::new(field_type, type_option) + .name("AI Tag") + .build(); + fields.push(translate_field); + }, } } diff --git a/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs b/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs index 5297ff14de..2da7a320f3 100644 --- a/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs +++ b/frontend/rust-lib/flowy-database2/tests/database/share_test/export_test.rs @@ -84,6 +84,7 @@ async fn export_and_then_import_meta_csv_test() { FieldType::Relation => {}, FieldType::Summary => {}, FieldType::Translate => {}, + FieldType::Tag => {}, } } else { panic!( @@ -168,6 +169,7 @@ async fn history_database_import_test() { FieldType::Relation => {}, FieldType::Summary => {}, FieldType::Translate => {}, + FieldType::Tag => {}, } } else { panic!( 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 f44a82ad3e..b708168922 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 @@ -1,6 +1,7 @@ use anyhow::Error; use client_api::entity::ai_dto::{ - SummarizeRowData, SummarizeRowParams, TranslateRowData, TranslateRowParams, + SummarizeRowData, SummarizeRowParams, TagRowData, TagRowParams, TagRowResponse, TranslateRowData, + TranslateRowParams, }; use client_api::entity::QueryCollabResult::{Failed, Success}; use client_api::entity::{QueryCollab, QueryCollabParams}; @@ -13,7 +14,7 @@ use std::sync::Arc; use tracing::{error, instrument}; use flowy_database_pub::cloud::{ - CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, + CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, TagRowContent, TranslateRowContent, TranslateRowResponse, }; use lib_infra::future::FutureResult; @@ -164,4 +165,19 @@ where Ok(data) }) } + + fn tag_database_row( + &self, + workspace_id: &str, + tag_row: TagRowContent, + ) -> FutureResult { + let workspace_id = workspace_id.to_string(); + let try_get_client = self.inner.try_get_client(); + FutureResult::new(async move { + let data = tag_row; + let params = TagRowParams { workspace_id, data }; + let data = try_get_client?.tag_row(params).await?; + Ok(data) + }) + } } diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs index 6c923d7d89..cd7bfbd4fc 100644 --- a/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs +++ b/frontend/rust-lib/flowy-server/src/local_server/impls/database.rs @@ -1,11 +1,12 @@ use anyhow::Error; +use client_api::entity::ai_dto::TagRowResponse; use collab::preclude::Collab; use collab_entity::define::{DATABASE, DATABASE_ROW_DATA, WORKSPACE_DATABASES}; use collab_entity::CollabType; use yrs::{Any, MapPrelim}; use flowy_database_pub::cloud::{ - CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, + CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, TagRowContent, TranslateRowContent, TranslateRowResponse, }; use lib_infra::future::FutureResult; @@ -96,4 +97,12 @@ impl DatabaseCloudService for LocalServerDatabaseCloudServiceImpl { // TODO(lucas): local ai FutureResult::new(async move { Ok(TranslateRowResponse::default()) }) } + + fn tag_database_row( + &self, + workspace_id: &str, + tag_row: TagRowContent, + ) -> FutureResult { + FutureResult::new(async move { Ok(TagRowResponse::default()) }) + } } diff --git a/frontend/rust-lib/flowy-server/src/supabase/api/database.rs b/frontend/rust-lib/flowy-server/src/supabase/api/database.rs index afba36d585..8d3742009a 100644 --- a/frontend/rust-lib/flowy-server/src/supabase/api/database.rs +++ b/frontend/rust-lib/flowy-server/src/supabase/api/database.rs @@ -1,9 +1,10 @@ use anyhow::Error; +use client_api::entity::ai_dto::TagRowResponse; use collab_entity::CollabType; use tokio::sync::oneshot::channel; use flowy_database_pub::cloud::{ - CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, + CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot, SummaryRowContent, TagRowContent, TranslateRowContent, TranslateRowResponse, }; use lib_dispatch::prelude::af_spawn; @@ -115,4 +116,12 @@ where ) -> FutureResult { FutureResult::new(async move { Ok(TranslateRowResponse::default()) }) } + + fn tag_database_row( + &self, + workspace_id: &str, + tag_row: TagRowContent, + ) -> FutureResult { + FutureResult::new(async move { Ok(TagRowResponse::default()) }) + } }