diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml index a7e5fd6870..074c67ebad 100644 --- a/.github/workflows/rust_ci.yaml +++ b/.github/workflows/rust_ci.yaml @@ -8,7 +8,6 @@ on: - "release/*" paths: - "frontend/rust-lib/**" - - "shared-lib/**" pull_request: branches: @@ -17,7 +16,6 @@ on: - "release/*" paths: - "frontend/rust-lib/**" - - "shared-lib/**" env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/rust_coverage.yml b/.github/workflows/rust_coverage.yml index dcf883ee3c..dbb2794bc3 100644 --- a/.github/workflows/rust_coverage.yml +++ b/.github/workflows/rust_coverage.yml @@ -7,7 +7,6 @@ on: - "release/*" paths: - "frontend/rust-lib/**" - - "shared-lib/**" env: CARGO_TERM_COLOR: always diff --git a/frontend/appflowy_flutter/integration_test/board/board_add_row_test.dart b/frontend/appflowy_flutter/integration_test/board/board_add_row_test.dart index fdd73cd842..b080f1899e 100644 --- a/frontend/appflowy_flutter/integration_test/board/board_add_row_test.dart +++ b/frontend/appflowy_flutter/integration_test/board/board_add_row_test.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/plugins/database_view/board/presentation/widgets/board_column_header.dart'; import 'package:appflowy/plugins/database_view/widgets/card/container/card_container.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_board/appflowy_board.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/integration_test/board/board_group_test.dart b/frontend/appflowy_flutter/integration_test/board/board_group_test.dart index a93863e5c8..02515c36e7 100644 --- a/frontend/appflowy_flutter/integration_test/board/board_group_test.dart +++ b/frontend/appflowy_flutter/integration_test/board/board_group_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/plugins/database_view/widgets/row/cells/select_option_cell/extension.dart'; import 'package:appflowy/plugins/database_view/widgets/row/row_property.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/board/board_hide_groups_test.dart b/frontend/appflowy_flutter/integration_test/board/board_hide_groups_test.dart index 51576f0a5d..0e80ef253b 100644 --- a/frontend/appflowy_flutter/integration_test/board/board_hide_groups_test.dart +++ b/frontend/appflowy_flutter/integration_test/board/board_hide_groups_test.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/plugins/database_view/board/presentation/widgets/board_column_header.dart'; import 'package:appflowy/plugins/database_view/board/presentation/widgets/board_hidden_groups.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/board/board_row_test.dart b/frontend/appflowy_flutter/integration_test/board/board_row_test.dart index b3f42c864e..37f251f82d 100644 --- a/frontend/appflowy_flutter/integration_test/board/board_row_test.dart +++ b/frontend/appflowy_flutter/integration_test/board/board_row_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/database_view/widgets/card/card.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_board/appflowy_board.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/services.dart'; diff --git a/frontend/appflowy_flutter/integration_test/cloud/anon_user_continue_test.dart b/frontend/appflowy_flutter/integration_test/cloud/anon_user_continue_test.dart index 709d095661..d0f827026e 100644 --- a/frontend/appflowy_flutter/integration_test/cloud/anon_user_continue_test.dart +++ b/frontend/appflowy_flutter/integration_test/cloud/anon_user_continue_test.dart @@ -10,7 +10,7 @@ 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:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart b/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart index 79128f7d84..864a024972 100644 --- a/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart +++ b/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart @@ -10,7 +10,7 @@ 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:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/cloud/user_setting_sync_test.dart b/frontend/appflowy_flutter/integration_test/cloud/user_setting_sync_test.dart index a7be7db0ae..760804bc15 100644 --- a/frontend/appflowy_flutter/integration_test/cloud/user_setting_sync_test.dart +++ b/frontend/appflowy_flutter/integration_test/cloud/user_setting_sync_test.dart @@ -11,7 +11,7 @@ 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:appflowy/workspace/presentation/widgets/user_avatar.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart b/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart index 2d29689b83..9d1d9c780c 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart b/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart index 2f05c823a2..8887ed0a80 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:intl/intl.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_field_settings_test.dart b/frontend/appflowy_flutter/integration_test/database/database_field_settings_test.dart index 62c5bb8737..229de68070 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_field_settings_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_field_settings_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/plugins/database_view/grid/presentation/grid_page.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_field_test.dart b/frontend/appflowy_flutter/integration_test/database/database_field_test.dart index 3c0487a387..f2d121c0ab 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_field_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_field_test.dart @@ -1,7 +1,7 @@ import 'package:appflowy/plugins/database_view/grid/presentation/grid_page.dart'; import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/type_option/select/select_option.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_row_page_test.dart b/frontend/appflowy_flutter/integration_test/database/database_row_page_test.dart index 5075344c41..b8d2b70d20 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_row_page_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_row_page_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/plugins/database_view/widgets/row/row_banner.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_row_test.dart b/frontend/appflowy_flutter/integration_test/database/database_row_test.dart index 5584939ca8..61d90e72a9 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_row_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_row_test.dart @@ -1,4 +1,4 @@ -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_setting_test.dart b/frontend/appflowy_flutter/integration_test/database/database_setting_test.dart index 2ada023225..caa5791e4c 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_setting_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_setting_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/database/database_view_test.dart b/frontend/appflowy_flutter/integration_test/database/database_view_test.dart index b5465ebee3..1a2e101763 100644 --- a/frontend/appflowy_flutter/integration_test/database/database_view_test.dart +++ b/frontend/appflowy_flutter/integration_test/database/database_view_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart b/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart index 321d0d1b6d..b25fed44c4 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart @@ -1,7 +1,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_cover_image_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_cover_image_test.dart index e92b849cd5..fbd4312489 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_cover_image_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_cover_image_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_emoji_mart/flutter_emoji_mart.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart index 77339b22ff..cf3e40db84 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart @@ -5,7 +5,7 @@ import 'package:appflowy/plugins/database_view/grid/presentation/grid_page.dart' import 'package:appflowy/plugins/database_view/widgets/row/cells/text_cell/text_cell.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/uuid.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart index 30ef8aaabd..5516cead47 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart @@ -6,7 +6,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/image/embe import 'package:appflowy/plugins/document/presentation/editor_plugins/image/image_placeholder.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/image/unsplash_image_widget.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/image/upload_image_menu.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide UploadImageMenu; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart index 75667ac611..f8ad952459 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart index 94b7eeb70a..84080d7c97 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flowy_infra_ui/widget/error_page.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart index 3c2065795a..d2ce2368da 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart @@ -1,4 +1,4 @@ -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart index d71d933afa..5cc8aabfa4 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart index 10bcebefae..b4a9784537 100644 --- a/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart @@ -1,7 +1,7 @@ import 'dart:io'; import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart b/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart index 8f1516d5be..8f1218e2f4 100644 --- a/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart +++ b/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart @@ -1,6 +1,6 @@ import 'dart:io'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart index a0eef906a0..f7c676d1b1 100644 --- a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart +++ b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart @@ -1,7 +1,7 @@ import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_icon_test.dart b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_icon_test.dart index 1b2523545c..a2a641ec8c 100644 --- a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_icon_test.dart +++ b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_icon_test.dart @@ -1,4 +1,4 @@ -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart index 075b9209b0..cac6e4ee04 100644 --- a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart +++ b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/presentation/home/menu/view/draggable_view_it import 'package:appflowy/workspace/presentation/home/menu/view/view_add_button.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_more_action_button.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/tabs_test.dart b/frontend/appflowy_flutter/integration_test/tabs_test.dart index af42c999c3..5b0522412f 100644 --- a/frontend/appflowy_flutter/integration_test/tabs_test.dart +++ b/frontend/appflowy_flutter/integration_test/tabs_test.dart @@ -2,7 +2,7 @@ import 'dart:io'; import 'package:appflowy/workspace/presentation/home/tabs/flowy_tab.dart'; import 'package:appflowy/workspace/presentation/home/tabs/tabs_manager.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/integration_test/util/common_operations.dart b/frontend/appflowy_flutter/integration_test/util/common_operations.dart index 9431acbb88..576a4da6e8 100644 --- a/frontend/appflowy_flutter/integration_test/util/common_operations.dart +++ b/frontend/appflowy_flutter/integration_test/util/common_operations.dart @@ -17,7 +17,7 @@ import 'package:appflowy/workspace/presentation/home/menu/view/view_more_action_ import 'package:appflowy/workspace/presentation/settings/widgets/settings_language_view.dart'; import 'package:appflowy/workspace/presentation/widgets/view_title_bar.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/widget/buttons/primary_button.dart'; import 'package:flutter/gestures.dart'; diff --git a/frontend/appflowy_flutter/integration_test/util/database_test_op.dart b/frontend/appflowy_flutter/integration_test/util/database_test_op.dart index aaa9ffc7f8..16288ff17f 100644 --- a/frontend/appflowy_flutter/integration_test/util/database_test_op.dart +++ b/frontend/appflowy_flutter/integration_test/util/database_test_op.dart @@ -65,7 +65,7 @@ import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart'; import 'package:appflowy/workspace/presentation/widgets/toggle/toggle.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_board/appflowy_board.dart'; import 'package:calendar_view/calendar_view.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/integration_test/util/expectation.dart b/frontend/appflowy_flutter/integration_test/util/expectation.dart index e8fbfd4eeb..c059e9e331 100644 --- a/frontend/appflowy_flutter/integration_test/util/expectation.dart +++ b/frontend/appflowy_flutter/integration_test/util/expectation.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/presentation/home/home_stack.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; import 'package:appflowy/workspace/presentation/widgets/view_title_bar.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/lib/core/notification/document_notification.dart b/frontend/appflowy_flutter/lib/core/notification/document_notification.dart index 024b67e86d..584d54cbe2 100644 --- a/frontend/appflowy_flutter/lib/core/notification/document_notification.dart +++ b/frontend/appflowy_flutter/lib/core/notification/document_notification.dart @@ -1,7 +1,7 @@ import 'dart:typed_data'; import 'package:appflowy/core/notification/notification_helper.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/notification.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart b/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart index 9acf0d062a..8ee7667394 100644 --- a/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart +++ b/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart @@ -3,7 +3,7 @@ import 'dart:typed_data'; import 'package:appflowy_backend/protobuf/flowy-notification/protobuf.dart'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; import 'notification_helper.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/application/mobile_router.dart b/frontend/appflowy_flutter/lib/mobile/application/mobile_router.dart index f33586635d..a97fd7ef37 100644 --- a/frontend/appflowy_flutter/lib/mobile/application/mobile_router.dart +++ b/frontend/appflowy_flutter/lib/mobile/application/mobile_router.dart @@ -3,7 +3,7 @@ import 'package:appflowy/mobile/presentation/database/mobile_calendar_screen.dar import 'package:appflowy/mobile/presentation/database/mobile_grid_screen.dart'; import 'package:appflowy/mobile/presentation/presentation.dart'; import 'package:appflowy/workspace/application/recent/recent_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/application/user_profile/user_profile_bloc.dart b/frontend/appflowy_flutter/lib/mobile/application/user_profile/user_profile_bloc.dart index 2d257e38b9..e3d43c4a51 100644 --- a/frontend/appflowy_flutter/lib/mobile/application/user_profile/user_profile_bloc.dart +++ b/frontend/appflowy_flutter/lib/mobile/application/user_profile/user_profile_bloc.dart @@ -1,7 +1,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/auth/auth_service.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:bloc/bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/base/mobile_view_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/base/mobile_view_page.dart index 8cfd7e8b0b..53fdb30d2b 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/base/mobile_view_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/base/mobile_view_page.dart @@ -9,7 +9,7 @@ import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart' hide State; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_add_new_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_add_new_page.dart index d9c5e7c1e5..0cc8e6f1a9 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_add_new_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_add_new_page.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet_action_widget.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item.dart index 43ca1e8ba0..13857f34e7 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item.dart @@ -1,7 +1,7 @@ import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart'; import 'package:appflowy/workspace/application/favorite/favorite_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart' hide WidgetBuilder; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_header.dart index b6dd615a04..80889f4e58 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_header.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_header.dart @@ -1,4 +1,4 @@ -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart index bfdc784219..a5995e1e52 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart index 1537024e9c..45633296ba 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart @@ -1,5 +1,5 @@ import 'package:appflowy/mobile/presentation/base/mobile_view_page.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class MobileBoardScreen extends StatelessWidget { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart index 4d72b4c800..bf0718e153 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart @@ -1,5 +1,5 @@ import 'package:appflowy/mobile/presentation/base/mobile_view_page.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class MobileCalendarScreen extends StatelessWidget { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart index 5045167c83..2ad4dfb3a1 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart @@ -1,5 +1,5 @@ import 'package:appflowy/mobile/presentation/base/mobile_view_page.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class MobileGridScreen extends StatelessWidget { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart index 15aeeeebc0..51b71bd3e3 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart @@ -11,7 +11,7 @@ import 'package:appflowy/plugins/database_view/application/setting/property_bloc import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart'; import 'package:appflowy/plugins/database_view/widgets/setting/field_visibility_extension.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart index 693ac83183..2f9794c94e 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart @@ -8,7 +8,7 @@ import 'package:appflowy/plugins/database_view/application/tab_bar_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart index 102a0e58fd..db70a58dd8 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart @@ -3,7 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/widgets/flowy_mobile_quick_action_button.dart'; import 'package:appflowy/plugins/database_view/application/database_controller.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart index 432daf83ca..10978f4fe9 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart @@ -9,7 +9,7 @@ import 'package:appflowy/plugins/database_view/application/layout/layout_service import 'package:appflowy/plugins/database_view/widgets/database_layout_ext.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart index 31bc880ae7..715d3e7256 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart @@ -1,5 +1,5 @@ import 'package:appflowy/mobile/presentation/base/mobile_view_page.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class MobileEditorScreen extends StatelessWidget { diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_folder.dart b/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_folder.dart index 07a36f2a47..5c19b3d6be 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_folder.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_folder.dart @@ -4,7 +4,7 @@ import 'package:appflowy/mobile/presentation/home/favorite_folder/mobile_home_fa import 'package:appflowy/mobile/presentation/widgets/flowy_mobile_state_container.dart'; import 'package:appflowy/workspace/application/favorite/favorite_bloc.dart'; import 'package:appflowy/workspace/application/menu/menu_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_page.dart index 5541588d10..5e58062c89 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/favorite/mobile_favorite_page.dart @@ -4,7 +4,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/auth/auth_service.dart'; import 'package:appflowy/workspace/presentation/home/errors/workspace_failed_screen.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder.dart index 18c1473956..b91c172910 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder.dart @@ -3,7 +3,7 @@ import 'package:appflowy/mobile/presentation/bottom_sheet/default_mobile_action_ import 'package:appflowy/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder_header.dart'; import 'package:appflowy/mobile/presentation/page_item/mobile_view_item.dart'; import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart index e3a6e40975..da58fb8f5c 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_folders.dart @@ -2,7 +2,7 @@ import 'package:appflowy/mobile/application/mobile_router.dart'; import 'package:appflowy/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart'; import 'package:appflowy/workspace/application/favorite/favorite_bloc.dart'; import 'package:appflowy/workspace/application/menu/menu_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart index d31e2e04ba..8502f768c1 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart @@ -8,7 +8,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/auth/auth_service.dart'; import 'package:appflowy/workspace/presentation/home/errors/workspace_failed_screen.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart index dbd0c24979..2f4a8e0735 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart @@ -4,7 +4,7 @@ import 'package:appflowy/mobile/presentation/home/personal_folder/mobile_home_pe import 'package:appflowy/mobile/presentation/page_item/mobile_view_item.dart'; import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_home_recent_views.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_home_recent_views.dart index 6b29cc8790..a7d06fdb4a 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_home_recent_views.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_home_recent_views.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/home/recent_folder/mobile_recent_view.dart'; import 'package:appflowy/workspace/application/recent/prelude.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart index b399c0eab9..2e91b577b5 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart @@ -8,8 +8,8 @@ import 'package:appflowy/workspace/application/doc/doc_listener.dart'; import 'package:appflowy/workspace/application/view/prelude.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/notifications/mobile_notifications_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/notifications/mobile_notifications_page.dart index 53d1a34ddd..d8102900f9 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/notifications/mobile_notifications_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/notifications/mobile_notifications_page.dart @@ -9,8 +9,8 @@ import 'package:appflowy/workspace/presentation/home/errors/workspace_failed_scr import 'package:appflowy/workspace/presentation/notifications/reminder_extension.dart'; import 'package:appflowy/workspace/presentation/notifications/widgets/inbox_action_bar.dart'; import 'package:appflowy/workspace/presentation/notifications/widgets/notification_view.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart b/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart index 4818112a3a..9f3b0fc324 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart @@ -7,7 +7,7 @@ import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/draggable_view_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart index eac02b04a9..6d134ba7f4 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_controller.dart @@ -9,7 +9,7 @@ import 'package:appflowy_backend/protobuf/flowy-database2/group_changeset.pb.dar import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:collection/collection.dart'; import 'dart:async'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart index d00efe9da9..1ce0d5f740 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/database_view_service.dart @@ -7,7 +7,7 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pb.da import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/group.pb.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/layout/layout_service.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/layout/layout_service.dart index 3ca3427f71..58f06d06a8 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/layout/layout_service.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/layout/layout_service.dart @@ -1,5 +1,5 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; ViewLayoutPB viewLayoutFromDatabaseLayout(DatabaseLayoutPB databaseLayout) { switch (databaseLayout) { diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/row/row_banner_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/row/row_banner_bloc.dart index e06bd21c21..21f689c5c8 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/row/row_banner_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/row/row_banner_bloc.dart @@ -4,7 +4,7 @@ import 'package:appflowy/plugins/database_view/application/row/row_service.dart' import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/share_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/share_bloc.dart index 5b498b9798..4abc77aef2 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/share_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/share_bloc.dart @@ -1,8 +1,8 @@ import 'dart:io'; import 'package:appflowy/workspace/application/settings/share/export_service.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/entities.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/entities.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/application/tab_bar_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/application/tab_bar_bloc.dart index 0105d86136..43bf4bb7bd 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/application/tab_bar_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/application/tab_bar_bloc.dart @@ -4,7 +4,7 @@ import 'package:appflowy/workspace/application/view/prelude.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide Log; import 'package:equatable/equatable.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart index a0bb0138b0..5dd29dc379 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/application/board_bloc.dart @@ -9,7 +9,7 @@ import 'package:appflowy_board/appflowy_board.dart'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart index 17aa09b788..95933f5635 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/board.dart @@ -2,7 +2,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart'; import 'package:appflowy/startup/plugin/plugin.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; class BoardPluginBuilder implements PluginBuilder { diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart index 99925c9fc9..f4e7156c8d 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/board/presentation/board_page.dart @@ -13,7 +13,7 @@ import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/ import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart'; import 'package:appflowy/plugins/database_view/widgets/row/row_detail.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_board/appflowy_board.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart index af01aeff62..0ff90f58ca 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_bloc.dart @@ -6,7 +6,7 @@ import 'package:appflowy/plugins/database_view/application/row/row_service.dart' import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:calendar_view/calendar_view.dart'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart index 10c2e5414c..ceaa19ec42 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/calendar.dart @@ -3,7 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart'; import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; class CalendarPluginBuilder extends PluginBuilder { @override diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart index cdb9530992..37e66b1824 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart @@ -10,7 +10,7 @@ import 'package:appflowy/plugins/database_view/calendar/application/unschedule_e import 'package:appflowy/plugins/database_view/grid/presentation/layout/sizes.dart'; import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/calendar_entities.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:calendar_view/calendar_view.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/grid_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/grid_bloc.dart index 4354a11716..a76e049ea7 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/grid_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/grid_bloc.dart @@ -7,7 +7,7 @@ import 'package:appflowy/plugins/database_view/grid/presentation/widgets/filter/ import 'package:appflowy/plugins/database_view/grid/presentation/widgets/sort/sort_info.dart'; import 'package:appflowy_backend/log.dart'; import 'package:dartz/dartz.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/row/row_document_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/row/row_document_bloc.dart index 9eedbbc7e9..998a30beb6 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/row/row_document_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/application/row/row_document_bloc.dart @@ -3,7 +3,7 @@ import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-error/code.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart index 06273bc471..0223d9a37e 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/grid.dart @@ -3,7 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart'; import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:easy_localization/easy_localization.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; class GridPluginBuilder implements PluginBuilder { @override diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart index 1178277f12..bda63ccb5a 100755 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/grid_page.dart @@ -11,7 +11,7 @@ import 'package:flowy_infra_ui/flowy_infra_ui_web.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_scroll_bar.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_scrollview.dart'; import 'package:flowy_infra_ui/widget/error_page.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter/material.dart'; import 'package:linked_scroll_controller/linked_scroll_controller.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/mobile_grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/mobile_grid_page.dart index 66bca1ec84..7ce9e2760d 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/mobile_grid_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/mobile_grid_page.dart @@ -9,7 +9,7 @@ import 'package:appflowy/plugins/database_view/grid/presentation/widgets/shortcu import 'package:appflowy/plugins/database_view/tab_bar/tab_bar_view.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:collection/collection.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/desktop/tab_bar_header.dart b/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/desktop/tab_bar_header.dart index 931355c216..456b43af15 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/desktop/tab_bar_header.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/desktop/tab_bar_header.dart @@ -4,7 +4,7 @@ import 'package:appflowy/plugins/database_view/application/tab_bar_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/presentation/widgets/dialogs.dart'; import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/size.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/mobile/mobile_tab_bar_header.dart b/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/mobile/mobile_tab_bar_header.dart index 2a35a385e8..edac4107ed 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/mobile/mobile_tab_bar_header.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/mobile/mobile_tab_bar_header.dart @@ -3,7 +3,7 @@ import 'package:appflowy/plugins/database_view/application/tab_bar_bloc.dart'; import 'package:appflowy/plugins/database_view/grid/presentation/layout/sizes.dart'; import 'package:appflowy/plugins/database_view/widgets/setting/mobile_database_controls.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:collection/collection.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/tab_bar_view.dart b/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/tab_bar_view.dart index ac716bb3f0..5cd6513633 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/tab_bar_view.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/tab_bar/tab_bar_view.dart @@ -7,7 +7,7 @@ import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:appflowy/workspace/presentation/home/home_stack.dart'; import 'package:appflowy/workspace/presentation/widgets/tab_bar_item.dart'; import 'package:appflowy/workspace/presentation/widgets/view_title_bar.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_layout_ext.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_layout_ext.dart index ed507e5ae6..4d79b2d075 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_layout_ext.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_layout_ext.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pbenum.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart'; import 'package:easy_localization/easy_localization.dart'; extension DatabaseLayoutExtension on DatabaseLayoutPB { diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_view_widget.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_view_widget.dart index 955baed317..46e866308b 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_view_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/database_view_widget.dart @@ -1,6 +1,6 @@ import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class DatabaseViewWidget extends StatefulWidget { diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_document.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_document.dart index b4d28f1b4a..7b7dcd29dc 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_document.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/row_document.dart @@ -4,7 +4,7 @@ import 'package:appflowy/plugins/document/application/doc_bloc.dart'; import 'package:appflowy/plugins/document/presentation/editor_page.dart'; import 'package:appflowy/plugins/document/presentation/editor_style.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/widget/error_page.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/share_button.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/share_button.dart index a334838c5c..2511fb8a2b 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/share_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/share_button.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/application/view/view_listener.dart'; import 'package:appflowy/workspace/presentation/home/toast.dart'; import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/file_picker/file_picker_service.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart index 5ad72b35fe..b39f5c01a1 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart @@ -7,9 +7,9 @@ import 'package:appflowy/plugins/trash/application/trash_service.dart'; import 'package:appflowy/workspace/application/doc/doc_listener.dart'; import 'package:appflowy/workspace/application/doc/sync_state_listener.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pbserver.dart'; import 'package:appflowy_editor/appflowy_editor.dart' show diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/doc_service.dart b/frontend/appflowy_flutter/lib/plugins/document/application/doc_service.dart index de13fb5ce4..5e17a1c1e1 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/doc_service.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/doc_service.dart @@ -1,7 +1,7 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/entities.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart'; class DocumentService { diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart b/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart index fc78ece99a..1c98b970f2 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/document_data_pb_extension.dart @@ -1,7 +1,7 @@ import 'dart:convert'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart' show Document, diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart b/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart index 666501c06b..f70b006a6f 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/editor_transaction_adapter.dart @@ -4,7 +4,7 @@ import 'dart:convert'; import 'package:appflowy/plugins/document/application/doc_service.dart'; import 'package:appflowy/plugins/document/application/document_data_pb_extension.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart' show EditorState, diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart index 9579c6ec75..c58f6622f4 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart @@ -1,9 +1,9 @@ import 'dart:io'; import 'package:appflowy/workspace/application/export/document_exporter.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/entities.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/document.dart b/frontend/appflowy_flutter/lib/plugins/document/document.dart index f93678caf8..7636e2d7d4 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/document.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/document.dart @@ -11,7 +11,7 @@ import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:appflowy/workspace/presentation/home/home_stack.dart'; import 'package:appflowy/workspace/presentation/widgets/tab_bar_item.dart'; import 'package:appflowy/workspace/presentation/widgets/view_title_bar.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart index d9548d7309..b91bb6b770 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart @@ -9,7 +9,7 @@ import 'package:appflowy/workspace/application/notifications/notification_action import 'package:appflowy/workspace/application/notifications/notification_action_bloc.dart'; import 'package:appflowy/workspace/application/view/prelude.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide Log; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/widget/error_page.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart index 780277ad15..00c7ad8bb4 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:dartz/dartz.dart' as dartz; import 'package:flowy_infra_ui/style_widget/text.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/insert_page_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/insert_page_command.dart index 759855e102..5ecd8ceb2d 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/insert_page_command.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/insert_page_command.dart @@ -4,7 +4,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/me import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart index fcc971665f..19c763051c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart @@ -4,7 +4,7 @@ import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy/workspace/presentation/widgets/dialogs.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart index 8797d6d5eb..60524ea95c 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart @@ -4,7 +4,7 @@ import 'package:appflowy/plugins/document/application/doc_bloc.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/base/insert_page_command.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/base/selectable_svg_widget.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/referenced_database_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/referenced_database_menu_item.dart index 5c7ca42d3f..3263f60291 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/referenced_database_menu_item.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/referenced_database_menu_item.dart @@ -2,7 +2,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/base/link_to_page_widget.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/base/selectable_svg_widget.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart index 2085baa682..53f680da6a 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart @@ -9,7 +9,7 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/header/emo import 'package:appflowy/plugins/document/presentation/editor_plugins/image/upload_image_menu.dart'; import 'package:appflowy/plugins/document/presentation/editor_style.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide UploadImageMenu; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:cached_network_image/cached_network_image.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart index 4b4c1b0a21..bcf01d3930 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; import 'package:appflowy/workspace/application/view/prelude.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart' show EditorState, SelectionUpdateReason; import 'package:collection/collection.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart index 3e36b370e0..7497a93379 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart @@ -5,9 +5,9 @@ import 'package:appflowy/util/string_extension.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; import 'package:appflowy/workspace/presentation/home/toast.dart'; import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/entities.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/entities.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/file_picker/file_picker_service.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart index e64d0d2a2b..60f12d89d3 100644 --- a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart @@ -1,6 +1,6 @@ import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/trash.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_listener.dart b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_listener.dart index cd187486f3..eddf355166 100644 --- a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_listener.dart +++ b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_listener.dart @@ -3,9 +3,9 @@ import 'dart:typed_data'; import 'package:appflowy/core/notification/folder_notification.dart'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/subject.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/trash.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; typedef TrashUpdatedCallback = void Function( diff --git a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_service.dart b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_service.dart index 718f7b01ae..96ae6be339 100644 --- a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_service.dart +++ b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_service.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/trash.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart'; class TrashService { Future> readTrash() { diff --git a/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart b/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart index bdba93eeee..4ae049dbb7 100644 --- a/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart +++ b/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart @@ -2,7 +2,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:flowy_infra_ui/style_widget/icon_button.dart'; import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/trash.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:fixnum/fixnum.dart' as $fixnum; diff --git a/frontend/appflowy_flutter/lib/plugins/util.dart b/frontend/appflowy_flutter/lib/plugins/util.dart index 75fea12158..4000ca8524 100644 --- a/frontend/appflowy_flutter/lib/plugins/util.dart +++ b/frontend/appflowy_flutter/lib/plugins/util.dart @@ -2,7 +2,7 @@ import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class ViewPluginNotifier extends PluginNotifier> { diff --git a/frontend/appflowy_flutter/lib/startup/deps_resolver.dart b/frontend/appflowy_flutter/lib/startup/deps_resolver.dart index a05f20d82e..94f7fcc808 100644 --- a/frontend/appflowy_flutter/lib/startup/deps_resolver.dart +++ b/frontend/appflowy_flutter/lib/startup/deps_resolver.dart @@ -29,7 +29,7 @@ import 'package:appflowy/workspace/application/view/prelude.dart'; import 'package:appflowy/workspace/application/workspace/prelude.dart'; import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide Log; import 'package:flowy_infra/file_picker/file_picker_impl.dart'; diff --git a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart index 5a2444e91f..55f7c062fa 100644 --- a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart +++ b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart @@ -4,7 +4,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/presentation/home/home_stack.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/widgets.dart'; export "./src/sandbox.dart"; diff --git a/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart b/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart index 92eeebde14..834bd67621 100644 --- a/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart +++ b/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart @@ -9,7 +9,7 @@ import 'package:appflowy/workspace/application/notifications/notification_action import 'package:appflowy/workspace/application/notifications/notification_action_bloc.dart'; import 'package:appflowy/workspace/application/notifications/notification_service.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:bloc/bloc.dart'; import 'package:collection/collection.dart'; diff --git a/frontend/appflowy_flutter/lib/user/application/user_listener.dart b/frontend/appflowy_flutter/lib/user/application/user_listener.dart index b744d91808..02e4f4b684 100644 --- a/frontend/appflowy_flutter/lib/user/application/user_listener.dart +++ b/frontend/appflowy_flutter/lib/user/application/user_listener.dart @@ -2,12 +2,12 @@ import 'dart:async'; import 'package:appflowy/core/notification/folder_notification.dart'; import 'package:appflowy/core/notification/user_notification.dart'; import 'package:dartz/dartz.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'dart:typed_data'; import 'package:flowy_infra/notifier.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/notification.pb.dart' as user; diff --git a/frontend/appflowy_flutter/lib/user/application/user_service.dart b/frontend/appflowy_flutter/lib/user/application/user_service.dart index b40d1702fa..ac76bf5234 100644 --- a/frontend/appflowy_flutter/lib/user/application/user_service.dart +++ b/frontend/appflowy_flutter/lib/user/application/user_service.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:dartz/dartz.dart'; import 'package:fixnum/fixnum.dart'; diff --git a/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart b/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart index 91b9e2e5fc..4847feed51 100644 --- a/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart +++ b/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart @@ -1,8 +1,8 @@ import 'package:appflowy/plugins/database_view/application/defines.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/helpers/handle_open_workspace_error.dart b/frontend/appflowy_flutter/lib/user/presentation/helpers/handle_open_workspace_error.dart index 61c4e360b5..f0c487cc33 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/helpers/handle_open_workspace_error.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/helpers/handle_open_workspace_error.dart @@ -3,7 +3,7 @@ import 'package:appflowy/user/application/auth/auth_service.dart'; import 'package:appflowy/user/presentation/router.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:flowy_infra_ui/style_widget/snap_bar.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/router.dart b/frontend/appflowy_flutter/lib/user/presentation/router.dart index 0d07ba678d..158d7a4a5a 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/router.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/router.dart @@ -6,7 +6,7 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart' show UserProfilePB; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart index 948914867a..b1654e2f0a 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart @@ -3,7 +3,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/auth/auth_service.dart'; import 'package:appflowy/workspace/presentation/widgets/dialogs.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/snap_bar.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart index c50ec25785..73d282b934 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart @@ -1,6 +1,6 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/workspace/application/workspace/prelude.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/mobile_workspace_start_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/mobile_workspace_start_screen.dart index d86b6c0fd0..9a3ec4f5ba 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/mobile_workspace_start_screen.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/mobile_workspace_start_screen.dart @@ -1,7 +1,7 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/workspace/application/workspace/prelude.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/widget/error_page.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/doc/doc_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/doc/doc_listener.dart index b7a1e2d285..fd35c01831 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/doc/doc_listener.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/doc/doc_listener.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:appflowy/core/notification/document_notification.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/subject.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/doc/sync_state_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/doc/sync_state_listener.dart index b02daf694a..37122fa31f 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/doc/sync_state_listener.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/doc/sync_state_listener.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:appflowy/core/notification/document_notification.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/subject.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/export/document_exporter.dart b/frontend/appflowy_flutter/lib/workspace/application/export/document_exporter.dart index 8ef3e3c2d4..e5cd875da1 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/export/document_exporter.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/export/document_exporter.dart @@ -5,7 +5,7 @@ import 'package:appflowy/plugins/document/application/document_data_pb_extension import 'package:appflowy/plugins/document/application/prelude.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/parsers/document_markdown_parsers.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:dartz/dartz.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart index 7a664cd3c3..18da724f2a 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart @@ -1,7 +1,7 @@ import 'package:appflowy/workspace/application/favorite/favorite_service.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_listener.dart index 6c002ab878..533f866764 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_listener.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_listener.dart @@ -2,8 +2,8 @@ import 'dart:async'; import 'package:appflowy/core/notification/folder_notification.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/subject.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_service.dart b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_service.dart index c43b3f5ebb..d88a617bce 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_service.dart @@ -1,6 +1,6 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:dartz/dartz.dart'; class FavoriteService { diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart index 09f8c7e71e..da218895da 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart @@ -1,8 +1,8 @@ import 'package:appflowy/user/application/user_listener.dart'; import 'package:flowy_infra/time/duration.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart' +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart' show WorkspaceSettingPB; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_service.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_service.dart index 9bfb40ca49..f8fcfbbb76 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/home/home_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_service.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart index 3277947aac..e8f616302d 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart @@ -1,7 +1,7 @@ import 'package:appflowy/user/application/user_listener.dart'; import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart'; import 'package:appflowy/workspace/application/edit_panel/edit_context.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart' +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart' show WorkspaceSettingPB; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart index c877ddab18..281b19f10f 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart @@ -4,7 +4,7 @@ import 'package:appflowy/workspace/application/workspace/workspace_listener.dart import 'package:appflowy/workspace/application/workspace/workspace_service.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart index 91ff439f27..5488208316 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart @@ -1,7 +1,7 @@ import 'package:appflowy/user/application/user_listener.dart'; import 'package:appflowy/user/application/user_service.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_listener.dart index e965f7fc99..763fcc9667 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_listener.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_listener.dart @@ -2,8 +2,8 @@ import 'dart:async'; import 'package:appflowy/core/notification/folder_notification.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/subject.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; import 'package:dartz/dartz.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_service.dart b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_service.dart index 147b663b59..0aea848572 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_service.dart @@ -1,6 +1,6 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:dartz/dartz.dart'; class RecentService { diff --git a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart index 8674ddde16..729a36fdf9 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart @@ -2,7 +2,7 @@ import 'package:appflowy/workspace/application/recent/recent_listener.dart'; import 'package:appflowy/workspace/application/recent/recent_service.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/setting_file_importer_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/setting_file_importer_bloc.dart index ede8a53a90..86adaf80fc 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/setting_file_importer_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/setting_file_importer_bloc.dart @@ -1,7 +1,7 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/import.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/import.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/settings_file_exporter_cubit.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/settings_file_exporter_cubit.dart index 430a95dd77..9d141db9ac 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/settings_file_exporter_cubit.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/settings_file_exporter_cubit.dart @@ -1,4 +1,4 @@ -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class SettingsFileExportState { diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart index ffb24288f3..5155aaae02 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart @@ -1,7 +1,7 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/import.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/import.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart'; import 'package:dartz/dartz.dart'; class ImportBackendService { diff --git a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart index 9f6f71817d..d7af85f1f2 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart @@ -4,7 +4,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/presentation/home/home_stack.dart'; import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:bloc/bloc.dart'; import 'package:flutter/foundation.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart index 60fc7c6455..a22cee33e8 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart @@ -8,7 +8,7 @@ import 'package:appflowy/workspace/application/recent/recent_service.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:collection/collection.dart'; import 'package:dartz/dartz.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart index ef7d015369..25ce626588 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart @@ -8,7 +8,7 @@ import 'package:appflowy/plugins/document/document.dart'; import 'package:appflowy/startup/plugin/plugin.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart' hide id; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart index fdb9bc593e..8c91548dfd 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart @@ -4,9 +4,9 @@ import 'package:appflowy/core/notification/folder_notification.dart'; import 'package:appflowy_backend/log.dart'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/protobuf/flowy-notification/subject.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; import 'package:appflowy_backend/rust_stream.dart'; // Delete the view from trash, which means the view was deleted permanently diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart index e8c3de5a52..e217196f71 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:dartz/dartz.dart'; class ViewBackendService { diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart index ef44c02592..33fbedd891 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart @@ -1,6 +1,6 @@ import 'package:appflowy/user/application/user_service.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart index 0e58bd86ba..bac9592fbb 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart @@ -1,14 +1,14 @@ import 'dart:async'; import 'dart:typed_data'; import 'package:appflowy/core/notification/folder_notification.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:dartz/dartz.dart'; import 'package:flowy_infra/notifier.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart' show UserProfilePB; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/notification.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/notification.pb.dart'; typedef AppListNotifyValue = Either, FlowyError>; typedef WorkspaceNotifyValue = Either; diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart index 3843469c87..ab2ff333a9 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart @@ -3,9 +3,9 @@ import 'dart:async'; import 'package:dartz/dartz.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart' +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart' show CreateViewPayloadPB, MoveViewPayloadPB, ViewLayoutPB, ViewPB; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; class WorkspaceService { final String workspaceId; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart index d198f06c4c..f8206306f1 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart @@ -17,7 +17,7 @@ import 'package:appflowy/workspace/presentation/widgets/edit_panel/panel_animati import 'package:appflowy/workspace/presentation/widgets/float_bubble/question_bubble.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart' show UserProfilePB; import 'package:flowy_infra_ui/style_widget/container.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart index 4aa2435341..ae17ec53e2 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart @@ -8,7 +8,7 @@ import 'package:appflowy/workspace/presentation/home/navigation.dart'; import 'package:appflowy/workspace/presentation/home/tabs/tabs_manager.dart'; import 'package:appflowy/workspace/presentation/home/toast.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart index c62741823b..9852eb710c 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart @@ -1,4 +1,4 @@ -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; class MenuSharedState { diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart index 5e99051cce..f56dc9098b 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart @@ -3,7 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/style_widget/button.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart index b272c0557e..38fd6566be 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart'; import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/rename_view_dialog.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart index 224d12f87d..317932fd6e 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/import/import_panel.dart @@ -8,7 +8,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/settings/share/import_service.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/import/import_type.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:flowy_infra/file_picker/file_picker_service.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart index d4064f1908..3981c9bfbf 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart @@ -10,8 +10,8 @@ import 'package:appflowy/workspace/presentation/home/menu/sidebar/sidebar_new_pa import 'package:appflowy/workspace/presentation/home/menu/sidebar/sidebar_top_menu.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/sidebar_trash.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/sidebar_user.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart' show UserProfilePB; import 'package:flowy_infra_ui/widget/spacing.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart index bdc926ba52..bdb8560b53 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart @@ -2,7 +2,7 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart'; import 'package:appflowy/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart index 31fece1055..5cf3e33145 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart @@ -7,7 +7,7 @@ import 'package:appflowy/workspace/presentation/notifications/widgets/notificati import 'package:appflowy/workspace/presentation/settings/settings_dialog.dart'; import 'package:appflowy/workspace/presentation/widgets/user_avatar.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart' show UserProfilePB; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart index cdda6bef11..2fcf4ce098 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/draggable_view_item.dart @@ -1,7 +1,7 @@ import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/presentation/widgets/draggable_item/draggable_item.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart' hide Log; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart index d50aa47efa..5519b43526 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart @@ -15,7 +15,7 @@ import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type. import 'package:appflowy/workspace/presentation/home/menu/view/view_add_button.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_more_action_button.dart'; import 'package:appflowy/workspace/presentation/widgets/dialogs.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_more_action_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_more_action_button.dart index ed6001a2f7..0cefde700e 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_more_action_button.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_more_action_button.dart @@ -1,6 +1,6 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/workspace/presentation/home/menu/view/view_action_type.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; import 'package:appflowy/workspace/presentation/widgets/pop_up_action.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/notification_dialog.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/notification_dialog.dart index cc37f57c33..c83d9bdf55 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/notification_dialog.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/notification_dialog.dart @@ -6,7 +6,7 @@ import 'package:appflowy/workspace/presentation/notifications/widgets/inbox_acti import 'package:appflowy/workspace/presentation/notifications/widgets/notification_hub_title.dart'; import 'package:appflowy/workspace/presentation/notifications/widgets/notification_tab_bar.dart'; import 'package:appflowy/workspace/presentation/notifications/widgets/notification_view.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/reminder.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart index 52cfb31ac0..90c118e5ea 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart @@ -3,7 +3,7 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/reminder/reminder_bloc.dart'; import 'package:appflowy/workspace/presentation/notifications/notification_dialog.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/theme_extension.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart index b8300cde23..29c03cb044 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart @@ -4,7 +4,7 @@ import 'package:appflowy/plugins/document/presentation/editor_configuration.dart import 'package:appflowy/plugins/document/presentation/editor_style.dart'; import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart'; import 'package:appflowy/workspace/application/settings/date_time/date_format_ext.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart index d33c449f55..267def3941 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart @@ -4,9 +4,9 @@ import 'package:appflowy/user/application/reminder/reminder_extension.dart'; import 'package:appflowy/user/application/reminder/reminder_bloc.dart'; import 'package:appflowy/workspace/presentation/notifications/widgets/notification_item.dart'; import 'package:appflowy/workspace/presentation/notifications/widgets/notifications_hub_empty.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/reminder.pb.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:collection/collection.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_exporter_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_exporter_widget.dart index 2f3e267168..6055f52182 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_exporter_widget.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_file_exporter_widget.dart @@ -8,8 +8,8 @@ import 'package:appflowy/workspace/presentation/home/toast.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:dartz/dartz.dart' as dartz; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/file_picker/file_picker_service.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/left_bar_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/left_bar_item.dart index b30e5ef931..4c142be09b 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/left_bar_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/left_bar_item.dart @@ -1,6 +1,6 @@ import 'package:appflowy/workspace/application/view/view_listener.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter/material.dart'; // TODO: Remove this file after the migration is done. diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart index 7a541c842e..7a8e91e60a 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart @@ -1,5 +1,5 @@ import 'package:appflowy/workspace/application/view/view_listener.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart index 4a985a6d87..d4f2d00368 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart @@ -5,7 +5,7 @@ import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy/workspace/application/view/view_listener.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/widget/flowy_tooltip.dart'; diff --git a/frontend/appflowy_flutter/packages/appflowy_backend/lib/dispatch/dispatch.dart b/frontend/appflowy_flutter/packages/appflowy_backend/lib/dispatch/dispatch.dart index 7881d8ab02..816ff76d02 100644 --- a/frontend/appflowy_flutter/packages/appflowy_backend/lib/dispatch/dispatch.dart +++ b/frontend/appflowy_flutter/packages/appflowy_backend/lib/dispatch/dispatch.dart @@ -13,9 +13,9 @@ import 'dart:typed_data'; import 'package:appflowy_backend/ffi.dart' as ffi; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:appflowy_backend/protobuf/dart-ffi/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:protobuf/protobuf.dart'; import 'dart:convert' show utf8; @@ -26,10 +26,10 @@ import 'error.dart'; import '../protobuf/flowy-date/entities.pb.dart'; import '../protobuf/flowy-date/event_map.pb.dart'; -part 'dart_event/flowy-folder2/dart_event.dart'; +part 'dart_event/flowy-folder/dart_event.dart'; part 'dart_event/flowy-user/dart_event.dart'; part 'dart_event/flowy-database2/dart_event.dart'; -part 'dart_event/flowy-document2/dart_event.dart'; +part 'dart_event/flowy-document/dart_event.dart'; part 'dart_event/flowy-config/dart_event.dart'; part 'dart_event/flowy-date/dart_event.dart'; diff --git a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart index f3174d442c..228423d7fe 100644 --- a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart +++ b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart @@ -10,7 +10,7 @@ import 'package:appflowy/plugins/database_view/board/board.dart'; import 'package:appflowy/plugins/database_view/grid/application/row/row_bloc.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import '../../util.dart'; import '../grid_test/util.dart'; diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart index a106fbc8f0..e8737f7570 100644 --- a/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart +++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/filter/filter_util.dart @@ -1,6 +1,6 @@ import 'package:appflowy/plugins/database_view/application/database_controller.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pbenum.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pbenum.dart'; import '../util.dart'; diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart index 37a213f70d..5cff4dff54 100644 --- a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart +++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart @@ -10,7 +10,7 @@ import 'package:appflowy/plugins/database_view/application/database_controller.d import 'package:appflowy/plugins/database_view/application/row/row_service.dart'; import 'package:appflowy/plugins/database_view/grid/application/row/row_bloc.dart'; import 'package:appflowy/workspace/application/view/view_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart'; import '../../util.dart'; diff --git a/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart b/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart index 04c23d51c3..b6101b719d 100644 --- a/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart +++ b/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart @@ -2,7 +2,7 @@ import 'package:appflowy/plugins/document/application/doc_bloc.dart'; import 'package:appflowy/workspace/application/home/home_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../util.dart'; diff --git a/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart b/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart index c72fbb6a8c..5fc2c546c2 100644 --- a/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart +++ b/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart @@ -1,6 +1,6 @@ import 'package:appflowy/plugins/trash/application/trash_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../util.dart'; diff --git a/frontend/appflowy_flutter/test/bloc_test/home_test/view_bloc_test.dart b/frontend/appflowy_flutter/test/bloc_test/home_test/view_bloc_test.dart index c4e4e78d8b..f70a8e5ec1 100644 --- a/frontend/appflowy_flutter/test/bloc_test/home_test/view_bloc_test.dart +++ b/frontend/appflowy_flutter/test/bloc_test/home_test/view_bloc_test.dart @@ -1,7 +1,7 @@ import 'package:appflowy/plugins/document/application/doc_bloc.dart'; import 'package:appflowy/workspace/application/view/view_bloc.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; import 'package:flutter_test/flutter_test.dart'; import '../../util.dart'; diff --git a/frontend/appflowy_flutter/test/unit_test/editor/transaction_adapter_test.dart b/frontend/appflowy_flutter/test/unit_test/editor/transaction_adapter_test.dart index 7f25a55353..93e27bc45b 100644 --- a/frontend/appflowy_flutter/test/unit_test/editor/transaction_adapter_test.dart +++ b/frontend/appflowy_flutter/test/unit_test/editor/transaction_adapter_test.dart @@ -1,5 +1,5 @@ import 'package:appflowy/plugins/document/application/editor_transaction_adapter.dart'; -import 'package:appflowy_backend/protobuf/flowy-document2/protobuf.dart'; +import 'package:appflowy_backend/protobuf/flowy-document/protobuf.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/frontend/appflowy_flutter/test/util.dart b/frontend/appflowy_flutter/test/util.dart index 014f45d08a..51326c7586 100644 --- a/frontend/appflowy_flutter/test/util.dart +++ b/frontend/appflowy_flutter/test/util.dart @@ -4,8 +4,8 @@ import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/auth/auth_service.dart'; import 'package:appflowy/user/application/user_service.dart'; import 'package:appflowy/workspace/application/workspace/workspace_service.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart'; -import 'package:appflowy_backend/protobuf/flowy-folder2/workspace.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'; +import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flutter/material.dart'; diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock index 3e6f25777d..041490f41a 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.lock +++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock @@ -1977,11 +1977,11 @@ dependencies = [ "flowy-database-deps", "flowy-database2", "flowy-date", + "flowy-document", "flowy-document-deps", - "flowy-document2", "flowy-error", + "flowy-folder", "flowy-folder-deps", - "flowy-folder2", "flowy-server", "flowy-server-config", "flowy-sqlite", @@ -2094,18 +2094,7 @@ dependencies = [ ] [[package]] -name = "flowy-document-deps" -version = "0.1.0" -dependencies = [ - "anyhow", - "collab", - "collab-document", - "flowy-error", - "lib-infra", -] - -[[package]] -name = "flowy-document2" +name = "flowy-document" version = "0.1.0" dependencies = [ "anyhow", @@ -2139,6 +2128,17 @@ dependencies = [ "validator", ] +[[package]] +name = "flowy-document-deps" +version = "0.1.0" +dependencies = [ + "anyhow", + "collab", + "collab-document", + "flowy-error", + "lib-infra", +] + [[package]] name = "flowy-encrypt" version = "0.1.0" @@ -2181,20 +2181,7 @@ dependencies = [ ] [[package]] -name = "flowy-folder-deps" -version = "0.1.0" -dependencies = [ - "anyhow", - "collab", - "collab-entity", - "collab-folder", - "flowy-error", - "lib-infra", - "uuid", -] - -[[package]] -name = "flowy-folder2" +name = "flowy-folder" version = "0.1.0" dependencies = [ "bytes", @@ -2224,6 +2211,19 @@ dependencies = [ "validator", ] +[[package]] +name = "flowy-folder-deps" +version = "0.1.0" +dependencies = [ + "anyhow", + "collab", + "collab-entity", + "collab-folder", + "flowy-error", + "lib-infra", + "uuid", +] + [[package]] name = "flowy-notification" version = "0.1.0" diff --git a/frontend/appflowy_tauri/src/appflowy_app/application/document/document.service.ts b/frontend/appflowy_tauri/src/appflowy_app/application/document/document.service.ts index 21efa47a1f..5a025a2f41 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/application/document/document.service.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/application/document/document.service.ts @@ -16,7 +16,7 @@ import { DocumentEventConvertDataToJSON, DocumentEventConvertDocument, DocumentEventOpenDocument, -} from '@/services/backend/events/flowy-document2'; +} from '@/services/backend/events/flowy-document'; import get from 'lodash-es/get'; import { EditorData, EditorNodeType } from '$app/application/document/document.types'; import { Log } from '$app/utils/log'; diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/auth/auth.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/auth/auth.hooks.ts index c5cb0691f4..e3afe55c2a 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/auth/auth.hooks.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/components/auth/auth.hooks.ts @@ -2,9 +2,9 @@ import { currentUserActions } from '../../stores/reducers/current-user/slice'; import { useAppDispatch, useAppSelector } from '../../stores/store'; import { UserProfilePB } from '../../../services/backend/events/flowy-user'; import { AuthBackendService, UserBackendService } from '../../stores/effects/user/user_bd_svc'; -import { WorkspaceSettingPB } from '../../../services/backend/models/flowy-folder2/workspace'; +import { WorkspaceSettingPB } from '../../../services/backend/models/flowy-folder/workspace'; import { Log } from '../../utils/log'; -import { FolderEventGetCurrentWorkspaceSetting } from '@/services/backend/events/flowy-folder2'; +import { FolderEventGetCurrentWorkspaceSetting } from '@/services/backend/events/flowy-folder'; export const useAuth = () => { const dispatch = useAppDispatch(); diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/database/application/database_view/database_view_service.ts b/frontend/appflowy_tauri/src/appflowy_app/components/database/application/database_view/database_view_service.ts index 7d8d41f611..87d99d9b75 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/database/application/database_view/database_view_service.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/components/database/application/database_view/database_view_service.ts @@ -4,7 +4,7 @@ import { FolderEventDeleteView, FolderEventGetView, FolderEventUpdateView, -} from '@/services/backend/events/flowy-folder2'; +} from '@/services/backend/events/flowy-folder'; import { databaseService } from '../database'; import { Page, parserViewPBToPage } from '$app_reducers/pages/slice'; diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts index bd049453e5..4060051597 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DatabaseTestHelper.ts @@ -17,7 +17,7 @@ import { TypeOptionController } from '$app/stores/effects/database/field/type_op import { makeSingleSelectTypeOptionContext } from '$app/stores/effects/database/field/type_option/type_option_context'; import { SelectOptionBackendService } from '$app/stores/effects/database/cell/select_option_bd_svc'; import { WorkspaceController } from '$app/stores/effects/workspace/workspace_controller'; -import { FolderEventGetCurrentWorkspaceSetting } from '@/services/backend/events/flowy-folder2'; +import { FolderEventGetCurrentWorkspaceSetting } from '@/services/backend/events/flowy-folder'; // Create a database page for specific layout type // Do not use it production code. Just for testing @@ -216,8 +216,7 @@ export async function createSingleSelectOptions(viewId: string, fieldInfo: Field assert(fieldInfo.field.field_type === FieldType.SingleSelect, 'Only work on single select'); const typeOptionController = new TypeOptionController(viewId, Some(fieldInfo)); const singleSelectTypeOptionContext = makeSingleSelectTypeOptionContext(typeOptionController); - const singleSelectTypeOptionPB: SingleSelectTypeOptionPB = singleSelectTypeOptionContext - .getTypeOption(); + const singleSelectTypeOptionPB: SingleSelectTypeOptionPB = singleSelectTypeOptionContext.getTypeOption(); const backendSvc = new SelectOptionBackendService(viewId, fieldInfo.field.id); diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts index c9d1f0af4d..895e28eee7 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/components/tests/DocumentTestHelper.ts @@ -1,6 +1,6 @@ import { ViewLayoutPB, WorkspaceSettingPB } from '@/services/backend'; import { WorkspaceController } from '../../stores/effects/workspace/workspace_controller'; -import { FolderEventGetCurrentWorkspaceSetting } from '@/services/backend/events/flowy-folder2'; +import { FolderEventGetCurrentWorkspaceSetting } from '@/services/backend/events/flowy-folder'; export async function createTestDocument() { const workspaceSetting: WorkspaceSettingPB = await FolderEventGetCurrentWorkspaceSetting().then((result) => diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts index 756a7314fd..33ece15fb8 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts @@ -31,7 +31,7 @@ import { ViewIdPB, OrderObjectPositionTypePB, } from '@/services/backend'; -import { FolderEventCloseView } from '@/services/backend/events/flowy-folder2'; +import { FolderEventCloseView } from '@/services/backend/events/flowy-folder'; import { TypeOptionController } from '$app/stores/effects/database/field/type_option/type_option_controller'; import { None } from 'ts-results'; @@ -64,11 +64,7 @@ export class DatabaseBackendService { /// 2.The row will be placed after the passed-in rowId /// 3.The row will be moved to the group with groupId. Currently, grouping is /// only support in kanban board. - createRow = async (params?: { - groupId?: string; - position?: OrderObjectPositionTypePB; - rowId?: string; - }) => { + createRow = async (params?: { groupId?: string; position?: OrderObjectPositionTypePB; rowId?: string }) => { const payload = CreateRowPayloadPB.fromObject({ view_id: this.viewId, row_position: { @@ -154,7 +150,11 @@ export class DatabaseBackendService { }; changeWidth = (params: { fieldId: string; width: number }) => { - const payload = FieldChangesetPB.fromObject({ view_id: this.viewId, field_id: params.fieldId, width: params.width }); + const payload = FieldChangesetPB.fromObject({ + view_id: this.viewId, + field_id: params.fieldId, + width: params.width, + }); return DatabaseEventUpdateField(payload); }; diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/user/user_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/user/user_bd_svc.ts index 932401fa1c..481c7de359 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/user/user_bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/user/user_bd_svc.ts @@ -22,7 +22,7 @@ import { FolderEventCreateWorkspace, FolderEventGetCurrentWorkspaceSetting, FolderEventReadCurrentWorkspace, -} from '@/services/backend/events/flowy-folder2'; +} from '@/services/backend/events/flowy-folder'; export class UserBackendService { constructor(public readonly userId: number) {} @@ -98,7 +98,7 @@ export class UserBackendService { export class AuthBackendService { signIn = (params: { email: string; password: string }) => { const payload = SignInPayloadPB.fromObject({ email: params.email, password: params.password }); - + return UserEventSignInWithEmailPassword(payload); }; diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/page/page_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/page/page_bd_svc.ts index 23bc06608e..6dc5752da0 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/page/page_bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/page/page_bd_svc.ts @@ -19,7 +19,7 @@ import { FolderEventCreateOrphanView, CreateOrphanViewPayloadPB, FolderEventGetView, -} from '@/services/backend/events/flowy-folder2'; +} from '@/services/backend/events/flowy-folder'; import { Page, PageIcon } from '$app_reducers/pages/slice'; export class PageBackendService { diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/trash/bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/trash/bd_svc.ts index 5f174d9eb7..e57d74107b 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/trash/bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/trash/bd_svc.ts @@ -6,7 +6,7 @@ import { FolderEventPermanentlyDeleteTrashItem, FolderEventPermanentlyDeleteAllTrashItem, FolderEventRecoverAllTrashItems, -} from '@/services/backend/events/flowy-folder2'; +} from '@/services/backend/events/flowy-folder'; export class TrashBackendService { constructor() { diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/workspace_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/workspace_bd_svc.ts index 1a5025412e..fc4d81f58b 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/workspace_bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/workspace/workspace_bd_svc.ts @@ -5,7 +5,7 @@ import { WorkspaceIdPB, FolderEventReadWorkspaceViews, FolderEventReadCurrentWorkspace, -} from '@/services/backend/events/flowy-folder2'; +} from '@/services/backend/events/flowy-folder'; import { UserEventOpenWorkspace, UserWorkspaceIdPB } from '@/services/backend/events/flowy-user'; export class WorkspaceBackendService { diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/current-user/slice.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/current-user/slice.ts index 1af3c3446e..8bb8d42b0e 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/current-user/slice.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/current-user/slice.ts @@ -1,5 +1,5 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { WorkspaceSettingPB } from '@/services/backend/models/flowy-folder2/workspace'; +import { WorkspaceSettingPB } from '@/services/backend/models/flowy-folder/workspace'; import { ThemeModePB as ThemeMode } from '@/services/backend'; export { ThemeMode }; diff --git a/frontend/appflowy_tauri/src/services/backend/index.ts b/frontend/appflowy_tauri/src/services/backend/index.ts index e4977d4665..9ee93aa123 100644 --- a/frontend/appflowy_tauri/src/services/backend/index.ts +++ b/frontend/appflowy_tauri/src/services/backend/index.ts @@ -1,7 +1,7 @@ -export * from './models/flowy-user'; -export * from './models/flowy-database2'; -export * from './models/flowy-folder2'; -export * from './models/flowy-document2'; -export * from './models/flowy-error'; -export * from './models/flowy-config'; -export * from './models/flowy-date'; +export * from "./models/flowy-user"; +export * from "./models/flowy-database2"; +export * from "./models/flowy-folder"; +export * from "./models/flowy-document"; +export * from "./models/flowy-error"; +export * from "./models/flowy-config"; +export * from "./models/flowy-date"; diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index c96eb4ddf4..f2d3ec4086 100644 --- a/frontend/rust-lib/Cargo.lock +++ b/frontend/rust-lib/Cargo.lock @@ -383,6 +383,15 @@ 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" @@ -1149,7 +1158,7 @@ dependencies = [ "cssparser-macros", "dtoa-short", "itoa", - "phf 0.8.0", + "phf 0.11.2", "smallvec", ] @@ -1579,11 +1588,11 @@ dependencies = [ "flowy-core", "flowy-database-deps", "flowy-database2", + "flowy-document", "flowy-document-deps", - "flowy-document2", "flowy-encrypt", + "flowy-folder", "flowy-folder-deps", - "flowy-folder2", "flowy-notification", "flowy-server", "flowy-server-config", @@ -1779,11 +1788,11 @@ dependencies = [ "flowy-database-deps", "flowy-database2", "flowy-date", + "flowy-document", "flowy-document-deps", - "flowy-document2", "flowy-error", + "flowy-folder", "flowy-folder-deps", - "flowy-folder2", "flowy-server", "flowy-server-config", "flowy-sqlite", @@ -1893,22 +1902,13 @@ dependencies = [ "quote", "serde_json", "syn 1.0.109", + "tokio", + "trybuild", "walkdir", ] [[package]] -name = "flowy-document-deps" -version = "0.1.0" -dependencies = [ - "anyhow", - "collab", - "collab-document", - "flowy-error", - "lib-infra", -] - -[[package]] -name = "flowy-document2" +name = "flowy-document" version = "0.1.0" dependencies = [ "anyhow", @@ -1944,6 +1944,17 @@ dependencies = [ "validator", ] +[[package]] +name = "flowy-document-deps" +version = "0.1.0" +dependencies = [ + "anyhow", + "collab", + "collab-document", + "flowy-error", + "lib-infra", +] + [[package]] name = "flowy-encrypt" version = "0.1.0" @@ -1986,21 +1997,7 @@ dependencies = [ ] [[package]] -name = "flowy-folder-deps" -version = "0.1.0" -dependencies = [ - "anyhow", - "collab", - "collab-entity", - "collab-folder", - "flowy-error", - "lib-infra", - "tokio", - "uuid", -] - -[[package]] -name = "flowy-folder2" +name = "flowy-folder" version = "0.1.0" dependencies = [ "bytes", @@ -2030,6 +2027,20 @@ dependencies = [ "validator", ] +[[package]] +name = "flowy-folder-deps" +version = "0.1.0" +dependencies = [ + "anyhow", + "collab", + "collab-entity", + "collab-folder", + "flowy-error", + "lib-infra", + "tokio", + "uuid", +] + [[package]] name = "flowy-notification" version = "0.1.0" @@ -3675,7 +3686,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", ] @@ -3695,6 +3706,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", ] @@ -3762,6 +3774,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" @@ -3965,7 +3990,7 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" dependencies = [ "bytes", "heck 0.4.1", - "itertools 0.10.5", + "itertools 0.11.0", "log", "multimap", "once_cell", @@ -3986,7 +4011,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", @@ -5431,6 +5456,15 @@ 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" @@ -5875,6 +5909,21 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "trybuild" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419ecd263363827c5730386f418715766f584e2f874d32c23c5b00bd9727e7e" +dependencies = [ + "basic-toml", + "glob", + "once_cell", + "serde", + "serde_derive", + "serde_json", + "termcolor", +] + [[package]] name = "tungstenite" version = "0.20.1" diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index 3ca3f0ae1c..6d6b5fa149 100644 --- a/frontend/rust-lib/Cargo.toml +++ b/frontend/rust-lib/Cargo.toml @@ -8,10 +8,10 @@ members = [ "flowy-user-deps", "event-integration", "flowy-sqlite", - "flowy-folder2", + "flowy-folder", "flowy-folder-deps", "flowy-notification", - "flowy-document2", + "flowy-document", "flowy-document-deps", "flowy-error", "flowy-database2", @@ -25,21 +25,29 @@ members = [ "collab-integrate", "flowy-ai", "flowy-date", + "lib-infra", + "build-tool/flowy-ast", + "build-tool/flowy-codegen", + "build-tool/flowy-derive", ] resolver = "2" [workspace.dependencies] lib-dispatch = { workspace = true, path = "lib-dispatch" } lib-log = { workspace = true, path = "lib-log" } +lib-infra= { workspace = true, path = "lib-infra" } +flowy-ast = { workspace = true, path = "build-tool/flowy-ast" } +flowy-codegen = { workspace = true, path = "build-tool/flowy-codegen" } +flowy-derive = { workspace = true, path = "build-tool/flowy-derive" } flowy-core = { workspace = true, path = "flowy-core" } dart-ffi = { workspace = true, path = "dart-ffi" } flowy-user = { workspace = true, path = "flowy-user" } flowy-user-deps = { workspace = true, path = "flowy-user-deps" } flowy-sqlite = { workspace = true, path = "flowy-sqlite" } -flowy-folder2 = { workspace = true, path = "flowy-folder2" } +flowy-folder = { workspace = true, path = "flowy-folder" } flowy-folder-deps = { workspace = true, path = "flowy-folder-deps" } flowy-notification = { workspace = true, path = "flowy-notification" } -flowy-document2 = { workspace = true, path = "flowy-document2" } +flowy-document = { workspace = true, path = "flowy-document" } flowy-document-deps = { workspace = true, path = "flowy-document-deps" } flowy-error = { workspace = true, path = "flowy-error" } flowy-database2 = { workspace = true, path = "flowy-database2" } diff --git a/shared-lib/flowy-ast/Cargo.toml b/frontend/rust-lib/build-tool/flowy-ast/Cargo.toml similarity index 100% rename from shared-lib/flowy-ast/Cargo.toml rename to frontend/rust-lib/build-tool/flowy-ast/Cargo.toml diff --git a/shared-lib/flowy-ast/src/ast.rs b/frontend/rust-lib/build-tool/flowy-ast/src/ast.rs similarity index 100% rename from shared-lib/flowy-ast/src/ast.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/ast.rs diff --git a/shared-lib/flowy-ast/src/ctxt.rs b/frontend/rust-lib/build-tool/flowy-ast/src/ctxt.rs similarity index 100% rename from shared-lib/flowy-ast/src/ctxt.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/ctxt.rs diff --git a/shared-lib/flowy-ast/src/event_attrs.rs b/frontend/rust-lib/build-tool/flowy-ast/src/event_attrs.rs similarity index 100% rename from shared-lib/flowy-ast/src/event_attrs.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/event_attrs.rs diff --git a/shared-lib/flowy-ast/src/lib.rs b/frontend/rust-lib/build-tool/flowy-ast/src/lib.rs similarity index 100% rename from shared-lib/flowy-ast/src/lib.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/lib.rs diff --git a/shared-lib/flowy-ast/src/node_attrs.rs b/frontend/rust-lib/build-tool/flowy-ast/src/node_attrs.rs similarity index 100% rename from shared-lib/flowy-ast/src/node_attrs.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/node_attrs.rs diff --git a/shared-lib/flowy-ast/src/pb_attrs.rs b/frontend/rust-lib/build-tool/flowy-ast/src/pb_attrs.rs similarity index 100% rename from shared-lib/flowy-ast/src/pb_attrs.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/pb_attrs.rs diff --git a/shared-lib/flowy-ast/src/symbol.rs b/frontend/rust-lib/build-tool/flowy-ast/src/symbol.rs similarity index 100% rename from shared-lib/flowy-ast/src/symbol.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/symbol.rs diff --git a/shared-lib/flowy-ast/src/ty_ext.rs b/frontend/rust-lib/build-tool/flowy-ast/src/ty_ext.rs similarity index 100% rename from shared-lib/flowy-ast/src/ty_ext.rs rename to frontend/rust-lib/build-tool/flowy-ast/src/ty_ext.rs diff --git a/shared-lib/flowy-codegen/Cargo.toml b/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml similarity index 97% rename from shared-lib/flowy-codegen/Cargo.toml rename to frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml index 4b713071a3..5873d00f15 100644 --- a/shared-lib/flowy-codegen/Cargo.toml +++ b/frontend/rust-lib/build-tool/flowy-codegen/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" log = "0.4.17" serde = { version = "1.0", features = ["derive"]} serde_json.workspace = true -flowy-ast = { path = "../flowy-ast"} +flowy-ast.workspace = true quote = "1.0" cmd_lib = { version = "1.3.0", optional = true } diff --git a/shared-lib/flowy-codegen/src/ast.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/ast.rs similarity index 100% rename from shared-lib/flowy-codegen/src/ast.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/ast.rs diff --git a/shared-lib/flowy-codegen/src/dart_event/dart_event.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/dart_event.rs similarity index 100% rename from shared-lib/flowy-codegen/src/dart_event/dart_event.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/dart_event.rs diff --git a/shared-lib/flowy-codegen/src/dart_event/event_template.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/event_template.rs similarity index 100% rename from shared-lib/flowy-codegen/src/dart_event/event_template.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/event_template.rs diff --git a/shared-lib/flowy-codegen/src/dart_event/event_template.tera b/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/event_template.tera similarity index 100% rename from shared-lib/flowy-codegen/src/dart_event/event_template.tera rename to frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/event_template.tera diff --git a/shared-lib/flowy-codegen/src/dart_event/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/mod.rs similarity index 100% rename from shared-lib/flowy-codegen/src/dart_event/mod.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/dart_event/mod.rs diff --git a/shared-lib/flowy-codegen/src/flowy_toml.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/flowy_toml.rs similarity index 100% rename from shared-lib/flowy-codegen/src/flowy_toml.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/flowy_toml.rs diff --git a/shared-lib/flowy-codegen/src/lib.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/lib.rs similarity index 100% rename from shared-lib/flowy-codegen/src/lib.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/lib.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/ast.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/ast.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/ast.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/ast.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs similarity index 99% rename from shared-lib/flowy-codegen/src/protobuf_file/mod.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs index d01dea5ed7..a3c20c225f 100644 --- a/shared-lib/flowy-codegen/src/protobuf_file/mod.rs +++ b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/mod.rs @@ -217,7 +217,7 @@ fn generate_dart_protobuf_files( .write(true) .append(false) .truncate(true) - .open(&protobuf_dart) + .open(Path::new(&protobuf_dart)) { Ok(ref mut file) => { let mut export = String::new(); diff --git a/shared-lib/flowy-codegen/src/protobuf_file/proto_gen.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_gen.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/proto_gen.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_gen.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/proto_info.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rs similarity index 98% rename from shared-lib/flowy-codegen/src/protobuf_file/proto_info.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rs index 1fea42dbd9..9eb7bbafb3 100644 --- a/shared-lib/flowy-codegen/src/protobuf_file/proto_info.rs +++ b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/proto_info.rs @@ -3,7 +3,7 @@ use crate::flowy_toml::{parse_crate_config_from, CrateConfig, FlowyConfig}; use crate::util::*; use std::fs::OpenOptions; use std::io::Write; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::str::FromStr; use walkdir::WalkDir; @@ -35,7 +35,7 @@ impl ProtobufCrateContext { .write(true) .append(false) .truncate(true) - .open(&mod_file_path) + .open(Path::new(&mod_file_path)) { Ok(ref mut file) => { file.write_all(content.as_bytes()).unwrap(); diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.tera b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.tera similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.tera rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/derive_meta/derive_meta.tera diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/derive_meta/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/derive_meta/mod.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/derive_meta/mod.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/derive_meta/mod.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/mod.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/mod.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/mod.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/enum.tera b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/enum.tera similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/enum.tera rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/enum.tera diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/enum_template.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/enum_template.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/enum_template.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/enum_template.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/mod.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/mod.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/mod.rs diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/struct.tera b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/struct.tera similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/struct.tera rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/struct.tera diff --git a/shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/struct_template.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/struct_template.rs similarity index 100% rename from shared-lib/flowy-codegen/src/protobuf_file/template/proto_file/struct_template.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/protobuf_file/template/proto_file/struct_template.rs diff --git a/shared-lib/flowy-codegen/src/ts_event/event_template.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/event_template.rs similarity index 100% rename from shared-lib/flowy-codegen/src/ts_event/event_template.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/event_template.rs diff --git a/shared-lib/flowy-codegen/src/ts_event/event_template.tera b/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/event_template.tera similarity index 100% rename from shared-lib/flowy-codegen/src/ts_event/event_template.tera rename to frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/event_template.tera diff --git a/shared-lib/flowy-codegen/src/ts_event/mod.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/mod.rs similarity index 100% rename from shared-lib/flowy-codegen/src/ts_event/mod.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/ts_event/mod.rs diff --git a/shared-lib/flowy-codegen/src/util.rs b/frontend/rust-lib/build-tool/flowy-codegen/src/util.rs similarity index 100% rename from shared-lib/flowy-codegen/src/util.rs rename to frontend/rust-lib/build-tool/flowy-codegen/src/util.rs diff --git a/shared-lib/flowy-derive/.gitignore b/frontend/rust-lib/build-tool/flowy-derive/.gitignore similarity index 100% rename from shared-lib/flowy-derive/.gitignore rename to frontend/rust-lib/build-tool/flowy-derive/.gitignore diff --git a/shared-lib/flowy-derive/Cargo.toml b/frontend/rust-lib/build-tool/flowy-derive/Cargo.toml similarity index 87% rename from shared-lib/flowy-derive/Cargo.toml rename to frontend/rust-lib/build-tool/flowy-derive/Cargo.toml index 2c2285987d..b03d889ba9 100644 --- a/shared-lib/flowy-derive/Cargo.toml +++ b/frontend/rust-lib/build-tool/flowy-derive/Cargo.toml @@ -17,10 +17,10 @@ path = "tests/progress.rs" syn = { version = "1.0.109", features = ["extra-traits", "visit"] } quote = "1.0" proc-macro2 = "1.0" -flowy-ast = { path = "../flowy-ast" } +flowy-ast.workspace = true lazy_static = {version = "1.4.0"} dashmap = "5" -flowy-codegen = { path = "../flowy-codegen"} +flowy-codegen.workspace = true serde_json.workspace = true walkdir = "2.3.2" diff --git a/shared-lib/flowy-derive/src/dart_event/mod.rs b/frontend/rust-lib/build-tool/flowy-derive/src/dart_event/mod.rs similarity index 100% rename from shared-lib/flowy-derive/src/dart_event/mod.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/dart_event/mod.rs diff --git a/shared-lib/flowy-derive/src/lib.rs b/frontend/rust-lib/build-tool/flowy-derive/src/lib.rs similarity index 100% rename from shared-lib/flowy-derive/src/lib.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/lib.rs diff --git a/shared-lib/flowy-derive/src/node/mod.rs b/frontend/rust-lib/build-tool/flowy-derive/src/node/mod.rs similarity index 100% rename from shared-lib/flowy-derive/src/node/mod.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/node/mod.rs diff --git a/shared-lib/flowy-derive/src/proto_buf/deserialize.rs b/frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/deserialize.rs similarity index 100% rename from shared-lib/flowy-derive/src/proto_buf/deserialize.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/deserialize.rs diff --git a/shared-lib/flowy-derive/src/proto_buf/enum_serde.rs b/frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/enum_serde.rs similarity index 100% rename from shared-lib/flowy-derive/src/proto_buf/enum_serde.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/enum_serde.rs diff --git a/shared-lib/flowy-derive/src/proto_buf/mod.rs b/frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/mod.rs similarity index 100% rename from shared-lib/flowy-derive/src/proto_buf/mod.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/mod.rs diff --git a/shared-lib/flowy-derive/src/proto_buf/serialize.rs b/frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/serialize.rs similarity index 100% rename from shared-lib/flowy-derive/src/proto_buf/serialize.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/serialize.rs diff --git a/shared-lib/flowy-derive/src/proto_buf/util.rs b/frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/util.rs similarity index 100% rename from shared-lib/flowy-derive/src/proto_buf/util.rs rename to frontend/rust-lib/build-tool/flowy-derive/src/proto_buf/util.rs diff --git a/shared-lib/flowy-derive/tests/progress.rs b/frontend/rust-lib/build-tool/flowy-derive/tests/progress.rs similarity index 100% rename from shared-lib/flowy-derive/tests/progress.rs rename to frontend/rust-lib/build-tool/flowy-derive/tests/progress.rs diff --git a/frontend/rust-lib/collab-integrate/Cargo.toml b/frontend/rust-lib/collab-integrate/Cargo.toml index 2011ef3869..716beacf2b 100644 --- a/frontend/rust-lib/collab-integrate/Cargo.toml +++ b/frontend/rust-lib/collab-integrate/Cargo.toml @@ -21,7 +21,7 @@ parking_lot.workspace = true futures.workspace = true async-trait.workspace = true tokio = { workspace = true, features = ["sync"]} -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } [features] default = ["rocksdb_plugin", "snapshot_plugin"] diff --git a/frontend/rust-lib/dart-ffi/Cargo.toml b/frontend/rust-lib/dart-ffi/Cargo.toml index 8e2caeb021..15fc8c1ba5 100644 --- a/frontend/rust-lib/dart-ffi/Cargo.toml +++ b/frontend/rust-lib/dart-ffi/Cargo.toml @@ -33,7 +33,7 @@ flowy-notification = { workspace = true } flowy-server = { workspace = true } flowy-server-config = { workspace = true} collab-integrate = { workspace = true } -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true serde_yaml = "0.9.27" [features] @@ -44,4 +44,4 @@ http_sync = ["flowy-core/http_sync", "flowy-core/use_bunyan"] openssl_vendored = ["flowy-core/openssl_vendored"] [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen", features = ["dart"] } +flowy-codegen = { workspace = true, features = ["dart"] } diff --git a/frontend/rust-lib/event-integration/Cargo.toml b/frontend/rust-lib/event-integration/Cargo.toml index 82a342568c..4e879b0c4e 100644 --- a/frontend/rust-lib/event-integration/Cargo.toml +++ b/frontend/rust-lib/event-integration/Cargo.toml @@ -9,15 +9,15 @@ edition = "2018" flowy-core = { workspace = true } flowy-user = { workspace = true } flowy-user-deps = { workspace = true } -flowy-folder2 = { path = "../flowy-folder2", features = ["test_helper"] } +flowy-folder = { path = "../flowy-folder", features = ["test_helper"] } flowy-folder-deps = { workspace = true } flowy-database2 = { path = "../flowy-database2" } flowy-database-deps = { workspace = true } -flowy-document2 = { path = "../flowy-document2" } +flowy-document = { path = "../flowy-document" } flowy-document-deps = { workspace = true } flowy-encrypt = { workspace = true } lib-dispatch = { workspace = true } -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-server = { path = "../flowy-server" } flowy-server-config = { workspace = true } flowy-notification = { workspace = true } diff --git a/frontend/rust-lib/event-integration/src/database_event.rs b/frontend/rust-lib/event-integration/src/database_event.rs index 78fe1c8d73..ff680af0dd 100644 --- a/frontend/rust-lib/event-integration/src/database_event.rs +++ b/frontend/rust-lib/event-integration/src/database_event.rs @@ -4,8 +4,8 @@ use bytes::Bytes; use flowy_database2::entities::*; use flowy_database2::event_map::DatabaseEvent; use flowy_database2::services::share::csv::CSVFormat; -use flowy_folder2::entities::*; -use flowy_folder2::event_map::FolderEvent; +use flowy_folder::entities::*; +use flowy_folder::event_map::FolderEvent; use flowy_user::errors::FlowyError; use crate::event_builder::EventBuilder; diff --git a/frontend/rust-lib/event-integration/src/document/document_event.rs b/frontend/rust-lib/event-integration/src/document/document_event.rs index 97246abcb4..e634c49f69 100644 --- a/frontend/rust-lib/event-integration/src/document/document_event.rs +++ b/frontend/rust-lib/event-integration/src/document/document_event.rs @@ -2,14 +2,14 @@ use std::collections::HashMap; use serde_json::Value; -use flowy_document2::entities::*; -use flowy_document2::event_map::DocumentEvent; -use flowy_document2::parser::parser_entities::{ +use flowy_document::entities::*; +use flowy_document::event_map::DocumentEvent; +use flowy_document::parser::parser_entities::{ ConvertDataToJsonPayloadPB, ConvertDataToJsonResponsePB, ConvertDocumentPayloadPB, ConvertDocumentResponsePB, }; -use flowy_folder2::entities::{CreateViewPayloadPB, ViewLayoutPB, ViewPB}; -use flowy_folder2::event_map::FolderEvent; +use flowy_folder::entities::{CreateViewPayloadPB, ViewLayoutPB, ViewPB}; +use flowy_folder::event_map::FolderEvent; use crate::document::utils::{gen_delta_str, gen_id, gen_text_block_data}; use crate::event_builder::EventBuilder; diff --git a/frontend/rust-lib/event-integration/src/document/utils.rs b/frontend/rust-lib/event-integration/src/document/utils.rs index b5ba9c8fe3..2199147ce6 100644 --- a/frontend/rust-lib/event-integration/src/document/utils.rs +++ b/frontend/rust-lib/event-integration/src/document/utils.rs @@ -1,5 +1,5 @@ use crate::document::document_event::*; -use flowy_document2::entities::*; +use flowy_document::entities::*; use nanoid::nanoid; use serde_json::json; use std::collections::HashMap; diff --git a/frontend/rust-lib/event-integration/src/document_event.rs b/frontend/rust-lib/event-integration/src/document_event.rs index c2bedb8b36..da839f09b6 100644 --- a/frontend/rust-lib/event-integration/src/document_event.rs +++ b/frontend/rust-lib/event-integration/src/document_event.rs @@ -8,10 +8,10 @@ use collab_document::blocks::DocumentData; use collab_document::document::Document; use collab_entity::CollabType; -use flowy_document2::entities::{DocumentDataPB, OpenDocumentPayloadPB}; -use flowy_document2::event_map::DocumentEvent; -use flowy_folder2::entities::{CreateViewPayloadPB, ViewLayoutPB, ViewPB}; -use flowy_folder2::event_map::FolderEvent; +use flowy_document::entities::{DocumentDataPB, OpenDocumentPayloadPB}; +use flowy_document::event_map::DocumentEvent; +use flowy_folder::entities::{CreateViewPayloadPB, ViewLayoutPB, ViewPB}; +use flowy_folder::event_map::FolderEvent; use crate::document::document_event::{DocumentEventTest, OpenDocumentData}; use crate::event_builder::EventBuilder; diff --git a/frontend/rust-lib/event-integration/src/folder_event.rs b/frontend/rust-lib/event-integration/src/folder_event.rs index 126ee7e20a..c5d1396396 100644 --- a/frontend/rust-lib/event-integration/src/folder_event.rs +++ b/frontend/rust-lib/event-integration/src/folder_event.rs @@ -1,7 +1,7 @@ -use flowy_folder2::entities::icon::UpdateViewIconPayloadPB; -use flowy_folder2::entities::*; -use flowy_folder2::event_map::FolderEvent; -use flowy_folder2::event_map::FolderEvent::*; +use flowy_folder::entities::icon::UpdateViewIconPayloadPB; +use flowy_folder::entities::*; +use flowy_folder::event_map::FolderEvent; +use flowy_folder::event_map::FolderEvent::*; use flowy_user::entities::{ AddWorkspaceMemberPB, QueryWorkspacePB, RemoveWorkspaceMemberPB, RepeatedWorkspaceMemberPB, WorkspaceMemberPB, diff --git a/frontend/rust-lib/event-integration/src/user_event.rs b/frontend/rust-lib/event-integration/src/user_event.rs index a87c4b07d5..1bcfd08f0b 100644 --- a/frontend/rust-lib/event-integration/src/user_event.rs +++ b/frontend/rust-lib/event-integration/src/user_event.rs @@ -3,8 +3,8 @@ use std::convert::TryFrom; use std::sync::Arc; use bytes::Bytes; -use flowy_folder2::entities::ImportAppFlowyDataPB; -use flowy_folder2::event_map::FolderEvent; +use flowy_folder::entities::ImportAppFlowyDataPB; +use flowy_folder::event_map::FolderEvent; use nanoid::nanoid; use protobuf::ProtobufError; use tokio::sync::broadcast::{channel, Sender}; diff --git a/frontend/rust-lib/event-integration/tests/database/supabase_test/helper.rs b/frontend/rust-lib/event-integration/tests/database/supabase_test/helper.rs index 0d4e5fa814..c067ef63b8 100644 --- a/frontend/rust-lib/event-integration/tests/database/supabase_test/helper.rs +++ b/frontend/rust-lib/event-integration/tests/database/supabase_test/helper.rs @@ -10,7 +10,7 @@ use collab_entity::CollabType; use event_integration::event_builder::EventBuilder; use flowy_database2::entities::{DatabasePB, DatabaseViewIdPB, RepeatedDatabaseSnapshotPB}; use flowy_database2::event_map::DatabaseEvent::*; -use flowy_folder2::entities::ViewPB; +use flowy_folder::entities::ViewPB; use crate::util::FlowySupabaseTest; diff --git a/frontend/rust-lib/event-integration/tests/document/af_cloud_test/edit_test.rs b/frontend/rust-lib/event-integration/tests/document/af_cloud_test/edit_test.rs index 9cad9f4b5e..95cdc52212 100644 --- a/frontend/rust-lib/event-integration/tests/document/af_cloud_test/edit_test.rs +++ b/frontend/rust-lib/event-integration/tests/document/af_cloud_test/edit_test.rs @@ -6,7 +6,7 @@ use event_integration::document_event::assert_document_data_equal; use event_integration::user_event::user_localhost_af_cloud; use event_integration::EventIntegrationTest; use flowy_core::DEFAULT_NAME; -use flowy_document2::entities::DocumentSyncStatePB; +use flowy_document::entities::DocumentSyncStatePB; use crate::util::{receive_with_timeout, unzip_history_user_db}; diff --git a/frontend/rust-lib/event-integration/tests/document/local_test/test.rs b/frontend/rust-lib/event-integration/tests/document/local_test/test.rs index 86cea38259..62b8de275b 100644 --- a/frontend/rust-lib/event-integration/tests/document/local_test/test.rs +++ b/frontend/rust-lib/event-integration/tests/document/local_test/test.rs @@ -1,8 +1,8 @@ use collab_document::blocks::json_str_to_hashmap; use event_integration::document::document_event::DocumentEventTest; use event_integration::document::utils::*; -use flowy_document2::entities::*; -use flowy_document2::parser::parser_entities::{ +use flowy_document::entities::*; +use flowy_document::parser::parser_entities::{ ConvertDataToJsonPayloadPB, ConvertDocumentPayloadPB, InputType, NestedBlock, ParseTypePB, }; use serde_json::{json, Value}; diff --git a/frontend/rust-lib/event-integration/tests/document/supabase_test/edit_test.rs b/frontend/rust-lib/event-integration/tests/document/supabase_test/edit_test.rs index a8eb08916c..f11b4acb7c 100644 --- a/frontend/rust-lib/event-integration/tests/document/supabase_test/edit_test.rs +++ b/frontend/rust-lib/event-integration/tests/document/supabase_test/edit_test.rs @@ -1,7 +1,7 @@ use std::time::Duration; use event_integration::document_event::assert_document_data_equal; -use flowy_document2::entities::DocumentSyncStatePB; +use flowy_document::entities::DocumentSyncStatePB; use crate::document::supabase_test::helper::FlowySupabaseDocumentTest; use crate::util::receive_with_timeout; diff --git a/frontend/rust-lib/event-integration/tests/document/supabase_test/helper.rs b/frontend/rust-lib/event-integration/tests/document/supabase_test/helper.rs index 26c51179fa..1b88f9aca4 100644 --- a/frontend/rust-lib/event-integration/tests/document/supabase_test/helper.rs +++ b/frontend/rust-lib/event-integration/tests/document/supabase_test/helper.rs @@ -1,9 +1,9 @@ use std::ops::Deref; use event_integration::event_builder::EventBuilder; -use flowy_document2::entities::{OpenDocumentPayloadPB, RepeatedDocumentSnapshotPB}; -use flowy_document2::event_map::DocumentEvent::GetDocumentSnapshots; -use flowy_folder2::entities::ViewPB; +use flowy_document::entities::{OpenDocumentPayloadPB, RepeatedDocumentSnapshotPB}; +use flowy_document::event_map::DocumentEvent::GetDocumentSnapshots; +use flowy_folder::entities::ViewPB; use crate::util::FlowySupabaseTest; diff --git a/frontend/rust-lib/event-integration/tests/folder/local_test/folder_test.rs b/frontend/rust-lib/event-integration/tests/folder/local_test/folder_test.rs index 9323e36a3d..fe4d64311f 100644 --- a/frontend/rust-lib/event-integration/tests/folder/local_test/folder_test.rs +++ b/frontend/rust-lib/event-integration/tests/folder/local_test/folder_test.rs @@ -1,6 +1,6 @@ use collab_folder::ViewLayout; -use flowy_folder2::entities::icon::{ViewIconPB, ViewIconTypePB}; +use flowy_folder::entities::icon::{ViewIconPB, ViewIconTypePB}; use crate::folder::local_test::script::FolderScript::*; use crate::folder::local_test::script::FolderTest; diff --git a/frontend/rust-lib/event-integration/tests/folder/local_test/script.rs b/frontend/rust-lib/event-integration/tests/folder/local_test/script.rs index 635d63039c..a43aafc144 100644 --- a/frontend/rust-lib/event-integration/tests/folder/local_test/script.rs +++ b/frontend/rust-lib/event-integration/tests/folder/local_test/script.rs @@ -2,9 +2,9 @@ use collab_folder::ViewLayout; use event_integration::event_builder::EventBuilder; use event_integration::EventIntegrationTest; -use flowy_folder2::entities::icon::{UpdateViewIconPayloadPB, ViewIconPB}; -use flowy_folder2::entities::*; -use flowy_folder2::event_map::FolderEvent::*; +use flowy_folder::entities::icon::{UpdateViewIconPayloadPB, ViewIconPB}; +use flowy_folder::entities::*; +use flowy_folder::event_map::FolderEvent::*; pub enum FolderScript { #[allow(dead_code)] diff --git a/frontend/rust-lib/event-integration/tests/folder/local_test/subscription_test.rs b/frontend/rust-lib/event-integration/tests/folder/local_test/subscription_test.rs index 6a82d9f9ab..90af905806 100644 --- a/frontend/rust-lib/event-integration/tests/folder/local_test/subscription_test.rs +++ b/frontend/rust-lib/event-integration/tests/folder/local_test/subscription_test.rs @@ -1,8 +1,8 @@ use std::time::Duration; use event_integration::EventIntegrationTest; -use flowy_folder2::entities::{ChildViewUpdatePB, RepeatedViewPB, UpdateViewPayloadPB}; -use flowy_folder2::notification::FolderNotification; +use flowy_folder::entities::{ChildViewUpdatePB, RepeatedViewPB, UpdateViewPayloadPB}; +use flowy_folder::notification::FolderNotification; use crate::util::receive_with_timeout; diff --git a/frontend/rust-lib/event-integration/tests/folder/local_test/test.rs b/frontend/rust-lib/event-integration/tests/folder/local_test/test.rs index 36b7e8c613..b227d98407 100644 --- a/frontend/rust-lib/event-integration/tests/folder/local_test/test.rs +++ b/frontend/rust-lib/event-integration/tests/folder/local_test/test.rs @@ -1,7 +1,7 @@ use event_integration::event_builder::EventBuilder; use event_integration::EventIntegrationTest; -use flowy_folder2::entities::icon::{UpdateViewIconPayloadPB, ViewIconPB, ViewIconTypePB}; -use flowy_folder2::entities::*; +use flowy_folder::entities::icon::{UpdateViewIconPayloadPB, ViewIconPB, ViewIconTypePB}; +use flowy_folder::entities::*; use flowy_user::errors::ErrorCode; #[tokio::test] @@ -12,7 +12,7 @@ async fn create_workspace_event_test() { desc: "".to_owned(), }; let resp = EventBuilder::new(test) - .event(flowy_folder2::event_map::FolderEvent::CreateWorkspace) + .event(flowy_folder::event_map::FolderEvent::CreateWorkspace) .payload(request) .async_send() .await @@ -30,22 +30,22 @@ async fn create_workspace_event_test() { // }; // // create a workspace // let resp_1 = EventBuilder::new(test.clone()) -// .event(flowy_folder2::event_map::FolderEvent::CreateWorkspace) +// .event(flowy_folder::event_map::FolderEvent::CreateWorkspace) // .payload(payload) // .async_send() // .await -// .parse::(); +// .parse::(); // // // open the workspace // let payload = WorkspaceIdPB { // value: Some(resp_1.id.clone()), // }; // let resp_2 = EventBuilder::new(test) -// .event(flowy_folder2::event_map::FolderEvent::OpenWorkspace) +// .event(flowy_folder::event_map::FolderEvent::OpenWorkspace) // .payload(payload) // .async_send() // .await -// .parse::(); +// .parse::(); // // assert_eq!(resp_1.id, resp_2.id); // assert_eq!(resp_1.name, resp_2.name); @@ -122,7 +122,7 @@ async fn delete_view_event_test() { value: view.id.clone(), }; let error = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::GetView) + .event(flowy_folder::event_map::FolderEvent::GetView) .payload(payload) .async_send() .await @@ -145,7 +145,7 @@ async fn put_back_trash_event_test() { value: view.id.clone(), }; let error = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::GetView) + .event(flowy_folder::event_map::FolderEvent::GetView) .payload(payload) .async_send() .await @@ -157,7 +157,7 @@ async fn put_back_trash_event_test() { id: view.id.clone(), }; EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::RestoreTrashItem) + .event(flowy_folder::event_map::FolderEvent::RestoreTrashItem) .payload(payload) .async_send() .await; @@ -166,7 +166,7 @@ async fn put_back_trash_event_test() { value: view.id.clone(), }; let error = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::GetView) + .event(flowy_folder::event_map::FolderEvent::GetView) .payload(payload) .async_send() .await @@ -187,16 +187,16 @@ async fn delete_view_permanently_event_test() { // delete the view. the view will be moved to trash EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::DeleteView) + .event(flowy_folder::event_map::FolderEvent::DeleteView) .payload(payload) .async_send() .await; let trash = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::ListTrashItems) + .event(flowy_folder::event_map::FolderEvent::ListTrashItems) .async_send() .await - .parse::() + .parse::() .items; assert_eq!(trash.len(), 1); assert_eq!(trash[0].id, view.id); @@ -208,17 +208,17 @@ async fn delete_view_permanently_event_test() { }], }; EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::PermanentlyDeleteTrashItem) + .event(flowy_folder::event_map::FolderEvent::PermanentlyDeleteTrashItem) .payload(payload) .async_send() .await; // After delete the last view, the trash should be empty let trash = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::ListTrashItems) + .event(flowy_folder::event_map::FolderEvent::ListTrashItems) .async_send() .await - .parse::() + .parse::() .items; assert!(trash.is_empty()); } @@ -237,32 +237,32 @@ async fn delete_all_trash_test() { }; // delete the view. the view will be moved to trash EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::DeleteView) + .event(flowy_folder::event_map::FolderEvent::DeleteView) .payload(payload) .async_send() .await; } let trash = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::ListTrashItems) + .event(flowy_folder::event_map::FolderEvent::ListTrashItems) .async_send() .await - .parse::() + .parse::() .items; assert_eq!(trash.len(), 3); // Delete all the trash EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::PermanentlyDeleteAllTrashItem) + .event(flowy_folder::event_map::FolderEvent::PermanentlyDeleteAllTrashItem) .async_send() .await; // After delete the last view, the trash should be empty let trash = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::ListTrashItems) + .event(flowy_folder::event_map::FolderEvent::ListTrashItems) .async_send() .await - .parse::() + .parse::() .items; assert!(trash.is_empty()); } @@ -323,11 +323,11 @@ async fn multiple_hierarchy_view_test() { }; let child = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::GetView) + .event(flowy_folder::event_map::FolderEvent::GetView) .payload(payload) .async_send() .await - .parse::(); + .parse::(); assert_eq!(child.name, format!("My {}-{} view", i + 1, j + 1)); assert_eq!(child.child_views.len(), 1); // By default only the first level of child views will be loaded @@ -370,7 +370,7 @@ async fn move_view_event_test() { to: 2, }; let _ = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::MoveView) + .event(flowy_folder::event_map::FolderEvent::MoveView) .payload(payload) .async_send() .await; @@ -411,7 +411,7 @@ async fn move_view_event_after_delete_view_test() { to: 3, }; let _ = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::MoveView) + .event(flowy_folder::event_map::FolderEvent::MoveView) .payload(payload) .async_send() .await; @@ -452,7 +452,7 @@ async fn move_view_event_after_delete_view_test2() { to: 2, }; let _ = EventBuilder::new(test.clone()) - .event(flowy_folder2::event_map::FolderEvent::MoveView) + .event(flowy_folder::event_map::FolderEvent::MoveView) .payload(payload) .async_send() .await; @@ -474,7 +474,7 @@ async fn create_parent_view_with_invalid_name() { }; assert_eq!( EventBuilder::new(sdk) - .event(flowy_folder2::event_map::FolderEvent::CreateWorkspace) + .event(flowy_folder::event_map::FolderEvent::CreateWorkspace) .payload(request) .async_send() .await @@ -551,7 +551,7 @@ async fn move_folder_nested_view( prev_view_id, }; EventBuilder::new(sdk) - .event(flowy_folder2::event_map::FolderEvent::MoveNestedView) + .event(flowy_folder::event_map::FolderEvent::MoveNestedView) .payload(payload) .async_send() .await; 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 7efcc153f7..863a41b137 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 @@ -9,8 +9,8 @@ use collab_entity::CollabType; use collab_folder::FolderData; use event_integration::event_builder::EventBuilder; -use flowy_folder2::entities::{FolderSnapshotPB, RepeatedFolderSnapshotPB, WorkspaceIdPB}; -use flowy_folder2::event_map::FolderEvent::GetFolderSnapshots; +use flowy_folder::entities::{FolderSnapshotPB, RepeatedFolderSnapshotPB, WorkspaceIdPB}; +use flowy_folder::event_map::FolderEvent::GetFolderSnapshots; use crate::util::FlowySupabaseTest; diff --git a/frontend/rust-lib/event-integration/tests/folder/supabase_test/test.rs b/frontend/rust-lib/event-integration/tests/folder/supabase_test/test.rs index 4ac2f54469..5f6a50988a 100644 --- a/frontend/rust-lib/event-integration/tests/folder/supabase_test/test.rs +++ b/frontend/rust-lib/event-integration/tests/folder/supabase_test/test.rs @@ -3,8 +3,8 @@ use std::time::Duration; use assert_json_diff::assert_json_eq; use serde_json::json; -use flowy_folder2::entities::{FolderSnapshotStatePB, FolderSyncStatePB}; -use flowy_folder2::notification::FolderNotification::DidUpdateFolderSnapshotState; +use flowy_folder::entities::{FolderSnapshotStatePB, FolderSyncStatePB}; +use flowy_folder::notification::FolderNotification::DidUpdateFolderSnapshotState; use crate::folder::supabase_test::helper::{assert_folder_collab_content, FlowySupabaseFolderTest}; use crate::util::{get_folder_data_from_server, receive_with_timeout}; diff --git a/frontend/rust-lib/event-integration/tests/user/migration_test/document_test.rs b/frontend/rust-lib/event-integration/tests/user/migration_test/document_test.rs index f15b5c3fdd..0d1aadc682 100644 --- a/frontend/rust-lib/event-integration/tests/user/migration_test/document_test.rs +++ b/frontend/rust-lib/event-integration/tests/user/migration_test/document_test.rs @@ -1,6 +1,6 @@ use event_integration::EventIntegrationTest; use flowy_core::DEFAULT_NAME; -use flowy_folder2::entities::ViewLayoutPB; +use flowy_folder::entities::ViewLayoutPB; use crate::util::unzip_history_user_db; diff --git a/frontend/rust-lib/event-integration/tests/user/migration_test/version_test.rs b/frontend/rust-lib/event-integration/tests/user/migration_test/version_test.rs index 5b38c29d0d..45ef9db26a 100644 --- a/frontend/rust-lib/event-integration/tests/user/migration_test/version_test.rs +++ b/frontend/rust-lib/event-integration/tests/user/migration_test/version_test.rs @@ -1,6 +1,6 @@ use event_integration::EventIntegrationTest; use flowy_core::DEFAULT_NAME; -use flowy_folder2::entities::ViewLayoutPB; +use flowy_folder::entities::ViewLayoutPB; use crate::util::unzip_history_user_db; diff --git a/frontend/rust-lib/event-integration/tests/user/supabase_test/workspace_test.rs b/frontend/rust-lib/event-integration/tests/user/supabase_test/workspace_test.rs index b63c9b47da..15f5f9dec1 100644 --- a/frontend/rust-lib/event-integration/tests/user/supabase_test/workspace_test.rs +++ b/frontend/rust-lib/event-integration/tests/user/supabase_test/workspace_test.rs @@ -1,8 +1,8 @@ use std::collections::HashMap; use event_integration::{event_builder::EventBuilder, EventIntegrationTest}; -use flowy_folder2::entities::WorkspaceSettingPB; -use flowy_folder2::event_map::FolderEvent::GetCurrentWorkspaceSetting; +use flowy_folder::entities::WorkspaceSettingPB; +use flowy_folder::event_map::FolderEvent::GetCurrentWorkspaceSetting; use flowy_server::supabase::define::{USER_EMAIL, USER_UUID}; use flowy_user::entities::{AuthenticatorPB, OauthSignInPB, UserProfilePB}; use flowy_user::event_map::UserEvent::*; diff --git a/frontend/rust-lib/flowy-ai/Cargo.toml b/frontend/rust-lib/flowy-ai/Cargo.toml index ece06cce6e..6a1f056c0c 100644 --- a/frontend/rust-lib/flowy-ai/Cargo.toml +++ b/frontend/rust-lib/flowy-ai/Cargo.toml @@ -10,7 +10,7 @@ reqwest = { version = "0.11", features = ["json"] } serde.workspace = true serde_json.workspace = true anyhow.workspace = true -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } async-openai = "0.14.2" tokio = { workspace = true, features = ["rt", "sync"] } dotenv = "0.15.0" \ No newline at end of file diff --git a/frontend/rust-lib/flowy-config/Cargo.toml b/frontend/rust-lib/flowy-config/Cargo.toml index a4fcf93da4..957071cc8f 100644 --- a/frontend/rust-lib/flowy-config/Cargo.toml +++ b/frontend/rust-lib/flowy-config/Cargo.toml @@ -11,13 +11,13 @@ flowy-sqlite = { workspace = true } lib-dispatch = { workspace = true } flowy-error = { workspace = true } -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true protobuf.workspace = true bytes.workspace = true strum_macros = "0.21" [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen"} +flowy-codegen.workspace = true [features] dart = ["flowy-codegen/dart"] diff --git a/frontend/rust-lib/flowy-core/Cargo.toml b/frontend/rust-lib/flowy-core/Cargo.toml index e89817c793..b8fa9719a7 100644 --- a/frontend/rust-lib/flowy-core/Cargo.toml +++ b/frontend/rust-lib/flowy-core/Cargo.toml @@ -10,12 +10,12 @@ lib-dispatch = { workspace = true } lib-log = { workspace = true } flowy-user = { workspace = true } flowy-user-deps = { workspace = true } -flowy-folder2 = { workspace = true } +flowy-folder = { workspace = true } flowy-folder-deps = { workspace = true } flowy-database2 = { workspace = true } flowy-database-deps = { workspace = true } flowy-sqlite = { workspace = true } -flowy-document2 = { workspace = true } +flowy-document = { workspace = true } flowy-document-deps = { workspace = true } flowy-error = { workspace = true } flowy-task = { workspace = true } @@ -43,7 +43,7 @@ parking_lot.workspace = true anyhow.workspace = true base64 = "0.21.5" -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } serde.workspace = true serde_json.workspace = true serde_repr.workspace = true @@ -59,17 +59,17 @@ use_bunyan = ["lib-log/use_bunyan"] dart = [ "flowy-user/dart", "flowy-date/dart", - "flowy-folder2/dart", + "flowy-folder/dart", "flowy-database2/dart", - "flowy-document2/dart", + "flowy-document/dart", "flowy-config/dart", ] ts = [ "flowy-user/ts", "flowy-date/ts", - "flowy-folder2/ts", + "flowy-folder/ts", "flowy-database2/ts", - "flowy-document2/ts", + "flowy-document/ts", "flowy-config/ts", ] rev-sqlite = ["flowy-user/rev-sqlite"] diff --git a/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs b/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs index ce9b2ae9da..1644db4994 100644 --- a/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs +++ b/frontend/rust-lib/flowy-core/src/deps_resolve/document_deps.rs @@ -3,7 +3,7 @@ use std::sync::{Arc, Weak}; use collab_integrate::collab_builder::AppFlowyCollabBuilder; use collab_integrate::RocksCollabDB; use flowy_database2::DatabaseManager; -use flowy_document2::manager::{DocumentManager, DocumentUser}; +use flowy_document::manager::{DocumentManager, DocumentUser}; use flowy_document_deps::cloud::DocumentCloudService; use flowy_error::FlowyError; use flowy_storage::FileStorageService; 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.rs index 004abf7a91..1c0fe2ab10 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 @@ -12,15 +12,15 @@ use flowy_database2::entities::DatabaseLayoutPB; use flowy_database2::services::share::csv::CSVFormat; use flowy_database2::template::{make_default_board, make_default_calendar, make_default_grid}; use flowy_database2::DatabaseManager; -use flowy_document2::entities::DocumentDataPB; -use flowy_document2::manager::DocumentManager; -use flowy_document2::parser::json::parser::JsonToDocumentParser; +use flowy_document::entities::DocumentDataPB; +use flowy_document::manager::DocumentManager; +use flowy_document::parser::json::parser::JsonToDocumentParser; use flowy_error::FlowyError; -use flowy_folder2::entities::ViewLayoutPB; -use flowy_folder2::manager::{FolderManager, FolderUser}; -use flowy_folder2::share::ImportType; -use flowy_folder2::view_operation::{FolderOperationHandler, FolderOperationHandlers, View}; -use flowy_folder2::ViewLayout; +use flowy_folder::entities::ViewLayoutPB; +use flowy_folder::manager::{FolderManager, FolderUser}; +use flowy_folder::share::ImportType; +use flowy_folder::view_operation::{FolderOperationHandler, FolderOperationHandlers, View}; +use flowy_folder::ViewLayout; use flowy_folder_deps::entities::ImportData; use flowy_folder_deps::folder_builder::{ParentChildViews, WorkspaceViewBuilder}; diff --git a/frontend/rust-lib/flowy-core/src/integrate/collab_interact.rs b/frontend/rust-lib/flowy-core/src/integrate/collab_interact.rs index 9e09b71224..4cd7b2ceed 100644 --- a/frontend/rust-lib/flowy-core/src/integrate/collab_interact.rs +++ b/frontend/rust-lib/flowy-core/src/integrate/collab_interact.rs @@ -3,8 +3,8 @@ use std::convert::TryFrom; use std::sync::Weak; use flowy_database2::DatabaseManager; -use flowy_document2::manager::DocumentManager; -use flowy_document2::reminder::{DocumentReminder, DocumentReminderAction}; +use flowy_document::manager::DocumentManager; +use flowy_document::reminder::{DocumentReminder, DocumentReminderAction}; use flowy_folder_deps::cloud::Error; use flowy_user::services::collab_interact::CollabInteract; use lib_infra::future::FutureResult; 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 d189b529ba..75fbec9ec2 100644 --- a/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs +++ b/frontend/rust-lib/flowy-core/src/integrate/trait_impls.rs @@ -15,7 +15,7 @@ use collab_integrate::collab_builder::{ }; use collab_integrate::postgres::SupabaseDBPlugin; use flowy_database_deps::cloud::{CollabDocStateByOid, DatabaseCloudService, DatabaseSnapshot}; -use flowy_document2::deps::DocumentData; +use flowy_document::deps::DocumentData; use flowy_document_deps::cloud::{DocumentCloudService, DocumentSnapshot}; use flowy_error::FlowyError; use flowy_folder_deps::cloud::{ diff --git a/frontend/rust-lib/flowy-core/src/integrate/user.rs b/frontend/rust-lib/flowy-core/src/integrate/user.rs index 07e52f9236..f1f1948496 100644 --- a/frontend/rust-lib/flowy-core/src/integrate/user.rs +++ b/frontend/rust-lib/flowy-core/src/integrate/user.rs @@ -6,9 +6,9 @@ use tracing::event; use collab_integrate::collab_builder::AppFlowyCollabBuilder; use flowy_database2::DatabaseManager; -use flowy_document2::manager::DocumentManager; +use flowy_document::manager::DocumentManager; use flowy_error::FlowyResult; -use flowy_folder2::manager::{FolderInitDataSource, FolderManager}; +use flowy_folder::manager::{FolderInitDataSource, FolderManager}; use flowy_user::event_map::UserStatusCallback; use flowy_user_deps::cloud::{UserCloudConfig, UserCloudServiceProvider}; use flowy_user_deps::entities::{Authenticator, UserProfile, UserWorkspace}; diff --git a/frontend/rust-lib/flowy-core/src/lib.rs b/frontend/rust-lib/flowy-core/src/lib.rs index 5db6f56783..f8e2c88ed6 100644 --- a/frontend/rust-lib/flowy-core/src/lib.rs +++ b/frontend/rust-lib/flowy-core/src/lib.rs @@ -9,8 +9,8 @@ use tracing::{debug, error, event, info, instrument}; use collab_integrate::collab_builder::{AppFlowyCollabBuilder, CollabPluginProviderType}; use flowy_database2::DatabaseManager; -use flowy_document2::manager::DocumentManager; -use flowy_folder2::manager::FolderManager; +use flowy_document::manager::DocumentManager; +use flowy_folder::manager::FolderManager; use flowy_sqlite::kv::StorePreferences; use flowy_storage::FileStorageService; use flowy_task::{TaskDispatcher, TaskRunner}; diff --git a/frontend/rust-lib/flowy-core/src/module.rs b/frontend/rust-lib/flowy-core/src/module.rs index 3699d74b85..ec90897670 100644 --- a/frontend/rust-lib/flowy-core/src/module.rs +++ b/frontend/rust-lib/flowy-core/src/module.rs @@ -1,8 +1,8 @@ use std::sync::Weak; use flowy_database2::DatabaseManager; -use flowy_document2::manager::DocumentManager as DocumentManager2; -use flowy_folder2::manager::FolderManager; +use flowy_document::manager::DocumentManager as DocumentManager2; +use flowy_folder::manager::FolderManager; use flowy_user::manager::UserManager; use lib_dispatch::prelude::AFPlugin; @@ -17,9 +17,9 @@ pub fn make_plugins( .map(|session| session.get_store_preferences()) .unwrap(); let user_plugin = flowy_user::event_map::init(user_session); - let folder_plugin = flowy_folder2::event_map::init(folder_manager); + let folder_plugin = flowy_folder::event_map::init(folder_manager); let database_plugin = flowy_database2::event_map::init(database_manager); - let document_plugin2 = flowy_document2::event_map::init(document_manager2); + let document_plugin2 = flowy_document::event_map::init(document_manager2); let config_plugin = flowy_config::event_map::init(store_preferences); let date_plugin = flowy_date::event_map::init(); vec![ diff --git a/frontend/rust-lib/flowy-database-deps/Cargo.toml b/frontend/rust-lib/flowy-database-deps/Cargo.toml index d3e22312d7..c9ed817703 100644 --- a/frontend/rust-lib/flowy-database-deps/Cargo.toml +++ b/frontend/rust-lib/flowy-database-deps/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-error = { workspace = true } collab-entity = { version = "0.1.0" } collab = { version = "0.1.0" } diff --git a/frontend/rust-lib/flowy-database2/Cargo.toml b/frontend/rust-lib/flowy-database2/Cargo.toml index 476a40c352..af99a6add9 100644 --- a/frontend/rust-lib/flowy-database2/Cargo.toml +++ b/frontend/rust-lib/flowy-database2/Cargo.toml @@ -12,7 +12,7 @@ collab-entity = { version = "0.1.0" } collab-integrate = { workspace = true } flowy-database-deps = { workspace = true } -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true flowy-notification = { workspace = true } parking_lot.workspace = true protobuf.workspace = true @@ -25,7 +25,7 @@ tracing.workspace = true serde.workspace = true serde_json.workspace = true serde_repr.workspace = true -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } chrono = { workspace = true, default-features = false, features = ["clock"] } rust_decimal = "1.28.1" rusty-money = {version = "0.4.1", features = ["iso"]} @@ -50,7 +50,7 @@ lru.workspace = true event-integration = { path = "../event-integration", default-features = false } [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen"} +flowy-codegen.workspace = true [features] diff --git a/frontend/rust-lib/flowy-date/Cargo.toml b/frontend/rust-lib/flowy-date/Cargo.toml index 61599c4787..43149bacb5 100644 --- a/frontend/rust-lib/flowy-date/Cargo.toml +++ b/frontend/rust-lib/flowy-date/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] lib-dispatch = { path = "../lib-dispatch" } flowy-error = { path = "../flowy-error" } -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true protobuf.workspace = true bytes.workspace = true strum_macros = "0.21" @@ -22,4 +22,4 @@ dart = ["flowy-codegen/dart"] ts = ["flowy-codegen/ts"] [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen" } +flowy-codegen.workspace = true diff --git a/frontend/rust-lib/flowy-document-deps/Cargo.toml b/frontend/rust-lib/flowy-document-deps/Cargo.toml index 7a04f8b9ea..c74aca434b 100644 --- a/frontend/rust-lib/flowy-document-deps/Cargo.toml +++ b/frontend/rust-lib/flowy-document-deps/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-error = { workspace = true } collab-document = { version = "0.1.0" } anyhow.workspace = true diff --git a/frontend/rust-lib/flowy-document2/Cargo.toml b/frontend/rust-lib/flowy-document/Cargo.toml similarity index 87% rename from frontend/rust-lib/flowy-document2/Cargo.toml rename to frontend/rust-lib/flowy-document/Cargo.toml index a7f21f8e22..2c0f00f7f5 100644 --- a/frontend/rust-lib/flowy-document2/Cargo.toml +++ b/frontend/rust-lib/flowy-document/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "flowy-document2" +name = "flowy-document" version = "0.1.0" edition = "2021" @@ -13,11 +13,11 @@ collab-integrate = { workspace = true, features = ["rocksdb_plugin", "snapshot_p flowy-document-deps = { workspace = true } flowy-storage = { workspace = true } -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true flowy-notification = { workspace = true } flowy-error = { path = "../flowy-error", features = ["impl_from_serde", "impl_from_sqlite", "impl_from_dispatch_error", "impl_from_collab"] } lib-dispatch = { workspace = true } -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } validator = "0.16.0" protobuf.workspace = true bytes.workspace = true @@ -42,7 +42,7 @@ tracing-subscriber = { version = "0.3.3", features = ["env-filter"] } collab-integrate = { workspace = true } [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen"} +flowy-codegen.workspace = true [features] dart = ["flowy-codegen/dart", "flowy-notification/dart"] diff --git a/frontend/rust-lib/flowy-document2/Flowy.toml b/frontend/rust-lib/flowy-document/Flowy.toml similarity index 100% rename from frontend/rust-lib/flowy-document2/Flowy.toml rename to frontend/rust-lib/flowy-document/Flowy.toml diff --git a/frontend/rust-lib/flowy-document2/build.rs b/frontend/rust-lib/flowy-document/build.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/build.rs rename to frontend/rust-lib/flowy-document/build.rs diff --git a/frontend/rust-lib/flowy-document2/src/deps.rs b/frontend/rust-lib/flowy-document/src/deps.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/deps.rs rename to frontend/rust-lib/flowy-document/src/deps.rs diff --git a/frontend/rust-lib/flowy-document2/src/document.rs b/frontend/rust-lib/flowy-document/src/document.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/document.rs rename to frontend/rust-lib/flowy-document/src/document.rs diff --git a/frontend/rust-lib/flowy-document2/src/document_data.rs b/frontend/rust-lib/flowy-document/src/document_data.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/document_data.rs rename to frontend/rust-lib/flowy-document/src/document_data.rs diff --git a/frontend/rust-lib/flowy-document2/src/entities.rs b/frontend/rust-lib/flowy-document/src/entities.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/entities.rs rename to frontend/rust-lib/flowy-document/src/entities.rs diff --git a/frontend/rust-lib/flowy-document2/src/event_handler.rs b/frontend/rust-lib/flowy-document/src/event_handler.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/event_handler.rs rename to frontend/rust-lib/flowy-document/src/event_handler.rs diff --git a/frontend/rust-lib/flowy-document2/src/event_map.rs b/frontend/rust-lib/flowy-document/src/event_map.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/event_map.rs rename to frontend/rust-lib/flowy-document/src/event_map.rs diff --git a/frontend/rust-lib/flowy-document2/src/lib.rs b/frontend/rust-lib/flowy-document/src/lib.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/lib.rs rename to frontend/rust-lib/flowy-document/src/lib.rs diff --git a/frontend/rust-lib/flowy-document2/src/manager.rs b/frontend/rust-lib/flowy-document/src/manager.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/manager.rs rename to frontend/rust-lib/flowy-document/src/manager.rs diff --git a/frontend/rust-lib/flowy-document2/src/notification.rs b/frontend/rust-lib/flowy-document/src/notification.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/notification.rs rename to frontend/rust-lib/flowy-document/src/notification.rs diff --git a/frontend/rust-lib/flowy-document2/src/parse.rs b/frontend/rust-lib/flowy-document/src/parse.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parse.rs rename to frontend/rust-lib/flowy-document/src/parse.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/constant.rs b/frontend/rust-lib/flowy-document/src/parser/constant.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/constant.rs rename to frontend/rust-lib/flowy-document/src/parser/constant.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/document_data_parser.rs b/frontend/rust-lib/flowy-document/src/parser/document_data_parser.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/document_data_parser.rs rename to frontend/rust-lib/flowy-document/src/parser/document_data_parser.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/external/mod.rs b/frontend/rust-lib/flowy-document/src/parser/external/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/external/mod.rs rename to frontend/rust-lib/flowy-document/src/parser/external/mod.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/external/parser.rs b/frontend/rust-lib/flowy-document/src/parser/external/parser.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/external/parser.rs rename to frontend/rust-lib/flowy-document/src/parser/external/parser.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/external/utils.rs b/frontend/rust-lib/flowy-document/src/parser/external/utils.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/external/utils.rs rename to frontend/rust-lib/flowy-document/src/parser/external/utils.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/json/block.rs b/frontend/rust-lib/flowy-document/src/parser/json/block.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/json/block.rs rename to frontend/rust-lib/flowy-document/src/parser/json/block.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/json/mod.rs b/frontend/rust-lib/flowy-document/src/parser/json/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/json/mod.rs rename to frontend/rust-lib/flowy-document/src/parser/json/mod.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/json/parser.rs b/frontend/rust-lib/flowy-document/src/parser/json/parser.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/json/parser.rs rename to frontend/rust-lib/flowy-document/src/parser/json/parser.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/mod.rs b/frontend/rust-lib/flowy-document/src/parser/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/mod.rs rename to frontend/rust-lib/flowy-document/src/parser/mod.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/parser_entities.rs b/frontend/rust-lib/flowy-document/src/parser/parser_entities.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/parser_entities.rs rename to frontend/rust-lib/flowy-document/src/parser/parser_entities.rs diff --git a/frontend/rust-lib/flowy-document2/src/parser/utils.rs b/frontend/rust-lib/flowy-document/src/parser/utils.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/parser/utils.rs rename to frontend/rust-lib/flowy-document/src/parser/utils.rs diff --git a/frontend/rust-lib/flowy-document2/src/reminder.rs b/frontend/rust-lib/flowy-document/src/reminder.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/src/reminder.rs rename to frontend/rust-lib/flowy-document/src/reminder.rs diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/bulleted_list.html b/frontend/rust-lib/flowy-document/tests/assets/html/bulleted_list.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/bulleted_list.html rename to frontend/rust-lib/flowy-document/tests/assets/html/bulleted_list.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/callout.html b/frontend/rust-lib/flowy-document/tests/assets/html/callout.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/callout.html rename to frontend/rust-lib/flowy-document/tests/assets/html/callout.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/code.html b/frontend/rust-lib/flowy-document/tests/assets/html/code.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/code.html rename to frontend/rust-lib/flowy-document/tests/assets/html/code.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/divider.html b/frontend/rust-lib/flowy-document/tests/assets/html/divider.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/divider.html rename to frontend/rust-lib/flowy-document/tests/assets/html/divider.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/google_docs.html b/frontend/rust-lib/flowy-document/tests/assets/html/google_docs.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/google_docs.html rename to frontend/rust-lib/flowy-document/tests/assets/html/google_docs.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/heading.html b/frontend/rust-lib/flowy-document/tests/assets/html/heading.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/heading.html rename to frontend/rust-lib/flowy-document/tests/assets/html/heading.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/image.html b/frontend/rust-lib/flowy-document/tests/assets/html/image.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/image.html rename to frontend/rust-lib/flowy-document/tests/assets/html/image.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/math_equation.html b/frontend/rust-lib/flowy-document/tests/assets/html/math_equation.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/math_equation.html rename to frontend/rust-lib/flowy-document/tests/assets/html/math_equation.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/notion.html b/frontend/rust-lib/flowy-document/tests/assets/html/notion.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/notion.html rename to frontend/rust-lib/flowy-document/tests/assets/html/notion.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/numbered_list.html b/frontend/rust-lib/flowy-document/tests/assets/html/numbered_list.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/numbered_list.html rename to frontend/rust-lib/flowy-document/tests/assets/html/numbered_list.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/paragraph.html b/frontend/rust-lib/flowy-document/tests/assets/html/paragraph.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/paragraph.html rename to frontend/rust-lib/flowy-document/tests/assets/html/paragraph.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/quote.html b/frontend/rust-lib/flowy-document/tests/assets/html/quote.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/quote.html rename to frontend/rust-lib/flowy-document/tests/assets/html/quote.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/simple.html b/frontend/rust-lib/flowy-document/tests/assets/html/simple.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/simple.html rename to frontend/rust-lib/flowy-document/tests/assets/html/simple.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/todo_list.html b/frontend/rust-lib/flowy-document/tests/assets/html/todo_list.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/todo_list.html rename to frontend/rust-lib/flowy-document/tests/assets/html/todo_list.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/html/toggle_list.html b/frontend/rust-lib/flowy-document/tests/assets/html/toggle_list.html similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/html/toggle_list.html rename to frontend/rust-lib/flowy-document/tests/assets/html/toggle_list.html diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/bulleted_list.json b/frontend/rust-lib/flowy-document/tests/assets/json/bulleted_list.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/bulleted_list.json rename to frontend/rust-lib/flowy-document/tests/assets/json/bulleted_list.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/callout.json b/frontend/rust-lib/flowy-document/tests/assets/json/callout.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/callout.json rename to frontend/rust-lib/flowy-document/tests/assets/json/callout.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/code.json b/frontend/rust-lib/flowy-document/tests/assets/json/code.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/code.json rename to frontend/rust-lib/flowy-document/tests/assets/json/code.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/divider.json b/frontend/rust-lib/flowy-document/tests/assets/json/divider.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/divider.json rename to frontend/rust-lib/flowy-document/tests/assets/json/divider.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/google_docs.json b/frontend/rust-lib/flowy-document/tests/assets/json/google_docs.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/google_docs.json rename to frontend/rust-lib/flowy-document/tests/assets/json/google_docs.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/heading.json b/frontend/rust-lib/flowy-document/tests/assets/json/heading.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/heading.json rename to frontend/rust-lib/flowy-document/tests/assets/json/heading.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/image.json b/frontend/rust-lib/flowy-document/tests/assets/json/image.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/image.json rename to frontend/rust-lib/flowy-document/tests/assets/json/image.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/initial_document.json b/frontend/rust-lib/flowy-document/tests/assets/json/initial_document.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/initial_document.json rename to frontend/rust-lib/flowy-document/tests/assets/json/initial_document.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/math_equation.json b/frontend/rust-lib/flowy-document/tests/assets/json/math_equation.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/math_equation.json rename to frontend/rust-lib/flowy-document/tests/assets/json/math_equation.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/notion.json b/frontend/rust-lib/flowy-document/tests/assets/json/notion.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/notion.json rename to frontend/rust-lib/flowy-document/tests/assets/json/notion.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/numbered_list.json b/frontend/rust-lib/flowy-document/tests/assets/json/numbered_list.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/numbered_list.json rename to frontend/rust-lib/flowy-document/tests/assets/json/numbered_list.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/paragraph.json b/frontend/rust-lib/flowy-document/tests/assets/json/paragraph.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/paragraph.json rename to frontend/rust-lib/flowy-document/tests/assets/json/paragraph.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/plain_text.json b/frontend/rust-lib/flowy-document/tests/assets/json/plain_text.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/plain_text.json rename to frontend/rust-lib/flowy-document/tests/assets/json/plain_text.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/quote.json b/frontend/rust-lib/flowy-document/tests/assets/json/quote.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/quote.json rename to frontend/rust-lib/flowy-document/tests/assets/json/quote.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/range_1.json b/frontend/rust-lib/flowy-document/tests/assets/json/range_1.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/range_1.json rename to frontend/rust-lib/flowy-document/tests/assets/json/range_1.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/range_2.json b/frontend/rust-lib/flowy-document/tests/assets/json/range_2.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/range_2.json rename to frontend/rust-lib/flowy-document/tests/assets/json/range_2.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/simple.json b/frontend/rust-lib/flowy-document/tests/assets/json/simple.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/simple.json rename to frontend/rust-lib/flowy-document/tests/assets/json/simple.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/todo_list.json b/frontend/rust-lib/flowy-document/tests/assets/json/todo_list.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/todo_list.json rename to frontend/rust-lib/flowy-document/tests/assets/json/todo_list.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/json/toggle_list.json b/frontend/rust-lib/flowy-document/tests/assets/json/toggle_list.json similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/json/toggle_list.json rename to frontend/rust-lib/flowy-document/tests/assets/json/toggle_list.json diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/bulleted_list.txt b/frontend/rust-lib/flowy-document/tests/assets/text/bulleted_list.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/bulleted_list.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/bulleted_list.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/callout.txt b/frontend/rust-lib/flowy-document/tests/assets/text/callout.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/callout.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/callout.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/code.txt b/frontend/rust-lib/flowy-document/tests/assets/text/code.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/code.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/code.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/divider.txt b/frontend/rust-lib/flowy-document/tests/assets/text/divider.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/divider.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/divider.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/heading.txt b/frontend/rust-lib/flowy-document/tests/assets/text/heading.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/heading.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/heading.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/image.txt b/frontend/rust-lib/flowy-document/tests/assets/text/image.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/image.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/image.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/math_equation.txt b/frontend/rust-lib/flowy-document/tests/assets/text/math_equation.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/math_equation.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/math_equation.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/numbered_list.txt b/frontend/rust-lib/flowy-document/tests/assets/text/numbered_list.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/numbered_list.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/numbered_list.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/paragraph.txt b/frontend/rust-lib/flowy-document/tests/assets/text/paragraph.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/paragraph.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/paragraph.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/plain_text.txt b/frontend/rust-lib/flowy-document/tests/assets/text/plain_text.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/plain_text.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/plain_text.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/quote.txt b/frontend/rust-lib/flowy-document/tests/assets/text/quote.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/quote.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/quote.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/todo_list.txt b/frontend/rust-lib/flowy-document/tests/assets/text/todo_list.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/todo_list.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/todo_list.txt diff --git a/frontend/rust-lib/flowy-document2/tests/assets/text/toggle_list.txt b/frontend/rust-lib/flowy-document/tests/assets/text/toggle_list.txt similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/assets/text/toggle_list.txt rename to frontend/rust-lib/flowy-document/tests/assets/text/toggle_list.txt diff --git a/frontend/rust-lib/flowy-document2/tests/document/document_insert_test.rs b/frontend/rust-lib/flowy-document/tests/document/document_insert_test.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/document/document_insert_test.rs rename to frontend/rust-lib/flowy-document/tests/document/document_insert_test.rs diff --git a/frontend/rust-lib/flowy-document2/tests/document/document_redo_undo_test.rs b/frontend/rust-lib/flowy-document/tests/document/document_redo_undo_test.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/document/document_redo_undo_test.rs rename to frontend/rust-lib/flowy-document/tests/document/document_redo_undo_test.rs diff --git a/frontend/rust-lib/flowy-document2/tests/document/document_test.rs b/frontend/rust-lib/flowy-document/tests/document/document_test.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/document/document_test.rs rename to frontend/rust-lib/flowy-document/tests/document/document_test.rs diff --git a/frontend/rust-lib/flowy-document2/tests/document/event_handler_test.rs b/frontend/rust-lib/flowy-document/tests/document/event_handler_test.rs similarity index 97% rename from frontend/rust-lib/flowy-document2/tests/document/event_handler_test.rs rename to frontend/rust-lib/flowy-document/tests/document/event_handler_test.rs index 770d7c6d93..cea8afd9ee 100644 --- a/frontend/rust-lib/flowy-document2/tests/document/event_handler_test.rs +++ b/frontend/rust-lib/flowy-document/tests/document/event_handler_test.rs @@ -1,4 +1,4 @@ -use flowy_document2::{ +use flowy_document::{ entities::{ConvertDataPayloadPB, ConvertType}, event_handler::convert_data_to_document_internal, }; diff --git a/frontend/rust-lib/flowy-document2/tests/document/mod.rs b/frontend/rust-lib/flowy-document/tests/document/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/document/mod.rs rename to frontend/rust-lib/flowy-document/tests/document/mod.rs diff --git a/frontend/rust-lib/flowy-document2/tests/document/util.rs b/frontend/rust-lib/flowy-document/tests/document/util.rs similarity index 97% rename from frontend/rust-lib/flowy-document2/tests/document/util.rs rename to frontend/rust-lib/flowy-document/tests/document/util.rs index d916bffe1b..96a1e61040 100644 --- a/frontend/rust-lib/flowy-document2/tests/document/util.rs +++ b/frontend/rust-lib/flowy-document/tests/document/util.rs @@ -18,8 +18,8 @@ use collab_integrate::collab_builder::{ CollabPluginProviderType, }; use collab_integrate::RocksCollabDB; -use flowy_document2::document::MutexDocument; -use flowy_document2::manager::{DocumentManager, DocumentUser}; +use flowy_document::document::MutexDocument; +use flowy_document::manager::{DocumentManager, DocumentUser}; use flowy_document_deps::cloud::*; use flowy_error::FlowyError; use flowy_storage::{FileStorageService, StorageObject}; diff --git a/frontend/rust-lib/flowy-document2/tests/main.rs b/frontend/rust-lib/flowy-document/tests/main.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/main.rs rename to frontend/rust-lib/flowy-document/tests/main.rs diff --git a/frontend/rust-lib/flowy-document2/tests/parser/document_data_parser_test.rs b/frontend/rust-lib/flowy-document/tests/parser/document_data_parser_test.rs similarity index 94% rename from frontend/rust-lib/flowy-document2/tests/parser/document_data_parser_test.rs rename to frontend/rust-lib/flowy-document/tests/parser/document_data_parser_test.rs index 084cbfe4cd..21f6997e95 100644 --- a/frontend/rust-lib/flowy-document2/tests/parser/document_data_parser_test.rs +++ b/frontend/rust-lib/flowy-document/tests/parser/document_data_parser_test.rs @@ -1,7 +1,7 @@ use collab_document::blocks::DocumentData; -use flowy_document2::parser::document_data_parser::DocumentDataParser; -use flowy_document2::parser::json::parser::JsonToDocumentParser; -use flowy_document2::parser::parser_entities::{NestedBlock, Range, Selection}; +use flowy_document::parser::document_data_parser::DocumentDataParser; +use flowy_document::parser::json::parser::JsonToDocumentParser; +use flowy_document::parser::parser_entities::{NestedBlock, Range, Selection}; use std::sync::Arc; #[tokio::test] diff --git a/frontend/rust-lib/flowy-document2/tests/parser/html/mod.rs b/frontend/rust-lib/flowy-document/tests/parser/html/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/parser/html/mod.rs rename to frontend/rust-lib/flowy-document/tests/parser/html/mod.rs diff --git a/frontend/rust-lib/flowy-document2/tests/parser/html/parser_test.rs b/frontend/rust-lib/flowy-document/tests/parser/html/parser_test.rs similarity index 90% rename from frontend/rust-lib/flowy-document2/tests/parser/html/parser_test.rs rename to frontend/rust-lib/flowy-document/tests/parser/html/parser_test.rs index a2fc95f7cb..ce1b4e1913 100644 --- a/frontend/rust-lib/flowy-document2/tests/parser/html/parser_test.rs +++ b/frontend/rust-lib/flowy-document/tests/parser/html/parser_test.rs @@ -1,5 +1,5 @@ -use flowy_document2::parser::external::parser::ExternalDataToNestedJSONParser; -use flowy_document2::parser::parser_entities::{InputType, NestedBlock}; +use flowy_document::parser::external::parser::ExternalDataToNestedJSONParser; +use flowy_document::parser::parser_entities::{InputType, NestedBlock}; macro_rules! generate_test_cases { ($($ty:ident),*) => { diff --git a/frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs b/frontend/rust-lib/flowy-document/tests/parser/json/block_test.rs similarity index 97% rename from frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs rename to frontend/rust-lib/flowy-document/tests/parser/json/block_test.rs index ea7c3f180a..82305e2579 100644 --- a/frontend/rust-lib/flowy-document2/tests/parser/json/block_test.rs +++ b/frontend/rust-lib/flowy-document/tests/parser/json/block_test.rs @@ -1,6 +1,6 @@ use serde_json::json; -use flowy_document2::parser::json::block::SerdeBlock; +use flowy_document::parser::json::block::SerdeBlock; #[test] fn test_empty_data_and_children() { diff --git a/frontend/rust-lib/flowy-document2/tests/parser/json/mod.rs b/frontend/rust-lib/flowy-document/tests/parser/json/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/parser/json/mod.rs rename to frontend/rust-lib/flowy-document/tests/parser/json/mod.rs diff --git a/frontend/rust-lib/flowy-document2/tests/parser/json/parser_test.rs b/frontend/rust-lib/flowy-document/tests/parser/json/parser_test.rs similarity index 97% rename from frontend/rust-lib/flowy-document2/tests/parser/json/parser_test.rs rename to frontend/rust-lib/flowy-document/tests/parser/json/parser_test.rs index 9849890470..096b4fd5ce 100644 --- a/frontend/rust-lib/flowy-document2/tests/parser/json/parser_test.rs +++ b/frontend/rust-lib/flowy-document/tests/parser/json/parser_test.rs @@ -1,5 +1,5 @@ use collab_document::blocks::json_str_to_hashmap; -use flowy_document2::parser::json::parser::JsonToDocumentParser; +use flowy_document::parser::json::parser::JsonToDocumentParser; use serde_json::json; #[test] diff --git a/frontend/rust-lib/flowy-document2/tests/parser/mod.rs b/frontend/rust-lib/flowy-document/tests/parser/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/parser/mod.rs rename to frontend/rust-lib/flowy-document/tests/parser/mod.rs diff --git a/frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/mod.rs b/frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/mod.rs rename to frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/mod.rs diff --git a/frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/test.rs b/frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/test.rs similarity index 100% rename from frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/test.rs rename to frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/test.rs diff --git a/frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/utils.rs b/frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/utils.rs similarity index 81% rename from frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/utils.rs rename to frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/utils.rs index 5484da9ede..759456c8c2 100644 --- a/frontend/rust-lib/flowy-document2/tests/parser/parse_to_html_text/utils.rs +++ b/frontend/rust-lib/flowy-document/tests/parser/parse_to_html_text/utils.rs @@ -1,5 +1,5 @@ -use flowy_document2::parser::document_data_parser::DocumentDataParser; -use flowy_document2::parser::json::parser::JsonToDocumentParser; +use flowy_document::parser::document_data_parser::DocumentDataParser; +use flowy_document::parser::json::parser::JsonToDocumentParser; use std::sync::Arc; pub fn assert_document_html_eq(source: &str, expect: &str) { diff --git a/frontend/rust-lib/flowy-error/Cargo.toml b/frontend/rust-lib/flowy-error/Cargo.toml index 8047ac5119..256909a3e8 100644 --- a/frontend/rust-lib/flowy-error/Cargo.toml +++ b/frontend/rust-lib/flowy-error/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true protobuf.workspace = true bytes.workspace = true anyhow.workspace = true @@ -45,6 +45,6 @@ dart = ["flowy-codegen/dart"] ts = ["flowy-codegen/ts"] [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen", features = [ +flowy-codegen = { workspace = true, features = [ "proto_gen", ] } diff --git a/frontend/rust-lib/flowy-folder-deps/Cargo.toml b/frontend/rust-lib/flowy-folder-deps/Cargo.toml index 7899afafdc..6513226950 100644 --- a/frontend/rust-lib/flowy-folder-deps/Cargo.toml +++ b/frontend/rust-lib/flowy-folder-deps/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-error = { workspace = true } collab-folder = { version = "0.1.0" } collab = { version = "0.1.0" } diff --git a/frontend/rust-lib/flowy-folder2/Cargo.toml b/frontend/rust-lib/flowy-folder/Cargo.toml similarity index 83% rename from frontend/rust-lib/flowy-folder2/Cargo.toml rename to frontend/rust-lib/flowy-folder/Cargo.toml index 75614567f3..ef37fe88cc 100644 --- a/frontend/rust-lib/flowy-folder2/Cargo.toml +++ b/frontend/rust-lib/flowy-folder/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "flowy-folder2" +name = "flowy-folder" version = "0.1.0" edition = "2021" @@ -12,7 +12,7 @@ collab-entity = { version = "0.1.0" } collab-integrate = { workspace = true } flowy-folder-deps = { workspace = true } -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true flowy-notification = { workspace = true } parking_lot.workspace = true unicode-segmentation = "1.10" @@ -20,7 +20,7 @@ tracing.workspace = true flowy-error = { path = "../flowy-error", features = ["impl_from_dispatch_error"]} lib-dispatch = { workspace = true } bytes.workspace = true -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } tokio = { workspace = true, features = ["full"] } nanoid = "0.4.0" lazy_static = "1.4.0" @@ -33,7 +33,7 @@ serde_json.workspace = true validator = "0.16.0" [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen"} +flowy-codegen.workspace = true [features] dart = ["flowy-codegen/dart", "flowy-notification/dart"] diff --git a/frontend/rust-lib/flowy-folder2/Flowy.toml b/frontend/rust-lib/flowy-folder/Flowy.toml similarity index 100% rename from frontend/rust-lib/flowy-folder2/Flowy.toml rename to frontend/rust-lib/flowy-folder/Flowy.toml diff --git a/frontend/rust-lib/flowy-folder2/build.rs b/frontend/rust-lib/flowy-folder/build.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/build.rs rename to frontend/rust-lib/flowy-folder/build.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/icon.rs b/frontend/rust-lib/flowy-folder/src/entities/icon.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/icon.rs rename to frontend/rust-lib/flowy-folder/src/entities/icon.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/import.rs b/frontend/rust-lib/flowy-folder/src/entities/import.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/import.rs rename to frontend/rust-lib/flowy-folder/src/entities/import.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/mod.rs b/frontend/rust-lib/flowy-folder/src/entities/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/mod.rs rename to frontend/rust-lib/flowy-folder/src/entities/mod.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/empty_str.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/empty_str.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/empty_str.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/empty_str.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/mod.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/mod.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/mod.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/trash/mod.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/trash/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/trash/mod.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/trash/mod.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/trash/trash_id.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/trash/trash_id.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/trash/trash_id.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/trash/trash_id.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/view/mod.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/view/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/view/mod.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/view/mod.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_desc.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/view/view_desc.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_desc.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/view/view_desc.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_id.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/view/view_id.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_id.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/view/view_id.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_name.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/view/view_name.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_name.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/view/view_name.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_thumbnail.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/view/view_thumbnail.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/view/view_thumbnail.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/view/view_thumbnail.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/mod.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/workspace/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/mod.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/workspace/mod.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/workspace_desc.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/workspace/workspace_desc.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/workspace_desc.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/workspace/workspace_desc.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/workspace_id.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/workspace/workspace_id.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/workspace_id.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/workspace/workspace_id.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/workspace_name.rs b/frontend/rust-lib/flowy-folder/src/entities/parser/workspace/workspace_name.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/parser/workspace/workspace_name.rs rename to frontend/rust-lib/flowy-folder/src/entities/parser/workspace/workspace_name.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/trash.rs b/frontend/rust-lib/flowy-folder/src/entities/trash.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/trash.rs rename to frontend/rust-lib/flowy-folder/src/entities/trash.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/view.rs b/frontend/rust-lib/flowy-folder/src/entities/view.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/view.rs rename to frontend/rust-lib/flowy-folder/src/entities/view.rs diff --git a/frontend/rust-lib/flowy-folder2/src/entities/workspace.rs b/frontend/rust-lib/flowy-folder/src/entities/workspace.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/entities/workspace.rs rename to frontend/rust-lib/flowy-folder/src/entities/workspace.rs diff --git a/frontend/rust-lib/flowy-folder2/src/event_handler.rs b/frontend/rust-lib/flowy-folder/src/event_handler.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/event_handler.rs rename to frontend/rust-lib/flowy-folder/src/event_handler.rs diff --git a/frontend/rust-lib/flowy-folder2/src/event_map.rs b/frontend/rust-lib/flowy-folder/src/event_map.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/event_map.rs rename to frontend/rust-lib/flowy-folder/src/event_map.rs diff --git a/frontend/rust-lib/flowy-folder2/src/lib.rs b/frontend/rust-lib/flowy-folder/src/lib.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/lib.rs rename to frontend/rust-lib/flowy-folder/src/lib.rs diff --git a/frontend/rust-lib/flowy-folder2/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/manager.rs rename to frontend/rust-lib/flowy-folder/src/manager.rs diff --git a/frontend/rust-lib/flowy-folder2/src/manager_init.rs b/frontend/rust-lib/flowy-folder/src/manager_init.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/manager_init.rs rename to frontend/rust-lib/flowy-folder/src/manager_init.rs diff --git a/frontend/rust-lib/flowy-folder2/src/manager_observer.rs b/frontend/rust-lib/flowy-folder/src/manager_observer.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/manager_observer.rs rename to frontend/rust-lib/flowy-folder/src/manager_observer.rs diff --git a/frontend/rust-lib/flowy-folder2/src/notification.rs b/frontend/rust-lib/flowy-folder/src/notification.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/notification.rs rename to frontend/rust-lib/flowy-folder/src/notification.rs diff --git a/frontend/rust-lib/flowy-folder2/src/share/import.rs b/frontend/rust-lib/flowy-folder/src/share/import.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/share/import.rs rename to frontend/rust-lib/flowy-folder/src/share/import.rs diff --git a/frontend/rust-lib/flowy-folder2/src/share/mod.rs b/frontend/rust-lib/flowy-folder/src/share/mod.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/share/mod.rs rename to frontend/rust-lib/flowy-folder/src/share/mod.rs diff --git a/frontend/rust-lib/flowy-folder2/src/test_helper.rs b/frontend/rust-lib/flowy-folder/src/test_helper.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/test_helper.rs rename to frontend/rust-lib/flowy-folder/src/test_helper.rs diff --git a/frontend/rust-lib/flowy-folder2/src/user_default.rs b/frontend/rust-lib/flowy-folder/src/user_default.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/user_default.rs rename to frontend/rust-lib/flowy-folder/src/user_default.rs diff --git a/frontend/rust-lib/flowy-folder2/src/util.rs b/frontend/rust-lib/flowy-folder/src/util.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/util.rs rename to frontend/rust-lib/flowy-folder/src/util.rs diff --git a/frontend/rust-lib/flowy-folder2/src/view_operation.rs b/frontend/rust-lib/flowy-folder/src/view_operation.rs similarity index 100% rename from frontend/rust-lib/flowy-folder2/src/view_operation.rs rename to frontend/rust-lib/flowy-folder/src/view_operation.rs diff --git a/frontend/rust-lib/flowy-notification/Cargo.toml b/frontend/rust-lib/flowy-notification/Cargo.toml index ef8886cd28..18f9dd283e 100644 --- a/frontend/rust-lib/flowy-notification/Cargo.toml +++ b/frontend/rust-lib/flowy-notification/Cargo.toml @@ -12,11 +12,11 @@ tracing.workspace = true bytes.workspace = true serde.workspace = true -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true lib-dispatch = { workspace = true } [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen" } +flowy-codegen.workspace = true [features] dart = ["flowy-codegen/dart"] diff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.toml index c6ca7b826c..24322f300e 100644 --- a/frontend/rust-lib/flowy-server/Cargo.toml +++ b/frontend/rust-lib/flowy-server/Cargo.toml @@ -30,7 +30,7 @@ collab-document = { version = "0.1.0" } collab-entity = { version = "0.1.0" } hex = "0.4.3" postgrest = "1.0" -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-user-deps = { workspace = true } flowy-folder-deps = { workspace = true } flowy-database-deps = { workspace = true } diff --git a/frontend/rust-lib/flowy-storage/Cargo.toml b/frontend/rust-lib/flowy-storage/Cargo.toml index 3fef485446..73c68222e1 100644 --- a/frontend/rust-lib/flowy-storage/Cargo.toml +++ b/frontend/rust-lib/flowy-storage/Cargo.toml @@ -12,6 +12,6 @@ serde.workspace = true async-trait.workspace = true bytes.workspace = true mime_guess = "2.0" -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } url = "2.2.2" flowy-error = { workspace = true, features = ["impl_from_reqwest"] } diff --git a/frontend/rust-lib/flowy-task/Cargo.toml b/frontend/rust-lib/flowy-task/Cargo.toml index e28795eff2..2507f37708 100644 --- a/frontend/rust-lib/flowy-task/Cargo.toml +++ b/frontend/rust-lib/flowy-task/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } tokio = { workspace = true, features = ["sync", "macros", ]} atomic_refcell = "0.1.9" anyhow.workspace = true diff --git a/frontend/rust-lib/flowy-user-deps/Cargo.toml b/frontend/rust-lib/flowy-user-deps/Cargo.toml index 1c48493c07..efa53d2960 100644 --- a/frontend/rust-lib/flowy-user-deps/Cargo.toml +++ b/frontend/rust-lib/flowy-user-deps/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-error = { workspace = true } uuid.workspace = true serde.workspace = true diff --git a/frontend/rust-lib/flowy-user/Cargo.toml b/frontend/rust-lib/flowy-user/Cargo.toml index ca3cc39412..64bed114c4 100644 --- a/frontend/rust-lib/flowy-user/Cargo.toml +++ b/frontend/rust-lib/flowy-user/Cargo.toml @@ -6,12 +6,12 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -flowy-derive = { path = "../../../shared-lib/flowy-derive" } +flowy-derive.workspace = true flowy-sqlite = { workspace = true, optional = true } flowy-encrypt = { workspace = true } flowy-error = { workspace = true, features = ["impl_from_sqlite", "impl_from_dispatch_error"] } flowy-folder-deps = { workspace = true } -lib-infra = { path = "../../../shared-lib/lib-infra" } +lib-infra = { workspace = true } flowy-notification = { workspace = true } flowy-server-config = { workspace = true } lib-dispatch = { workspace = true } @@ -61,4 +61,4 @@ dart = ["flowy-codegen/dart", "flowy-notification/dart"] ts = ["flowy-codegen/ts", "flowy-notification/ts"] [build-dependencies] -flowy-codegen = { path = "../../../shared-lib/flowy-codegen" } +flowy-codegen.workspace = true diff --git a/shared-lib/lib-infra/Cargo.toml b/frontend/rust-lib/lib-infra/Cargo.toml similarity index 100% rename from shared-lib/lib-infra/Cargo.toml rename to frontend/rust-lib/lib-infra/Cargo.toml diff --git a/shared-lib/lib-infra/src/box_any.rs b/frontend/rust-lib/lib-infra/src/box_any.rs similarity index 100% rename from shared-lib/lib-infra/src/box_any.rs rename to frontend/rust-lib/lib-infra/src/box_any.rs diff --git a/shared-lib/lib-infra/src/file_util.rs b/frontend/rust-lib/lib-infra/src/file_util.rs similarity index 100% rename from shared-lib/lib-infra/src/file_util.rs rename to frontend/rust-lib/lib-infra/src/file_util.rs diff --git a/shared-lib/lib-infra/src/future.rs b/frontend/rust-lib/lib-infra/src/future.rs similarity index 100% rename from shared-lib/lib-infra/src/future.rs rename to frontend/rust-lib/lib-infra/src/future.rs diff --git a/shared-lib/lib-infra/src/lib.rs b/frontend/rust-lib/lib-infra/src/lib.rs similarity index 100% rename from shared-lib/lib-infra/src/lib.rs rename to frontend/rust-lib/lib-infra/src/lib.rs diff --git a/shared-lib/lib-infra/src/ref_map.rs b/frontend/rust-lib/lib-infra/src/ref_map.rs similarity index 100% rename from shared-lib/lib-infra/src/ref_map.rs rename to frontend/rust-lib/lib-infra/src/ref_map.rs diff --git a/shared-lib/lib-infra/src/util.rs b/frontend/rust-lib/lib-infra/src/util.rs similarity index 100% rename from shared-lib/lib-infra/src/util.rs rename to frontend/rust-lib/lib-infra/src/util.rs diff --git a/shared-lib/lib-infra/src/validator_fn.rs b/frontend/rust-lib/lib-infra/src/validator_fn.rs similarity index 100% rename from shared-lib/lib-infra/src/validator_fn.rs rename to frontend/rust-lib/lib-infra/src/validator_fn.rs diff --git a/frontend/scripts/makefile/tests.toml b/frontend/scripts/makefile/tests.toml index 947b013636..63b0345039 100644 --- a/frontend/scripts/makefile/tests.toml +++ b/frontend/scripts/makefile/tests.toml @@ -80,13 +80,6 @@ cd rust-lib RUST_LOG=info RUST_BACKTRACE=1 cargo test --no-default-features --features "rev-sqlite" ''' -[tasks.shared_lib_unit_test] -env = { RUST_LOG = "info" } -description = "Run shared-lib unit test" -script = ''' -cd ../shared-lib -cargo test --no-default-features -''' [tasks.check_grcov] description = "Check if `grcov` is installled" @@ -115,7 +108,7 @@ script = [""" rm ${full_path} end - shared_lib_profs = glob_array ../shared-lib/**/*.profraw + shared_lib_profs = glob_array ./rust-lib/build-tool/**/*.profraw for prof in ${shared_lib_profs} full_path = canonicalize ${prof} rm ${full_path} @@ -171,54 +164,12 @@ script = [ """, ] -[tasks.get_sharedlib_grcov_report] -description = "Get `grcov` HTML report for test coverage shared-lib" -script_runner = "@shell" -script = [ - """ - echo --- Getting 'grcov' results 'shared-lib' --- - cd ../shared-lib - - grcov . \ - --binary-path target/debug/deps \ - --source-dir . \ - --output-type html \ - --branch \ - --ignore-not-existing \ - --log-level WARN \ - --output-path target/coverage-html - - echo "--- Done! Generated HTML report under 'target/coverage-html' for sharedlib." - """, -] - [tasks.get_grcov_report] description = "Get `grcov` HTML report for test coverage" run_task = { name = [ "get_rustlib_grcov_report", - "get_sharedlib_grcov_report", ], parallel = true } -[tasks.get_sharedlib_lcov_report] -description = "Generates `lcov` report for `shared-lib`" -script_runner = "@shell" -script = [""" - echo Getting 'lcov' results for 'shared-lib' - - cd ../shared-lib - - grcov . \ - --binary-path target/debug/deps \ - --source-dir . \ - --output-type lcov \ - --branch \ - --ignore-not-existing \ - --log-level WARN \ - --output-path target/coverage.lcov - - echo "--- Done! Generated 'target/coverage.lcov' sharedlib." - """] - [tasks.get_rustlib_lcov_report] description = "Generates `lcov` report for `rust-lib`" script_runner = "@shell" @@ -242,7 +193,6 @@ script = [""" [tasks.get_lcov_report] description = "Get `lcov` reports for test coverage" run_task = { name = [ - "get_sharedlib_lcov_report", "get_rustlib_lcov_report", ], parallel = true } diff --git a/frontend/scripts/makefile/tool.toml b/frontend/scripts/makefile/tool.toml index f7c5bd948c..7dd76b5e2f 100644 --- a/frontend/scripts/makefile/tool.toml +++ b/frontend/scripts/makefile/tool.toml @@ -11,7 +11,7 @@ script = [""" cd rust-lib cargo clean -q - cd ../../shared-lib + cd ./build-tool cargo clean -q """] script_runner = "@shell" @@ -40,7 +40,7 @@ run_task = { name = "remove_files_with_pattern" } [tasks.rm_shared_lib_generated_protobuf_files] private = true -env = { "rm_proto_path" = "../shared-lib/**/resources/proto", "rm_protobuf_path" = "../shared-lib/**/protobuf" } +env = { "rm_proto_path" = "./rust-lib/build-tool/**/resources/proto", "rm_protobuf_path" = "./rust-lib/build-tool/**/protobuf" } run_task = { name = "remove_files_with_pattern" } diff --git a/shared-lib/Cargo.lock b/shared-lib/Cargo.lock deleted file mode 100644 index 42d7d56d84..0000000000 --- a/shared-lib/Cargo.lock +++ /dev/null @@ -1,2272 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aes" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "aho-corasick" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "async-trait" -version = "0.1.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "basic-toml" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1" -dependencies = [ - "serde", -] - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "windows-targets", -] - -[[package]] -name = "chrono-tz" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552" -dependencies = [ - "chrono", - "chrono-tz-build", - "phf 0.10.1", -] - -[[package]] -name = "chrono-tz-build" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069" -dependencies = [ - "parse-zoneinfo", - "phf 0.10.1", - "phf_codegen", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "cmd_lib" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba0f413777386d37f85afa5242f277a7b461905254c1af3c339d4af06800f62" -dependencies = [ - "cmd_lib_macros", - "faccess", - "lazy_static", - "log", - "os_pipe", -] - -[[package]] -name = "cmd_lib_macros" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e66605092ff6c6e37e0246601ae6c3f62dc1880e0599359b5f303497c112dc0" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "console" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "regex", - "terminal_size", - "unicode-width", - "winapi", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "cpufeatures" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "cxx" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 1.0.109", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dashmap" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" -dependencies = [ - "cfg-if", - "num_cpus", - "parking_lot", -] - -[[package]] -name = "deranged" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "deunicode" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" - -[[package]] -name = "digest" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - -[[package]] -name = "encode_unicode" -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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "faccess" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ae66425802d6a903e268ae1a08b8c38ba143520f227a205edf4e9c7e3e26d5" -dependencies = [ - "bitflags 1.3.2", - "libc", - "winapi", -] - -[[package]] -name = "fancy-regex" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0678ab2d46fa5195aaf59ad034c083d351377d4af57f3e073c074d0da3e3c766" -dependencies = [ - "bit-set", - "regex", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "flowy-ast" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "flowy-codegen" -version = "0.1.0" -dependencies = [ - "cmd_lib", - "console", - "fancy-regex", - "flowy-ast", - "itertools", - "lazy_static", - "log", - "phf 0.8.0", - "protoc-bin-vendored", - "protoc-rust", - "quote", - "serde", - "serde_json", - "similar", - "syn 1.0.109", - "tera", - "toml", - "walkdir", -] - -[[package]] -name = "flowy-derive" -version = "0.1.0" -dependencies = [ - "dashmap", - "flowy-ast", - "flowy-codegen", - "lazy_static", - "proc-macro2", - "quote", - "serde_json", - "syn 1.0.109", - "tokio", - "trybuild", - "walkdir", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-core" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" - -[[package]] -name = "generic-array" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "globset" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" -dependencies = [ - "aho-corasick 0.7.18", - "bstr", - "fnv", - "log", - "regex", -] - -[[package]] -name = "globwalk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" -dependencies = [ - "bitflags 1.3.2", - "ignore", - "walkdir", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "humansize" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" -dependencies = [ - "libm", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "idna" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "ignore" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" -dependencies = [ - "globset", - "lazy_static", - "log", - "memchr", - "regex", - "same-file", - "thread_local", - "walkdir", - "winapi-util", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "indextree" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497f036ac2fae75c34224648a77802e5dd4e9cfb56f4713ab6b12b7160a0523b" - -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lib-infra" -version = "0.1.0" -dependencies = [ - "anyhow", - "async-trait", - "bytes", - "chrono", - "futures-core", - "md5", - "pin-project", - "rand 0.8.5", - "tempfile", - "tokio", - "validator", - "walkdir", - "zip", -] - -[[package]] -name = "lib-ot" -version = "0.1.0" -dependencies = [ - "bytes", - "indexmap", - "indextree", - "lazy_static", - "serde", - "serde_json", - "strum", - "strum_macros", - "thiserror", - "tracing", -] - -[[package]] -name = "libc" -version = "0.2.150" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" - -[[package]] -name = "libm" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" - -[[package]] -name = "lock_api" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - -[[package]] -name = "os_pipe" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb233f06c2307e1f5ce2ecad9f8121cffbbee2c95428f44ea85222e460d0d213" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.2.10", - "smallvec", - "windows-sys 0.36.1", -] - -[[package]] -name = "parse-zoneinfo" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" -dependencies = [ - "regex", -] - -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest", - "hmac", - "password-hash", - "sha2", -] - -[[package]] -name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - -[[package]] -name = "pest" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" -dependencies = [ - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "pest_meta" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "phf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" -dependencies = [ - "phf_macros", - "phf_shared 0.8.0", - "proc-macro-hack", -] - -[[package]] -name = "phf" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" -dependencies = [ - "phf_shared 0.10.0", -] - -[[package]] -name = "phf_codegen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", -] - -[[package]] -name = "phf_generator" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" -dependencies = [ - "phf_shared 0.8.0", - "rand 0.7.3", -] - -[[package]] -name = "phf_generator" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" -dependencies = [ - "phf_shared 0.10.0", - "rand 0.8.5", -] - -[[package]] -name = "phf_macros" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" -dependencies = [ - "phf_generator 0.8.0", - "phf_shared 0.8.0", - "proc-macro-hack", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "phf_shared" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", - "uncased", -] - -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro-hack" -version = "0.5.20+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" - -[[package]] -name = "proc-macro2" -version = "1.0.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "protobuf" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" - -[[package]] -name = "protobuf-codegen" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "033460afb75cf755fcfc16dfaed20b86468082a2ea24e05ac35ab4a099a017d6" -dependencies = [ - "protobuf", -] - -[[package]] -name = "protoc" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0218039c514f9e14a5060742ecd50427f8ac4f85a6dc58f2ddb806e318c55ee" -dependencies = [ - "log", - "which", -] - -[[package]] -name = "protoc-bin-vendored" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "005ca8623e5633e298ad1f917d8be0a44bcf406bf3cde3b80e63003e49a3f27d" -dependencies = [ - "protoc-bin-vendored-linux-aarch_64", - "protoc-bin-vendored-linux-ppcle_64", - "protoc-bin-vendored-linux-x86_32", - "protoc-bin-vendored-linux-x86_64", - "protoc-bin-vendored-macos-x86_64", - "protoc-bin-vendored-win32", -] - -[[package]] -name = "protoc-bin-vendored-linux-aarch_64" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb9fc9cce84c8694b6ea01cc6296617b288b703719b725b8c9c65f7c5874435" - -[[package]] -name = "protoc-bin-vendored-linux-ppcle_64" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d2a07dcf7173a04d49974930ccbfb7fd4d74df30ecfc8762cf2f895a094516" - -[[package]] -name = "protoc-bin-vendored-linux-x86_32" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54fef0b04fcacba64d1d80eed74a20356d96847da8497a59b0a0a436c9165b0" - -[[package]] -name = "protoc-bin-vendored-linux-x86_64" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8782f2ce7d43a9a5c74ea4936f001e9e8442205c244f7a3d4286bd4c37bc924" - -[[package]] -name = "protoc-bin-vendored-macos-x86_64" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5de656c7ee83f08e0ae5b81792ccfdc1d04e7876b1d9a38e6876a9e09e02537" - -[[package]] -name = "protoc-bin-vendored-win32" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9653c3ed92974e34c5a6e0a510864dab979760481714c172e0a34e437cb98804" - -[[package]] -name = "protoc-rust" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22f8a182bb17c485f20bdc4274a8c39000a61024cfe461c799b50fec77267838" -dependencies = [ - "protobuf", - "protobuf-codegen", - "protoc", - "tempfile", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", - "rand_pcg", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.3", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "redox_syscall" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" -dependencies = [ - "aho-corasick 1.0.1", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.38.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" - -[[package]] -name = "serde" -version = "1.0.192" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.192" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "serde_json" -version = "1.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha1" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "similar" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad1d488a557b235fc46dae55512ffbfc429d2482b08b4d9435ab07384ca8aec" - -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - -[[package]] -name = "slug" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" -dependencies = [ - "deunicode", -] - -[[package]] -name = "smallvec" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" - -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "strum" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" - -[[package]] -name = "strum_macros" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall 0.4.1", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "tera" -version = "1.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a665751302f22a03c56721e23094e4dc22b04a80f381e6737a07bf7a7c70c0" -dependencies = [ - "chrono", - "chrono-tz", - "globwalk", - "humansize", - "lazy_static", - "percent-encoding", - "pest", - "pest_derive", - "rand 0.8.5", - "regex", - "serde", - "serde_json", - "slug", - "thread_local", - "unic-segment", -] - -[[package]] -name = "termcolor" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" -dependencies = [ - "deranged", - "powerfmt", - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "trybuild" -version = "1.0.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501dbdbb99861e4ab6b60eb6a7493956a9defb644fd034bc4a5ef27c693c8a3a" -dependencies = [ - "basic-toml", - "glob", - "once_cell", - "serde", - "serde_derive", - "serde_json", - "termcolor", -] - -[[package]] -name = "typenum" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" - -[[package]] -name = "ucd-trie" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - -[[package]] -name = "uncased" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" -dependencies = [ - "version_check", -] - -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-segment" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" -dependencies = [ - "unic-ucd-segment", -] - -[[package]] -name = "unic-ucd-segment" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-version" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" -dependencies = [ - "unic-common", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" - -[[package]] -name = "unicode-ident" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "url" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" -dependencies = [ - "form_urlencoded", - "idna 0.3.0", - "percent-encoding", -] - -[[package]] -name = "validator" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" -dependencies = [ - "idna 0.4.0", - "lazy_static", - "regex", - "serde", - "serde_derive", - "serde_json", - "url", -] - -[[package]] -name = "version_check" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "which" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" -dependencies = [ - "either", - "libc", - "once_cell", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2", - "sha1", - "time", - "zstd", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/shared-lib/Cargo.toml b/shared-lib/Cargo.toml deleted file mode 100644 index 37d51ffeb2..0000000000 --- a/shared-lib/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[workspace] -members = [ - "lib-ot", - "lib-infra", - "flowy-derive", - "flowy-ast", - "flowy-codegen", -] - -[profile.dev] -opt-level = 0 -#https://doc.rust-lang.org/rustc/codegen-options/index.html#debug-assertions -#split-debuginfo = "unpacked" - - -[workspace.dependencies] -anyhow = "1.0.75" -tracing = "0.1.40" -serde = "1.0.108" -serde_json = "1.0.108" -tokio = "1.34.0" -async-trait = "0.1.74" -chrono = { version = "0.4.31", default-features = false, features = ["clock"] } diff --git a/shared-lib/lib-ot/Cargo.toml b/shared-lib/lib-ot/Cargo.toml deleted file mode 100644 index d412e7d74b..0000000000 --- a/shared-lib/lib-ot/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "lib-ot" -version = "0.1.0" -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -serde = { version = "1.0", features = ["derive", "rc"] } -thiserror = "1.0" -serde_json.workspace = true -indexmap = {version = "2.1.0", features = ["serde"]} -tracing.workspace = true -lazy_static = "1.4.0" -strum = "0.21" -strum_macros = "0.21" -bytes = "1.4" -indextree = "4.5.0" - - -[features] -flowy_unit_test = [] diff --git a/shared-lib/lib-ot/src/codec/markdown/markdown_encoder.rs b/shared-lib/lib-ot/src/codec/markdown/markdown_encoder.rs deleted file mode 100644 index 8e4c5eadb8..0000000000 --- a/shared-lib/lib-ot/src/codec/markdown/markdown_encoder.rs +++ /dev/null @@ -1,372 +0,0 @@ -use crate::core::{AttributeKey, AttributeValue, Attributes, OperationIterator, Operations}; -use crate::text_delta::{is_block, TextAttributeKey}; -use std::collections::HashMap; -use std::str::FromStr; -use strum_macros::EnumString; - -const LINEFEEDASCIICODE: i32 = 0x0A; - -#[cfg(test)] -mod tests { - use crate::codec::markdown::markdown_encoder::markdown_encoder; - use crate::text_delta::TextDelta; - - #[test] - fn markdown_encoder_header_1_test() { - let json = r#"[{"insert":"header 1"},{"insert":"\n","attributes":{"header":1}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "# header 1\n"); - } - - #[test] - fn markdown_encoder_header_2_test() { - let json = r#"[{"insert":"header 2"},{"insert":"\n","attributes":{"header":2}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "## header 2\n"); - } - - #[test] - fn markdown_encoder_header_3_test() { - let json = r#"[{"insert":"header 3"},{"insert":"\n","attributes":{"header":3}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "### header 3\n"); - } - - #[test] - fn markdown_encoder_bold_italics_underlined_test() { - let json = r#"[{"insert":"bold","attributes":{"bold":true}},{"insert":" "},{"insert":"italics","attributes":{"italic":true}},{"insert":" "},{"insert":"underlined","attributes":{"underline":true}},{"insert":" "},{"insert":"\n","attributes":{"header":3}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "### **bold** _italics_ underlined \n"); - } - #[test] - fn markdown_encoder_strikethrough_highlight_test() { - let json = r##"[{"insert":"strikethrough","attributes":{"strike":true}},{"insert":" "},{"insert":"highlighted","attributes":{"background":"#ffefe3"}},{"insert":"\n"}]"##; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "~~strikethrough~~ highlighted\n"); - } - - #[test] - fn markdown_encoder_numbered_list_test() { - let json = r#"[{"insert":"numbered list\nitem 1"},{"insert":"\n","attributes":{"list":"ordered"}},{"insert":"item 2"},{"insert":"\n","attributes":{"list":"ordered"}},{"insert":"item3"},{"insert":"\n","attributes":{"list":"ordered"}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "numbered list\n\n1. item 1\n1. item 2\n1. item3\n"); - } - - #[test] - fn markdown_encoder_bullet_list_test() { - let json = r#"[{"insert":"bullet list\nitem1"},{"insert":"\n","attributes":{"list":"bullet"}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "bullet list\n\n* item1\n"); - } - - #[test] - fn markdown_encoder_check_list_test() { - let json = r#"[{"insert":"check list\nchecked"},{"insert":"\n","attributes":{"list":"checked"}},{"insert":"unchecked"},{"insert":"\n","attributes":{"list":"unchecked"}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "check list\n\n- [x] checked\n\n- [ ] unchecked\n"); - } - - #[test] - fn markdown_encoder_code_test() { - let json = r#"[{"insert":"code this "},{"insert":"print(\"hello world\")","attributes":{"code":true}},{"insert":"\n"}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "code this `print(\"hello world\")`\n"); - } - - #[test] - fn markdown_encoder_quote_block_test() { - let json = r#"[{"insert":"this is a quote block"},{"insert":"\n","attributes":{"blockquote":true}}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "> this is a quote block\n"); - } - - #[test] - fn markdown_encoder_link_test() { - let json = r#"[{"insert":"appflowy","attributes":{"link":"https://www.appflowy.io/"}},{"insert":"\n"}]"#; - let delta = TextDelta::from_json(json).unwrap(); - let md = markdown_encoder(&delta); - assert_eq!(md, "[appflowy](https://www.appflowy.io/)\n"); - } -} - -struct Attribute { - key: AttributeKey, - value: AttributeValue, -} - -pub fn markdown_encoder(delta: &Operations) -> String { - let mut markdown_buffer = String::new(); - let mut line_buffer = String::new(); - let mut current_inline_style = Attributes::default(); - let mut current_block_lines: Vec = Vec::new(); - let mut iterator = OperationIterator::new(delta); - let mut current_block_style: Option = None; - - while iterator.has_next() { - let operation = iterator.next().unwrap(); - let operation_data = operation.get_data(); - if !operation_data.contains('\n') { - handle_inline( - &mut current_inline_style, - &mut line_buffer, - String::from(operation_data), - operation.get_attributes(), - ) - } else { - handle_line( - &mut line_buffer, - &mut markdown_buffer, - String::from(operation_data), - operation.get_attributes(), - &mut current_block_style, - &mut current_block_lines, - &mut current_inline_style, - ) - } - } - handle_block(&mut current_block_style, &mut current_block_lines, &mut markdown_buffer); - - markdown_buffer -} - -fn handle_inline(current_inline_style: &mut Attributes, buffer: &mut String, mut text: String, attributes: Attributes) { - let mut marked_for_removal: HashMap = HashMap::new(); - - for key in current_inline_style - .clone() - .keys() - .collect::>() - .into_iter() - .rev() - { - if let Some(attribute) = TextAttributeKey::from_str(key) { - if is_block(&attribute) { - continue; - } - } - - if attributes.contains_key(key) { - continue; - } - - let padding = trim_right(buffer); - write_attribute(buffer, key, current_inline_style.get(key.as_ref()).unwrap(), true); - if !padding.is_empty() { - buffer.push_str(&padding) - } - marked_for_removal.insert(key.clone(), current_inline_style.get(key).unwrap().clone()); - } - - for (marked_for_removal_key, marked_for_removal_value) in &marked_for_removal { - current_inline_style.retain(|inline_style_key, inline_style_value| { - inline_style_key != marked_for_removal_key && inline_style_value != marked_for_removal_value - }) - } - - for (key, value) in attributes.iter() { - if let Some(attribute) = TextAttributeKey::from_str(key) { - if is_block(&attribute) { - continue; - } - } - if current_inline_style.contains_key(key) { - continue; - } - let original_text = text.clone(); - text = text.trim_start().to_string(); - let padding = " ".repeat(original_text.len() - text.len()); - if !padding.is_empty() { - buffer.push_str(&padding) - } - write_attribute(buffer, key, value, false) - } - - buffer.push_str(&text); - *current_inline_style = attributes; -} - -fn trim_right(buffer: &mut String) -> String { - let text = buffer.clone(); - if !text.ends_with(' ') { - return String::from(""); - } - let result = text.trim_end(); - buffer.clear(); - buffer.push_str(result); - " ".repeat(text.len() - result.len()) -} - -fn write_attribute(buffer: &mut String, key: &AttributeKey, value: &AttributeValue, close: bool) { - let key = TextAttributeKey::from_str(key); - match key { - TextAttributeKey::Bold => buffer.push_str("**"), - TextAttributeKey::Italic => buffer.push('_'), - TextAttributeKey::Underline => { - if close { - buffer.push_str("") - } else { - buffer.push_str("") - } - } - TextAttributeKey::StrikeThrough => buffer.push_str("~~"), - TextAttributeKey::Link => { - if close { - buffer.push_str(format!("]({})", value.0.as_ref().unwrap()).as_str()) - } else { - buffer.push('[') - } - } - TextAttributeKey::Background => { - if close { - buffer.push_str("") - } else { - buffer.push_str("") - } - } - TextAttributeKey::CodeBlock => { - if close { - buffer.push_str("\n```") - } else { - buffer.push_str("```\n") - } - } - TextAttributeKey::InlineCode => buffer.push('`'), - _ => {} - } -} - -fn handle_line( - buffer: &mut String, - markdown_buffer: &mut String, - data: String, - attributes: Attributes, - current_block_style: &mut Option, - current_block_lines: &mut Vec, - current_inline_style: &mut Attributes, -) { - let mut span = String::new(); - for c in data.chars() { - if (c as i32) == LINEFEEDASCIICODE { - if !span.is_empty() { - handle_inline(current_inline_style, buffer, span.clone(), attributes.clone()); - } - handle_inline(current_inline_style, buffer, String::from(""), Attributes::default()); - - let line_block_key = attributes.keys().find(|key| { - if let Some(attribute) = TextAttributeKey::from_str(key) { - is_block(&attribute) - } else { - false - } - }); - - match (line_block_key, ¤t_block_style) { - (Some(line_block_key), Some(current_block_style)) - if *line_block_key == current_block_style.key - && *attributes.get(line_block_key).unwrap() == current_block_style.value => - { - current_block_lines.push(buffer.clone()); - } - (None, None) => { - current_block_lines.push(buffer.clone()); - } - _ => { - handle_block(current_block_style, current_block_lines, markdown_buffer); - current_block_lines.clear(); - current_block_lines.push(buffer.clone()); - - match line_block_key { - None => *current_block_style = None, - Some(line_block_key) => { - *current_block_style = Some(Attribute { - key: line_block_key.clone(), - value: attributes.get(line_block_key).unwrap().clone(), - }) - } - } - } - } - buffer.clear(); - span.clear(); - } else { - span.push(c); - } - } - if !span.is_empty() { - handle_inline(current_inline_style, buffer, span.clone(), attributes) - } -} - -fn handle_block( - block_style: &mut Option, - current_block_lines: &mut Vec, - markdown_buffer: &mut String, -) { - if current_block_lines.is_empty() { - return; - } - if !markdown_buffer.is_empty() { - markdown_buffer.push('\n') - } - - match block_style { - None => { - markdown_buffer.push_str(¤t_block_lines.join("\n")); - markdown_buffer.push('\n'); - } - Some(block_style) if block_style.key == AttributeKey::CodeBlock => { - write_attribute(markdown_buffer, &block_style.key, &block_style.value, false); - markdown_buffer.push_str(¤t_block_lines.join("\n")); - write_attribute(markdown_buffer, &block_style.key, &block_style.value, true); - markdown_buffer.push('\n'); - } - Some(block_style) => { - for line in current_block_lines { - write_block_tag(markdown_buffer, block_style, false); - markdown_buffer.push_str(line); - markdown_buffer.push('\n'); - } - } - } -} - -fn write_block_tag(buffer: &mut String, block: &Attribute, close: bool) { - if close { - return; - } - - if block.key == AttributeKey::BlockQuote { - buffer.push_str("> "); - } else if block.key == AttributeKey::List { - if block.value.0.as_ref().unwrap().eq("bullet") { - buffer.push_str("* "); - } else if block.value.0.as_ref().unwrap().eq("checked") { - buffer.push_str("- [x] "); - } else if block.value.0.as_ref().unwrap().eq("unchecked") { - buffer.push_str("- [ ] "); - } else if block.value.0.as_ref().unwrap().eq("ordered") { - buffer.push_str("1. "); - } else { - buffer.push_str("* "); - } - } else if block.key == AttributeKey::Header { - if block.value.0.as_ref().unwrap().eq("1") { - buffer.push_str("# "); - } else if block.value.0.as_ref().unwrap().eq("2") { - buffer.push_str("## "); - } else if block.value.0.as_ref().unwrap().eq("3") { - buffer.push_str("### "); - } else if block.key == AttributeKey::List { - } - } -} diff --git a/shared-lib/lib-ot/src/codec/markdown/mod.rs b/shared-lib/lib-ot/src/codec/markdown/mod.rs deleted file mode 100644 index c555505482..0000000000 --- a/shared-lib/lib-ot/src/codec/markdown/mod.rs +++ /dev/null @@ -1 +0,0 @@ -// pub mod markdown_encoder; diff --git a/shared-lib/lib-ot/src/codec/mod.rs b/shared-lib/lib-ot/src/codec/mod.rs deleted file mode 100644 index 163a4fba82..0000000000 --- a/shared-lib/lib-ot/src/codec/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod markdown; diff --git a/shared-lib/lib-ot/src/core/attributes/attribute.rs b/shared-lib/lib-ot/src/core/attributes/attribute.rs deleted file mode 100644 index 95aae6a8f3..0000000000 --- a/shared-lib/lib-ot/src/core/attributes/attribute.rs +++ /dev/null @@ -1,345 +0,0 @@ -use crate::core::{OperationAttributes, OperationTransform}; -use crate::errors::OTError; -use indexmap::IndexMap; -use serde::{Deserialize, Serialize}; -use std::fmt; -use std::fmt::Display; - -#[derive(Debug, Clone)] -pub struct AttributeEntry { - pub key: AttributeKey, - pub value: AttributeValue, -} - -impl AttributeEntry { - pub fn new, V: Into>(key: K, value: V) -> Self { - Self { - key: key.into(), - value: value.into(), - } - } - - pub fn clear(&mut self) { - self.value.ty = None; - self.value.value = None; - } -} - -impl std::convert::From for AttributeHashMap { - fn from(entry: AttributeEntry) -> Self { - let mut attributes = AttributeHashMap::new(); - attributes.insert_entry(entry); - attributes - } -} - -#[derive(Default, Clone, Serialize, Deserialize, Eq, PartialEq, Debug)] -pub struct AttributeHashMap(IndexMap); - -impl std::ops::Deref for AttributeHashMap { - type Target = IndexMap; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl std::ops::DerefMut for AttributeHashMap { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl AttributeHashMap { - pub fn new() -> AttributeHashMap { - AttributeHashMap(IndexMap::new()) - } - - pub fn into_inner(self) -> IndexMap { - self.0 - } - - // pub fn from_value(attribute_map: HashMap) -> Self { - // Self(attribute_map) - // } - - pub fn insert>(&mut self, key: K, value: V) { - self.0.insert(key.to_string(), value.into()); - } - - pub fn insert_entry(&mut self, entry: AttributeEntry) { - self.insert(entry.key, entry.value) - } - - /// Set the key's value to None - pub fn remove_value>(&mut self, key: K) { - // if let Some(mut_value) = self.0.get_mut(key.as_ref()) { - // mut_value.value = None; - // } - self.insert(key.as_ref().to_string(), AttributeValue::none()); - } - - /// Set all key's value to None - pub fn remove_all_value(&mut self) { - self.0.iter_mut().for_each(|(_, v)| { - *v = AttributeValue::none(); - }) - } - - pub fn retain_values(&mut self, retain_keys: &[&str]) { - self.0.iter_mut().for_each(|(k, v)| { - if !retain_keys.contains(&k.as_str()) { - *v = AttributeValue::none(); - } - }) - } - - pub fn remove_key>(&mut self, key: K) { - self.0.remove(key.as_ref()); - } - - /// Create a new key/value map by constructing new attributes from the other - /// if it's not None and replace the key/value with self key/value. - pub fn merge(&mut self, other: Option) { - if other.is_none() { - return; - } - - let mut new_attributes = other.unwrap().0; - self.0.iter().for_each(|(k, v)| { - new_attributes.insert(k.clone(), v.clone()); - }); - self.0 = new_attributes; - } - - pub fn is_empty(&self) -> bool { - self.0.is_empty() - } - - pub fn to_json(&self) -> Result { - serde_json::to_string(self).map_err(|err| OTError::serde().context(err)) - } -} - -impl Display for AttributeHashMap { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for (key, value) in self.0.iter() { - f.write_str(&format!("{:?}:{:?}", key, value))?; - } - Ok(()) - } -} - -impl OperationAttributes for AttributeHashMap { - fn is_empty(&self) -> bool { - self.is_empty() - } - - fn remove(&mut self) { - self.retain(|_, v| v.value.is_some()); - } - - fn extend(&mut self, other: Self) { - self.0.extend(other.0); - } -} - -impl OperationTransform for AttributeHashMap { - fn compose(&self, other: &Self) -> Result - where - Self: Sized, - { - let mut attributes = self.clone(); - attributes.0.extend(other.clone().0); - Ok(attributes) - } - - fn transform(&self, other: &Self) -> Result<(Self, Self), OTError> - where - Self: Sized, - { - let a = self - .iter() - .fold(AttributeHashMap::new(), |mut new_attributes, (k, v)| { - if !other.contains_key(k) { - new_attributes.insert(k.clone(), v.clone()); - } - new_attributes - }); - - let b = other - .iter() - .fold(AttributeHashMap::new(), |mut new_attributes, (k, v)| { - if !self.contains_key(k) { - new_attributes.insert(k.clone(), v.clone()); - } - new_attributes - }); - - Ok((a, b)) - } - - fn invert(&self, other: &Self) -> Self { - let base_inverted = other - .iter() - .fold(AttributeHashMap::new(), |mut attributes, (k, v)| { - if other.get(k) != self.get(k) && self.contains_key(k) { - attributes.insert(k.clone(), v.clone()); - } - attributes - }); - - self.iter().fold(base_inverted, |mut attributes, (k, _)| { - if other.get(k) != self.get(k) && !other.contains_key(k) { - attributes.remove_value(k); - } - attributes - }) - } -} - -pub type AttributeKey = String; - -#[derive(Eq, PartialEq, Hash, Debug, Clone)] -pub enum ValueType { - IntType = 0, - FloatType = 1, - StrType = 2, - BoolType = 3, -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AttributeValue { - pub ty: Option, - pub value: Option, -} - -impl AttributeValue { - pub fn none() -> Self { - Self { - ty: None, - value: None, - } - } - - pub fn from_int(val: i64) -> Self { - Self { - ty: Some(ValueType::IntType), - value: Some(val.to_string()), - } - } - - pub fn from_float(val: f64) -> Self { - Self { - ty: Some(ValueType::FloatType), - value: Some(val.to_string()), - } - } - - pub fn from_bool(val: bool) -> Self { - // let value = if val { Some(val.to_string()) } else { None }; - Self { - ty: Some(ValueType::BoolType), - value: Some(val.to_string()), - } - } - - pub fn from_string(s: T) -> Self { - let value = Some(s.to_string()); - Self { - ty: Some(ValueType::StrType), - value, - } - } - - pub fn int_value(&self) -> Option { - let value = self.value.as_ref()?; - Some(value.parse::().unwrap_or(0)) - } - - pub fn bool_value(&self) -> Option { - let value = self.value.as_ref()?; - Some(value.parse::().unwrap_or(false)) - } - - pub fn str_value(&self) -> Option { - self.value.clone() - } - - pub fn float_value(&self) -> Option { - let value = self.value.as_ref()?; - Some(value.parse::().unwrap_or(0.0)) - } -} - -impl std::convert::From for AttributeValue { - fn from(value: bool) -> Self { - AttributeValue::from_bool(value) - } -} - -impl std::convert::From for AttributeValue { - fn from(value: usize) -> Self { - AttributeValue::from_int(value as i64) - } -} - -impl std::convert::From<&str> for AttributeValue { - fn from(value: &str) -> Self { - AttributeValue::from_string(value) - } -} - -impl std::convert::From for AttributeValue { - fn from(value: String) -> Self { - AttributeValue::from_string(value) - } -} - -impl std::convert::From for AttributeValue { - fn from(value: f64) -> Self { - AttributeValue::from_float(value) - } -} - -impl std::convert::From for AttributeValue { - fn from(value: i64) -> Self { - AttributeValue::from_int(value) - } -} - -impl std::convert::From for AttributeValue { - fn from(value: i32) -> Self { - AttributeValue::from_int(value as i64) - } -} - -#[derive(Default)] -pub struct AttributeBuilder { - attributes: AttributeHashMap, -} - -impl AttributeBuilder { - pub fn new() -> Self { - Self::default() - } - - pub fn insert>(mut self, key: K, value: V) -> Self { - self.attributes.insert(key, value); - self - } - - pub fn insert_entry(mut self, entry: AttributeEntry) -> Self { - self.attributes.insert_entry(entry); - self - } - - pub fn delete>(mut self, key: K) -> Self { - self.attributes.remove_value(key); - self - } - - pub fn build(self) -> AttributeHashMap { - self.attributes - } -} diff --git a/shared-lib/lib-ot/src/core/attributes/attribute_serde.rs b/shared-lib/lib-ot/src/core/attributes/attribute_serde.rs deleted file mode 100644 index d20d112d72..0000000000 --- a/shared-lib/lib-ot/src/core/attributes/attribute_serde.rs +++ /dev/null @@ -1,174 +0,0 @@ -use crate::core::attributes::AttributeValue; - -use serde::{ - de::{self, MapAccess, Visitor}, - Deserialize, Deserializer, Serialize, Serializer, -}; -use std::fmt; - -impl Serialize for AttributeValue { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match &self.ty { - None => serializer.serialize_none(), - Some(ty) => match ty { - super::ValueType::IntType => { - if let Some(value) = self.int_value() { - serializer.serialize_i64(value) - } else { - serializer.serialize_none() - } - }, - super::ValueType::FloatType => { - if let Some(value) = self.float_value() { - serializer.serialize_f64(value) - } else { - serializer.serialize_none() - } - }, - super::ValueType::StrType => { - if let Some(value) = self.str_value() { - serializer.serialize_str(&value) - } else { - serializer.serialize_none() - } - }, - super::ValueType::BoolType => { - if let Some(value) = self.bool_value() { - serializer.serialize_bool(value) - } else { - serializer.serialize_none() - } - }, - }, - } - } -} - -impl<'de> Deserialize<'de> for AttributeValue { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct AttributeValueVisitor; - impl<'de> Visitor<'de> for AttributeValueVisitor { - type Value = AttributeValue; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("bool, usize or string") - } - - fn visit_bool(self, value: bool) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_bool(value)) - } - - fn visit_i8(self, value: i8) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_i16(self, value: i16) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_i32(self, value: i32) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_i64(self, value: i64) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value)) - } - - fn visit_u8(self, value: u8) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_u16(self, value: u16) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_u32(self, value: u32) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_u64(self, value: u64) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_int(value as i64)) - } - - fn visit_f32(self, value: f32) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_float(value as f64)) - } - - fn visit_f64(self, value: f64) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_float(value)) - } - - fn visit_str(self, s: &str) -> Result - where - E: de::Error, - { - Ok(AttributeValue::from_string(s)) - } - - fn visit_none(self) -> Result - where - E: de::Error, - { - Ok(AttributeValue::none()) - } - - fn visit_unit(self) -> Result - where - E: de::Error, - { - // the value that contains null will be processed here. - Ok(AttributeValue::none()) - } - - fn visit_map(self, map: A) -> Result - where - A: MapAccess<'de>, - { - // https://github.com/serde-rs/json/issues/505 - let mut map = map; - let value = map.next_value::()?; - Ok(value) - } - } - - deserializer.deserialize_any(AttributeValueVisitor) - } -} diff --git a/shared-lib/lib-ot/src/core/attributes/mod.rs b/shared-lib/lib-ot/src/core/attributes/mod.rs deleted file mode 100644 index fee0906d88..0000000000 --- a/shared-lib/lib-ot/src/core/attributes/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -mod attribute; -mod attribute_serde; - -pub use attribute::*; diff --git a/shared-lib/lib-ot/src/core/delta/builder.rs b/shared-lib/lib-ot/src/core/delta/builder.rs deleted file mode 100644 index 90fd7195f5..0000000000 --- a/shared-lib/lib-ot/src/core/delta/builder.rs +++ /dev/null @@ -1,136 +0,0 @@ -use crate::core::delta::operation::OperationAttributes; -use crate::core::delta::{trim, DeltaOperations}; - -/// A builder for creating new [Operations] objects. -/// -/// Note that all edit operations must be sorted; the start point of each -/// interval must be no less than the end point of the previous one. -/// -/// # Examples -/// -/// ``` -/// use lib_ot::core::DeltaBuilder; -/// let delta = DeltaBuilder::new() -/// .insert("AppFlowy") -/// .build(); -/// assert_eq!(delta.content().unwrap(), "AppFlowy"); -/// ``` -pub struct DeltaOperationBuilder { - delta: DeltaOperations, -} - -impl std::default::Default for DeltaOperationBuilder -where - T: OperationAttributes, -{ - fn default() -> Self { - Self { - delta: DeltaOperations::new(), - } - } -} - -impl DeltaOperationBuilder -where - T: OperationAttributes, -{ - pub fn new() -> Self { - DeltaOperationBuilder::default() - } - - pub fn from_delta_operation(delta_operation: DeltaOperations) -> Self { - debug_assert!(delta_operation.utf16_base_len == 0); - let mut builder = DeltaOperationBuilder::new(); - delta_operation.ops.into_iter().for_each(|operation| { - builder.delta.add(operation); - }); - builder - } - - /// Retain the 'n' characters with the attributes. Use 'retain' instead if you don't - /// need any attributes. - /// # Examples - /// - /// ``` - /// use lib_ot::text_delta::{BuildInTextAttribute, DeltaTextOperations, DeltaTextOperationBuilder}; - /// - /// let mut attribute = BuildInTextAttribute::Bold(true); - /// let delta = DeltaTextOperationBuilder::new().retain_with_attributes(7, attribute.into()).build(); - /// - /// assert_eq!(delta.json_str(), r#"[{"retain":7,"attributes":{"bold":true}}]"#); - /// ``` - pub fn retain_with_attributes(mut self, n: usize, attrs: T) -> Self { - self.delta.retain(n, attrs); - self - } - - pub fn retain(mut self, n: usize) -> Self { - self.delta.retain(n, T::default()); - self - } - - /// Deletes the given interval. Panics if interval is not properly sorted. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{OperationTransform, DeltaBuilder}; - /// - /// let delta = DeltaBuilder::new() - /// .insert("AppFlowy...") - /// .build(); - /// - /// let changeset = DeltaBuilder::new() - /// .retain(8) - /// .delete(3) - /// .build(); - /// - /// let new_delta = delta.compose(&changeset).unwrap(); - /// assert_eq!(new_delta.content().unwrap(), "AppFlowy"); - /// ``` - pub fn delete(mut self, n: usize) -> Self { - self.delta.delete(n); - self - } - - /// Inserts the string with attributes. Use 'insert' instead if you don't - /// need any attributes. - pub fn insert_with_attributes(mut self, s: &str, attrs: T) -> Self { - self.delta.insert(s, attrs); - self - } - - pub fn insert(mut self, s: &str) -> Self { - self.delta.insert(s, T::default()); - self - } - - /// Removes trailing retain operation with empty attributes - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{OperationTransform, DeltaBuilder}; - /// use lib_ot::text_delta::{BuildInTextAttribute, DeltaTextOperationBuilder}; - /// let delta = DeltaBuilder::new() - /// .retain(3) - /// .trim() - /// .build(); - /// assert_eq!(delta.ops.len(), 0); - /// - /// let delta = DeltaTextOperationBuilder::new() - /// .retain_with_attributes(3, BuildInTextAttribute::Bold(true).into()) - /// .trim() - /// .build(); - /// assert_eq!(delta.ops.len(), 1); - /// ``` - pub fn trim(mut self) -> Self { - trim(&mut self.delta); - self - } - - /// Builds the `Delta` - pub fn build(self) -> DeltaOperations { - self.delta - } -} diff --git a/shared-lib/lib-ot/src/core/delta/cursor.rs b/shared-lib/lib-ot/src/core/delta/cursor.rs deleted file mode 100644 index 0c8bbaca7c..0000000000 --- a/shared-lib/lib-ot/src/core/delta/cursor.rs +++ /dev/null @@ -1,253 +0,0 @@ -#![allow(clippy::while_let_on_iterator)] -use crate::core::delta::operation::{DeltaOperation, OperationAttributes}; -use crate::core::delta::DeltaOperations; -use crate::core::interval::Interval; -use crate::errors::{ErrorBuilder, OTError, OTErrorCode}; -use std::{cmp::min, iter::Enumerate, slice::Iter}; - -/// A [OperationsCursor] is used to iterate the delta and return the corresponding delta. -#[derive(Debug)] -pub struct OperationsCursor<'a, T: OperationAttributes> { - pub(crate) delta: &'a DeltaOperations, - pub(crate) origin_iv: Interval, - pub(crate) consume_iv: Interval, - pub(crate) consume_count: usize, - pub(crate) op_offset: usize, - iter: Enumerate>>, - next_op: Option>, -} - -impl<'a, T> OperationsCursor<'a, T> -where - T: OperationAttributes, -{ - /// # Arguments - /// - /// * `delta`: The delta you want to iterate over. - /// * `interval`: The range for the cursor movement. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{OperationsCursor, OperationIterator, Interval, DeltaOperation}; - /// use lib_ot::text_delta::DeltaTextOperations; - /// let mut delta = DeltaTextOperations::default(); - /// delta.add(DeltaOperation::insert("123")); - /// delta.add(DeltaOperation::insert("4")); - /// - /// let mut cursor = OperationsCursor::new(&delta, Interval::new(0, 3)); - /// assert_eq!(cursor.next_iv(), Interval::new(0,3)); - /// assert_eq!(cursor.next_with_len(Some(2)).unwrap(), DeltaOperation::insert("12")); - /// assert_eq!(cursor.get_next_op().unwrap(), DeltaOperation::insert("3")); - /// assert_eq!(cursor.get_next_op(), None); - /// ``` - pub fn new(delta: &'a DeltaOperations, interval: Interval) -> OperationsCursor<'a, T> { - // debug_assert!(interval.start <= delta.target_len); - let mut cursor = Self { - delta, - origin_iv: interval, - consume_iv: interval, - consume_count: 0, - op_offset: 0, - iter: delta.ops.iter().enumerate(), - next_op: None, - }; - cursor.descend(0); - cursor - } - - /// Returns the next operation interval - pub fn next_iv(&self) -> Interval { - self - .next_iv_with_len(None) - .unwrap_or_else(|| Interval::new(0, 0)) - } - - /// Returns the next operation - pub fn get_next_op(&mut self) -> Option> { - self.next_with_len(None) - } - - /// Returns the reference of the next operation - pub fn next_op(&self) -> Option<&DeltaOperation> { - let mut next_op = self.next_op.as_ref(); - if next_op.is_none() { - let mut offset = 0; - for op in &self.delta.ops { - offset += op.len(); - if offset > self.consume_count { - next_op = Some(op); - break; - } - } - } - next_op - } - - /// # Arguments - /// - /// * `expected_len`: Return the next operation with the specified length. - /// - /// - pub fn next_with_len(&mut self, expected_len: Option) -> Option> { - let mut find_op = None; - let holder = self.next_op.clone(); - let mut next_op = holder.as_ref(); - - if next_op.is_none() { - next_op = find_next(self); - } - - let mut consume_len = 0; - while find_op.is_none() && next_op.is_some() { - let op = next_op.take().unwrap(); - let interval = self - .next_iv_with_len(expected_len) - .unwrap_or_else(|| Interval::new(0, 0)); - - // cache the op if the interval is empty. e.g. last_op_before(Some(0)) - if interval.is_empty() { - self.next_op = Some(op.clone()); - break; - } - find_op = op.shrink(interval); - let suffix = Interval::new(0, op.len()).suffix(interval); - if suffix.is_empty() { - self.next_op = None; - } else { - self.next_op = op.shrink(suffix); - } - - consume_len += interval.end; - self.consume_count += interval.end; - self.consume_iv.start = self.consume_count; - - // continue to find the op in next iteration - if find_op.is_none() { - next_op = find_next(self); - } - } - - if find_op.is_some() { - if let Some(end) = expected_len { - // try to find the next op before the index if consume_len less than index - if end > consume_len && self.has_next() { - return self.next_with_len(Some(end - consume_len)); - } - } - } - find_op - } - - pub fn has_next(&self) -> bool { - self.next_op().is_some() - } - - /// Finds the op within the current offset. - /// This function sets the start of the consume_iv to the offset, updates the consume_count - /// and the next_op reference. - /// - /// # Arguments - /// - /// * `offset`: Represents the offset of the delta string, in Utf16CodeUnit unit. - fn descend(&mut self, offset: usize) { - self.consume_iv.start += offset; - - if self.consume_count >= self.consume_iv.start { - return; - } - while let Some((o_index, op)) = self.iter.next() { - self.op_offset = o_index; - let start = self.consume_count; - let end = start + op.len(); - let intersect = Interval::new(start, end).intersect(self.consume_iv); - if intersect.is_empty() { - self.consume_count += op.len(); - } else { - self.next_op = Some(op.clone()); - break; - } - } - } - - fn next_iv_with_len(&self, expected_len: Option) -> Option { - let op = self.next_op()?; - let start = self.consume_count; - let end = match expected_len { - None => self.consume_count + op.len(), - Some(expected_len) => self.consume_count + min(expected_len, op.len()), - }; - - let intersect = Interval::new(start, end).intersect(self.consume_iv); - let interval = intersect.translate_neg(start); - Some(interval) - } -} - -fn find_next<'a, T>(cursor: &mut OperationsCursor<'a, T>) -> Option<&'a DeltaOperation> -where - T: OperationAttributes, -{ - match cursor.iter.next() { - None => None, - Some((o_index, op)) => { - cursor.op_offset = o_index; - Some(op) - }, - } -} - -type SeekResult = Result<(), OTError>; -pub trait Metric { - fn seek(cursor: &mut OperationsCursor, offset: usize) -> SeekResult; -} - -/// [OpMetric] is used by [DeltaIterator] for seeking operations -/// The unit of the movement is Operation -pub struct OpMetric(); - -impl Metric for OpMetric { - fn seek( - cursor: &mut OperationsCursor, - op_offset: usize, - ) -> SeekResult { - check_bound(cursor.op_offset, op_offset)?; - let mut seek_cursor = OperationsCursor::new(cursor.delta, cursor.origin_iv); - - while let Some((_, op)) = seek_cursor.iter.next() { - cursor.descend(op.len()); - if cursor.op_offset >= op_offset { - break; - } - } - Ok(()) - } -} - -/// [Utf16CodeUnitMetric] is used by [OperationIterator] for seeking operations. -/// The unit of the movement is Utf16CodeUnit -pub struct Utf16CodeUnitMetric(); - -impl Metric for Utf16CodeUnitMetric { - fn seek(cursor: &mut OperationsCursor, offset: usize) -> SeekResult { - if offset > 0 { - check_bound(cursor.consume_count, offset)?; - let _ = cursor.next_with_len(Some(offset)); - } - - Ok(()) - } -} - -fn check_bound(current: usize, target: usize) -> Result<(), OTError> { - debug_assert!(current <= target); - if current > target { - let msg = format!("{} should be greater than current: {}", target, current); - return Err( - ErrorBuilder::new(OTErrorCode::IncompatibleLength) - .msg(msg) - .build(), - ); - } - Ok(()) -} diff --git a/shared-lib/lib-ot/src/core/delta/iterator.rs b/shared-lib/lib-ot/src/core/delta/iterator.rs deleted file mode 100644 index 8ea68e6c84..0000000000 --- a/shared-lib/lib-ot/src/core/delta/iterator.rs +++ /dev/null @@ -1,280 +0,0 @@ -use std::ops::{Deref, DerefMut}; - -use crate::core::delta::operation::{DeltaOperation, OperationAttributes}; -use crate::core::delta::{DeltaOperations, NEW_LINE}; -use crate::core::interval::Interval; -use crate::core::AttributeHashMap; - -use super::cursor::*; - -pub(crate) const MAX_IV_LEN: usize = i32::MAX as usize; - -/// [OperationIterator] is used to iterate over the operations. -/// # Examples -/// -/// You could check [this](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/backend/delta) out for more information. -/// -/// ``` -/// use lib_ot::core::{OperationIterator, Interval, DeltaOperation}; -/// use lib_ot::text_delta::DeltaTextOperations; -/// let mut delta = DeltaTextOperations::default(); -/// delta.add(DeltaOperation::insert("123")); -/// delta.add(DeltaOperation::insert("4")); -/// assert_eq!( -/// OperationIterator::from_interval(&delta, Interval::new(0, 2)).ops(), -/// vec![DeltaOperation::insert("12")] -/// ); -/// -/// assert_eq!( -/// OperationIterator::from_interval(&delta, Interval::new(1, 3)).ops(), -/// vec![DeltaOperation::insert("23")] -/// ); -/// ``` -pub struct OperationIterator<'a, T: OperationAttributes> { - cursor: OperationsCursor<'a, T>, -} - -impl<'a, T> OperationIterator<'a, T> -where - T: OperationAttributes, -{ - pub fn new(delta: &'a DeltaOperations) -> Self { - let interval = Interval::new(0, MAX_IV_LEN); - Self::from_interval(delta, interval) - } - - pub fn from_offset(delta: &'a DeltaOperations, offset: usize) -> Self { - let interval = Interval::new(0, MAX_IV_LEN); - let mut iter = Self::from_interval(delta, interval); - iter.seek::(offset); - iter - } - - pub fn from_interval(delta: &'a DeltaOperations, interval: Interval) -> Self { - let cursor = OperationsCursor::new(delta, interval); - Self { cursor } - } - - pub fn ops(&mut self) -> Vec> { - self.collect::>() - } - - pub fn next_op_len(&self) -> Option { - let interval = self.cursor.next_iv(); - if interval.is_empty() { - None - } else { - Some(interval.size()) - } - } - - pub fn next_op(&mut self) -> Option> { - self.cursor.get_next_op() - } - - pub fn next_op_with_len(&mut self, len: usize) -> Option> { - self.cursor.next_with_len(Some(len)) - } - - // find next op contains NEW_LINE - pub fn next_op_with_newline(&mut self) -> Option<(DeltaOperation, usize)> { - let mut offset = 0; - while self.has_next() { - if let Some(op) = self.next_op() { - if OpNewline::parse(&op).is_contain() { - return Some((op, offset)); - } - offset += op.len(); - } - } - - None - } - - pub fn seek(&mut self, index: usize) { - match M::seek(&mut self.cursor, index) { - Ok(_) => {}, - Err(e) => tracing::error!("Seek fail: {:?}", e), - } - } - - pub fn has_next(&self) -> bool { - self.cursor.has_next() - } - - pub fn is_next_insert(&self) -> bool { - match self.cursor.next_op() { - None => false, - Some(op) => op.is_insert(), - } - } - - pub fn is_next_retain(&self) -> bool { - match self.cursor.next_op() { - None => false, - Some(op) => op.is_retain(), - } - } - - pub fn is_next_delete(&self) -> bool { - match self.cursor.next_op() { - None => false, - Some(op) => op.is_delete(), - } - } -} - -impl<'a, T> Iterator for OperationIterator<'a, T> -where - T: OperationAttributes, -{ - type Item = DeltaOperation; - fn next(&mut self) -> Option { - self.next_op() - } -} - -pub fn is_empty_line_at_index(delta: &DeltaOperations, index: usize) -> bool { - let mut iter = OperationIterator::new(delta); - let (prev, next) = (iter.next_op_with_len(index), iter.next_op()); - if prev.is_none() { - return true; - } - - if next.is_none() { - return false; - } - - let prev = prev.unwrap(); - let next = next.unwrap(); - OpNewline::parse(&prev).is_end() && OpNewline::parse(&next).is_start() -} - -pub struct AttributesIter<'a, T: OperationAttributes> { - delta_iter: OperationIterator<'a, T>, -} - -impl<'a, T> AttributesIter<'a, T> -where - T: OperationAttributes, -{ - pub fn new(delta: &'a DeltaOperations) -> Self { - let interval = Interval::new(0, usize::MAX); - Self::from_interval(delta, interval) - } - - pub fn from_interval(delta: &'a DeltaOperations, interval: Interval) -> Self { - let delta_iter = OperationIterator::from_interval(delta, interval); - Self { delta_iter } - } - - pub fn next_or_empty(&mut self) -> T { - match self.next() { - None => T::default(), - Some((_, attributes)) => attributes, - } - } -} - -impl<'a, T> Deref for AttributesIter<'a, T> -where - T: OperationAttributes, -{ - type Target = OperationIterator<'a, T>; - - fn deref(&self) -> &Self::Target { - &self.delta_iter - } -} - -impl<'a, T> DerefMut for AttributesIter<'a, T> -where - T: OperationAttributes, -{ - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.delta_iter - } -} - -impl<'a, T> Iterator for AttributesIter<'a, T> -where - T: OperationAttributes, -{ - type Item = (usize, T); - fn next(&mut self) -> Option { - let next_op = self.delta_iter.next_op(); - next_op.as_ref()?; - let mut length: usize = 0; - let mut attributes = T::default(); - - match next_op.unwrap() { - DeltaOperation::::Delete(_n) => {}, - DeltaOperation::::Retain(retain) => { - tracing::trace!("extend retain attributes with {} ", &retain.attributes); - attributes.extend(retain.attributes.clone()); - - length = retain.n; - }, - DeltaOperation::::Insert(insert) => { - tracing::trace!("extend insert attributes with {} ", &insert.attributes); - attributes.extend(insert.attributes.clone()); - length = insert.utf16_size(); - }, - } - - Some((length, attributes)) - } -} - -#[derive(PartialEq, Eq)] -pub enum OpNewline { - Start, - End, - Contain, - Equal, - NotFound, -} - -impl OpNewline { - pub fn parse(op: &DeltaOperation) -> OpNewline { - let s = op.get_data(); - - if s == NEW_LINE { - return OpNewline::Equal; - } - - if s.starts_with(NEW_LINE) { - return OpNewline::Start; - } - - if s.ends_with(NEW_LINE) { - return OpNewline::End; - } - - if s.contains(NEW_LINE) { - return OpNewline::Contain; - } - - OpNewline::NotFound - } - - pub fn is_start(&self) -> bool { - self == &OpNewline::Start || self.is_equal() - } - - pub fn is_end(&self) -> bool { - self == &OpNewline::End || self.is_equal() - } - - pub fn is_not_found(&self) -> bool { - self == &OpNewline::NotFound - } - - pub fn is_contain(&self) -> bool { - self.is_start() || self.is_end() || self.is_equal() || self == &OpNewline::Contain - } - - pub fn is_equal(&self) -> bool { - self == &OpNewline::Equal - } -} diff --git a/shared-lib/lib-ot/src/core/delta/mod.rs b/shared-lib/lib-ot/src/core/delta/mod.rs deleted file mode 100644 index a782bf0078..0000000000 --- a/shared-lib/lib-ot/src/core/delta/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![allow(clippy::module_inception)] -mod builder; -mod cursor; -mod iterator; -pub mod operation; -mod ops; -mod ops_serde; - -pub use builder::*; -pub use cursor::*; -pub use iterator::*; -pub use ops::*; - -pub const NEW_LINE: &str = "\n"; -pub const WHITESPACE: &str = " "; diff --git a/shared-lib/lib-ot/src/core/delta/operation/mod.rs b/shared-lib/lib-ot/src/core/delta/operation/mod.rs deleted file mode 100644 index 067c55e98a..0000000000 --- a/shared-lib/lib-ot/src/core/delta/operation/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![allow(clippy::module_inception)] -mod operation; -mod operation_serde; - -pub use operation::*; -pub use operation_serde::*; diff --git a/shared-lib/lib-ot/src/core/delta/operation/operation.rs b/shared-lib/lib-ot/src/core/delta/operation/operation.rs deleted file mode 100644 index cbb0afa1a4..0000000000 --- a/shared-lib/lib-ot/src/core/delta/operation/operation.rs +++ /dev/null @@ -1,490 +0,0 @@ -use std::fmt::Display; -use std::{ - cmp::min, - fmt, - fmt::Debug, - ops::{Deref, DerefMut}, -}; - -use serde::{Deserialize, Serialize, __private::Formatter}; - -use crate::core::interval::Interval; -use crate::core::ot_str::OTString; -use crate::errors::OTError; - -pub trait OperationTransform { - /// Merges the operation with `other` into one operation while preserving - /// the changes of both. - /// - /// # Arguments - /// - /// * `other`: The delta gonna to merge. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{OperationTransform, DeltaBuilder}; - /// let delta = DeltaBuilder::new().build(); - /// let other = DeltaBuilder::new().insert("abc").build(); - /// let new_document = delta.compose(&other).unwrap(); - /// assert_eq!(new_document.content().unwrap(), "abc".to_owned()); - /// ``` - fn compose(&self, other: &Self) -> Result - where - Self: Sized; - - /// Transforms two operations a and b that happened concurrently and - /// produces two operations a' and b'. - /// (a', b') = a.transform(b) - /// a.compose(b') = b.compose(a') - /// - fn transform(&self, other: &Self) -> Result<(Self, Self), OTError> - where - Self: Sized; - - /// Returns the invert delta from the other. It can be used to do the undo operation. - /// - /// # Arguments - /// - /// * `other`: Generate the undo delta for [Other]. [Other] can compose the undo delta to return - /// to the previous state. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{OperationTransform, DeltaBuilder}; - /// let initial_delta = DeltaBuilder::new().build(); - /// let delta = DeltaBuilder::new().insert("abc").build(); - /// - /// let undo_delta = delta.invert(&initial_delta); - /// let composed_delta = initial_delta.compose(&delta).unwrap(); - /// let inverted_delta = composed_delta.compose(&undo_delta).unwrap(); - /// - /// assert_eq!(initial_delta, inverted_delta); - /// - /// ``` - fn invert(&self, other: &Self) -> Self; -} - -/// Each operation can carry attributes. For example, the [TextAttributes] has a list of key/value attributes. -/// Such as { bold: true, italic: true }. -/// -///Because [Operation] is generic over the T, so you must specify the T. For example, the [Delta] uses -///[EmptyAttributes] as the T. [EmptyAttributes] does nothing, just a phantom. -/// -pub trait OperationAttributes: - Default + Display + Eq + PartialEq + Clone + Debug + OperationTransform -{ - fn is_empty(&self) -> bool { - true - } - - /// Remove the attribute which value is None. - fn remove(&mut self) {} - - fn extend(&mut self, _other: Self) {} -} - -/// [DeltaOperation] consists of three types. -/// * Delete -/// * Retain -/// * Insert -/// -/// You could check [this](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/backend/delta) out for more information. -/// -/// The [T] should support serde if you want to serialize/deserialize the operation -/// to json string. You could check out the operation_serde.rs for more information. -/// -#[derive(Debug, Clone, Eq, PartialEq)] -pub enum DeltaOperation { - Delete(usize), - Retain(Retain), - Insert(Insert), -} - -impl DeltaOperation -where - T: OperationAttributes, -{ - pub fn delete(n: usize) -> Self { - Self::Delete(n) - } - - /// Create a [Retain] operation with the given attributes - pub fn retain_with_attributes(n: usize, attributes: T) -> Self { - Self::Retain(Retain { n, attributes }) - } - - /// Create a [Retain] operation without attributes - pub fn retain(n: usize) -> Self { - Self::Retain(Retain { - n, - attributes: T::default(), - }) - } - - /// Create a [Insert] operation with the given attributes - pub fn insert_with_attributes(s: &str, attributes: T) -> Self { - Self::Insert(Insert { - s: OTString::from(s), - attributes, - }) - } - - /// Create a [Insert] operation without attributes - pub fn insert(s: &str) -> Self { - Self::Insert(Insert { - s: OTString::from(s), - attributes: T::default(), - }) - } - - /// Return the String if the operation is [Insert] operation, otherwise return the empty string. - pub fn get_data(&self) -> &str { - match self { - DeltaOperation::Delete(_) => "", - DeltaOperation::Retain(_) => "", - DeltaOperation::Insert(insert) => &insert.s, - } - } - - pub fn get_attributes(&self) -> T { - match self { - DeltaOperation::Delete(_) => T::default(), - DeltaOperation::Retain(retain) => retain.attributes.clone(), - DeltaOperation::Insert(insert) => insert.attributes.clone(), - } - } - - pub fn set_attributes(&mut self, attributes: T) { - match self { - DeltaOperation::Delete(_) => tracing::error!("Delete should not contains attributes"), - DeltaOperation::Retain(retain) => retain.attributes = attributes, - DeltaOperation::Insert(insert) => insert.attributes = attributes, - } - } - - pub fn has_attribute(&self) -> bool { - !self.get_attributes().is_empty() - } - - pub fn len(&self) -> usize { - match self { - DeltaOperation::Delete(n) => *n, - DeltaOperation::Retain(r) => r.n, - DeltaOperation::Insert(i) => i.utf16_size(), - } - } - - pub fn is_empty(&self) -> bool { - self.len() == 0 - } - - #[allow(dead_code)] - pub fn split(&self, index: usize) -> (Option>, Option>) { - debug_assert!(index < self.len()); - let left; - let right; - match self { - DeltaOperation::Delete(n) => { - left = Some(DeltaOperation::::delete(index)); - right = Some(DeltaOperation::::delete(*n - index)); - }, - DeltaOperation::Retain(retain) => { - left = Some(DeltaOperation::::delete(index)); - right = Some(DeltaOperation::::delete(retain.n - index)); - }, - DeltaOperation::Insert(insert) => { - let attributes = self.get_attributes(); - left = Some(DeltaOperation::::insert_with_attributes( - &insert.s[0..index], - attributes.clone(), - )); - right = Some(DeltaOperation::::insert_with_attributes( - &insert.s[index..insert.utf16_size()], - attributes, - )); - }, - } - - (left, right) - } - - /// Returns an operation with the specified width. - /// # Arguments - /// - /// * `interval`: Specify the shrink width of the operation. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{Interval, DeltaOperation, EmptyAttributes}; - /// let operation = DeltaOperation::::insert("1234"); - /// - /// let op1 = operation.shrink(Interval::new(0,3)).unwrap(); - /// assert_eq!(op1 , DeltaOperation::insert("123")); - /// - /// let op2= operation.shrink(Interval::new(3,4)).unwrap(); - /// assert_eq!(op2, DeltaOperation::insert("4")); - /// ``` - pub fn shrink(&self, interval: Interval) -> Option> { - let op = match self { - DeltaOperation::Delete(n) => DeltaOperation::delete(min(*n, interval.size())), - DeltaOperation::Retain(retain) => DeltaOperation::retain_with_attributes( - min(retain.n, interval.size()), - retain.attributes.clone(), - ), - DeltaOperation::Insert(insert) => { - if interval.start > insert.utf16_size() { - DeltaOperation::insert("") - } else { - let s = insert.s.sub_str(interval).unwrap_or_else(|| "".to_owned()); - DeltaOperation::insert_with_attributes(&s, insert.attributes.clone()) - } - }, - }; - - match op.is_empty() { - true => None, - false => Some(op), - } - } - - pub fn is_delete(&self) -> bool { - if let DeltaOperation::Delete(_) = self { - return true; - } - false - } - - pub fn is_insert(&self) -> bool { - if let DeltaOperation::Insert(_) = self { - return true; - } - false - } - - pub fn is_retain(&self) -> bool { - if let DeltaOperation::Retain(_) = self { - return true; - } - false - } - - pub fn is_plain(&self) -> bool { - match self { - DeltaOperation::Delete(_) => true, - DeltaOperation::Retain(retain) => retain.is_plain(), - DeltaOperation::Insert(insert) => insert.is_plain(), - } - } -} - -impl fmt::Display for DeltaOperation -where - T: OperationAttributes, -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str("{")?; - match self { - DeltaOperation::Delete(n) => { - f.write_fmt(format_args!("delete: {}", n))?; - }, - DeltaOperation::Retain(r) => { - f.write_fmt(format_args!("{}", r))?; - }, - DeltaOperation::Insert(i) => { - f.write_fmt(format_args!("{}", i))?; - }, - } - f.write_str("}")?; - Ok(()) - } -} - -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct Retain { - pub n: usize, - pub attributes: T, -} - -impl fmt::Display for Retain -where - T: OperationAttributes, -{ - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - if self.attributes.is_empty() { - f.write_fmt(format_args!("retain: {}", self.n)) - } else { - f.write_fmt(format_args!( - "retain: {}, attributes: {}", - self.n, self.attributes - )) - } - } -} - -impl Retain -where - T: OperationAttributes, -{ - pub fn merge_or_new(&mut self, n: usize, attributes: T) -> Option> { - // tracing::trace!( - // "merge_retain_or_new_op: len: {:?}, l: {} - r: {}", - // n, - // self.attributes, - // attributes - // ); - if self.attributes == attributes { - self.n += n; - None - } else { - Some(DeltaOperation::retain_with_attributes(n, attributes)) - } - } - - pub fn is_plain(&self) -> bool { - self.attributes.is_empty() - } -} - -impl std::convert::From for Retain -where - T: OperationAttributes, -{ - fn from(n: usize) -> Self { - Retain { - n, - attributes: T::default(), - } - } -} - -impl Deref for Retain -where - T: OperationAttributes, -{ - type Target = usize; - - fn deref(&self) -> &Self::Target { - &self.n - } -} - -impl DerefMut for Retain -where - T: OperationAttributes, -{ - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.n - } -} - -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct Insert { - pub s: OTString, - pub attributes: T, -} - -impl fmt::Display for Insert -where - T: OperationAttributes, -{ - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - let mut s = self.s.clone(); - if s.ends_with('\n') { - s.pop(); - if s.is_empty() { - s = "new_line".into(); - } - } - - if self.attributes.is_empty() { - f.write_fmt(format_args!("insert: {}", s)) - } else { - f.write_fmt(format_args!( - "insert: {}, attributes: {}", - s, self.attributes - )) - } - } -} - -impl Insert -where - T: OperationAttributes, -{ - pub fn utf16_size(&self) -> usize { - self.s.utf16_len() - } - - pub fn merge_or_new_op(&mut self, s: &str, attributes: T) -> Option> { - if self.attributes == attributes { - self.s += s; - None - } else { - Some(DeltaOperation::::insert_with_attributes(s, attributes)) - } - } - - pub fn is_plain(&self) -> bool { - self.attributes.is_empty() - } -} - -impl std::convert::From for Insert -where - T: OperationAttributes, -{ - fn from(s: String) -> Self { - Insert { - s: s.into(), - attributes: T::default(), - } - } -} - -impl std::convert::From<&str> for Insert -where - T: OperationAttributes, -{ - fn from(s: &str) -> Self { - Insert::from(s.to_owned()) - } -} - -impl std::convert::From for Insert -where - T: OperationAttributes, -{ - fn from(s: OTString) -> Self { - Insert { - s, - attributes: T::default(), - } - } -} - -#[derive(Debug, Clone, Eq, PartialEq, Default, Serialize, Deserialize)] -pub struct EmptyAttributes(); -impl fmt::Display for EmptyAttributes { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str("PhantomAttributes") - } -} - -impl OperationAttributes for EmptyAttributes {} - -impl OperationTransform for EmptyAttributes { - fn compose(&self, _other: &Self) -> Result { - Ok(self.clone()) - } - - fn transform(&self, other: &Self) -> Result<(Self, Self), OTError> { - Ok((self.clone(), other.clone())) - } - - fn invert(&self, _other: &Self) -> Self { - self.clone() - } -} diff --git a/shared-lib/lib-ot/src/core/delta/operation/operation_serde.rs b/shared-lib/lib-ot/src/core/delta/operation/operation_serde.rs deleted file mode 100644 index 13ea729cdd..0000000000 --- a/shared-lib/lib-ot/src/core/delta/operation/operation_serde.rs +++ /dev/null @@ -1,340 +0,0 @@ -use crate::core::delta::operation::{DeltaOperation, Insert, OperationAttributes, Retain}; -use crate::core::ot_str::OTString; -use serde::{ - de, - de::{MapAccess, SeqAccess, Visitor}, - ser::SerializeMap, - Deserialize, Deserializer, Serialize, Serializer, -}; -use std::{fmt, marker::PhantomData}; - -impl Serialize for DeltaOperation -where - T: OperationAttributes + Serialize, -{ - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - match self { - DeltaOperation::Retain(retain) => retain.serialize(serializer), - DeltaOperation::Delete(i) => { - let mut map = serializer.serialize_map(Some(1))?; - map.serialize_entry("delete", i)?; - map.end() - }, - DeltaOperation::Insert(insert) => insert.serialize(serializer), - } - } -} - -impl<'de, T> Deserialize<'de> for DeltaOperation -where - T: OperationAttributes + Deserialize<'de>, -{ - fn deserialize(deserializer: D) -> Result, D::Error> - where - D: Deserializer<'de>, - { - struct OperationVisitor(PhantomData T>); - - impl<'de, T> Visitor<'de> for OperationVisitor - where - T: OperationAttributes + Deserialize<'de>, - { - type Value = DeltaOperation; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("an integer between -2^64 and 2^63 or a string") - } - - #[inline] - fn visit_map(self, mut map: V) -> Result - where - V: MapAccess<'de>, - { - let mut operation = None; - let mut attributes = None; - while let Some(key) = map.next_key()? { - match key { - "delete" => { - if operation.is_some() { - return Err(de::Error::duplicate_field("operation")); - } - operation = Some(DeltaOperation::::Delete(map.next_value()?)); - }, - "retain" => { - if operation.is_some() { - return Err(de::Error::duplicate_field("operation")); - } - let i: usize = map.next_value()?; - operation = Some(DeltaOperation::::Retain(i.into())); - }, - "insert" => { - if operation.is_some() { - return Err(de::Error::duplicate_field("operation")); - } - let i: String = map.next_value()?; - operation = Some(DeltaOperation::::Insert(i.into())); - }, - "attributes" => { - if attributes.is_some() { - return Err(de::Error::duplicate_field("attributes")); - } - let map: T = map.next_value()?; - attributes = Some(map); - }, - _ => {}, - } - } - match operation { - None => Err(de::Error::missing_field("operation")), - Some(mut operation) => { - if !operation.is_delete() { - operation.set_attributes(attributes.unwrap_or_default()); - } - Ok(operation) - }, - } - } - } - - deserializer.deserialize_any(OperationVisitor(PhantomData)) - } -} - -impl Serialize for Retain -where - T: OperationAttributes + Serialize, -{ - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let len = false as usize + 1 + if self.attributes.is_empty() { 0 } else { 1 }; - let mut serde_state = serializer.serialize_struct("Retain", len)?; - serde::ser::SerializeStruct::serialize_field(&mut serde_state, "retain", &self.n)?; - if !self.attributes.is_empty() { - serde::ser::SerializeStruct::serialize_field( - &mut serde_state, - "attributes", - &self.attributes, - )?; - } - serde::ser::SerializeStruct::end(serde_state) - } -} - -impl<'de, T> Deserialize<'de> for Retain -where - T: OperationAttributes + Deserialize<'de>, -{ - fn deserialize(deserializer: D) -> Result>::Error> - where - D: Deserializer<'de>, - { - struct RetainVisitor(PhantomData T>); - - impl<'de, T> Visitor<'de> for RetainVisitor - where - T: OperationAttributes + Deserialize<'de>, - { - type Value = Retain; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("struct Retain") - } - - #[inline] - fn visit_seq(self, mut seq: A) -> Result - where - A: SeqAccess<'de>, - { - let len = match serde::de::SeqAccess::next_element::(&mut seq)? { - Some(val) => val, - None => { - return Err(de::Error::invalid_length( - 0, - &"struct Retain with 2 elements", - )); - }, - }; - - let attributes = match serde::de::SeqAccess::next_element::(&mut seq)? { - Some(val) => val, - None => { - return Err(de::Error::invalid_length( - 1, - &"struct Retain with 2 elements", - )); - }, - }; - - Ok(Retain:: { n: len, attributes }) - } - - #[inline] - fn visit_map(self, mut map: V) -> Result - where - V: MapAccess<'de>, - { - let mut len: Option = None; - let mut attributes: Option = None; - while let Some(key) = map.next_key()? { - match key { - "retain" => { - if len.is_some() { - return Err(de::Error::duplicate_field("retain")); - } - len = Some(map.next_value()?); - }, - "attributes" => { - if attributes.is_some() { - return Err(de::Error::duplicate_field("attributes")); - } - attributes = Some(map.next_value()?); - }, - _ => panic!(), - } - } - - if len.is_none() { - return Err(de::Error::missing_field("len")); - } - - if attributes.is_none() { - return Err(de::Error::missing_field("attributes")); - } - Ok(Retain:: { - n: len.unwrap(), - attributes: attributes.unwrap(), - }) - } - } - const FIELDS: &[&str] = &["retain", "attributes"]; - serde::Deserializer::deserialize_struct( - deserializer, - "Retain", - FIELDS, - RetainVisitor(PhantomData), - ) - } -} - -impl Serialize for Insert -where - T: OperationAttributes + Serialize, -{ - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let len = false as usize + 1 + if self.attributes.is_empty() { 0 } else { 1 }; - let mut serde_state = serializer.serialize_struct("Insert", len)?; - serde::ser::SerializeStruct::serialize_field(&mut serde_state, "insert", &self.s)?; - if !self.attributes.is_empty() { - serde::ser::SerializeStruct::serialize_field( - &mut serde_state, - "attributes", - &self.attributes, - )?; - } - serde::ser::SerializeStruct::end(serde_state) - } -} - -impl<'de, T> Deserialize<'de> for Insert -where - T: OperationAttributes + Deserialize<'de>, -{ - fn deserialize(deserializer: D) -> Result>::Error> - where - D: Deserializer<'de>, - { - struct InsertVisitor(PhantomData T>); - - impl<'de, T> Visitor<'de> for InsertVisitor - where - T: OperationAttributes + Deserialize<'de>, - { - type Value = Insert; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("struct Insert") - } - - #[inline] - fn visit_seq(self, mut seq: A) -> Result - where - A: SeqAccess<'de>, - { - let s = match serde::de::SeqAccess::next_element::(&mut seq)? { - Some(val) => val, - None => { - return Err(de::Error::invalid_length( - 0, - &"struct Insert with 2 elements", - )); - }, - }; - - let attributes = match serde::de::SeqAccess::next_element::(&mut seq)? { - Some(val) => val, - None => { - return Err(de::Error::invalid_length( - 1, - &"struct Retain with 2 elements", - )); - }, - }; - - Ok(Insert:: { s, attributes }) - } - - #[inline] - fn visit_map(self, mut map: V) -> Result - where - V: MapAccess<'de>, - { - let mut s: Option = None; - let mut attributes: Option = None; - while let Some(key) = map.next_key()? { - match key { - "insert" => { - if s.is_some() { - return Err(de::Error::duplicate_field("insert")); - } - s = Some(map.next_value()?); - }, - "attributes" => { - if attributes.is_some() { - return Err(de::Error::duplicate_field("attributes")); - } - attributes = Some(map.next_value()?); - }, - _ => panic!(), - } - } - - if s.is_none() { - return Err(de::Error::missing_field("s")); - } - - if attributes.is_none() { - return Err(de::Error::missing_field("attributes")); - } - Ok(Insert:: { - s: s.unwrap(), - attributes: attributes.unwrap(), - }) - } - } - const FIELDS: &[&str] = &["insert", "attributes"]; - serde::Deserializer::deserialize_struct( - deserializer, - "Insert", - FIELDS, - InsertVisitor(PhantomData), - ) - } -} diff --git a/shared-lib/lib-ot/src/core/delta/ops.rs b/shared-lib/lib-ot/src/core/delta/ops.rs deleted file mode 100644 index 69e01e2d0f..0000000000 --- a/shared-lib/lib-ot/src/core/delta/ops.rs +++ /dev/null @@ -1,670 +0,0 @@ -use std::{ - cmp::{min, Ordering}, - fmt, - iter::FromIterator, - str, - str::FromStr, -}; - -use bytes::Bytes; -use serde::de::DeserializeOwned; - -use crate::core::delta::operation::{ - DeltaOperation, EmptyAttributes, OperationAttributes, OperationTransform, -}; -use crate::core::delta::{OperationIterator, MAX_IV_LEN}; -use crate::core::interval::Interval; -use crate::core::ot_str::OTString; -use crate::core::DeltaOperationBuilder; -use crate::errors::{ErrorBuilder, OTError, OTErrorCode}; - -pub type DeltaBuilder = DeltaOperationBuilder; - -/// A [Delta] contains list of operations that consists of 'Retain', 'Delete' and 'Insert' operation. -/// Check out the [Operation] for more details. It describes the document as a sequence of -/// operations. -/// -/// You could check [this](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/backend/delta) out for more information. -/// -/// If the [T] supports 'serde', that will enable delta to serialize to JSON or deserialize from -/// a JSON string. -/// -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct DeltaOperations { - pub ops: Vec>, - - /// 'Delete' and 'Retain' operation will update the [utf16_base_len] - /// Transforming the other delta, it requires the utf16_base_len must be equal. - pub utf16_base_len: usize, - - /// Represents the current len of the delta. - /// 'Insert' and 'Retain' operation will update the [utf16_target_len] - pub utf16_target_len: usize, -} - -impl Default for DeltaOperations -where - T: OperationAttributes, -{ - fn default() -> Self { - Self { - ops: Vec::new(), - utf16_base_len: 0, - utf16_target_len: 0, - } - } -} - -impl fmt::Display for DeltaOperations -where - T: OperationAttributes, -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // f.write_str(&serde_json::to_string(self).unwrap_or("".to_owned()))?; - f.write_str("[ ")?; - for op in &self.ops { - f.write_fmt(format_args!("{} ", op))?; - } - f.write_str("]")?; - Ok(()) - } -} - -impl FromIterator> for DeltaOperations -where - T: OperationAttributes, -{ - fn from_iter>>(ops: I) -> Self { - let mut operations = DeltaOperations::default(); - for op in ops { - operations.add(op); - } - operations - } -} - -impl DeltaOperations -where - T: OperationAttributes, -{ - pub fn new() -> Self { - Self::default() - } - - #[inline] - pub fn with_capacity(capacity: usize) -> Self { - Self { - ops: Vec::with_capacity(capacity), - utf16_base_len: 0, - utf16_target_len: 0, - } - } - - /// Adding an operation. It will be added in sequence. - pub fn add(&mut self, op: DeltaOperation) { - match op { - DeltaOperation::Delete(i) => self.delete(i), - DeltaOperation::Insert(i) => self.insert(&i.s, i.attributes), - DeltaOperation::Retain(r) => self.retain(r.n, r.attributes), - } - } - - /// Creating a [Delete] operation with len [n] - pub fn delete(&mut self, n: usize) { - if n == 0 { - return; - } - self.utf16_base_len += n; - if let Some(DeltaOperation::Delete(n_last)) = self.ops.last_mut() { - *n_last += n; - } else { - self.ops.push(DeltaOperation::delete(n)); - } - } - - /// Creating a [Insert] operation with string, [s]. - pub fn insert(&mut self, s: &str, attributes: T) { - let s: OTString = s.into(); - if s.is_empty() { - return; - } - - self.utf16_target_len += s.utf16_len(); - let new_last = match self.ops.as_mut_slice() { - [.., DeltaOperation::::Insert(insert)] => { - // - insert.merge_or_new_op(&s, attributes) - }, - [.., DeltaOperation::::Insert(pre_insert), DeltaOperation::Delete(_)] => { - // - pre_insert.merge_or_new_op(&s, attributes) - }, - [.., op_last @ DeltaOperation::::Delete(_)] => { - let new_last = op_last.clone(); - *op_last = DeltaOperation::::insert_with_attributes(&s, attributes); - Some(new_last) - }, - _ => Some(DeltaOperation::::insert_with_attributes(&s, attributes)), - }; - - match new_last { - None => {}, - Some(new_last) => self.ops.push(new_last), - } - } - - /// Creating a [Retain] operation with len, [n]. - pub fn retain(&mut self, n: usize, attributes: T) { - if n == 0 { - return; - } - self.utf16_base_len += n; - self.utf16_target_len += n; - - if let Some(DeltaOperation::::Retain(retain)) = self.ops.last_mut() { - if let Some(new_op) = retain.merge_or_new(n, attributes) { - self.ops.push(new_op); - } - } else { - self - .ops - .push(DeltaOperation::::retain_with_attributes(n, attributes)); - } - } - - /// Return the a new string described by this delta. The new string will contains the input string. - /// The length of the [applied_str] must be equal to the the [utf16_base_len]. - /// - /// # Arguments - /// - /// * `applied_str`: A string represents the utf16_base_len content. it will be consumed by the [retain] - /// or [delete] operations. - /// - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::DeltaBuilder; - /// let s = "hello"; - /// let delta_a = DeltaBuilder::new().insert(s).build(); - /// let delta_b = DeltaBuilder::new() - /// .retain(s.len()) - /// .insert(", AppFlowy") - /// .build(); - /// - /// let after_a = delta_a.content().unwrap(); - /// let after_b = delta_b.apply(&after_a).unwrap(); - /// assert_eq!("hello, AppFlowy", &after_b); - /// ``` - pub fn apply(&self, applied_str: &str) -> Result { - let applied_str: OTString = applied_str.into(); - if applied_str.utf16_len() != self.utf16_base_len { - return Err( - ErrorBuilder::new(OTErrorCode::IncompatibleLength) - .msg(format!( - "Expected: {}, but received: {}", - self.utf16_base_len, - applied_str.utf16_len() - )) - .build(), - ); - } - let mut new_s = String::new(); - let code_point_iter = &mut applied_str.utf16_iter(); - for op in &self.ops { - match &op { - DeltaOperation::Retain(retain) => { - for c in code_point_iter.take(retain.n) { - new_s.push_str(str::from_utf8(c.0).unwrap_or("")); - } - }, - DeltaOperation::Delete(delete) => { - for _ in 0..*delete { - code_point_iter.next(); - } - }, - DeltaOperation::Insert(insert) => { - new_s += &insert.s; - }, - } - } - Ok(new_s) - } - - pub fn inverted(&self) -> Self { - self.invert_str("") - } - - /// Computes the inverse [Delta]. The inverse of an operation is the - /// operation that reverts the effects of the operation - /// # Arguments - /// - /// * `inverted_s`: A string represents the utf16_base_len content. The len of [inverted_s] - /// must equal to the [utf16_base_len], it will be consumed by the [retain] or [delete] operations. - /// - /// If the delta's operations just contain a insert operation. The inverted_s must be empty string. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::DeltaBuilder; - /// let s = "hello world"; - /// let delta = DeltaBuilder::new().insert(s).build(); - /// let invert_delta = delta.invert_str(s); - /// assert_eq!(delta.utf16_base_len, invert_delta.utf16_target_len); - /// assert_eq!(delta.utf16_target_len, invert_delta.utf16_base_len); - /// - /// assert_eq!(invert_delta.apply(s).unwrap(), "") - /// - /// ``` - /// - pub fn invert_str(&self, inverted_s: &str) -> Self { - let mut inverted = DeltaOperations::default(); - let inverted_s: OTString = inverted_s.into(); - let code_point_iter = &mut inverted_s.utf16_iter(); - - for op in &self.ops { - match &op { - DeltaOperation::Retain(retain) => { - inverted.retain(retain.n, T::default()); - for _ in 0..retain.n { - code_point_iter.next(); - } - }, - DeltaOperation::Insert(insert) => { - inverted.delete(insert.utf16_size()); - }, - DeltaOperation::Delete(delete) => { - let bytes = code_point_iter - .take(*delete) - .flat_map(|a| str::from_utf8(a.0).ok()) - .collect::(); - - inverted.insert(&bytes, op.get_attributes()); - }, - } - } - inverted - } - - /// Return true if the delta doesn't contain any [Insert] or [Delete] operations. - pub fn is_noop(&self) -> bool { - matches!(self.ops.as_slice(), [] | [DeltaOperation::Retain(_)]) - } - - pub fn is_empty(&self) -> bool { - self.ops.is_empty() - } - - pub fn extend(&mut self, other: Self) { - other.ops.into_iter().for_each(|op| self.add(op)); - } - - /// Get the content that the [Delta] represents. - pub fn content(&self) -> Result { - self.apply("") - } -} - -impl OperationTransform for DeltaOperations -where - T: OperationAttributes, -{ - fn compose(&self, other: &Self) -> Result - where - Self: Sized, - { - let mut new_delta = DeltaOperations::default(); - let mut iter = OperationIterator::new(self); - let mut other_iter = OperationIterator::new(other); - - while iter.has_next() || other_iter.has_next() { - if other_iter.is_next_insert() { - new_delta.add(other_iter.next_op().unwrap()); - continue; - } - - if iter.is_next_delete() { - new_delta.add(iter.next_op().unwrap()); - continue; - } - - let length = min( - iter.next_op_len().unwrap_or(MAX_IV_LEN), - other_iter.next_op_len().unwrap_or(MAX_IV_LEN), - ); - - let op = iter - .next_op_with_len(length) - .unwrap_or_else(|| DeltaOperation::retain(length)); - let other_op = other_iter - .next_op_with_len(length) - .unwrap_or_else(|| DeltaOperation::retain(length)); - - // debug_assert_eq!(op.len(), other_op.len(), "Composing delta failed,"); - - match (&op, &other_op) { - (DeltaOperation::Retain(retain), DeltaOperation::Retain(other_retain)) => { - let composed_attrs = retain.attributes.compose(&other_retain.attributes)?; - - new_delta.add(DeltaOperation::retain_with_attributes( - retain.n, - composed_attrs, - )) - }, - (DeltaOperation::Insert(insert), DeltaOperation::Retain(other_retain)) => { - let mut composed_attrs = insert.attributes.compose(&other_retain.attributes)?; - composed_attrs.remove(); - new_delta.add(DeltaOperation::insert_with_attributes( - op.get_data(), - composed_attrs, - )) - }, - (DeltaOperation::Retain(_), DeltaOperation::Delete(_)) => { - new_delta.add(other_op); - }, - (a, b) => { - debug_assert!(a.is_insert()); - debug_assert!(b.is_delete()); - continue; - }, - } - } - Ok(new_delta) - } - - fn transform(&self, other: &Self) -> Result<(Self, Self), OTError> - where - Self: Sized, - { - if self.utf16_base_len != other.utf16_base_len { - return Err( - ErrorBuilder::new(OTErrorCode::IncompatibleLength) - .msg(format!( - "cur base length: {}, other base length: {}", - self.utf16_base_len, other.utf16_base_len - )) - .build(), - ); - } - - let mut a_prime = DeltaOperations::default(); - let mut b_prime = DeltaOperations::default(); - - let mut ops1 = self.ops.iter().cloned(); - let mut ops2 = other.ops.iter().cloned(); - - let mut next_op1 = ops1.next(); - let mut next_op2 = ops2.next(); - loop { - match (&next_op1, &next_op2) { - (None, None) => break, - (Some(DeltaOperation::Insert(insert)), _) => { - // let composed_attrs = transform_attributes(&next_op1, &next_op2, true); - a_prime.insert(&insert.s, insert.attributes.clone()); - b_prime.retain(insert.utf16_size(), insert.attributes.clone()); - next_op1 = ops1.next(); - }, - (_, Some(DeltaOperation::Insert(o_insert))) => { - let composed_attrs = transform_op_attribute(&next_op1, &next_op2)?; - a_prime.retain(o_insert.utf16_size(), composed_attrs.clone()); - b_prime.insert(&o_insert.s, composed_attrs); - next_op2 = ops2.next(); - }, - (None, _) => { - return Err(ErrorBuilder::new(OTErrorCode::IncompatibleLength).build()); - }, - (_, None) => { - return Err(ErrorBuilder::new(OTErrorCode::IncompatibleLength).build()); - }, - (Some(DeltaOperation::Retain(retain)), Some(DeltaOperation::Retain(o_retain))) => { - let composed_attrs = transform_op_attribute(&next_op1, &next_op2)?; - match retain.cmp(o_retain) { - Ordering::Less => { - a_prime.retain(retain.n, composed_attrs.clone()); - b_prime.retain(retain.n, composed_attrs.clone()); - next_op2 = Some(DeltaOperation::retain(o_retain.n - retain.n)); - next_op1 = ops1.next(); - }, - Ordering::Equal => { - a_prime.retain(retain.n, composed_attrs.clone()); - b_prime.retain(retain.n, composed_attrs.clone()); - next_op1 = ops1.next(); - next_op2 = ops2.next(); - }, - Ordering::Greater => { - a_prime.retain(o_retain.n, composed_attrs.clone()); - b_prime.retain(o_retain.n, composed_attrs.clone()); - next_op1 = Some(DeltaOperation::retain(retain.n - o_retain.n)); - next_op2 = ops2.next(); - }, - }; - }, - (Some(DeltaOperation::Delete(i)), Some(DeltaOperation::Delete(j))) => match i.cmp(j) { - Ordering::Less => { - next_op2 = Some(DeltaOperation::delete(*j - *i)); - next_op1 = ops1.next(); - }, - Ordering::Equal => { - next_op1 = ops1.next(); - next_op2 = ops2.next(); - }, - Ordering::Greater => { - next_op1 = Some(DeltaOperation::delete(*i - *j)); - next_op2 = ops2.next(); - }, - }, - (Some(DeltaOperation::Delete(i)), Some(DeltaOperation::Retain(o_retain))) => { - match i.cmp(o_retain) { - Ordering::Less => { - a_prime.delete(*i); - next_op2 = Some(DeltaOperation::retain(o_retain.n - *i)); - next_op1 = ops1.next(); - }, - Ordering::Equal => { - a_prime.delete(*i); - next_op1 = ops1.next(); - next_op2 = ops2.next(); - }, - Ordering::Greater => { - a_prime.delete(o_retain.n); - next_op1 = Some(DeltaOperation::delete(*i - o_retain.n)); - next_op2 = ops2.next(); - }, - }; - }, - (Some(DeltaOperation::Retain(retain)), Some(DeltaOperation::Delete(j))) => { - match retain.cmp(j) { - Ordering::Less => { - b_prime.delete(retain.n); - next_op2 = Some(DeltaOperation::delete(*j - retain.n)); - next_op1 = ops1.next(); - }, - Ordering::Equal => { - b_prime.delete(retain.n); - next_op1 = ops1.next(); - next_op2 = ops2.next(); - }, - Ordering::Greater => { - b_prime.delete(*j); - next_op1 = Some(DeltaOperation::retain(retain.n - *j)); - next_op2 = ops2.next(); - }, - }; - }, - } - } - Ok((a_prime, b_prime)) - } - - fn invert(&self, other: &Self) -> Self { - let mut inverted = DeltaOperations::default(); - let mut index = 0; - for op in &self.ops { - let len: usize = op.len(); - match op { - DeltaOperation::Delete(n) => { - invert_other(&mut inverted, other, op, index, index + *n); - index += len; - }, - DeltaOperation::Retain(_) => { - match op.has_attribute() { - true => invert_other(&mut inverted, other, op, index, index + len), - false => { - // tracing::trace!("invert retain: {} by retain {} {}", op, len, - // op.get_attributes()); - inverted.retain(len, op.get_attributes()) - }, - } - index += len; - }, - DeltaOperation::Insert(_) => { - // tracing::trace!("invert insert: {} by delete {}", op, len); - inverted.delete(len); - }, - } - } - inverted - } -} - -/// Removes trailing retain operation with empty attributes, if present. -pub fn trim(delta: &mut DeltaOperations) -where - T: OperationAttributes, -{ - if let Some(last) = delta.ops.last() { - if last.is_retain() && last.is_plain() { - delta.ops.pop(); - } - } -} - -fn invert_other( - base: &mut DeltaOperations, - other: &DeltaOperations, - operation: &DeltaOperation, - start: usize, - end: usize, -) { - tracing::trace!("invert op: {} [{}:{}]", operation, start, end); - let other_ops = OperationIterator::from_interval(other, Interval::new(start, end)).ops(); - other_ops.into_iter().for_each(|other_op| match operation { - DeltaOperation::Delete(_n) => { - // tracing::trace!("invert delete: {} by add {}", n, other_op); - base.add(other_op); - }, - DeltaOperation::Retain(_retain) => { - tracing::trace!( - "invert attributes: {:?}, {:?}", - operation.get_attributes(), - other_op.get_attributes() - ); - let inverted_attrs = operation - .get_attributes() - .invert(&other_op.get_attributes()); - base.retain(other_op.len(), inverted_attrs); - }, - DeltaOperation::Insert(_) => { - tracing::error!("Impossible to here. Insert operation should be treated as delete") - }, - }); -} - -fn transform_op_attribute( - left: &Option>, - right: &Option>, -) -> Result { - if left.is_none() { - if right.is_none() { - return Ok(T::default()); - } - return Ok(right.as_ref().unwrap().get_attributes()); - } - let left = left.as_ref().unwrap().get_attributes(); - let right = right.as_ref().unwrap().get_attributes(); - // TODO: replace with anyhow and this error. - Ok(left.transform(&right)?.0) -} - -impl DeltaOperations -where - T: OperationAttributes + DeserializeOwned, -{ - /// # Examples - /// - /// ``` - /// use lib_ot::core::DeltaOperationBuilder; - /// use lib_ot::text_delta::{DeltaTextOperations}; - /// let json = r#"[ - /// {"retain":7,"attributes":{"bold":null}} - /// ]"#; - /// let delta = DeltaTextOperations::from_json(json).unwrap(); - /// assert_eq!(delta.json_str(), r#"[{"retain":7,"attributes":{"bold":null}}]"#); - /// ``` - pub fn from_json(json: &str) -> Result { - let delta = serde_json::from_str(json).map_err(|e| { - tracing::trace!("Deserialize failed: {:?}", e); - tracing::trace!("{:?}", json); - e - })?; - Ok(delta) - } - - /// Deserialize the bytes into [Delta]. It requires the bytes is in utf8 format. - pub fn from_bytes>(bytes: B) -> Result { - let json = str::from_utf8(bytes.as_ref())?.to_owned(); - let val = Self::from_json(&json)?; - Ok(val) - } -} - -impl DeltaOperations -where - T: OperationAttributes + serde::Serialize, -{ - /// Serialize the [Delta] into a String in JSON format - pub fn json_str(&self) -> String { - serde_json::to_string(self).unwrap_or_else(|_| "".to_owned()) - } - - /// Serial the [Delta] into a String in Bytes format - pub fn json_bytes(&self) -> Bytes { - let json = self.json_str(); - Bytes::from(json.into_bytes()) - } -} - -impl FromStr for DeltaOperations -where - T: OperationAttributes, -{ - type Err = (); - - fn from_str(s: &str) -> Result, Self::Err> { - let mut delta = DeltaOperations::with_capacity(1); - delta.add(DeltaOperation::Insert(s.into())); - Ok(delta) - } -} - -impl std::convert::TryFrom> for DeltaOperations -where - T: OperationAttributes + DeserializeOwned, -{ - type Error = OTError; - fn try_from(bytes: Vec) -> Result { - DeltaOperations::from_bytes(bytes) - } -} - -impl std::convert::TryFrom for DeltaOperations -where - T: OperationAttributes + DeserializeOwned, -{ - type Error = OTError; - - fn try_from(bytes: Bytes) -> Result { - DeltaOperations::from_bytes(&bytes) - } -} diff --git a/shared-lib/lib-ot/src/core/delta/ops_serde.rs b/shared-lib/lib-ot/src/core/delta/ops_serde.rs deleted file mode 100644 index 7837b49ced..0000000000 --- a/shared-lib/lib-ot/src/core/delta/ops_serde.rs +++ /dev/null @@ -1,62 +0,0 @@ -use crate::core::delta::operation::OperationAttributes; -use crate::core::delta::DeltaOperations; - -use serde::{ - de::{SeqAccess, Visitor}, - ser::SerializeSeq, - Deserialize, Deserializer, Serialize, Serializer, -}; -use std::{fmt, marker::PhantomData}; - -impl Serialize for DeltaOperations -where - T: OperationAttributes + Serialize, -{ - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let mut seq = serializer.serialize_seq(Some(self.ops.len()))?; - for op in self.ops.iter() { - seq.serialize_element(op)?; - } - seq.end() - } -} - -impl<'de, T> Deserialize<'de> for DeltaOperations -where - T: OperationAttributes + Deserialize<'de>, -{ - fn deserialize(deserializer: D) -> Result, D::Error> - where - D: Deserializer<'de>, - { - struct OperationSeqVisitor(PhantomData T>); - - impl<'de, T> Visitor<'de> for OperationSeqVisitor - where - T: OperationAttributes + Deserialize<'de>, - { - type Value = DeltaOperations; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("a sequence") - } - - #[inline] - fn visit_seq(self, mut seq: A) -> Result - where - A: SeqAccess<'de>, - { - let mut o = DeltaOperations::default(); - while let Some(op) = seq.next_element()? { - o.add(op); - } - Ok(o) - } - } - - deserializer.deserialize_seq(OperationSeqVisitor(PhantomData)) - } -} diff --git a/shared-lib/lib-ot/src/core/interval.rs b/shared-lib/lib-ot/src/core/interval.rs deleted file mode 100644 index ca5f0b9f10..0000000000 --- a/shared-lib/lib-ot/src/core/interval.rs +++ /dev/null @@ -1,243 +0,0 @@ -use serde::{Deserialize, Serialize}; -use std::{ - cmp::{max, min}, - fmt, - ops::{Range, RangeInclusive, RangeTo, RangeToInclusive}, -}; - -/// Representing a closed-open range; -/// the interval [5, 7) is the set {5, 6}. -/// -/// It is an invariant that `start <= end`. An interval where `end < start` is -/// considered empty. -#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -pub struct Interval { - pub start: usize, - pub end: usize, -} - -impl Interval { - /// Construct a new `Interval` representing the range [start..end). - /// It is an invariant that `start <= end`. - pub fn new(start: usize, end: usize) -> Interval { - debug_assert!(start <= end); - Interval { start, end } - } - - pub fn start(&self) -> usize { - self.start - } - - pub fn end(&self) -> usize { - self.end - } - - pub fn start_end(&self) -> (usize, usize) { - (self.start, self.end) - } - - pub fn is_before(&self, val: usize) -> bool { - self.end <= val - } - - pub fn contains(&self, val: usize) -> bool { - self.start <= val && val < self.end - } - - pub fn contains_range(&self, start: usize, end: usize) -> bool { - !self.intersect(Interval::new(start, end)).is_empty() - } - - pub fn is_after(&self, val: usize) -> bool { - self.start > val - } - - pub fn is_empty(&self) -> bool { - self.end <= self.start - } - - pub fn intersect(&self, other: Interval) -> Interval { - let start = max(self.start, other.start); - let end = min(self.end, other.end); - Interval { - start, - end: max(start, end), - } - } - - // the first half of self - other - pub fn prefix(&self, other: Interval) -> Interval { - Interval { - start: min(self.start, other.start), - end: min(self.end, other.start), - } - } - - // the second half of self - other - pub fn suffix(&self, other: Interval) -> Interval { - Interval { - start: max(self.start, other.end), - end: max(self.end, other.end), - } - } - - pub fn translate(&self, amount: usize) -> Interval { - Interval { - start: self.start + amount, - end: self.end + amount, - } - } - - pub fn translate_neg(&self, amount: usize) -> Interval { - debug_assert!(self.start >= amount); - Interval { - start: self.start - amount, - end: self.end - amount, - } - } - - pub fn union(&self, other: Interval) -> Interval { - if self.is_empty() { - return other; - } - if other.is_empty() { - return *self; - } - let start = min(self.start, other.start); - let end = max(self.end, other.end); - Interval { start, end } - } - - pub fn size(&self) -> usize { - self.end - self.start - } -} - -impl std::default::Default for Interval { - fn default() -> Self { - Interval::new(0, 0) - } -} - -impl fmt::Display for Interval { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[{}, {})", self.start(), self.end()) - } -} - -impl fmt::Debug for Interval { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(self, f) - } -} - -impl From> for Interval { - fn from(src: Range) -> Interval { - let Range { start, end } = src; - Interval { start, end } - } -} - -impl From> for Interval { - fn from(src: RangeTo) -> Interval { - Interval::new(0, src.end) - } -} - -impl From> for Interval { - fn from(src: RangeInclusive) -> Interval { - Interval::new(*src.start(), src.end().saturating_add(1)) - } -} - -impl From> for Interval { - fn from(src: RangeToInclusive) -> Interval { - Interval::new(0, src.end.saturating_add(1)) - } -} - -#[cfg(test)] -mod tests { - use crate::core::interval::Interval; - - #[test] - fn contains() { - let i = Interval::new(2, 42); - assert!(!i.contains(1)); - assert!(i.contains(2)); - assert!(i.contains(3)); - assert!(i.contains(41)); - assert!(!i.contains(42)); - assert!(!i.contains(43)); - } - - #[test] - fn before() { - let i = Interval::new(2, 42); - assert!(!i.is_before(1)); - assert!(!i.is_before(2)); - assert!(!i.is_before(3)); - assert!(!i.is_before(41)); - assert!(i.is_before(42)); - assert!(i.is_before(43)); - } - - #[test] - fn after() { - let i = Interval::new(2, 42); - assert!(i.is_after(1)); - assert!(!i.is_after(2)); - assert!(!i.is_after(3)); - assert!(!i.is_after(41)); - assert!(!i.is_after(42)); - assert!(!i.is_after(43)); - } - - #[test] - fn translate() { - let i = Interval::new(2, 42); - assert_eq!(Interval::new(5, 45), i.translate(3)); - assert_eq!(Interval::new(1, 41), i.translate_neg(1)); - } - - #[test] - fn empty() { - assert!(Interval::new(0, 0).is_empty()); - assert!(Interval::new(1, 1).is_empty()); - assert!(!Interval::new(1, 2).is_empty()); - } - - #[test] - fn intersect() { - assert_eq!( - Interval::new(2, 3), - Interval::new(1, 3).intersect(Interval::new(2, 4)) - ); - assert!(Interval::new(1, 2) - .intersect(Interval::new(2, 43)) - .is_empty()); - } - - #[test] - fn prefix() { - assert_eq!( - Interval::new(1, 2), - Interval::new(1, 4).prefix(Interval::new(2, 3)) - ); - } - - #[test] - fn suffix() { - assert_eq!( - Interval::new(3, 4), - Interval::new(1, 4).suffix(Interval::new(2, 3)) - ); - } - - #[test] - fn size() { - assert_eq!(40, Interval::new(2, 42).size()); - assert_eq!(0, Interval::new(1, 1).size()); - assert_eq!(1, Interval::new(1, 2).size()); - } -} diff --git a/shared-lib/lib-ot/src/core/mod.rs b/shared-lib/lib-ot/src/core/mod.rs deleted file mode 100644 index 7d038c8b5d..0000000000 --- a/shared-lib/lib-ot/src/core/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub mod attributes; -mod delta; -mod interval; -mod node_tree; -mod ot_str; - -pub use attributes::*; -pub use delta::operation::*; -pub use delta::*; -pub use interval::*; -pub use node_tree::*; -pub use ot_str::*; diff --git a/shared-lib/lib-ot/src/core/node_tree/mod.rs b/shared-lib/lib-ot/src/core/node_tree/mod.rs deleted file mode 100644 index 417c4af03f..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![allow(clippy::module_inception)] - -mod node; -mod node_serde; -mod operation; -mod operation_serde; -mod path; -mod transaction; -mod transaction_serde; -mod tree; -mod tree_serde; - -pub use node::*; -pub use operation::*; -pub use path::*; -pub use transaction::*; -pub use tree::*; -pub use tree_serde::*; - -pub use indextree::NodeId; diff --git a/shared-lib/lib-ot/src/core/node_tree/node.rs b/shared-lib/lib-ot/src/core/node_tree/node.rs deleted file mode 100644 index 3b9284c03d..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/node.rs +++ /dev/null @@ -1,314 +0,0 @@ -use super::node_serde::*; -use crate::core::attributes::{AttributeHashMap, AttributeKey, AttributeValue}; -use crate::core::Body::Delta; -use crate::core::{AttributeEntry, OperationTransform}; -use crate::errors::OTError; -use crate::text_delta::DeltaTextOperations; -use serde::{Deserialize, Serialize}; - -pub trait ToNodeData: Send + Sync { - fn to_node_data(&self) -> NodeData; -} - -impl ToNodeData for Box -where - T: ToNodeData, -{ - fn to_node_data(&self) -> NodeData { - (**self).to_node_data() - } -} - -#[derive(Default, Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] -pub struct NodeData { - #[serde(rename = "type")] - pub node_type: String, - - #[serde(skip_serializing_if = "AttributeHashMap::is_empty")] - #[serde(default)] - pub attributes: AttributeHashMap, - - #[serde(serialize_with = "serialize_body")] - #[serde(deserialize_with = "deserialize_body")] - #[serde(skip_serializing_if = "Body::is_empty")] - #[serde(default)] - pub body: Body, - - #[serde(skip_serializing_if = "Vec::is_empty")] - #[serde(default)] - pub children: Vec, -} - -impl NodeData { - pub fn new(node_type: T) -> NodeData { - NodeData { - node_type: node_type.to_string(), - ..Default::default() - } - } - - pub fn split(self) -> (Node, Vec) { - let node = Node { - node_type: self.node_type, - body: self.body, - attributes: self.attributes, - }; - - (node, self.children) - } -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct RepeatedNodeData(Vec); - -/// Builder for [`NodeData`] -pub struct NodeDataBuilder { - node: NodeData, -} - -impl NodeDataBuilder { - pub fn new(node_type: T) -> Self { - Self { - node: NodeData::new(node_type.to_string()), - } - } - - /// Appends a new node to the end of the builder's node children. - pub fn add_node_data(mut self, node: NodeData) -> Self { - self.node.children.push(node); - self - } - - pub fn extend_node_data(mut self, node: Vec) -> Self { - self.node.children.extend(node); - self - } - - /// Inserts attributes to the builder's node. - /// - /// The attributes will be replace if they shared the same key - pub fn insert_attribute, V: Into>( - mut self, - key: K, - value: V, - ) -> Self { - self.node.attributes.insert(key.into(), value); - self - } - - pub fn insert_attribute_entry(mut self, entry: AttributeEntry) -> Self { - self.node.attributes.insert_entry(entry); - self - } - - pub fn insert_delta(mut self, delta: DeltaTextOperations) -> Self { - self.node.body = Body::Delta(delta); - self - } - - /// Returns the builder's node - pub fn build(self) -> NodeData { - self.node - } -} - -/// NodeBody represents as the node's data. -/// -/// For the moment, the NodeBody can be Empty or Delta. We can extend -/// the NodeBody by adding a new enum type. -/// -/// The NodeBody implements the [`OperationTransform`] trait which means it can perform -/// compose, transform and invert. -/// -#[derive(Debug, Clone, PartialEq, Eq, Default)] -pub enum Body { - #[default] - Empty, - Delta(DeltaTextOperations), -} - -impl Body { - fn is_empty(&self) -> bool { - matches!(self, Body::Empty) - } -} - -impl OperationTransform for Body { - /// Only the same enum variant can perform the compose operation. - fn compose(&self, other: &Self) -> Result - where - Self: Sized, - { - match (self, other) { - (Delta(a), Delta(b)) => a.compose(b).map(Delta), - (Body::Empty, Delta(b)) => Ok(Delta(b.clone())), - (Body::Empty, Body::Empty) => Ok(Body::Empty), - (l, r) => { - let msg = format!("{:?} can not compose {:?}", l, r); - Err(OTError::internal().context(msg)) - }, - } - } - - /// Only the same enum variant can perform the transform operation. - fn transform(&self, other: &Self) -> Result<(Self, Self), OTError> - where - Self: Sized, - { - match (self, other) { - (Delta(l), Delta(r)) => l.transform(r).map(|(ta, tb)| (Delta(ta), Delta(tb))), - (Body::Empty, Body::Empty) => Ok((Body::Empty, Body::Empty)), - (l, r) => { - let msg = format!("{:?} can not compose {:?}", l, r); - Err(OTError::internal().context(msg)) - }, - } - } - - /// Only the same enum variant can perform the invert operation. - fn invert(&self, other: &Self) -> Self { - match (self, other) { - (Delta(l), Delta(r)) => Delta(l.invert(r)), - (Body::Empty, Body::Empty) => Body::Empty, - (l, r) => { - tracing::error!("{:?} can not compose {:?}", l, r); - l.clone() - }, - } - } -} - -/// Represents the changeset of the [`NodeBody`] -/// -/// Each NodeBody except the Empty should have its corresponding changeset variant. -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum Changeset { - Delta { - delta: DeltaTextOperations, - inverted: DeltaTextOperations, - }, - Attributes { - new: AttributeHashMap, - old: AttributeHashMap, - }, -} - -impl Changeset { - pub fn is_delta(&self) -> bool { - match self { - Changeset::Delta { .. } => true, - Changeset::Attributes { .. } => false, - } - } - pub fn is_attribute(&self) -> bool { - match self { - Changeset::Delta { .. } => false, - Changeset::Attributes { .. } => true, - } - } - pub fn inverted(&self) -> Changeset { - match self { - Changeset::Delta { delta, inverted } => Changeset::Delta { - delta: inverted.clone(), - inverted: delta.clone(), - }, - Changeset::Attributes { new, old } => Changeset::Attributes { - new: old.clone(), - old: new.clone(), - }, - } - } - - pub fn compose(&mut self, other: &Changeset) -> Result<(), OTError> { - match (self, other) { - ( - Changeset::Delta { delta, inverted }, - Changeset::Delta { - delta: other_delta, - inverted: _, - }, - ) => { - let original = delta.compose(inverted)?; - let new_delta = delta.compose(other_delta)?; - let new_inverted = new_delta.invert(&original); - - *delta = new_delta; - *inverted = new_inverted; - Ok(()) - }, - ( - Changeset::Attributes { new, old }, - Changeset::Attributes { - new: other_new, - old: other_old, - }, - ) => { - *new = other_new.clone(); - *old = other_old.clone(); - Ok(()) - }, - (left, right) => { - let err = format!( - "Compose changeset failed. {:?} can't compose {:?}", - left, right - ); - Err(OTError::compose().context(err)) - }, - } - } -} - -/// [`Node`] represents as a leaf in the [`NodeTree`]. -/// -#[derive(Clone, Eq, PartialEq, Debug)] -pub struct Node { - pub node_type: String, - pub body: Body, - pub attributes: AttributeHashMap, -} - -impl Node { - pub fn new(node_type: &str) -> Node { - Node { - node_type: node_type.into(), - attributes: AttributeHashMap::new(), - body: Body::Empty, - } - } - - pub fn apply_changeset(&mut self, changeset: Changeset) -> Result<(), OTError> { - match changeset { - Changeset::Delta { delta, inverted: _ } => { - let new_body = self.body.compose(&Delta(delta))?; - self.body = new_body; - Ok(()) - }, - Changeset::Attributes { new, old: _ } => { - let new_attributes = AttributeHashMap::compose(&self.attributes, &new)?; - self.attributes = new_attributes; - Ok(()) - }, - } - } -} - -impl std::convert::From for Node { - fn from(node: NodeData) -> Self { - Self { - node_type: node.node_type, - attributes: node.attributes, - body: node.body, - } - } -} - -impl std::convert::From<&NodeData> for Node { - fn from(node: &NodeData) -> Self { - Self { - node_type: node.node_type.clone(), - attributes: node.attributes.clone(), - body: node.body.clone(), - } - } -} diff --git a/shared-lib/lib-ot/src/core/node_tree/node_serde.rs b/shared-lib/lib-ot/src/core/node_tree/node_serde.rs deleted file mode 100644 index ebc794a0bc..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/node_serde.rs +++ /dev/null @@ -1,63 +0,0 @@ -use super::Body; -use crate::text_delta::DeltaTextOperations; -use serde::de::{self, MapAccess, Visitor}; -use serde::ser::SerializeMap; -use serde::{Deserializer, Serializer}; -use std::fmt; - -pub fn serialize_body(body: &Body, serializer: S) -> Result -where - S: Serializer, -{ - let mut map = serializer.serialize_map(Some(3))?; - match body { - Body::Empty => {}, - Body::Delta(delta) => { - map.serialize_key("delta")?; - map.serialize_value(delta)?; - }, - } - map.end() -} - -pub fn deserialize_body<'de, D>(deserializer: D) -> Result -where - D: Deserializer<'de>, -{ - struct NodeBodyVisitor(); - - impl<'de> Visitor<'de> for NodeBodyVisitor { - type Value = Body; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Expect NodeBody") - } - - fn visit_map(self, mut map: V) -> Result - where - V: MapAccess<'de>, - { - let mut delta: Option = None; - while let Some(key) = map.next_key()? { - match key { - "delta" => { - if delta.is_some() { - return Err(de::Error::duplicate_field("delta")); - } - delta = Some(map.next_value()?); - }, - other => { - panic!("Unexpected key: {}", other); - }, - } - } - - if let Some(delta) = delta { - return Ok(Body::Delta(delta)); - } - - Err(de::Error::missing_field("delta")) - } - } - deserializer.deserialize_any(NodeBodyVisitor()) -} diff --git a/shared-lib/lib-ot/src/core/node_tree/operation.rs b/shared-lib/lib-ot/src/core/node_tree/operation.rs deleted file mode 100644 index 546b048698..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/operation.rs +++ /dev/null @@ -1,270 +0,0 @@ -use crate::core::{Body, Changeset, NodeData, OperationTransform, Path}; -use crate::errors::OTError; - -use serde::{Deserialize, Serialize}; -use std::sync::Arc; - -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(tag = "op")] -pub enum NodeOperation { - #[serde(rename = "insert")] - Insert { path: Path, nodes: Vec }, - - #[serde(rename = "update")] - Update { path: Path, changeset: Changeset }, - - #[serde(rename = "delete")] - Delete { path: Path, nodes: Vec }, -} - -impl NodeOperation { - pub fn get_path(&self) -> &Path { - match self { - NodeOperation::Insert { path, .. } => path, - NodeOperation::Delete { path, .. } => path, - NodeOperation::Update { path, .. } => path, - } - } - - pub fn get_mut_path(&mut self) -> &mut Path { - match self { - NodeOperation::Insert { path, .. } => path, - NodeOperation::Delete { path, .. } => path, - NodeOperation::Update { path, .. } => path, - } - } - - pub fn is_update_delta(&self) -> bool { - match self { - NodeOperation::Insert { .. } => false, - NodeOperation::Update { path: _, changeset } => changeset.is_delta(), - NodeOperation::Delete { .. } => false, - } - } - - pub fn is_update_attribute(&self) -> bool { - match self { - NodeOperation::Insert { .. } => false, - NodeOperation::Update { path: _, changeset } => changeset.is_attribute(), - NodeOperation::Delete { .. } => false, - } - } - pub fn is_insert(&self) -> bool { - match self { - NodeOperation::Insert { .. } => true, - NodeOperation::Update { .. } => false, - NodeOperation::Delete { .. } => false, - } - } - pub fn can_compose(&self, other: &NodeOperation) -> bool { - if self.get_path() != other.get_path() { - return false; - } - if self.is_update_delta() && other.is_update_delta() { - return true; - } - - if self.is_update_attribute() && other.is_update_attribute() { - return true; - } - - if self.is_insert() && other.is_update_delta() { - return true; - } - false - } - - pub fn compose(&mut self, other: &NodeOperation) -> Result<(), OTError> { - match (self, other) { - ( - NodeOperation::Insert { path: _, nodes }, - NodeOperation::Update { - path: _other_path, - changeset, - }, - ) => { - match changeset { - Changeset::Delta { delta, inverted: _ } => { - if let Body::Delta(old_delta) = &mut nodes.last_mut().unwrap().body { - let new_delta = old_delta.compose(delta)?; - *old_delta = new_delta; - } - }, - Changeset::Attributes { new: _, old: _ } => { - return Err(OTError::compose().context("Can't compose the attributes changeset")); - }, - } - Ok(()) - }, - ( - NodeOperation::Update { path: _, changeset }, - NodeOperation::Update { - path: _, - changeset: other_changeset, - }, - ) => changeset.compose(other_changeset), - (_left, _right) => Err(OTError::compose().context("Can't compose the operation")), - } - } - - pub fn inverted(&self) -> NodeOperation { - match self { - NodeOperation::Insert { path, nodes } => NodeOperation::Delete { - path: path.clone(), - nodes: nodes.clone(), - }, - NodeOperation::Delete { path, nodes } => NodeOperation::Insert { - path: path.clone(), - nodes: nodes.clone(), - }, - NodeOperation::Update { - path, - changeset: body, - } => NodeOperation::Update { - path: path.clone(), - changeset: body.inverted(), - }, - } - } - - /// Make the `other` operation can be applied to the version after applying the `self` operation. - /// The semantics of transform is used when editing conflicts occur, which is often determined by the version id。 - /// For example, if the inserted position has been acquired by others, then it's needed to do the transform to - /// make sure the inserted position is right. - /// - /// # Arguments - /// - /// * `other`: The operation that is going to be transformed - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::{NodeDataBuilder, NodeOperation, Path}; - /// let node_1 = NodeDataBuilder::new("text_1").build(); - /// let node_2 = NodeDataBuilder::new("text_2").build(); - /// - /// let op_1 = NodeOperation::Insert { - /// path: Path(vec![0, 1]), - /// nodes: vec![node_1], - /// }; - /// - /// let mut op_2 = NodeOperation::Insert { - /// path: Path(vec![0, 1]), - /// nodes: vec![node_2], - /// }; - /// - /// assert_eq!(serde_json::to_string(&op_2).unwrap(), r#"{"op":"insert","path":[0,1],"nodes":[{"type":"text_2"}]}"#); - /// - /// op_1.transform(&mut op_2); - /// assert_eq!(serde_json::to_string(&op_2).unwrap(), r#"{"op":"insert","path":[0,2],"nodes":[{"type":"text_2"}]}"#); - /// assert_eq!(serde_json::to_string(&op_1).unwrap(), r#"{"op":"insert","path":[0,1],"nodes":[{"type":"text_1"}]}"#); - /// ``` - pub fn transform(&self, other: &mut NodeOperation) { - match self { - NodeOperation::Insert { path, nodes } => { - let new_path = path.transform(other.get_path(), nodes.len()); - *other.get_mut_path() = new_path; - }, - NodeOperation::Delete { path, nodes } => { - let new_path = path.transform(other.get_path(), nodes.len()); - *other.get_mut_path() = new_path; - }, - _ => { - // Only insert/delete will change the path. - }, - } - } -} - -type OperationIndexMap = Vec>; - -#[derive(Debug, Clone, Default)] -pub struct NodeOperations { - inner: OperationIndexMap, -} - -impl NodeOperations { - pub fn new() -> Self { - Self::default() - } - - pub fn from_operations(operations: Vec) -> Self { - let mut ops = Self::new(); - for op in operations { - ops.push_op(op) - } - ops - } - - pub fn from_bytes(bytes: Vec) -> Result { - let operation_list = - serde_json::from_slice(&bytes).map_err(|err| OTError::serde().context(err))?; - Ok(operation_list) - } - - pub fn to_bytes(&self) -> Result, OTError> { - let bytes = serde_json::to_vec(self).map_err(|err| OTError::serde().context(err))?; - Ok(bytes) - } - - pub fn values(&self) -> &Vec> { - &self.inner - } - - pub fn values_mut(&mut self) -> &mut Vec> { - &mut self.inner - } - - pub fn len(&self) -> usize { - self.values().len() - } - - pub fn is_empty(&self) -> bool { - self.inner.is_empty() - } - - pub fn into_inner(self) -> Vec> { - self.inner - } - - pub fn push_op>>(&mut self, other: T) { - let other = other.into(); - if let Some(last_operation) = self.inner.last_mut() { - if last_operation.can_compose(&other) { - let mut_operation = Arc::make_mut(last_operation); - if mut_operation.compose(&other).is_ok() { - return; - } - } - } - - // If the passed-in operation can't be composed, then append it to the end. - self.inner.push(other); - } - - pub fn compose(&mut self, other: NodeOperations) { - for operation in other.values() { - self.push_op(operation.clone()); - } - } - - pub fn inverted(&self) -> Self { - let mut operations = Self::new(); - for operation in self.values() { - operations.push_op(operation.inverted()); - } - operations - } -} - -impl std::convert::From> for NodeOperations { - fn from(operations: Vec) -> Self { - Self::from_operations(operations) - } -} - -impl std::convert::From for NodeOperations { - fn from(operation: NodeOperation) -> Self { - Self::from_operations(vec![operation]) - } -} diff --git a/shared-lib/lib-ot/src/core/node_tree/operation_serde.rs b/shared-lib/lib-ot/src/core/node_tree/operation_serde.rs deleted file mode 100644 index 70400a2eab..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/operation_serde.rs +++ /dev/null @@ -1,49 +0,0 @@ -use crate::core::{NodeOperation, NodeOperations}; -use serde::de::{SeqAccess, Visitor}; -use serde::ser::SerializeSeq; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use std::fmt; - -impl Serialize for NodeOperations { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let operations = self.values(); - let mut seq = serializer.serialize_seq(Some(operations.len()))?; - for operation in operations { - seq.serialize_element(&operation)?; - } - seq.end() - } -} - -impl<'de> Deserialize<'de> for NodeOperations { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct NodeOperationsVisitor(); - - impl<'de> Visitor<'de> for NodeOperationsVisitor { - type Value = NodeOperations; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Expected node operation") - } - - fn visit_seq(self, mut seq: A) -> Result - where - A: SeqAccess<'de>, - { - let mut operations = NodeOperations::new(); - while let Some(operation) = seq.next_element::()? { - operations.push_op(operation); - } - Ok(operations) - } - } - - deserializer.deserialize_any(NodeOperationsVisitor()) - } -} diff --git a/shared-lib/lib-ot/src/core/node_tree/path.rs b/shared-lib/lib-ot/src/core/node_tree/path.rs deleted file mode 100644 index 205290dd9f..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/path.rs +++ /dev/null @@ -1,225 +0,0 @@ -use serde::{Deserialize, Serialize}; - -/// The `Path` represents as a path to reference to the node in the `NodeTree`. -/// β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” -/// β”‚ Root β”‚ -/// └─────────┼──────────┐ -/// β”‚0: Node A β”‚ -/// └──────────┼────────────┐ -/// β”‚0: Node A-1 β”‚ -/// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ -/// β”‚1: Node A-2 β”‚ -/// β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -/// β”‚1: Node B β”‚ -/// └──────────┼────────────┐ -/// β”‚0: Node B-1 β”‚ -/// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ -/// β”‚1: Node B-2 β”‚ -/// β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -/// β”‚2: Node C β”‚ -/// β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -/// -/// The path of Node A will be [0] -/// The path of Node A-1 will be [0,0] -/// The path of Node A-2 will be [0,1] -/// The path of Node B-2 will be [1,1] -#[derive(Clone, Serialize, Deserialize, Eq, PartialEq, Debug, Default, Hash)] -pub struct Path(pub Vec); - -impl Path { - pub fn is_valid(&self) -> bool { - if self.is_empty() { - return false; - } - true - } - - pub fn clone_with(&self, element: usize) -> Self { - let mut cloned_self = self.clone(); - cloned_self.push(element); - cloned_self - } - - pub fn is_root(&self) -> bool { - self.0.len() == 1 && self.0[0] == 0 - } - - pub fn next(&self) -> Self { - let mut cloned_self = self.clone(); - if !self.is_valid() { - return cloned_self; - } - let last = cloned_self.pop(); - cloned_self.push(last.unwrap() + 1); - cloned_self - } -} - -impl std::ops::Deref for Path { - type Target = Vec; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl std::ops::DerefMut for Path { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl std::convert::From for Path { - fn from(val: usize) -> Self { - Path(vec![val]) - } -} - -impl std::convert::From<&usize> for Path { - fn from(val: &usize) -> Self { - Path(vec![*val]) - } -} - -impl std::convert::From<&Path> for Path { - fn from(path: &Path) -> Self { - path.clone() - } -} - -impl From> for Path { - fn from(v: Vec) -> Self { - Path(v) - } -} - -impl From<&Vec> for Path { - fn from(values: &Vec) -> Self { - Path(values.clone()) - } -} - -impl From<&[usize]> for Path { - fn from(values: &[usize]) -> Self { - Path(values.to_vec()) - } -} - -impl Path { - /// Calling this function if there are two changes want to modify the same path. - /// - /// # Arguments - /// - /// * `other`: the path that need to be transformed - /// * `offset`: represents the len of nodes referenced by the current path - /// - /// If two changes modify the same path or the path was shared by them. Then it needs to do the - /// transformation to make sure the changes are applied to the right path. - /// - /// returns: the path represents the position that the other path reference to. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::Path; - /// let path = Path(vec![0, 1]); - /// for (old_path, len_of_nodes, expected_path) in vec![ - /// // Try to modify the path [0, 1], but someone has inserted one element before the - /// // current path [0,1] in advance. That causes the modified path [0,1] to no longer - /// // valid. It needs to do the transformation to get the right path. - /// // - /// // [0,2] is the path you want to modify. - /// (Path(vec![0, 1]), 1, Path(vec![0, 2])), - /// (Path(vec![0, 1]), 5, Path(vec![0, 6])), - /// (Path(vec![0, 2]), 1, Path(vec![0, 3])), - /// // Try to modify the path [0, 2,3,4], but someone has inserted one element before the - /// // current path [0,1] in advance. That cause the prefix path [0,2] of [0,2,3,4] - /// // no longer valid. - /// // It needs to do the transformation to get the right path. So [0,2] is transformed to [0,3] - /// // and the suffix [3,4] of the [0,2,3,4] remains the same. So the transformed result is - /// // - /// // [0,3,3,4] - /// (Path(vec![0, 2, 3, 4]), 1, Path(vec![0, 3, 3, 4])), - /// ] { - /// assert_eq!(path.transform(&old_path, len_of_nodes), expected_path); - /// } - /// // The path remains the same in the following test. Because the shared path is not changed. - /// let path = Path(vec![0, 1, 2]); - /// for (old_path, len_of_nodes, expected_path) in vec![ - /// // Try to modify the path [0,0,0,1,2], but someone has inserted one element - /// // before [0,1,2]. [0,0,0,1,2] and [0,1,2] share the same path [0,x], because - /// // the element was inserted at [0,1,2] that didn't affect the shared path [0, x]. - /// // So, after the transformation, the path is not changed. - /// (Path(vec![0, 0, 0, 1, 2]), 1, Path(vec![0, 0, 0, 1, 2])), - /// (Path(vec![0, 1]), 1, Path(vec![0, 1])), - /// ] { - /// assert_eq!(path.transform(&old_path, len_of_nodes), expected_path); - /// } - /// - /// let path = Path(vec![1, 1]); - /// for (old_path, len_of_nodes, expected_path) in vec![(Path(vec![1, 0]), 1, Path(vec![1, 0]))] { - /// assert_eq!(path.transform(&old_path, len_of_nodes), expected_path); - /// } - /// ``` - /// For example, client A and client B want to insert a node at the same index, the server applies - /// the changes made by client B. But, before applying the client A's changes, server transforms - /// the changes first in order to make sure that client A modify the right position. After that, - /// the changes can be applied to the server. - /// - /// β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” - /// β”‚ Client A β”‚ β”‚ Server β”‚ β”‚ Client B β”‚ - /// β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ - /// β”‚ β”‚ β”Œ ─ ─ ─ ─ ─ ─ ─ ┐ β”‚ - /// β”‚ β”‚ Root β”‚ - /// β”‚ β”‚ β”‚ 0:A β”‚ β”‚ - /// β”‚ β”‚ ─ ─ ─ ─ ─ ─ ─ ─ β”‚ - /// β”‚ β”‚ ◀───────────────────────│ - /// β”‚ β”‚ Insert B at index 1 β”‚ - /// β”‚ β”‚ β”‚ - /// β”‚ β”‚ β”Œ ─ ─ ─ ─ ─ ─ ─ ┐ β”‚ - /// β”‚ β”‚ Root β”‚ - /// β”‚ β”‚ β”‚ 0:A β”‚ β”‚ - /// β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Άβ”‚ 1:B β”‚ - /// β”‚ Insert C at index 1 β”‚ β”” ─ ─ ─ ─ ─ ─ ─ β”˜ β”‚ - /// β”‚ β”‚ β”‚ - /// β”‚ β”‚ transform index 1 to 2 β”‚ - /// β”‚ β”‚ β”‚ - /// β”‚ β”‚ β”Œ ─ ─ ─ ─ ─ ─ ─ ─ β”‚ - /// β”‚ β”‚ Root β”‚ β”‚ - /// β”‚ β”‚ β”‚ 0:A β”‚ - /// β–Ό β–Ό 1:B β”‚ β–Ό - /// β”‚ 2:C - /// ─ ─ ─ ─ ─ ─ ─ ─ β”˜ - pub fn transform(&self, other: &Path, offset: usize) -> Path { - if self.len() > other.len() { - return other.clone(); - } - if self.is_empty() || other.is_empty() { - return other.clone(); - } - for i in 0..(self.len() - 1) { - if self.0[i] != other.0[i] { - return other.clone(); - } - } - - // Splits the `Path` into two part. The suffix will contain the last element of the `Path`. - let second_last_index = self.0.len() - 1; - let mut prefix: Vec = self.0[0..second_last_index].into(); - let mut suffix: Vec = other.0[self.0.len()..].into(); - let last_value = *self.0.last().unwrap(); - - let other_second_last_value = other.0[second_last_index]; - - // - if last_value <= other_second_last_value { - prefix.push(other_second_last_value + offset); - } else { - prefix.push(other_second_last_value); - } - - // concat the prefix and suffix into a new path - prefix.append(&mut suffix); - Path(prefix) - } -} diff --git a/shared-lib/lib-ot/src/core/node_tree/transaction.rs b/shared-lib/lib-ot/src/core/node_tree/transaction.rs deleted file mode 100644 index a75285b4aa..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/transaction.rs +++ /dev/null @@ -1,281 +0,0 @@ -use super::{Changeset, NodeOperations}; -use crate::core::{NodeData, NodeOperation, NodeTree, Path}; -use crate::errors::OTError; -use indextree::NodeId; -use serde::{Deserialize, Serialize}; -use std::sync::Arc; - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct Transaction { - pub operations: NodeOperations, - - #[serde(default)] - #[serde(skip_serializing_if = "Extension::is_empty")] - pub extension: Extension, -} - -impl Transaction { - pub fn new() -> Self { - Self::default() - } - - pub fn from_operations>(operations: T) -> Self { - Self { - operations: operations.into(), - extension: Extension::Empty, - } - } - - pub fn from_bytes(bytes: &[u8]) -> Result { - let transaction = serde_json::from_slice(bytes).map_err(|err| OTError::serde().context(err))?; - Ok(transaction) - } - - pub fn to_bytes(&self) -> Result, OTError> { - let bytes = serde_json::to_vec(&self).map_err(|err| OTError::serde().context(err))?; - Ok(bytes) - } - - pub fn from_json(s: &str) -> Result { - let serde_transaction: Transaction = - serde_json::from_str(s).map_err(|err| OTError::serde().context(err))?; - let mut transaction = Self::new(); - transaction.extension = serde_transaction.extension; - for operation in serde_transaction.operations.into_inner() { - transaction.operations.push_op(operation); - } - Ok(transaction) - } - - pub fn to_json(&self) -> Result { - serde_json::to_string(&self).map_err(|err| OTError::serde().context(err)) - } - - pub fn into_operations(self) -> Vec> { - self.operations.into_inner() - } - - pub fn split(self) -> (Vec>, Extension) { - (self.operations.into_inner(), self.extension) - } - - pub fn push_operation>(&mut self, operation: T) { - let operation = operation.into(); - self.operations.push_op(operation); - } - - /// Make the `other` can be applied to the version after applying the `self` transaction. - /// - /// The semantics of transform is used when editing conflicts occur, which is often determined by the version id。 - /// the operations of the transaction will be transformed into the conflict operations. - pub fn transform(&self, other: &Transaction) -> Result { - let mut other = other.clone(); - other.extension = self.extension.clone(); - - for other_operation in other.operations.values_mut() { - let other_operation = Arc::make_mut(other_operation); - for operation in self.operations.values() { - operation.transform(other_operation); - } - } - - Ok(other) - } - - pub fn compose(&mut self, other: Transaction) -> Result<(), OTError> { - // For the moment, just append `other` operations to the end of `self`. - let Transaction { - operations, - extension, - } = other; - self.operations.compose(operations); - self.extension = extension; - Ok(()) - } -} - -#[derive(Debug, Clone, Serialize, Deserialize, Default)] -pub enum Extension { - #[default] - Empty, - TextSelection { - before_selection: Selection, - after_selection: Selection, - }, -} - -impl Extension { - fn is_empty(&self) -> bool { - matches!(self, Extension::Empty) - } -} - -#[derive(Debug, Clone, Serialize, Deserialize, Default)] -pub struct Selection { - start: Position, - end: Position, -} - -#[derive(Debug, Clone, Serialize, Deserialize, Default)] -pub struct Position { - path: Path, - offset: usize, -} -#[derive(Default)] -pub struct TransactionBuilder { - operations: NodeOperations, -} - -impl TransactionBuilder { - pub fn new() -> TransactionBuilder { - Self::default() - } - - /// - /// - /// # Arguments - /// - /// * `path`: the path that is used to save the nodes - /// * `nodes`: the nodes you will be save in the path - /// - /// # Examples - /// - /// ``` - /// // 0 -- text_1 - /// use lib_ot::core::{NodeTree, NodeData, TransactionBuilder}; - /// let mut node_tree = NodeTree::default(); - /// let transaction = TransactionBuilder::new() - /// .insert_nodes_at_path(0,vec![ NodeData::new("text_1")]) - /// .build(); - /// node_tree.apply_transaction(transaction).unwrap(); - /// - /// node_tree.node_id_at_path(vec![0]).unwrap(); - /// ``` - /// - pub fn insert_nodes_at_path>(self, path: T, nodes: Vec) -> Self { - self.push(NodeOperation::Insert { - path: path.into(), - nodes, - }) - } - - /// - /// - /// # Arguments - /// - /// * `path`: the path that is used to save the nodes - /// * `node`: the node data will be saved in the path - /// - /// # Examples - /// - /// ``` - /// // 0 - /// // -- 0 - /// // |-- text - /// use lib_ot::core::{NodeTree, NodeData, TransactionBuilder}; - /// let mut node_tree = NodeTree::default(); - /// let transaction = TransactionBuilder::new() - /// .insert_node_at_path(0, NodeData::new("text")) - /// .build(); - /// node_tree.apply_transaction(transaction).unwrap(); - /// ``` - /// - pub fn insert_node_at_path>(self, path: T, node: NodeData) -> Self { - self.insert_nodes_at_path(path, vec![node]) - } - - pub fn update_node_at_path>(mut self, path: T, changeset: Changeset) -> Self { - self.operations.push_op(NodeOperation::Update { - path: path.into(), - changeset, - }); - self - } - // - // pub fn update_delta_at_path>( - // mut self, - // path: T, - // new_delta: DeltaTextOperations, - // ) -> Result { - // let path = path.into(); - // let operation: NodeOperation = self - // .operations - // .get(&path) - // .ok_or(Err(OTError::record_not_found().context("Can't found the node")))?; - // - // match operation { - // NodeOperation::Insert { path, nodes } => {} - // NodeOperation::Update { path, changeset } => {} - // NodeOperation::Delete { .. } => {} - // } - // - // match node.body { - // Body::Empty => Ok(self), - // Body::Delta(delta) => { - // let inverted = new_delta.invert(&delta); - // let changeset = Changeset::Delta { - // delta: new_delta, - // inverted, - // }; - // Ok(self.update_node_at_path(path, changeset)) - // } - // } - // } - - pub fn delete_node_at_path(self, node_tree: &NodeTree, path: &Path) -> Self { - self.delete_nodes_at_path(node_tree, path, 1) - } - - pub fn delete_nodes_at_path(mut self, node_tree: &NodeTree, path: &Path, length: usize) -> Self { - let node_id = node_tree.node_id_at_path(path); - if node_id.is_none() { - tracing::warn!("Path: {:?} doesn't contains any nodes", path); - return self; - } - - let mut node_id = node_id.unwrap(); - let mut deleted_nodes = vec![]; - for _ in 0..length { - deleted_nodes.push(self.get_deleted_node_data(node_tree, node_id)); - node_id = node_tree.following_siblings(node_id).next().unwrap(); - } - - self.operations.push_op(NodeOperation::Delete { - path: path.clone(), - nodes: deleted_nodes, - }); - self - } - - fn get_deleted_node_data(&self, node_tree: &NodeTree, node_id: NodeId) -> NodeData { - recursive_get_deleted_node_data(node_tree, node_id) - } - - pub fn push(mut self, op: NodeOperation) -> Self { - self.operations.push_op(op); - self - } - - pub fn build(self) -> Transaction { - Transaction::from_operations(self.operations) - } -} - -fn recursive_get_deleted_node_data(node_tree: &NodeTree, node_id: NodeId) -> NodeData { - let node_data = node_tree.get_node(node_id).unwrap(); - let mut children = vec![]; - node_tree - .get_children_ids(node_id) - .into_iter() - .for_each(|child_id| { - let child = recursive_get_deleted_node_data(node_tree, child_id); - children.push(child); - }); - - NodeData { - node_type: node_data.node_type.clone(), - attributes: node_data.attributes.clone(), - body: node_data.body.clone(), - children, - } -} diff --git a/shared-lib/lib-ot/src/core/node_tree/transaction_serde.rs b/shared-lib/lib-ot/src/core/node_tree/transaction_serde.rs deleted file mode 100644 index fa1d0ddd8c..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/transaction_serde.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::core::Extension; -use serde::ser::SerializeMap; -use serde::Serializer; - -#[allow(dead_code)] -pub fn serialize_extension(extension: &Extension, serializer: S) -> Result -where - S: Serializer, -{ - match extension { - Extension::Empty => { - let map = serializer.serialize_map(None)?; - map.end() - }, - Extension::TextSelection { - before_selection, - after_selection, - } => { - let mut map = serializer.serialize_map(Some(2))?; - map.serialize_key("before_selection")?; - map.serialize_value(before_selection)?; - - map.serialize_key("after_selection")?; - map.serialize_value(after_selection)?; - - map.end() - }, - } -} diff --git a/shared-lib/lib-ot/src/core/node_tree/tree.rs b/shared-lib/lib-ot/src/core/node_tree/tree.rs deleted file mode 100644 index 286c7cb523..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/tree.rs +++ /dev/null @@ -1,532 +0,0 @@ -use super::NodeOperations; -use crate::core::{Changeset, Node, NodeData, NodeOperation, Path, Transaction}; -use crate::errors::{OTError, OTErrorCode}; -use indextree::{Arena, FollowingSiblings, NodeId}; -use std::sync::Arc; - -#[derive(Default, Debug, Clone)] -pub struct NodeTreeContext {} - -#[derive(Debug, Clone)] -pub struct NodeTree { - arena: Arena, - root: NodeId, - pub context: NodeTreeContext, -} - -impl Default for NodeTree { - fn default() -> Self { - Self::new(NodeTreeContext::default()) - } -} - -pub const PLACEHOLDER_NODE_TYPE: &str = ""; - -impl NodeTree { - pub fn new(context: NodeTreeContext) -> NodeTree { - let mut arena = Arena::new(); - let root = arena.new_node(Node::new("root")); - NodeTree { - arena, - root, - context, - } - } - - pub fn from_node_data(node_data: NodeData, context: NodeTreeContext) -> Result { - let mut tree = Self::new(context); - tree.insert_nodes(&0_usize.into(), vec![node_data])?; - Ok(tree) - } - - pub fn from_bytes(bytes: &[u8]) -> Result { - let tree: NodeTree = serde_json::from_slice(bytes).map_err(|e| OTError::serde().context(e))?; - Ok(tree) - } - - pub fn to_bytes(&self) -> Vec { - match serde_json::to_vec(self) { - Ok(bytes) => bytes, - Err(e) => { - tracing::error!("{}", e); - vec![] - }, - } - } - - pub fn to_json(&self, pretty: bool) -> Result { - if pretty { - match serde_json::to_string_pretty(self) { - Ok(json) => Ok(json), - Err(err) => Err(OTError::serde().context(err)), - } - } else { - match serde_json::to_string(self) { - Ok(json) => Ok(json), - Err(err) => Err(OTError::serde().context(err)), - } - } - } - - pub fn from_operations>( - operations: T, - context: NodeTreeContext, - ) -> Result { - let operations = operations.into(); - let mut node_tree = NodeTree::new(context); - for (_, operation) in operations.into_inner().into_iter().enumerate() { - node_tree.apply_op(operation)?; - } - Ok(node_tree) - } - - pub fn from_transaction>( - transaction: T, - context: NodeTreeContext, - ) -> Result { - let transaction = transaction.into(); - let mut tree = Self::new(context); - tree.apply_transaction(transaction)?; - Ok(tree) - } - - pub fn get_node(&self, node_id: NodeId) -> Option<&Node> { - if node_id.is_removed(&self.arena) { - return None; - } - Some(self.arena.get(node_id)?.get()) - } - - pub fn get_node_at_path(&self, path: &Path) -> Option<&Node> { - let node_id = self.node_id_at_path(path)?; - self.get_node(node_id) - } - - pub fn get_node_data_at_path(&self, path: &Path) -> Option { - let node_id = self.node_id_at_path(path)?; - let node_data = self.get_node_data(node_id)?; - Some(node_data) - } - - pub fn get_node_data_at_root(&self) -> Option { - self.get_node_data(self.root) - } - - pub fn get_node_data(&self, node_id: NodeId) -> Option { - let Node { - node_type, - body, - attributes, - } = self.get_node(node_id)?.clone(); - let mut node_data = NodeData::new(node_type); - for (key, value) in attributes.into_inner() { - node_data.attributes.insert(key, value); - } - node_data.body = body; - - let children = self.get_children_ids(node_id); - for child in children.into_iter() { - if let Some(child_node_data) = self.get_node_data(child) { - node_data.children.push(child_node_data); - } - } - Some(node_data) - } - - pub fn root_node_id(&self) -> NodeId { - self.root - } - - pub fn get_children(&self, node_id: NodeId) -> Vec<&Node> { - node_id - .children(&self.arena) - .flat_map(|node_id| self.get_node(node_id)) - .collect() - } - /// Returns a iterator used to iterate over the node ids whose parent node id is node_id - /// - /// * `node_id`: the children's parent node id - /// - pub fn get_children_ids(&self, node_id: NodeId) -> Vec { - node_id.children(&self.arena).collect() - } - - /// Serialize the node to JSON with node_id - pub fn serialize_node(&self, node_id: NodeId, pretty_json: bool) -> Result { - let node_data = self - .get_node_data(node_id) - .ok_or_else(|| OTError::internal().context("Node doesn't exist exist"))?; - if pretty_json { - serde_json::to_string_pretty(&node_data).map_err(|err| OTError::serde().context(err)) - } else { - serde_json::to_string(&node_data).map_err(|err| OTError::serde().context(err)) - } - } - - /// - /// # Examples - /// - /// ``` - /// use std::sync::Arc; - /// use lib_ot::core::{NodeOperation, NodeTree, NodeData, Path}; - /// let nodes = vec![NodeData::new("text".to_string())]; - /// let root_path: Path = vec![0].into(); - /// let op = NodeOperation::Insert {path: root_path.clone(),nodes }; - /// - /// let mut node_tree = NodeTree::default(); - /// node_tree.apply_op(Arc::new(op)).unwrap(); - /// let node_id = node_tree.node_id_at_path(&root_path).unwrap(); - /// let node_path = node_tree.path_from_node_id(node_id); - /// debug_assert_eq!(node_path, root_path); - /// ``` - pub fn node_id_at_path>(&self, path: T) -> Option { - let path = path.into(); - if !path.is_valid() { - return None; - } - - let mut node_id = self.root; - for id in path.iter() { - node_id = self.node_id_from_parent_at_index(node_id, *id)?; - } - - if node_id.is_removed(&self.arena) { - return None; - } - Some(node_id) - } - - pub fn path_from_node_id(&self, node_id: NodeId) -> Path { - let mut path = vec![]; - let mut current_node = node_id; - // Use .skip(1) on the ancestors iterator to skip the root node. - let ancestors = node_id.ancestors(&self.arena).skip(1); - for parent_node in ancestors { - let counter = self.index_of_node(parent_node, current_node); - path.push(counter); - current_node = parent_node; - } - path.reverse(); - Path(path) - } - - fn index_of_node(&self, parent_node: NodeId, child_node: NodeId) -> usize { - let mut counter: usize = 0; - let iter = parent_node.children(&self.arena); - for node in iter { - if node == child_node { - return counter; - } - counter += 1; - } - - counter - } - - /// Returns the note_id at the index of the tree which its id is note_id - /// # Arguments - /// - /// * `node_id`: the node id of the child's parent - /// * `index`: index of the node in parent children list - /// - /// returns: Option - /// - /// # Examples - /// - /// ``` - /// use std::sync::Arc; - /// use lib_ot::core::{NodeOperation, NodeTree, NodeData, Path}; - /// let node_1 = NodeData::new("text".to_string()); - /// let inserted_path: Path = vec![0].into(); - /// - /// let mut node_tree = NodeTree::default(); - /// let op = NodeOperation::Insert {path: inserted_path.clone(),nodes: vec![node_1.clone()] }; - /// node_tree.apply_op(Arc::new(op)).unwrap(); - /// - /// let node_2 = node_tree.get_node_at_path(&inserted_path).unwrap(); - /// assert_eq!(node_2.node_type, node_1.node_type); - /// ``` - pub fn node_id_from_parent_at_index(&self, node_id: NodeId, index: usize) -> Option { - let children = node_id.children(&self.arena); - for (counter, child) in children.enumerate() { - if counter == index { - return Some(child); - } - } - - None - } - - /// - /// # Arguments - /// - /// * `node_id`: if the node_is is None, then will use root node_id. - /// - /// returns number of the children of the root node - /// - pub fn number_of_children(&self, node_id: Option) -> usize { - match node_id { - None => self.root.children(&self.arena).count(), - Some(node_id) => node_id.children(&self.arena).count(), - } - } - - pub fn following_siblings(&self, node_id: NodeId) -> FollowingSiblings<'_, Node> { - node_id.following_siblings(&self.arena) - } - - pub fn apply_transaction(&mut self, transaction: Transaction) -> Result<(), OTError> { - let operations = transaction.split().0; - for operation in operations { - self.apply_op(operation)?; - } - - Ok(()) - } - - pub fn apply_op>>(&mut self, op: T) -> Result<(), OTError> { - let op = match Arc::try_unwrap(op.into()) { - Ok(op) => op, - Err(op) => op.as_ref().clone(), - }; - - match op { - NodeOperation::Insert { path, nodes } => self.insert_nodes(&path, nodes), - NodeOperation::Update { path, changeset } => self.update(&path, changeset), - NodeOperation::Delete { path, nodes } => { - if nodes.is_empty() { - self.delete_node(&path) - } else { - self.delete_nodes(&path, nodes) - } - }, - } - } - /// Inserts nodes at given path - /// root - /// 0 - A - /// 0 - A1 - /// 1 - B - /// 0 - B1 - /// 1 - B2 - /// - /// The path of each node will be: - /// A: [0] - /// A1: [0,0] - /// B: [1] - /// B1: [1,0] - /// B2: [1,1] - /// - /// When inserting multiple nodes into the same path, each of them will be appended to the root - /// node. For example. The path is [0] and the nodes are [A, B, C]. After inserting the nodes, - /// the tree will be: - /// root - /// 0: A - /// 1: B - /// 2: C - /// - /// returns error if the path is empty - /// - fn insert_nodes(&mut self, path: &Path, nodes: Vec) -> Result<(), OTError> { - if !path.is_valid() { - return Err(OTErrorCode::InvalidPath.into()); - } - - let (parent_path, last_path) = path.split_at(path.0.len() - 1); - let last_index = *last_path.first().unwrap(); - if parent_path.is_empty() { - self.insert_nodes_at_index(self.root, last_index, nodes) - } else { - let parent_node = match self.node_id_at_path(parent_path) { - None => self.create_adjacent_nodes_for_path(parent_path), - Some(parent_node) => parent_node, - }; - - self.insert_nodes_at_index(parent_node, last_index, nodes) - } - } - - /// Create the adjacent nodes for the path - /// - /// It will create a corresponding node for each node on the path if it's not existing. - /// If the path is not start from zero, it will create its siblings. - /// - /// Check out the operation_insert_test.rs for more examples. - /// * operation_insert_node_when_its_parent_is_not_exist - /// * operation_insert_node_when_multiple_parent_is_not_exist_test - /// - /// # Arguments - /// - /// * `path`: creates nodes for this path - /// - /// returns: NodeId - /// - fn create_adjacent_nodes_for_path>(&mut self, path: T) -> NodeId { - let path = path.into(); - let mut node_id = self.root; - for id in path.iter() { - match self.node_id_from_parent_at_index(node_id, *id) { - None => { - let num_of_children = node_id.children(&self.arena).count(); - if *id > num_of_children { - for _ in 0..(*id - num_of_children) { - let node: Node = placeholder_node().into(); - let sibling_node = self.arena.new_node(node); - node_id.append(sibling_node, &mut self.arena); - } - } - - let node: Node = placeholder_node().into(); - let new_node_id = self.arena.new_node(node); - node_id.append(new_node_id, &mut self.arena); - node_id = new_node_id; - }, - Some(next_node_id) => { - node_id = next_node_id; - }, - } - } - node_id - } - - /// Inserts nodes before the node with node_id - /// - fn insert_nodes_before(&mut self, node_id: &NodeId, nodes: Vec) { - if node_id.is_removed(&self.arena) { - tracing::warn!("Node:{:?} is remove before insert", node_id); - return; - } - for node in nodes { - let (node, children) = node.split(); - let new_node_id = self.arena.new_node(node); - node_id.insert_before(new_node_id, &mut self.arena); - self.append_nodes(&new_node_id, children); - } - } - - fn insert_nodes_at_index( - &mut self, - parent: NodeId, - index: usize, - nodes: Vec, - ) -> Result<(), OTError> { - if index == 0 && parent.children(&self.arena).next().is_none() { - self.append_nodes(&parent, nodes); - return Ok(()); - } - - // Append the node to the end of the children list if index greater or equal to the - // length of the children. - let num_of_children = parent.children(&self.arena).count(); - if index >= num_of_children { - let mut num_of_nodes_to_insert = index - num_of_children; - while num_of_nodes_to_insert > 0 { - self.append_nodes(&parent, vec![placeholder_node()]); - num_of_nodes_to_insert -= 1; - } - - self.append_nodes(&parent, nodes); - return Ok(()); - } - - let node_to_insert = self - .node_id_from_parent_at_index(parent, index) - .ok_or_else(|| OTError::internal().context(format!("Can't find the node at {}", index)))?; - - self.insert_nodes_before(&node_to_insert, nodes); - Ok(()) - } - - fn append_nodes(&mut self, parent: &NodeId, nodes: Vec) { - for node in nodes { - let (node, children) = node.split(); - let new_node_id = self.arena.new_node(node); - parent.append(new_node_id, &mut self.arena); - - self.append_nodes(&new_node_id, children); - } - } - - /// Removes a node and its descendants from the tree - fn delete_node(&mut self, path: &Path) -> Result<(), OTError> { - if !path.is_valid() { - return Err(OTErrorCode::InvalidPath.into()); - } - match self.node_id_at_path(path) { - None => tracing::warn!("Can't find any node at path: {:?}", path), - Some(node) => { - node.remove_subtree(&mut self.arena); - }, - } - - Ok(()) - } - - /// Removes a node and the consecutive nodes behide it - /// - /// if the nodes is empty, it will remove the single node at the path. - /// else it will remove the nodes at the path and the consecutive nodes behind it. - fn delete_nodes(&mut self, path: &Path, nodes: Vec) -> Result<(), OTError> { - if !path.is_valid() { - return Err(OTErrorCode::InvalidPath.into()); - } - - let node_id = self.node_id_at_path(path).ok_or_else(|| { - tracing::warn!("Can't find any node at path: {:?}", path); - OTError::internal().context("Can't find any node at path") - }); - - if node_id.is_err() { - return Err(OTErrorCode::PathNotFound.into()); - } - - for _ in 0..nodes.len() { - let res = self.delete_node(path); - res? - } - - Ok(()) - } - - /// Update the node at path with the `changeset` - /// - /// Do nothing if there is no node at the path. - /// - /// # Arguments - /// - /// * `path`: references to the node that will be applied with the changeset - /// * `changeset`: the change that will be applied to the node - /// - /// returns: Result<(), OTError> - fn update(&mut self, path: &Path, changeset: Changeset) -> Result<(), OTError> { - match self.mut_node_at_path(path, |node| node.apply_changeset(changeset)) { - Ok(_) => {}, - Err(err) => tracing::error!("{}", err), - } - Ok(()) - } - - fn mut_node_at_path(&mut self, path: &Path, f: F) -> Result<(), OTError> - where - F: FnOnce(&mut Node) -> Result<(), OTError>, - { - if !path.is_valid() { - return Err(OTErrorCode::InvalidPath.into()); - } - let node_id = self.node_id_at_path(path).ok_or_else(|| { - OTError::path_not_found().context(format!("Can't find the mutated node at path: {:?}", path)) - })?; - match self.arena.get_mut(node_id) { - None => tracing::warn!("The path: {:?} does not contain any nodes", path), - Some(node) => { - let node = node.get_mut(); - f(node)?; - }, - } - Ok(()) - } -} - -pub fn placeholder_node() -> NodeData { - NodeData::new(PLACEHOLDER_NODE_TYPE) -} diff --git a/shared-lib/lib-ot/src/core/node_tree/tree_serde.rs b/shared-lib/lib-ot/src/core/node_tree/tree_serde.rs deleted file mode 100644 index dbf87c5940..0000000000 --- a/shared-lib/lib-ot/src/core/node_tree/tree_serde.rs +++ /dev/null @@ -1,63 +0,0 @@ -use crate::core::{NodeData, NodeTree, NodeTreeContext}; -use serde::de::{MapAccess, Visitor}; -use serde::ser::SerializeSeq; -use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; -use std::fmt; - -use std::marker::PhantomData; - -impl Serialize for NodeTree { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let root_node_id = self.root_node_id(); - let mut children = self.get_children_ids(root_node_id); - if children.is_empty() { - return serializer.serialize_str(""); - } - if children.len() == 1 { - let node_id = children.pop().unwrap(); - match self.get_node_data(node_id) { - None => serializer.serialize_str(""), - Some(node_data) => node_data.serialize(serializer), - } - } else { - let mut seq = serializer.serialize_seq(Some(children.len()))?; - for child in children { - if let Some(child_node_data) = self.get_node_data(child) { - seq.serialize_element(&child_node_data)?; - } - } - seq.end() - } - } -} - -impl<'de> Deserialize<'de> for NodeTree { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct NodeTreeVisitor(PhantomData); - - impl<'de> Visitor<'de> for NodeTreeVisitor { - type Value = NodeData; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Expected node data tree") - } - - fn visit_map(self, map: V) -> Result - where - V: MapAccess<'de>, - { - // Forward the deserialization to NodeData - Deserialize::deserialize(de::value::MapAccessDeserializer::new(map)) - } - } - - let node_data: NodeData = deserializer.deserialize_any(NodeTreeVisitor(PhantomData))?; - Ok(NodeTree::from_node_data(node_data, NodeTreeContext::default()).unwrap()) - } -} diff --git a/shared-lib/lib-ot/src/core/ot_str.rs b/shared-lib/lib-ot/src/core/ot_str.rs deleted file mode 100644 index 2063a713d4..0000000000 --- a/shared-lib/lib-ot/src/core/ot_str.rs +++ /dev/null @@ -1,332 +0,0 @@ -use serde::{de, de::Visitor, Deserialize, Deserializer, Serialize, Serializer}; -use std::{fmt, fmt::Formatter}; - -/// [OTString] uses [String] as its inner container. -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct OTString(pub String); - -impl OTString { - /// Returns the number of UTF-16 code units in this string. - /// - /// The length of strings behaves differently in different languages. For example: [Dart] string's - /// length is calculated with UTF-16 code units. The method [utf16_len] returns the length of a - /// String in UTF-16 code units. - /// - /// # Examples - /// - /// ``` - /// use lib_ot::core::OTString; - /// let utf16_len = OTString::from("πŸ‘‹").utf16_len(); - /// assert_eq!(utf16_len, 2); - /// let bytes_len = String::from("πŸ‘‹").len(); - /// assert_eq!(bytes_len, 4); - /// - /// ``` - pub fn utf16_len(&self) -> usize { - count_utf16_code_units(&self.0) - } - - pub fn utf16_iter(&self) -> Utf16CodeUnitIterator { - Utf16CodeUnitIterator::new(self) - } - - /// Returns a new string with the given [Interval] - /// # Examples - /// - /// ``` - /// use lib_ot::core::{OTString, Interval}; - /// let s: OTString = "δ½ ε₯½\n😁".into(); - /// assert_eq!(s.utf16_len(), 5); - /// let output1 = s.sub_str(Interval::new(0, 2)).unwrap(); - /// assert_eq!(output1, "δ½ ε₯½"); - /// - /// let output2 = s.sub_str(Interval::new(2, 3)).unwrap(); - /// assert_eq!(output2, "\n"); - /// - /// let output3 = s.sub_str(Interval::new(3, 5)).unwrap(); - /// assert_eq!(output3, "😁"); - /// ``` - pub fn sub_str(&self, interval: Interval) -> Option { - let mut iter = Utf16CodeUnitIterator::new(self); - let mut buf = vec![]; - while let Some((byte, _len)) = iter.next() { - if iter.utf16_offset >= interval.start && iter.utf16_offset < interval.end { - buf.extend_from_slice(byte); - } - } - - if buf.is_empty() { - return None; - } - - match str::from_utf8(&buf) { - Ok(item) => Some(item.to_owned()), - Err(_e) => None, - } - } - - /// Return a new string with the given [Interval] - /// # Examples - /// - /// ``` - /// use lib_ot::core::OTString; - /// let s: OTString = "πŸ‘‹πŸ˜πŸ‘‹".into(); /// - /// let mut iter = s.utf16_code_point_iter(); - /// assert_eq!(iter.next().unwrap(), "πŸ‘‹".to_string()); - /// assert_eq!(iter.next().unwrap(), "😁".to_string()); - /// assert_eq!(iter.next().unwrap(), "πŸ‘‹".to_string()); - /// assert_eq!(iter.next(), None); - /// - /// let s: OTString = "πŸ‘‹12abδΈ€δΊŒπŸ‘‹".into(); /// - /// let mut iter = s.utf16_code_point_iter(); - /// assert_eq!(iter.next().unwrap(), "πŸ‘‹".to_string()); - /// assert_eq!(iter.next().unwrap(), "1".to_string()); - /// assert_eq!(iter.next().unwrap(), "2".to_string()); - /// - /// assert_eq!(iter.skip(OTString::from("abδΈ€δΊŒ").utf16_len()).next().unwrap(), "πŸ‘‹".to_string()); - /// ``` - #[allow(dead_code)] - pub fn utf16_code_point_iter(&self) -> OTUtf16CodePointIterator { - OTUtf16CodePointIterator::new(self, 0) - } -} - -impl std::ops::Deref for OTString { - type Target = String; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl std::ops::DerefMut for OTString { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl std::convert::From for OTString { - fn from(s: String) -> Self { - OTString(s) - } -} - -impl std::convert::From<&str> for OTString { - fn from(s: &str) -> Self { - s.to_owned().into() - } -} - -impl std::fmt::Display for OTString { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str(&self.0) - } -} - -impl std::ops::Add<&str> for OTString { - type Output = OTString; - - fn add(self, rhs: &str) -> OTString { - let new_value = self.0 + rhs; - new_value.into() - } -} - -impl std::ops::AddAssign<&str> for OTString { - fn add_assign(&mut self, rhs: &str) { - self.0 += rhs; - } -} - -impl Serialize for OTString { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_str(&self.0) - } -} - -impl<'de> Deserialize<'de> for OTString { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - struct OTStringVisitor; - - impl<'de> Visitor<'de> for OTStringVisitor { - type Value = OTString; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("a str") - } - - fn visit_str(self, s: &str) -> Result - where - E: de::Error, - { - Ok(s.into()) - } - } - deserializer.deserialize_str(OTStringVisitor) - } -} - -pub struct Utf16CodeUnitIterator<'a> { - s: &'a OTString, - byte_offset: usize, - utf16_offset: usize, - utf16_count: usize, -} - -impl<'a> Utf16CodeUnitIterator<'a> { - pub fn new(s: &'a OTString) -> Self { - Utf16CodeUnitIterator { - s, - byte_offset: 0, - utf16_offset: 0, - utf16_count: 0, - } - } -} - -impl<'a> Iterator for Utf16CodeUnitIterator<'a> { - type Item = (&'a [u8], usize); - - fn next(&mut self) -> Option { - let _len = self.s.len(); - if self.byte_offset == self.s.len() { - None - } else { - let b = self.s.as_bytes()[self.byte_offset]; - let start = self.byte_offset; - let end = self.byte_offset + len_utf8_from_first_byte(b); - if (b as i8) >= -0x40 { - self.utf16_count += 1; - } - if b >= 0xf0 { - self.utf16_count += 1; - } - - if self.utf16_count > 0 { - self.utf16_offset = self.utf16_count - 1; - } - self.byte_offset = end; - let byte = &self.s.as_bytes()[start..end]; - Some((byte, end - start)) - } - } -} - -pub struct OTUtf16CodePointIterator<'a> { - s: &'a OTString, - offset: usize, -} - -impl<'a> OTUtf16CodePointIterator<'a> { - pub fn new(s: &'a OTString, offset: usize) -> Self { - OTUtf16CodePointIterator { s, offset } - } -} - -use crate::core::interval::Interval; -use std::str; - -impl<'a> Iterator for OTUtf16CodePointIterator<'a> { - type Item = String; - - fn next(&mut self) -> Option { - if self.offset == self.s.len() { - None - } else { - let byte = self.s.as_bytes()[self.offset]; - let end = len_utf8_from_first_byte(byte); - let buf = &self.s.as_bytes()[self.offset..self.offset + end]; - self.offset += end; - match str::from_utf8(buf) { - Ok(item) => Some(item.to_string()), - Err(_e) => None, - } - } - } -} - -pub fn count_utf16_code_units(s: &str) -> usize { - let mut utf16_count = 0; - for &b in s.as_bytes() { - if (b as i8) >= -0x40 { - utf16_count += 1; - } - if b >= 0xf0 { - utf16_count += 1; - } - } - utf16_count -} - -/// Given the initial byte of a UTF-8 codepoint, returns the number of -/// bytes required to represent the codepoint. -/// RFC reference : https://tools.ietf.org/html/rfc3629#section-4 -pub fn len_utf8_from_first_byte(b: u8) -> usize { - match b { - b if b < 0x80 => 1, - b if b < 0xe0 => 2, - b if b < 0xf0 => 3, - _ => 4, - } -} - -#[cfg(test)] -mod tests { - use crate::core::interval::Interval; - use crate::core::ot_str::OTString; - - #[test] - fn flowy_str_code_unit() { - let size = OTString::from("πŸ‘‹").utf16_len(); - assert_eq!(size, 2); - - let s: OTString = "πŸ‘‹ \nπŸ‘‹".into(); - let output = s.sub_str(Interval::new(0, size)).unwrap(); - assert_eq!(output, "πŸ‘‹"); - - let output = s.sub_str(Interval::new(2, 3)).unwrap(); - assert_eq!(output, " "); - - let output = s.sub_str(Interval::new(3, 4)).unwrap(); - assert_eq!(output, "\n"); - - let output = s.sub_str(Interval::new(4, 4 + size)).unwrap(); - assert_eq!(output, "πŸ‘‹"); - } - - #[test] - fn flowy_str_sub_str_in_chinese2() { - let s: OTString = "😁 \n".into(); - let size = s.utf16_len(); - assert_eq!(size, 4); - - let output1 = s.sub_str(Interval::new(0, 3)).unwrap(); - let output2 = s.sub_str(Interval::new(3, 4)).unwrap(); - assert_eq!(output1, "😁 "); - assert_eq!(output2, "\n"); - } - - #[test] - fn flowy_str_sub_str_in_english() { - let s: OTString = "ab".into(); - let size = s.utf16_len(); - assert_eq!(size, 2); - - let output = s.sub_str(Interval::new(0, 2)).unwrap(); - assert_eq!(output, "ab"); - } - - #[test] - fn flowy_str_utf16_code_point_iter_test2() { - let s: OTString = "πŸ‘‹πŸ˜πŸ‘‹".into(); - let iter = s.utf16_code_point_iter(); - let result = iter.skip(1).take(1).collect::(); - assert_eq!(result, "😁".to_string()); - } -} diff --git a/shared-lib/lib-ot/src/errors.rs b/shared-lib/lib-ot/src/errors.rs deleted file mode 100644 index 58a846f0c3..0000000000 --- a/shared-lib/lib-ot/src/errors.rs +++ /dev/null @@ -1,117 +0,0 @@ -use std::{fmt, fmt::Debug, str::Utf8Error}; - -#[derive(thiserror::Error, Clone, Debug)] -pub struct OTError { - pub code: OTErrorCode, - pub msg: String, -} - -macro_rules! static_ot_error { - ($name:ident, $code:expr) => { - #[allow(non_snake_case, missing_docs)] - pub fn $name() -> OTError { - $code.into() - } - }; -} - -impl std::convert::From for OTError { - fn from(code: OTErrorCode) -> Self { - OTError { - code: code.clone(), - msg: format!("{:?}", code), - } - } -} - -impl OTError { - pub fn new(code: OTErrorCode, msg: String) -> OTError { - Self { code, msg } - } - - pub fn context(mut self, error: T) -> Self { - self.msg = format!("{:?}", error); - self - } - - static_ot_error!(duplicate_revision, OTErrorCode::DuplicatedRevision); - static_ot_error!(revision_id_conflict, OTErrorCode::RevisionIDConflict); - static_ot_error!(internal, OTErrorCode::Internal); - static_ot_error!(serde, OTErrorCode::SerdeError); - static_ot_error!(path_not_found, OTErrorCode::PathNotFound); - static_ot_error!(compose, OTErrorCode::ComposeOperationFail); - static_ot_error!(record_not_found, OTErrorCode::RecordNotFound); -} - -impl fmt::Display for OTError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}: {}", self.code, self.msg) - } -} - -impl std::convert::From for OTError { - fn from(error: serde_json::Error) -> Self { - ErrorBuilder::new(OTErrorCode::SerdeError) - .error(error) - .build() - } -} - -impl std::convert::From for OTError { - fn from(error: Utf8Error) -> Self { - ErrorBuilder::new(OTErrorCode::SerdeError) - .error(error) - .build() - } -} - -#[derive(Debug, Clone, Eq, PartialEq)] -pub enum OTErrorCode { - IncompatibleLength, - ApplyInsertFail, - ApplyDeleteFail, - ApplyFormatFail, - ComposeOperationFail, - IntervalOutOfBound, - UndoFail, - RedoFail, - SerdeError, - DuplicatedRevision, - RevisionIDConflict, - Internal, - PathNotFound, - PathIsEmpty, - InvalidPath, - RecordNotFound, -} - -pub struct ErrorBuilder { - pub code: OTErrorCode, - pub msg: Option, -} - -impl ErrorBuilder { - pub fn new(code: OTErrorCode) -> Self { - ErrorBuilder { code, msg: None } - } - - pub fn msg(mut self, msg: T) -> Self - where - T: Into, - { - self.msg = Some(msg.into()); - self - } - - pub fn error(mut self, msg: T) -> Self - where - T: std::fmt::Debug, - { - self.msg = Some(format!("{:?}", msg)); - self - } - - pub fn build(mut self) -> OTError { - OTError::new(self.code, self.msg.take().unwrap_or_else(|| "".to_owned())) - } -} diff --git a/shared-lib/lib-ot/src/lib.rs b/shared-lib/lib-ot/src/lib.rs deleted file mode 100644 index 60002437bf..0000000000 --- a/shared-lib/lib-ot/src/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod codec; -pub mod core; -pub mod errors; -pub mod text_delta; diff --git a/shared-lib/lib-ot/src/text_delta/attributes.rs b/shared-lib/lib-ot/src/text_delta/attributes.rs deleted file mode 100644 index c12359a5f3..0000000000 --- a/shared-lib/lib-ot/src/text_delta/attributes.rs +++ /dev/null @@ -1,154 +0,0 @@ -#![allow(non_snake_case)] -use crate::core::{AttributeEntry, AttributeHashMap, AttributeKey, AttributeValue}; -use crate::text_delta::DeltaTextOperation; -use crate::{inline_attribute_entry, inline_list_attribute_entry}; -use lazy_static::lazy_static; -use std::str::FromStr; -use std::{collections::HashSet, iter::FromIterator}; -use strum_macros::{AsRefStr, Display, EnumString}; - -#[inline(always)] -pub fn empty_attributes() -> AttributeHashMap { - AttributeHashMap::default() -} - -pub fn attributes_except_header(op: &DeltaTextOperation) -> AttributeHashMap { - let mut attributes = op.get_attributes(); - attributes.remove_key(BuildInTextAttributeKey::Header); - attributes -} - -#[derive(Debug, Clone)] -pub struct BuildInTextAttribute(); - -impl BuildInTextAttribute { - inline_attribute_entry!(Bold, bool); - inline_attribute_entry!(Italic, bool); - inline_attribute_entry!(Underline, bool); - inline_attribute_entry!(StrikeThrough, bool); - inline_attribute_entry!(Link, &str); - inline_attribute_entry!(Color, String); - inline_attribute_entry!(Font, usize); - inline_attribute_entry!(Size, usize); - inline_attribute_entry!(Background, String); - inline_attribute_entry!(InlineCode, bool); - - inline_attribute_entry!(Header, usize); - inline_attribute_entry!(Indent, usize); - inline_attribute_entry!(Align, String); - inline_attribute_entry!(List, &str); - inline_attribute_entry!(CodeBlock, bool); - inline_attribute_entry!(BlockQuote, bool); - - inline_attribute_entry!(Width, usize); - inline_attribute_entry!(Height, usize); - - // List extension - inline_list_attribute_entry!(Bullet, "bullet"); - inline_list_attribute_entry!(Ordered, "ordered"); - inline_list_attribute_entry!(Checked, "checked"); - inline_list_attribute_entry!(UnChecked, "unchecked"); -} - -#[derive( - Clone, - Debug, - Display, - Hash, - Eq, - PartialEq, - serde::Serialize, - serde::Deserialize, - AsRefStr, - EnumString, -)] -#[strum(serialize_all = "snake_case")] -pub enum BuildInTextAttributeKey { - #[serde(rename = "bold")] - Bold, - #[serde(rename = "italic")] - Italic, - #[serde(rename = "underline")] - Underline, - #[serde(rename = "strike")] - StrikeThrough, - #[serde(rename = "font")] - Font, - #[serde(rename = "size")] - Size, - #[serde(rename = "link")] - Link, - #[serde(rename = "color")] - Color, - #[serde(rename = "background")] - Background, - #[serde(rename = "indent")] - Indent, - #[serde(rename = "align")] - Align, - #[serde(rename = "code_block")] - CodeBlock, - #[serde(rename = "code")] - InlineCode, - #[serde(rename = "list")] - List, - #[serde(rename = "blockquote")] - BlockQuote, - #[serde(rename = "width")] - Width, - #[serde(rename = "height")] - Height, - #[serde(rename = "header")] - Header, -} - -pub fn is_block(k: &AttributeKey) -> bool { - if let Ok(key) = BuildInTextAttributeKey::from_str(k) { - BLOCK_KEYS.contains(&key) - } else { - false - } -} - -pub fn is_inline(k: &AttributeKey) -> bool { - if let Ok(key) = BuildInTextAttributeKey::from_str(k) { - INLINE_KEYS.contains(&key) - } else { - false - } -} - -lazy_static! { - static ref BLOCK_KEYS: HashSet = HashSet::from_iter(vec![ - BuildInTextAttributeKey::Header, - BuildInTextAttributeKey::Indent, - BuildInTextAttributeKey::Align, - BuildInTextAttributeKey::CodeBlock, - BuildInTextAttributeKey::List, - BuildInTextAttributeKey::BlockQuote, - ]); - static ref INLINE_KEYS: HashSet = HashSet::from_iter(vec![ - BuildInTextAttributeKey::Bold, - BuildInTextAttributeKey::Italic, - BuildInTextAttributeKey::Underline, - BuildInTextAttributeKey::StrikeThrough, - BuildInTextAttributeKey::Link, - BuildInTextAttributeKey::Color, - BuildInTextAttributeKey::Font, - BuildInTextAttributeKey::Size, - BuildInTextAttributeKey::Background, - BuildInTextAttributeKey::InlineCode, - ]); - static ref IGNORE_KEYS: HashSet = HashSet::from_iter(vec![ - BuildInTextAttributeKey::Width, - BuildInTextAttributeKey::Height, - ]); -} - -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum AttributeScope { - Inline, - Block, - Embeds, - Ignore, -} diff --git a/shared-lib/lib-ot/src/text_delta/delta.rs b/shared-lib/lib-ot/src/text_delta/delta.rs deleted file mode 100644 index dcb98f80cc..0000000000 --- a/shared-lib/lib-ot/src/text_delta/delta.rs +++ /dev/null @@ -1,9 +0,0 @@ -use crate::core::{AttributeHashMap, DeltaOperation, DeltaOperationBuilder, DeltaOperations}; - -pub type DeltaTextOperations = DeltaOperations; -pub type DeltaTextOperationBuilder = DeltaOperationBuilder; -pub type DeltaTextOperation = DeltaOperation; - -// pub trait TextOperation2: Default + Debug + OperationTransform {} -// -// impl TextOperation2 for TextOperations {} diff --git a/shared-lib/lib-ot/src/text_delta/macros.rs b/shared-lib/lib-ot/src/text_delta/macros.rs deleted file mode 100644 index 5dcae70fc4..0000000000 --- a/shared-lib/lib-ot/src/text_delta/macros.rs +++ /dev/null @@ -1,34 +0,0 @@ -#[macro_export] -macro_rules! inline_attribute_entry { - ( - $key: ident, - $value: ty - ) => { - pub fn $key(value: $value) -> $crate::core::AttributeEntry { - AttributeEntry { - key: BuildInTextAttributeKey::$key.as_ref().to_string(), - value: value.into(), - } - } - }; -} - -#[macro_export] -macro_rules! inline_list_attribute_entry { - ( - $key: ident, - $value: expr - ) => { - pub fn $key(b: bool) -> $crate::core::AttributeEntry { - let value = match b { - true => $value.into(), - false => AttributeValue::none(), - }; - - AttributeEntry { - key: BuildInTextAttributeKey::List.as_ref().to_string(), - value, - } - } - }; -} diff --git a/shared-lib/lib-ot/src/text_delta/mod.rs b/shared-lib/lib-ot/src/text_delta/mod.rs deleted file mode 100644 index 06fd687b13..0000000000 --- a/shared-lib/lib-ot/src/text_delta/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -mod attributes; - -#[macro_use] -mod macros; -mod delta; - -pub use attributes::*; -pub use delta::*; diff --git a/shared-lib/lib-ot/tests/main.rs b/shared-lib/lib-ot/tests/main.rs deleted file mode 100644 index 274142d345..0000000000 --- a/shared-lib/lib-ot/tests/main.rs +++ /dev/null @@ -1 +0,0 @@ -mod node; diff --git a/shared-lib/lib-ot/tests/node/changeset_compose_test.rs b/shared-lib/lib-ot/tests/node/changeset_compose_test.rs deleted file mode 100644 index 4e5a4b1de0..0000000000 --- a/shared-lib/lib-ot/tests/node/changeset_compose_test.rs +++ /dev/null @@ -1,206 +0,0 @@ -use crate::node::script::NodeScript::*; -use crate::node::script::NodeTest; -use lib_ot::core::{AttributeEntry, Changeset, NodeData, OperationTransform}; -use lib_ot::text_delta::DeltaTextOperationBuilder; - -#[test] -fn changeset_delta_compose_delta_test() { - // delta 1 - let delta_1 = DeltaTextOperationBuilder::new() - .insert("Hello world") - .build(); - let inverted_1 = delta_1.inverted(); - let mut changeset_1 = Changeset::Delta { - delta: delta_1.clone(), - inverted: inverted_1, - }; - - // delta 2 - let delta_2 = DeltaTextOperationBuilder::new() - .retain(delta_1.utf16_target_len) - .insert("!") - .build(); - let inverted_2 = delta_2.inverted(); - let changeset_2 = Changeset::Delta { - delta: delta_2, - inverted: inverted_2, - }; - - // compose - changeset_1.compose(&changeset_2).unwrap(); - - if let Changeset::Delta { delta, inverted } = changeset_1 { - assert_eq!(delta.content().unwrap(), "Hello world!"); - let new_delta = delta.compose(&inverted).unwrap(); - assert_eq!(new_delta.content().unwrap(), ""); - } -} - -#[test] -fn operation_compose_delta_changeset_then_invert_test() { - let delta = DeltaTextOperationBuilder::new() - .insert("Hello world") - .build(); - let inverted = delta.inverted(); - let changeset = Changeset::Delta { - delta: delta.clone(), - inverted: inverted.clone(), - }; - - let mut test = NodeTest::new(); - let text_node = NodeData::new("text"); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset: changeset.clone(), - }, - AssertNodeDelta { - path: 0.into(), - expected: delta.clone(), - }, - UpdateBody { - path: 0.into(), - changeset: changeset.inverted(), - }, - AssertNodeDelta { - path: 0.into(), - expected: delta.compose(&inverted).unwrap(), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_compose_multiple_delta_changeset_then_invert_test() { - // delta 1 - let delta_1 = DeltaTextOperationBuilder::new() - .insert("Hello world") - .build(); - let inverted_1 = delta_1.inverted(); - let changeset_1 = Changeset::Delta { - delta: delta_1.clone(), - inverted: inverted_1, - }; - - // delta 2 - let delta_2 = DeltaTextOperationBuilder::new() - .retain(delta_1.utf16_target_len) - .insert("!") - .build(); - let inverted_2 = delta_2.inverted(); - let changeset_2 = Changeset::Delta { - delta: delta_2.clone(), - inverted: inverted_2, - }; - - // delta 3 - let delta_3 = DeltaTextOperationBuilder::new() - .retain(delta_2.utf16_target_len) - .insert("AppFlowy") - .build(); - let inverted_3 = delta_3.inverted(); - let changeset_3 = Changeset::Delta { - delta: delta_3.clone(), - inverted: inverted_3, - }; - - let mut test = NodeTest::new(); - let text_node = NodeData::new("text"); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset: changeset_1.clone(), - }, - UpdateBody { - path: 0.into(), - changeset: changeset_2.clone(), - }, - UpdateBody { - path: 0.into(), - changeset: changeset_3.clone(), - }, - AssertNodeDelta { - path: 0.into(), - expected: delta_1 - .compose(&delta_2) - .unwrap() - .compose(&delta_3) - .unwrap(), - }, - UpdateBody { - path: 0.into(), - changeset: changeset_3.inverted(), - }, - AssertNodeDeltaContent { - path: 0.into(), - expected: r#"Hello world!"#, - }, - UpdateBody { - path: 0.into(), - changeset: changeset_2.inverted(), - }, - AssertNodeDeltaContent { - path: 0.into(), - expected: r#"Hello world"#, - }, - UpdateBody { - path: 0.into(), - changeset: changeset_1.inverted(), - }, - AssertNodeDeltaContent { - path: 0.into(), - expected: r#""#, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -#[should_panic] -fn changeset_delta_compose_attributes_test() { - // delta 1 - let delta = DeltaTextOperationBuilder::new() - .insert("Hello world") - .build(); - let inverted = delta.inverted(); - let mut delta_changeset = Changeset::Delta { delta, inverted }; - - // attributes - let attribute_changeset = Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }; - - // compose - delta_changeset.compose(&attribute_changeset).unwrap(); -} - -#[test] -fn changeset_attributes_compose_attributes_test() { - // attributes - let mut changeset_1 = Changeset::Attributes { - new: AttributeEntry::new("bold", true).into(), - old: Default::default(), - }; - - let changeset_2 = Changeset::Attributes { - new: AttributeEntry::new("Italic", true).into(), - old: Default::default(), - }; - // compose - changeset_1.compose(&changeset_2).unwrap(); - - if let Changeset::Attributes { new, old: _ } = changeset_1 { - assert_eq!(new, AttributeEntry::new("Italic", true).into()); - } -} diff --git a/shared-lib/lib-ot/tests/node/mod.rs b/shared-lib/lib-ot/tests/node/mod.rs deleted file mode 100644 index 904f44f4d8..0000000000 --- a/shared-lib/lib-ot/tests/node/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -mod changeset_compose_test; -mod operation_attribute_test; -mod operation_compose_test; -mod operation_delete_test; -mod operation_delta_test; -mod operation_insert_test; -mod script; -mod serde_test; -mod transaction_compose_test; -mod tree_test; diff --git a/shared-lib/lib-ot/tests/node/operation_attribute_test.rs b/shared-lib/lib-ot/tests/node/operation_attribute_test.rs deleted file mode 100644 index 80f44348eb..0000000000 --- a/shared-lib/lib-ot/tests/node/operation_attribute_test.rs +++ /dev/null @@ -1,64 +0,0 @@ -use crate::node::script::NodeScript::*; -use crate::node::script::NodeTest; -use lib_ot::core::{AttributeEntry, AttributeValue, Changeset, NodeData}; - -#[test] -fn operation_update_attribute_with_float_value_test() { - let mut test = NodeTest::new(); - let text_node = NodeData::new("text"); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset: Changeset::Attributes { - new: AttributeEntry::new("value", 12.2).into(), - old: Default::default(), - }, - }, - AssertNodeAttributes { - path: 0.into(), - expected: r#"{"value":12.2}"#, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_update_attribute_with_negative_value_test() { - let mut test = NodeTest::new(); - let text_node = NodeData::new("text"); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset: Changeset::Attributes { - new: AttributeEntry::new("value", -12.2).into(), - old: Default::default(), - }, - }, - AssertNodeAttributes { - path: 0.into(), - expected: r#"{"value":-12.2}"#, - }, - UpdateBody { - path: 0.into(), - changeset: Changeset::Attributes { - new: AttributeEntry::new("value", AttributeValue::from_int(-12)).into(), - old: Default::default(), - }, - }, - AssertNodeAttributes { - path: 0.into(), - expected: r#"{"value":-12}"#, - }, - ]; - test.run_scripts(scripts); -} diff --git a/shared-lib/lib-ot/tests/node/operation_compose_test.rs b/shared-lib/lib-ot/tests/node/operation_compose_test.rs deleted file mode 100644 index c2bfd0d7c2..0000000000 --- a/shared-lib/lib-ot/tests/node/operation_compose_test.rs +++ /dev/null @@ -1,135 +0,0 @@ -use lib_ot::core::{Changeset, NodeOperation}; - -#[test] -fn operation_insert_compose_delta_update_test() { - let insert_operation = NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }; - - let update_operation = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Delta { - delta: Default::default(), - inverted: Default::default(), - }, - }; - - assert!(insert_operation.can_compose(&update_operation)) -} - -#[test] -fn operation_insert_compose_attribute_update_test() { - let insert_operation = NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }; - - let update_operation = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - - assert!(!insert_operation.can_compose(&update_operation)) -} -#[test] -fn operation_insert_compose_update_with_diff_path_test() { - let insert_operation = NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }; - - let update_operation = NodeOperation::Update { - path: 1.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - - assert!(!insert_operation.can_compose(&update_operation)) -} - -#[test] -fn operation_insert_compose_insert_operation_test() { - let insert_operation = NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }; - - assert!(!insert_operation.can_compose(&NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }),) -} - -#[test] -fn operation_update_compose_insert_operation_test() { - let update_operation = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - - assert!(!update_operation.can_compose(&NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - })) -} -#[test] -fn operation_update_compose_update_test() { - let update_operation_1 = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - let update_operation_2 = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - - assert!(update_operation_1.can_compose(&update_operation_2)); -} -#[test] -fn operation_update_compose_update_with_diff_path_test() { - let update_operation_1 = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - let update_operation_2 = NodeOperation::Update { - path: 1.into(), - changeset: Changeset::Attributes { - new: Default::default(), - old: Default::default(), - }, - }; - - assert!(!update_operation_1.can_compose(&update_operation_2)); -} - -#[test] -fn operation_insert_compose_insert_test() { - let insert_operation_1 = NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }; - let insert_operation_2 = NodeOperation::Insert { - path: 0.into(), - nodes: vec![], - }; - - assert!(!insert_operation_1.can_compose(&insert_operation_2)); -} diff --git a/shared-lib/lib-ot/tests/node/operation_delete_test.rs b/shared-lib/lib-ot/tests/node/operation_delete_test.rs deleted file mode 100644 index b42fdd8927..0000000000 --- a/shared-lib/lib-ot/tests/node/operation_delete_test.rs +++ /dev/null @@ -1,180 +0,0 @@ -use crate::node::script::NodeScript::*; -use crate::node::script::NodeTest; - -use lib_ot::core::{Changeset, NodeData, NodeDataBuilder}; - -#[test] -fn operation_delete_nested_node_test() { - let mut test = NodeTest::new(); - let image_a = NodeData::new("image_a"); - let image_b = NodeData::new("image_b"); - - let video_a = NodeData::new("video_a"); - let video_b = NodeData::new("video_b"); - - let image_1 = NodeDataBuilder::new("image_1") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let video_1 = NodeDataBuilder::new("video_1") - .add_node_data(video_a.clone()) - .add_node_data(video_b) - .build(); - - let text_node_1 = NodeDataBuilder::new("text_1") - .add_node_data(image_1) - .add_node_data(video_1.clone()) - .build(); - - let image_2 = NodeDataBuilder::new("image_2") - .add_node_data(image_a) - .add_node_data(image_b.clone()) - .build(); - let text_node_2 = NodeDataBuilder::new("text_2") - .add_node_data(image_2) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: text_node_2, - rev_id: 2, - }, - // 0:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - // 1:video_1 - // 0:video_a - // 1:video_b - // 1:text_2 - // 0:image_2 - // 0:image_a - // 1:image_b - DeleteNode { - path: vec![0, 0, 0].into(), - rev_id: 3, - }, - AssertNode { - path: vec![0, 0, 0].into(), - expected: Some(image_b), - }, - AssertNode { - path: vec![0, 1].into(), - expected: Some(video_1), - }, - DeleteNode { - path: vec![0, 1, 1].into(), - rev_id: 4, - }, - AssertNode { - path: vec![0, 1, 0].into(), - expected: Some(video_a), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_delete_node_with_revision_conflict_test() { - let mut test = NodeTest::new(); - let text_1 = NodeDataBuilder::new("text_1").build(); - let text_2 = NodeDataBuilder::new("text_2").build(); - let text_3 = NodeDataBuilder::new("text_3").build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_1.clone(), - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: text_2, - rev_id: 2, - }, - // The node's in the tree will be: - // 0: text_1 - // 2: text_2 - // - // The insert action is happened concurrently with the delete action, because they - // share the same rev_id. aka, 3. The delete action is want to delete the node at index 1, - // but it was moved to index 2. - InsertNode { - path: 1.into(), - node_data: text_3.clone(), - rev_id: 3, - }, - // 0: text_1 - // 1: text_3 - // 2: text_2 - // - // The path of the delete action will be transformed to a new path that point to the text_2. - // 1 -> 2 - DeleteNode { - path: 1.into(), - rev_id: 3, - }, - // After perform the delete action, the tree will be: - // 0: text_1 - // 1: text_3 - AssertNumberOfChildrenAtPath { - path: None, - expected: 2, - }, - AssertNode { - path: 0.into(), - expected: Some(text_1), - }, - AssertNode { - path: 1.into(), - expected: Some(text_3), - }, - AssertNode { - path: 2.into(), - expected: None, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_update_node_after_delete_test() { - let mut test = NodeTest::new(); - let text_1 = NodeDataBuilder::new("text_1").build(); - let text_2 = NodeDataBuilder::new("text_2").build(); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: text_2, - rev_id: 2, - }, - DeleteNode { - path: 0.into(), - rev_id: 3, - }, - // The node at path 1 is not exist. The following UpdateBody script will do nothing - AssertNode { - path: 1.into(), - expected: None, - }, - UpdateBody { - path: 1.into(), - changeset: Changeset::Delta { - delta: Default::default(), - inverted: Default::default(), - }, - }, - ]; - test.run_scripts(scripts); -} diff --git a/shared-lib/lib-ot/tests/node/operation_delta_test.rs b/shared-lib/lib-ot/tests/node/operation_delta_test.rs deleted file mode 100644 index 2cf782b76e..0000000000 --- a/shared-lib/lib-ot/tests/node/operation_delta_test.rs +++ /dev/null @@ -1,43 +0,0 @@ -use crate::node::script::NodeScript::{AssertNodeDelta, InsertNode, UpdateBody}; -use crate::node::script::{edit_node_delta, NodeTest}; -use lib_ot::core::NodeDataBuilder; -use lib_ot::text_delta::DeltaTextOperationBuilder; - -#[test] -fn operation_update_delta_test() { - let mut test = NodeTest::new(); - let initial_delta = DeltaTextOperationBuilder::new().build(); - let new_delta = DeltaTextOperationBuilder::new() - .retain(initial_delta.utf16_base_len) - .insert("Hello, world") - .build(); - let (changeset, expected) = edit_node_delta(&initial_delta, new_delta); - let node = NodeDataBuilder::new("text") - .insert_delta(initial_delta.clone()) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset: changeset.clone(), - }, - AssertNodeDelta { - path: 0.into(), - expected, - }, - UpdateBody { - path: 0.into(), - changeset: changeset.inverted(), - }, - AssertNodeDelta { - path: 0.into(), - expected: initial_delta, - }, - ]; - test.run_scripts(scripts); -} diff --git a/shared-lib/lib-ot/tests/node/operation_insert_test.rs b/shared-lib/lib-ot/tests/node/operation_insert_test.rs deleted file mode 100644 index 1192face1e..0000000000 --- a/shared-lib/lib-ot/tests/node/operation_insert_test.rs +++ /dev/null @@ -1,463 +0,0 @@ -use crate::node::script::NodeScript::*; -use crate::node::script::NodeTest; - -use lib_ot::core::{placeholder_node, NodeData, NodeDataBuilder, NodeOperation, Path}; - -#[test] -fn operation_insert_op_transform_test() { - let node_1 = NodeDataBuilder::new("text_1").build(); - let node_2 = NodeDataBuilder::new("text_2").build(); - let op_1 = NodeOperation::Insert { - path: Path(vec![0, 1]), - nodes: vec![node_1], - }; - - let mut insert_2 = NodeOperation::Insert { - path: Path(vec![0, 1]), - nodes: vec![node_2], - }; - - // let mut node_tree = NodeTree::new("root"); - // node_tree.apply_op(insert_1.clone()).unwrap(); - - op_1.transform(&mut insert_2); - let json = serde_json::to_string(&insert_2).unwrap(); - assert_eq!( - json, - r#"{"op":"insert","path":[0,2],"nodes":[{"type":"text_2"}]}"# - ); -} - -#[test] -fn operation_insert_one_level_path_test() { - let node_data_1 = NodeDataBuilder::new("text_1").build(); - let node_data_2 = NodeDataBuilder::new("text_2").build(); - let node_data_3 = NodeDataBuilder::new("text_3").build(); - let node_3 = node_data_3.clone(); - // 0: text_1 - // 1: text_2 - // - // Insert a new operation with rev_id 2 to index 1,but the index was already taken, so - // it needs to be transformed. - // - // 0: text_1 - // 1: text_2 - // 2: text_3 - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_data_1.clone(), - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: node_data_2.clone(), - rev_id: 2, - }, - InsertNode { - path: 1.into(), - node_data: node_data_3.clone(), - rev_id: 2, - }, - AssertNode { - path: 2.into(), - expected: Some(node_3.clone()), - }, - ]; - NodeTest::new().run_scripts(scripts); - - // If the rev_id of the node_data_3 is 3. then the tree will be: - // 0: text_1 - // 1: text_3 - // 2: text_2 - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_data_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: node_data_2, - rev_id: 2, - }, - InsertNode { - path: 1.into(), - node_data: node_data_3, - rev_id: 3, - }, - AssertNode { - path: 1.into(), - expected: Some(node_3), - }, - ]; - NodeTest::new().run_scripts(scripts); -} - -#[test] -fn operation_insert_with_multiple_level_path_test() { - let mut test = NodeTest::new(); - let node_data_1 = NodeDataBuilder::new("text_1") - .add_node_data(NodeDataBuilder::new("text_1_1").build()) - .add_node_data(NodeDataBuilder::new("text_1_2").build()) - .build(); - - let node_data_2 = NodeDataBuilder::new("text_2") - .add_node_data(NodeDataBuilder::new("text_2_1").build()) - .add_node_data(NodeDataBuilder::new("text_2_2").build()) - .build(); - - let node_data_3 = NodeDataBuilder::new("text_3").build(); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_data_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: node_data_2, - rev_id: 2, - }, - InsertNode { - path: 1.into(), - node_data: node_data_3.clone(), - rev_id: 2, - }, - AssertNode { - path: 2.into(), - expected: Some(node_data_3), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_insert_node_out_of_bound_test() { - let mut test = NodeTest::new(); - let image_a = NodeData::new("image_a"); - let image_b = NodeData::new("image_b"); - let image = NodeDataBuilder::new("image_1") - .add_node_data(image_a) - .add_node_data(image_b) - .build(); - let text_node = NodeDataBuilder::new("text_1").add_node_data(image).build(); - let image_c = NodeData::new("image_c"); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node, - rev_id: 1, - }, - // 0:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - InsertNode { - path: vec![0, 0, 3].into(), - node_data: image_c.clone(), - rev_id: 2, - }, - // 0:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - // 2:placeholder node - // 3:image_c - AssertNode { - path: vec![0, 0, 2].into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: vec![0, 0, 3].into(), - expected: Some(image_c), - }, - AssertNode { - path: vec![0, 0, 10].into(), - expected: None, - }, - ]; - test.run_scripts(scripts); -} -#[test] -fn operation_insert_node_when_parent_is_not_exist_test1() { - let mut test = NodeTest::new(); - let text_1 = NodeDataBuilder::new("text_1").build(); - let text_2 = NodeDataBuilder::new("text_2").build(); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_1, - rev_id: 1, - }, - // The node at path 1 is not existing when inserting the text_2 to path 2. - InsertNode { - path: 2.into(), - node_data: text_2.clone(), - rev_id: 2, - }, - AssertNode { - path: 1.into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: 2.into(), - expected: Some(text_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_insert_node_when_parent_is_not_exist_test2() { - let mut test = NodeTest::new(); - let text_1 = NodeDataBuilder::new("text_1").build(); - let text_2 = NodeDataBuilder::new("text_2").build(); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_1, - rev_id: 1, - }, - // The node at path 1 is not existing when inserting the text_2 to path 2. - InsertNode { - path: 3.into(), - node_data: text_2.clone(), - rev_id: 2, - }, - AssertNode { - path: 1.into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: 2.into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: 3.into(), - expected: Some(text_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_insert_node_when_its_parent_is_not_exist_test3() { - let mut test = NodeTest::new(); - let text_1 = NodeDataBuilder::new("text_1").build(); - let text_2 = NodeDataBuilder::new("text_2").build(); - - let mut placeholder_node = placeholder_node(); - placeholder_node.children.push(text_2.clone()); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_1, - rev_id: 1, - }, - // The node at path 1 is not existing when inserting the text_2 to path 2. - InsertNode { - path: vec![1, 0].into(), - node_data: text_2.clone(), - rev_id: 2, - }, - AssertNode { - path: 1.into(), - expected: Some(placeholder_node), - }, - AssertNode { - path: vec![1, 0].into(), - expected: Some(text_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_insert_node_to_the_end_when_parent_is_not_exist_test() { - let mut test = NodeTest::new(); - let node_0 = NodeData::new("0"); - let node_1 = NodeData::new("1"); - let node_1_1 = NodeData::new("1_1"); - let text_node = NodeData::new("text"); - let mut ghost = placeholder_node(); - ghost.children.push(text_node.clone()); - // 0:0 - // 1:1 - // 0:1_1 - // 1:ghost - // 0:text - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_0, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: node_1, - rev_id: 2, - }, - InsertNode { - path: vec![1, 0].into(), - node_data: node_1_1.clone(), - rev_id: 3, - }, - InsertNode { - path: vec![1, 1, 0].into(), - node_data: text_node.clone(), - rev_id: 4, - }, - AssertNode { - path: vec![1, 0].into(), - expected: Some(node_1_1), - }, - AssertNode { - path: vec![1, 1].into(), - expected: Some(ghost), - }, - AssertNode { - path: vec![1, 1, 0].into(), - expected: Some(text_node), - }, - ]; - test.run_scripts(scripts); -} -#[test] -fn operation_insert_node_when_multiple_parent_is_not_exist_test() { - let mut test = NodeTest::new(); - let text_1 = NodeDataBuilder::new("text_1").build(); - let text_2 = NodeDataBuilder::new("text_2").build(); - - let path = vec![1, 0, 0, 0, 0, 0]; - let mut auto_fill_node = placeholder_node(); - let mut iter_node: &mut NodeData = &mut auto_fill_node; - let insert_path = path.split_at(1).1; - for (index, _) in insert_path.iter().enumerate() { - if index == insert_path.len() - 1 { - iter_node.children.push(text_2.clone()); - } else { - iter_node.children.push(placeholder_node()); - iter_node = iter_node.children.last_mut().unwrap(); - } - } - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_1, - rev_id: 1, - }, - InsertNode { - path: path.clone().into(), - node_data: text_2.clone(), - rev_id: 2, - }, - AssertNode { - path: vec![1].into(), - expected: Some(auto_fill_node), - }, - AssertNode { - path: path.into(), - expected: Some(text_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_insert_node_when_multiple_parent_is_not_exist_test2() { - let mut test = NodeTest::new(); - // 0:ghost - // 0:ghost - // 1:ghost - // 0:text - let mut text_node_parent = placeholder_node(); - let text_node = NodeDataBuilder::new("text").build(); - text_node_parent.children.push(text_node.clone()); - - let mut ghost = placeholder_node(); - ghost.children.push(placeholder_node()); - ghost.children.push(text_node_parent.clone()); - - let path = vec![1, 1, 0]; - let scripts = vec![ - InsertNode { - path: path.into(), - node_data: text_node.clone(), - rev_id: 1, - }, - // 0:ghost - // 1:ghost - // 0:ghost - // 1:ghost - // 0:text - AssertNode { - path: 0.into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: 1.into(), - expected: Some(ghost), - }, - AssertNumberOfChildrenAtPath { - path: Some(1.into()), - expected: 2, - }, - AssertNode { - path: vec![1, 1].into(), - expected: Some(text_node_parent), - }, - AssertNode { - path: vec![1, 1, 0].into(), - expected: Some(text_node), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn operation_insert_node_when_multiple_parent_is_not_exist_test3() { - let mut test = NodeTest::new(); - let text_node = NodeDataBuilder::new("text").build(); - let path = vec![3, 3, 0]; - let scripts = vec![ - InsertNode { - path: path.clone().into(), - node_data: text_node.clone(), - rev_id: 1, - }, - // 0:ghost - // 1:ghost - // 2:ghost - // 3:ghost - // 0:ghost - // 1:ghost - // 2:ghost - // 3:ghost - // 0:text - AssertNode { - path: 0.into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: 1.into(), - expected: Some(placeholder_node()), - }, - AssertNode { - path: 2.into(), - expected: Some(placeholder_node()), - }, - AssertNumberOfChildrenAtPath { - path: Some(3.into()), - expected: 4, - }, - AssertNode { - path: path.into(), - expected: Some(text_node), - }, - ]; - test.run_scripts(scripts); -} diff --git a/shared-lib/lib-ot/tests/node/script.rs b/shared-lib/lib-ot/tests/node/script.rs deleted file mode 100644 index 2868b83cc3..0000000000 --- a/shared-lib/lib-ot/tests/node/script.rs +++ /dev/null @@ -1,258 +0,0 @@ -#![allow(clippy::all)] -use lib_ot::core::{NodeTreeContext, OperationTransform, Transaction}; -use lib_ot::text_delta::DeltaTextOperationBuilder; -use lib_ot::{ - core::attributes::AttributeHashMap, - core::{Body, Changeset, NodeData, NodeTree, Path, TransactionBuilder}, - text_delta::DeltaTextOperations, -}; -use std::collections::HashMap; - -pub enum NodeScript { - InsertNode { - path: Path, - node_data: NodeData, - rev_id: usize, - }, - InsertNodes { - path: Path, - node_data_list: Vec, - rev_id: usize, - }, - UpdateAttributes { - path: Path, - attributes: AttributeHashMap, - }, - UpdateBody { - path: Path, - changeset: Changeset, - }, - DeleteNode { - path: Path, - rev_id: usize, - }, - DeleteNodes { - path: Path, - node_data_list: Vec, - rev_id: usize, - }, - AssertNumberOfChildrenAtPath { - path: Option, - expected: usize, - }, - AssertNodesAtRoot { - expected: Vec, - }, - #[allow(dead_code)] - AssertNodesAtPath { - path: Path, - expected: Vec, - }, - AssertNode { - path: Path, - expected: Option, - }, - AssertNodeAttributes { - path: Path, - expected: &'static str, - }, - AssertNodeDelta { - path: Path, - expected: DeltaTextOperations, - }, - AssertNodeDeltaContent { - path: Path, - expected: &'static str, - }, - #[allow(dead_code)] - AssertTreeJSON { - expected: String, - }, -} - -pub struct NodeTest { - rev_id: usize, - rev_operations: HashMap, - node_tree: NodeTree, -} - -impl NodeTest { - pub fn new() -> Self { - Self { - rev_id: 0, - rev_operations: HashMap::new(), - node_tree: NodeTree::new(NodeTreeContext::default()), - } - } - - pub fn run_scripts(&mut self, scripts: Vec) { - for script in scripts { - self.run_script(script); - } - } - - pub fn run_script(&mut self, script: NodeScript) { - match script { - NodeScript::InsertNode { - path, - node_data: node, - rev_id, - } => { - let mut transaction = TransactionBuilder::new() - .insert_node_at_path(path, node) - .build(); - self.transform_transaction_if_need(&mut transaction, rev_id); - self.apply_transaction(transaction); - }, - NodeScript::InsertNodes { - path, - node_data_list, - rev_id, - } => { - let mut transaction = TransactionBuilder::new() - .insert_nodes_at_path(path, node_data_list) - .build(); - self.transform_transaction_if_need(&mut transaction, rev_id); - self.apply_transaction(transaction); - }, - NodeScript::UpdateAttributes { path, attributes } => { - let node = self.node_tree.get_node_data_at_path(&path).unwrap(); - let transaction = TransactionBuilder::new() - .update_node_at_path( - &path, - Changeset::Attributes { - new: attributes, - old: node.attributes, - }, - ) - .build(); - self.apply_transaction(transaction); - }, - NodeScript::UpdateBody { path, changeset } => { - // - let transaction = TransactionBuilder::new() - .update_node_at_path(&path, changeset) - .build(); - self.apply_transaction(transaction); - }, - NodeScript::DeleteNode { path, rev_id } => { - let mut transaction = TransactionBuilder::new() - .delete_node_at_path(&self.node_tree, &path) - .build(); - self.transform_transaction_if_need(&mut transaction, rev_id); - self.apply_transaction(transaction); - }, - NodeScript::DeleteNodes { - path, - node_data_list, - rev_id, - } => { - let mut transaction = TransactionBuilder::new() - .delete_nodes_at_path(&self.node_tree, &path, node_data_list.len()) - .build(); - self.transform_transaction_if_need(&mut transaction, rev_id); - self.apply_transaction(transaction); - }, - NodeScript::AssertNode { path, expected } => { - let node = self.node_tree.get_node_data_at_path(&path); - assert_eq!(node, expected.map(|e| e.into())); - }, - NodeScript::AssertNodeAttributes { path, expected } => { - let node = self.node_tree.get_node_data_at_path(&path).unwrap(); - assert_eq!(node.attributes.to_json().unwrap(), expected); - }, - NodeScript::AssertNumberOfChildrenAtPath { path, expected } => match path { - None => { - let len = self.node_tree.number_of_children(None); - assert_eq!(len, expected) - }, - Some(path) => { - let node_id = self.node_tree.node_id_at_path(path).unwrap(); - let len = self.node_tree.number_of_children(Some(node_id)); - assert_eq!(len, expected) - }, - }, - NodeScript::AssertNodesAtRoot { expected } => { - let nodes = self.node_tree.get_node_data_at_root().unwrap().children; - assert_eq!(nodes, expected) - }, - NodeScript::AssertNodesAtPath { path, expected } => { - let nodes = self - .node_tree - .get_node_data_at_path(&path) - .unwrap() - .children; - assert_eq!(nodes, expected) - }, - NodeScript::AssertNodeDelta { path, expected } => { - let node = self.node_tree.get_node_at_path(&path).unwrap(); - if let Body::Delta(delta) = node.body.clone() { - debug_assert_eq!(delta, expected); - } else { - panic!("Node body type not match, expect Delta"); - } - }, - NodeScript::AssertNodeDeltaContent { path, expected } => { - let node = self.node_tree.get_node_at_path(&path).unwrap(); - if let Body::Delta(delta) = node.body.clone() { - debug_assert_eq!(delta.content().unwrap(), expected); - } else { - panic!("Node body type not match, expect Delta"); - } - }, - NodeScript::AssertTreeJSON { expected } => { - let json = serde_json::to_string(&self.node_tree).unwrap(); - assert_eq!(json, expected) - }, - } - } - - fn apply_transaction(&mut self, transaction: Transaction) { - self.rev_id += 1; - self.rev_operations.insert(self.rev_id, transaction.clone()); - self.node_tree.apply_transaction(transaction).unwrap(); - } - - fn transform_transaction_if_need(&mut self, transaction: &mut Transaction, rev_id: usize) { - if self.rev_id >= rev_id { - for rev_id in rev_id..=self.rev_id { - let old_transaction = self.rev_operations.get(&rev_id).unwrap(); - *transaction = old_transaction.transform(transaction).unwrap(); - } - } - } -} - -pub fn edit_node_delta( - delta: &DeltaTextOperations, - new_delta: DeltaTextOperations, -) -> (Changeset, DeltaTextOperations) { - let inverted = new_delta.invert(&delta); - let expected = delta.compose(&new_delta).unwrap(); - let changeset = Changeset::Delta { - delta: new_delta.clone(), - inverted: inverted.clone(), - }; - (changeset, expected) -} - -pub fn make_node_delta_changeset( - initial_content: &str, - insert_str: &str, -) -> (DeltaTextOperations, Changeset, DeltaTextOperations) { - let initial_content = initial_content.to_owned(); - let initial_delta = DeltaTextOperationBuilder::new() - .insert(&initial_content) - .build(); - let delta = DeltaTextOperationBuilder::new() - .retain(initial_content.len()) - .insert(insert_str) - .build(); - let inverted = delta.invert(&initial_delta); - let expected = initial_delta.compose(&delta).unwrap(); - let changeset = Changeset::Delta { - delta: delta.clone(), - inverted: inverted.clone(), - }; - (initial_delta, changeset, expected) -} diff --git a/shared-lib/lib-ot/tests/node/serde_test.rs b/shared-lib/lib-ot/tests/node/serde_test.rs deleted file mode 100644 index 0d781c393d..0000000000 --- a/shared-lib/lib-ot/tests/node/serde_test.rs +++ /dev/null @@ -1,157 +0,0 @@ -use lib_ot::core::{ - AttributeBuilder, Changeset, NodeData, NodeDataBuilder, NodeOperation, NodeTree, Path, -}; -use lib_ot::text_delta::DeltaTextOperationBuilder; - -#[test] -fn operation_insert_node_serde_test() { - let insert = NodeOperation::Insert { - path: Path(vec![0, 1]), - nodes: vec![NodeData::new("text".to_owned())], - }; - let result = serde_json::to_string(&insert).unwrap(); - assert_eq!( - result, - r#"{"op":"insert","path":[0,1],"nodes":[{"type":"text"}]}"# - ); -} - -#[test] -fn operation_insert_node_with_children_serde_test() { - let node = NodeDataBuilder::new("text") - .add_node_data(NodeData::new("sub_text".to_owned())) - .build(); - - let insert = NodeOperation::Insert { - path: Path(vec![0, 1]), - nodes: vec![node], - }; - assert_eq!( - serde_json::to_string(&insert).unwrap(), - r#"{"op":"insert","path":[0,1],"nodes":[{"type":"text","children":[{"type":"sub_text"}]}]}"# - ); -} - -#[test] -fn operation_update_node_attributes_serde_test() { - let operation = NodeOperation::Update { - path: Path(vec![0, 1]), - changeset: Changeset::Attributes { - new: AttributeBuilder::new().insert("bold", true).build(), - old: AttributeBuilder::new().insert("bold", false).build(), - }, - }; - - let result = serde_json::to_string(&operation).unwrap(); - assert_eq!( - result, - r#"{"op":"update","path":[0,1],"changeset":{"attributes":{"new":{"bold":true},"old":{"bold":false}}}}"# - ); -} - -#[test] -fn operation_update_node_body_serialize_test() { - let delta = DeltaTextOperationBuilder::new() - .insert("AppFlowy...") - .build(); - let inverted = delta.invert_str(""); - let changeset = Changeset::Delta { delta, inverted }; - let insert = NodeOperation::Update { - path: Path(vec![0, 1]), - changeset, - }; - let result = serde_json::to_string(&insert).unwrap(); - assert_eq!( - result, - r#"{"op":"update","path":[0,1],"changeset":{"delta":{"delta":[{"insert":"AppFlowy..."}],"inverted":[{"delete":11}]}}}"# - ); -} - -#[test] -fn operation_update_node_body_deserialize_test() { - let json_1 = r#"{"op":"update","path":[0,1],"changeset":{"delta":{"delta":[{"insert":"AppFlowy..."}],"inverted":[{"delete":11}]}}}"#; - let operation: NodeOperation = serde_json::from_str(json_1).unwrap(); - let json_2 = serde_json::to_string(&operation).unwrap(); - assert_eq!(json_1, json_2); -} - -// #[test] -// fn transaction_serialize_test() { -// let insert = NodeOperation::Insert { -// path: Path(vec![0, 1]), -// nodes: vec![NodeData::new("text".to_owned())], -// }; -// let transaction = Transaction::from_operations(vec![insert]); -// let json = serde_json::to_string(&transaction).unwrap(); -// assert_eq!( -// json, -// r#"{"operations":[{"op":"insert","path":[0,1],"nodes":[{"type":"text"}]}]}"# -// ); -// } -// -// #[test] -// fn transaction_deserialize_test() { -// let json = r#"{"operations":[{"op":"insert","path":[0,1],"nodes":[{"type":"text"}]}],"TextSelection":{"before_selection":{"start":{"path":[],"offset":0},"end":{"path":[],"offset":0}},"after_selection":{"start":{"path":[],"offset":0},"end":{"path":[],"offset":0}}}}"#; -// -// let transaction: Transaction = serde_json::from_str(json).unwrap(); -// assert_eq!(transaction.operations.len(), 1); -// } -// -// #[test] -// fn node_tree_deserialize_test() { -// let tree: NodeTree = serde_json::from_str(TREE_JSON).unwrap(); -// assert_eq!(tree.number_of_children(None), 1); -// } - -#[test] -fn node_tree_serialize_test() { - let tree: NodeTree = serde_json::from_str(TREE_JSON).unwrap(); - let json = serde_json::to_string_pretty(&tree).unwrap(); - assert_eq!(json, TREE_JSON); -} - -#[test] -fn node_tree_serde_test() { - let tree: NodeTree = serde_json::from_str(TREE_JSON).unwrap(); - let bytes = tree.to_bytes(); - let tree = NodeTree::from_bytes(&bytes).unwrap(); - assert_eq!(bytes, tree.to_bytes()); -} - -#[allow(dead_code)] -const TREE_JSON: &str = r#"{ - "type": "editor", - "children": [ - { - "type": "image", - "attributes": { - "image_src": "https://s1.ax1x.com/2022/08/26/v2sSbR.jpg" - } - }, - { - "type": "text", - "attributes": { - "heading": "h1" - }, - "body": { - "delta": [ - { - "insert": "πŸ‘‹ " - }, - { - "insert": "Welcome to ", - "attributes": { - "href": "appflowy.io" - } - }, - { - "insert": "AppFlowy Editor", - "attributes": { - "italic": true - } - } - ] - } - } - ] -}"#; diff --git a/shared-lib/lib-ot/tests/node/transaction_compose_test.rs b/shared-lib/lib-ot/tests/node/transaction_compose_test.rs deleted file mode 100644 index 6d1c386ee7..0000000000 --- a/shared-lib/lib-ot/tests/node/transaction_compose_test.rs +++ /dev/null @@ -1,121 +0,0 @@ -use crate::node::script::{edit_node_delta, make_node_delta_changeset}; -use lib_ot::core::{ - AttributeEntry, Changeset, NodeDataBuilder, NodeOperation, Transaction, TransactionBuilder, -}; -use lib_ot::text_delta::DeltaTextOperationBuilder; - -#[test] -fn transaction_compose_update_after_insert_test() { - let (initial_delta, changeset, _) = make_node_delta_changeset("Hello", " world"); - let node_data = NodeDataBuilder::new("text") - .insert_delta(initial_delta) - .build(); - - // Modify the same path, the operations will be merged after composing if possible. - let mut transaction_a = TransactionBuilder::new() - .insert_node_at_path(0, node_data) - .build(); - let transaction_b = TransactionBuilder::new() - .update_node_at_path(0, changeset) - .build(); - transaction_a.compose(transaction_b).unwrap(); - - // The operations are merged into one operation - assert_eq!(transaction_a.operations.len(), 1); - assert_eq!( - transaction_a.to_json().unwrap(), - r#"{"operations":[{"op":"insert","path":[0],"nodes":[{"type":"text","body":{"delta":[{"insert":"Hello world"}]}}]}]}"# - ); -} - -#[test] -fn transaction_compose_multiple_update_test() { - let (initial_delta, changeset_1, final_delta) = make_node_delta_changeset("Hello", " world"); - let mut transaction = TransactionBuilder::new() - .insert_node_at_path( - 0, - NodeDataBuilder::new("text") - .insert_delta(initial_delta) - .build(), - ) - .build(); - let (changeset_2, _) = edit_node_delta( - &final_delta, - DeltaTextOperationBuilder::new() - .retain(final_delta.utf16_target_len) - .insert("😁") - .build(), - ); - - let mut other_transaction = Transaction::new(); - - // the following two update operations will be merged into one - let update_1 = TransactionBuilder::new() - .update_node_at_path(0, changeset_1) - .build(); - other_transaction.compose(update_1).unwrap(); - - let update_2 = TransactionBuilder::new() - .update_node_at_path(0, changeset_2) - .build(); - other_transaction.compose(update_2).unwrap(); - - let inverted = Transaction::from_operations(other_transaction.operations.inverted()); - - // the update operation will be merged into insert operation - transaction.compose(other_transaction).unwrap(); - assert_eq!(transaction.operations.len(), 1); - assert_eq!( - transaction.to_json().unwrap(), - r#"{"operations":[{"op":"insert","path":[0],"nodes":[{"type":"text","body":{"delta":[{"insert":"Hello world😁"}]}}]}]}"# - ); - - transaction.compose(inverted).unwrap(); - assert_eq!( - transaction.to_json().unwrap(), - r#"{"operations":[{"op":"insert","path":[0],"nodes":[{"type":"text","body":{"delta":[{"insert":"Hello"}]}}]}]}"# - ); -} - -#[test] -fn transaction_compose_multiple_attribute_test() { - let delta = DeltaTextOperationBuilder::new().insert("Hello").build(); - let node = NodeDataBuilder::new("text").insert_delta(delta).build(); - - let insert_operation = NodeOperation::Insert { - path: 0.into(), - nodes: vec![node], - }; - - let mut transaction = Transaction::new(); - transaction.push_operation(insert_operation); - - let new_attribute = AttributeEntry::new("subtype", "bulleted-list"); - let update_operation = NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: new_attribute.clone().into(), - old: Default::default(), - }, - }; - transaction.push_operation(update_operation); - assert_eq!( - transaction.to_json().unwrap(), - r#"{"operations":[{"op":"insert","path":[0],"nodes":[{"type":"text","body":{"delta":[{"insert":"Hello"}]}}]},{"op":"update","path":[0],"changeset":{"attributes":{"new":{"subtype":"bulleted-list"},"old":{}}}}]}"# - ); - - let old_attribute = new_attribute; - let new_attribute = AttributeEntry::new("subtype", "number-list"); - transaction.push_operation(NodeOperation::Update { - path: 0.into(), - changeset: Changeset::Attributes { - new: new_attribute.into(), - old: old_attribute.into(), - }, - }); - - assert_eq!( - transaction.to_json().unwrap(), - r#"{"operations":[{"op":"insert","path":[0],"nodes":[{"type":"text","body":{"delta":[{"insert":"Hello"}]}}]},{"op":"update","path":[0],"changeset":{"attributes":{"new":{"subtype":"number-list"},"old":{"subtype":"bulleted-list"}}}}]}"# - ); -} diff --git a/shared-lib/lib-ot/tests/node/tree_test.rs b/shared-lib/lib-ot/tests/node/tree_test.rs deleted file mode 100644 index 237c311cda..0000000000 --- a/shared-lib/lib-ot/tests/node/tree_test.rs +++ /dev/null @@ -1,769 +0,0 @@ -use crate::node::script::NodeScript::*; -use crate::node::script::{make_node_delta_changeset, NodeTest}; - -use lib_ot::core::{NodeData, NodeDataBuilder, Path}; - -#[test] -fn node_insert_test() { - let mut test = NodeTest::new(); - let node_data = NodeData::new("text"); - let path: Path = vec![0].into(); - let scripts = vec![ - InsertNode { - path: path.clone(), - node_data: node_data.clone(), - rev_id: 1, - }, - AssertNode { - path, - expected: Some(node_data), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -#[should_panic] -fn node_insert_with_empty_path_test() { - let mut test = NodeTest::new(); - let scripts = vec![InsertNode { - path: vec![].into(), - node_data: NodeData::new("text"), - rev_id: 1, - }]; - test.run_scripts(scripts); -} - -#[test] -fn tree_insert_multiple_nodes_at_root_path_test() { - let mut test = NodeTest::new(); - let node_1 = NodeData::new("a"); - let node_2 = NodeData::new("b"); - let node_3 = NodeData::new("c"); - let node_data_list = vec![node_1, node_2, node_3]; - let path: Path = vec![0].into(); - - // Insert three nodes under the root - let scripts = vec![ - // 0:a - // 1:b - // 2:c - InsertNodes { - path, - node_data_list: node_data_list.clone(), - rev_id: 1, - }, - AssertNodesAtRoot { - expected: node_data_list, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn tree_insert_multiple_nodes_at_root_path_test2() { - let mut test = NodeTest::new(); - let node_1 = NodeData::new("a"); - let node_2 = NodeData::new("b"); - let node_3 = NodeData::new("c"); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_1.clone(), - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: node_2.clone(), - rev_id: 2, - }, - InsertNode { - path: 2.into(), - node_data: node_3.clone(), - rev_id: 3, - }, - // 0:a - // 1:b - // 2:c - AssertNode { - path: 0.into(), - expected: Some(node_1), - }, - AssertNode { - path: 1.into(), - expected: Some(node_2), - }, - AssertNode { - path: 2.into(), - expected: Some(node_3), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_insert_node_with_children_test() { - let mut test = NodeTest::new(); - let image_1 = NodeData::new("image_a"); - let image_2 = NodeData::new("image_b"); - - let image = NodeDataBuilder::new("image") - .add_node_data(image_1.clone()) - .add_node_data(image_2.clone()) - .build(); - let node_data = NodeDataBuilder::new("text") - .add_node_data(image.clone()) - .build(); - let path: Path = 0.into(); - let scripts = vec![ - InsertNode { - path: path.clone(), - node_data: node_data.clone(), - rev_id: 1, - }, - // 0:text - // 0:image - // 0:image_1 - // 1:image_2 - AssertNode { - path, - expected: Some(node_data), - }, - AssertNode { - path: vec![0, 0].into(), - expected: Some(image), - }, - AssertNode { - path: vec![0, 0, 0].into(), - expected: Some(image_1), - }, - AssertNode { - path: vec![0, 0, 1].into(), - expected: Some(image_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_insert_node_in_ordered_nodes_test() { - let mut test = NodeTest::new(); - let path_1: Path = 0.into(); - let node_1 = NodeData::new("text_1"); - - let path_2: Path = 1.into(); - let node_2_1 = NodeData::new("text_2_1"); - let node_2_2 = NodeData::new("text_2_2"); - - let path_3: Path = 2.into(); - let node_3 = NodeData::new("text_3"); - - let scripts = vec![ - InsertNode { - path: path_1.clone(), - node_data: node_1.clone(), - rev_id: 1, - }, - InsertNode { - path: path_2.clone(), - node_data: node_2_1.clone(), - rev_id: 2, - }, - InsertNode { - path: path_3.clone(), - node_data: node_3, - rev_id: 3, - }, - // 0:text_1 - // 1:text_2_1 - // 2:text_3 - InsertNode { - path: path_2.clone(), - node_data: node_2_2.clone(), - rev_id: 4, - }, - // 0:text_1 - // 1:text_2_2 - // 2:text_2_1 - // 3:text_3 - AssertNode { - path: path_1, - expected: Some(node_1), - }, - AssertNode { - path: path_2, - expected: Some(node_2_2), - }, - AssertNode { - path: path_3, - expected: Some(node_2_1), - }, - AssertNumberOfChildrenAtPath { - path: None, - expected: 4, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_insert_nested_nodes_test() { - let mut test = NodeTest::new(); - let node_data_1_1 = NodeDataBuilder::new("text_1_1").build(); - let node_data_1_2 = NodeDataBuilder::new("text_1_2").build(); - let node_data_1 = NodeDataBuilder::new("text_1") - .add_node_data(node_data_1_1.clone()) - .add_node_data(node_data_1_2.clone()) - .build(); - - let node_data_2_1 = NodeDataBuilder::new("text_2_1").build(); - let node_data_2_2 = NodeDataBuilder::new("text_2_2").build(); - let node_data_2 = NodeDataBuilder::new("text_2") - .add_node_data(node_data_2_1.clone()) - .add_node_data(node_data_2_2.clone()) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_data_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: node_data_2, - rev_id: 2, - }, - // the tree will be: - // 0:text_1 - // 0:text_1_1 - // 1:text_1_2 - // 1:text_2 - // 0:text_2_1 - // 1:text_2_2 - AssertNode { - path: vec![0, 0].into(), - expected: Some(node_data_1_1), - }, - AssertNode { - path: vec![0, 1].into(), - expected: Some(node_data_1_2), - }, - AssertNode { - path: vec![1, 0].into(), - expected: Some(node_data_2_1), - }, - AssertNode { - path: vec![1, 1].into(), - expected: Some(node_data_2_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_insert_node_before_existing_nested_nodes_test() { - let mut test = NodeTest::new(); - let node_data_1_1 = NodeDataBuilder::new("text_1_1").build(); - let node_data_1_2 = NodeDataBuilder::new("text_1_2").build(); - let node_data_1 = NodeDataBuilder::new("text_1") - .add_node_data(node_data_1_1.clone()) - .add_node_data(node_data_1_2.clone()) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node_data_1, - rev_id: 1, - }, - // 0:text_1 - // 0:text_1_1 - // 1:text_1_2 - InsertNode { - path: 0.into(), - node_data: NodeDataBuilder::new("text_0").build(), - rev_id: 2, - }, - // 0:text_0 - // 1:text_1 - // 0:text_1_1 - // 1:text_1_2 - AssertNode { - path: vec![1, 0].into(), - expected: Some(node_data_1_1), - }, - AssertNode { - path: vec![1, 1].into(), - expected: Some(node_data_1_2), - }, - ]; - test.run_scripts(scripts); -} -#[test] -fn node_insert_with_attributes_test() { - let mut test = NodeTest::new(); - let path: Path = 0.into(); - let mut inserted_node = NodeData::new("text"); - inserted_node.attributes.insert("bold", true); - inserted_node.attributes.insert("underline", true); - - let scripts = vec![ - InsertNode { - path: path.clone(), - node_data: inserted_node.clone(), - rev_id: 1, - }, - UpdateAttributes { - path: path.clone(), - attributes: inserted_node.attributes.clone(), - }, - AssertNode { - path, - expected: Some(inserted_node), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_delete_test() { - let mut test = NodeTest::new(); - let inserted_node = NodeData::new("text"); - let path: Path = 0.into(); - let scripts = vec![ - InsertNode { - path: path.clone(), - node_data: inserted_node, - rev_id: 1, - }, - DeleteNode { - path: path.clone(), - rev_id: 2, - }, - AssertNode { - path, - expected: None, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn nodes_delete_test() { - let mut test = NodeTest::new(); - let node_1 = NodeData::new("a"); - let node_2 = NodeData::new("b"); - let node_3 = NodeData::new("c"); - let node_data_list = vec![node_1, node_2, node_3]; - let path: Path = 0.into(); - let scripts = vec![ - InsertNodes { - path: path.clone(), - node_data_list: node_data_list.clone(), - rev_id: 1, - }, - DeleteNodes { - path: path.clone(), - node_data_list, - rev_id: 2, - }, - AssertNode { - path: path.clone(), - expected: None, - }, - AssertNode { - path: path.next(), - expected: None, - }, - AssertNode { - path: path.next().next(), - expected: None, - }, - AssertTreeJSON { - expected: r#""""#.to_string(), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_delete_node_from_list_test() { - let mut test = NodeTest::new(); - let image_a = NodeData::new("image_a"); - let image_b = NodeData::new("image_b"); - - let image_1 = NodeDataBuilder::new("image_1") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let text_node_1 = NodeDataBuilder::new("text_1") - .add_node_data(image_1) - .build(); - let image_2 = NodeDataBuilder::new("image_2") - .add_node_data(image_a) - .add_node_data(image_b) - .build(); - let text_node_2 = NodeDataBuilder::new("text_2") - .add_node_data(image_2.clone()) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: text_node_2.clone(), - rev_id: 2, - }, - DeleteNode { - path: 0.into(), - rev_id: 3, - }, - AssertNode { - path: 1.into(), - expected: None, - }, - AssertNode { - path: 0.into(), - expected: Some(text_node_2), - }, - AssertNode { - path: vec![0, 0].into(), - expected: Some(image_2), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_delete_nested_node_test() { - let mut test = NodeTest::new(); - let image_a = NodeData::new("image_a"); - let image_b = NodeData::new("image_b"); - - let image_1 = NodeDataBuilder::new("image_1") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let text_node_1 = NodeDataBuilder::new("text_1") - .add_node_data(image_1) - .build(); - - let image_2 = NodeDataBuilder::new("image_2") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let text_node_2 = NodeDataBuilder::new("text_2") - .add_node_data(image_2) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node_1, - rev_id: 1, - }, - InsertNode { - path: 1.into(), - node_data: text_node_2, - rev_id: 2, - }, - // 0:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - // 1:text_2 - // 0:image_2 - // 0:image_a - // 1:image_b - DeleteNode { - path: vec![0, 0, 0].into(), - rev_id: 3, - }, - // 0:text_1 - // 0:image_1 - // 0:image_b - // 1:text_2 - // 0:image_2 - // 0:image_a - // 1:image_b - AssertNode { - path: vec![0, 0, 0].into(), - expected: Some(image_b.clone()), - }, - DeleteNode { - path: vec![0, 0].into(), - rev_id: 4, - }, - // 0:text_1 - // 1:text_2 - // 0:image_2 - // 0:image_a - // 1:image_b - AssertNumberOfChildrenAtPath { - path: Some(0.into()), - expected: 0, - }, - AssertNode { - path: vec![0].into(), - expected: Some(NodeDataBuilder::new("text_1").build()), - }, - AssertNode { - path: vec![1, 0, 0].into(), - expected: Some(image_a), - }, - AssertNode { - path: vec![1, 0, 1].into(), - expected: Some(image_b), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_delete_children_test() { - let mut test = NodeTest::new(); - let inserted_node = NodeDataBuilder::new("text") - .add_node_data(NodeDataBuilder::new("sub_text_1").build()) - .add_node_data(NodeDataBuilder::new("sub_text_2").build()) - .add_node_data(NodeDataBuilder::new("sub_text_3").build()) - .build(); - - let scripts = vec![ - InsertNode { - path: vec![0].into(), - node_data: inserted_node, - rev_id: 1, - }, - AssertNode { - path: vec![0, 0].into(), - expected: Some(NodeDataBuilder::new("sub_text_1").build()), - }, - AssertNode { - path: vec![0, 1].into(), - expected: Some(NodeDataBuilder::new("sub_text_2").build()), - }, - AssertNode { - path: vec![0, 2].into(), - expected: Some(NodeDataBuilder::new("sub_text_3").build()), - }, - AssertNumberOfChildrenAtPath { - path: Some(Path(vec![0])), - expected: 3, - }, - DeleteNode { - path: vec![0, 0].into(), - rev_id: 2, - }, - AssertNode { - path: vec![0, 0].into(), - expected: Some(NodeDataBuilder::new("sub_text_2").build()), - }, - AssertNumberOfChildrenAtPath { - path: Some(Path(vec![0])), - expected: 2, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_reorder_sub_nodes_test() { - let mut test = NodeTest::new(); - let image_a = NodeData::new("image_a"); - let image_b = NodeData::new("image_b"); - - let child_1 = NodeDataBuilder::new("image_1") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let text_node_1 = NodeDataBuilder::new("text_1") - .add_node_data(child_1) - .build(); - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node_1, - rev_id: 1, - }, - // 0:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - DeleteNode { - path: vec![0, 0, 0].into(), - rev_id: 2, - }, - // 0:text_1 - // 0:image_1 - // 0:image_b - InsertNode { - path: vec![0, 0, 1].into(), - node_data: image_a.clone(), - rev_id: 3, - }, - // 0:text_1 - // 0:image_1 - // 0:image_b - // 1:image_a - AssertNode { - path: vec![0, 0, 0].into(), - expected: Some(image_b), - }, - AssertNode { - path: vec![0, 0, 1].into(), - expected: Some(image_a), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_reorder_nodes_test() { - let mut test = NodeTest::new(); - let image_a = NodeData::new("image_a"); - let image_b = NodeData::new("image_b"); - - let image_1 = NodeDataBuilder::new("image_1") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let text_node_1 = NodeDataBuilder::new("text_1") - .add_node_data(image_1.clone()) - .build(); - - let image_2 = NodeDataBuilder::new("image_2") - .add_node_data(image_a.clone()) - .add_node_data(image_b.clone()) - .build(); - let text_node_2 = NodeDataBuilder::new("text_2") - .add_node_data(image_2.clone()) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: text_node_1.clone(), - rev_id: 1, - }, - InsertNode { - path: 0.into(), - node_data: text_node_2.clone(), - rev_id: 1, - }, - // 0:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - // 1:text_2 - // 0:image_2 - // 0:image_a - // 1:image_b - DeleteNode { - path: vec![0].into(), - rev_id: 3, - }, - AssertNode { - path: vec![0].into(), - expected: Some(text_node_2.clone()), - }, - InsertNode { - path: vec![1].into(), - node_data: text_node_1.clone(), - rev_id: 4, - }, - // 0:text_2 - // 0:image_2 - // 0:image_a - // 1:image_b - // 1:text_1 - // 0:image_1 - // 0:image_a - // 1:image_b - AssertNode { - path: vec![0].into(), - expected: Some(text_node_2), - }, - AssertNode { - path: vec![0, 0].into(), - expected: Some(image_2), - }, - AssertNode { - path: vec![0, 0, 0].into(), - expected: Some(image_a), - }, - AssertNode { - path: vec![1].into(), - expected: Some(text_node_1), - }, - AssertNode { - path: vec![1, 0].into(), - expected: Some(image_1), - }, - AssertNode { - path: vec![1, 0, 1].into(), - expected: Some(image_b), - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_update_body_test() { - let mut test = NodeTest::new(); - let (initial_delta, changeset, expected) = make_node_delta_changeset("Hello", "AppFlowy"); - let node = NodeDataBuilder::new("text") - .insert_delta(initial_delta) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset, - }, - AssertNodeDelta { - path: 0.into(), - expected, - }, - ]; - test.run_scripts(scripts); -} - -#[test] -fn node_inverted_body_changeset_test() { - let mut test = NodeTest::new(); - let (initial_delta, changeset, _expected) = make_node_delta_changeset("Hello", "AppFlowy"); - let node = NodeDataBuilder::new("text") - .insert_delta(initial_delta.clone()) - .build(); - - let scripts = vec![ - InsertNode { - path: 0.into(), - node_data: node, - rev_id: 1, - }, - UpdateBody { - path: 0.into(), - changeset: changeset.clone(), - }, - UpdateBody { - path: 0.into(), - changeset: changeset.inverted(), - }, - AssertNodeDelta { - path: 0.into(), - expected: initial_delta, - }, - ]; - test.run_scripts(scripts); -} diff --git a/shared-lib/rust-toolchain.toml b/shared-lib/rust-toolchain.toml deleted file mode 100644 index f400973ca7..0000000000 --- a/shared-lib/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "1.70" diff --git a/shared-lib/rustfmt.toml b/shared-lib/rustfmt.toml deleted file mode 100644 index 5cb0d67ee5..0000000000 --- a/shared-lib/rustfmt.toml +++ /dev/null @@ -1,12 +0,0 @@ -# https://rust-lang.github.io/rustfmt/?version=master&search= -max_width = 100 -tab_spaces = 2 -newline_style = "Auto" -match_block_trailing_comma = true -use_field_init_shorthand = true -use_try_shorthand = true -reorder_imports = true -reorder_modules = true -remove_nested_parens = true -merge_derives = true -edition = "2021" \ No newline at end of file