Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
Upgrade Rust edition (Do not merge into 0.9.2 version) (#7925)
Nathan.fooofed9d43fc55b
diff --git a/.github/workflows/android_ci.yaml.bak b/.github/workflows/android_ci.yaml.bakindex 27e680eada..3c867931a4 100644--- a/.github/workflows/android_ci.yaml.bak+++ b/.github/workflows/android_ci.yaml.bak@@ -19,7 +19,7 @@ on:env:CARGO_TERM_COLOR: alwaysFLUTTER_VERSION: "3.27.4"- RUST_TOOLCHAIN: "1.84.0"+ RUST_TOOLCHAIN: "1.85.0"CARGO_MAKE_VERSION: "0.37.18"CLOUD_VERSION: 0.6.54-amd64diff --git a/.github/workflows/flutter_ci.yaml b/.github/workflows/flutter_ci.yamlindex dc54aa089f..8ac44ffbcf 100644--- a/.github/workflows/flutter_ci.yaml+++ b/.github/workflows/flutter_ci.yaml@@ -26,7 +26,7 @@ on:env:CARGO_TERM_COLOR: alwaysFLUTTER_VERSION: "3.27.4"- RUST_TOOLCHAIN: "1.84.0"+ RUST_TOOLCHAIN: "1.85.0"CARGO_MAKE_VERSION: "0.37.18"CLOUD_VERSION: 0.9.49-amd64diff --git a/.github/workflows/ios_ci.yaml b/.github/workflows/ios_ci.yamlindex 4459aac631..9fc90c201d 100644--- a/.github/workflows/ios_ci.yaml+++ b/.github/workflows/ios_ci.yaml@@ -19,7 +19,7 @@ on:env:FLUTTER_VERSION: "3.27.4"- RUST_TOOLCHAIN: "1.84.0"+ RUST_TOOLCHAIN: "1.85.0"concurrency:group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex dbf20499ab..85883647d1 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -7,7 +7,7 @@ on:env:FLUTTER_VERSION: "3.27.4"- RUST_TOOLCHAIN: "1.84.0"+ RUST_TOOLCHAIN: "1.85.0"jobs:create-release:diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yamlindex 6939981bd8..7b7a465fc8 100644--- a/.github/workflows/rust_ci.yaml+++ b/.github/workflows/rust_ci.yaml@@ -19,7 +19,7 @@ on:env:CARGO_TERM_COLOR: alwaysCLOUD_VERSION: 0.9.49-amd64- RUST_TOOLCHAIN: "1.84.0"+ RUST_TOOLCHAIN: "1.85.0"jobs:ubuntu-job:diff --git a/.github/workflows/rust_coverage.yml b/.github/workflows/rust_coverage.ymlindex a22e81e59a..a775706546 100644--- a/.github/workflows/rust_coverage.yml+++ b/.github/workflows/rust_coverage.yml@@ -11,7 +11,7 @@ on:env:CARGO_TERM_COLOR: alwaysFLUTTER_VERSION: "3.27.4"- RUST_TOOLCHAIN: "1.84.0"+ RUST_TOOLCHAIN: "1.85.0"jobs:tests:diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex 1da157ea65..12ede1f9e9 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -2226,7 +2226,6 @@ dependencies = ["lopdf","notify","ollama-rs",- "pin-project","protobuf","pulldown-cmark 0.13.0","reqwest 0.11.27",diff --git a/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml b/frontend/rust-lib/build-tool/flowy-codegen/Cargo.tomlindex ae07268ee9..9b8cbee00e 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml+++ b/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-codegen"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/dart_event.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/dart_event.rsindex 0a1849f877..f8d58c246a 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/dart_event.rs+++ b/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/dart_event.rs@@ -8,12 +8,12 @@ use walkdir::WalkDir;use flowy_ast::ASTResult;use crate::ast::EventASTContext;-use crate::flowy_toml::{parse_crate_config_from, CrateConfig};+use crate::flowy_toml::{CrateConfig, parse_crate_config_from};use crate::util::{is_crate_dir, is_hidden, path_string_with_component, read_file};use super::event_template::*;-pub fn gen(crate_name: &str) {+pub fn r#gen(crate_name: &str) {if std::env::var("CARGO_MAKE_WORKING_DIRECTORY").is_err() {println!("CARGO_MAKE_WORKING_DIRECTORY was not set, skip generate dart pb");return;diff --git a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/ast.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/ast.rsindex 337498f0cd..8c0071750f 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/ast.rs+++ b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/ast.rs@@ -2,8 +2,8 @@#![allow(dead_code)]#![allow(unused_imports)]#![allow(unused_results)]-use crate::protobuf_file::template::{EnumTemplate, StructTemplate, RUST_TYPE_MAP};-use crate::protobuf_file::{parse_crate_info_from_path, ProtoFile, ProtobufCrateContext};+use crate::protobuf_file::template::{EnumTemplate, RUST_TYPE_MAP, StructTemplate};+use crate::protobuf_file::{ProtoFile, ProtobufCrateContext, parse_crate_info_from_path};use crate::util::*;use fancy_regex::Regex;use flowy_ast::*;diff --git a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rsindex 677e7bcddf..e566be3d45 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs+++ b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs@@ -6,8 +6,8 @@ mod proto_gen;mod proto_info;mod template;-use crate::util::path_string_with_component;use crate::Project;+use crate::util::path_string_with_component;use itertools::Itertools;use log::info;pub use proto_gen::*;@@ -368,7 +368,7 @@ pub fn gen_proto_files(crate_name: &str) -> Vec<ProtobufCrate> {.display().to_string();- let crate_context = ProtoGenerator::gen(crate_name, &crate_path);+ let crate_context = ProtoGenerator::r#gen(crate_name, &crate_path);let proto_crates = crate_context.iter().map(|info| info.protobuf_crate.clone())diff --git a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_gen.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_gen.rsindex 1253506bd8..2c29cc273d 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_gen.rs+++ b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_gen.rs@@ -2,11 +2,11 @@#![allow(dead_code)]#![allow(unused_imports)]#![allow(unused_results)]+use crate::ProtoCache;+use crate::protobuf_file::ProtoFile;use crate::protobuf_file::ast::parse_protobuf_context_from;use crate::protobuf_file::proto_info::ProtobufCrateContext;-use crate::protobuf_file::ProtoFile;use crate::util::*;-use crate::ProtoCache;use std::collections::HashMap;use std::fs::File;use std::path::Path;@@ -14,7 +14,7 @@ use std::{fs::OpenOptions, io::Write};pub struct ProtoGenerator();impl ProtoGenerator {- pub fn gen(crate_name: &str, crate_path: &str) -> Vec<ProtobufCrateContext> {+ pub fn r#gen(crate_name: &str, crate_path: &str) -> Vec<ProtobufCrateContext> {let crate_contexts = parse_protobuf_context_from(vec![crate_path.to_owned()]);write_proto_files(&crate_contexts);write_rust_crate_mod_file(&crate_contexts);diff --git a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rsindex 9eb7bbafb3..085787dbaf 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rs+++ b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rs@@ -1,5 +1,5 @@#![allow(dead_code)]-use crate::flowy_toml::{parse_crate_config_from, CrateConfig, FlowyConfig};+use crate::flowy_toml::{CrateConfig, FlowyConfig, parse_crate_config_from};use crate::util::*;use std::fs::OpenOptions;use std::io::Write;diff --git a/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/mod.rsindex 97a7f5f529..c668edd694 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/mod.rs+++ b/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/mod.rs@@ -1,10 +1,10 @@mod event_template;+use crate::Project;use crate::ast::EventASTContext;-use crate::flowy_toml::{parse_crate_config_from, CrateConfig};+use crate::flowy_toml::{CrateConfig, parse_crate_config_from};use crate::ts_event::event_template::{EventRenderContext, EventTemplate};use crate::util::{is_crate_dir, is_hidden, path_string_with_component, read_file};-use crate::Project;use flowy_ast::ASTResult;use std::collections::HashSet;use std::fs::File;@@ -13,7 +13,7 @@ use std::path::PathBuf;use syn::Item;use walkdir::WalkDir;-pub fn gen(dest_folder_name: &str, project: Project) {+pub fn r#gen(dest_folder_name: &str, project: Project) {let root = project.event_root();let backend_service_path = project.dst();diff --git a/frontend/rust-lib/collab-integrate/Cargo.toml b/frontend/rust-lib/collab-integrate/Cargo.tomlindex 46c21818f1..a53d1d64fa 100644--- a/frontend/rust-lib/collab-integrate/Cargo.toml+++ b/frontend/rust-lib/collab-integrate/Cargo.toml@@ -1,7 +1,7 @@[package]name = "collab-integrate"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[lib]diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rsindex 3472a70f9d..5af621e7eb 100644--- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs+++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs@@ -3,7 +3,7 @@ use std::fmt::{Debug, Display};use std::sync::{Arc, Weak};use crate::CollabKVDB;-use anyhow::{anyhow, Error};+use anyhow::{Error, anyhow};use arc_swap::{ArcSwap, ArcSwapOption};use collab::core::collab::DataSource;use collab::core::collab_plugin::CollabPersistence;@@ -28,9 +28,9 @@ use collab_plugins::local_storage::indexeddb::IndexeddbDiskPlugin;pub use crate::plugin_provider::CollabCloudPluginProvider;use collab::lock::RwLock;-use collab_plugins::local_storage::kv::doc::CollabKVAction;-use collab_plugins::local_storage::kv::KVTransactionDB;use collab_plugins::local_storage::CollabPersistenceConfig;+use collab_plugins::local_storage::kv::KVTransactionDB;+use collab_plugins::local_storage::kv::doc::CollabKVAction;use collab_user::core::{UserAwareness, UserAwarenessNotifier};use crate::instant_indexed_data_provider::InstantIndexedDataWriter;@@ -379,9 +379,7 @@ impl AppFlowyCollabBuilder {let write_txn = collab_db.write_txn();trace!("flush workspace: {} {}:collab:{} to disk",- workspace_id,- collab_type,- object_id+ workspace_id, collab_type, object_id);let collab: &Collab = collab.borrow();let encode_collab =@@ -456,9 +454,7 @@ impl CollabPersistence for CollabPersistenceImpl {Ok(update_count) => {trace!("did load collab:{}-{} from disk, update_count:{}",- self.uid,- object_id,- update_count+ self.uid, object_id, update_count);},Err(err) => {diff --git a/frontend/rust-lib/collab-integrate/src/config.rs b/frontend/rust-lib/collab-integrate/src/config.rsindex c114dcc68d..6ad8b7f804 100644--- a/frontend/rust-lib/collab-integrate/src/config.rs+++ b/frontend/rust-lib/collab-integrate/src/config.rs@@ -63,8 +63,10 @@ impl AWSDynamoDBConfig {}pub fn write_env(&self) {- std::env::set_var(AWS_ACCESS_KEY_ID, &self.access_key_id);- std::env::set_var(AWS_SECRET_ACCESS_KEY, &self.secret_access_key);- std::env::set_var(AWS_REGION, &self.region);+ unsafe {+ std::env::set_var(AWS_ACCESS_KEY_ID, &self.access_key_id);+ std::env::set_var(AWS_SECRET_ACCESS_KEY, &self.secret_access_key);+ std::env::set_var(AWS_REGION, &self.region);+ }}}diff --git a/frontend/rust-lib/collab-integrate/src/lib.rs b/frontend/rust-lib/collab-integrate/src/lib.rsindex e4bde9c3e3..113cfbc641 100644--- a/frontend/rust-lib/collab-integrate/src/lib.rs+++ b/frontend/rust-lib/collab-integrate/src/lib.rs@@ -1,6 +1,6 @@pub use collab::preclude::Snapshot;-pub use collab_plugins::local_storage::CollabPersistenceConfig;pub use collab_plugins::CollabKVDB;+pub use collab_plugins::local_storage::CollabPersistenceConfig;pub mod collab_builder;pub mod config;diff --git a/frontend/rust-lib/flowy-ai-pub/Cargo.toml b/frontend/rust-lib/flowy-ai-pub/Cargo.tomlindex 9f543ef2ef..4da80c38a3 100644--- a/frontend/rust-lib/flowy-ai-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-ai-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-ai-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-ai-pub/src/cloud.rs b/frontend/rust-lib/flowy-ai-pub/src/cloud.rsindex 8e2066640e..69360cf5be 100644--- a/frontend/rust-lib/flowy-ai-pub/src/cloud.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/cloud.rs@@ -1,4 +1,5 @@use crate::cloud::ai_dto::AvailableModel;+pub use client_api::entity::QuestionStreamValue;pub use client_api::entity::ai_dto::{AppFlowyOfflineAI, CompleteTextParams, CompletionMessage, CompletionMetadata, CompletionType,CreateChatContext, CustomPrompt, LLMModel, LocalAIConfig, ModelInfo, ModelList, OutputContent,@@ -9,7 +10,6 @@ pub use client_api::entity::chat_dto::{ChatMessage, ChatMessageType, ChatRAGData, ChatSettings, ContextLoader, MessageCursor,RepeatedChatMessage, UpdateChatParams,};-pub use client_api::entity::QuestionStreamValue;pub use client_api::entity::*;pub use client_api::error::{AppResponseError, ErrorCode as AppErrorCode};use flowy_error::FlowyError;diff --git a/frontend/rust-lib/flowy-ai-pub/src/entities.rs b/frontend/rust-lib/flowy-ai-pub/src/entities.rsindex c728eea63e..00907b468e 100644--- a/frontend/rust-lib/flowy-ai-pub/src/entities.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/entities.rs@@ -1,5 +1,5 @@-use crate::cloud::workspace_dto::ViewIcon;use crate::cloud::CollabType;+use crate::cloud::workspace_dto::ViewIcon;use twox_hash::xxhash64::Hasher;use uuid::Uuid;pub const RAG_IDS: &str = "rag_ids";diff --git a/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_message_sql.rs b/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_message_sql.rsindex 0abac81a79..503c3e7ecd 100644--- a/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_message_sql.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_message_sql.rs@@ -1,14 +1,13 @@-use crate::cloud::chat_dto::ChatAuthorType;use crate::cloud::MessageCursor;+use crate::cloud::chat_dto::ChatAuthorType;use client_api::entity::chat_dto::ChatMessage;use flowy_error::{FlowyError, FlowyResult};use flowy_sqlite::upsert::excluded;use flowy_sqlite::{- diesel, insert_into,+ DBConnection, ExpressionMethods, Identifiable, Insertable, OptionalExtension, QueryResult,+ Queryable, diesel, insert_into,query_dsl::*,schema::{chat_message_table, chat_message_table::dsl},- DBConnection, ExpressionMethods, Identifiable, Insertable, OptionalExtension, QueryResult,- Queryable,};#[derive(Queryable, Insertable, Identifiable, Debug)]diff --git a/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs b/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rsindex 56f0149f06..c610167485 100644--- a/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/persistence/chat_sql.rs@@ -2,10 +2,10 @@ use diesel::sqlite::SqliteConnection;use flowy_error::FlowyResult;use flowy_sqlite::upsert::excluded;use flowy_sqlite::{+ AsChangeset, DBConnection, ExpressionMethods, Identifiable, Insertable, QueryResult, Queryable,diesel,query_dsl::*,schema::{chat_table, chat_table::dsl},- AsChangeset, DBConnection, ExpressionMethods, Identifiable, Insertable, QueryResult, Queryable,};use lib_infra::util::timestamp;use serde::{Deserialize, Serialize};diff --git a/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_metadata_sql.rs b/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_metadata_sql.rsindex adb8b72de1..f3f6af7431 100644--- a/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_metadata_sql.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_metadata_sql.rs@@ -1,10 +1,9 @@use diesel::upsert::excluded;use flowy_error::{FlowyError, FlowyResult};use flowy_sqlite::{- diesel, insert_into,+ DBConnection, ExpressionMethods, Identifiable, Insertable, Queryable, diesel, insert_into,query_dsl::*,schema::{af_collab_metadata, af_collab_metadata::dsl},- DBConnection, ExpressionMethods, Identifiable, Insertable, Queryable,};use std::collections::HashMap;use std::str::FromStr;diff --git a/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_sql.rs b/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_sql.rsindex 328400aa68..f854bbd967 100644--- a/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_sql.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/persistence/collab_sql.rs@@ -2,10 +2,9 @@ use diesel::sqlite::SqliteConnection;use flowy_error::FlowyResult;use flowy_sqlite::upsert::excluded;use flowy_sqlite::{- diesel,+ AsChangeset, ExpressionMethods, Identifiable, Insertable, Queryable, diesel,query_dsl::*,schema::{index_collab_record_table, index_collab_record_table::dsl},- AsChangeset, ExpressionMethods, Identifiable, Insertable, Queryable,};#[derive(Clone, Debug, Queryable, Insertable, AsChangeset, Identifiable)]diff --git a/frontend/rust-lib/flowy-ai-pub/src/persistence/local_model_sql.rs b/frontend/rust-lib/flowy-ai-pub/src/persistence/local_model_sql.rsindex 1e1d49b79e..2592a101a5 100644--- a/frontend/rust-lib/flowy-ai-pub/src/persistence/local_model_sql.rs+++ b/frontend/rust-lib/flowy-ai-pub/src/persistence/local_model_sql.rs@@ -2,10 +2,9 @@ use diesel::sqlite::SqliteConnection;use flowy_error::FlowyResult;use flowy_sqlite::upsert::excluded;use flowy_sqlite::{- diesel,+ ExpressionMethods, Identifiable, Insertable, Queryable, diesel,query_dsl::*,schema::{local_ai_model_table, local_ai_model_table::dsl},- ExpressionMethods, Identifiable, Insertable, Queryable,};#[derive(Clone, Default, Queryable, Insertable, Identifiable)]diff --git a/frontend/rust-lib/flowy-ai/Cargo.toml b/frontend/rust-lib/flowy-ai/Cargo.tomlindex 0611a74130..695349612f 100644--- a/frontend/rust-lib/flowy-ai/Cargo.toml+++ b/frontend/rust-lib/flowy-ai/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-ai"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html@@ -39,7 +39,6 @@ reqwest = { version = "0.11.27", features = ["json"] }sha2 = "0.10.7"base64 = "0.21.5"futures-util = "0.3.30"-pin-project = "1.1.5"flowy-storage-pub = { workspace = true }ollama-rs.workspace = trueschemars = "0.8.22"diff --git a/frontend/rust-lib/flowy-ai/build.rs b/frontend/rust-lib/flowy-ai/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-ai/build.rs+++ b/frontend/rust-lib/flowy-ai/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/flowy-ai/src/ai_manager.rs b/frontend/rust-lib/flowy-ai/src/ai_manager.rsindex 56316ca71a..7d2d7bc0a7 100644--- a/frontend/rust-lib/flowy-ai/src/ai_manager.rs+++ b/frontend/rust-lib/flowy-ai/src/ai_manager.rs@@ -6,7 +6,7 @@ use crate::entities::{use crate::local_ai::controller::{LocalAIController, LocalAISetting};use crate::middleware::chat_service_mw::ChatServiceMiddleware;use flowy_ai_pub::persistence::{- select_chat_metadata, select_chat_rag_ids, select_chat_summary, update_chat, ChatTableChangeset,+ ChatTableChangeset, select_chat_metadata, select_chat_rag_ids, select_chat_summary, update_chat,};use std::collections::HashMap;@@ -16,12 +16,12 @@ use flowy_error::{ErrorCode, FlowyError, FlowyResult};use flowy_sqlite::kv::KVStorePreferences;use crate::model_select::{- LocalAiSource, LocalModelStorageImpl, ModelSelectionControl, ServerAiSource,- ServerModelStorageImpl, SourceKey, GLOBAL_ACTIVE_MODEL_KEY,+ GLOBAL_ACTIVE_MODEL_KEY, LocalAiSource, LocalModelStorageImpl, ModelSelectionControl,+ ServerAiSource, ServerModelStorageImpl, SourceKey,};-use crate::notification::{chat_notification_builder, ChatNotification};+use crate::notification::{ChatNotification, chat_notification_builder};use flowy_ai_pub::persistence::{- batch_insert_collab_metadata, batch_select_collab_metadata, AFCollabMetadata,+ AFCollabMetadata, batch_insert_collab_metadata, batch_select_collab_metadata,};use flowy_ai_pub::user_service::AIUserService;use flowy_sqlite::DBConnection;@@ -461,8 +461,7 @@ impl AIManager {trace!("[Model Selection] notify sources: {:?}, model:{}, when disable local ai",- notify_source,- model.name+ notify_source, model.name);for source in notify_source {chat_notification_builder(&source, ChatNotification::DidUpdateSelectedModel)diff --git a/frontend/rust-lib/flowy-ai/src/ai_tool/markdown.rs b/frontend/rust-lib/flowy-ai/src/ai_tool/markdown.rsindex 745c4aa727..bd1ceb81b8 100644--- a/frontend/rust-lib/flowy-ai/src/ai_tool/markdown.rs+++ b/frontend/rust-lib/flowy-ai/src/ai_tool/markdown.rs@@ -1,4 +1,4 @@-use pulldown_cmark::{html, Options, Parser};+use pulldown_cmark::{Options, Parser, html};use std::fs;pub struct MdRead {diff --git a/frontend/rust-lib/flowy-ai/src/chat.rs b/frontend/rust-lib/flowy-ai/src/chat.rsindex 9f8af289e1..b7ad1c6b77 100644--- a/frontend/rust-lib/flowy-ai/src/chat.rs+++ b/frontend/rust-lib/flowy-ai/src/chat.rs@@ -3,15 +3,15 @@ use crate::entities::{RepeatedRelatedQuestionPB, StreamMessageParams,};use crate::middleware::chat_service_mw::ChatServiceMiddleware;-use crate::notification::{chat_notification_builder, ChatNotification};+use crate::notification::{ChatNotification, chat_notification_builder};use crate::stream_message::{AIFollowUpData, StreamMessage};use allo_isolate::Isolate;use flowy_ai_pub::cloud::{AIModel, ChatCloudService, ChatMessage, MessageCursor, QuestionStreamValue, ResponseFormat,};use flowy_ai_pub::persistence::{- select_answer_where_match_reply_message_id, select_chat_messages, upsert_chat_messages,- ChatMessageTable,+ ChatMessageTable, select_answer_where_match_reply_message_id, select_chat_messages,+ upsert_chat_messages,};use flowy_ai_pub::user_service::AIUserService;use flowy_error::{ErrorCode, FlowyError, FlowyResult};@@ -19,8 +19,8 @@ use flowy_sqlite::DBConnection;use futures::{SinkExt, StreamExt};use lib_infra::isolate_stream::IsolateSink;use std::path::PathBuf;-use std::sync::atomic::{AtomicBool, AtomicI64};use std::sync::Arc;+use std::sync::atomic::{AtomicBool, AtomicI64};use tokio::sync::{Mutex, RwLock};use tracing::{error, instrument, trace};use uuid::Uuid;@@ -77,10 +77,7 @@ impl Chat {) -> Result<ChatMessagePB, FlowyError> {trace!("[Chat] stream chat message: chat_id={}, message={}, message_type={:?}, format={:?}",- self.chat_id,- params.message,- params.message_type,- params.format,+ self.chat_id, params.message, params.message_type, params.format,);// clear@@ -329,9 +326,7 @@ impl Chat {) -> Result<ChatMessageListPB, FlowyError> {trace!("[Chat] Loading messages from disk: chat_id={}, limit={}, before_message_id={:?}",- self.chat_id,- limit,- before_message_id+ self.chat_id, limit, before_message_id);let offset = before_message_id.map_or(MessageCursor::NextBack, MessageCursor::BeforeMessageId);@@ -377,9 +372,7 @@ impl Chat {) -> Result<ChatMessageListPB, FlowyError> {trace!("[Chat] Loading new messages: chat_id={}, limit={}, after_message_id={:?}",- self.chat_id,- limit,- after_message_id,+ self.chat_id, limit, after_message_id,);let offset = after_message_id.map_or(MessageCursor::NextBack, MessageCursor::AfterMessageId);let messages = self.load_local_chat_messages(limit, offset).await?;@@ -410,10 +403,7 @@ impl Chat {) -> FlowyResult<()> {trace!("[Chat] start loading messages from remote: chat_id={}, limit={}, before_message_id={:?}, after_message_id={:?}",- self.chat_id,- limit,- before_message_id,- after_message_id+ self.chat_id, limit, before_message_id, after_message_id);let workspace_id = self.user_service.workspace_id()?;let chat_id = self.chat_id;@@ -520,9 +510,7 @@ impl Chat {trace!("[Chat] related messages: chat_id={}, message_id={}, messages:{:?}",- self.chat_id,- message_id,- resp.items+ self.chat_id, message_id, resp.items);Ok(RepeatedRelatedQuestionPB::from(resp))}@@ -531,8 +519,7 @@ impl Chat {pub async fn generate_answer(&self, question_message_id: i64) -> FlowyResult<ChatMessagePB> {trace!("[Chat] generate answer: chat_id={}, question_message_id={}",- self.chat_id,- question_message_id+ self.chat_id, question_message_id);let workspace_id = self.user_service.workspace_id()?;let answer = self@@ -552,9 +539,7 @@ impl Chat {) -> Result<Vec<ChatMessagePB>, FlowyError> {trace!("[Chat] Loading messages from disk: chat_id={}, limit={}, offset={:?}",- self.chat_id,- limit,- offset+ self.chat_id, limit, offset);let conn = self.user_service.sqlite_connection(self.uid)?;let rows = select_chat_messages(conn, &self.chat_id.to_string(), limit, offset)?.messages;@@ -590,8 +575,7 @@ impl Chat {trace!("[Chat] index file: chat_id={}, file_path={:?}",- self.chat_id,- file_path+ self.chat_id, file_path);self.chat_service@@ -605,8 +589,7 @@ impl Chat {trace!("[Chat] created index file record: chat_id={}, file_path={:?}",- self.chat_id,- file_path+ self.chat_id, file_path);Ok(())diff --git a/frontend/rust-lib/flowy-ai/src/embeddings/embedder.rs b/frontend/rust-lib/flowy-ai/src/embeddings/embedder.rsindex 2a501ecda7..c8c2b629b0 100644--- a/frontend/rust-lib/flowy-ai/src/embeddings/embedder.rs+++ b/frontend/rust-lib/flowy-ai/src/embeddings/embedder.rs@@ -1,8 +1,8 @@use crate::embeddings::indexer::EmbeddingModel;use flowy_error::FlowyResult;-use ollama_rs::generation::embeddings::request::GenerateEmbeddingsRequest;-use ollama_rs::generation::embeddings::GenerateEmbeddingsResponse;use ollama_rs::Ollama;+use ollama_rs::generation::embeddings::GenerateEmbeddingsResponse;+use ollama_rs::generation::embeddings::request::GenerateEmbeddingsRequest;use std::sync::Arc;#[derive(Debug, Clone)]diff --git a/frontend/rust-lib/flowy-ai/src/embeddings/scheduler.rs b/frontend/rust-lib/flowy-ai/src/embeddings/scheduler.rsindex fd6666fc68..b202eb662f 100644--- a/frontend/rust-lib/flowy-ai/src/embeddings/scheduler.rs+++ b/frontend/rust-lib/flowy-ai/src/embeddings/scheduler.rs@@ -1,6 +1,6 @@use crate::embeddings::embedder::{Embedder, OllamaEmbedder};use crate::embeddings::indexer::IndexerProvider;-use crate::search::summary::{summarize_documents, LLMDocument};+use crate::search::summary::{LLMDocument, summarize_documents};use flowy_ai_pub::cloud::search_dto::{SearchContentType, SearchDocumentResponseItem, SearchResult, SearchSummaryResult, Summary,};@@ -8,11 +8,11 @@ use flowy_ai_pub::entities::{EmbeddingRecord, UnindexedCollab, UnindexedData};use flowy_error::{ErrorCode, FlowyError, FlowyResult};use flowy_sqlite::internal::derives::multiconnection::chrono::Utc;use flowy_sqlite_vec::db::VectorSqliteDB;-use ollama_rs::generation::embeddings::request::{EmbeddingsInput, GenerateEmbeddingsRequest};use ollama_rs::Ollama;+use ollama_rs::generation::embeddings::request::{EmbeddingsInput, GenerateEmbeddingsRequest};use std::sync::{Arc, Weak};use tokio::select;-use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};+use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel};use tokio::sync::{broadcast, mpsc};use tracing::{debug, error, info, trace, warn};use uuid::Uuid;diff --git a/frontend/rust-lib/flowy-ai/src/event_handler.rs b/frontend/rust-lib/flowy-ai/src/event_handler.rsindex 675ee6b43a..ff4e8dfe35 100644--- a/frontend/rust-lib/flowy-ai/src/event_handler.rs+++ b/frontend/rust-lib/flowy-ai/src/event_handler.rs@@ -3,7 +3,7 @@ use crate::completion::AICompletion;use crate::entities::*;use flowy_ai_pub::cloud::{AIModel, ChatMessageType};use flowy_error::{ErrorCode, FlowyError, FlowyResult};-use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};+use lib_dispatch::prelude::{AFPluginData, AFPluginState, DataResult, data_result_ok};use std::fs;use std::path::PathBuf;use std::str::FromStr;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/context_question_chain.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/context_question_chain.rsindex 7886007030..3710899036 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/context_question_chain.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/context_question_chain.rs@@ -1,5 +1,5 @@-use crate::local_ai::chat::llm::LLMOllama;use crate::SqliteVectorStore;+use crate::local_ai::chat::llm::LLMOllama;use flowy_error::{FlowyError, FlowyResult};use flowy_sqlite_vec::entities::EmbeddedContent;use langchain_rust::language_models::llm::LLM;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/conversation_chain.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/conversation_chain.rsindex 28f2bcab45..e4155c0cae 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/conversation_chain.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/chains/conversation_chain.rs@@ -1,10 +1,10 @@+use crate::SqliteVectorStore;use crate::local_ai::chat::chains::context_question_chain::{- embedded_documents_to_context_str, ContextRelatedQuestionChain,+ ContextRelatedQuestionChain, embedded_documents_to_context_str,};use crate::local_ai::chat::chains::related_question_chain::RelatedQuestionChain;use crate::local_ai::chat::llm::LLMOllama;use crate::local_ai::chat::retriever::AFRetriever;-use crate::SqliteVectorStore;use arc_swap::ArcSwap;use async_stream::stream;use async_trait::async_trait;@@ -13,7 +13,7 @@ use flowy_ai_pub::entities::SOURCE_ID;use flowy_error::{FlowyError, FlowyResult};use flowy_sqlite_vec::entities::EmbeddedContent;use futures::Stream;-use futures_util::{pin_mut, StreamExt};+use futures_util::{StreamExt, pin_mut};use langchain_rust::chain::{Chain, ChainError, CondenseQuestionGeneratorChain, CondenseQuestionPromptBuilder,StuffDocumentBuilder, StuffQAPromptBuilder,@@ -23,7 +23,7 @@ use langchain_rust::memory::SimpleMemory;use langchain_rust::prompt::{FormatPrompter, PromptArgs};use langchain_rust::schemas::{BaseMemory, Document, Message, StreamData};use serde::{Deserialize, Serialize};-use serde_json::{json, Value};+use serde_json::{Value, json};use std::{collections::HashMap, pin::Pin, sync::Arc};use tokio::sync::Mutex;use tokio_util::either::Either;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm.rsindex 1d482cd217..0fbb639e0e 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm.rs@@ -8,10 +8,10 @@ use std::pin::Pin;use std::sync::Arc;use tokio_stream::StreamExt;+use ollama_rs::Ollama;use ollama_rs::generation::chat::request::ChatMessageRequest;use ollama_rs::generation::parameters::FormatType;use ollama_rs::models::ModelOptions;-use ollama_rs::Ollama;#[derive(Debug, Clone)]pub struct LLMOllama {diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm_chat.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm_chat.rsindex 3e3ba3da47..5ea86c0a01 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm_chat.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/llm_chat.rs@@ -1,3 +1,5 @@+use crate::SqliteVectorStore;+use crate::local_ai::chat::LLMChatInfo;use crate::local_ai::chat::chains::conversation_chain::{ConversationalRetrieverChain, ConversationalRetrieverChainBuilder,};@@ -7,8 +9,6 @@ use crate::local_ai::chat::retriever::multi_source_retriever::MultipleSourceRetruse crate::local_ai::chat::retriever::sqlite_retriever::RetrieverOption;use crate::local_ai::chat::retriever::{AFRetriever, MultipleSourceRetrieverStore};use crate::local_ai::chat::summary_memory::SummaryMemory;-use crate::local_ai::chat::LLMChatInfo;-use crate::SqliteVectorStore;use flowy_ai_pub::cloud::{QuestionStreamValue, ResponseFormat, StreamAnswer};use flowy_ai_pub::entities::{RAG_IDS, SOURCE_ID, WORKSPACE_ID};use flowy_ai_pub::user_service::AIUserService;@@ -199,8 +199,7 @@ fn create_retriever() -> Box<dyn AFRetriever> {trace!("[VectorStore]: {} create retriever with rag_ids: {:?}",- workspace_id,- rag_ids,+ workspace_id, rag_ids,);let mut stores: Vec<Arc<dyn MultipleSourceRetrieverStore>> = vec![];diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/mod.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/mod.rsindex 68dda7a88a..e89910f398 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/mod.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/mod.rs@@ -5,13 +5,13 @@ pub mod llm_chat;pub mod retriever;mod summary_memory;+use crate::SqliteVectorStore;use crate::local_ai::chat::llm::LLMOllama;use crate::local_ai::chat::llm_chat::LLMChat;use crate::local_ai::chat::retriever::MultipleSourceRetrieverStore;use crate::local_ai::completion::chain::CompletionChain;use crate::local_ai::database::summary::DatabaseSummaryChain;use crate::local_ai::database::translate::DatabaseTranslateChain;-use crate::SqliteVectorStore;use dashmap::{DashMap, Entry};use flowy_ai_pub::cloud::ai_dto::{TranslateRowData, TranslateRowResponse};use flowy_ai_pub::cloud::chat_dto::ChatAuthorType;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/mod.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/mod.rsindex 1e899e9f97..fcb7ebe3ba 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/mod.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/mod.rs@@ -13,7 +13,7 @@ pub trait AFRetriever: Send + Sync + 'static {fn set_rag_ids(&mut self, new_rag_ids: Vec<String>);async fn retrieve_documents(&self, query: &str)- -> Result<Vec<LangchainDocument>, Box<dyn Error>>;+ -> Result<Vec<LangchainDocument>, Box<dyn Error>>;}#[async_trait]diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/multi_source_retriever.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/multi_source_retriever.rsindex f6a311a832..9f9d6c86aa 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/multi_source_retriever.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/multi_source_retriever.rs@@ -63,8 +63,7 @@ impl AFRetriever for MultipleSourceRetriever {async fn retrieve_documents(&self, query: &str) -> Result<Vec<Document>, Box<dyn Error>> {trace!("[VectorStore] filters: {:?}, retrieving documents for query: {}",- self.rag_ids,- query,+ self.rag_ids, query,);// Create futures for each vector store searchdiff --git a/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/sqlite_retriever.rs b/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/sqlite_retriever.rsindex 747d802fc6..89e4ba41d1 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/sqlite_retriever.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/chat/retriever/sqlite_retriever.rs@@ -3,7 +3,7 @@ use async_trait::async_trait;use flowy_ai_pub::entities::RAG_IDS;use langchain_rust::schemas::{Document, Retriever};use langchain_rust::vectorstore::{VecStoreOptions, VectorStore};-use serde_json::{json, Value};+use serde_json::{Value, json};use std::error::Error;use tracing::trace;@@ -48,8 +48,7 @@ impl AFRetriever for SqliteVecRetriever {async fn retrieve_documents(&self, query: &str) -> Result<Vec<Document>, Box<dyn Error>> {trace!("[VectorStore] filters: {:?}, retrieving documents for query: {}",- self.options.filters,- query,+ self.options.filters, query,);match self.vector_store.as_ref() {diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/completion/stream_interpreter.rs b/frontend/rust-lib/flowy-ai/src/local_ai/completion/stream_interpreter.rsindex 0cf4500c33..758ce1da4e 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/completion/stream_interpreter.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/completion/stream_interpreter.rs@@ -1,8 +1,8 @@use flowy_ai_pub::cloud::{CompletionStreamValue, CompletionType};-use futures_util::{stream, stream::BoxStream, Stream, StreamExt};+use futures_util::{Stream, StreamExt, stream, stream::BoxStream};use langchain_rust::language_models::LLMError;use langchain_rust::schemas::StreamData;-use serde_json::{json, Value};+use serde_json::{Value, json};use std::collections::HashMap;use std::sync::{Arc, Mutex};use tracing::{debug, warn};diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rsindex 600acc8759..64943d1b7e 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/controller.rs@@ -1,7 +1,7 @@use crate::entities::LocalAIPB;use crate::local_ai::resource::{LLMResourceService, LocalAIResourceController};use crate::notification::{- chat_notification_builder, ChatNotification, APPFLOWY_AI_NOTIFICATION_KEY,+ APPFLOWY_AI_NOTIFICATION_KEY, ChatNotification, chat_notification_builder,};use anyhow::Error;use flowy_error::{FlowyError, FlowyResult};@@ -15,13 +15,13 @@ use crate::stream_message::StreamMessage;use arc_swap::ArcSwapOption;use flowy_ai_pub::cloud::AIModel;use flowy_ai_pub::persistence::{- select_local_ai_model, upsert_local_ai_model, LocalAIModelTable, ModelType,+ LocalAIModelTable, ModelType, select_local_ai_model, upsert_local_ai_model,};use flowy_ai_pub::user_service::AIUserService;use futures_util::SinkExt;use lib_infra::util::get_operating_system;-use ollama_rs::generation::embeddings::request::{EmbeddingsInput, GenerateEmbeddingsRequest};use ollama_rs::Ollama;+use ollama_rs::generation::embeddings::request::{EmbeddingsInput, GenerateEmbeddingsRequest};use serde::{Deserialize, Serialize};use std::ops::Deref;use std::path::PathBuf;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/request.rs b/frontend/rust-lib/flowy-ai/src/local_ai/request.rsindex 6d4bd3289d..2f6984219a 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/request.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/request.rs@@ -1,6 +1,6 @@-use anyhow::{anyhow, Result};-use base64::engine::general_purpose::STANDARD;+use anyhow::{Result, anyhow};use base64::Engine;+use base64::engine::general_purpose::STANDARD;use reqwest::{Client, Response, StatusCode};use sha2::{Digest, Sha256};use std::path::{Path, PathBuf};@@ -79,8 +79,7 @@ pub async fn download_model(if calculated_sha256.as_slice() != header_sha256.as_slice() {trace!("Header Sha256: {:?}, calculated Sha256:{:?}",- header_sha256,- calculated_sha256+ header_sha256, calculated_sha256);fs::remove_file(&partial_path).await?;diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rsindex 1e5a4369f0..c41d5952ea 100644--- a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs+++ b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs@@ -4,7 +4,7 @@ use lib_infra::async_trait::async_trait;use crate::entities::LackOfAIResourcePB;use crate::notification::{- chat_notification_builder, ChatNotification, APPFLOWY_AI_NOTIFICATION_KEY,+ APPFLOWY_AI_NOTIFICATION_KEY, ChatNotification, chat_notification_builder,};use flowy_ai_pub::user_service::AIUserService;use lib_infra::util::get_operating_system;diff --git a/frontend/rust-lib/flowy-ai/src/model_select.rs b/frontend/rust-lib/flowy-ai/src/model_select.rsindex 1b01818d1d..43cda1a3df 100644--- a/frontend/rust-lib/flowy-ai/src/model_select.rs+++ b/frontend/rust-lib/flowy-ai/src/model_select.rs@@ -364,7 +364,7 @@ impl ModelSource for ServerAiSource {let now = timestamp();let should_fetch = {let cached = self.cached_models.read().await;- cached.models.is_empty() || cached.timestamp.map_or(true, |ts| now - ts >= 300)+ cached.models.is_empty() || cached.timestamp.is_none_or(|ts| now - ts >= 300)};if !should_fetch {return self.cached_models.read().await.models.clone();diff --git a/frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs b/frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rsindex 71d3e37ce7..d92fd14532 100644--- a/frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs+++ b/frontend/rust-lib/flowy-ai/src/offline/offline_message_sync.rs@@ -4,8 +4,8 @@ use flowy_ai_pub::cloud::{StreamAnswer, StreamComplete, UpdateChatParams,};use flowy_ai_pub::persistence::{- update_chat_is_sync, update_chat_message_is_sync, upsert_chat, upsert_chat_messages,- ChatMessageTable, ChatTable,+ ChatMessageTable, ChatTable, update_chat_is_sync, update_chat_message_is_sync, upsert_chat,+ upsert_chat_messages,};use flowy_ai_pub::user_service::AIUserService;use flowy_error::FlowyError;diff --git a/frontend/rust-lib/flowy-ai/src/search/summary.rs b/frontend/rust-lib/flowy-ai/src/search/summary.rsindex 672517dbf8..ee04d8655a 100644--- a/frontend/rust-lib/flowy-ai/src/search/summary.rs+++ b/frontend/rust-lib/flowy-ai/src/search/summary.rs@@ -1,8 +1,8 @@use flowy_error::FlowyError;+use ollama_rs::Ollama;use ollama_rs::generation::chat::request::ChatMessageRequest;use ollama_rs::generation::chat::{ChatMessage, MessageRole};use ollama_rs::generation::parameters::{FormatType, JsonStructure};-use ollama_rs::Ollama;use schemars::JsonSchema;use serde::{Deserialize, Serialize};use serde_json::json;@@ -103,7 +103,7 @@ pub async fn summarize_documents(#[cfg(test)]mod tests {- use crate::search::summary::{summarize_documents, LLMDocument};+ use crate::search::summary::{LLMDocument, summarize_documents};use ollama_rs::Ollama;#[tokio::test]diff --git a/frontend/rust-lib/flowy-ai/tests/chat_test/qa_test.rs b/frontend/rust-lib/flowy-ai/tests/chat_test/qa_test.rsindex 93d73c2102..365ba04aa1 100644--- a/frontend/rust-lib/flowy-ai/tests/chat_test/qa_test.rs+++ b/frontend/rust-lib/flowy-ai/tests/chat_test/qa_test.rs@@ -1,4 +1,4 @@-use crate::{collect_stream, load_asset_content, setup_log, TestContext};+use crate::{TestContext, collect_stream, load_asset_content, setup_log};use flowy_ai::local_ai::chat::chains::conversation_chain::{ANSWER_WITH_SUGGESTED_QUESTION, CAN_NOT_ANSWER_WITH_CONTEXT,};@@ -53,12 +53,26 @@ async fn local_ollama_test_chat_with_multiple_docs_retrieve() {let mut chat = context.create_chat(vec![]).await;let mut ids = vec![];- for (doc, id) in [("Rust is a multiplayer survival game developed by Facepunch Studios, first released in early access in December 2013 and fully launched in February 2018. It has since become one of the most popular games in the survival genre, known for its harsh environment, intricate crafting system, and player-driven dynamics. The game is available on Windows, macOS, and PlayStation, with a community-driven approach to updates and content additions.", uuid::Uuid::new_v4()),- ("Rust is a modern, system-level programming language designed with a focus on performance, safety, and concurrency. It was created by Mozilla and first released in 2010, with its 1.0 version launched in 2015. Rust is known for providing the control and performance of languages like C and C++, but with built-in safety features that prevent common programming errors, such as memory leaks, data races, and buffer overflows.", uuid::Uuid::new_v4()),- ("Rust as a Natural Process (Oxidation) refers to the chemical reaction that occurs when metals, primarily iron, come into contact with oxygen and moisture (water) over time, leading to the formation of iron oxide, commonly known as rust. This process is a form of oxidation, where a substance reacts with oxygen in the air or water, resulting in the degradation of the metal.", uuid::Uuid::new_v4())] {- ids.push(id.to_string());- chat.embed_paragraphs(&id.to_string(), vec![doc.to_string()]).await.unwrap();- }+ for (doc, id) in [+ (+ "Rust is a multiplayer survival game developed by Facepunch Studios, first released in early access in December 2013 and fully launched in February 2018. It has since become one of the most popular games in the survival genre, known for its harsh environment, intricate crafting system, and player-driven dynamics. The game is available on Windows, macOS, and PlayStation, with a community-driven approach to updates and content additions.",+ uuid::Uuid::new_v4(),+ ),+ (+ "Rust is a modern, system-level programming language designed with a focus on performance, safety, and concurrency. It was created by Mozilla and first released in 2010, with its 1.0 version launched in 2015. Rust is known for providing the control and performance of languages like C and C++, but with built-in safety features that prevent common programming errors, such as memory leaks, data races, and buffer overflows.",+ uuid::Uuid::new_v4(),+ ),+ (+ "Rust as a Natural Process (Oxidation) refers to the chemical reaction that occurs when metals, primarily iron, come into contact with oxygen and moisture (water) over time, leading to the formation of iron oxide, commonly known as rust. This process is a form of oxidation, where a substance reacts with oxygen in the air or water, resulting in the degradation of the metal.",+ uuid::Uuid::new_v4(),+ ),+ ] {+ ids.push(id.to_string());+ chat+ .embed_paragraphs(&id.to_string(), vec![doc.to_string()])+ .await+ .unwrap();+ }chat.set_rag_ids(ids.clone());let all_docs = chat.get_all_embedded_documents().await.unwrap();@@ -95,11 +109,13 @@ async fn local_ollama_test_chat_with_multiple_docs_retrieve() {assert!(!result.sources.is_empty());assert!(result.sources[0].get(SOURCE_ID).unwrap().as_str().is_some());assert!(result.sources[0].get(SOURCE).unwrap().as_str().is_some());- assert!(result.sources[0]- .get(SOURCE_NAME)- .unwrap()- .as_str()- .is_some());+ assert!(+ result.sources[0]+ .get(SOURCE_NAME)+ .unwrap()+ .as_str()+ .is_some()+ );let stream = chat.stream_question("Japan ski resort", Default::default())diff --git a/frontend/rust-lib/flowy-ai/tests/chat_test/related_question_test.rs b/frontend/rust-lib/flowy-ai/tests/chat_test/related_question_test.rsindex 1b955f759c..9b37ac3ac6 100644--- a/frontend/rust-lib/flowy-ai/tests/chat_test/related_question_test.rs+++ b/frontend/rust-lib/flowy-ai/tests/chat_test/related_question_test.rs@@ -1,4 +1,4 @@-use crate::{collect_stream, load_asset_content, TestContext};+use crate::{TestContext, collect_stream, load_asset_content};use uuid::Uuid;#[tokio::test]diff --git a/frontend/rust-lib/flowy-ai/tests/complete_test/mod.rs b/frontend/rust-lib/flowy-ai/tests/complete_test/mod.rsindex 872b00d0dc..23215a0650 100644--- a/frontend/rust-lib/flowy-ai/tests/complete_test/mod.rs+++ b/frontend/rust-lib/flowy-ai/tests/complete_test/mod.rs@@ -4,7 +4,7 @@ use flowy_ai::local_ai::completion::chain::CompletionChain;use flowy_ai::local_ai::completion::stream_interpreter::stream_interpreter_for_completion;use flowy_ai_pub::cloud::{CompletionStreamValue, CompletionType, OutputLayout, ResponseFormat};use flowy_error::FlowyError;-use futures_util::{stream, stream::BoxStream, StreamExt};+use futures_util::{StreamExt, stream, stream::BoxStream};use langchain_rust::language_models::LLMError;use langchain_rust::schemas::StreamData;use serde_json::json;@@ -487,7 +487,10 @@ async fn test_tiny_chunks_with_mixed_tag_formats() {let (answer, comment) = collect_completion_results(result_stream).await;assert_eq!(answer, "He starts work every day at **8:00 a.m.**");- assert_eq!(comment, "* \"everyday\" should be changed to \"every day\" as it is an adverb and should not be written with the suffix \"-day\".\n* Added colon after the time for correct formatting.\n* Added zeros for clarity in time notation.");+ assert_eq!(+ comment,+ "* \"everyday\" should be changed to \"every day\" as it is an adverb and should not be written with the suffix \"-day\".\n* Added colon after the time for correct formatting.\n* Added zeros for clarity in time notation."+ );}#[tokio::test]@@ -619,7 +622,10 @@ async fn test_format_tags_with_grammar_correction() {// Assert the expected output - updated to match actual behaviorassert_eq!(answer, "He starts work every day at 8 a.m.");- assert_eq!(comment, "* The word \"everyday\" is being replaced with **`every day`**, as the first part should be hyphenated for clarity. However, in this case, it's more idiomatic to use **`every day`** without a space.\n* In British English, it's common to write out the time (e.g., \"eight o'clock\" or \"8 a.m.\"). Since the text already uses \"8 a.m.\", no correction is needed here.");+ assert_eq!(+ comment,+ "* The word \"everyday\" is being replaced with **`every day`**, as the first part should be hyphenated for clarity. However, in this case, it's more idiomatic to use **`every day`** without a space.\n* In British English, it's common to write out the time (e.g., \"eight o'clock\" or \"8 a.m.\"). Since the text already uses \"8 a.m.\", no correction is needed here."+ );}#[tokio::test]@@ -716,7 +722,10 @@ async fn test_everyday_correction_stream() {let (answer, comment) = collect_completion_results(result_stream).await;assert_eq!(answer, "He starts work every day at 8 a.m.");- assert_eq!(comment, "The error was in \"everyday\". In English, \"everyday\" is an adjective that means happening or done regularly. The correct word to use here is \"every day\", which is a noun phrase indicating a specific time period. I added a space between the two words for clarity and correctness.");+ assert_eq!(+ comment,+ "The error was in \"everyday\". In English, \"everyday\" is an adjective that means happening or done regularly. The correct word to use here is \"every day\", which is a noun phrase indicating a specific time period. I added a space between the two words for clarity and correctness."+ );}#[tokio::test]@@ -811,5 +820,8 @@ async fn test_basketball_improvement_stream() {let (answer, comment) = collect_completion_results(result_stream).await;assert_eq!(answer, "We enjoy playing basketball together as friends.");- assert_eq!(comment, "* Changed \"like\" to \"enjoy\", which is a more specific and engaging verb that conveys a stronger enthusiasm for the activity.\n* Modified the sentence structure to make it more concise and natural-sounding, using a more active voice (\"We enjoy...\") instead of a passive one (\"I like...\").");+ assert_eq!(+ comment,+ "* Changed \"like\" to \"enjoy\", which is a more specific and engaging verb that conveys a stronger enthusiasm for the activity.\n* Modified the sentence structure to make it more concise and natural-sounding, using a more active voice (\"We enjoy...\") instead of a passive one (\"I like...\")."+ );}diff --git a/frontend/rust-lib/flowy-ai/tests/main.rs b/frontend/rust-lib/flowy-ai/tests/main.rsindex 2589aa1ea0..2fba95cc6c 100644--- a/frontend/rust-lib/flowy-ai/tests/main.rs+++ b/frontend/rust-lib/flowy-ai/tests/main.rs@@ -3,9 +3,9 @@ mod complete_test;mod summary_test;mod translate_test;-use flowy_ai::local_ai::chat::llm_chat::LLMChat;-use flowy_ai::local_ai::chat::LLMChatInfo;use flowy_ai::SqliteVectorStore;+use flowy_ai::local_ai::chat::LLMChatInfo;+use flowy_ai::local_ai::chat::llm_chat::LLMChat;use flowy_ai_pub::cloud::{ContextSuggestedQuestion, QuestionStreamValue, StreamAnswer};use flowy_sqlite_vec::db::VectorSqliteDB;use langchain_rust::url::Url;@@ -14,9 +14,9 @@ use serde_json::Value;use std::sync::{Arc, Once};use tempfile::tempdir;use tokio_stream::StreamExt;+use tracing_subscriber::EnvFilter;use tracing_subscriber::fmt::Subscriber;use tracing_subscriber::util::SubscriberInitExt;-use tracing_subscriber::EnvFilter;use uuid::Uuid;pub fn setup_log() {@@ -25,7 +25,9 @@ pub fn setup_log() {let level = std::env::var("RUST_LOG").unwrap_or("trace".to_string());let mut filters = vec![];filters.push(format!("flowy_ai={}", level));- std::env::set_var("RUST_LOG", filters.join(","));+ unsafe {+ std::env::set_var("RUST_LOG", filters.join(","));+ }let subscriber = Subscriber::builder().with_ansi(true)diff --git a/frontend/rust-lib/flowy-database-pub/Cargo.toml b/frontend/rust-lib/flowy-database-pub/Cargo.tomlindex 483eeb894d..8b3f97f4b3 100644--- a/frontend/rust-lib/flowy-database-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-database-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-database-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-database2/Cargo.toml b/frontend/rust-lib/flowy-database2/Cargo.tomlindex 990f426029..25beb2aade 100644--- a/frontend/rust-lib/flowy-database2/Cargo.toml+++ b/frontend/rust-lib/flowy-database2/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-database2"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-database2/build.rs b/frontend/rust-lib/flowy-database2/build.rsindex e10aed7956..b8bcc3b9a0 100644--- a/frontend/rust-lib/flowy-database2/build.rs+++ b/frontend/rust-lib/flowy-database2/build.rs@@ -2,7 +2,7 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}// #[cfg(feature = "ts")]diff --git a/frontend/rust-lib/flowy-database2/src/entities/calendar_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/calendar_entities.rsindex 6ab424a230..7f35693e95 100644--- a/frontend/rust-lib/flowy-database2/src/entities/calendar_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/calendar_entities.rs@@ -1,8 +1,8 @@use flowy_derive::{ProtoBuf, ProtoBuf_Enum};use flowy_error::ErrorCode;-use crate::entities::parser::NotEmptyStr;use crate::entities::RowMetaPB;+use crate::entities::parser::NotEmptyStr;use crate::services::setting::{CalendarLayout, CalendarLayoutSetting};use super::CellIdPB;diff --git a/frontend/rust-lib/flowy-database2/src/entities/cell_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/cell_entities.rsindex 9af549c698..49fb1e1aa1 100644--- a/frontend/rust-lib/flowy-database2/src/entities/cell_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/cell_entities.rs@@ -5,8 +5,8 @@ use flowy_error::ErrorCode;use lib_infra::validator_fn::required_not_empty_str;use validator::Validate;-use crate::entities::parser::NotEmptyStr;use crate::entities::FieldType;+use crate::entities::parser::NotEmptyStr;#[derive(ProtoBuf, Default)]pub struct CreateSelectOptionPayloadPB {diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rsindex 8171ed11a8..13c57d2c2f 100644--- a/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/field_settings_entities.rs@@ -4,8 +4,8 @@ use lib_infra::validator_fn::required_not_empty_str;use std::ops::Deref;use validator::Validate;-use crate::entities::parser::NotEmptyStr;use crate::entities::RepeatedFieldIdPB;+use crate::entities::parser::NotEmptyStr;use crate::impl_into_field_visibility;use crate::services::field_settings::FieldSettings;diff --git a/frontend/rust-lib/flowy-database2/src/event_handler.rs b/frontend/rust-lib/flowy-database2/src/event_handler.rsindex 47e280565e..846065a0ef 100644--- a/frontend/rust-lib/flowy-database2/src/event_handler.rs+++ b/frontend/rust-lib/flowy-database2/src/event_handler.rs@@ -6,14 +6,14 @@ use tokio::sync::oneshot;use tracing::{info, instrument};use flowy_error::{FlowyError, FlowyResult};-use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};+use lib_dispatch::prelude::{AFPluginData, AFPluginState, DataResult, data_result_ok};use crate::entities::*;use crate::manager::DatabaseManager;use crate::services::field::checklist_filter::ChecklistCellChangeset;use crate::services::field::date_filter::DateCellChangeset;use crate::services::field::{- type_option_data_from_pb, RelationCellChangeset, SelectOptionCellChangeset, TypeOptionCellExt,+ RelationCellChangeset, SelectOptionCellChangeset, TypeOptionCellExt, type_option_data_from_pb,};use crate::services::group::GroupChangeset;use crate::services::share::csv::CSVFormat;diff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rsindex d79a32ff2f..80a2f7a298 100644--- a/frontend/rust-lib/flowy-database2/src/manager.rs+++ b/frontend/rust-lib/flowy-database2/src/manager.rs@@ -31,7 +31,7 @@ use collab_integrate::{CollabKVAction, CollabKVDB};use flowy_database_pub::cloud::{DatabaseAIService, DatabaseCloudService, SummaryRowContent, TranslateItem, TranslateRowContent,};-use flowy_error::{internal_error, FlowyError, FlowyResult};+use flowy_error::{FlowyError, FlowyResult, internal_error};use lib_infra::box_any::BoxAny;use lib_infra::priority_task::TaskDispatcher;@@ -614,8 +614,7 @@ impl DatabaseManager {// Call the cloud service to summarize the row.trace!("[AI]:summarize row:{}, content:{:?}",- row_id,- summary_row_content+ row_id, summary_row_content);let response = self.ai_service@@ -680,8 +679,7 @@ impl DatabaseManager {// Call the cloud service to summarize the row.trace!("[AI]:translate to {}, content:{:?}",- language,- translate_row_content+ language, translate_row_content);let response = self.ai_service@@ -841,8 +839,7 @@ impl DatabaseCollabService for WorkspaceDatabaseCollabServiceImpl {{trace!("build collab: {}:{} from local encode collab",- collab_type,- object_id+ collab_type, object_id);CollabPersistenceImpl {persistence: Some(self.persistence.clone()),@@ -1031,8 +1028,7 @@ impl DatabaseCollabPersistenceService for DatabasePersistenceImpl {Ok(update_count) => {trace!("[Database]: did load collab:{}, update_count:{}",- object_id,- update_count+ object_id, update_count);},Err(err) => {@@ -1175,8 +1171,7 @@ async fn open_database_with_retry(for attempt in 1..=max_retries {trace!("[Database]: attempt {} to open database:{}",- attempt,- database_id+ attempt, database_id);let result = workspace_database_managerdiff --git a/frontend/rust-lib/flowy-database2/src/services/calculations/entities.rs b/frontend/rust-lib/flowy-database2/src/services/calculations/entities.rsindex 34688b7367..48dd8359af 100644--- a/frontend/rust-lib/flowy-database2/src/services/calculations/entities.rs+++ b/frontend/rust-lib/flowy-database2/src/services/calculations/entities.rs@@ -1,5 +1,5 @@-use collab::preclude::encoding::serde::from_any;use collab::preclude::Any;+use collab::preclude::encoding::serde::from_any;use collab_database::views::{CalculationMap, CalculationMapBuilder};use serde::Deserialize;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.rsindex 5009c674d0..d81d140f34 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@@ -1,10 +1,10 @@use std::collections::HashMap;use std::str::FromStr;+use collab_database::fields::Field;use collab_database::fields::media_type_option::MediaCellData;use collab_database::fields::select_type_option::SelectOptionIds;-use collab_database::fields::Field;-use collab_database::rows::{get_field_type_from_cell, Cell, Cells};+use collab_database::rows::{Cell, Cells, get_field_type_from_cell};use collab_database::template::relation_parse::RelationCellData;use flowy_error::{FlowyError, FlowyResult};use lib_infra::box_any::BoxAny;@@ -243,7 +243,9 @@ impl<'a> CellBuilder<'a> {}},FieldType::LastEditedTime | FieldType::CreatedTime => {- tracing::warn!("Shouldn't insert cell data to cell whose field type is LastEditedTime or CreatedTime");+ tracing::warn!(+ "Shouldn't insert cell data to cell whose field type is LastEditedTime or CreatedTime"+ );},FieldType::SingleSelect | FieldType::MultiSelect => {if let Ok(ids) = SelectOptionIds::from_str(&cell_str) {diff --git a/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs b/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rsindex 09bd13793a..f0eefecd80 100644--- a/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs+++ b/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs@@ -1,7 +1,7 @@use bytes::Bytes;use std::fmt::Display;-use flowy_error::{internal_error, FlowyResult};+use flowy_error::{FlowyResult, internal_error};/// The data is encoded by protobuf or utf8. You should choose the corresponding decode struct to parse it.///diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rsindex cbff27d81b..d92b33ef42 100644--- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs@@ -1,7 +1,8 @@+use crate::DatabaseUser;use crate::entities::*;-use crate::notification::{database_notification_builder, DatabaseNotification};+use crate::notification::{DatabaseNotification, database_notification_builder};use crate::services::calculations::Calculation;-use crate::services::cell::{apply_cell_changeset, get_cell_protobuf, stringify_cell, CellCache};+use crate::services::cell::{CellCache, apply_cell_changeset, get_cell_protobuf, stringify_cell};use crate::services::database::database_observe::*;use crate::services::database::util::database_view_setting_pb_from_view;use crate::services::database_view::{@@ -10,16 +11,15 @@ use crate::services::database_view::{use crate::services::field::checklist_filter::ChecklistCellChangeset;use crate::services::field::type_option_transform::transform_type_option;use crate::services::field::{- default_type_option_data_from_type, select_type_option_from_field, type_option_data_from_pb,SelectOptionCellChangeset, StringCellData, TypeOptionCellDataHandler, TypeOptionCellExt,+ default_type_option_data_from_type, select_type_option_from_field, type_option_data_from_pb,};-use crate::services::field_settings::{default_field_settings_by_layout_map, FieldSettings};+use crate::services::field_settings::{FieldSettings, default_field_settings_by_layout_map};use crate::services::filter::{Filter, FilterChangeset};-use crate::services::group::{default_group_setting, GroupChangeset, GroupSetting};+use crate::services::group::{GroupChangeset, GroupSetting, default_group_setting};use crate::services::share::csv::{CSVExport, CSVFormat};use crate::services::sort::Sort;use crate::utils::cache::AnyTypeCache;-use crate::DatabaseUser;use arc_swap::ArcSwapOption;use async_trait::async_trait;use collab::core::collab_plugin::CollabPluginType;@@ -36,10 +36,10 @@ use collab_database::views::{};use collab_entity::CollabType;use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};-use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};+use flowy_error::{ErrorCode, FlowyError, FlowyResult, internal_error};use flowy_notification::DebounceNotificationSender;use futures::future::join_all;-use futures::{pin_mut, StreamExt};+use futures::{StreamExt, pin_mut};use lib_infra::box_any::BoxAny;use lib_infra::priority_task::TaskDispatcher;use lib_infra::util::timestamp;@@ -48,8 +48,8 @@ use std::str::FromStr;use std::sync::{Arc, Weak};use std::time::Duration;use tokio::select;-use tokio::sync::oneshot::Sender;use tokio::sync::RwLock as TokioRwLock;+use tokio::sync::oneshot::Sender;use tokio::sync::{broadcast, oneshot};use tokio::task::yield_now;use tokio_util::sync::CancellationToken;@@ -603,9 +603,7 @@ impl DatabaseEditor {trace!("duplicate row: {:?} at index:{}, new row:{:?}",- row_id,- index,- row_order+ row_id, index, row_order);Ok(())@@ -641,9 +639,7 @@ impl DatabaseEditor {})?;trace!("Move row:{} from group:{} to group:{}",- from_row,- from_group,- to_group+ from_row, from_group, to_group);// when moving row between groups, the cells of the row should be updateddiff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_observe.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_observe.rsindex 1c965995ec..9501bd1419 100644--- a/frontend/rust-lib/flowy-database2/src/services/database/database_observe.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_observe.rs@@ -1,6 +1,6 @@use crate::entities::{DatabaseSyncStatePB, DidFetchRowPB, RowsChangePB};use crate::notification::{- database_notification_builder, DatabaseNotification, DATABASE_OBSERVABLE_SOURCE,+ DATABASE_OBSERVABLE_SOURCE, DatabaseNotification, database_notification_builder,};use crate::services::database::{DatabaseEditor, UpdatedRow};use crate::services::database_view::DatabaseViewEditor;@@ -52,8 +52,7 @@ pub(crate) async fn observe_rows_change(while let Ok(row_change) = row_change.recv().await {trace!("[Database Observe]: {} row change:{:?}",- database_id,- row_change+ database_id, row_change);if let Some(database) = weak_database.upgrade() {match row_change {@@ -99,8 +98,7 @@ pub(crate) async fn observe_field_change(database_id: &str, database: &Arc<RwLoctrace!("[Database Observe]: {} field change:{:?}",- database_id,- field_change+ database_id, field_change);match field_change {FieldChange::DidUpdateField { .. } => {},@@ -127,8 +125,7 @@ pub(crate) async fn observe_view_change(database_id: &Uuid, database_editor: &Arwhile let Ok(view_change) = view_change.recv().await {trace!("[Database View Observe]: {} view change:{:?}",- database_id,- view_change+ database_id, view_change);match weak_database_editor.upgrade() {None => break,@@ -216,9 +213,7 @@ async fn handle_did_update_row_orders({trace!("[RowOrder]: insert row:{} at index:{}, is_local:{}",- row_order.id,- index,- is_local_change+ row_order.id, index, is_local_change);// insert row order in database view cache@@ -259,10 +254,7 @@ async fn handle_did_update_row_orders(if let Some(row) = view_editor.row_by_row_id.get(lazy_row.id.as_str()) {trace!("[RowOrder]: delete row:{} at index:{}, is_move_row: {}, is_local:{}",- row.id,- index,- row_change.is_move_row,- is_local_change+ row.id, index, row_change.is_move_row, is_local_change);view_editor.v_did_delete_row(&row, row_change.is_move_row, is_local_change)@@ -306,8 +298,7 @@ pub(crate) async fn observe_block_event(database_id: &Uuid, database_editor: &Artrace!("[Database Observe]: {} block event: {:?}",- database_id,- event+ database_id, event);match event {BlockEvent::DidFetchRow(row_details) => {diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rsindex 9316726663..fd291457cf 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs@@ -2,10 +2,10 @@ use crate::entities::FieldType;use crate::services::field_settings::default_field_settings_by_layout_map;use crate::services::setting::{BoardLayoutSetting, CalendarLayoutSetting};use collab::lock::RwLock;-use collab_database::database::{gen_field_id, Database};+use collab_database::database::{Database, gen_field_id};+use collab_database::fields::Field;use collab_database::fields::date_type_option::DateTypeOption;use collab_database::fields::select_type_option::SingleSelectTypeOption;-use collab_database::fields::Field;use collab_database::views::{DatabaseLayout, FieldSettingsByFieldIdMap, LayoutSetting, OrderObjectPosition,};diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rsindex a3a5e6f484..d690e0fb88 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/notifier.rs@@ -4,7 +4,7 @@ use crate::entities::{GroupChangesPB, GroupRowsNotificationPB, ReorderAllRowsPB, ReorderSingleRowPB,RowsVisibilityChangePB, SortChangesetNotificationPB,};-use crate::notification::{database_notification_builder, DatabaseNotification};+use crate::notification::{DatabaseNotification, database_notification_builder};use crate::services::filter::FilterResultNotification;use crate::services::sort::{ReorderAllRowsResult, ReorderSingleRowResult};use async_stream::stream;diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_calculations.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_calculations.rsindex 301be9fbe9..534025e928 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_calculations.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_calculations.rs@@ -9,7 +9,7 @@ use crate::services::calculations::{};use crate::services::database_view::{- gen_handler_id, DatabaseViewChangedNotifier, DatabaseViewOperation,+ DatabaseViewChangedNotifier, DatabaseViewOperation, gen_handler_id,};pub async fn make_calculations_controller(diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rsindex e287373142..47db19eba1 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs@@ -2,7 +2,7 @@ use std::borrow::Cow;use std::collections::HashMap;use std::sync::Arc;-use super::{notify_did_update_calculation, DatabaseViewChanged};+use super::{DatabaseViewChanged, notify_did_update_calculation};use crate::entities::{CalculationChangesetNotificationPB, CalendarEventPB, CreateRowPayloadPB, DatabaseLayoutMetaPB,DatabaseLayoutSettingPB, DeleteSortPayloadPB, FieldSettingsChangesetPB, FieldType,@@ -10,19 +10,19 @@ use crate::entities::{RemoveCalculationChangesetPB, ReorderSortPayloadPB, RowMetaPB, RowsChangePB,SortChangesetNotificationPB, SortPB, UpdateCalculationChangesetPB, UpdateSortPayloadPB,};-use crate::notification::{database_notification_builder, DatabaseNotification};+use crate::notification::{DatabaseNotification, database_notification_builder};use crate::services::calculations::{Calculation, CalculationChangeset, CalculationsController};use crate::services::cell::{CellBuilder, CellCache};-use crate::services::database::{database_view_setting_pb_from_view, DatabaseRowEvent, UpdatedRow};+use crate::services::database::{DatabaseRowEvent, UpdatedRow, database_view_setting_pb_from_view};use crate::services::database_view::view_calculations::make_calculations_controller;use crate::services::database_view::view_filter::make_filter_controller;use crate::services::database_view::view_group::{get_cell_for_row, new_group_controller};use crate::services::database_view::view_operation::DatabaseViewOperation;use crate::services::database_view::view_sort::make_sort_controller;use crate::services::database_view::{+ DatabaseLayoutDepsResolver, DatabaseViewChangedNotifier, DatabaseViewChangedReceiverRunner,notify_did_update_filter, notify_did_update_group_rows, notify_did_update_num_of_groups,- notify_did_update_setting, notify_did_update_sort, DatabaseLayoutDepsResolver,- DatabaseViewChangedNotifier, DatabaseViewChangedReceiverRunner,+ notify_did_update_setting, notify_did_update_sort,};use crate::services::field_settings::FieldSettings;use crate::services::filter::{Filter, FilterChangeset, FilterController};@@ -40,7 +40,7 @@ use dashmap::DashMap;use flowy_error::{FlowyError, FlowyResult};use lib_infra::util::timestamp;-use tokio::sync::{broadcast, RwLock};+use tokio::sync::{RwLock, broadcast};use tracing::{error, instrument, trace, warn};pub struct DatabaseViewEditor {diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_filter.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_filter.rsindex 91341ae3b3..ef8d075c98 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_filter.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_filter.rs@@ -3,7 +3,7 @@ use std::sync::Arc;use crate::services::cell::CellCache;use crate::services::database_view::{- gen_handler_id, DatabaseViewChangedNotifier, DatabaseViewOperation,+ DatabaseViewChangedNotifier, DatabaseViewOperation, gen_handler_id,};use crate::services::filter::{Filter, FilterController, FilterDelegate, FilterTaskHandler};use collab_database::fields::Field;diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_group.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_group.rsindex 63d4ca99a0..7075110ddb 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_group.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_group.rs@@ -11,8 +11,8 @@ use crate::services::database_view::DatabaseViewOperation;use crate::services::field::RowSingleCellData;use crate::services::filter::FilterController;use crate::services::group::{- make_group_controller, GroupContextDelegate, GroupController, GroupControllerDelegate,- GroupSetting,+ GroupContextDelegate, GroupController, GroupControllerDelegate, GroupSetting,+ make_group_controller,};pub async fn new_group_controller(diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_sort.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_sort.rsindex 53b70a42ca..8a9e9bf183 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_sort.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_sort.rs@@ -7,7 +7,7 @@ use tokio::sync::RwLock;use crate::services::cell::CellCache;use crate::services::database_view::{- gen_handler_id, DatabaseViewChangedNotifier, DatabaseViewOperation,+ DatabaseViewChangedNotifier, DatabaseViewOperation, gen_handler_id,};use crate::services::filter::FilterController;use crate::services::sort::{Sort, SortController, SortDelegate, SortTaskHandler};diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_option_transform.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_option_transform.rsindex e5972ea064..71c701acda 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_option_transform.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_option_transform.rs@@ -2,6 +2,7 @@ use crate::entities::FieldType;use crate::services::field::TypeOptionTransform;use async_trait::async_trait;use collab_database::database::Database;+use collab_database::fields::TypeOptionData;use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::fields::checklist_type_option::ChecklistTypeOption;use collab_database::fields::date_type_option::{DateTypeOption, TimeTypeOption};@@ -14,7 +15,6 @@ use collab_database::fields::text_type_option::RichTextTypeOption;use collab_database::fields::timestamp_type_option::TimestampTypeOption;use collab_database::fields::translate_type_option::TranslateTypeOption;use collab_database::fields::url_type_option::URLTypeOption;-use collab_database::fields::TypeOptionData;pub async fn transform_type_option(view_id: &str,diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_tests.rsindex c0a0eadd86..8d26174c6c 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_tests.rs@@ -7,8 +7,8 @@ mod tests {use crate::entities::CheckboxCellDataPB;use crate::entities::FieldType;use crate::services::cell::CellDataDecoder;- use crate::services::field::type_options::checkbox_type_option::*;use crate::services::field::FieldBuilder;+ use crate::services::field::type_options::checkbox_type_option::*;use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::template::util::ToCellString;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rsindex 6afe4c4b57..5259acfad0 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rs@@ -1,8 +1,8 @@use std::cmp::Ordering;use std::str::FromStr;-use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::fields::Field;+use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::rows::Cell;use collab_database::template::util::ToCellString;use flowy_error::FlowyResult;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rsindex 55ca8dd77f..bb9fd64e4a 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checkbox_type_option/checkbox_type_option_entities.rs@@ -2,13 +2,13 @@ use std::str::FromStr;use bytes::Bytes;use collab::util::AnyMapExt;-use collab_database::rows::{new_cell_builder, Cell};+use collab_database::rows::{Cell, new_cell_builder};use collab_database::template::util::ToCellString;use flowy_error::{FlowyError, FlowyResult};use crate::entities::{CheckboxCellDataPB, FieldType};use crate::services::cell::CellProtobufBlobParser;-use crate::services::field::{TypeOptionCellData, CELL_DATA};+use crate::services::field::{CELL_DATA, TypeOptionCellData};pub const CHECK: &str = "Yes";pub const UNCHECK: &str = "No";diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_filter.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_filter.rsindex 5fa9c11242..2405824bd5 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_filter.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_filter.rs@@ -2,8 +2,8 @@ use crate::entities::ChecklistCellDataChangesetPB;use crate::entities::{ChecklistFilterConditionPB, ChecklistFilterPB};use crate::services::filter::PreFillCellsWithFilter;-use collab_database::fields::select_type_option::SelectOption;use collab_database::fields::Field;+use collab_database::fields::select_type_option::SelectOption;use collab_database::rows::Cell;use collab_database::template::check_list_parse::ChecklistCellData;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_type_option.rsindex a9043f227c..f9511c6e6c 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/checklist_type_option/checklist_type_option.rs@@ -1,13 +1,13 @@use crate::entities::{ChecklistCellDataPB, ChecklistFilterPB, SelectOptionPB};use crate::services::cell::{CellDataChangeset, CellDataDecoder};-use crate::services::field::checklist_filter::{checklist_from_options, ChecklistCellChangeset};+use crate::services::field::checklist_filter::{ChecklistCellChangeset, checklist_from_options};use crate::services::field::{CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare, TypeOptionCellDataFilter,TypeOptionTransform,};use crate::services::sort::SortCondition;use collab_database::fields::checklist_type_option::ChecklistTypeOption;-use collab_database::fields::select_type_option::{SelectOption, SELECTION_IDS_SEPARATOR};+use collab_database::fields::select_type_option::{SELECTION_IDS_SEPARATOR, SelectOption};use collab_database::rows::Cell;use collab_database::template::check_list_parse::ChecklistCellData;use collab_database::template::util::TypeOptionCellData;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_filter.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_filter.rsindex 3f0808fac2..6cd0fb1ac0 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_filter.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_filter.rs@@ -4,11 +4,11 @@ use crate::services::filter::PreFillCellsWithFilter;use bytes::Bytes;use chrono::{Duration, Local, NaiveDate, TimeZone};-use collab_database::fields::date_type_option::DateCellData;use collab_database::fields::Field;+use collab_database::fields::date_type_option::DateCellData;use collab_database::rows::Cell;use collab_database::template::timestamp_parse::TimestampCellData;-use flowy_error::{internal_error, FlowyResult};+use flowy_error::{FlowyResult, internal_error};use crate::entities::DateCellDataPB;use crate::services::cell::CellProtobufBlobParser;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rsindex d9739fa792..aa8f9b601e 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/date_type_option/date_type_option.rs@@ -14,8 +14,8 @@ use crate::entities::{DateCellDataPB, DateFilterPB, FieldType};use crate::services::cell::{CellDataChangeset, CellDataDecoder};use crate::services::field::date_type_option::date_filter::DateCellChangeset;use crate::services::field::{- default_order, CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare,- TypeOptionCellDataFilter, TypeOptionTransform, CELL_DATA,+ CELL_DATA, CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare,+ TypeOptionCellDataFilter, TypeOptionTransform, default_order,};use crate::services::sort::SortCondition;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/media_type_option/media_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/media_type_option/media_type_option.rsindex 6fca683358..849eb33d7b 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/media_type_option/media_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/media_type_option/media_type_option.rs@@ -3,8 +3,8 @@ use crate::{services::{cell::{CellDataChangeset, CellDataDecoder},field::{- default_order, CellDataProtobufEncoder, TypeOption, TypeOptionCellData,- TypeOptionCellDataCompare, TypeOptionCellDataFilter, TypeOptionTransform,+ CellDataProtobufEncoder, TypeOption, TypeOptionCellData, TypeOptionCellDataCompare,+ TypeOptionCellDataFilter, TypeOptionTransform, default_order,},sort::SortCondition,},diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_filter.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_filter.rsindex 01b6f6dd90..5cf8c1ccee 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_filter.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_filter.rs@@ -1,7 +1,7 @@use std::str::FromStr;-use collab_database::fields::number_type_option::NumberCellFormat;use collab_database::fields::Field;+use collab_database::fields::number_type_option::NumberCellFormat;use collab_database::rows::Cell;use rust_decimal::Decimal;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/relation_type_option/relation.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/relation_type_option/relation.rsindex 1ed1d6b1be..31c2fda68b 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/relation_type_option/relation.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/relation_type_option/relation.rs@@ -10,8 +10,8 @@ use flowy_error::FlowyResult;use crate::entities::{RelationCellDataPB, RelationFilterPB};use crate::services::cell::{CellDataChangeset, CellDataDecoder};use crate::services::field::{- default_order, CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare,- TypeOptionCellDataFilter, TypeOptionTransform,+ CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare, TypeOptionCellDataFilter,+ TypeOptionTransform, default_order,};use crate::services::sort::SortCondition;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/multi_select_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/multi_select_type_option.rsindex 63356d9a04..4125ed8954 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/multi_select_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/multi_select_type_option.rs@@ -1,15 +1,15 @@use crate::entities::{FieldType, SelectOptionCellDataPB, SelectOptionFilterPB};use crate::services::cell::CellDataChangeset;use crate::services::field::{- default_order, CellDataProtobufEncoder, SelectOptionCellChangeset, SelectTypeOptionSharedAction,- TypeOption, TypeOptionCellDataCompare, TypeOptionCellDataFilter,+ CellDataProtobufEncoder, SelectOptionCellChangeset, SelectTypeOptionSharedAction, TypeOption,+ TypeOptionCellDataCompare, TypeOptionCellDataFilter, default_order,};use crate::services::sort::SortCondition;+use collab_database::fields::TypeOptionData;use collab_database::fields::select_type_option::{MultiSelectTypeOption, SelectOption, SelectOptionIds,};-use collab_database::fields::TypeOptionData;use collab_database::rows::Cell;use flowy_error::FlowyResult;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_filter.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_filter.rsindex af1ff97368..8102e4a260 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_filter.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_filter.rs@@ -1,5 +1,5 @@-use collab_database::fields::select_type_option::SelectOption;use collab_database::fields::Field;+use collab_database::fields::select_type_option::SelectOption;use collab_database::rows::Cell;use crate::entities::{SelectOptionFilterConditionPB, SelectOptionFilterPB};diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_type_option.rsindex dde93d4f50..7d012e761a 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/select_type_option.rs@@ -8,13 +8,13 @@ use async_trait::async_trait;use bytes::Bytes;use collab_database::database::Database;use collab_database::fields::select_type_option::{- MultiSelectTypeOption, SelectOption, SelectOptionColor, SelectOptionIds, SingleSelectTypeOption,- SELECTION_IDS_SEPARATOR,+ MultiSelectTypeOption, SELECTION_IDS_SEPARATOR, SelectOption, SelectOptionColor, SelectOptionIds,+ SingleSelectTypeOption,};use collab_database::fields::{Field, TypeOptionData};use collab_database::rows::Cell;use collab_database::template::util::ToCellString;-use flowy_error::{internal_error, ErrorCode, FlowyResult};+use flowy_error::{ErrorCode, FlowyResult, internal_error};use std::str::FromStr;/// Defines the shared actions used by SingleSelect or Multi-Select.diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/single_select_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/single_select_type_option.rsindex 993f25b47f..308b0b1df9 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/single_select_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/single_select_type_option.rs@@ -1,16 +1,16 @@use crate::entities::{FieldType, SelectOptionCellDataPB, SelectOptionFilterPB};use crate::services::cell::CellDataChangeset;use crate::services::field::{- default_order, CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare,- TypeOptionCellDataFilter,+ CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare, TypeOptionCellDataFilter,+ default_order,};use crate::services::field::{SelectOptionCellChangeset, SelectTypeOptionSharedAction};use crate::services::sort::SortCondition;+use collab_database::fields::TypeOptionData;use collab_database::fields::select_type_option::{SelectOption, SelectOptionIds, SingleSelectTypeOption,};-use collab_database::fields::TypeOptionData;use collab_database::rows::Cell;use flowy_error::FlowyResult;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/type_option_transform.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/type_option_transform.rsindex b085bab09d..2d2a0968d9 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/type_option_transform.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/selection_type_option/type_option_transform.rs@@ -1,12 +1,12 @@use crate::entities::FieldType;use crate::services::cell::CellDataDecoder;-use crate::services::field::{SelectTypeOptionSharedAction, TypeOption, CHECK, UNCHECK};+use crate::services::field::{CHECK, SelectTypeOptionSharedAction, TypeOption, UNCHECK};use collab_database::database::Database;+use collab_database::fields::TypeOptionData;use collab_database::fields::select_type_option::{- SelectOption, SelectOptionColor, SelectOptionIds, SelectTypeOption, SELECTION_IDS_SEPARATOR,+ SELECTION_IDS_SEPARATOR, SelectOption, SelectOptionColor, SelectOptionIds, SelectTypeOption,};use collab_database::fields::text_type_option::RichTextTypeOption;-use collab_database::fields::TypeOptionData;use collab_database::template::option_parse::build_options_from_cells;use tracing::info;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.rsindex 6872d97d95..c8c2b498db 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@@ -1,18 +1,18 @@use collab::util::AnyMapExt;use std::cmp::Ordering;-use collab_database::fields::text_type_option::RichTextTypeOption;use collab_database::fields::Field;-use collab_database::rows::{new_cell_builder, Cell};+use collab_database::fields::text_type_option::RichTextTypeOption;+use collab_database::rows::{Cell, new_cell_builder};use collab_database::template::util::ToCellString;use flowy_error::{FlowyError, FlowyResult};use crate::entities::{FieldType, TextFilterPB};-use crate::services::cell::{stringify_cell, CellDataChangeset, CellDataDecoder};+use crate::services::cell::{CellDataChangeset, CellDataDecoder, stringify_cell};use crate::services::field::type_options::util::ProtobufStr;use crate::services::field::{- CellDataProtobufEncoder, TypeOption, TypeOptionCellData, TypeOptionCellDataCompare,- TypeOptionCellDataFilter, TypeOptionTransform, CELL_DATA,+ CELL_DATA, CellDataProtobufEncoder, TypeOption, TypeOptionCellData, TypeOptionCellDataCompare,+ TypeOptionCellDataFilter, TypeOptionTransform,};use crate::services::sort::SortCondition;diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rsindex 528f4df01b..44be6ab27c 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs@@ -1,8 +1,8 @@use crate::entities::{DateFilterPB, TimestampCellDataPB};use crate::services::cell::{CellDataChangeset, CellDataDecoder};use crate::services::field::{- default_order, CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare,- TypeOptionCellDataFilter, TypeOptionTransform,+ CellDataProtobufEncoder, TypeOption, TypeOptionCellDataCompare, TypeOptionCellDataFilter,+ TypeOptionTransform, default_order,};use crate::services::sort::SortCondition;use collab_database::fields::timestamp_type_option::TimestampTypeOption;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.rsindex 27b2f05f9a..3dcc92fe3f 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@@ -6,6 +6,7 @@ use crate::services::field::{};use crate::services::sort::SortCondition;use collab::preclude::Any;+use collab_database::fields::Field;use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::fields::checklist_type_option::ChecklistTypeOption;use collab_database::fields::date_type_option::{DateTypeOption, TimeTypeOption};@@ -18,13 +19,12 @@ use collab_database::fields::text_type_option::RichTextTypeOption;use collab_database::fields::timestamp_type_option::TimestampTypeOption;use collab_database::fields::translate_type_option::TranslateTypeOption;use collab_database::fields::url_type_option::URLTypeOption;-use collab_database::fields::Field;-use collab_database::rows::{get_field_type_from_cell, Cell, RowId};+use collab_database::rows::{Cell, RowId, get_field_type_from_cell};use flowy_error::FlowyResult;use lib_infra::box_any::BoxAny;use std::cmp::Ordering;-use std::collections::hash_map::DefaultHasher;use std::collections::HashMap;+use std::collections::hash_map::DefaultHasher;use std::hash::{Hash, Hasher};pub const CELL_DATA: &str = "data";diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/url_type_option/url_type_option_entities.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/url_type_option/url_type_option_entities.rsindex b9d1a07823..25084955fe 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/url_type_option/url_type_option_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/url_type_option/url_type_option_entities.rs@@ -2,7 +2,7 @@ use bytes::Bytes;use collab_database::fields::url_type_option::URLCellData;-use flowy_error::{internal_error, FlowyResult};+use flowy_error::{FlowyResult, internal_error};use crate::entities::URLCellDataPB;use crate::services::cell::CellProtobufBlobParser;diff --git a/frontend/rust-lib/flowy-database2/src/services/field_settings/field_settings_builder.rs b/frontend/rust-lib/flowy-database2/src/services/field_settings/field_settings_builder.rsindex 95d70184c2..5c0983049f 100644--- a/frontend/rust-lib/flowy-database2/src/services/field_settings/field_settings_builder.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field_settings/field_settings_builder.rs@@ -7,7 +7,7 @@ use std::collections::HashMap;use strum::IntoEnumIterator;use crate::entities::FieldVisibility;-use crate::services::field_settings::{FieldSettings, DEFAULT_WIDTH, VISIBILITY};+use crate::services::field_settings::{DEFAULT_WIDTH, FieldSettings, VISIBILITY};/// Helper struct to create a new field settingpub struct FieldSettingsBuilder {diff --git a/frontend/rust-lib/flowy-database2/src/services/group/configuration.rs b/frontend/rust-lib/flowy-database2/src/services/group/configuration.rsindex 95c1048b60..8424ed1e38 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/configuration.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/configuration.rs@@ -5,8 +5,8 @@ use std::sync::Arc;use collab_database::fields::Field;use indexmap::IndexMap;-use serde::de::DeserializeOwned;use serde::Serialize;+use serde::de::DeserializeOwned;use tracing::event;use flowy_error::{FlowyError, FlowyResult};@@ -14,7 +14,7 @@ use flowy_error::{FlowyError, FlowyResult};use crate::entities::{GroupChangesPB, GroupPB, InsertedGroupPB};use crate::services::field::RowSingleCellData;use crate::services::group::{- default_group_setting, GeneratedGroups, Group, GroupChangeset, GroupData, GroupSetting,+ GeneratedGroups, Group, GroupChangeset, GroupData, GroupSetting, default_group_setting,};#[async_trait]@@ -24,7 +24,7 @@ pub trait GroupContextDelegate: Send + Sync + 'static {async fn get_configuration_cells(&self, view_id: &str, field_id: &str) -> Vec<RowSingleCellData>;async fn save_configuration(&self, view_id: &str, group_setting: GroupSetting)- -> FlowyResult<()>;+ -> FlowyResult<()>;}impl<T> std::fmt::Display for GroupControllerContext<T> {@@ -463,7 +463,7 @@ impl MergeGroupResult {mod tests {use crate::services::group::Group;- use super::{merge_groups, MergeGroupResult};+ use super::{MergeGroupResult, merge_groups};#[test]fn merge_groups_test() {diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller.rsindex eed12e492a..a5d3cc909e 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller.rs@@ -5,15 +5,15 @@ use std::sync::Arc;use collab_database::fields::{Field, TypeOptionData};use collab_database::rows::{Cells, Row, RowId};use flowy_error::{FlowyError, FlowyResult};-use serde::de::DeserializeOwned;use serde::Serialize;+use serde::de::DeserializeOwned;use tracing::trace;use crate::entities::{FieldType, GroupPB, GroupRowsNotificationPB, InsertedGroupPB, InsertedRowPB, RowMetaPB,};-use crate::services::cell::{get_cell_protobuf, CellProtobufBlobParser};-use crate::services::field::{default_type_option_data_from_type, TypeOption, TypeOptionCellData};+use crate::services::cell::{CellProtobufBlobParser, get_cell_protobuf};+use crate::services::field::{TypeOption, TypeOptionCellData, default_type_option_data_from_type};use crate::services::group::action::{DidMoveGroupRowResult, DidUpdateGroupRowResult, GroupController, GroupCustomize,};diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/checkbox_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/checkbox_controller.rsindex b33d402dca..c4b276d4f8 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/checkbox_controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/checkbox_controller.rs@@ -1,18 +1,18 @@use async_trait::async_trait;use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::fields::{Field, TypeOptionData};-use collab_database::rows::{new_cell_builder, Cell, Cells, Row};+use collab_database::rows::{Cell, Cells, Row, new_cell_builder};use flowy_error::FlowyResult;use serde::{Deserialize, Serialize};use crate::entities::{FieldType, GroupPB, GroupRowsNotificationPB, InsertedRowPB, RowMetaPB};use crate::services::cell::insert_checkbox_cell;-use crate::services::field::{CheckboxCellDataParser, TypeOption, CHECK, UNCHECK};+use crate::services::field::{CHECK, CheckboxCellDataParser, TypeOption, UNCHECK};use crate::services::group::action::GroupCustomize;use crate::services::group::configuration::GroupControllerContext;use crate::services::group::controller::BaseGroupController;use crate::services::group::{- move_group_row, GeneratedGroups, Group, GroupsBuilder, MoveGroupRowContext,+ GeneratedGroups, Group, GroupsBuilder, MoveGroupRowContext, move_group_row,};#[derive(Default, Serialize, Deserialize)]diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rsindex f3d03c6856..fa6c49bcdb 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/date_controller.rs@@ -3,8 +3,8 @@ use chrono::{DateTime, Datelike, Days, Duration, Local};use collab_database::database::timestamp;use collab_database::fields::date_type_option::{DateCellData, DateTypeOption};use collab_database::fields::{Field, TypeOptionData};-use collab_database::rows::{new_cell_builder, Cell, Cells, Row};-use flowy_error::{internal_error, FlowyResult};+use collab_database::rows::{Cell, Cells, Row, new_cell_builder};+use flowy_error::{FlowyResult, internal_error};use serde::{Deserialize, Serialize};use serde_repr::{Deserialize_repr, Serialize_repr};@@ -12,13 +12,13 @@ use crate::entities::{FieldType, GroupPB, GroupRowsNotificationPB, InsertedGroupPB, InsertedRowPB, RowMetaPB,};use crate::services::cell::insert_date_cell;-use crate::services::field::date_filter::DateCellDataParser;use crate::services::field::TypeOption;+use crate::services::field::date_filter::DateCellDataParser;use crate::services::group::action::GroupCustomize;use crate::services::group::configuration::GroupControllerContext;use crate::services::group::controller::BaseGroupController;use crate::services::group::{- make_no_status_group, move_group_row, GeneratedGroups, Group, GroupsBuilder, MoveGroupRowContext,+ GeneratedGroups, Group, GroupsBuilder, MoveGroupRowContext, make_no_status_group, move_group_row,};#[derive(Default, Serialize, Deserialize)]@@ -342,9 +342,9 @@ fn date_time_from_timestamp(timestamp: Option<i64>) -> DateTime<Local> {#[cfg(test)]mod tests {use crate::services::group::controller_impls::date_controller::{- get_date_group_id, GROUP_ID_DATE_FORMAT,+ GROUP_ID_DATE_FORMAT, get_date_group_id,};- use chrono::{offset, Days, Duration};+ use chrono::{Days, Duration, offset};use collab_database::fields::date_type_option::{DateCellData, DateTypeOption};#[test]diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/default_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/default_controller.rsindex 0ce7dd036c..076139d8c0 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/default_controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/default_controller.rs@@ -116,8 +116,7 @@ impl GroupController for DefaultGroupController {if self.group.contains_row(&row.id) {trace!("[RowOrder]: delete row:{} from group: {}",- row.id,- self.group.id+ row.id, self.group.id);self.group.remove_row(&row.id);changeset.deleted_rows.push(row.id.clone().into_inner());diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/multi_select_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/multi_select_controller.rsindex e5bae5ba8d..f03a8ccee9 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/multi_select_controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/multi_select_controller.rs@@ -1,7 +1,7 @@use async_trait::async_trait;use collab_database::fields::select_type_option::{MultiSelectTypeOption, SelectOption};use collab_database::fields::{Field, TypeOptionData};-use collab_database::rows::{new_cell_builder, Cell, Cells, Row};+use collab_database::rows::{Cell, Cells, Row, new_cell_builder};use flowy_error::{FlowyError, FlowyResult};use serde::{Deserialize, Serialize};@@ -13,9 +13,9 @@ use crate::services::field::{use crate::services::group::action::GroupCustomize;use crate::services::group::controller::BaseGroupController;use crate::services::group::{- add_or_remove_select_option_row, generate_select_option_groups, make_no_status_group,- move_group_row, remove_select_option_row, GeneratedGroups, Group, GroupChangeset,- GroupControllerContext, GroupsBuilder, MoveGroupRowContext,+ GeneratedGroups, Group, GroupChangeset, GroupControllerContext, GroupsBuilder,+ MoveGroupRowContext, add_or_remove_select_option_row, generate_select_option_groups,+ make_no_status_group, move_group_row, remove_select_option_row,};#[derive(Default, Serialize, Deserialize)]diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/single_select_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/single_select_controller.rsindex 0a82fe1fd4..1c3176fea8 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/single_select_controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/single_select_controller.rs@@ -1,7 +1,7 @@use async_trait::async_trait;use collab_database::fields::select_type_option::{SelectOption, SingleSelectTypeOption};use collab_database::fields::{Field, TypeOptionData};-use collab_database::rows::{new_cell_builder, Cell, Cells, Row};+use collab_database::rows::{Cell, Cells, Row, new_cell_builder};use flowy_error::{FlowyError, FlowyResult};use serde::{Deserialize, Serialize};@@ -14,8 +14,8 @@ use crate::services::group::action::GroupCustomize;use crate::services::group::controller::BaseGroupController;use crate::services::group::controller_impls::select_option_controller::util::*;use crate::services::group::{- make_no_status_group, GeneratedGroups, Group, GroupChangeset, GroupControllerContext,- GroupsBuilder, MoveGroupRowContext,+ GeneratedGroups, Group, GroupChangeset, GroupControllerContext, GroupsBuilder,+ MoveGroupRowContext, make_no_status_group,};#[derive(Default, Serialize, Deserialize)]diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/util.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/util.rsindex 827e4f0e53..259bc6e0ed 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/util.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/select_option_controller/util.rs@@ -7,8 +7,8 @@ use crate::services::cell::{use crate::services::field::CHECK;use crate::services::group::{Group, GroupData, MoveGroupRowContext};use chrono::NaiveDateTime;-use collab_database::fields::select_type_option::{SelectOption, SelectOptionIds};use collab_database::fields::Field;+use collab_database::fields::select_type_option::{SelectOption, SelectOptionIds};use collab_database::rows::{Cell, Row};use tracing::debug;diff --git a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/url_controller.rs b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/url_controller.rsindex aae0777b71..ea76e8427e 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/url_controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/controller_impls/url_controller.rs@@ -1,7 +1,7 @@use async_trait::async_trait;use collab_database::fields::url_type_option::{URLCellData, URLTypeOption};use collab_database::fields::{Field, TypeOptionData};-use collab_database::rows::{new_cell_builder, Cell, Cells, Row};+use collab_database::rows::{Cell, Cells, Row, new_cell_builder};use serde::{Deserialize, Serialize};use flowy_error::FlowyResult;@@ -15,7 +15,7 @@ use crate::services::group::action::GroupCustomize;use crate::services::group::configuration::GroupControllerContext;use crate::services::group::controller::BaseGroupController;use crate::services::group::{- make_no_status_group, move_group_row, GeneratedGroups, Group, GroupsBuilder, MoveGroupRowContext,+ GeneratedGroups, Group, GroupsBuilder, MoveGroupRowContext, make_no_status_group, move_group_row,};#[derive(Default, Serialize, Deserialize)]diff --git a/frontend/rust-lib/flowy-database2/src/services/group/entities.rs b/frontend/rust-lib/flowy-database2/src/services/group/entities.rsindex 4c3ddc4017..f0e55f4346 100644--- a/frontend/rust-lib/flowy-database2/src/services/group/entities.rs+++ b/frontend/rust-lib/flowy-database2/src/services/group/entities.rs@@ -1,5 +1,5 @@-use collab::preclude::encoding::serde::{from_any, to_any};use collab::preclude::Any;+use collab::preclude::encoding::serde::{from_any, to_any};use collab_database::database::gen_database_group_id;use collab_database::rows::{Row, RowId};use collab_database::views::{GroupMap, GroupMapBuilder, GroupSettingBuilder, GroupSettingMap};diff --git a/frontend/rust-lib/flowy-database2/src/services/setting/entities.rs b/frontend/rust-lib/flowy-database2/src/services/setting/entities.rsindex d40ab58d72..fc6a45d9d7 100644--- a/frontend/rust-lib/flowy-database2/src/services/setting/entities.rs+++ b/frontend/rust-lib/flowy-database2/src/services/setting/entities.rs@@ -1,5 +1,5 @@-use collab::preclude::encoding::serde::from_any;use collab::preclude::Any;+use collab::preclude::encoding::serde::from_any;use collab_database::views::{LayoutSetting, LayoutSettingBuilder};use serde::{Deserialize, Serialize};use serde_repr::*;diff --git a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rsindex 5f10691879..3206279e5c 100644--- a/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs+++ b/frontend/rust-lib/flowy-database2/src/services/share/csv/import.rs@@ -1,14 +1,14 @@use collab_database::database::{gen_database_id, gen_field_id, gen_row_id, timestamp};use collab_database::entity::{CreateDatabaseParams, CreateViewParams, EncodedCollabInfo};use collab_database::fields::Field;-use collab_database::rows::{new_cell_builder, Cell, CreateRowParams};+use collab_database::rows::{Cell, CreateRowParams, new_cell_builder};use collab_database::views::DatabaseLayout;use flowy_error::{FlowyError, FlowyResult};use std::fmt::Display;use std::{fs::File, io::prelude::*};use crate::entities::FieldType;-use crate::services::field::{default_type_option_data_from_type, CELL_DATA};+use crate::services::field::{CELL_DATA, default_type_option_data_from_type};use crate::services::field_settings::default_field_settings_for_fields;use crate::services::share::csv::CSVFormat;diff --git a/frontend/rust-lib/flowy-database2/src/services/sort/controller.rs b/frontend/rust-lib/flowy-database2/src/services/sort/controller.rsindex 5df4629839..2b54927b9b 100644--- a/frontend/rust-lib/flowy-database2/src/services/sort/controller.rs+++ b/frontend/rust-lib/flowy-database2/src/services/sort/controller.rs@@ -18,7 +18,7 @@ use crate::entities::SortChangesetNotificationPB;use crate::entities::{FieldType, SortWithIndexPB};use crate::services::cell::CellCache;use crate::services::database_view::{DatabaseViewChanged, DatabaseViewChangedNotifier};-use crate::services::field::{default_order, TypeOptionCellExt};+use crate::services::field::{TypeOptionCellExt, default_order};use crate::services::sort::{ReorderAllRowsResult, ReorderSingleRowResult, Sort, SortChangeset, SortCondition,};diff --git a/frontend/rust-lib/flowy-database2/src/utils/cache.rs b/frontend/rust-lib/flowy-database2/src/utils/cache.rsindex 840bdbb1b4..4cb4b461d5 100644--- a/frontend/rust-lib/flowy-database2/src/utils/cache.rs+++ b/frontend/rust-lib/flowy-database2/src/utils/cache.rs@@ -1,6 +1,6 @@-use dashmap::mapref::one::{MappedRef, MappedRefMut};use dashmap::DashMap;-use std::any::{type_name, Any};+use dashmap::mapref::one::{MappedRef, MappedRefMut};+use std::any::{Any, type_name};use std::fmt::Debug;use std::hash::Hash;use std::sync::Arc;diff --git a/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs b/frontend/rust-lib/flowy-database2/tests/database/database_editor.rsindex ca4a1e5cee..89c42c553e 100644--- a/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/database_editor.rs@@ -2,23 +2,23 @@ use std::collections::HashMap;use std::sync::Arc;use collab_database::database::gen_database_view_id;+use collab_database::fields::Field;use collab_database::fields::checkbox_type_option::CheckboxTypeOption;use collab_database::fields::checklist_type_option::ChecklistTypeOption;use collab_database::fields::select_type_option::{MultiSelectTypeOption, SelectOption, SelectOptionIds, SingleSelectTypeOption,};-use collab_database::fields::Field;use collab_database::rows::{Row, RowId};use lib_infra::box_any::BoxAny;use strum::EnumCount;-use event_integration_test::folder_event::ViewTest;use event_integration_test::EventIntegrationTest;+use event_integration_test::folder_event::ViewTest;use flowy_database2::entities::{DatabasePB, FieldType, FilterPB, RowMetaPB};use flowy_database2::services::database::DatabaseEditor;-use flowy_database2::services::field::checklist_filter::ChecklistCellChangeset;use flowy_database2::services::field::SelectOptionCellChangeset;+use flowy_database2::services::field::checklist_filter::ChecklistCellChangeset;use flowy_database2::services::share::csv::{CSVFormat, ImportResult};use flowy_error::FlowyResult;diff --git a/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs b/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rsindex 0728cbab95..1c991a11f9 100644--- a/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/field_test/util.rs@@ -1,14 +1,14 @@+use collab_database::fields::Field;use collab_database::fields::date_type_option::{DateFormat, DateTypeOption, TimeFormat, TimeTypeOption,};use collab_database::fields::select_type_option::{SelectOption, SingleSelectTypeOption};use collab_database::fields::text_type_option::RichTextTypeOption;use collab_database::fields::timestamp_type_option::TimestampTypeOption;-use collab_database::fields::Field;use collab_database::views::OrderObjectPosition;use flowy_database2::entities::{CreateFieldParams, FieldType};-use flowy_database2::services::field::{type_option_to_pb, FieldBuilder};+use flowy_database2::services::field::{FieldBuilder, type_option_to_pb};pub fn create_text_field(grid_id: &str) -> (CreateFieldParams, Field) {let field_type = FieldType::RichText;diff --git a/frontend/rust-lib/flowy-database2/tests/database/group_test/date_group_test.rs b/frontend/rust-lib/flowy-database2/tests/database/group_test/date_group_test.rsindex 1110e0a8d7..0885cb4b3b 100644--- a/frontend/rust-lib/flowy-database2/tests/database/group_test/date_group_test.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/group_test/date_group_test.rs@@ -1,5 +1,5 @@use crate::database::group_test::script::DatabaseGroupTest;-use chrono::{offset, Duration, NaiveDateTime};+use chrono::{Duration, NaiveDateTime, offset};use collab_database::fields::date_type_option::DateCellData;use flowy_database2::entities::{CreateRowPayloadPB, FieldType};use std::collections::HashMap;diff --git a/frontend/rust-lib/flowy-database2/tests/database/group_test/script.rs b/frontend/rust-lib/flowy-database2/tests/database/group_test/script.rsindex 1b700b96f3..bb0ba4fcca 100644--- a/frontend/rust-lib/flowy-database2/tests/database/group_test/script.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/group_test/script.rs@@ -1,13 +1,13 @@use crate::database::database_editor::DatabaseEditorTest;-use collab_database::fields::select_type_option::{SelectOption, SingleSelectTypeOption};use collab_database::fields::Field;+use collab_database::fields::select_type_option::{SelectOption, SingleSelectTypeOption};use collab_database::rows::RowId;use flowy_database2::entities::{CreateRowPayloadPB, FieldType, GroupPB, RowMetaPB};use flowy_database2::services::cell::{delete_select_option_cell, insert_date_cell, insert_select_option_cell, insert_url_cell,};use flowy_database2::services::field::{- edit_single_select_type_option, SelectTypeOptionSharedAction,+ SelectTypeOptionSharedAction, edit_single_select_type_option,};use std::time::Duration;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.rsindex c2c4851e86..e18d7d2ad9 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@@ -1,4 +1,4 @@-use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData};+use collab_database::database::{DatabaseData, gen_database_id, gen_database_view_id, gen_row_id};use collab_database::entity::DatabaseView;use collab_database::fields::checklist_type_option::ChecklistTypeOption;use collab_database::fields::date_type_option::{DateFormat, DateTypeOption, TimeFormat};diff --git a/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs b/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rsindex 4e789305ba..2706f8e65f 100644--- a/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/mock_data/calendar_mock_data.rs@@ -1,4 +1,4 @@-use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData};+use collab_database::database::{DatabaseData, gen_database_id, gen_database_view_id, gen_row_id};use collab_database::entity::DatabaseView;use collab_database::fields::select_type_option::MultiSelectTypeOption;use collab_database::views::{DatabaseLayout, LayoutSetting, LayoutSettings};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.rsindex 5039a37b39..2ade9d5ba5 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@@ -1,4 +1,4 @@-use collab_database::database::{gen_database_id, gen_database_view_id, gen_row_id, DatabaseData};+use collab_database::database::{DatabaseData, gen_database_id, gen_database_view_id, gen_row_id};use collab_database::entity::DatabaseView;use collab_database::fields::checklist_type_option::ChecklistTypeOption;use collab_database::fields::date_type_option::{@@ -19,8 +19,8 @@ use strum::IntoEnumIterator;use crate::database::mock_data::{COMPLETED, FACEBOOK, GOOGLE, PAUSED, PLANNED, TWITTER};use event_integration_test::database_event::TestRowBuilder;use flowy_database2::entities::FieldType;-use flowy_database2::services::field::checklist_filter::ChecklistCellInsertChangeset;use flowy_database2::services::field::FieldBuilder;+use flowy_database2::services::field::checklist_filter::ChecklistCellInsertChangeset;use flowy_database2::services::field_settings::default_field_settings_for_fields;pub fn make_test_grid() -> DatabaseData {diff --git a/frontend/rust-lib/flowy-database2/tests/database/pre_fill_cell_test/script.rs b/frontend/rust-lib/flowy-database2/tests/database/pre_fill_cell_test/script.rsindex 8bc93cf0de..e30e54019e 100644--- a/frontend/rust-lib/flowy-database2/tests/database/pre_fill_cell_test/script.rs+++ b/frontend/rust-lib/flowy-database2/tests/database/pre_fill_cell_test/script.rs@@ -1,5 +1,5 @@use crate::database::database_editor::DatabaseEditorTest;-use collab_database::fields::select_type_option::{SelectOptionIds, SELECTION_IDS_SEPARATOR};+use collab_database::fields::select_type_option::{SELECTION_IDS_SEPARATOR, SelectOptionIds};use flowy_database2::entities::{CreateRowPayloadPB, FilterDataPB, InsertFilterPB};use flowy_database2::services::cell::stringify_cell;use std::ops::{Deref, DerefMut};diff --git a/frontend/rust-lib/flowy-date/Cargo.toml b/frontend/rust-lib/flowy-date/Cargo.tomlindex d04dfd8416..7cad27dacf 100644--- a/frontend/rust-lib/flowy-date/Cargo.toml+++ b/frontend/rust-lib/flowy-date/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-date"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[lib]diff --git a/frontend/rust-lib/flowy-date/build.rs b/frontend/rust-lib/flowy-date/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-date/build.rs+++ b/frontend/rust-lib/flowy-date/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/flowy-date/src/event_handler.rs b/frontend/rust-lib/flowy-date/src/event_handler.rsindex 12712ec8fb..aad22de251 100644--- a/frontend/rust-lib/flowy-date/src/event_handler.rs+++ b/frontend/rust-lib/flowy-date/src/event_handler.rs@@ -2,7 +2,7 @@ use chrono::{Datelike, NaiveDate};use date_time_parser::DateParser;use fancy_regex::Regex;use flowy_error::FlowyError;-use lib_dispatch::prelude::{data_result_ok, AFPluginData, DataResult};+use lib_dispatch::prelude::{AFPluginData, DataResult, data_result_ok};use std::sync::OnceLock;use crate::entities::*;diff --git a/frontend/rust-lib/flowy-document-pub/Cargo.toml b/frontend/rust-lib/flowy-document-pub/Cargo.tomlindex cbb74de5c4..24876d07a7 100644--- a/frontend/rust-lib/flowy-document-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-document-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-document-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-document/Cargo.toml b/frontend/rust-lib/flowy-document/Cargo.tomlindex 23547c64fe..a345a84483 100644--- a/frontend/rust-lib/flowy-document/Cargo.toml+++ b/frontend/rust-lib/flowy-document/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-document"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[lib]diff --git a/frontend/rust-lib/flowy-document/build.rs b/frontend/rust-lib/flowy-document/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-document/build.rs+++ b/frontend/rust-lib/flowy-document/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/flowy-document/src/document.rs b/frontend/rust-lib/flowy-document/src/document.rsindex aa871cf4bc..36993dada1 100644--- a/frontend/rust-lib/flowy-document/src/document.rs+++ b/frontend/rust-lib/flowy-document/src/document.rs@@ -1,7 +1,7 @@use crate::entities::{DocEventPB, DocumentAwarenessStatesPB, DocumentSnapshotStatePB, DocumentSyncStatePB,};-use crate::notification::{document_notification_builder, DocumentNotification};+use crate::notification::{DocumentNotification, document_notification_builder};use collab::preclude::Collab;use collab_document::document::Document;use futures::StreamExt;diff --git a/frontend/rust-lib/flowy-document/src/entities.rs b/frontend/rust-lib/flowy-document/src/entities.rsindex c8a6765fd6..5b13a20d17 100644--- a/frontend/rust-lib/flowy-document/src/entities.rs+++ b/frontend/rust-lib/flowy-document/src/entities.rs@@ -1,6 +1,6 @@use collab::core::collab_state::SyncState;use collab_document::{- blocks::{json_str_to_hashmap, Block, BlockAction, DocumentData},+ blocks::{Block, BlockAction, DocumentData, json_str_to_hashmap},document_awareness::{DocumentAwarenessPosition, DocumentAwarenessSelection, DocumentAwarenessState,DocumentAwarenessUser,diff --git a/frontend/rust-lib/flowy-document/src/event_handler.rs b/frontend/rust-lib/flowy-document/src/event_handler.rsindex acf45777eb..f18044b475 100644--- a/frontend/rust-lib/flowy-document/src/event_handler.rs+++ b/frontend/rust-lib/flowy-document/src/event_handler.rs@@ -20,7 +20,7 @@ use crate::parser::parser_entities::{};use crate::{manager::DocumentManager, parser::json::parser::JsonToDocumentParser};use flowy_error::{FlowyError, FlowyResult};-use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};+use lib_dispatch::prelude::{AFPluginData, AFPluginState, DataResult, data_result_ok};use lib_infra::sync_trace;use tracing::instrument;use uuid::Uuid;diff --git a/frontend/rust-lib/flowy-document/src/manager.rs b/frontend/rust-lib/flowy-document/src/manager.rsindex 445911d4b6..c02e4db950 100644--- a/frontend/rust-lib/flowy-document/src/manager.rs+++ b/frontend/rust-lib/flowy-document/src/manager.rs@@ -23,7 +23,7 @@ use collab_integrate::collab_builder::{use collab_plugins::CollabKVDB;use dashmap::DashMap;use flowy_document_pub::cloud::DocumentCloudService;-use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};+use flowy_error::{ErrorCode, FlowyError, FlowyResult, internal_error};use flowy_storage_pub::storage::{CreatedUpload, StorageService};use lib_infra::util::timestamp;use tracing::{event, instrument};diff --git a/frontend/rust-lib/flowy-document/src/parser/external/utils.rs b/frontend/rust-lib/flowy-document/src/parser/external/utils.rsindex 1e31792f2f..b7679469fe 100644--- a/frontend/rust-lib/flowy-document/src/parser/external/utils.rs+++ b/frontend/rust-lib/flowy-document/src/parser/external/utils.rs@@ -1,7 +1,7 @@use crate::parser::constant::*;use crate::parser::parser_entities::{InsertDelta, NestedBlock};-use scraper::node::Attrs;use scraper::ElementRef;+use scraper::node::Attrs;use serde::{Deserialize, Serialize};use serde_json::Value;use std::collections::HashMap;diff --git a/frontend/rust-lib/flowy-document/tests/document/document_redo_undo_test.rs b/frontend/rust-lib/flowy-document/tests/document/document_redo_undo_test.rsindex 2a47ec93c4..3b26ae3c8b 100644--- a/frontend/rust-lib/flowy-document/tests/document/document_redo_undo_test.rs+++ b/frontend/rust-lib/flowy-document/tests/document/document_redo_undo_test.rs@@ -1,9 +1,9 @@use std::collections::HashMap;use collab_document::blocks::{Block, BlockAction, BlockActionPayload, BlockActionType};-use collab_document::document_data::{default_document_data, PARAGRAPH_BLOCK_TYPE};+use collab_document::document_data::{PARAGRAPH_BLOCK_TYPE, default_document_data};-use crate::document::util::{gen_document_id, gen_id, DocumentTest};+use crate::document::util::{DocumentTest, gen_document_id, gen_id};#[tokio::test]async fn undo_redo_test() {diff --git a/frontend/rust-lib/flowy-document/tests/document/document_test.rs b/frontend/rust-lib/flowy-document/tests/document/document_test.rsindex 8323a645c7..16238ccd6f 100644--- a/frontend/rust-lib/flowy-document/tests/document/document_test.rs+++ b/frontend/rust-lib/flowy-document/tests/document/document_test.rs@@ -1,10 +1,10 @@use std::{collections::HashMap, vec};use collab_document::blocks::{Block, BlockAction, BlockActionPayload, BlockActionType};-use collab_document::document_data::{default_document_data, PARAGRAPH_BLOCK_TYPE};-use serde_json::{json, to_value, Value};+use collab_document::document_data::{PARAGRAPH_BLOCK_TYPE, default_document_data};+use serde_json::{Value, json, to_value};-use crate::document::util::{gen_document_id, gen_id, DocumentTest};+use crate::document::util::{DocumentTest, gen_document_id, gen_id};#[tokio::test]async fn restore_document() {diff --git a/frontend/rust-lib/flowy-document/tests/document/util.rs b/frontend/rust-lib/flowy-document/tests/document/util.rsindex ef92f32b59..2a1178bf74 100644--- a/frontend/rust-lib/flowy-document/tests/document/util.rs+++ b/frontend/rust-lib/flowy-document/tests/document/util.rs@@ -6,11 +6,11 @@ use collab::preclude::CollabPlugin;use collab_document::blocks::DocumentData;use collab_document::document::Document;use collab_document::document_data::default_document_data;+use collab_integrate::CollabKVDB;use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabCloudPluginProvider, CollabPluginProviderContext,CollabPluginProviderType, WorkspaceCollabIntegrate,};-use collab_integrate::CollabKVDB;use flowy_document::entities::{DocumentSnapshotData, DocumentSnapshotMeta};use flowy_document::manager::{DocumentManager, DocumentSnapshotService, DocumentUserService};use flowy_document_pub::cloud::*;@@ -21,7 +21,7 @@ use lib_infra::box_any::BoxAny;use nanoid::nanoid;use tempfile::TempDir;use tokio::sync::RwLock;-use tracing_subscriber::{fmt::Subscriber, util::SubscriberInitExt, EnvFilter};+use tracing_subscriber::{EnvFilter, fmt::Subscriber, util::SubscriberInitExt};use uuid::Uuid;pub struct DocumentTest {@@ -109,7 +109,9 @@ impl DocumentUserService for FakeUser {pub fn setup_log() {static START: OnceLock<()> = OnceLock::new();START.get_or_init(|| {- std::env::set_var("RUST_LOG", "collab_persistence=trace");+ unsafe {+ std::env::set_var("RUST_LOG", "collab_persistence=trace");+ }let subscriber = Subscriber::builder().with_env_filter(EnvFilter::from_default_env()).with_ansi(true)diff --git a/frontend/rust-lib/flowy-folder-pub/Cargo.toml b/frontend/rust-lib/flowy-folder-pub/Cargo.tomlindex 9f33bfe1c4..725196a3b9 100644--- a/frontend/rust-lib/flowy-folder-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-folder-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-folder-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-folder-pub/src/cloud.rs b/frontend/rust-lib/flowy-folder-pub/src/cloud.rsindex 05cc8f867d..98416fd851 100644--- a/frontend/rust-lib/flowy-folder-pub/src/cloud.rs+++ b/frontend/rust-lib/flowy-folder-pub/src/cloud.rs@@ -1,6 +1,6 @@use crate::entities::PublishPayload;pub use anyhow::Error;-use client_api::entity::{workspace_dto::PublishInfoView, PublishInfo};+use client_api::entity::{PublishInfo, workspace_dto::PublishInfoView};use collab::entity::EncodedCollab;use collab_entity::CollabType;pub use collab_folder::{Folder, FolderData, Workspace};diff --git a/frontend/rust-lib/flowy-folder/Cargo.toml b/frontend/rust-lib/flowy-folder/Cargo.tomlindex 07b53eeee3..aa92cd772f 100644--- a/frontend/rust-lib/flowy-folder/Cargo.toml+++ b/frontend/rust-lib/flowy-folder/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-folder"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-folder/build.rs b/frontend/rust-lib/flowy-folder/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-folder/build.rs+++ b/frontend/rust-lib/flowy-folder/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/flowy-folder/src/entities/import.rs b/frontend/rust-lib/flowy-folder/src/entities/import.rsindex 83e8bdf874..b6edc6adf3 100644--- a/frontend/rust-lib/flowy-folder/src/entities/import.rs+++ b/frontend/rust-lib/flowy-folder/src/entities/import.rs@@ -1,5 +1,5 @@-use crate::entities::parser::empty_str::NotEmptyStr;use crate::entities::ViewLayoutPB;+use crate::entities::parser::empty_str::NotEmptyStr;use crate::share::{ImportData, ImportItem, ImportParams, ImportType};use flowy_derive::{ProtoBuf, ProtoBuf_Enum};use flowy_error::FlowyError;diff --git a/frontend/rust-lib/flowy-folder/src/entities/publish.rs b/frontend/rust-lib/flowy-folder/src/entities/publish.rsindex ac23d810f5..85453ec003 100644--- a/frontend/rust-lib/flowy-folder/src/entities/publish.rs+++ b/frontend/rust-lib/flowy-folder/src/entities/publish.rs@@ -1,5 +1,5 @@-use client_api::entity::workspace_dto::{FolderViewMinimal, PublishInfoView};use client_api::entity::PublishInfo;+use client_api::entity::workspace_dto::{FolderViewMinimal, PublishInfoView};use flowy_derive::ProtoBuf;use super::{RepeatedViewIdPB, ViewIconPB, ViewLayoutPB};diff --git a/frontend/rust-lib/flowy-folder/src/event_handler.rs b/frontend/rust-lib/flowy-folder/src/event_handler.rsindex 809651a262..72a863278a 100644--- a/frontend/rust-lib/flowy-folder/src/event_handler.rs+++ b/frontend/rust-lib/flowy-folder/src/event_handler.rs@@ -1,5 +1,5 @@use flowy_error::{FlowyError, FlowyResult};-use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};+use lib_dispatch::prelude::{AFPluginData, AFPluginState, DataResult, data_result_ok};use std::str::FromStr;use std::sync::{Arc, Weak};use tracing::instrument;diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rsindex 50f0c7b4c9..4d6bf503af 100644--- a/frontend/rust-lib/flowy-folder/src/manager.rs+++ b/frontend/rust-lib/flowy-folder/src/manager.rs@@ -1,24 +1,24 @@use crate::entities::icon::UpdateViewIconParams;use crate::entities::{- view_pb_with_child_views, view_pb_without_child_views, view_pb_without_child_views_from_arc,CreateViewParams, DeletedViewPB, DuplicateViewParams, FolderSnapshotPB, MoveNestedViewParams,RepeatedTrashPB, RepeatedViewIdPB, RepeatedViewPB, UpdateViewParams, ViewLayoutPB, ViewPB,- ViewSectionPB, WorkspaceLatestPB, WorkspacePB,+ ViewSectionPB, WorkspaceLatestPB, WorkspacePB, view_pb_with_child_views,+ view_pb_without_child_views, view_pb_without_child_views_from_arc,};use crate::manager_observer::{- notify_child_views_changed, notify_did_update_workspace, notify_parent_view_did_change,- ChildViewChangeReason,+ ChildViewChangeReason, notify_child_views_changed, notify_did_update_workspace,+ notify_parent_view_did_change,};-use crate::notification::{folder_notification_builder, FolderNotification};+use crate::notification::{FolderNotification, folder_notification_builder};use crate::publish_util::{generate_publish_name, view_pb_to_publish_view};use crate::share::{ImportData, ImportItem, ImportParams};use crate::util::{folder_not_init_error, workspace_data_not_sync_error};use crate::view_operation::{- create_view, FolderOperationHandler, FolderOperationHandlers, GatherEncodedCollab, ViewData,+ FolderOperationHandler, FolderOperationHandlers, GatherEncodedCollab, ViewData, create_view,};use arc_swap::ArcSwapOption;-use client_api::entity::workspace_dto::PublishInfoView;use client_api::entity::PublishInfo;+use client_api::entity::workspace_dto::PublishInfoView;use collab::core::collab::{DataSource, IndexContentReceiver};use collab::lock::RwLock;use collab_entity::{CollabType, EncodedCollab};@@ -28,12 +28,12 @@ use collab_folder::{Folder, FolderData, FolderNotify, Section, SectionItem, TrashInfo, View, ViewLayout, ViewUpdate,Workspace,};+use collab_integrate::CollabKVDB;use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig, CollabPersistenceImpl,};-use collab_integrate::CollabKVDB;-use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};-use flowy_folder_pub::cloud::{gen_view_id, FolderCloudService, FolderCollabParams};+use flowy_error::{ErrorCode, FlowyError, FlowyResult, internal_error};+use flowy_folder_pub::cloud::{FolderCloudService, FolderCollabParams, gen_view_id};use flowy_folder_pub::entities::{PublishDatabaseData, PublishDatabasePayload, PublishDocumentPayload, PublishPayload,PublishViewInfo, PublishViewMeta, PublishViewMetaData,@@ -371,8 +371,7 @@ impl FolderManager {let result = self.cloud_service()?.get_folder_doc_state(workspace_id, user_id, CollabType::Folder, workspace_id)- .await- .map_err(FlowyError::from);+ .await;match result {Ok(folder_doc_state) => {@@ -1131,7 +1130,7 @@ impl FolderManager {return Err(FlowyError::record_not_found().with_context(format!("Can't duplicate the view({})", view_id)),- )+ );},Some(lock) => lock,};@@ -1367,7 +1366,7 @@ impl FolderManager {return Err(FlowyError::record_not_found().with_context(format!("Can't find the view with ID: {}", view_id)),- )+ );},Some(lock) => lock,};diff --git a/frontend/rust-lib/flowy-folder/src/manager_init.rs b/frontend/rust-lib/flowy-folder/src/manager_init.rsindex 69dcb0bc25..a4eaeb3e78 100644--- a/frontend/rust-lib/flowy-folder/src/manager_init.rs+++ b/frontend/rust-lib/flowy-folder/src/manager_init.rs@@ -8,7 +8,7 @@ use collab_folder::{Folder, FolderNotify};use collab_integrate::CollabKVDB;use flowy_error::{FlowyError, FlowyResult};use std::sync::{Arc, Weak};-use tracing::{event, info, Level};+use tracing::{Level, event, info};use uuid::Uuid;impl FolderManager {diff --git a/frontend/rust-lib/flowy-folder/src/manager_observer.rs b/frontend/rust-lib/flowy-folder/src/manager_observer.rsindex 5d3034b5aa..8e3e9145fc 100644--- a/frontend/rust-lib/flowy-folder/src/manager_observer.rs+++ b/frontend/rust-lib/flowy-folder/src/manager_observer.rs@@ -1,9 +1,9 @@use crate::entities::{- view_pb_with_child_views, view_pb_without_child_views, ChildViewUpdatePB, FolderSyncStatePB,- RepeatedTrashPB, RepeatedViewPB, SectionViewsPB, ViewPB, ViewSectionPB,+ ChildViewUpdatePB, FolderSyncStatePB, RepeatedTrashPB, RepeatedViewPB, SectionViewsPB, ViewPB,+ ViewSectionPB, view_pb_with_child_views, view_pb_without_child_views,};-use crate::manager::{get_workspace_private_view_pbs, get_workspace_public_view_pbs, FolderUser};-use crate::notification::{folder_notification_builder, FolderNotification};+use crate::manager::{FolderUser, get_workspace_private_view_pbs, get_workspace_public_view_pbs};+use crate::notification::{FolderNotification, folder_notification_builder};use collab::core::collab_state::SyncState;use collab::lock::RwLock;use collab_folder::{@@ -15,9 +15,9 @@ use lib_infra::sync_trace;use std::collections::HashSet;use std::str::FromStr;use std::sync::Weak;-use tokio_stream::wrappers::WatchStream;use tokio_stream::StreamExt;-use tracing::{event, trace, Level};+use tokio_stream::wrappers::WatchStream;+use tracing::{Level, event, trace};use uuid::Uuid;/// Listen on the [ViewChange] after create/delete/update events happeneddiff --git a/frontend/rust-lib/flowy-folder/src/user_default.rs b/frontend/rust-lib/flowy-folder/src/user_default.rsindex 82fe1730fc..42f9f03374 100644--- a/frontend/rust-lib/flowy-folder/src/user_default.rs+++ b/frontend/rust-lib/flowy-folder/src/user_default.rs@@ -6,7 +6,7 @@ use tokio::sync::RwLock;use lib_infra::util::timestamp;-use crate::entities::{view_pb_with_child_views, ViewPB};+use crate::entities::{ViewPB, view_pb_with_child_views};use crate::view_operation::{FolderOperationHandler, FolderOperationHandlers};pub struct DefaultFolderBuilder();diff --git a/frontend/rust-lib/flowy-folder/src/view_operation.rs b/frontend/rust-lib/flowy-folder/src/view_operation.rsindex 17919e07b1..1a9b1ae242 100644--- a/frontend/rust-lib/flowy-folder/src/view_operation.rs+++ b/frontend/rust-lib/flowy-folder/src/view_operation.rs@@ -2,9 +2,9 @@ use async_trait::async_trait;use bytes::Bytes;use collab::entity::EncodedCollab;use collab_entity::CollabType;-use collab_folder::hierarchy_builder::NestedViewBuilder;pub use collab_folder::View;use collab_folder::ViewLayout;+use collab_folder::hierarchy_builder::NestedViewBuilder;use dashmap::DashMap;use flowy_error::FlowyError;use std::collections::HashMap;diff --git a/frontend/rust-lib/flowy-search-pub/Cargo.toml b/frontend/rust-lib/flowy-search-pub/Cargo.tomlindex 8b2c8bffe7..8a06c78273 100644--- a/frontend/rust-lib/flowy-search-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-search-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-search-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-search-pub/src/schema.rs b/frontend/rust-lib/flowy-search-pub/src/schema.rsindex 2dfb1fd9eb..14f36a6005 100644--- a/frontend/rust-lib/flowy-search-pub/src/schema.rs+++ b/frontend/rust-lib/flowy-search-pub/src/schema.rs@@ -1,4 +1,4 @@-use tantivy::schema::{Schema, STORED, STRING, TEXT};+use tantivy::schema::{STORED, STRING, Schema, TEXT};pub struct LocalSearchTantivySchema(pub Schema);diff --git a/frontend/rust-lib/flowy-search/Cargo.toml b/frontend/rust-lib/flowy-search/Cargo.tomlindex 87dffebca2..f990af4748 100644--- a/frontend/rust-lib/flowy-search/Cargo.toml+++ b/frontend/rust-lib/flowy-search/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-search"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-search/build.rs b/frontend/rust-lib/flowy-search/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-search/build.rs+++ b/frontend/rust-lib/flowy-search/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/flowy-search/src/document/cloud_search_handler.rs b/frontend/rust-lib/flowy-search/src/document/cloud_search_handler.rsindex 358940225f..d75959a5a3 100644--- a/frontend/rust-lib/flowy-search/src/document/cloud_search_handler.rs+++ b/frontend/rust-lib/flowy-search/src/document/cloud_search_handler.rs@@ -9,7 +9,7 @@ use crate::{use async_stream::stream;use flowy_error::FlowyResult;use flowy_folder::entities::ViewPB;-use flowy_folder::{manager::FolderManager, ViewLayout};+use flowy_folder::{ViewLayout, manager::FolderManager};use flowy_search_pub::cloud::{SearchCloudService, SearchResult};use lib_infra::async_trait::async_trait;use std::pin::Pin;diff --git a/frontend/rust-lib/flowy-search/tests/tantivy_test.rs b/frontend/rust-lib/flowy-search/tests/tantivy_test.rsindex 6506851d78..42df0ac457 100644--- a/frontend/rust-lib/flowy-search/tests/tantivy_test.rs+++ b/frontend/rust-lib/flowy-search/tests/tantivy_test.rs@@ -1,7 +1,7 @@use tantivy::collector::TopDocs;use tantivy::query::QueryParser;use tantivy::schema::*;-use tantivy::{doc, DocAddress, Index, Score};+use tantivy::{DocAddress, Index, Score, doc};#[test]fn search_folder_test() {diff --git a/frontend/rust-lib/flowy-server-pub/Cargo.toml b/frontend/rust-lib/flowy-server-pub/Cargo.tomlindex 1c98487666..12019d1634 100644--- a/frontend/rust-lib/flowy-server-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-server-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-server-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-server-pub/src/lib.rs b/frontend/rust-lib/flowy-server-pub/src/lib.rsindex 42baef52bd..f07777a7ff 100644--- a/frontend/rust-lib/flowy-server-pub/src/lib.rs+++ b/frontend/rust-lib/flowy-server-pub/src/lib.rs@@ -41,7 +41,9 @@ pub enum AuthenticatorType {impl AuthenticatorType {pub fn write_env(&self) {let s = self.clone() as u8;- std::env::set_var(CLOUT_TYPE_STR, s.to_string());+ unsafe {+ std::env::set_var(CLOUT_TYPE_STR, s.to_string());+ }}#[allow(dead_code)]diff --git a/frontend/rust-lib/flowy-server-pub/src/native/af_cloud_config.rs b/frontend/rust-lib/flowy-server-pub/src/native/af_cloud_config.rsindex 9c74850fcd..6ef9b6f4f3 100644--- a/frontend/rust-lib/flowy-server-pub/src/native/af_cloud_config.rs+++ b/frontend/rust-lib/flowy-server-pub/src/native/af_cloud_config.rs@@ -73,16 +73,18 @@ impl AFCloudConfiguration {/// Write the configuration to the environment variables.pub fn write_env(&self) {- std::env::set_var(APPFLOWY_CLOUD_BASE_URL, &self.base_url);- std::env::set_var(APPFLOWY_CLOUD_WS_BASE_URL, &self.ws_base_url);- std::env::set_var(APPFLOWY_CLOUD_GOTRUE_URL, &self.gotrue_url);- std::env::set_var(- APPFLOWY_ENABLE_SYNC_TRACE,- if self.enable_sync_trace {- "true"- } else {- "false"- },- );+ unsafe {+ std::env::set_var(APPFLOWY_CLOUD_BASE_URL, &self.base_url);+ std::env::set_var(APPFLOWY_CLOUD_WS_BASE_URL, &self.ws_base_url);+ std::env::set_var(APPFLOWY_CLOUD_GOTRUE_URL, &self.gotrue_url);+ std::env::set_var(+ APPFLOWY_ENABLE_SYNC_TRACE,+ if self.enable_sync_trace {+ "true"+ } else {+ "false"+ },+ );+ }}}diff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.tomlindex 4edf6ee2e7..5124e9688f 100644--- a/frontend/rust-lib/flowy-server/Cargo.toml+++ b/frontend/rust-lib/flowy-server/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-server"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html[lib]diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rsindex 0faf3ee2c9..f3ae70a085 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/chat.rs@@ -105,10 +105,7 @@ where) -> Result<StreamAnswer, FlowyError> {trace!("stream_answer: workspace_id={}, chat_id={}, format={:?}, model: {:?}",- workspace_id,- chat_id,- format,- ai_model,+ workspace_id, chat_id, format, ai_model,);let try_get_client = self.inner.try_get_client();let result = try_get_client?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.rsindex f29a7f89ad..1c99b6a978 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,11 +1,11 @@#![allow(unused_variables)]+use crate::af_cloud::AFServer;use crate::af_cloud::define::LoggedUser;use crate::af_cloud::impls::util::check_request_workspace_id_is_match;-use crate::af_cloud::AFServer;+use client_api::entity::QueryCollabResult::{Failed, Success};use client_api::entity::ai_dto::{SummarizeRowData, SummarizeRowParams, TranslateRowData, TranslateRowParams,};-use client_api::entity::QueryCollabResult::{Failed, Success};use client_api::entity::{CreateCollabParams, QueryCollab, QueryCollabParams};use client_api::error::ErrorCode::RecordNotFound;use collab::entity::EncodedCollab;diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rsindex 1e000d5971..ad5d28a5aa 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rs@@ -13,9 +13,9 @@ use std::sync::Weak;use tracing::instrument;use uuid::Uuid;+use crate::af_cloud::AFServer;use crate::af_cloud::define::LoggedUser;use crate::af_cloud::impls::util::check_request_workspace_id_is_match;-use crate::af_cloud::AFServer;pub(crate) struct AFCloudDocumentCloudServiceImpl<T> {pub inner: T,diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rsindex 578f2870c6..76a50d06f9 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/folder.rs@@ -17,9 +17,9 @@ use flowy_folder_pub::cloud::{use flowy_folder_pub::entities::PublishPayload;use lib_infra::async_trait::async_trait;+use crate::af_cloud::AFServer;use crate::af_cloud::define::LoggedUser;use crate::af_cloud::impls::util::check_request_workspace_id_is_match;-use crate::af_cloud::AFServer;pub(crate) struct AFCloudFolderCloudServiceImpl<T> {pub inner: T,diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/dto.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/dto.rsindex 3bf5022a16..983f5e4154 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/dto.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/dto.rs@@ -3,8 +3,8 @@ use client_api::entity::auth_dto::{UpdateUserParams, UserMetaData};use client_api::entity::{AFRole, AFUserProfile, AFWorkspaceInvitationStatus, AFWorkspaceMember};use flowy_user_pub::entities::{- AuthType, Role, UpdateUserProfileParams, UserProfile, WorkspaceInvitationStatus, WorkspaceMember,- WorkspaceType, USER_METADATA_ICON_URL,+ AuthType, Role, USER_METADATA_ICON_URL, UpdateUserProfileParams, UserProfile,+ WorkspaceInvitationStatus, WorkspaceMember, WorkspaceType,};pub fn af_update_from_update_params(update: UpdateUserProfileParams) -> UpdateUserParams {diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs b/frontend/rust-lib/flowy-server/src/af_cloud/server.rsindex 069f985e66..75bd68371e 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/server.rs@@ -25,11 +25,11 @@ use flowy_user_pub::cloud::{UserCloudService, UserUpdate};use flowy_user_pub::entities::UserTokenState;use super::impls::AFCloudSearchCloudServiceImpl;+use crate::AppFlowyServer;use crate::af_cloud::impls::{AFCloudDatabaseCloudServiceImpl, AFCloudDocumentCloudServiceImpl, AFCloudFileStorageServiceImpl,AFCloudFolderCloudServiceImpl, AFCloudUserAuthServiceImpl, CloudChatServiceImpl,};-use crate::AppFlowyServer;use flowy_ai::offline::offline_message_sync::AutoSyncChatService;use flowy_ai_pub::user_service::AIUserService;use flowy_search_pub::tantivy_state::DocumentTantivyState;@@ -37,7 +37,7 @@ use lib_infra::async_trait::async_trait;use rand::Rng;use semver::Version;use tokio::select;-use tokio::sync::{watch, RwLock};+use tokio::sync::{RwLock, watch};use tokio::task::JoinHandle;use tokio_stream::wrappers::WatchStream;use tokio_util::sync::CancellationToken;diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/chat.rsindex 6137dc8abe..c4993a91e7 100644--- a/frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/impls/chat.rs@@ -5,20 +5,20 @@ use flowy_ai::local_ai::controller::LocalAIController;use flowy_ai_pub::cloud::chat_dto::{ChatAuthor, ChatAuthorType};use flowy_ai_pub::cloud::{AIModel, ChatCloudService, ChatMessage, ChatMessageType, ChatSettings, CompleteTextParams,- MessageCursor, ModelList, RelatedQuestion, RepeatedChatMessage, ResponseFormat, StreamAnswer,- StreamComplete, UpdateChatParams, DEFAULT_AI_MODEL_NAME,+ DEFAULT_AI_MODEL_NAME, MessageCursor, ModelList, RelatedQuestion, RepeatedChatMessage,+ ResponseFormat, StreamAnswer, StreamComplete, UpdateChatParams,};use flowy_ai_pub::persistence::{- deserialize_chat_metadata, deserialize_rag_ids, select_answer_where_match_reply_message_id,- select_chat, select_chat_messages, select_message_content, serialize_chat_metadata,- serialize_rag_ids, update_chat, upsert_chat, upsert_chat_messages, ChatMessageTable, ChatTable,- ChatTableChangeset,+ ChatMessageTable, ChatTable, ChatTableChangeset, deserialize_chat_metadata, deserialize_rag_ids,+ select_answer_where_match_reply_message_id, select_chat, select_chat_messages,+ select_message_content, serialize_chat_metadata, serialize_rag_ids, update_chat, upsert_chat,+ upsert_chat_messages,};use flowy_error::{FlowyError, FlowyResult};use lazy_static::lazy_static;use lib_infra::async_trait::async_trait;use lib_infra::util::timestamp;-use serde_json::{json, Value};+use serde_json::{Value, json};use std::collections::HashMap;use std::path::Path;use std::sync::Arc;diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/folder.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/folder.rsindex fcb7e929cb..6649bcc6b9 100644--- a/frontend/rust-lib/flowy-server/src/local_server/impls/folder.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/impls/folder.rs@@ -1,15 +1,15 @@#![allow(unused_variables)]+use crate::EmbeddingWriter;use crate::af_cloud::define::LoggedUser;use crate::local_server::util::default_encode_collab_for_collab_type;-use crate::EmbeddingWriter;-use client_api::entity::workspace_dto::PublishInfoView;use client_api::entity::PublishInfo;+use client_api::entity::workspace_dto::PublishInfoView;use collab::core::origin::CollabOrigin;use collab::preclude::Collab;use collab_entity::CollabType;-use collab_plugins::local_storage::kv::doc::CollabKVAction;use collab_plugins::local_storage::kv::KVTransactionDB;+use collab_plugins::local_storage::kv::doc::CollabKVAction;use flowy_error::FlowyError;use flowy_folder_pub::cloud::{FolderCloudService, FolderCollabParams, FolderSnapshot, FullSyncCollabParams,diff --git a/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs b/frontend/rust-lib/flowy-server/src/local_server/impls/user.rsindex bf10fe2e0c..441dfe96a8 100644--- a/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/impls/user.rs@@ -2,7 +2,7 @@use crate::af_cloud::define::LoggedUser;use crate::local_server::template::create_workspace::{- create_workspace_for_user, CreateWorkspaceCollab,+ CreateWorkspaceCollab, create_workspace_for_user,};use crate::local_server::uid::IDGenerator;use anyhow::Context;@@ -10,22 +10,22 @@ use client_api::entity::GotrueTokenResponse;use collab::core::origin::CollabOrigin;use collab::preclude::Collab;use collab_entity::CollabObject;-use collab_plugins::local_storage::kv::doc::CollabKVAction;-use collab_plugins::local_storage::kv::KVTransactionDB;use collab_plugins::CollabKVDB;+use collab_plugins::local_storage::kv::KVTransactionDB;+use collab_plugins::local_storage::kv::doc::CollabKVAction;use collab_user::core::UserAwareness;use flowy_ai_pub::cloud::billing_dto::WorkspaceUsageAndLimit;use flowy_ai_pub::cloud::{AFWorkspaceSettings, AFWorkspaceSettingsChange};use flowy_error::{FlowyError, FlowyResult};+use flowy_user_pub::DEFAULT_USER_NAME;use flowy_user_pub::cloud::{UserCloudService, UserCollabParams};use flowy_user_pub::entities::*;use flowy_user_pub::sql::{+ UserTableChangeset, WorkspaceMemberTable, WorkspaceSettingsChangeset, WorkspaceSettingsTable,insert_local_workspace, select_all_user_workspace, select_user_profile, select_user_workspace,select_workspace_member, select_workspace_setting, update_user_profile, update_workspace_setting,- upsert_workspace_member, upsert_workspace_setting, UserTableChangeset, WorkspaceMemberTable,- WorkspaceSettingsChangeset, WorkspaceSettingsTable,+ upsert_workspace_member, upsert_workspace_setting,};-use flowy_user_pub::DEFAULT_USER_NAME;use lazy_static::lazy_static;use lib_infra::async_trait::async_trait;use lib_infra::box_any::BoxAny;diff --git a/frontend/rust-lib/flowy-server/src/local_server/server.rs b/frontend/rust-lib/flowy-server/src/local_server/server.rsindex 3ab163be57..24bbcf4657 100644--- a/frontend/rust-lib/flowy-server/src/local_server/server.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/server.rs@@ -17,7 +17,7 @@ use flowy_storage_pub::cloud::StorageCloudService;use flowy_user_pub::cloud::UserCloudService;use lib_infra::async_trait::async_trait;use std::sync::{Arc, Weak};-use tokio::sync::{mpsc, RwLock};+use tokio::sync::{RwLock, mpsc};pub struct LocalServer {logged_user: Arc<dyn LoggedUser>,diff --git a/frontend/rust-lib/flowy-server/src/local_server/uid.rs b/frontend/rust-lib/flowy-server/src/local_server/uid.rsindex ea45582cc1..c34f4dda7c 100644--- a/frontend/rust-lib/flowy-server/src/local_server/uid.rs+++ b/frontend/rust-lib/flowy-server/src/local_server/uid.rs@@ -38,7 +38,8 @@ impl IDGenerator {}self.last_timestamp = timestamp;- let id = (timestamp - EPOCH) << TIMESTAMP_SHIFT | self.node_id << NODE_ID_SHIFT | self.sequence;+ let id =+ ((timestamp - EPOCH) << TIMESTAMP_SHIFT) | (self.node_id << NODE_ID_SHIFT) | self.sequence;id as i64}diff --git a/frontend/rust-lib/flowy-sqlite-vec/Cargo.toml b/frontend/rust-lib/flowy-sqlite-vec/Cargo.tomlindex 1b59d8af02..ebc62f26cb 100644--- a/frontend/rust-lib/flowy-sqlite-vec/Cargo.toml+++ b/frontend/rust-lib/flowy-sqlite-vec/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-sqlite-vec"version = "0.1.0"-edition = "2021"+edition = "2024"[dependencies]sqlite-vec = "0.1.6"diff --git a/frontend/rust-lib/flowy-sqlite-vec/src/db.rs b/frontend/rust-lib/flowy-sqlite-vec/src/db.rsindex 4805347eb9..f739874c14 100644--- a/frontend/rust-lib/flowy-sqlite-vec/src/db.rs+++ b/frontend/rust-lib/flowy-sqlite-vec/src/db.rs@@ -7,7 +7,7 @@ use anyhow::{Context, Result};use flowy_ai_pub::entities::{EmbeddedChunk, SearchResult};use r2d2::Pool;use r2d2_sqlite::SqliteConnectionManager;-use rusqlite::{params, ToSql};+use rusqlite::{ToSql, params};use serde_json::Value;use std::collections::{HashMap, HashSet};use std::path::PathBuf;@@ -418,8 +418,7 @@ impl VectorSqliteDB {) -> Result<Vec<SearchResult>> {trace!("[VectorStore] Searching workspace:{} score:{}",- workspace_id,- min_score+ workspace_id, min_score);// distance = 1 - score, so we only want distance <= max_distancelet max_distance = 1.0 - min_score;@@ -467,9 +466,7 @@ impl VectorSqliteDB {) -> Result<Vec<SearchResult>> {trace!("[VectorStore] Searching workspace:{} with object_ids: {:?}, score:{}",- workspace_id,- object_ids,- min_score+ workspace_id, object_ids, min_score);// distance = 1 - score, so we only want distance <= max_distancelet max_distance = 1.0 - min_score;@@ -536,8 +533,7 @@ impl VectorSqliteDB {let score: f32 = row.get(4)?;trace!("[VectorStore] Found {} embedding record, score: {}",- oid,- score+ oid, score);results.push(SearchResult {oid,diff --git a/frontend/rust-lib/flowy-sqlite-vec/src/migration.rs b/frontend/rust-lib/flowy-sqlite-vec/src/migration.rsindex 84f0c27cc9..38bd9efa5e 100644--- a/frontend/rust-lib/flowy-sqlite-vec/src/migration.rs+++ b/frontend/rust-lib/flowy-sqlite-vec/src/migration.rs@@ -1,4 +1,4 @@-use include_dir::{include_dir, Dir};+use include_dir::{Dir, include_dir};use r2d2::PooledConnection;use r2d2_sqlite::SqliteConnectionManager;use rusqlite_migration::Migrations;diff --git a/frontend/rust-lib/flowy-storage-pub/Cargo.toml b/frontend/rust-lib/flowy-storage-pub/Cargo.tomlindex d36c997432..b74ca3719f 100644--- a/frontend/rust-lib/flowy-storage-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-storage-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-storage-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-storage/Cargo.toml b/frontend/rust-lib/flowy-storage/Cargo.tomlindex add7996439..5579667d70 100644--- a/frontend/rust-lib/flowy-storage/Cargo.toml+++ b/frontend/rust-lib/flowy-storage/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-storage"version = "0.1.0"-edition = "2021"+edition = "2024"[dependencies]lib-dispatch = { workspace = true }diff --git a/frontend/rust-lib/flowy-storage/build.rs b/frontend/rust-lib/flowy-storage/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-storage/build.rs+++ b/frontend/rust-lib/flowy-storage/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/flowy-storage/src/event_handler.rs b/frontend/rust-lib/flowy-storage/src/event_handler.rsindex 8b34918e6b..92eebaf079 100644--- a/frontend/rust-lib/flowy-storage/src/event_handler.rs+++ b/frontend/rust-lib/flowy-storage/src/event_handler.rs@@ -1,7 +1,7 @@use crate::entities::{FileStatePB, QueryFilePB, RegisterStreamPB};use crate::manager::StorageManager;use flowy_error::{FlowyError, FlowyResult};-use lib_dispatch::prelude::{data_result_ok, AFPluginData, AFPluginState, DataResult};+use lib_dispatch::prelude::{AFPluginData, AFPluginState, DataResult, data_result_ok};use std::sync::{Arc, Weak};fn upgrade_storage_manager(diff --git a/frontend/rust-lib/flowy-storage/src/manager.rs b/frontend/rust-lib/flowy-storage/src/manager.rsindex 0dd729b087..8f942764e8 100644--- a/frontend/rust-lib/flowy-storage/src/manager.rs+++ b/frontend/rust-lib/flowy-storage/src/manager.rs@@ -1,11 +1,11 @@use crate::entities::FileStatePB;use crate::file_cache::FileTempStorage;-use crate::notification::{make_notification, StorageNotification};+use crate::notification::{StorageNotification, make_notification};use crate::sqlite_sql::{- batch_select_upload_file, delete_all_upload_parts, delete_upload_file,- delete_upload_file_by_file_id, insert_upload_file, insert_upload_part, is_upload_completed,- is_upload_exist, select_upload_file, select_upload_parts, update_upload_file_completed,- update_upload_file_upload_id, UploadFilePartTable, UploadFileTable,+ UploadFilePartTable, UploadFileTable, batch_select_upload_file, delete_all_upload_parts,+ delete_upload_file, delete_upload_file_by_file_id, insert_upload_file, insert_upload_part,+ is_upload_completed, is_upload_exist, select_upload_file, select_upload_parts,+ update_upload_file_completed, update_upload_file_upload_id,};use crate::uploader::{FileUploader, FileUploaderRunner, Signal, UploadTask, UploadTaskQueue};use allo_isolate::Isolate;@@ -14,7 +14,7 @@ use collab_importer::util::FileId;use dashmap::DashMap;use flowy_error::{ErrorCode, FlowyError, FlowyResult};use flowy_sqlite::DBConnection;-use flowy_storage_pub::chunked_byte::{calculate_offsets, ChunkedBytes, MIN_CHUNK_SIZE};+use flowy_storage_pub::chunked_byte::{ChunkedBytes, MIN_CHUNK_SIZE, calculate_offsets};use flowy_storage_pub::cloud::StorageCloudService;use flowy_storage_pub::storage::{CompletedPartRequest, CreatedUpload, FileProgress, FileProgressReceiver, FileUploadState,@@ -25,8 +25,8 @@ use lib_infra::isolate_stream::{IsolateSink, SinkExt};use lib_infra::util::timestamp;use std::path::{Path, PathBuf};use std::str::FromStr;-use std::sync::atomic::AtomicBool;use std::sync::Arc;+use std::sync::atomic::AtomicBool;use tokio::io::AsyncWriteExt;use tokio::sync::{broadcast, watch};use tracing::{debug, error, info, instrument, trace};@@ -598,9 +598,7 @@ async fn start_upload(// 1. create uploadtrace!("[File] create upload for workspace: {}, parent_dir: {}, file_id: {}",- upload_file.workspace_id,- upload_file.parent_dir,- upload_file.file_id+ upload_file.workspace_id, upload_file.parent_dir, upload_file.file_id);let workspace_id = Uuid::from_str(&upload_file.workspace_id)?;@@ -635,8 +633,7 @@ async fn start_upload(trace!("[File] {} update upload_id: {}",- upload_file.file_id,- create_upload_resp.upload_id+ upload_file.file_id, create_upload_resp.upload_id);upload_file.upload_id = create_upload_resp.upload_id;@@ -675,8 +672,7 @@ async fn start_upload(Ok(resp) => {trace!("[File] {} part {} uploaded",- upload_file.file_id,- part_number+ upload_file.file_id, part_number);let mut progress_value = (part_number as f64 / total_parts as f64).clamp(0.0, 1.0);// The 0.1 is reserved for the complete_upload progressdiff --git a/frontend/rust-lib/flowy-storage/src/sqlite_sql.rs b/frontend/rust-lib/flowy-storage/src/sqlite_sql.rsindex 36e24b7ef9..4b6fd39cb1 100644--- a/frontend/rust-lib/flowy-storage/src/sqlite_sql.rs+++ b/frontend/rust-lib/flowy-storage/src/sqlite_sql.rs@@ -3,8 +3,8 @@ use flowy_sqlite::result::DatabaseErrorKind;use flowy_sqlite::result::Error::DatabaseError;use flowy_sqlite::schema::{upload_file_part, upload_file_table};use flowy_sqlite::{- diesel, AsChangeset, BoolExpressionMethods, DBConnection, ExpressionMethods, Identifiable,- Insertable, OptionalExtension, QueryDsl, Queryable, RunQueryDsl, SqliteConnection,+ AsChangeset, BoolExpressionMethods, DBConnection, ExpressionMethods, Identifiable, Insertable,+ OptionalExtension, QueryDsl, Queryable, RunQueryDsl, SqliteConnection, diesel,};use tracing::{trace, warn};diff --git a/frontend/rust-lib/flowy-storage/src/uploader.rs b/frontend/rust-lib/flowy-storage/src/uploader.rsindex a230b3de83..535a2faefc 100644--- a/frontend/rust-lib/flowy-storage/src/uploader.rs+++ b/frontend/rust-lib/flowy-storage/src/uploader.rs@@ -8,7 +8,7 @@ use std::fmt::Display;use std::sync::atomic::{AtomicBool, AtomicU8};use std::sync::{Arc, Weak};use std::time::Duration;-use tokio::sync::{watch, RwLock};+use tokio::sync::{RwLock, watch};use tracing::{error, info, instrument, trace, warn};#[derive(Clone)]diff --git a/frontend/rust-lib/flowy-storage/tests/multiple_part_upload_test.rs b/frontend/rust-lib/flowy-storage/tests/multiple_part_upload_test.rsindex 4fddb78458..89e3a05db9 100644--- a/frontend/rust-lib/flowy-storage/tests/multiple_part_upload_test.rs+++ b/frontend/rust-lib/flowy-storage/tests/multiple_part_upload_test.rs@@ -1,12 +1,12 @@use collab_importer::util::FileId;use flowy_sqlite::Database;use flowy_storage::sqlite_sql::{- batch_select_upload_file, delete_upload_file, insert_upload_file, insert_upload_part,- select_latest_upload_part, select_upload_parts, UploadFilePartTable, UploadFileTable,+ UploadFilePartTable, UploadFileTable, batch_select_upload_file, delete_upload_file,+ insert_upload_file, insert_upload_part, select_latest_upload_part, select_upload_parts,};use flowy_storage_pub::chunked_byte::{ChunkedBytes, MIN_CHUNK_SIZE};use rand::distributions::Alphanumeric;-use rand::{thread_rng, Rng};+use rand::{Rng, thread_rng};use std::env::temp_dir;use std::fs::File;use std::io::Write;diff --git a/frontend/rust-lib/flowy-user-pub/Cargo.toml b/frontend/rust-lib/flowy-user-pub/Cargo.tomlindex 6d39f163c3..7a0c76e8ac 100644--- a/frontend/rust-lib/flowy-user-pub/Cargo.toml+++ b/frontend/rust-lib/flowy-user-pub/Cargo.toml@@ -1,7 +1,7 @@[package]name = "flowy-user-pub"version = "0.1.0"-edition = "2021"+edition = "2024"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmldiff --git a/frontend/rust-lib/flowy-user-pub/src/cloud.rs b/frontend/rust-lib/flowy-user-pub/src/cloud.rsindex a99e8b8672..3a4b701108 100644--- a/frontend/rust-lib/flowy-user-pub/src/cloud.rs+++ b/frontend/rust-lib/flowy-user-pub/src/cloud.rs@@ -1,13 +1,13 @@+use client_api::entity::GotrueTokenResponse;use client_api::entity::billing_dto::RecurringInterval;use client_api::entity::billing_dto::SubscriptionPlan;use client_api::entity::billing_dto::SubscriptionPlanDetail;pub use client_api::entity::billing_dto::SubscriptionStatus;use client_api::entity::billing_dto::WorkspaceSubscriptionStatus;use client_api::entity::billing_dto::WorkspaceUsageAndLimit;-use client_api::entity::GotrueTokenResponse;pub use client_api::entity::{AFWorkspaceSettings, AFWorkspaceSettingsChange};use collab_entity::{CollabObject, CollabType};-use flowy_error::{internal_error, ErrorCode, FlowyError};+use flowy_error::{ErrorCode, FlowyError, internal_error};use lib_infra::async_trait::async_trait;use lib_infra::box_any::BoxAny;use serde::{Deserialize, Serialize};@@ -152,7 +152,7 @@ pub trait UserCloudService: Send + Sync + 'static {) -> Result<GotrueTokenResponse, FlowyError>;async fn sign_in_with_magic_link(&self, email: &str, redirect_to: &str)- -> Result<(), FlowyError>;+ -> Result<(), FlowyError>;async fn sign_in_with_passcode(&self,@@ -173,7 +173,7 @@ pub trait UserCloudService: Send + Sync + 'static {/// Get the user information using the user's token or uid/// return None if the user is not foundasync fn get_user_profile(&self, uid: i64, workspace_id: &str)- -> Result<UserProfile, FlowyError>;+ -> Result<UserProfile, FlowyError>;async fn open_workspace(&self, workspace_id: &Uuid) -> Result<UserWorkspace, FlowyError>;diff --git a/frontend/rust-lib/flowy-user-pub/src/entities.rs b/frontend/rust-lib/flowy-user-pub/src/entities.rsindex 3072221219..c9fec20e6e 100644--- a/frontend/rust-lib/flowy-user-pub/src/entities.rs+++ b/frontend/rust-lib/flowy-user-pub/src/entities.rs@@ -2,8 +2,8 @@ use std::fmt::{Display, Formatter};use std::str::FromStr;use chrono::{DateTime, Utc};-pub use client_api::entity::billing_dto::RecurringInterval;use client_api::entity::AFRole;+pub use client_api::entity::billing_dto::RecurringInterval;use flowy_error::FlowyResult;use serde::{Deserialize, Serialize};use serde_json::Value;diff --git a/frontend/rust-lib/flowy-user-pub/src/sql/member_sql.rs b/frontend/rust-lib/flowy-user-pub/src/sql/member_sql.rsindex 1bfcfd923b..92d44997bd 100644--- a/frontend/rust-lib/flowy-user-pub/src/sql/member_sql.rs+++ b/frontend/rust-lib/flowy-user-pub/src/sql/member_sql.rs@@ -1,9 +1,9 @@use crate::entities::{Role, WorkspaceMember};-use diesel::{insert_into, RunQueryDsl};+use diesel::{RunQueryDsl, insert_into};use flowy_error::FlowyResult;use flowy_sqlite::schema::workspace_members_table;use flowy_sqlite::schema::workspace_members_table::dsl;-use flowy_sqlite::{prelude::*, DBConnection, ExpressionMethods};+use flowy_sqlite::{DBConnection, ExpressionMethods, prelude::*};#[derive(Queryable, Insertable, AsChangeset, Debug, Clone)]#[diesel(table_name = workspace_members_table)]diff --git a/frontend/rust-lib/flowy-user-pub/src/sql/user_sql.rs b/frontend/rust-lib/flowy-user-pub/src/sql/user_sql.rsindex 0ccb2b4a49..e8834d2a36 100644--- a/frontend/rust-lib/flowy-user-pub/src/sql/user_sql.rs+++ b/frontend/rust-lib/flowy-user-pub/src/sql/user_sql.rs@@ -3,11 +3,11 @@ use crate::entities::{AuthType, Role, UpdateUserProfileParams, UserProfile, UserWorkspace, WorkspaceType,};use crate::sql::{- select_user_workspace, upsert_user_workspace, upsert_workspace_member, WorkspaceMemberTable,+ WorkspaceMemberTable, select_user_workspace, upsert_user_workspace, upsert_workspace_member,};use flowy_error::{FlowyError, FlowyResult};use flowy_sqlite::schema::user_table;-use flowy_sqlite::{prelude::*, DBConnection, ExpressionMethods, RunQueryDsl};+use flowy_sqlite::{DBConnection, ExpressionMethods, RunQueryDsl, prelude::*};use tracing::trace;/// The order of the fields in the struct must be the same as the order of the fields in the table.diff --git a/frontend/rust-lib/flowy-user-pub/src/sql/workspace_setting_sql.rs b/frontend/rust-lib/flowy-user-pub/src/sql/workspace_setting_sql.rsindex 7eeafaf1e4..535610b2d8 100644--- a/frontend/rust-lib/flowy-user-pub/src/sql/workspace_setting_sql.rs+++ b/frontend/rust-lib/flowy-user-pub/src/sql/workspace_setting_sql.rs@@ -1,9 +1,9 @@use client_api::entity::AFWorkspaceSettings;use flowy_error::FlowyError;+use flowy_sqlite::DBConnection;use flowy_sqlite::schema::workspace_setting_table;use flowy_sqlite::schema::workspace_setting_table::dsl;-use flowy_sqlite::DBConnection;-use flowy_sqlite::{prelude::*, ExpressionMethods};+use flowy_sqlite::{ExpressionMethods, prelude::*};use uuid::Uuid;#[derive(Clone, Default, Queryable, Identifiable, Insertable)]diff --git a/frontend/rust-lib/flowy-user-pub/src/sql/workspace_sql.rs b/frontend/rust-lib/flowy-user-pub/src/sql/workspace_sql.rsindex ec24a00172..9fc2c6b599 100644--- a/frontend/rust-lib/flowy-user-pub/src/sql/workspace_sql.rs+++ b/frontend/rust-lib/flowy-user-pub/src/sql/workspace_sql.rs@@ -1,10 +1,10 @@use crate::entities::{AuthType, UserWorkspace, WorkspaceType};use chrono::{TimeZone, Utc};use flowy_error::{FlowyError, FlowyResult};+use flowy_sqlite::DBConnection;use flowy_sqlite::schema::user_workspace_table;use flowy_sqlite::schema::user_workspace_table::dsl;-use flowy_sqlite::DBConnection;-use flowy_sqlite::{prelude::*, ExpressionMethods, RunQueryDsl, SqliteConnection};+use flowy_sqlite::{ExpressionMethods, RunQueryDsl, SqliteConnection, prelude::*};use std::collections::{HashMap, HashSet};use tracing::{info, warn};diff --git a/frontend/rust-lib/flowy-user/build.rs b/frontend/rust-lib/flowy-user/build.rsindex 77c0c8125b..d71ea526a3 100644--- a/frontend/rust-lib/flowy-user/build.rs+++ b/frontend/rust-lib/flowy-user/build.rs@@ -2,6 +2,6 @@ fn main() {#[cfg(feature = "dart")]{flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));- flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));+ flowy_codegen::dart_event::r#gen(env!("CARGO_PKG_NAME"));}}diff --git a/frontend/rust-lib/lib-log/src/layer.rs b/frontend/rust-lib/lib-log/src/layer.rsindex 945db52a8b..90571685a4 100644--- a/frontend/rust-lib/lib-log/src/layer.rs+++ b/frontend/rust-lib/lib-log/src/layer.rs@@ -54,7 +54,7 @@ whereself.target_filter.as_ref()- .map_or(true, |f| f(metadata.target()))+ .is_none_or(|f| f(metadata.target()))}fn serialize_fields(diff --git a/frontend/rust-lib/rust-toolchain.toml b/frontend/rust-lib/rust-toolchain.tomlindex efd9dc3dbe..24b4908d57 100644--- a/frontend/rust-lib/rust-toolchain.toml+++ b/frontend/rust-lib/rust-toolchain.toml@@ -1,2 +1,3 @@[toolchain]-channel = "1.84.0"+channel = "1.85"+components = ["clippy", "rustfmt"]\ No newline at end of filediff --git a/frontend/rust-lib/rustfmt.toml b/frontend/rust-lib/rustfmt.tomlindex 5cb0d67ee5..3a40b3f363 100644--- a/frontend/rust-lib/rustfmt.toml+++ b/frontend/rust-lib/rustfmt.toml@@ -9,4 +9,4 @@ reorder_imports = truereorder_modules = trueremove_nested_parens = truemerge_derives = true-edition = "2021"\ No newline at end of file+edition = "2024"\ No newline at end of filediff --git a/frontend/rust-toolchain.toml b/frontend/rust-toolchain.tomlindex efd9dc3dbe..4b260e5d3d 100644--- a/frontend/rust-toolchain.toml+++ b/frontend/rust-toolchain.toml@@ -1,2 +1,3 @@[toolchain]-channel = "1.84.0"+channel = "1.85"+components = ["clippy", "rustfmt"]diff --git a/frontend/scripts/makefile/env.toml b/frontend/scripts/makefile/env.tomlindex 96a632f8ab..73a7cb214a 100644--- a/frontend/scripts/makefile/env.toml+++ b/frontend/scripts/makefile/env.toml@@ -79,7 +79,7 @@ dependencies = ["check_vcpkg"][tasks.install_targets.mac]script = """#rustup target add x86_64-apple-ios-#rustup target add x86_64-apple-darwin+rustup target add x86_64-apple-darwin#rustup target add aarch64-apple-iosrustup target add aarch64-apple-darwin"""