Skip to content

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.

feat: create the default workspace on cloud when using appflowy cloud (#4040)

Nathan.fooo8036d070adde
diff --git a/frontend/appflowy_flutter/integration_test/auth/appflowy_cloud_auth_test.dart b/frontend/appflowy_flutter/integration_test/auth/appflowy_cloud_auth_test.dart
index 83ddefe5b4..becfa6a67e 100644
--- a/frontend/appflowy_flutter/integration_test/auth/appflowy_cloud_auth_test.dart
+++ b/frontend/appflowy_flutter/integration_test/auth/appflowy_cloud_auth_test.dart
@@ -2,10 +2,14 @@
import 'package:appflowy/env/cloud_env.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:appflowy/startup/startup.dart';
+import 'package:appflowy/user/application/auth/af_cloud_mock_auth_service.dart';
+import 'package:appflowy/user/application/auth/auth_service.dart';
import 'package:appflowy/workspace/application/settings/prelude.dart';
import 'package:appflowy/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart';
import 'package:appflowy/workspace/presentation/settings/widgets/settings_user_view.dart';
import 'package:easy_localization/easy_localization.dart';
+import 'package:flowy_infra/uuid.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:path/path.dart' as p;
import 'package:integration_test/integration_test.dart';
@@ -24,66 +28,72 @@ void main() {
tester.expectToSeeHomePage();
});
- // testWidgets('sign out', (tester) async {
- // await tester.initializeAppFlowy(
- // cloudType: AuthenticatorType.appflowyCloud,
- // );
- // await tester.tapGoogleLoginInButton();
+ testWidgets('sign out', (tester) async {
+ await tester.initializeAppFlowy(
+ cloudType: AuthenticatorType.appflowyCloud,
+ );
+ await tester.tapGoogleLoginInButton();
- // // Open the setting page and sign out
- // await tester.openSettings();
- // await tester.openSettingsPage(SettingsPage.user);
- // await tester.tapButton(find.byType(SettingLogoutButton));
+ // Open the setting page and sign out
+ await tester.openSettings();
+ await tester.openSettingsPage(SettingsPage.user);
+ await tester.tapButton(find.byType(SettingLogoutButton));
- // tester.expectToSeeText(LocaleKeys.button_ok.tr());
- // await tester.tapButtonWithName(LocaleKeys.button_ok.tr());
+ tester.expectToSeeText(LocaleKeys.button_ok.tr());
+ await tester.tapButtonWithName(LocaleKeys.button_ok.tr());
- // // Go to the sign in page again
- // await tester.pumpAndSettle(const Duration(seconds: 1));
- // tester.expectToSeeGoogleLoginButton();
- // });
+ // Go to the sign in page again
+ await tester.pumpAndSettle(const Duration(seconds: 1));
+ tester.expectToSeeGoogleLoginButton();
+ });
- // testWidgets('sign in as annoymous', (tester) async {
- // await tester.initializeAppFlowy(
- // cloudType: AuthenticatorType.appflowyCloud,
- // );
- // await tester.tapSignInAsGuest();
+ testWidgets('sign in as annoymous', (tester) async {
+ await tester.initializeAppFlowy(
+ cloudType: AuthenticatorType.appflowyCloud,
+ );
+ await tester.tapSignInAsGuest();
- // // should not see the sync setting page when sign in as annoymous
- // await tester.openSettings();
- // await tester.openSettingsPage(SettingsPage.user);
- // tester.expectToSeeGoogleLoginButton();
- // });
+ // should not see the sync setting page when sign in as annoymous
+ await tester.openSettings();
+ await tester.openSettingsPage(SettingsPage.user);
+ tester.expectToSeeGoogleLoginButton();
+ });
- // testWidgets('enable sync', (tester) async {
- // await tester.initializeAppFlowy(
- // cloudType: AuthenticatorType.appflowyCloud,
- // );
- // await tester.tapGoogleLoginInButton();
+ testWidgets('enable sync', (tester) async {
+ await tester.initializeAppFlowy(
+ cloudType: AuthenticatorType.appflowyCloud,
+ );
- // // Open the setting page and sign out
- // await tester.openSettings();
- // await tester.openSettingsPage(SettingsPage.cloud);
+ await tester.tapGoogleLoginInButton();
+ // Open the setting page and sign out
+ await tester.openSettings();
+ await tester.openSettingsPage(SettingsPage.cloud);
- // // the switch should be on by default
- // tester.assertAppFlowyCloudEnableSyncSwitchValue(true);
- // await tester.toggleEnableSync(AppFlowyCloudEnableSync);
+ // the switch should be on by default
+ tester.assertAppFlowyCloudEnableSyncSwitchValue(true);
+ await tester.toggleEnableSync(AppFlowyCloudEnableSync);
- // // the switch should be off
- // tester.assertAppFlowyCloudEnableSyncSwitchValue(false);
+ // the switch should be off
+ tester.assertAppFlowyCloudEnableSyncSwitchValue(false);
- // // the switch should be on after toggling
- // await tester.toggleEnableSync(AppFlowyCloudEnableSync);
- // tester.assertAppFlowyCloudEnableSyncSwitchValue(true);
- // });
+ // the switch should be on after toggling
+ await tester.toggleEnableSync(AppFlowyCloudEnableSync);
+ tester.assertAppFlowyCloudEnableSyncSwitchValue(true);
+ });
// testWidgets('custom folder sign in', (tester) async {
// const userA = 'UserA';
+ // final userAEmail = "${uuid()}@appflowy.io";
// final initialPath = p.join(userA, appFlowyDataFolder);
// final context = await tester.initializeAppFlowy(
// cloudType: AuthenticatorType.appflowyCloud,
// pathExtension: initialPath,
// );
+ // getIt.registerFactory<AuthService>(
+ // () => AppFlowyCloudMockAuthService(
+ // email: userAEmail,
+ // ),
+ // );
// // remove the last extension
// final rootPath = context.applicationDataDirectory.replaceFirst(
// initialPath,
diff --git a/frontend/appflowy_flutter/integration_test/util/base.dart b/frontend/appflowy_flutter/integration_test/util/base.dart
index c2b92781b9..eddc3e445c 100644
--- a/frontend/appflowy_flutter/integration_test/util/base.dart
+++ b/frontend/appflowy_flutter/integration_test/util/base.dart
@@ -5,6 +5,9 @@ import 'package:appflowy/env/cloud_env.dart';
import 'package:appflowy/env/cloud_env_test.dart';
import 'package:appflowy/startup/entry_point.dart';
import 'package:appflowy/startup/startup.dart';
+import 'package:appflowy/user/application/auth/af_cloud_mock_auth_service.dart';
+import 'package:appflowy/user/application/auth/auth_service.dart';
+import 'package:appflowy/user/application/auth/supabase_mock_auth_service.dart';
import 'package:appflowy/user/presentation/presentation.dart';
import 'package:appflowy/user/presentation/screens/sign_in_screen/widgets/widgets.dart';
import 'package:appflowy/workspace/application/settings/prelude.dart';
@@ -32,6 +35,7 @@ extension AppFlowyTestBase on WidgetTester {
String? pathExtension,
Size windowsSize = const Size(1600, 1200),
AuthenticatorType? cloudType,
+ String? userEmail,
}) async {
binding.setSurfaceSize(windowsSize);
@@ -61,22 +65,32 @@ extension AppFlowyTestBase on WidgetTester {
}
return rustEnvs;
},
- didInitGetItCallback: Future(
- () async {
- if (cloudType != null) {
- switch (cloudType) {
- case AuthenticatorType.local:
- break;
- case AuthenticatorType.supabase:
- await useSupabaseCloud();
- break;
- case AuthenticatorType.appflowyCloud:
- await useAppFlowyCloud();
- break;
+ didInitGetItCallback: () {
+ return Future(
+ () async {
+ if (cloudType != null) {
+ switch (cloudType) {
+ case AuthenticatorType.local:
+ break;
+ case AuthenticatorType.supabase:
+ await useSupabaseCloud();
+ getIt.unregister<AuthService>();
+ getIt.registerFactory<AuthService>(
+ () => SupabaseMockAuthService(),
+ );
+ break;
+ case AuthenticatorType.appflowyCloud:
+ await useAppFlowyCloud();
+ getIt.unregister<AuthService>();
+ getIt.registerFactory<AuthService>(
+ () => AppFlowyCloudMockAuthService(email: userEmail),
+ );
+ break;
+ }
}
- }
- },
- ),
+ },
+ );
+ },
);
await waitUntilSignInPageShow();
return FlowyTestContext(
diff --git a/frontend/appflowy_flutter/ios/Podfile.lock b/frontend/appflowy_flutter/ios/Podfile.lock
index 0e508e8ca0..9c90ae776c 100644
--- a/frontend/appflowy_flutter/ios/Podfile.lock
+++ b/frontend/appflowy_flutter/ios/Podfile.lock
@@ -202,4 +202,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 8c681999c7764593c94846b2a64b44d86f7a27ac
-COCOAPODS: 1.12.1
+COCOAPODS: 1.11.3
diff --git a/frontend/appflowy_flutter/lib/startup/deps_resolver.dart b/frontend/appflowy_flutter/lib/startup/deps_resolver.dart
index a24999ee23..877599e7ea 100644
--- a/frontend/appflowy_flutter/lib/startup/deps_resolver.dart
+++ b/frontend/appflowy_flutter/lib/startup/deps_resolver.dart
@@ -9,10 +9,8 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/stability_
import 'package:appflowy/plugins/trash/application/prelude.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/user/application/auth/af_cloud_auth_service.dart';
-import 'package:appflowy/user/application/auth/af_cloud_mock_auth_service.dart';
import 'package:appflowy/user/application/auth/auth_service.dart';
import 'package:appflowy/user/application/auth/supabase_auth_service.dart';
-import 'package:appflowy/user/application/auth/supabase_mock_auth_service.dart';
import 'package:appflowy/user/application/prelude.dart';
import 'package:appflowy/user/application/reminder/reminder_bloc.dart';
import 'package:appflowy/user/application/user_listener.dart';
@@ -52,7 +50,6 @@ class DependencyResolver {
_resolveHomeDeps(getIt);
_resolveFolderDeps(getIt);
_resolveDocDeps(getIt);
- // _resolveGridDeps(getIt);
_resolveCommonService(getIt, mode);
}
}
@@ -131,19 +128,10 @@ void _resolveUserDeps(GetIt getIt, IntegrationMode mode) {
);
break;
case AuthenticatorType.supabase:
- if (mode.isIntegrationTest) {
- getIt.registerFactory<AuthService>(() => SupabaseMockAuthService());
- } else {
- getIt.registerFactory<AuthService>(() => SupabaseAuthService());
- }
+ getIt.registerFactory<AuthService>(() => SupabaseAuthService());
break;
case AuthenticatorType.appflowyCloud:
- if (mode.isIntegrationTest) {
- getIt
- .registerFactory<AuthService>(() => AppFlowyCloudMockAuthService());
- } else {
- getIt.registerFactory<AuthService>(() => AppFlowyCloudAuthService());
- }
+ getIt.registerFactory<AuthService>(() => AppFlowyCloudAuthService());
break;
}
diff --git a/frontend/appflowy_flutter/lib/startup/startup.dart b/frontend/appflowy_flutter/lib/startup/startup.dart
index 38f9407465..97d306fdc4 100644
--- a/frontend/appflowy_flutter/lib/startup/startup.dart
+++ b/frontend/appflowy_flutter/lib/startup/startup.dart
@@ -45,7 +45,7 @@ class FlowyRunner {
// which is used for dependency injection throughout the app.
// If your functionality depends on 'getIt', ensure to register
// your callback here to execute any necessary actions post-initialization.
- Future? didInitGetItCallback,
+ Future Function()? didInitGetItCallback,
// Passing the envs to the backend
Map<String, String> Function()? rustEnvsBuilder,
// Indicate whether the app is running in anonymous mode.
@@ -64,7 +64,7 @@ class FlowyRunner {
// Specify the env
await initGetIt(getIt, mode, f, config);
- await didInitGetItCallback;
+ await didInitGetItCallback?.call();
final applicationDataDirectory =
await getIt<ApplicationDataStorage>().getPath().then(
diff --git a/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart b/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
index cd608ae826..8e860e2ed6 100644
--- a/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
+++ b/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
@@ -12,14 +12,10 @@ import 'package:flowy_infra/uuid.dart';
/// Only used for testing.
class AppFlowyCloudMockAuthService implements AuthService {
- // Use same email for all tests.
- static String currentUserEmail = "";
+ final String userEmail;
- AppFlowyCloudMockAuthService() {
- if (currentUserEmail.isEmpty) {
- currentUserEmail = "${uuid()}@appflowy.io";
- }
- }
+ AppFlowyCloudMockAuthService({String? email})
+ : userEmail = email ?? "${uuid()}@appflowy.io";
final BackendAuthService _appFlowyAuthService =
BackendAuthService(AuthTypePB.Supabase);
@@ -51,7 +47,7 @@ class AppFlowyCloudMockAuthService implements AuthService {
final payload = SignInUrlPayloadPB.create()
..authType = AuthTypePB.AFCloud
// don't use nanoid here, the gotrue server will transform the email
- ..email = currentUserEmail;
+ ..email = userEmail;
final deviceId = await getDeviceId();
final getSignInURLResult = await UserEventGenerateSignInURL(payload).send();
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock
index 0ca4e554ee..10688c50ae 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock
@@ -65,14 +65,15 @@ dependencies = [
[[package]]
name = "ahash"
-version = "0.8.3"
+version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
+checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
dependencies = [
"cfg-if",
"getrandom 0.2.10",
"once_cell",
"version_check",
+ "zerocopy",
]
[[package]]
@@ -138,7 +139,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"reqwest",
@@ -230,7 +231,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -241,7 +242,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -403,7 +404,7 @@ dependencies = [
"regex",
"rustc-hash",
"shlex",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -785,7 +786,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -818,6 +819,7 @@ dependencies = [
"tracing",
"url",
"uuid",
+ "workspace-template",
"yrs",
]
@@ -880,7 +882,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -900,7 +902,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -930,7 +932,7 @@ dependencies = [
[[package]]
name = "collab-derive"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"proc-macro2",
"quote",
@@ -942,7 +944,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"collab",
@@ -962,7 +964,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"bytes",
@@ -976,7 +978,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"chrono",
@@ -1018,7 +1020,7 @@ dependencies = [
[[package]]
name = "collab-persistence"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -1040,7 +1042,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -1067,7 +1069,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"collab",
@@ -1326,7 +1328,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa 1.0.6",
- "phf 0.8.0",
+ "phf 0.11.2",
"smallvec",
]
@@ -1337,7 +1339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -1425,7 +1427,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -1447,7 +1449,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a"
dependencies = [
"darling_core 0.20.1",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -1472,7 +1474,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -2028,7 +2030,7 @@ dependencies = [
"flowy-notification",
"flowy-task",
"futures",
- "indexmap 1.9.3",
+ "indexmap 2.1.0",
"lazy_static",
"lib-dispatch",
"lib-infra",
@@ -2108,7 +2110,7 @@ dependencies = [
"flowy-notification",
"flowy-storage",
"futures",
- "indexmap 1.9.3",
+ "indexmap 2.1.0",
"lib-dispatch",
"lib-infra",
"lru",
@@ -2199,6 +2201,7 @@ dependencies = [
"nanoid",
"parking_lot",
"protobuf",
+ "serde_json",
"strum_macros 0.21.1",
"tokio",
"tokio-stream",
@@ -2495,7 +2498,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -2830,7 +2833,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"futures-util",
@@ -2846,7 +2849,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -2942,11 +2945,11 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.14.0"
+version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"allocator-api2",
]
@@ -2956,7 +2959,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
dependencies = [
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
]
[[package]]
@@ -3247,12 +3250,13 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "2.0.0"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
+checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"equivalent",
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
+ "serde",
]
[[package]]
@@ -3267,7 +3271,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"reqwest",
@@ -3639,7 +3643,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efa59af2ddfad1854ae27d75009d538d0998b4b2fd47083e743ac1a10e46c60"
dependencies = [
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
]
[[package]]
@@ -4101,7 +4105,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -4311,7 +4315,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -4332,7 +4336,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
dependencies = [
"fixedbitset",
- "indexmap 2.0.0",
+ "indexmap 2.1.0",
]
[[package]]
@@ -4363,6 +4367,7 @@ 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",
]
@@ -4454,6 +4459,19 @@ 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.32",
+]
+
[[package]]
name = "phf_shared"
version = "0.8.0"
@@ -4499,7 +4517,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -4616,7 +4634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282"
dependencies = [
"proc-macro2",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -4695,7 +4713,7 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
dependencies = [
"bytes",
"heck 0.4.1",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"log",
"multimap",
"once_cell",
@@ -4704,7 +4722,7 @@ dependencies = [
"prost",
"prost-types",
"regex",
- "syn 2.0.29",
+ "syn 2.0.32",
"tempfile",
"which",
]
@@ -4716,10 +4734,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
dependencies = [
"anyhow",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -5011,7 +5029,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"bincode",
@@ -5467,7 +5485,7 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c95a930e03325234c18c7071fd2b60118307e025d6fff3e12745ffbf63a3d29c"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"cssparser 0.31.2",
"ego-tree",
"getopts",
@@ -5484,7 +5502,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"cssparser 0.31.2",
"ego-tree",
"getopts",
@@ -5609,7 +5627,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -5631,7 +5649,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -5680,7 +5698,7 @@ dependencies = [
"darling 0.20.1",
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -5764,7 +5782,7 @@ dependencies = [
[[package]]
name = "shared_entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -5964,7 +5982,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"atoi",
"byteorder",
"bytes",
@@ -5980,7 +5998,7 @@ dependencies = [
"futures-util",
"hashlink",
"hex",
- "indexmap 2.0.0",
+ "indexmap 2.1.0",
"log",
"memchr",
"once_cell",
@@ -6121,7 +6139,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -6143,9 +6161,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.29"
+version = "2.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
+checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2"
dependencies = [
"proc-macro2",
"quote",
@@ -6523,7 +6541,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -6615,7 +6633,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -6749,7 +6767,7 @@ version = "0.19.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7"
dependencies = [
- "indexmap 2.0.0",
+ "indexmap 2.1.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -6793,7 +6811,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
]
[[package]]
@@ -6802,7 +6820,7 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5c266b9ac83dedf0e0385ad78514949e6d89491269e7065bee51d2bb8ec7373"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"gethostname",
"log",
"serde",
@@ -7209,7 +7227,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
"wasm-bindgen-shared",
]
@@ -7243,7 +7261,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.29",
+ "syn 2.0.32",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -7647,6 +7665,26 @@ dependencies = [
"windows-sys 0.48.0",
]
+[[package]]
+name = "workspace-template"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "bytes",
+ "collab",
+ "collab-document",
+ "collab-entity",
+ "collab-folder",
+ "indexmap 2.1.0",
+ "nanoid",
+ "serde",
+ "serde_json",
+ "tokio",
+ "uuid",
+]
+
[[package]]
name = "wry"
version = "0.24.3"
@@ -7747,6 +7785,26 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "zerocopy"
+version = "0.7.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.7.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.32",
+]
+
[[package]]
name = "zip"
version = "0.6.6"
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml
index 2e415905a9..359417c43d 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml
@@ -57,7 +57,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 = "5090711272dbc503912544375307365c174bb804" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "58ffae16b145b87a1b47f818936d80e6d6f8794c" }
# Please use the following script to update collab.
# Working directory: frontend
#
@@ -67,11 +67,15 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "509
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+
+
+
+
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 56fb393af8..6dc8e30061 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -65,14 +65,15 @@ dependencies = [
[[package]]
name = "ahash"
-version = "0.8.3"
+version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
+checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
dependencies = [
"cfg-if",
"getrandom 0.2.10",
"once_cell",
"version_check",
+ "zerocopy",
]
[[package]]
@@ -124,7 +125,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"reqwest",
@@ -666,7 +667,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -699,6 +700,7 @@ dependencies = [
"tracing",
"url",
"uuid",
+ "workspace-template",
"yrs",
]
@@ -730,7 +732,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -750,7 +752,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -780,7 +782,7 @@ dependencies = [
[[package]]
name = "collab-derive"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"proc-macro2",
"quote",
@@ -792,7 +794,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"collab",
@@ -812,7 +814,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"bytes",
@@ -826,7 +828,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"chrono",
@@ -868,7 +870,7 @@ dependencies = [
[[package]]
name = "collab-persistence"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -890,7 +892,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"async-trait",
@@ -917,7 +919,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=a462a49facbf3682717c3074b14fd29f19276e28#a462a49facbf3682717c3074b14fd29f19276e28"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=22e11ebb490039736cb2a81d9fe7dfe96782bc8b#22e11ebb490039736cb2a81d9fe7dfe96782bc8b"
dependencies = [
"anyhow",
"collab",
@@ -1150,7 +1152,7 @@ dependencies = [
"cssparser-macros",
"dtoa-short",
"itoa",
- "phf 0.8.0",
+ "phf 0.11.2",
"smallvec",
]
@@ -1263,7 +1265,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [
"cfg-if",
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
"lock_api",
"once_cell",
"parking_lot_core",
@@ -1278,7 +1280,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -1831,7 +1833,7 @@ dependencies = [
"flowy-notification",
"flowy-task",
"futures",
- "indexmap 1.9.3",
+ "indexmap 2.1.0",
"lazy_static",
"lib-dispatch",
"lib-infra",
@@ -1911,7 +1913,7 @@ dependencies = [
"flowy-notification",
"flowy-storage",
"futures",
- "indexmap 1.9.3",
+ "indexmap 2.1.0",
"lib-dispatch",
"lib-infra",
"lru",
@@ -2004,6 +2006,7 @@ dependencies = [
"nanoid",
"parking_lot",
"protobuf",
+ "serde_json",
"strum_macros 0.21.1",
"tokio",
"tokio-stream",
@@ -2471,7 +2474,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"futures-util",
@@ -2487,7 +2490,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -2532,16 +2535,16 @@ version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
]
[[package]]
name = "hashbrown"
-version = "0.14.0"
+version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"allocator-api2",
]
@@ -2551,7 +2554,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
dependencies = [
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
]
[[package]]
@@ -2832,23 +2835,23 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
- "serde",
]
[[package]]
name = "indexmap"
-version = "2.0.0"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
+checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"equivalent",
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
+ "serde",
]
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"reqwest",
@@ -3123,7 +3126,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1efa59af2ddfad1854ae27d75009d538d0998b4b2fd47083e743ac1a10e46c60"
dependencies = [
- "hashbrown 0.14.0",
+ "hashbrown 0.14.3",
]
[[package]]
@@ -3655,7 +3658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
dependencies = [
"fixedbitset",
- "indexmap 2.0.0",
+ "indexmap 2.1.0",
]
[[package]]
@@ -3664,7 +3667,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
- "phf_macros",
+ "phf_macros 0.8.0",
"phf_shared 0.8.0",
"proc-macro-hack",
]
@@ -3684,6 +3687,7 @@ 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",
]
@@ -3751,6 +3755,19 @@ 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.31",
+]
+
[[package]]
name = "phf_shared"
version = "0.8.0"
@@ -3954,7 +3971,7 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
dependencies = [
"bytes",
"heck 0.4.1",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"log",
"multimap",
"once_cell",
@@ -3975,7 +3992,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
dependencies = [
"anyhow",
- "itertools 0.10.5",
+ "itertools 0.11.0",
"proc-macro2",
"quote",
"syn 2.0.31",
@@ -4314,7 +4331,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"bincode",
@@ -4768,7 +4785,7 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c95a930e03325234c18c7071fd2b60118307e025d6fff3e12745ffbf63a3d29c"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"cssparser",
"ego-tree",
"getopts",
@@ -4785,7 +4802,7 @@ version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"cssparser",
"ego-tree",
"getopts",
@@ -4924,7 +4941,7 @@ version = "0.9.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c"
dependencies = [
- "indexmap 2.0.0",
+ "indexmap 2.1.0",
"itoa",
"ryu",
"serde",
@@ -4980,7 +4997,7 @@ dependencies = [
[[package]]
name = "shared_entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=5090711272dbc503912544375307365c174bb804#5090711272dbc503912544375307365c174bb804"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
dependencies = [
"anyhow",
"app-error",
@@ -5146,7 +5163,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"atoi",
"byteorder",
"bytes",
@@ -5162,7 +5179,7 @@ dependencies = [
"futures-util",
"hashlink",
"hex",
- "indexmap 2.0.0",
+ "indexmap 2.1.0",
"log",
"memchr",
"once_cell",
@@ -5734,7 +5751,7 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5c266b9ac83dedf0e0385ad78514949e6d89491269e7065bee51d2bb8ec7373"
dependencies = [
- "ahash 0.8.3",
+ "ahash 0.8.6",
"gethostname",
"log",
"serde",
@@ -6314,6 +6331,26 @@ dependencies = [
"windows-sys",
]
+[[package]]
+name = "workspace-template"
+version = "0.1.0"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=58ffae16b145b87a1b47f818936d80e6d6f8794c#58ffae16b145b87a1b47f818936d80e6d6f8794c"
+dependencies = [
+ "anyhow",
+ "async-trait",
+ "bytes",
+ "collab",
+ "collab-document",
+ "collab-entity",
+ "collab-folder",
+ "indexmap 2.1.0",
+ "nanoid",
+ "serde",
+ "serde_json",
+ "tokio",
+ "uuid",
+]
+
[[package]]
name = "wyz"
version = "0.5.1"
@@ -6346,6 +6383,26 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "zerocopy"
+version = "0.7.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0"
+dependencies = [
+ "zerocopy-derive",
+]
+
+[[package]]
+name = "zerocopy-derive"
+version = "0.7.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.31",
+]
+
[[package]]
name = "zip"
version = "0.6.6"
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index bf10912049..8d96e812c3 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -67,7 +67,7 @@ futures = "0.3.29"
tokio = "1.34.0"
tokio-stream = "0.1.14"
async-trait = "0.1.74"
-chrono = { version = "0.4.31", default-features = false, features = ["clock"] }
+chrono = { version = "0.4.31", default-features = false, features = ["clock"] }
lru = "0.12.0"
[profile.dev]
@@ -99,7 +99,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 = "5090711272dbc503912544375307365c174bb804" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "58ffae16b145b87a1b47f818936d80e6d6f8794c" }
# Please use the following script to update collab.
# Working directory: frontend
#
@@ -109,11 +109,11 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "509
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
-collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a462a49facbf3682717c3074b14fd29f19276e28" }
+collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
+collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "22e11ebb490039736cb2a81d9fe7dfe96782bc8b" }
diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rs
index 265f4a9e0d..dc49c4c3c4 100644
--- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs
+++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs
@@ -2,7 +2,6 @@ use std::fmt::Debug;
use std::sync::{Arc, Weak};
use anyhow::Error;
-use async_trait::async_trait;
use collab::core::collab::{CollabRawData, MutexCollab};
use collab::preclude::{CollabBuilder, CollabPlugin};
use collab_entity::{CollabObject, CollabType};
@@ -14,16 +13,16 @@ use collab_plugins::snapshot::{CollabSnapshotPlugin, SnapshotPersistence};
use parking_lot::{Mutex, RwLock};
use tracing::trace;
-use lib_infra::future::{to_fut, Fut};
+use lib_infra::future::Fut;
#[derive(Clone, Debug)]
-pub enum CollabSource {
+pub enum CollabDataSource {
Local,
- AFCloud,
+ AppFlowyCloud,
Supabase,
}
-pub enum CollabPluginContext {
+pub enum CollabStorageProviderContext {
Local,
AppFlowyCloud {
uid: i64,
@@ -39,9 +38,9 @@ pub enum CollabPluginContext {
}
pub trait CollabStorageProvider: Send + Sync + 'static {
- fn storage_source(&self) -> CollabSource;
+ fn storage_source(&self) -> CollabDataSource;
- fn get_plugins(&self, context: CollabPluginContext) -> Fut<Vec<Arc<dyn CollabPlugin>>>;
+ fn get_plugins(&self, context: CollabStorageProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>>;
fn is_sync_enabled(&self) -> bool;
}
@@ -50,11 +49,11 @@ impl<T> CollabStorageProvider for Arc<T>
where
T: CollabStorageProvider,
{
- fn storage_source(&self) -> CollabSource {
+ fn storage_source(&self) -> CollabDataSource {
(**self).storage_source()
}
- fn get_plugins(&self, context: CollabPluginContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {
+ fn get_plugins(&self, context: CollabStorageProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {
(**self).get_plugins(context)
}
@@ -195,7 +194,7 @@ impl AppFlowyCollabBuilder {
let span = tracing::span!(tracing::Level::TRACE, "collab_builder", object_id = %object_id);
let _enter = span.enter();
match cloud_storage_type {
- CollabSource::AFCloud => {
+ CollabDataSource::AppFlowyCloud => {
#[cfg(feature = "appflowy_cloud_integrate")]
{
trace!("init appflowy cloud collab plugins");
@@ -204,7 +203,7 @@ impl AppFlowyCollabBuilder {
.cloud_storage
.read()
.await
- .get_plugins(CollabPluginContext::AppFlowyCloud {
+ .get_plugins(CollabStorageProviderContext::AppFlowyCloud {
uid,
collab_object: collab_object.clone(),
local_collab,
@@ -217,7 +216,7 @@ impl AppFlowyCollabBuilder {
}
}
},
- CollabSource::Supabase => {
+ CollabDataSource::Supabase => {
#[cfg(feature = "supabase_integrate")]
{
trace!("init supabase collab plugins");
@@ -227,7 +226,7 @@ impl AppFlowyCollabBuilder {
.cloud_storage
.read()
.await
- .get_plugins(CollabPluginContext::Supabase {
+ .get_plugins(CollabStorageProviderContext::Supabase {
uid,
collab_object: collab_object.clone(),
local_collab,
@@ -239,7 +238,7 @@ impl AppFlowyCollabBuilder {
}
}
},
- CollabSource::Local => {},
+ CollabDataSource::Local => {},
}
if let Some(snapshot_persistence) = self.snapshot_persistence.lock().as_ref() {
@@ -262,20 +261,3 @@ impl AppFlowyCollabBuilder {
Ok(collab)
}
}
-
-pub struct DefaultCollabStorageProvider();
-
-#[async_trait]
-impl CollabStorageProvider for DefaultCollabStorageProvider {
- fn storage_source(&self) -> CollabSource {
- CollabSource::Local
- }
-
- fn get_plugins(&self, _context: CollabPluginContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {
- to_fut(async move { vec![] })
- }
-
- fn is_sync_enabled(&self) -> bool {
- false
- }
-}
diff --git a/frontend/rust-lib/event-integration/tests/folder/supabase_test/helper.rs b/frontend/rust-lib/event-integration/tests/folder/supabase_test/helper.rs
index 171e65fee3..eacef53b36 100644
--- a/frontend/rust-lib/event-integration/tests/folder/supabase_test/helper.rs
+++ b/frontend/rust-lib/event-integration/tests/folder/supabase_test/helper.rs
@@ -50,7 +50,7 @@ impl FlowySupabaseFolderTest {
pub async fn get_collab_update(&self, workspace_id: &str) -> Vec<u8> {
let cloud_service = self.folder_manager.get_cloud_service().clone();
let remote_updates = cloud_service
- .get_folder_updates(workspace_id, self.user_manager.user_id().unwrap())
+ .get_folder_doc_state(workspace_id, self.user_manager.user_id().unwrap())
.await
.unwrap();
diff --git a/frontend/rust-lib/flowy-core/Cargo.toml b/frontend/rust-lib/flowy-core/Cargo.toml
index 3ae5624b7e..e89817c793 100644
--- a/frontend/rust-lib/flowy-core/Cargo.toml
+++ b/frontend/rust-lib/flowy-core/Cargo.toml
@@ -31,7 +31,7 @@ collab = { version = "0.1.0" }
diesel.workspace = true
uuid.workspace = true
flowy-storage = { workspace = true }
-client-api = { version = "0.1.0", features = ["collab-sync"] }
+client-api = { version = "0.1.0", features = ["collab-sync", "template"] }
tracing.workspace = true
futures-core = { version = "0.3", default-features = false }
diff --git a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs
index 72da860e79..26607a5b67 100644
--- a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs
+++ b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs
@@ -1,5 +1,4 @@
use std::sync::Arc;
-use std::time::Duration;
use anyhow::Error;
use bytes::Bytes;
@@ -10,7 +9,9 @@ use collab_entity::CollabType;
use tokio_stream::wrappers::WatchStream;
use tracing::instrument;
-use collab_integrate::collab_builder::{CollabPluginContext, CollabSource, CollabStorageProvider};
+use collab_integrate::collab_builder::{
+ CollabDataSource, CollabStorageProvider, CollabStorageProviderContext,
+};
use collab_integrate::postgres::SupabaseDBPlugin;
use flowy_database_deps::cloud::{
CollabObjectUpdate, CollabObjectUpdateByOid, DatabaseCloudService, DatabaseSnapshot,
@@ -186,13 +187,17 @@ impl FolderCloudService for ServerProvider {
})
}
- fn get_folder_updates(&self, workspace_id: &str, uid: i64) -> FutureResult<Vec<Vec<u8>>, Error> {
+ fn get_folder_doc_state(
+ &self,
+ workspace_id: &str,
+ uid: i64,
+ ) -> FutureResult<Vec<Vec<u8>>, Error> {
let workspace_id = workspace_id.to_string();
let server = self.get_server(&self.get_server_type());
FutureResult::new(async move {
server?
.folder_service()
- .get_folder_updates(&workspace_id, uid)
+ .get_folder_doc_state(&workspace_id, uid)
.await
})
}
@@ -307,15 +312,15 @@ impl DocumentCloudService for ServerProvider {
}
impl CollabStorageProvider for ServerProvider {
- fn storage_source(&self) -> CollabSource {
+ fn storage_source(&self) -> CollabDataSource {
self.get_server_type().into()
}
#[instrument(level = "debug", skip(self, context), fields(server_type = %self.get_server_type()))]
- fn get_plugins(&self, context: CollabPluginContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {
+ fn get_plugins(&self, context: CollabStorageProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {
match context {
- CollabPluginContext::Local => to_fut(async move { vec![] }),
- CollabPluginContext::AppFlowyCloud {
+ CollabStorageProviderContext::Local => to_fut(async move { vec![] }),
+ CollabStorageProviderContext::AppFlowyCloud {
uid: _,
collab_object,
local_collab,
@@ -334,7 +339,7 @@ impl CollabStorageProvider for ServerProvider {
let sink_config = SinkConfig::new()
.send_timeout(8)
.with_max_payload_size(1024 * 10)
- .with_strategy(SinkStrategy::FixInterval(Duration::from_millis(600)));
+ .with_strategy(sink_strategy_from_object(&sync_object));
let sync_plugin = SyncPlugin::new(
origin,
sync_object,
@@ -360,7 +365,7 @@ impl CollabStorageProvider for ServerProvider {
to_fut(async move { vec![] })
}
},
- CollabPluginContext::Supabase {
+ CollabStorageProviderContext::Supabase {
uid,
collab_object,
local_collab,
@@ -391,3 +396,14 @@ impl CollabStorageProvider for ServerProvider {
*self.enable_sync.read()
}
}
+
+fn sink_strategy_from_object(object: &SyncObject) -> SinkStrategy {
+ match object.collab_type {
+ CollabType::Document => SinkStrategy::FixInterval(std::time::Duration::from_millis(300)),
+ CollabType::Folder => SinkStrategy::ASAP,
+ CollabType::Database => SinkStrategy::ASAP,
+ CollabType::WorkspaceDatabase => SinkStrategy::ASAP,
+ CollabType::DatabaseRow => SinkStrategy::ASAP,
+ CollabType::UserAwareness => SinkStrategy::ASAP,
+ }
+}
diff --git a/frontend/rust-lib/flowy-core/src/integrate/user.rs b/frontend/rust-lib/flowy-core/src/integrate/user.rs
index 17dd4cb667..bf17490f96 100644
--- a/frontend/rust-lib/flowy-core/src/integrate/user.rs
+++ b/frontend/rust-lib/flowy-core/src/integrate/user.rs
@@ -140,14 +140,27 @@ impl UserStatusCallback for UserStatusCallbackImpl {
device_id
);
+ // In the current implementation, when a user signs up for AppFlowy Cloud, a default workspace
+ // is automatically created for them. However, for users who sign up through Supabase, the creation
+ // of the default workspace relies on the client-side operation. This means that the process
+ // for initializing a default workspace differs depending on the sign-up method used.
+ let data_source = match folder_manager
+ .cloud_service
+ .get_folder_doc_state(&user_workspace.id, user_profile.uid)
+ .await
+ {
+ Ok(doc_state) => FolderInitDataSource::Cloud(doc_state),
+ Err(_) => FolderInitDataSource::LocalDisk {
+ create_if_not_exist: true,
+ },
+ };
+
folder_manager
.initialize_with_new_user(
user_profile.uid,
&user_profile.token,
is_new_user,
- FolderInitDataSource::LocalDisk {
- create_if_not_exist: true,
- },
+ data_source,
&user_workspace.id,
)
.await
diff --git a/frontend/rust-lib/flowy-core/src/lib.rs b/frontend/rust-lib/flowy-core/src/lib.rs
index e06fb1619f..c9b5b68d2f 100644
--- a/frontend/rust-lib/flowy-core/src/lib.rs
+++ b/frontend/rust-lib/flowy-core/src/lib.rs
@@ -7,7 +7,7 @@ use std::time::Duration;
use tokio::sync::RwLock;
use tracing::{debug, error, event, info, instrument};
-use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabSource};
+use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabDataSource};
use flowy_database2::DatabaseManager;
use flowy_document2::manager::DocumentManager;
use flowy_folder2::manager::FolderManager;
@@ -232,12 +232,12 @@ fn init_user_manager(
)
}
-impl From<ServerType> for CollabSource {
+impl From<ServerType> for CollabDataSource {
fn from(server_type: ServerType) -> Self {
match server_type {
- ServerType::Local => CollabSource::Local,
- ServerType::AFCloud => CollabSource::AFCloud,
- ServerType::Supabase => CollabSource::Supabase,
+ ServerType::Local => CollabDataSource::Local,
+ ServerType::AFCloud => CollabDataSource::AppFlowyCloud,
+ ServerType::Supabase => CollabDataSource::Supabase,
}
}
}
diff --git a/frontend/rust-lib/flowy-database2/Cargo.toml b/frontend/rust-lib/flowy-database2/Cargo.toml
index ec46cf468e..476a40c352 100644
--- a/frontend/rust-lib/flowy-database2/Cargo.toml
+++ b/frontend/rust-lib/flowy-database2/Cargo.toml
@@ -30,7 +30,7 @@ chrono = { workspace = true, default-features = false, features = ["clock"] }
rust_decimal = "1.28.1"
rusty-money = {version = "0.4.1", features = ["iso"]}
lazy_static = "1.4.0"
-indexmap = {version = "1.9.2", features = ["serde"]}
+indexmap = {version = "2.1.0", features = ["serde"]}
url = { version = "2"}
fancy-regex = "0.11.0"
futures.workspace = true
diff --git a/frontend/rust-lib/flowy-document2/Cargo.toml b/frontend/rust-lib/flowy-document2/Cargo.toml
index 078903d1c3..a7f21f8e22 100644
--- a/frontend/rust-lib/flowy-document2/Cargo.toml
+++ b/frontend/rust-lib/flowy-document2/Cargo.toml
@@ -29,7 +29,7 @@ serde_json.workspace = true
tracing.workspace = true
tokio = { workspace = true, features = ["full"] }
anyhow.workspace = true
-indexmap = {version = "1.9.2", features = ["serde"]}
+indexmap = {version = "2.1.0", features = ["serde"]}
uuid.workspace = true
futures.workspace = true
tokio-stream = { workspace = true, features = ["sync"] }
diff --git a/frontend/rust-lib/flowy-document2/src/entities.rs b/frontend/rust-lib/flowy-document2/src/entities.rs
index 8e3d68ef6d..91924c6b8e 100644
--- a/frontend/rust-lib/flowy-document2/src/entities.rs
+++ b/frontend/rust-lib/flowy-document2/src/entities.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use collab::core::collab_state::SyncState;
-use collab_document::blocks::{BlockAction, DocumentData};
+use collab_document::blocks::{json_str_to_hashmap, Block, BlockAction, DocumentData};
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
use flowy_error::ErrorCode;
@@ -174,6 +174,24 @@ pub struct BlockPB {
pub external_type: Option<String>,
}
+impl From<BlockPB> for Block {
+ fn from(pb: BlockPB) -> Self {
+ // Use `json_str_to_hashmap()` from the `collab_document` crate to convert the JSON data to a hashmap
+ let data = json_str_to_hashmap(&pb.data).unwrap_or_default();
+
+ // Convert the protobuf `BlockPB` to our internal `Block` struct
+ Self {
+ id: pb.id,
+ ty: pb.ty,
+ children: pb.children_id,
+ parent: pb.parent_id,
+ data,
+ external_id: pb.external_id,
+ external_type: pb.external_type,
+ }
+ }
+}
+
#[derive(Default, ProtoBuf, Debug)]
pub struct MetaPB {
#[pb(index = 1)]
diff --git a/frontend/rust-lib/flowy-document2/src/event_handler.rs b/frontend/rust-lib/flowy-document2/src/event_handler.rs
index c4851f2e70..c4b089712c 100644
--- a/frontend/rust-lib/flowy-document2/src/event_handler.rs
+++ b/frontend/rust-lib/flowy-document2/src/event_handler.rs
@@ -7,8 +7,7 @@
use std::sync::{Arc, Weak};
use collab_document::blocks::{
- json_str_to_hashmap, Block, BlockAction, BlockActionPayload, BlockActionType, BlockEvent,
- BlockEventPayload, DeltaType,
+ BlockAction, BlockActionPayload, BlockActionType, BlockEvent, BlockEventPayload, DeltaType,
};
use flowy_error::{FlowyError, FlowyResult};
@@ -254,24 +253,6 @@ impl From<BlockActionPayloadPB> for BlockActionPayload {
}
}
-impl From<BlockPB> for Block {
- fn from(pb: BlockPB) -> Self {
- // Use `json_str_to_hashmap()` from the `collab_document` crate to convert the JSON data to a hashmap
- let data = json_str_to_hashmap(&pb.data).unwrap_or_default();
-
- // Convert the protobuf `BlockPB` to our internal `Block` struct
- Self {
- id: pb.id,
- ty: pb.ty,
- children: pb.children_id,
- parent: pb.parent_id,
- data,
- external_id: pb.external_id,
- external_type: pb.external_type,
- }
- }
-}
-
impl From<BlockEvent> for BlockEventPB {
fn from(payload: BlockEvent) -> Self {
// Convert each individual `BlockEvent` to a protobuf `BlockEventPB`, and collect the results into a `Vec`
diff --git a/frontend/rust-lib/flowy-document2/src/parser/json/block.rs b/frontend/rust-lib/flowy-document2/src/parser/json/block.rs
index 16b3bd0c73..0479e116e8 100644
--- a/frontend/rust-lib/flowy-document2/src/parser/json/block.rs
+++ b/frontend/rust-lib/flowy-document2/src/parser/json/block.rs
@@ -7,14 +7,14 @@ use serde_json::Value;
/// {
/// 'type': string,
/// 'data': Map<String, Object>
-/// 'children': [Block],
+/// 'children': [SerdeBlock],
/// }
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
-pub struct Block {
+pub struct SerdeBlock {
#[serde(rename = "type")]
pub ty: String,
#[serde(default)]
pub data: HashMap<String, Value>,
#[serde(default)]
- pub children: Vec<Block>,
+ pub children: Vec<SerdeBlock>,
}
diff --git a/frontend/rust-lib/flowy-document2/src/parser/json/parser.rs b/frontend/rust-lib/flowy-document2/src/parser/json/parser.rs
index 8a4af4aee1..91f61ca58b 100644
--- a/frontend/rust-lib/flowy-document2/src/parser/json/parser.rs
+++ b/frontend/rust-lib/flowy-document2/src/parser/json/parser.rs
@@ -7,7 +7,7 @@ use flowy_error::FlowyResult;
use crate::entities::{BlockPB, ChildrenPB, DocumentDataPB, MetaPB};
-use super::block::Block;
+use super::block::SerdeBlock;
pub struct JsonToDocumentParser;
@@ -15,7 +15,7 @@ const DELTA: &str = "delta";
const TEXT_EXTERNAL_TYPE: &str = "text";
impl JsonToDocumentParser {
pub fn json_str_to_document(json_str: &str) -> FlowyResult<DocumentDataPB> {
- let root = serde_json::from_str::<Block>(json_str)?;
+ let root = serde_json::from_str::<SerdeBlock>(json_str)?;
let page_id = nanoid!(10);
@@ -39,7 +39,7 @@ impl JsonToDocumentParser {
}
fn generate_blocks(
- block: &Block,
+ block: &SerdeBlock,
id: Option<String>,
parent_id: String,
) -> (IndexMap<String, BlockPB>, IndexMap<String, String>) {
@@ -93,7 +93,7 @@ impl JsonToDocumentParser {
}
fn block_to_block_pb(
- block: &Block,
+ block: &SerdeBlock,
id: Option<String>,
parent_id: String,
) -> (BlockPB, Option<String>) {
diff --git a/frontend/rust-lib/flowy-document2/tests/document/util.rs b/frontend/rust-lib/flowy-document2/tests/document/util.rs
index 0a38eb0c8e..0acfcf6cf0 100644
--- a/frontend/rust-lib/flowy-document2/tests/document/util.rs
+++ b/frontend/rust-lib/flowy-document2/tests/document/util.rs
@@ -3,6 +3,7 @@ use std::sync::Arc;
use anyhow::Error;
use bytes::Bytes;
+use collab::preclude::CollabPlugin;
use collab_document::blocks::DocumentData;
use collab_document::document_data::default_document_data;
use nanoid::nanoid;
@@ -11,14 +12,17 @@ use tempfile::TempDir;
use tracing_subscriber::{fmt::Subscriber, util::SubscriberInitExt, EnvFilter};
use uuid::Uuid;
-use collab_integrate::collab_builder::{AppFlowyCollabBuilder, DefaultCollabStorageProvider};
+use collab_integrate::collab_builder::{
+ AppFlowyCollabBuilder, CollabDataSource, CollabStorageProvider, CollabStorageProviderContext,
+};
use collab_integrate::RocksCollabDB;
use flowy_document2::document::MutexDocument;
use flowy_document2::manager::{DocumentManager, DocumentUser};
use flowy_document_deps::cloud::*;
use flowy_error::FlowyError;
use flowy_storage::{FileStorageService, StorageObject};
-use lib_infra::future::FutureResult;
+use lib_infra::async_trait::async_trait;
+use lib_infra::future::{to_fut, Fut, FutureResult};
pub struct DocumentTest {
inner: DocumentManager,
@@ -165,3 +169,20 @@ impl FileStorageService for DocumentTestFileStorageService {
todo!()
}
}
+
+struct DefaultCollabStorageProvider();
+
+#[async_trait]
+impl CollabStorageProvider for DefaultCollabStorageProvider {
+ fn storage_source(&self) -> CollabDataSource {
+ CollabDataSource::Local
+ }
+
+ fn get_plugins(&self, _context: CollabStorageProviderContext) -> Fut<Vec<Arc<dyn CollabPlugin>>> {
+ to_fut(async move { vec![] })
+ }
+
+ fn is_sync_enabled(&self) -> bool {
+ false
+ }
+}
diff --git a/frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs b/frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs
index f6ee20bbe7..ea7c3f180a 100644
--- a/frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs
+++ b/frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs
@@ -1,12 +1,13 @@
-use flowy_document2::parser::json::block::Block;
use serde_json::json;
+use flowy_document2::parser::json::block::SerdeBlock;
+
#[test]
fn test_empty_data_and_children() {
let json = json!({
"type": "page",
});
- let block = serde_json::from_value::<Block>(json).unwrap();
+ let block = serde_json::from_value::<SerdeBlock>(json).unwrap();
assert_eq!(block.ty, "page");
assert!(block.data.is_empty());
assert!(block.children.is_empty());
@@ -21,7 +22,7 @@ fn test_data() {
"checked": false
}
});
- let block = serde_json::from_value::<Block>(json).unwrap();
+ let block = serde_json::from_value::<SerdeBlock>(json).unwrap();
assert_eq!(block.ty, "todo_list");
assert_eq!(block.data.len(), 2);
assert_eq!(block.data.get("checked").unwrap(), false);
@@ -52,7 +53,7 @@ fn test_children() {
}
}
]});
- let block = serde_json::from_value::<Block>(json).unwrap();
+ let block = serde_json::from_value::<SerdeBlock>(json).unwrap();
assert!(block.data.is_empty());
assert_eq!(block.ty, "page");
assert_eq!(block.children.len(), 2);
@@ -92,7 +93,7 @@ fn test_nested_children() {
}
]
});
- let block = serde_json::from_value::<Block>(json).unwrap();
+ let block = serde_json::from_value::<SerdeBlock>(json).unwrap();
assert!(block.data.is_empty());
assert_eq!(block.ty, "page");
assert_eq!(
diff --git a/frontend/rust-lib/flowy-folder-deps/src/cloud.rs b/frontend/rust-lib/flowy-folder-deps/src/cloud.rs
index 5270519043..c0f78e540f 100644
--- a/frontend/rust-lib/flowy-folder-deps/src/cloud.rs
+++ b/frontend/rust-lib/flowy-folder-deps/src/cloud.rs
@@ -28,7 +28,8 @@ pub trait FolderCloudService: Send + Sync + 'static {
limit: usize,
) -> FutureResult<Vec<FolderSnapshot>, Error>;
- fn get_folder_updates(&self, workspace_id: &str, uid: i64) -> FutureResult<Vec<Vec<u8>>, Error>;
+ fn get_folder_doc_state(&self, workspace_id: &str, uid: i64)
+ -> FutureResult<Vec<Vec<u8>>, Error>;
fn service_name(&self) -> String;
}
diff --git a/frontend/rust-lib/flowy-folder2/Cargo.toml b/frontend/rust-lib/flowy-folder2/Cargo.toml
index 0f98425828..94a253ca5b 100644
--- a/frontend/rust-lib/flowy-folder2/Cargo.toml
+++ b/frontend/rust-lib/flowy-folder2/Cargo.toml
@@ -29,6 +29,7 @@ strum_macros = "0.21"
protobuf.workspace = true
uuid.workspace = true
tokio-stream = { workspace = true, features = ["sync"] }
+serde_json.workspace = true
[build-dependencies]
flowy-codegen = { path = "../../../shared-lib/flowy-codegen"}
diff --git a/frontend/rust-lib/flowy-folder2/src/manager.rs b/frontend/rust-lib/flowy-folder2/src/manager.rs
index 287323373a..5c0916d9a1 100644
--- a/frontend/rust-lib/flowy-folder2/src/manager.rs
+++ b/frontend/rust-lib/flowy-folder2/src/manager.rs
@@ -48,7 +48,7 @@ pub struct FolderManager {
collab_builder: Arc<AppFlowyCollabBuilder>,
user: Arc<dyn FolderUser>,
operation_handlers: FolderOperationHandlers,
- cloud_service: Arc<dyn FolderCloudService>,
+ pub cloud_service: Arc<dyn FolderCloudService>,
}
unsafe impl Send for FolderManager {}
@@ -136,7 +136,7 @@ impl FolderManager {
// Update the workspace id
event!(
Level::INFO,
- "Init current workspace: {} from: {}",
+ "Init workspace: {} from: {}",
workspace_id,
initial_data
);
@@ -165,10 +165,13 @@ impl FolderManager {
.await?;
Folder::open(UserId::from(uid), collab, Some(folder_notifier))?
} else if create_if_not_exist {
+ // Currently, this branch is only used when the server type is supabase. For appflowy cloud,
+ // the default workspace is already created when the user sign up.
event!(Level::INFO, "Create folder with default folder builder");
let folder_data =
DefaultFolderBuilder::build(uid, workspace_id.to_string(), &self.operation_handlers)
.await;
+
let collab = self
.collab_for_folder(uid, &workspace_id, collab_db, vec![])
.await?;
@@ -249,23 +252,23 @@ impl FolderManager {
user_id: i64,
workspace_id: &str,
) -> FlowyResult<()> {
- let folder_updates = self
+ let folder_doc_state = self
.cloud_service
- .get_folder_updates(workspace_id, user_id)
+ .get_folder_doc_state(workspace_id, user_id)
.await?;
event!(
Level::INFO,
"Get folder updates via {}, number of updates: {}",
self.cloud_service.service_name(),
- folder_updates.len()
+ folder_doc_state.len()
);
self
.initialize(
user_id,
workspace_id,
- FolderInitDataSource::Cloud(folder_updates),
+ FolderInitDataSource::Cloud(folder_doc_state),
)
.await?;
Ok(())
@@ -291,7 +294,7 @@ impl FolderManager {
// when the user signs up for the first time.
let result = self
.cloud_service
- .get_folder_updates(workspace_id, user_id)
+ .get_folder_doc_state(workspace_id, user_id)
.await
.map_err(FlowyError::from);
@@ -1174,14 +1177,14 @@ fn subscribe_folder_trash_changed(
}
/// Return the views that belong to the workspace. The views are filtered by the trash.
-fn get_workspace_view_pbs(workspace_id: &str, folder: &Folder) -> Vec<ViewPB> {
+fn get_workspace_view_pbs(_workspace_id: &str, folder: &Folder) -> Vec<ViewPB> {
let trash_ids = folder
.get_all_trash()
.into_iter()
.map(|trash| trash.id)
.collect::<Vec<String>>();
- let mut views = folder.get_workspace_views(workspace_id);
+ let mut views = folder.get_workspace_views();
views.retain(|view| !trash_ids.contains(&view.id));
views
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.rs
index f7268c0e53..23d88cfe48 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
@@ -89,7 +89,11 @@ where
FutureResult::new(async move { Ok(vec![]) })
}
- fn get_folder_updates(&self, workspace_id: &str, _uid: i64) -> FutureResult<Vec<Vec<u8>>, Error> {
+ fn get_folder_doc_state(
+ &self,
+ workspace_id: &str,
+ _uid: i64,
+ ) -> FutureResult<Vec<Vec<u8>>, Error> {
let workspace_id = workspace_id.to_string();
let try_get_client = self.0.try_get_client();
FutureResult::new(async move {
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.rs
index 99f00e2d27..fc3d4028af 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,6 +1,6 @@
use std::sync::Arc;
-use anyhow::Error;
+use anyhow::{anyhow, Error};
use flowy_folder_deps::cloud::{
gen_workspace_id, FolderCloudService, FolderData, FolderSnapshot, Workspace, WorkspaceRecord,
@@ -50,12 +50,16 @@ impl FolderCloudService for LocalServerFolderCloudServiceImpl {
FutureResult::new(async move { Ok(vec![]) })
}
- fn get_folder_updates(
+ fn get_folder_doc_state(
&self,
_workspace_id: &str,
_uid: i64,
) -> FutureResult<Vec<Vec<u8>>, Error> {
- FutureResult::new(async move { Ok(vec![]) })
+ FutureResult::new(async {
+ Err(anyhow!(
+ "Local server doesn't support get folder doc state from remote"
+ ))
+ })
}
fn service_name(&self) -> String {
diff --git a/frontend/rust-lib/flowy-server/src/supabase/api/folder.rs b/frontend/rust-lib/flowy-server/src/supabase/api/folder.rs
index 6efe86d1d5..bb9ee4fd88 100644
--- a/frontend/rust-lib/flowy-server/src/supabase/api/folder.rs
+++ b/frontend/rust-lib/flowy-server/src/supabase/api/folder.rs
@@ -128,7 +128,11 @@ where
})
}
- fn get_folder_updates(&self, workspace_id: &str, _uid: i64) -> FutureResult<Vec<Vec<u8>>, Error> {
+ fn get_folder_doc_state(
+ &self,
+ workspace_id: &str,
+ _uid: i64,
+ ) -> FutureResult<Vec<Vec<u8>>, Error> {
let try_get_postgrest = self.server.try_get_weak_postgrest();
let workspace_id = workspace_id.to_string();
let (tx, rx) = channel();
diff --git a/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs b/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs
index 5f871df364..225b22b336 100644
--- a/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs
+++ b/frontend/rust-lib/flowy-server/tests/supabase_test/folder_test.rs
@@ -69,7 +69,7 @@ async fn supabase_get_folder_test() {
// let updates = collab_service.get_all_updates(&collab_object).await.unwrap();
let updates = folder_service
- .get_folder_updates(&user.latest_workspace.id, user.user_id)
+ .get_folder_doc_state(&user.latest_workspace.id, user.user_id)
.await
.unwrap();
assert_eq!(updates.len(), 2);
@@ -81,7 +81,7 @@ async fn supabase_get_folder_test() {
.unwrap();
}
let updates: Vec<Vec<u8>> = folder_service
- .get_folder_updates(&user.latest_workspace.id, user.user_id)
+ .get_folder_doc_state(&user.latest_workspace.id, user.user_id)
.await
.unwrap();
@@ -149,7 +149,7 @@ async fn supabase_duplicate_updates_test() {
.await
.unwrap();
let first_init_sync_update: Vec<u8> = folder_service
- .get_folder_updates(&user.latest_workspace.id, user.user_id)
+ .get_folder_doc_state(&user.latest_workspace.id, user.user_id)
.await
.unwrap()
.first()
@@ -169,7 +169,7 @@ async fn supabase_duplicate_updates_test() {
.await
.unwrap();
let second_init_sync_update: Vec<u8> = folder_service
- .get_folder_updates(&user.latest_workspace.id, user.user_id)
+ .get_folder_doc_state(&user.latest_workspace.id, user.user_id)
.await
.unwrap()
.first()
@@ -258,7 +258,7 @@ async fn supabase_diff_state_vector_test() {
let old_version_doc = Doc::new();
let map = { old_version_doc.get_or_insert_map("map") };
let updates: Vec<Vec<u8>> = folder_service
- .get_folder_updates(&user.latest_workspace.id, user.user_id)
+ .get_folder_doc_state(&user.latest_workspace.id, user.user_id)
.await
.unwrap();
{
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.rs
index 27d05869d8..50c8a2523d 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
@@ -33,7 +33,7 @@ impl UserDataMigration for HistoricalEmptyDocumentMigration {
// Migration the first level documents of the workspace. The first level documents do not have
// any updates. So when calling load_collab, it will return error.
- let migration_views = folder.get_workspace_views(&session.user_workspace.id);
+ let migration_views = folder.get_workspace_views();
for view in migration_views {
if load_collab(session.user_id, &write_txn, &view.id).is_err() {
// Create a document with default data
diff --git a/shared-lib/Cargo.lock b/shared-lib/Cargo.lock
index ced211dbea..f130bb5ae4 100644
--- a/shared-lib/Cargo.lock
+++ b/shared-lib/Cargo.lock
@@ -450,6 +450,12 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
[[package]]
name = "errno"
version = "0.3.1"
@@ -640,9 +646,9 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.12.3"
+version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
@@ -723,11 +729,11 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "1.9.2"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
+checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
- "autocfg",
+ "equivalent",
"hashbrown",
"serde",
]
diff --git a/shared-lib/lib-ot/Cargo.toml b/shared-lib/lib-ot/Cargo.toml
index 9d36af88d7..d412e7d74b 100644
--- a/shared-lib/lib-ot/Cargo.toml
+++ b/shared-lib/lib-ot/Cargo.toml
@@ -9,7 +9,7 @@ edition = "2018"
serde = { version = "1.0", features = ["derive", "rc"] }
thiserror = "1.0"
serde_json.workspace = true
-indexmap = {version = "1.9.2", features = ["serde"]}
+indexmap = {version = "2.1.0", features = ["serde"]}
tracing.workspace = true
lazy_static = "1.4.0"
strum = "0.21"