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
feat: wasm build (#4412)
Nathan.fooo90516b6adca5
diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yamlindex b0292b455e..c722565cb5 100644--- a/.github/workflows/rust_ci.yaml+++ b/.github/workflows/rust_ci.yaml@@ -23,7 +23,6 @@ env:jobs:test-on-ubuntu:-# environment: SUPABASE_CIruns-on: ubuntu-lateststeps:- name: Checkout source code@@ -50,22 +49,6 @@ jobs:workspaces: |frontend/rust-lib-# - name: Create .env file in flowy-server-# working-directory: frontend/rust-lib/flowy-server-# run: |-# touch .env.ci-# echo SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env.ci-# echo SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} >> .env.ci-# echo SUPABASE_JWT_SECRET=${{ secrets.SUPABASE_JWT_SECRET }} >> .env.ci-#-# - name: Create .env file in event-integration-# working-directory: frontend/rust-lib/event-integration-# run: |-# touch .env.ci-# echo SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env.ci-# echo SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} >> .env.ci-# echo SUPABASE_JWT_SECRET=${{ secrets.SUPABASE_JWT_SECRET }} >> .env.ci-- name: Checkout appflowy cloud codeuses: actions/checkout@v3with:diff --git a/frontend/Makefile.toml b/frontend/Makefile.tomlindex aac4b03724..48aefac8fd 100644--- a/frontend/Makefile.toml+++ b/frontend/Makefile.toml@@ -10,6 +10,7 @@ extend = [{ path = "scripts/makefile/flutter.toml" },{ path = "scripts/makefile/tool.toml" },{ path = "scripts/makefile/tauri.toml" },+ { path = "scripts/makefile/web.toml" },][config]diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lockindex 91a22843fc..c08bdc42fd 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock@@ -2,6 +2,18 @@# It is not intended for manual editing.version = 3+[[package]]+name = "accessory"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "850bb534b9dc04744fbbb71d30ad6d25a7e4cf6dc33e223c81ef3a92ebab4e0b"+dependencies = [+ "macroific",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "addr2line"version = "0.19.0"@@ -139,10 +151,11 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","bincode",+ "getrandom 0.2.10","reqwest","serde","serde_json",@@ -159,6 +172,7 @@ version = "0.0.0"dependencies = ["bytes","flowy-core",+ "flowy-error","flowy-notification","lib-dispatch","serde",@@ -685,7 +699,7 @@ dependencies = [[[package]]name = "client-api"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -698,6 +712,7 @@ dependencies = ["database-entity","futures-core","futures-util",+ "getrandom 0.2.10","gotrue","gotrue-entity","mime",@@ -783,12 +798,13 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","async-trait","bincode","bytes",+ "js-sys","parking_lot","serde","serde_json",@@ -797,13 +813,14 @@ dependencies = ["tokio","tokio-stream","tracing",+ "web-sys","yrs",][[package]]name = "collab-database"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","async-trait",@@ -811,6 +828,7 @@ dependencies = ["collab","collab-entity","collab-plugins",+ "js-sys","lazy_static","lru","nanoid",@@ -830,7 +848,7 @@ dependencies = [[[package]]name = "collab-document"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","collab",@@ -848,7 +866,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","bytes",@@ -862,7 +880,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","chrono",@@ -898,16 +916,20 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow",+ "async-stream","async-trait","bincode","bytes","chrono","collab","collab-entity",+ "futures","futures-util",+ "indexed_db_futures",+ "js-sys","lazy_static","parking_lot","rand 0.8.5",@@ -921,14 +943,18 @@ dependencies = ["tokio-retry","tokio-stream","tracing",+ "tracing-wasm","uuid",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys","yrs",][[package]]name = "collab-user"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","collab",@@ -1261,7 +1287,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -1287,6 +1313,18 @@ dependencies = ["regex",]+[[package]]+name = "delegate-display"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "98a85201f233142ac819bbf6226e36d0b5e129a47bd325084674261c82d4cd66"+dependencies = [+ "macroific",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "derivative"version = "2.2.0"@@ -1511,12 +1549,6 @@ dependencies = ["winapi",]-[[package]]-name = "fallible-iterator"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"-[[package]]name = "fancy-regex"version = "0.10.0"@@ -1537,6 +1569,18 @@ dependencies = ["regex",]+[[package]]+name = "fancy_constructor"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f71f317e4af73b2f8f608fac190c52eac4b1879d2145df1db2fe48881ca69435"+dependencies = [+ "macroific",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "fastrand"version = "2.0.1"@@ -1705,6 +1749,7 @@ dependencies = ["collab-database","collab-entity","collab-integrate",+ "collab-plugins","csv","dashmap","fancy-regex 0.11.0",@@ -1777,6 +1822,7 @@ dependencies = ["collab-document","collab-entity","collab-integrate",+ "collab-plugins","flowy-codegen","flowy-derive","flowy-document-pub",@@ -1821,6 +1867,7 @@ dependencies = ["aes-gcm","anyhow","base64 0.21.5",+ "getrandom 0.2.10","hmac","pbkdf2 0.12.2","rand 0.8.5",@@ -1850,7 +1897,6 @@ dependencies = ["serde_repr","thiserror","tokio",- "tokio-postgres","url","validator",]@@ -1865,6 +1911,7 @@ dependencies = ["collab-entity","collab-folder","collab-integrate",+ "collab-plugins","flowy-codegen","flowy-derive","flowy-error",@@ -2016,6 +2063,7 @@ dependencies = ["collab-entity","collab-folder","collab-integrate",+ "collab-plugins","collab-user","diesel","diesel_derives",@@ -2500,10 +2548,11 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","futures-util",+ "getrandom 0.2.10","gotrue-entity","infra","reqwest",@@ -2516,7 +2565,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -2901,6 +2950,23 @@ dependencies = ["num-traits",]+[[package]]+name = "indexed_db_futures"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6cc2083760572ee02385ab8b7c02c20925d2dd1f97a1a25a8737a238608f1152"+dependencies = [+ "accessory",+ "cfg-if",+ "delegate-display",+ "fancy_constructor",+ "js-sys",+ "uuid",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+]+[[package]]name = "indexmap"version = "1.9.3"@@ -2935,7 +3001,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","reqwest",@@ -3294,6 +3360,53 @@ version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"+[[package]]+name = "macroific"+version = "1.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f05c00ac596022625d01047c421a0d97d7f09a18e429187b341c201cb631b9dd"+dependencies = [+ "macroific_attr_parse",+ "macroific_core",+ "macroific_macro",+]++[[package]]+name = "macroific_attr_parse"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd94d5da95b30ae6e10621ad02340909346ad91661f3f8c0f2b62345e46a2f67"+dependencies = [+ "cfg-if",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]++[[package]]+name = "macroific_core"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13198c120864097a565ccb3ff947672d969932b7975ebd4085732c9f09435e55"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]++[[package]]+name = "macroific_macro"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b0c9853143cbed7f1e41dc39fee95f9b361bec65c8dc2a01bf609be01b61f5ae"+dependencies = [+ "macroific_attr_parse",+ "macroific_core",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "malloc_buf"version = "0.0.6"@@ -3346,15 +3459,6 @@ version = "0.1.10"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"-[[package]]-name = "md-5"-version = "0.10.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca"-dependencies = [- "digest",-]-[[package]]name = "md5"version = "0.7.0"@@ -4136,35 +4240,6 @@ dependencies = ["universal-hash",]-[[package]]-name = "postgres-protocol"-version = "0.6.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "78b7fa9f396f51dffd61546fd8573ee20592287996568e6175ceb0f8699ad75d"-dependencies = [- "base64 0.21.5",- "byteorder",- "bytes",- "fallible-iterator",- "hmac",- "md-5",- "memchr",- "rand 0.8.5",- "sha2",- "stringprep",-]--[[package]]-name = "postgres-types"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f028f05971fe20f512bcc679e2c10227e57809a3af86a7606304435bc8896cd6"-dependencies = [- "bytes",- "fallible-iterator",- "postgres-protocol",-]-[[package]]name = "postgrest"version = "1.5.0"@@ -4578,7 +4653,7 @@ dependencies = [[[package]]name = "realtime-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","bincode",@@ -4600,7 +4675,7 @@ dependencies = [[[package]]name = "realtime-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","bincode",@@ -5248,7 +5323,7 @@ dependencies = [[[package]]name = "shared_entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -5449,16 +5524,6 @@ dependencies = ["quote",]-[[package]]-name = "stringprep"-version = "0.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1"-dependencies = [- "unicode-bidi",- "unicode-normalization",-]-[[package]]name = "strsim"version = "0.10.0"@@ -6024,30 +6089,6 @@ dependencies = ["tokio",]-[[package]]-name = "tokio-postgres"-version = "0.7.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6e89f6234aa8fd43779746012fcf53603cdb91fdd8399aa0de868c2d56b6dde1"-dependencies = [- "async-trait",- "byteorder",- "bytes",- "fallible-iterator",- "futures-channel",- "futures-util",- "log",- "parking_lot",- "percent-encoding",- "phf 0.11.2",- "pin-project-lite",- "postgres-protocol",- "postgres-types",- "socket2 0.5.5",- "tokio",- "tokio-util",-]-[[package]]name = "tokio-retry"version = "0.3.0"@@ -6274,6 +6315,17 @@ dependencies = ["tracing-serde",]+[[package]]+name = "tracing-wasm"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07"+dependencies = [+ "tracing",+ "tracing-subscriber",+ "wasm-bindgen",+]+[[package]]name = "treediff"version = "4.0.2"@@ -6465,6 +6517,7 @@ dependencies = ["getrandom 0.2.10","serde","sha1_smol",+ "wasm-bindgen",][[package]]@@ -7118,7 +7171,7 @@ dependencies = [[[package]]name = "workspace-template"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","async-trait",@@ -7127,6 +7180,7 @@ dependencies = ["collab-document","collab-entity","collab-folder",+ "getrandom 0.2.10","indexmap 2.1.0","nanoid","serde",diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.tomlindex e38bf4f21f..d4c9163b6f 100644--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml@@ -17,7 +17,7 @@ tauri-build = { version = "1.5", features = [] }anyhow = "1.0"tracing = "0.1.40"bytes = "1.5.0"-serde = "1.0.108"+serde = "1.0"serde_json = "1.0.108"protobuf = { version = "2.28.0" }diesel = { version = "2.1.0", features = ["sqlite", "chrono", "r2d2"] }@@ -40,6 +40,7 @@ bytes.workspace = truetracing.workspace = truelib-dispatch = { path = "../../rust-lib/lib-dispatch", features = ["use_serde"] }flowy-core = { path = "../../rust-lib/flowy-core", features = ["rev-sqlite", "ts"] }+flowy-error = { path = "../../rust-lib/flowy-error", features = ["impl_from_sqlite", "impl_from_dispatch_error", "impl_from_appflowy_cloud", "impl_from_reqwest", "impl_from_serde"] }flowy-notification = { path = "../../rust-lib/flowy-notification", features = ["ts"] }uuid = "1.5.0"@@ -57,7 +58,7 @@ custom-protocol = ["tauri/custom-protocol"]# Run the script:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "5a353856afbcb29ee357c4f2bda183a94d4f811d" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "480b7377f28c01c92c90eda648f67aae5bad8931" }# Please use the following script to update collab.# Working directory: frontend#@@ -67,10 +68,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "5a3# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }\ No newline at end of filediff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lockindex f2f1c81857..ed89dc3edd 100644--- a/frontend/rust-lib/Cargo.lock+++ b/frontend/rust-lib/Cargo.lock@@ -2,6 +2,18 @@# It is not intended for manual editing.version = 3+[[package]]+name = "accessory"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "850bb534b9dc04744fbbb71d30ad6d25a7e4cf6dc33e223c81ef3a92ebab4e0b"+dependencies = [+ "macroific",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "addr2line"version = "0.21.0"@@ -140,10 +152,11 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"[[package]]name = "app-error"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","bincode",+ "getrandom 0.2.10","reqwest","serde","serde_json",@@ -345,15 +358,6 @@ version = "1.6.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"-[[package]]-name = "basic-toml"-version = "0.1.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2f2139706359229bfa8f19142ac1155b4b80beafb7a60471ac5dd109d4a19778"-dependencies = [- "serde",-]-[[package]]name = "bincode"version = "1.3.3"@@ -658,7 +662,7 @@ dependencies = [[[package]]name = "client-api"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -671,6 +675,7 @@ dependencies = ["database-entity","futures-core","futures-util",+ "getrandom 0.2.10","gotrue","gotrue-entity","mime",@@ -725,12 +730,13 @@ dependencies = [[[package]]name = "collab"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","async-trait","bincode","bytes",+ "js-sys","parking_lot","serde","serde_json",@@ -739,13 +745,14 @@ dependencies = ["tokio","tokio-stream","tracing",+ "web-sys","yrs",][[package]]name = "collab-database"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","async-trait",@@ -753,6 +760,7 @@ dependencies = ["collab","collab-entity","collab-plugins",+ "js-sys","lazy_static","lru","nanoid",@@ -772,11 +780,12 @@ dependencies = [[[package]]name = "collab-document"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","collab","collab-entity",+ "getrandom 0.2.10","nanoid","parking_lot","serde",@@ -790,7 +799,7 @@ dependencies = [[[package]]name = "collab-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","bytes",@@ -804,7 +813,7 @@ dependencies = [[[package]]name = "collab-folder"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","chrono",@@ -840,16 +849,21 @@ dependencies = [[[package]]name = "collab-plugins"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow",+ "async-stream","async-trait","bincode","bytes","chrono","collab","collab-entity",+ "futures","futures-util",+ "getrandom 0.2.10",+ "indexed_db_futures",+ "js-sys","lazy_static","parking_lot","rand 0.8.5",@@ -863,14 +877,18 @@ dependencies = ["tokio-retry","tokio-stream","tracing",+ "tracing-wasm","uuid",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys","yrs",][[package]]name = "collab-user"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3c6b188a2bcd25da2787d891a4faf6e085c8984c#3c6b188a2bcd25da2787d891a4faf6e085c8984c"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3eef93f35f606edef2541888cb91cd6686d77225#3eef93f35f606edef2541888cb91cd6686d77225"dependencies = ["anyhow","collab",@@ -1066,7 +1084,7 @@ dependencies = ["cssparser-macros","dtoa-short","itoa",- "phf 0.11.2",+ "phf 0.8.0","smallvec",]@@ -1157,6 +1175,7 @@ dependencies = ["flowy-codegen","flowy-core","flowy-derive",+ "flowy-error","flowy-notification","flowy-server","flowy-server-pub",@@ -1194,7 +1213,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"[[package]]name = "database-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -1220,6 +1239,18 @@ dependencies = ["regex",]+[[package]]+name = "delegate-display"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "98a85201f233142ac819bbf6226e36d0b5e129a47bd325084674261c82d4cd66"+dependencies = [+ "macroific",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "deranged"version = "0.3.8"@@ -1537,6 +1568,18 @@ dependencies = ["regex",]+[[package]]+name = "fancy_constructor"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f71f317e4af73b2f8f608fac190c52eac4b1879d2145df1db2fe48881ca69435"+dependencies = [+ "macroific",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "fastrand"version = "2.0.0"@@ -1695,6 +1738,7 @@ dependencies = ["collab-database","collab-entity","collab-integrate",+ "collab-plugins","csv","dashmap","event-integration",@@ -1755,8 +1799,6 @@ dependencies = ["quote","serde_json","syn 1.0.109",- "tokio",- "trybuild","walkdir",]@@ -1770,6 +1812,7 @@ dependencies = ["collab-document","collab-entity","collab-integrate",+ "collab-plugins","flowy-codegen","flowy-derive","flowy-document-pub",@@ -1816,6 +1859,7 @@ dependencies = ["aes-gcm","anyhow","base64 0.21.5",+ "getrandom 0.2.10","hmac","pbkdf2 0.12.2","rand 0.8.5",@@ -1845,7 +1889,6 @@ dependencies = ["serde_repr","thiserror","tokio",- "tokio-postgres","url","validator",]@@ -1860,6 +1903,7 @@ dependencies = ["collab-entity","collab-folder","collab-integrate",+ "collab-plugins","flowy-codegen","flowy-derive","flowy-error",@@ -2018,6 +2062,7 @@ dependencies = ["collab-entity","collab-folder","collab-integrate",+ "collab-plugins","collab-user","diesel","diesel_derives",@@ -2335,10 +2380,11 @@ dependencies = [[[package]]name = "gotrue"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","futures-util",+ "getrandom 0.2.10","gotrue-entity","infra","reqwest",@@ -2351,7 +2397,7 @@ dependencies = [[[package]]name = "gotrue-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -2685,6 +2731,23 @@ dependencies = ["winapi-util",]+[[package]]+name = "indexed_db_futures"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6cc2083760572ee02385ab8b7c02c20925d2dd1f97a1a25a8737a238608f1152"+dependencies = [+ "accessory",+ "cfg-if",+ "delegate-display",+ "fancy_constructor",+ "js-sys",+ "uuid",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+]+[[package]]name = "indexmap"version = "1.9.3"@@ -2709,7 +2772,7 @@ dependencies = [[[package]]name = "infra"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","reqwest",@@ -2961,6 +3024,53 @@ version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"+[[package]]+name = "macroific"+version = "1.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f05c00ac596022625d01047c421a0d97d7f09a18e429187b341c201cb631b9dd"+dependencies = [+ "macroific_attr_parse",+ "macroific_core",+ "macroific_macro",+]++[[package]]+name = "macroific_attr_parse"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd94d5da95b30ae6e10621ad02340909346ad91661f3f8c0f2b62345e46a2f67"+dependencies = [+ "cfg-if",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]++[[package]]+name = "macroific_core"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13198c120864097a565ccb3ff947672d969932b7975ebd4085732c9f09435e55"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]++[[package]]+name = "macroific_macro"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b0c9853143cbed7f1e41dc39fee95f9b361bec65c8dc2a01bf609be01b61f5ae"+dependencies = [+ "macroific_attr_parse",+ "macroific_core",+ "proc-macro2",+ "quote",+ "syn 2.0.47",+]+[[package]]name = "markup5ever"version = "0.11.0"@@ -3426,7 +3536,7 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"dependencies = [- "phf_macros 0.8.0",+ "phf_macros","phf_shared 0.8.0","proc-macro-hack",]@@ -3446,7 +3556,6 @@ version = "0.11.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"dependencies = [- "phf_macros 0.11.2","phf_shared 0.11.2",]@@ -3514,19 +3623,6 @@ dependencies = ["syn 1.0.109",]-[[package]]-name = "phf_macros"-version = "0.11.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"-dependencies = [- "phf_generator 0.11.2",- "phf_shared 0.11.2",- "proc-macro2",- "quote",- "syn 2.0.47",-]-[[package]]name = "phf_shared"version = "0.8.0"@@ -4080,7 +4176,7 @@ dependencies = [[[package]]name = "realtime-entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","bincode",@@ -4102,7 +4198,7 @@ dependencies = [[[package]]name = "realtime-protocol"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","bincode",@@ -4681,7 +4777,7 @@ dependencies = [[[package]]name = "shared_entity"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","app-error",@@ -5004,15 +5100,6 @@ dependencies = ["unic-segment",]-[[package]]-name = "termcolor"-version = "1.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449"-dependencies = [- "winapi-util",-]-[[package]]name = "terminal_size"version = "0.1.17"@@ -5464,25 +5551,21 @@ dependencies = [][[package]]-name = "try-lock"-version = "0.2.4"+name = "tracing-wasm"+version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"+checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07"+dependencies = [+ "tracing",+ "tracing-subscriber",+ "wasm-bindgen",+][[package]]-name = "trybuild"-version = "1.0.86"+name = "try-lock"+version = "0.2.4"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8419ecd263363827c5730386f418715766f584e2f874d32c23c5b00bd9727e7e"-dependencies = [- "basic-toml",- "glob",- "once_cell",- "serde",- "serde_derive",- "serde_json",- "termcolor",-]+checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"[[package]]name = "tungstenite"@@ -5662,6 +5745,7 @@ dependencies = ["getrandom 0.2.10","serde","sha1_smol",+ "wasm-bindgen",][[package]]@@ -6000,7 +6084,7 @@ dependencies = [[[package]]name = "workspace-template"version = "0.1.0"-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5a353856afbcb29ee357c4f2bda183a94d4f811d#5a353856afbcb29ee357c4f2bda183a94d4f811d"+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=480b7377f28c01c92c90eda648f67aae5bad8931#480b7377f28c01c92c90eda648f67aae5bad8931"dependencies = ["anyhow","async-trait",@@ -6009,6 +6093,7 @@ dependencies = ["collab-document","collab-entity","collab-folder",+ "getrandom 0.2.10","indexmap 2.1.0","nanoid","serde",diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.tomlindex 1892ae0dca..83226df02d 100644--- a/frontend/rust-lib/Cargo.toml+++ b/frontend/rust-lib/Cargo.toml@@ -105,7 +105,7 @@ incremental = false# Run the script:# scripts/tool/update_client_api_rev.sh new_rev_id# ⚠️⚠️⚠️️-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "5a353856afbcb29ee357c4f2bda183a94d4f811d" }+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "480b7377f28c01c92c90eda648f67aae5bad8931" }# Please use the following script to update collab.# Working directory: frontend#@@ -115,10 +115,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "5a3# To switch to the local path, run:# scripts/tool/update_collab_source.sh# ⚠️⚠️⚠️️-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3c6b188a2bcd25da2787d891a4faf6e085c8984c" }+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3eef93f35f606edef2541888cb91cd6686d77225" }diff --git a/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml b/frontend/rust-lib/build-tool/flowy-codegen/Cargo.tomlindex 5873d00f15..92a273ad04 100644--- a/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml+++ b/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml@@ -7,7 +7,7 @@ edition = "2021"[dependencies]log = "0.4.17"-serde = { version = "1.0", features = ["derive"]}+serde = { workspace = true, features = ["derive"]}serde_json.workspace = trueflowy-ast.workspace = truequote = "1.0"diff --git a/frontend/rust-lib/build-tool/flowy-derive/Cargo.toml b/frontend/rust-lib/build-tool/flowy-derive/Cargo.tomlindex b03d889ba9..ce84acd0eb 100644--- a/frontend/rust-lib/build-tool/flowy-derive/Cargo.toml+++ b/frontend/rust-lib/build-tool/flowy-derive/Cargo.toml@@ -9,10 +9,6 @@ edition = "2018"proc-macro = truename = "flowy_derive"-[[test]]-name = "tests"-path = "tests/progress.rs"-[dependencies]syn = { version = "1.0.109", features = ["extra-traits", "visit"] }quote = "1.0"@@ -23,7 +19,3 @@ dashmap = "5"flowy-codegen.workspace = trueserde_json.workspace = truewalkdir = "2.3.2"--[dev-dependencies]-tokio = { workspace = true, features = ["full"] }-trybuild = "1.0.77"diff --git a/frontend/rust-lib/build-tool/flowy-derive/tests/progress.rs b/frontend/rust-lib/build-tool/flowy-derive/tests/progress.rsdeleted file mode 100644index 260bdb4d80..0000000000--- a/frontend/rust-lib/build-tool/flowy-derive/tests/progress.rs+++ /dev/null@@ -1,5 +0,0 @@-#[tokio::test]-async fn tests() {- let _t = trybuild::TestCases::new();- // t.pass("tests/protobuf_enum.rs");-}diff --git a/frontend/rust-lib/collab-integrate/Cargo.toml b/frontend/rust-lib/collab-integrate/Cargo.tomlindex db89cbf170..f7fab8f34b 100644--- a/frontend/rust-lib/collab-integrate/Cargo.toml+++ b/frontend/rust-lib/collab-integrate/Cargo.toml@@ -4,6 +4,8 @@ version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]collab = { version = "0.1.0" }@@ -20,4 +22,4 @@ lib-infra = { workspace = true }[features]default = []-wasm_build = []\ No newline at end of file+wasm_build = ["collab-plugins/wasm_build"]\ No newline at end of filediff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rsindex 0455df539c..41210e9b5e 100644--- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs+++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs@@ -1,20 +1,27 @@use std::fmt::{Debug, Display};use std::sync::{Arc, Weak};+use crate::CollabKVDB;use anyhow::Error;use collab::core::collab::{CollabDocState, MutexCollab};use collab::preclude::{CollabBuilder, CollabPlugin};use collab_entity::{CollabObject, CollabType};use collab_plugins::connect_state::{CollabConnectReachability, CollabConnectState};use collab_plugins::local_storage::kv::snapshot::SnapshotPersistence;+if_native! {use collab_plugins::local_storage::rocksdb::rocksdb_plugin::{RocksdbBackup, RocksdbDiskPlugin};+}++if_wasm! {+use collab_plugins::local_storage::indexeddb::IndexeddbDiskPlugin;+}+use collab_plugins::local_storage::CollabPersistenceConfig;+use lib_infra::future::Fut;+use lib_infra::{if_native, if_wasm};use parking_lot::{Mutex, RwLock};use tracing::trace;-use crate::CollabKVDB;-use lib_infra::future::Fut;-#[derive(Clone, Debug)]pub enum CollabPluginProviderType {Local,@@ -87,6 +94,7 @@ pub struct AppFlowyCollabBuilder {workspace_id: RwLock<Option<String>>,plugin_provider: tokio::sync::RwLock<Arc<dyn CollabCloudPluginProvider>>,snapshot_persistence: Mutex<Option<Arc<dyn SnapshotPersistence>>>,+ #[cfg(not(target_arch = "wasm32"))]rocksdb_backup: Mutex<Option<Arc<dyn RocksdbBackup>>>,device_id: String,}@@ -115,6 +123,7 @@ impl AppFlowyCollabBuilder {workspace_id: Default::default(),plugin_provider: tokio::sync::RwLock::new(Arc::new(storage_provider)),snapshot_persistence: Default::default(),+ #[cfg(not(target_arch = "wasm32"))]rocksdb_backup: Default::default(),device_id,}@@ -124,6 +133,7 @@ impl AppFlowyCollabBuilder {*self.snapshot_persistence.lock() = Some(snapshot_persistence);}+ #[cfg(not(target_arch = "wasm32"))]pub fn set_rocksdb_backup(&self, rocksdb_backup: Arc<dyn RocksdbBackup>) {*self.rocksdb_backup.lock() = Some(rocksdb_backup);}@@ -221,23 +231,36 @@ impl AppFlowyCollabBuilder {object_type: CollabType,collab_db: Weak<CollabKVDB>,collab_doc_state: CollabDocState,- persistence_config: CollabPersistenceConfig,+ #[allow(unused_variables)] persistence_config: CollabPersistenceConfig,build_config: CollabBuilderConfig,) -> Result<Arc<MutexCollab>, Error> {- let collab = Arc::new(- CollabBuilder::new(uid, object_id)- .with_doc_state(collab_doc_state)- .with_plugin(RocksdbDiskPlugin::new_with_config(- uid,- object_id.to_string(),- object_type.clone(),- collab_db.clone(),- persistence_config.clone(),- None,- ))- .with_device_id(self.device_id.clone())- .build()?,- );+ let mut builder = CollabBuilder::new(uid, object_id)+ .with_doc_state(collab_doc_state)+ .with_device_id(self.device_id.clone());++ #[cfg(target_arch = "wasm32")]+ {+ builder = builder.with_plugin(IndexeddbDiskPlugin::new(+ uid,+ object_id.to_string(),+ object_type.clone(),+ collab_db.clone(),+ ));+ }++ #[cfg(not(target_arch = "wasm32"))]+ {+ builder = builder.with_plugin(RocksdbDiskPlugin::new_with_config(+ uid,+ object_id.to_string(),+ object_type.clone(),+ collab_db.clone(),+ persistence_config.clone(),+ None,+ ));+ }++ let collab = Arc::new(builder.build()?);{let collab_object = self.collab_object(uid, object_id, object_type)?;if build_config.sync_enable {@@ -265,22 +288,25 @@ impl AppFlowyCollabBuilder {}},CollabPluginProviderType::Supabase => {- trace!("init supabase collab plugins");- let local_collab = Arc::downgrade(&collab);- let local_collab_db = collab_db.clone();- let plugins = self- .plugin_provider- .read()- .await- .get_plugins(CollabPluginProviderContext::Supabase {- uid,- collab_object,- local_collab,- local_collab_db,- })- .await;- for plugin in plugins {- collab.lock().add_plugin(plugin);+ #[cfg(not(target_arch = "wasm32"))]+ {+ trace!("init supabase collab plugins");+ let local_collab = Arc::downgrade(&collab);+ let local_collab_db = collab_db.clone();+ let plugins = self+ .plugin_provider+ .read()+ .await+ .get_plugins(CollabPluginProviderContext::Supabase {+ uid,+ collab_object,+ local_collab,+ local_collab_db,+ })+ .await;+ for plugin in plugins {+ collab.lock().add_plugin(plugin);+ }}},CollabPluginProviderType::Local => {},@@ -288,7 +314,12 @@ impl AppFlowyCollabBuilder {}}+ #[cfg(target_arch = "wasm32")]+ collab.lock().initialize().await;++ #[cfg(not(target_arch = "wasm32"))]collab.lock().initialize();+trace!("collab initialized: {}", object_id);Ok(collab)}diff --git a/frontend/rust-lib/dart-ffi/Cargo.toml b/frontend/rust-lib/dart-ffi/Cargo.tomlindex a80c536f63..bbd34cdf77 100644--- a/frontend/rust-lib/dart-ffi/Cargo.toml+++ b/frontend/rust-lib/dart-ffi/Cargo.toml@@ -35,6 +35,7 @@ flowy-server-pub = { workspace = true}collab-integrate = { workspace = true }flowy-derive.workspace = trueserde_yaml = "0.9.27"+flowy-error = { workspace = true, features = ["impl_from_sqlite", "impl_from_dispatch_error", "impl_from_appflowy_cloud", "impl_from_reqwest", "impl_from_serde"] }[features]default = ["dart", "rev-sqlite"]diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rsindex 9c056bd68f..4becb36241 100644--- a/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs+++ b/frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps.rs@@ -140,7 +140,7 @@ impl FolderOperationHandler for DocumentFolderOperation {let manager = self.0.clone();let view_id = view_id.to_string();FutureResult::new(async move {- match manager.delete_document(&view_id) {+ match manager.delete_document(&view_id).await {Ok(_) => tracing::trace!("Delete document: {}", view_id),Err(e) => tracing::error!("🔴delete document failed: {}", e),}diff --git a/frontend/rust-lib/flowy-database2/Cargo.toml b/frontend/rust-lib/flowy-database2/Cargo.tomlindex 79d52f224a..42216e725c 100644--- a/frontend/rust-lib/flowy-database2/Cargo.toml+++ b/frontend/rust-lib/flowy-database2/Cargo.toml@@ -9,6 +9,7 @@ edition = "2021"collab = { version = "0.1.0" }collab-database = { version = "0.1.0" }collab-entity = { version = "0.1.0" }+collab-plugins = { version = "0.1.0" }collab-integrate = { workspace = true }flowy-database-pub = { workspace = true }@@ -16,7 +17,7 @@ flowy-derive.workspace = trueflowy-notification = { workspace = true }parking_lot.workspace = trueprotobuf.workspace = true-flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_collab"]}+flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "impl_from_collab_database"]}lib-dispatch = { workspace = true }tokio = { workspace = true, features = ["sync"] }bytes.workspace = true@@ -54,4 +55,5 @@ flowy-codegen.workspace = true[features]dart = ["flowy-codegen/dart", "flowy-notification/dart"]-ts = ["flowy-codegen/ts", "flowy-notification/ts"]\ No newline at end of file+ts = ["flowy-codegen/ts", "flowy-notification/ts"]+wasm_build = ["collab-plugins/wasm_build"]\ No newline at end of filediff --git a/frontend/rust-lib/flowy-database2/src/manager.rs b/frontend/rust-lib/flowy-database2/src/manager.rsindex 4d44fbd88b..9884342994 100644--- a/frontend/rust-lib/flowy-database2/src/manager.rs+++ b/frontend/rust-lib/flowy-database2/src/manager.rs@@ -11,6 +11,7 @@ use collab_database::user::{};use collab_database::views::{CreateDatabaseParams, CreateViewParams, DatabaseLayout};use collab_entity::CollabType;+use collab_plugins::local_storage::kv::KVTransactionDB;use futures::executor::block_on;use lru::LruCache;use tokio::sync::{Mutex, RwLock};diff --git a/frontend/rust-lib/flowy-date/Cargo.toml b/frontend/rust-lib/flowy-date/Cargo.tomlindex 43149bacb5..526678099c 100644--- a/frontend/rust-lib/flowy-date/Cargo.toml+++ b/frontend/rust-lib/flowy-date/Cargo.toml@@ -4,6 +4,8 @@ version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]lib-dispatch = { path = "../lib-dispatch" }@@ -20,6 +22,7 @@ fancy-regex = { version = "0.11.0" }[features]dart = ["flowy-codegen/dart"]ts = ["flowy-codegen/ts"]+wasm_build = ["lib-dispatch/single_thread", "flowy-codegen/ts"][build-dependencies]flowy-codegen.workspace = truediff --git a/frontend/rust-lib/flowy-document/Cargo.toml b/frontend/rust-lib/flowy-document/Cargo.tomlindex 6a684ef9e0..09bb0dcb2e 100644--- a/frontend/rust-lib/flowy-document/Cargo.toml+++ b/frontend/rust-lib/flowy-document/Cargo.toml@@ -11,15 +11,16 @@ crate-type = ["cdylib", "rlib"]collab = { version = "0.1.0" }collab-document = { version = "0.1.0" }collab-entity = { version = "0.1.0" }+collab-plugins = { version = "0.1.0" }collab-integrate = { workspace = true }flowy-document-pub = { workspace = true }flowy-storage = { workspace = true }flowy-derive.workspace = trueflowy-notification = { workspace = true }-flowy-error = { path = "../flowy-error", features = ["impl_from_serde", "impl_from_sqlite", "impl_from_dispatch_error", "impl_from_collab"] }+flowy-error = { path = "../flowy-error", features = ["impl_from_serde", "impl_from_dispatch_error", "impl_from_collab_document"] }lib-dispatch = { workspace = true }lib-infra = { workspace = true }-validator = "0.16.0"+validator = { version = "0.16.0", features = ["derive"] }protobuf.workspace = truebytes.workspace = truenanoid = "0.4.0"@@ -51,4 +52,14 @@ flowy-codegen.workspace = true[features]dart = ["flowy-codegen/dart", "flowy-notification/dart"]ts = ["flowy-codegen/ts", "flowy-notification/ts"]+wasm_build = [+ "flowy-codegen/ts",+ "flowy-notification/ts",+ "collab-plugins/wasm_build",+ "collab/wasm_build",+ "lib-dispatch/wasm_build",+ "collab-document/wasm_build",+ "flowy-error/wasm_build",+ "flowy-notification/wasm_build"+]diff --git a/frontend/rust-lib/flowy-document/src/manager.rs b/frontend/rust-lib/flowy-document/src/manager.rsindex a94fdbdfad..e22debded2 100644--- a/frontend/rust-lib/flowy-document/src/manager.rs+++ b/frontend/rust-lib/flowy-document/src/manager.rs@@ -10,6 +10,7 @@ use collab_document::blocks::DocumentData;use collab_document::document::Document;use collab_document::document_data::default_document_data;use collab_entity::CollabType;+use collab_plugins::CollabKVDB;use flowy_storage::object_from_disk;use lru::LruCache;use parking_lot::Mutex;@@ -20,7 +21,7 @@ use tracing::warn;use tracing::{event, instrument};use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabBuilderConfig};-use collab_integrate::{CollabKVAction, CollabKVDB, CollabPersistenceConfig};+use collab_integrate::CollabPersistenceConfig;use flowy_document_pub::cloud::DocumentCloudService;use flowy_error::{internal_error, ErrorCode, FlowyError, FlowyResult};use flowy_storage::ObjectStorageService;@@ -108,7 +109,7 @@ impl DocumentManager {doc_id: &str,data: Option<DocumentData>,) -> FlowyResult<()> {- if self.is_doc_exist(doc_id).unwrap_or(false) {+ if self.is_doc_exist(doc_id).await.unwrap_or(false) {Err(FlowyError::new(ErrorCode::RecordAlreadyExists,format!("document {} already exists", doc_id),@@ -135,7 +136,7 @@ impl DocumentManager {}let mut doc_state = vec![];- if !self.is_doc_exist(doc_id)? {+ if !self.is_doc_exist(doc_id).await? {// Try to get the document from the cloud servicedoc_state = self.cloud_service@@ -167,7 +168,7 @@ impl DocumentManager {pub async fn get_document_data(&self, doc_id: &str) -> FlowyResult<DocumentData> {let mut updates = vec![];- if !self.is_doc_exist(doc_id)? {+ if !self.is_doc_exist(doc_id).await? {updates = self.cloud_service.get_document_doc_state(doc_id, &self.user_service.workspace_id()?)@@ -194,13 +195,10 @@ impl DocumentManager {Ok(())}- pub fn delete_document(&self, doc_id: &str) -> FlowyResult<()> {+ pub async fn delete_document(&self, doc_id: &str) -> FlowyResult<()> {let uid = self.user_service.user_id()?;if let Some(db) = self.user_service.collab_db(uid)?.upgrade() {- let _ = db.with_write_txn(|txn| {- txn.delete_doc(uid, &doc_id)?;- Ok(())- });+ db.delete_doc(uid, doc_id).await?;// When deleting a document, we need to remove it from the cache.self.documents.lock().pop(doc_id);@@ -271,28 +269,32 @@ impl DocumentManager {}pub async fn download_file(&self, local_file_path: String, url: String) -> FlowyResult<()> {- if tokio::fs::metadata(&local_file_path).await.is_ok() {- warn!("file already exist in user local disk: {}", local_file_path);- return Ok(());- }-- let storage_service = self.storage_service_upgrade()?;- let object_value = storage_service.get_object(url).await?;-- // create file if not exist- let mut file = tokio::fs::OpenOptions::new()- .create(true)- .write(true)- .open(&local_file_path)- .await?;+ // TODO(nathan): save file when the current target is wasm+ #[cfg(not(target_arch = "wasm32"))]+ {+ if tokio::fs::metadata(&local_file_path).await.is_ok() {+ warn!("file already exist in user local disk: {}", local_file_path);+ return Ok(());+ }- let n = file.write(&object_value.raw).await?;- info!("downloaded {} bytes to file: {}", n, local_file_path);+ let storage_service = self.storage_service_upgrade()?;+ let object_value = storage_service.get_object(url).await?;+ // create file if not exist+ let mut file = tokio::fs::OpenOptions::new()+ .create(true)+ .write(true)+ .open(&local_file_path)+ .await?;+ let n = file.write(&object_value.raw).await?;+ info!("downloaded {} bytes to file: {}", n, local_file_path);+ }Ok(())}pub async fn delete_file(&self, local_file_path: String, url: String) -> FlowyResult<()> {+ // TODO(nathan): delete file when the current target is wasm+ #[cfg(not(target_arch = "wasm32"))]// delete file from localtokio::fs::remove_file(local_file_path).await?;@@ -332,11 +334,11 @@ impl DocumentManager {Ok(collab)}- fn is_doc_exist(&self, doc_id: &str) -> FlowyResult<bool> {+ async fn is_doc_exist(&self, doc_id: &str) -> FlowyResult<bool> {let uid = self.user_service.user_id()?;if let Some(collab_db) = self.user_service.collab_db(uid)?.upgrade() {- let read_txn = collab_db.read_txn();- Ok(read_txn.is_exist(uid, doc_id))+ let is_exist = collab_db.is_exist(uid, doc_id).await?;+ Ok(is_exist)} else {Ok(false)}diff --git a/frontend/rust-lib/flowy-encrypt/Cargo.toml b/frontend/rust-lib/flowy-encrypt/Cargo.tomlindex 2041fccff1..b5cfd63eb6 100644--- a/frontend/rust-lib/flowy-encrypt/Cargo.toml+++ b/frontend/rust-lib/flowy-encrypt/Cargo.toml@@ -4,6 +4,8 @@ version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]aes-gcm = "0.10.2"@@ -12,4 +14,10 @@ pbkdf2 = "0.12.2"hmac = "0.12.1"sha2 = "0.10.7"anyhow.workspace = true-base64 = "0.21.2"\ No newline at end of file+base64 = "0.21.2"++[target.'cfg(target_arch = "wasm32")'.dependencies]+getrandom = { version = "0.2", features = ["js"]}++[features]+wasm_build = []diff --git a/frontend/rust-lib/flowy-error/Cargo.toml b/frontend/rust-lib/flowy-error/Cargo.tomlindex ae37cc6b3a..24aa8bc8c9 100644--- a/frontend/rust-lib/flowy-error/Cargo.toml+++ b/frontend/rust-lib/flowy-error/Cargo.toml@@ -4,6 +4,8 @@ version = "0.1.0"edition = "2018"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]flowy-derive.workspace = true@@ -28,18 +30,18 @@ url = { version = "2.2", optional = true }collab-database = { version = "0.1.0", optional = true }collab-document = { version = "0.1.0", optional = true }collab-plugins = { version = "0.1.0", optional = true }-tokio-postgres = { version = "0.7.8", optional = true }client-api = { version = "0.1.0", optional = true }[features]-default = ["impl_from_appflowy_cloud", "impl_from_collab", "impl_from_reqwest", "impl_from_serde"]impl_from_dispatch_error = ["lib-dispatch"]impl_from_serde = []impl_from_reqwest = ["reqwest"]-impl_from_sqlite = ["flowy-sqlite", "r2d2"]-impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest", "collab-plugins"]-impl_from_postgres = ["tokio-postgres"]+impl_from_collab_document = ["collab-document", "impl_from_reqwest", "collab-plugins"]+impl_from_collab_database= ["collab-database"]impl_from_url = ["url"]+wasm_build = ["lib-dispatch/wasm_build"]++impl_from_sqlite = ["flowy-sqlite", "r2d2"]impl_from_appflowy_cloud = ["client-api"]dart = ["flowy-codegen/dart"]ts = ["flowy-codegen/ts"]diff --git a/frontend/rust-lib/flowy-error/src/impl_from/collab.rs b/frontend/rust-lib/flowy-error/src/impl_from/collab.rsindex df71a6eb80..a29559429d 100644--- a/frontend/rust-lib/flowy-error/src/impl_from/collab.rs+++ b/frontend/rust-lib/flowy-error/src/impl_from/collab.rs@@ -1,25 +1,36 @@+#[cfg(feature = "impl_from_collab_database")]use collab_database::error::DatabaseError;++#[cfg(feature = "impl_from_collab_document")]use collab_document::error::DocumentError;++#[cfg(feature = "impl_from_collab_document")]use collab_plugins::local_storage::kv::PersistenceError;use crate::{ErrorCode, FlowyError};+#[cfg(feature = "impl_from_collab_document")]impl From<PersistenceError> for FlowyError {fn from(err: PersistenceError) -> Self {match err {PersistenceError::UnexpectedEmptyUpdates => FlowyError::new(ErrorCode::RecordNotFound, err),+ #[cfg(not(target_arch = "wasm32"))]PersistenceError::RocksdbCorruption(_) => FlowyError::new(ErrorCode::RocksdbCorruption, err),+ #[cfg(not(target_arch = "wasm32"))]PersistenceError::RocksdbIOError(_) => FlowyError::new(ErrorCode::RocksdbIOError, err),_ => FlowyError::new(ErrorCode::RocksdbInternal, err),}}}++#[cfg(feature = "impl_from_collab_database")]impl From<DatabaseError> for FlowyError {fn from(error: DatabaseError) -> Self {FlowyError::internal().with_context(error)}}+#[cfg(feature = "impl_from_collab_document")]impl From<DocumentError> for FlowyError {fn from(error: DocumentError) -> Self {FlowyError::internal().with_context(error)diff --git a/frontend/rust-lib/flowy-error/src/impl_from/mod.rs b/frontend/rust-lib/flowy-error/src/impl_from/mod.rsindex 56370c04be..6fdccdb937 100644--- a/frontend/rust-lib/flowy-error/src/impl_from/mod.rs+++ b/frontend/rust-lib/flowy-error/src/impl_from/mod.rs@@ -13,12 +13,9 @@ pub mod reqwest;#[cfg(feature = "impl_from_sqlite")]pub mod database;-#[cfg(feature = "impl_from_collab")]+#[cfg(feature = "impl_from_collab_document")]pub mod collab;-#[cfg(feature = "impl_from_postgres")]-mod postgres;-#[cfg(feature = "impl_from_appflowy_cloud")]mod cloud;#[cfg(feature = "impl_from_url")]diff --git a/frontend/rust-lib/flowy-error/src/impl_from/postgres.rs b/frontend/rust-lib/flowy-error/src/impl_from/postgres.rsdeleted file mode 100644index c5a79510dd..0000000000--- a/frontend/rust-lib/flowy-error/src/impl_from/postgres.rs+++ /dev/null@@ -1,7 +0,0 @@-use crate::FlowyError;--impl std::convert::From<tokio_postgres::Error> for FlowyError {- fn from(error: tokio_postgres::Error) -> Self {- FlowyError::internal().with_context(error)- }-}diff --git a/frontend/rust-lib/flowy-folder/Cargo.toml b/frontend/rust-lib/flowy-folder/Cargo.tomlindex 73df96f37c..93df78002c 100644--- a/frontend/rust-lib/flowy-folder/Cargo.toml+++ b/frontend/rust-lib/flowy-folder/Cargo.toml@@ -9,6 +9,7 @@ edition = "2021"collab = { version = "0.1.0" }collab-folder = { version = "0.1.0" }collab-entity = { version = "0.1.0" }+collab-plugins = { version = "0.1.0" }collab-integrate = { workspace = true }flowy-folder-pub = { workspace = true }@@ -38,4 +39,5 @@ flowy-codegen.workspace = true[features]dart = ["flowy-codegen/dart", "flowy-notification/dart"]ts = ["flowy-codegen/ts", "flowy-notification/ts"]-test_helper = []\ No newline at end of file+test_helper = []+wasm_build = ["collab-plugins/wasm_build"]diff --git a/frontend/rust-lib/flowy-folder/src/util.rs b/frontend/rust-lib/flowy-folder/src/util.rsindex 1a980bb83c..f056cfd90e 100644--- a/frontend/rust-lib/flowy-folder/src/util.rs+++ b/frontend/rust-lib/flowy-folder/src/util.rs@@ -1,10 +1,10 @@use collab_folder::Folder;-use std::sync::Arc;-use tracing::{event, instrument};-use collab_integrate::CollabKVAction;+use collab_plugins::local_storage::kv::KVTransactionDB;use flowy_error::{ErrorCode, FlowyError, FlowyResult};use flowy_folder_pub::folder_builder::ParentChildViews;+use std::sync::Arc;+use tracing::{event, instrument};use crate::entities::UserFolderPB;use crate::manager::FolderUser;diff --git a/frontend/rust-lib/flowy-notification/Cargo.toml b/frontend/rust-lib/flowy-notification/Cargo.tomlindex 18f9dd283e..5a721eb5ba 100644--- a/frontend/rust-lib/flowy-notification/Cargo.toml+++ b/frontend/rust-lib/flowy-notification/Cargo.toml@@ -4,13 +4,15 @@ version = "0.1.0"edition = "2018"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]lazy_static = { version = "1.4.0" }protobuf.workspace = truetracing.workspace = truebytes.workspace = true-serde.workspace = true+serde = { workspace = true, features = ["derive"] }flowy-derive.workspace = truelib-dispatch = { workspace = true }@@ -21,3 +23,4 @@ flowy-codegen.workspace = true[features]dart = ["flowy-codegen/dart"]ts = ["flowy-codegen/ts"]+wasm_build = ["lib-dispatch/wasm_build", "flowy-codegen/ts"]\ No newline at end of filediff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.tomlindex c9bbb84e68..bb887080c6 100644--- a/frontend/rust-lib/flowy-server/Cargo.toml+++ b/frontend/rust-lib/flowy-server/Cargo.toml@@ -33,7 +33,7 @@ flowy-user-pub = { workspace = true }flowy-folder-pub = { workspace = true }flowy-database-pub = { workspace = true }flowy-document-pub = { workspace = true }-flowy-error = { workspace = true, features = ["impl_from_postgres", "impl_from_serde", "impl_from_reqwest", "impl_from_url", "impl_from_appflowy_cloud"] }+flowy-error = { workspace = true, features = ["impl_from_serde", "impl_from_reqwest", "impl_from_url", "impl_from_appflowy_cloud"] }flowy-server-pub = { workspace = true }flowy-encrypt = { workspace = true }flowy-storage = { workspace = true }diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs b/frontend/rust-lib/flowy-server/src/af_cloud/server.rsindex 55e6689809..f7eeaa8789 100644--- a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs+++ b/frontend/rust-lib/flowy-server/src/af_cloud/server.rs@@ -5,10 +5,10 @@ use anyhow::Error;use client_api::collab_sync::collab_msg::CollabMessage;use client_api::entity::UserMessage;use client_api::notify::{TokenState, TokenStateReceiver};-use client_api::ws::{+use client_api::{Client, ClientConfiguration};+use client_api::{ConnectState, WSClient, WSClientConfig, WSConnectStateReceiver, WebSocketChannel,};-use client_api::{Client, ClientConfiguration};use flowy_storage::ObjectStorageService;use tokio::sync::watch;use tokio_stream::wrappers::WatchStream;diff --git a/frontend/rust-lib/flowy-server/src/server.rs b/frontend/rust-lib/flowy-server/src/server.rsindex b2a3698650..245006c718 100644--- a/frontend/rust-lib/flowy-server/src/server.rs+++ b/frontend/rust-lib/flowy-server/src/server.rs@@ -3,7 +3,7 @@ use std::sync::Arc;use anyhow::Error;use client_api::collab_sync::collab_msg::CollabMessage;-use client_api::ws::{ConnectState, WSConnectStateReceiver, WebSocketChannel};+use client_api::{ConnectState, WSConnectStateReceiver, WebSocketChannel};use collab_entity::CollabObject;use collab_plugins::cloud_storage::RemoteCollabStorage;use parking_lot::RwLock;diff --git a/frontend/rust-lib/flowy-storage/Cargo.toml b/frontend/rust-lib/flowy-storage/Cargo.tomlindex db3f0a330c..552340cf78 100644--- a/frontend/rust-lib/flowy-storage/Cargo.toml+++ b/frontend/rust-lib/flowy-storage/Cargo.toml@@ -4,6 +4,8 @@ version = "0.1.0"edition = "2021"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]reqwest = { version = "0.11", features = ["json", "stream"] }@@ -16,6 +18,10 @@ lib-infra = { workspace = true }url = "2.2.2"flowy-error = { workspace = true, features = ["impl_from_reqwest"] }mime = "0.3.17"-tokio.workspace = true+tokio = { workspace = true, features = ["sync", "io-util"]}tracing.workspace = truefxhash = "0.2.1"+++[features]+wasm_build = ["lib-infra/wasm_build", "flowy-error/wasm_build"]\ No newline at end of filediff --git a/frontend/rust-lib/flowy-storage/src/lib.rs b/frontend/rust-lib/flowy-storage/src/lib.rsindex 448cedbbcb..018b9c1d54 100644--- a/frontend/rust-lib/flowy-storage/src/lib.rs+++ b/frontend/rust-lib/flowy-storage/src/lib.rs@@ -20,6 +20,15 @@ pub struct ObjectValue {pub mime: Mime,}+#[cfg(target_arch = "wasm32")]+pub async fn object_from_disk(+ workspace_id: &str,+ local_file_path: &str,+) -> Result<(ObjectIdentity, ObjectValue), FlowyError> {+ todo!("object_from_disk is not implemented for wasm32")+}++#[cfg(not(target_arch = "wasm32"))]pub async fn object_from_disk(workspace_id: &str,local_file_path: &str,diff --git a/frontend/rust-lib/flowy-user/Cargo.toml b/frontend/rust-lib/flowy-user/Cargo.tomlindex 1a57f2aad6..7b92151837 100644--- a/frontend/rust-lib/flowy-user/Cargo.toml+++ b/frontend/rust-lib/flowy-user/Cargo.toml@@ -9,7 +9,7 @@ edition = "2018"flowy-derive.workspace = trueflowy-sqlite = { workspace = true, optional = true }flowy-encrypt = { workspace = true }-flowy-error = { workspace = true, features = ["impl_from_sqlite", "impl_from_dispatch_error"] }+flowy-error = { workspace = true, features = ["impl_from_dispatch_error"] }flowy-folder-pub = { workspace = true }lib-infra = { workspace = true }flowy-notification = { workspace = true }@@ -22,6 +22,7 @@ collab-document = { version = "0.1.0" }collab-database = { version = "0.1.0" }collab-user = { version = "0.1.0" }collab-entity = { version = "0.1.0" }+collab-plugins = { version = "0.1.0" }flowy-user-pub = { workspace = true }anyhow.workspace = truetracing.workspace = truediff --git a/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs b/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rsindex 6d39cbe262..d74046fc61 100644--- a/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs+++ b/frontend/rust-lib/flowy-user/src/anon_user/migrate_anon_user_collab.rs@@ -12,6 +12,7 @@ use collab_database::database::{use collab_database::rows::{database_row_document_id_from_row_id, mut_row_with_collab, RowId};use collab_database::user::DatabaseViewTrackerList;use collab_folder::{Folder, UserId};+use collab_plugins::local_storage::kv::KVTransactionDB;use parking_lot::{Mutex, RwLock};use tracing::info;diff --git a/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs b/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rsindex 6fa3cd5b93..8629cf868c 100644--- a/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs+++ b/frontend/rust-lib/flowy-user/src/anon_user/sync_supabase_user_collab.rs@@ -11,6 +11,7 @@ use collab_database::rows::database_row_document_id_from_row_id;use collab_database::user::{get_all_database_view_trackers, DatabaseViewTracker};use collab_entity::{CollabObject, CollabType};use collab_folder::{Folder, View, ViewLayout};+use collab_plugins::local_storage::kv::KVTransactionDB;use parking_lot::Mutex;use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};diff --git a/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rs b/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rsindex 0b68b32eed..78a6dc6673 100644--- a/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rs+++ b/frontend/rust-lib/flowy-user/src/migrations/document_empty_content.rs@@ -5,6 +5,7 @@ use collab::core::origin::{CollabClient, CollabOrigin};use collab_document::document::Document;use collab_document::document_data::default_document_data;use collab_folder::{Folder, View};+use collab_plugins::local_storage::kv::KVTransactionDB;use tracing::{event, instrument};use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};diff --git a/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rs b/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rsindex 8c8c4273c6..dec5dcbeef 100644--- a/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rs+++ b/frontend/rust-lib/flowy-user/src/migrations/workspace_and_favorite_v1.rs@@ -1,6 +1,7 @@use std::sync::Arc;use collab_folder::Folder;+use collab_plugins::local_storage::kv::KVTransactionDB;use tracing::instrument;use collab_integrate::{CollabKVAction, CollabKVDB};diff --git a/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rs b/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rsindex ff7563c1fe..798a8bc1cf 100644--- a/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rs+++ b/frontend/rust-lib/flowy-user/src/migrations/workspace_trash_v1.rs@@ -1,6 +1,7 @@use std::sync::Arc;use collab_folder::Folder;+use collab_plugins::local_storage::kv::KVTransactionDB;use tracing::instrument;use collab_integrate::{CollabKVAction, CollabKVDB};diff --git a/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs b/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rsindex 6d1389b33e..67d4d08e8e 100644--- a/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs+++ b/frontend/rust-lib/flowy-user/src/services/data_import/appflowy_data_import.rs@@ -20,6 +20,7 @@ use collab_document::document_data::default_document_collab_data;use collab_entity::CollabType;use collab_folder::{Folder, UserId, View, ViewIdentifier, ViewLayout};use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};+use collab_plugins::local_storage::kv::KVTransactionDB;use flowy_error::FlowyError;use flowy_folder_pub::cloud::gen_view_id;use flowy_folder_pub::entities::{AppFlowyData, ImportData};diff --git a/frontend/rust-lib/flowy-user/src/services/db.rs b/frontend/rust-lib/flowy-user/src/services/db.rsindex a041a8d927..853365c04a 100644--- a/frontend/rust-lib/flowy-user/src/services/db.rs+++ b/frontend/rust-lib/flowy-user/src/services/db.rs@@ -2,10 +2,8 @@ use std::path::{Path, PathBuf};use std::{collections::HashMap, fs, io, sync::Arc, time::Duration};use chrono::Local;-use parking_lot::RwLock;-use tracing::{error, event, info, instrument};-use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};+use collab_plugins::local_storage::kv::KVTransactionDB;use flowy_error::FlowyError;use flowy_sqlite::schema::user_workspace_table;use flowy_sqlite::ConnectionPool;@@ -17,6 +15,8 @@ use flowy_sqlite::{use flowy_user_pub::entities::{UserProfile, UserWorkspace};use lib_dispatch::prelude::af_spawn;use lib_infra::file_util::{unzip_and_replace, zip_folder};+use parking_lot::RwLock;+use tracing::{error, event, info, instrument};use crate::services::sqlite_sql::user_sql::UserTable;use crate::services::sqlite_sql::workspace_sql::UserWorkspaceTable;diff --git a/frontend/rust-lib/lib-dispatch/Cargo.toml b/frontend/rust-lib/lib-dispatch/Cargo.tomlindex cf633bafd7..93258501f7 100644--- a/frontend/rust-lib/lib-dispatch/Cargo.toml+++ b/frontend/rust-lib/lib-dispatch/Cargo.toml@@ -4,6 +4,8 @@ version = "0.1.0"edition = "2018"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html+[lib]+crate-type = ["cdylib", "rlib"][dependencies]pin-project = "1.0"@@ -42,7 +44,6 @@ default = ["use_protobuf"]use_serde = ["bincode", "serde_json", "serde", "serde_repr"]use_protobuf= ["protobuf"]single_thread = []+wasm_build = ["single_thread"]-[lib]-crate-type = ["cdylib", "rlib"]diff --git a/frontend/rust-lib/lib-infra/Cargo.toml b/frontend/rust-lib/lib-infra/Cargo.tomlindex 30e8390976..037d8dec6a 100644--- a/frontend/rust-lib/lib-infra/Cargo.toml+++ b/frontend/rust-lib/lib-infra/Cargo.toml@@ -12,7 +12,7 @@ chrono = { workspace = true, default-features = false, features = ["clock"] }bytes = { version = "1.5" }pin-project = "1.1.3"futures-core = { version = "0.3" }-tokio = { workspace = true, features = ["time", "rt"] }+tokio = { workspace = true, features = ["sync", "time", "rt"] }async-trait.workspace = truemd5 = "0.7.0"anyhow.workspace = true@@ -32,3 +32,4 @@ brotli = { version = "3.4.0", optional = true }[features]compression = ["brotli"]+wasm_build = []\ No newline at end of filediff --git a/frontend/rust-lib/lib-infra/src/util.rs b/frontend/rust-lib/lib-infra/src/util.rsindex cb6cf8a7d6..80cdc89fe5 100644--- a/frontend/rust-lib/lib-infra/src/util.rs+++ b/frontend/rust-lib/lib-infra/src/util.rs@@ -1,3 +1,19 @@+#[macro_export]+macro_rules! if_native {+ ($($item:item)*) => {$(+ #[cfg(not(target_arch = "wasm32"))]+ $item+ )*}+}++#[macro_export]+macro_rules! if_wasm {+ ($($item:item)*) => {$(+ #[cfg(target_arch = "wasm32")]+ $item+ )*}+}+pub fn move_vec_element<T, F>(vec: &mut Vec<T>,filter: F,diff --git a/frontend/scripts/makefile/web.toml b/frontend/scripts/makefile/web.tomlnew file mode 100644index 0000000000..e1cf6678c5--- /dev/null+++ b/frontend/scripts/makefile/web.toml@@ -0,0 +1,19 @@++[tasks.wasm_build]+script_runner = "bash"+script = [+ """+ #!/bin/bash+ BASE_DIR=$(pwd)+# crates=("lib-dispatch" "flowy-encrypt" "lib-infra" "flowy-notification" "flowy-date" "flowy-error" "collab-integrate" "flowy-document")+ crates=("flowy-document")++ # Iterate over each crate and build it+ for crate in "${crates[@]}"; do+ echo "🔥🔥🔥 Building $crate with wasm-pack..."+ cd "$BASE_DIR/rust-lib/$crate" || { echo "Failed to enter directory $crate"; exit 1; }++ wasm-pack build --features="wasm_build" || { echo "Build failed for $crate"; exit 1; }+ done+ """+]